forked from Mirrors/opensbi
platform: generic: Pass FDT to early/final_init overrides
Several of these override functions access the FDT blob. Explicitly indicate which callbacks are allowed to modify the FDT blob by passing the parameter as a possibly-const pointer. This also reduces code size by deduplicating the call to fdt_get_address(). Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
3f964652d9
commit
6e5db7b09c
@@ -221,6 +221,7 @@ static int generic_nascent_init(void)
|
||||
|
||||
static int generic_early_init(bool cold_boot)
|
||||
{
|
||||
const void *fdt = fdt_get_address();
|
||||
int rc;
|
||||
|
||||
if (cold_boot) {
|
||||
@@ -237,16 +238,16 @@ static int generic_early_init(bool cold_boot)
|
||||
if (!generic_plat || !generic_plat->early_init)
|
||||
return 0;
|
||||
|
||||
return generic_plat->early_init(cold_boot, generic_plat_match);
|
||||
return generic_plat->early_init(cold_boot, fdt, generic_plat_match);
|
||||
}
|
||||
|
||||
static int generic_final_init(bool cold_boot)
|
||||
{
|
||||
void *fdt;
|
||||
void *fdt = fdt_get_address();
|
||||
int rc;
|
||||
|
||||
if (generic_plat && generic_plat->final_init) {
|
||||
rc = generic_plat->final_init(cold_boot, generic_plat_match);
|
||||
rc = generic_plat->final_init(cold_boot, fdt, generic_plat_match);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
@@ -254,8 +255,6 @@ static int generic_final_init(bool cold_boot)
|
||||
if (!cold_boot)
|
||||
return 0;
|
||||
|
||||
fdt = fdt_get_address();
|
||||
|
||||
fdt_cpu_fixup(fdt);
|
||||
fdt_fixups(fdt);
|
||||
fdt_domain_fixup(fdt);
|
||||
|
Reference in New Issue
Block a user