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

1 /*-
29 #include <sys/kernel.h>
100 #define SMB_STS_PEC 0x1F /* PEC (CRC-8) Error */
121 #define NFSMB_LOCK(nfsmb) mtx_lock(&(nfsmb)->lock)
122 #define NFSMB_UNLOCK(nfsmb) mtx_unlock(&(nfsmb)->lock)
123 #define NFSMB_LOCK_ASSERT(nfsmb) mtx_assert(&(nfsmb)->lock, MA_OWNED)
126 (bus_read_1(nfsmb->res, register))
128 (bus_write_1(nfsmb->res, register, value))
182 nfsmbsub_sc->rid = NF2PCI_SMBASE_2; in nfsmbsub_attach()
184 nfsmbsub_sc->res = bus_alloc_resource_any(parent, SYS_RES_IOPORT, in nfsmbsub_attach()
185 &nfsmbsub_sc->rid, RF_ACTIVE); in nfsmbsub_attach()
186 if (nfsmbsub_sc->res == NULL) { in nfsmbsub_attach()
187 /* Older incarnations of the device used non-standard BARs. */ in nfsmbsub_attach()
188 nfsmbsub_sc->rid = 0x54; in nfsmbsub_attach()
189 nfsmbsub_sc->res = bus_alloc_resource_any(parent, in nfsmbsub_attach()
190 SYS_RES_IOPORT, &nfsmbsub_sc->rid, RF_ACTIVE); in nfsmbsub_attach()
191 if (nfsmbsub_sc->res == NULL) { in nfsmbsub_attach()
196 mtx_init(&nfsmbsub_sc->lock, device_get_nameunit(dev), "nfsmb", in nfsmbsub_attach()
199 nfsmbsub_sc->smbus = device_add_child(dev, "smbus", DEVICE_UNIT_ANY); in nfsmbsub_attach()
200 if (nfsmbsub_sc->smbus == NULL) { in nfsmbsub_attach()
216 nfsmb_sc->rid = NF2PCI_SMBASE_1; in nfsmb_attach()
218 nfsmb_sc->res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, in nfsmb_attach()
219 &nfsmb_sc->rid, RF_ACTIVE); in nfsmb_attach()
221 if (nfsmb_sc->res == NULL) { in nfsmb_attach()
222 /* Older incarnations of the device used non-standard BARs. */ in nfsmb_attach()
223 nfsmb_sc->rid = 0x50; in nfsmb_attach()
224 nfsmb_sc->res = bus_alloc_resource_any(dev, in nfsmb_attach()
225 SYS_RES_IOPORT, &nfsmb_sc->rid, RF_ACTIVE); in nfsmb_attach()
226 if (nfsmb_sc->res == NULL) { in nfsmb_attach()
232 mtx_init(&nfsmb_sc->lock, device_get_nameunit(dev), "nfsmb", MTX_DEF); in nfsmb_attach()
235 nfsmb_sc->smbus = device_add_child(dev, "smbus", DEVICE_UNIT_ANY); in nfsmb_attach()
236 if (!nfsmb_sc->smbus) { in nfsmb_attach()
241 nfsmb_sc->subdev = NULL; in nfsmb_attach()
257 /* Trying to add secondary device as slave */ in nfsmb_attach()
258 nfsmb_sc->subdev = device_add_child(dev, "nfsmb", DEVICE_UNIT_ANY); in nfsmb_attach()
259 if (!nfsmb_sc->subdev) { in nfsmb_attach()
285 mtx_destroy(&nfsmbsub_sc->lock); in nfsmbsub_detach()
286 if (nfsmbsub_sc->res) { in nfsmbsub_detach()
287 bus_release_resource(parent, SYS_RES_IOPORT, nfsmbsub_sc->rid, in nfsmbsub_detach()
288 nfsmbsub_sc->res); in nfsmbsub_detach()
289 nfsmbsub_sc->res = NULL; in nfsmbsub_detach()
304 mtx_destroy(&nfsmb_sc->lock); in nfsmb_detach()
305 if (nfsmb_sc->res) { in nfsmb_detach()
306 bus_release_resource(dev, SYS_RES_IOPORT, nfsmb_sc->rid, in nfsmb_detach()
307 nfsmb_sc->res); in nfsmb_detach()
308 nfsmb_sc->res = NULL; in nfsmb_detach()
342 } while (NFSMB_SMBINB(sc, SMB_PRTCL) != 0 && count--); in nfsmb_wait()
377 nfsmb_quick(device_t dev, u_char slave, int how) in nfsmb_quick() argument
388 NFSMB_DEBUG(printf("nfsmb: QWRITE to 0x%x", slave)); in nfsmb_quick()
392 NFSMB_DEBUG(printf("nfsmb: QREAD to 0x%x", slave)); in nfsmb_quick()
399 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); in nfsmb_quick()
411 nfsmb_sendb(device_t dev, u_char slave, char byte) in nfsmb_sendb() argument
418 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); in nfsmb_sendb()
423 NFSMB_DEBUG(printf("nfsmb: SENDB to 0x%x, byte=0x%x, error=0x%x\n", slave, byte, error)); in nfsmb_sendb()
430 nfsmb_recvb(device_t dev, u_char slave, char *byte) in nfsmb_recvb() argument
436 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); in nfsmb_recvb()
442 NFSMB_DEBUG(printf("nfsmb: RECVB from 0x%x, byte=0x%x, error=0x%x\n", slave, *byte, error)); in nfsmb_recvb()
449 nfsmb_writeb(device_t dev, u_char slave, char cmd, char byte) in nfsmb_writeb() argument
457 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); in nfsmb_writeb()
462 …NFSMB_DEBUG(printf("nfsmb: WRITEB to 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, byte, e… in nfsmb_writeb()
469 nfsmb_readb(device_t dev, u_char slave, char cmd, char *byte) in nfsmb_readb() argument
476 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); in nfsmb_readb()
482 …NFSMB_DEBUG(printf("nfsmb: READB from 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, (unsig… in nfsmb_readb()
489 nfsmb_writew(device_t dev, u_char slave, char cmd, short word) in nfsmb_writew() argument
498 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); in nfsmb_writew()
503 …NFSMB_DEBUG(printf("nfsmb: WRITEW to 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, word, e… in nfsmb_writew()
510 nfsmb_readw(device_t dev, u_char slave, char cmd, short *word) in nfsmb_readw() argument
517 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); in nfsmb_readw()
524 …NFSMB_DEBUG(printf("nfsmb: READW from 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, (unsig… in nfsmb_readw()
531 nfsmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf) in nfsmb_bwrite() argument
545 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); in nfsmb_bwrite()
550 …NFSMB_DEBUG(printf("nfsmb: WRITEBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd,… in nfsmb_bwrite()
557 nfsmb_bread(device_t dev, u_char slave, char cmd, u_char *count, char *buf) in nfsmb_bread() argument
568 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); in nfsmb_bread()
581 …NFSMB_DEBUG(printf("nfsmb: READBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, *count, cmd,… in nfsmb_bread()