mirror of
https://github.com/ipxe/ipxe
synced 2026-01-21 18:30:56 +03:00
[fdt] Allow paths and aliases to be terminated with separator characters
Non-permitted name characters such as a colon are sometimes used to separate alias names or paths from additional metadata, such as the baud rate for a UART in the "/chosen/stdout-path" property. Support the use of such alias names and paths by allowing any character not permitted in a property name to terminate a property or node name match. (This is a very relaxed matching rule that will produce false positive matches on invalid input, but this is unlikely to cause problems in practice.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -213,6 +213,10 @@ static void fdt_test_exec ( void ) {
|
||||
ok ( strcmp ( string, "sifive,uart0" ) == 0 );
|
||||
ok ( fdt_path ( &fdt, "/nonexistent", &offset ) != 0 );
|
||||
ok ( fdt_path ( &fdt, "/cpus/nonexistent", &offset ) != 0 );
|
||||
ok ( fdt_path ( &fdt, "/soc/serial@10010000:115200n8",
|
||||
&offset ) == 0 );
|
||||
ok ( ( string = fdt_string ( &fdt, offset, "compatible" ) ) != NULL );
|
||||
ok ( strcmp ( string, "sifive,uart0" ) == 0 );
|
||||
|
||||
/* Verify 64-bit integer properties */
|
||||
ok ( fdt_u64 ( &fdt, 0, "#address-cells", &u64 ) == 0 );
|
||||
@@ -249,6 +253,9 @@ 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 );
|
||||
ok ( fdt_alias ( &fdt, "ethernet0:params", &offset ) == 0 );
|
||||
ok ( ( string = fdt_string ( &fdt, offset, "phy-mode" ) ) != NULL );
|
||||
ok ( strcmp ( string, "gmii" ) == 0 );
|
||||
|
||||
/* Verify node description */
|
||||
ok ( fdt_path ( &fdt, "/memory@80000000", &offset ) == 0 );
|
||||
|
||||
Reference in New Issue
Block a user