mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-06-28 09:08:24 +00:00
lib: utils/fdt: Change addr and size to uint64_t
The maximum address and size encoded in DT are 64-bit numbers, so we should use uint64_t for 'addr' and 'size' in fdt_get_node_addr_size(). Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
parent
d244f3dbd6
commit
47a47654e8
5 changed files with 17 additions and 16 deletions
|
@ -43,8 +43,8 @@ int fdt_parse_phandle_with_args(void *fdt, int nodeoff,
|
||||||
const char *prop, const char *cells_prop,
|
const char *prop, const char *cells_prop,
|
||||||
int index, struct fdt_phandle_args *out_args);
|
int index, struct fdt_phandle_args *out_args);
|
||||||
|
|
||||||
int fdt_get_node_addr_size(void *fdt, int node, unsigned long *addr,
|
int fdt_get_node_addr_size(void *fdt, int node, uint64_t *addr,
|
||||||
unsigned long *size);
|
uint64_t *size);
|
||||||
|
|
||||||
int fdt_parse_hart_id(void *fdt, int cpu_offset, u32 *hartid);
|
int fdt_parse_hart_id(void *fdt, int cpu_offset, u32 *hartid);
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ int fdt_parse_aclint_node(void *fdt, int nodeoffset, bool for_timer,
|
||||||
unsigned long *out_addr, unsigned long *out_size,
|
unsigned long *out_addr, unsigned long *out_size,
|
||||||
u32 *out_first_hartid, u32 *out_hart_count);
|
u32 *out_first_hartid, u32 *out_hart_count);
|
||||||
|
|
||||||
int fdt_parse_compat_addr(void *fdt, unsigned long *addr,
|
int fdt_parse_compat_addr(void *fdt, uint64_t *addr,
|
||||||
const char *compatible);
|
const char *compatible);
|
||||||
|
|
||||||
#endif /* __FDT_HELPER_H__ */
|
#endif /* __FDT_HELPER_H__ */
|
||||||
|
|
|
@ -120,7 +120,7 @@ int fdt_parse_phandle_with_args(void *fdt, int nodeoff,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fdt_translate_address(void *fdt, uint64_t reg, int parent,
|
static int fdt_translate_address(void *fdt, uint64_t reg, int parent,
|
||||||
unsigned long *addr)
|
uint64_t *addr)
|
||||||
{
|
{
|
||||||
int i, rlen;
|
int i, rlen;
|
||||||
int cell_addr, cell_size;
|
int cell_addr, cell_size;
|
||||||
|
@ -157,8 +157,7 @@ static int fdt_translate_address(void *fdt, uint64_t reg, int parent,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fdt_get_node_addr_size(void *fdt, int node, unsigned long *addr,
|
int fdt_get_node_addr_size(void *fdt, int node, uint64_t *addr, uint64_t *size)
|
||||||
unsigned long *size)
|
|
||||||
{
|
{
|
||||||
int parent, len, i, rc;
|
int parent, len, i, rc;
|
||||||
int cell_addr, cell_size;
|
int cell_addr, cell_size;
|
||||||
|
@ -266,7 +265,7 @@ int fdt_parse_gaisler_uart_node(void *fdt, int nodeoffset,
|
||||||
{
|
{
|
||||||
int len, rc;
|
int len, rc;
|
||||||
const fdt32_t *val;
|
const fdt32_t *val;
|
||||||
unsigned long reg_addr, reg_size;
|
uint64_t reg_addr, reg_size;
|
||||||
|
|
||||||
if (nodeoffset < 0 || !uart || !fdt)
|
if (nodeoffset < 0 || !uart || !fdt)
|
||||||
return SBI_ENODEV;
|
return SBI_ENODEV;
|
||||||
|
@ -304,7 +303,7 @@ int fdt_parse_shakti_uart_node(void *fdt, int nodeoffset,
|
||||||
{
|
{
|
||||||
int len, rc;
|
int len, rc;
|
||||||
const fdt32_t *val;
|
const fdt32_t *val;
|
||||||
unsigned long reg_addr, reg_size;
|
uint64_t reg_addr, reg_size;
|
||||||
|
|
||||||
if (nodeoffset < 0 || !uart || !fdt)
|
if (nodeoffset < 0 || !uart || !fdt)
|
||||||
return SBI_ENODEV;
|
return SBI_ENODEV;
|
||||||
|
@ -338,7 +337,7 @@ int fdt_parse_sifive_uart_node(void *fdt, int nodeoffset,
|
||||||
{
|
{
|
||||||
int len, rc;
|
int len, rc;
|
||||||
const fdt32_t *val;
|
const fdt32_t *val;
|
||||||
unsigned long reg_addr, reg_size;
|
uint64_t reg_addr, reg_size;
|
||||||
|
|
||||||
if (nodeoffset < 0 || !uart || !fdt)
|
if (nodeoffset < 0 || !uart || !fdt)
|
||||||
return SBI_ENODEV;
|
return SBI_ENODEV;
|
||||||
|
@ -376,7 +375,7 @@ int fdt_parse_uart8250_node(void *fdt, int nodeoffset,
|
||||||
{
|
{
|
||||||
int len, rc;
|
int len, rc;
|
||||||
const fdt32_t *val;
|
const fdt32_t *val;
|
||||||
unsigned long reg_addr, reg_size;
|
uint64_t reg_addr, reg_size;
|
||||||
|
|
||||||
if (nodeoffset < 0 || !uart || !fdt)
|
if (nodeoffset < 0 || !uart || !fdt)
|
||||||
return SBI_ENODEV;
|
return SBI_ENODEV;
|
||||||
|
@ -436,7 +435,7 @@ int fdt_parse_plic_node(void *fdt, int nodeoffset, struct plic_data *plic)
|
||||||
{
|
{
|
||||||
int len, rc;
|
int len, rc;
|
||||||
const fdt32_t *val;
|
const fdt32_t *val;
|
||||||
unsigned long reg_addr, reg_size;
|
uint64_t reg_addr, reg_size;
|
||||||
|
|
||||||
if (nodeoffset < 0 || !plic || !fdt)
|
if (nodeoffset < 0 || !plic || !fdt)
|
||||||
return SBI_ENODEV;
|
return SBI_ENODEV;
|
||||||
|
@ -472,7 +471,7 @@ int fdt_parse_aclint_node(void *fdt, int nodeoffset, bool for_timer,
|
||||||
u32 *out_first_hartid, u32 *out_hart_count)
|
u32 *out_first_hartid, u32 *out_hart_count)
|
||||||
{
|
{
|
||||||
const fdt32_t *val;
|
const fdt32_t *val;
|
||||||
unsigned long reg_addr, reg_size;
|
uint64_t reg_addr, reg_size;
|
||||||
int i, rc, count, cpu_offset, cpu_intc_offset;
|
int i, rc, count, cpu_offset, cpu_intc_offset;
|
||||||
u32 phandle, hwirq, hartid, first_hartid, last_hartid;
|
u32 phandle, hwirq, hartid, first_hartid, last_hartid;
|
||||||
u32 match_hwirq = (for_timer) ? IRQ_M_TIMER : IRQ_M_SOFT;
|
u32 match_hwirq = (for_timer) ? IRQ_M_TIMER : IRQ_M_SOFT;
|
||||||
|
@ -535,7 +534,7 @@ int fdt_parse_aclint_node(void *fdt, int nodeoffset, bool for_timer,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fdt_parse_compat_addr(void *fdt, unsigned long *addr,
|
int fdt_parse_compat_addr(void *fdt, uint64_t *addr,
|
||||||
const char *compatible)
|
const char *compatible)
|
||||||
{
|
{
|
||||||
int nodeoffset, rc;
|
int nodeoffset, rc;
|
||||||
|
|
|
@ -71,15 +71,17 @@ static int sifive_gpio_init(void *fdt, int nodeoff, u32 phandle,
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct sifive_gpio_chip *chip;
|
struct sifive_gpio_chip *chip;
|
||||||
|
uint64_t addr;
|
||||||
|
|
||||||
if (SIFIVE_GPIO_CHIP_MAX <= sifive_gpio_chip_count)
|
if (SIFIVE_GPIO_CHIP_MAX <= sifive_gpio_chip_count)
|
||||||
return SBI_ENOSPC;
|
return SBI_ENOSPC;
|
||||||
chip = &sifive_gpio_chip_array[sifive_gpio_chip_count];
|
chip = &sifive_gpio_chip_array[sifive_gpio_chip_count];
|
||||||
|
|
||||||
rc = fdt_get_node_addr_size(fdt, nodeoff, &chip->addr, NULL);
|
rc = fdt_get_node_addr_size(fdt, nodeoff, &addr, NULL);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
chip->addr = addr;
|
||||||
chip->chip.driver = &fdt_gpio_sifive;
|
chip->chip.driver = &fdt_gpio_sifive;
|
||||||
chip->chip.id = phandle;
|
chip->chip.id = phandle;
|
||||||
chip->chip.ngpio = SIFIVE_GPIO_PINS_DEF;
|
chip->chip.ngpio = SIFIVE_GPIO_PINS_DEF;
|
||||||
|
|
|
@ -16,7 +16,7 @@ static int sifive_test_reset_init(void *fdt, int nodeoff,
|
||||||
const struct fdt_match *match)
|
const struct fdt_match *match)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
unsigned long addr;
|
uint64_t addr;
|
||||||
|
|
||||||
rc = fdt_get_node_addr_size(fdt, nodeoff, &addr, NULL);
|
rc = fdt_get_node_addr_size(fdt, nodeoff, &addr, NULL);
|
||||||
if (rc)
|
if (rc)
|
||||||
|
|
|
@ -64,7 +64,7 @@ static int openpiton_early_init(bool cold_boot)
|
||||||
void *fdt;
|
void *fdt;
|
||||||
struct platform_uart_data uart_data;
|
struct platform_uart_data uart_data;
|
||||||
struct plic_data plic_data;
|
struct plic_data plic_data;
|
||||||
unsigned long clint_addr;
|
uint64_t clint_addr;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (!cold_boot)
|
if (!cold_boot)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue