diff options
author | Anup Patel <apatel@ventanamicro.com> | 2022-05-13 06:56:27 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2022-05-13 06:56:27 +0300 |
commit | 3a69d12fc3af4dbcfd4975086985bbe903e8580f (patch) | |
tree | 6dd7be5ca0bbeb0c2ba81e601945b6b6c26323f9 /lib | |
parent | bfeb305e0f8da3f8bdff97a21a6628c3156fbfff (diff) | |
download | opensbi-3a69d12fc3af4dbcfd4975086985bbe903e8580f.tar.xz |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils/irqchip/fdt_irqchip.c | 16 | ||||
-rw-r--r-- | lib/utils/irqchip/fdt_irqchip_drivers.carray | 3 | ||||
-rw-r--r-- | lib/utils/irqchip/objects.mk | 8 |
3 files changed, 16 insertions, 11 deletions
diff --git a/lib/utils/irqchip/fdt_irqchip.c b/lib/utils/irqchip/fdt_irqchip.c index 6007755..1b6b674 100644 --- a/lib/utils/irqchip/fdt_irqchip.c +++ b/lib/utils/irqchip/fdt_irqchip.c @@ -12,15 +12,9 @@ #include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/irqchip/fdt_irqchip.h> -extern struct fdt_irqchip fdt_irqchip_aplic; -extern struct fdt_irqchip fdt_irqchip_imsic; -extern struct fdt_irqchip fdt_irqchip_plic; - -static struct fdt_irqchip *irqchip_drivers[] = { - &fdt_irqchip_aplic, - &fdt_irqchip_imsic, - &fdt_irqchip_plic -}; +/* List of FDT irqchip drivers generated at compile time */ +extern struct fdt_irqchip *fdt_irqchip_drivers[]; +extern unsigned long fdt_irqchip_drivers_size; #define FDT_IRQCHIP_MAX_DRIVERS 8 @@ -61,8 +55,8 @@ static int fdt_irqchip_cold_init(void) const struct fdt_match *match; void *fdt = fdt_get_address(); - for (pos = 0; pos < array_size(irqchip_drivers); pos++) { - drv = irqchip_drivers[pos]; + for (pos = 0; pos < fdt_irqchip_drivers_size; pos++) { + drv = fdt_irqchip_drivers[pos]; noff = -1; drv_added = false; diff --git a/lib/utils/irqchip/fdt_irqchip_drivers.carray b/lib/utils/irqchip/fdt_irqchip_drivers.carray new file mode 100644 index 0000000..b373be5 --- /dev/null +++ b/lib/utils/irqchip/fdt_irqchip_drivers.carray @@ -0,0 +1,3 @@ +HEADER: sbi_utils/irqchip/fdt_irqchip.h +TYPE: struct fdt_irqchip +NAME: fdt_irqchip_drivers diff --git a/lib/utils/irqchip/objects.mk b/lib/utils/irqchip/objects.mk index fad4344..7775bc4 100644 --- a/lib/utils/irqchip/objects.mk +++ b/lib/utils/irqchip/objects.mk @@ -8,9 +8,17 @@ # 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 + +carray-fdt_irqchip_drivers-y += fdt_irqchip_imsic 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/aplic.o libsbiutils-objs-y += irqchip/imsic.o libsbiutils-objs-y += irqchip/plic.o |