Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Proposed new /etc/rc.d/drvctl script



While investigating PR kern/59253 I discovered that the amdsmn(4)
device attaches to the device tree at the same place as a pchb(4).
Both devices want to attach at `pci0 dev 0 function 0'.

When the amdsmn driver module is built-in to the kernel, everything
works just fine, since the amdsmn_attach() returns a value of 2,
which "wins" over the value of 1 returned by pchb_attach().

However, if the amdsmn module is loaded later (ie, is not built-in),
it is not present during initial configuration, and cannot return a
value higher tham that of pchb.  So, pchb wins by and "claims" the
attachment.  Later, when the amdsmn module is loaded, it cannot
attach in the device tree because the attachment point is already
occupied by pchb. If you use drvctl to delete the pchb instance you
can then load the module and amdsmn will attach correctly.

I propose that a new /etc/rc.d/drvctl script be provided (with a
default of drvctl=NO in rc.conf) to automate the "eviction" of the
pchb instance.  This script is structurally identical to the
/et/rc.d/modules script - nothing fancy.  A copy of the new script
is attached to this email.

I'd like to commit this within the next few days unless there are
strong reasons against.

+---------------------+--------------------------+----------------------+
| Paul Goyette (.sig) | PGP Key fingerprint:     | E-mail addresses:    |
| (Retired)           | 1B11 1849 721C 56C8 F63A | paul%whooppee.com@localhost    |
| Software Developer  | 6E2E 05FD 15CE 9F2D 5102 | pgoyette%netbsd.org@localhost  |
| & Network Engineer  |                          | pgoyette99%gmail.com@localhost |
+---------------------+--------------------------+----------------------+
#!/bin/sh
#
# $NetBSD$
#

# PROVIDE: drvctl
# REQUIRE: fsck_root
# BEFORE: modules

$_rc_subr_loaded . /etc/rc.subr

name="drvctl"
rcvar=$name
start_cmd="drvctl_start"
stop_cmd=":"

drvctl_start()
{
	if [ -f /etc/drvctl.conf ]; then
		echo "Running drvctl."
		while read name args; do
			case $name in
			''|"#"*)
				;;
			*)
				(
					set -o noglob
					eval set -- $args
					drvctl "$@" "$name"
				)
				;;
			esac
		done < /etc/drvctl.conf
	fi
}

load_rc_config $name
run_rc_command "$1"


Home | Main Index | Thread Index | Old Index