From patchwork Mon Apr 19 15:47:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bernhard M. Wiedemann" X-Patchwork-Id: 50490 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 ozlabs.org (Postfix) with ESMTPS id 92EF4B7D0C for ; Tue, 20 Apr 2010 05:21:27 +1000 (EST) Received: from localhost ([127.0.0.1]:43536 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3wUv-0001aN-EU for incoming@patchwork.ozlabs.org; Mon, 19 Apr 2010 15:19:09 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O3tC6-0001mI-Ln for qemu-devel@nongnu.org; Mon, 19 Apr 2010 11:47:30 -0400 Received: from [140.186.70.92] (port=33609 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3tC5-0001lY-6M for qemu-devel@nongnu.org; Mon, 19 Apr 2010 11:47:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O3tC2-0004Zk-MA for qemu-devel@nongnu.org; Mon, 19 Apr 2010 11:47:29 -0400 Received: from delta.zq1.de ([78.46.32.14]:39865) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O3tC2-0004YD-1N for qemu-devel@nongnu.org; Mon, 19 Apr 2010 11:47:26 -0400 Received: from delta.zq1.de (localhost [127.0.0.1]) by delta.zq1.de (Postfix) with ESMTP id 18ED71734C1 for ; Mon, 19 Apr 2010 17:47:20 +0200 (CEST) Received: from vm12ag.zq1.de (uml12a.zq1.de [192.168.234.46]) by delta.zq1.de (Postfix) with ESMTP for ; Mon, 19 Apr 2010 17:47:20 +0200 (CEST) Received: by vm12ag.zq1.de (Postfix, from userid 1000) id 0748F100D0; Mon, 19 Apr 2010 17:47:19 +0200 (CEST) Date: Mon, 19 Apr 2010 17:47:19 +0200 From: "Bernhard M. Wiedemann" To: qemu-devel@nongnu.org Message-ID: <20100419154719.GA8863@zq1.de> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Mon, 19 Apr 2010 15:15:00 -0400 Subject: [Qemu-devel] [PATCH 1/1] hw: better i440 emulation 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 attached is a tested 0.12.3-version of an old patch http://xenon.stanford.edu/~eswierk/misc/qemu-linuxbios/qemu-piix-ram-size.patch that together with http://www.mail-archive.com/linuxbios@linuxbios.org/msg02390.html (which is already in coreboot trunk) allows coreboot BIOS to autodetect the amount of RAM within qemu/kvm from a register in i440 northbridge. The message on the old patch states: Unfortunately the current version of qemu does not set these registers, but I have patched qemu so that it emulates the i440 more faithfully in this regard. new patch is also available at http://www.zq1.de/~bernhard/linux/qemu-0.12.3-piix-ram-size.patch Please discuss or apply this patch. regards Bernhard M. Wiedemann --- software engineer diff -ru ./hw/pc.c ../qpatch/hw/pc.c --- ./hw/pc.c 2010-02-26 03:34:00.000000000 +0100 +++ ../qpatch/hw/pc.c 2010-04-19 17:18:12.000000000 +0200 @@ -1130,7 +1130,7 @@ } if (pci_enabled) { - pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq); + pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq, ram_size); } else { pci_bus = NULL; isa_bus_new(NULL); diff -ru ./hw/pc.h ../qpatch/hw/pc.h --- ./hw/pc.h 2010-02-26 03:34:00.000000000 +0100 +++ ../qpatch/hw/pc.h 2010-04-19 17:10:50.000000000 +0200 @@ -129,7 +129,7 @@ struct PCII440FXState; typedef struct PCII440FXState PCII440FXState; -PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic); +PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic, int ram_size); void i440fx_set_smm(PCII440FXState *d, int val); void i440fx_init_memory_mappings(PCII440FXState *d); diff -ru ./hw/piix_pci.c ../qpatch/hw/piix_pci.c --- ./hw/piix_pci.c 2010-02-26 03:34:00.000000000 +0100 +++ ../qpatch/hw/piix_pci.c 2010-04-19 17:27:59.000000000 +0200 @@ -209,7 +209,7 @@ static PIIX3State *piix3_dev; -PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic) +PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic, int ram_size) { DeviceState *dev; PCIBus *b; @@ -236,6 +236,11 @@ piix3_dev = piix3; + ram_size = ram_size / 8 / 1024 / 1024; + if (ram_size > 255) + ram_size = 255; + (*pi440fx_state)->dev.config[0x57]=ram_size; + return b; }