|
|
7711c0 |
From 8bad602712aa9d875e1826b6cc17baba97deb4c8 Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
7711c0 |
Date: Fri, 17 May 2019 06:50:56 +0200
|
|
|
7711c0 |
Subject: [PATCH 29/53] hw: Use PFLASH_CFI0{1, 2} and TYPE_PFLASH_CFI0{1, 2}
|
|
|
7711c0 |
MIME-Version: 1.0
|
|
|
7711c0 |
Content-Type: text/plain; charset=UTF-8
|
|
|
7711c0 |
Content-Transfer-Encoding: 8bit
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
7711c0 |
Message-id: <20190517065120.12028-8-armbru@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 87997
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v3 07/31] hw: Use PFLASH_CFI0{1, 2} and TYPE_PFLASH_CFI0{1, 2}
|
|
|
7711c0 |
Bugzilla: 1624009
|
|
|
7711c0 |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
We have two open-coded copies of macro PFLASH_CFI01(). Move the macro
|
|
|
7711c0 |
to the header, so we can ditch the copies. Move PFLASH_CFI02() to the
|
|
|
7711c0 |
header for symmetry.
|
|
|
7711c0 |
|
|
|
7711c0 |
We define macros TYPE_PFLASH_CFI01 and TYPE_PFLASH_CFI02 for type name
|
|
|
7711c0 |
strings, then mostly use the strings. If the macros are worth
|
|
|
7711c0 |
defining, they are worth using. Replace the strings by the macros.
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
|
|
|
7711c0 |
Message-Id: <20190308094610.21210-6-armbru@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit 81c7db723ebd0c677784a728020c7e8845868daf)
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
hw/arm/vexpress.c | 4 ++--
|
|
|
7711c0 |
hw/arm/virt.c | 3 ++-
|
|
|
7711c0 |
hw/block/pflash_cfi01.c | 3 ---
|
|
|
7711c0 |
hw/block/pflash_cfi02.c | 3 ---
|
|
|
7711c0 |
hw/xtensa/xtfpga.c | 4 ++--
|
|
|
7711c0 |
include/hw/block/flash.h | 4 ++++
|
|
|
7711c0 |
6 files changed, 10 insertions(+), 11 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
|
|
|
7711c0 |
index 5cca371..cf87379 100644
|
|
|
7711c0 |
--- a/hw/arm/vexpress.c
|
|
|
7711c0 |
+++ b/hw/arm/vexpress.c
|
|
|
7711c0 |
@@ -504,7 +504,7 @@ static void vexpress_modify_dtb(const struct arm_boot_info *info, void *fdt)
|
|
|
7711c0 |
static PFlashCFI01 *ve_pflash_cfi01_register(hwaddr base, const char *name,
|
|
|
7711c0 |
DriveInfo *di)
|
|
|
7711c0 |
{
|
|
|
7711c0 |
- DeviceState *dev = qdev_create(NULL, "cfi.pflash01");
|
|
|
7711c0 |
+ DeviceState *dev = qdev_create(NULL, TYPE_PFLASH_CFI01);
|
|
|
7711c0 |
|
|
|
7711c0 |
if (di) {
|
|
|
7711c0 |
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(di),
|
|
|
7711c0 |
@@ -525,7 +525,7 @@ static PFlashCFI01 *ve_pflash_cfi01_register(hwaddr base, const char *name,
|
|
|
7711c0 |
qdev_init_nofail(dev);
|
|
|
7711c0 |
|
|
|
7711c0 |
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
|
|
|
7711c0 |
- return OBJECT_CHECK(PFlashCFI01, (dev), "cfi.pflash01");
|
|
|
7711c0 |
+ return PFLASH_CFI01(dev);
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
static void vexpress_common_init(MachineState *machine)
|
|
|
7711c0 |
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
|
|
7711c0 |
index 751a93c..4c652de 100644
|
|
|
7711c0 |
--- a/hw/arm/virt.c
|
|
|
7711c0 |
+++ b/hw/arm/virt.c
|
|
|
7711c0 |
@@ -34,6 +34,7 @@
|
|
|
7711c0 |
#include "hw/arm/arm.h"
|
|
|
7711c0 |
#include "hw/arm/primecell.h"
|
|
|
7711c0 |
#include "hw/arm/virt.h"
|
|
|
7711c0 |
+#include "hw/block/flash.h"
|
|
|
7711c0 |
#include "hw/vfio/vfio-calxeda-xgmac.h"
|
|
|
7711c0 |
#include "hw/vfio/vfio-amd-xgbe.h"
|
|
|
7711c0 |
#include "hw/devices.h"
|
|
|
7711c0 |
@@ -812,7 +813,7 @@ static void create_one_flash(const char *name, hwaddr flashbase,
|
|
|
7711c0 |
* parameters as the flash devices on the Versatile Express board.
|
|
|
7711c0 |
*/
|
|
|
7711c0 |
DriveInfo *dinfo = drive_get_next(IF_PFLASH);
|
|
|
7711c0 |
- DeviceState *dev = qdev_create(NULL, "cfi.pflash01");
|
|
|
7711c0 |
+ DeviceState *dev = qdev_create(NULL, TYPE_PFLASH_CFI01);
|
|
|
7711c0 |
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
|
|
|
7711c0 |
const uint64_t sectorlength = 256 * 1024;
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
|
|
|
7711c0 |
index 1ff4d25..dbd3b9d 100644
|
|
|
7711c0 |
--- a/hw/block/pflash_cfi01.c
|
|
|
7711c0 |
+++ b/hw/block/pflash_cfi01.c
|
|
|
7711c0 |
@@ -59,9 +59,6 @@ do { \
|
|
|
7711c0 |
#define DPRINTF(fmt, ...) do { } while (0)
|
|
|
7711c0 |
#endif
|
|
|
7711c0 |
|
|
|
7711c0 |
-#define PFLASH_CFI01(obj) \
|
|
|
7711c0 |
- OBJECT_CHECK(PFlashCFI01, (obj), TYPE_PFLASH_CFI01)
|
|
|
7711c0 |
-
|
|
|
7711c0 |
#define PFLASH_BE 0
|
|
|
7711c0 |
#define PFLASH_SECURE 1
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
|
|
|
7711c0 |
index 2c0cbde..b9e0448 100644
|
|
|
7711c0 |
--- a/hw/block/pflash_cfi02.c
|
|
|
7711c0 |
+++ b/hw/block/pflash_cfi02.c
|
|
|
7711c0 |
@@ -57,9 +57,6 @@ do { \
|
|
|
7711c0 |
|
|
|
7711c0 |
#define PFLASH_LAZY_ROMD_THRESHOLD 42
|
|
|
7711c0 |
|
|
|
7711c0 |
-#define PFLASH_CFI02(obj) \
|
|
|
7711c0 |
- OBJECT_CHECK(PFlashCFI02, (obj), TYPE_PFLASH_CFI02)
|
|
|
7711c0 |
-
|
|
|
7711c0 |
struct PFlashCFI02 {
|
|
|
7711c0 |
/*< private >*/
|
|
|
7711c0 |
SysBusDevice parent_obj;
|
|
|
7711c0 |
diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
|
|
|
7711c0 |
index 8f8c0b9..56deadc 100644
|
|
|
7711c0 |
--- a/hw/xtensa/xtfpga.c
|
|
|
7711c0 |
+++ b/hw/xtensa/xtfpga.c
|
|
|
7711c0 |
@@ -164,7 +164,7 @@ static PFlashCFI01 *xtfpga_flash_init(MemoryRegion *address_space,
|
|
|
7711c0 |
DriveInfo *dinfo, int be)
|
|
|
7711c0 |
{
|
|
|
7711c0 |
SysBusDevice *s;
|
|
|
7711c0 |
- DeviceState *dev = qdev_create(NULL, "cfi.pflash01");
|
|
|
7711c0 |
+ DeviceState *dev = qdev_create(NULL, TYPE_PFLASH_CFI01);
|
|
|
7711c0 |
|
|
|
7711c0 |
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo),
|
|
|
7711c0 |
&error_abort);
|
|
|
7711c0 |
@@ -178,7 +178,7 @@ static PFlashCFI01 *xtfpga_flash_init(MemoryRegion *address_space,
|
|
|
7711c0 |
s = SYS_BUS_DEVICE(dev);
|
|
|
7711c0 |
memory_region_add_subregion(address_space, board->flash->base,
|
|
|
7711c0 |
sysbus_mmio_get_region(s, 0));
|
|
|
7711c0 |
- return OBJECT_CHECK(PFlashCFI01, (dev), "cfi.pflash01");
|
|
|
7711c0 |
+ return PFLASH_CFI01(dev);
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
static uint64_t translate_phys_addr(void *opaque, uint64_t addr)
|
|
|
7711c0 |
diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h
|
|
|
7711c0 |
index 333005d..aeea3ca 100644
|
|
|
7711c0 |
--- a/include/hw/block/flash.h
|
|
|
7711c0 |
+++ b/include/hw/block/flash.h
|
|
|
7711c0 |
@@ -8,6 +8,8 @@
|
|
|
7711c0 |
/* pflash_cfi01.c */
|
|
|
7711c0 |
|
|
|
7711c0 |
#define TYPE_PFLASH_CFI01 "cfi.pflash01"
|
|
|
7711c0 |
+#define PFLASH_CFI01(obj) \
|
|
|
7711c0 |
+ OBJECT_CHECK(PFlashCFI01, (obj), TYPE_PFLASH_CFI01)
|
|
|
7711c0 |
|
|
|
7711c0 |
typedef struct PFlashCFI01 PFlashCFI01;
|
|
|
7711c0 |
|
|
|
7711c0 |
@@ -25,6 +27,8 @@ MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl);
|
|
|
7711c0 |
/* pflash_cfi02.c */
|
|
|
7711c0 |
|
|
|
7711c0 |
#define TYPE_PFLASH_CFI02 "cfi.pflash02"
|
|
|
7711c0 |
+#define PFLASH_CFI02(obj) \
|
|
|
7711c0 |
+ OBJECT_CHECK(PFlashCFI02, (obj), TYPE_PFLASH_CFI02)
|
|
|
7711c0 |
|
|
|
7711c0 |
typedef struct PFlashCFI02 PFlashCFI02;
|
|
|
7711c0 |
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|