Analysis modeDraft
Analysis mode answers one question about a Mac that has no descriptor: which of its device-tree nodes does OpenBoot already have a driver for? It reads only the device tree and never touches a register. The result is a porting checklist. It is not evidence that any block works.
Status#
| Part | State |
|---|---|
Analyzer (openboot/src/devanalyze.c, devcomp.c) |
Written, with host tests. Pure code: it reads the bytes it is given, with no memory-mapped I/O. |
Host command-line tool devanalyze |
Works on a raw ADT file. |
| Firmware entry | Not implemented. The firmware does not run the analyzer. There is no automatic page on a descriptor miss, no confirmation prompt before booting an unknown device, and no menu or monitor entry. |
| Getting the raw tree off an unknown Mac | Not built (see Adding a device). |
| Real inputs | One: the tree of the M5 series machine. The other test trees are edits of it. |
Analysis mode is not finished until a real tree from a different SoC has
been analysed. Node layout, reg sizes and compatible naming on another
SoC may differ from what the one real tree shows.
What the colours mean#
The analyzer classifies every node below /arm-io by matching its
compatible list against a component table in devcomp.c.
| Colour | Meaning |
|---|---|
| known (green) | A compatible entry equals a version an existing driver accepts, and reg is readable. |
| version-mismatch (yellow) | The family is known but the version is not one a driver accepts, or the node has no readable reg. |
| no driver (red) | No component of the table matches. The label says only that the compatible is not in the table: the code reaches some such nodes by a fixed path instead. A needed component with no node at all is also red. |
Green says only that a driver exists for that compatible string. The
device tree has no status property, so nothing in it says a block is
powered or enabled. A red node that is not needed is normal on a new Mac:
the table lists only compatibles that existing code binds.
Three components are needed: aic, dart and mcc. The verdict line
needed blocks: OK means each has a node, green or yellow.
Run it on the host#
Build the tool from the same devcomp.c and devanalyze.c that a
firmware entry would link, then give it a raw or sanitised ADT file:
make -C tests/dbg_host build/devanalyze
tests/dbg_host/build/devanalyze [--draft] FILE.adt
Exit status: 0 when every needed block has a node, 1 when one is missing, 2 when the file is unreadable or not an ADT.
Output has this shape for a tree like the real test tree (the middle has one
R line per unbound node, 128 rows at most, the rest counted as dropped).
The values below are made up; the real list for the M5 series is on its
hardware blocks page:
DEVICE UNKNOWN chip-id=0x1234 board-id=0x5
closest: MacXX,Y (Jzzz)
known 63, version-mismatch 7, no driver 396 (dropped 338)
Y /arm-io/apcie0 apcie apcie,tNNNN
...
needed blocks: OK
"known" means a driver exists for this compatible, not that the block is powered or works
Two things to know when reading it. On a supported device the first line
still says DEVICE UNKNOWN: the analyzer ignores the descriptor table
when it classifies and only names the closest descriptor. Run on the
real tree it is a regression check, and needed blocks: OK must stay. And the
yellow rows are honest: a chip-specific compatible such as apcie,tNNNN
is not one of the versions listed in the component table, so it is
reported as a mismatch rather than as known.
With a needed block missing, the last lines name it and the tool exits 1:
R /arm-io/aic needed:aic
needed blocks: MISSING aic
The draft descriptor#
With --draft, the tool writes a descriptor of the
schema. For a tree whose board id has no
descriptor, the first lines are:
# DRAFT written by OpenBoot analysis mode; unverified; edit before submitting
[device]
name = "unknown (0x1234/0xd)"
soc = "t1234"
tier = "experimental"
chip_ids = [0x1234]
board_ids = [0xd]
[quirks]
names = []
# try: pmc-dvfs-voter
# try: mcc-adt-carveouts
The draft holds [device] with the observed ids, the SoC of the closest
descriptor (unknown if none claims the chip id), tier experimental, and
an empty quirk list. The closest descriptor's quirk names appear as # try:
comments, followed by comments for the carveout map and the yellow and red
blocks. A try line is a suggestion to test, not a claim.
The draft has no [layout] and no [cpu]. A layout read from the device
tree of the machine it describes proves nothing, and descriptors that share
a chip id must agree on those tables.
Edit the draft, place it at devices/<soc>/<board>.toml (the soc key
must equal the directory), and run devgen.py --check as described in
Adding a device. A draft is never a verified
descriptor.