From 32d8ea84236e322dcdf2fa9029b08066ce5b2a5f Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 6 Jun 2008 18:29:56 +0000 Subject: [PATCH] - Use bus_foo() rather than bus_space_foo() and remove bus space tag/handle from softc. - Mark interrupt handlers MPSAFE as these drivers have been locked for a while. --- sys/dev/ichsmb/ichsmb.c | 124 ++++++++++++++++++------------------ sys/dev/ichsmb/ichsmb_pci.c | 4 +- sys/dev/ichsmb/ichsmb_var.h | 2 - sys/pci/amdpm.c | 12 ++-- sys/pci/amdsmb.c | 8 +-- sys/pci/intpm.c | 4 +- sys/pci/nfsmb.c | 10 +-- sys/pci/viapm.c | 12 +--- 8 files changed, 76 insertions(+), 100 deletions(-) diff --git a/sys/dev/ichsmb/ichsmb.c b/sys/dev/ichsmb/ichsmb.c index 9c60df7302fc..d9024420c93b 100644 --- a/sys/dev/ichsmb/ichsmb.c +++ b/sys/dev/ichsmb/ichsmb.c @@ -121,10 +121,10 @@ ichsmb_attach(device_t dev) } /* Clear interrupt conditions */ - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_STA, 0xff); + bus_write_1(sc->io_res, ICH_HST_STA, 0xff); /* Set up interrupt handler */ - error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC, + error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, ichsmb_device_intr, sc, &sc->irq_handle); if (error != 0) { device_printf(dev, "can't setup irq\n"); @@ -181,10 +181,10 @@ ichsmb_quick(device_t dev, u_char slave, int how) case SMB_QWRITE: mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_QUICK; - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, + bus_write_1(sc->io_res, ICH_XMIT_SLVA, (slave << 1) | (how == SMB_QREAD ? ICH_XMIT_SLVA_READ : ICH_XMIT_SLVA_WRITE)); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, + bus_write_1(sc->io_res, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); smb_error = ichsmb_wait(sc); mtx_unlock(&sc->mutex); @@ -207,10 +207,10 @@ ichsmb_sendb(device_t dev, u_char slave, char byte) ("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd)); mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE; - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, + bus_write_1(sc->io_res, ICH_XMIT_SLVA, (slave << 1) | ICH_XMIT_SLVA_WRITE); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, byte); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, + bus_write_1(sc->io_res, ICH_HST_CMD, byte); + bus_write_1(sc->io_res, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); smb_error = ichsmb_wait(sc); mtx_unlock(&sc->mutex); @@ -229,12 +229,12 @@ ichsmb_recvb(device_t dev, u_char slave, char *byte) ("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd)); mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE; - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, + bus_write_1(sc->io_res, ICH_XMIT_SLVA, (slave << 1) | ICH_XMIT_SLVA_READ); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, + bus_write_1(sc->io_res, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR) - *byte = bus_space_read_1(sc->io_bst, sc->io_bsh, ICH_D0); + *byte = bus_read_1(sc->io_res, ICH_D0); mtx_unlock(&sc->mutex); DBG("smb_error=%d byte=0x%02x\n", smb_error, (u_char)*byte); return (smb_error); @@ -252,11 +252,11 @@ ichsmb_writeb(device_t dev, u_char slave, char cmd, char byte) ("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd)); mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE_DATA; - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, + bus_write_1(sc->io_res, ICH_XMIT_SLVA, (slave << 1) | ICH_XMIT_SLVA_WRITE); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, byte); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, + bus_write_1(sc->io_res, ICH_HST_CMD, cmd); + bus_write_1(sc->io_res, ICH_D0, byte); + bus_write_1(sc->io_res, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); smb_error = ichsmb_wait(sc); mtx_unlock(&sc->mutex); @@ -276,12 +276,12 @@ ichsmb_writew(device_t dev, u_char slave, char cmd, short word) ("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd)); mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_WORD_DATA; - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, + bus_write_1(sc->io_res, ICH_XMIT_SLVA, (slave << 1) | ICH_XMIT_SLVA_WRITE); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, word & 0xff); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D1, word >> 8); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, + bus_write_1(sc->io_res, ICH_HST_CMD, cmd); + bus_write_1(sc->io_res, ICH_D0, word & 0xff); + bus_write_1(sc->io_res, ICH_D1, word >> 8); + bus_write_1(sc->io_res, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); smb_error = ichsmb_wait(sc); mtx_unlock(&sc->mutex); @@ -300,13 +300,13 @@ ichsmb_readb(device_t dev, u_char slave, char cmd, char *byte) ("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd)); mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE_DATA; - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, + bus_write_1(sc->io_res, ICH_XMIT_SLVA, (slave << 1) | ICH_XMIT_SLVA_READ); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, + bus_write_1(sc->io_res, ICH_HST_CMD, cmd); + bus_write_1(sc->io_res, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR) - *byte = bus_space_read_1(sc->io_bst, sc->io_bsh, ICH_D0); + *byte = bus_read_1(sc->io_res, ICH_D0); mtx_unlock(&sc->mutex); DBG("smb_error=%d byte=0x%02x\n", smb_error, (u_char)*byte); return (smb_error); @@ -323,16 +323,16 @@ ichsmb_readw(device_t dev, u_char slave, char cmd, short *word) ("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd)); mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_WORD_DATA; - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, + bus_write_1(sc->io_res, ICH_XMIT_SLVA, (slave << 1) | ICH_XMIT_SLVA_READ); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, + bus_write_1(sc->io_res, ICH_HST_CMD, cmd); + bus_write_1(sc->io_res, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR) { - *word = (bus_space_read_1(sc->io_bst, - sc->io_bsh, ICH_D0) & 0xff) - | (bus_space_read_1(sc->io_bst, - sc->io_bsh, ICH_D1) << 8); + *word = (bus_read_1(sc->io_res, + ICH_D0) & 0xff) + | (bus_read_1(sc->io_res, + ICH_D1) << 8); } mtx_unlock(&sc->mutex); DBG("smb_error=%d word=0x%04x\n", smb_error, (u_int16_t)*word); @@ -351,18 +351,18 @@ ichsmb_pcall(device_t dev, u_char slave, char cmd, short sdata, short *rdata) ("%s: ich_cmd=%d\n", __func__ , sc->ich_cmd)); mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_PROC_CALL; - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, + bus_write_1(sc->io_res, ICH_XMIT_SLVA, (slave << 1) | ICH_XMIT_SLVA_WRITE); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, sdata & 0xff); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D1, sdata >> 8); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, + bus_write_1(sc->io_res, ICH_HST_CMD, cmd); + bus_write_1(sc->io_res, ICH_D0, sdata & 0xff); + bus_write_1(sc->io_res, ICH_D1, sdata >> 8); + bus_write_1(sc->io_res, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR) { - *rdata = (bus_space_read_1(sc->io_bst, - sc->io_bsh, ICH_D0) & 0xff) - | (bus_space_read_1(sc->io_bst, - sc->io_bsh, ICH_D1) << 8); + *rdata = (bus_read_1(sc->io_res, + ICH_D0) & 0xff) + | (bus_read_1(sc->io_res, + ICH_D1) << 8); } mtx_unlock(&sc->mutex); DBG("smb_error=%d rdata=0x%04x\n", smb_error, (u_int16_t)*rdata); @@ -402,12 +402,12 @@ ichsmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf) mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BLOCK; - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, + bus_write_1(sc->io_res, ICH_XMIT_SLVA, (slave << 1) | ICH_XMIT_SLVA_WRITE); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, count); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_BLOCK_DB, buf[0]); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, + bus_write_1(sc->io_res, ICH_HST_CMD, cmd); + bus_write_1(sc->io_res, ICH_D0, count); + bus_write_1(sc->io_res, ICH_BLOCK_DB, buf[0]); + bus_write_1(sc->io_res, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); smb_error = ichsmb_wait(sc); mtx_unlock(&sc->mutex); @@ -433,11 +433,11 @@ ichsmb_bread(device_t dev, u_char slave, char cmd, u_char *count, char *buf) mtx_lock(&sc->mutex); sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BLOCK; - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA, + bus_write_1(sc->io_res, ICH_XMIT_SLVA, (slave << 1) | ICH_XMIT_SLVA_READ); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd); - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, *count); /* XXX? */ - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT, + bus_write_1(sc->io_res, ICH_HST_CMD, cmd); + bus_write_1(sc->io_res, ICH_D0, *count); /* XXX? */ + bus_write_1(sc->io_res, ICH_HST_CNT, ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd); if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR) { bcopy(sc->block_data, buf, min(sc->block_count, *count)); @@ -509,7 +509,7 @@ ichsmb_device_intr(void *cookie) for (count = 0; count < maxloops; count++) { /* Get and reset status bits */ - status = bus_space_read_1(sc->io_bst, sc->io_bsh, ICH_HST_STA); + status = bus_read_1(sc->io_res, ICH_HST_STA); #if ICHSMB_DEBUG if ((status & ~(ICH_HST_STA_INUSE_STS | ICH_HST_STA_HOST_BUSY)) || count > 0) { @@ -532,7 +532,7 @@ ichsmb_device_intr(void *cookie) if ((status & ~ok_bits) != 0) { device_printf(dev, "irq 0x%02x during %d\n", status, cmd_index); - bus_space_write_1(sc->io_bst, sc->io_bsh, + bus_write_1(sc->io_res, ICH_HST_STA, (status & ~ok_bits)); continue; } @@ -567,16 +567,16 @@ ichsmb_device_intr(void *cookie) if (sc->block_index < sc->block_count) { /* Write next byte */ - bus_space_write_1(sc->io_bst, - sc->io_bsh, ICH_BLOCK_DB, + bus_write_1(sc->io_res, + ICH_BLOCK_DB, sc->block_data[sc->block_index++]); } } else { /* First interrupt, get the count also */ if (sc->block_index == 0) { - sc->block_count = bus_space_read_1( - sc->io_bst, sc->io_bsh, ICH_D0); + sc->block_count = bus_read_1( + sc->io_res, ICH_D0); } /* Get next byte, if any */ @@ -584,15 +584,15 @@ ichsmb_device_intr(void *cookie) /* Read next byte */ sc->block_data[sc->block_index++] = - bus_space_read_1(sc->io_bst, - sc->io_bsh, ICH_BLOCK_DB); + bus_read_1(sc->io_res, + ICH_BLOCK_DB); /* Set "LAST_BYTE" bit before reading the last byte of block data */ if (sc->block_index >= sc->block_count - 1) { - bus_space_write_1(sc->io_bst, - sc->io_bsh, ICH_HST_CNT, + bus_write_1(sc->io_res, + ICH_HST_CNT, ICH_HST_CNT_LAST_BYTE | ICH_HST_CNT_INTREN | sc->ich_cmd); @@ -606,21 +606,21 @@ ichsmb_device_intr(void *cookie) sc->smb_error = SMB_ENOERR; finished: sc->ich_cmd = -1; - bus_space_write_1(sc->io_bst, sc->io_bsh, + bus_write_1(sc->io_res, ICH_HST_STA, status); wakeup(sc); break; } /* Clear status bits and try again */ - bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_STA, status); + bus_write_1(sc->io_res, ICH_HST_STA, status); } mtx_unlock(&sc->mutex); /* Too many loops? */ if (count == maxloops) { device_printf(dev, "interrupt loop, status=0x%02x\n", - bus_space_read_1(sc->io_bst, sc->io_bsh, ICH_HST_STA)); + bus_read_1(sc->io_res, ICH_HST_STA)); } } @@ -645,7 +645,7 @@ ichsmb_wait(sc_p sc) break; case EWOULDBLOCK: device_printf(dev, "device timeout, status=0x%02x\n", - bus_space_read_1(sc->io_bst, sc->io_bsh, ICH_HST_STA)); + bus_read_1(sc->io_res, ICH_HST_STA)); sc->ich_cmd = -1; smb_error = SMB_ETIMEOUT; break; diff --git a/sys/dev/ichsmb/ichsmb_pci.c b/sys/dev/ichsmb/ichsmb_pci.c index e102f1fa1bdd..b6d11df94ffc 100644 --- a/sys/dev/ichsmb/ichsmb_pci.c +++ b/sys/dev/ichsmb/ichsmb_pci.c @@ -189,14 +189,12 @@ ichsmb_pci_attach(device_t dev) &sc->io_rid, 0, ~0, 16, RF_ACTIVE); if (sc->io_res == NULL) sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->io_rid, 0, ~0, 32, RF_ACTIVE); + &sc->io_rid, 0ul, ~0ul, 32, RF_ACTIVE); if (sc->io_res == NULL) { device_printf(dev, "can't map I/O\n"); error = ENXIO; goto fail; } - sc->io_bst = rman_get_bustag(sc->io_res); - sc->io_bsh = rman_get_bushandle(sc->io_res); /* Allocate interrupt */ sc->irq_rid = 0; diff --git a/sys/dev/ichsmb/ichsmb_var.h b/sys/dev/ichsmb/ichsmb_var.h index a7d0dcb234f9..bc35c540ccf5 100644 --- a/sys/dev/ichsmb/ichsmb_var.h +++ b/sys/dev/ichsmb/ichsmb_var.h @@ -51,8 +51,6 @@ struct ichsmb_softc { device_t smb; /* smb device */ struct resource *io_res; /* i/o port resource */ int io_rid; /* i/o port bus id */ - bus_space_tag_t io_bst; /* bus space tag */ - bus_space_handle_t io_bsh; /* bus space handle */ struct resource *irq_res; /* interrupt resource */ int irq_rid; /* interrupt bus id */ void *irq_handle; /* handle for interrupt code */ diff --git a/sys/pci/amdpm.c b/sys/pci/amdpm.c index f8ec9c54848b..63b8fe1330ef 100644 --- a/sys/pci/amdpm.c +++ b/sys/pci/amdpm.c @@ -123,8 +123,6 @@ struct amdpm_softc { int base; int rid; struct resource *res; - bus_space_tag_t smbst; - bus_space_handle_t smbsh; device_t smbus; struct mtx lock; }; @@ -134,13 +132,13 @@ struct amdpm_softc { #define AMDPM_LOCK_ASSERT(amdpm) mtx_assert(&(amdpm)->lock, MA_OWNED) #define AMDPM_SMBINB(amdpm,register) \ - (bus_space_read_1(amdpm->smbst, amdpm->smbsh, register)) + (bus_read_1(amdpm->res, register)) #define AMDPM_SMBOUTB(amdpm,register,value) \ - (bus_space_write_1(amdpm->smbst, amdpm->smbsh, register, value)) + (bus_write_1(amdpm->res, register, value)) #define AMDPM_SMBINW(amdpm,register) \ - (bus_space_read_2(amdpm->smbst, amdpm->smbsh, register)) + (bus_read_2(amdpm->res, register)) #define AMDPM_SMBOUTW(amdpm,register,value) \ - (bus_space_write_2(amdpm->smbst, amdpm->smbsh, register, value)) + (bus_write_2(amdpm->res, register, value)) static int amdpm_detach(device_t dev); @@ -213,8 +211,6 @@ amdpm_attach(device_t dev) return (ENXIO); } - amdpm_sc->smbst = rman_get_bustag(amdpm_sc->res); - amdpm_sc->smbsh = rman_get_bushandle(amdpm_sc->res); mtx_init(&amdpm_sc->lock, device_get_nameunit(dev), "amdpm", MTX_DEF); /* Allocate a new smbus device */ diff --git a/sys/pci/amdsmb.c b/sys/pci/amdsmb.c index ecf4fccd8577..264b11a1b366 100644 --- a/sys/pci/amdsmb.c +++ b/sys/pci/amdsmb.c @@ -110,8 +110,6 @@ static int amdsmb_debug = 0; struct amdsmb_softc { int rid; struct resource *res; - bus_space_tag_t smbst; - bus_space_handle_t smbsh; device_t smbus; struct mtx lock; }; @@ -121,9 +119,9 @@ struct amdsmb_softc { #define AMDSMB_LOCK_ASSERT(amdsmb) mtx_assert(&(amdsmb)->lock, MA_OWNED) #define AMDSMB_ECINB(amdsmb, register) \ - (bus_space_read_1(amdsmb->smbst, amdsmb->smbsh, register)) + (bus_read_1(amdsmb->res, register)) #define AMDSMB_ECOUTB(amdsmb, register, value) \ - (bus_space_write_1(amdsmb->smbst, amdsmb->smbsh, register, value)) + (bus_write_1(amdsmb->res, register, value)) static int amdsmb_detach(device_t dev); @@ -163,8 +161,6 @@ amdsmb_attach(device_t dev) return (ENXIO); } - amdsmb_sc->smbst = rman_get_bustag(amdsmb_sc->res); - amdsmb_sc->smbsh = rman_get_bushandle(amdsmb_sc->res); mtx_init(&amdsmb_sc->lock, device_get_nameunit(dev), "amdsmb", MTX_DEF); /* Allocate a new smbus device */ diff --git a/sys/pci/intpm.c b/sys/pci/intpm.c index 3cae6cc6a2eb..6b711837d43f 100644 --- a/sys/pci/intpm.c +++ b/sys/pci/intpm.c @@ -160,8 +160,8 @@ intsmb_attach(device_t dev) goto fail; } - error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC, NULL, - intsmb_rawintr, sc, &sc->irq_hand); + error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, intsmb_rawintr, sc, &sc->irq_hand); if (error) { device_printf(dev, "Failed to map intr\n"); goto fail; diff --git a/sys/pci/nfsmb.c b/sys/pci/nfsmb.c index 454581818ee5..570cd50e5956 100644 --- a/sys/pci/nfsmb.c +++ b/sys/pci/nfsmb.c @@ -111,8 +111,6 @@ static int nfsmb_debug = 0; struct nfsmb_softc { int rid; struct resource *res; - bus_space_tag_t smbst; - bus_space_handle_t smbsh; device_t smbus; device_t subdev; struct mtx lock; @@ -123,9 +121,9 @@ struct nfsmb_softc { #define NFSMB_LOCK_ASSERT(nfsmb) mtx_assert(&(nfsmb)->lock, MA_OWNED) #define NFSMB_SMBINB(nfsmb, register) \ - (bus_space_read_1(nfsmb->smbst, nfsmb->smbsh, register)) + (bus_read_1(nfsmb->res, register)) #define NFSMB_SMBOUTB(nfsmb, register, value) \ - (bus_space_write_1(nfsmb->smbst, nfsmb->smbsh, register, value)) + (bus_write_1(nfsmb->res, register, value)) static int nfsmb_detach(device_t dev); static int nfsmbsub_detach(device_t dev); @@ -188,8 +186,6 @@ nfsmbsub_attach(device_t dev) return (ENXIO); } } - nfsmbsub_sc->smbst = rman_get_bustag(nfsmbsub_sc->res); - nfsmbsub_sc->smbsh = rman_get_bushandle(nfsmbsub_sc->res); mtx_init(&nfsmbsub_sc->lock, device_get_nameunit(dev), "nfsmb", MTX_DEF); @@ -226,8 +222,6 @@ nfsmb_attach(device_t dev) } } - nfsmb_sc->smbst = rman_get_bustag(nfsmb_sc->res); - nfsmb_sc->smbsh = rman_get_bushandle(nfsmb_sc->res); mtx_init(&nfsmb_sc->lock, device_get_nameunit(dev), "nfsmb", MTX_DEF); /* Allocate a new smbus device */ diff --git a/sys/pci/viapm.c b/sys/pci/viapm.c index d9305e2b2b97..4e0459315c1c 100644 --- a/sys/pci/viapm.c +++ b/sys/pci/viapm.c @@ -73,9 +73,9 @@ static int viapm_debug = 0; #define VIA_CX700_PMU_ID 0x83241106 #define VIAPM_INB(port) \ - ((u_char)bus_space_read_1(viapm->st, viapm->sh, port)) + ((u_char)bus_read_1(viapm->iores, port)) #define VIAPM_OUTB(port,val) \ - (bus_space_write_1(viapm->st, viapm->sh, port, (u_char)(val))) + (bus_write_1(viapm->iores, port, (u_char)(val))) #define VIAPM_TYP_UNKNOWN 0 #define VIAPM_TYP_586B_3040E 1 @@ -91,8 +91,6 @@ static int viapm_debug = 0; struct viapm_softc { int type; u_int32_t base; - bus_space_tag_t st; - bus_space_handle_t sh; int iorid; int irqrid; struct resource *iores; @@ -347,8 +345,6 @@ viapm_pro_attach(device_t dev) device_printf(dev, "could not allocate bus space\n"); goto error; } - viapm->st = rman_get_bustag(viapm->iores); - viapm->sh = rman_get_bushandle(viapm->iores); #ifdef notyet /* force irq 9 */ @@ -363,7 +359,7 @@ viapm_pro_attach(device_t dev) goto error; } - if (bus_setup_intr(dev, viapm->irqres, INTR_TYPE_MISC, + if (bus_setup_intr(dev, viapm->irqres, INTR_TYPE_MISC | INTR_MPSAFE, (driver_intr_t *) viasmb_intr, viapm, &viapm->irqih)) { device_printf(dev, "could not setup irq\n"); goto error; @@ -423,8 +419,6 @@ viapm_586b_attach(device_t dev) device_printf(dev, "could not allocate bus resource\n"); goto error; } - viapm->st = rman_get_bustag(viapm->iores); - viapm->sh = rman_get_bushandle(viapm->iores); VIAPM_OUTB(GPIO_DIR, VIAPM_INB(GPIO_DIR) | VIAPM_SCL | VIAPM_SDA);