forked from Mirrors/opensbi
lib: Remove hartid paramter from early_init() and final_init() callbacks
We simplify early_init() and final_init() callbacks of sbi_platform by removing "hartid" parameter. Signed-off-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
@@ -61,9 +61,9 @@ struct sbi_platform {
|
|||||||
u64 disabled_hart_mask;
|
u64 disabled_hart_mask;
|
||||||
|
|
||||||
/** Platform early initialization */
|
/** Platform early initialization */
|
||||||
int (*early_init)(u32 hartid, bool cold_boot);
|
int (*early_init)(bool cold_boot);
|
||||||
/** Platform final initialization */
|
/** Platform final initialization */
|
||||||
int (*final_init)(u32 hartid, bool cold_boot);
|
int (*final_init)(bool cold_boot);
|
||||||
|
|
||||||
/** Get number of PMP regions for given HART */
|
/** Get number of PMP regions for given HART */
|
||||||
u32 (*pmp_region_count)(u32 hartid);
|
u32 (*pmp_region_count)(u32 hartid);
|
||||||
@@ -155,11 +155,11 @@ static inline const char *sbi_platform_name(struct sbi_platform *plat)
|
|||||||
*
|
*
|
||||||
* @return TRUE if HART is disabled and FALSE otherwise
|
* @return TRUE if HART is disabled and FALSE otherwise
|
||||||
*/
|
*/
|
||||||
static inline bool sbi_platform_hart_disabled(struct sbi_platform *plat, u32 hartid)
|
static inline bool sbi_platform_hart_disabled(struct sbi_platform *plat,
|
||||||
|
u32 hartid)
|
||||||
{
|
{
|
||||||
if (plat && (plat->disabled_hart_mask & (1 << hartid)))
|
if (plat && (plat->disabled_hart_mask & (1 << hartid)))
|
||||||
return 1;
|
return 1;
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,16 +195,15 @@ static inline u32 sbi_platform_hart_stack_size(struct sbi_platform *plat)
|
|||||||
* Early initialization of a given HART
|
* Early initialization of a given HART
|
||||||
*
|
*
|
||||||
* @param plat pointer to struct sbi_platform
|
* @param plat pointer to struct sbi_platform
|
||||||
* @param hartid HART ID
|
|
||||||
* @param cold_boot whether cold boot (TRUE) or warm_boot (FALSE)
|
* @param cold_boot whether cold boot (TRUE) or warm_boot (FALSE)
|
||||||
*
|
*
|
||||||
* @return 0 on success and negative error code on failure
|
* @return 0 on success and negative error code on failure
|
||||||
*/
|
*/
|
||||||
static inline int sbi_platform_early_init(struct sbi_platform *plat,
|
static inline int sbi_platform_early_init(struct sbi_platform *plat,
|
||||||
u32 hartid, bool cold_boot)
|
bool cold_boot)
|
||||||
{
|
{
|
||||||
if (plat && plat->early_init)
|
if (plat && plat->early_init)
|
||||||
return plat->early_init(hartid, cold_boot);
|
return plat->early_init(cold_boot);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,16 +211,15 @@ static inline int sbi_platform_early_init(struct sbi_platform *plat,
|
|||||||
* Final initialization of a HART
|
* Final initialization of a HART
|
||||||
*
|
*
|
||||||
* @param plat pointer to struct sbi_platform
|
* @param plat pointer to struct sbi_platform
|
||||||
* @param hartid HART ID
|
|
||||||
* @param cold_boot whether cold boot (TRUE) or warm_boot (FALSE)
|
* @param cold_boot whether cold boot (TRUE) or warm_boot (FALSE)
|
||||||
*
|
*
|
||||||
* @return 0 on success and negative error code on failure
|
* @return 0 on success and negative error code on failure
|
||||||
*/
|
*/
|
||||||
static inline int sbi_platform_final_init(struct sbi_platform *plat,
|
static inline int sbi_platform_final_init(struct sbi_platform *plat,
|
||||||
u32 hartid, bool cold_boot)
|
bool cold_boot)
|
||||||
{
|
{
|
||||||
if (plat && plat->final_init)
|
if (plat && plat->final_init)
|
||||||
return plat->final_init(hartid, cold_boot);
|
return plat->final_init(cold_boot);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,11 +14,9 @@
|
|||||||
|
|
||||||
struct sbi_scratch;
|
struct sbi_scratch;
|
||||||
|
|
||||||
int sbi_system_early_init(struct sbi_scratch *scratch, u32 hartid,
|
int sbi_system_early_init(struct sbi_scratch *scratch, bool cold_boot);
|
||||||
bool cold_boot);
|
|
||||||
|
|
||||||
int sbi_system_final_init(struct sbi_scratch *scratch, u32 hartid,
|
int sbi_system_final_init(struct sbi_scratch *scratch, bool cold_boot);
|
||||||
bool cold_boot);
|
|
||||||
|
|
||||||
void __attribute__((noreturn)) sbi_system_reboot(struct sbi_scratch *scratch,
|
void __attribute__((noreturn)) sbi_system_reboot(struct sbi_scratch *scratch,
|
||||||
u32 type);
|
u32 type);
|
||||||
|
@@ -33,7 +33,7 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
|
|||||||
char str[64];
|
char str[64];
|
||||||
struct sbi_platform *plat = sbi_platform_ptr(scratch);
|
struct sbi_platform *plat = sbi_platform_ptr(scratch);
|
||||||
|
|
||||||
rc = sbi_system_early_init(scratch, hartid, TRUE);
|
rc = sbi_system_early_init(scratch, TRUE);
|
||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
|
|||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
rc = sbi_system_final_init(scratch, hartid, TRUE);
|
rc = sbi_system_final_init(scratch, TRUE);
|
||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ static void __noreturn init_warmboot(struct sbi_scratch *scratch, u32 hartid)
|
|||||||
if (sbi_platform_hart_disabled(plat, hartid))
|
if (sbi_platform_hart_disabled(plat, hartid))
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
rc = sbi_system_early_init(scratch, hartid, FALSE);
|
rc = sbi_system_early_init(scratch, FALSE);
|
||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ static void __noreturn init_warmboot(struct sbi_scratch *scratch, u32 hartid)
|
|||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
rc = sbi_system_final_init(scratch, hartid, FALSE);
|
rc = sbi_system_final_init(scratch, FALSE);
|
||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
|
@@ -11,18 +11,16 @@
|
|||||||
#include <sbi/sbi_platform.h>
|
#include <sbi/sbi_platform.h>
|
||||||
#include <sbi/sbi_system.h>
|
#include <sbi/sbi_system.h>
|
||||||
|
|
||||||
int sbi_system_early_init(struct sbi_scratch *scratch, u32 hartid,
|
int sbi_system_early_init(struct sbi_scratch *scratch, bool cold_boot)
|
||||||
bool cold_boot)
|
|
||||||
{
|
{
|
||||||
return sbi_platform_early_init(sbi_platform_ptr(scratch),
|
return sbi_platform_early_init(sbi_platform_ptr(scratch),
|
||||||
hartid, cold_boot);
|
cold_boot);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sbi_system_final_init(struct sbi_scratch *scratch, u32 hartid,
|
int sbi_system_final_init(struct sbi_scratch *scratch, bool cold_boot)
|
||||||
bool cold_boot)
|
|
||||||
{
|
{
|
||||||
return sbi_platform_final_init(sbi_platform_ptr(scratch),
|
return sbi_platform_final_init(sbi_platform_ptr(scratch),
|
||||||
hartid, cold_boot);
|
cold_boot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __attribute__((noreturn)) sbi_system_reboot(struct sbi_scratch *scratch,
|
void __attribute__((noreturn)) sbi_system_reboot(struct sbi_scratch *scratch,
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#define SIFIVE_U_UART0_ADDR 0x10013000
|
#define SIFIVE_U_UART0_ADDR 0x10013000
|
||||||
#define SIFIVE_U_UART1_ADDR 0x10023000
|
#define SIFIVE_U_UART1_ADDR 0x10023000
|
||||||
|
|
||||||
static int sifive_u_final_init(u32 hartid, bool cold_boot)
|
static int sifive_u_final_init(bool cold_boot)
|
||||||
{
|
{
|
||||||
void *fdt;
|
void *fdt;
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#define VIRT_UART_BAUDRATE 115200
|
#define VIRT_UART_BAUDRATE 115200
|
||||||
#define VIRT_UART_SHIFTREG_ADDR 1843200
|
#define VIRT_UART_SHIFTREG_ADDR 1843200
|
||||||
|
|
||||||
static int virt_final_init(u32 hartid, bool cold_boot)
|
static int virt_final_init(bool cold_boot)
|
||||||
{
|
{
|
||||||
void *fdt;
|
void *fdt;
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ static void fu540_modify_dt(void *fdt)
|
|||||||
|
|
||||||
plic_fdt_fixup(fdt, "riscv,plic0");
|
plic_fdt_fixup(fdt, "riscv,plic0");
|
||||||
}
|
}
|
||||||
static int fu540_final_init(u32 hartid, bool cold_boot)
|
static int fu540_final_init(bool cold_boot)
|
||||||
{
|
{
|
||||||
void *fdt;
|
void *fdt;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user