summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1999-05-22 15:47:34 +0000
committerdfr <dfr@FreeBSD.org>1999-05-22 15:47:34 +0000
commitb22d4cf457e89930b109c33ccbca02f7587c89e6 (patch)
treee817e202ab180af95627c8d9bf65e4e80578adc4 /sys/isa
parenta9c1a3ee02d01f394a40fbed871551a5c3e3d384 (diff)
downloadFreeBSD-src-b22d4cf457e89930b109c33ccbca02f7587c89e6.zip
FreeBSD-src-b22d4cf457e89930b109c33ccbca02f7587c89e6.tar.gz
Use the resource apis to manipulate resources.
Diffstat (limited to 'sys/isa')
-rw-r--r--sys/isa/atkbdc_isa.c22
-rw-r--r--sys/isa/sio.c27
2 files changed, 39 insertions, 10 deletions
diff --git a/sys/isa/atkbdc_isa.c b/sys/isa/atkbdc_isa.c
index de1ecdb..2ac2525 100644
--- a/sys/isa/atkbdc_isa.c
+++ b/sys/isa/atkbdc_isa.c
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: atkbdc_isa.c,v 1.5 1999/05/09 20:45:53 peter Exp $
+ * $Id: atkbdc_isa.c,v 1.6 1999/05/18 11:33:14 yokota Exp $
*/
#include "atkbdc.h"
@@ -36,6 +36,9 @@
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/malloc.h>
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/rman.h>
#include <dev/kbd/atkbdcreg.h>
@@ -91,11 +94,17 @@ static int
atkbdc_probe(device_t dev)
{
int error;
+ int rid;
+ struct resource *port;
device_set_desc(dev, "keyboard controller (i8042)");
- error = atkbdc_probe_unit(device_get_unit(dev), isa_get_port(dev));
- if (error == 0)
- isa_set_portsize(dev, IO_KBDSIZE);
+ rid = 0;
+ port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
+ 0, ~0, IO_KBDSIZE, RF_ACTIVE);
+ if (!port)
+ return ENXIO;
+ error = atkbdc_probe_unit(device_get_unit(dev), rman_get_start(port));
+ bus_release_resource(dev, SYS_RES_IOPORT, rid, port);
return error;
}
@@ -106,12 +115,17 @@ atkbdc_add_device(device_t dev, const char *name, int unit)
atkbdc_device_t *kdev;
device_t child;
int t;
+ int rid;
+ struct resource *port;
kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, M_NOWAIT);
if (!kdev)
return;
bzero(kdev, sizeof *kdev);
+ /* XXX should track resource in softc */
+ port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
+ 0, ~0, IO_KBDSIZE, RF_ACTIVE);
kdev->port = sc->port;
if (resource_int_value(name, unit, "irq", &t) == 0)
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);
OpenPOWER on IntegriCloud