[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/20] hw/i386: Use generic DeviceState instead of PFlashCFI01
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 07/20] hw/i386: Use generic DeviceState instead of PFlashCFI01 |
Date: |
Wed, 4 Jan 2023 23:04:36 +0100 |
Nothing here requires access to PFlashCFI01 internal fields:
use the inherited generic DeviceState.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/pc_sysfw.c | 14 +++++++-------
include/hw/i386/pc.h | 3 +--
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 60db0efb41..1a12207dd1 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -71,7 +71,7 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory,
memory_region_set_readonly(isa_bios, true);
}
-static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms,
+static DeviceState *pc_pflash_create(PCMachineState *pcms,
const char *name,
const char *alias_prop_name)
{
@@ -88,7 +88,7 @@ static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms,
* will be removed with object_unparent.
*/
object_unref(OBJECT(dev));
- return PFLASH_CFI01(dev);
+ return dev;
}
void pc_system_flash_create(PCMachineState *pcms)
@@ -143,7 +143,7 @@ static void pc_system_flash_map(PCMachineState *pcms,
int i;
BlockBackend *blk;
int64_t size;
- PFlashCFI01 *system_flash;
+ DeviceState *system_flash;
MemoryRegion *flash_mem;
void *flash_ptr;
int flash_size;
@@ -152,7 +152,7 @@ static void pc_system_flash_map(PCMachineState *pcms,
for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) {
system_flash = pcms->flash[i];
- blk = pflash_cfi01_get_blk(DEVICE(system_flash));
+ blk = pflash_cfi01_get_blk(system_flash);
if (!blk) {
break;
}
@@ -187,7 +187,7 @@ static void pc_system_flash_map(PCMachineState *pcms,
0x100000000ULL - total_size);
if (i == 0) {
- flash_mem = pflash_cfi01_get_memory(DEVICE(system_flash));
+ flash_mem = pflash_cfi01_get_memory(system_flash);
pc_isa_bios_init(rom_memory, flash_mem, size);
/* Encrypt the pflash boot ROM */
@@ -214,9 +214,9 @@ void pc_system_firmware_init(PCMachineState *pcms,
/* Map legacy -drive if=pflash to machine properties */
for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) {
- pflash_cfi01_legacy_drive(DEVICE(pcms->flash[i]),
+ pflash_cfi01_legacy_drive(pcms->flash[i],
drive_get(IF_PFLASH, 0, i));
- pflash_blk[i] = pflash_cfi01_get_blk(DEVICE(pcms->flash[i]));
+ pflash_blk[i] = pflash_cfi01_get_blk(pcms->flash[i]);
}
/* Reject gaps */
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 991f905f5d..70abe61805 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -6,7 +6,6 @@
#include "qemu/uuid.h"
#include "hw/boards.h"
#include "hw/block/fdc.h"
-#include "hw/block/flash.h"
#include "hw/i386/x86.h"
#include "hw/acpi/acpi_dev_interface.h"
@@ -35,7 +34,7 @@ typedef struct PCMachineState {
/* Pointers to devices and objects: */
PCIBus *bus;
I2CBus *smbus;
- PFlashCFI01 *flash[2];
+ DeviceState *flash[2];
ISADevice *pcspk;
DeviceState *iommu;
--
2.38.1
- [PATCH 00/20] hw: Remove implicit sysbus_mmio_map() from pflash APIs, Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 02/20] hw/block: Use pflash_cfi01_get_blk() in pflash_cfi01_legacy_drive(), Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 01/20] hw/block: Pass DeviceState to pflash_cfi01_get_blk(), Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 03/20] hw/block: Pass DeviceState to pflash_cfi01_get_memory(), Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 04/20] hw/arm: Use generic DeviceState instead of PFlashCFI01, Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 05/20] hw/loongarch: Use generic DeviceState instead of PFlashCFI01, Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 06/20] hw/riscv: Use generic DeviceState instead of PFlashCFI01, Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 07/20] hw/i386: Use generic DeviceState instead of PFlashCFI01,
Philippe Mathieu-Daudé <=
- [PATCH 08/20] hw/xtensa: Use generic DeviceState instead of PFlashCFI01, Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 09/20] hw/block: Factor pflash_cfi01_create() out of pflash_cfi01_register(), Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 10/20] hw/arm: Open-code pflash_cfi01_register(), Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 11/20] hw/microblaze: Open-code pflash_cfi01_register(), Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 12/20] hw/mips: Open-code pflash_cfi01_register(), Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 13/20] hw/ppc: Open-code pflash_cfi01_register(), Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 15/20] hw/block: Make PFlashCFI01 QOM declaration internal, Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 14/20] hw/block: Remove unused pflash_cfi01_register(), Philippe Mathieu-Daudé, 2023/01/04
- [PATCH 16/20] hw/block: Factor pflash_cfi02_create() out of pflash_cfi02_register(), Philippe Mathieu-Daudé, 2023/01/04