pvpanic: add API to access io port

Add API to find pvpanic device and get its io port.
Will be used to fill in guest info structure.

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Michael S. Tsirkin 2013-07-24 18:56:12 +03:00
parent 6f1426ab0f
commit 309cd62d6b
2 changed files with 13 additions and 1 deletions

View File

@ -117,8 +117,19 @@ void pvpanic_init(ISABus *bus)
isa_create_simple(bus, TYPE_ISA_PVPANIC_DEVICE);
}
#define PVPANIC_IOPORT_PROP "ioport"
uint16_t pvpanic_port(void)
{
Object *o = object_resolve_path_type("", TYPE_ISA_PVPANIC_DEVICE, NULL);
if (!o) {
return 0;
}
return object_property_get_int(o, PVPANIC_IOPORT_PROP, NULL);
}
static Property pvpanic_isa_properties[] = {
DEFINE_PROP_UINT16("ioport", PVPanicState, ioport, 0x505),
DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicState, ioport, 0x505),
DEFINE_PROP_END_OF_LIST(),
};

View File

@ -235,6 +235,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