forked from Mirrors/opensbi
lib: utils: Allow CLINT functions to be used for multiple CLINTs
We extend CLINT cold init function to have a "struct clint_data *" parameter pointing to CLINT details. This allows platforms to use CLINT functions for multiple CLINT instances. When multiple CLINTs are present, the platform can also provide one of the CLINT as reference CLINT for other CLINTs. This will help CLINTs to sync their time value with reference CLINT using a time_delta computed in warm init function. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
@@ -15,6 +15,13 @@
|
||||
|
||||
static struct c910_regs_struct c910_regs;
|
||||
|
||||
static struct clint_data clint = {
|
||||
.addr = 0, /* Updated at cold boot time */
|
||||
.first_hartid = 0,
|
||||
.hart_count = C910_HART_COUNT,
|
||||
.has_64bit_mmio = FALSE,
|
||||
};
|
||||
|
||||
static int c910_early_init(bool cold_boot)
|
||||
{
|
||||
if (cold_boot) {
|
||||
@@ -78,7 +85,8 @@ static int c910_ipi_init(bool cold_boot)
|
||||
int rc;
|
||||
|
||||
if (cold_boot) {
|
||||
rc = clint_cold_ipi_init(c910_regs.clint_base_addr, C910_HART_COUNT);
|
||||
clint.addr = c910_regs.clint_base_addr;
|
||||
rc = clint_cold_ipi_init(&clint);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
@@ -91,8 +99,8 @@ static int c910_timer_init(bool cold_boot)
|
||||
int ret;
|
||||
|
||||
if (cold_boot) {
|
||||
ret = clint_cold_timer_init(c910_regs.clint_base_addr,
|
||||
C910_HART_COUNT, FALSE);
|
||||
clint.addr = c910_regs.clint_base_addr;
|
||||
ret = clint_cold_timer_init(&clint, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user