mirror of
https://github.com/ipxe/ipxe
synced 2026-01-23 04:29:01 +03:00
[fdt] Use phandle as device location
Consumption of phandles will be in the form of locating a functional device (e.g. a GPIO device, or an I2C device, or a reset controller) by phandle, rather than locating the device tree node to which the phandle refers. Repurpose fdt_phandle() to obtain the phandle value (instead of searching by phandle), and record this value as the bus location within the generic device structure. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -237,6 +237,16 @@ static void fdt_test_exec ( void ) {
|
||||
ok ( fdt_path ( &fdt, "/soc/ethernet@10090000", &offset ) == 0 );
|
||||
ok ( fdt_u32 ( &fdt, offset, "max-speed", &u32 ) != 0 );
|
||||
|
||||
/* Verify phandle properties */
|
||||
ok ( fdt_path ( &fdt, "/cpus/cpu@0/interrupt-controller",
|
||||
&offset ) == 0 );
|
||||
ok ( fdt_phandle ( &fdt, offset ) == 0x03 );
|
||||
ok ( fdt_path ( &fdt, "/soc/ethernet@10090000/ethernet-phy@0",
|
||||
&offset ) == 0 );
|
||||
ok ( fdt_phandle ( &fdt, offset ) == 0x08 );
|
||||
ok ( fdt_path ( &fdt, "/soc/serial@10010000", &offset ) == 0 );
|
||||
ok ( fdt_phandle ( &fdt, offset ) == 0 );
|
||||
|
||||
/* Verify cell properties */
|
||||
ok ( fdt_path ( &fdt, "/soc/ethernet@10090000", &offset ) == 0 );
|
||||
ok ( fdt_cells ( &fdt, offset, "reg", 4, 2, &u64 ) == 0 );
|
||||
@@ -261,15 +271,6 @@ static void fdt_test_exec ( void ) {
|
||||
ok ( ( string = fdt_string ( &fdt, offset, "phy-mode" ) ) != NULL );
|
||||
ok ( strcmp ( string, "gmii" ) == 0 );
|
||||
|
||||
/* Verify phandle lookup */
|
||||
ok ( fdt_phandle ( &fdt, 0x03, &offset ) == 0 );
|
||||
ok ( fdt_describe ( &fdt, offset, &desc ) == 0 );
|
||||
ok ( strcmp ( desc.name, "interrupt-controller" ) == 0 );
|
||||
ok ( fdt_phandle ( &fdt, 0x08, &offset ) == 0 );
|
||||
ok ( fdt_describe ( &fdt, offset, &desc ) == 0 );
|
||||
ok ( strcmp ( desc.name, "ethernet-phy@0" ) == 0 );
|
||||
ok ( fdt_phandle ( &fdt, 0x2a, &offset ) != 0 );
|
||||
|
||||
/* Verify node description */
|
||||
ok ( fdt_path ( &fdt, "/memory@80000000", &offset ) == 0 );
|
||||
ok ( fdt_describe ( &fdt, offset, &desc ) == 0 );
|
||||
|
||||
Reference in New Issue
Block a user