mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-04-13 06:11:37 +01:00
lib: utils/irqchip: Add unique_id to plic, aplic, and imsic data
Add a 32-bit unique ID to plic, aplic, and imsic data which can be used to differentiate multiple irqchip devices. Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260213055342.3124872-7-anup.patel@oss.qualcomm.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -35,6 +35,7 @@ struct aplic_data {
|
|||||||
struct sbi_irqchip_device irqchip;
|
struct sbi_irqchip_device irqchip;
|
||||||
struct sbi_dlist node;
|
struct sbi_dlist node;
|
||||||
/* Public members */
|
/* Public members */
|
||||||
|
u32 unique_id;
|
||||||
unsigned long addr;
|
unsigned long addr;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
unsigned long num_idc;
|
unsigned long num_idc;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ struct imsic_regs {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct imsic_data {
|
struct imsic_data {
|
||||||
|
u32 unique_id;
|
||||||
bool targets_mmode;
|
bool targets_mmode;
|
||||||
u32 guest_index_bits;
|
u32 guest_index_bits;
|
||||||
u32 hart_index_bits;
|
u32 hart_index_bits;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ struct plic_data {
|
|||||||
/* Private members */
|
/* Private members */
|
||||||
struct sbi_irqchip_device irqchip;
|
struct sbi_irqchip_device irqchip;
|
||||||
/* Public members */
|
/* Public members */
|
||||||
|
u32 unique_id;
|
||||||
unsigned long addr;
|
unsigned long addr;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
unsigned long num_src;
|
unsigned long num_src;
|
||||||
|
|||||||
@@ -673,6 +673,7 @@ int fdt_parse_aplic_node(const void *fdt, int nodeoff, struct aplic_data *aplic)
|
|||||||
rc = fdt_get_node_addr_size(fdt, nodeoff, 0, ®_addr, ®_size);
|
rc = fdt_get_node_addr_size(fdt, nodeoff, 0, ®_addr, ®_size);
|
||||||
if (rc < 0 || !reg_size)
|
if (rc < 0 || !reg_size)
|
||||||
return SBI_ENODEV;
|
return SBI_ENODEV;
|
||||||
|
aplic->unique_id = nodeoff;
|
||||||
aplic->addr = reg_addr;
|
aplic->addr = reg_addr;
|
||||||
aplic->size = reg_size;
|
aplic->size = reg_size;
|
||||||
|
|
||||||
@@ -805,6 +806,7 @@ int fdt_parse_imsic_node(const void *fdt, int nodeoff, struct imsic_data *imsic)
|
|||||||
if (nodeoff < 0 || !imsic || !fdt)
|
if (nodeoff < 0 || !imsic || !fdt)
|
||||||
return SBI_ENODEV;
|
return SBI_ENODEV;
|
||||||
|
|
||||||
|
imsic->unique_id = nodeoff;
|
||||||
imsic->targets_mmode = false;
|
imsic->targets_mmode = false;
|
||||||
val = fdt_getprop(fdt, nodeoff, "interrupts-extended", &len);
|
val = fdt_getprop(fdt, nodeoff, "interrupts-extended", &len);
|
||||||
if (val && len > sizeof(fdt32_t)) {
|
if (val && len > sizeof(fdt32_t)) {
|
||||||
@@ -887,6 +889,7 @@ int fdt_parse_plic_node(const void *fdt, int nodeoffset, struct plic_data *plic)
|
|||||||
®_addr, ®_size);
|
®_addr, ®_size);
|
||||||
if (rc < 0 || !reg_size)
|
if (rc < 0 || !reg_size)
|
||||||
return SBI_ENODEV;
|
return SBI_ENODEV;
|
||||||
|
plic->unique_id = nodeoffset;
|
||||||
plic->addr = reg_addr;
|
plic->addr = reg_addr;
|
||||||
plic->size = reg_size;
|
plic->size = reg_size;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
CLINT_MTIMER_OFFSET)
|
CLINT_MTIMER_OFFSET)
|
||||||
|
|
||||||
static struct plic_data plic = {
|
static struct plic_data plic = {
|
||||||
|
.unique_id = 0,
|
||||||
.addr = ARIANE_PLIC_ADDR,
|
.addr = ARIANE_PLIC_ADDR,
|
||||||
.size = ARIANE_PLIC_SIZE,
|
.size = ARIANE_PLIC_SIZE,
|
||||||
.num_src = ARIANE_PLIC_NUM_SOURCES,
|
.num_src = ARIANE_PLIC_NUM_SOURCES,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
(OPENPITON_DEFAULT_CLINT_ADDR + CLINT_MTIMER_OFFSET)
|
(OPENPITON_DEFAULT_CLINT_ADDR + CLINT_MTIMER_OFFSET)
|
||||||
|
|
||||||
static struct plic_data plic = {
|
static struct plic_data plic = {
|
||||||
|
.unique_id = 0,
|
||||||
.addr = (unsigned long)OPENPITON_DEFAULT_PLIC_ADDR,
|
.addr = (unsigned long)OPENPITON_DEFAULT_PLIC_ADDR,
|
||||||
.size = OPENPITON_DEFAULT_PLIC_SIZE,
|
.size = OPENPITON_DEFAULT_PLIC_SIZE,
|
||||||
.num_src = OPENPITON_DEFAULT_PLIC_NUM_SOURCES,
|
.num_src = OPENPITON_DEFAULT_PLIC_NUM_SOURCES,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ unsigned long fw_platform_init(unsigned long arg0, unsigned long arg1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct plic_data plic = {
|
static struct plic_data plic = {
|
||||||
|
.unique_id = 0,
|
||||||
.addr = K210_PLIC_BASE_ADDR,
|
.addr = K210_PLIC_BASE_ADDR,
|
||||||
.size = K210_PLIC_BASE_SIZE,
|
.size = K210_PLIC_BASE_SIZE,
|
||||||
.num_src = K210_PLIC_NUM_SOURCES,
|
.num_src = K210_PLIC_NUM_SOURCES,
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
static u32 ux600_clk_freq = 8000000;
|
static u32 ux600_clk_freq = 8000000;
|
||||||
|
|
||||||
static struct plic_data plic = {
|
static struct plic_data plic = {
|
||||||
|
.unique_id = 0,
|
||||||
.addr = UX600_PLIC_ADDR,
|
.addr = UX600_PLIC_ADDR,
|
||||||
.size = UX600_PLIC_SIZE,
|
.size = UX600_PLIC_SIZE,
|
||||||
.num_src = UX600_PLIC_NUM_SOURCES,
|
.num_src = UX600_PLIC_NUM_SOURCES,
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#define PLATFORM_UART_BAUDRATE 115200
|
#define PLATFORM_UART_BAUDRATE 115200
|
||||||
|
|
||||||
static struct plic_data plic = {
|
static struct plic_data plic = {
|
||||||
|
.unique_id = 0,
|
||||||
.addr = PLATFORM_PLIC_ADDR,
|
.addr = PLATFORM_PLIC_ADDR,
|
||||||
.size = PLATFORM_PLIC_SIZE,
|
.size = PLATFORM_PLIC_SIZE,
|
||||||
.num_src = PLATFORM_PLIC_NUM_SOURCES,
|
.num_src = PLATFORM_PLIC_NUM_SOURCES,
|
||||||
|
|||||||
Reference in New Issue
Block a user