From: cinap_lenrek@felloff.net
To: 9front@9front.org
Subject: Re: [9front] 9front on Raspberry Pi 400
Date: Sun, 24 Jan 2021 16:01:07 +0100 [thread overview]
Message-ID: <5B3B970A411ADBCC5D32FFDFAB1E4D3E@felloff.net> (raw)
In-Reply-To: <C46BC2704F7391F743BBD3D3620A4041@felloff.net>
Ok, i also added a bunch of debug prints into the
xhci driver (in addition to the GIC debug prints)
and updated the pi9 kernels in these url locations:
http://felloff.net/usr/cinap_lenrek/9pi4 (kernel for sdcard)
http://felloff.net/usr/cinap_lenrek/s9pi4 (a.out for debug symbols)
http://felloff.net/usr/cinap_lenrek/usbxhci.c (changed file)
sha1 checksums:
0ddfe8a7c00164dc8a07c71219b3ab5eba48da6e 9pi4
2f7bc6b6f6ae514b977c6411f27d548eb183d5b1 s9pi4
and the diff:
diff -r 5c327eddc496 sys/src/9/port/usbxhci.c
--- a/sys/src/9/port/usbxhci.c Sat Jan 23 20:36:09 2021 -0800
+++ b/sys/src/9/port/usbxhci.c Sun Jan 24 15:53:30 2021 +0100
@@ -397,18 +397,32 @@
return nil;
}
+static int
+pollwait(u32int *reg, u32int mask, u32int val, int timeout)
+{
+ while((*reg & mask) != val) {
+ if(timeout <= 0)
+ return -1;
+ timeout -= 10;
+ if(up != nil && islo())
+ tsleep(&up->sleep, return0, nil, 10);
+ else
+ delay(10);
+ }
+ return 0;
+}
+
static void
handoff(Ctlr *ctlr)
{
u32int *r;
- int i;
if((r = xecp(ctlr, 1, nil)) == nil)
return;
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);
+ if(pollwait(&r[0], 1<<16, 0, 1000) < 0)
+ print("xhci %llux: handoff timeout\n", ctlr->base);
}
/* disable SMI interrupts */
r[1] &= 7<<1 | 255<<5 | 7<<17 | 7<<29;
@@ -421,11 +435,9 @@
shutdown(Hci *hp)
{
Ctlr *ctlr = hp->aux;
- int i;
ctlr->opr[USBCMD] = 0;
- for(i=0; (ctlr->opr[USBSTS] & HCH) == 0 && i < 10; i++)
- delay(10);
+ pollwait(&ctlr->opr[USBSTS], HCH, HCH, 100);
intrdisable(ctlr->pcidev->intl, hp->interrupt, hp, ctlr->pcidev->tbdf, hp->type);
pcidisable(ctlr->pcidev);
}
@@ -477,13 +489,16 @@
ctlr->hccparams = ctlr->mmio[HCCPARAMS];
handoff(ctlr);
- for(i=0; (ctlr->opr[USBSTS] & CNR) != 0 && i<100; i++)
- tsleep(&up->sleep, return0, nil, 10);
+ if(pollwait(&ctlr->opr[USBSTS], CNR, 0, 1000) < 0)
+ print("xhci %llux: controller not ready before reset: %.8ux\n",
+ ctlr->base, ctlr->opr[USBSTS]);
ctlr->opr[USBCMD] = HCRST;
delay(1);
- for(i=0; (ctlr->opr[USBSTS] & (CNR|HCH)) != HCH && i<100; i++)
- tsleep(&up->sleep, return0, nil, 10);
+
+ if(pollwait(&ctlr->opr[USBSTS], CNR|HCH, HCH, 1000) < 0)
+ print("xhci %llux: controller not halted after reset: %.8ux\n",
+ ctlr->base, ctlr->opr[USBSTS]);
pcisetbme(ctlr->pcidev);
intrenable(ctlr->pcidev->intl, hp->interrupt, hp, ctlr->pcidev->tbdf, hp->type);
@@ -593,8 +608,10 @@
coherence();
ctlr->opr[USBCMD] = RUNSTOP|INTE|HSEE|EWE;
- for(i=0; (ctlr->opr[USBSTS] & (CNR|HCH)) != 0 && i<100; i++)
- tsleep(&up->sleep, return0, nil, 10);
+
+ if(pollwait(&ctlr->opr[USBSTS], CNR|HCH, 0, 1000) < 0)
+ print("xhci %llux: controller not ready after run: %.8ux\n",
+ ctlr->base, ctlr->opr[USBSTS]);
kproc("xhcirecover", recover, hp);
}
--
cinap
next prev parent reply other threads:[~2021-01-24 15:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 17:23 Mack Wallace
2021-01-23 16:11 ` cinap_lenrek
2021-01-23 21:08 ` Mack Wallace
2021-01-23 21:13 ` Mack Wallace
2021-01-23 23:42 ` cinap_lenrek
2021-01-24 15:01 ` cinap_lenrek [this message]
2021-01-26 3:33 ` Mack Wallace
2021-01-26 3:35 ` Mack Wallace
2021-01-26 11:21 ` cinap_lenrek
2021-01-26 12:09 ` cinap_lenrek
2021-01-27 2:32 ` Mack Wallace
2021-01-27 14:30 ` cinap_lenrek
2021-01-27 17:04 ` cinap_lenrek
2021-01-27 17:57 ` cinap_lenrek
2021-01-29 14:58 ` cinap_lenrek
2021-01-30 2:43 ` Mack Wallace
2021-01-30 5:54 ` cinap_lenrek
2021-01-30 19:23 ` Mack Wallace
2021-01-30 19:41 ` cinap_lenrek
2021-01-30 19:46 ` cinap_lenrek
2021-02-01 1:16 ` Mack Wallace
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5B3B970A411ADBCC5D32FFDFAB1E4D3E@felloff.net \
--to=cinap_lenrek@felloff.net \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).