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

1 /*-
33 #include <sys/kernel.h>
60 * I/O registers offsets - the base address is programmed via the
63 #define SMBSTS 0x0 /* SMBus host/slave status register */
64 #define SMBCMD 0x1 /* SMBus host/slave command register */
130 #define ALPM_LOCK(alpm) mtx_lock(&(alpm)->lock)
131 #define ALPM_UNLOCK(alpm) mtx_unlock(&(alpm)->lock)
132 #define ALPM_LOCK_ASSERT(alpm) mtx_assert(&(alpm)->lock, MA_OWNED)
135 (bus_space_read_1(alpm->smbst, alpm->smbsh, register))
137 (bus_space_write_1(alpm->smbst, alpm->smbsh, register, value))
179 (l & SMBHSI_SLAVE) ? "slave":"noslave"); in alpm_attach()
209 alpm->res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, in alpm_attach()
212 if (alpm->res == NULL) { in alpm_attach()
216 alpm->smbst = rman_get_bustag(alpm->res); in alpm_attach()
217 alpm->smbsh = rman_get_bushandle(alpm->res); in alpm_attach()
218 mtx_init(&alpm->lock, device_get_nameunit(dev), "alpm", MTX_DEF); in alpm_attach()
221 alpm->smbus = device_add_child(dev, "smbus", DEVICE_UNIT_ANY); in alpm_attach()
222 if (alpm->smbus == NULL) { in alpm_attach()
236 if (alpm->smbus) { in alpm_detach()
237 device_delete_child(dev, alpm->smbus); in alpm_detach()
238 alpm->smbus = NULL; in alpm_detach()
240 mtx_destroy(&alpm->lock); in alpm_detach()
242 if (alpm->res) in alpm_detach()
243 bus_release_resource(dev, SYS_RES_IOPORT, SMBBA, alpm->res); in alpm_detach()
307 while (count--) { in alpm_wait()
337 alpm_quick(device_t dev, u_char slave, int how) in alpm_quick() argument
351 ALPM_DEBUG(printf("alpm: QWRITE to 0x%x", slave)); in alpm_quick()
352 ALPM_SMBOUTB(sc, SMBHADDR, slave & ~LSB); in alpm_quick()
355 ALPM_DEBUG(printf("alpm: QREAD to 0x%x", slave)); in alpm_quick()
356 ALPM_SMBOUTB(sc, SMBHADDR, slave | LSB); in alpm_quick()
374 alpm_sendb(device_t dev, u_char slave, char byte) in alpm_sendb() argument
386 ALPM_SMBOUTB(sc, SMBHADDR, slave & ~LSB); in alpm_sendb()
393 ALPM_DEBUG(printf("alpm: SENDB to 0x%x, byte=0x%x, error=0x%x\n", slave, byte, error)); in alpm_sendb()
400 alpm_recvb(device_t dev, u_char slave, char *byte) in alpm_recvb() argument
412 ALPM_SMBOUTB(sc, SMBHADDR, slave | LSB); in alpm_recvb()
419 ALPM_DEBUG(printf("alpm: RECVB from 0x%x, byte=0x%x, error=0x%x\n", slave, *byte, error)); in alpm_recvb()
426 alpm_writeb(device_t dev, u_char slave, char cmd, char byte) in alpm_writeb() argument
438 ALPM_SMBOUTB(sc, SMBHADDR, slave & ~LSB); in alpm_writeb()
446 …ALPM_DEBUG(printf("alpm: WRITEB to 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, byte, err… in alpm_writeb()
453 alpm_readb(device_t dev, u_char slave, char cmd, char *byte) in alpm_readb() argument
465 ALPM_SMBOUTB(sc, SMBHADDR, slave | LSB); in alpm_readb()
473 …ALPM_DEBUG(printf("alpm: READB from 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, *byte, e… in alpm_readb()
480 alpm_writew(device_t dev, u_char slave, char cmd, short word) in alpm_writew() argument
492 ALPM_SMBOUTB(sc, SMBHADDR, slave & ~LSB); in alpm_writew()
501 …ALPM_DEBUG(printf("alpm: WRITEW to 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, word, err… in alpm_writew()
508 alpm_readw(device_t dev, u_char slave, char cmd, short *word) in alpm_readw() argument
521 ALPM_SMBOUTB(sc, SMBHADDR, slave | LSB); in alpm_readw()
533 …ALPM_DEBUG(printf("alpm: READW from 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, *word, e… in alpm_readw()
540 alpm_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf) in alpm_bwrite() argument
556 ALPM_SMBOUTB(sc, SMBHADDR, slave & ~LSB); in alpm_bwrite()
559 * 32-byte long internal buffer */ in alpm_bwrite()
564 /* fill the 32-byte internal buffer */ in alpm_bwrite()
574 …ALPM_DEBUG(printf("alpm: WRITEBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, e… in alpm_bwrite()
581 alpm_bread(device_t dev, u_char slave, char cmd, u_char *count, char *buf) in alpm_bread() argument
597 ALPM_SMBOUTB(sc, SMBHADDR, slave | LSB); in alpm_bread()
600 * 32-byte long internal buffer */ in alpm_bread()
611 /* read the 32-byte internal buffer */ in alpm_bread()
621 …ALPM_DEBUG(printf("alpm: READBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, *count, cmd, e… in alpm_bread()