[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 06/21] hw/loongarch: Use generic DeviceState instead of PFlash
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 06/21] hw/loongarch: Use generic DeviceState instead of PFlashCFI01 |
Date: |
Mon, 9 Jan 2023 13:08:18 +0100 |
Nothing here requires access to PFlashCFI01 internal fields:
use the inherited generic DeviceState.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---
hw/loongarch/virt.c | 9 ++++-----
include/hw/loongarch/virt.h | 3 +--
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 66be925068..0655e48c42 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -45,7 +45,7 @@
#include "sysemu/block-backend.h"
#include "hw/block/flash.h"
-static void virt_flash_create(LoongArchMachineState *lams)
+static DeviceState *virt_flash_create(LoongArchMachineState *lams)
{
DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01);
@@ -62,14 +62,13 @@ static void virt_flash_create(LoongArchMachineState *lams)
object_property_add_alias(OBJECT(lams), "pflash",
OBJECT(dev), "drive");
- lams->flash = PFLASH_CFI01(dev);
+ return dev;
}
static void virt_flash_map(LoongArchMachineState *lams,
MemoryRegion *sysmem)
{
- PFlashCFI01 *flash = lams->flash;
- DeviceState *dev = DEVICE(flash);
+ DeviceState *dev = lams->flash;
hwaddr base = VIRT_FLASH_BASE;
hwaddr size = VIRT_FLASH_SIZE;
@@ -904,7 +903,7 @@ static void loongarch_machine_initfn(Object *obj)
lams->acpi = ON_OFF_AUTO_AUTO;
lams->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
lams->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
- virt_flash_create(lams);
+ lams->flash = virt_flash_create(lams);
}
static bool memhp_type_supported(DeviceState *dev)
diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h
index f5f818894e..519b25c722 100644
--- a/include/hw/loongarch/virt.h
+++ b/include/hw/loongarch/virt.h
@@ -12,7 +12,6 @@
#include "hw/boards.h"
#include "qemu/queue.h"
#include "hw/intc/loongarch_ipi.h"
-#include "hw/block/flash.h"
#define LOONGARCH_MAX_VCPUS 4
@@ -52,7 +51,7 @@ struct LoongArchMachineState {
int fdt_size;
DeviceState *platform_bus_dev;
PCIBus *pci_bus;
- PFlashCFI01 *flash;
+ DeviceState *flash;
};
#define TYPE_LOONGARCH_MACHINE MACHINE_TYPE_NAME("virt")
--
2.38.1
- Re: [PATCH v2 01/21] hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width', (continued)
- Re: [PATCH v2 01/21] hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width', Daniel P . Berrangé, 2023/01/09
- Re: [PATCH v2 01/21] hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width', Philippe Mathieu-Daudé, 2023/01/09
- Re: [PATCH v2 01/21] hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width', Peter Maydell, 2023/01/13
- Re: [PATCH v2 01/21] hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width', Markus Armbruster, 2023/01/16
- Re: [PATCH v2 01/21] hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width', Philippe Mathieu-Daudé, 2023/01/16
- Re: [PATCH v2 01/21] hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width', Markus Armbruster, 2023/01/17
[PATCH v2 03/21] hw/block: Use pflash_cfi01_get_blk() in pflash_cfi01_legacy_drive(), Philippe Mathieu-Daudé, 2023/01/09
[PATCH v2 02/21] hw/block: Pass DeviceState to pflash_cfi01_get_blk(), Philippe Mathieu-Daudé, 2023/01/09
[PATCH v2 06/21] hw/loongarch: Use generic DeviceState instead of PFlashCFI01,
Philippe Mathieu-Daudé <=
[PATCH v2 04/21] hw/block: Pass DeviceState to pflash_cfi01_get_memory(), Philippe Mathieu-Daudé, 2023/01/09
[PATCH v2 05/21] hw/arm: Use generic DeviceState instead of PFlashCFI01, Philippe Mathieu-Daudé, 2023/01/09
[PATCH v2 07/21] hw/riscv: Use generic DeviceState instead of PFlashCFI01, Philippe Mathieu-Daudé, 2023/01/09
[PATCH v2 08/21] hw/i386: Use generic DeviceState instead of PFlashCFI01, Philippe Mathieu-Daudé, 2023/01/09
[PATCH v2 09/21] hw/xtensa: Use generic DeviceState instead of PFlashCFI01, Philippe Mathieu-Daudé, 2023/01/09
[PATCH v2 10/21] hw/sh4: Open-code pflash_cfi02_register(), Philippe Mathieu-Daudé, 2023/01/09