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;
|
static int already = 0;
|
||||||
int i;
|
int i;
|
||||||
ulong io;
|
uintptr io;
|
||||||
Ctlr *ctlr;
|
Ctlr *ctlr;
|
||||||
Pcidev *p;
|
Pcidev *p;
|
||||||
Ecapio *capio;
|
Ecapio *capio;
|
||||||
|
@ -180,7 +180,7 @@ scanpci(void)
|
||||||
p->vid, p->did);
|
p->vid, p->did);
|
||||||
continue;
|
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);
|
p->vid, p->did, io, p->mem[0].size, p->intl);
|
||||||
|
|
||||||
ctlr = malloc(sizeof(Ctlr));
|
ctlr = malloc(sizeof(Ctlr));
|
||||||
|
|
|
@ -245,7 +245,6 @@ struct Qh
|
||||||
Qh* next; /* in active or free list */
|
Qh* next; /* in active or free list */
|
||||||
Td* tds; /* Td list in this Qh (initially, elink) */
|
Td* tds; /* Td list in this Qh (initially, elink) */
|
||||||
char* tag; /* debug and align, mostly */
|
char* tag; /* debug and align, mostly */
|
||||||
ulong align;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -579,17 +578,18 @@ tdalloc(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Td *td;
|
Td *td;
|
||||||
Td *pool;
|
uchar *pool;
|
||||||
|
|
||||||
lock(&tdpool);
|
lock(&tdpool);
|
||||||
if(tdpool.free == nil){
|
if(tdpool.free == nil){
|
||||||
ddprint("uhci: tdalloc %d Tds\n", Incr);
|
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)
|
if(pool == nil)
|
||||||
panic("tdalloc");
|
panic("tdalloc");
|
||||||
for(i=Incr; --i>=0;){
|
for(i=Incr; --i>=0;){
|
||||||
pool[i].next = tdpool.free;
|
td = (Td*)(pool + i*ROUND(sizeof(Td), Align));
|
||||||
tdpool.free = &pool[i];
|
td->next = tdpool.free;
|
||||||
|
tdpool.free = td;
|
||||||
}
|
}
|
||||||
tdpool.nalloc += Incr;
|
tdpool.nalloc += Incr;
|
||||||
tdpool.nfree += Incr;
|
tdpool.nfree += Incr;
|
||||||
|
@ -602,7 +602,7 @@ tdalloc(void)
|
||||||
|
|
||||||
memset(td, 0, sizeof(Td));
|
memset(td, 0, sizeof(Td));
|
||||||
td->link = Tdterm;
|
td->link = Tdterm;
|
||||||
assert(((ulong)td & 0xF) == 0);
|
assert(((uintptr)td & 0xF) == 0);
|
||||||
return td;
|
return td;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,17 +659,18 @@ qhalloc(Ctlr *ctlr, Qh *prev, Qio *io, char *tag)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Qh *qh;
|
Qh *qh;
|
||||||
Qh *pool;
|
uchar *pool;
|
||||||
|
|
||||||
lock(&qhpool);
|
lock(&qhpool);
|
||||||
if(qhpool.free == nil){
|
if(qhpool.free == nil){
|
||||||
ddprint("uhci: qhalloc %d Qhs\n", Incr);
|
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)
|
if(pool == nil)
|
||||||
panic("qhalloc");
|
panic("qhalloc");
|
||||||
for(i=Incr; --i>=0;){
|
for(i=Incr; --i>=0;){
|
||||||
pool[i].next = qhpool.free;
|
qh = (Qh*)(pool + i*ROUND(sizeof(Qh), Align));
|
||||||
qhpool.free = &pool[i];
|
qh->next = qhpool.free;
|
||||||
|
qhpool.free = qh;
|
||||||
}
|
}
|
||||||
qhpool.nalloc += Incr;
|
qhpool.nalloc += Incr;
|
||||||
qhpool.nfree += Incr;
|
qhpool.nfree += Incr;
|
||||||
|
@ -696,7 +697,7 @@ qhalloc(Ctlr *ctlr, Qh *prev, Qio *io, char *tag)
|
||||||
iunlock(ctlr);
|
iunlock(ctlr);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(((ulong)qh & 0xF) == 0);
|
assert(((uintptr)qh & 0xF) == 0);
|
||||||
return qh;
|
return qh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -424,7 +424,7 @@ edalloc(void)
|
||||||
unlock(&edpool);
|
unlock(&edpool);
|
||||||
|
|
||||||
memset(ed, 0, sizeof(Ed)); /* safety */
|
memset(ed, 0, sizeof(Ed)); /* safety */
|
||||||
assert(((ulong)ed & 0xF) == 0);
|
assert(((uintptr)ed & 0xF) == 0);
|
||||||
return ed;
|
return ed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue