summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>2001-09-06 12:09:26 +0000
committeryokota <yokota@FreeBSD.org>2001-09-06 12:09:26 +0000
commit7f7bf018aaca93024e7d2fcad9da1f21118a4596 (patch)
tree92dfbfe85d242540cbb11e726375c24e19ca53d4 /sys/isa
parent40d29ec988364a2073a0fe8beb31e808ad5d748a (diff)
downloadFreeBSD-src-7f7bf018aaca93024e7d2fcad9da1f21118a4596.zip
FreeBSD-src-7f7bf018aaca93024e7d2fcad9da1f21118a4596.tar.gz
Update the atkbdc, atkbd, and psm drivers to probe/attach
more cleanly and consistently in all APCI, PnP BIOS, and "hint" cases. NOTE: this doesn't necessarily solve the problem that the PS/2 mouse is not detected after the recent ACPI update.
Diffstat (limited to 'sys/isa')
-rw-r--r--sys/isa/atkbd_isa.c54
-rw-r--r--sys/isa/atkbdc_isa.c195
-rw-r--r--sys/isa/psm.c155
3 files changed, 279 insertions, 125 deletions
diff --git a/sys/isa/atkbd_isa.c b/sys/isa/atkbd_isa.c
index 130b986..4dea5d1 100644
--- a/sys/isa/atkbd_isa.c
+++ b/sys/isa/atkbd_isa.c
@@ -52,12 +52,14 @@ typedef struct {
devclass_t atkbd_devclass;
+static void atkbdidentify(driver_t *driver, device_t dev);
static int atkbdprobe(device_t dev);
static int atkbdattach(device_t dev);
static int atkbdresume(device_t dev);
static void atkbd_isa_intr(void *arg);
static device_method_t atkbd_methods[] = {
+ DEVMETHOD(device_identify, atkbdidentify),
DEVMETHOD(device_probe, atkbdprobe),
DEVMETHOD(device_attach, atkbdattach),
DEVMETHOD(device_resume, atkbdresume),
@@ -70,17 +72,38 @@ static driver_t atkbd_driver = {
sizeof(atkbd_softc_t),
};
+static void
+atkbdidentify(driver_t *driver, device_t parent)
+{
+
+ /* always add at least one child */
+ BUS_ADD_CHILD(parent, KBDC_RID_KBD, driver->name, 0);
+}
+
static int
atkbdprobe(device_t dev)
{
- uintptr_t irq;
- uintptr_t flags;
+ struct resource *res;
+ u_long irq;
+ int flags;
+ int rid;
device_set_desc(dev, "AT Keyboard");
/* obtain parameters */
- BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
- BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags);
+ flags = device_get_flags(dev);
+
+ /* see if IRQ is available */
+ rid = KBDC_RID_KBD;
+ res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
+ RF_SHAREABLE | RF_ACTIVE);
+ if (res == NULL) {
+ if (bootverbose)
+ device_printf(dev, "unable to allocate IRQ\n");
+ return ENXIO;
+ }
+ irq = rman_get_start(res);
+ bus_release_resource(dev, SYS_RES_IRQ, rid, res);
/* probe the device */
return atkbd_probe_unit(device_get_unit(dev),
@@ -93,16 +116,16 @@ atkbdattach(device_t dev)
{
atkbd_softc_t *sc;
keyboard_t *kbd;
- uintptr_t irq;
- uintptr_t flags;
+ u_long irq;
+ int flags;
int rid;
int error;
sc = device_get_softc(dev);
- BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
- BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags);
-
+ rid = KBDC_RID_KBD;
+ irq = bus_get_resource_start(dev, SYS_RES_IRQ, rid);
+ flags = device_get_flags(dev);
error = atkbd_attach_unit(device_get_unit(dev), &kbd,
device_get_unit(device_get_parent(dev)),
irq, flags);
@@ -110,13 +133,16 @@ atkbdattach(device_t dev)
return error;
/* declare our interrupt handler */
- rid = 0;
- sc->intr = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, irq, irq, 1,
+ sc->intr = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
RF_SHAREABLE | RF_ACTIVE);
- BUS_SETUP_INTR(device_get_parent(dev), dev, sc->intr, INTR_TYPE_TTY,
- atkbd_isa_intr, kbd, &sc->ih);
+ if (sc->intr == NULL)
+ return ENXIO;
+ error = bus_setup_intr(dev, sc->intr, INTR_TYPE_TTY, atkbd_isa_intr,
+ kbd, &sc->ih);
+ if (error)
+ bus_release_resource(dev, SYS_RES_IRQ, rid, sc->intr);
- return 0;
+ return error;
}
static int
diff --git a/sys/isa/atkbdc_isa.c b/sys/isa/atkbdc_isa.c
index ce72f05..0528bb1 100644
--- a/sys/isa/atkbdc_isa.c
+++ b/sys/isa/atkbdc_isa.c
@@ -47,8 +47,8 @@ static MALLOC_DEFINE(M_ATKBDDEV, "atkbddev", "AT Keyboard device");
/* children */
typedef struct atkbdc_device {
- int flags; /* configuration flags */
- int irq; /* ISA IRQ mask */
+ struct resource_list resources;
+ int rid;
u_int32_t vendorid;
u_int32_t serial;
u_int32_t logicalid;
@@ -60,11 +60,21 @@ devclass_t atkbdc_devclass;
static int atkbdc_probe(device_t dev);
static int atkbdc_attach(device_t dev);
+static device_t atkbdc_add_child(device_t bus, int order, char *name,
+ int unit);
static int atkbdc_print_child(device_t bus, device_t dev);
static int atkbdc_read_ivar(device_t bus, device_t dev, int index,
uintptr_t *val);
static int atkbdc_write_ivar(device_t bus, device_t dev, int index,
uintptr_t val);
+static struct resource_list
+ *atkbdc_get_resource_list (device_t bus, device_t dev);
+static struct resource
+ *atkbdc_alloc_resource(device_t bus, device_t dev, int type,
+ int *rid, u_long start, u_long end,
+ u_long count, u_int flags);
+static int atkbdc_release_resource(device_t bus, device_t dev, int type,
+ int rid, struct resource *res);
static device_method_t atkbdc_methods[] = {
DEVMETHOD(device_probe, atkbdc_probe),
@@ -72,13 +82,18 @@ static device_method_t atkbdc_methods[] = {
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
+ DEVMETHOD(bus_add_child, atkbdc_add_child),
DEVMETHOD(bus_print_child, atkbdc_print_child),
DEVMETHOD(bus_read_ivar, atkbdc_read_ivar),
DEVMETHOD(bus_write_ivar, atkbdc_write_ivar),
- DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
- DEVMETHOD(bus_release_resource, bus_generic_release_resource),
+ DEVMETHOD(bus_get_resource_list,atkbdc_get_resource_list),
+ DEVMETHOD(bus_alloc_resource, atkbdc_alloc_resource),
+ DEVMETHOD(bus_release_resource, atkbdc_release_resource),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
+ DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
+ DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource),
+ DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource),
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
@@ -101,6 +116,8 @@ atkbdc_probe(device_t dev)
{
struct resource *port0;
struct resource *port1;
+ u_long start;
+ u_long count;
int error;
int rid;
@@ -110,25 +127,40 @@ atkbdc_probe(device_t dev)
device_set_desc(dev, "Keyboard controller (i8042)");
+ /*
+ * Adjust I/O port resources.
+ * The AT keyboard controller uses two ports (a command/data port
+ * 0x60 and a status port 0x64), which may be given to us in
+ * one resource (0x60 through 0x64) or as two separate resources
+ * (0x60 and 0x64). Furthermore, /boot/device.hints may contain
+ * just one port, 0x60. We shall adjust resource settings
+ * so that these two ports are available as two separate resources.
+ */
+ device_quiet(dev);
rid = 0;
+ if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &start, &count) != 0)
+ return ENXIO;
+ if (count > 1) /* adjust the count */
+ bus_set_resource(dev, SYS_RES_IOPORT, rid, start, 1);
port0 = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1,
RF_ACTIVE);
if (port0 == NULL)
return ENXIO;
- /* XXX */
- if (bus_get_resource_start(dev, SYS_RES_IOPORT, 1) <= 0) {
- bus_set_resource(dev, SYS_RES_IOPORT, 1,
- rman_get_start(port0) + KBD_STATUS_PORT, 1);
- }
rid = 1;
+ if (bus_get_resource(dev, SYS_RES_IOPORT, rid, NULL, NULL) != 0)
+ bus_set_resource(dev, SYS_RES_IOPORT, 1,
+ start + KBD_STATUS_PORT, 1);
port1 = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1,
RF_ACTIVE);
if (port1 == NULL) {
bus_release_resource(dev, SYS_RES_IOPORT, 0, port0);
return ENXIO;
}
+ device_verbose(dev);
error = atkbdc_probe_unit(device_get_unit(dev), port0, port1);
+ if (error == 0)
+ bus_generic_probe(dev);
bus_release_resource(dev, SYS_RES_IOPORT, 0, port0);
bus_release_resource(dev, SYS_RES_IOPORT, 1, port1);
@@ -136,44 +168,13 @@ atkbdc_probe(device_t dev)
return error;
}
-static void
-atkbdc_add_device(device_t dev, const char *name, int unit)
-{
- atkbdc_device_t *kdev;
- device_t child;
- int t;
-
- if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
- return;
-
- kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV,
- M_NOWAIT | M_ZERO);
- if (!kdev)
- return;
-
- if (resource_int_value(name, unit, "irq", &t) == 0)
- kdev->irq = t;
- else
- kdev->irq = -1;
-
- if (resource_int_value(name, unit, "flags", &t) == 0)
- kdev->flags = t;
- else
- kdev->flags = 0;
-
- child = device_add_child(dev, name, unit);
- device_set_ivars(child, kdev);
-}
-
static int
atkbdc_attach(device_t dev)
{
atkbdc_softc_t *sc;
- int unit, dunit;
+ int unit;
int error;
int rid;
- int i;
- const char *name, *dname;
unit = device_get_unit(dev);
sc = *(atkbdc_softc_t **)device_get_softc(dev);
@@ -211,40 +212,73 @@ atkbdc_attach(device_t dev)
}
*(atkbdc_softc_t **)device_get_softc(dev) = sc;
- /*
- * Add all devices configured to be attached to atkbdc0.
- */
- name = device_get_nameunit(dev);
- i = 0;
- while ((resource_find_match(&i, &dname, &dunit, "at", name)) == 0)
- atkbdc_add_device(dev, dname, dunit);
+ bus_generic_attach(dev);
+
+ return 0;
+}
+
+static device_t
+atkbdc_add_child(device_t bus, int order, char *name, int unit)
+{
+ atkbdc_device_t *ivar;
+ device_t child;
+ int t;
+
+ ivar = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV,
+ M_NOWAIT | M_ZERO);
+ if (!ivar)
+ return NULL;
+
+ child = device_add_child(bus, NULL, -1);
+ if (child == NULL) {
+ free(ivar, M_ATKBDDEV);
+ return child;
+ }
+
+ resource_list_init(&ivar->resources);
+ ivar->rid = order;
/*
- * and atkbdc?
+ * If the device is not created by the PnP BIOS or ACPI,
+ * refer to device hints for IRQ.
*/
- name = device_get_name(dev);
- i = 0;
- while ((resource_find_match(&i, &dname, &dunit, "at", name)) == 0)
- atkbdc_add_device(dev, dname, dunit);
+ if (ISA_PNP_PROBE(device_get_parent(bus), bus, atkbdc_ids) != 0) {
+ if (resource_int_value(name, unit, "irq", &t) != 0)
+ t = -1;
+ } else {
+ t = bus_get_resource_start(bus, SYS_RES_IRQ, ivar->rid);
+ }
+ if (t > 0)
+ resource_list_add(&ivar->resources, SYS_RES_IRQ, ivar->rid,
+ t, t, 1);
- bus_generic_attach(dev);
+ 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)
+ device_disable(child);
- return 0;
+ device_set_ivars(child, ivar);
+
+ return child;
}
static int
atkbdc_print_child(device_t bus, device_t dev)
{
atkbdc_device_t *kbdcdev;
+ u_long irq;
+ int flags;
int retval = 0;
kbdcdev = (atkbdc_device_t *)device_get_ivars(dev);
retval += bus_print_child_header(bus, dev);
- if (kbdcdev->flags != 0)
- retval += printf(" flags 0x%x", kbdcdev->flags);
- if (kbdcdev->irq != -1)
- retval += printf(" irq %d", kbdcdev->irq);
+ flags = device_get_flags(dev);
+ if (flags != 0)
+ retval += printf(" flags 0x%x", flags);
+ irq = bus_get_resource_start(dev, SYS_RES_IRQ, kbdcdev->rid);
+ if (irq != 0)
+ retval += printf(" irq %ld", irq);
retval += bus_print_child_footer(bus, dev);
return (retval);
@@ -257,12 +291,6 @@ atkbdc_read_ivar(device_t bus, device_t dev, int index, uintptr_t *val)
ivar = (atkbdc_device_t *)device_get_ivars(dev);
switch (index) {
- case KBDC_IVAR_IRQ:
- *val = (u_long)ivar->irq;
- break;
- case KBDC_IVAR_FLAGS:
- *val = (u_long)ivar->flags;
- break;
case KBDC_IVAR_VENDORID:
*val = (u_long)ivar->vendorid;
break;
@@ -288,12 +316,6 @@ atkbdc_write_ivar(device_t bus, device_t dev, int index, uintptr_t val)
ivar = (atkbdc_device_t *)device_get_ivars(dev);
switch (index) {
- case KBDC_IVAR_IRQ:
- ivar->irq = (int)val;
- break;
- case KBDC_IVAR_FLAGS:
- ivar->flags = (int)val;
- break;
case KBDC_IVAR_VENDORID:
ivar->vendorid = (u_int32_t)val;
break;
@@ -312,5 +334,36 @@ atkbdc_write_ivar(device_t bus, device_t dev, int index, uintptr_t val)
return 0;
}
+static struct resource_list
+*atkbdc_get_resource_list (device_t bus, device_t dev)
+{
+ atkbdc_device_t *ivar;
+
+ ivar = (atkbdc_device_t *)device_get_ivars(dev);
+ return &ivar->resources;
+}
+
+static struct resource
+*atkbdc_alloc_resource(device_t bus, device_t dev, int type, int *rid,
+ u_long start, u_long end, u_long count, u_int flags)
+{
+ atkbdc_device_t *ivar;
+
+ ivar = (atkbdc_device_t *)device_get_ivars(dev);
+ return resource_list_alloc(&ivar->resources, bus, dev, type, rid,
+ start, end, count, flags);
+}
+
+static int
+atkbdc_release_resource(device_t bus, device_t dev, int type, int rid,
+ struct resource *res)
+{
+ atkbdc_device_t *ivar;
+
+ ivar = (atkbdc_device_t *)device_get_ivars(dev);
+ return resource_list_release(&ivar->resources, bus, dev, type, rid,
+ res);
+}
+
DRIVER_MODULE(atkbdc, isa, atkbdc_driver, atkbdc_devclass, 0, 0);
DRIVER_MODULE(atkbdc, acpi, atkbdc_driver, atkbdc_devclass, 0, 0);
diff --git a/sys/isa/psm.c b/sys/isa/psm.c
index a756073..1bb5b71 100644
--- a/sys/isa/psm.c
+++ b/sys/isa/psm.c
@@ -216,6 +216,7 @@ typedef int packetfunc_t __P((struct psm_softc *, unsigned char *,
int *, int, mousestatus_t *));
/* function prototypes */
+static void psmidentify __P((driver_t *, device_t));
static int psmprobe __P((device_t));
static int psmattach __P((device_t));
static int psmdetach __P((device_t));
@@ -300,6 +301,7 @@ static struct {
/* device driver declarateion */
static device_method_t psm_methods[] = {
/* Device interface */
+ DEVMETHOD(device_identify, psmidentify),
DEVMETHOD(device_probe, psmprobe),
DEVMETHOD(device_attach, psmattach),
DEVMETHOD(device_detach, psmdetach),
@@ -314,14 +316,6 @@ static driver_t psm_driver = {
sizeof(struct psm_softc),
};
-#if notyet
-static struct isa_pnp_id psm_ids[] = {
- { 0x130fd041, "PS/2 mouse port" }, /* PNP0F13 */
- { 0x1303d041, "PS/2 port" }, /* PNP0313, XXX */
- { 0 }
-};
-#endif
-
#define CDEV_MAJOR 21
static struct cdevsw psm_cdevsw = {
@@ -781,6 +775,14 @@ doopen(int unit, int command_byte)
/* psm driver entry points */
+static void
+psmidentify(driver_t *driver, device_t parent)
+{
+
+ /* always add at least one child */
+ BUS_ADD_CHILD(parent, KBDC_RID_AUX, driver->name, 0);
+}
+
#define endprobe(v) { if (bootverbose) \
--verbose; \
kbdc_set_device_mask(sc->kbdc, mask); \
@@ -793,8 +795,6 @@ psmprobe(device_t dev)
{
int unit = device_get_unit(dev);
struct psm_softc *sc = device_get_softc(dev);
- uintptr_t irq;
- uintptr_t flags;
int stat[3];
int command_byte;
int mask;
@@ -805,17 +805,19 @@ psmprobe(device_t dev)
kbdc_debug(TRUE);
#endif
-#if notyet
- /* check PnP IDs */
- if (XXX_PNP_PROBE(device_get_parent(dev), dev, psm_ids) == ENXIO)
- return ENXIO;
-#endif
-
- BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
- BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags);
+ /* see if IRQ is available */
+ rid = KBDC_RID_AUX;
+ sc->intr = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
+ RF_SHAREABLE | RF_ACTIVE);
+ if (sc->intr == NULL) {
+ if (bootverbose)
+ device_printf(dev, "unable to allocate IRQ\n");
+ return (ENXIO);
+ }
+ bus_release_resource(dev, SYS_RES_IRQ, rid, sc->intr);
sc->kbdc = atkbdc_open(device_get_unit(device_get_parent(dev)));
- sc->config = flags & PSM_CONFIG_FLAGS;
+ sc->config = device_get_flags(dev) & PSM_CONFIG_FLAGS;
/* XXX: for backward compatibility */
#if defined(PSM_HOOKRESUME) || defined(PSM_HOOKAPM)
sc->config |=
@@ -1083,18 +1085,6 @@ psmprobe(device_t dev)
endprobe(ENXIO);
}
- /* see if IRQ is available */
- rid = 0;
- sc->intr = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, irq, irq, 1,
- RF_ACTIVE);
- if (sc->intr == NULL) {
- printf("psm%d: unable to allocate the IRQ resource (%d).\n",
- unit, (int)irq);
- endprobe(ENXIO);
- } else {
- bus_release_resource(dev, SYS_RES_IRQ, rid, sc->intr);
- }
-
/* done */
kbdc_set_device_mask(sc->kbdc, mask | KBD_AUX_CONTROL_BITS);
kbdc_lock(sc->kbdc, FALSE);
@@ -1106,7 +1096,6 @@ psmattach(device_t dev)
{
int unit = device_get_unit(dev);
struct psm_softc *sc = device_get_softc(dev);
- uintptr_t irq;
int error;
int rid;
@@ -1118,14 +1107,12 @@ psmattach(device_t dev)
callout_handle_init(&sc->callout);
/* Setup our interrupt handler */
- rid = 0;
- BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
- sc->intr = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, irq, irq, 1,
- RF_ACTIVE);
+ rid = KBDC_RID_AUX;
+ sc->intr = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
+ RF_SHAREABLE | RF_ACTIVE);
if (sc->intr == NULL)
return (ENXIO);
- error = BUS_SETUP_INTR(device_get_parent(dev), dev, sc->intr,
- INTR_TYPE_TTY, psmintr, sc, &sc->ih);
+ error = bus_setup_intr(dev, sc->intr, INTR_TYPE_TTY, psmintr, sc, &sc->ih);
if (error) {
bus_release_resource(dev, SYS_RES_IRQ, rid, sc->intr);
return (error);
@@ -1166,8 +1153,8 @@ psmdetach(device_t dev)
if (sc->state & PSM_OPEN)
return EBUSY;
- rid = 0;
- BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->intr, sc->ih);
+ rid = KBDC_RID_AUX;
+ bus_teardown_intr(dev, sc->intr, sc->ih);
bus_release_resource(dev, SYS_RES_IRQ, rid, sc->intr);
destroy_dev(sc->dev);
@@ -2783,3 +2770,91 @@ psmresume(device_t dev)
}
DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass, 0, 0);
+
+/*
+ * This sucks up assignments from PNPBIOS and ACPI.
+ */
+
+#define PSMCPNP_DRIVER_NAME "psmcpnp"
+
+static devclass_t psmcpnp_devclass;
+
+static device_probe_t psmcpnp_probe;
+static device_attach_t psmcpnp_attach;
+
+static device_method_t psmcpnp_methods[] = {
+ DEVMETHOD(device_probe, psmcpnp_probe),
+ DEVMETHOD(device_attach, psmcpnp_attach),
+
+ { 0, 0 }
+};
+
+static driver_t psmcpnp_driver = {
+ PSMCPNP_DRIVER_NAME,
+ psmcpnp_methods,
+ 1, /* no softc */
+};
+
+static struct isa_pnp_id psmcpnp_ids[] = {
+ { 0x130fd041, "PS/2 mouse port" }, /* PNP0F13 */
+ { 0x1303d041, "PS/2 port" }, /* PNP0313, XXX */
+ { 0 }
+};
+
+static int
+create_a_copy(device_t atkbdc, device_t me)
+{
+ device_t psm;
+ u_long irq;
+
+ irq = bus_get_resource_start(me, SYS_RES_IRQ, 0);
+ if (irq <= 0)
+ return ENXIO; /* shouldn't happen */
+
+ psm = BUS_ADD_CHILD(atkbdc, 1, "psm", 0);
+ if (psm == NULL)
+ return ENXIO;
+
+ /* move our resource to the new copy */
+ bus_set_resource(psm, SYS_RES_IRQ, KBDC_RID_AUX, irq, 1);
+ bus_delete_resource(me, SYS_RES_IRQ, 0);
+
+ /* ...then probe and attach it */
+ return device_probe_and_attach(psm);
+}
+
+static int
+psmcpnp_probe(device_t dev)
+{
+ device_t atkbdc;
+
+ if (ISA_PNP_PROBE(device_get_parent(dev), dev, psmcpnp_ids))
+ return ENXIO;
+
+ /*
+ * If we find an atkbdc device on the same bus,
+ * create our copy there.
+ */
+ atkbdc = device_find_child(device_get_parent(dev), ATKBDC_DRIVER_NAME,
+ device_get_unit(dev));
+ if (atkbdc == NULL)
+ return ENXIO;
+
+ if (device_get_state(atkbdc) == DS_ATTACHED)
+ create_a_copy(atkbdc, dev);
+
+ /* keep quiet */
+ if (!bootverbose)
+ device_quiet(dev);
+ return 0;
+}
+
+static int
+psmcpnp_attach(device_t dev)
+{
+
+ return 0;
+}
+
+DRIVER_MODULE(psmcpnp, isa, psmcpnp_driver, psmcpnp_devclass, 0, 0);
+DRIVER_MODULE(psmcpnp, acpi, psmcpnp_driver, psmcpnp_devclass, 0, 0);
OpenPOWER on IntegriCloud