Architecture
The firmware is a freestanding GNU C23 + microMIPS32r2 program with no
main loop and no threads. After bringing up the MIPS core, shared memory
and GPU units, fw_main() enables interrupts and sleeps in WAIT; all
runtime work runs in interrupt context, one interrupt at a time.
Source files (src/)
File |
Role |
|---|---|
|
Per BVNC. Reset/NMI entry at |
|
Per BVNC. Exception page at |
|
|
|
GPU bring-up at every power-on (docsClean/BXE-2-32/boot-gpu-init): XPU/secure/fault page, MTS event routing and DM association, dust power, SLC bypass, PDS/USC exec bases, unit defaults and init-done handshakes. |
|
Kernel CCB consumer, return slots, Firmware CCB producer (Host ↔ firmware protocol). |
|
|
|
|
|
Context table ( |
|
BIF catalogue slots and rebuild, compute ( |
|
Geometry ( |
|
Fragment ( |
|
Parameter Manager (E041): free-list and list loads/stores of both PM contexts, which HWRTData each context holds (store before evict, dirty flag), out-of-memory handling (ready pages, grow, partial render) and the HWR free-list reconstruction request. |
|
GPU utilisation ( |
|
Hardware recovery: MMU fault or watchdog ( |
|
|
|
Firmware interface structures checked with |
|
Fixed addresses and sizes; also parsed by |
|
RGX register offsets used by the firmware. |
|
Trace IDs generated by |
|
CP0 access ( |
|
Internal firmware state and kick interfaces. |
|
Linker script: four |
Execution model
+--------------------------------------------------------+
HW0 timer --> | irq_dispatch(0): re-arm Compare (1 ms) |
(CP0 Compare) | kccb_process(); sched_poll(); sched_run(); |
+--------------------------------------------------------+
HW1 BG task > | irq_dispatch(1): kccb_process(); sched_poll(); |
(MTS) | sched_run(); MTS_TASK_END = 0 |
+--------------------------------------------------------+
HW2 IRQ task> | irq_dispatch(2): ev = EVENT_STATUS; EVENT_CLEAR = ev; |
(MTS) | sched_irq(ev); MTS_TASK_END = 2 |
+--------------------------------------------------------+
BG task (HW1): the host writes
ROGUE_CR_MTS_SCHEDULEafter queuing a KCCB command; the MTS raises HW1 (E016).IRQ task (HW2): the GPU raises a hardware event (data-master completion, MMU page fault, etc.); the MTS raises HW2 on every completion (E018).
Timer (HW0): CP0
Count/Compareevery 1 ms. Acts as a watchdog tick and a backstop poll racing HW1/HW2; whichever path runs first handles the event.
All three interrupt vectors enter int_common in vectors.S, which
saves caller-saved registers, EPC and Status on the wired stack and
clears EXL / ERL / IE before calling C. Leaving EXL = 1
would send any TLB miss inside C code to the general exception vector instead
of the TLB refill vector and clobber EPC (E002). On return, the
original Status is restored with EXL re-set for ERET.
Interrupts are never nested. Boot-time code calling kccb_process() before
entering WAIT guards itself with irq_save() / irq_restore().
Global state
All firmware state lives in .bss at 0xC0ED0000 and is zeroed on
every boot (cold or warm; no firmware state persists across power cycles):
Object |
Module |
Contents |
|---|---|---|
|
|
Pointers to |
|
|
Contexts seen in |
|
|
Per-DM busy flag, running context, cCCB offset of running command, completion event mask, kick timestamp and bound BIF slot. |
|
|
Page-catalogue physical address bound to each |
Address helper fwptr()
Host-supplied fw_addr fields are MIPS virtual addresses inside the 16 MiB
firmware heap at 0xC0000000 that may carry flag bits (bit 0 = sync
checkpoint; bits above bit 24 = meta-DMA/cached flags). fwptr() masks the
address with 0xC0FFFFFC (preserving 0 as NULL), and the dynamic
TLB refill handler maps the page on demand from the host MIPS page table.
Module dependencies
fw_main -> shared_init -> trace_init -> gpu_power_on -> gpu_units_init (dust_power)
-> sched_init -> kick_init
irq_dispatch -> kccb_process -> {sched_kick, sched_cleanup, mmu_cache_op, pow_handle, ...}
-> sched_poll / sched_irq -> kick_events -> sched_dm_done
-> sched_run -> ctx_process -> kick_task -> {kick_cdm, kick_tq3d, kick_geom, kick_frag}
-> (timer) hwr_watchdog -> hwr_recover; kick_events(MMU fault) -> hwr_recover
everything -> util (TRACE, notify_host, write_barrier, cr_poll32, gpu_timer)