]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/pc/usbuhci.c
merge
[plan9front.git] / sys / src / 9 / pc / usbuhci.c
index 8b5d54b75fcfb32f64cbb8e7212a519a2d5ca697..a5783d546f6554cb61ac5a5f3e71db6a6b8d06a9 100644 (file)
@@ -14,6 +14,7 @@
 #include       "dat.h"
 #include       "fns.h"
 #include       "io.h"
+#include       "../port/pci.h"
 #include       "../port/error.h"
 #include       "../port/usb.h"
 
@@ -958,10 +959,6 @@ interrupt(Ureg*, void *a)
        }
        OUTS(Status, sts & Sall);
        cmd = INS(Cmd);
-       if(cmd & Crun == 0){
-               iprint("uhci %#ux: not running: uhci bug?\n", ctlr->port);
-               /* BUG: should abort everything in this case */
-       }
        if(debug > 1){
                frptr = INL(Flbaseadd);
                frno = INL(Frnum);
@@ -2133,7 +2130,9 @@ scanpci(void)
                        continue;
                switch(p->ccrp){
                case 0:
-                       io = p->mem[4].bar & ~0x0F;
+                       if((p->mem[4].bar & 1) == 0)
+                               continue;
+                       io = p->mem[4].bar & ~3;
                        break;
                default:
                        continue;
@@ -2148,7 +2147,7 @@ scanpci(void)
                        continue;
                }
 
-               dprint("uhci: %#x %#x: port %#ux size %#x irq %d\n",
+               print("uhci: %#x %#x: port %#ux size %#x irq %d\n",
                        p->vid, p->did, io, p->mem[4].size, p->intl);
 
                ctlr = malloc(sizeof(Ctlr));
@@ -2323,6 +2322,8 @@ reset(Hci *hp)
                return -1;
 
        p = ctlr->pcidev;
+       pcienable(p);
+
        hp->aux = ctlr;
        hp->port = ctlr->port;
        hp->irq = p->intl;
@@ -2332,6 +2333,8 @@ reset(Hci *hp)
        uhcireset(ctlr);
        uhcimeminit(ctlr);
 
+       pcisetbme(p);
+
        /*
         * Linkage to the generic HCI driver.
         */
@@ -2349,14 +2352,6 @@ reset(Hci *hp)
        hp->shutdown = shutdown;
        hp->debug = setdebug;
        hp->type = "uhci";
-
-       /*
-        * IRQ2 doesn't really exist, it's used to gang the interrupt
-        * controllers together. A device set to IRQ2 will appear on
-        * the second interrupt controller as IRQ9.
-        */
-       if(hp->irq == 2)
-               hp->irq = 9;
        intrenable(hp->irq, hp->interrupt, hp, hp->tbdf, hp->type);
 
        return 0;