diff options
author | dfr <dfr@FreeBSD.org> | 1999-05-22 15:47:34 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1999-05-22 15:47:34 +0000 |
commit | b22d4cf457e89930b109c33ccbca02f7587c89e6 (patch) | |
tree | e817e202ab180af95627c8d9bf65e4e80578adc4 /sys/isa/sio.c | |
parent | a9c1a3ee02d01f394a40fbed871551a5c3e3d384 (diff) | |
download | FreeBSD-src-b22d4cf457e89930b109c33ccbca02f7587c89e6.zip FreeBSD-src-b22d4cf457e89930b109c33ccbca02f7587c89e6.tar.gz |
Use the resource apis to manipulate resources.
Diffstat (limited to 'sys/isa/sio.c')
-rw-r--r-- | sys/isa/sio.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 20354d3..8e32971 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.240 1999/05/09 20:35:02 peter Exp $ + * $Id: sio.c,v 1.241 1999/05/10 14:01:29 dfr Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -596,6 +596,14 @@ sioprobe(dev) int result; device_t xdev; u_int flags = isa_get_flags(dev); + int rid; + struct resource *port; + + rid = 0; + port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, + 0, ~0, IO_COMSIZE, RF_ACTIVE); + if (!port) + return ENXIO; if (!already_init) { /* @@ -638,7 +646,6 @@ sioprobe(dev) if (idev == NULL) { printf("sio%d: master device %d not configured\n", device_get_unit(dev), COM_MPMASTER(flags)); - isa_set_irq(dev, 0); idev = dev; } if (!COM_NOTAST4(flags)) { @@ -652,7 +659,7 @@ sioprobe(dev) mcr_image = 0; bzero(failures, sizeof failures); - iobase = isa_get_port(dev); + iobase = rman_get_start(port); /* * We don't want to get actual interrupts, just masked ones. @@ -741,7 +748,6 @@ sioprobe(dev) failures[6] = inb(iobase + com_iir); } /* Check IIR_TXRDY clear ? */ - isa_set_portsize(dev, IO_COMSIZE); result = 0; if ( failures[6] & IIR_TXRDY ) { /* Nop, Double check with clearing IER */ @@ -759,6 +765,7 @@ sioprobe(dev) } outb(iobase + com_cfcr, CFCR_8BITS); enable_intr(); + bus_release_resource(dev, SYS_RES_IOPORT, rid, port); return (iobase == siocniobase ? 0 : result); } @@ -809,7 +816,6 @@ sioprobe(dev) device_get_unit(dev), irqmap[0], irqmap[1], irqmap[2], irqmap[3]); - isa_set_portsize(dev, IO_COMSIZE); result = 0; for (fn = 0; fn < sizeof failures; ++fn) if (failures[fn]) { @@ -825,6 +831,7 @@ sioprobe(dev) } break; } + bus_release_resource(dev, SYS_RES_IOPORT, rid, port); return (iobase == siocniobase ? 0 : result); } @@ -907,8 +914,16 @@ sioattach(dev) struct resource *res; int zero = 0; u_int flags = isa_get_flags(dev); + int rid; + struct resource *port; + + rid = 0; + port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, + 0, ~0, IO_COMSIZE, RF_ACTIVE); + if (!port) + return ENXIO; - iobase = isa_get_port(dev); + iobase = rman_get_start(port); unit = device_get_unit(dev); com = device_get_softc(dev); |