Addressing and address map

MMIO windows

The firmware reaches three register windows, plus the DFC table window (src/lib/k1_ddrt_regs.h, src/blob/blob.c):

window

base

contents

MC

0xc0000000

command ports, STATUS, timing banks, CS map and geometry

PHY

0xc0040000 (ddr + 0x40000)

four 16 KiB slices, COMMON analog blocks, training status / harvest

APMU

0xd4282800

DDR PLLs, clock select, MC reset, frequency-change kicks

DFC window

0xf0000000

write port of the hardware frequency-change table

The full register offset list lives in src/lib/k1_ddrt_regs.h.

CPU address map

After bring-up the MC maps the detected capacity into the CPU address space in two windows: the low 2 GiB at CPU address 0x0 and the rest from 0x1_0000_0000. Ranks are contiguous, not fine-interleaved [measured]:

  • on the 8 GiB board (MR8 0x52, 4096 MiB/rank), CS1 begins at DRAM offset 4 GiB, i.e. CPU address 0x1_8000_0000 (6 GiB; CS1 training buffer 0x1_8800_0000 in logsRefs/021-eeprom-cs-num-8gib/readme.md, non-aliasing across 0x10000, 0x7fff0000, 0x100000000, 0x17fff0000 and 0x180000000 verified with 0 errors in logsRefs/044-docsclean-claims-sweep-8gib/readme.md);

  • on the 16 GiB board (MR8 0x58, 8192 MiB/rank), CS1 begins at DRAM offset 8 GiB, i.e. CPU address 0x2_8000_0000 (10 GiB; CS1 training buffer 0x2_8800_0000 in logsRefs/005-indep-cs1-16gib/readme.md, non-aliasing across 0x10000, 0x7fff0000, 0x100000000, 0x27fff0000 and 0x280000000 verified with 0 errors in logsRefs/043-docsclean-claims-sweep/readme.md).

Size and geometry from MR8

The MC describes each rank with a size code and a geometry (row/column/bank counts) derived from MR8. The firmware reads MR8 once (rank 0, channel 0), decodes width (MR8[7:6]: x16 or x8) and density (MR8[5:2]), and programs the CS0/CS1 map (K1_MC_CS0_MAP / CS1_MAP / CS1_HI) and geometry words (K1_MC_CS0_GEOM / CS1_GEOM). The exact bit masks and decode tables are implemented in k1_ddr_size_code(), k1_ddr_geometry() and k1_ddr_map_apply() in src/lib/k1_ddr_init.c (Controller bring-up).

[measured] on silicon: MR8 0x52 (x8, 4096 MiB/rank, ROW_17, 8192 MiB total on 2 ranks in logsRefs/021-eeprom-cs-num-8gib/readme.md) and MR8 0x58 (x8, 8192 MiB/rank, ROW_18, 16384 MiB total on 2 ranks in logsRefs/020-eeprom-cs-num-16gib/readme.md; 8192 MiB mapped when cs_num = 1 in logsRefs/018-indep-cs-num-1-16gib/readme.md). Supported encodings in src/lib/k1_ddr_init.c: x8 and x16 with density codes 0..6 (2–16 Gb per channel) whose rank size has a CS-map code ([open] on silicon for x16 and density codes other than 8 Gb/16 Gb x8; docsClean/address-map). 1 Gb parts, x8 12 Gb and other widths are rejected (Notes, limitations and open points).