shithub: riscv

Download patch

ref: a3626a6efacc99bdfbe733758d508ed38ed8148c
parent: 8243b6600f4c8d60e520aa1b20368ae9575aabf9
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Jun 6 12:05:40 EDT 2020

usbehcipc: use 64-bit physical addresses and check pci membar type

--- a/sys/src/9/pc/usbehcipc.c
+++ b/sys/src/9/pc/usbehcipc.c
@@ -153,7 +153,7 @@
 {
 	static int already = 0;
 	int i;
-	uintptr io;
+	uvlong io;
 	Ctlr *ctlr;
 	Pcidev *p;
 	Ecapio *capio;
@@ -170,6 +170,8 @@
 			continue;
 		switch(p->ccrp){
 		case 0x20:
+			if(p->mem[0].bar & 1)
+				continue;
 			io = p->mem[0].bar & ~0x0f;
 			break;
 		default:
@@ -178,7 +180,7 @@
 		if(io == 0)
 			continue;
 
-		print("usbehci: %#x %#x: port %#p size %#x irq %d\n",
+		print("usbehci: %#x %#x: port %llux size %d irq %d\n",
 			p->vid, p->did, io, p->mem[0].size, p->intl);
 
 		ctlr = malloc(sizeof(Ctlr));
@@ -187,7 +189,8 @@
 			continue;
 		}
 
-		if((capio = vmap(io, p->mem[0].size)) == nil){
+		capio = vmap(io, p->mem[0].size);
+		if(capio == nil){
 			print("usbehci: cannot map mmio\n");
 			free(ctlr);
 			continue;
@@ -210,7 +213,7 @@
 		 */
 		if (i >= maxehci) {
 			iprint("usbehci: ignoring controllers after first %d, "
-				"at %#p\n", maxehci, io);
+				"at %.8llux\n", maxehci, io);
 			ctlrs[i] = nil;
 		}
 	}