]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/pc/usbuhci.c
merge
[plan9front.git] / sys / src / 9 / pc / usbuhci.c
index 92757b9b0e2d44d501238fec858eda07a6762998..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"
 
@@ -2129,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;
@@ -2144,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));
@@ -2319,6 +2322,8 @@ reset(Hci *hp)
                return -1;
 
        p = ctlr->pcidev;
+       pcienable(p);
+
        hp->aux = ctlr;
        hp->port = ctlr->port;
        hp->irq = p->intl;
@@ -2328,6 +2333,8 @@ reset(Hci *hp)
        uhcireset(ctlr);
        uhcimeminit(ctlr);
 
+       pcisetbme(p);
+
        /*
         * Linkage to the generic HCI driver.
         */
@@ -2345,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;