shithub: riscv

Download patch

ref: 1d62e1d8c88c4698a7d8da6a510fb1c7d6da9cf1
parent: 336df4d4aed17394d5a5fc8ae1f1c24df4c1cf5e
author: cinap_lenrek <[email protected]>
date: Fri Sep 14 23:17:17 EDT 2012

usb: dont give up on unassigned pci irq line in hci driver

sometimes, the bios does not assign a interrupt line for pci
devices. this should not be fatal in case of mp ineterrupts
as long as there is intpin or msi can be used.

warn in intrenable() if we hit such a interrupt and set
irq to -1 to prevent it from getting enabled on the pic
or as isa interrupt in apic mode.

--- a/sys/src/9/pc/trap.c
+++ b/sys/src/9/pc/trap.c
@@ -40,6 +40,12 @@
 		return;
 	}
 
+	if(tbdf != BUSUNKNOWN && (irq == 0xff || irq == 0)){
+		print("intrenable: got unassigned irq %d, tbdf 0x%uX for %s\n",
+			irq, tbdf, name);
+		irq = -1;
+	}
+
 	if((v = xalloc(sizeof(Vctl))) == nil)
 		panic("intrenable: out of memory");
 	v->isintr = 1;
--- a/sys/src/9/pc/usbehcipc.c
+++ b/sys/src/9/pc/usbehcipc.c
@@ -172,10 +172,6 @@
 				p->vid, p->did);
 			continue;
 		}
-		if(p->intl == 0xff || p->intl == 0) {
-			print("usbehci: no irq assigned for port %#lux\n", io);
-			continue;
-		}
 		dprint("usbehci: %#x %#x: port %#lux size %#x irq %d\n",
 			p->vid, p->did, io, p->mem[0].size, p->intl);
 
--- a/sys/src/9/pc/usbohci.c
+++ b/sys/src/9/pc/usbohci.c
@@ -2382,10 +2382,6 @@
 			print("usbohci: failed to map registers\n");
 			continue;
 		}
-		if(p->intl == 0xFF || p->intl == 0) {
-			print("usbohci: no irq assigned for port %#lux\n", mem);
-			continue;
-		}
 
 		ctlr = malloc(sizeof(Ctlr));
 		if(ctlr == nil){
--- a/sys/src/9/pc/usbuhci.c
+++ b/sys/src/9/pc/usbuhci.c
@@ -2137,10 +2137,6 @@
 			print("usbuhci: port %#ux in use\n", io);
 			continue;
 		}
-		if(p->intl == 0xFF || p->intl == 0){
-			print("usbuhci: no irq assigned for port %#ux\n", io);
-			continue;
-		}
 
 		dprint("uhci: %#x %#x: port %#ux size %#x irq %d\n",
 			p->vid, p->did, io, p->mem[4].size, p->intl);