kernel: usb fixes for amd64
This commit is contained in:
parent
dcea714680
commit
06bc19c28f
3 changed files with 15 additions and 14 deletions
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue