From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V8XIn-0005yo-U9 for qemu-devel@nongnu.org; Sun, 11 Aug 2013 11:11:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V8XIi-0001Bk-Ig for qemu-devel@nongnu.org; Sun, 11 Aug 2013 11:11:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V8XIi-0001BZ-9j for qemu-devel@nongnu.org; Sun, 11 Aug 2013 11:11:24 -0400 From: Marcel Apfelbaum Date: Sun, 11 Aug 2013 18:10:43 +0300 Message-Id: <1376233843-19410-3-git-send-email-marcel.a@redhat.com> In-Reply-To: <1376233843-19410-1-git-send-email-marcel.a@redhat.com> References: <1376233843-19410-1-git-send-email-marcel.a@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH for-1.6 V2 2/2] hw/misc: make pvpanic known to user List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, gleb@redhat.com, mst@redhat.com, hutao@cn.fujitsu.com, Marcel Apfelbaum , kraxel@redhat.com, pbonzini@redhat.com, afaerber@suse.de, vrozenfe@redhat.com 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 --- Changes from V1: - Addressed Andreas F=C3=A4rber review (removed bus type) - Small changes to be posible to enable pvpanic both from command line and from machine_init - Added pvpanic to MISC category hw/misc/pvpanic.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index 7bb49a5..b64e3bb 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -97,29 +97,24 @@ static void pvpanic_isa_realizefn(DeviceState *dev, E= rror **errp) { ISADevice *d =3D ISA_DEVICE(dev); PVPanicState *s =3D ISA_PVPANIC_DEVICE(dev); + FWCfgState *fw_cfg =3D fw_cfg_find(); + uint16_t *pvpanic_port; =20 - isa_register_ioport(d, &s->io, s->ioport); -} + if (!fw_cfg) { + return; + } =20 -static void pvpanic_fw_cfg(ISADevice *dev, FWCfgState *fw_cfg) -{ - PVPanicState *s =3D ISA_PVPANIC_DEVICE(dev); - uint16_t *pvpanic_port =3D g_malloc(sizeof(*pvpanic_port)); + pvpanic_port =3D g_malloc(sizeof(*pvpanic_port)); *pvpanic_port =3D 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); } =20 void pvpanic_init(ISABus *bus) { - ISADevice *dev; - FWCfgState *fw_cfg =3D fw_cfg_find(); - if (!fw_cfg) { - return; - } - dev =3D isa_create_simple (bus, TYPE_ISA_PVPANIC_DEVICE); - pvpanic_fw_cfg(dev, fw_cfg); + isa_create_simple(bus, TYPE_ISA_PVPANIC_DEVICE); } =20 static Property pvpanic_isa_properties[] =3D { @@ -132,8 +127,8 @@ static void pvpanic_isa_class_init(ObjectClass *klass= , void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->realize =3D pvpanic_isa_realizefn; - dc->no_user =3D 1; dc->props =3D pvpanic_isa_properties; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); } =20 static TypeInfo pvpanic_isa_info =3D { --=20 1.8.3.1