]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
handle only firmware add requests
authorElan Ruusamäe <glen@delfi.ee>
Thu, 27 Mar 2014 22:57:00 +0000 (00:57 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Thu, 27 Mar 2014 22:57:02 +0000 (00:57 +0200)
with handling all hotplug events, we ran into some kind of race condition
which resulted only one of the two bnx2 devices to appear working:

[ 16.425932] bnx2: Firmware file "bnx2/bnx2-rv2p-06-6.0.15.fw" is invalid

after inspecting bnx2.c sourcecode, appears that this error is printed only if
firmware file is too short and the firmware itself is and has always been 5696
bytes (in pld packages).

internally in firmware loader, the race appeared as:
+ '[' ! -e /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0/firmware/0000:03:00.0/loading ']'
+ '[' -e /lib/firmware/updates/3.4.83-1/bnx2/bnx2-rv2p-06-6.0.15.fw ']'
+ continue
+ '[' -e /lib/firmware/updates/bnx2/bnx2-rv2p-06-6.0.15.fw ']'
+ continue
+ '[' -e /lib/firmware/3.4.83-1/bnx2/bnx2-rv2p-06-6.0.15.fw ']'
+ >/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0/firmware/0000:03:00.0/loading
+ echo 1
+ >/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0/firmware/0000:03:00.0/data
+ cat /lib/firmware/3.4.83-1/bnx2/bnx2-rv2p-06-6.0.15.fw
/lib/firmware/firmware-loader.sh[29]: cat: <stdout>: No such device

firmware-loader.sh

index 82232a8dbf9b868b2168ae7250dd93246de28cd4..d9a3782120e5238601070a02b44fefbe38c919fa 100755 (executable)
@@ -1,10 +1,17 @@
 #!/bin/sh
 set -e
 
+# handle only firmware add requests
+if [ "$SUBSYSTEM" != "firmware" ]; then
+       exit 0
+fi
+if [ "$ACTION" != "add" ]; then
+       exit 0
+fi
+
 FIRMWARE_DIRS="/lib/firmware/updates/$(uname -r) /lib/firmware/updates \
                /lib/firmware/$(uname -r) /lib/firmware"
 
-# add initrd code to print to kmsg
 # @param string message
 # @param int loglevel. defaults to "6" (info)
 # Log levels can be:
This page took 1.154238 seconds and 4 git commands to generate.