use u32int, and not ulong to indicate hardware dictated sizes. Reference: /n/atom/patch/applied/moreusbtypes Date: Fri Jun 6 19:28:44 CES 2014 Signed-off-by: quanstro@quanstro.net --- /sys/src/9/port/usbehci.c Fri Jun 6 19:28:17 2014 +++ /sys/src/9/port/usbehci.c Fri Jun 6 19:28:17 2014 @@ -173,7 +173,7 @@ { int nel; int depth; - ulong* bw; + uint* bw; Qh** root; }; @@ -188,11 +188,11 @@ int usbid; /* usb address for endpoint/device */ int toggle; /* Tddata0/Tddata1 */ int tok; /* Tdtoksetup, Tdtokin, Tdtokout */ - ulong iotime; /* last I/O time; to hold interrupt polls */ + uint iotime; /* last I/O time in ms; to hold interrupt polls */ int debug; /* debug flag from the endpoint */ char* err; /* error string */ char* tag; /* debug (no room in Qh for this) */ - ulong bw; + uint bw; }; struct Ctlio @@ -213,13 +213,13 @@ uchar* data; /* iso data buffers if not embedded */ char* err; /* error string */ int nerrs; /* nb of consecutive I/O errors */ - ulong maxsize; /* ntds * ep->maxpkt */ + uint maxsize; /* ntds * ep->maxpkt */ long nleft; /* number of bytes left from last write */ int debug; /* debug flag from the endpoint */ int delay; /* max number of bytes to buffer */ int hs; /* is high speed? */ Isoio* next; /* in list of active Isoios */ - ulong td0frno; /* first frame used in ctlr */ + uint td0frno; /* first frame used in ctlr */ union{ Itd* tdi; /* next td processed by interrupt */ Sitd* stdi; @@ -547,10 +547,10 @@ } static int -pickschedq(Qtree *qt, int pollival, ulong bw, ulong limit) +pickschedq(Qtree *qt, int pollival, uint bw, uint limit) { int i, j, d, upperb, q; - ulong best, worst, total; + uint best, worst, total; d = flog2lower(pollival); if(d > qt->depth) @@ -580,11 +580,11 @@ { int q; Qh *tqh; - ulong bw; + uint bw; bw = qh->io->bw; q = pickschedq(ctlr->tree, pollival, 0, ~0); - ddqprint("ehci: sched %#p q %d, ival %d, bw %uld\n", + ddqprint("ehci: sched %#p q %d, ival %d, bw %ud\n", qh->io, q, pollival, bw); if(q < 0){ print("ehci: no room for ed\n"); @@ -608,7 +608,7 @@ int q; Qh *prev, *this, *next; Qh **l; - ulong bw; + uint bw; bw = qh->io->bw; q = qh->sched; @@ -1061,11 +1061,11 @@ print("\n"); return; } - print("iso %#p %s %s speed state %d nframes %d maxsz %uld", + print("iso %#p %s %s speed state %d nframes %d maxsz %ud", iso, iso->tok == Tdtokin ? "in" : "out", iso->hs ? "high" : "full", iso->state, iso->nframes, iso->maxsize); - print(" td0 %uld tdi %#p tdu %#p data %#p\n", + print(" td0 %ud tdi %#p tdu %#p data %#p\n", iso->td0frno, iso->tdi, iso->tdu, iso->data); if(iso->err != nil) print("\terr %s\n", iso->err); @@ -1242,7 +1242,7 @@ itdinit(Isoio *iso, Itd *td) { int p, t; - ulong pa, tsize, size; + u32int pa, tsize, size; /* * BUG: This does not put an integral number of samples @@ -1374,7 +1374,7 @@ iso->err = ierrmsg(err); diprint("isohsintr: tdi %#p error %#ux %s\n", tdi, err, iso->err); - diprint("ctlr load %uld\n", ctlr->load); + diprint("ctlr load %ud\n", ctlr->load); } tdi->ndata = 0; }else @@ -1438,7 +1438,7 @@ iso->err = serrmsg(err); diprint("isofsintr: tdi %#p error %#ux %s\n", stdi, err, iso->err); - diprint("ctlr load %uld\n", ctlr->load); + diprint("ctlr load %ud\n", ctlr->load); } stdi->ndata = 0; }else @@ -1775,7 +1775,7 @@ seprintio(char *s, char *e, Qio *io, char *pref) { s = seprint(s,e,"%s io %#p qh %#p id %#x", pref, io, io->qh, io->usbid); - s = seprint(s,e," iot %ld", io->iotime); + s = seprint(s,e," iot %d", io->iotime); s = seprint(s,e," tog %#x tok %#x err %s", io->toggle, io->tok, io->err); return s; } @@ -2273,7 +2273,7 @@ } static void -epiowait(Hci *hp, Qio *io, int tmout, ulong load) +epiowait(Hci *hp, Qio *io, int tmout, uint load) { Qh *qh; int timedout; @@ -2347,7 +2347,7 @@ { int saved, ntds, tmout; long n, tot; - ulong load; + uint load; char *err; char buf[128]; uchar *c; @@ -2358,7 +2358,7 @@ ctlr = ep->hp->aux; io->debug = ep->debug; tmout = ep->tmout; - ddeprint("epio: %s ep%d.%d io %#p count %ld load %uld\n", + ddeprint("epio: %s ep%d.%d io %#p count %ld load %ud\n", io->tok == Tdtokin ? "in" : "out", ep->dev->nb, ep->nb, io, count, ctlr->load); if((ehcidebug > 1 || ep->debug > 1) && io->tok != Tdtokin){ @@ -2409,7 +2409,7 @@ ltd->csw |= Tdioc; /* the last one interrupts */ coherence(); - ddeprint("ehci: load %uld ctlr load %uld\n", load, ctlr->load); + ddeprint("ehci: load %ud ctlr load %ud\n", load, ctlr->load); if(ehcidebug > 1 || ep->debug > 1) dumptd(td0, "epio: put: "); @@ -2487,7 +2487,7 @@ Qio *io; Isoio *iso; char buf[160]; - ulong delta; + uint delta; ddeprint("ehci: epread\n"); if(ep->aux == nil) @@ -2647,7 +2647,7 @@ Qio *io; Ctlio *cio; Isoio *iso; - ulong delta; + uint delta; pollcheck(ep->hp); @@ -2684,7 +2684,7 @@ long left; Sitd *td, *ltd; int i; - ulong frno; + uint frno; left = 0; ltd = nil; @@ -2731,7 +2731,8 @@ { int ival, p; long left; - ulong frno, i, pa; + u32int pa; + uint frno, i; Itd *ltd, *td; iso->hs = 1; @@ -2779,7 +2780,7 @@ int ival; /* pollival in ms */ int tpf; /* tds per frame */ int i, n, w, woff; - ulong frno; + uint frno; Isoio *iso; iso = ep->aux; @@ -2817,7 +2818,7 @@ ctlr->load += ep->load; ctlr->isoload += ep->load; ctlr->nreqs++; - dprint("ehci: load %uld isoload %uld\n", ctlr->load, ctlr->isoload); + dprint("ehci: load %ud isoload %ud\n", ctlr->load, ctlr->isoload); diprint("iso nframes %d pollival %uld ival %d maxpkt %uld ntds %d\n", iso->nframes, ep->pollival, ival, ep->maxpkt, ep->ntds); iunlock(ctlr); @@ -2992,7 +2993,7 @@ } static void -cancelisoio(Ctlr *ctlr, Isoio *iso, int pollival, ulong load) +cancelisoio(Ctlr *ctlr, Isoio *iso, int pollival, uint load) { int frno, i, n, t, w, woff; u32int *lp, *tp; @@ -3152,7 +3153,7 @@ mkqhtree(Ctlr *ctlr) { int i, n, d, o, leaf0, depth; - ulong leafs[Nintrleafs]; + u32int leafs[Nintrleafs]; Qh *qh; Qh **tree; Qtree *qt; @@ -3213,7 +3214,7 @@ Eopio *opio; opio = ctlr->opio; - frsize = ctlr->nframes * sizeof(ulong); + frsize = ctlr->nframes * sizeof(u32int); assert((frsize & 0xFFF) == 0); /* must be 4k aligned */ ctlr->frames = mallocalign(frsize, frsize, 0, 0); if(ctlr->frames == nil) --- /sys/src/9/omap/usbehciomap.c Fri Jun 6 19:28:17 2014 +++ /sys/src/9/omap/usbehciomap.c Fri Jun 6 19:28:17 2014 @@ -68,7 +68,7 @@ ctlr->nframes = 256; break; default: - panic("ehci: unknown fls %ld", opio->cmd & Cflsmask); + panic("ehci: unknown fls %d", opio->cmd & Cflsmask); } coherence(); dprint("ehci: %d frames\n", ctlr->nframes); --- /sys/src/9/omap/usbehci.h Fri Jun 6 19:28:18 2014 +++ /sys/src/9/omap/usbehci.h Fri Jun 6 19:28:18 2014 @@ -46,8 +46,8 @@ int ntree; /* number of dummy qhs in tree */ Qh* intrqhs; /* list of (not dummy) qhs in tree */ Isoio* iso; /* list of active Iso I/O */ - ulong load; - ulong isoload; + uint load; + uint isoload; int nintr; /* number of interrupts attended */ int ntdintr; /* number of intrs. with something to do */ int nqhintr; /* number of async td intrs. */ @@ -79,14 +79,14 @@ typedef struct Uhh Uhh; struct Uhh { - ulong revision; /* ro */ + u32int revision; /* ro */ uchar _pad0[0x10-0x4]; - ulong sysconfig; - ulong sysstatus; /* ro */ + u32int sysconfig; + u32int sysstatus; /* ro */ uchar _pad1[0x40-0x18]; - ulong hostconfig; - ulong debug_csr; + u32int hostconfig; + u32int debug_csr; }; enum {