9front - general discussion about 9front
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9front@9front.org
Subject: Re: [9front] 9front on Raspberry Pi 400
Date: Tue, 26 Jan 2021 12:21:23 +0100	[thread overview]
Message-ID: <BDA622280131386DF3141CAB730943B4@felloff.net> (raw)
In-Reply-To: <010001773cc26554-a456b631-4a33-4832-a4b0-ee187a34411d-000000@email.amazonses.com>

> xhci 600000000: controller not ready before reset: 00000815
> xhci 600000000: controller not halted after reset: 00000815
> xhci 600000000: controller not ready after run: 0000080d

ok, this means the controller never clears the "Host Controller Halted"
and "Host Controller Not Ready" bits in the status register.

so it is possible the xhcireset() firmware command is not having
the desired effect on the pi400?

the mailbox command xhcireset() is run right after our pcie controller
reset, after we enumerated the pci bus, but before we attempt to
reset the xhci controller.

see in autogenerated pi4.c:

void links(void){
	bootlinks();

	gisblink();
	pcibcmlink();	<- pcie controller reset and enumeration
	archbcm4link();	<- here we do the xhcireset call to firmware
	usbxhcilink();	<- registers the xhci driver, will attempt to reset later
	ethergenetlink();
	ethermediumlink();
	loopbackmediumlink();
}

i know that richard put the xhcireset() call directly in the xhci
driver init function.

the reason i did not do that was because my xhci driver is portable
and shared with the pc and pc64 kernels and i do not want to clutter
it with work arounds for raspberry pi.

the effects that these differences might have is that we do
not enable the pci device before the xhcireset() call, and that we
do not do the xhci handoff. well... and timing differences...

so the simplest thing to try first would be to put a pcienable()
call before the xhcireset() like:

diff -r 5c327eddc496 sys/src/9/bcm64/archbcm4.c
--- a/sys/src/9/bcm64/archbcm4.c	Sat Jan 23 20:36:09 2021 -0800
+++ b/sys/src/9/bcm64/archbcm4.c	Tue Jan 26 12:01:03 2021 +0100
@@ -183,8 +183,10 @@
 	 * for the firmware to dictate the PCI configuration. Consequently, the mailbox
 	 * is required so that the OS can reset the VLI after asserting PCI chip reset.
 	 */
-	if((p = pcimatch(nil, 0x1106, 0x3483)) != nil)
+	if((p = pcimatch(nil, 0x1106, 0x3483)) != nil){
+		pcienable(p);
 		xhcireset(BUSBNO(p->tbdf)<<20 | BUSDNO(p->tbdf)<<15 | BUSFNO(p->tbdf)<<12);
+	}
 
 	// addclock0link(wdogfeed, HZ);
 }

it is unclear to me why the code works fine on the pi4 8GB model tho.

another possibility is you have the wrong firmware files for
the pi400 in the image.

if that also fails, i can put in a hook in the xhci driver and we
execute the xhcireset magic function in the exact same place as
with richards driver next.

the other difference we have is that our kernel is 64 bit one,
and firmware loader takes different codepaths for these kernel
types, so might leave the machine in a different state when
handing control to the kernel.

anyway, can you also provide me with the GIC debug prints i put?

--
cinap

  reply	other threads:[~2021-01-26 14:50 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
2021-01-26  3:33         ` Mack Wallace
2021-01-26  3:35         ` Mack Wallace
2021-01-26 11:21           ` cinap_lenrek [this message]
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=BDA622280131386DF3141CAB730943B4@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).