mirror of
https://github.com/ipxe/ipxe
synced 2025-12-17 10:01:03 +03:00
[fdt] Allow for the existence of multiple device trees
When running on a platform that uses FDT as its hardware description mechanism, we are likely to have multiple device tree structures. At a minimum, there will be the device tree passed to us from the previous boot stage (e.g. OpenSBI), and the device tree that we construct to be passed to the booted operating system. Update the internal FDT API to include an FDT pointer in all function parameter lists. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -55,7 +55,7 @@ static int hart_node ( unsigned int *offset ) {
|
||||
snprintf ( path, sizeof ( path ), "/cpus/cpu@%lx", boot_hart );
|
||||
|
||||
/* Find node */
|
||||
if ( ( rc = fdt_path ( path, offset ) ) != 0 ) {
|
||||
if ( ( rc = fdt_path ( &sysfdt, path, offset ) ) != 0 ) {
|
||||
DBGC ( colour, "HART could not find %s: %s\n",
|
||||
path, strerror ( rc ) );
|
||||
return rc;
|
||||
@@ -81,7 +81,7 @@ int hart_supported ( const char *ext ) {
|
||||
return rc;
|
||||
|
||||
/* Get ISA description */
|
||||
isa = fdt_string ( offset, "riscv,isa" );
|
||||
isa = fdt_string ( &sysfdt, offset, "riscv,isa" );
|
||||
if ( ! isa ) {
|
||||
DBGC ( colour, "HART could not identify ISA\n" );
|
||||
return -ENOENT;
|
||||
|
||||
@@ -152,8 +152,8 @@ static int zicntr_probe ( void ) {
|
||||
}
|
||||
|
||||
/* Get timer frequency */
|
||||
if ( ( ( rc = fdt_path ( "/cpus", &offset ) ) != 0 ) ||
|
||||
( ( rc = fdt_u64 ( offset, "timebase-frequency",
|
||||
if ( ( ( rc = fdt_path ( &sysfdt, "/cpus", &offset ) ) != 0 ) ||
|
||||
( ( rc = fdt_u64 ( &sysfdt, offset, "timebase-frequency",
|
||||
&u.freq ) ) != 0 ) ) {
|
||||
DBGC ( colour, "ZICNTR could not determine frequency: %s\n",
|
||||
strerror ( rc ) );
|
||||
|
||||
@@ -121,8 +121,9 @@ _sbi_start:
|
||||
STOREN s0, (t0)
|
||||
|
||||
/* Register device tree */
|
||||
mv a0, s1
|
||||
call register_fdt
|
||||
la a0, sysfdt
|
||||
mv a1, s1
|
||||
call fdt_parse
|
||||
|
||||
/* Call main program */
|
||||
progress "\n\n"
|
||||
|
||||
Reference in New Issue
Block a user