shithub: riscv

Download patch

ref: f9839ed0a29a0598fa383f9c5e8d5c366f93596a
parent: 83876083c9bba29e01ce1a82cba77d84f6382f07
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Oct 5 20:29:05 EDT 2018

usbehci, usbxhci: add *noehcihandoff= and *noxhcihandoff= parameters

on Samsung ATIV Smart PC Pro XE00T1C-A01CL, the EHCI handoff
causes the system to freeze in UEFI mode as soon as we assert
the os semaphore bit.

until a general solution is found, provide these parameters to
disable the handoff for now as it seems to otherwise work fine.

--- a/sys/src/9/pc/usbehcipc.c
+++ b/sys/src/9/pc/usbehcipc.c
@@ -41,7 +41,7 @@
 	off = ehciecap(ctlr, Clegacy);
 	if(off == -1)
 		return;
-	if(pcicfgr8(ctlr->pcidev, off+CLbiossem) != 0){
+	if(getconf("*noehcihandoff") == nil && pcicfgr8(ctlr->pcidev, off+CLbiossem) != 0){
 		dprint("ehci %#p: bios active, taking over...\n", ctlr->capio);
 		pcicfgw8(ctlr->pcidev, off+CLossem, 1);
 		for(i = 0; i < 100; i++){
--- a/sys/src/9/pc/usbxhci.c
+++ b/sys/src/9/pc/usbxhci.c
@@ -393,11 +393,13 @@
 
 	if((r = xecp(ctlr, 1, nil)) == nil)
 		return;
-	r[0] |= 1<<24;		/* request ownership */
-	for(i = 0; (r[0] & (1<<16)) != 0 && i<100; i++)
-		tsleep(&up->sleep, return0, nil, 10);
+	if(getconf("*noxhcihandoff") == nil){
+		r[0] |= 1<<24;		/* request ownership */
+		for(i = 0; (r[0] & (1<<16)) != 0 && i<100; i++)
+			tsleep(&up->sleep, return0, nil, 10);
+		r[0] &= ~(1<<16);	/* in case of timeout */
+	}
 	r[1] = 0;		/* disable SMI interrupts */
-	r[0] &= ~(1<<16);	/* in case of timeout */
 }
 
 static void