From patchwork Fri Apr 5 06:36:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hu Tao X-Patchwork-Id: 234053 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B8AEE2C00AE for ; Fri, 5 Apr 2013 17:39:18 +1100 (EST) Received: from localhost ([::1]:57135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO0Iu-0003EB-GY for incoming@patchwork.ozlabs.org; Fri, 05 Apr 2013 02:39:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO0Gr-00006Y-US for qemu-devel@nongnu.org; Fri, 05 Apr 2013 02:37:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UO0Gn-000788-0F for qemu-devel@nongnu.org; Fri, 05 Apr 2013 02:37:09 -0400 Received: from [222.73.24.84] (port=9712 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO0Gm-00077L-M2 for qemu-devel@nongnu.org; Fri, 05 Apr 2013 02:37:04 -0400 X-IronPort-AV: E=Sophos;i="4.87,413,1363104000"; d="scan'208";a="7001393" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 05 Apr 2013 14:34:18 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r356aqH6020006; Fri, 5 Apr 2013 14:36:53 +0800 Received: from localhost.localdomain ([10.167.233.156]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013040514355003-319506 ; Fri, 5 Apr 2013 14:35:50 +0800 From: Hu Tao To: qemu-devel , "Daniel P. Berrange" , KAMEZAWA Hiroyuki , Jan Kiszka , Gleb Natapov , Blue Swirl , Eric Blake , Andrew Jones , Marcelo Tosatti , Sasha Levin , Luiz Capitulino , Anthony Liguori , Markus Armbruster , Paolo Bonzini , Stefan Hajnoczi , Juan Quintela , Orit Wasserman , Wen Congyang , "Michael S. Tsirkin" , Alexander Graf , Alex Williamson , Peter Maydell , Christian Borntraeger Date: Fri, 5 Apr 2013 14:36:20 +0800 Message-Id: <463861eaf170face0a5e7643d7d012024293096a.1365143012.git.hutao@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: References: X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/04/05 14:35:50, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/04/05 14:35:52, Serialize complete at 2013/04/05 14:35:52 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Subject: [Qemu-devel] [PATCH v17 4/6] pvpanic: pass configurable ioport to seabios X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This lets seabios patch the corresponding SSDT entry. Signed-off-by: Hu Tao --- hw/fw_cfg.c | 8 +++++++- hw/fw_cfg.h | 2 ++ hw/pvpanic.c | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c index 63a1998..0bde436 100644 --- a/hw/fw_cfg.c +++ b/hw/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); } diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h index 05c8df1..07cc941 100644 --- a/hw/fw_cfg.h +++ b/hw/fw_cfg.h @@ -1,6 +1,8 @@ #ifndef FW_CFG_H #define FW_CFG_H +#include "exec/hwaddr.h" + #define FW_CFG_SIGNATURE 0x00 #define FW_CFG_ID 0x01 #define FW_CFG_UUID 0x02 diff --git a/hw/pvpanic.c b/hw/pvpanic.c index ff0a116..b3d10e2 100644 --- a/hw/pvpanic.c +++ b/hw/pvpanic.c @@ -18,6 +18,8 @@ #include #include +#include "hw/fw_cfg.h" + /* The bit of supported pv event */ #define PVPANIC_F_PANICKED 0 @@ -79,10 +81,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; }