mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
lib: utils/irqchip: Generate FDT irqchip driver list at compile-time
Instead of having FDT irqchip driver list hard-coded in the C source, we generate it using carray.sh at compile-time. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com>
This commit is contained in:
@@ -12,15 +12,9 @@
|
|||||||
#include <sbi_utils/fdt/fdt_helper.h>
|
#include <sbi_utils/fdt/fdt_helper.h>
|
||||||
#include <sbi_utils/irqchip/fdt_irqchip.h>
|
#include <sbi_utils/irqchip/fdt_irqchip.h>
|
||||||
|
|
||||||
extern struct fdt_irqchip fdt_irqchip_aplic;
|
/* List of FDT irqchip drivers generated at compile time */
|
||||||
extern struct fdt_irqchip fdt_irqchip_imsic;
|
extern struct fdt_irqchip *fdt_irqchip_drivers[];
|
||||||
extern struct fdt_irqchip fdt_irqchip_plic;
|
extern unsigned long fdt_irqchip_drivers_size;
|
||||||
|
|
||||||
static struct fdt_irqchip *irqchip_drivers[] = {
|
|
||||||
&fdt_irqchip_aplic,
|
|
||||||
&fdt_irqchip_imsic,
|
|
||||||
&fdt_irqchip_plic
|
|
||||||
};
|
|
||||||
|
|
||||||
#define FDT_IRQCHIP_MAX_DRIVERS 8
|
#define FDT_IRQCHIP_MAX_DRIVERS 8
|
||||||
|
|
||||||
@@ -61,8 +55,8 @@ static int fdt_irqchip_cold_init(void)
|
|||||||
const struct fdt_match *match;
|
const struct fdt_match *match;
|
||||||
void *fdt = fdt_get_address();
|
void *fdt = fdt_get_address();
|
||||||
|
|
||||||
for (pos = 0; pos < array_size(irqchip_drivers); pos++) {
|
for (pos = 0; pos < fdt_irqchip_drivers_size; pos++) {
|
||||||
drv = irqchip_drivers[pos];
|
drv = fdt_irqchip_drivers[pos];
|
||||||
|
|
||||||
noff = -1;
|
noff = -1;
|
||||||
drv_added = false;
|
drv_added = false;
|
||||||
|
3
lib/utils/irqchip/fdt_irqchip_drivers.carray
Normal file
3
lib/utils/irqchip/fdt_irqchip_drivers.carray
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
HEADER: sbi_utils/irqchip/fdt_irqchip.h
|
||||||
|
TYPE: struct fdt_irqchip
|
||||||
|
NAME: fdt_irqchip_drivers
|
@@ -8,9 +8,17 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
libsbiutils-objs-y += irqchip/fdt_irqchip.o
|
libsbiutils-objs-y += irqchip/fdt_irqchip.o
|
||||||
|
libsbiutils-objs-y += irqchip/fdt_irqchip_drivers.o
|
||||||
|
|
||||||
|
carray-fdt_irqchip_drivers-y += fdt_irqchip_aplic
|
||||||
libsbiutils-objs-y += irqchip/fdt_irqchip_aplic.o
|
libsbiutils-objs-y += irqchip/fdt_irqchip_aplic.o
|
||||||
|
|
||||||
|
carray-fdt_irqchip_drivers-y += fdt_irqchip_imsic
|
||||||
libsbiutils-objs-y += irqchip/fdt_irqchip_imsic.o
|
libsbiutils-objs-y += irqchip/fdt_irqchip_imsic.o
|
||||||
|
|
||||||
|
carray-fdt_irqchip_drivers-y += fdt_irqchip_plic
|
||||||
libsbiutils-objs-y += irqchip/fdt_irqchip_plic.o
|
libsbiutils-objs-y += irqchip/fdt_irqchip_plic.o
|
||||||
|
|
||||||
libsbiutils-objs-y += irqchip/aplic.o
|
libsbiutils-objs-y += irqchip/aplic.o
|
||||||
libsbiutils-objs-y += irqchip/imsic.o
|
libsbiutils-objs-y += irqchip/imsic.o
|
||||||
libsbiutils-objs-y += irqchip/plic.o
|
libsbiutils-objs-y += irqchip/plic.o
|
||||||
|
Reference in New Issue
Block a user