hw/riscv: Widen OpenSBI dynamic info struct

Since fw_dynamic_info is only used for non 32 bit targets, target_long
is int64_t anyway.  Rename struct to fw_dynamic_info64 and use int64_t.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251027-feature-single-binary-hw-v1-v2-3-44478d589ae9@rev.ng>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Anton Johansson
2025-10-27 13:35:12 +01:00
committed by Philippe Mathieu-Daudé
parent f64cc60cfb
commit 7dbe2d7df0
2 changed files with 19 additions and 17 deletions

View File

@ -388,7 +388,8 @@ void riscv_rom_copy_firmware_info(MachineState *machine,
uint64_t kernel_entry)
{
struct fw_dynamic_info32 dinfo32;
struct fw_dynamic_info dinfo;
struct fw_dynamic_info64 dinfo64;
void *dinfo_ptr = NULL;
size_t dinfo_len;
if (riscv_is_32bit(harts)) {
@ -398,15 +399,17 @@ void riscv_rom_copy_firmware_info(MachineState *machine,
dinfo32.next_addr = cpu_to_le32(kernel_entry);
dinfo32.options = 0;
dinfo32.boot_hart = 0;
dinfo_ptr = &dinfo32;
dinfo_len = sizeof(dinfo32);
} else {
dinfo.magic = cpu_to_le64(FW_DYNAMIC_INFO_MAGIC_VALUE);
dinfo.version = cpu_to_le64(FW_DYNAMIC_INFO_VERSION);
dinfo.next_mode = cpu_to_le64(FW_DYNAMIC_INFO_NEXT_MODE_S);
dinfo.next_addr = cpu_to_le64(kernel_entry);
dinfo.options = 0;
dinfo.boot_hart = 0;
dinfo_len = sizeof(dinfo);
dinfo64.magic = cpu_to_le64(FW_DYNAMIC_INFO_MAGIC_VALUE);
dinfo64.version = cpu_to_le64(FW_DYNAMIC_INFO_VERSION);
dinfo64.next_mode = cpu_to_le64(FW_DYNAMIC_INFO_NEXT_MODE_S);
dinfo64.next_addr = cpu_to_le64(kernel_entry);
dinfo64.options = 0;
dinfo64.boot_hart = 0;
dinfo_ptr = &dinfo64;
dinfo_len = sizeof(dinfo64);
}
/**
@ -420,8 +423,7 @@ void riscv_rom_copy_firmware_info(MachineState *machine,
}
rom_add_blob_fixed_as("mrom.finfo",
riscv_is_32bit(harts) ?
(void *)&dinfo32 : (void *)&dinfo,
dinfo_ptr,
dinfo_len,
rom_base + reset_vec_size,
&address_space_memory);

View File

@ -29,17 +29,17 @@ enum sbi_scratch_options {
};
/** Representation dynamic info passed by previous booting stage */
struct fw_dynamic_info {
struct fw_dynamic_info64 {
/** Info magic */
target_long magic;
int64_t magic;
/** Info version */
target_long version;
int64_t version;
/** Next booting stage address */
target_long next_addr;
int64_t next_addr;
/** Next booting stage mode */
target_long next_mode;
int64_t next_mode;
/** Options for OpenSBI library */
target_long options;
int64_t options;
/**
* Preferred boot HART id
*
@ -55,7 +55,7 @@ struct fw_dynamic_info {
* stage can set it to -1UL which will force the FW_DYNAMIC firmware
* to use the relocation lottery mechanism.
*/
target_long boot_hart;
int64_t boot_hart;
};
/** Representation dynamic info passed by previous booting stage */