need to load the floppy module
[bootcd.git] / conf_files / pl_hwinit
1 #!/bin/sh
2
3 pci_table=/etc/pl_pcitable
4
5 echo "pl_hwinit: loading applicable modules"
6
7 # this will contain lines of device_id:vendor_id (no 0x)
8 system_devices=$(lspci -n | cut -d " " -f4)
9
10 for device in $system_devices; do
11
12     # now vendor_id and device_id are broken apart
13     vendor_id=$(echo $device | cut -d ":" -f1)
14     device_id=$(echo $device | cut -d ":" -f2)
15
16     # either exactly match vendor:device, or a vendor:ffff (let the module
17     # figure out if it can be used for this device), or ffff:device
18     # (not sure if this is legal, but shows up in the pci map)
19     mods=$(grep -i "\($vendor_id:ffff\|$vendor_id:$device_id\|ffff:$device_id\)" \
20         $pci_table | cut -d " " -f1)
21
22     for module in $mods; do
23         if [ -n "$module" ]; then
24             echo "pl_hwinit: found and loading module $module"
25             /sbin/modprobe $module
26         fi
27     done
28 done
29
30 # just in case, look for any modules that are ffff:ffff and load them
31 mods=$(grep -i "ffff:ffff" $pci_table | cut -d " " -f1)
32 for module in $mods; do
33     if [ -n "$module" ]; then
34         echo "pl_hwinit: found and loading wild module $module"
35         /sbin/modprobe $module
36     fi
37 done
38
39 # sd_mod won't get loaded automatically
40 echo "pl_hwinit: loading sd_mod"
41 /sbin/modprobe sd_mod
42
43 echo "pl_hwinit: loading floppy device driver"
44 /sbin/modprobe floppy