summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-02-01 10:20:43 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2014-02-01 10:20:43 +0100
commit06bc19c28f3bd1528f669626eb9826226decabd9 (patch)
tree5e36c7281ed08853bd7667c8213548485d577156 /sys
parentdcea714680fd6836380ea2b190e3b61b8323ab22 (diff)
kernel: usb fixes for amd64
Diffstat (limited to 'sys')
-rw-r--r--sys/src/9/pc/usbehcipc.c4
-rw-r--r--sys/src/9/pc/usbuhci.c23
-rw-r--r--sys/src/9/port/usbehci.c2
3 files changed, 15 insertions, 14 deletions
diff --git a/sys/src/9/pc/usbehcipc.c b/sys/src/9/pc/usbehcipc.c
index ad624750e..241a9b07b 100644
--- a/sys/src/9/pc/usbehcipc.c
+++ b/sys/src/9/pc/usbehcipc.c
@@ -153,7 +153,7 @@ scanpci(void)
{
static int already = 0;
int i;
- ulong io;
+ uintptr io;
Ctlr *ctlr;
Pcidev *p;
Ecapio *capio;
@@ -180,7 +180,7 @@ scanpci(void)
p->vid, p->did);
continue;
}
- dprint("usbehci: %#x %#x: port %#lux size %#x irq %d\n",
+ dprint("usbehci: %#x %#x: port %#p size %#x irq %d\n",
p->vid, p->did, io, p->mem[0].size, p->intl);
ctlr = malloc(sizeof(Ctlr));
diff --git a/sys/src/9/pc/usbuhci.c b/sys/src/9/pc/usbuhci.c
index 043b52dd8..986a91c9e 100644
--- a/sys/src/9/pc/usbuhci.c
+++ b/sys/src/9/pc/usbuhci.c
@@ -245,7 +245,6 @@ struct Qh
Qh* next; /* in active or free list */
Td* tds; /* Td list in this Qh (initially, elink) */
char* tag; /* debug and align, mostly */
- ulong align;
};
/*
@@ -579,17 +578,18 @@ tdalloc(void)
{
int i;
Td *td;
- Td *pool;
+ uchar *pool;
lock(&tdpool);
if(tdpool.free == nil){
ddprint("uhci: tdalloc %d Tds\n", Incr);
- pool = xspanalloc(Incr*sizeof(Td), Align, 0);
+ pool = xspanalloc(Incr*ROUND(sizeof(Td), Align), Align, 0);
if(pool == nil)
panic("tdalloc");
for(i=Incr; --i>=0;){
- pool[i].next = tdpool.free;
- tdpool.free = &pool[i];
+ td = (Td*)(pool + i*ROUND(sizeof(Td), Align));
+ td->next = tdpool.free;
+ tdpool.free = td;
}
tdpool.nalloc += Incr;
tdpool.nfree += Incr;
@@ -602,7 +602,7 @@ tdalloc(void)
memset(td, 0, sizeof(Td));
td->link = Tdterm;
- assert(((ulong)td & 0xF) == 0);
+ assert(((uintptr)td & 0xF) == 0);
return td;
}
@@ -659,17 +659,18 @@ qhalloc(Ctlr *ctlr, Qh *prev, Qio *io, char *tag)
{
int i;
Qh *qh;
- Qh *pool;
+ uchar *pool;
lock(&qhpool);
if(qhpool.free == nil){
ddprint("uhci: qhalloc %d Qhs\n", Incr);
- pool = xspanalloc(Incr*sizeof(Qh), Align, 0);
+ pool = xspanalloc(Incr*ROUND(sizeof(Qh), Align), Align, 0);
if(pool == nil)
panic("qhalloc");
for(i=Incr; --i>=0;){
- pool[i].next = qhpool.free;
- qhpool.free = &pool[i];
+ qh = (Qh*)(pool + i*ROUND(sizeof(Qh), Align));
+ qh->next = qhpool.free;
+ qhpool.free = qh;
}
qhpool.nalloc += Incr;
qhpool.nfree += Incr;
@@ -696,7 +697,7 @@ qhalloc(Ctlr *ctlr, Qh *prev, Qio *io, char *tag)
iunlock(ctlr);
}
- assert(((ulong)qh & 0xF) == 0);
+ assert(((uintptr)qh & 0xF) == 0);
return qh;
}
diff --git a/sys/src/9/port/usbehci.c b/sys/src/9/port/usbehci.c
index 66546675c..45b48145a 100644
--- a/sys/src/9/port/usbehci.c
+++ b/sys/src/9/port/usbehci.c
@@ -424,7 +424,7 @@ edalloc(void)
unlock(&edpool);
memset(ed, 0, sizeof(Ed)); /* safety */
- assert(((ulong)ed & 0xF) == 0);
+ assert(((uintptr)ed & 0xF) == 0);
return ed;
}