summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/usbohci.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2018-10-07 22:28:21 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2018-10-07 22:28:21 +0200
commit9fec0e736081cd155afb6a413b7641b93faed519 (patch)
treea91f5bb3e967e97ddd00c727e0d2bfd65669f93d /sys/src/9/pc/usbohci.c
parent4d7c195804991b9c762f9a859679282c7014bbbb (diff)
pc drivers: use pcienable() to handle device power up and missing initialization
Diffstat (limited to 'sys/src/9/pc/usbohci.c')
-rw-r--r--sys/src/9/pc/usbohci.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/src/9/pc/usbohci.c b/sys/src/9/pc/usbohci.c
index 588a9cebb..d24f2388e 100644
--- a/sys/src/9/pc/usbohci.c
+++ b/sys/src/9/pc/usbohci.c
@@ -2405,12 +2405,14 @@ scanpci(void)
print("ohci: no memory\n");
continue;
}
+ if((ctlr->ohci = vmap(io, p->mem[0].size)) == nil){
+ print("ohci: can't map ohci\n");
+ free(ctlr);
+ continue;
+ }
ctlr->pcidev = p;
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);
for(i = 0; i < Nhcis; i++)
if(ctlrs[i] == nil){
ctlrs[i] = ctlr;
@@ -2577,11 +2579,15 @@ reset(Hci *hp)
iunlock(&resetlck);
if(ctlrs[i] == nil || i == Nhcis)
return -1;
- if(ctlr->ohci->control == ~0)
- return -1;
-
p = ctlr->pcidev;
+ pcienable(p);
+
+ if(ctlr->ohci->control == ~0){
+ pcidisable(p);
+ return -1;
+ }
+
hp->aux = ctlr;
hp->port = ctlr->base;
hp->irq = p->intl;
@@ -2591,6 +2597,8 @@ reset(Hci *hp)
ohcireset(ctlr);
ohcimeminit(ctlr);
+ pcisetbme(p);
+
/*
* Linkage to the generic HCI driver.
*/