summaryrefslogtreecommitdiffstats
path: root/DEBUG_NOTES.md
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-01 16:48:40 +0100
committersalmonik <salmonik@tuta.io>2026-11-01 16:48:40 +0100
commit12549dabf96bd6eb08c6834134fedf9edc7452b5 (patch)
tree2237ed1a05b731f0e1a39c2374440cec3c872258 /DEBUG_NOTES.md
parentscripts: add test-usb; fix duplicate -bios in the test harness (diff)
downloadrs-dos-12549dabf96bd6eb08c6834134fedf9edc7452b5.tar.gz
rs-dos-12549dabf96bd6eb08c6834134fedf9edc7452b5.zip
ehci: reserve the 64-bit QH/qTD layout (fixes hardware HSE)
First OptiPlex run: the controller halted with HSE (USBSTS bit4) 20 ms into the first control transfer, with otherwise valid QH/qTD fields (control QH, DTC, MPS 8, split hub 0/port 1, active qTD). The PCH EHCI advertises HCCPARAMS bit0 (64-bit addressing capability), which extends every QH with bufptr_hi[5] (17 dwords / 68 B) and every qTD the same way (13 dwords / 52 B). Packing them 32-bit-style (48/32 B) made the controller read the next qTD as the overlay's high buffer pointer and DMA to a bogus 64-bit address -> Host System Error. Space every structure for the 64-bit variant (32-bit controllers ignore the tail): HID qTD at QH+0x80; control qTDs at QH+0x100/0x140/0x180 with the setup packet at +0x1C0. The failure QR now reports the capability and the DMA bases so the next hardware iteration is self-describing.
Diffstat (limited to 'DEBUG_NOTES.md')
-rw-r--r--DEBUG_NOTES.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/DEBUG_NOTES.md b/DEBUG_NOTES.md
index b7c0e08..cd2b9ae 100644
--- a/DEBUG_NOTES.md
+++ b/DEBUG_NOTES.md
@@ -631,3 +631,36 @@ Failure signatures to report:
631- xHCI: no hub support; no USB3 warm-reset subtleties beyond the current 631- xHCI: no hub support; no USB3 warm-reset subtleties beyond the current
632 port-reset sequence. 632 port-reset sequence.
633- AHCI/PS2 behaviour unchanged (PS/2 remains the fallback input path). 633- AHCI/PS2 behaviour unchanged (PS/2 remains the fallback input path).
634
635### OptiPlex 7010 — first hardware QR decode
636
637The first hardware run booted to the shell with no USB input and displayed
638the EHCI failure QR:
639
640```
641EHCI fail stage=4 t=20ms sp=0 dev=0 in=true len=18
642cmd=00000020 sts=0000b013
643prtsc0=0x00001005 hp=0x00003000
644qh1=48084000 qh2=40800000 nqtd=012080c0
645setup=00080e80 data=80120d80 stat=80008c80
646```
647
648- `sts` bit4 = **HSE (Host System Error)** plus HCH: the controller aborted
649 the very first DMA pass after 20 ms, so this is a bus/DMA fault, not a
650 protocol error.
651- `cmd=0x20`: RUNSTOP self-cleared, only ASE remains.
652- `qh1/qh2/qTD tokens` are structurally correct: control QH, DTC, MPS 8,
653 split hub 0 / port 1, qTD active with TBYTES.
654- `prtsc0` PED=0: full-speed device on the root port (companion/TT path).
655
656**Root cause: 64-bit addressing capability.** The PCH EHCI advertises
657HCCPARAMS bit0, which extends every QH with `bufptr_hi[5]` (68 B) and every
658qTD with `bufptr_hi[5]` (52 B). The driver packed them 32-bit-style (48/32
659B), so the HC read the *next qTD* as the overlay's high buffer pointer and
660DMA'd to a bogus 64-bit address -> HSE. QEMU reports `caps64=false`, so only
661hardware exposed this.
662
663**Fix:** always reserve the 64-bit layout (32-bit controllers ignore the
664tail): HID qTD at QH+0x80; control qTDs at +0x100/+0x140/+0x180 and the setup
665packet at +0x1C0. The failure QR now prints `c64=` and the DMA bases
666(async/xfer/setup/buf) so the next run is self-describing.