-
Notifications
You must be signed in to change notification settings - Fork 650
Open
Description
Hi,
I would like to ask about a check that is performed during FDT parsing, specifically for the PLIC node. The check in question is:
if (rc < 0 || !reg_addr || !reg_size)
return SBI_ENODEV;
This code is located in lib/utils/fdt/fdt_helper.c:
int fdt_parse_plic_node(const void *fdt, int nodeoffset, struct plic_data *plic)
{
int len, rc;
const fdt32_t *val;
uint64_t reg_addr, reg_size;
if (nodeoffset < 0 || !plic || !fdt)
return SBI_ENODEV;
rc = fdt_get_node_addr_size(fdt, nodeoffset, 0,
®_addr, ®_size);
if (rc < 0 || !reg_addr || !reg_size)
return SBI_ENODEV;
plic->addr = reg_addr;
plic->size = reg_size;
val = fdt_getprop(fdt, nodeoffset, "riscv,ndev", &len);
if (len > 0)
plic->num_src = fdt32_to_cpu(*val);
return 0;
}
My question concerns the need to check reg_addr != 0. This condition causes an error when the PLIC base address is 0x0.
I am aware that placing the PLIC at address 0x0 is generally not considered good practice, but has this possibility been explicitly considered? As far as I know, there is no restriction in the PLIC specification that forbids a base address of zero.
Thank you in advance.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels