summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/usbehcipc.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/usbehcipc.c
parent4d7c195804991b9c762f9a859679282c7014bbbb (diff)
pc drivers: use pcienable() to handle device power up and missing initialization
Diffstat (limited to 'sys/src/9/pc/usbehcipc.c')
-rw-r--r--sys/src/9/pc/usbehcipc.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/src/9/pc/usbehcipc.c b/sys/src/9/pc/usbehcipc.c
index 29a49bb6f..0618de1bb 100644
--- a/sys/src/9/pc/usbehcipc.c
+++ b/sys/src/9/pc/usbehcipc.c
@@ -186,12 +186,16 @@ scanpci(void)
print("usbehci: no memory\n");
continue;
}
+
+ if((capio = vmap(io, p->mem[0].size)) == nil){
+ print("usbehci: cannot map mmio\n");
+ free(ctlr);
+ 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);
- pcisetpms(p, 0);
+ ctlr->capio = capio;
for(i = 0; i < Nhcis; i++)
if(ctlrs[i] == nil){
ctlrs[i] = ctlr;
@@ -248,6 +252,8 @@ reset(Hci *hp)
return -1;
p = ctlr->pcidev;
+ pcienable(p);
+
hp->aux = ctlr;
hp->port = ctlr->base;
hp->irq = p->intl;
@@ -263,8 +269,11 @@ reset(Hci *hp)
capio->parms & 0x40 ? "explicit" : "automatic",
capio->parms & 0x10 ? "" : "no ", hp->nports);
+ ctlr->opio = (Eopio*)((uintptr)capio + (capio->cap & 0xff));
ehcireset(ctlr);
ehcimeminit(ctlr);
+
+ pcisetbme(p);
/*
* Linkage to the generic HCI driver.