mirror of
https://github.com/ipxe/ipxe
synced 2026-01-21 18:30:56 +03:00
[fdt] Remove concept of a device tree cursor
Refactor device tree traversal to operate on the basis of describing the token at a given offset, with no separate notion of a device tree cursor. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -158,6 +158,7 @@ static const uint8_t sifive_u[] = {
|
||||
*
|
||||
*/
|
||||
static void fdt_test_exec ( void ) {
|
||||
struct fdt_descriptor desc;
|
||||
struct fdt_header *hdr;
|
||||
struct fdt fdt;
|
||||
const char *string;
|
||||
@@ -218,6 +219,19 @@ static void fdt_test_exec ( void ) {
|
||||
ok ( ( string = fdt_string ( &fdt, offset, "compatible" ) ) != NULL );
|
||||
ok ( strcmp ( string, "sifive,uart0" ) == 0 );
|
||||
ok ( fdt_alias ( &fdt, "nonexistent0", &offset ) != 0 );
|
||||
|
||||
/* Verify node description */
|
||||
ok ( fdt_path ( &fdt, "/memory@80000000", &offset ) == 0 );
|
||||
ok ( fdt_describe ( &fdt, offset, &desc ) == 0 );
|
||||
ok ( desc.offset == offset );
|
||||
ok ( strcmp ( desc.name, "memory@80000000" ) == 0 );
|
||||
ok ( desc.data == NULL );
|
||||
ok ( desc.len == 0 );
|
||||
ok ( desc.depth == +1 );
|
||||
ok ( fdt_describe ( &fdt, desc.next, &desc ) == 0 );
|
||||
ok ( strcmp ( desc.name, "device_type" ) == 0 );
|
||||
ok ( strcmp ( desc.data, "memory" ) == 0 );
|
||||
ok ( desc.depth == 0 );
|
||||
}
|
||||
|
||||
/** FDT self-test */
|
||||
|
||||
Reference in New Issue
Block a user