[fdt] Provide ability to locate the parent device node

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-05-30 16:37:28 +01:00
parent d64250918c
commit 1762568ec5
3 changed files with 109 additions and 1 deletions

View File

@@ -263,6 +263,18 @@ static void fdt_test_exec ( void ) {
ok ( strcmp ( desc.data, "memory" ) == 0 );
ok ( desc.depth == 0 );
/* Verify parent lookup */
ok ( fdt_path ( &fdt, "/soc/ethernet@10090000/ethernet-phy@0",
&offset ) == 0 );
ok ( fdt_parent ( &fdt, offset, &offset ) == 0 );
ok ( fdt_describe ( &fdt, offset, &desc ) == 0 );
ok ( strcmp ( desc.name, "ethernet@10090000" ) == 0 );
ok ( fdt_parent ( &fdt, offset, &offset ) == 0 );
ok ( fdt_describe ( &fdt, offset, &desc ) == 0 );
ok ( strcmp ( desc.name, "soc" ) == 0 );
ok ( fdt_parent ( &fdt, offset, &offset ) == 0 );
ok ( offset == 0 );
/* Verify device tree creation */
image = image_memory ( "test.dtb", sifive_u, sizeof ( sifive_u ) );
ok ( image != NULL );