|
|
9ae3a8 |
From b33784c26d96c3c020f4b0245f77731af3f88b8e Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 6 Nov 2013 16:32:29 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 70/81] fw_cfg: add API to find FW cfg object
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1383755557-21590-2-git-send-email-marcel.a@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55546
|
|
|
9ae3a8 |
O-Subject: [RHEL-7 qemu-kvm PATCH v3 1/9] fw_cfg: add API to find FW cfg object
|
|
|
9ae3a8 |
Bugzilla: 990601
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Remove some code duplication by adding a
|
|
|
9ae3a8 |
function to look up the fw cfg file.
|
|
|
9ae3a8 |
This way, we don't need to duplicate same strings everywhere.
|
|
|
9ae3a8 |
Use by both fw cfg and pvpanic device.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 600c60b76d0682f6c39d19bfff79da9321e8cf86)
|
|
|
9ae3a8 |
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/misc/pvpanic.c | 2 +-
|
|
|
9ae3a8 |
hw/nvram/fw_cfg.c | 15 ++++++++++++---
|
|
|
9ae3a8 |
include/hw/nvram/fw_cfg.h | 2 ++
|
|
|
9ae3a8 |
3 files changed, 15 insertions(+), 4 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/misc/pvpanic.c | 2 +-
|
|
|
9ae3a8 |
hw/nvram/fw_cfg.c | 15 ++++++++++++---
|
|
|
9ae3a8 |
include/hw/nvram/fw_cfg.h | 2 ++
|
|
|
9ae3a8 |
3 files changed, 15 insertions(+), 4 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
|
|
|
9ae3a8 |
index 439d636..d17c3c9 100644
|
|
|
9ae3a8 |
--- a/hw/misc/pvpanic.c
|
|
|
9ae3a8 |
+++ b/hw/misc/pvpanic.c
|
|
|
9ae3a8 |
@@ -96,7 +96,7 @@ static int pvpanic_isa_initfn(ISADevice *dev)
|
|
|
9ae3a8 |
isa_register_ioport(dev, &s->io, s->ioport);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (!port_configured) {
|
|
|
9ae3a8 |
- fw_cfg = object_resolve_path("/machine/fw_cfg", NULL);
|
|
|
9ae3a8 |
+ fw_cfg = fw_cfg_find();
|
|
|
9ae3a8 |
if (fw_cfg) {
|
|
|
9ae3a8 |
fw_cfg_add_file(fw_cfg, "etc/pvpanic-port",
|
|
|
9ae3a8 |
g_memdup(&s->ioport, sizeof(s->ioport)),
|
|
|
9ae3a8 |
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
|
|
|
9ae3a8 |
index 3fa1488..064344d 100644
|
|
|
9ae3a8 |
--- a/hw/nvram/fw_cfg.c
|
|
|
9ae3a8 |
+++ b/hw/nvram/fw_cfg.c
|
|
|
9ae3a8 |
@@ -32,6 +32,9 @@
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
#define FW_CFG_SIZE 2
|
|
|
9ae3a8 |
#define FW_CFG_DATA_SIZE 1
|
|
|
9ae3a8 |
+#define TYPE_FW_CFG "fw_cfg"
|
|
|
9ae3a8 |
+#define FW_CFG_NAME "fw_cfg"
|
|
|
9ae3a8 |
+#define FW_CFG_PATH "/machine/" FW_CFG_NAME
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
typedef struct FWCfgEntry {
|
|
|
9ae3a8 |
uint32_t len;
|
|
|
9ae3a8 |
@@ -493,8 +496,8 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
s = DO_UPCAST(FWCfgState, busdev.qdev, dev);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (!object_resolve_path("/machine/fw_cfg", NULL)) {
|
|
|
9ae3a8 |
- object_property_add_child(qdev_get_machine(), "fw_cfg", OBJECT(s),
|
|
|
9ae3a8 |
+ if (!object_resolve_path(FW_CFG_PATH, NULL)) {
|
|
|
9ae3a8 |
+ object_property_add_child(qdev_get_machine(), FW_CFG_NAME, OBJECT(s),
|
|
|
9ae3a8 |
NULL);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -553,6 +556,12 @@ static Property fw_cfg_properties[] = {
|
|
|
9ae3a8 |
DEFINE_PROP_END_OF_LIST(),
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+FWCfgState *fw_cfg_find(void)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ return OBJECT_CHECK(FWCfgState, object_resolve_path(FW_CFG_PATH, NULL),
|
|
|
9ae3a8 |
+ TYPE_FW_CFG);
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static void fw_cfg_class_init(ObjectClass *klass, void *data)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
DeviceClass *dc = DEVICE_CLASS(klass);
|
|
|
9ae3a8 |
@@ -565,7 +574,7 @@ static void fw_cfg_class_init(ObjectClass *klass, void *data)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static const TypeInfo fw_cfg_info = {
|
|
|
9ae3a8 |
- .name = "fw_cfg",
|
|
|
9ae3a8 |
+ .name = TYPE_FW_CFG,
|
|
|
9ae3a8 |
.parent = TYPE_SYS_BUS_DEVICE,
|
|
|
9ae3a8 |
.instance_size = sizeof(FWCfgState),
|
|
|
9ae3a8 |
.class_init = fw_cfg_class_init,
|
|
|
9ae3a8 |
diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
|
|
|
9ae3a8 |
index 3e4a334..48a8aa4 100644
|
|
|
9ae3a8 |
--- a/include/hw/nvram/fw_cfg.h
|
|
|
9ae3a8 |
+++ b/include/hw/nvram/fw_cfg.h
|
|
|
9ae3a8 |
@@ -73,6 +73,8 @@ void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data,
|
|
|
9ae3a8 |
FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
|
|
|
9ae3a8 |
hwaddr crl_addr, hwaddr data_addr);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+FWCfgState *fw_cfg_find(void);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
#endif /* NO_QEMU_PROTOS */
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
#endif
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|