mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 23:41:23 +01:00
lib: utils: Allow PLIC functions to be used for multiple PLICs
We extend all PLIC functions to have a "struct plic_data *" parameter pointing to PLIC details. This allows platforms to use these functions for multiple PLIC instances. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
@@ -17,6 +17,19 @@
|
||||
#include <sbi_utils/serial/uart8250.h>
|
||||
#include <sbi_utils/sys/clint.h>
|
||||
|
||||
#define PLATFORM_PLIC_ADDR 0xc000000
|
||||
#define PLATFORM_PLIC_NUM_SOURCES 128
|
||||
#define PLATFORM_HART_COUNT 4
|
||||
#define PLATFORM_CLINT_ADDR 0x2000000
|
||||
#define PLATFORM_UART_ADDR 0x09000000
|
||||
#define PLATFORM_UART_INPUT_FREQ 10000000
|
||||
#define PLATFORM_UART_BAUDRATE 115200
|
||||
|
||||
static struct plic_data plic = {
|
||||
.addr = PLATFORM_PLIC_ADDR,
|
||||
.num_src = PLATFORM_PLIC_NUM_SOURCES,
|
||||
};
|
||||
|
||||
/*
|
||||
* Platform early initialization.
|
||||
*/
|
||||
@@ -39,7 +52,7 @@ static int platform_final_init(bool cold_boot)
|
||||
static int platform_console_init(void)
|
||||
{
|
||||
/* Example if the generic UART8250 driver is used */
|
||||
return uart8250_init(PLATFORM_UART_ADDR, PLATFORM_UART_SHIFTREG_ADDR,
|
||||
return uart8250_init(PLATFORM_UART_ADDR, PLATFORM_UART_INPUT_FREQ,
|
||||
PLATFORM_UART_BAUDRATE, 0, 1);
|
||||
}
|
||||
|
||||
@@ -70,13 +83,12 @@ static int platform_irqchip_init(bool cold_boot)
|
||||
|
||||
/* Example if the generic PLIC driver is used */
|
||||
if (cold_boot) {
|
||||
ret = plic_cold_irqchip_init(PLATFORM_PLIC_ADDR,
|
||||
PLATFORM_PLIC_NUM_SOURCES);
|
||||
ret = plic_cold_irqchip_init(&plic);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return plic_warm_irqchip_init(2 * hartid, 2 * hartid + 1);
|
||||
return plic_warm_irqchip_init(&plic, 2 * hartid, 2 * hartid + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user