Add API to find pvpanic device and get its io port. Will be used to fill in guest info structure.
Signed-off-by: Michael S. Tsirkin <m...@redhat.com> --- hw/misc/pvpanic.c | 11 +++++++++++ include/hw/i386/pc.h | 1 + 2 files changed, 12 insertions(+) diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 7bb49a5..bb403e9 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -122,6 +122,17 @@ void pvpanic_init(ISABus *bus) pvpanic_fw_cfg(dev, fw_cfg); } +uint16_t pvpanic_port(void) +{ + Object *o = object_resolve_path_type("", TYPE_ISA_PVPANIC_DEVICE, NULL); + PVPanicState *s; + if (!o) { + return 0; + } + s = ISA_PVPANIC_DEVICE(o); + return s->ioport; +} + static Property pvpanic_isa_properties[] = { DEFINE_PROP_UINT16("ioport", PVPanicState, ioport, 0x505), DEFINE_PROP_END_OF_LIST(), diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 76af5cd..e718a59 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -228,6 +228,7 @@ void pc_system_firmware_init(MemoryRegion *rom_memory); /* pvpanic.c */ void pvpanic_init(ISABus *bus); +uint16_t pvpanic_port(void); /* e820 types */ #define E820_RAM 1 -- MST