summaryrefslogtreecommitdiff
path: root/platform/template
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-05-12 10:27:52 +0300
committerAnup Patel <anup@brainfault.org>2020-05-23 08:06:29 +0300
commit446a9c6d1eb97fcedd6a94ac76d15e941a6087a8 (patch)
treeb8b8d6e8fec3fb2caf01913b0f2139c4f8695846 /platform/template
parent73d6ef3b2933ccf0b3a8a0ba110bf53ad9720b51 (diff)
downloadopensbi-446a9c6d1eb97fcedd6a94ac76d15e941a6087a8.tar.xz
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>
Diffstat (limited to 'platform/template')
-rw-r--r--platform/template/platform.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/platform/template/platform.c b/platform/template/platform.c
index 3a3bdac..c845380 100644
--- a/platform/template/platform.c
+++ b/platform/template/platform.c
@@ -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);
}
/*