CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Mon Sep 19 22:11:41 UTC 2016 Modified Files: src/sys/dev/ic: nvme.c nvmevar.h Log Message: slightly optimize memory access - change struct nvme_queue so that the struct dmamem members are allocated as part of it, instead of separate kmem_alloc()s To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/nvme.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/nvmevar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/nvme.c diff -u src/sys/dev/ic/nvme.c:1.11 src/sys/dev/ic/nvme.c:1.12 --- src/sys/dev/ic/nvme.c:1.11 Mon Sep 19 20:33:51 2016 +++ src/sys/dev/ic/nvme.c Mon Sep 19 22:11:41 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nvme.c,v 1.11 2016/09/19 20:33:51 jdolecek Exp $ */ +/* $NetBSD: nvme.c,v 1.12 2016/09/19 22:11:41 jdolecek Exp $ */ /* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.11 2016/09/19 20:33:51 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.12 2016/09/19 22:11:41 jdolecek Exp $"); #include #include @@ -85,11 +85,9 @@ static void nvme_q_submit(struct nvme_so static int nvme_q_complete(struct nvme_softc *, struct nvme_queue *q); static void nvme_q_free(struct nvme_softc *, struct nvme_queue *); -static struct nvme_dmamem * - nvme_dmamem_alloc(struct nvme_softc *, size_t); +static int nvme_dmamem_alloc(struct nvme_softc *, size_t, + struct nvme_dmamem *); static void nvme_dmamem_free(struct nvme_softc *, struct nvme_dmamem *); -static void nvme_dmamem_sync(struct nvme_softc *, struct nvme_dmamem *, - int); static void nvme_ns_io_fill(struct nvme_queue *, struct nvme_ccb *, void *); @@ -153,8 +151,12 @@ nvme_write8(struct nvme_softc *sc, bus_s #endif } #endif /* __LP64__ */ + #define nvme_barrier(_s, _r, _l, _f) \ bus_space_barrier((_s)->sc_iot, (_s)->sc_ioh, (_r), (_l), (_f)) +#define nvme_dmamem_sync(sc, mem, ops) \ + bus_dmamap_sync((sc)->sc_dmat, NVME_DMA_MAP(mem), \ + 0, NVME_DMA_LEN(mem), (ops)); static void nvme_version(struct nvme_softc *sc, uint32_t ver) @@ -546,19 +548,19 @@ nvme_ns_identify(struct nvme_softc *sc, { struct nvme_sqe sqe; struct nvm_identify_namespace *identify; - struct nvme_dmamem *mem; + struct nvme_dmamem mem; struct nvme_ccb *ccb; struct nvme_namespace *ns; - int rv; + int error; KASSERT(nsid > 0); ccb = nvme_ccb_get(sc->sc_admin_q); KASSERT(ccb != NULL); /* it's a bug if we don't have spare ccb here */ - mem = nvme_dmamem_alloc(sc, sizeof(*identify)); - if (mem == NULL) - return ENOMEM; + error = nvme_dmamem_alloc(sc, sizeof(*identify), ); + if (error) + return error; memset(, 0, sizeof(sqe)); sqe.opcode = NVM_ADMIN_IDENTIFY; @@ -570,13 +572,14 @@ nvme_ns_identify(struct nvme_softc *sc, ccb->ccb_cookie = nvme_dmamem_sync(sc, mem, BUS_DMASYNC_PREREAD); - rv = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_sqe_fill, NVME_TIMO_IDENT); + error = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_sqe_fill, + NVME_TIMO_IDENT); nvme_dmamem_sync(sc, mem, BUS_DMASYNC_POSTREAD); nvme_ccb_put(sc->sc_admin_q, ccb); - if (rv != 0) { - rv = EIO; + if (error != 0) { + error = EIO; goto done; } @@ -590,9 +593,9 @@ nvme_ns_identify(struct nvme_softc *sc, ns->ident = identify; done: - nvme_dmamem_free(sc, mem); + nvme_dmamem_free(sc, ); - return rv; + return error; } int @@ -1073,29 +1076,29 @@ nvme_identify(struct nvme_softc *sc, u_i { char sn[41], mn[81], fr[17]; struct nvm_identify_controller *identify; - struct nvme_dmamem *mem; + struct nvme_dmamem mem; struct nvme_ccb *ccb; u_int mdts; - int rv = 1; + int error; ccb = nvme_ccb_get(sc->sc_admin_q); KASSERT(ccb != NULL); /* it's a bug if we don't have spare ccb here */ - mem = nvme_dmamem_alloc(sc, sizeof(*identify)); - if (mem == NULL) - return 1; + error = nvme_dmamem_alloc(sc, sizeof(*identify), ); + if (error) + return error; ccb->ccb_done = nvme_empty_done; - ccb->ccb_cookie = mem; + ccb->ccb_cookie = nvme_dmamem_sync(sc, mem, BUS_DMASYNC_PREREAD); - rv = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_fill_identify, + error = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_fill_identify, NVME_TIMO_IDENT); nvme_dmamem_sync(sc, mem, BUS_DMASYNC_POSTREAD); nvme_ccb_put(sc->sc_admin_q, ccb); - if (rv != 0) + if (error != 0) goto done; identify = NVME_DMA_KVA(mem); @@ -1120,9 +1123,9 @@ nvme_identify(struct nvme_softc *sc, u_i memcpy(>sc_identify, identify, sizeof(sc->sc_identify)); done: - nvme_dmamem_free(sc, mem); + nvme_dmamem_free(sc, ); - return rv; + return error; } static int @@ -1225,7 +1228,7 @@ nvme_fill_identify(struct nvme_queue *q, struct nvme_dmamem *mem = ccb->ccb_cookie; sqe->opcode = NVM_ADMIN_IDENTIFY; - htolem64(>entry.prp[0], NVME_DMA_DVA(mem)); + htolem64(>entry.prp[0],
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Mon Sep 19 20:33:51 UTC 2016 Modified Files: src/sys/dev/ic: ld_nvme.c nvme.c nvmevar.h Log Message: on further thought, just remove the separately allocated nvme_ns_context altogether and fold into nvme_ccb; allocating this separately just isn't useful To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/ld_nvme.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/nvme.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/nvmevar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ld_nvme.c diff -u src/sys/dev/ic/ld_nvme.c:1.5 src/sys/dev/ic/ld_nvme.c:1.6 --- src/sys/dev/ic/ld_nvme.c:1.5 Sun Sep 18 21:52:36 2016 +++ src/sys/dev/ic/ld_nvme.c Mon Sep 19 20:33:51 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_nvme.c,v 1.5 2016/09/18 21:52:36 jdolecek Exp $ */ +/* $NetBSD: ld_nvme.c,v 1.6 2016/09/19 20:33:51 jdolecek Exp $ */ /*- * Copyright (C) 2016 NONAKA Kimihiro@@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.5 2016/09/18 21:52:36 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.6 2016/09/19 20:33:51 jdolecek Exp $"); #include #include @@ -46,7 +46,6 @@ struct ld_nvme_softc { struct nvme_softc *sc_nvme; uint16_t sc_nsid; - int sc_attaching; }; static int ld_nvme_match(device_t, cfdata_t, void *); @@ -60,11 +59,8 @@ static int ld_nvme_start(struct ld_softc static int ld_nvme_dump(struct ld_softc *, void *, int, int); static int ld_nvme_flush(struct ld_softc *, int); -static int ld_nvme_dobio(struct ld_nvme_softc *, void *, int, daddr_t, - int, struct buf *); -static void ld_nvme_biodone(struct nvme_ns_context *); -static void ld_nvme_syncdone(struct nvme_ns_context *); - +static void ld_nvme_biodone(void *, struct buf *, uint16_t); +static void ld_nvme_syncdone(void *, struct buf *, uint16_t); static int ld_nvme_match(device_t parent, cfdata_t match, void *aux) @@ -92,7 +88,6 @@ ld_nvme_attach(device_t parent, device_t ld->sc_dv = self; sc->sc_nvme = nsc; sc->sc_nsid = naa->naa_nsid; - sc->sc_attaching = 1; aprint_naive("\n"); aprint_normal("\n"); @@ -117,8 +112,6 @@ ld_nvme_attach(device_t parent, device_t ld->sc_flush = ld_nvme_flush; ld->sc_flags = LDF_ENABLED; ldattach(ld, "fcfs"); - - sc->sc_attaching = 0; } static int @@ -142,8 +135,11 @@ ld_nvme_start(struct ld_softc *ld, struc { struct ld_nvme_softc *sc = device_private(ld->sc_dv); - return ld_nvme_dobio(sc, bp->b_data, bp->b_bcount, bp->b_rawblkno, - BUF_ISWRITE(bp), bp); + return nvme_ns_dobio(sc->sc_nvme, sc->sc_nsid, sc, + bp, bp->b_data, bp->b_bcount, + sc->sc_ld.sc_secsize, bp->b_rawblkno, + BUF_ISWRITE(bp) ? 0 : NVME_NS_CTX_F_READ, + ld_nvme_biodone); } static int @@ -151,51 +147,18 @@ ld_nvme_dump(struct ld_softc *ld, void * { struct ld_nvme_softc *sc = device_private(ld->sc_dv); - return ld_nvme_dobio(sc, data, blkcnt * ld->sc_secsize, blkno, 1, NULL); -} - -static int -ld_nvme_dobio(struct ld_nvme_softc *sc, void *data, int datasize, daddr_t blkno, -int dowrite, struct buf *bp) -{ - struct nvme_ns_context *ctx; - int error; - int waitok = (bp != NULL && !cpu_softintr_p() && !cpu_intr_p() - && !sc->sc_attaching); - - ctx = nvme_ns_get_ctx(sc, waitok ? PR_WAITOK : PR_NOWAIT); - if (ctx == NULL) - return EAGAIN; - - ctx->nnc_cookie = sc; - ctx->nnc_nsid = sc->sc_nsid; - ctx->nnc_done = ld_nvme_biodone; - ctx->nnc_buf = bp; - ctx->nnc_data = data; - ctx->nnc_datasize = datasize; - ctx->nnc_secsize = sc->sc_ld.sc_secsize; - ctx->nnc_blkno = blkno; - ctx->nnc_flags = dowrite ? 0 : NVME_NS_CTX_F_READ; - if (bp == NULL) - SET(ctx->nnc_flags, NVME_NS_CTX_F_POLL); - - error = nvme_ns_dobio(sc->sc_nvme, ctx); - if (error) - nvme_ns_put_ctx(sc, ctx); - - return error; + return nvme_ns_dobio(sc->sc_nvme, sc->sc_nsid, sc, + NULL, data, blkcnt * ld->sc_secsize, + sc->sc_ld.sc_secsize, blkno, + NVME_NS_CTX_F_POLL, + ld_nvme_biodone); } static void -ld_nvme_biodone(struct nvme_ns_context *ctx) +ld_nvme_biodone(void *xc, struct buf *bp, uint16_t cmd_status) { - struct ld_nvme_softc *sc = ctx->nnc_cookie; - struct buf *bp = ctx->nnc_buf; - int status = NVME_CQE_SC(ctx->nnc_status); - - /* free before processing to avoid starvation, lddone() could trigger - * another i/o request */ - nvme_ns_put_ctx(sc, ctx); + struct ld_nvme_softc *sc = xc; + uint16_t status = NVME_CQE_SC(cmd_status); if (bp != NULL) { if (status != NVME_CQE_SC_SUCCESS) { @@ -217,33 +180,14 @@ static int ld_nvme_flush(struct ld_softc *ld, int flags) { struct ld_nvme_softc *sc = device_private(ld->sc_dv); - struct nvme_ns_context *ctx; - int error; - int waitok = (!ISSET(flags, LDFL_POLL) - && !cpu_softintr_p() && !cpu_intr_p()); - - ctx = nvme_ns_get_ctx(sc, waitok ? PR_WAITOK : PR_NOWAIT); - if (ctx == NULL) - return EAGAIN;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jakllsch Date: Mon Sep 19 19:07:53 UTC 2016 Modified Files: src/sys/dev/ic: siisata.c Log Message: Don't permanantly disable port if drive probe times out, reinitialize port instead. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/siisata.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/siisata.c diff -u src/sys/dev/ic/siisata.c:1.28 src/sys/dev/ic/siisata.c:1.29 --- src/sys/dev/ic/siisata.c:1.28 Mon May 2 19:18:29 2016 +++ src/sys/dev/ic/siisata.c Mon Sep 19 19:07:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: siisata.c,v 1.28 2016/05/02 19:18:29 christos Exp $ */ +/* $NetBSD: siisata.c,v 1.29 2016/09/19 19:07:53 jakllsch Exp $ */ /* from ahcisata_core.c */ @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.28 2016/05/02 19:18:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.29 2016/09/19 19:07:53 jakllsch Exp $"); #include #include @@ -724,11 +724,10 @@ siisata_probe_drive(struct ata_channel * if (timed_out) { aprint_error_dev(sc->sc_atac.atac_dev, "SOFT_RESET failed on port %d (error %d PSS 0x%x), " - "disabling\n", chp->ch_channel, + "resetting\n", chp->ch_channel, PRREAD(sc, PRX(chp->ch_channel, PRO_PCE)), PRREAD(sc, PRX(chp->ch_channel, PRO_PSS))); - PRWRITE(sc, PRX(chp->ch_channel, PRO_PCS), - PR_PC_PORT_RESET); + siisata_reinit_port(chp); break; }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Mon Sep 19 19:06:58 UTC 2016 Modified Files: src/sys/dev/ic: nvme.c Log Message: comment tyop and KNF; pointed out by Nick To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/nvme.c diff -u src/sys/dev/ic/nvme.c:1.9 src/sys/dev/ic/nvme.c:1.10 --- src/sys/dev/ic/nvme.c:1.9 Sun Sep 18 21:19:39 2016 +++ src/sys/dev/ic/nvme.c Mon Sep 19 19:06:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nvme.c,v 1.9 2016/09/18 21:19:39 jdolecek Exp $ */ +/* $NetBSD: nvme.c,v 1.10 2016/09/19 19:06:57 jdolecek Exp $ */ /* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.9 2016/09/18 21:19:39 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.10 2016/09/19 19:06:57 jdolecek Exp $"); #include #include @@ -1048,7 +1048,7 @@ nvme_q_complete(struct nvme_softc *sc, s rv = 1; /* - * Unlock the mutext before calling the ccb_done callback + * Unlock the mutex before calling the ccb_done callback * and re-lock afterwards. The callback triggers lddone() * which schedules another i/o, and also calls nvme_ccb_put(). * Unlock/relock avoids possibility of deadlock. @@ -1393,8 +1393,10 @@ nvme_intr(void *xsc) struct nvme_softc *sc = xsc; int rv = 0; - /* INTx is level triggered, controller deasserts the interrupt only - * when we advance command queue head via write to the doorbell */ + /* + * INTx is level triggered, controller deasserts the interrupt only + * when we advance command queue head via write to the doorbell. + */ if (nvme_q_complete(sc, sc->sc_admin_q)) rv = 1; if (sc->sc_q != NULL)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Sun Sep 18 21:52:37 UTC 2016 Modified Files: src/sys/dev/ic: ld_nvme.c Log Message: must use PR_NOWAIT also during ldattach()/dkwedge discover, our i/o is there called with a spin lock held, which triggers LOCKDEBUG panic To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/ld_nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ld_nvme.c diff -u src/sys/dev/ic/ld_nvme.c:1.4 src/sys/dev/ic/ld_nvme.c:1.5 --- src/sys/dev/ic/ld_nvme.c:1.4 Sun Sep 18 21:19:39 2016 +++ src/sys/dev/ic/ld_nvme.c Sun Sep 18 21:52:36 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_nvme.c,v 1.4 2016/09/18 21:19:39 jdolecek Exp $ */ +/* $NetBSD: ld_nvme.c,v 1.5 2016/09/18 21:52:36 jdolecek Exp $ */ /*- * Copyright (C) 2016 NONAKA Kimihiro@@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.4 2016/09/18 21:19:39 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.5 2016/09/18 21:52:36 jdolecek Exp $"); #include #include @@ -46,6 +46,7 @@ struct ld_nvme_softc { struct nvme_softc *sc_nvme; uint16_t sc_nsid; + int sc_attaching; }; static int ld_nvme_match(device_t, cfdata_t, void *); @@ -91,6 +92,7 @@ ld_nvme_attach(device_t parent, device_t ld->sc_dv = self; sc->sc_nvme = nsc; sc->sc_nsid = naa->naa_nsid; + sc->sc_attaching = 1; aprint_naive("\n"); aprint_normal("\n"); @@ -115,6 +117,8 @@ ld_nvme_attach(device_t parent, device_t ld->sc_flush = ld_nvme_flush; ld->sc_flags = LDF_ENABLED; ldattach(ld, "fcfs"); + + sc->sc_attaching = 0; } static int @@ -156,7 +160,8 @@ ld_nvme_dobio(struct ld_nvme_softc *sc, { struct nvme_ns_context *ctx; int error; - int waitok = (bp != NULL && !cpu_softintr_p() && !cpu_intr_p()); + int waitok = (bp != NULL && !cpu_softintr_p() && !cpu_intr_p() + && !sc->sc_attaching); ctx = nvme_ns_get_ctx(sc, waitok ? PR_WAITOK : PR_NOWAIT); if (ctx == NULL)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Sat Sep 17 23:59:30 UTC 2016 Modified Files: src/sys/dev/ic: nvmereg.h Log Message: add macros to read AQA subvalues, is used by nvme_dumpregs() To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/nvmereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/nvmereg.h diff -u src/sys/dev/ic/nvmereg.h:1.4 src/sys/dev/ic/nvmereg.h:1.5 --- src/sys/dev/ic/nvmereg.h:1.4 Fri Sep 16 10:54:45 2016 +++ src/sys/dev/ic/nvmereg.h Sat Sep 17 23:59:30 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nvmereg.h,v 1.4 2016/09/16 10:54:45 jdolecek Exp $ */ +/* $NetBSD: nvmereg.h,v 1.5 2016/09/17 23:59:30 jdolecek Exp $ */ /* $OpenBSD: nvmereg.h,v 1.10 2016/04/14 11:18:32 dlg Exp $ */ /* @@ -81,8 +81,10 @@ #define NVME_AQA 0x0024 /* Admin Queue Attributes */ /* Admin Completion Queue Size */ #define NVME_AQA_ACQS(_v) (((_v) - 1) << 16) +#define NVME_AQA_ACQS_R(_v) ((_v >> 16) & ((1 << 12) - 1)) /* Admin Submission Queue Size */ #define NVME_AQA_ASQS(_v) (((_v) - 1) << 0) +#define NVME_AQA_ASQS_R(_v) (_v & ((1 << 12) - 1)) #define NVME_ASQ 0x0028 /* Admin Submission Queue Base Address */ #define NVME_ACQ 0x0030 /* Admin Completion Queue Base Address */
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Sat Sep 17 19:52:16 UTC 2016 Modified Files: src/sys/dev/ic: nvme.c Log Message: make nvme_dumpregs() compile on LP64 hosts sprinkle some delays() and extra checks into attach code, so that it follows more closely what FreeBSD driver does, and is easier to cross-check To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/nvme.c diff -u src/sys/dev/ic/nvme.c:1.7 src/sys/dev/ic/nvme.c:1.8 --- src/sys/dev/ic/nvme.c:1.7 Fri Sep 16 12:57:26 2016 +++ src/sys/dev/ic/nvme.c Sat Sep 17 19:52:16 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nvme.c,v 1.7 2016/09/16 12:57:26 jdolecek Exp $ */ +/* $NetBSD: nvme.c,v 1.8 2016/09/17 19:52:16 jdolecek Exp $ */ /* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.7 2016/09/16 12:57:26 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.8 2016/09/17 19:52:16 jdolecek Exp $"); #include #include @@ -200,35 +200,47 @@ nvme_dumpregs(struct nvme_softc *sc) #define DEVNAME(_sc) device_xname((_sc)->sc_dev) r8 = nvme_read8(sc, NVME_CAP); - printf("%s: cap 0x%016llx\n", DEVNAME(sc), nvme_read8(sc, NVME_CAP)); + printf("%s: cap 0x%016"PRIx64"\n", DEVNAME(sc), nvme_read8(sc, NVME_CAP)); printf("%s: mpsmax %u (%u)\n", DEVNAME(sc), (u_int)NVME_CAP_MPSMAX(r8), (1 << NVME_CAP_MPSMAX(r8))); printf("%s: mpsmin %u (%u)\n", DEVNAME(sc), (u_int)NVME_CAP_MPSMIN(r8), (1 << NVME_CAP_MPSMIN(r8))); - printf("%s: css %llu\n", DEVNAME(sc), NVME_CAP_CSS(r8)); - printf("%s: nssrs %llu\n", DEVNAME(sc), NVME_CAP_NSSRS(r8)); - printf("%s: dstrd %llu\n", DEVNAME(sc), NVME_CAP_DSTRD(r8)); - printf("%s: to %llu msec\n", DEVNAME(sc), NVME_CAP_TO(r8)); - printf("%s: ams %llu\n", DEVNAME(sc), NVME_CAP_AMS(r8)); - printf("%s: cqr %llu\n", DEVNAME(sc), NVME_CAP_CQR(r8)); - printf("%s: mqes %llu\n", DEVNAME(sc), NVME_CAP_MQES(r8)); + printf("%s: css %"PRIu64"\n", DEVNAME(sc), NVME_CAP_CSS(r8)); + printf("%s: nssrs %"PRIu64"\n", DEVNAME(sc), NVME_CAP_NSSRS(r8)); + printf("%s: dstrd %"PRIu64"\n", DEVNAME(sc), NVME_CAP_DSTRD(r8)); + printf("%s: to %"PRIu64" msec\n", DEVNAME(sc), NVME_CAP_TO(r8)); + printf("%s: ams %"PRIu64"\n", DEVNAME(sc), NVME_CAP_AMS(r8)); + printf("%s: cqr %"PRIu64"\n", DEVNAME(sc), NVME_CAP_CQR(r8)); + printf("%s: mqes %"PRIu64"\n", DEVNAME(sc), NVME_CAP_MQES(r8)); printf("%s: vs 0x%04x\n", DEVNAME(sc), nvme_read4(sc, NVME_VS)); r4 = nvme_read4(sc, NVME_CC); printf("%s: cc 0x%04x\n", DEVNAME(sc), r4); - printf("%s: iocqes %u\n", DEVNAME(sc), NVME_CC_IOCQES_R(r4)); - printf("%s: iosqes %u\n", DEVNAME(sc), NVME_CC_IOSQES_R(r4)); + printf("%s: iocqes %u (%u)\n", DEVNAME(sc), NVME_CC_IOCQES_R(r4), + (1 << NVME_CC_IOCQES_R(r4))); + printf("%s: iosqes %u (%u)\n", DEVNAME(sc), NVME_CC_IOSQES_R(r4), + (1 << NVME_CC_IOSQES_R(r4))); printf("%s: shn %u\n", DEVNAME(sc), NVME_CC_SHN_R(r4)); printf("%s: ams %u\n", DEVNAME(sc), NVME_CC_AMS_R(r4)); - printf("%s: mps %u\n", DEVNAME(sc), NVME_CC_MPS_R(r4)); + printf("%s: mps %u (%u)\n", DEVNAME(sc), NVME_CC_MPS_R(r4), + (1 << NVME_CC_MPS_R(r4))); printf("%s: css %u\n", DEVNAME(sc), NVME_CC_CSS_R(r4)); printf("%s: en %u\n", DEVNAME(sc), ISSET(r4, NVME_CC_EN) ? 1 : 0); - printf("%s: csts 0x%08x\n", DEVNAME(sc), nvme_read4(sc, NVME_CSTS)); - printf("%s: aqa 0x%08x\n", DEVNAME(sc), nvme_read4(sc, NVME_AQA)); - printf("%s: asq 0x%016llx\n", DEVNAME(sc), nvme_read8(sc, NVME_ASQ)); - printf("%s: acq 0x%016llx\n", DEVNAME(sc), nvme_read8(sc, NVME_ACQ)); + r4 = nvme_read4(sc, NVME_CSTS); + printf("%s: csts 0x%08x\n", DEVNAME(sc), r4); + printf("%s: rdy %u\n", DEVNAME(sc), r4 & NVME_CSTS_RDY); + printf("%s: cfs %u\n", DEVNAME(sc), r4 & NVME_CSTS_CFS); + printf("%s: shst %x\n", DEVNAME(sc), r4 & NVME_CSTS_SHST_MASK); + + r4 = nvme_read4(sc, NVME_AQA); + printf("%s: aqa 0x%08x\n", DEVNAME(sc), r4); + printf("%s: acqs %u\n", DEVNAME(sc), NVME_AQA_ACQS_R(r4)); + printf("%s: asqs %u\n", DEVNAME(sc), NVME_AQA_ASQS_R(r4)); + + printf("%s: asq 0x%016"PRIx64"\n", DEVNAME(sc), nvme_read8(sc, NVME_ASQ)); + printf("%s: acq 0x%016"PRIx64"\n", DEVNAME(sc), nvme_read8(sc, NVME_ACQ)); #undef DEVNAME } #endif /* NVME_DEBUG */ @@ -237,10 +249,19 @@ static int nvme_ready(struct nvme_softc *sc, uint32_t rdy) { u_int i = 0; + uint32_t cc; + + cc = nvme_read4(sc, NVME_CC); + if (((cc & NVME_CC_EN) != 0) != (rdy != 0)) { + aprint_error_dev(sc->sc_dev, + "controller enabled status expected %d, found to be %d\n", + (rdy != 0), ((cc & NVME_CC_EN) != 0)); + return ENXIO; + } while ((nvme_read4(sc, NVME_CSTS) & NVME_CSTS_RDY) != rdy) { if (i++ > sc->sc_rdy_to) - return 1; + return ENXIO; delay(1000); nvme_barrier(sc, NVME_CSTS, 4,
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Fri Sep 16 15:24:47 UTC 2016 Modified Files: src/sys/dev/ic: ld_nvme.c Log Message: change nvme(4) ld to use fcfs as default strategy to lower i/o processing overhead and hence lower latency; the sorting doesn't provide any benefit for SSDs To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/ld_nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ld_nvme.c diff -u src/sys/dev/ic/ld_nvme.c:1.2 src/sys/dev/ic/ld_nvme.c:1.3 --- src/sys/dev/ic/ld_nvme.c:1.2 Fri Sep 16 15:20:50 2016 +++ src/sys/dev/ic/ld_nvme.c Fri Sep 16 15:24:47 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_nvme.c,v 1.2 2016/09/16 15:20:50 jdolecek Exp $ */ +/* $NetBSD: ld_nvme.c,v 1.3 2016/09/16 15:24:47 jdolecek Exp $ */ /*- * Copyright (C) 2016 NONAKA Kimihiro@@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.2 2016/09/16 15:20:50 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.3 2016/09/16 15:24:47 jdolecek Exp $"); #include #include @@ -114,7 +114,7 @@ ld_nvme_attach(device_t parent, device_t ld->sc_dump = ld_nvme_dump; ld->sc_flush = ld_nvme_flush; ld->sc_flags = LDF_ENABLED; - ldattach(ld, BUFQ_DISK_DEFAULT_STRAT); + ldattach(ld, "fcfs"); } static int
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Fri Sep 16 12:57:26 UTC 2016 Modified Files: src/sys/dev/ic: nvme.c Log Message: introduce optional timeout for the polled commands; currently 5 seconds for queue creation/deletion, 10 seconds for controller/namespace identify, and unlimited for cache sync and passthrough commands this makes device attach error out instead of hanging the kernel when the device fails to respond properly, such as under QEMU currently To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/nvme.c diff -u src/sys/dev/ic/nvme.c:1.6 src/sys/dev/ic/nvme.c:1.7 --- src/sys/dev/ic/nvme.c:1.6 Fri Sep 16 11:41:40 2016 +++ src/sys/dev/ic/nvme.c Fri Sep 16 12:57:26 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nvme.c,v 1.6 2016/09/16 11:41:40 jdolecek Exp $ */ +/* $NetBSD: nvme.c,v 1.7 2016/09/16 12:57:26 jdolecek Exp $ */ /* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.6 2016/09/16 11:41:40 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.7 2016/09/16 12:57:26 jdolecek Exp $"); #include #include @@ -67,7 +67,7 @@ static void nvme_ccb_put(struct nvme_que static int nvme_poll(struct nvme_softc *, struct nvme_queue *, struct nvme_ccb *, void (*)(struct nvme_queue *, - struct nvme_ccb *, void *)); + struct nvme_ccb *, void *), int); static void nvme_poll_fill(struct nvme_queue *, struct nvme_ccb *, void *); static void nvme_poll_done(struct nvme_queue *, struct nvme_ccb *, struct nvme_cqe *); @@ -107,6 +107,11 @@ static void nvme_pt_done(struct nvme_que static int nvme_command_passthrough(struct nvme_softc *, struct nvme_pt_command *, uint16_t, struct lwp *, bool); +#define NVME_TIMO_QOP 5 /* queue create and delete timeout */ +#define NVME_TIMO_IDENT 10 /* probe identify timeout */ +#define NVME_TIMO_PT -1 /* passthrough cmd timeout */ +#define NVME_TIMO_SY -1 /* sync cache timeout */ + #define nvme_read4(_s, _r) \ bus_space_read_4((_s)->sc_iot, (_s)->sc_ioh, (_r)) #define nvme_write4(_s, _r, _v) \ @@ -250,8 +255,10 @@ nvme_enable(struct nvme_softc *sc, u_int uint32_t cc; cc = nvme_read4(sc, NVME_CC); - if (ISSET(cc, NVME_CC_EN)) - return nvme_ready(sc, NVME_CSTS_RDY); + if (ISSET(cc, NVME_CC_EN)) { + aprint_error_dev(sc->sc_dev, "controller unexpectedly enabled, failed to stay disabled\n"); + return 0; + } nvme_write4(sc, NVME_AQA, NVME_AQA_ACQS(sc->sc_admin_q->q_entries) | NVME_AQA_ASQS(sc->sc_admin_q->q_entries)); @@ -541,7 +548,7 @@ nvme_ns_identify(struct nvme_softc *sc, ccb->ccb_cookie = nvme_dmamem_sync(sc, mem, BUS_DMASYNC_PREREAD); - rv = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_sqe_fill); + rv = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_sqe_fill, NVME_TIMO_IDENT); nvme_dmamem_sync(sc, mem, BUS_DMASYNC_POSTREAD); nvme_ccb_put(sc->sc_admin_q, ccb); @@ -610,7 +617,7 @@ nvme_ns_dobio(struct nvme_softc *sc, str } if (ISSET(ctx->nnc_flags, NVME_NS_CTX_F_POLL)) { - if (nvme_poll(sc, q, ccb, nvme_ns_io_fill) != 0) + if (nvme_poll(sc, q, ccb, nvme_ns_io_fill, NVME_TIMO_PT) != 0) return EIO; return 0; } @@ -691,7 +698,7 @@ nvme_ns_sync(struct nvme_softc *sc, stru ccb->ccb_cookie = ctx; if (ISSET(ctx->nnc_flags, NVME_NS_CTX_F_POLL)) { - if (nvme_poll(sc, q, ccb, nvme_ns_sync_fill) != 0) + if (nvme_poll(sc, q, ccb, nvme_ns_sync_fill, NVME_TIMO_SY) != 0) return EIO; return 0; } @@ -852,7 +859,7 @@ nvme_command_passthrough(struct nvme_sof ccb->ccb_cookie = pt; pt->cmd.nsid = nsid; - if (nvme_poll(sc, q, ccb, nvme_pt_fill)) { + if (nvme_poll(sc, q, ccb, nvme_pt_fill, NVME_TIMO_PT)) { error = EIO; goto out; } @@ -903,12 +910,15 @@ struct nvme_poll_state { static int nvme_poll(struct nvme_softc *sc, struct nvme_queue *q, struct nvme_ccb *ccb, -void (*fill)(struct nvme_queue *, struct nvme_ccb *, void *)) +void (*fill)(struct nvme_queue *, struct nvme_ccb *, void *), int timo_sec) { struct nvme_poll_state state; void (*done)(struct nvme_queue *, struct nvme_ccb *, struct nvme_cqe *); void *cookie; uint16_t flags; + int step = 10; + int maxloop = timo_sec * 100 / step; + int error = 0; memset(, 0, sizeof(state)); (*fill)(q, ccb, ); @@ -922,17 +932,23 @@ nvme_poll(struct nvme_softc *sc, struct nvme_q_submit(sc, q, ccb, nvme_poll_fill); while (!ISSET(state.c.flags, htole16(NVME_CQE_PHASE))) { if (nvme_q_complete(sc, q) == 0) - delay(10); + delay(step); - /* XXX no timeout? */ + if (timo_sec >= 0 && --maxloop <= 0) { + error = ETIMEDOUT; + break; + } } ccb->ccb_cookie = cookie; done(q, ccb, ); - flags = lemtoh16(); - - return flags & ~NVME_CQE_PHASE; + if (error == 0) { + flags = lemtoh16(); + return flags &
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Fri Sep 16 11:41:40 UTC 2016 Modified Files: src/sys/dev/ic: nvme.c Log Message: make nvme_dumpregs() compile when NVME_DEBUG is defined To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/nvme.c diff -u src/sys/dev/ic/nvme.c:1.5 src/sys/dev/ic/nvme.c:1.6 --- src/sys/dev/ic/nvme.c:1.5 Thu Sep 8 15:00:08 2016 +++ src/sys/dev/ic/nvme.c Fri Sep 16 11:41:40 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nvme.c,v 1.5 2016/09/08 15:00:08 nonaka Exp $ */ +/* $NetBSD: nvme.c,v 1.6 2016/09/16 11:41:40 jdolecek Exp $ */ /* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.5 2016/09/08 15:00:08 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.6 2016/09/16 11:41:40 jdolecek Exp $"); #include #include @@ -187,7 +187,7 @@ nvme_version(struct nvme_softc *sc, uint } #ifdef NVME_DEBUG -static void +static __used void nvme_dumpregs(struct nvme_softc *sc) { uint64_t r8; @@ -202,7 +202,7 @@ nvme_dumpregs(struct nvme_softc *sc) (u_int)NVME_CAP_MPSMIN(r8), (1 << NVME_CAP_MPSMIN(r8))); printf("%s: css %llu\n", DEVNAME(sc), NVME_CAP_CSS(r8)); printf("%s: nssrs %llu\n", DEVNAME(sc), NVME_CAP_NSSRS(r8)); - printf("%s: dstrd %u\n", DEVNAME(sc), NVME_CAP_DSTRD(r8)); + printf("%s: dstrd %llu\n", DEVNAME(sc), NVME_CAP_DSTRD(r8)); printf("%s: to %llu msec\n", DEVNAME(sc), NVME_CAP_TO(r8)); printf("%s: ams %llu\n", DEVNAME(sc), NVME_CAP_AMS(r8)); printf("%s: cqr %llu\n", DEVNAME(sc), NVME_CAP_CQR(r8)); @@ -218,7 +218,7 @@ nvme_dumpregs(struct nvme_softc *sc) printf("%s: ams %u\n", DEVNAME(sc), NVME_CC_AMS_R(r4)); printf("%s: mps %u\n", DEVNAME(sc), NVME_CC_MPS_R(r4)); printf("%s: css %u\n", DEVNAME(sc), NVME_CC_CSS_R(r4)); - printf("%s: en %u\n", DEVNAME(sc), ISSET(r4, NVME_CC_EN)); + printf("%s: en %u\n", DEVNAME(sc), ISSET(r4, NVME_CC_EN) ? 1 : 0); printf("%s: csts 0x%08x\n", DEVNAME(sc), nvme_read4(sc, NVME_CSTS)); printf("%s: aqa 0x%08x\n", DEVNAME(sc), nvme_read4(sc, NVME_AQA));
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Fri Sep 16 10:54:45 UTC 2016 Modified Files: src/sys/dev/ic: nvmereg.h Log Message: add IO flags for FUA and also LR while here To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/nvmereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/nvmereg.h diff -u src/sys/dev/ic/nvmereg.h:1.3 src/sys/dev/ic/nvmereg.h:1.4 --- src/sys/dev/ic/nvmereg.h:1.3 Sat Jun 4 16:29:35 2016 +++ src/sys/dev/ic/nvmereg.h Fri Sep 16 10:54:45 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nvmereg.h,v 1.3 2016/06/04 16:29:35 nonaka Exp $ */ +/* $NetBSD: nvmereg.h,v 1.4 2016/09/16 10:54:45 jdolecek Exp $ */ /* $OpenBSD: nvmereg.h,v 1.10 2016/04/14 11:18:32 dlg Exp $ */ /* @@ -186,6 +186,8 @@ struct nvme_sqe_io { uint16_t nlb; /* Number of Logical Blocks */ uint16_t ioflags; +#define NVM_SQE_IO_FUA __BIT(14) /* Force Unit Access (bypass cache) */ +#define NVM_SQE_IO_LR __BIT(15) /* Limited Retry */ uint8_t dsm; /* Dataset Management */ uint8_t _reserved2[3];
CVS commit: src/sys/dev/ic
Module Name:src Committed By: nonaka Date: Thu Sep 8 04:41:16 UTC 2016 Modified Files: src/sys/dev/ic: nvme.c Log Message: fix off-by-one error in namespace id range check. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/nvme.c diff -u src/sys/dev/ic/nvme.c:1.3 src/sys/dev/ic/nvme.c:1.4 --- src/sys/dev/ic/nvme.c:1.3 Sat Jun 4 16:11:51 2016 +++ src/sys/dev/ic/nvme.c Thu Sep 8 04:41:16 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nvme.c,v 1.3 2016/06/04 16:11:51 nonaka Exp $ */ +/* $NetBSD: nvme.c,v 1.4 2016/09/08 04:41:16 nonaka Exp $ */ /* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.3 2016/06/04 16:11:51 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.4 2016/09/08 04:41:16 nonaka Exp $"); #include #include @@ -1559,7 +1559,7 @@ nvmensopen(dev_t dev, int flag, int mode return ENXIO; nsidx = nsid - 1; - if (nsidx > sc->sc_nn || sc->sc_namespaces[nsidx].dev == NULL) + if (nsidx >= sc->sc_nn || sc->sc_namespaces[nsidx].dev == NULL) return ENXIO; if (ISSET(sc->sc_namespaces[nsidx].flags, NVME_NS_F_OPEN)) return EBUSY; @@ -1586,7 +1586,7 @@ nvmensclose(dev_t dev, int flag, int mod return ENXIO; nsidx = nsid - 1; - if (nsidx > sc->sc_nn) + if (nsidx >= sc->sc_nn) return ENXIO; CLR(sc->sc_namespaces[nsidx].flags, NVME_NS_F_OPEN);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Mon Sep 5 04:06:55 UTC 2016 Modified Files: src/sys/dev/ic: spdmemvar.h Log Message: Fix the first two bytes' definitions of the DDR3 SPD ROM. This was not a real bug because the definitions haven't used. From JEDEC Standard No. 21-C Annex K: Serial Presense Detect (SPD) for DDR3 SDRAM Modules Documet Release 6. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/spdmemvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/spdmemvar.h diff -u src/sys/dev/ic/spdmemvar.h:1.11 src/sys/dev/ic/spdmemvar.h:1.12 --- src/sys/dev/ic/spdmemvar.h:1.11 Tue Jan 5 11:49:32 2016 +++ src/sys/dev/ic/spdmemvar.h Mon Sep 5 04:06:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: spdmemvar.h,v 1.11 2016/01/05 11:49:32 msaitoh Exp $ */ +/* $NetBSD: spdmemvar.h,v 1.12 2016/09/05 04:06:55 msaitoh Exp $ */ /* * Copyright (c) 2007 Paul Goyette @@ -418,8 +418,12 @@ struct spdmem_rambus {/* Direct Ramb } __packed; struct spdmem_ddr3 {/* Dual Data Rate 3 SDRAM */ - uint8_t ddr3_len; - uint8_t ddr3_size; + SPD_BITFIELD(\ + uint8_t ddr3_ROM_used:4, \ + uint8_t ddr3_ROM_size:3, \ + uint8_t ddr3_crccover:1, \ + ); + uint8_t ddr3_romrev; uint8_t ddr3_type; uint8_t ddr3_mod_type; SPD_BITFIELD(\
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Fri Aug 26 22:50:11 UTC 2016 Modified Files: src/sys/dev/ic: ct65550.c Log Message: fix a bunch of bugs & tpyos in chipsfb_mmap() so wsfb can actually work To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/ct65550.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ct65550.c diff -u src/sys/dev/ic/ct65550.c:1.10 src/sys/dev/ic/ct65550.c:1.11 --- src/sys/dev/ic/ct65550.c:1.10 Sat Jan 4 16:37:05 2014 +++ src/sys/dev/ic/ct65550.c Fri Aug 26 22:50:11 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ct65550.c,v 1.10 2014/01/04 16:37:05 macallan Exp $ */ +/* $NetBSD: ct65550.c,v 1.11 2016/08/26 22:50:11 macallan Exp $ */ /* * Copyright (c) 2006 Michael Lorenz @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ct65550.c,v 1.10 2014/01/04 16:37:05 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ct65550.c,v 1.11 2016/08/26 22:50:11 macallan Exp $"); #include #include @@ -770,12 +770,14 @@ chipsfb_mmap(void *v, void *vs, off_t of struct chipsfb_softc *sc = vd->cookie; paddr_t pa; - if (sc->sc_mmap != NULL) - return sc->sc_mmap(v, vs, offset, prot); + if (sc->sc_mmap != NULL) { + pa = sc->sc_mmap(v, vs, offset, prot); + if (pa != -1) return pa; + } /* 'regular' framebuffer mmap()ing */ if (offset < sc->memsize) { - pa = bus_space_mmap(sc->sc_memt, offset, 0, prot, + pa = bus_space_mmap(sc->sc_memt, sc->sc_fb, offset, prot, BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE); return pa; } @@ -792,7 +794,7 @@ chipsfb_mmap(void *v, void *vs, off_t of if ((offset >= sc->sc_fb) && (offset < (sc->sc_fb + sc->sc_fbsize))) { pa = bus_space_mmap(sc->sc_memt, offset, 0, prot, - BUS_SPACE_MAP_LINEAR); + BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE); return pa; }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Thu Aug 25 20:14:02 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Fix scheduling of interrupt transfers. I can now use a hub with my flxd ISA USB adapter To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.93 src/sys/dev/ic/sl811hs.c:1.94 --- src/sys/dev/ic/sl811hs.c:1.93 Fri Jul 1 09:03:28 2016 +++ src/sys/dev/ic/sl811hs.c Thu Aug 25 20:14:02 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.93 2016/07/01 09:03:28 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.94 2016/08/25 20:14:02 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.93 2016/07/01 09:03:28 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.94 2016/08/25 20:14:02 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -920,6 +920,11 @@ slhci_start(struct usbd_xfer *xfer) else spipe->buffer = NULL; spipe->lastframe = t->frame; + if (spipe->ptype == PT_INTR) { + spipe->frame = spipe->lastframe + + spipe->pipe.up_interval; + } + #if defined(DEBUG) || defined(SLHCI_DEBUG) if (__predict_false(spipe->ptype == PT_INTR && xfer->ux_length > spipe->tregs[LEN])) {
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Wed Aug 17 22:03:02 UTC 2016 Modified Files: src/sys/dev/ic: wdc.c Log Message: Spelling in comment To generate a diff of this commit: cvs rdiff -u -r1.281 -r1.282 src/sys/dev/ic/wdc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/wdc.c diff -u src/sys/dev/ic/wdc.c:1.281 src/sys/dev/ic/wdc.c:1.282 --- src/sys/dev/ic/wdc.c:1.281 Fri May 6 04:46:17 2016 +++ src/sys/dev/ic/wdc.c Wed Aug 17 22:03:02 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.281 2016/05/06 04:46:17 msaitoh Exp $ */ +/* $NetBSD: wdc.c,v 1.282 2016/08/17 22:03:02 skrll Exp $ */ /* * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.281 2016/05/06 04:46:17 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.282 2016/08/17 22:03:02 skrll Exp $"); #include "opt_ata.h" #include "opt_wdc.h" @@ -360,7 +360,7 @@ wdc_drvprobe(struct ata_channel *chp) for (i = 0; i < chp->ch_ndrives; i++) { #if NATA_DMA /* - * Init error counter so that an error withing the first xfers + * Init error counter so that an error within the first xfers * will trigger a downgrade */ chp->ch_drive[i].n_dmaerrs = NERRS_MAX-1;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Wed Jul 13 00:01:27 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: Use the proper channel for some things. Remove debugging now that it all works. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.20 src/sys/dev/ic/rt2860.c:1.21 --- src/sys/dev/ic/rt2860.c:1.20 Thu Jul 7 21:24:53 2016 +++ src/sys/dev/ic/rt2860.c Tue Jul 12 20:01:27 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.20 2016/07/08 01:24:53 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.21 2016/07/13 00:01:27 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /* $FreeBSD: head/sys/dev/ral/rt2860.c 297793 2016-04-10 23:07:00Z pfg $ */ @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.20 2016/07/08 01:24:53 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.21 2016/07/13 00:01:27 christos Exp $"); #include #include @@ -63,9 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1 #include -#ifndef RAL_DEBUG -#define RAL_DEBUG -#endif #ifdef RAL_DEBUG #define DPRINTF(x) do { if (rt2860_debug > 0) printf x; } while (0) #define DPRINTFN(n, x) do { if (rt2860_debug >= (n)) printf x; } while (0) @@ -1509,7 +1506,6 @@ rt2860_intr(void *arg) uint32_t r; r = RAL_READ(sc, RT2860_INT_STATUS); - DPRINTF(("intr %#x\n", r)); if (__predict_false(r == 0x)) return 0; /* device likely went away */ if (r == 0) @@ -1684,8 +1680,8 @@ rt2860_tx(struct rt2860_softc *sc, struc tap->wt_flags = 0; tap->wt_rate = rt2860_rates[ridx].rate; - tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq); - tap->wt_chan_flags = htole16(ic->ic_ibss_chan->ic_flags); + tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); + tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); tap->wt_hwqueue = qid; if (mcs & RT2860_PHY_SHPRE) tap->wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; @@ -3146,7 +3142,7 @@ static int8_t rt2860_rssi2dbm(struct rt2860_softc *sc, uint8_t rssi, uint8_t rxchain) { struct ieee80211com *ic = >sc_ic; - struct ieee80211_channel *c = ic->ic_ibss_chan; + struct ieee80211_channel *c = ic->ic_curchan; int delta; if (IEEE80211_IS_CHAN_5GHZ(c)) {
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Fri Jul 8 01:24:53 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c rt2860reg.h rt2860var.h Log Message: more fixes. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/rt2860.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/rt2860reg.h cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/rt2860var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.19 src/sys/dev/ic/rt2860.c:1.20 --- src/sys/dev/ic/rt2860.c:1.19 Wed Jul 6 22:18:05 2016 +++ src/sys/dev/ic/rt2860.c Thu Jul 7 21:24:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.19 2016/07/07 02:18:05 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.20 2016/07/08 01:24:53 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /* $FreeBSD: head/sys/dev/ral/rt2860.c 297793 2016-04-10 23:07:00Z pfg $ */ @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.19 2016/07/07 02:18:05 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.20 2016/07/08 01:24:53 christos Exp $"); #include #include @@ -63,10 +63,13 @@ __KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1 #include +#ifndef RAL_DEBUG +#define RAL_DEBUG +#endif #ifdef RAL_DEBUG #define DPRINTF(x) do { if (rt2860_debug > 0) printf x; } while (0) #define DPRINTFN(n, x) do { if (rt2860_debug >= (n)) printf x; } while (0) -int rt2860_debug = 4; +int rt2860_debug = 0; #else #define DPRINTF(x) #define DPRINTFN(n, x) @@ -92,6 +95,7 @@ static struct ieee80211_node *rt2860_nod static int rt2860_media_change(struct ifnet *); static void rt2860_iter_func(void *, struct ieee80211_node *); static void rt2860_updatestats(struct rt2860_softc *); +static void rt2860_update_promisc(struct ifnet *); static void rt2860_newassoc(struct ieee80211_node *, int); #ifdef notyet @@ -142,6 +146,7 @@ static void rt2860_set_macaddr(struct rt static void rt2860_updateslot(struct ifnet *); static void rt2860_updateprot(struct ieee80211com *); static int rt2860_updateedca(struct ieee80211com *); + #ifdef HW_CRYPTO static int rt2860_set_key(struct ieee80211com *, const struct ieee80211_key *, const uint8_t *); @@ -149,7 +154,7 @@ static int rt2860_delete_key(struct ieee const struct ieee80211_key *); #endif static int8_t rt2860_rssi2dbm(struct rt2860_softc *, uint8_t, uint8_t); -static const char * rt2860_get_rf(uint8_t); +static const char * rt2860_get_rf(uint32_t); static int rt2860_read_eeprom(struct rt2860_softc *); static int rt2860_bbp_init(struct rt2860_softc *); static int rt5390_bbp_init(struct rt2860_softc *); @@ -404,11 +409,11 @@ rt2860_attachhook(device_t self) bpf_attach2(ifp, DLT_IEEE802_11_RADIO, sizeof (struct ieee80211_frame) + 64, >sc_drvbpf); - sc->sc_rxtap_len = sizeof sc->sc_rxtapu; + sc->sc_rxtap_len = roundup(sizeof(sc->sc_rxtap), sizeof(u_int32_t)); sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len); sc->sc_rxtap.wr_ihdr.it_present = htole32(RT2860_RX_RADIOTAP_PRESENT); - sc->sc_txtap_len = sizeof sc->sc_txtapu; + sc->sc_txtap_len = roundup(sizeof(sc->sc_txtap), sizeof(u_int32_t)); sc->sc_txtap.wt_ihdr.it_len = htole16(sc->sc_txtap_len); sc->sc_txtap.wt_ihdr.it_present = htole32(RT2860_TX_RADIOTAP_PRESENT); @@ -821,9 +826,9 @@ rt2860_free_rx_ring(struct rt2860_softc static struct ieee80211_node * rt2860_node_alloc(struct ieee80211_node_table *nt) { - struct rt2860_node *rn = - malloc(sizeof (struct rt2860_node), M_DEVBUF, M_NOWAIT | M_ZERO); - return (rn) ? >ni : NULL; + struct rt2860_node *rn = malloc(sizeof(*rn), M_80211_NODE, + M_NOWAIT | M_ZERO); + return rn ? >ni : NULL; } static int @@ -1006,7 +1011,7 @@ rt2860_newstate(struct ieee80211com *ic, break; case IEEE80211_S_SCAN: - rt2860_switch_chan(sc, ic->ic_bss->ni_chan); + rt2860_switch_chan(sc, ic->ic_curchan); if (ostate != IEEE80211_S_SCAN) rt2860_set_gp_timer(sc, 150); break; @@ -1014,12 +1019,12 @@ rt2860_newstate(struct ieee80211com *ic, case IEEE80211_S_AUTH: case IEEE80211_S_ASSOC: rt2860_set_gp_timer(sc, 0); - rt2860_switch_chan(sc, ic->ic_bss->ni_chan); + rt2860_switch_chan(sc, ic->ic_curchan); break; case IEEE80211_S_RUN: rt2860_set_gp_timer(sc, 0); - rt2860_switch_chan(sc, ic->ic_bss->ni_chan); + rt2860_switch_chan(sc, ic->ic_curchan); if (ic->ic_opmode != IEEE80211_M_MONITOR) { rt2860_updateslot(ic->ic_ifp); @@ -1308,15 +1313,6 @@ rt2860_rx_intr(struct rt2860_softc *sc) goto skip; } -#ifdef HW_CRYPTO - if (__predict_false(rxd->flags & htole32(RT2860_RX_MICERR))) { - /* report MIC failures to net80211 for TKIP */ - ieee80211_notify_michael_failure(ic, wh, 0/* XXX */); - DPRINTF(("error2 %#x\n", rxd->flags)); - ifp->if_ierrors++; - goto skip; - } -#endif MGETHDR(m1, M_DONTWAIT, MT_DATA); if
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Thu Jul 7 02:18:05 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: kill RAL_DEBUG To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.18 src/sys/dev/ic/rt2860.c:1.19 --- src/sys/dev/ic/rt2860.c:1.18 Wed Jul 6 21:24:16 2016 +++ src/sys/dev/ic/rt2860.c Wed Jul 6 22:18:05 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.18 2016/07/07 01:24:16 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.19 2016/07/07 02:18:05 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /* $FreeBSD: head/sys/dev/ral/rt2860.c 297793 2016-04-10 23:07:00Z pfg $ */ @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.18 2016/07/07 01:24:16 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.19 2016/07/07 02:18:05 christos Exp $"); #include #include @@ -63,7 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1 #include -#define RAL_DEBUG #ifdef RAL_DEBUG #define DPRINTF(x) do { if (rt2860_debug > 0) printf x; } while (0) #define DPRINTFN(n, x) do { if (rt2860_debug >= (n)) printf x; } while (0)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Thu Jul 7 01:24:17 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c rt2860reg.h Log Message: add 539x support from FreeBSD (not working) To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/rt2860.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/rt2860reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.17 src/sys/dev/ic/rt2860.c:1.18 --- src/sys/dev/ic/rt2860.c:1.17 Fri Jun 24 12:08:54 2016 +++ src/sys/dev/ic/rt2860.c Wed Jul 6 21:24:16 2016 @@ -1,8 +1,10 @@ -/* $NetBSD: rt2860.c,v 1.17 2016/06/24 16:08:54 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.18 2016/07/07 01:24:16 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ +/* $FreeBSD: head/sys/dev/ral/rt2860.c 297793 2016-04-10 23:07:00Z pfg $ */ /*- * Copyright (c) 2007-2010 Damien Bergamini+ * Copyright (c) 2012 Bernhard Schmidt * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -18,12 +20,12 @@ */ /*- - * Ralink Technology RT2860/RT3090/RT3390/RT3562 chipset driver + * Ralink Technology RT2860/RT3090/RT3390/RT3562/RT5390/RT5392 chipset driver * http://www.ralinktech.com/ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.17 2016/06/24 16:08:54 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.18 2016/07/07 01:24:16 christos Exp $"); #include #include @@ -61,6 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1 #include +#define RAL_DEBUG #ifdef RAL_DEBUG #define DPRINTF(x) do { if (rt2860_debug > 0) printf x; } while (0) #define DPRINTFN(n, x) do { if (rt2860_debug >= (n)) printf x; } while (0) @@ -125,8 +128,11 @@ static void rt2860_set_basicrates(struct static void rt2860_select_chan_group(struct rt2860_softc *, int); static void rt2860_set_chan(struct rt2860_softc *, u_int); static void rt3090_set_chan(struct rt2860_softc *, u_int); -static int rt3090_rf_init(struct rt2860_softc *); +static void rt5390_set_chan(struct rt2860_softc *, u_int); +static void rt3090_rf_init(struct rt2860_softc *); +static void rt5390_rf_init(struct rt2860_softc *); static void rt3090_rf_wakeup(struct rt2860_softc *); +static void rt5390_rf_wakeup(struct rt2860_softc *); static int rt3090_filter_calib(struct rt2860_softc *, uint8_t, uint8_t, uint8_t *); static void rt3090_rf_setup(struct rt2860_softc *); @@ -147,6 +153,7 @@ static int8_t rt2860_rssi2dbm(struct rt2 static const char * rt2860_get_rf(uint8_t); static int rt2860_read_eeprom(struct rt2860_softc *); static int rt2860_bbp_init(struct rt2860_softc *); +static int rt5390_bbp_init(struct rt2860_softc *); static int rt2860_txrx_enable(struct rt2860_softc *); static int rt2860_init(struct ifnet *); static void rt2860_stop(struct ifnet *, int); @@ -174,6 +181,8 @@ static const struct { uint8_t val; } rt2860_def_bbp[] = { RT2860_DEF_BBP +}, rt5390_def_bbp[] = { + RT5390_DEF_BBP }; static const struct rfprog { @@ -196,6 +205,10 @@ static const struct { RT3070_DEF_RF }, rt3572_def_rf[] = { RT3572_DEF_RF +}, rt5390_def_rf[] = { + RT5390_DEF_RF +}, rt5392_def_rf[] = { + RT5392_DEF_RF }; int @@ -975,6 +988,7 @@ rt2860_newstate(struct ieee80211com *ic, ostate = ic->ic_state; + DPRINTF(("ostate = %d nstate = %d\n", ostate, nstate)); if (ostate == IEEE80211_S_RUN) { /* turn link LED off */ rt2860_set_leds(sc, RT2860_LED_RADIO); @@ -1273,6 +1287,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) uint16_t phy; hw = RAL_READ(sc, RT2860_FS_DRX_IDX) & 0xfff; + DPRINTF(("rx mbuf %#x\n", hw)); while (sc->rxq.cur != hw) { struct rt2860_rx_data *data = >rxq.data[sc->rxq.cur]; struct rt2860_rxd *rxd = >rxq.rxd[sc->rxq.cur]; @@ -1289,6 +1304,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) if (__predict_false(rxd->flags & htole32(RT2860_RX_CRCERR | RT2860_RX_ICVERR))) { + DPRINTF(("error %#x\n", rxd->flags)); ifp->if_ierrors++; goto skip; } @@ -1297,6 +1313,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) if (__predict_false(rxd->flags & htole32(RT2860_RX_MICERR))) { /* report MIC failures to net80211 for TKIP */ ieee80211_notify_michael_failure(ic, wh, 0/* XXX */); + DPRINTF(("error2 %#x\n", rxd->flags)); ifp->if_ierrors++; goto skip; } @@ -1304,11 +1321,13 @@ rt2860_rx_intr(struct rt2860_softc *sc) MGETHDR(m1, M_DONTWAIT, MT_DATA); if (__predict_false(m1 == NULL)) { + DPRINTF(("error2 %#x\n", rxd->flags)); ifp->if_ierrors++; goto skip; } MCLGET(m1, M_DONTWAIT); if (__predict_false((m1->m_flags & M_EXT) == 0)) { + DPRINTF(("no mbuf\n")); m_freem(m1); ifp->if_ierrors++; goto skip; @@ -1322,6 +1341,7 @@ rt2860_rx_intr(struct
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Jul 1 09:03:28 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Loop in the interrupt handler while there are interrupts to process. umass(4) reads now work much better. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.92 src/sys/dev/ic/sl811hs.c:1.93 --- src/sys/dev/ic/sl811hs.c:1.92 Fri Jul 1 08:42:21 2016 +++ src/sys/dev/ic/sl811hs.c Fri Jul 1 09:03:28 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.92 2016/07/01 08:42:21 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.93 2016/07/01 09:03:28 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.92 2016/07/01 08:42:21 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.93 2016/07/01 09:03:28 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -1534,13 +1534,17 @@ slhci_intr(void *arg) { SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); struct slhci_softc *sc = arg; - int ret; + int ret = 0; + int irq; start_cc_time(_hard_int, (unsigned int)arg); mutex_enter(>sc_intr_lock); - ret = slhci_dointr(sc); - slhci_main(sc); + do { + irq = slhci_dointr(sc); + ret |= irq; + slhci_main(sc); + } while (irq); mutex_exit(>sc_intr_lock); stop_cc_time(_hard_int);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Jul 1 08:42:21 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Fixup the error handling and specifically NAK hold off. If the device NAKs then delay the transfer by at least a frame. I can now write files to a umass attached to slhci(4). To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.91 src/sys/dev/ic/sl811hs.c:1.92 --- src/sys/dev/ic/sl811hs.c:1.91 Fri Jul 1 07:35:03 2016 +++ src/sys/dev/ic/sl811hs.c Fri Jul 1 08:42:21 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.91 2016/07/01 07:35:03 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.92 2016/07/01 08:42:21 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.91 2016/07/01 07:35:03 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.92 2016/07/01 08:42:21 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -2077,28 +2077,31 @@ slhci_abdone(struct slhci_softc *sc, int slhci_halt(sc, spipe, xfer); return; } else if (__predict_false(sc->sc_bus.ub_usepolling)) { - if (status == SL11_EPSTAT_STALL) + head = Q_CALLBACKS; + if (status & SL11_EPSTAT_STALL) xfer->ux_status = USBD_STALLED; - else if (status == SL11_EPSTAT_TIMEOUT) + else if (status & SL11_EPSTAT_TIMEOUT) xfer->ux_status = USBD_TIMEOUT; - else if (status == SL11_EPSTAT_NAK) -xfer->ux_status = USBD_TIMEOUT; /*XXX*/ + else if (status & SL11_EPSTAT_NAK) +head = Q_NEXT_CB; else xfer->ux_status = USBD_IOERROR; - head = Q_CALLBACKS; - } else if (status == SL11_EPSTAT_NAK) { - if (spipe->pipe.up_interval) { -spipe->lastframe = spipe->frame = -t->frame + spipe->pipe.up_interval; -slhci_queue_timed(sc, spipe); -goto queued; - } - head = Q_NEXT_CB; + } else if (status & SL11_EPSTAT_NAK) { + int i = spipe->pipe.up_interval; + if (i == 0) +i = 1; + DDOLOG("xfer %p spipe %p NAK delay by %d", xfer, spipe, + i, 0); + spipe->lastframe = spipe->frame = t->frame + i; + slhci_queue_timed(sc, spipe); + goto queued; } else if (++spipe->nerrs > SLHCI_MAX_RETRIES || - status == SL11_EPSTAT_STALL) { - if (status == SL11_EPSTAT_STALL) + (status & SL11_EPSTAT_STALL)) { + DDOLOG("xfer %p spipe %p nerrs %d", xfer, spipe, + spipe->nerrs, 0); + if (status & SL11_EPSTAT_STALL) xfer->ux_status = USBD_STALLED; - else if (status == SL11_EPSTAT_TIMEOUT) + else if (status & SL11_EPSTAT_TIMEOUT) xfer->ux_status = USBD_TIMEOUT; else xfer->ux_status = USBD_IOERROR; @@ -2108,7 +2111,7 @@ slhci_abdone(struct slhci_softc *sc, int 0); DDOLOGSTATUS(status); - if (status == SL11_EPSTAT_OVERFLOW && + if (status & SL11_EPSTAT_OVERFLOW && ratecheck(>sc_overflow_warn_rate, _warn_rate)) { printf("%s: Overflow condition: "
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Jul 1 07:35:03 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Debug tweak To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.90 src/sys/dev/ic/sl811hs.c:1.91 --- src/sys/dev/ic/sl811hs.c:1.90 Fri Jul 1 07:33:33 2016 +++ src/sys/dev/ic/sl811hs.c Fri Jul 1 07:35:03 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.90 2016/07/01 07:33:33 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.91 2016/07/01 07:35:03 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.90 2016/07/01 07:33:33 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.91 2016/07/01 07:35:03 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -2104,7 +2104,7 @@ slhci_abdone(struct slhci_softc *sc, int xfer->ux_status = USBD_IOERROR; DLOG(D_ERR, "Max retries reached! status %#x " - "xfer->ux_status %#x", status, xfer->ux_status, 0, + "xfer->ux_status %d", status, xfer->ux_status, 0, 0); DDOLOGSTATUS(status);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Jul 1 07:33:33 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Format conditional To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.89 src/sys/dev/ic/sl811hs.c:1.90 --- src/sys/dev/ic/sl811hs.c:1.89 Fri Jul 1 07:15:37 2016 +++ src/sys/dev/ic/sl811hs.c Fri Jul 1 07:33:33 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.89 2016/07/01 07:15:37 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.90 2016/07/01 07:33:33 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.89 2016/07/01 07:15:37 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.90 2016/07/01 07:33:33 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -2158,8 +2158,8 @@ status_setup: xfer->ux_actlen += actlen; spipe->control ^= SL11_EPCTRL_DATATOGGLE; - if (actlen == spipe->tregs[LEN] && (xfer->ux_length > - xfer->ux_actlen || spipe->wantshort)) { + if (actlen == spipe->tregs[LEN] && + (xfer->ux_length > xfer->ux_actlen || spipe->wantshort)) { spipe->buffer += actlen; LK_SLASSERT(xfer->ux_length >= xfer->ux_actlen, sc, spipe, xfer, return);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Jul 1 07:15:37 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Format conditionals To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.88 src/sys/dev/ic/sl811hs.c:1.89 --- src/sys/dev/ic/sl811hs.c:1.88 Fri Jul 1 05:39:24 2016 +++ src/sys/dev/ic/sl811hs.c Fri Jul 1 07:15:37 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.88 2016/07/01 05:39:24 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.89 2016/07/01 07:15:37 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.88 2016/07/01 05:39:24 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.89 2016/07/01 07:15:37 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -940,15 +940,16 @@ slhci_start(struct usbd_xfer *xfer) DLOGBUF(D_XFER, spipe->buffer, spipe->tregs[LEN]); spipe->ptype = PT_CTRL_SETUP; spipe->newpid &= ~SL11_PID_BITS; - if (xfer->ux_length == 0 || (xfer->ux_request.bmRequestType & - UT_READ)) + if (xfer->ux_length == 0 || + (xfer->ux_request.bmRequestType & UT_READ)) spipe->newpid |= SL11_PID_IN; else spipe->newpid |= SL11_PID_OUT; } - if (xfer->ux_flags & USBD_FORCE_SHORT_XFER && spipe->tregs[LEN] == - max_packet && (spipe->newpid & SL11_PID_BITS) == SL11_PID_OUT) + if (xfer->ux_flags & USBD_FORCE_SHORT_XFER && + spipe->tregs[LEN] == max_packet && + (spipe->newpid & SL11_PID_BITS) == SL11_PID_OUT) spipe->wantshort = 1; else spipe->wantshort = 0;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Jul 1 05:39:24 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Reformat a conditional To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.87 src/sys/dev/ic/sl811hs.c:1.88 --- src/sys/dev/ic/sl811hs.c:1.87 Thu Jun 30 16:34:56 2016 +++ src/sys/dev/ic/sl811hs.c Fri Jul 1 05:39:24 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.87 2016/06/30 16:34:56 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.88 2016/07/01 05:39:24 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.87 2016/06/30 16:34:56 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.88 2016/07/01 05:39:24 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -1778,8 +1778,7 @@ slhci_dointr(struct slhci_softc *sc) #ifdef SLHCI_DEBUG if (slhcidebug & SLHCI_D_INTR && r & sc->sc_ier && - ((r & ~(SL11_ISR_SOF|SL11_ISR_DATA)) || slhcidebug & - SLHCI_D_SOF)) { + ((r & ~(SL11_ISR_SOF|SL11_ISR_DATA)) || slhcidebug & SLHCI_D_SOF)) { uint8_t e, f; e = slhci_read(sc, SL11_IER);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Thu Jun 30 16:34:56 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Remove dead code To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.86 src/sys/dev/ic/sl811hs.c:1.87 --- src/sys/dev/ic/sl811hs.c:1.86 Tue Jun 28 16:00:32 2016 +++ src/sys/dev/ic/sl811hs.c Thu Jun 30 16:34:56 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.86 2016/06/28 16:00:32 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.87 2016/06/30 16:34:56 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.86 2016/06/28 16:00:32 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.87 2016/06/30 16:34:56 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -2210,13 +2210,6 @@ status_setup: LK_SLASSERT(xfer->ux_actlen <= xfer->ux_length, sc, spipe, xfer, return); xfer->ux_status = USBD_NORMAL_COMPLETION; -#if 0 /* usb_transfer_complete will do this */ - if (xfer->ux_length == xfer->ux_actlen || xfer->ux_flags & - USBD_SHORT_XFER_OK) -xfer->ux_status = USBD_NORMAL_COMPLETION; - else -xfer->ux_status = USBD_SHORT_XFER; -#endif } }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Jun 28 16:00:32 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Add slhci_memtest which is run when SLHCI_DEBUG is defined. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.85 src/sys/dev/ic/sl811hs.c:1.86 --- src/sys/dev/ic/sl811hs.c:1.85 Mon Jun 20 14:18:30 2016 +++ src/sys/dev/ic/sl811hs.c Tue Jun 28 16:00:32 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.85 2016/06/20 14:18:30 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.86 2016/06/28 16:00:32 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.85 2016/06/20 14:18:30 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.86 2016/06/28 16:00:32 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -516,6 +516,8 @@ static void slhci_get_status(struct slhc #define SLHCIHIST_CALLED() USBHIST_CALLED(slhcidebug) #ifdef SLHCI_DEBUG +static int slhci_memtest(struct slhci_softc *); + void slhci_log_buffer(struct usbd_xfer *); void slhci_log_req(usb_device_request_t *); void slhci_log_dumpreg(void); @@ -1205,6 +1207,13 @@ slhci_attach(struct slhci_softc *sc) return -1; } +#ifdef SLHCI_DEBUG + if (slhci_memtest(sc)) { + printf("%s: memory/bus error!\n", SC_NAME(sc)); + return -1; + } +#endif + callout_init(>sc_timer, CALLOUT_MPSAFE); callout_setfunc(>sc_timer, slhci_reset_entry, sc); @@ -2885,6 +2894,88 @@ slhci_reset(struct slhci_softc *sc) DLOG(D_MSG, "RESET done flags %#x", t->flags, 0,0,0); } + +#ifdef SLHCI_DEBUG +static int +slhci_memtest(struct slhci_softc *sc) +{ + enum { ASC, DESC, EITHER = ASC }; /* direction */ + enum { READ, WRITE }; /* operation */ + const char *ptr, *elem; + size_t i; + const int low = SL11_BUFFER_START, high = SL11_BUFFER_END; + int addr = 0, dir = ASC, op = READ; + /* Extended March C- test algorithm (SOFs also) */ + const char test[] = "E(w0) A(r0w1r1) A(r1w0r0) D(r0w1) D(r1w0) E(r0)"; + char c; + const uint8_t dbs[] = { 0x00, 0x0f, 0x33, 0x55 }; /* data backgrounds */ + uint8_t db; + + /* Perform memory test for all data backgrounds. */ + for (i = 0; i < __arraycount(dbs); i++) { + ptr = test; + elem = ptr; + /* Walk test algorithm string. */ + while ((c = *ptr++) != '\0') + switch (tolower((int)c)) { + case 'a': +/* Address sequence is in ascending order. */ +dir = ASC; +break; + case 'd': +/* Address sequence is in descending order. */ +dir = DESC; +break; + case 'e': +/* Address sequence is in either order. */ +dir = EITHER; +break; + case '(': +/* Start of test element (sequence). */ +elem = ptr; +addr = (dir == ASC) ? low : high; +break; + case 'r': +/* read operation */ +op = READ; +break; + case 'w': +/* write operation */ +op = WRITE; +break; + case '0': + case '1': +/* + * Execute previously set-up operation by + * reading/writing non-inverted ('0') or + * inverted ('1') data background. + */ +db = (c - '0') ? ~dbs[i] : dbs[i]; +if (op == READ) { + if (slhci_read(sc, addr) != db) + return -1; +} else + slhci_write(sc, addr, db); +break; + case ')': +/* + * End of element: Repeat same element with next + * address or continue to next element. + */ +addr = (dir == ASC) ? addr + 1 : addr - 1; +if (addr >= low && addr <= high) + ptr = elem; +break; + default: +/* Do nothing. */ +break; + } + } + + return 0; +} +#endif + /* returns 1 if succeeded, 0 if failed, reserve == 0 is unreserve */ static int slhci_reserve_bustime(struct slhci_softc *sc, struct slhci_pipe *spipe, int
CVS commit: src/sys/dev/ic
Module Name:src Committed By: pgoyette Date: Mon Jun 27 07:37:54 UTC 2016 Modified Files: src/sys/dev/ic: spicvar.h Log Message: Add license, copied from the companion file dev/ic/spic.c Addresses PR kern/25173 (the $NetBSD$ had previously been added in rev 1.7 by dyoung) To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/spicvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/spicvar.h diff -u src/sys/dev/ic/spicvar.h:1.7 src/sys/dev/ic/spicvar.h:1.8 --- src/sys/dev/ic/spicvar.h:1.7 Wed Feb 24 22:37:58 2010 +++ src/sys/dev/ic/spicvar.h Mon Jun 27 07:37:54 2016 @@ -1,5 +1,51 @@ -/* $NetBSD: spicvar.h,v 1.7 2010/02/24 22:37:58 dyoung Exp $ */ +/* $NetBSD: spicvar.h,v 1.8 2016/06/27 07:37:54 pgoyette Exp $ */ +/* + * Copyright (c) 2002 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (lenn...@augustsson.net) at + * Carlstedt Research & Technology. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * The SPIC is used on some Sony Vaios to handle the jog dial and other + * peripherals. + * The protocol used by the SPIC seems to vary wildly among the different + * models, and I've found no documentation. + * This file handles the jog dial on the SRX77 model, and perhaps nothing + * else. + * + * The general way of talking to the SPIC was gleaned from the Linux and + * FreeBSD drivers. The hex numbers were taken from these drivers (they + * come from reverese engineering.) + * + * TODO: + * Make it handle more models. + * Figure out why the interrupt mode doesn't work. + */ #include struct spic_softc {
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Fri Jun 24 16:08:55 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: diff reduction with openbsd; turn debugging on. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.16 src/sys/dev/ic/rt2860.c:1.17 --- src/sys/dev/ic/rt2860.c:1.16 Fri Jun 17 13:03:20 2016 +++ src/sys/dev/ic/rt2860.c Fri Jun 24 12:08:54 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.16 2016/06/17 17:03:20 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.17 2016/06/24 16:08:54 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.16 2016/06/17 17:03:20 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.17 2016/06/24 16:08:54 christos Exp $"); #include #include @@ -64,7 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1 #ifdef RAL_DEBUG #define DPRINTF(x) do { if (rt2860_debug > 0) printf x; } while (0) #define DPRINTFN(n, x) do { if (rt2860_debug >= (n)) printf x; } while (0) -int rt2860_debug = 0; +int rt2860_debug = 4; #else #define DPRINTF(x) #define DPRINTFN(n, x) @@ -1776,6 +1776,8 @@ rt2860_start(struct ifnet *ifp) continue; } + bpf_mtap(ifp, m); + eh = mtod(m, struct ether_header *); ni = ieee80211_find_txnode(ic, eh->ether_dhost); if (ni == NULL) { @@ -1784,8 +1786,6 @@ rt2860_start(struct ifnet *ifp) continue; } - bpf_mtap(ifp, m); - if ((m = ieee80211_encap(ic, m, ni)) == NULL) { ieee80211_free_node(ni); ifp->if_oerrors++; @@ -1863,6 +1863,22 @@ rt2860_ioctl(struct ifnet *ifp, u_long c } break; + case SIOCS80211CHANNEL: + /* + * This allows for fast channel switching in monitor mode + * (used by kismet). In IBSS mode, we must explicitly reset + * the interface to generate a new beacon frame. + */ + error = ieee80211_ioctl(ic, cmd, data); + if (error == ENETRESET && + ic->ic_opmode == IEEE80211_M_MONITOR) { + if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == + (IFF_UP | IFF_RUNNING)) +rt2860_switch_chan(sc, ic->ic_ibss_chan); + error = 0; + } + break; + default: error = ieee80211_ioctl(ic, cmd, data); } @@ -2753,6 +2769,11 @@ rt2860_set_key(struct ieee80211com *ic, uint8_t mode, wcid, iv[8]; struct ieee80211_key *k = __UNCONST(ck); /* XXX */ + /* defer setting of WEP keys until interface is brought up */ + if ((ic->ic_if.if_flags & (IFF_UP | IFF_RUNNING)) != + (IFF_UP | IFF_RUNNING)) + return 0; + /* map net80211 cipher to RT2860 security mode */ switch (k->wk_cipher->ic_cipher) { case IEEE80211_CIPHER_WEP:
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Mon Jun 20 14:18:30 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Fix a comment To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.84 src/sys/dev/ic/sl811hs.c:1.85 --- src/sys/dev/ic/sl811hs.c:1.84 Mon Jun 20 07:13:07 2016 +++ src/sys/dev/ic/sl811hs.c Mon Jun 20 14:18:30 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.84 2016/06/20 07:13:07 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.85 2016/06/20 14:18:30 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.84 2016/06/20 07:13:07 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.85 2016/06/20 14:18:30 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -1537,7 +1537,7 @@ slhci_intr(void *arg) return ret; } -/* called with main lock only held, returns with locks released. */ +/* called with interrupt lock only held. */ void slhci_main(struct slhci_softc *sc) {
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Mon Jun 20 07:13:07 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: More debug. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.83 src/sys/dev/ic/sl811hs.c:1.84 --- src/sys/dev/ic/sl811hs.c:1.83 Mon Jun 20 07:12:00 2016 +++ src/sys/dev/ic/sl811hs.c Mon Jun 20 07:13:07 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.83 2016/06/20 07:12:00 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.84 2016/06/20 07:13:07 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.83 2016/06/20 07:12:00 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.84 2016/06/20 07:13:07 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -639,7 +639,7 @@ DDOLOGBUF(uint8_t *buf, unsigned int len !!((r) & SL11_IER_USBA), 0); \ } while (0) -#define DDLOGSTATUS(s) do { \ +#define DDOLOGSTATUS(s) do { \ DDOLOG("STAT stall =%d nak =%d overflow =%d setup =%d", \ !!((s) & SL11_EPSTAT_STALL), !!((s) & SL11_EPSTAT_NAK), \ !!((s) & SL11_EPSTAT_OVERFLOW), !!((s) & SL11_EPSTAT_SETUP)); \ @@ -648,7 +648,7 @@ DDOLOGBUF(uint8_t *buf, unsigned int len !!((s) & SL11_EPSTAT_ERROR), !!((s) & SL11_EPSTAT_ACK)); \ } while (0) -#define DDLOGEPCTRL(r) do { \ +#define DDOLOGEPCTRL(r) do { \ DDOLOG("CTRL preamble=%d toggle =%d sof =%d iso =%d", \ !!((r) & SL11_EPCTRL_PREAMBLE), !!((r) & SL11_EPCTRL_DATATOGGLE),\ !!((r) & SL11_EPCTRL_SOF), !!((r) & SL11_EPCTRL_ISO)); \ @@ -657,7 +657,7 @@ DDOLOGBUF(uint8_t *buf, unsigned int len !!((r) & SL11_EPCTRL_ENABLE), !!((r) & SL11_EPCTRL_ARM), 0); \ } while (0) -#define DDLOGEPSTAT(r) do { \ +#define DDOLOGEPSTAT(r) do { \ DDOLOG("STAT stall =%d nak =%d overflow =%d setup =%d", \ !!((r) & SL11_EPSTAT_STALL), !!((r) & SL11_EPSTAT_NAK), \ !!((r) & SL11_EPSTAT_OVERFLOW), !!((r) & SL11_EPSTAT_SETUP)); \ @@ -677,9 +677,9 @@ DDOLOGBUF(uint8_t *buf, unsigned int len #define DDOLOGCTRL(x) ((void)0) #define DDOLOGISR(r) ((void)0) #define DDOLOGIER(r) ((void)0) -#define DDLOGSTATUS(s) ((void)0) -#define DDLOGEPCTRL(r) ((void)0) -#define DDLOGEPSTAT(r) ((void)0) +#define DDOLOGSTATUS(s) ((void)0) +#define DDOLOGEPCTRL(r) ((void)0) +#define DDOLOGEPSTAT(r) ((void)0) #endif /* SLHCI_DEBUG */ #ifdef DIAGNOSTIC @@ -2024,7 +2024,7 @@ slhci_abdone(struct slhci_softc *sc, int if ((slhcidebug & SLHCI_D_NAK) || (status & SL11_EPSTAT_ERRBITS) != SL11_EPSTAT_NAK) { DDOLOG("USB Status = %#.2x", status, 0, 0, 0); - DDLOGSTATUS(status); + DDOLOGSTATUS(status); } #endif @@ -2097,7 +2097,7 @@ slhci_abdone(struct slhci_softc *sc, int DLOG(D_ERR, "Max retries reached! status %#x " "xfer->ux_status %#x", status, xfer->ux_status, 0, 0); - DDLOGSTATUS(status); + DDOLOGSTATUS(status); if (status == SL11_EPSTAT_OVERFLOW && ratecheck(>sc_overflow_warn_rate, @@ -3330,7 +3330,7 @@ slhci_log_dumpreg(void) r = slhci_read(ssc, SL11_E0CTRL); DDOLOG("USB A Host Control = %#.2x", r, 0, 0, 0); - DDLOGEPCTRL(r); + DDOLOGEPCTRL(r); aaddr = slhci_read(ssc, SL11_E0ADDR); DDOLOG("USB A Base Address = %u", aaddr, 0,0,0); @@ -3338,13 +3338,13 @@ slhci_log_dumpreg(void) DDOLOG("USB A Length = %u", alen, 0,0,0); r = slhci_read(ssc, SL11_E0STAT); DDOLOG("USB A Status = %#.2x", r, 0,0,0); - DDLOGEPSTAT(r); + DDOLOGEPSTAT(r); r = slhci_read(ssc, SL11_E0CONT); DDOLOG("USB A Remaining or Overflow Length = %u", r, 0,0,0); r = slhci_read(ssc, SL11_E1CTRL); DDOLOG("USB B Host Control = %#.2x", r, 0,0,0); - DDLOGEPCTRL(r); + DDOLOGEPCTRL(r); baddr = slhci_read(ssc, SL11_E1ADDR); DDOLOG("USB B Base Address = %u", baddr, 0,0,0); @@ -3352,7 +3352,7 @@ slhci_log_dumpreg(void) DDOLOG("USB B Length = %u", blen, 0,0,0); r = slhci_read(ssc, SL11_E1STAT); DDOLOG("USB B Status = %#.2x", r, 0,0,0); - DDLOGEPSTAT(r); + DDOLOGEPSTAT(r); r = slhci_read(ssc, SL11_E1CONT); DDOLOG("USB B Remaining or Overflow Length = %u", r, 0,0,0); @@ -3426,6 +3426,8 @@ slhci_print_intr(void) void slhci_log_sc(void) { + SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); + struct slhci_transfers *t; int i; @@ -3436,9 +3438,9 @@ slhci_log_sc(void) t->spipe[1], t->len[1]); for (i=0; i<=Q_MAX; i++) - DDOLOG("Q %d: %p", i, gcq_first(>q[i]), 0,0); + DDOLOG("Q %d: %p", i, gcq_hq(>q[i]), 0,0); - DDOLOG("TIMED: %p", GCQ_ITEM(gcq_first(>to), + DDOLOG("TIMED: %p", GCQ_ITEM(gcq_hq(>to), struct slhci_pipe, to), 0,0,0); DDOLOG("frame=%d rootintr=%p", t->frame, t->rootintr, 0,0); @@ -3449,13 +3451,13 @@ slhci_log_sc(void) void slhci_log_slreq(struct slhci_pipe *r) { -
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Mon Jun 20 07:12:00 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Set ssc as early as possible To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.82 src/sys/dev/ic/sl811hs.c:1.83 --- src/sys/dev/ic/sl811hs.c:1.82 Sun Jun 19 07:38:08 2016 +++ src/sys/dev/ic/sl811hs.c Mon Jun 20 07:12:00 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.82 2016/06/19 07:38:08 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.83 2016/06/20 07:12:00 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.82 2016/06/19 07:38:08 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.83 2016/06/20 07:12:00 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -1153,6 +1153,10 @@ slhci_preinit(struct slhci_softc *sc, Po t = >sc_transfers; +#ifdef SLHCI_DEBUG + ssc = sc; +#endif + mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB); mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_USB); @@ -1211,10 +1215,6 @@ slhci_attach(struct slhci_softc *sc) sc->sc_cb_softintr = softint_establish(SOFTINT_NET, slhci_callback_entry, sc); -#ifdef SLHCI_DEBUG - ssc = sc; -#endif - if (t->sltype == SLTYPE_SL811HS_R12) rev = "(rev 1.2)"; else if (t->sltype == SLTYPE_SL811HS_R14)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Jun 19 07:38:08 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: More debug To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.81 src/sys/dev/ic/sl811hs.c:1.82 --- src/sys/dev/ic/sl811hs.c:1.81 Sun Jun 19 06:47:04 2016 +++ src/sys/dev/ic/sl811hs.c Sun Jun 19 07:38:08 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.81 2016/06/19 06:47:04 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.82 2016/06/19 07:38:08 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.81 2016/06/19 06:47:04 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.82 2016/06/19 07:38:08 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -643,7 +643,7 @@ DDOLOGBUF(uint8_t *buf, unsigned int len DDOLOG("STAT stall =%d nak =%d overflow =%d setup =%d", \ !!((s) & SL11_EPSTAT_STALL), !!((s) & SL11_EPSTAT_NAK), \ !!((s) & SL11_EPSTAT_OVERFLOW), !!((s) & SL11_EPSTAT_SETUP)); \ -DDOLOG("STAT sequence=%d timeout =%d error=%d ack =%d", \ +DDOLOG("STAT sequence=%d timeout =%d error=%d ack =%d", \ !!((s) & SL11_EPSTAT_SEQUENCE), !!((s) & SL11_EPSTAT_TIMEOUT), \ !!((s) & SL11_EPSTAT_ERROR), !!((s) & SL11_EPSTAT_ACK)); \ } while (0) @@ -2706,8 +2706,10 @@ slhci_halt(struct slhci_softc *sc, struc static void slhci_intrchange(struct slhci_softc *sc, uint8_t new_ier) { + SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); KASSERT(mutex_owned(>sc_intr_lock)); if (sc->sc_ier != new_ier) { + DLOG(D_INTR, "New IER %#x", new_ier, 0, 0, 0); sc->sc_ier = new_ier; slhci_write(sc, SL11_IER, new_ier); BSB_SYNC(sc->iot, sc->ioh, sc->pst, sc->psz);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun Jun 19 06:47:04 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: More debug and fix a debug To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.80 src/sys/dev/ic/sl811hs.c:1.81 --- src/sys/dev/ic/sl811hs.c:1.80 Sat Jun 18 20:27:55 2016 +++ src/sys/dev/ic/sl811hs.c Sun Jun 19 06:47:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.80 2016/06/18 20:27:55 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.81 2016/06/19 06:47:04 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.80 2016/06/18 20:27:55 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.81 2016/06/19 06:47:04 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -1745,6 +1745,7 @@ slhci_waitintr(struct slhci_softc *sc, i return); slhci_dointr(sc); } + DLOG(D_WAIT, "... done", 0, 0, 0, 0); } static int @@ -2403,7 +2404,7 @@ slhci_callback(struct slhci_softc *sc) xfer = spipe->xfer; LK_SLASSERT(xfer != NULL, sc, spipe, NULL, return); spipe->xfer = NULL; - DLOG(D_XFER, "xfer callback length %d actlen %d spipe %d " + DLOG(D_XFER, "xfer callback length %d actlen %d spipe %p " "type %d", xfer->ux_length, xfer->ux_actlen, spipe, spipe->ptype); do_callback:
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sat Jun 18 20:27:55 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Fix non-debug build. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.79 src/sys/dev/ic/sl811hs.c:1.80 --- src/sys/dev/ic/sl811hs.c:1.79 Sat Jun 18 19:30:24 2016 +++ src/sys/dev/ic/sl811hs.c Sat Jun 18 20:27:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.79 2016/06/18 19:30:24 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.80 2016/06/18 20:27:55 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.79 2016/06/18 19:30:24 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.80 2016/06/18 20:27:55 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -160,59 +160,6 @@ static const uint8_t slhci_tregs[2][4] = #ifdef SLHCI_DEBUG #define SLHCI_MEM_ACCOUNTING - -#define DDOLOGCTRL(x) do { \ -DDOLOG("CTRL suspend=%d", !!((x) & SL11_CTRL_SUSPEND), 0, 0, 0); \ -DDOLOG("CTRL ls =%d jk =%d reset =%d sof=%d", \ - !!((x) & SL11_CTRL_LOWSPEED), !!((x) & SL11_CTRL_JKSTATE), \ - !!((x) & SL11_CTRL_RESETENGINE), !!((x) & SL11_CTRL_ENABLESOF));\ -} while (0) - -#define DDOLOGISR(r) do { \ -DDOLOG("ISR data =%d det/res=%d insert =%d sof=%d", \ - !!((r) & SL11_ISR_DATA), !!((r) & SL11_ISR_RESUME), \ - !!((r) & SL11_ISR_INSERT), ((r) & SL11_ISR_SOF)); \ -DDOLOG("ISR babble =%d usbb =%d usba =%d", \ - !!((r) & SL11_ISR_BABBLE), !!((r) & SL11_ISR_USBB), \ - !!((r) & SL11_ISR_USBA), 0); \ -} while (0) - -#define DDOLOGIER(r) do { \ -DDOLOG("IER det/res=%d insert =%d sof=%d", \ - !!((r) & SL11_IER_RESUME), \ - !!((r) & SL11_IER_INSERT), ((r) & SL11_IER_SOF), 0); \ -DDOLOG("IER babble =%d usbb =%d usba =%d", \ - !!((r) & SL11_IER_BABBLE), !!((r) & SL11_IER_USBB), \ - !!((r) & SL11_IER_USBA), 0); \ -} while (0) - -#define DDLOGSTATUS(s) do { \ -DDOLOG("STAT stall =%d nak =%d overflow =%d setup =%d", \ - !!((s) & SL11_EPSTAT_STALL), !!((s) & SL11_EPSTAT_NAK), \ - !!((s) & SL11_EPSTAT_OVERFLOW), !!((s) & SL11_EPSTAT_SETUP)); \ -DDOLOG("STAT sequence=%d timeout =%d error=%d ack =%d", \ - !!((s) & SL11_EPSTAT_SEQUENCE), !!((s) & SL11_EPSTAT_TIMEOUT), \ - !!((s) & SL11_EPSTAT_ERROR), !!((s) & SL11_EPSTAT_ACK)); \ -} while (0) - -#define DDLOGEPCTRL(r) do { \ -DDOLOG("CTRL preamble=%d toggle =%d sof =%d iso =%d", \ - !!((r) & SL11_EPCTRL_PREAMBLE), !!((r) & SL11_EPCTRL_DATATOGGLE),\ - !!((r) & SL11_EPCTRL_SOF), !!((r) & SL11_EPCTRL_ISO)); \ -DDOLOG("CTRL out =%d enable =%d arm =%d", \ - !!((r) & SL11_EPCTRL_DIRECTION),\ - !!((r) & SL11_EPCTRL_ENABLE), !!((r) & SL11_EPCTRL_ARM), 0); \ -} while (0) - -#define DDLOGEPSTAT(r) do { \ -DDOLOG("STAT stall =%d nak =%d overflow =%d setup =%d", \ - !!((r) & SL11_EPSTAT_STALL), !!((r) & SL11_EPSTAT_NAK), \ - !!((r) & SL11_EPSTAT_OVERFLOW), !!((r) & SL11_EPSTAT_SETUP)); \ -DDOLOG("STAT sequence=%d timeout =%d error=%d ack =%d", \ - !!((r) & SL11_EPSTAT_SEQUENCE), !!((r) & SL11_EPSTAT_TIMEOUT), \ - !!((r) & SL11_EPSTAT_ERROR), !!((r) & SL11_EPSTAT_ACK)); \ -} while (0) - #endif /* @@ -666,6 +613,58 @@ DDOLOGBUF(uint8_t *buf, unsigned int len DDOLOG("%.2x", buf[i], 0,0,0); } #define DLOGBUF(x, b, l) SLHCI_DEXEC(x, DDOLOGBUF(b, l)) + +#define DDOLOGCTRL(x) do { \ +DDOLOG("CTRL suspend=%d", !!((x) & SL11_CTRL_SUSPEND), 0, 0, 0); \ +DDOLOG("CTRL ls =%d jk =%d reset =%d sof=%d", \ + !!((x) & SL11_CTRL_LOWSPEED), !!((x) & SL11_CTRL_JKSTATE), \ + !!((x) & SL11_CTRL_RESETENGINE), !!((x) & SL11_CTRL_ENABLESOF));\ +} while (0) + +#define DDOLOGISR(r) do { \ +DDOLOG("ISR data =%d det/res=%d insert =%d sof=%d", \ + !!((r) & SL11_ISR_DATA), !!((r) & SL11_ISR_RESUME), \ + !!((r) & SL11_ISR_INSERT), ((r) & SL11_ISR_SOF)); \ +DDOLOG("ISR babble =%d usbb =%d usba =%d", \ + !!((r) & SL11_ISR_BABBLE), !!((r) & SL11_ISR_USBB), \ + !!((r) & SL11_ISR_USBA), 0); \ +} while (0) + +#define DDOLOGIER(r) do { \ +DDOLOG("IER det/res=%d insert =%d sof=%d", \ + !!((r) & SL11_IER_RESUME), \ + !!((r) & SL11_IER_INSERT), ((r) & SL11_IER_SOF), 0); \ +DDOLOG("IER babble =%d usbb =%d usba =%d", \ + !!((r) & SL11_IER_BABBLE), !!((r) & SL11_IER_USBB), \ + !!((r) & SL11_IER_USBA), 0); \ +} while (0) + +#define DDLOGSTATUS(s) do { \ +DDOLOG("STAT stall =%d nak =%d overflow =%d setup =%d", \ + !!((s) & SL11_EPSTAT_STALL), !!((s) &
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sat Jun 18 19:30:24 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Debug updates to work with vmstat(1) -u To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.78 src/sys/dev/ic/sl811hs.c:1.79 --- src/sys/dev/ic/sl811hs.c:1.78 Fri Jun 17 16:07:40 2016 +++ src/sys/dev/ic/sl811hs.c Sat Jun 18 19:30:24 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.78 2016/06/17 16:07:40 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.79 2016/06/18 19:30:24 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.78 2016/06/17 16:07:40 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.79 2016/06/18 19:30:24 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -160,18 +160,59 @@ static const uint8_t slhci_tregs[2][4] = #ifdef SLHCI_DEBUG #define SLHCI_MEM_ACCOUNTING -static const char * -pnames(int ptype) -{ - static const char * const names[] = { "ROOT Ctrl", "ROOT Intr", - "Control (setup)", "Control (data)", "Control (status)", - "Interrupt", "Bulk", "BAD PTYPE" }; - - KASSERT(sizeof(names) / sizeof(names[0]) == PT_MAX + 2); - if (ptype > PT_MAX) - ptype = PT_MAX + 1; - return names[ptype]; -} + +#define DDOLOGCTRL(x) do { \ +DDOLOG("CTRL suspend=%d", !!((x) & SL11_CTRL_SUSPEND), 0, 0, 0); \ +DDOLOG("CTRL ls =%d jk =%d reset =%d sof=%d", \ + !!((x) & SL11_CTRL_LOWSPEED), !!((x) & SL11_CTRL_JKSTATE), \ + !!((x) & SL11_CTRL_RESETENGINE), !!((x) & SL11_CTRL_ENABLESOF));\ +} while (0) + +#define DDOLOGISR(r) do { \ +DDOLOG("ISR data =%d det/res=%d insert =%d sof=%d", \ + !!((r) & SL11_ISR_DATA), !!((r) & SL11_ISR_RESUME), \ + !!((r) & SL11_ISR_INSERT), ((r) & SL11_ISR_SOF)); \ +DDOLOG("ISR babble =%d usbb =%d usba =%d", \ + !!((r) & SL11_ISR_BABBLE), !!((r) & SL11_ISR_USBB), \ + !!((r) & SL11_ISR_USBA), 0); \ +} while (0) + +#define DDOLOGIER(r) do { \ +DDOLOG("IER det/res=%d insert =%d sof=%d", \ + !!((r) & SL11_IER_RESUME), \ + !!((r) & SL11_IER_INSERT), ((r) & SL11_IER_SOF), 0); \ +DDOLOG("IER babble =%d usbb =%d usba =%d", \ + !!((r) & SL11_IER_BABBLE), !!((r) & SL11_IER_USBB), \ + !!((r) & SL11_IER_USBA), 0); \ +} while (0) + +#define DDLOGSTATUS(s) do { \ +DDOLOG("STAT stall =%d nak =%d overflow =%d setup =%d", \ + !!((s) & SL11_EPSTAT_STALL), !!((s) & SL11_EPSTAT_NAK), \ + !!((s) & SL11_EPSTAT_OVERFLOW), !!((s) & SL11_EPSTAT_SETUP)); \ +DDOLOG("STAT sequence=%d timeout =%d error=%d ack =%d", \ + !!((s) & SL11_EPSTAT_SEQUENCE), !!((s) & SL11_EPSTAT_TIMEOUT), \ + !!((s) & SL11_EPSTAT_ERROR), !!((s) & SL11_EPSTAT_ACK)); \ +} while (0) + +#define DDLOGEPCTRL(r) do { \ +DDOLOG("CTRL preamble=%d toggle =%d sof =%d iso =%d", \ + !!((r) & SL11_EPCTRL_PREAMBLE), !!((r) & SL11_EPCTRL_DATATOGGLE),\ + !!((r) & SL11_EPCTRL_SOF), !!((r) & SL11_EPCTRL_ISO)); \ +DDOLOG("CTRL out =%d enable =%d arm =%d", \ + !!((r) & SL11_EPCTRL_DIRECTION),\ + !!((r) & SL11_EPCTRL_ENABLE), !!((r) & SL11_EPCTRL_ARM), 0); \ +} while (0) + +#define DDLOGEPSTAT(r) do { \ +DDOLOG("STAT stall =%d nak =%d overflow =%d setup =%d", \ + !!((r) & SL11_EPSTAT_STALL), !!((r) & SL11_EPSTAT_NAK), \ + !!((r) & SL11_EPSTAT_OVERFLOW), !!((r) & SL11_EPSTAT_SETUP)); \ +DDOLOG("STAT sequence=%d timeout =%d error=%d ack =%d", \ + !!((r) & SL11_EPSTAT_SEQUENCE), !!((r) & SL11_EPSTAT_TIMEOUT), \ + !!((r) & SL11_EPSTAT_ERROR), !!((r) & SL11_EPSTAT_ACK)); \ +} while (0) + #endif /* @@ -530,7 +571,6 @@ static void slhci_get_status(struct slhc #ifdef SLHCI_DEBUG void slhci_log_buffer(struct usbd_xfer *); void slhci_log_req(usb_device_request_t *); -void slhci_log_req_hub(usb_device_request_t *); void slhci_log_dumpreg(void); void slhci_log_xfer(struct usbd_xfer *); void slhci_log_spipe(struct slhci_pipe *); @@ -590,21 +630,7 @@ struct slhci_softc *ssc; #define DDOLOG(f, a, b, c, d) do { KERNHIST_LOG(usbhist, f, a, b, c, d); \ } while (/*CONSTCOND*/0) #define DLOG(x, f, a, b, c, d) SLHCI_DEXEC(x, DDOLOG(f, a, b, c, d)) -/* - * DLOGFLAG8 is a macro not a function so that flag name expressions are not - * evaluated unless the flag bit is set (which could save a register read). - * x is debug mask, y is flag identifier, z is flag variable, - * a-h are flag names (must evaluate to string constants, msb first). - */ -#define DDOLOGFLAG8(y, z, a, b, c, d, e, f, g, h) do { uint8_t _DLF8 = (z); \ -if (_DLF8 & 0xf0) KERNHIST_LOG(usbhist, y " %s %s %s %s", _DLF8 & 0x80 ? \ -(a) : "", _DLF8 &
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Fri Jun 17 17:05:04 UTC 2016 Modified Files: src/sys/dev/ic: cissreg.h Log Message: rename intr bits To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/cissreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/cissreg.h diff -u src/sys/dev/ic/cissreg.h:1.4 src/sys/dev/ic/cissreg.h:1.5 --- src/sys/dev/ic/cissreg.h:1.4 Sat Oct 12 12:52:21 2013 +++ src/sys/dev/ic/cissreg.h Fri Jun 17 13:05:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cissreg.h,v 1.4 2013/10/12 16:52:21 christos Exp $ */ +/* $NetBSD: cissreg.h,v 1.5 2016/06/17 17:05:04 christos Exp $ */ /* $OpenBSD: cissreg.h,v 1.11 2010/06/03 01:02:13 dlg Exp $ */ /* @@ -24,8 +24,10 @@ #define CISS_IDB_CFG 0x01 #define CISS_ISR 0x30 #define CISS_IMR 0x34 -#define CISS_READYENAB 4 -#define CISS_READYENA 8 +#define CISS_INTR_OPQ_SA5 (1<<3) +#define CISS_INTR_OPQ_SA5B (1<<2) +#define CISS_INTR_OPQ (CISS_INTR_OPQ_SA5|CISS_INTR_OPQ_SA5B) +#define CISS_INTR_MSI (1<<0) #define CISS_INQ 0x40 #define CISS_OUTQ 0x44 #define CISS_CFG_BAR 0xb4
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Fri Jun 17 17:03:20 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: ifdef out unused code. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.15 src/sys/dev/ic/rt2860.c:1.16 --- src/sys/dev/ic/rt2860.c:1.15 Fri Jun 17 11:38:54 2016 +++ src/sys/dev/ic/rt2860.c Fri Jun 17 13:03:20 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.15 2016/06/17 15:38:54 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.16 2016/06/17 17:03:20 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.15 2016/06/17 15:38:54 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.16 2016/06/17 17:03:20 christos Exp $"); #include #include @@ -2741,6 +2741,7 @@ rt2860_updateedca(struct ieee80211com *i return 0; } +#ifdef HW_CRYPTO static int rt2860_set_key(struct ieee80211com *ic, const struct ieee80211_key *ck, const uint8_t *mac) @@ -2864,6 +2865,7 @@ rt2860_delete_key(struct ieee80211com *i } return 1; } +#endif static int8_t rt2860_rssi2dbm(struct rt2860_softc *sc, uint8_t rssi, uint8_t rxchain)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Jun 17 16:07:40 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: More(/less) debug To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.77 src/sys/dev/ic/sl811hs.c:1.78 --- src/sys/dev/ic/sl811hs.c:1.77 Fri Jun 17 15:57:08 2016 +++ src/sys/dev/ic/sl811hs.c Fri Jun 17 16:07:40 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.77 2016/06/17 15:57:08 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.78 2016/06/17 16:07:40 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.77 2016/06/17 15:57:08 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.78 2016/06/17 16:07:40 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_slhci.h" @@ -1735,11 +1735,10 @@ slhci_dointr(struct slhci_softc *sc) KASSERT(mutex_owned(>sc_intr_lock)); - DLOG(D_INTR, "Flags %#x sc_ier %#x ISR=%#x", t->flags, sc->sc_ier, - slhci_read(sc, SL11_ISR), 0); - - if (sc->sc_ier == 0) + if (sc->sc_ier == 0) { + DLOG(D_INTR, "sc_ier is zero", 0, 0, 0, 0); return 0; + } r = slhci_read(sc, SL11_ISR); @@ -1776,8 +1775,10 @@ slhci_dointr(struct slhci_softc *sc) r &= sc->sc_ier; - if (r == 0) + if (r == 0) { + DLOG(D_INTR, "r is zero", 0, 0, 0, 0); return 0; + } sc->sc_ier_check = 0; @@ -1787,6 +1788,7 @@ slhci_dointr(struct slhci_softc *sc) /* If we have an insertion event we do not care about anything else. */ if (__predict_false(r & SL11_ISR_INSERT)) { slhci_insert(sc); + DLOG(D_INTR, "... done", 0, 0, 0, 0); return 1; } @@ -1896,6 +1898,8 @@ slhci_dointr(struct slhci_softc *sc) slhci_dotransfer(sc); + DLOG(D_INTR, "... done", 0, 0, 0, 0); + return 1; }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Fri Jun 17 15:57:08 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: _KERNEL_OPT protection To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.76 src/sys/dev/ic/sl811hs.c:1.77 --- src/sys/dev/ic/sl811hs.c:1.76 Tue May 17 03:20:58 2016 +++ src/sys/dev/ic/sl811hs.c Fri Jun 17 15:57:08 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.76 2016/05/17 03:20:58 martin Exp $ */ +/* $NetBSD: sl811hs.c,v 1.77 2016/06/17 15:57:08 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,11 +68,10 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.76 2016/05/17 03:20:58 martin Exp $"); - -#include "opt_slhci.h" +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.77 2016/06/17 15:57:08 skrll Exp $"); #ifdef _KERNEL_OPT +#include "opt_slhci.h" #include "opt_usb.h" #endif
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Fri Jun 17 15:38:54 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: disable hardware crypto for now. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.14 src/sys/dev/ic/rt2860.c:1.15 --- src/sys/dev/ic/rt2860.c:1.14 Thu Jun 16 11:51:13 2016 +++ src/sys/dev/ic/rt2860.c Fri Jun 17 11:38:54 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.14 2016/06/16 15:51:13 riastradh Exp $ */ +/* $NetBSD: rt2860.c,v 1.15 2016/06/17 15:38:54 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.14 2016/06/16 15:51:13 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.15 2016/06/17 15:38:54 christos Exp $"); #include #include @@ -137,10 +137,12 @@ static void rt2860_set_macaddr(struct rt static void rt2860_updateslot(struct ifnet *); static void rt2860_updateprot(struct ieee80211com *); static int rt2860_updateedca(struct ieee80211com *); +#ifdef HW_CRYPTO static int rt2860_set_key(struct ieee80211com *, const struct ieee80211_key *, const uint8_t *); static int rt2860_delete_key(struct ieee80211com *, const struct ieee80211_key *); +#endif static int8_t rt2860_rssi2dbm(struct rt2860_softc *, uint8_t, uint8_t); static const char * rt2860_get_rf(uint8_t); static int rt2860_read_eeprom(struct rt2860_softc *); @@ -378,8 +380,10 @@ rt2860_attachhook(device_t self) #endif ic->ic_updateslot = rt2860_updateslot; ic->ic_wme.wme_update = rt2860_updateedca; +#ifdef HW_CRYPTO ic->ic_crypto.cs_key_set = rt2860_set_key; ic->ic_crypto.cs_key_delete = rt2860_delete_key; +#endif /* override state transition machine */ sc->sc_newstate = ic->ic_newstate; ic->ic_newstate = rt2860_newstate; @@ -1289,6 +1293,15 @@ rt2860_rx_intr(struct rt2860_softc *sc) goto skip; } +#ifdef HW_CRYPTO + if (__predict_false(rxd->flags & htole32(RT2860_RX_MICERR))) { + /* report MIC failures to net80211 for TKIP */ + ieee80211_notify_michael_failure(ic, wh, 0/* XXX */); + ifp->if_ierrors++; + goto skip; + } +#endif + MGETHDR(m1, M_DONTWAIT, MT_DATA); if (__predict_false(m1 == NULL)) { ifp->if_ierrors++; @@ -1341,10 +1354,12 @@ rt2860_rx_intr(struct rt2860_softc *sc) m->m_pkthdr.len = m->m_len = le16toh(rxwi->len) & 0xfff; wh = mtod(m, struct ieee80211_frame *); +#ifdef HW_CRYPTO if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { /* frame is decrypted by hardware */ wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; } +#endif /* HW may insert 2 padding bytes after 802.11 header */ if (rxd->flags & htole32(RT2860_RX_L2PAD)) { @@ -1354,13 +1369,6 @@ rt2860_rx_intr(struct rt2860_softc *sc) wh = mtod(m, struct ieee80211_frame *); } - if (__predict_false(rxd->flags & htole32(RT2860_RX_MICERR))) { - /* report MIC failures to net80211 for TKIP */ - ieee80211_notify_michael_failure(ic, wh, 0/* XXX */); - ifp->if_ierrors++; - goto skip; - } - ant = rt2860_maxrssi_chain(sc, rxwi); rssi = rxwi->rssi[ant]; @@ -1402,6 +1410,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) } bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m); skipbpf: + wh = mtod(m, struct ieee80211_frame *); /* grab a reference to the source node */ ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Thu Jun 16 15:51:13 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: Use m_set_rcvif, not M_SETCTX. M_SETCTX is only for driver-private use of rcvif, whereas here we really mean to set the receiving interface with m_set_rcvif. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.13 src/sys/dev/ic/rt2860.c:1.14 --- src/sys/dev/ic/rt2860.c:1.13 Thu Jun 16 15:21:49 2016 +++ src/sys/dev/ic/rt2860.c Thu Jun 16 15:51:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.13 2016/06/16 15:21:49 nonaka Exp $ */ +/* $NetBSD: rt2860.c,v 1.14 2016/06/16 15:51:13 riastradh Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.13 2016/06/16 15:21:49 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.14 2016/06/16 15:51:13 riastradh Exp $"); #include #include @@ -1337,7 +1337,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) /* finalize mbuf */ m->m_data = (void *)(rxwi + 1); - M_SETCTX(m, ifp); + m_set_rcvif(m, ifp); m->m_pkthdr.len = m->m_len = le16toh(rxwi->len) & 0xfff; wh = mtod(m, struct ieee80211_frame *);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: nonaka Date: Thu Jun 16 15:21:49 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: use M_SETCTX() macro. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.12 src/sys/dev/ic/rt2860.c:1.13 --- src/sys/dev/ic/rt2860.c:1.12 Thu Jun 16 13:01:08 2016 +++ src/sys/dev/ic/rt2860.c Thu Jun 16 15:21:49 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.12 2016/06/16 13:01:08 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.13 2016/06/16 15:21:49 nonaka Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.12 2016/06/16 13:01:08 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.13 2016/06/16 15:21:49 nonaka Exp $"); #include #include @@ -1337,7 +1337,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) /* finalize mbuf */ m->m_data = (void *)(rxwi + 1); - m->m_pkthdr.rcvif = ifp; + M_SETCTX(m, ifp); m->m_pkthdr.len = m->m_len = le16toh(rxwi->len) & 0xfff; wh = mtod(m, struct ieee80211_frame *);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Thu Jun 16 12:56:49 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: fix mbuf handling; we don't crash anymore. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.10 src/sys/dev/ic/rt2860.c:1.11 --- src/sys/dev/ic/rt2860.c:1.10 Thu May 26 01:04:46 2016 +++ src/sys/dev/ic/rt2860.c Thu Jun 16 08:56:49 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.10 2016/05/26 05:04:46 ozaki-r Exp $ */ +/* $NetBSD: rt2860.c,v 1.11 2016/06/16 12:56:49 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.10 2016/05/26 05:04:46 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.11 2016/06/16 12:56:49 christos Exp $"); #include #include @@ -700,7 +700,7 @@ rt2860_alloc_rx_ring(struct rt2860_softc goto fail; } - MGET(data->m, M_DONTWAIT, MT_DATA); + MGETHDR(data->m, M_DONTWAIT, MT_DATA); if (data->m == NULL) { msg = "allocate Rx mbuf"; goto fail1; @@ -1273,7 +1273,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) goto skip; } - MGET(m1, M_DONTWAIT, MT_DATA); + MGETHDR(m1, M_DONTWAIT, MT_DATA); if (__predict_false(m1 == NULL)) { ifp->if_ierrors++; goto skip; @@ -1321,6 +1321,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) /* finalize mbuf */ m->m_data = (void *)(rxwi + 1); + m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = le16toh(rxwi->len) & 0xfff; wh = mtod(m, struct ieee80211_frame *);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Thu Jun 16 13:01:08 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: more conservating handling of memory. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.11 src/sys/dev/ic/rt2860.c:1.12 --- src/sys/dev/ic/rt2860.c:1.11 Thu Jun 16 08:56:49 2016 +++ src/sys/dev/ic/rt2860.c Thu Jun 16 09:01:08 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.11 2016/06/16 12:56:49 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.12 2016/06/16 13:01:08 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.11 2016/06/16 12:56:49 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.12 2016/06/16 13:01:08 christos Exp $"); #include #include @@ -507,12 +507,18 @@ rt2860_reset_tx_ring(struct rt2860_softc if ((data = ring->data[i]) == NULL) continue; /* nothing mapped in this slot */ - bus_dmamap_sync(sc->sc_dmat, data->map, 0, - data->map->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, data->map); - m_freem(data->m); - data->m= NULL; - data->ni = NULL; /* node already freed */ + if (data->ni != NULL) { + ieee80211_free_node(data->ni); + data->ni = NULL; + } + + if (data->m != NULL) { + bus_dmamap_sync(sc->sc_dmat, data->map, 0, + data->map->dm_mapsize, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dmat, data->map); + m_freem(data->m); + data->m = NULL; + } SLIST_INSERT_HEAD(>data_pool, data, next); ring->data[i] = NULL; @@ -543,13 +549,23 @@ rt2860_free_tx_ring(struct rt2860_softc if ((data = ring->data[i]) == NULL) continue; /* nothing mapped in this slot */ - bus_dmamap_sync(sc->sc_dmat, data->map, 0, - data->map->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, data->map); - m_freem(data->m); + if (data->ni != NULL) { + ieee80211_free_node(data->ni); + data->ni = NULL; + } + if (data->m != NULL) { + bus_dmamap_sync(sc->sc_dmat, data->map, 0, + data->map->dm_mapsize, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dmat, data->map); + m_freem(data->m); + data->m = NULL; + } SLIST_INSERT_HEAD(>data_pool, data, next); + ring->data[i] = NULL; } + ring->queued = 0; + ring->cur = ring->next = 0; } /*
CVS commit: src/sys/dev/ic
Module Name:src Committed By: pgoyette Date: Wed Jun 8 22:25:35 UTC 2016 Modified Files: src/sys/dev/ic: rtl81x9.c Log Message: Revert previous (rev. 1.98). It breaks at least one user's card. PR kern/44433 To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/dev/ic/rtl81x9.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rtl81x9.c diff -u src/sys/dev/ic/rtl81x9.c:1.98 src/sys/dev/ic/rtl81x9.c:1.99 --- src/sys/dev/ic/rtl81x9.c:1.98 Wed Jun 1 12:40:03 2016 +++ src/sys/dev/ic/rtl81x9.c Wed Jun 8 22:25:35 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rtl81x9.c,v 1.98 2016/06/01 12:40:03 pgoyette Exp $ */ +/* $NetBSD: rtl81x9.c,v 1.99 2016/06/08 22:25:35 pgoyette Exp $ */ /* * Copyright (c) 1997, 1998 @@ -86,7 +86,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.98 2016/06/01 12:40:03 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.99 2016/06/08 22:25:35 pgoyette Exp $"); #include @@ -1339,11 +1339,9 @@ rtk_init(struct ifnet *ifp) rtk_stop(ifp, 0); /* Init our MAC address */ - CSR_WRITE_1(sc, RTK_EECMD, RTK_EEMODE_WRITECFG); for (i = 0; i < ETHER_ADDR_LEN; i++) { CSR_WRITE_1(sc, RTK_IDR0 + i, CLLADDR(ifp->if_sadl)[i]); } - CSR_WRITE_1(sc, RTK_EECMD, RTK_EEMODE_OFF); /* Init the RX buffer pointer register. */ bus_dmamap_sync(sc->sc_dmat, sc->recv_dmamap, 0,
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jmcneill Date: Fri Jun 3 10:34:03 UTC 2016 Modified Files: src/sys/dev/ic: ahcisata_core.c Log Message: PR kern/51211: atactl atabus0 reset causes a panic on Tegra K1 Fix an issue where ahci_reset_channel calls ahci_channel_start with clo=1 even if CAP.SCLO=0. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/dev/ic/ahcisata_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ahcisata_core.c diff -u src/sys/dev/ic/ahcisata_core.c:1.56 src/sys/dev/ic/ahcisata_core.c:1.57 --- src/sys/dev/ic/ahcisata_core.c:1.56 Mon May 2 19:18:29 2016 +++ src/sys/dev/ic/ahcisata_core.c Fri Jun 3 10:34:03 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisata_core.c,v 1.56 2016/05/02 19:18:29 christos Exp $ */ +/* $NetBSD: ahcisata_core.c,v 1.57 2016/06/03 10:34:03 jmcneill Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.56 2016/05/02 19:18:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.57 2016/06/03 10:34:03 jmcneill Exp $"); #include #include @@ -828,7 +828,8 @@ ahci_reset_channel(struct ata_channel *c /* clear port interrupt register */ AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0x); /* clear SErrors and start operations */ - ahci_channel_start(sc, chp, flags, 1); + ahci_channel_start(sc, chp, flags, + (sc->sc_ahci_cap & AHCI_CAP_CLO) ? 1 : 0); /* wait 31s for BSY to clear */ for (i = 0; ich_channel));
CVS commit: src/sys/dev/ic
Module Name:src Committed By: pgoyette Date: Wed Jun 1 12:40:03 UTC 2016 Modified Files: src/sys/dev/ic: rtl81x9.c Log Message: Enable writing to the EPROM before trying to change our MAC address. >From PR kern/44433 To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sys/dev/ic/rtl81x9.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rtl81x9.c diff -u src/sys/dev/ic/rtl81x9.c:1.97 src/sys/dev/ic/rtl81x9.c:1.98 --- src/sys/dev/ic/rtl81x9.c:1.97 Tue Feb 9 08:32:10 2016 +++ src/sys/dev/ic/rtl81x9.c Wed Jun 1 12:40:03 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rtl81x9.c,v 1.97 2016/02/09 08:32:10 ozaki-r Exp $ */ +/* $NetBSD: rtl81x9.c,v 1.98 2016/06/01 12:40:03 pgoyette Exp $ */ /* * Copyright (c) 1997, 1998 @@ -86,7 +86,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.97 2016/02/09 08:32:10 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.98 2016/06/01 12:40:03 pgoyette Exp $"); #include @@ -1339,9 +1339,11 @@ rtk_init(struct ifnet *ifp) rtk_stop(ifp, 0); /* Init our MAC address */ + CSR_WRITE_1(sc, RTK_EECMD, RTK_EEMODE_WRITECFG); for (i = 0; i < ETHER_ADDR_LEN; i++) { CSR_WRITE_1(sc, RTK_IDR0 + i, CLLADDR(ifp->if_sadl)[i]); } + CSR_WRITE_1(sc, RTK_EECMD, RTK_EEMODE_OFF); /* Init the RX buffer pointer register. */ bus_dmamap_sync(sc->sc_dmat, sc->recv_dmamap, 0,
CVS commit: src/sys/dev/ic
Module Name:src Committed By: pgoyette Date: Wed Jun 1 08:06:38 UTC 2016 Modified Files: src/sys/dev/ic: nslm7x.c Log Message: Ooopppsss, missed the function declaration! To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/sys/dev/ic/nslm7x.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/nslm7x.c diff -u src/sys/dev/ic/nslm7x.c:1.63 src/sys/dev/ic/nslm7x.c:1.64 --- src/sys/dev/ic/nslm7x.c:1.63 Wed Jun 1 02:37:47 2016 +++ src/sys/dev/ic/nslm7x.c Wed Jun 1 08:06:38 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nslm7x.c,v 1.63 2016/06/01 02:37:47 pgoyette Exp $ */ +/* $NetBSD: nslm7x.c,v 1.64 2016/06/01 08:06:38 pgoyette Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.63 2016/06/01 02:37:47 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.64 2016/06/01 08:06:38 pgoyette Exp $"); #include #include @@ -92,7 +92,7 @@ static void wb_w83627ehf_refresh_nvolt(s static void wb_refresh_temp(struct lm_softc *, int); static void wb_refresh_fanrpm(struct lm_softc *, int); static void wb_w83792d_refresh_fanrpm(struct lm_softc *, int); - +static void wb_nct6776f_refresh_fanrpm(struct lm_softc *, int); static void as_refresh_temp(struct lm_softc *, int); struct lm_chip {
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdc Date: Tue May 17 14:44:53 UTC 2016 Modified Files: src/sys/dev/ic: gem.c Log Message: PR kern/46083 Track the start of each packet, so that we set the "Start of Frame" bit in all the relevant transmit descriptors when enqueing multiple packets. Patch from Valery Ushakov, slightly modified by me to handle debug output. Tested on macppc/6.x and sparc64/7.99.x. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/dev/ic/gem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/gem.c diff -u src/sys/dev/ic/gem.c:1.104 src/sys/dev/ic/gem.c:1.105 --- src/sys/dev/ic/gem.c:1.104 Tue Feb 9 08:32:10 2016 +++ src/sys/dev/ic/gem.c Tue May 17 14:44:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: gem.c,v 1.104 2016/02/09 08:32:10 ozaki-r Exp $ */ +/* $NetBSD: gem.c,v 1.105 2016/05/17 14:44:53 jdc Exp $ */ /* * @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.104 2016/02/09 08:32:10 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.105 2016/05/17 14:44:53 jdc Exp $"); #include "opt_inet.h" @@ -1362,6 +1362,9 @@ gem_start(struct ifnet *ifp) struct gem_txsoft *txs; bus_dmamap_t dmamap; int error, firsttx, nexttx = -1, lasttx = -1, ofree, seg; +#ifdef GEM_DEBUG + int otxnext; +#endif uint64_t flags = 0; if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) @@ -1372,10 +1375,12 @@ gem_start(struct ifnet *ifp) * the first descriptor we'll use. */ ofree = sc->sc_txfree; - firsttx = sc->sc_txnext; +#ifdef GEM_DEBUG + otxnext = sc->sc_txnext; +#endif DPRINTF(sc, ("%s: gem_start: txfree %d, txnext %d\n", - device_xname(sc->sc_dev), ofree, firsttx)); + device_xname(sc->sc_dev), ofree, otxnext)); /* * Loop through the send queue, setting up transmit descriptors @@ -1480,7 +1485,8 @@ gem_start(struct ifnet *ifp) /* * Initialize the transmit descriptors. */ - for (nexttx = sc->sc_txnext, seg = 0; + firsttx = sc->sc_txnext; + for (nexttx = firsttx, seg = 0; seg < dmamap->dm_nsegs; seg++, nexttx = GEM_NEXTTX(nexttx)) { @@ -1602,7 +1608,7 @@ gem_start(struct ifnet *ifp) if (sc->sc_txfree != ofree) { DPRINTF(sc, ("%s: packets enqueued, IC on %d, OWN on %d\n", - device_xname(sc->sc_dev), lasttx, firsttx)); + device_xname(sc->sc_dev), lasttx, otxnext)); /* * The entire packet chain is set up. * Kick the transmitter.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: martin Date: Tue May 17 03:20:58 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Mark a diagnostic only variable To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.75 src/sys/dev/ic/sl811hs.c:1.76 --- src/sys/dev/ic/sl811hs.c:1.75 Mon May 16 15:09:29 2016 +++ src/sys/dev/ic/sl811hs.c Tue May 17 03:20:58 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.75 2016/05/16 15:09:29 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.76 2016/05/17 03:20:58 martin Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.75 2016/05/16 15:09:29 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.76 2016/05/17 03:20:58 martin Exp $"); #include "opt_slhci.h" @@ -986,7 +986,7 @@ slhci_root_start(struct usbd_xfer *xfer) { SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); struct slhci_softc *sc; - struct slhci_pipe *spipe; + struct slhci_pipe *spipe __diagused; spipe = SLHCI_PIPE2SPIPE(xfer->ux_pipe); sc = SLHCI_XFER2SC(xfer);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Mon May 16 15:09:29 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Simplify and fixup roothub interrupt transfers to work as well as before nick-nhusb. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.74 src/sys/dev/ic/sl811hs.c:1.75 --- src/sys/dev/ic/sl811hs.c:1.74 Mon May 16 08:00:25 2016 +++ src/sys/dev/ic/sl811hs.c Mon May 16 15:09:29 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.74 2016/05/16 08:00:25 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.75 2016/05/16 15:09:29 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.74 2016/05/16 08:00:25 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.75 2016/05/16 15:09:29 skrll Exp $"); #include "opt_slhci.h" @@ -524,8 +524,6 @@ static void slhci_insert(struct slhci_so static usbd_status slhci_clear_feature(struct slhci_softc *, unsigned int); static usbd_status slhci_set_feature(struct slhci_softc *, unsigned int); static void slhci_get_status(struct slhci_softc *, usb_port_status_t *); -static usbd_status slhci_root(struct slhci_softc *, struct slhci_pipe *, -struct usbd_xfer *); #define SLHCIHIST_FUNC() USBHIST_FUNC() #define SLHCIHIST_CALLED() USBHIST_CALLED(slhcidebug) @@ -993,7 +991,20 @@ slhci_root_start(struct usbd_xfer *xfer) spipe = SLHCI_PIPE2SPIPE(xfer->ux_pipe); sc = SLHCI_XFER2SC(xfer); - return slhci_lock_call(sc, _root, spipe, xfer); + struct slhci_transfers *t = >sc_transfers; + + LK_SLASSERT(spipe != NULL && xfer != NULL, sc, spipe, xfer, return + USBD_CANCELLED); + + DLOG(D_TRACE, "%s start", pnames(SLHCI_XFER_TYPE(xfer)), 0,0,0); + + KASSERT(spipe->ptype == PT_ROOT_INTR); + + mutex_enter(>sc_intr_lock); + t->rootintr = xfer; + mutex_exit(>sc_intr_lock); + + return USBD_IN_PROGRESS; } usbd_status @@ -3080,32 +3091,6 @@ slhci_get_status(struct slhci_softc *sc, DLOG(D_ROOT, "status=%#.4x, change=%#.4x", status, change, 0,0); } -static usbd_status -slhci_root(struct slhci_softc *sc, struct slhci_pipe *spipe, -struct usbd_xfer *xfer) -{ - SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); - struct slhci_transfers *t; - - t = >sc_transfers; - - LK_SLASSERT(spipe != NULL && xfer != NULL, sc, spipe, xfer, return - USBD_CANCELLED); - - DLOG(D_TRACE, "%s start", pnames(SLHCI_XFER_TYPE(xfer)), 0,0,0); - KASSERT(mutex_owned(>sc_intr_lock)); - - KASSERT(spipe->ptype == PT_ROOT_INTR); -#if 0 - LK_SLASSERT(t->rootintr == NULL, sc, spipe, xfer, return - USBD_CANCELLED); -#endif - t->rootintr = xfer; - if (t->flags & F_CHANGE) - t->flags |= F_ROOTINTR; - return USBD_IN_PROGRESS; -} - static int slhci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req, void *buf, int buflen)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Mon May 16 08:00:25 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Update comment To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.73 src/sys/dev/ic/sl811hs.c:1.74 --- src/sys/dev/ic/sl811hs.c:1.73 Mon May 16 07:59:42 2016 +++ src/sys/dev/ic/sl811hs.c Mon May 16 08:00:25 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.73 2016/05/16 07:59:42 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.74 2016/05/16 08:00:25 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.73 2016/05/16 07:59:42 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.74 2016/05/16 08:00:25 skrll Exp $"); #include "opt_slhci.h" @@ -2479,7 +2479,7 @@ slhci_do_callback_schedule(struct slhci_ } #if 0 -/* must be called with lock taken from IPL_USB */ +/* must be called with lock taken. */ /* XXX static */ void slhci_pollxfer(struct slhci_softc *sc, struct usbd_xfer *xfer) {
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Mon May 16 07:59:42 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Really fix comment To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.72 src/sys/dev/ic/sl811hs.c:1.73 --- src/sys/dev/ic/sl811hs.c:1.72 Sun May 15 14:00:08 2016 +++ src/sys/dev/ic/sl811hs.c Mon May 16 07:59:42 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.72 2016/05/15 14:00:08 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.73 2016/05/16 07:59:42 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.72 2016/05/15 14:00:08 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.73 2016/05/16 07:59:42 skrll Exp $"); #include "opt_slhci.h" @@ -2332,7 +2332,7 @@ slhci_dotransfer(struct slhci_softc *sc) } /* - * slhci_callback is called after the lock. + * slhci_callback is called after the lock is taken. */ static void slhci_callback(struct slhci_softc *sc)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun May 15 14:00:08 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Fix comment To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.71 src/sys/dev/ic/sl811hs.c:1.72 --- src/sys/dev/ic/sl811hs.c:1.71 Sun May 15 13:59:36 2016 +++ src/sys/dev/ic/sl811hs.c Sun May 15 14:00:08 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.71 2016/05/15 13:59:36 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.72 2016/05/15 14:00:08 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.71 2016/05/15 13:59:36 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.72 2016/05/15 14:00:08 skrll Exp $"); #include "opt_slhci.h" @@ -2332,7 +2332,7 @@ slhci_dotransfer(struct slhci_softc *sc) } /* - * slhci_callback is called after the lock is taken from splusb. + * slhci_callback is called after the lock. */ static void slhci_callback(struct slhci_softc *sc)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun May 15 13:59:36 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Typo in comment To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.70 src/sys/dev/ic/sl811hs.c:1.71 --- src/sys/dev/ic/sl811hs.c:1.70 Sat May 14 10:07:52 2016 +++ src/sys/dev/ic/sl811hs.c Sun May 15 13:59:36 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.70 2016/05/14 10:07:52 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.71 2016/05/15 13:59:36 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.70 2016/05/14 10:07:52 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.71 2016/05/15 13:59:36 skrll Exp $"); #include "opt_slhci.h" @@ -3054,7 +3054,7 @@ slhci_get_status(struct slhci_softc *sc, KASSERT(mutex_owned(>sc_intr_lock)); /* - * We do not have a way to detect over current or bable and + * We do not have a way to detect over current or babble and * suspend is currently not implemented, so connect and reset * are the only changes that need to be reported. */
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sat May 14 10:07:52 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: #if 0 an assert around rootintr that's no longer correct. root hub interrupt transfers could do with reworking. To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.69 src/sys/dev/ic/sl811hs.c:1.70 --- src/sys/dev/ic/sl811hs.c:1.69 Sat May 14 08:52:20 2016 +++ src/sys/dev/ic/sl811hs.c Sat May 14 10:07:52 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.69 2016/05/14 08:52:20 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.70 2016/05/14 10:07:52 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.69 2016/05/14 08:52:20 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.70 2016/05/14 10:07:52 skrll Exp $"); #include "opt_slhci.h" @@ -3096,8 +3096,10 @@ slhci_root(struct slhci_softc *sc, struc KASSERT(mutex_owned(>sc_intr_lock)); KASSERT(spipe->ptype == PT_ROOT_INTR); +#if 0 LK_SLASSERT(t->rootintr == NULL, sc, spipe, xfer, return USBD_CANCELLED); +#endif t->rootintr = xfer; if (t->flags & F_CHANGE) t->flags |= F_ROOTINTR;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sat May 14 08:52:20 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Another locking fix in slhci_roothub_ctrl To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.68 src/sys/dev/ic/sl811hs.c:1.69 --- src/sys/dev/ic/sl811hs.c:1.68 Thu May 12 18:57:38 2016 +++ src/sys/dev/ic/sl811hs.c Sat May 14 08:52:20 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.68 2016/05/12 18:57:38 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.69 2016/05/14 08:52:20 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.68 2016/05/12 18:57:38 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.69 2016/05/14 08:52:20 skrll Exp $"); #include "opt_slhci.h" @@ -3162,9 +3162,11 @@ slhci_roothub_ctrl(struct usbd_bus *bus, /* Write Requests */ case UR_CLEAR_FEATURE: if (type == UT_WRITE_CLASS_OTHER) { - if (index == 1 /* Port */) + if (index == 1 /* Port */) { +mutex_enter(>sc_intr_lock); error = slhci_clear_feature(sc, value); - else +mutex_exit(>sc_intr_lock); + } else DLOG(D_ROOT, "Clear Port Feature " "index = %#.4x", index, 0,0,0); }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Thu May 12 18:57:38 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Fix locking in slhci_roothub_ctrl To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.67 src/sys/dev/ic/sl811hs.c:1.68 --- src/sys/dev/ic/sl811hs.c:1.67 Thu May 12 05:30:17 2016 +++ src/sys/dev/ic/sl811hs.c Thu May 12 18:57:38 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.67 2016/05/12 05:30:17 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.68 2016/05/12 18:57:38 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.67 2016/05/12 05:30:17 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.68 2016/05/12 18:57:38 skrll Exp $"); #include "opt_slhci.h" @@ -3171,9 +3171,11 @@ slhci_roothub_ctrl(struct usbd_bus *bus, break; case UR_SET_FEATURE: if (type == UT_WRITE_CLASS_OTHER) { - if (index == 1 /* Port */) + if (index == 1 /* Port */) { +mutex_enter(>sc_intr_lock); error = slhci_set_feature(sc, value); - else +mutex_exit(>sc_intr_lock); + } else DLOG(D_ROOT, "Set Port Feature " "index = %#.4x", index, 0,0,0); } else if (type != UT_WRITE_CLASS_DEVICE) @@ -3187,8 +3189,10 @@ slhci_roothub_ctrl(struct usbd_bus *bus, if (type == UT_READ_CLASS_OTHER) { if (index == 1 /* Port */ && len == /* XXX >=? */ sizeof(usb_port_status_t)) { +mutex_enter(>sc_intr_lock); slhci_get_status(sc, (usb_port_status_t *) buf); +mutex_exit(>sc_intr_lock); actlen = sizeof(usb_port_status_t); error = USBD_NORMAL_COMPLETION; } else
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Thu May 12 05:30:17 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: More typos in previous To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.66 src/sys/dev/ic/sl811hs.c:1.67 --- src/sys/dev/ic/sl811hs.c:1.66 Wed May 11 21:28:21 2016 +++ src/sys/dev/ic/sl811hs.c Thu May 12 05:30:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.66 2016/05/11 21:28:21 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.67 2016/05/12 05:30:17 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.66 2016/05/11 21:28:21 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.67 2016/05/12 05:30:17 skrll Exp $"); #include "opt_slhci.h" @@ -1725,7 +1725,7 @@ slhci_dointr(struct slhci_softc *sc) KASSERT(mutex_owned(>sc_intr_lock)); - DLOG(D_INTR, "Flags %#x sc_ier #%x ISR=#%x", t->flags, sc->sc_ier, + DLOG(D_INTR, "Flags %#x sc_ier %#x ISR=%#x", t->flags, sc->sc_ier, slhci_read(sc, SL11_ISR), 0); if (sc->sc_ier == 0)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Wed May 11 21:28:21 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Typo in previous To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.65 src/sys/dev/ic/sl811hs.c:1.66 --- src/sys/dev/ic/sl811hs.c:1.65 Wed May 11 21:27:09 2016 +++ src/sys/dev/ic/sl811hs.c Wed May 11 21:28:21 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.65 2016/05/11 21:27:09 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.66 2016/05/11 21:28:21 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.65 2016/05/11 21:27:09 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.66 2016/05/11 21:28:21 skrll Exp $"); #include "opt_slhci.h" @@ -1725,7 +1725,7 @@ slhci_dointr(struct slhci_softc *sc) KASSERT(mutex_owned(>sc_intr_lock)); - DLOG(D_INTR, "Flags %#x sc_eir #%x ISR=#%x", t->flags, sc->sc_ier, + DLOG(D_INTR, "Flags %#x sc_ier #%x ISR=#%x", t->flags, sc->sc_ier, slhci_read(sc, SL11_ISR), 0); if (sc->sc_ier == 0)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Wed May 11 21:27:09 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: More debug To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.64 src/sys/dev/ic/sl811hs.c:1.65 --- src/sys/dev/ic/sl811hs.c:1.64 Wed May 11 21:05:12 2016 +++ src/sys/dev/ic/sl811hs.c Wed May 11 21:27:09 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.64 2016/05/11 21:05:12 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.65 2016/05/11 21:27:09 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.64 2016/05/11 21:05:12 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.65 2016/05/11 21:27:09 skrll Exp $"); #include "opt_slhci.h" @@ -1725,6 +1725,9 @@ slhci_dointr(struct slhci_softc *sc) KASSERT(mutex_owned(>sc_intr_lock)); + DLOG(D_INTR, "Flags %#x sc_eir #%x ISR=#%x", t->flags, sc->sc_ier, + slhci_read(sc, SL11_ISR), 0); + if (sc->sc_ier == 0) return 0;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Wed May 11 21:05:12 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Remove incorrect comment To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.63 src/sys/dev/ic/sl811hs.c:1.64 --- src/sys/dev/ic/sl811hs.c:1.63 Wed May 11 21:03:01 2016 +++ src/sys/dev/ic/sl811hs.c Wed May 11 21:05:12 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.63 2016/05/11 21:03:01 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.64 2016/05/11 21:05:12 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.63 2016/05/11 21:03:01 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.64 2016/05/11 21:05:12 skrll Exp $"); #include "opt_slhci.h" @@ -1372,7 +1372,6 @@ slhci_poll(struct usbd_bus *bus) /* XXX void slhci_done(struct usbd_xfer *xfer) { - /* xfer may not be valid here */ } void
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Wed May 11 21:03:01 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: More debug To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.62 src/sys/dev/ic/sl811hs.c:1.63 --- src/sys/dev/ic/sl811hs.c:1.62 Wed May 11 21:02:10 2016 +++ src/sys/dev/ic/sl811hs.c Wed May 11 21:03:01 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.62 2016/05/11 21:02:10 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.63 2016/05/11 21:03:01 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.62 2016/05/11 21:02:10 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.63 2016/05/11 21:03:01 skrll Exp $"); #include "opt_slhci.h" @@ -2448,6 +2448,7 @@ slhci_xfer_timer(struct slhci_softc *sc, static void slhci_callback_schedule(struct slhci_softc *sc) { + SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); struct slhci_transfers *t; t = >sc_transfers;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Wed May 11 21:02:10 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: The HCD should no longer restart a repeating transfer (i.e. an interrupt transfer) as this is now handled in the usb core code. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.61 src/sys/dev/ic/sl811hs.c:1.62 --- src/sys/dev/ic/sl811hs.c:1.61 Wed May 11 06:07:52 2016 +++ src/sys/dev/ic/sl811hs.c Wed May 11 21:02:10 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.61 2016/05/11 06:07:52 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.62 2016/05/11 21:02:10 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.61 2016/05/11 06:07:52 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.62 2016/05/11 21:02:10 skrll Exp $"); #include "opt_slhci.h" @@ -493,7 +493,6 @@ static void slhci_enter_xfers(struct slh static void slhci_queue_timed(struct slhci_softc *, struct slhci_pipe *); static void slhci_xfer_timer(struct slhci_softc *, struct slhci_pipe *); -static void slhci_do_repeat(struct slhci_softc *, struct usbd_xfer *); static void slhci_callback_schedule(struct slhci_softc *); static void slhci_do_callback_schedule(struct slhci_softc *); #if 0 @@ -1474,23 +1473,18 @@ repeat: void slhci_do_callback(struct slhci_softc *sc, struct usbd_xfer *xfer) { + SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); KASSERT(mutex_owned(>sc_intr_lock)); - int repeat; - start_cc_time(_callback, (u_int)xfer); mutex_exit(>sc_intr_lock); mutex_enter(>sc_lock); - repeat = xfer->ux_pipe->up_repeat; usb_transfer_complete(xfer); mutex_exit(>sc_lock); mutex_enter(>sc_intr_lock); stop_cc_time(_callback); - - if (repeat && !sc->sc_bus.ub_usepolling) - slhci_do_repeat(sc, xfer); } int @@ -2452,30 +2446,6 @@ slhci_xfer_timer(struct slhci_softc *sc, } static void -slhci_do_repeat(struct slhci_softc *sc, struct usbd_xfer *xfer) -{ - SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); - struct slhci_transfers *t; - struct slhci_pipe *spipe; - - t = >sc_transfers; - spipe = SLHCI_PIPE2SPIPE(xfer->ux_pipe); - - if (xfer == t->rootintr) - return; - - DLOG(D_TRACE, "REPEAT: xfer %p actlen %d frame %u now %u", - xfer, xfer->ux_actlen, spipe->frame, sc->sc_transfers.frame); - - xfer->ux_actlen = 0; - spipe->xfer = xfer; - if (spipe->tregs[LEN]) - KASSERT(spipe->buffer == xfer->ux_buf); - slhci_queue_timed(sc, spipe); - slhci_dotransfer(sc); -} - -static void slhci_callback_schedule(struct slhci_softc *sc) { struct slhci_transfers *t;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Wed May 11 06:07:52 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: fix build To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.60 src/sys/dev/ic/sl811hs.c:1.61 --- src/sys/dev/ic/sl811hs.c:1.60 Tue May 10 21:15:54 2016 +++ src/sys/dev/ic/sl811hs.c Wed May 11 06:07:52 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.60 2016/05/10 21:15:54 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.61 2016/05/11 06:07:52 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.60 2016/05/10 21:15:54 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.61 2016/05/11 06:07:52 skrll Exp $"); #include "opt_slhci.h" @@ -1296,15 +1296,12 @@ slhci_abort(struct usbd_xfer *xfer) struct slhci_softc *sc; struct slhci_pipe *spipe; - KASSERT(mutex_owned(>sc_lock)); - spipe = SLHCI_PIPE2SPIPE(xfer->ux_pipe); if (spipe == NULL) goto callback; sc = SLHCI_XFER2SC(xfer); - KASSERT(mutex_owned(>sc_lock)); DLOG(D_TRACE, "%s abort xfer %p spipe %p spipe->xfer %p",
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue May 10 21:15:54 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Remove comment about splusb and replace with KASSERT(mutex_owned()) To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.59 src/sys/dev/ic/sl811hs.c:1.60 --- src/sys/dev/ic/sl811hs.c:1.59 Tue May 10 21:13:48 2016 +++ src/sys/dev/ic/sl811hs.c Tue May 10 21:15:54 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.59 2016/05/10 21:13:48 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.60 2016/05/10 21:15:54 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.59 2016/05/10 21:13:48 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.60 2016/05/10 21:15:54 skrll Exp $"); #include "opt_slhci.h" @@ -1296,6 +1296,8 @@ slhci_abort(struct usbd_xfer *xfer) struct slhci_softc *sc; struct slhci_pipe *spipe; + KASSERT(mutex_owned(>sc_lock)); + spipe = SLHCI_PIPE2SPIPE(xfer->ux_pipe); if (spipe == NULL) @@ -1312,7 +1314,6 @@ slhci_abort(struct usbd_xfer *xfer) callback: xfer->ux_status = USBD_CANCELLED; - /* Abort happens at IPL_USB. */ usb_transfer_complete(xfer); }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue May 10 21:13:48 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: More debug To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.58 src/sys/dev/ic/sl811hs.c:1.59 --- src/sys/dev/ic/sl811hs.c:1.58 Sun May 8 07:48:24 2016 +++ src/sys/dev/ic/sl811hs.c Tue May 10 21:13:48 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.58 2016/05/08 07:48:24 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.59 2016/05/10 21:13:48 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.58 2016/05/08 07:48:24 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.59 2016/05/10 21:13:48 skrll Exp $"); #include "opt_slhci.h" @@ -1398,6 +1398,7 @@ slhci_mem_use(struct usbd_bus *bus, int void slhci_reset_entry(void *arg) { + SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); struct slhci_softc *sc = arg; mutex_enter(>sc_intr_lock); @@ -2492,12 +2493,14 @@ slhci_callback_schedule(struct slhci_sof static void slhci_do_callback_schedule(struct slhci_softc *sc) { + SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); struct slhci_transfers *t; t = >sc_transfers; KASSERT(mutex_owned(>sc_intr_lock)); + DLOG(D_MSG, "flags %#x", t->flags, 0, 0, 0); if (!(t->flags & F_CALLBACK)) { t->flags |= F_CALLBACK; softint_schedule(sc->sc_cb_softintr);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun May 8 07:48:24 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: More debug To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.57 src/sys/dev/ic/sl811hs.c:1.58 --- src/sys/dev/ic/sl811hs.c:1.57 Sun May 8 07:40:17 2016 +++ src/sys/dev/ic/sl811hs.c Sun May 8 07:48:24 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.57 2016/05/08 07:40:17 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.58 2016/05/08 07:48:24 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.57 2016/05/08 07:40:17 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.58 2016/05/08 07:48:24 skrll Exp $"); #include "opt_slhci.h" @@ -987,6 +987,7 @@ slhci_start(struct usbd_xfer *xfer) usbd_status slhci_root_start(struct usbd_xfer *xfer) { + SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); struct slhci_softc *sc; struct slhci_pipe *spipe; @@ -1496,6 +1497,7 @@ slhci_do_callback(struct slhci_softc *sc int slhci_intr(void *arg) { + SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); struct slhci_softc *sc = arg; int ret; @@ -1514,6 +1516,7 @@ slhci_intr(void *arg) void slhci_main(struct slhci_softc *sc) { + SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); struct slhci_transfers *t; t = >sc_transfers;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Sun May 8 07:40:17 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Create sc_intr_lock at IPL_USB To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.56 src/sys/dev/ic/sl811hs.c:1.57 --- src/sys/dev/ic/sl811hs.c:1.56 Tue Apr 26 10:38:42 2016 +++ src/sys/dev/ic/sl811hs.c Sun May 8 07:40:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.56 2016/04/26 10:38:42 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.57 2016/05/08 07:40:17 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.56 2016/04/26 10:38:42 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.57 2016/05/08 07:40:17 skrll Exp $"); #include "opt_slhci.h" @@ -1121,7 +1121,7 @@ slhci_preinit(struct slhci_softc *sc, Po t = >sc_transfers; mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB); - mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED); + mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_USB); /* sc->sc_ier = 0; */ /* t->rootintr = NULL; */
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Fri May 6 18:07:17 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: misc cleanups. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.7 src/sys/dev/ic/rt2860.c:1.8 --- src/sys/dev/ic/rt2860.c:1.7 Mon May 2 20:19:32 2016 +++ src/sys/dev/ic/rt2860.c Fri May 6 14:07:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.7 2016/05/03 00:19:32 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.8 2016/05/06 18:07:17 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.7 2016/05/03 00:19:32 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.8 2016/05/06 18:07:17 christos Exp $"); #include #include @@ -69,6 +69,7 @@ int rt2860_debug = 0; #define DPRINTF(x) #define DPRINTFN(n, x) #endif +#define MAXQS 6 /* Tx (4 EDCAs + HCCA + Mgt) and Rx rings */ static void rt2860_attachhook(device_t); static int rt2860_alloc_tx_ring(struct rt2860_softc *, @@ -239,7 +240,7 @@ rt2860_attach(void *xsc, int id) /* * Allocate Tx (4 EDCAs + HCCA + Mgt) and Rx rings. */ - for (qid = 0; qid < 6; qid++) { + for (qid = 0; qid < MAXQS; qid++) { if ((error = rt2860_alloc_tx_ring(sc, >txq[qid])) != 0) { aprint_error_dev(sc->sc_dev, "could not allocate Tx ring %d\n", qid); @@ -418,7 +419,7 @@ rt2860_detach(void *xsc) ieee80211_ifdetach(>sc_ic); /* free all nodes */ if_detach(ifp); - for (qid = 0; qid < 6; qid++) + for (qid = 0; qid < MAXQS; qid++) rt2860_free_tx_ring(sc, >txq[qid]); rt2860_free_rx_ring(sc, >rxq); rt2860_free_tx_pool(sc); @@ -689,6 +690,7 @@ rt2860_alloc_rx_ring(struct rt2860_softc for (i = 0; i < RT2860_RX_RING_COUNT; i++) { struct rt2860_rx_data *data = >data[i]; struct rt2860_rxd *rxd = >rxd[i]; + const char *msg; error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, MCLBYTES, 0, BUS_DMA_NOWAIT, >map); @@ -700,17 +702,13 @@ rt2860_alloc_rx_ring(struct rt2860_softc MGET(data->m, M_DONTWAIT, MT_DATA); if (data->m == NULL) { - aprint_error_dev(sc->sc_dev, - "could not allocate Rx mbuf\n"); - error = ENOBUFS; - goto fail; + msg = "allocate Rx mbuf"; + goto fail1; } MCLGET(data->m, M_DONTWAIT); if ((data->m->m_flags & M_EXT) == 0) { - aprint_error_dev(sc->sc_dev, - "could not allocate Rx mbuf cluster\n"); -error = ENOBUFS; - goto fail; + msg = "allocate Rx mbuf cluster"; + goto fail1; } @@ -718,8 +716,12 @@ rt2860_alloc_rx_ring(struct rt2860_softc mtod(data->m, void *), MCLBYTES, NULL, BUS_DMA_READ | BUS_DMA_NOWAIT); if (error != 0) { - aprint_error_dev(sc->sc_dev, - "could not load DMA map\n"); + msg = "load DMA map"; + fail1: + aprint_error_dev(sc->sc_dev, "could not %s\n", msg); + m_freem(data->m); + data->m = NULL; + error = ENOBUFS; goto fail; } @@ -730,7 +732,6 @@ rt2860_alloc_rx_ring(struct rt2860_softc bus_dmamap_sync(sc->sc_dmat, ring->map, 0, size, BUS_DMASYNC_PREWRITE); return 0; - fail: rt2860_free_rx_ring(sc, ring); return error; } @@ -761,9 +762,12 @@ rt2860_free_rx_ring(struct rt2860_softc bus_dmamem_unmap(sc->sc_dmat, (void *)ring->rxd, RT2860_RX_RING_COUNT * sizeof (struct rt2860_rxd)); bus_dmamem_free(sc->sc_dmat, >seg, 1); + ring->rxd = NULL; } - if (ring->map != NULL) + if (ring->map != NULL) { bus_dmamap_destroy(sc->sc_dmat, ring->map); + ring->map = NULL; + } for (i = 0; i < RT2860_RX_RING_COUNT; i++) { struct rt2860_rx_data *data = >data[i]; @@ -773,9 +777,12 @@ rt2860_free_rx_ring(struct rt2860_softc data->map->dm_mapsize, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc->sc_dmat, data->map); m_freem(data->m); + data->m = NULL; } - if (data->map != NULL) + if (data->map != NULL) { bus_dmamap_destroy(sc->sc_dmat, data->map); + data->map = NULL; + } } } @@ -1533,6 +1540,7 @@ rt2860_tx(struct rt2860_softc *sc, struc qid = (type == IEEE80211_FC0_TYPE_MGT) ? sc->mgtqid : WME_AC_BE; } + KASSERT(qid < MAXQS); ring = >txq[qid]; /* pickup a rate index */ @@ -3436,7 +3444,7 @@ rt2860_init(struct ifnet *ifp) RAL_SET_REGION_4(sc, RT2860_SKEY_MODE_0_7, 0, 4); /* init Tx rings (4 EDCAs + HCCA + Mgt) */ - for (qid = 0; qid < 6; qid++) { + for (qid = 0; qid < MAXQS; qid++) { RAL_WRITE(sc, RT2860_TX_BASE_PTR(qid), sc->txq[qid].paddr); RAL_WRITE(sc, RT2860_TX_MAX_CNT(qid), RT2860_TX_RING_COUNT); RAL_WRITE(sc, RT2860_TX_CTX_IDX(qid), 0); @@ -3599,7 +3607,7 @@ rt2860_stop(struct ifnet *ifp, int disab /* reset Tx and Rx rings (and reclaim TXWIs) */ sc->qfullmsk = 0; - for (qid = 0; qid < 6; qid++) + for (qid
CVS commit: src/sys/dev/ic
Module Name:src Committed By: msaitoh Date: Fri May 6 04:46:17 UTC 2016 Modified Files: src/sys/dev/ic: wdc.c Log Message: KNF. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.280 -r1.281 src/sys/dev/ic/wdc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/wdc.c diff -u src/sys/dev/ic/wdc.c:1.280 src/sys/dev/ic/wdc.c:1.281 --- src/sys/dev/ic/wdc.c:1.280 Mon Jan 18 04:46:47 2016 +++ src/sys/dev/ic/wdc.c Fri May 6 04:46:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.280 2016/01/18 04:46:47 msaitoh Exp $ */ +/* $NetBSD: wdc.c,v 1.281 2016/05/06 04:46:17 msaitoh Exp $ */ /* * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.280 2016/01/18 04:46:47 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.281 2016/05/06 04:46:17 msaitoh Exp $"); #include "opt_ata.h" #include "opt_wdc.h" @@ -989,10 +989,8 @@ wdc_reset_channel(struct ata_channel *ch * DMA engine */ if (chp->ch_flags & ATACH_DMA_WAIT) { - (*wdc->dma_finish)( - wdc->dma_arg, - chp->ch_channel, - xfer->c_drive, + (*wdc->dma_finish)(wdc->dma_arg, + chp->ch_channel, xfer->c_drive, WDC_DMAEND_ABRT_QUIET); chp->ch_flags &= ~ATACH_DMA_WAIT; } @@ -1027,10 +1025,11 @@ wdcreset(struct ata_channel *chp, int po #endif wdc->reset(chp, poll); - drv_mask1 = (chp->ch_drive[0].drive_type != ATA_DRIVET_NONE) ? 0x01:0x00; + drv_mask1 = (chp->ch_drive[0].drive_type != ATA_DRIVET_NONE) + ? 0x01 : 0x00; if (chp->ch_ndrives > 1) - drv_mask1 |= - (chp->ch_drive[1].drive_type != ATA_DRIVET_NONE) ? 0x02:0x00; + drv_mask1 |= (chp->ch_drive[1].drive_type != ATA_DRIVET_NONE) + ? 0x02 : 0x00; drv_mask2 = __wdcwait_reset(chp, drv_mask1, (poll == RESET_SLEEP) ? 0 : 1); if (drv_mask2 != drv_mask1) { @@ -1336,15 +1335,13 @@ wdctimeout(void *arg) if ((chp->ch_flags & ATACH_IRQ_WAIT) != 0) { __wdcerror(chp, "lost interrupt"); printf("\ttype: %s tc_bcount: %d tc_skip: %d\n", - (xfer->c_flags & C_ATAPI) ? "atapi" : "ata", - xfer->c_bcount, - xfer->c_skip); + (xfer->c_flags & C_ATAPI) ? "atapi" : "ata", + xfer->c_bcount, xfer->c_skip); #if NATA_DMA || NATA_PIOBM if (chp->ch_flags & ATACH_DMA_WAIT) { wdc->dma_status = - (*wdc->dma_finish)(wdc->dma_arg, -chp->ch_channel, xfer->c_drive, -WDC_DMAEND_ABRT); + (*wdc->dma_finish)(wdc->dma_arg, chp->ch_channel, +xfer->c_drive, WDC_DMAEND_ABRT); chp->ch_flags &= ~ATACH_DMA_WAIT; } #endif @@ -1432,8 +1429,7 @@ __wdccommand_start(struct ata_channel *c ATADEBUG_PRINT(("__wdccommand_start %s:%d:%d\n", device_xname(chp->ch_atac->atac_dev), chp->ch_channel, - xfer->c_drive), - DEBUG_FUNCS); + xfer->c_drive), DEBUG_FUNCS); if (wdc->select) wdc->select(chp,drive);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Tue May 3 00:19:32 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: minor nits To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.6 src/sys/dev/ic/rt2860.c:1.7 --- src/sys/dev/ic/rt2860.c:1.6 Mon May 2 13:37:23 2016 +++ src/sys/dev/ic/rt2860.c Mon May 2 20:19:32 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.6 2016/05/02 17:37:23 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.7 2016/05/03 00:19:32 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.6 2016/05/02 17:37:23 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.7 2016/05/03 00:19:32 christos Exp $"); #include #include @@ -1207,8 +1207,9 @@ rt2860_tx_intr(struct rt2860_softc *sc, } sc->sc_tx_timer = 0; - if (ring->queued < RT2860_TX_RING_ONEMORE) + if (ring->queued <= RT2860_TX_RING_ONEMORE) sc->qfullmsk &= ~(1 << qid); + ifp->if_flags &= ~IFF_OACTIVE; rt2860_start(ifp); } @@ -1324,7 +1325,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) /* HW may insert 2 padding bytes after 802.11 header */ if (rxd->flags & htole32(RT2860_RX_L2PAD)) { u_int hdrlen = ieee80211_hdrspace(ic, wh); - memmove(wh + 2, wh, hdrlen); + memmove((char *)wh + 2, wh, hdrlen); m->m_data += 2; wh = mtod(m, struct ieee80211_frame *); } @@ -1489,8 +1490,9 @@ rt2860_intr(void *arg) if (r & RT2860_MAC_INT_0) /* TBTT */ rt2860_tbtt_intr(sc); - if (r & RT2860_MAC_INT_3) /* Auto wakeup */ - /* TBD wakeup */{}; + if (r & RT2860_MAC_INT_3) { /* Auto wakeup */ + /* TBD wakeup */ + } if (r & RT2860_MAC_INT_4) /* GP timer */ rt2860_gp_intr(sc);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Mon May 2 17:37:23 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: Make it look more like rt2560.c To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.5 src/sys/dev/ic/rt2860.c:1.6 --- src/sys/dev/ic/rt2860.c:1.5 Sun May 1 06:49:59 2016 +++ src/sys/dev/ic/rt2860.c Mon May 2 13:37:23 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.5 2016/05/01 10:49:59 nonaka Exp $ */ +/* $NetBSD: rt2860.c,v 1.6 2016/05/02 17:37:23 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.5 2016/05/01 10:49:59 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.6 2016/05/02 17:37:23 christos Exp $"); #include #include @@ -364,6 +364,7 @@ rt2860_attachhook(device_t self) ifp->if_ioctl = rt2860_ioctl; ifp->if_start = rt2860_start; ifp->if_watchdog = rt2860_watchdog; + IFQ_SET_READY(>if_snd); memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); if_attach(ifp); @@ -393,6 +394,14 @@ rt2860_attachhook(device_t self) sc->sc_txtap_len = sizeof sc->sc_txtapu; sc->sc_txtap.wt_ihdr.it_len = htole16(sc->sc_txtap_len); sc->sc_txtap.wt_ihdr.it_present = htole32(RT2860_TX_RADIOTAP_PRESENT); + + ieee80211_announce(ic); + + if (pmf_device_register(sc->sc_dev, NULL, NULL)) + pmf_class_network_register(sc->sc_dev, ifp); + else + aprint_error_dev(sc->sc_dev, + "couldn't establish power handler\n"); } int @@ -402,6 +411,10 @@ rt2860_detach(void *xsc) struct ifnet *ifp = >sc_if; int qid; + pmf_device_deregister(sc->sc_dev); + + rt2860_stop(ifp, 1); + ieee80211_ifdetach(>sc_ic); /* free all nodes */ if_detach(ifp);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: nonaka Date: Sun May 1 10:49:59 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: Remove RAL_DEBUG define. Fix amd64 ALL kernel build failure. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.4 src/sys/dev/ic/rt2860.c:1.5 --- src/sys/dev/ic/rt2860.c:1.4 Fri Apr 29 02:27:06 2016 +++ src/sys/dev/ic/rt2860.c Sun May 1 10:49:59 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.4 2016/04/29 02:27:06 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.5 2016/05/01 10:49:59 nonaka Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.4 2016/04/29 02:27:06 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.5 2016/05/01 10:49:59 nonaka Exp $"); #include #include @@ -61,7 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1 #include -#define RAL_DEBUG #ifdef RAL_DEBUG #define DPRINTF(x) do { if (rt2860_debug > 0) printf x; } while (0) #define DPRINTFN(n, x) do { if (rt2860_debug >= (n)) printf x; } while (0)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Fri Apr 29 02:27:06 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: remove in %s\n", __func__ debugging To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.3 src/sys/dev/ic/rt2860.c:1.4 --- src/sys/dev/ic/rt2860.c:1.3 Thu Apr 28 08:24:51 2016 +++ src/sys/dev/ic/rt2860.c Thu Apr 28 22:27:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.3 2016/04/28 12:24:51 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.4 2016/04/29 02:27:06 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.3 2016/04/28 12:24:51 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.4 2016/04/29 02:27:06 christos Exp $"); #include #include @@ -204,13 +204,11 @@ rt2860_attach(void *xsc, int id) int qid, ntries, error; uint32_t tmp; - aprint_normal_dev(sc->sc_dev, "in %s\n", __func__); sc->amrr.amrr_min_success_threshold = 1; sc->amrr.amrr_max_success_threshold = 15; /* wait for NIC to initialize */ for (ntries = 0; ntries < 100; ntries++) { - aprint_normal_dev(sc->sc_dev, "reading ASIC\n"); tmp = RAL_READ(sc, RT2860_ASIC_VER_ID); if (tmp != 0 && tmp != 0x) break; @@ -230,12 +228,12 @@ rt2860_attach(void *xsc, int id) id == PCI_PRODUCT_AWT_RT2890)) sc->sc_flags |= RT2860_ADVANCED_PS; - aprint_normal_dev(sc->sc_dev, "reading eeprom\n"); /* retrieve RF rev. no and various other things from EEPROM */ rt2860_read_eeprom(sc); aprint_normal_dev(sc->sc_dev, "802.11 address %s\n", ether_sprintf(ic->ic_myaddr)); - aprint_normal_dev(sc->sc_dev, "MAC/BBP RT%X (rev 0x%04X), RF %s (MIMO %dT%dR)\n", + aprint_normal_dev(sc->sc_dev, "MAC/BBP RT%X (rev 0x%04X), " + "RF %s (MIMO %dT%dR)\n", sc->mac_ver, sc->mac_rev, rt2860_get_rf(sc->rf_rev), sc->ntxchains, sc->nrxchains); @@ -281,7 +279,6 @@ firmware_load(const char *dname, const c firmware_handle_t fh; int error; - aprint_normal("in %s\n", __func__); if ((error = firmware_open(dname, iname, )) != 0) return (error); *sizep = firmware_get_size(fh); @@ -304,7 +301,6 @@ rt2860_attachhook(device_t self) struct ifnet *ifp = >sc_if; int i, error; - aprint_normal_dev(sc->sc_dev, "in %s\n", __func__); error = firmware_load("ral", "ral-rt2860", >ucode, >ucsize); if (error != 0) { aprint_error_dev(sc->sc_dev, @@ -407,7 +403,6 @@ rt2860_detach(void *xsc) struct ifnet *ifp = >sc_if; int qid; - aprint_normal_dev(sc->sc_dev, "in %s\n", __func__); ieee80211_ifdetach(>sc_ic); /* free all nodes */ if_detach(ifp); @@ -428,7 +423,6 @@ rt2860_suspend(void *xsc) struct rt2860_softc *sc = xsc; struct ifnet *ifp = >sc_if; - aprint_normal_dev(sc->sc_dev, "in %s\n", __func__); if (ifp->if_flags & IFF_RUNNING) rt2860_stop(ifp, 1); } @@ -439,7 +433,6 @@ rt2860_wakeup(void *xsc) struct rt2860_softc *sc = xsc; struct ifnet *ifp = >sc_if; - aprint_normal_dev(sc->sc_dev, "in %s\n", __func__); if (ifp->if_flags & IFF_UP) rt2860_init(ifp); } @@ -449,7 +442,6 @@ rt2860_alloc_tx_ring(struct rt2860_softc { int nsegs, size, error; - aprint_normal_dev(sc->sc_dev, "in %s\n", __func__); size = RT2860_TX_RING_COUNT * sizeof (struct rt2860_txd); error = bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, @@ -498,7 +490,6 @@ rt2860_reset_tx_ring(struct rt2860_softc struct rt2860_tx_data *data; int i; - aprint_normal_dev(sc->sc_dev, "in %s\n", __func__); for (i = 0; i < RT2860_TX_RING_COUNT; i++) { if ((data = ring->data[i]) == NULL) continue; /* nothing mapped in this slot */ @@ -524,7 +515,6 @@ rt2860_free_tx_ring(struct rt2860_softc struct rt2860_tx_data *data; int i; - aprint_normal_dev(sc->sc_dev, "in %s\n", __func__); if (ring->txd != NULL) { bus_dmamap_sync(sc->sc_dmat, ring->map, 0, ring->map->dm_mapsize, BUS_DMASYNC_POSTWRITE); @@ -559,7 +549,6 @@ rt2860_alloc_tx_pool(struct rt2860_softc bus_addr_t paddr; int i, nsegs, size, error; - aprint_normal_dev(sc->sc_dev, "in %s\n", __func__); size = RT2860_TX_POOL_COUNT * RT2860_TXWI_DMASZ; /* init data_pool early in case of failure.. */ @@ -627,7 +616,6 @@ fail: rt2860_free_tx_pool(sc); static void rt2860_free_tx_pool(struct rt2860_softc *sc) { - aprint_normal_dev(sc->sc_dev, "in %s\n", __func__); if (sc->txwi_vaddr != NULL) { bus_dmamap_sync(sc->sc_dmat, sc->txwi_map, 0, sc->txwi_map->dm_mapsize, BUS_DMASYNC_POSTWRITE); @@ -652,7 +640,6 @@ rt2860_alloc_rx_ring(struct rt2860_softc { int i, nsegs, size, error; - aprint_normal_dev(sc->sc_dev, "in %s\n", __func__); size = RT2860_RX_RING_COUNT * sizeof (struct rt2860_rxd); error =
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Thu Apr 28 12:24:51 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c Log Message: Pass the proper device_t to the attach hook. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/rt2860.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.2 src/sys/dev/ic/rt2860.c:1.3 --- src/sys/dev/ic/rt2860.c:1.2 Wed Apr 27 15:49:26 2016 +++ src/sys/dev/ic/rt2860.c Thu Apr 28 08:24:51 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rt2860.c,v 1.2 2016/04/27 19:49:26 christos Exp $ */ +/* $NetBSD: rt2860.c,v 1.3 2016/04/28 12:24:51 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.2 2016/04/27 19:49:26 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.3 2016/04/28 12:24:51 christos Exp $"); #include #include @@ -71,7 +71,7 @@ int rt2860_debug = 0; #define DPRINTFN(n, x) #endif -static void rt2860_attachhook(struct device *); +static void rt2860_attachhook(device_t); static int rt2860_alloc_tx_ring(struct rt2860_softc *, struct rt2860_tx_ring *); static void rt2860_reset_tx_ring(struct rt2860_softc *, @@ -264,7 +264,7 @@ rt2860_attach(void *xsc, int id) sc->mgtqid = (sc->mac_ver == 0x2860 && sc->mac_rev == 0x0100) ? WME_AC_VO : 5; - config_mountroot(xsc, rt2860_attachhook); + config_mountroot(sc->sc_dev, rt2860_attachhook); return 0; @@ -297,9 +297,9 @@ firmware_load(const char *dname, const c } static void -rt2860_attachhook(struct device *self) +rt2860_attachhook(device_t self) { - struct rt2860_softc *sc = (struct rt2860_softc *)self; + struct rt2860_softc *sc = device_private(self); struct ieee80211com *ic = >sc_ic; struct ifnet *ifp = >sc_if; int i, error;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Wed Apr 27 19:49:26 UTC 2016 Modified Files: src/sys/dev/ic: rt2860.c rt2860reg.h rt2860var.h Log Message: Make RT 2860 for the if_ral_pci.c driver compile. This work was done by Jeff Rizzo To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/rt2860.c src/sys/dev/ic/rt2860var.h cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/rt2860reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860.c diff -u src/sys/dev/ic/rt2860.c:1.1 src/sys/dev/ic/rt2860.c:1.2 --- src/sys/dev/ic/rt2860.c:1.1 Tue Apr 26 17:17:20 2016 +++ src/sys/dev/ic/rt2860.c Wed Apr 27 15:49:26 2016 @@ -1,3 +1,4 @@ +/* $NetBSD: rt2860.c,v 1.2 2016/04/27 19:49:26 christos Exp $ */ /* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */ /*- @@ -21,43 +22,46 @@ * http://www.ralinktech.com/ */ -#include "bpfilter.h" +#include +__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.2 2016/04/27 19:49:26 christos Exp $"); #include #include +#include #include #include #include #include #include #include -#include +#include +#include #include #include #include +#include -#include -#include +#include +#include -#if NBPFILTER > 0 #include -#endif #include #include +#include #include -#include -#include - #include #include #include +#include + #include #include #include +#define RAL_DEBUG #ifdef RAL_DEBUG #define DPRINTF(x) do { if (rt2860_debug > 0) printf x; } while (0) #define DPRINTFN(n, x) do { if (rt2860_debug >= (n)) printf x; } while (0) @@ -67,94 +71,94 @@ int rt2860_debug = 0; #define DPRINTFN(n, x) #endif -void rt2860_attachhook(struct device *); -int rt2860_alloc_tx_ring(struct rt2860_softc *, +static void rt2860_attachhook(struct device *); +static int rt2860_alloc_tx_ring(struct rt2860_softc *, struct rt2860_tx_ring *); -void rt2860_reset_tx_ring(struct rt2860_softc *, +static void rt2860_reset_tx_ring(struct rt2860_softc *, struct rt2860_tx_ring *); -void rt2860_free_tx_ring(struct rt2860_softc *, +static void rt2860_free_tx_ring(struct rt2860_softc *, struct rt2860_tx_ring *); -int rt2860_alloc_tx_pool(struct rt2860_softc *); -void rt2860_free_tx_pool(struct rt2860_softc *); -int rt2860_alloc_rx_ring(struct rt2860_softc *, +static int rt2860_alloc_tx_pool(struct rt2860_softc *); +static void rt2860_free_tx_pool(struct rt2860_softc *); +static int rt2860_alloc_rx_ring(struct rt2860_softc *, struct rt2860_rx_ring *); -void rt2860_reset_rx_ring(struct rt2860_softc *, +static void rt2860_reset_rx_ring(struct rt2860_softc *, struct rt2860_rx_ring *); -void rt2860_free_rx_ring(struct rt2860_softc *, +static void rt2860_free_rx_ring(struct rt2860_softc *, struct rt2860_rx_ring *); -struct ieee80211_node *rt2860_node_alloc(struct ieee80211com *); -int rt2860_media_change(struct ifnet *); -void rt2860_iter_func(void *, struct ieee80211_node *); -void rt2860_updatestats(struct rt2860_softc *); -void rt2860_newassoc(struct ieee80211com *, struct ieee80211_node *, +static struct ieee80211_node *rt2860_node_alloc(struct ieee80211_node_table *); +static int rt2860_media_change(struct ifnet *); +static void rt2860_iter_func(void *, struct ieee80211_node *); +static void rt2860_updatestats(struct rt2860_softc *); +static void rt2860_newassoc(struct ieee80211_node *, int); -void rt2860_node_leave(struct ieee80211com *, - struct ieee80211_node *); -int rt2860_ampdu_rx_start(struct ieee80211com *, +#ifdef notyet +static int rt2860_ampdu_rx_start(struct ieee80211com *, struct ieee80211_node *, uint8_t); -void rt2860_ampdu_rx_stop(struct ieee80211com *, +static void rt2860_ampdu_rx_stop(struct ieee80211com *, struct ieee80211_node *, uint8_t); -int rt2860_newstate(struct ieee80211com *, enum ieee80211_state, +#endif +static int rt2860_newstate(struct ieee80211com *, enum ieee80211_state, int); -uint16_t rt3090_efuse_read_2(struct rt2860_softc *, uint16_t); -uint16_t rt2860_eeprom_read_2(struct rt2860_softc *, uint16_t); -void rt2860_intr_coherent(struct rt2860_softc *); -void rt2860_drain_stats_fifo(struct rt2860_softc *); -void rt2860_tx_intr(struct rt2860_softc *, int); -void rt2860_rx_intr(struct rt2860_softc *); -void rt2860_tbtt_intr(struct rt2860_softc *); -void rt2860_gp_intr(struct rt2860_softc *); -int rt2860_tx(struct rt2860_softc *, struct mbuf *, +static uint16_t rt3090_efuse_read_2(struct rt2860_softc *, uint16_t); +static uint16_t rt2860_eeprom_read_2(struct rt2860_softc *, uint16_t); +static void rt2860_intr_coherent(struct rt2860_softc *); +static void rt2860_drain_stats_fifo(struct rt2860_softc *); +static void rt2860_tx_intr(struct rt2860_softc *, int); +static void rt2860_rx_intr(struct rt2860_softc *); +static void rt2860_tbtt_intr(struct rt2860_softc *); +static void
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Tue Apr 26 21:17:20 UTC 2016 Modified Files: src/sys/dev/ic: rt2860reg.h Added Files: src/sys/dev/ic: rt2860.c rt2860var.h Log Message: Unmodified OpenBSD sources (except Ids) To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/ic/rt2860.c src/sys/dev/ic/rt2860var.h cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/rt2860reg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/rt2860reg.h diff -u src/sys/dev/ic/rt2860reg.h:1.1 src/sys/dev/ic/rt2860reg.h:1.2 --- src/sys/dev/ic/rt2860reg.h:1.1 Wed May 30 10:30:35 2012 +++ src/sys/dev/ic/rt2860reg.h Tue Apr 26 17:17:20 2016 @@ -1,5 +1,4 @@ -/* $NetBSD: rt2860reg.h,v 1.1 2012/05/30 14:30:35 nonaka Exp $ */ -/* $OpenBSD: rt2860reg.h,v 1.30 2010/05/10 18:17:10 damien Exp $ */ +/* $OpenBSD: rt2860reg.h,v 1.32 2014/05/24 10:10:17 stsp Exp $ */ /*- * Copyright (c) 2007 @@ -81,6 +80,9 @@ #define RT3070_LDO_CFG0 0x05d4 #define RT3070_GPIO_SWITCH 0x05dc +/* RT5592 registers */ +#define RT5592_DEBUG_INDEX 0x05e8 + /* MAC registers */ #define RT2860_ASIC_VER_ID 0x1000 #define RT2860_MAC_SYS_CTRL 0x1004 @@ -205,6 +207,7 @@ #define RT2860_H2M_MAILBOX 0x7010 #define RT2860_H2M_MAILBOX_CID 0x7014 #define RT2860_H2M_MAILBOX_STATUS 0x701c +#define RT2860_H2M_INTSRC 0x7024 #define RT2860_H2M_BBPAGENT 0x7028 #define RT2860_BCN_BASE(vap) (0x7800 + (vap) * 512) @@ -256,10 +259,10 @@ #define RT2860_TX_DMA_EN (1 << 0) /* possible flags for register DELAY_INT_CFG */ -#define RT2860_TXDLY_INT_EN (1 << 31) +#define RT2860_TXDLY_INT_EN (1U << 31) #define RT2860_TXMAX_PINT_SHIFT 24 #define RT2860_TXMAX_PTIME_SHIFT 16 -#define RT2860_RXDLY_INT_EN (1 << 15) +#define RT2860_RXDLY_INT_EN (1U << 15) #define RT2860_RXMAX_PINT_SHIFT 8 #define RT2860_RXMAX_PTIME_SHIFT 0 @@ -268,16 +271,16 @@ #define RT2860_GPIO_O_SHIFT 0 /* possible flags for register USB_DMA_CFG */ -#define RT2860_USB_TX_BUSY (1 << 31) -#define RT2860_USB_RX_BUSY (1 << 30) +#define RT2860_USB_TX_BUSY (1U << 31) +#define RT2860_USB_RX_BUSY (1U << 30) #define RT2860_USB_EPOUT_VLD_SHIFT 24 -#define RT2860_USB_TX_EN (1 << 23) -#define RT2860_USB_RX_EN (1 << 22) -#define RT2860_USB_RX_AGG_EN (1 << 21) -#define RT2860_USB_TXOP_HALT (1 << 20) -#define RT2860_USB_TX_CLEAR (1 << 19) -#define RT2860_USB_PHY_WD_EN (1 << 16) -#define RT2860_USB_PHY_MAN_RST (1 << 15) +#define RT2860_USB_TX_EN (1U << 23) +#define RT2860_USB_RX_EN (1U << 22) +#define RT2860_USB_RX_AGG_EN (1U << 21) +#define RT2860_USB_TXOP_HALT (1U << 20) +#define RT2860_USB_TX_CLEAR (1U << 19) +#define RT2860_USB_PHY_WD_EN (1U << 16) +#define RT2860_USB_PHY_MAN_RST (1U << 15) #define RT2860_USB_RX_AGG_LMT(x) ((x) << 8) /* in unit of 1KB */ #define RT2860_USB_RX_AGG_TO(x) ((x) & 0xff) /* in unit of 33ns */ @@ -368,9 +371,9 @@ #define RT2860_TX0Q_PCNT_MASK 0x00ff /* possible flags for register CAP_CTRL */ -#define RT2860_CAP_ADC_FEQ (1 << 31) -#define RT2860_CAP_START (1 << 30) -#define RT2860_MAN_TRIG (1 << 29) +#define RT2860_CAP_ADC_FEQ (1U << 31) +#define RT2860_CAP_START (1U << 30) +#define RT2860_MAN_TRIG (1U << 29) #define RT2860_TRIG_OFFSET_SHIFT 16 #define RT2860_START_ADDR_SHIFT 0 @@ -379,13 +382,16 @@ #define RT3070_RF_WRITE (1 << 16) /* possible flags for register EFUSE_CTRL */ -#define RT3070_SEL_EFUSE (1 << 31) -#define RT3070_EFSROM_KICK (1 << 30) +#define RT3070_SEL_EFUSE (1U << 31) +#define RT3070_EFSROM_KICK (1U << 30) #define RT3070_EFSROM_AIN_MASK 0x03ff #define RT3070_EFSROM_AIN_SHIFT 16 #define RT3070_EFSROM_MODE_MASK 0x00c0 #define RT3070_EFUSE_AOUT_MASK 0x003f +/* possible flag for register DEBUG_INDEX */ +#define RT5592_SEL_XTAL (1U << 31) + /* possible flags for register MAC_SYS_CTRL */ #define RT2860_RX_TS_EN (1 << 7) #define RT2860_WLAN_HALT_EN (1 << 6) @@ -418,9 +424,9 @@ #define RT2860_BBP_DATA_SHIFT 0 /* possible flags for register RF_CSR_CFG0 */ -#define RT2860_RF_REG_CTRL (1 << 31) -#define RT2860_RF_LE_SEL1 (1 << 30) -#define RT2860_RF_LE_STBY (1 << 29) +#define RT2860_RF_REG_CTRL (1U << 31) +#define RT2860_RF_LE_SEL1 (1U << 30) +#define RT2860_RF_LE_STBY (1U << 29) #define RT2860_RF_REG_WIDTH_SHIFT 24 #define RT2860_RF_REG_0_SHIFT 0 @@ -453,9 +459,9 @@ #define RT2860_SLOT_TIME 0 /* possible flags for register NAV_TIME_CFG */ -#define RT2860_NAV_UPD (1 << 31) +#define RT2860_NAV_UPD (1U << 31) #define RT2860_NAV_UPD_VAL_SHIFT 16 -#define RT2860_NAV_CLR_EN (1 << 15) +#define RT2860_NAV_CLR_EN (1U << 15) #define RT2860_NAV_TIMER_SHIFT 0 /* possible flags for register CH_TIME_CFG */ @@ -507,37 +513,37 @@ #define RT2860_WAKEUP_LEAD_TIME_SHIFT 0 /* possible flags for register TX_PIN_CFG */ -#define RT3593_LNA_PE_G2_POL (1 << 31) -#define RT3593_LNA_PE_A2_POL (1 << 30) -#define RT3593_LNA_PE_G2_EN (1 <<
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Apr 26 10:28:28 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Fix SLHCI_XFER_TYPE To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.54 src/sys/dev/ic/sl811hs.c:1.55 --- src/sys/dev/ic/sl811hs.c:1.54 Tue Apr 26 10:10:27 2016 +++ src/sys/dev/ic/sl811hs.c Tue Apr 26 10:28:28 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.54 2016/04/26 10:10:27 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.55 2016/04/26 10:28:28 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.54 2016/04/26 10:10:27 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.55 2016/04/26 10:28:28 skrll Exp $"); #include "opt_slhci.h" @@ -168,8 +168,6 @@ pnames(int ptype) } #endif -#define SLHCI_XFER_TYPE(x) (((struct slhci_pipe *)((x)->pipe))->ptype) - /* * Maximum allowable reserved bus time. Since intr/isoc transfers have * unconditional priority, this is all that ensures control and bulk transfers @@ -296,6 +294,9 @@ struct slhci_pipe { #define SLHCI_XFER2SC(xfer) SLHCI_BUS2SC((xfer)->ux_bus) #define SLHCI_PIPE2SPIPE(pipe) ((struct slhci_pipe *)(pipe)) +#define SLHCI_XFER2SPIPE(xfer) SLHCI_PIPE2SPIPE((xfer)->ux_pipe) + +#define SLHCI_XFER_TYPE(x) (SLHCI_XFER2SPIPE(xfer)->ptype) #ifdef SLHCI_PROFILE_TRANSFER #if defined(__mips__)
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Apr 26 10:10:27 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Remove unnecessary whitespace from attach message. >From Felix Deichmann To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.53 src/sys/dev/ic/sl811hs.c:1.54 --- src/sys/dev/ic/sl811hs.c:1.53 Tue Apr 26 09:08:55 2016 +++ src/sys/dev/ic/sl811hs.c Tue Apr 26 10:10:27 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.53 2016/04/26 09:08:55 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.54 2016/04/26 10:10:27 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.53 2016/04/26 09:08:55 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.54 2016/04/26 10:10:27 skrll Exp $"); #include "opt_slhci.h" @@ -1184,11 +1184,11 @@ slhci_attach(struct slhci_softc *sc) #endif if (t->sltype == SLTYPE_SL811HS_R12) - rev = " (rev 1.2)"; + rev = "(rev 1.2)"; else if (t->sltype == SLTYPE_SL811HS_R14) - rev = " (rev 1.4 or 1.5)"; + rev = "(rev 1.4 or 1.5)"; else - rev = " (unknown revision)"; + rev = "(unknown revision)"; aprint_normal("%s: ScanLogic SL811HS/T USB Host Controller %s\n", SC_NAME(sc), rev);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Apr 26 09:08:55 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: KNF the #includes To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.52 src/sys/dev/ic/sl811hs.c:1.53 --- src/sys/dev/ic/sl811hs.c:1.52 Tue Apr 26 09:07:10 2016 +++ src/sys/dev/ic/sl811hs.c Tue Apr 26 09:08:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.52 2016/04/26 09:07:10 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.53 2016/04/26 09:08:55 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,21 +68,21 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.52 2016/04/26 09:07:10 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.53 2016/04/26 09:08:55 skrll Exp $"); #include "opt_slhci.h" #include -#include -#include -#include +#include +#include #include -#include -#include #include #include -#include -#include +#include +#include +#include +#include +#include #include #include
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Apr 26 09:07:10 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: One sys/cdefs.h is enough To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.51 src/sys/dev/ic/sl811hs.c:1.52 --- src/sys/dev/ic/sl811hs.c:1.51 Tue Apr 26 09:04:01 2016 +++ src/sys/dev/ic/sl811hs.c Tue Apr 26 09:07:10 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.51 2016/04/26 09:04:01 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.52 2016/04/26 09:07:10 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,11 +68,10 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.51 2016/04/26 09:04:01 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.52 2016/04/26 09:07:10 skrll Exp $"); #include "opt_slhci.h" -#include #include #include #include
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Apr 26 09:04:01 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: s/slhci_debug/slhcidebug/ for consistency with other HCD debug variables To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.50 src/sys/dev/ic/sl811hs.c:1.51 --- src/sys/dev/ic/sl811hs.c:1.50 Tue Apr 26 09:00:22 2016 +++ src/sys/dev/ic/sl811hs.c Tue Apr 26 09:04:01 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.50 2016/04/26 09:00:22 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.51 2016/04/26 09:04:01 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.50 2016/04/26 09:00:22 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.51 2016/04/26 09:04:01 skrll Exp $"); #include "opt_slhci.h" @@ -550,7 +550,7 @@ const int SLHCI_D_ROOT = 0x0800; const int SLHCI_D_SOF = 0x1000; const int SLHCI_D_NAK = 0x2000; -int slhci_debug = 0x1cbc; /* 0xc8c; */ /* 0x; */ /* 0xd8c; */ +int slhcidebug = 0x1cbc; /* 0xc8c; */ /* 0x; */ /* 0xd8c; */ struct slhci_softc *ssc; #ifdef USB_DEBUG int slhci_usbdebug = -1; /* value to set usbdebug on attach, -1 = leave alone */ @@ -589,7 +589,7 @@ KERNHIST_DECL(slhcihist); const unsigned int SLHCI_HISTMASK = KERNHIST_SLHCI; struct kern_history_ent slhci_he[SLHCI_NHIST]; -#define SLHCI_DEXEC(x, y) do { if ((slhci_debug & SLHCI_ ## x)) { y; } \ +#define SLHCI_DEXEC(x, y) do { if ((slhcidebug & SLHCI_ ## x)) { y; } \ } while (/*CONSTCOND*/ 0) #define DDOLOG(f, a, b, c, d) do { const char *_kernhist_name = __func__; \ u_long _kernhist_call = 0; KERNHIST_LOG(slhcihist, f, a, b, c, d); \ @@ -1730,8 +1730,8 @@ slhci_dointr(struct slhci_softc *sc) r = slhci_read(sc, SL11_ISR); #ifdef SLHCI_DEBUG - if (slhci_debug & SLHCI_D_INTR && r & sc->sc_ier && - ((r & ~(SL11_ISR_SOF|SL11_ISR_DATA)) || slhci_debug & + if (slhcidebug & SLHCI_D_INTR && r & sc->sc_ier && + ((r & ~(SL11_ISR_SOF|SL11_ISR_DATA)) || slhcidebug & SLHCI_D_SOF)) { uint8_t e, f; @@ -1980,7 +1980,7 @@ slhci_abdone(struct slhci_softc *sc, int } #ifdef SLHCI_DEBUG - if (slhci_debug & SLHCI_D_NAK || (status & SL11_EPSTAT_ERRBITS) != + if (slhcidebug & SLHCI_D_NAK || (status & SL11_EPSTAT_ERRBITS) != SL11_EPSTAT_NAK) DLOGFLAG8(D_XFER, "STATUS=", status, "STALL", "NAK", "Overflow", "Setup", "Data Toggle", "Timeout", "Error",
CVS commit: src/sys/dev/ic
Module Name:src Committed By: skrll Date: Tue Apr 26 09:00:22 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: Remove unused variable To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.49 src/sys/dev/ic/sl811hs.c:1.50 --- src/sys/dev/ic/sl811hs.c:1.49 Mon Apr 25 20:15:41 2016 +++ src/sys/dev/ic/sl811hs.c Tue Apr 26 09:00:22 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.49 2016/04/25 20:15:41 joerg Exp $ */ +/* $NetBSD: sl811hs.c,v 1.50 2016/04/26 09:00:22 skrll Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.49 2016/04/25 20:15:41 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.50 2016/04/26 09:00:22 skrll Exp $"); #include "opt_slhci.h" @@ -1384,7 +1384,6 @@ void slhci_mem_use(struct usbd_bus *bus, int val) { struct slhci_softc *sc = SLHCI_BUS2SC(bus); - int s; mutex_enter(>sc_intr_lock); sc->sc_mem_use += val;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: joerg Date: Mon Apr 25 20:15:41 UTC 2016 Modified Files: src/sys/dev/ic: sl811hs.c Log Message: GC slhci_hubd To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ic/sl811hs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.48 src/sys/dev/ic/sl811hs.c:1.49 --- src/sys/dev/ic/sl811hs.c:1.48 Sat Apr 23 10:15:31 2016 +++ src/sys/dev/ic/sl811hs.c Mon Apr 25 20:15:41 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.48 2016/04/23 10:15:31 skrll Exp $ */ +/* $NetBSD: sl811hs.c,v 1.49 2016/04/25 20:15:41 joerg Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.48 2016/04/23 10:15:31 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.49 2016/04/25 20:15:41 joerg Exp $"); #include "opt_slhci.h" @@ -2938,17 +2938,6 @@ slhci_insert(struct slhci_softc *sc) * Data structures and routines to emulate the root hub. */ -static const usb_hub_descriptor_t slhci_hubd = { - .bDescLength = USB_HUB_DESCRIPTOR_SIZE, - .bDescriptorType = UDESC_HUB, - .bNbrPorts = 1, - .wHubCharacteristics = USETWD(UHD_PWR_INDIVIDUAL | UHD_OC_NONE), - .bPwrOn2PwrGood = 50, - .bHubContrCurrent = 0, - .DeviceRemovable = { 0x00 }, - .PortPowerCtrlMask = { 0x00 } -}; - static usbd_status slhci_clear_feature(struct slhci_softc *sc, unsigned int what) {
CVS commit: src/sys/dev/ic
Module Name:src Committed By: knakahara Date: Wed Apr 20 08:53:11 UTC 2016 Modified Files: src/sys/dev/ic: dp8390.c Log Message: Apply mbuf initialize function to stack mbuf used as M_PKTHDR. It is required to prevent unexpected behavior in future works abount m_pkthdr. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/dev/ic/dp8390.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/dp8390.c diff -u src/sys/dev/ic/dp8390.c:1.83 src/sys/dev/ic/dp8390.c:1.84 --- src/sys/dev/ic/dp8390.c:1.83 Tue Feb 9 08:32:10 2016 +++ src/sys/dev/ic/dp8390.c Wed Apr 20 08:53:11 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: dp8390.c,v 1.83 2016/02/09 08:32:10 ozaki-r Exp $ */ +/* $NetBSD: dp8390.c,v 1.84 2016/04/20 08:53:11 knakahara Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -14,7 +14,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.83 2016/02/09 08:32:10 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.84 2016/04/20 08:53:11 knakahara Exp $"); #include "opt_ipkdb.h" #include "opt_inet.h" @@ -1492,11 +1492,10 @@ dp8390_ipkdb_send(struct ipkdb_if *kip, bus_space_handle_t regh = sc->sc_regh; struct mbuf mb; - mb.m_next = NULL; - mb.m_pkthdr.len = mb.m_len = l; - mb.m_data = buf; - mb.m_flags = M_EXT | M_PKTHDR; - mb.m_type = MT_DATA; + mbuf_hdr_init(, MT_DATA, NULL, buf, l); + mbuf_pkthdr_init(); + mb.m_pkthdr.len = l; + mb.m_flags |= M_EXT; l = sc->write_mbuf(sc, , sc->mem_start + ((sc->txb_new * ED_TXBUF_SIZE) << ED_PAGE_SHIFT));
CVS commit: src/sys/dev/ic
Module Name:src Committed By: roy Date: Fri Apr 8 14:52:56 UTC 2016 Modified Files: src/sys/dev/ic: ath.c Log Message: Revert prior. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/dev/ic/ath.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ath.c diff -u src/sys/dev/ic/ath.c:1.118 src/sys/dev/ic/ath.c:1.119 --- src/sys/dev/ic/ath.c:1.118 Wed Apr 6 15:10:35 2016 +++ src/sys/dev/ic/ath.c Fri Apr 8 14:52:56 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ath.c,v 1.118 2016/04/06 15:10:35 roy Exp $ */ +/* $NetBSD: ath.c,v 1.119 2016/04/08 14:52:56 roy Exp $ */ /*- * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.104 2005/09/16 10:09:23 ru Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.118 2016/04/06 15:10:35 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.119 2016/04/08 14:52:56 roy Exp $"); #endif /* @@ -158,7 +158,7 @@ static int ath_desc_alloc(struct ath_sof static void ath_desc_free(struct ath_softc *); static struct ieee80211_node *ath_node_alloc(struct ieee80211_node_table *); static void ath_node_free(struct ieee80211_node *); -static int8_t ath_node_getrssi(const struct ieee80211_node *); +static u_int8_t ath_node_getrssi(const struct ieee80211_node *); static int ath_rxbuf_init(struct ath_softc *, struct ath_buf *); static void ath_recv_mgmt(struct ieee80211com *ic, struct mbuf *m, struct ieee80211_node *ni, @@ -2797,7 +2797,7 @@ ath_node_free(struct ieee80211_node *ni) sc->sc_node_free(ni); } -static int8_t +static u_int8_t ath_node_getrssi(const struct ieee80211_node *ni) { #define HAL_EP_RND(x, mul) \
CVS commit: src/sys/dev/ic
Module Name:src Committed By: roy Date: Wed Apr 6 15:10:35 UTC 2016 Modified Files: src/sys/dev/ic: ath.c Log Message: Fix rssi To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/dev/ic/ath.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ath.c diff -u src/sys/dev/ic/ath.c:1.117 src/sys/dev/ic/ath.c:1.118 --- src/sys/dev/ic/ath.c:1.117 Sat Oct 18 08:33:27 2014 +++ src/sys/dev/ic/ath.c Wed Apr 6 15:10:35 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ath.c,v 1.117 2014/10/18 08:33:27 snj Exp $ */ +/* $NetBSD: ath.c,v 1.118 2016/04/06 15:10:35 roy Exp $ */ /*- * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.104 2005/09/16 10:09:23 ru Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.117 2014/10/18 08:33:27 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.118 2016/04/06 15:10:35 roy Exp $"); #endif /* @@ -158,7 +158,7 @@ static int ath_desc_alloc(struct ath_sof static void ath_desc_free(struct ath_softc *); static struct ieee80211_node *ath_node_alloc(struct ieee80211_node_table *); static void ath_node_free(struct ieee80211_node *); -static u_int8_t ath_node_getrssi(const struct ieee80211_node *); +static int8_t ath_node_getrssi(const struct ieee80211_node *); static int ath_rxbuf_init(struct ath_softc *, struct ath_buf *); static void ath_recv_mgmt(struct ieee80211com *ic, struct mbuf *m, struct ieee80211_node *ni, @@ -2797,7 +2797,7 @@ ath_node_free(struct ieee80211_node *ni) sc->sc_node_free(ni); } -static u_int8_t +static int8_t ath_node_getrssi(const struct ieee80211_node *ni) { #define HAL_EP_RND(x, mul) \
CVS commit: src/sys/dev/ic
Module Name:src Committed By: macallan Date: Fri Mar 11 22:39:01 UTC 2016 Modified Files: src/sys/dev/ic: malo.c Log Message: malo_rx_desc::status is uint8_t, so don't try to endian-twiddle it To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/malo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/malo.c diff -u src/sys/dev/ic/malo.c:1.4 src/sys/dev/ic/malo.c:1.5 --- src/sys/dev/ic/malo.c:1.4 Fri Mar 11 18:33:18 2016 +++ src/sys/dev/ic/malo.c Fri Mar 11 22:39:01 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: malo.c,v 1.4 2016/03/11 18:33:18 christos Exp $ */ +/* $NetBSD: malo.c,v 1.5 2016/03/11 22:39:01 macallan Exp $ */ /* $OpenBSD: malo.c,v 1.92 2010/08/27 17:08:00 jsg Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.4 2016/03/11 18:33:18 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.5 2016/03/11 22:39:01 macallan Exp $"); #include #include @@ -622,7 +622,7 @@ malo_alloc_rx_ring(struct malo_softc *sc goto fail; } - desc->status = htole16(1); + desc->status = 1; desc->physdata = htole32(data->map->dm_segs->ds_addr); desc->physnext = htole32(ring->physaddr + (i + 1) % count * sizeof(struct malo_rx_desc));
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Fri Mar 11 18:33:18 UTC 2016 Modified Files: src/sys/dev/ic: malo.c Log Message: PR/50948: David Binderman: Fix misplaced parens To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/malo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/malo.c diff -u src/sys/dev/ic/malo.c:1.3 src/sys/dev/ic/malo.c:1.4 --- src/sys/dev/ic/malo.c:1.3 Sun Aug 5 05:16:54 2012 +++ src/sys/dev/ic/malo.c Fri Mar 11 13:33:18 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: malo.c,v 1.3 2012/08/05 09:16:54 degroote Exp $ */ +/* $NetBSD: malo.c,v 1.4 2016/03/11 18:33:18 christos Exp $ */ /* $OpenBSD: malo.c,v 1.92 2010/08/27 17:08:00 jsg Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.3 2012/08/05 09:16:54 degroote Exp $"); +__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.4 2016/03/11 18:33:18 christos Exp $"); #include #include @@ -1623,7 +1623,7 @@ malo_get_firmware(struct malo_softc *sc, /* load firmware image from disk */ - if ((error = firmware_open("malo", name, ) != 0)) { + if ((error = firmware_open("malo", name, )) != 0) { aprint_error_dev(sc->sc_dev, "could not read firmware file\n"); return error; }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Wed Mar 9 20:07:04 UTC 2016 Modified Files: src/sys/dev/ic: arn9003.c Log Message: PR/50927: David Binderman: Fix wrong paren To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/arn9003.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/arn9003.c diff -u src/sys/dev/ic/arn9003.c:1.7 src/sys/dev/ic/arn9003.c:1.8 --- src/sys/dev/ic/arn9003.c:1.7 Sun May 24 13:08:50 2015 +++ src/sys/dev/ic/arn9003.c Wed Mar 9 15:07:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: arn9003.c,v 1.7 2015/05/24 17:08:50 matt Exp $ */ +/* $NetBSD: arn9003.c,v 1.8 2016/03/09 20:07:04 christos Exp $ */ /* $OpenBSD: ar9003.c,v 1.25 2012/10/20 09:53:32 stsp Exp $ */ /*- @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arn9003.c,v 1.7 2015/05/24 17:08:50 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arn9003.c,v 1.8 2016/03/09 20:07:04 christos Exp $"); #include #include @@ -2235,7 +2235,7 @@ ar9003_calib_iq(struct athn_softc *sc) if (cal->pwr_meas_q == 0) continue; - if ((iq_corr_neg = cal->iq_corr_meas < 0)) + if ((iq_corr_neg = cal->iq_corr_meas) < 0) cal->iq_corr_meas = -cal->iq_corr_meas; i_coff_denom =
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Wed Mar 9 20:06:31 UTC 2016 Modified Files: src/sys/dev/ic: arn5008.c Log Message: PR/50926: David Binderman: Fix wrong paren To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/arn5008.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/arn5008.c diff -u src/sys/dev/ic/arn5008.c:1.9 src/sys/dev/ic/arn5008.c:1.10 --- src/sys/dev/ic/arn5008.c:1.9 Fri May 29 20:56:42 2015 +++ src/sys/dev/ic/arn5008.c Wed Mar 9 15:06:31 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: arn5008.c,v 1.9 2015/05/30 00:56:42 jmcneill Exp $ */ +/* $NetBSD: arn5008.c,v 1.10 2016/03/09 20:06:31 christos Exp $ */ /* $OpenBSD: ar5008.c,v 1.21 2012/08/25 12:14:31 kettenis Exp $ */ /*- @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arn5008.c,v 1.9 2015/05/30 00:56:42 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arn5008.c,v 1.10 2016/03/09 20:06:31 christos Exp $"); #include #include @@ -2020,7 +2020,7 @@ ar5008_calib_iq(struct athn_softc *sc) if (cal->pwr_meas_q == 0) continue; - if ((iq_corr_neg = cal->iq_corr_meas < 0)) + if ((iq_corr_neg = cal->iq_corr_meas) < 0) cal->iq_corr_meas = -cal->iq_corr_meas; i_coff_denom =
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Wed Mar 2 19:26:15 UTC 2016 Modified Files: src/sys/dev/ic: bwi.c Log Message: PR/50882: David Binderman: Remove redundant code. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/ic/bwi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/bwi.c diff -u src/sys/dev/ic/bwi.c:1.26 src/sys/dev/ic/bwi.c:1.27 --- src/sys/dev/ic/bwi.c:1.26 Fri Apr 10 07:47:12 2015 +++ src/sys/dev/ic/bwi.c Wed Mar 2 14:26:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: bwi.c,v 1.26 2015/04/10 11:47:12 maxv Exp $ */ +/* $NetBSD: bwi.c,v 1.27 2016/03/02 19:26:15 christos Exp $ */ /* $OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $ */ /* @@ -48,7 +48,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.26 2015/04/10 11:47:12 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.27 2016/03/02 19:26:15 christos Exp $"); #include #include @@ -3782,7 +3782,7 @@ bwi_set_gains(struct bwi_mac *mac, const bwi_tbl_write_2(mac, tbl_gain_ofs2 + i, tbl_gain); } - if (gains == NULL || (gains != NULL && gains->phy_gain != -1)) { + if (gains == NULL || gains->phy_gain != -1) { uint16_t phy_gain1, phy_gain2; if (gains != NULL) {
CVS commit: src/sys/dev/ic
Module Name:src Committed By: christos Date: Tue Jan 26 16:00:12 UTC 2016 Modified Files: src/sys/dev/ic: atw.c Log Message: PR/50692: David Binderman: Set the right wake up bits. To generate a diff of this commit: cvs rdiff -u -r1.156 -r1.157 src/sys/dev/ic/atw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/atw.c diff -u src/sys/dev/ic/atw.c:1.156 src/sys/dev/ic/atw.c:1.157 --- src/sys/dev/ic/atw.c:1.156 Thu Nov 21 19:01:09 2013 +++ src/sys/dev/ic/atw.c Tue Jan 26 11:00:12 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: atw.c,v 1.156 2013/11/22 00:01:09 riz Exp $ */ +/* $NetBSD: atw.c,v 1.157 2016/01/26 16:00:12 christos Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.156 2013/11/22 00:01:09 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.157 2016/01/26 16:00:12 christos Exp $"); #include @@ -988,9 +988,11 @@ atw_wcsr_init(struct atw_softc *sc) uint32_t wcsr; wcsr = ATW_READ(sc, ATW_WCSR); - wcsr &= ~(ATW_WCSR_BLN_MASK|ATW_WCSR_LSOE|ATW_WCSR_MPRE|ATW_WCSR_LSOE); + wcsr &= ~ATW_WCSR_BLN_MASK; wcsr |= __SHIFTIN(7, ATW_WCSR_BLN_MASK); - ATW_WRITE(sc, ATW_WCSR, wcsr); /* XXX resets wake-up status bits */ + /* We always want to wake up on link loss or TSFT out of range */ + wcsr |= ATW_WCSR_LSOE|ATW_WCSR_TSFTWE; + ATW_WRITE(sc, ATW_WCSR, wcsr); DPRINTF(sc, ("%s: %s reg[WCSR] = %08x\n", device_xname(sc->sc_dev), __func__, ATW_READ(sc, ATW_WCSR)));
CVS commit: src/sys/dev/ic
Module Name:src Committed By: ozaki-r Date: Fri Jan 22 06:51:47 UTC 2016 Modified Files: src/sys/dev/ic: midway.c Log Message: Revert previous atm_input is not compatible with ifp->if_input and other *_input routines... To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/dev/ic/midway.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/midway.c diff -u src/sys/dev/ic/midway.c:1.95 src/sys/dev/ic/midway.c:1.96 --- src/sys/dev/ic/midway.c:1.95 Fri Jan 22 06:34:59 2016 +++ src/sys/dev/ic/midway.c Fri Jan 22 06:51:47 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: midway.c,v 1.95 2016/01/22 06:34:59 ozaki-r Exp $ */ +/* $NetBSD: midway.c,v 1.96 2016/01/22 06:51:47 ozaki-r Exp $ */ /* (sync'd to midway.c 1.68) */ /* @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.95 2016/01/22 06:34:59 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.96 2016/01/22 06:51:47 ozaki-r Exp $"); #include "opt_natm.h" @@ -2768,7 +2768,7 @@ EN_INTR_TYPE en_intr(void *arg) bpf_mtap(ifp, m); - ifp->if_input(ifp, , m, sc->rxslot[slot].rxhand); + atm_input(ifp, , m, sc->rxslot[slot].rxhand); } }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: ozaki-r Date: Fri Jan 22 06:34:59 UTC 2016 Modified Files: src/sys/dev/ic: midway.c Log Message: Don't call atm_input directly This should be the last one that was survived ifp->if_input replacements. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/dev/ic/midway.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/midway.c diff -u src/sys/dev/ic/midway.c:1.94 src/sys/dev/ic/midway.c:1.95 --- src/sys/dev/ic/midway.c:1.94 Tue Mar 13 18:40:31 2012 +++ src/sys/dev/ic/midway.c Fri Jan 22 06:34:59 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: midway.c,v 1.94 2012/03/13 18:40:31 elad Exp $ */ +/* $NetBSD: midway.c,v 1.95 2016/01/22 06:34:59 ozaki-r Exp $ */ /* (sync'd to midway.c 1.68) */ /* @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.94 2012/03/13 18:40:31 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.95 2016/01/22 06:34:59 ozaki-r Exp $"); #include "opt_natm.h" @@ -2768,7 +2768,7 @@ EN_INTR_TYPE en_intr(void *arg) bpf_mtap(ifp, m); - atm_input(ifp, , m, sc->rxslot[slot].rxhand); + ifp->if_input(ifp, , m, sc->rxslot[slot].rxhand); } }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdc Date: Mon Jan 11 18:24:56 UTC 2016 Modified Files: src/sys/dev/ic: pcf8584.c Log Message: Always take the bus lock (avoids collisions when drivers set I2C_F_POLL). To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/pcf8584.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/pcf8584.c diff -u src/sys/dev/ic/pcf8584.c:1.14 src/sys/dev/ic/pcf8584.c:1.15 --- src/sys/dev/ic/pcf8584.c:1.14 Mon Jan 4 10:00:33 2016 +++ src/sys/dev/ic/pcf8584.c Mon Jan 11 18:24:56 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: pcf8584.c,v 1.14 2016/01/04 10:00:33 jdc Exp $ */ +/* $NetBSD: pcf8584.c,v 1.15 2016/01/11 18:24:56 jdc Exp $ */ /* $OpenBSD: pcf8584.c,v 1.9 2007/10/20 18:46:21 kettenis Exp $ */ /* @@ -116,9 +116,6 @@ pcfiic_i2c_acquire_bus(void *arg, int fl { struct pcfiic_softc *sc = arg; - if (cold || sc->sc_poll || (flags & I2C_F_POLL)) - return (0); - rw_enter(>sc_lock, RW_WRITER); return 0; } @@ -128,9 +125,6 @@ pcfiic_i2c_release_bus(void *arg, int fl { struct pcfiic_softc *sc = arg; - if (cold || sc->sc_poll || (flags & I2C_F_POLL)) - return; - rw_exit(>sc_lock); }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdc Date: Mon Jan 4 10:00:33 UTC 2016 Modified Files: src/sys/dev/ic: pcf8584.c Log Message: Redo r1.12 - process cmd and value buffers in pcfiic_xmit(). Avoids allocating a temporary buffer for writes using both buffers. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/pcf8584.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/pcf8584.c diff -u src/sys/dev/ic/pcf8584.c:1.13 src/sys/dev/ic/pcf8584.c:1.14 --- src/sys/dev/ic/pcf8584.c:1.13 Sun Jan 3 17:32:17 2016 +++ src/sys/dev/ic/pcf8584.c Mon Jan 4 10:00:33 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: pcf8584.c,v 1.13 2016/01/03 17:32:17 jdc Exp $ */ +/* $NetBSD: pcf8584.c,v 1.14 2016/01/04 10:00:33 jdc Exp $ */ /* $OpenBSD: pcf8584.c,v 1.9 2007/10/20 18:46:21 kettenis Exp $ */ /* @@ -31,7 +31,7 @@ #include #include -/* Internal egisters */ +/* Internal registers */ #define PCF8584_S0 0x00 #define PCF8584_S1 0x01 #define PCF8584_S2 0x02 @@ -44,7 +44,7 @@ int pcfiic_i2c_exec(void *, i2c_op_t, i size_t, void *, size_t, int); int pcfiic_xmit(struct pcfiic_softc *, u_int8_t, const u_int8_t *, - size_t); + size_t, const u_int8_t *, size_t); int pcfiic_recv(struct pcfiic_softc *, u_int8_t, u_int8_t *, size_t); @@ -157,21 +157,9 @@ pcfiic_i2c_exec(void *arg, i2c_op_t op, * If we are reading, write address, cmdbuf, then read address, buf. */ if (I2C_OP_WRITE_P(op)) { - if (len > 0) { - uint8_t *tmp; - - tmp = malloc(cmdlen + len, M_DEVBUF, - flags & I2C_F_POLL ? M_NOWAIT : M_WAITOK); - if (tmp == NULL) -return (1); - memcpy(tmp, cmdbuf, cmdlen); - memcpy(tmp + cmdlen, buf, len); - ret = pcfiic_xmit(sc, addr & 0x7f, tmp, cmdlen + len); - free(tmp, M_DEVBUF); - } else - ret = pcfiic_xmit(sc, addr & 0x7f, cmdbuf, cmdlen); + ret = pcfiic_xmit(sc, addr & 0x7f, cmdbuf, cmdlen, buf, len); } else { - if (pcfiic_xmit(sc, addr & 0x7f, cmdbuf, cmdlen) != 0) + if (pcfiic_xmit(sc, addr & 0x7f, cmdbuf, cmdlen, NULL, 0) != 0) return (1); ret = pcfiic_recv(sc, addr & 0x7f, buf, len); } @@ -179,8 +167,8 @@ pcfiic_i2c_exec(void *arg, i2c_op_t op, } int -pcfiic_xmit(struct pcfiic_softc *sc, u_int8_t addr, const u_int8_t *buf, -size_t len) +pcfiic_xmit(struct pcfiic_softc *sc, u_int8_t addr, const u_int8_t *cmdbuf, +size_t cmdlen, const u_int8_t *buf, size_t len) { int i, err = 0; volatile u_int8_t r; @@ -191,7 +179,7 @@ pcfiic_xmit(struct pcfiic_softc *sc, u_i pcfiic_write(sc, PCF8584_S0, addr << 1); pcfiic_write(sc, PCF8584_S1, PCF8584_CMD_START); - for (i = 0; i <= len; i++) { + for (i = 0; i <= cmdlen + len; i++) { if (pcfiic_wait_pin(sc, ) != 0) { pcfiic_write(sc, PCF8584_S1, PCF8584_CMD_STOP); return (1); @@ -202,8 +190,10 @@ pcfiic_xmit(struct pcfiic_softc *sc, u_i break; } - if (i < len) - pcfiic_write(sc, PCF8584_S0, buf[i]); + if (i < cmdlen) + pcfiic_write(sc, PCF8584_S0, cmdbuf[i]); + else if (i < cmdlen + len) + pcfiic_write(sc, PCF8584_S0, buf[i - cmdlen]); } pcfiic_write(sc, PCF8584_S1, PCF8584_CMD_STOP); return (err);