Lines 22-61
Link Here
|
22 |
|
22 |
|
23 |
do_setpci() { |
23 |
do_setpci() { |
24 |
#ewarn "do_setpci: /usr/sbin/setpci $SETPCI_OPT $@" |
24 |
#ewarn "do_setpci: /usr/sbin/setpci $SETPCI_OPT $@" |
25 |
SWITCH=$1 |
25 |
x= |
26 |
case "$SWITCH" in |
26 |
case "$1" in |
27 |
-d) DESC="(vendor)" ;; |
27 |
-d) DESC=vendor |
28 |
-s) DESC="(bus)" ;; |
28 |
;; -s) DESC=bus |
29 |
*) eerror "Unknown setpci type!" ; return 1 ;; |
29 |
;; -x) [ -n "$SWITCH" -a -n "$DESC" ] || { eerror "Bad array call, Switch: ${SWITCH:-Empty!} Desc: ${DESC:-Empty!}"; return 1; } |
30 |
esac |
30 |
x=1; false |
31 |
shift |
31 |
;; *) eerror 'Unknown setpci type!'; return 1 |
32 |
SPEC_ID=$1 |
32 |
;; esac && SWITCH=$1 |
33 |
shift |
33 |
[ -z "$2" ] && { |
34 |
if [[ -z "$SPEC_ID" ]]; then |
34 |
eerror "Missing $DESC device specifier!" |
35 |
eerror "Missing device specifier!" |
|
|
36 |
return 1 |
35 |
return 1 |
37 |
fi |
36 |
} |
38 |
if [[ -z "$@" ]]; then |
37 |
SPEC_ID=$2 |
|
|
38 |
shift 2 |
39 |
[ -z "$*" ] && { |
39 |
eerror "Missing configuration to set for $DESC $SPEC_ID!" |
40 |
eerror "Missing configuration to set for $DESC $SPEC_ID!" |
40 |
return 1 |
41 |
return 1 |
41 |
fi |
42 |
} |
42 |
ebegin "Setting PCI params for $DESC $SPEC_ID to $@" |
43 |
ebegin "Setting PCI params for ($DESC) $SPEC_ID to $*" |
43 |
/usr/sbin/setpci $SETPCI_OPT $SWITCH $SPEC_ID "$@" |
44 |
/usr/sbin/setpci $SETPCI_OPT $SWITCH $SPEC_ID "$@" |
44 |
eend $? |
45 |
r=$? |
45 |
SWITCH="" |
46 |
[ -n "$x" ] && unset -v x SPEC_ID || unset -v x SWITCH SPEC_ID |
46 |
SPEC_ID="" |
47 |
eend "$r" |
|
|
48 |
return "$r" |
47 |
} |
49 |
} |
48 |
|
50 |
|
49 |
do_setpci_array() { |
51 |
do_setpci_array() { |
50 |
name=$1 |
52 |
case $1 in |
51 |
shift |
53 |
-d) DESC=vendor |
|
|
54 |
;; -s) DESC=bus |
55 |
;; *) eerror "Unknown type to: do_setpci_array $*";return 1 |
56 |
;; esac |
57 |
SWITCH=$1; shift |
58 |
[ -z $1 ] && { eerror 'No array name to do_setpci_array!'; return 1; } |
52 |
i=0 |
59 |
i=0 |
53 |
while true; do |
60 |
while true; do |
54 |
eval opt="\$${name}_$i" |
61 |
eval opt="\$${1}_$i" |
55 |
[[ -z "$opt" ]] && break |
62 |
[ -z "$opt" ] && break |
56 |
do_setpci "$*" $opt |
63 |
do_setpci -x $opt # || return 1 |
57 |
i=$(($i+1)) |
64 |
i=$(($i+1)) |
58 |
done |
65 |
done |
|
|
66 |
unset -v opt i SWITCH |
59 |
} |
67 |
} |
60 |
|
68 |
|
61 |
start() { |
69 |
start() { |
Lines 65-72
Link Here
|
65 |
fi |
73 |
fi |
66 |
|
74 |
|
67 |
checkconfig || return 1 |
75 |
checkconfig || return 1 |
68 |
|
76 |
|
69 |
[[ -n "$PCIPARM_ALL" ]] && \ |
77 |
if [ "$VERBOSE" = yes ]; then |
|
|
78 |
SETPCI_OPT=' -v' |
79 |
else SETPCI_OPT= |
80 |
fi |
81 |
|
82 |
[ -n "$PCIPARM_ALL" ] && \ |
70 |
do_setpci -d '*:*' $PCIPARM_ALL |
83 |
do_setpci -d '*:*' $PCIPARM_ALL |
71 |
|
84 |
|
72 |
do_setpci_array PCIPARM_BUS -s |
85 |
do_setpci_array PCIPARM_BUS -s |