Module Name:    src
Committed By:   msaitoh
Date:           Tue Feb 13 14:56:52 UTC 2024

Modified Files:
        src/sys/dev/ic: mfireg.h
        src/sys/dev/pci: mfii.c

Log Message:
mfii(4): Apply two changes from OpenBSD to fix an unknown firmware state.

 My own MegaRAID 946N-8i 2G", firmware 50.5.0-2594 failed to attach.

        mfii0: unknown firmware state 1879048192

1879048192 equals to 0x70000000(== MFI_STATE_FW_INIT_2).
Apply following two OpenBSD commits to resolve this problem.

sys/dev/pci/mfii.c OpenBSD rev. 1.86
sys/dev/ic/mfireg.h OpenBSD rev. 1.52

Make mfii(4) recover from firmware FAULT state on startup.

In case firmware initially comes up in FAULT state, reset the device and
give it one more chance to attach successfully. The Linux megaraid_sas
driver applies the same workaround in this case. There seems to be a bug
in some firmware versions which can trigger this behaviour; see mainline
Linux commit 6431f5d7c6025f8b007af06ea090de308f7e6881

Problem observed by me with mfii(4) attached via KVM PCI-passthrough:
mfii0 at pci0 dev 2 function 0 "Symbios Logic MegaRAID SAS2208" rev 0x05: msi
mfii0: firmware fault

With this workaround in place, attachment succeeds and the device works:
mfii0 at pci0 dev 2 function 0 "Symbios Logic MegaRAID SAS2208" rev 0x05: msi
mfii0: firmware fault; attempting full device reset, this can take some time
mfii0: "RAID Ctrl SAS 6G 1GB (D3116C)", firmware 23.29.0-0019, 1024MB cache

Tested for regressions on bare metal by Hrvoje with two different adapters:
mfii0 at pci1 dev 0 function 0 "Symbios Logic MegaRAID SAS3508" rev 0x01: msi
mfii0: "PERC H740P Mini ", firmware 51.16.0-4076, 8192MB cache
mfii0 at pci4 dev 0 function 0 "Symbios Logic MegaRAID SAS2208" rev 0x05: msi
mfii0: "ServeRAID M5110", firmware 23.34.0-0023, 512MB cache

ok jmatthew@

sys/dev/pci/mfii.c OpenBSD rev. 1.87

Give mfii(4) firmware more time to transition out of UNDEFINED state.

Prevents occasional failure to recover from firmware FAULT state where
the driver gave up too early: mfii0: firmware stuck in state 0

ok deraadt@

To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/mfireg.h
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/pci/mfii.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Reply via email to