View | Details | Raw Unified
Collapse All | Expand All

(-) init.d-pciparm.orig (-25 / +38 lines)
 Lines 22-61    Link Here 
do_setpci() {
do_setpci() {
	#ewarn "do_setpci: /usr/sbin/setpci $SETPCI_OPT $@"
	#ewarn "do_setpci: /usr/sbin/setpci $SETPCI_OPT $@"
	SWITCH=$1
	x=
	case "$SWITCH" in
	case "$1" in
		-d) DESC="(vendor)" ;;
		-d) DESC=vendor
		-s) DESC="(bus)" ;;
	;;	-s) DESC=bus
		*) eerror "Unknown setpci type!" ; return 1 ;;
	;;	-x) [ -n "$SWITCH" -a -n "$DESC" ] || { eerror "Bad array call, Switch: ${SWITCH:-Empty!} Desc: ${DESC:-Empty!}"; return 1; }
	esac
			x=1; false
	shift
	;;	*) eerror 'Unknown setpci type!'; return 1
	SPEC_ID=$1
;;	esac && SWITCH=$1
	shift
	[ -z "$2" ] && {
	if [[ -z "$SPEC_ID" ]]; then
		eerror "Missing $DESC device specifier!"
		eerror "Missing device specifier!"
		return 1
		return 1
	fi
	}
	if [[ -z "$@" ]]; then
	SPEC_ID=$2
	shift 2
	[ -z "$*" ] && {
		eerror "Missing configuration to set for $DESC $SPEC_ID!"
		eerror "Missing configuration to set for $DESC $SPEC_ID!"
		return 1
		return 1
	fi
	}
	ebegin "Setting PCI params for $DESC $SPEC_ID to $@"
	ebegin "Setting PCI params for ($DESC) $SPEC_ID to $*"
	/usr/sbin/setpci $SETPCI_OPT $SWITCH $SPEC_ID "$@"
	/usr/sbin/setpci $SETPCI_OPT $SWITCH $SPEC_ID "$@"
	eend $?
	r=$?
	SWITCH=""
	[ -n "$x" ] && unset -v x SPEC_ID || unset -v x SWITCH SPEC_ID
	SPEC_ID=""
	eend "$r"
	return "$r"
}
}
do_setpci_array() {
do_setpci_array() {
	name=$1
	case $1 in
	shift
	-d) DESC=vendor
;;	-s) DESC=bus
;;	*) eerror "Unknown type to: do_setpci_array $*";return 1
;;	esac
	SWITCH=$1; shift
	[ -z $1 ] && { eerror 'No array name to do_setpci_array!'; return 1; }
	i=0
	i=0
	while true; do
	while true; do
		eval opt="\$${name}_$i"
		eval opt="\$${1}_$i"
		[[ -z "$opt" ]] && break
		[ -z "$opt" ] && break
		do_setpci "$*" $opt
		do_setpci -x $opt # || return 1
		i=$(($i+1))
		i=$(($i+1))
	done
	done
	unset -v opt i SWITCH
}
}
start() {
start() {
 Lines 65-72    Link Here 
	fi
	fi
	checkconfig || return 1
	checkconfig || return 1
	
	[[ -n "$PCIPARM_ALL" ]] && \
	if [ "$VERBOSE" = yes ]; then
		SETPCI_OPT=' -v'
	else SETPCI_OPT=
	fi
	[ -n "$PCIPARM_ALL" ] && \
		do_setpci -d '*:*' $PCIPARM_ALL
		do_setpci -d '*:*' $PCIPARM_ALL
	do_setpci_array PCIPARM_BUS -s
	do_setpci_array PCIPARM_BUS -s