From c06e51c4969ee0a874b4be207f4aea064f537369 Mon Sep 17 00:00:00 2001 From: vasilito Date: Wed, 5 Aug 2026 02:42:16 +0300 Subject: [PATCH] docs(plan): add Ryzen 7000 / X670E host compatibility plan --- .../task-1-ryzen-7000-x670e-compat.md | 84 ++++ .../RYZEN-7000-X670E-COMPATIBILITY-PLAN.md | 426 ++++++++++++++++++ 2 files changed, 510 insertions(+) create mode 100644 .omo/evidence/task-1-ryzen-7000-x670e-compat.md create mode 100644 local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md diff --git a/.omo/evidence/task-1-ryzen-7000-x670e-compat.md b/.omo/evidence/task-1-ryzen-7000-x670e-compat.md new file mode 100644 index 0000000000..572ded0884 --- /dev/null +++ b/.omo/evidence/task-1-ryzen-7000-x670e-compat.md @@ -0,0 +1,84 @@ +# Evidence: task-1-ryzen-7000-x670e-compat + +**Todo:** 1 of `.omo/plans/ryzen-7000-x670e-compat.md` +**Deliverable:** `local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md` (426 lines, authored 2026-08-05) +**No commits made** (operator commits after verification). No other file touched. + +## What was written + +Durable host compatibility plan for the MSI MPG X670E CARBON WIFI (MS-7D70) + Ryzen 9 +7900X, mirroring `local/docs/LG-GRAM-16Z90TP-COMPATIBILITY-PLAN.md` structure with this +host's content drawn from `.omo/drafts/ryzen-7000-x670e-compat.md` (findings, Oracle +verdicts) and `.omo/plans/ryzen-7000-x670e-compat.md` (waves table, dependency matrix, +scope guardrails). + +Structure: + +- Header + status block with honest evidence language (compile-visible ≠ QEMU-bounded ≠ + hardware-validated; no runtime claims). +- **Three prominent correction callouts** near the top: (a) Raphael = DCN 3.1.5 (not + 3.1.4), with the correct GC 10.3.6 / SDMA 5.2.6 / VCN 3.1.2 / MP0-MP1 13.0.5 set and + firmware names; (b) RTL8125 needs the new `redbear-r8125d`, rtl8168d explicitly cannot + bind it; (c) MT7922 is the mt7921 family, SoftMAC, not iwlwifi-compatible. +- **§1 Host profile** — AMI BIOS 1.74, 12C/24T Zen 4 Raphael, X670E dual-Promontory + (PROM21), 64GB, Raphael iGPU 1002:164e as display target (BIOS-disabled, enablement + prerequisite noted), NVIDIA 10de:2704 explicitly excluded. +- **§2 Device-by-device matrix** — ✅/🟡/❌ verdicts with evidence paths. Every dmesg + PCI ID has a row: 1022:14d8/14d9, 1022:43f4, 1022:43f6 (ASM1064 re-brand note), + 1022:43f7, 1022:15b6/15b7/15b8 (hci 0x120), 1022:15e3, 1022:1649 (PSP deferred), + 1022:790b/790e, 10ec:8125, 14c3:0616, 0e8d:0616, 1cc1:5766 (HMB candidate), + 144d:a80c, 1002:164e, 10de:2704, 1022:14e3 (k10temp), AMDIF031, MSFT0101, + 1462:7d70, 0db0:6a05, 0db0:9ba6, 0db0:d6e7 (UAC2 gap). Plus §2.1 known non-issues + and §2.2 five platform-level findings (pcid no allocator, ps2d crash, MADT gaps, + wrong BAR model in AMD glue, zero amdgpu firmware). +- **§3 Boot-path analysis** — UEFI → bootloader → kernel → pcid → driver-manager → + login, with §3.1 no-i8042 callout (ps2d fully optional, kernel-owned verdict) and + §3.2 PCI-conflict callout (AMDIF031 0xfb300000 vs bridge window; fail-closed auditor + + transactional allocator). +- **§4 Multiphase plan** — PHASE 0 (Wave 0) through PHASE 8 (Waves 8–9 incl. Gate B) = + 9 `### PHASE` headings; phase contents mapped from plan todos with gates. +- **§5 Dependency graph** — ASCII graph summarizing the plan's dependency matrix + (todo 10 executor fan-out, todo 24 policy gating, Gate A/B chains). +- **§6 Execution order** — serial baselines snapshot, Phase 0, parallel substrate + phases, Gate A serialization, Wi-Fi/BT/display, Gate B, continuous hygiene. +- **§7 Out of scope** — NVIDIA, S3/s2idle, TPM/watchdog/PSP/EDAC, MSI vendor HIDs, + UAC2, atomic-KMS/Mesa/3D; plus ABSOLUTE-RULE / no-stub / reference-only reminders. +- **§7.1 Deferred-with-docs placeholder table** with headers `Device | Reason | What + would unblock` for todo 39 to fill. + +## Acceptance-grep outputs (run in repo root) + +``` +$ test -s local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md && echo nonempty OK +nonempty OK + +$ grep -c '^### PHASE' local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md +9 (>= 7 required: PASS) + +$ grep -q 'DCN 3.1.5' file && grep -q 'redbear-r8125d' file && grep -q 'redbear-mt7922' file +DCN OK / r8125d OK / mt7922 OK (all true: PASS) + +$ grep -c 'BE201\|8086:7740' file +0 (no Intel-only leftovers: PASS) + +$ grep -E '10ec:8125|14c3:0616|1002:164e|1022:15e3|1022:790b' file | wc -l +17 (>= 5 required: PASS) + +$ wc -l file +426 +``` + +## Judgment calls made + +1. **9 phases instead of 8**: mapped Wave 0 → PHASE 0 and folded Wave 9 (todo 40, + Gate B) into PHASE 8's tail, keeping the plan's wave numbering visible in each + phase title. Acceptance only required ≥7 `### PHASE` headings. +2. **Deferred table placeholder**: §7.1 carries the required headers plus one italic + placeholder row noting todo 39 fills it; PSP/TPM/watchdog/vendor HIDs are listed + in §7 prose now (per the MUST-DO device list) without pre-filling the table rows. +3. **No Intel-only content copied**: the LG plan is referenced only as a structural + template and for its ACPICA-port verdict (§2.3 of that plan); no BE201/8086:7740 + or Intel Wi-Fi assumptions appear (grep-verified). +4. **Evidence language**: every runtime statement is framed as planned/expected with + an explicit "nothing is claimed today" framing; no bare-metal or QEMU result is + asserted as done. diff --git a/local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md b/local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md new file mode 100644 index 0000000000..bda531123d --- /dev/null +++ b/local/docs/RYZEN-7000-X670E-COMPATIBILITY-PLAN.md @@ -0,0 +1,426 @@ +# MSI MPG X670E CARBON WIFI (MS-7D70) + Ryzen 9 7900X — Host Compatibility Plan + +**Created:** 2026-08-05 +**Status:** Plan authored — execution not yet started. Nothing in this document claims +runtime validation. Evidence language per project rules: **compile-visible ≠ +QEMU-bounded ≠ hardware-validated.** Every verdict below is a static code/readiness +assessment derived from the host dmesg (Linux 7.1.4) plus six parallel read-only +codebase mappings, not from a boot of Red Bear OS on this machine. +**Source evidence:** Host dmesg + lspci from the MS-7D70 machine; the findings ledger +at `.omo/drafts/ryzen-7000-x670e-compat.md`; the execution work plan at +`.omo/plans/ryzen-7000-x670e-compat.md` (41 todos + 4 verifiers). +**Host class:** Modern AMD desktop (Zen 4 / Raphael, X670E dual-Promontory chipset), +first-class bare-metal target. + +--- + +## THREE CORRECTIONS — READ FIRST + +> ### ⚠️ CORRECTION 1 — Raphael is DCN 3.1.5, NOT DCN 3.1.4 +> Earlier internal notes (and the current redox-drm AMD glue's firmware default, +> `dmcub_dcn31.bin`) described the Raphael display block as DCN 3.1.4. The Linux 7.1 +> reference table (`Documentation/gpu/amdgpu/apu-asic-info-table.csv`) is definitive: +> **Raphael = DCN 3.1.5, GC 10.3.6, SDMA 5.2.6, VCN 3.1.2, MP0/MP1 13.0.5.** +> The bounded port slice is the `dcn315` subset (~4.8k LoC) plus the shared `dcn314` +> DML, not a DCN 3.1.4 port. Firmware is `dcn_3_1_5_dmcub.bin`, `gc_10_3_6_*`, +> `sdma_5_2_6.bin`, `vcn_3_1_2.bin`, `psp_13_0_5_*` — NOT the RDNA3 set +> (`sdma_6_*`, `vcn_4_*`, `mes_2_*`). + +> ### ⚠️ CORRECTION 2 — RTL8125 2.5GbE needs a NEW driver (`redbear-r8125d`); `rtl8168d` CANNOT bind it +> The onboard wired NIC is a Realtek RTL8125 [10ec:8125]. The existing `rtl8168d` +> driver **explicitly excludes** the 8125 (different register layout; +> `redbear-device-services.toml` restricts its match to device `0x8168/0x8169`). +> There is no wired-network fallback: a new Rust driver, **`redbear-r8125d`**, +> ported from the Linux `r8169` RTL8125 sections with `rtl_nic/rtl8125*-*.fw` +> firmware via firmware-loader, is **mandatory** work, not optional polish. +> (Linux `rtase` is for 8126/8127 only and is not the reference for this chip.) + +> ### ⚠️ CORRECTION 3 — MT7922 Wi-Fi is the mt7921 family (SoftMAC), NOT iwlwifi-compatible +> The onboard Wi-Fi is a MediaTek MT7922 [14c3:0616]. It belongs to the **mt7921 +> driver family** in Linux (`mt76/mt7921/pci.c` carries the 0x0616 ID) and is a +> **mac80211 SoftMAC** device — the MLME runs on the host, not in firmware. +> `redbear-iwlwifi` is Intel-vendor-only and cannot bind or share a firmware +> interface with it. The plan is a new **`redbear-mt7922`** driver: a bounded mt76 +> C transport (WFDMA rings, Connac descriptors, ROM-patch/WM firmware transfer, MCU +> mailbox, reset) under the formalized linux-kpi exemption, with the control plane +> (scan/auth/assoc/key/regulatory/aggregation policy) as a **Rust SoftMAC/MLME**. +> No FullMAC assumption, no mac80211/cfg80211 import, no Intel assumptions anywhere. + +--- + +## 1. Host Profile + +| Property | Value | +|---|---| +| Model | MSI MPG X670E CARBON WIFI (MS-7D70); DMI: `Micro-Star International Co., Ltd. MS-7D70/MPG X670E CARBON WIFI (MS-7D70)` | +| BIOS | AMI BIOS 1.74, UEFI | +| CPU | AMD Ryzen 9 7900X (Raphael, Zen 4), 12 cores / 24 threads, x2APIC, invariant TSC, CPPC | +| Chipset | AMD X670E — dual Promontory (PROM21) chipset (two downstream PROM21 complexes) | +| RAM | 64 GB | +| Display GPU (target) | AMD Raphael integrated GPU [1002:164e] — DCN 3.1.5, GC 10.3.6, SDMA 5.2.6, VCN 3.1.2, MP0/MP1 13.0.5. **Currently BIOS-disabled** (dGPU present, iGPU not enumerated in the captured dmesg); BIOS enablement + GOP/display capture is a hard prerequisite for all display work | +| Excluded GPU | NVIDIA RTX 4080 [10de:2704] — **explicitly excluded by the operator**. No nouveau/NVK work of any kind | +| Storage 0 | ADATA NVMe [1cc1:5766] — DRAM-less controller, **HMB candidate** (Host Memory Buffer; FID 0x0D) | +| Storage 1 | Samsung NVMe [144d:a80c] — generic, no Linux quirks | +| SATA | ASM1064 AHCI controller (AMD-vendored as 1022:43f6 on this chipset — upstream ASM1064 is 1b21:1064; class match suffices) | +| Wired net | Realtek RTL8125 2.5GbE [10ec:8125] — see CORRECTION 2 | +| Wi-Fi | MediaTek MT7922 [14c3:0616] — mt7921 family, SoftMAC; fw `mediatek/WIFI_RAM_CODE_MT7922_1.bin` + `mediatek/WIFI_MT7922_patch_mcu_1_1_hdr.bin` — see CORRECTION 3 | +| Bluetooth | MediaTek USB BT [0e8d:0616] — WMT protocol (btmtk), fw `mediatek/BT_RAM_CODE_MT7922_1_1_hdr.bin`; post-Linux-7.1 `btusb.c` addition, port reference is `btmtk.c` (~700 LoC) | +| USB | Five xHCI controllers: 1022:43f7 (chipset), 1022:15b6/15b7/15b8 (Raphael USB4-adjacent, hci version 0x120), plus ASMedia ASM3142-class; Linux quirk mask `0x200000010` = `XHCI_SPURIOUS_SUCCESS | XHCI_DEFAULT_PM_RUNTIME_ALLOW` | +| Audio | AMD Ryzen HD Audio [1022:15e3] (class 0x0403) | +| Platform | PSP [1022:1649] (deferred, no consumer), FCH SMBus [1022:790b]/[1022:790e], k10temp thermal [1022:14e3], gpio-amdpt (ACPI HID `AMDIF031`), TPM2 (ACPI HID `MSFT0101`, deferred) | +| MSI vendor HIDs | Mystic Light 1462:7d70, AIO 0db0:6a05, Nuvoton 0db0:9ba6, USB audio 0db0:d6e7 — enumerate-only / tolerate; UAC2 gap noted for 0db0:d6e7 | +| IOMMU | AMD-Vi (IVRS present); iommu daemon has a real IVRS parser (IVHD 0x10/0x11; IVMD 0x20/0x21 currently skipped) — structural correction planned | +| Input | **No PS/2 controller on this board** (dmesg: "i8042: PNP: No PS/2 controller found") — USB HID is the only input path; `ps2d` must be fully optional | +| Notable quirks | Firmware leaves PCI BAR/bridge-window conflicts (dmesg "can't claim" storm; AMDIF031 region at 0xfb300000 collides with a bridge window — Linux reassigns; Red Bear pcid currently cannot) | + +--- + +## 2. Device-by-Device Support Matrix (dmesg vs. codebase recon) + +Legend: ✅ = expected to work today (code match + mature path) · 🟡 = code exists, gap or unproven · ❌ = no support +Evidence levels are compile/static only unless a QEMU harness is named. **No row below is hardware-validated.** + +| Device | ID | Red Bear component | Verdict | Evidence | +|---|---|---|---|---| +| UEFI boot | — | bootloader fork | ✅ | AMI UEFI is standard; Red Bear UEFI boot proven on AMD bare metal (Threadripper) | +| CPU/SMP | Zen 4 | kernel x2APIC path | 🟡 | x2APIC works via CPUID (`local_apic.rs:52-79`); MADT types 0x4/0x5/0x9/0xA are NOT parsed in the kernel fork (`madt/mod.rs:149-228` falls to Unknown); normalization planned (Wave 1) | +| Raphael root complex / data fabric | 1022:14d8, 1022:14d9 | pcid (bus-layer) | ✅ (n/a) | Host-bridge/data-fabric functions; no userspace driver needed by design | +| Chipset PCIe switch | 1022:43f4 | pcid (bus-layer) | ✅ (n/a) | Bridge recursion exists (`pcid main.rs:324-344`); multi-host-bridge FIXME noted | +| Chipset AHCI (ASM1064 re-brand) | 1022:43f6 | `ahcid` | 🟡 | Class match suffices (upstream ASM1064 = 1b21:1064 board_ahci generic); ahcid is legacy-IRQ only with re-arm fix — fine for ASM1064; no HW validation | +| Chipset xHCI | 1022:43f7 | `xhcid` | 🟡 | Class match; Linux flag `XHCI_DEFAULT_PM_RUNTIME_ALLOW` (`xhci-pci.c:331`); 51-flag quirk table exists in redox-driver-sys; no HW validation | +| Raphael USB4-adjacent xHCI ×3 | 1022:15b6, 1022:15b7, 1022:15b8 | `xhcid` | 🟡 | Class match; hci version 0x120 → `DEFAULT_PM_RUNTIME_ALLOW` rule already exists; no HW validation | +| Ryzen HD Audio | 1022:15e3 | `ihdad` | 🟡 | ihdad code claims ANY class 0x0403 (spec-compliant verbs/CORB/RIRB), but driver-manager TOML is vendor=0x8086-only (`50-audio.toml:9-11`) — widen match + runtime-verify | +| AMD PSP (crypto) | 1022:1649 | — | ❌ (deferred) | No driver, no consumer — documented deferral, see §7 table | +| FCH SMBus | 1022:790b, 1022:790e | `redbear-smbusd` (new) | ❌→planned | No driver today; Linux `i2c-piix4` binds 1022:790b (rev ≥ 0x51, MMIO mode); `amd-mp2-i2cd` is a DIFFERENT IP — new daemon or extension required | +| k10temp thermal | 1022:14e3 | (new) | ❌→planned | 1022:14e3 IS in Linux k10temp ID table (19H_M60H_DF_F3); no Red Bear k10temp driver exists; redbear-power has AMD RAPL MSRs but no thermal zone consumer | +| AMD GPIO platform device | AMDIF031 (ACPI) | gpio-amdpt port | ❌→planned | ACPI platform device; Linux `gpio-amdpt.c` is 147 LoC (24 pins, MMIO) — trivial port, but needs the missing ACPI HID→driver spawn path (registry, claim, capability-safe `_CRS` handoff) | +| TPM2 | MSFT0101 (ACPI) | — | ❌ (deferred) | No consumer; documented deferral, see §7 table | +| RTL8125 2.5GbE | 10ec:8125 | **`redbear-r8125d` (new)** | ❌→planned | **rtl8168d CANNOT bind it** (CORRECTION 2); port Linux `r8169` 8125 sections; fw `rtl_nic/rtl8125*-*.fw` via firmware-loader; match entry with subclass filter per the 10-network.toml precedent | +| MT7922 Wi-Fi | 14c3:0616 | **`redbear-mt7922` (new)** | ❌→planned | mt7921 family, SoftMAC (CORRECTION 3); bounded mt76 C transport (linux-kpi exemption) + Rust SoftMAC/MLME control plane + redbear-wifictl backend; ~6.6k LoC Linux reference | +| MediaTek BT | 0e8d:0616 | `redbear-btusb` btmtk module | 🟡→planned | HCI core in redbear-btusb is vendor-agnostic (`hci.rs` ~1848 LoC) but vendor list lacks 0x0E8D and `btintel.rs` is Intel-specific; needs btmtk (WMT) module + real USB HCI transport (control/interrupt/bulk, STALL recovery) | +| ADATA NVMe (DRAM-less) | 1cc1:5766 | `nvmed` + HMB | 🟡 | Class match works; no Linux quirks (generic); nvmed declares cmbloc/cmbsz but never uses them — **HMB (FID 0x0D) is new work**, with HMMIN floor and clean disable if `min(HMPRE,cap) < HMMIN` | +| Samsung NVMe | 144d:a80c | `nvmed` | 🟡 | Class match; generic (no quirks); PRP-only, 8-queue cap, single MSI — adequate; no HW validation | +| Raphael iGPU (display target) | 1002:164e | `redox-drm` / amdgpu DCN315 slice | ❌→planned | DCN 3.1.5 (CORRECTION 1); **currently BIOS-disabled** — enablement is prerequisite; existing bounded AMD glue has the WRONG BAR model for the APU (BAR0=framebuffer aperture / BAR2=doorbells / BAR5=MMIO; current glue inverts roles) and reads the first MMIO dword as a device ID — **do NOT ship it on Raphael**; path is GOP/vesad interim → read-only probe → DCN315 slice | +| NVIDIA RTX 4080 | 10de:2704 | — | ❌ (excluded) | **Explicitly excluded by the operator** — no work of any kind, see §7 | +| MSI Mystic Light | 1462:7d70 | — (tolerate) | 🟡 (enumerate-only) | Vendor RGB HID; must enumerate without errors via usbhidd; no vendor-protocol driver (no consumer) | +| MSI AIO controller | 0db0:6a05 | — (tolerate) | 🟡 (enumerate-only) | Vendor AIO HID; enumerate-only; vendor-software domain | +| Nuvoton HID | 0db0:9ba6 | — (tolerate) | 🟡 (enumerate-only) | Vendor HID; enumerate-only | +| MSI USB audio (UAC2) | 0db0:d6e7 | `redbear-usbaudiod` | 🟡→❌ | redbear-usbaudiod is **UAC 1.0 only** — this device is UAC 2.0; documented gap, see §7 | +| AMD-Vi IOMMU | IVRS | `iommu` daemon | 🟡 | Real IVRS parser exists (IVHD 0x10/0x11; IVMD 0x20/0x21 skipped — 0x22 scope semantics uncorrected); QEMU first-use proof passes; **real-hardware validation open**; structural correction planned (Wave 2) | +| PS/2 input | i8042 — ABSENT | kernel `serio` + `ps2d` | ❌ (as-is) | **This board has no i8042**; `ps2d` currently does `.expect("ps2d: failed to open /scheme/serio/0")` and CRASHES — must become fully optional with a kernel-owned presence verdict (FADT flag + bounded probe) | +| USB HID input | — | `usbhidd` | 🟡 | Report-descriptor path works in QEMU; USB HID is the ONLY input path on this board, so it is boot-critical here | +| CPU freq (CPPC) | Zen 4 | `cpufreqd` replacement path | ❌→planned | cpufreqd is Intel HWP-only; Zen 4 needs AMD CPPC via MSRs 0xC00102B0–0xC00102B5 (CPUID 0x80000008:EBX[27] gate) — new AMD path required | + +### 2.1 Known non-issues (verified, do not re-investigate) + +- Root complex / data fabric / PCIe switch functions (1022:14d8/14d9/43f4): bus-layer devices, no userspace driver by design. +- PSP (1022:1649) and TPM (MSFT0101): absent drivers are intentional — no consumer today. +- AHCI re-brand (1022:43f6): class matching is correct; no vendor quirk needed. +- x2APIC: register mode works via CPUID; IRQ-remapping absence does not block MSI/MSI-X delivery on QEMU today (structural AMD-Vi correction is still planned). + +### 2.2 Critical platform-level findings (from recon, not optional) + +1. **pcid does no resource allocation.** `pcid` reads firmware BARs only + (`cfg_access/mod.rs:423-447` pure passthrough; `main.rs:33-71`). This board's + firmware leaves BAR/bridge-window conflicts (Linux hit "can't claim" on the + AMDIF031 0xfb300000 region and reassigned to 0xc0000000/0x1040000000). Red Bear + currently cannot repair these — a driver `map_bar` silently fails or stomps. + Plan: fail-closed resource auditor + transactional cold-plug subtree-repairing + allocator in userspace pcid (Oracle verdict A). +2. **ps2d crashes on no-i8042 boards.** See matrix row; Wave 1 fix. +3. **MADT gaps.** Types 0x4/0x5/0x9/0xA unparsed; `IrqScheme::init()` collects + type-0 records only; reconcile into a normalized topology table (Oracle verdict D). +4. **Existing AMD display glue is wrong for Raphael.** BAR roles inverted for the + APU memory model; probe-first path mandated (Oracle verdict C). +5. **Zero amdgpu firmware blobs on disk.** `local/firmware/` carries i915/iwlwifi/ + intel-bt only; the Raphael 11-blob set (gc_10_3_6, psp_13_0_5, sdma_5_2_6, + vcn_3_1_2, dcn_3_1_5_dmcub) must be staged via fetch-firmware.sh / + redbear-firmware-amdgpu. + +--- + +## 3. Boot Path Analysis (redbear-mini on this host) + +``` +UEFI (AMI 1.74) → Red Bear bootloader (✅ expected — proven on AMD bare metal) + → kernel: x2APIC detect (✅), 24-thread SMP (🟡 MADT normalization needed), + MCFG ECAM (🟡 multi-segment entries currently warn-skipped), + TSC clocksource (🟡 bare-metal calibration missing — KVM pvclock only today) + → initfs: pcid (❌ resource conflicts unrepairable today — auditor/allocator needed) + → nvmed (🟡 both NVMe class-match; HMB for the ADATA is new work) + → rootfs mount (✅ expected) + → vesad + fbcond console (✅ — GOP framebuffer; iGPU must be BIOS-enabled first) + → driver-manager (owns match/claim/spawn; pcid-spawner retired): + xhcid ×5 (🟡 class match + quirk table — unvalidated on HW) + ahcid (🟡 class match) + ps2d (❌ CRASHES without i8042 — must exit 0 as fully optional) + usbhidd (🟡 THE input path on this board) + rtl8168d (does NOT claim 10ec:8125 — correct exclusion) + redbear-r8125d (planned — the wired net path) + redbear-mt7922 (planned — Wi-Fi path) + redbear-btusb (planned — btmtk module for 0e8d:0616) + ihdad (🟡 probes 1022:15e3 only after the TOML match is widened) + → acpid: RSDP/FADT/DSDT (🟡 producer contract unwired), S5 shutdown (🟡 unbounded + spin today — bounded fallback planned), reboot via FADT reset_reg (planned) + → cpufreqd (❌ Intel HWP-only — AMD CPPC path planned) + → login prompt — the minimally-usable milestone +``` + +Expected first-boot result **after** the Wave 1–3 substrate work (nothing is claimed +today): boot to login on the VESA console with USB HID input, both NVMe drives +bound, AHCI and all five xHCI controllers claimed, working shutdown/reboot — but no +wired network (until `redbear-r8125d`), no Wi-Fi (until `redbear-mt7922`), no +DRM/KMS display (vesad only), no audio, no CPU frequency scaling. + +### 3.1 The no-i8042 callout + +Desktop boards in this class ship no PS/2 controller. `ps2d` currently +`.expect()`s on `/scheme/serio/0` and panics. The fix is a single kernel-owned +presence verdict (FADT `IA_PC_BOOT_ARCH` 8042 flag primary, bounded active probe as +fallback), IRQ1/IRQ12 wired only when present, and ps2d reading the verdict and +exiting 0 with one info line when absent. Boards WITH an i8042 keep full current +behavior. ps2d is never removed from any config (ABSOLUTE RULE); USB HID is never +gated behind ps2d. + +### 3.2 The PCI-conflict callout + +This firmware leaves real resource conflicts — the dmesg shows the AMDIF031 GPIO +device's 0xfb300000 region colliding with a bridge window, and Linux repaired it by +reassignment. Red Bear pcid today passes firmware BARs through verbatim. The plan +(Oracle verdict A) is: first a fail-closed **resource auditor** (block enable/map +until acpid returns normalized `_CRS` + reservations), then a **transactional +cold-plug allocator** (tighten the oversized bridge window first; relocate the +subtree only if needed; snapshot → disable → size → program → verify → restore; on +failure leave the subtree disabled). No hot-plug initially; `NO_RESOURCE_RELOC` +means "preserve and fail closed." + +--- + +## 4. Multiphase Plan + +Phases map 1:1 onto the waves of the work plan (`.omo/plans/ryzen-7000-x670e-compat.md`, +waves table lines 64–75). Wave 9's Gate B is folded into Phase 8's tail. Every phase +ends with a validation gate; QEMU-bounded proofs are used where a QEMU analogue +exists, bare-metal gates on the MS-7D70 host use packaged in-guest checkers with +logs archived to `local/docs/evidence/ryzen-x670e/`. `make validate +CONFIG_NAME=redbear-mini` (Gate A path) and `=redbear-full` (Gate B path) run and +are archived at every image gate. Evidence language stays honest throughout: +compile-visible ≠ QEMU-bounded ≠ hardware-validated. + +--- + +### PHASE 0 — Durable documentation, DMI quirk profile, host evidence capture (Wave 0, todos 1–4) + +| # | Work item | Notes | +|---|---|---| +| 0.1 | Author this document | Todo 1 — this file | +| 0.2 | MS-7D70 DMI quirk profile in `redbear-quirks/source/quirks.d/50-system.toml` | Exact-match on `sys_vendor` + `board_name = "MS-7D70"`; conservative (no invented flags); host unit test in redox-driver-sys proving match vs. non-match | +| 0.3 | Host evidence capture kit (Rust tool `local/scripts/capture-host-evidence/`) | lspci/iomem/acpidump/dmidecode/lsusb, `nvme id-ctrl` for BOTH drives (HMB fields gate Phase 4), MADT record inventory, firmware listing, Raphael IP-discovery lines; **plus the serial pre-Wave-0 ten-SHA `baselines.toml` snapshot**; **plus operator BIOS iGPU enablement + GOP/BAR capture** (hard prerequisite for all display work) | +| 0.4 | HARDWARE-VALIDATION-MATRIX `[AVAILABLE] (MS-7D70: ...)` annotations | Compile-only baseline levels; refreshed at every gate | + +**Gate 0:** doc + quirk test green; evidence artifacts non-empty; baselines recorded. + +--- + +### PHASE 1 — Boot substrate (Wave 1, todos 5–8, 41) + +| # | Work item | Notes | +|---|---|---| +| 1.1 | Kernel MADT normalization | Parse types 0/4/5/9/A; one normalized processor table (32-bit APIC ID + ACPI UID + flags); dedup by ACPI UID only (0x000 vs 0x100 are distinct CPUs); type-9 wins; NMI per-CPU; `IrqScheme::init()` fixed off type-0-only; reject sub-2-byte records with guaranteed iterator progress | +| 1.2 | Bare-metal TSC calibration | CPUID 0x15 (validated) → HPET → FADT PM-timer, all kernel-internal; invariant-TSC gate (CPUID 0x80000007:EDX[8]); forced-source test modes that FAIL LOUDLY when the source is unavailable; KVM pvclock path retained | +| 1.3 | acpid bounded S5 + FADT reset-reg reboot + 8042 fallback | 5 s bounded delay → named terminal fallback chain (reset-reg → 8042 pulse → halt-with-error); never an unbounded spin | +| 1.4 | ps2d fully optional | Kernel-owned i8042 presence verdict; conditional IRQ1/12 wiring; ps2d exits 0 with one info line when absent (§3.1) | +| 1.5 | Threading substrate validation | `redbear-threadtest` recipe in redbear-mini; layer-isolated tests (kernel futex → relibc pthread → std PAL → `thread::scope`); QEMU reproduce → root-cause fix in the proven-failing durable component → bare-metal soak riding the Gate A boot | + +**Gate 1 (part of Gate A):** kernel boots with all 24 threads; TSC source asserted; +poweroff/reboot terminate cleanly; no-i8042 boot reaches login on USB HID. + +--- + +### PHASE 2 — ACPI/acpid hardening, continuing the ACPICA-to-Rust port (Wave 2, todos 9–14) + +Per the LG plan §2.3 verdict: port ACPICA's algorithms and data structures into the +vendored acpi-rs fork + acpid, never the C library. + +| # | Work item | Notes | +|---|---|---| +| 2.1 | RSDP producer contract | Explicit bootloader → kernel → hwd/init env → acpid chain; BIOS-search fallback wired; startup diagnostic naming the producer | +| 2.2 | GPE dispatch hardening (evgpe port) | Default-on dispatch; **one serialized AML executor** with opcode-count + wall-clock budgets; per-GPE pending/coalescing state; masked-until-queued; queue-full recovery; storm detection; all AML everywhere routed through it | +| 2.3 | Power-resource engine | `_PR0`/`_PR3`/`_STA`/`_ON`/`_OFF` with ref-counting and cycle detection; this board's tree is `\_SB.PCI0.GPP7.*` (40+ PWRS resources); enumerate + expose only, act on explicit consumer request | +| 2.4 | Namespace-wide `_PRW` wake enumeration | Replaces the laptop-oriented fixed candidate list; AMD desktop GPP paths covered | +| 2.5 | `_OSC` negotiation + `_REG` opregion-connect | Two-pass query-then-control per root bridge; support vs control DWORDs kept separate; request NO native control yet; `_REG` wiring for EC/PCI_Config/SystemMemory opregions through the serialized executor | +| 2.6 | AMD-Vi interrupt remapping structural correction | IVHD 0x40 + IVMD 0x20/0x21/0x22 (scope selectors; exclusion via flags field); per-device/alias IRT from EFR; BDF-aware MSI programming owned by pcid; the unconditional-true kernel delivery gate (`irq.rs:221-227`) removed | + +**Gate 2 (feeds Gate A/B):** host tests green; QEMU EC/power-button regression clean; +QEMU AMD-Vi self-test shows per-device IRTE + delivered-through-remap interrupt. + +--- + +### PHASE 3 — PCI resource safety (Wave 3, todos 15–17) + +| # | Work item | Notes | +|---|---|---| +| 3.1 | Fail-closed resource auditor in pcid | Namespace-wide `_CRS` via the serialized AML executor; containment-vs-conflict classification; block enable/map until normalized resources exist; segment-0 fail-closed | +| 3.2 | Transactional cold-plug BAR/bridge-window allocator | Strategy-selected; tighten oversized bridge windows first, relocate subtree only if needed; snapshot → disable → size → program → verify → restore; failure leaves the subtree disabled (§3.2 callout) | +| 3.3 | Segment-aware MCFG handling | Multi-segment entries currently warn-skipped (`cfg_access/mod.rs:307-315`); bounded handling | + +**Gate 3 (feeds Gate A):** allocator planner host tests green; the AMDIF031-class +conflict shape from the task-3 evidence is repaired in simulation. + +--- + +### PHASE 4 — Storage + USB (Wave 4, todos 18–20) + +| # | Work item | Notes | +|---|---|---| +| 4.1 | NVMe HMB (FID 0x0D) for the ADATA 1cc1:5766 | Exact dword layout (CDW10 FID, CDW11 EHM/MR, CDW12 HSIZE 4 KiB, CDW13/14 descriptor DMA, CDW15 count); HMMIN floor with clean disable; zero flags before freeing; Gate A HMB assertion conditional on HMPRE > 0 per `nvme id-ctrl` evidence | +| 4.2 | UAS wiring in usbscsid | Dispatch currently matches protocol 0x50 only — wire 0x62; speed-aware streams (USB2 no-stream OK; SuperSpeed needs streams or BOT fallback); typed errors; QEMU `usb-uas` proof | +| 4.3 | xHCI quirk parity | All five controllers through the canonical redox-driver-sys quirk table; mask `0x200000010` covered by existing rules; consumes the Phase 0 DMI profile | + +**Gate 4 (feeds Gate A):** QEMU storage/USB harnesses green; both-NVMe bind asserted. + +--- + +### PHASE 5 — Wired network: `redbear-r8125d` (Wave 5, todos 21–24 + Gate A at todo 23) + +| # | Work item | Notes | +|---|---|---| +| 5.1 | `redbear-r8125d` core | New Rust driver for RTL8125 (10ec:8125); port Linux `r8169` 8125 sections (MAC_VER_61–66, shared-descriptor model); rtl8168d stays untouched (CORRECTION 2) | +| 5.2 | PHY/firmware/integration | `rtl_nic/rtl8125*-*.fw` via firmware-loader; firmware-action executor; `redbear-firmware-realtek` is the SOLE owner of `rtl_nic/**` (monolith excludes it; zero-collision assertion in mini+full); driver-manager match entry with correct subclass filter | +| 5.3 | Policy commits (todo 24) | Three policy commits: linux-kpi mt76 C-transport exemption (root-AGENTS.md amendment, operator pre-approved), amdgpu/DCN315 bounded C-gap regularization, firmware redistribution policy (pinned linux-firmware tag + SHA-256/WHENCE manifest) — blocks Phases 5.2, 6, 7 | +| 5.4 | **Net integration + GATE A (todo 23)** | The minimally-usable milestone: boot to login on the MS-7D70 with USB HID input, both NVMe bound (HMB conditional), AHCI + xHCI ×5 claimed, dual-IO-APIC asserted, TSC source + drift asserted, bounded shutdown/reboot, RTL8125 link + traffic; `redbear-gate-a-check` packaged checker; `make validate CONFIG_NAME=redbear-mini` archived | + +**Gate A:** minimally-usable bare-metal boot on the MS-7D70 host. + +--- + +### PHASE 6 — Wi-Fi: `redbear-mt7922` (Wave 6, todos 25–28) + +| # | Work item | Notes | +|---|---|---| +| 6.1 | mt76 C transport | Bounded: WFDMA rings, Connac descriptors, ROM-patch + WM firmware transfer, MCU mailbox, reset — under the Phase 5.3 exemption; NO host MLME in C | +| 6.2 | Rust SoftMAC control plane | Reusable station/supplicant core (EAPOL 4-way, RSN IE, replay/MIC, PTK/GTK, defrag/reorder, mgmt frames, wifictl control protocol) as a library-only crate + MT7922 adapter; fail-closed regulatory (unknown domain = 2.4 GHz ch1–11 low power); ADDBA/DELBA BA-session lifecycle; open + WPA2 fixture integration tests | +| 6.3 | Firmware + wifictl | `mediatek/WIFI_RAM_CODE_MT7922_1.bin` + `mediatek/WIFI_MT7922_patch_mcu_1_1_hdr.bin` via firmware-loader; redbear-wifictl backend | +| 6.4 | Wi-Fi bounded ladder on bare metal | probe → fw boot alive → scan → association → DHCP → reconnect persistence, using the existing `redbear-phase5-wifi-*` harness pattern | + +**Gate 6 (feeds Gate B):** MT7922 associates and passes traffic on the host. + +--- + +### PHASE 7 — Bluetooth + Raphael display (Wave 7, todos 29–34) + +| # | Work item | Notes | +|---|---|---| +| 7.1 | redbear-btusb btmtk module | WMT protocol port (~700 LoC reference), 0x0E8D probing, `BT_RAM_CODE_MT7922_1_1_hdr.bin`; real USB HCI transport (control/interrupt/bulk, STALL recovery — replacing the in-memory StubTransport); HCI core suite passes unchanged | +| 7.2 | Raphael probe (read-only) | BAR roles, IP discovery, ATOM, firmware inventory — the top-3 unknowns (BAR/IP topology, display bootstrap chain, scanout memory semantics) answered from evidence BEFORE any port | +| 7.3 | Raphael firmware staging | The 11-blob DCN 3.1.5 set (CORRECTION 1) via fetch-firmware.sh + redbear-firmware-amdgpu; manifest entries for gc_10_3_6/sdma_5_2_6/vcn_3_1_2/psp_13_0_5 | +| 7.4 | Wi-Fi + BT coexistence validation | Shared-antenna pair on this board; bounded bare-metal proof | +| 7.5 | DCN315 minimal display slice | Closure-first (derive the compile/link closure before porting); DML/resource-pool/HWSS reimplemented in Rust from reference; register access/DMUB/fw-load on the authorized C ABI surface; one HDMI/DP monitor lit on the iGPU at legacy modeset | +| 7.6 | iGPU modeset gate on bare metal | The display gate; vesad remains the fallback; atomic KMS is explicitly NOT in this plan | + +**Gate 7 (feeds Gate B):** one monitor driven by the Raphael iGPU; BT HCI +operational; coexistence proven. + +--- + +### PHASE 8 — Platform drivers + deferred-docs + Gate B (Waves 8–9, todos 35–40) + +| # | Work item | Notes | +|---|---|---| +| 8.1 | ihdad AMD widening | driver-manager TOML vendor=0x8086-only today → claim 1022:15e3; runtime-verify verbs/CORB/RIRB | +| 8.2 | AMD CPPC cpufreq | MSRs 0xC00102B0–0xC00102B5 (CAP1/ENABLE/REQ/STATUS/REQ2), CPUID 0x80000008:EBX[27] gate; REQ2 FloorPerf + readback + APERF/MPERF; REQ2 support bit CPUID 0x80000007:EDX[16] with negative test | +| 8.3 | k10temp driver | 1022:14e3 thermal readout feeding redbear-power/thermald | +| 8.4 | `redbear-smbusd` + gpio-amdpt | FCH SMBus (1022:790b, piix4-style MMIO) — new daemon (amd-mp2-i2cd is a different IP); gpio-amdpt (AMDIF031) launched via the new ACPI HID→driver spawn path (registry, claim, capability-safe `_CRS` handoff, lifecycle, integration tests) | +| 8.5 | Deferred-with-docs table | See §7.1 — rows to be filled during execution (todo 39) | +| 8.6 | **GATE B (todo 40)** + matrix finalization | Full bare-metal pass on redbear-full: Gate A surface + Wi-Fi + BT + coexistence + iGPU modeset + HDA + CPPC + k10temp + SMBus/GPIO; `redbear-gate-b-check`; `make validate CONFIG_NAME=redbear-full` archived; HARDWARE-VALIDATION-MATRIX final refresh | + +**Gate B:** full bare-metal validation on the MS-7D70 host. + +--- + +## 5. Dependency Graph + +Summarized from the work plan's dependency matrix (lines 78–120). Todo numbers are +the plan's; phases above parenthesize theirs. + +``` +Phase 0 (todos 1-4: doc, DMI profile, evidence, matrix) + ├── todo 3 evidence ──► todo 15 (PCI auditor), todo 30 (Raphael probe) + └── todo 2 DMI profile ──► todo 20 (xHCI quirk parity) + +Phase 1 (todos 5-8, 41: MADT, TSC, S5/reboot, ps2d, threading) ──► all block todo 23 (Gate A) + +Phase 2 (todos 9-14: ACPI/AMD-Vi) + ├── todo 10 serialized AML executor ──► todos 11, 12, 13, 40; also 15, 38 + ├── todo 14 AMD-Vi IRTE ──► todo 23 (Gate A) + └── todos 9, 11, 12, 13 ──► todo 40 (Gate B) + +Phase 3 (todos 15-17: PCI resources) + ├── todo 15 auditor (deps 3, 10) ──► todo 16 allocator + └── todo 17 MCFG ──► todo 16; todo 16 ──► todo 23 (Gate A) + +Phase 4 (todos 18-20: HMB, UAS, xHCI) ──► all block todo 23 (Gate A) + +Phase 5 (todos 21-23 + 24 policy) + ├── todo 24 policy commits ──► blocks 22, 25, 27, 31, 33 (Wi-Fi/BT/firmware/display all wait on it) + ├── todo 21 r8125d core ──► todo 22 (deps 21, 24) ──► todo 23 + └── todo 23 GATE A (deps 5,6,7,8,14,16,18,19,20,22) ──► blocks 28, 29 + +Phase 6 (todos 25-28: mt76 transport → SoftMAC → firmware/wifictl → BM ladder) + 24 ──► 25 ──► 26 ──► 27 (deps 24,26) ──► 28 (deps 23,27) ──► 32 + +Phase 7 (todos 29-34: BT, probe, firmware, coexistence, DCN315, modeset) + ├── 29 btmtk (deps 23,27) ──► 32 + ├── 30 probe (dep 3) + 31 firmware (dep 24) ──► 33 DCN315 (deps 24,30,31) ──► 34 modeset (deps 23,33) + └── 32 coexistence (deps 28,29) ──► 40; 34 ──► 40 + +Phase 8 (todos 35-39: HDA, CPPC, k10temp, SMBus/GPIO, deferred-docs) + ├── 38 deps 10,15 (AML executor + resource auditor) + └── 35,36,37,38,39 ──► todo 40 GATE B (deps 9,10,11,12,13,23,28,32,34,35,36,37,38,39) +``` + +Longest poles: todo 24 (policy) gates the entire Wi-Fi/BT/display track — land it +early; the Gate A chain (substrate + PCI + storage/USB + r8125) gates everything +bare-metal afterward. + +## 6. Suggested Execution Order + +1. **Pre-Wave-0 (serial):** ten-SHA `baselines.toml` snapshot before any todo commits. +2. **Phase 0** — doc, DMI profile, evidence capture (incl. operator BIOS iGPU + enablement + GOP/BAR capture), matrix annotations. +3. **Phase 1 + Phase 2 + Phase 3** — boot substrate, ACPI/AMD-Vi, PCI resources. + These are kernel/base-internal and parallelize; todo 24's policy commits should + land here too (they gate Phases 5–7). +4. **Phase 4 + Phase 5** — storage/USB + r8125d → **Gate A** (minimally usable). + Everything from Phase 6 onward serializes behind Gate A's bare-metal pass. +5. **Phase 6** — MT7922 Wi-Fi (start the C transport early; longest single port). +6. **Phase 7** — BT btmtk, Raphael probe → firmware → DCN315 slice → modeset gate. +7. **Phase 8** — platform drivers, deferred-docs table, **Gate B** + matrix final. +8. **Continuous** — matrix refresh at every gate; all quirks as data-driven entries; + durability rule (fork commits or local/recipes in the same session) everywhere. + +## 7. Explicitly Out of Scope (per policies) + +- **NVIDIA RTX 4080 (10de:2704)** — explicitly excluded by the operator. No + nouveau/NVK work, no display path through the dGPU, no exceptions. +- **Suspend/sleep (S3/s2idle)** — desktop target: S5 shutdown + reboot only. + Sleep work stays in `local/docs/ACPI-IMPROVEMENT-PLAN.md`. +- **TPM2 (MSFT0101), sp5100_tco watchdog, AMD PSP (1022:1649), EDAC/RAS** — + no consumer today; documented deferral (table below). +- **MSI vendor drivers** — Mystic Light RGB (1462:7d70), AIO (0db0:6a05), + Nuvoton (0db0:9ba6): enumerate-and-tolerate only; vendor-software domain. +- **UAC 2.0 audio (0db0:d6e7)** — redbear-usbaudiod is UAC 1.0 only; the UAC2 + gap is documented, not closed here. +- **Atomic KMS / Mesa / radeonsi / 3D** — belongs to + `local/docs/3D-DESKTOP-COMPREHENSIVE-PLAN.md`; this plan ends at legacy + modeset + framebuffer on the iGPU. +- No removal/ignore/comment-out of any package, patch, BINS entry, or service + to make anything pass (ABSOLUTE RULE). No stubs. No copied Linux/ACPICA + implementation code (reference-only policy; the only C surface is the two + Phase-5.3 exemptions' firmware-ABI boundary). + +### 7.1 Deferred-with-docs devices (placeholder — rows filled by todo 39 during execution) + +| Device | Reason | What would unblock | +|---|---|---| +| *(todo 39 fills rows during execution)* | | |