- Use the new resource_disabled() helper function to see if devices are
disabled. - Change the apm driver to match the acpi driver's behavior by checking to see if the device is disabled in the identify routine instead of in the probe routine. This way if the device is disabled it is never created. Note that a few places (ips(4), Alpha SMP) used "disable" instead of "disabled" for their hint names, and these hints must be changed to "disabled". If this is a big problem, resource_disabled() can always be changed to honor both names.
This commit is contained in:
parent
ea0bd15238
commit
17958a749f
@ -349,7 +349,6 @@ cpu_mp_start(void)
|
||||
mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN);
|
||||
|
||||
for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
|
||||
int dv;
|
||||
struct pcs *pcsp;
|
||||
|
||||
if (i == boot_cpu_id)
|
||||
@ -380,8 +379,7 @@ cpu_mp_start(void)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
dv = 0;
|
||||
if (resource_int_value("cpu", i, "disable", &dv) == 0 && dv) {
|
||||
if (resource_disabled("cpu", i))
|
||||
printf("CPU %d disabled by loader.\n", i);
|
||||
continue;
|
||||
}
|
||||
|
@ -215,8 +215,7 @@ acpi_identify(driver_t *driver, device_t parent)
|
||||
/*
|
||||
* Check that we haven't been disabled with a hint.
|
||||
*/
|
||||
if (!resource_int_value("acpi", 0, "disabled", &error) &&
|
||||
(error != 0))
|
||||
if (resource_disabled("acpi", 0))
|
||||
return_VOID;
|
||||
|
||||
/*
|
||||
@ -2175,13 +2174,11 @@ out:
|
||||
static void
|
||||
acpi_pm_register(void *arg)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (!cold)
|
||||
return;
|
||||
|
||||
if (!resource_int_value("acpi", 0, "disabled", &error) &&
|
||||
(error != 0))
|
||||
if (resource_disabled("acpi", 0))
|
||||
return;
|
||||
|
||||
power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, NULL);
|
||||
|
@ -277,8 +277,7 @@ atkbd_configure(int flags)
|
||||
atkbdc_configure();
|
||||
|
||||
/* if the driver is disabled, unregister the keyboard if any */
|
||||
if ((resource_int_value("atkbd", ATKBD_DEFAULT, "disabled", &i) == 0)
|
||||
&& i != 0) {
|
||||
if (resource_disabled("atkbd", ATKBD_DEFAULT)) {
|
||||
i = kbd_find_keyboard(ATKBD_DRIVER_NAME, ATKBD_DEFAULT);
|
||||
if (i >= 0) {
|
||||
kbd = kbd_get_keyboard(i);
|
||||
|
@ -255,7 +255,7 @@ atkbdc_add_child(device_t bus, int order, char *name, int unit)
|
||||
|
||||
if (resource_int_value(name, unit, "flags", &t) == 0)
|
||||
device_set_flags(child, t);
|
||||
if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
|
||||
if (resource_disabled(name, unit))
|
||||
device_disable(child);
|
||||
|
||||
device_set_ivars(child, ivar);
|
||||
|
@ -255,7 +255,7 @@ atkbdc_add_child(device_t bus, int order, char *name, int unit)
|
||||
|
||||
if (resource_int_value(name, unit, "flags", &t) == 0)
|
||||
device_set_flags(child, t);
|
||||
if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
|
||||
if (resource_disabled(name, unit))
|
||||
device_disable(child);
|
||||
|
||||
device_set_ivars(child, ivar);
|
||||
|
@ -973,7 +973,7 @@ fdc_detach(device_t dev)
|
||||
static void
|
||||
fdc_add_child(device_t dev, const char *name, int unit)
|
||||
{
|
||||
int disabled, flags;
|
||||
int flags;
|
||||
struct fdc_ivars *ivar;
|
||||
device_t child;
|
||||
|
||||
@ -990,8 +990,7 @@ fdc_add_child(device_t dev, const char *name, int unit)
|
||||
device_set_ivars(child, ivar);
|
||||
if (resource_int_value(name, unit, "flags", &flags) == 0)
|
||||
device_set_flags(child, flags);
|
||||
if (resource_int_value(name, unit, "disabled", &disabled) == 0
|
||||
&& disabled != 0)
|
||||
if (resource_disabled(name, unit))
|
||||
device_disable(child);
|
||||
}
|
||||
|
||||
|
@ -50,13 +50,10 @@ static int ips_pci_probe(device_t dev)
|
||||
static int ips_pci_attach(device_t dev)
|
||||
{
|
||||
u_int32_t command;
|
||||
int tval;
|
||||
ips_softc_t *sc;
|
||||
|
||||
|
||||
tval = 0;
|
||||
if (resource_int_value(device_get_name(dev), device_get_unit(dev),
|
||||
"disable", &tval) == 0 && tval) {
|
||||
if (resource_disabled(device_get_name(dev), device_get_unit(dev))) {
|
||||
device_printf(dev, "device is disabled\n");
|
||||
/* but return 0 so the !$)$)*!$*) unit isn't reused */
|
||||
return (0);
|
||||
|
@ -277,8 +277,7 @@ atkbd_configure(int flags)
|
||||
atkbdc_configure();
|
||||
|
||||
/* if the driver is disabled, unregister the keyboard if any */
|
||||
if ((resource_int_value("atkbd", ATKBD_DEFAULT, "disabled", &i) == 0)
|
||||
&& i != 0) {
|
||||
if (resource_disabled("atkbd", ATKBD_DEFAULT)) {
|
||||
i = kbd_find_keyboard(ATKBD_DRIVER_NAME, ATKBD_DEFAULT);
|
||||
if (i >= 0) {
|
||||
kbd = kbd_get_keyboard(i);
|
||||
|
@ -2967,11 +2967,9 @@ siocnprobe(cp)
|
||||
|
||||
for (unit = 0; unit < 16; unit++) { /* XXX need to know how many */
|
||||
int flags;
|
||||
int disabled;
|
||||
if (resource_int_value("sio", unit, "disabled", &disabled) == 0) {
|
||||
if (disabled)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (resource_disabled("sio", unit))
|
||||
continue;
|
||||
if (resource_int_value("sio", unit, "flags", &flags))
|
||||
continue;
|
||||
if (COM_CONSOLE(flags) || COM_DEBUGGER(flags)) {
|
||||
|
@ -846,6 +846,9 @@ apm_identify(driver_t *driver, device_t parent)
|
||||
return;
|
||||
}
|
||||
|
||||
if (resource_disabled("apm", 0))
|
||||
return;
|
||||
|
||||
child = BUS_ADD_CHILD(parent, 0, "apm", 0);
|
||||
if (child == NULL)
|
||||
panic("apm_identify");
|
||||
@ -860,18 +863,12 @@ apm_probe(device_t dev)
|
||||
#define APM_KERNBASE KERNBASE
|
||||
struct vm86frame vmf;
|
||||
struct apm_softc *sc = &apm_softc;
|
||||
int disabled, flags;
|
||||
int flags;
|
||||
#ifdef PC98
|
||||
int rid;
|
||||
#endif
|
||||
|
||||
device_set_desc(dev, "APM BIOS");
|
||||
|
||||
if (resource_int_value("apm", 0, "disabled", &disabled) != 0)
|
||||
disabled = 0;
|
||||
if (disabled)
|
||||
return ENXIO;
|
||||
|
||||
if (device_get_unit(dev) > 0) {
|
||||
printf("apm: Only one APM driver supported.\n");
|
||||
return ENXIO;
|
||||
@ -1544,10 +1541,8 @@ out:
|
||||
static void
|
||||
apm_pm_register(void *arg)
|
||||
{
|
||||
int disabled = 0;
|
||||
|
||||
resource_int_value("apm", 0, "disabled", &disabled);
|
||||
if (disabled == 0)
|
||||
if (!resource_disabled("apm", 0))
|
||||
power_pm_register(POWER_PM_TYPE_APM, apm_pm_func, NULL);
|
||||
}
|
||||
|
||||
|
@ -642,8 +642,8 @@ pcvt_cn_probe(struct consdev *cp)
|
||||
int unit = 0;
|
||||
int i;
|
||||
|
||||
/* See if this driver is disabled in probe hint. */
|
||||
if (resource_int_value("vt", unit, "disabled", &i) == 0 && i)
|
||||
/* See if this driver is disabled in probe hint. */
|
||||
if (resource_disabled("vt", unit))
|
||||
{
|
||||
cp->cn_pri = CN_DEAD;
|
||||
return;
|
||||
|
@ -255,7 +255,7 @@ atkbdc_add_child(device_t bus, int order, char *name, int unit)
|
||||
|
||||
if (resource_int_value(name, unit, "flags", &t) == 0)
|
||||
device_set_flags(child, t);
|
||||
if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
|
||||
if (resource_disabled(name, unit))
|
||||
device_disable(child);
|
||||
|
||||
device_set_ivars(child, ivar);
|
||||
|
@ -973,7 +973,7 @@ fdc_detach(device_t dev)
|
||||
static void
|
||||
fdc_add_child(device_t dev, const char *name, int unit)
|
||||
{
|
||||
int disabled, flags;
|
||||
int flags;
|
||||
struct fdc_ivars *ivar;
|
||||
device_t child;
|
||||
|
||||
@ -990,8 +990,7 @@ fdc_add_child(device_t dev, const char *name, int unit)
|
||||
device_set_ivars(child, ivar);
|
||||
if (resource_int_value(name, unit, "flags", &flags) == 0)
|
||||
device_set_flags(child, flags);
|
||||
if (resource_int_value(name, unit, "disabled", &disabled) == 0
|
||||
&& disabled != 0)
|
||||
if (resource_disabled(name, unit))
|
||||
device_disable(child);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ isahint_add_device(device_t parent, const char *name, int unit)
|
||||
if (resource_int_value(name, unit, "flags", &t) == 0)
|
||||
device_set_flags(child, t);
|
||||
|
||||
if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
|
||||
if (resource_disabled(name, unit))
|
||||
device_disable(child);
|
||||
}
|
||||
|
||||
|
@ -195,14 +195,12 @@ sc_softc_t
|
||||
int
|
||||
sc_get_cons_priority(int *unit, int *flags)
|
||||
{
|
||||
int disabled;
|
||||
const char *at;
|
||||
int u, f;
|
||||
|
||||
*unit = -1;
|
||||
for (u = 0; u < 16; u++) {
|
||||
if ((resource_int_value(SC_DRIVER_NAME, u, "disabled",
|
||||
&disabled) == 0) && disabled)
|
||||
if (resource_disabled(SC_DRIVER_NAME, u))
|
||||
continue;
|
||||
if (resource_string_value(SC_DRIVER_NAME, u, "at", &at) != 0)
|
||||
continue;
|
||||
|
@ -1275,7 +1275,7 @@ fdc_detach(device_t dev)
|
||||
static void
|
||||
fdc_add_child(device_t dev, const char *name, int unit)
|
||||
{
|
||||
int disabled, flags;
|
||||
int flags;
|
||||
struct fdc_ivars *ivar;
|
||||
device_t child;
|
||||
|
||||
@ -1292,8 +1292,7 @@ fdc_add_child(device_t dev, const char *name, int unit)
|
||||
device_set_ivars(child, ivar);
|
||||
if (resource_int_value(name, unit, "flags", &flags) == 0)
|
||||
device_set_flags(child, flags);
|
||||
if (resource_int_value(name, unit, "disabled", &disabled) == 0
|
||||
&& disabled != 0)
|
||||
if (resource_disabled(name, unit))
|
||||
device_disable(child);
|
||||
}
|
||||
|
||||
|
@ -370,8 +370,7 @@ pckbd_configure(int flags)
|
||||
if (resource_int_value(DRIVER_NAME, 0, "flags", &i) == 0) {
|
||||
flags |= i;
|
||||
/* if the driver is disabled, unregister the keyboard if any */
|
||||
if (resource_int_value(DRIVER_NAME, 0, "disabled", &i) == 0
|
||||
&& i != 0) {
|
||||
if (resource_disabled(DRIVER_NAME, 0)) {
|
||||
i = kbd_find_keyboard(DRIVER_NAME, PC98KBD_DEFAULT);
|
||||
if (i >= 0) {
|
||||
kbd = kbd_get_keyboard(i);
|
||||
|
@ -4162,11 +4162,8 @@ siocnprobe(cp)
|
||||
|
||||
for (unit = 0; unit < 16; unit++) { /* XXX need to know how many */
|
||||
int flags;
|
||||
int disabled;
|
||||
if (resource_int_value("sio", unit, "disabled", &disabled) == 0) {
|
||||
if (disabled)
|
||||
continue;
|
||||
}
|
||||
if (resource_disabled("sio", unit))
|
||||
continue;
|
||||
if (resource_int_value("sio", unit, "flags", &flags))
|
||||
continue;
|
||||
if (COM_CONSOLE(flags) || COM_DEBUGGER(flags)) {
|
||||
|
@ -180,14 +180,12 @@ sc_softc_t
|
||||
int
|
||||
sc_get_cons_priority(int *unit, int *flags)
|
||||
{
|
||||
int disabled;
|
||||
const char *at;
|
||||
int u, f;
|
||||
|
||||
*unit = -1;
|
||||
for (u = 0; u < 16; u++) {
|
||||
if ((resource_int_value(SC_DRIVER_NAME, u, "disabled",
|
||||
&disabled) == 0) && disabled)
|
||||
if (resource_disabled(SC_DRIVER_NAME, u))
|
||||
continue;
|
||||
if (resource_string_value(SC_DRIVER_NAME, u, "at", &at) != 0)
|
||||
continue;
|
||||
|
@ -1275,7 +1275,7 @@ fdc_detach(device_t dev)
|
||||
static void
|
||||
fdc_add_child(device_t dev, const char *name, int unit)
|
||||
{
|
||||
int disabled, flags;
|
||||
int flags;
|
||||
struct fdc_ivars *ivar;
|
||||
device_t child;
|
||||
|
||||
@ -1292,8 +1292,7 @@ fdc_add_child(device_t dev, const char *name, int unit)
|
||||
device_set_ivars(child, ivar);
|
||||
if (resource_int_value(name, unit, "flags", &flags) == 0)
|
||||
device_set_flags(child, flags);
|
||||
if (resource_int_value(name, unit, "disabled", &disabled) == 0
|
||||
&& disabled != 0)
|
||||
if (resource_disabled(name, unit))
|
||||
device_disable(child);
|
||||
}
|
||||
|
||||
|
@ -370,8 +370,7 @@ pckbd_configure(int flags)
|
||||
if (resource_int_value(DRIVER_NAME, 0, "flags", &i) == 0) {
|
||||
flags |= i;
|
||||
/* if the driver is disabled, unregister the keyboard if any */
|
||||
if (resource_int_value(DRIVER_NAME, 0, "disabled", &i) == 0
|
||||
&& i != 0) {
|
||||
if (resource_disabled(DRIVER_NAME, 0)) {
|
||||
i = kbd_find_keyboard(DRIVER_NAME, PC98KBD_DEFAULT);
|
||||
if (i >= 0) {
|
||||
kbd = kbd_get_keyboard(i);
|
||||
|
@ -4162,11 +4162,8 @@ siocnprobe(cp)
|
||||
|
||||
for (unit = 0; unit < 16; unit++) { /* XXX need to know how many */
|
||||
int flags;
|
||||
int disabled;
|
||||
if (resource_int_value("sio", unit, "disabled", &disabled) == 0) {
|
||||
if (disabled)
|
||||
continue;
|
||||
}
|
||||
if (resource_disabled("sio", unit))
|
||||
continue;
|
||||
if (resource_int_value("sio", unit, "flags", &flags))
|
||||
continue;
|
||||
if (COM_CONSOLE(flags) || COM_DEBUGGER(flags)) {
|
||||
|
@ -180,14 +180,12 @@ sc_softc_t
|
||||
int
|
||||
sc_get_cons_priority(int *unit, int *flags)
|
||||
{
|
||||
int disabled;
|
||||
const char *at;
|
||||
int u, f;
|
||||
|
||||
*unit = -1;
|
||||
for (u = 0; u < 16; u++) {
|
||||
if ((resource_int_value(SC_DRIVER_NAME, u, "disabled",
|
||||
&disabled) == 0) && disabled)
|
||||
if (resource_disabled(SC_DRIVER_NAME, u))
|
||||
continue;
|
||||
if (resource_string_value(SC_DRIVER_NAME, u, "at", &at) != 0)
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user