Received: from eggs.gnu.org ([208.118.235.92]:54567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVLmC-0002zz-9d for qemu-devel@nongnu.org; Thu, 25 Apr 2013 08:59:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVLm5-0006M0-AH for qemu-devel@nongnu.org; Thu, 25 Apr 2013 08:59:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVLm5-0006Lh-3Y for qemu-devel@nongnu.org; Thu, 25 Apr 2013 08:59:45 -0400 From: Markus Armbruster References: <87r4hz9996.fsf@blackfin.pond.sub.org> <20130425054353.GH10084@localhost.localdomain> Date: Thu, 25 Apr 2013 14:59:35 +0200 In-Reply-To: <20130425054353.GH10084@localhost.localdomain> (Hu Tao's message of "Thu, 25 Apr 2013 13:43:54 +0800") Message-ID: <874neuojew.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v20 4/7] pvpanic: pass configurable ioport to seabios List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: qemu-devel@nongnu.org Hu Tao writes: > On Wed, Apr 24, 2013 at 06:35:49PM +0200, Markus Armbruster wrote: >> Hu Tao writes: >> >> > This lets seabios patch the corresponding SSDT entry. >> > >> > Signed-off-by: Hu Tao >> > --- >> > hw/misc/pvpanic.c | 14 ++++++++++++++ >> > hw/nvram/fw_cfg.c | 8 +++++++- >> > include/hw/nvram/fw_cfg.h | 2 ++ >> > 3 files changed, 23 insertions(+), 1 deletion(-) >> > >> > diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c >> > index 01cfe0b..a80fae5 100644 >> > --- a/hw/misc/pvpanic.c >> > +++ b/hw/misc/pvpanic.c >> > @@ -18,6 +18,8 @@ >> > #include "sysemu/sysemu.h" >> > #include "qemu/log.h" >> > >> > +#include "hw/nvram/fw_cfg.h" >> > + >> > /* The bit of supported pv event */ >> > #define PVPANIC_F_PANICKED 0 >> > >> > @@ -86,10 +88,22 @@ static const MemoryRegionOps pvpanic_ops = { >> > static int pvpanic_isa_initfn(ISADevice *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); >> > 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; >> > } >> > >> > diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c >> > index 97bba87..1a7e49c 100644 >> > --- a/hw/nvram/fw_cfg.c >> > +++ b/hw/nvram/fw_cfg.c >> > @@ -489,11 +489,17 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port, >> > dev = qdev_create(NULL, "fw_cfg"); >> > qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port); >> > qdev_prop_set_uint32(dev, "data_iobase", data_port); >> > - qdev_init_nofail(dev); >> > d = SYS_BUS_DEVICE(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) { >> > sysbus_mmio_map(d, 0, ctl_addr); >> > } >> >> Oh, and while you're at it: mention the new QOM object in the commit >> message? > > You mean fw_cfg is added to /machine/fw_cfg? Yes.