From 261c00b8282a479f3da7678f0fb524893ec0b689 Mon Sep 17 00:00:00 2001 From: emax Date: Wed, 5 Jul 2006 17:18:47 +0000 Subject: Replace inb() and outb() with bus_space_read_1() and bus_space_write_1() Submitted by: marius MFC after: 1 week --- sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c | 18 ++++++++++-------- sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'sys') diff --git a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c index 16a7de4..2687c0e 100644 --- a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c +++ b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c @@ -96,30 +96,30 @@ static void bt3c_download_firmware (bt3c_softc_p, char const *, int); #define bt3c_set_address(sc, address) \ do { \ - outb(rman_get_start((sc)->iobase) + BT3C_ADDR_L, ((address) & 0xff)); \ - outb(rman_get_start((sc)->iobase) + BT3C_ADDR_H, (((address) >> 8) & 0xff)); \ + bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_ADDR_L, ((address) & 0xff)); \ + bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_ADDR_H, (((address) >> 8) & 0xff)); \ } while (0) #define bt3c_read_data(sc, data) \ do { \ - (data) = inb(rman_get_start((sc)->iobase) + BT3C_DATA_L); \ - (data) |= ((inb(rman_get_start((sc)->iobase) + BT3C_DATA_H) & 0xff) << 8); \ + (data) = bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_DATA_L); \ + (data) |= ((bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_DATA_H) & 0xff) << 8); \ } while (0) #define bt3c_write_data(sc, data) \ do { \ - outb(rman_get_start((sc)->iobase) + BT3C_DATA_L, ((data) & 0xff)); \ - outb(rman_get_start((sc)->iobase) + BT3C_DATA_H, (((data) >> 8) & 0xff)); \ + bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_DATA_L, ((data) & 0xff)); \ + bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_DATA_H, (((data) >> 8) & 0xff)); \ } while (0) #define bt3c_read_control(sc, data) \ do { \ - (data) = inb(rman_get_start((sc)->iobase) + BT3C_CONTROL); \ + (data) = bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_CONTROL); \ } while (0) #define bt3c_write_control(sc, data) \ do { \ - outb(rman_get_start((sc)->iobase) + BT3C_CONTROL, (data)); \ + bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_CONTROL, (data)); \ } while (0) #define bt3c_read(sc, address, data) \ @@ -622,6 +622,8 @@ bt3c_pccard_attach(device_t dev) device_printf(dev, "Could not allocate I/O ports\n"); goto bad; } + sc->iot = rman_get_bustag(sc->iobase); + sc->ioh = rman_get_bushandle(sc->iobase); /* Allocate IRQ */ sc->irq_rid = 0; diff --git a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h index 76d959a..0496ac2 100644 --- a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h +++ b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h @@ -63,6 +63,8 @@ struct bt3c_softc { device_t dev; /* pointer back to device */ int iobase_rid; /* iobase RID */ struct resource *iobase; /* iobase */ + bus_space_tag_t iot; /* I/O tag */ + bus_space_handle_t ioh; /* I/O handle */ int irq_rid; /* irq RID */ struct resource *irq; /* irq */ void *irq_cookie; /* irq cookie */ -- cgit v1.1