mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
hw/riscv/virt.c: remove 'long' casts in fmt strings
We can avoid the 'long' casts by using PRIx64 and HWADDR_PRIx on the fmt strings for uint64_t and hwaddr types. Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20250429125811.224803-10-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
621e45271f
commit
e7cb99bfd1
1 changed files with 17 additions and 15 deletions
|
@ -304,12 +304,13 @@ static void create_fdt_socket_cpus(RISCVVirtState *s, int socket,
|
|||
static void create_fdt_socket_memory(RISCVVirtState *s, int socket)
|
||||
{
|
||||
g_autofree char *mem_name = NULL;
|
||||
uint64_t addr, size;
|
||||
hwaddr addr;
|
||||
uint64_t size;
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
addr = s->memmap[VIRT_DRAM].base + riscv_socket_mem_offset(ms, socket);
|
||||
size = riscv_socket_mem_size(ms, socket);
|
||||
mem_name = g_strdup_printf("/memory@%lx", (long)addr);
|
||||
mem_name = g_strdup_printf("/memory@%"HWADDR_PRIx, addr);
|
||||
qemu_fdt_add_subnode(ms->fdt, mem_name);
|
||||
qemu_fdt_setprop_cells(ms->fdt, mem_name, "reg",
|
||||
addr >> 32, addr, size >> 32, size);
|
||||
|
@ -880,8 +881,8 @@ static void create_fdt_pcie(RISCVVirtState *s,
|
|||
g_autofree char *name = NULL;
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
name = g_strdup_printf("/soc/pci@%lx",
|
||||
(long) s->memmap[VIRT_PCIE_ECAM].base);
|
||||
name = g_strdup_printf("/soc/pci@%"HWADDR_PRIx,
|
||||
s->memmap[VIRT_PCIE_ECAM].base);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "#address-cells",
|
||||
FDT_PCI_ADDR_CELLS);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "#interrupt-cells",
|
||||
|
@ -925,8 +926,8 @@ static void create_fdt_reset(RISCVVirtState *s, uint32_t *phandle)
|
|||
MachineState *ms = MACHINE(s);
|
||||
|
||||
test_phandle = (*phandle)++;
|
||||
name = g_strdup_printf("/soc/test@%lx",
|
||||
(long)s->memmap[VIRT_TEST].base);
|
||||
name = g_strdup_printf("/soc/test@%"HWADDR_PRIx,
|
||||
s->memmap[VIRT_TEST].base);
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
{
|
||||
static const char * const compat[3] = {
|
||||
|
@ -964,8 +965,8 @@ static void create_fdt_uart(RISCVVirtState *s,
|
|||
g_autofree char *name = NULL;
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
name = g_strdup_printf("/soc/serial@%lx",
|
||||
(long)s->memmap[VIRT_UART0].base);
|
||||
name = g_strdup_printf("/soc/serial@%"HWADDR_PRIx,
|
||||
s->memmap[VIRT_UART0].base);
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible", "ns16550a");
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "reg",
|
||||
|
@ -989,7 +990,8 @@ static void create_fdt_rtc(RISCVVirtState *s,
|
|||
g_autofree char *name = NULL;
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
name = g_strdup_printf("/soc/rtc@%lx", (long)s->memmap[VIRT_RTC].base);
|
||||
name = g_strdup_printf("/soc/rtc@%"HWADDR_PRIx,
|
||||
s->memmap[VIRT_RTC].base);
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible",
|
||||
"google,goldfish-rtc");
|
||||
|
@ -1042,8 +1044,8 @@ static void create_fdt_virtio_iommu(RISCVVirtState *s, uint16_t bdf)
|
|||
g_autofree char *iommu_node = NULL;
|
||||
g_autofree char *pci_node = NULL;
|
||||
|
||||
pci_node = g_strdup_printf("/soc/pci@%lx",
|
||||
(long) s->memmap[VIRT_PCIE_ECAM].base);
|
||||
pci_node = g_strdup_printf("/soc/pci@%"HWADDR_PRIx,
|
||||
s->memmap[VIRT_PCIE_ECAM].base);
|
||||
iommu_node = g_strdup_printf("%s/virtio_iommu@%x,%x", pci_node,
|
||||
PCI_SLOT(bdf), PCI_FUNC(bdf));
|
||||
iommu_phandle = qemu_fdt_alloc_phandle(fdt);
|
||||
|
@ -1111,8 +1113,8 @@ static void create_fdt_iommu(RISCVVirtState *s, uint16_t bdf)
|
|||
g_autofree char *iommu_node = NULL;
|
||||
g_autofree char *pci_node = NULL;
|
||||
|
||||
pci_node = g_strdup_printf("/soc/pci@%lx",
|
||||
(long) s->memmap[VIRT_PCIE_ECAM].base);
|
||||
pci_node = g_strdup_printf("/soc/pci@%"HWADDR_PRIx,
|
||||
s->memmap[VIRT_PCIE_ECAM].base);
|
||||
iommu_node = g_strdup_printf("%s/iommu@%x", pci_node, bdf);
|
||||
iommu_phandle = qemu_fdt_alloc_phandle(fdt);
|
||||
qemu_fdt_add_subnode(fdt, iommu_node);
|
||||
|
@ -1181,8 +1183,8 @@ static void create_fdt(RISCVVirtState *s)
|
|||
* The "/soc/pci@..." node is needed for PCIE hotplugs
|
||||
* that might happen before finalize_fdt().
|
||||
*/
|
||||
name = g_strdup_printf("/soc/pci@%lx",
|
||||
(long) s->memmap[VIRT_PCIE_ECAM].base);
|
||||
name = g_strdup_printf("/soc/pci@%"HWADDR_PRIx,
|
||||
s->memmap[VIRT_PCIE_ECAM].base);
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
|
||||
qemu_fdt_add_subnode(ms->fdt, "/chosen");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue