mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 23:41:23 +01:00
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:
@@ -24,13 +24,20 @@
|
||||
#define ARIANE_PLIC_ADDR 0xc000000
|
||||
#define ARIANE_PLIC_NUM_SOURCES 3
|
||||
#define ARIANE_HART_COUNT 1
|
||||
#define ARIANE_CLINT_ADDR 0x2000000
|
||||
#define ARIANE_CLINT_ADDR 0x2000000
|
||||
|
||||
static struct plic_data plic = {
|
||||
.addr = ARIANE_PLIC_ADDR,
|
||||
.num_src = ARIANE_PLIC_NUM_SOURCES,
|
||||
};
|
||||
|
||||
static struct clint_data clint = {
|
||||
.addr = ARIANE_CLINT_ADDR,
|
||||
.first_hartid = 0,
|
||||
.hart_count = ARIANE_HART_COUNT,
|
||||
.has_64bit_mmio = TRUE,
|
||||
};
|
||||
|
||||
/*
|
||||
* Ariane platform early initialization.
|
||||
*/
|
||||
@@ -116,8 +123,7 @@ static int ariane_ipi_init(bool cold_boot)
|
||||
int ret;
|
||||
|
||||
if (cold_boot) {
|
||||
ret = clint_cold_ipi_init(ARIANE_CLINT_ADDR,
|
||||
ARIANE_HART_COUNT);
|
||||
ret = clint_cold_ipi_init(&clint);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
@@ -133,8 +139,7 @@ static int ariane_timer_init(bool cold_boot)
|
||||
int ret;
|
||||
|
||||
if (cold_boot) {
|
||||
ret = clint_cold_timer_init(ARIANE_CLINT_ADDR,
|
||||
ARIANE_HART_COUNT, TRUE);
|
||||
ret = clint_cold_timer_init(&clint, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user