Skip to content

Commit 888cc46

Browse files
committed
docs: reorganize and condense NXP T2080 target documentation
1 parent b136684 commit 888cc46

1 file changed

Lines changed: 17 additions & 190 deletions

File tree

docs/Targets.md

Lines changed: 17 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -5999,202 +5999,29 @@ The flash boot entry point is the last 4 bytes of the NOR flash region (`0xEFFFF
59995999
60006000
```
60016001
CPU Core -> L1 (32KB I + 32KB D) -> L2 (2 MB, shared by the single 4-core cluster)
6002-
CoreNet Fabric CPC (2MB, SRAM or L3 cache)
6003-
DDR Controller DDR SDRAM
6004-
IFC Controller NOR Flash
6002+
-> CoreNet Fabric -> CPC (2MB, SRAM or L3 cache)
6003+
-> DDR Controller -> DDR SDRAM
6004+
-> IFC Controller -> NOR Flash
60056005
```
60066006
60076007
Each core begins execution at effective address `0x0_FFFF_FFFC` with a single
60086008
4KB MMU page (RM 4.3.3). The assembly startup (`boot_ppc_start.S`) configures
60096009
TLBs, caches, and stack before jumping to C code.
60106010
6011-
**Cold Boot Stack (L1 Locked D-Cache)**
6012-
6013-
CPC SRAM is unreliable for stores on cold power-on — L1 dirty-line evictions
6014-
through CoreNet to CPC cause bus errors (silent CPU checkstop with `MSR[ME]=0`).
6015-
The fix (matching U-Boot) uses L1 locked D-cache as the initial 16KB stack:
6016-
`dcbz` allocates cache lines without bus reads, `dcbtls` locks them so they
6017-
are never evicted. The locked lines at `L1_CACHE_ADDR` (`0xF8E00000`; `0xEE800000` on VPX3-152) are
6018-
entirely core-local. After DDR init in `hal_init()`, the stack relocates to
6019-
DDR and the CPC switches from SRAM to L3 cache mode.
6020-
6021-
**Flash TLB and XIP**
6022-
6023-
The flash TLB uses `MAS2_W | MAS2_G` (Write-Through + Guarded) during XIP
6024-
boot, allowing L1 I-cache to cache instruction fetches while preventing
6025-
speculative prefetch to the IFC. C code switches to `MAS2_I | MAS2_G` during
6026-
flash write/erase (command mode), then `MAS2_M` for full caching afterward.
6027-
6028-
**CCSRBAR Relocation (CW VPX3-152 only)**
6029-
6030-
The default CCSRBAR at `0xFE000000` (16 MB) falls within the VPX3-152's 256 MB
6031-
flash VA range (`0xF0000000`-`0xFFFFFFFF`). The startup assembly relocates
6032-
CCSRBAR to `0xEF000000` (just below flash). The CPC SRAM and L1 cache addresses
6033-
are also relocated to `0xEE900000`/`0xEE800000` to avoid overlap.
6034-
6035-
**Boot ROM TLB invalidation (CW VPX3-152 only)**
6036-
6037-
For VPX3-152, TLB1 Entry 2 maps the full 256 MB flash at `0xF0000000-0xFFFFFFFF`
6038-
with IPROT. This range overlaps with the boot ROM TLB (default 4 KB at
6039-
`0xFFFFF000`, resized to 256 KB at `0xFFFC0000` by `shrink_default_tlb1`).
6040-
Overlapping TLB1 entries cause an e6500 multi-hit machine check. After Entry 2
6041-
is created, the boot ROM TLB is cleared via `tlbwe` with `V=0` and `IPROT=0`;
6042-
Entry 2 then serves all instruction fetches for the flash region including the
6043-
boot ROM range. For NAII 68PPC2 and T2080 RDB (128 MB flash at `0xE8000000`),
6044-
there is no overlap and the boot ROM TLB remains valid alongside Entry 2.
6045-
6046-
**RAMFUNCTION Constraints**
6047-
6048-
The NOR flash (two S29GL01GS x8 in parallel, 16-bit bus) enters
6049-
command mode bank-wide — instruction fetches during program/erase return status
6050-
data instead of code. All flash write/erase functions are marked `RAMFUNCTION`,
6051-
placed in `.ramcode`, copied to DDR, and remapped via TLB9. Key rules:
6052-
6053-
- **No calls to flash-resident code.** The linker generates trampolines that
6054-
jump back to flash addresses. Any helper called from RAMFUNCTION code must
6055-
itself be RAMFUNCTION or fully inlined. Delay/clock helpers (for example,
6056-
`udelay` and associated clock accessors) are provided by `nxp_ppc.c` and
6057-
are marked `RAMFUNCTION` so they can be safely invoked without executing
6058-
from flash `.text`.
6059-
- **Inline TLB/cache ops.** `hal_flash_cache_disable/enable` use
6060-
`set_tlb()` / `write_tlb()` (inline `mtspr` helpers) and direct
6061-
L1CSR0/L1CSR1 manipulation.
6062-
- **WBP timing.** The write-buffer-program sequence (unlock → 0x25 → count →
6063-
data → 0x29) must execute without bus-stalling delays. UART output between
6064-
steps (~87us per character at 115200) triggers DQ1 abort.
6065-
- **WBP abort recovery.** Plain `AMD_CMD_RESET` (0xF0) is ignored in
6066-
WBP-abort state; the full unlock + 0xF0 sequence is required.
6067-
6068-
**Multi-Core (ENABLE_MP)**
6069-
6070-
The e6500 L2 cache is per-cluster (shared by all 4 cores). Secondary cores
6071-
must skip L2 flash-invalidate (L2FI) since the primary core already
6072-
initialized the shared L2; they only set L1 stash ID via L1CSR2.
6073-
6074-
**e6500 64-bit GPR**
6075-
6076-
The e6500 has 64-bit GPRs even in 32-bit mode. `lis` sign-extends to 64 bits,
6077-
producing incorrect values for addresses >= 0x80000000 (e.g., `lis r3, 0xEFFE`
6078-
→ `0xFFFFFFFF_EFFE0000`), causing TLB misses on `blr`. The `LOAD_ADDR32`
6079-
macro (`li reg, 0` + `oris` + `ori`) avoids this for all address loads.
6080-
6081-
**MSR Configuration**
6082-
6083-
After the stack is established: `MSR[CE|ME|DE|RI]` — critical interrupt,
6084-
machine check (exceptions instead of checkstop), debug, and recoverable
6085-
interrupt enable. Branch prediction (BUCSR) is deferred to `hal_init()` after
6086-
DDR stack relocation.
6087-
6088-
**e6500 Cluster L2 ECC bring-up**
6089-
6090-
The e6500 cluster L2 (memory-mapped `L2CSR0`) must be enabled in a specific
6091-
order or its ECC array is left uninitialized for ranges the OS later fetches,
6092-
producing an uncorrectable multi-bit ECC machine check (`MCSR[IF]`,
6093-
`L2ERRDET` MBECC). `boot_ppc_start.S` follows the CW U-Boot / SDK2.0 sequence:
6094-
(1) `L2FI | L2LFC` (flash-invalidate + lock-flash-clear), polling until clear;
6095-
(2) `L2PE` (ECC enable) in its own write, polling until it reads back set,
6096-
BEFORE the cache is enabled; (3) `L2E | L2PE | L2REP_MODE` to enable the cache
6097-
with ECC. Writing a bare `L2E` without first polling `L2PE` set is the
6098-
misordering that machine-checks VxWorks.
6099-
6100-
#### VxWorks 7 64-bit Boot Support (ENABLE_OS64BIT)
6101-
6102-
When `ENABLE_OS64BIT` is set, `do_boot()` performs the additional handoff
6103-
work needed to launch a VxWorks 7 64-bit kernel (Curtiss-Wright `ossel=ostype2`
6104-
mode) or a 64-bit Linux kernel via the ePAPR convention.
6105-
6106-
**ePAPR handoff:** wolfBoot passes the FDT pointer in `r3`, the IMA size in
6107-
`r7`, and `0x45504150` (`'EPAP'`) in `r6`. Other GPRs are zero. MSR is
6108-
`0x00002200` (`FP|DE`); the OS sets `MSR[CM]=1` itself within its first ~30
6109-
instructions.
6110-
6111-
**Final 64-bit memory map (FUM Table 2.5).** `hal_os64bit_map_transition()`
6112-
in `src/boot_ppc.c` performs the board-agnostic DDR-to-slot-0 remap and
6113-
delegates the board-specific peripheral LAW/ATMU programming to
6114-
`hal_cw_vpx3152_os64_periph()`, which builds the 36-bit-aliased peripheral
6115-
map VxWorks 7 expects on CW VPX3-152:
6116-
6117-
| Effective Address | Physical Address | Region |
6118-
|---|---|---|
6119-
| `0xF000_0000` | `0xF_F000_0000` | Flash (256 MB) |
6120-
| `0xEF00_0000` | `0xF_EF00_0000` | CCSR (16 MB) |
6121-
| `0xEE40_0000` | `0xF_EE40_0000` | FPGA / NVRAM (4 MB span) |
6122-
| `0xEE00_0000` | `0xF_EE00_0000` | DCSR (4 MB) |
6123-
| `0xEC00_0000` | `0xF_EC00_0000` | QMan portals (32 MB) |
6124-
| `0xEA00_0000` | `0xF_EA00_0000` | BMan portals (32 MB) |
6125-
| `0xE000_0000` | `0xD_0000_0000` | PCIe1 (XMC) memory (2 GB) |
6126-
| `0xC000_0000` | `0xC_0000_0000` | PCIe4 (Switch) memory (2 GB) |
6127-
| `0x0000_0000` | `0x0_0000_0000` | DDR identity (2 GB, slot 0) |
6128-
6129-
**DDR at TLB1 slot 0.** VxWorks 7's early entry stub iterates TLB1 from
6130-
slot 1 upward invalidating each entry, then reads slot 0 expecting it to
6131-
contain the DDR mapping. wolfBoot pins DDR at slot 12 by default; the
6132-
OS-handoff transition invalidates slot 12 and writes DDR identity (2 GB,
6133-
`MAS3_SX|SW|SR`, `MAS2_M`, IPROT) at slot 0.
6134-
6135-
**Spin-table.** `hal_mp_init()` places the secondary-core spin-table at
6136-
`bootpg - BOOT_ROM_SIZE`. For VxWorks 7 the bootpg is anchored just below
6137-
the FUM `/memory` hole at `0x7E40_0000` so `cpu-release-addr` lands inside
6138-
declared memory. `hal_mp_up()` releases all secondaries into the spin loop
6139-
via `DCFG_BRR` regardless of `ENABLE_OS64BIT` (the earlier theory that CW
6140-
U-Boot holds the secondaries in reset for `ossel=ostype2` was disproven --
6141-
U-Boot also releases CPU0/2/4/6 into the spin loop first). The OS then
6142-
brings up each released core via the standard ePAPR spin-table protocol
6143-
(`cpu-release-addr` in the FDT).
6144-
6145-
**FDT fixups.** `hal_dts_fixup()` populates `cpus/cpu@N/cpu-release-addr`
6146-
and `enable-method = "spin-table"` for every core, and marks every core
6147-
`status = "okay"` (marking the secondaries `"disabled"` made VxWorks skip
6148-
them and stall on the first spin-table release). The
6149-
DTB's existing `/memory.reg` is left untouched if already populated
6150-
(matching production U-Boot's `fdt_fixup_memory` which only writes when
6151-
the node is missing). The DTB's bootargs is replaced with the
6152-
`WOLFBOOT_BOOTARGS` value from `.config` if defined.
6153-
6154-
**RAMFUNCTION OS-jump trampoline.** wolfBoot is XIP from flash by default;
6155-
`wolfBoot_os64bit_jump()` is a `RAMFUNCTION` (lives in `.ramcode` /
6156-
DDR). Steps it performs in order:
6157-
6158-
1. Copy the exception handler (`isr_empty`, ~208 bytes) from flash
6159-
`0xFFFE_0000` to DDR at `0x0080_0000` (4 KB-aligned), then re-point
6160-
`IVPR` to the DDR copy. Without this, the next step (switching
6161-
flash to cache-inhibit + guarded) would break the e6500 fetcher's
6162-
ability to service handler instructions, causing any subsequent
6163-
exception to silent-hang. Production U-Boot's `IVPR` likewise
6164-
targets its DDR-relocated code, not flash.
6165-
2. Call `hal_flash_cache_disable_pre_os()` (also `RAMFUNCTION`) which
6166-
switches the flash TLB to `MAS2_I|MAS2_G`, asserts DUART1 MCR=3
6167-
(DTR+RTS, matching production U-Boot's pre-bootm value), and zeros
6168-
`TCR` to disable any leftover watchdog reset arming.
6169-
3. `sync; isync` to drain the pipeline.
6170-
4. Indirect-jump to the OS entry through `bctrl`. The bctrl is fetched
6171-
from DDR (the trampoline itself), matching the production U-Boot
6172-
pattern of running its final pre-OS instructions out of DDR.
6173-
6174-
**Other VxWorks-driven adjustments:**
6175-
6176-
- `CORES_PER_CLUSTER = 4` for T2080: the four e6500 cores share a single
6177-
cluster (2 MB L2), so the MP secondary path's linear core-ID is
6178-
`(PIR>>5)*4 + ((PIR>>3) & 0x3)`. The cluster term is 0 on this one-cluster
6179-
part; an earlier value of 2 (a mistaken "2 clusters of 2" reading) was
6180-
masked by that and only worked by accident.
6181-
- T2080 rev-1 e6500 errata block at primary core reset and the
6182-
secondary boot path. Erratum A003999 (HDBCR1 |= 0x0100_0000) is
6183-
intentionally NOT applied because production CW U-Boot does not
6184-
apply it to T2080.
6185-
- Secondary L2 init is gated on cluster ID > 0; T2080's four cores are all
6186-
in cluster 0, so every secondary skips it and shares the boot core's L2.
6187-
- IFC chip-selects on CW VPX3-152: AMASK + `MSEL=GPCM` aligned with CW
6188-
U-Boot's CSPR programming. CSOR is left alone while wolfBoot is still
6189-
XIP from flash (writing CSOR would alter the GPCM timing of the very
6190-
flash we are fetching from).
6191-
6192-
**Early-boot UART debug (`WOLFBOOT_EARLY_UART`).** Defining this
6193-
preprocessor flag compiles in the e6500 early-boot (pre-C) UART debug
6194-
helper macros in `src/boot_ppc_start.S` (DUART1 at `CCSR + 0x11C500`).
6195-
They emit single-character breadcrumbs from the assembly startup when
6196-
bringing up a new board or OS, before the C `wolfBoot_printf` path is
6197-
available. Off by default.
6011+
The HAL handles several QorIQ boot constraints; the rationale is documented in `src/boot_ppc_start.S` and `hal/nxp_t2080.c`:
6012+
6013+
- **Cold-boot stack.** CPC SRAM is unreliable for stores on cold power-on, so the initial 16KB stack uses locked L1 D-cache and relocates to DDR after `hal_init()`.
6014+
- **XIP flash access.** wolfBoot executes in place from NOR. Because program/erase puts the NOR into command mode bank-wide, all flash write/erase routines are `RAMFUNCTION` (copied to DDR) and must not call flash-resident code; the flash TLB switches cache attributes around program/erase.
6015+
- **Multi-core (`ENABLE_MP`).** The e6500 L2 is shared by all four cores in the single cluster, so secondaries skip L2 re-init and share the boot core's L2.
6016+
- **CW VPX3-152 (256 MB NOR) only.** The larger flash VA range forces CCSRBAR to relocate from `0xFE000000` to `0xEF000000` (CPC/L1 addresses move to `0xEE900000`/`0xEE800000`), and the boot-ROM TLB is invalidated to avoid an e6500 multi-hit machine check. The 128 MB RDB and NAII boards need neither adjustment.
6017+
6018+
#### VxWorks 7 / 64-bit OS Boot Support (ENABLE_OS64BIT)
6019+
6020+
With `ENABLE_OS64BIT`, `do_boot()` performs the extra handoff needed to launch a 64-bit kernel -- a VxWorks 7 kernel (Curtiss-Wright `ossel=ostype2` mode) or a 64-bit Linux kernel via the ePAPR convention. This path is hardware-verified on the CW VPX3-152 booting VxWorks 7 and Green Hills INTEGRITY-178 tuMP.
6021+
6022+
wolfBoot hands off per ePAPR: FDT pointer in `r3`, `'EPAP'` in `r6`, IMA size in `r7`, remaining GPRs zero, with the OS switching itself to 64-bit mode. Before the jump wolfBoot builds the final 64-bit memory map (DDR identity-mapped at TLB1 slot 0, plus the board's peripheral and PCIe windows), fixes up the FDT (`cpu-release-addr`, `enable-method`, per-core `status`, and the `WOLFBOOT_BOOTARGS` bootargs), releases the secondary cores into the ePAPR spin-table, and jumps to the OS entry from a `RAMFUNCTION` trampoline running out of DDR. The board-specific peripheral map is supplied by the board HAL (for the VPX3-152, `hal_cw_vpx3152_os64_periph()`).
6023+
6024+
Set `WOLFBOOT_EARLY_UART` to compile in pre-C single-character UART breadcrumbs (DUART1) emitted from the assembly startup, useful when bringing up a new board or OS. Off by default.
61986025
61996026
### Building wolfBoot for NXP T2080 PPC
62006027

0 commit comments

Comments
 (0)