diff options
author | Sunil V L | 2022-10-04 11:23:49 +0200 |
---|---|---|
committer | Alistair Francis | 2022-10-14 06:29:50 +0200 |
commit | 785a7383dd4832cc772a2c5483bd6fa40ee51302 (patch) | |
tree | a1d65af658237084968eee752ecf4799e66abdda /hw/loongarch | |
parent | hw/ssi: ibex_spi: fixup/add rw1c functionality (diff) | |
download | qemu-785a7383dd4832cc772a2c5483bd6fa40ee51302.tar.gz qemu-785a7383dd4832cc772a2c5483bd6fa40ee51302.tar.xz qemu-785a7383dd4832cc772a2c5483bd6fa40ee51302.zip |
hw/arm, loongarch: Move load_image_to_fw_cfg() to common location
load_image_to_fw_cfg() is duplicated by both arm and loongarch. The same
function will be required by riscv too. So, it's time to refactor and
move this function to a common path.
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20221004092351.18209-2-sunilvl@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'hw/loongarch')
-rw-r--r-- | hw/loongarch/virt.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 29df99727d..4b595a9ea4 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -598,39 +598,6 @@ static void reset_load_elf(void *opaque) } } -/* Load an image file into an fw_cfg entry identified by key. */ -static void load_image_to_fw_cfg(FWCfgState *fw_cfg, uint16_t size_key, - uint16_t data_key, const char *image_name, - bool try_decompress) -{ - size_t size = -1; - uint8_t *data; - - if (image_name == NULL) { - return; - } - - if (try_decompress) { - size = load_image_gzipped_buffer(image_name, - LOAD_IMAGE_MAX_GUNZIP_BYTES, &data); - } - - if (size == (size_t)-1) { - gchar *contents; - gsize length; - - if (!g_file_get_contents(image_name, &contents, &length, NULL)) { - error_report("failed to load \"%s\"", image_name); - exit(1); - } - size = length; - data = (uint8_t *)contents; - } - - fw_cfg_add_i32(fw_cfg, size_key, size); - fw_cfg_add_bytes(fw_cfg, data_key, data, size); -} - static void fw_cfg_add_kernel_info(FWCfgState *fw_cfg) { /* |