Repository navigation
storage: Read NVMe on the T8011 (A10X) - #24
Conversation
adt_getprop_copy() copied the full ADT property value into the caller buffer via p.copy_raw() before checking whether the property size matched len, overflowing smaller destination buffers when an ADT property was larger than expected. Check p.size as usize != len before copying so mismatched properties return AdtError::BadLength without touching the output buffer. Assisted-by: LLM Signed-off-by: Grier Johnson <grier@scooterfarm.com>
Add an apcie,t8011 entry to apcie_nvme so m1n1's boot manager can read internal storage on A10X boards (iPad Pro 2: J120, J121, J207, J208). T8011 has six PCIe ports instead of four, shifting the RC and PHY register windows in /arm-io/apcie from reg[9]/reg[10] to reg[13]/reg[14], and brings up port 0 via the NAND sysclk enable, pipe reset release, and pipe-clock ungated poll (matching Linux's pcie-apple-h9p.c and iPadOS's AppleT8011PCIe). DART, NVMMU, BAR mapping, L1SS, and GPIO setup match T8010. Additional hardening: - Validate T8011 lane-cfg (length and value) in read_adt() before powering hardware. - If port 0 link is already up at entry, assert PERST# and reset the port cleanly before reprogramming NVMMU/DART mappings, and read LTSSM once per decision. - Require the PCIe capability on the root port and update Link Control 2 with mask16() instead of a 32-bit RMW. - Track init stages (port_started, link_up after endpoint ID, nvmmu_started, dart_started) so early failure only unwinds initialized hardware. - Validate completion sq_id and cid in submit(), and disable/shut down the controller before retiring a timed-out DMA tag so a late transfer cannot contaminate a subsequent boot attempt. On shutdown, gate NAND sysclk and clear port 0 clocks cleanly so Linux's pcie-apple-h9p brings up both NVMe (port 0) and Wi-Fi (port 2) without errors. Tested on J207 (iPad Pro 10.5-inch, Wi-Fi): orchard launch --m1n1 boots installed Omarchy A directly from internal NVMe, and Linux brings up NVMe and BCM4355 Wi-Fi cleanly. Ref: OrchardLinux/orchard#553 Assisted-by: LLM Signed-off-by: Grier Johnson <grier@scooterfarm.com>
6bcce5e to
9ce5c0e
Compare
|
Merged, thank you @grierj, and welcome! A great first contribution here: the T8011 bring-up follows the iPadOS driver and the Linux one closely, and your test on the 10.5-inch iPad Pro (installed Omarchy A up in 16 s, both PCIe ports clean in Linux afterwards) was exactly the evidence we needed. What this brings: m1n1 can now read the internal storage of the A10X iPad Pros (12.9-inch and 10.5-inch, Wi-Fi and Cellular), so Nothing was changed on your branch and nothing was left out. Follow-up on our side: orchard moves its m1n1 lock to this merge, records launch from storage in the four boards' device data and closes OrchardLinux/orchard#553. The 12.9-inch models and the 10.5-inch Cellular use the same code and should just work; reports from owners are welcome. |
|
Updated (
|
Summary
Adds
apcie,t8011NVMe storage support toapcie_nvmeandmain_storage_start()som1n1's boot manager (orchard launch) can boot installed systems from internal storage on A10X (T8011) boards (J120,J121,J207,J208).Refs OrchardLinux/orchard#553.
Details
apcie_socwithreg_rc,reg_phy, andhas_nand_sysclk(T8011 has 6 PCIe ports so RC and PHY sit at/arm-io/apciereg[13]andreg[14]rather thanreg[9]/reg[10]).t8011_setup_common()andt8011_setup_link()following Linux'spcie-apple-h9p.cand iPadOS'sAppleT8011PCIe(PHY tunables, RC common + port 0 tunables, NAND sysclk enable, pipe reset release, pipe-clock ungated poll, config + storage port tunables).port_down().apcie,t8011tomain_storage_start()insrc/utils.c.Testing
Tested on iPad Pro (10.5-inch, Wi-Fi) (
J207/iPad7,3):m1n1builder image (boot/m1n1/Containerfile).orchard launch --m1n1 build/m1n1.bin --busy-cpu:m1n1initialized internal NVMe, loadedomarchy-a-7cbbc672-7.3.0-rc1-orchard-apple-16kfrom theBOOTpartition, and booted installed Omarchy A directly into Linux in 16 s.tablet@172.16.42.1) that Linuxpcie-apple-h9pcleanly brings up both root ports afterapcie_nvme_shutdown()with zero PCIe/NVMe/DART errors:0000:01:00.0 [106b:2002]NVMe S3E (nvme0n1: p1 p2 p3,/mounted r/w)0000:02:00.0 [14e4:43dc]BCM4355 Wi-Fi (wld0UP)