From patchwork Mon Aug 3 13:32:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jes Sorensen X-Patchwork-Id: 30701 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 D75EDB6F1E for ; Tue, 4 Aug 2009 17:50:46 +1000 (EST) Received: from localhost ([127.0.0.1]:39325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MYEnC-0004lk-1W for incoming@patchwork.ozlabs.org; Tue, 04 Aug 2009 03:50:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MYElh-0003wA-B3 for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:49:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MYElc-0003sS-C1 for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:49:08 -0400 Received: from [199.232.76.173] (port=46542 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MYElc-0003sI-29 for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:49:04 -0400 Received: from mx20.gnu.org ([199.232.41.8]:39868) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MYElb-0007yy-Ey for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:49:03 -0400 Received: from relay2.sgi.com ([192.48.179.30] helo=relay.sgi.com) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MYEla-0005ip-Gd for qemu-devel@nongnu.org; Tue, 04 Aug 2009 03:49: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 CFE6F304064; 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 n747mtor004235; 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 n747mtk4004234; 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.440384755@sgi.com> User-Agent: quilt/0.47-1 Date: Mon, 03 Aug 2009 15:32:37 +0200 From: Jes Sorensen To: kevin@koconnor.net References: <20090803133236.207919528@sgi.com> Content-Disposition: inline; filename=0002-seperate-qemu-cfg.patch X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Anthony Liguori , Beth Kon , qemu-devel , avi@redhat.com Subject: [Qemu-devel] [PATCH 1/5] Move QEMU_CFG related code out of smbios.c 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 moves QEMU_CFG infrastructure out of smbios.c and puts it into seperate files. Signed-off-by: Jes Sorensen --- Makefile | 4 ++-- src/qemu-cfg.c | 29 +++++++++++++++++++++++++++++ src/qemu-cfg.h | 19 +++++++++++++++++++ src/smbios.c | 22 +--------------------- 4 files changed, 51 insertions(+), 23 deletions(-) Index: seabios/Makefile =================================================================== --- seabios.orig/Makefile +++ seabios/Makefile @@ -16,8 +16,8 @@ SRCBOTH=output.c util.c floppy.c ata.c m pnpbios.c pirtable.c vgahooks.c pmm.c SRC16=$(SRCBOTH) system.c disk.c apm.c pcibios.c font.c SRC32=$(SRCBOTH) post.c shadow.c memmap.c coreboot.c boot.c \ - acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c mtrr.c \ - lzmadecode.c + acpi.c smm.c mptable.c qemu-cfg.c smbios.c pciinit.c optionroms.c \ + mtrr.c lzmadecode.c cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \ /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;) Index: seabios/src/qemu-cfg.c =================================================================== --- /dev/null +++ seabios/src/qemu-cfg.c @@ -0,0 +1,29 @@ +// qemu-cfg.c: QEMU_CFG related code +// +// Copyright (C) 2009 Jes Sorensen, SGI +// Copyright (C) 2008 Kevin O'Connor +// Copyright (C) 2006 Fabrice Bellard +// +// This file may be distributed under the terms of the GNU LGPLv3 license. + +#include "types.h" +#include "ioport.h" +#include "qemu-cfg.h" + +void +qemu_cfg_read(u8 *buf, u16 f, int len) +{ + outw(f, PORT_QEMU_CFG_CTL); + while (len--) + *(buf++) = inb(PORT_QEMU_CFG_DATA); +} + +int +qemu_cfg_port_probe() +{ + u8 sig[4] = "QEMU"; + u8 buf[4]; + qemu_cfg_read(buf, QEMU_CFG_SIGNATURE, 4); + return *(u32*)buf == *(u32*)sig; +} + Index: seabios/src/qemu-cfg.h =================================================================== --- /dev/null +++ seabios/src/qemu-cfg.h @@ -0,0 +1,19 @@ +// qemu-cfg.h: QEMU_CFG related definitions +// +// Copyright (C) 2009 Jes Sorensen, SGI +// Copyright (C) 2008 Kevin O'Connor +// Copyright (C) 2006 Fabrice Bellard +// +// This file may be distributed under the terms of the GNU LGPLv3 license. + +#ifndef __QEMU_CFG_H +#define __QEMU_CFG_H + +#define QEMU_CFG_SIGNATURE 0x00 +#define QEMU_CFG_ID 0x01 +#define QEMU_CFG_UUID 0x02 + +void qemu_cfg_read(u8 *buf, u16 f, int len); +int qemu_cfg_port_probe(); + +#endif Index: seabios/src/smbios.c =================================================================== --- seabios.orig/src/smbios.c +++ seabios/src/smbios.c @@ -8,33 +8,13 @@ #include "util.h" // dprintf #include "memmap.h" // malloc_fseg #include "biosvar.h" // GET_EBDA +#include "qemu-cfg.h" // QEMU_CFG_UUID /**************************************************************** * UUID probe ****************************************************************/ -#define QEMU_CFG_SIGNATURE 0x00 -#define QEMU_CFG_ID 0x01 -#define QEMU_CFG_UUID 0x02 - -static void -qemu_cfg_read(u8 *buf, u16 f, int len) -{ - outw(f, PORT_QEMU_CFG_CTL); - while (len--) - *(buf++) = inb(PORT_QEMU_CFG_DATA); -} - -static int -qemu_cfg_port_probe() -{ - u8 sig[4] = "QEMU"; - u8 buf[4]; - qemu_cfg_read(buf, QEMU_CFG_SIGNATURE, 4); - return *(u32*)buf == *(u32*)sig; -} - static void uuid_probe(u8 *bios_uuid) {