mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
include: sbi_utils: Introduce an helper to get fdt base address
This simply adds an helper to get fdt address which is more explicit than sbi_scratch_thishart_arg1_ptr. Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:

committed by
Anup Patel

parent
723aa88ff4
commit
c891acca17
@@ -11,6 +11,7 @@
|
||||
#define __FDT_HELPER_H__
|
||||
|
||||
#include <sbi/sbi_types.h>
|
||||
#include <sbi/sbi_scratch.h>
|
||||
|
||||
struct fdt_match {
|
||||
const char *compatible;
|
||||
@@ -81,4 +82,9 @@ int fdt_parse_aclint_node(void *fdt, int nodeoffset, bool for_timer,
|
||||
int fdt_parse_compat_addr(void *fdt, uint64_t *addr,
|
||||
const char *compatible);
|
||||
|
||||
static inline void *fdt_get_address(void)
|
||||
{
|
||||
return sbi_scratch_thishart_arg1_ptr();
|
||||
}
|
||||
|
||||
#endif /* __FDT_HELPER_H__ */
|
||||
|
@@ -45,7 +45,7 @@ static int fdt_ipi_cold_init(void)
|
||||
int pos, noff, rc;
|
||||
struct fdt_ipi *drv;
|
||||
const struct fdt_match *match;
|
||||
void *fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
void *fdt = fdt_get_address();
|
||||
|
||||
for (pos = 0; pos < array_size(ipi_drivers); pos++) {
|
||||
drv = ipi_drivers[pos];
|
||||
|
@@ -38,7 +38,7 @@ static int fdt_irqchip_cold_init(void)
|
||||
int pos, noff, rc;
|
||||
struct fdt_irqchip *drv;
|
||||
const struct fdt_match *match;
|
||||
void *fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
void *fdt = fdt_get_address();
|
||||
|
||||
for (pos = 0; pos < array_size(irqchip_drivers); pos++) {
|
||||
drv = irqchip_drivers[pos];
|
||||
|
@@ -33,7 +33,7 @@ int fdt_reset_init(void)
|
||||
int pos, noff, rc;
|
||||
struct fdt_reset *drv;
|
||||
const struct fdt_match *match;
|
||||
void *fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
void *fdt = fdt_get_address();
|
||||
|
||||
for (pos = 0; pos < array_size(reset_drivers); pos++) {
|
||||
drv = reset_drivers[pos];
|
||||
|
@@ -40,7 +40,7 @@ int fdt_serial_init(void)
|
||||
struct fdt_serial *drv;
|
||||
const struct fdt_match *match;
|
||||
int pos, noff = -1, len, coff, rc;
|
||||
void *fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
void *fdt = fdt_get_address();
|
||||
|
||||
/* Find offset of node pointed to by stdout-path */
|
||||
coff = fdt_path_offset(fdt, "/chosen");
|
||||
|
@@ -45,7 +45,7 @@ static int fdt_timer_cold_init(void)
|
||||
int pos, noff, rc;
|
||||
struct fdt_timer *drv;
|
||||
const struct fdt_match *match;
|
||||
void *fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
void *fdt = fdt_get_address();
|
||||
|
||||
for (pos = 0; pos < array_size(timer_drivers); pos++) {
|
||||
drv = timer_drivers[pos];
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <sbi/sbi_ipi.h>
|
||||
#include <sbi/sbi_platform.h>
|
||||
#include <sbi/sbi_trap.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/fdt/fdt_fixup.h>
|
||||
#include <sbi_utils/irqchip/plic.h>
|
||||
#include <sbi_utils/serial/uart8250.h>
|
||||
@@ -55,7 +56,7 @@ static int ae350_final_init(bool cold_boot)
|
||||
if (!cold_boot)
|
||||
return 0;
|
||||
|
||||
fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
fdt = fdt_get_address();
|
||||
fdt_fixups(fdt);
|
||||
|
||||
return 0;
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include <sbi/sbi_const.h>
|
||||
#include <sbi/sbi_hart.h>
|
||||
#include <sbi/sbi_platform.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/fdt/fdt_fixup.h>
|
||||
#include <sbi_utils/ipi/aclint_mswi.h>
|
||||
#include <sbi_utils/irqchip/plic.h>
|
||||
@@ -76,7 +77,7 @@ static int ariane_final_init(bool cold_boot)
|
||||
if (!cold_boot)
|
||||
return 0;
|
||||
|
||||
fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
fdt = fdt_get_address();
|
||||
fdt_fixups(fdt);
|
||||
|
||||
return 0;
|
||||
|
@@ -76,7 +76,7 @@ static int openpiton_early_init(bool cold_boot)
|
||||
|
||||
if (!cold_boot)
|
||||
return 0;
|
||||
fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
fdt = fdt_get_address();
|
||||
|
||||
rc = fdt_parse_uart8250(fdt, &uart_data, "ns16550");
|
||||
if (!rc)
|
||||
@@ -112,7 +112,7 @@ static int openpiton_final_init(bool cold_boot)
|
||||
if (!cold_boot)
|
||||
return 0;
|
||||
|
||||
fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
fdt = fdt_get_address();
|
||||
fdt_fixups(fdt);
|
||||
|
||||
return 0;
|
||||
|
@@ -148,7 +148,7 @@ static int generic_final_init(bool cold_boot)
|
||||
if (!cold_boot)
|
||||
return 0;
|
||||
|
||||
fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
fdt = fdt_get_address();
|
||||
|
||||
fdt_cpu_fixup(fdt);
|
||||
fdt_fixups(fdt);
|
||||
@@ -177,7 +177,7 @@ static void generic_final_exit(void)
|
||||
|
||||
static int generic_domains_init(void)
|
||||
{
|
||||
return fdt_domains_populate(sbi_scratch_thishart_arg1_ptr());
|
||||
return fdt_domains_populate(fdt_get_address());
|
||||
}
|
||||
|
||||
static u64 generic_tlbr_flush_limit(void)
|
||||
@@ -189,7 +189,7 @@ static u64 generic_tlbr_flush_limit(void)
|
||||
|
||||
static int generic_pmu_init(void)
|
||||
{
|
||||
return fdt_pmu_setup(sbi_scratch_thishart_arg1_ptr());
|
||||
return fdt_pmu_setup(fdt_get_address());
|
||||
}
|
||||
|
||||
static uint64_t generic_pmu_xlate_to_mhpmevent(uint32_t event_idx,
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include <sbi/sbi_const.h>
|
||||
#include <sbi/sbi_platform.h>
|
||||
#include <sbi/sbi_system.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/fdt/fdt_fixup.h>
|
||||
#include <sbi_utils/ipi/aclint_mswi.h>
|
||||
#include <sbi_utils/irqchip/plic.h>
|
||||
@@ -120,7 +121,7 @@ static int k210_final_init(bool cold_boot)
|
||||
if (!cold_boot)
|
||||
return 0;
|
||||
|
||||
fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
fdt = fdt_get_address();
|
||||
|
||||
fdt_cpu_fixup(fdt);
|
||||
fdt_fixups(fdt);
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include <sbi/sbi_const.h>
|
||||
#include <sbi/sbi_platform.h>
|
||||
#include <sbi/sbi_system.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/fdt/fdt_fixup.h>
|
||||
#include <sbi_utils/ipi/aclint_mswi.h>
|
||||
#include <sbi_utils/irqchip/plic.h>
|
||||
@@ -175,7 +176,7 @@ static int ux600_final_init(bool cold_boot)
|
||||
if (!cold_boot)
|
||||
return 0;
|
||||
|
||||
fdt = sbi_scratch_thishart_arg1_ptr();
|
||||
fdt = fdt_get_address();
|
||||
ux600_modify_dt(fdt);
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user