@@ -91,7 +91,7 @@ struct SBSAMachineState {
int fdt_size;
int psci_conduit;
DeviceState *gic;
- PFlashCFI01 *flash[2];
+ DeviceState *flash[2];
};
#define TYPE_SBSA_MACHINE MACHINE_TYPE_NAME("sbsa-ref")
@@ -264,7 +264,7 @@ static void create_fdt(SBSAMachineState *sms)
#define SBSA_FLASH_SECTOR_SIZE (256 * KiB)
-static PFlashCFI01 *sbsa_flash_create1(SBSAMachineState *sms,
+static DeviceState *sbsa_flash_create1(SBSAMachineState *sms,
const char *name,
const char *alias_prop_name)
{
@@ -286,7 +286,7 @@ static PFlashCFI01 *sbsa_flash_create1(SBSAMachineState *sms,
object_property_add_child(OBJECT(sms), name, OBJECT(dev));
object_property_add_alias(OBJECT(sms), alias_prop_name,
OBJECT(dev), "drive");
- return PFLASH_CFI01(dev);
+ return dev;
}
static void sbsa_flash_create(SBSAMachineState *sms)
@@ -295,7 +295,7 @@ static void sbsa_flash_create(SBSAMachineState *sms)
sms->flash[1] = sbsa_flash_create1(sms, "sbsa.flash1", "pflash1");
}
-static void sbsa_flash_map1(PFlashCFI01 *flash,
+static void sbsa_flash_map1(DeviceState *flash,
hwaddr base, hwaddr size,
MemoryRegion *sysmem)
{
@@ -340,13 +340,13 @@ static bool sbsa_firmware_init(SBSAMachineState *sms,
/* Map legacy -drive if=pflash to machine properties */
for (i = 0; i < ARRAY_SIZE(sms->flash); i++) {
- pflash_cfi01_legacy_drive(DEVICE(sms->flash[i]),
+ pflash_cfi01_legacy_drive(sms->flash[i],
drive_get(IF_PFLASH, 0, i));
}
sbsa_flash_map(sms, sysmem, secure_sysmem);
- pflash_blk0 = pflash_cfi01_get_blk(DEVICE(sms->flash[0]));
+ pflash_blk0 = pflash_cfi01_get_blk(sms->flash[0]);
bios_name = MACHINE(sms)->firmware;
if (bios_name) {
@@ -508,7 +508,7 @@ static void vexpress_modify_dtb(const struct arm_boot_info *info, void *fdt)
/* Open code a private version of pflash registration since we
* need to set non-default device width for VExpress platform.
*/
-static PFlashCFI01 *ve_pflash_cfi01_register(hwaddr base, const char *name,
+static DeviceState *ve_pflash_cfi01_register(hwaddr base, const char *name,
DriveInfo *di)
{
DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01);
@@ -531,7 +531,7 @@ static PFlashCFI01 *ve_pflash_cfi01_register(hwaddr base, const char *name,
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
- return PFLASH_CFI01(dev);
+ return dev;
}
static void vexpress_common_init(MachineState *machine)
@@ -543,7 +543,6 @@ static void vexpress_common_init(MachineState *machine)
qemu_irq pic[64];
uint32_t sys_id;
DriveInfo *dinfo;
- PFlashCFI01 *pflash0;
I2CBus *i2c;
ram_addr_t vram_size, sram_size;
MemoryRegion *sysmem = get_system_memory();
@@ -657,12 +656,11 @@ static void vexpress_common_init(MachineState *machine)
sysbus_create_simple("pl111", map[VE_CLCD], pic[14]);
dinfo = drive_get(IF_PFLASH, 0, 0);
- pflash0 = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0",
- dinfo);
+ dev = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0", dinfo);
if (map[VE_NORFLASHALIAS] != -1) {
/* Map flash 0 as an alias into low memory */
- flash0mem = sysbus_mmio_get_region(SYS_BUS_DEVICE(pflash0), 0);
+ flash0mem = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
memory_region_init_alias(flashalias, NULL, "vexpress.flashalias",
flash0mem, 0, VEXPRESS_FLASH_SIZE);
memory_region_add_subregion(sysmem, map[VE_NORFLASHALIAS], flashalias);
@@ -1105,7 +1105,7 @@ static void create_virtio_devices(const VirtMachineState *vms)
#define VIRT_FLASH_SECTOR_SIZE (256 * KiB)
-static PFlashCFI01 *virt_flash_create1(VirtMachineState *vms,
+static DeviceState *virt_flash_create1(VirtMachineState *vms,
const char *name,
const char *alias_prop_name)
{
@@ -1127,7 +1127,7 @@ static PFlashCFI01 *virt_flash_create1(VirtMachineState *vms,
object_property_add_child(OBJECT(vms), name, OBJECT(dev));
object_property_add_alias(OBJECT(vms), alias_prop_name,
OBJECT(dev), "drive");
- return PFLASH_CFI01(dev);
+ return dev;
}
static void virt_flash_create(VirtMachineState *vms)
@@ -1136,7 +1136,7 @@ static void virt_flash_create(VirtMachineState *vms)
vms->flash[1] = virt_flash_create1(vms, "virt.flash1", "pflash1");
}
-static void virt_flash_map1(PFlashCFI01 *flash,
+static void virt_flash_map1(DeviceState *flash,
hwaddr base, hwaddr size,
MemoryRegion *sysmem)
{
@@ -1227,13 +1227,13 @@ static bool virt_firmware_init(VirtMachineState *vms,
/* Map legacy -drive if=pflash to machine properties */
for (i = 0; i < ARRAY_SIZE(vms->flash); i++) {
- pflash_cfi01_legacy_drive(DEVICE(vms->flash[i]),
+ pflash_cfi01_legacy_drive(vms->flash[i],
drive_get(IF_PFLASH, 0, i));
}
virt_flash_map(vms, sysmem, secure_sysmem);
- pflash_blk0 = pflash_cfi01_get_blk(DEVICE(vms->flash[0]));
+ pflash_blk0 = pflash_cfi01_get_blk(vms->flash[0]);
bios_name = MACHINE(vms)->firmware;
if (bios_name) {
@@ -34,7 +34,6 @@
#include "qemu/notify.h"
#include "hw/boards.h"
#include "hw/arm/boot.h"
-#include "hw/block/flash.h"
#include "sysemu/kvm.h"
#include "hw/intc/arm_gicv3_common.h"
#include "qom/object.h"
@@ -142,7 +141,7 @@ struct VirtMachineState {
Notifier machine_done;
DeviceState *platform_bus_dev;
FWCfgState *fw_cfg;
- PFlashCFI01 *flash[2];
+ DeviceState *flash[2];
bool secure;
bool highmem;
bool highmem_compact;