Deleted Added
full compact
26c26
< * $FreeBSD: head/sys/dev/atkbdc/atkbdc_isa.c 57481 2000-02-25 11:40:31Z yokota $
---
> * $FreeBSD: head/sys/dev/atkbdc/atkbdc_isa.c 58271 2000-03-19 03:25:13Z yokota $
35a36
> #include <machine/bus_pio.h>
89a91,95
> static struct isa_pnp_id atkbdc_ids[] = {
> { 0x0303d041, "Keyboard controller (i8042)" }, /* PNP0303 */
> { 0 }
> };
>
93,95c99,102
< int error;
< int rid;
< struct resource *port;
---
> struct resource *port0;
> struct resource *port1;
> int error;
> int rid;
97,99c104,106
< /* Check isapnp ids */
< if (isa_get_vendorid(dev))
< return (ENXIO);
---
> /* check PnP IDs */
> if (ISA_PNP_PROBE(device_get_parent(dev), dev, atkbdc_ids) == ENXIO)
> return ENXIO;
101c108,109
< device_set_desc(dev, "keyboard controller (i8042)");
---
> device_set_desc(dev, "Keyboard controller (i8042)");
>
103,105c111,113
< port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
< 0, ~0, IO_KBDSIZE, RF_ACTIVE);
< if (!port)
---
> port0 = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1,
> RF_ACTIVE);
> if (port0 == NULL)
107,108c115,132
< error = atkbdc_probe_unit(device_get_unit(dev), rman_get_start(port));
< bus_release_resource(dev, SYS_RES_IOPORT, rid, port);
---
> /* 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;
> 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;
> }
>
> error = atkbdc_probe_unit(device_get_unit(dev), port0, port1);
>
> bus_release_resource(dev, SYS_RES_IOPORT, 0, port0);
> bus_release_resource(dev, SYS_RES_IOPORT, 1, port1);
>
115d138
< atkbdc_softc_t *sc = *(atkbdc_softc_t **)device_get_softc(dev);
128,129d150
< kdev->port = sc->port;
<
148d168
< struct resource *port;
169d188
< /* XXX should track resource in softc */
171,173c190,192
< port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
< 0, ~0, IO_KBDSIZE, RF_ACTIVE);
< if (!port)
---
> sc->port0 = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1,
> RF_ACTIVE);
> if (sc->port0 == NULL)
175,176c194,205
< error = atkbdc_attach_unit(unit, sc, rman_get_start(port));
< if (error)
---
> rid = 1;
> sc->port1 = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1,
> RF_ACTIVE);
> if (sc->port1 == NULL) {
> bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->port0);
> return ENXIO;
> }
>
> error = atkbdc_attach_unit(unit, sc, sc->port0, sc->port1);
> if (error) {
> bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->port0);
> bus_release_resource(dev, SYS_RES_IOPORT, 1, sc->port1);
177a207
> }