pvpanic: pass configurable ioport to seabios

This lets seabios patch the corresponding SSDT entry.

Also add fw_cfg object to /machine/fw_cfg so we can reference
it elsewhere.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 60c65d95fe2b23b12bea67099126566010a11a1a.1366945969.git.hutao@cn.fujitsu.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Hu Tao 2013-04-26 11:24:44 +08:00 committed by Anthony Liguori
parent 1dfe5057e5
commit 10a584b287
2 changed files with 21 additions and 1 deletions

View File

@ -18,6 +18,8 @@
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
#include "qemu/log.h" #include "qemu/log.h"
#include "hw/nvram/fw_cfg.h"
/* The bit of supported pv event */ /* The bit of supported pv event */
#define PVPANIC_F_PANICKED 0 #define PVPANIC_F_PANICKED 0
@ -86,10 +88,22 @@ static const MemoryRegionOps pvpanic_ops = {
static int pvpanic_isa_initfn(ISADevice *dev) static int pvpanic_isa_initfn(ISADevice *dev)
{ {
PVPanicState *s = ISA_PVPANIC_DEVICE(dev); PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
static bool port_configured;
void *fw_cfg;
memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1); memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1);
isa_register_ioport(dev, &s->io, s->ioport); isa_register_ioport(dev, &s->io, s->ioport);
if (!port_configured) {
fw_cfg = object_resolve_path("/machine/fw_cfg", NULL);
if (fw_cfg) {
fw_cfg_add_file(fw_cfg, "etc/pvpanic-port",
g_memdup(&s->ioport, sizeof(s->ioport)),
sizeof(s->ioport));
port_configured = true;
}
}
return 0; return 0;
} }

View File

@ -489,11 +489,17 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
dev = qdev_create(NULL, "fw_cfg"); dev = qdev_create(NULL, "fw_cfg");
qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port); qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port);
qdev_prop_set_uint32(dev, "data_iobase", data_port); qdev_prop_set_uint32(dev, "data_iobase", data_port);
qdev_init_nofail(dev);
d = SYS_BUS_DEVICE(dev); d = SYS_BUS_DEVICE(dev);
s = DO_UPCAST(FWCfgState, busdev.qdev, dev); s = DO_UPCAST(FWCfgState, busdev.qdev, dev);
if (!object_resolve_path("/machine/fw_cfg", NULL)) {
object_property_add_child(qdev_get_machine(), "fw_cfg", OBJECT(s),
NULL);
}
qdev_init_nofail(dev);
if (ctl_addr) { if (ctl_addr) {
sysbus_mmio_map(d, 0, ctl_addr); sysbus_mmio_map(d, 0, ctl_addr);
} }