Am Mi., 25. Nov. 2020 um 15:57 Uhr schrieb mturney@codeaurora.org:
On 2020-11-24 03:05, Andy Pont wrote:
Is there an idiots guide to the definitions in devicetree.cb? Trying to make sense of the USB and PCIe configuration stuff.
https://doc.coreboot.org/acpi/devicetree.html describes some aspects but it's relatively specific about listing devices for the purpose of having them appear in ACPI, so that's just a subset. https://doc.coreboot.org/acpi/devicetree.html#diving-into-the-above-example is probably the most interesting part in terms of generic information. https://link.springer.com/chapter/10.1007/978-1-4842-0070-4_4 also has some bits on the devicetree (page 28+).
Roughly speaking: - The device tree is mostly modeled after PCI (because that's where it was first used), although it was extended over time to be able to describe other topologies. - "device" entries enumerate addressable devices at a certain point in the physical hardware tree - "chip" entries describe the drivers that are used for the sub-tree they cover - "register" entries fill in values into the struct referred to by the next-outer "chip" - io, irq point to device registers.
The naming of the keywords doesn't make all too much sense, since it remained unchanged (except for compatible additions) since ~2003 when that structure was devised, while both hardware and our use of the device tree evolved.
I'd love to see somebody pick up the bits of information they gather on the device tree and write a doc on that in Documentation/ (which gets rendered to doc.coreboot.org). Andy, willing to take that on? :-)
Device Tree Reference: https://elinux.org/Device_Tree_Reference Device Tree Usage: https://elinux.org/Device_Tree_Usage Device Tree Mysteries: https://elinux.org/Device_Tree_Mysteries
Those are u-boot/Linux-style device trees, loosely based on the OpenFirmware device tree. devicetree.cb is something else, coming from LinuxBIOS v2 LinuxBIOS v3 used Linux-style device trees but it didn't stick (as in: people didn't port that back to v2, which later became v4), so our device tree is still based on the old LBv2 thing.
Patrick