OpenBoot
Draft: this page is not reviewed yet.

Device descriptor schemaDraft

A device descriptor is one TOML file, devices/<soc>/<board>.toml. The directory name is the SoC name and the file name is the board name; both must match [a-z0-9]+. The format is flat data: tables of scalars and arrays of scalars, with no expressions, branches or includes. Unknown tables and unknown keys are errors. Integers may be written in hex, all are unsigned, and each must fit the width of its key.

tools/devgen/devgen.py validates every descriptor and turns the set into a C table that is compiled into the image. No TOML is parsed at run time.

[device]#

Required. Identifies the board and says how far it is trusted.

Key Type Meaning
name string, 1 to 47 printable ASCII characters, no quote or backslash The model name shown in reports.
soc string matching [a-z0-9]+ The SoC name. Must equal the name of the directory that holds the file.
tier "supported" or "experimental" supported means the project verified the descriptor on a real machine. experimental means the generator accepts it and nothing more. A device with no descriptor has no tier at all: it is reported as unknown.
chip_ids array of 1 to 8 unsigned 32-bit integers, no duplicates The chip-id values the device tree of this SoC reports in /chosen.
board_ids array of 1 to 8 unsigned 32-bit integers, no duplicates The board-id values the device tree of this board reports in /chosen.

The firmware looks a device up by the exact pair (chip id, board id). No two descriptors may claim the same pair.

[layout]#

Optional. Either all five keys are present or none. It is the early memory layout of the board, used as a fallback only when deriving the layout from the live device tree fails; the firmware then prints a console line saying so. The values must equal what the derivation gives on that board with the RAM configuration the descriptor was checked on (the DRAM end depends on how much RAM the machine has). dram_base must be below dram_end, and the other three addresses must lie inside DRAM.

Key Type Meaning
dram_base u64 Start of DRAM.
dram_end u64 End of DRAM, exclusive.
island_anchor u64 End of the carveout that holds the first-stage loader. The early blocks sit at fixed distances below it.
lifeline_log_base u64 Base of the lifeline log ring.
dbg_base u64 Base of the debug region.

[cpu]#

Optional. mask_stride stands alone. The three psc_ keys are either all present or all absent.

Key Type Meaning
mask_stride u32, 1 to 32 Bits per cluster in the CPU start mask. Used when the CPU topology in the device tree cannot be read.
psc_base u64, at least 1 Physical address of the PSC register of cluster 0.
psc_cluster_stride u64, at least 1 Address distance between the PSC registers of consecutive clusters.
psc_clusters u32, 1 to 16 Number of clusters that have a PSC register.

[quirks]#

Optional. An empty list is allowed.

Key Type Meaning
names array of strings matching [a-z0-9-]+, no duplicates Named workarounds this board needs. Each name must be a row of devices/quirks.toml; otherwise the generator fails. See Named quirks.

[[quirk]]#

These are the rows of devices/quirks.toml, the registry of workaround names. Every key is a non-empty string. The row order matters: a quirk's bit number is its row index, so new rows go at the end.

Key Type Meaning
name string matching [a-z0-9-]+, unique The quirk name that descriptors list.
stage string The boot stage at which the quirk is asked for.
summary string What the workaround does.
when_absent string What happens on a board that does not list the quirk.

Cross-file rules#

  • Descriptors that share a chip id must carry identical [layout] and [cpu] data. Those tables describe the SoC and are looked up by chip id alone.
  • No (chip id, board id) pair may appear in two descriptors.
  • A [quirks] name that is not in quirks.toml is an error.

Run-time lookups#

The generated table is read through these calls, declared in openboot/src/devtable.h.

  • devtable_find(chip, board) returns the exact match, or nothing. Nothing means the device is unknown.
  • devtable_find_chip(chip) returns the first descriptor of a chip id, for SoC-level data that is needed before the board id is known.
  • devtable_count() and devtable_at(i) walk the table.
  • devtable_tier(chip, board) returns the tier of the exact match, or unknown.

Limits#

These numbers are read from the generator, not typed in.

Limit Value
Ids per chip_ids or board_ids array 8
Quirk names per descriptor 8
Rows in quirks.toml (the mask is 32 bits) 32