From patchwork Mon Aug 3 13:32:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jes Sorensen X-Patchwork-Id: 30705 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 51CD7B6F1E for ; Tue, 4 Aug 2009 17:57:49 +1000 (EST) Received: from localhost ([127.0.0.1]:45859 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MYEu0-00075S-V6 for incoming@patchwork.ozlabs.org; Tue, 04 Aug 2009 03:57:45 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MYEsS-0006kq-0d for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:56:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MYEsN-0006jR-2O for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:56:07 -0400 Received: from [199.232.76.173] (port=39638 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MYEsM-0006jN-KF for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:56:02 -0400 Received: from relay2.sgi.com ([192.48.179.30]:52120 helo=relay.sgi.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MYEsM-0000JG-4T for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:56:02 -0400 Received: from eye3.emea.sgi.com (eye3.emea.sgi.com [144.253.156.24]) by relay2.corp.sgi.com (Postfix) with ESMTP id CF0C2304062; Tue, 4 Aug 2009 00:48:56 -0700 (PDT) Received: from eye3.emea.sgi.com (localhost.localdomain [127.0.0.1]) by eye3.emea.sgi.com (8.14.3/8.14.3) with ESMTP id n747mtWr004243; Tue, 4 Aug 2009 09:48:55 +0200 Received: (from jes@localhost) by eye3.emea.sgi.com (8.14.3/8.14.3/Submit) id n747mtwH004242; Tue, 4 Aug 2009 09:48:55 +0200 X-Authentication-Warning: eye3.emea.sgi.com: jes set sender to jes@sgi.com using -f Message-Id: <20090803133316.747565341@sgi.com> User-Agent: quilt/0.47-1 Date: Mon, 03 Aug 2009 15:32:39 +0200 From: Jes Sorensen To: kevin@koconnor.net References: <20090803133236.207919528@sgi.com> Content-Disposition: inline; filename=0004-emulator-detect.patch X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Anthony Liguori , Beth Kon , qemu-devel , avi@redhat.com Subject: [Qemu-devel] [PATCH 3/5] Set emu_ver based on information provided by qemu_cfg. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch retrieves the value of QEMU_CFG_EMULATOR and sets emu_ver, allowing the BIOS to runtime verify which emulator it is running on. Signed-off-by: Jes Sorensen --- src/post.c | 4 ++++ src/qemu-cfg.c | 8 ++++++++ src/qemu-cfg.h | 2 ++ src/util.h | 7 +++++++ 4 files changed, 21 insertions(+) Index: seabios/src/post.c =================================================================== --- seabios.orig/src/post.c +++ seabios/src/post.c @@ -20,6 +20,8 @@ #include "boot.h" // IPL #include "qemu-cfg.h" +u16 emu_ver; + void __set_irq(int vector, void *loc) { @@ -167,6 +169,8 @@ post() * if someone knows how to do so reliably. */ qemu_cfg_port_probe(); + if (qemu_cfg_port) + emu_ver = qemu_cfg_get_emulator_rev(); pic_setup(); timer_setup(); Index: seabios/src/qemu-cfg.c =================================================================== --- seabios.orig/src/qemu-cfg.c +++ seabios/src/qemu-cfg.c @@ -31,3 +31,11 @@ qemu_cfg_port_probe() return qemu_cfg_port; } +u16 qemu_cfg_get_emulator_rev(void) +{ + u16 rev; + + qemu_cfg_read((u8*)&rev, QEMU_CFG_EMULATOR, sizeof(rev)); + + return rev; +} Index: seabios/src/qemu-cfg.h =================================================================== --- seabios.orig/src/qemu-cfg.h +++ seabios/src/qemu-cfg.h @@ -12,8 +12,10 @@ #define QEMU_CFG_SIGNATURE 0x00 #define QEMU_CFG_ID 0x01 #define QEMU_CFG_UUID 0x02 +#define QEMU_CFG_EMULATOR 0x10 void qemu_cfg_read(u8 *buf, u16 f, int len); int qemu_cfg_port_probe(); +u16 qemu_cfg_get_emulator_rev(void); #endif Index: seabios/src/util.h =================================================================== --- seabios.orig/src/util.h +++ seabios/src/util.h @@ -267,4 +267,11 @@ extern const char VERSION[]; // qemu-cfg.c extern int qemu_cfg_port; +// port.c +extern u16 emu_ver; +#define EMU_NONE 0x0000 +#define EMU_QEMU 0x0100 +#define EMU_QEMU_KVM 0x0101 +#define EMU_QEMU_KQEMU 0x0102 + #endif // util.h