Lines Matching +full:slave +full:- +full:kernel

1 /*-
29 #include <sys/kernel.h>
94 #define SMB_STS_PEC 0x1f /* PEC (CRC-8) Error */
114 #define AMDSMB_LOCK(amdsmb) mtx_lock(&(amdsmb)->lock)
115 #define AMDSMB_UNLOCK(amdsmb) mtx_unlock(&(amdsmb)->lock)
116 #define AMDSMB_LOCK_ASSERT(amdsmb) mtx_assert(&(amdsmb)->lock, MA_OWNED)
119 (bus_read_1(amdsmb->res, register))
121 (bus_write_1(amdsmb->res, register, value))
127 PCI_DESCR("AMD-8111 SMBus 2.0 Controller") }
138 device_set_desc(dev, tbl->descr); in amdsmb_probe()
149 amdsmb_sc->rid = PCIR_BAR(0); in amdsmb_attach()
151 amdsmb_sc->res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, in amdsmb_attach()
152 &amdsmb_sc->rid, RF_ACTIVE); in amdsmb_attach()
154 if (amdsmb_sc->res == NULL) { in amdsmb_attach()
159 mtx_init(&amdsmb_sc->lock, device_get_nameunit(dev), "amdsmb", MTX_DEF); in amdsmb_attach()
162 amdsmb_sc->smbus = device_add_child(dev, "smbus", DEVICE_UNIT_ANY); in amdsmb_attach()
163 if (!amdsmb_sc->smbus) { in amdsmb_attach()
178 if (amdsmb_sc->smbus) { in amdsmb_detach()
179 device_delete_child(dev, amdsmb_sc->smbus); in amdsmb_detach()
180 amdsmb_sc->smbus = NULL; in amdsmb_detach()
183 mtx_destroy(&amdsmb_sc->lock); in amdsmb_detach()
184 if (amdsmb_sc->res) in amdsmb_detach()
185 bus_release_resource(dev, SYS_RES_IOPORT, amdsmb_sc->rid, in amdsmb_detach()
186 amdsmb_sc->res); in amdsmb_detach()
212 while (timeout-- && AMDSMB_ECINB(sc, EC_SC) & EC_SC_IBF) in amdsmb_ec_wait_write()
215 device_printf(sc->smbus, "timeout waiting for IBF to clear\n"); in amdsmb_ec_wait_write()
226 while (timeout-- && ~AMDSMB_ECINB(sc, EC_SC) & EC_SC_OBF) in amdsmb_ec_wait_read()
229 device_printf(sc->smbus, "timeout waiting for OBF to set\n"); in amdsmb_ec_wait_read()
289 } while (temp != 0 && count--); in amdsmb_wait()
325 amdsmb_quick(device_t dev, u_char slave, int how) in amdsmb_quick() argument
336 AMDSMB_DEBUG(printf("amdsmb: QWRITE to 0x%x", slave)); in amdsmb_quick()
340 AMDSMB_DEBUG(printf("amdsmb: QREAD to 0x%x", slave)); in amdsmb_quick()
347 amdsmb_ec_write(sc, SMB_ADDR, slave); in amdsmb_quick()
359 amdsmb_sendb(device_t dev, u_char slave, char byte) in amdsmb_sendb() argument
366 amdsmb_ec_write(sc, SMB_ADDR, slave); in amdsmb_sendb()
372 slave, byte, error)); in amdsmb_sendb()
379 amdsmb_recvb(device_t dev, u_char slave, char *byte) in amdsmb_recvb() argument
385 amdsmb_ec_write(sc, SMB_ADDR, slave); in amdsmb_recvb()
392 slave, *byte, error)); in amdsmb_recvb()
399 amdsmb_writeb(device_t dev, u_char slave, char cmd, char byte) in amdsmb_writeb() argument
407 amdsmb_ec_write(sc, SMB_ADDR, slave); in amdsmb_writeb()
413 "error=0x%x\n", slave, cmd, byte, error)); in amdsmb_writeb()
420 amdsmb_readb(device_t dev, u_char slave, char cmd, char *byte) in amdsmb_readb() argument
427 amdsmb_ec_write(sc, SMB_ADDR, slave); in amdsmb_readb()
434 "error=0x%x\n", slave, cmd, (unsigned char)*byte, error)); in amdsmb_readb()
441 amdsmb_writew(device_t dev, u_char slave, char cmd, short word) in amdsmb_writew() argument
450 amdsmb_ec_write(sc, SMB_ADDR, slave); in amdsmb_writew()
456 "error=0x%x\n", slave, cmd, word, error)); in amdsmb_writew()
463 amdsmb_readw(device_t dev, u_char slave, char cmd, short *word) in amdsmb_readw() argument
471 amdsmb_ec_write(sc, SMB_ADDR, slave); in amdsmb_readw()
481 "error=0x%x\n", slave, cmd, (unsigned short)*word, error)); in amdsmb_readw()
488 amdsmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf) in amdsmb_bwrite() argument
502 amdsmb_ec_write(sc, SMB_ADDR, slave); in amdsmb_bwrite()
508 "error=0x%x", slave, count, cmd, error)); in amdsmb_bwrite()
515 amdsmb_bread(device_t dev, u_char slave, char cmd, u_char *count, char *buf) in amdsmb_bread() argument
526 amdsmb_ec_write(sc, SMB_ADDR, slave); in amdsmb_bread()
540 "error=0x%x", slave, *count, cmd, error)); in amdsmb_bread()