Dell H310 MINI Flash to IT Mode for FreeNAS!

Here is the procedure to flash your Dell H310 mini to IT mode so you can use it as a FreeNAS HBA.

Please note I did NOT come up with this method, am just re-sharing the content as it’s been disappearing. For the original PDF see here:

https://mega.nz/#!0wphwQIQ!QC2th7vPOsha5U0Um_8jHieas78KTSb1NcvSJPHZOEs

  1. Add the H310 MINI to your Server
  2. Boot the server go into System Bios Settings | Integrated Devices and set the following
    1. Enabled for Integrated Raid Controller
    2. Disabled for I/OAT DMA Engine
    3. Disabled for SR-IOV Global
  3. Download the ubuntu desktop .iso from the official site which comes with the LIVE CD functionality. I used the 18 LTS image.
    1. https://ubuntu.com/download/desktop
  4. Boot it via virtual cd rom, real cd, or usb.
  5. Run the following in a terminal on the server with the H310 Mini.
    1. sudo su
    2. add-apt-repository universe && apt update -y
    3. apt get install git-core build-essential python3 pciutils p7zip-full -y
  6. Download the file called “8-07-14_MegaCLI.zip” which you can get here: https://mega.nz/#!Yg402KII!HD0_jsAMem99p0KVkXRi8PmR-CkvJTQqonU2fvFzisU

7. After rebooting and using the live Linux image, take note of the current SAS address used by the card. We need to rely on MegaCli:

unzip 8-07-14_MegaCLI.zip

7z x Linux/MegaCli-8.07.14-1.noarch.rpm

7z x MegaCli-8.07.14-1.noarch.cpio

chmod 755 opt/MegaRAID/MegaCli/MegaCli64

opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -a0 | grep SAS\ Address


8. The SAS address is a 16-byte hexadecimal number that will be restored afterwards. Technically, unless there are multiple HBAs in a single system, all with
the same SAS address, it may be left blank (which makes it default to a known value).

/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -a0 | grep SAS\ Address

9. Next, the following software should be fetched and built:

wget https://github.com/exactassembly/meta-xa-stm/raw/master/recipes-support/lsiutil/files/lsiutil-1.72.tar.gz

tar xzf lsiutil-1.72.tar.gz

make -C lsiutil -f Makefile_Linux

Or you can just download it compiled here:

https://mega.nz/#F!kw5n0IaC!TxOcAAQr1tLMxKC-57FrLw

10. Now we also need lsirec.

git clone https://github.com/marcan/lsirec

make -C lsirec

Or you can just download it compiled here: https://mega.nz/#F!AgwVAQaC!cLKncHixJKySk41l2VqoOw

11. Before running the programs just built, it is required to unload the kernel module currently driving the HBA:

rmmod megaraid_sas

If drives are attached to the server via the HBA, this will fail.

12. Hugepages should now be enabled. These will be used to load the IT mode firmware from the host to the card:

echo 16 > /proc/sys/vm/nr_hugepages

13. The card now has to be put in reset mode. For this step, it is required to know its full PCI address. You may use lspci to identify the card:

lspci -nnv | grep H310 -B1

01:00.0 RAID bus controller [0104]: LSI Logic / Symbios Logic MegaRAID SAS 2008 [Falcon] [1000:0073] (rev 03)
Subsystem: Dell PERC H310 Mini Monolithics [1028:1f51]

lsirec/lsirec 0000:01:00.0 unbind

lsirec/lsirec 0000:01:00.0 halt

14. At this point, the SBR should be extracted from the card. The SBR is a 256-byte blob stored onto a serial EEPROM which contains several pieces of
information, most notably how the card should identify itself.

lsirec/lsirec 0000:01:00.0 readsbr H310MM.sbr

15. When flashing to IT mode using the regular utilities, the SBR is erased (typically blanking with the ‘megarec.exe -writesbr 0 sbrempty.bin’ or the ‘sas2flsh.
exe -o -e 7′ command). This is the step that bricks the card, as the server uses the PCI Subsystem Vendor and Product ID loaded from the SBR to checkthe card is allowed or not in the dedicated storage slot. Additionally, the SBR includes checksums, edits should update them as needed or, as we’ll do, a tool can be used:

python3 lsirec/sbrtool.py parse H310MM.sbr H310MM.cfg

16. The H310MM.cfg file should have at least two entries modified, PCIPID should be set to 0x0072 and Interface should be set to 0x00 (these two values
signal that the card is running in IT/IR mode rather than in megaRAID mode).
Note
I’ve chosen to use the freshly dumped H310MM.cfg as the base for the new SBR, as I’ve preferred to be minimal in the changes performed,
given I do not know the meaning of the other fields. It is however possible (and I have tested the result is working) to use the lsirec/sample_sbr
/sbr_dell_h200e_itir.cfg as the base, modifying the SubsysVID and SubsysPID fields to 0x1028 and 0x1f51 respectively. As long as the card
presents the correct SubsysVID and SubsysPID, it will not brick upon reboot. To get the appropriate driver (for megaRAID or IT/IR mode) bound
to the card, the PCIPID and Interface fields have to be set to the values described above.

17. The modified file should be turned back into a binary blob and written to the card’s SBR:

python3 lsirec/sbrtool.py build H310MM.cfg mod_H310MM.sbr

lsirec/lsirec 0000:01:00.0 writesbr mod_H310MM.sbr

Device in MPT mode
Using I2C address 0x54
Using EEPROM type 1
Writing SBR…
SBR written from mod_H310MM.sbr


18. You can check that the card’s PCI ID has been updated via the following command:


lspci -vns 0000:01:00.0 -A intel-conf1 | head -n2


The kernel however hasn’t noticed this and will be updated later.
Now, you’ll want to get the card out from reset mode and instruct it to load the IT mode firmware loaded from the host (rather than the one stored internally)

lsirec/lsirec 0000:01:00.0 hostboot 2118it.bin

19. At this point we can let the kernel know the card has changed, as it is able to operate in IT mode properly as if it had been flashed:

lsirec/lsirec 0000:01:00.0 rescan

20. As the kernel rescans the card, it will also bind the mpt3sas driver to it. This is fine as the next steps, involving actually flashing the firmware to the card to make IT mode persistent, make use of the /dev/mptctl device created by the driver.

lsiutil/lsiutil -e

Note
The card may take some time to be brought up into an operational state. If the lsiutil command does not display any controller, rmmod’ing and
modprobe’ing the mpt3sas driver might get it working, alternatively, rmmod the mpt3sas driver and repeat the lsirec steps with unbind halt
hostboot rescan.

21. Select the adapter, then use option 46 (Upload FLASH section) and then option 5 (Complete – all sections) to make a backup. You’ll be asked for a file on which to store the dump of the flash for safety.


22. The card can then be erased via option 33 (Erase non-volatile adapter storage) and then select in turn option 3 (FLASH) and option 8 (Persistent
manufacturing config pages). Erasing the flash will take a significant amount of time as it’s a sizeable chunk of memory (16 MB). Return to the main menu afterwards.


Now the firmware can be flashed using option 2 (Download firmware – update the FLASH) and provide the full path to the 2118it.bin file.

If you used the MEGA links I provided the 2118it.bin should already be in the lsirec and lsiutil folders.

23. This part isn’t necessary but feel free if you have more than 1 HBA or just want to restore the address.

To restore the SAS Address of the controller, lsiutil should be used after a reboot via option 18 (Change SAS WWID). The restored SAS Address will be
operative after another reboot (as it can be verified via systool -c scsi_host -v host0 — systool is part of the sysfsutils package).

Note
Should you want to boot off a drive attached to the H310MM, you will also have to flash the appropriate bootrom (mptsas2.rom for BIOS,
x64sas2.rom for UEFI). I have not included this step as the most popular reason for cards to be flashed is to be used in PCIe passthrough in
FreeNAS (or related) VMs. In those configurations, the boot drive will be a vmdk. Not flashing the bootrom also helps speed up the server’s boot.

Leave a comment

Exit mobile version