mirror of https://github.com/xemu-project/xemu.git
hw/misc: make pvpanic known to user
This patch is based on Hu Tao's: http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00125.html The pvpanic device may be enabled now with "-device pvpanic" from command line. Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Reviewed-by: Hu Tao <hutao@cn.fujitsu.com> Message-id: 1376233843-19410-3-git-send-email-marcel.a@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
7f3e341a00
commit
a5d3f640a0
|
@ -97,29 +97,24 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
ISADevice *d = ISA_DEVICE(dev);
|
ISADevice *d = ISA_DEVICE(dev);
|
||||||
PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
|
PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
|
||||||
|
FWCfgState *fw_cfg = fw_cfg_find();
|
||||||
|
uint16_t *pvpanic_port;
|
||||||
|
|
||||||
|
if (!fw_cfg) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pvpanic_port = g_malloc(sizeof(*pvpanic_port));
|
||||||
|
*pvpanic_port = cpu_to_le16(s->ioport);
|
||||||
|
fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port,
|
||||||
|
sizeof(*pvpanic_port));
|
||||||
|
|
||||||
isa_register_ioport(d, &s->io, s->ioport);
|
isa_register_ioport(d, &s->io, s->ioport);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pvpanic_fw_cfg(ISADevice *dev, FWCfgState *fw_cfg)
|
|
||||||
{
|
|
||||||
PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
|
|
||||||
uint16_t *pvpanic_port = g_malloc(sizeof(*pvpanic_port));
|
|
||||||
*pvpanic_port = cpu_to_le16(s->ioport);
|
|
||||||
|
|
||||||
fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port,
|
|
||||||
sizeof(*pvpanic_port));
|
|
||||||
}
|
|
||||||
|
|
||||||
void pvpanic_init(ISABus *bus)
|
void pvpanic_init(ISABus *bus)
|
||||||
{
|
{
|
||||||
ISADevice *dev;
|
isa_create_simple(bus, TYPE_ISA_PVPANIC_DEVICE);
|
||||||
FWCfgState *fw_cfg = fw_cfg_find();
|
|
||||||
if (!fw_cfg) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dev = isa_create_simple (bus, TYPE_ISA_PVPANIC_DEVICE);
|
|
||||||
pvpanic_fw_cfg(dev, fw_cfg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Property pvpanic_isa_properties[] = {
|
static Property pvpanic_isa_properties[] = {
|
||||||
|
@ -132,8 +127,8 @@ static void pvpanic_isa_class_init(ObjectClass *klass, void *data)
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = pvpanic_isa_realizefn;
|
dc->realize = pvpanic_isa_realizefn;
|
||||||
dc->no_user = 1;
|
|
||||||
dc->props = pvpanic_isa_properties;
|
dc->props = pvpanic_isa_properties;
|
||||||
|
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TypeInfo pvpanic_isa_info = {
|
static TypeInfo pvpanic_isa_info = {
|
||||||
|
|
Loading…
Reference in New Issue