blob: d83ee5a450db8ba1c7ee6d29c3e1850566b3a27b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
#!/bin/sh
#
# pci.rc mostly to recover lost boot-time pci hotplug events
#
# $Id: pci.rc,v 1.1 2002/02/25 02:13:12 blocke Exp $
#
# Modified for Gentoo Linux, sworley 2002-02-20
PATH=/sbin:/bin:/usr/sbin:/usr/bin
cd /etc/hotplug
. hotplug.functions
# Gentoo Linux use /etc/conf.d ???
# # override any of the defaults?
if [ -f /etc/conf.d/pci ]; then
. /etc/conf.d/pci
fi
pci_boot_events ()
{
LISTER=`type -p pcimodules`
if [ "$LISTER" = "" -o ! -f /proc/bus/pci/devices -o ! -x pci.agent ]; then
echo $"** can't synthesize pci hotplug events"
return 1
fi
# make sure the pci agent will run
ACTION=add
PCI_CLASS=0
PCI_ID=0:0
PCI_SLOT=0:0.0
PCI_SUBSYS_ID=0:0
export ACTION PCI_CLASS PCI_ID PCI_SLOT PCI_SUBSYS_ID
# Alternatively, parse /proc/bus/pci/devices to find
# which pci slots don't have drivers. That's messy to
# parse, and hides PCI_CLASS and PCI_SUBSYS_ID. At
# least PCI_CLASS is used by common drivers (USB hcds).
# these notifications will be handled by pcimodules
for BUS in `cd /proc/bus/pci;find * -type d -print`; do
for SLOT_FUNC in `cd /proc/bus/pci/$BUS; echo *`; do
PCI_SLOT=$BUS:$SLOT_FUNC
: hotplug pci for $PCI_SLOT
/sbin/hotplug pci
done
done
}
# See how we were called.
case "$1" in
start)
pci_boot_events
;;
stop)
echo $"pci stop -- ignored"
;;
status)
echo $"PCI Status for kernel: " `uname -srm`
echo ''
if [ -f /proc/bus/pci/devices ]; then
COUNT=`ls /proc/bus/pci | wc -l`
if [ $COUNT -gt 1 ]; then
COUNT=`expr $COUNT - 1`
echo $"PCI up; bus count is $COUNT"
if [ -x /sbin/lspci ]; then
/sbin/lspci
fi
else
echo $"no PCI busses?"
fi
echo ''
else
echo $"no PCI /proc support?"
fi
echo ''
;;
restart)
# always invoke by absolute path, else PATH=$PATH:
$0 stop && $0 start
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
|