Module Name: src
Committed By: skrll
Date: Mon Apr 6 08:58:44 UTC 2015
Modified Files:
src/sys/dev/usb [nick-nhusb]: ehci.c ehcivar.h ohci.c uhci.c
Log Message:
Use anonymous unions in various structs and rename the ctl/iso members of
the pipe structs to ctrl/isoc.
No functional change intended.
To generate a diff of this commit:
cvs rdiff -u -r1.234.2.47 -r1.234.2.48 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.42.14.12 -r1.42.14.13 src/sys/dev/usb/ehcivar.h
cvs rdiff -u -r1.254.2.20 -r1.254.2.21 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.264.4.32 -r1.264.4.33 src/sys/dev/usb/uhci.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/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.234.2.47 src/sys/dev/usb/ehci.c:1.234.2.48
--- src/sys/dev/usb/ehci.c:1.234.2.47 Mon Apr 6 07:08:59 2015
+++ src/sys/dev/usb/ehci.c Mon Apr 6 08:58:43 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.234.2.47 2015/04/06 07:08:59 skrll Exp $ */
+/* $NetBSD: ehci.c,v 1.234.2.48 2015/04/06 08:58:43 skrll Exp $ */
/*
* Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.47 2015/04/06 07:08:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.48 2015/04/06 08:58:43 skrll Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -1824,7 +1824,7 @@ ehci_dump_sitd(struct ehci_soft_itd *itd
USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
USBHIST_LOG(ehcidebug, "SITD %p next = %p prev = %p",
- itd, itd->u.frame_list.next, itd->u.frame_list.prev, 0);
+ itd, itd->frame_list.next, itd->frame_list.prev, 0);
USBHIST_LOG(ehcidebug, " xfernext=%p physaddr=%X slot=%d",
itd->xfer_next, itd->physaddr, itd->slot, 0);
}
@@ -2173,18 +2173,18 @@ ehci_rem_free_itd_chain(ehci_softc_t *sc
panic("ehci isoc xfer being freed, but with no itd chain\n");
for (itd = exfer->ex_itdstart; itd != NULL; itd = itd->xfer_next) {
- prev = itd->u.frame_list.prev;
+ prev = itd->frame_list.prev;
/* Unlink itd from hardware chain, or frame array */
if (prev == NULL) { /* We're at the table head */
- sc->sc_softitds[itd->slot] = itd->u.frame_list.next;
+ sc->sc_softitds[itd->slot] = itd->frame_list.next;
sc->sc_flist[itd->slot] = itd->itd.itd_next;
usb_syncmem(&sc->sc_fldma,
sizeof(ehci_link_t) * itd->slot,
sizeof(ehci_link_t),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- if (itd->u.frame_list.next != NULL)
- itd->u.frame_list.next->u.frame_list.prev = NULL;
+ if (itd->frame_list.next != NULL)
+ itd->frame_list.next->frame_list.prev = NULL;
} else {
/* XXX this part is untested... */
prev->itd.itd_next = itd->itd.itd_next;
@@ -2192,9 +2192,9 @@ ehci_rem_free_itd_chain(ehci_softc_t *sc
itd->offs + offsetof(ehci_itd_t, itd_next),
sizeof(itd->itd.itd_next), BUS_DMASYNC_PREWRITE);
- prev->u.frame_list.next = itd->u.frame_list.next;
- if (itd->u.frame_list.next != NULL)
- itd->u.frame_list.next->u.frame_list.prev = prev;
+ prev->frame_list.next = itd->frame_list.next;
+ if (itd->frame_list.next != NULL)
+ itd->frame_list.next->frame_list.prev = prev;
}
}
@@ -2221,18 +2221,18 @@ ehci_rem_free_sitd_chain(ehci_softc_t *s
panic("ehci isoc xfer being freed, but with no sitd chain\n");
for (sitd = exfer->ex_sitdstart; sitd != NULL; sitd = sitd->xfer_next) {
- prev = sitd->u.frame_list.prev;
+ prev = sitd->frame_list.prev;
/* Unlink sitd from hardware chain, or frame array */
if (prev == NULL) { /* We're at the table head */
- sc->sc_softsitds[sitd->slot] = sitd->u.frame_list.next;
+ sc->sc_softsitds[sitd->slot] = sitd->frame_list.next;
sc->sc_flist[sitd->slot] = sitd->sitd.sitd_next;
usb_syncmem(&sc->sc_fldma,
sizeof(ehci_link_t) * sitd->slot,
sizeof(ehci_link_t),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- if (sitd->u.frame_list.next != NULL)
- sitd->u.frame_list.next->u.frame_list.prev = NULL;
+ if (sitd->frame_list.next != NULL)
+ sitd->frame_list.next->frame_list.prev = NULL;
} else {
/* XXX this part is untested... */
prev->sitd.sitd_next = sitd->sitd.sitd_next;
@@ -2240,9 +2240,9 @@ ehci_rem_free_sitd_chain(ehci_softc_t *s
sitd->offs + offsetof(ehci_sitd_t, sitd_next),
sizeof(sitd->sitd.sitd_next), BUS_DMASYNC_PREWRITE);
- prev->u.frame_list.next = sitd->u.frame_list.next;
- if (sitd->u.frame_list.next != NULL)
- sitd->u.frame_list.next->u.frame_list.prev = prev;
+ prev->frame_list.next = sitd->frame_list.next;
+ if (sitd->frame_list.next != NULL)
+ sitd->frame_list.next->frame_list.prev = prev;
}
}
@@ -2944,7 +2944,7 @@ ehci_alloc_itd(ehci_softc_t *sc)
previndex = (frindex != 0) ? frindex - 1 : sc->sc_flsize;
freeitd = NULL;
- LIST_FOREACH(itd, &sc->sc_freeitds, u.free_list) {
+ LIST_FOREACH(itd, &sc->sc_freeitds, free_list) {
if (itd == NULL)
break;
if (itd->slot != frindex && itd->slot != previndex) {
@@ -2971,20 +2971,20 @@ ehci_alloc_itd(ehci_softc_t *sc)
itd->physaddr = DMAADDR(&dma, offs);
itd->dma = dma;
itd->offs = offs;
- LIST_INSERT_HEAD(&sc->sc_freeitds, itd, u.free_list);
+ LIST_INSERT_HEAD(&sc->sc_freeitds, itd, free_list);
}
freeitd = LIST_FIRST(&sc->sc_freeitds);
}
itd = freeitd;
- LIST_REMOVE(itd, u.free_list);
+ LIST_REMOVE(itd, free_list);
memset(&itd->itd, 0, sizeof(ehci_itd_t));
usb_syncmem(&itd->dma, itd->offs + offsetof(ehci_itd_t, itd_next),
sizeof(itd->itd.itd_next),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- itd->u.frame_list.next = NULL;
- itd->u.frame_list.prev = NULL;
+ itd->frame_list.next = NULL;
+ itd->frame_list.prev = NULL;
itd->xfer_next = NULL;
itd->slot = 0;
@@ -3015,7 +3015,7 @@ ehci_alloc_sitd(ehci_softc_t *sc)
previndex = (frindex != 0) ? frindex - 1 : sc->sc_flsize;
freesitd = NULL;
- LIST_FOREACH(sitd, &sc->sc_freesitds, u.free_list) {
+ LIST_FOREACH(sitd, &sc->sc_freesitds, free_list) {
if (sitd == NULL)
break;
if (sitd->slot != frindex && sitd->slot != previndex) {
@@ -3042,20 +3042,20 @@ ehci_alloc_sitd(ehci_softc_t *sc)
sitd->physaddr = DMAADDR(&dma, offs);
sitd->dma = dma;
sitd->offs = offs;
- LIST_INSERT_HEAD(&sc->sc_freesitds, sitd, u.free_list);
+ LIST_INSERT_HEAD(&sc->sc_freesitds, sitd, free_list);
}
freesitd = LIST_FIRST(&sc->sc_freesitds);
}
sitd = freesitd;
- LIST_REMOVE(sitd, u.free_list);
+ LIST_REMOVE(sitd, free_list);
memset(&sitd->sitd, 0, sizeof(ehci_sitd_t));
usb_syncmem(&sitd->dma, sitd->offs + offsetof(ehci_sitd_t, sitd_next),
sizeof(sitd->sitd.sitd_next), BUS_DMASYNC_PREWRITE |
BUS_DMASYNC_PREREAD);
- sitd->u.frame_list.next = NULL;
- sitd->u.frame_list.prev = NULL;
+ sitd->frame_list.next = NULL;
+ sitd->frame_list.prev = NULL;
sitd->xfer_next = NULL;
sitd->slot = 0;
@@ -3070,7 +3070,7 @@ ehci_free_itd(ehci_softc_t *sc, ehci_sof
KASSERT(mutex_owned(&sc->sc_lock));
- LIST_INSERT_HEAD(&sc->sc_freeitds, itd, u.free_list);
+ LIST_INSERT_HEAD(&sc->sc_freeitds, itd, free_list);
}
Static void
@@ -3079,7 +3079,7 @@ ehci_free_sitd(ehci_softc_t *sc, ehci_so
KASSERT(mutex_owned(&sc->sc_lock));
- LIST_INSERT_HEAD(&sc->sc_freesitds, sitd, u.free_list);
+ LIST_INSERT_HEAD(&sc->sc_freesitds, sitd, free_list);
}
/****************/
@@ -4318,12 +4318,12 @@ ehci_device_fs_isoc_start(struct usbd_xf
sizeof(ehci_link_t),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- sitd->u.frame_list.next = sc->sc_softsitds[frindex];
+ sitd->frame_list.next = sc->sc_softsitds[frindex];
sc->sc_softsitds[frindex] = sitd;
- if (sitd->u.frame_list.next != NULL)
- sitd->u.frame_list.next->u.frame_list.prev = sitd;
+ if (sitd->frame_list.next != NULL)
+ sitd->frame_list.next->frame_list.prev = sitd;
sitd->slot = frindex;
- sitd->u.frame_list.prev = NULL;
+ sitd->frame_list.prev = NULL;
frindex += i;
if (frindex >= sc->sc_flsize)
@@ -4647,12 +4647,12 @@ ehci_device_isoc_start(struct usbd_xfer
sizeof(ehci_link_t),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- itd->u.frame_list.next = sc->sc_softitds[frindex];
+ itd->frame_list.next = sc->sc_softitds[frindex];
sc->sc_softitds[frindex] = itd;
- if (itd->u.frame_list.next != NULL)
- itd->u.frame_list.next->u.frame_list.prev = itd;
+ if (itd->frame_list.next != NULL)
+ itd->frame_list.next->frame_list.prev = itd;
itd->slot = frindex;
- itd->u.frame_list.prev = NULL;
+ itd->frame_list.prev = NULL;
frindex += i;
if (frindex >= sc->sc_flsize)
Index: src/sys/dev/usb/ehcivar.h
diff -u src/sys/dev/usb/ehcivar.h:1.42.14.12 src/sys/dev/usb/ehcivar.h:1.42.14.13
--- src/sys/dev/usb/ehcivar.h:1.42.14.12 Thu Mar 19 17:26:42 2015
+++ src/sys/dev/usb/ehcivar.h Mon Apr 6 08:58:43 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: ehcivar.h,v 1.42.14.12 2015/03/19 17:26:42 skrll Exp $ */
+/* $NetBSD: ehcivar.h,v 1.42.14.13 2015/04/06 08:58:43 skrll Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@ typedef struct ehci_soft_itd {
} frame_list;
/* circular list of free itds */
LIST_ENTRY(ehci_soft_itd) free_list;
- } u;
+ };
struct ehci_soft_itd *xfer_next; /* Next soft_itd in xfer */
ehci_physaddr_t physaddr;
usb_dma_t dma;
Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.20 src/sys/dev/usb/ohci.c:1.254.2.21
--- src/sys/dev/usb/ohci.c:1.254.2.20 Mon Mar 30 11:56:18 2015
+++ src/sys/dev/usb/ohci.c Mon Apr 6 08:58:44 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.254.2.20 2015/03/30 11:56:18 skrll Exp $ */
+/* $NetBSD: ohci.c,v 1.254.2.21 2015/04/06 08:58:44 skrll Exp $ */
/*
* Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.20 2015/03/30 11:56:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.21 2015/04/06 08:58:44 skrll Exp $");
#include "opt_usb.h"
@@ -258,7 +258,7 @@ struct ohci_pipe {
usb_dma_t reqdma;
u_int length;
ohci_soft_td_t *setup, *data, *stat;
- } ctl;
+ } ctrl;
/* Interrupt pipe */
struct {
int nslots;
@@ -269,11 +269,11 @@ struct ohci_pipe {
u_int length;
int isread;
} bulk;
- /* Iso pipe */
- struct iso {
+ /* Isochronous pipe */
+ struct isoc {
int next, inuse;
- } iso;
- } u;
+ } isoc;
+ };
};
Static const struct usbd_bus_methods ohci_bus_methods = {
@@ -1425,7 +1425,7 @@ ohci_softintr(void *v)
ohci_soft_itd_t *next;
opipe = (struct ohci_pipe *)xfer->ux_pipe;
- opipe->u.iso.inuse -= xfer->ux_nframes;
+ opipe->isoc.inuse -= xfer->ux_nframes;
uedir = UE_GET_DIR(xfer->ux_pipe->up_endpoint->ue_edesc->
bEndpointAddress);
xfer->ux_status = USBD_NORMAL_COMPLETION;
@@ -1500,7 +1500,7 @@ ohci_device_ctrl_done(struct usbd_xfer *
if (len)
usb_syncmem(&xfer->ux_dmabuf, 0, len,
isread ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
- usb_syncmem(&opipe->u.ctl.reqdma, 0,
+ usb_syncmem(&opipe->ctrl.reqdma, 0,
sizeof(usb_device_request_t), BUS_DMASYNC_POSTWRITE);
}
@@ -1737,7 +1737,7 @@ ohci_device_request(struct usbd_xfer *xf
tail->xfer = NULL;
sed = opipe->sed;
- opipe->u.ctl.length = len;
+ opipe->ctrl.length = len;
KASSERTMSG(OHCI_ED_GET_FA(O32TOH(sed->ed.ed_flags)) == dev->ud_addr,
"address ED %d pipe %d\n",
@@ -1771,12 +1771,12 @@ ohci_device_request(struct usbd_xfer *xf
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
}
- memcpy(KERNADDR(&opipe->u.ctl.reqdma, 0), req, sizeof(*req));
- usb_syncmem(&opipe->u.ctl.reqdma, 0, sizeof(*req), BUS_DMASYNC_PREWRITE);
+ memcpy(KERNADDR(&opipe->ctrl.reqdma, 0), req, sizeof(*req));
+ usb_syncmem(&opipe->ctrl.reqdma, 0, sizeof(*req), BUS_DMASYNC_PREWRITE);
setup->td.td_flags = HTOO32(OHCI_TD_SETUP | OHCI_TD_NOCC |
OHCI_TD_TOGGLE_0 | OHCI_TD_NOINTR);
- setup->td.td_cbp = HTOO32(DMAADDR(&opipe->u.ctl.reqdma, 0));
+ setup->td.td_cbp = HTOO32(DMAADDR(&opipe->ctrl.reqdma, 0));
setup->nexttd = next;
setup->td.td_nexttd = HTOO32(next->physaddr);
setup->td.td_be = HTOO32(O32TOH(setup->td.td_cbp) + sizeof(*req) - 1);
@@ -2216,7 +2216,7 @@ ohci_open(struct usbd_pipe *pipe)
pipe->up_methods = &ohci_device_ctrl_methods;
err = usb_allocmem(&sc->sc_bus,
sizeof(usb_device_request_t),
- 0, &opipe->u.ctl.reqdma);
+ 0, &opipe->ctrl.reqdma);
if (err)
goto bad;
mutex_enter(&sc->sc_lock);
@@ -2867,8 +2867,8 @@ ohci_device_bulk_start(struct usbd_xfer
xfer->ux_flags);
DPRINTFN(4, "endpt=%d", endpt, 0, 0, 0);
- opipe->u.bulk.isread = isread;
- opipe->u.bulk.length = len;
+ opipe->bulk.isread = isread;
+ opipe->bulk.length = len;
usb_syncmem(&sed->dma, sed->offs, sizeof(sed->ed),
BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
@@ -3107,8 +3107,8 @@ ohci_device_intr_close(struct usbd_pipe
{
struct ohci_pipe *opipe = (struct ohci_pipe *)pipe;
ohci_softc_t *sc = pipe->up_dev->ud_bus->ub_hcpriv;
- int nslots = opipe->u.intr.nslots;
- int pos = opipe->u.intr.pos;
+ int nslots = opipe->intr.nslots;
+ int pos = opipe->intr.pos;
int j;
ohci_soft_ed_t *p, *sed = opipe->sed;
@@ -3211,8 +3211,8 @@ ohci_device_setintr(ohci_softc_t *sc, st
for (j = 0; j < nslots; j++)
++sc->sc_bws[(best * nslots + j) % OHCI_NO_INTRS];
- opipe->u.intr.nslots = nslots;
- opipe->u.intr.pos = best;
+ opipe->intr.nslots = nslots;
+ opipe->intr.pos = best;
DPRINTFN(5, "returns %p", opipe, 0, 0, 0);
return USBD_NORMAL_COMPLETION;
@@ -3258,7 +3258,7 @@ ohci_device_isoc_enter(struct usbd_xfer
struct usbd_device *dev = opipe->pipe.up_dev;
ohci_softc_t *sc = dev->ud_bus->ub_hcpriv;
ohci_soft_ed_t *sed = opipe->sed;
- struct iso *iso = &opipe->u.iso;
+ struct isoc *isoc = &opipe->isoc;
ohci_soft_itd_t *sitd, *nsitd;
ohci_physaddr_t buf, offs, noffs, bp0;
int i, ncur, nframes;
@@ -3266,15 +3266,15 @@ ohci_device_isoc_enter(struct usbd_xfer
OHCIHIST_FUNC(); OHCIHIST_CALLED();
DPRINTFN(1, "used=%d next=%d xfer=%p nframes=%d",
- iso->inuse, iso->next, xfer, xfer->ux_nframes);
+ isoc->inuse, isoc->next, xfer, xfer->ux_nframes);
if (sc->sc_dying)
return;
- if (iso->next == -1) {
+ if (isoc->next == -1) {
/* Not in use yet, schedule it a few frames ahead. */
- iso->next = O32TOH(sc->sc_hcca->hcca_frame_number) + 5;
- DPRINTFN(2,"start next=%d", iso->next, 0, 0, 0);
+ isoc->next = O32TOH(sc->sc_hcca->hcca_frame_number) + 5;
+ DPRINTFN(2,"start next=%d", isoc->next, 0, 0, 0);
}
sitd = opipe->tail.itd;
@@ -3302,7 +3302,7 @@ ohci_device_isoc_enter(struct usbd_xfer
/* Fill current ITD */
sitd->itd.itd_flags = HTOO32(
OHCI_ITD_NOCC |
- OHCI_ITD_SET_SF(iso->next) |
+ OHCI_ITD_SET_SF(isoc->next) |
OHCI_ITD_SET_DI(6) | /* delay intr a little */
OHCI_ITD_SET_FC(ncur));
sitd->itd.itd_bp0 = HTOO32(bp0);
@@ -3315,7 +3315,7 @@ ohci_device_isoc_enter(struct usbd_xfer
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
sitd = nsitd;
- iso->next = iso->next + ncur;
+ isoc->next = isoc->next + ncur;
bp0 = OHCI_PAGE(buf + offs);
ncur = 0;
}
@@ -3334,7 +3334,7 @@ ohci_device_isoc_enter(struct usbd_xfer
/* Fixup last used ITD */
sitd->itd.itd_flags = HTOO32(
OHCI_ITD_NOCC |
- OHCI_ITD_SET_SF(iso->next) |
+ OHCI_ITD_SET_SF(isoc->next) |
OHCI_ITD_SET_DI(0) |
OHCI_ITD_SET_FC(ncur));
sitd->itd.itd_bp0 = HTOO32(bp0);
@@ -3346,8 +3346,8 @@ ohci_device_isoc_enter(struct usbd_xfer
usb_syncmem(&sitd->dma, sitd->offs, sizeof(sitd->itd),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- iso->next = iso->next + ncur;
- iso->inuse += nframes;
+ isoc->next = isoc->next + ncur;
+ isoc->inuse += nframes;
xfer->ux_actlen = offs; /* XXX pretend we did it all */
@@ -3483,10 +3483,10 @@ ohci_setup_isoc(struct usbd_pipe *pipe)
{
struct ohci_pipe *opipe = (struct ohci_pipe *)pipe;
ohci_softc_t *sc = pipe->up_dev->ud_bus->ub_hcpriv;
- struct iso *iso = &opipe->u.iso;
+ struct isoc *isoc = &opipe->isoc;
- iso->next = -1;
- iso->inuse = 0;
+ isoc->next = -1;
+ isoc->inuse = 0;
mutex_enter(&sc->sc_lock);
ohci_add_ed(sc, opipe->sed, sc->sc_isoc_head);
Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.264.4.32 src/sys/dev/usb/uhci.c:1.264.4.33
--- src/sys/dev/usb/uhci.c:1.264.4.32 Sun Apr 5 07:26:31 2015
+++ src/sys/dev/usb/uhci.c Mon Apr 6 08:58:44 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.264.4.32 2015/04/05 07:26:31 skrll Exp $ */
+/* $NetBSD: uhci.c,v 1.264.4.33 2015/04/06 08:58:44 skrll Exp $ */
/*
* Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.32 2015/04/05 07:26:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.33 2015/04/06 08:58:44 skrll Exp $");
#include "opt_usb.h"
@@ -141,7 +141,7 @@ struct uhci_pipe {
usb_dma_t reqdma;
uhci_soft_td_t *setup, *stat;
u_int length;
- } ctl;
+ } ctrl;
/* Interrupt pipe */
struct {
int npoll;
@@ -154,12 +154,12 @@ struct uhci_pipe {
u_int length;
int isread;
} bulk;
- /* Iso pipe */
- struct iso {
+ /* Isochronous pipe */
+ struct isoc {
uhci_soft_td_t **stds;
int next, inuse;
- } iso;
- } u;
+ } isoc;
+ };
};
Static void uhci_globalreset(uhci_softc_t *);
@@ -1474,8 +1474,8 @@ uhci_check_intr(uhci_softc_t *sc, uhci_i
if ((status & UHCI_TD_SPD) && xfertype == UE_CONTROL) {
struct uhci_pipe *upipe =
(struct uhci_pipe *)xfer->ux_pipe;
- uhci_soft_qh_t *sqh = upipe->u.ctl.sqh;
- uhci_soft_td_t *stat = upipe->u.ctl.stat;
+ uhci_soft_qh_t *sqh = upipe->ctrl.sqh;
+ uhci_soft_td_t *stat = upipe->ctrl.stat;
DPRINTFN(12, "ii=%p std=%p control status"
"phase needs completion", ii, ii->stdstart, 0, 0);
@@ -1531,7 +1531,7 @@ uhci_idone(uhci_intr_info_t *ii)
if (xfer->ux_nframes != 0) {
/* Isoc transfer, do things differently. */
- uhci_soft_td_t **stds = upipe->u.iso.stds;
+ uhci_soft_td_t **stds = upipe->isoc.stds;
int i, n, nframes, len;
DPRINTFN(5, "ii=%p isoc ready", ii, 0, 0, 0);
@@ -1558,7 +1558,7 @@ uhci_idone(uhci_intr_info_t *ii)
xfer->ux_frlengths[i] = len;
actlen += len;
}
- upipe->u.iso.inuse -= nframes;
+ upipe->isoc.inuse -= nframes;
xfer->ux_actlen = actlen;
xfer->ux_status = USBD_NORMAL_COMPLETION;
goto end;
@@ -2066,10 +2066,10 @@ uhci_device_bulk_start(struct usbd_xfer
len = xfer->ux_length;
endpt = upipe->pipe.up_endpoint->ue_edesc->bEndpointAddress;
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
- sqh = upipe->u.bulk.sqh;
+ sqh = upipe->bulk.sqh;
- upipe->u.bulk.isread = isread;
- upipe->u.bulk.length = len;
+ upipe->bulk.isread = isread;
+ upipe->bulk.length = len;
err = uhci_alloc_std_chain(upipe, sc, len, isread, xfer->ux_flags,
&xfer->ux_dmabuf, &data, &dataend);
@@ -2252,7 +2252,7 @@ uhci_device_bulk_close(struct usbd_pipe
KASSERT(mutex_owned(&sc->sc_lock));
- uhci_free_sqh(sc, upipe->u.bulk.sqh);
+ uhci_free_sqh(sc, upipe->bulk.sqh);
pipe->up_endpoint->ue_toggle = upipe->nexttoggle;
}
@@ -2347,7 +2347,7 @@ uhci_device_intr_start(struct usbd_xfer
endpt = upipe->pipe.up_endpoint->ue_edesc->bEndpointAddress;
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
- upipe->u.intr.isread = isread;
+ upipe->intr.isread = isread;
err = uhci_alloc_std_chain(upipe, sc, xfer->ux_length, isread,
xfer->ux_flags, &xfer->ux_dmabuf, &data,
@@ -2367,7 +2367,7 @@ uhci_device_intr_start(struct usbd_xfer
#ifdef UHCI_DEBUG
if (uhcidebug > 10) {
uhci_dump_tds(data);
- uhci_dump_qh(upipe->u.intr.qhs[0]);
+ uhci_dump_qh(upipe->intr.qhs[0]);
}
#endif
DPRINTFN(10, "--- dump end ---", 0, 0, 0, 0);
@@ -2381,9 +2381,9 @@ uhci_device_intr_start(struct usbd_xfer
ii->isdone = false;
#endif
- DPRINTFN(10, "qhs[0]=%p", upipe->u.intr.qhs[0], 0, 0, 0);
- for (i = 0; i < upipe->u.intr.npoll; i++) {
- sqh = upipe->u.intr.qhs[i];
+ DPRINTFN(10, "qhs[0]=%p", upipe->intr.qhs[0], 0, 0, 0);
+ for (i = 0; i < upipe->intr.npoll; i++) {
+ sqh = upipe->intr.qhs[i];
sqh->elink = data;
sqh->qh.qh_elink = htole32(data->physaddr | UHCI_PTR_TD);
usb_syncmem(&sqh->dma,
@@ -2399,7 +2399,7 @@ uhci_device_intr_start(struct usbd_xfer
#ifdef UHCI_DEBUG
if (uhcidebug > 10) {
uhci_dump_tds(data);
- uhci_dump_qh(upipe->u.intr.qhs[0]);
+ uhci_dump_qh(upipe->intr.qhs[0]);
}
#endif
DPRINTFN(10, "--- dump end ---", 0, 0, 0, 0);
@@ -2451,9 +2451,9 @@ uhci_device_intr_close(struct usbd_pipe
KASSERT(mutex_owned(&sc->sc_lock));
/* Unlink descriptors from controller data structures. */
- npoll = upipe->u.intr.npoll;
+ npoll = upipe->intr.npoll;
for (i = 0; i < npoll; i++)
- uhci_remove_intr(sc, upipe->u.intr.qhs[i]);
+ uhci_remove_intr(sc, upipe->intr.qhs[i]);
/*
* We now have to wait for any activity on the physical
@@ -2462,8 +2462,8 @@ uhci_device_intr_close(struct usbd_pipe
usb_delay_ms_locked(&sc->sc_bus, 2, &sc->sc_lock);
for(i = 0; i < npoll; i++)
- uhci_free_sqh(sc, upipe->u.intr.qhs[i]);
- kmem_free(upipe->u.intr.qhs, npoll * sizeof(uhci_soft_qh_t *));
+ uhci_free_sqh(sc, upipe->intr.qhs[i]);
+ kmem_free(upipe->intr.qhs, npoll * sizeof(uhci_soft_qh_t *));
/* XXX free other resources */
}
@@ -2499,9 +2499,9 @@ uhci_device_request(struct usbd_xfer *xf
isread = req->bmRequestType & UT_READ;
len = UGETW(req->wLength);
- setup = upipe->u.ctl.setup;
- stat = upipe->u.ctl.stat;
- sqh = upipe->u.ctl.sqh;
+ setup = upipe->ctrl.setup;
+ stat = upipe->ctrl.stat;
+ sqh = upipe->ctrl.sqh;
/* Set up data transaction */
if (len != 0) {
@@ -2520,17 +2520,17 @@ uhci_device_request(struct usbd_xfer *xf
} else {
next = stat;
}
- upipe->u.ctl.length = len;
+ upipe->ctrl.length = len;
- memcpy(KERNADDR(&upipe->u.ctl.reqdma, 0), req, sizeof *req);
- usb_syncmem(&upipe->u.ctl.reqdma, 0, sizeof *req, BUS_DMASYNC_PREWRITE);
+ memcpy(KERNADDR(&upipe->ctrl.reqdma, 0), req, sizeof *req);
+ usb_syncmem(&upipe->ctrl.reqdma, 0, sizeof *req, BUS_DMASYNC_PREWRITE);
setup->link.std = next;
setup->td.td_link = htole32(next->physaddr | UHCI_PTR_TD);
setup->td.td_status = htole32(UHCI_TD_SET_ERRCNT(3) | ls |
UHCI_TD_ACTIVE);
setup->td.td_token = htole32(UHCI_TD_SETUP(sizeof *req, endpt, addr));
- setup->td.td_buffer = htole32(DMAADDR(&upipe->u.ctl.reqdma, 0));
+ setup->td.td_buffer = htole32(DMAADDR(&upipe->ctrl.reqdma, 0));
usb_syncmem(&setup->dma, setup->offs, sizeof(setup->td),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
@@ -2646,7 +2646,7 @@ uhci_device_isoc_enter(struct usbd_xfer
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->ux_pipe;
struct usbd_device *dev = upipe->pipe.up_dev;
uhci_softc_t *sc = dev->ud_bus->ub_hcpriv;
- struct iso *iso = &upipe->u.iso;
+ struct isoc *isoc = &upipe->isoc;
uhci_soft_td_t *std;
uint32_t buf, len, status, offs;
int i, next, nframes;
@@ -2654,7 +2654,7 @@ uhci_device_isoc_enter(struct usbd_xfer
UHCIHIST_FUNC(); UHCIHIST_CALLED();
DPRINTFN(5, "used=%d next=%d xfer=%p nframes=%d",
- iso->inuse, iso->next, xfer, xfer->ux_nframes);
+ isoc->inuse, isoc->next, xfer, xfer->ux_nframes);
if (sc->sc_dying)
return;
@@ -2666,11 +2666,11 @@ uhci_device_isoc_enter(struct usbd_xfer
}
#ifdef DIAGNOSTIC
- if (iso->inuse >= UHCI_VFRAMELIST_COUNT)
+ if (isoc->inuse >= UHCI_VFRAMELIST_COUNT)
printf("uhci_device_isoc_enter: overflow!\n");
#endif
- next = iso->next;
+ next = isoc->next;
if (next == -1) {
/* Not in use yet, schedule it a few frames ahead. */
next = (UREAD2(sc, UHCI_FRNUM) + 3) % UHCI_VFRAMELIST_COUNT;
@@ -2688,7 +2688,7 @@ uhci_device_isoc_enter(struct usbd_xfer
nframes = xfer->ux_nframes;
mutex_enter(&sc->sc_lock);
for (i = 0; i < nframes; i++) {
- std = iso->stds[next];
+ std = isoc->stds[next];
if (++next >= UHCI_VFRAMELIST_COUNT)
next = 0;
len = xfer->ux_frlengths[i];
@@ -2713,8 +2713,8 @@ uhci_device_isoc_enter(struct usbd_xfer
buf += len;
offs += len;
}
- iso->next = next;
- iso->inuse += xfer->ux_nframes;
+ isoc->next = next;
+ isoc->inuse += xfer->ux_nframes;
mutex_exit(&sc->sc_lock);
}
@@ -2747,7 +2747,7 @@ uhci_device_isoc_start(struct usbd_xfer
i = UXFER(xfer)->curframe + xfer->ux_nframes;
if (i >= UHCI_VFRAMELIST_COUNT)
i -= UHCI_VFRAMELIST_COUNT;
- end = upipe->u.iso.stds[i];
+ end = upipe->isoc.stds[i];
KASSERT(end != NULL);
@@ -2772,7 +2772,7 @@ uhci_device_isoc_abort(struct usbd_xfer
{
uhci_softc_t *sc __diagused = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->ux_pipe;
- uhci_soft_td_t **stds = upipe->u.iso.stds;
+ uhci_soft_td_t **stds = upipe->isoc.stds;
uhci_soft_td_t *std;
int i, n, nframes, maxlen, len;
@@ -2832,7 +2832,7 @@ uhci_device_isoc_close(struct usbd_pipe
struct usbd_device *dev = upipe->pipe.up_dev;
uhci_softc_t *sc = dev->ud_bus->ub_hcpriv;
uhci_soft_td_t *std, *vstd;
- struct iso *iso;
+ struct isoc *isoc;
int i;
KASSERT(mutex_owned(&sc->sc_lock));
@@ -2843,10 +2843,10 @@ uhci_device_isoc_close(struct usbd_pipe
* Unschedule.
* Deallocate.
*/
- iso = &upipe->u.iso;
+ isoc = &upipe->isoc;
for (i = 0; i < UHCI_VFRAMELIST_COUNT; i++) {
- std = iso->stds[i];
+ std = isoc->stds[i];
usb_syncmem(&std->dma,
std->offs + offsetof(uhci_td_t, td_status),
sizeof(std->td.td_status),
@@ -2861,7 +2861,7 @@ uhci_device_isoc_close(struct usbd_pipe
usb_delay_ms_locked(&sc->sc_bus, 2, &sc->sc_lock);
for (i = 0; i < UHCI_VFRAMELIST_COUNT; i++) {
- std = iso->stds[i];
+ std = isoc->stds[i];
for (vstd = sc->sc_vframes[i].htd;
vstd != NULL && vstd->link.std != std;
vstd = vstd->link.std)
@@ -2885,7 +2885,7 @@ uhci_device_isoc_close(struct usbd_pipe
uhci_free_std(sc, std);
}
- kmem_free(iso->stds, UHCI_VFRAMELIST_COUNT * sizeof (uhci_soft_td_t *));
+ kmem_free(isoc->stds, UHCI_VFRAMELIST_COUNT * sizeof (uhci_soft_td_t *));
}
usbd_status
@@ -2899,14 +2899,14 @@ uhci_setup_isoc(struct usbd_pipe *pipe)
int rd = UE_GET_DIR(endpt) == UE_DIR_IN;
uhci_soft_td_t *std, *vstd;
uint32_t token;
- struct iso *iso;
+ struct isoc *isoc;
int i;
- iso = &upipe->u.iso;
- iso->stds = kmem_alloc(UHCI_VFRAMELIST_COUNT *
+ isoc = &upipe->isoc;
+ isoc->stds = kmem_alloc(UHCI_VFRAMELIST_COUNT *
sizeof (uhci_soft_td_t *),
KM_SLEEP);
- if (iso->stds == NULL)
+ if (isoc->stds == NULL)
return USBD_NOMEM;
token = rd ? UHCI_TD_IN (0, endpt, addr, 0) :
@@ -2923,12 +2923,12 @@ uhci_setup_isoc(struct usbd_pipe *pipe)
std->td.td_token = htole32(token);
usb_syncmem(&std->dma, std->offs, sizeof(std->td),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- iso->stds[i] = std;
+ isoc->stds[i] = std;
}
/* Insert TDs into schedule. */
for (i = 0; i < UHCI_VFRAMELIST_COUNT; i++) {
- std = iso->stds[i];
+ std = isoc->stds[i];
vstd = sc->sc_vframes[i].htd;
usb_syncmem(&vstd->dma,
vstd->offs + offsetof(uhci_td_t, td_link),
@@ -2949,16 +2949,16 @@ uhci_setup_isoc(struct usbd_pipe *pipe)
}
mutex_exit(&sc->sc_lock);
- iso->next = -1;
- iso->inuse = 0;
+ isoc->next = -1;
+ isoc->inuse = 0;
return USBD_NORMAL_COMPLETION;
bad:
while (--i >= 0)
- uhci_free_std(sc, iso->stds[i]);
+ uhci_free_std(sc, isoc->stds[i]);
mutex_exit(&sc->sc_lock);
- kmem_free(iso->stds, UHCI_VFRAMELIST_COUNT * sizeof (uhci_soft_td_t *));
+ kmem_free(isoc->stds, UHCI_VFRAMELIST_COUNT * sizeof (uhci_soft_td_t *));
return USBD_NOMEM;
}
@@ -3027,9 +3027,9 @@ uhci_device_intr_done(struct usbd_xfer *
KASSERT(sc->sc_bus.ub_usepolling || mutex_owned(&sc->sc_lock));
- npoll = upipe->u.intr.npoll;
+ npoll = upipe->intr.npoll;
for(i = 0; i < npoll; i++) {
- sqh = upipe->u.intr.qhs[i];
+ sqh = upipe->intr.qhs[i];
sqh->elink = NULL;
sqh->qh.qh_elink = htole32(UHCI_PTR_T);
usb_syncmem(&sqh->dma,
@@ -3051,7 +3051,7 @@ uhci_device_intr_done(struct usbd_xfer *
/* This alloc cannot fail since we freed the chain above. */
uhci_alloc_std_chain(upipe, sc, xfer->ux_length,
- upipe->u.intr.isread, xfer->ux_flags,
+ upipe->intr.isread, xfer->ux_flags,
&xfer->ux_dmabuf, &data, &dataend);
dataend->td.td_status |= htole32(UHCI_TD_IOC);
usb_syncmem(&dataend->dma,
@@ -3063,7 +3063,7 @@ uhci_device_intr_done(struct usbd_xfer *
#ifdef UHCI_DEBUG
if (uhcidebug > 10) {
uhci_dump_tds(data);
- uhci_dump_qh(upipe->u.intr.qhs[0]);
+ uhci_dump_qh(upipe->intr.qhs[0]);
}
#endif
DPRINTFN(10, "--- dump end ---", 0, 0, 0, 0);
@@ -3075,7 +3075,7 @@ uhci_device_intr_done(struct usbd_xfer *
ii->isdone = false;
#endif
for (i = 0; i < npoll; i++) {
- sqh = upipe->u.intr.qhs[i];
+ sqh = upipe->intr.qhs[i];
sqh->elink = data;
sqh->qh.qh_elink = htole32(data->physaddr | UHCI_PTR_TD);
usb_syncmem(&sqh->dma,
@@ -3114,18 +3114,18 @@ uhci_device_ctrl_done(struct usbd_xfer *
uhci_del_intr_info(ii); /* remove from active list */
if (upipe->pipe.up_dev->ud_speed == USB_SPEED_LOW)
- uhci_remove_ls_ctrl(sc, upipe->u.ctl.sqh);
+ uhci_remove_ls_ctrl(sc, upipe->ctrl.sqh);
else
- uhci_remove_hs_ctrl(sc, upipe->u.ctl.sqh);
+ uhci_remove_hs_ctrl(sc, upipe->ctrl.sqh);
- if (upipe->u.ctl.length != 0)
+ if (upipe->ctrl.length != 0)
uhci_free_std_chain(sc, ii->stdstart->link.std, ii->stdend);
if (len) {
usb_syncmem(&xfer->ux_dmabuf, 0, len,
isread ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
}
- usb_syncmem(&upipe->u.ctl.reqdma, 0,
+ usb_syncmem(&upipe->ctrl.reqdma, 0,
sizeof(usb_device_request_t), BUS_DMASYNC_POSTWRITE);
DPRINTF("length=%d", xfer->ux_actlen, 0, 0, 0);
@@ -3150,7 +3150,7 @@ uhci_device_bulk_done(struct usbd_xfer *
uhci_del_intr_info(ii); /* remove from active list */
- uhci_remove_bulk(sc, upipe->u.bulk.sqh);
+ uhci_remove_bulk(sc, upipe->bulk.sqh);
uhci_free_std_chain(sc, ii->stdstart, NULL);
@@ -3243,10 +3243,10 @@ uhci_device_setintr(uhci_softc_t *sc, st
npoll = (UHCI_VFRAMELIST_COUNT + ival - 1) / ival;
DPRINTF("ival=%d npoll=%d", ival, npoll, 0, 0);
- upipe->u.intr.npoll = npoll;
- upipe->u.intr.qhs =
+ upipe->intr.npoll = npoll;
+ upipe->intr.qhs =
kmem_alloc(npoll * sizeof(uhci_soft_qh_t *), KM_SLEEP);
- if (upipe->u.intr.qhs == NULL)
+ if (upipe->intr.qhs == NULL)
return USBD_NOMEM;
/*
@@ -3265,7 +3265,7 @@ uhci_device_setintr(uhci_softc_t *sc, st
DPRINTF("bw=%d offs=%d", bestbw, bestoffs, 0, 0);
mutex_enter(&sc->sc_lock);
for(i = 0; i < npoll; i++) {
- upipe->u.intr.qhs[i] = sqh = uhci_alloc_sqh(sc);
+ upipe->intr.qhs[i] = sqh = uhci_alloc_sqh(sc);
sqh->elink = NULL;
sqh->qh.qh_elink = htole32(UHCI_PTR_T);
usb_syncmem(&sqh->dma,
@@ -3278,7 +3278,7 @@ uhci_device_setintr(uhci_softc_t *sc, st
/* Enter QHs into the controller data structures. */
for(i = 0; i < npoll; i++)
- uhci_add_intr(sc, upipe->u.intr.qhs[i]);
+ uhci_add_intr(sc, upipe->intr.qhs[i]);
mutex_exit(&sc->sc_lock);
DPRINTFN(5, "returns %p", upipe, 0, 0, 0);
@@ -3323,27 +3323,27 @@ uhci_open(struct usbd_pipe *pipe)
switch (ed->bmAttributes & UE_XFERTYPE) {
case UE_CONTROL:
pipe->up_methods = &uhci_device_ctrl_methods;
- upipe->u.ctl.sqh = uhci_alloc_sqh(sc);
- if (upipe->u.ctl.sqh == NULL)
+ upipe->ctrl.sqh = uhci_alloc_sqh(sc);
+ if (upipe->ctrl.sqh == NULL)
goto bad;
- upipe->u.ctl.setup = uhci_alloc_std(sc);
- if (upipe->u.ctl.setup == NULL) {
- uhci_free_sqh(sc, upipe->u.ctl.sqh);
+ upipe->ctrl.setup = uhci_alloc_std(sc);
+ if (upipe->ctrl.setup == NULL) {
+ uhci_free_sqh(sc, upipe->ctrl.sqh);
goto bad;
}
- upipe->u.ctl.stat = uhci_alloc_std(sc);
- if (upipe->u.ctl.stat == NULL) {
- uhci_free_sqh(sc, upipe->u.ctl.sqh);
- uhci_free_std(sc, upipe->u.ctl.setup);
+ upipe->ctrl.stat = uhci_alloc_std(sc);
+ if (upipe->ctrl.stat == NULL) {
+ uhci_free_sqh(sc, upipe->ctrl.sqh);
+ uhci_free_std(sc, upipe->ctrl.setup);
goto bad;
}
err = usb_allocmem(&sc->sc_bus,
sizeof(usb_device_request_t),
- 0, &upipe->u.ctl.reqdma);
+ 0, &upipe->ctrl.reqdma);
if (err) {
- uhci_free_sqh(sc, upipe->u.ctl.sqh);
- uhci_free_std(sc, upipe->u.ctl.setup);
- uhci_free_std(sc, upipe->u.ctl.stat);
+ uhci_free_sqh(sc, upipe->ctrl.sqh);
+ uhci_free_std(sc, upipe->ctrl.setup);
+ uhci_free_std(sc, upipe->ctrl.stat);
goto bad;
}
break;
@@ -3358,8 +3358,8 @@ uhci_open(struct usbd_pipe *pipe)
return uhci_setup_isoc(pipe);
case UE_BULK:
pipe->up_methods = &uhci_device_bulk_methods;
- upipe->u.bulk.sqh = uhci_alloc_sqh(sc);
- if (upipe->u.bulk.sqh == NULL)
+ upipe->bulk.sqh = uhci_alloc_sqh(sc);
+ if (upipe->bulk.sqh == NULL)
goto bad;
break;
}