coreboot/src
Julius Werner 46eae436c0 commonlib/device_tree: Return cells properties of parent node
In Flattened Device Trees, there exist special properties called
`#address-cells` and `#size-cells` that determine how large addresses
and sizes in `reg` properties are. According to the FDT specification,
each `reg` node cares about the `...cells` property in the _parent_ of
its node. Our current implementation looks for those properties in the
node it finds and returns, which would presumably be the node with the
`reg` property itself. Therefore, we're returning the wrong `...cells`
values.

This isn't really a problem in practice because we also allow inheriting
these properties from the parent when they don't exist in the child, and
nodes that contain `reg` properties usually don't contain `...cells`
properties themselves (because those properties would be incorrect and
useless there), so we usually just end up falling back to the (correct)
value we inherited from the parent. But it's still better to just fix
the mistake, and if we ever happen to have a situation where the node
containing the `reg` property still has children that require different
`...cells` values as well, it could make a difference. (The fact that
we're inheriting these properties is also technically incorrect
according to the spec, but we're doing that intentionally to match
behavior in the Linux kernel.)

This issue was already correctly implemented in the recently added
fdt_find_node() from commit 33079b8174 ("lib/device_tree: Add some FDT
helper functions"), and this patch also fixes it in the older
dt_find_node().

Change-Id: I323066477a4d4be17225e0915a81ce2ff39c1e40
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85964
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
2025-01-15 20:31:08 +00:00
..
acpi acpi/acpigen: generate Create*Field() from name string directly 2024-12-10 02:58:29 +00:00
arch arch/x86: Replace 'unsigned long int' by 'unsigned long' 2025-01-08 02:57:44 +00:00
commonlib commonlib/device_tree: Return cells properties of parent node 2025-01-15 20:31:08 +00:00
console console/i2c_smbus: Allow to send data w/o register offset 2024-07-11 00:06:22 +00:00
cpu cpu/x86/64bit: Back up/restore CR3 on mode switch 2025-01-08 08:18:21 +00:00
device device: Fix debug print 2025-01-08 08:18:55 +00:00
drivers drivers/amd/opensil/mpio: Factor out common MPIO symbols from vendorcode 2025-01-13 12:26:24 +00:00
ec ec/starlabs/merlin: Only include battery ACPI for systems with a battery 2025-01-15 10:36:21 +00:00
include device/pci_ids: Add Intel Panther Lake device IDs for Bluetooth CNVi 2025-01-14 18:36:30 +00:00
lib lib: Replace 'unsigned long int' by 'unsigned long' 2025-01-12 04:51:51 +00:00
mainboard mb/starlabs/*: Unset ADD_ITE_BINARY 2025-01-15 10:37:27 +00:00
northbridge haswell NRI: Post-process selected timings 2024-12-10 09:38:00 +00:00
sbom src, util: Clean up makefile.inc in text, help & comments 2024-01-26 20:15:18 +00:00
security drivers/pc80/tpm: Remove flag TPM_RDRESP_NEED_DELAY 2024-10-14 15:26:11 +00:00
soc soc/mediatek/mt8196: Initialize PMIF for SD Card 2025-01-15 10:58:31 +00:00
southbridge Treewide: Remove unused header files 2024-11-30 04:44:06 +00:00
superio superio/ite: Add support for IT8625E 2024-11-21 15:49:12 +00:00
vendorcode vendorcode/amd/fsp/glinda: Update usb_phy_config structure 2025-01-14 13:35:07 +00:00
Kconfig Add initial experimental LTO support 2024-08-24 12:50:38 +00:00