summaryrefslogtreecommitdiff
path: root/sys/src/9
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2017-07-31 17:36:56 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2017-07-31 17:36:56 +0200
commit5f23d78f068fcc33555705ee43933fc8ed8b4fc0 (patch)
tree72e76902a083cf5e231e732579603c92ac15f1a3 /sys/src/9
parent48352be82574e39a54e44b5ed38d407dcb66a0bb (diff)
usbohci, usbehci, usbxhci: save mmio base address in ctlr, cant PADDR() on 386...
Diffstat (limited to 'sys/src/9')
-rw-r--r--sys/src/9/pc/usbehci.h1
-rw-r--r--sys/src/9/pc/usbehcipc.c11
-rw-r--r--sys/src/9/pc/usbohci.c24
-rw-r--r--sys/src/9/pc/usbxhci.c10
4 files changed, 23 insertions, 23 deletions
diff --git a/sys/src/9/pc/usbehci.h b/sys/src/9/pc/usbehci.h
index 885bdc606..4b0c9c3b0 100644
--- a/sys/src/9/pc/usbehci.h
+++ b/sys/src/9/pc/usbehci.h
@@ -170,6 +170,7 @@ struct Ctlr
Lock; /* for ilock. qh lists and basic ctlr I/O */
QLock portlck; /* for port resets/enable... (and doorbell) */
int active; /* in use or not */
+ uintptr base;
Pcidev* pcidev;
Ecapio* capio; /* Capability i/o regs */
Eopio* opio; /* Operational i/o regs */
diff --git a/sys/src/9/pc/usbehcipc.c b/sys/src/9/pc/usbehcipc.c
index 35744e93c..ed8eafab7 100644
--- a/sys/src/9/pc/usbehcipc.c
+++ b/sys/src/9/pc/usbehcipc.c
@@ -175,11 +175,9 @@ scanpci(void)
default:
continue;
}
- if(io == 0){
- print("usbehci: %x %x: failed to map registers\n",
- p->vid, p->did);
+ if(io == 0)
continue;
- }
+
print("usbehci: %#x %#x: port %#p size %#x irq %d\n",
p->vid, p->did, io, p->mem[0].size, p->intl);
@@ -189,6 +187,7 @@ scanpci(void)
continue;
}
ctlr->pcidev = p;
+ ctlr->base = io;
capio = ctlr->capio = vmap(io, p->mem[0].size);
ctlr->opio = (Eopio*)((uintptr)capio + (capio->cap & 0xff));
pcisetbme(p);
@@ -239,7 +238,7 @@ reset(Hci *hp)
for(i = 0; i < Nhcis && ctlrs[i] != nil; i++){
ctlr = ctlrs[i];
if(ctlr->active == 0)
- if(hp->port == 0 || hp->port == PADDR(ctlr->capio)){
+ if(hp->port == 0 || hp->port == ctlr->base){
ctlr->active = 1;
break;
}
@@ -250,7 +249,7 @@ reset(Hci *hp)
p = ctlr->pcidev;
hp->aux = ctlr;
- hp->port = PADDR(ctlr->capio);
+ hp->port = ctlr->base;
hp->irq = p->intl;
hp->tbdf = p->tbdf;
diff --git a/sys/src/9/pc/usbohci.c b/sys/src/9/pc/usbohci.c
index ef9b07df9..41c0b9b2e 100644
--- a/sys/src/9/pc/usbohci.c
+++ b/sys/src/9/pc/usbohci.c
@@ -350,6 +350,7 @@ struct Ctlr
Qtree* tree; /* tree for t Ep i/o */
int ntree; /* number of dummy Eds in tree */
Pcidev* pcidev;
+ uintptr base;
};
#define dqprint if(debug || io && io->debug)print
@@ -2378,7 +2379,7 @@ init(Hci *hp)
static void
scanpci(void)
{
- ulong mem;
+ uintptr io;
Ctlr *ctlr;
Pcidev *p;
int i;
@@ -2392,24 +2393,21 @@ scanpci(void)
/*
* Find Ohci controllers (Programming Interface = 0x10).
*/
- if(p->ccrb != Pcibcserial || p->ccru != Pciscusb ||
- p->ccrp != 0x10)
+ if(p->ccrb != Pcibcserial || p->ccru != Pciscusb || p->ccrp != 0x10)
continue;
- mem = p->mem[0].bar & ~0x0F;
- dprint("ohci: %x/%x port 0x%lux size 0x%x irq %d\n",
- p->vid, p->did, mem, p->mem[0].size, p->intl);
- if(mem == 0){
- print("ohci: failed to map registers\n");
+ io = p->mem[0].bar & ~0x0F;
+ if(io == 0)
continue;
- }
-
+ print("usbohci: %#x %#x: port %#p size %#x irq %d\n",
+ p->vid, p->did, io, p->mem[0].size, p->intl);
ctlr = malloc(sizeof(Ctlr));
if(ctlr == nil){
print("ohci: no memory\n");
continue;
}
ctlr->pcidev = p;
- ctlr->ohci = vmap(mem, p->mem[0].size);
+ ctlr->base = io;
+ ctlr->ohci = vmap(io, p->mem[0].size);
dprint("scanpci: ctlr %#p, ohci %#p\n", ctlr, ctlr->ohci);
pcisetbme(p);
pcisetpms(p, 0);
@@ -2571,7 +2569,7 @@ reset(Hci *hp)
for(i = 0; i < Nhcis && ctlrs[i] != nil; i++){
ctlr = ctlrs[i];
if(ctlr->active == 0)
- if(hp->port == 0 || hp->port == PADDR(ctlr->ohci)){
+ if(hp->port == 0 || hp->port == ctlr->base){
ctlr->active = 1;
break;
}
@@ -2585,7 +2583,7 @@ reset(Hci *hp)
p = ctlr->pcidev;
hp->aux = ctlr;
- hp->port = PADDR(ctlr->ohci);
+ hp->port = ctlr->base;
hp->irq = p->intl;
hp->tbdf = p->tbdf;
ctlr->nports = hp->nports = ctlr->ohci->rhdesca & 0xff;
diff --git a/sys/src/9/pc/usbxhci.c b/sys/src/9/pc/usbxhci.c
index dcb1ab10f..858bf95ed 100644
--- a/sys/src/9/pc/usbxhci.c
+++ b/sys/src/9/pc/usbxhci.c
@@ -238,6 +238,7 @@ struct Ctlr
void (*setrptr)(u32int*, u64int);
void *active;
+ uintptr base;
};
struct Epio
@@ -1437,6 +1438,8 @@ scanpci(void)
io = p->mem[0].bar & ~0x0f;
if(io == 0)
continue;
+ print("usbxhci: %#x %#x: port %#p size %#x irq %d\n",
+ p->vid, p->did, io, p->mem[0].size, p->intl);
mmio = vmap(io, p->mem[0].size);
if(mmio == nil){
print("usbxhci: cannot map registers\n");
@@ -1448,8 +1451,7 @@ scanpci(void)
vunmap(mmio, p->mem[0].size);
continue;
}
- print("usbxhci: %#x %#x: port %#p size %#x irq %d\n",
- p->vid, p->did, io, p->mem[0].size, p->intl);
+ ctlr->base = io;
ctlr->active = nil;
ctlr->pcidev = p;
ctlr->mmio = mmio;
@@ -1481,7 +1483,7 @@ reset(Hci *hp)
for(i = 0; i < nelem(ctlrs) && ctlrs[i] != nil; i++){
ctlr = ctlrs[i];
if(ctlr->active == nil)
- if(hp->port == 0 || hp->port == PADDR(ctlr->mmio)){
+ if(hp->port == 0 || hp->port == ctlr->base){
ctlr->active = hp;
goto Found;
}
@@ -1490,7 +1492,7 @@ reset(Hci *hp)
Found:
hp->aux = ctlr;
- hp->port = PADDR(ctlr->mmio);
+ hp->port = ctlr->base;
hp->irq = ctlr->pcidev->intl;
hp->tbdf = ctlr->pcidev->tbdf;