(Courtesy DavidDurlach.com)

LSI Disk Drive Controller Firmware Update (Last updated 2022-08-02.)

Context

After spending well over a full day trying to ("simply" - ha ha ha ha...) update and change the firmware from IR (Integrated RAID) to IT (Initiator Target) mode on an LSI SAS9211-8i SATA card — and finally succeeding (just short of taking my own life out of desperation and despair...) — I wanted to share key items that may help others. (If it does help you, please let me know. I am curious as to whether the significant time to post these tech-tidbits is worth it...)

FYI: I am far from alone in this pain, with comments such as the following being typical:

This document is not exhaustive, and may have errors (hopefully only minor ones, however since I got delayed by several months between writing this and the actual upgrade, certain memories are a tad hazy...); if it does have errors, my apologies. The alternative, to have made the posting exhaustive, including recording every error message's exact text (very helpful for all of you out there doing text string searches to find help, I realize...), was simply too exhausting — particularly given I already lost well over a day tackling the problem itself...

In any case, absolutely no warranties are provided for the below - You do all at your own risk.
Risk highest if you are booting from an OS drive connected to the controller in question, and/or more generally have drives already connected to the controller with important data... If neither of these situations is the case (neither were in my situation), my estimation is that risks are much reduced (e.g., boot failure and/or data loss may not even be applicable).

Preamble

  1. With the exception of booting into Linux, EFI shells, etc., I was working on/within a Windows 10 PC. (E.g., when creating bootable USB stick Flash Drives using Rufus.)
    Also, my boards were slated for use within (and tested within) a Windows environment. It is possible the board binary files for other OSes would be different (and if so, perhaps only for the BIOS, not the firmware).
  2. I was programming a PCIe add-on board (vs. the LSI chipset being built into a motherboard), and not a board supporting an OS disk used to boot the system, and did not have existing disks with important data stored in RAID format or the like. There may well be issues where, if you are booting from a drive connected to the controller, the below comments/directions are insufficient and could get you into a non-bootable state. Similarly, if you have RAID-formatted drives with data, switching from IR to IT mode will likely make your data inaccessible and, very possibly, irreversibly corrupt it.
  3. Company Names: LSI was purchased by Avago, then renamed to Broadcom. Websites, postings, name of firmware displayed on screen at time of boot/post, etc., may be any of these. (Boards similarly appear to also have multiple names.) I use "LSI" to refer to all.
  4. File Names:
    • sas2flash.exe is for Windows.
    • sas2flsh.exe is for DOS.
    • sas2flash.efi is for UEFI shell.
    • .bin files contain data for non BIOS part of firmware.
    • .rom files contain data files for BIOS part of firmware.
  5. Most (perhaps all) LSI cards, in order to function in JBOD mode (Just a Bunch Of Disks) — vs RAID mode — require (re)programming the cards firmware to be in IT mode, not IR mode.

    What mode the card is in is shown at time of boot/post, by "-IR" or "-IT" suffix in the "FW Revision" data shown at boot/post, where "FW" refers to Firmware. HOWEVER, this is true only if the card has been programmed to have a BIOS at all — something that does NOT appear to be needed when using the board in JBOD/IT mode — at least if not booting from a drive connected to the device, which I am not. In other words, there are elements of the Firmware that can be written/updated — including a card's functioning in IT vs. IR mode, without the card even having a "full" BIOS.

    Continuing the above: It is not always immediately clear when "Firmware" refers to essentially all parts of the programmable Flash memory, when just the "BIOS" boot portion (associated with the "-b" sas2flash command and ".rom" extension data files), when to the area that determines IT vs. IR mode (associated with the "-f" sas2flash command and ".bin" extension data files), whether there is some overlap/pairing (this I have not explored in any depth), etc.

  6. Not all LSI cards support JBOD. A very handy list of what cards can be programmed in what modes may be found here https://www.broadcom.com/support/knowledgebase/1211161496893/megaraid-3ware-and-hba-support-for-various-raid-levels-and-jbod-. Snip of title text from that page:
    Question: "MegaRAID, 3ware, and HBA Support for Various RAID Levels and JBOD Mode"
    Answer: "The table below describes RAID level and drive pass-through (JBOD) support for MegaRAID and 3ware controllers as well as SAS HBAs."
  7. How to lookup your board and download appropriate firmware etc.:
       https://www.broadcom.com/support/knowledgebase/1211161494890/finding-the-latest-software-for-your-controller
          https://www.broadcom.com/support/download-search
             Product Group: "Storage Adapters, Controllers, and ICs" (Note that in many cases — e.g., both of my boards — you must check "Include Legacy Products" - a field that shows up after selecting "Storage Adapters, Controllers, and ICs" for the first/leftmost drop-down).
             Product Family: "All Storage Adapters, Controllers, ICs". Then scroll through to find your controllers. (Mine were "SAS 9201-16e Host Bus Adapter" and "SAS 9211-8i Host Bus Adapter".) I would recommend leaving the "Asset Type" field blank, in order that the search shows you all relevant docs and downloads for your controller.

    Update: While writing this document, I found an easier method of navigation of the above — if you are dealing with Legacy products as I was:

       For Product Group, choose "Legacy Products".
       For Product Family, choose "Legacy Host Bus Adapters".
    • For my LSI SAS9201-16e board, which did NOT require IR>IT conversion, and could thus have its firmware updated from Windows 10: https://docs.broadcom.com/docs/12350418 (9201-16e_Package_P20_IT_Firmware_BIOS_for_MSDOS_Windows.zip).
    • For my LSI SAS 9211-8i board, which DID require IR>IT conversion (the hell...): https://docs.broadcom.com/docs/12350530 (9211-8i_Package_P20_IR_IT_FW_BIOS_for_MSDOS_Windows.zip).
  8. It is relatively straightforward to update the firmware within the IR (and I believe within IT) mode - e.g., this can simply be done in a Windows 10 Administrator-level Command Prompt. It is changing from IR to IT mode (and presumably the reverse), that can be a royal pain in the a...
  9. The directions below require a motherboard supporting UEFI boot, as well as the ability to boot from a USB Flash Drive.

    [When I attempted to do the below on a motherboard not supporting UEFI (happened to be a Lenovo ThinkStation S20), it failed on all configurations I tried, with an error message whose text I unfortunately failed to record, but which basically conveyed that the UEFI-based boot as configured on the USB boot Flash drive could not be implemented, period, on that motherboard, and a BIOS-based boot drive was required. This error occurred regardless of whether one was trying to boot Linux etc. This suggested to me that the comment of "Unlike what Linus Tech Tips (https://linustechtips.com/main/topic/104425-flashing-an-lsi-9211-8i-raid-card-to-it-mode-for-zfssoftware-raid-tutorial/) suggests, it doesn’t matter which motherboard you have. What matters is that you need access to an EFI shell where you can easily run some command to change the mode and flash the card." at https://www.tfir.io/easiest-way-to-flash-lsi-sas-9211-8i-on-motherboards-without-efi-shell/ may be incorrect. More specifically, I was never able to get "access to an EFI shell" on a non EFI motherboard. Maybe it can be done — by the above person's directions or otherwise — but none of the diverse ways I created a boot drive using Rufus (see below) worked.]

  10. sas2flash.efi will NOT (in my experience) function properly under EFI Shell 2.x, it needs 1.x. However, your motherboard can have 2.x built in, where an EFI 1.x shell can function "within" it (in my case, via Linux). For example, you may see:
       EFI Shell version 2.31 [4.653]
       Current running mode 1.1.2.
  11. sas2flash commands: In general, see SAS2Flash_ReferenceGuide.pdf, which should be part of any firmware/bios package you download. See in particular:
    • Explanation of the last parameter (integer n) on "sas2flash –o –e n" Table 2: Command Parameters and Regions.
    • sas2flash -ver
    • sas2flash -listall
    • sas2flash -list
  12. Error messages at various stages — when trying to erase firmware, change from/to IR<>IT mode, having unsupported version 2.x EFI Shell, or motherboard not supporting UEFI boot period — include:
    • "Erase Flash Command not Supported on this platform." (If you try to erase Flash in an unsupported environment like Windows or DOS — vs. EFI Shell.)
    • "ERROR: Cannot Flash IT Firmware over IR Firmware!" (If you try to program IT mode over IR mode without erasing Flash memory first.)
    • Trying to recall error if one attempts to run sas2flash.efi in v2.x vs. v1.x of EFI Shell. I think it may be "Failed to initialize PAL. Exiting the program."", but it may also be (or include both) "InitShellApp: Application not started from Shell."
  13. Various 3rd party links I discovered related to this issue:

(Finally) Directions

  1. If you are just updating the Firmware, staying within IR or IT mode but not crossing between them, things should be easy.
    1. For example, when I updated the IT Firmware for my SAS 9201-16e board (I imagine updating the BIOS is similarly straightforward, but have not actually tried that), I just executed "sas2flash -o -f 9201-16e.bin" in a Windows 10 Administrator-level CMD window. (The results of typing this command, along with other similar CMD window captures, may be found at the end of this document.)
      The "-o" means "Enable advanced command mode." and the "-f" refers to Firmware.
    2. Note that I did not need to explicitly erase the Flash memory first, and it is that fact that made things easy to do within Windows etc.
    3. All required elements were within the folder "9201-16e_Package_P20_IT_FW_BIOS_for_MSDOS_Windows" (link to .zip file contain same already provided above).
  2. Directions for the much more difficult task of erasing the Flash memory, required to make the IR<>IT switch, follow.
    1. First step: Boot into a UEFI version 1.x Shell:
      1. You will need a computer that support UEFI at the motherboard firmware level. (See my notes above regarding not trusting online comments that this is not needed. All my tests suggests it is.)
        Thankfully however, the UEFI version number need NOT be the 1.x required for most/all LSI legacy products, but may be the more common version 2.x.
      2. To create a USB Flash boot drive appropriate to the task:
        1. Download "archlinux-2017.03.01-dual.iso" from https://archive.archlinux.org/iso/. Just select the 2017-03-01 date and you will see the aforementioned file. Comments:
          - There may be other OSes that could work — I just have not tested them. I simply used Arch Linux.
          - You cannot use recent versions of Arch Linux as they do not support version 1.x of the UEFI shell — the version that is needed for legacy LSI product sas2flash commands! (Or if they do support, getting to it much more complicated than simply picking a boot-menu item.)
          - (I recommend avoiding (Bit)Torrent or Magnet at https://archlinux.org/download/ as that was (to me anyway) much more confusing/problematic — as well as apparently not having the needed older version anyway.)
        2. Download Rufus, a handy utility to create bootable USB Flash drives spanning a wide range of operating systems. Comments:
          - I used the portable version — rufus-3.18p.exe.
          - For "Device", you want to choose your boot USB Flash drive.
          - For "Boot selection", you want to choose "Disk or ISO image (Please select)".
          - Then you want the button to the right of the above field to be "SELECT" (vs. "DOWNLOAD").
          - Now (I found this initially confusing): You want to then press the "Select" button (vs. clicking the arrow to the right of it) and choose the "archlinux-2017.03.01-dual.iso" file that you previously downloaded.
          - You can (to the best of my current recollection) leave the defaults of "MBR", "BIOS or UEFI", "FAT32 (Default)", and other defaults as well.
          - You then click the "START" button and it creates a bootable USB Flash drive from the ISO image selected above.
      3. Plug the USB Arch Linux boot drive you just made into the computer you are using to update the board. Comments:
        1. Enter BIOS (key stroke will depend on computer manufacturer — could be F1, F2, F10, F12, DEL, ENTER, ESC).
        2. Configure to boot off said USB drive (motherboard must be capable of this which, if it supports UEFI most likely will).
        3. Make Boot Mode be UEFI or Auto.
        4. Refer to very top of "Boot from an usb: Information for people who want to install Arch Linux on an SSD or harddisk" https://www.arcolinuxd.com/5-the-actual-installation-of-arch-linux-phase-1-uefi/ for additional BIOS settings I did not, in my particular case, have to review/change.
        5. Boot computer.
      4. You should now see a screen similar/identical to the one shown directly under "Boot from the ISO in VB" in the link in c-iv directly above, right near the top. You want to choose the "UEFI Shell x86_64 v1" option.
    2. UEFI Shell Commands I used to convert my LSI SAS 9211-8i board from IR mode to IT mode (from folder "9211-8i_Package_P20_IR_IT_FW_BIOS_for_MSDOS_Windows" as linked to above):
      1. To erase the Flash memory, I used the command "sas2flash.efi –o –e 6". [I never tried "sas2flash.efi –o –e 7" (was nervous about that...) ". "sas2flash –o –e 8" did not work, but the command may have been executed in a context (e.g., Windows) where erasing Flash was not possible, period — and/or because I executed the command for a board that did not even support RAID — rather than due to the "8" per se... (I tried SO many things, it is all a bit of a blur now...). In any case, see the SAS2Flash_ReferenceGuide.pdf, and in particular "Table 2: Command Parameters and Regions"]
      2. To then program it with IT firmware: "sas2flash.efi -o -f 2118it.bin". (To program with IR firmware, one would use 2118ir.bin)
      3. To program BIOS:
        1. It may be (don't think I tried) that BIOS update can be done from within Windows CMD window, and does not require UEFI at all.
        2. There are apparently different BIOSes for different contexts. For example: mptsas2.rom (for DOS/Windows), x64sas2.rom and ebcsas2.rom (related it appears to BSD), etc. It is even (apparently...) possible to have multiple BIOSes programmed at once (though I have certainly not tried/tested (see https://www.reddit.com/r/zfs/comments/ejixc8/flashing_h310h200_uefi_bsd_bios_x64sas2_and/)
        3. The general command is "sas2flash.efi -b [filename].rom" - e.g., "sas2flash.efi -b mptsas2.rom".
        4. Apparently (though I do not think I attempted), one can combine the Firmware and BIOS write/update into one command as in "sas2flash.efi -o -f 2118it.bin -b mptsas2.rom".
        5. Having the BIOS is nice in that it shows info during boot-up/POST, and is required (< pretty certain, though never tested), if booting off a drive connected to the drive controller in question. However, including a BIOS at all (vs. erasing all Flash, writing Firmware, but not writing BIOS), significantly slows boot time. So if you are using the controller for drives other than OS boot ones, I would recommend not having a BIOS present at all (to speed up boot).
BELOW, FOR COMPLETENESS, SEE VARIOUS OUTPUTS FROM CMD WINDOW COMMANDS
(Unfortunately, I did not capture UFI Shell equivalents — sorry...)

E:\>sas2flash -list
LSI Corporation SAS2 Flash Utility
Version 20.00.00.00 (2014.09.18)
Copyright (c) 2008-2014 LSI Corporation. All rights reserved

Adapter Selected is a LSI SAS: SAS2116_1(B1)

Controller Number : 0
Controller : SAS2116_1(B1)
PCI Address : 00:02:00:00
SAS Address : 5000d31-0-001d-e73d
NVDATA Version (Default) : 0d.43.00.0f
NVDATA Version (Persistent) : 0d.43.00.0f
Firmware Product ID : 0x2213 (IT)
Firmware Version : 13.00.60.00
NVDATA Vendor : LSI
NVDATA Product ID : SAS9201-16e
BIOS Version : N/A
UEFI BSD Version : N/A
FCODE Version : N/A
Board Name : SAS9201-16e
Board Assembly : H3-25379-01G
Board Tracer Number : SV21003107

Finished Processing Commands Successfully.
Exiting SAS2Flash.


E:\>sas2flash -o -f 9201-16e.bin
LSI Corporation SAS2 Flash Utility
Version 20.00.00.00 (2014.09.18)
Copyright (c) 2008-2014 LSI Corporation. All rights reserved

Advanced Mode Set

Adapter Selected is a LSI SAS: SAS2116_1(B1)

Executing Operation: Flash Firmware Image

Firmware Image has a Valid Checksum.
Firmware Version 20.00.07.00
Firmware Image compatible with Controller.

Valid NVDATA Image found.
NVDATA Version 14.01.00.00
Checking for a compatible NVData image...

NVDATA Device ID and Chip Revision match verified.
NVDATA Versions Compatible.
Valid Initialization Image verified.
Valid BootLoader Image verified.

Beginning Firmware Download...
Firmware Download Successful.

Verifying Download...

Firmware Flash Successful.

Resetting Adapter...
Adapter Successfully Reset.

Finished Processing Commands Successfully.
Exiting SAS2Flash.


E:\>sas2flash -list
LSI Corporation SAS2 Flash Utility
Version 20.00.00.00 (2014.09.18)
Copyright (c) 2008-2014 LSI Corporation. All rights reserved

Adapter Selected is a LSI SAS: SAS2116_1(B1)

Controller Number : 0
Controller : SAS2116_1(B1)
PCI Address : 00:02:00:00
SAS Address : 5000d31-0-001d-e73d
NVDATA Version (Default) : 14.01.00.07
NVDATA Version (Persistent) : 14.01.00.07
Firmware Product ID : 0x2213 (IT)
Firmware Version : 20.00.07.00
NVDATA Vendor : LSI
NVDATA Product ID : SAS9201-16e
BIOS Version : N/A
UEFI BSD Version : N/A
FCODE Version : N/A
Board Name : SAS9201-16e
Board Assembly : H3-25379-01G
Board Tracer Number : SV21003107

Finished Processing Commands Successfully.
Exiting SAS2Flash.