Addressing and access rules

Three address views that must never be mixed [spec: docsClean/02]:

  1. DDRC/CFG byte offsets — DDRC_BASE + off; host 32-bit accesses.

  2. Host DPHY word index i — DPHY_BASE + 4*i; each 32-bit host word carries one 16-bit PHY CSR in its low half.

  3. ARC addresses inside the PMU — 0x0000xxxx IMEM, 0x8000xxxx DMEM, 0x90xxxxxx PHY CSRs / mailbox.

Conversions

ARC CSR address  = 0x90000000 | (i << 1)
ARC DMEM address = 0x80000000 + 2 * (i - 0x58000)     (0x58000 <= i < 0x60000)
CSR index        = base | (rank << 12) | (lane << 8) | offset   (OR, never +)

Firmware helpers: PHY_CSR_ARC(), PHY_IDX(), DMEM_ARC() in src/hal/mmio.h.

Windows

Host index

ARC

Use

0x41000

via CSRs

ACSM SRAM, 4096 halfwords

0x50000

0x00000000

PMU IMEM, 64 KiB

0x58000

0x80000000

message block (0x140 bytes used, 0x400 reserved)

0x58200

0x80000400

host parameter area (full training: up to 0x584d1)

0x584d2

0x800009a4

cleared by the host up to 0x5ffff before release

0x5a000

0x80004000

our DMEM image (.rodata/.data), loaded by our SPL patch [design]

0x5f000

0x8000e000

transient host scratch (256 bytes) — unused by us

0x60000

0x80010000

DMEM end, initial stack top

Access widths

On the PMU side, DMEM shared with the host and every 0x90xxxxxx register are 16-bit: only volatile 16-bit (or 8-bit for byte fields) accesses [spec: docsClean/12, BR-03]. Our own stack and .bss in DMEM are accessed with ordinary 32-bit loads/stores by the compiler; whether that is safe in every DMEM range is checked by experiment [open].

Warning

Never access DPHY/PMU MMIO from Linux (/dev/mem): reported to stall the SoC until a power cycle [spec: docsClean/14]. Re-verification is scheduled for the later validation phase.

Host access after a PMU run

What the SPL can reach once the PMU has run and been stalled (0xd0099 = 1, 0xd0000 = 0) [exp 016, exp 019]:

Target

Behaviour

PHY CSRs

read and write work with 0xc0080 = 3

ACSM SRAM

read and write work with 0xc0080 = 3 (4096 of 4096 halfwords read back)

DMEM (message

reads work, writes are dropped with 0xc0080 = 3

block)

(a SequenceCtrl write reads back the old value); with 0xd0099 = 9 DMEM reads 0

docsClean/12 gives the sequence for a DMEM write between two runs: 0xd0099 = 1, 0xd0000 = 0, ``0xc0080 = 7``, write, 0xd0000 = 1, then 0xd0099 = 9, 1, 0 [spec, not yet tried]. The initial load, before the first start, works with the vendor flow as is.

A second start of the loaded firmware (0xd0000 = 1, 0xd0099 = 9, 1, 0) works without reloading IMEM or DMEM: the firmware runs again from its entry and the message block keeps what the first run left [exp 016].