qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Ed Swierk" <eswierk@arastra.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Set RAM size in i440FX PCI configuration
Date: Tue, 12 Sep 2006 20:28:49 -0700	[thread overview]
Message-ID: <c1bf1cf0609122028w54f49fdbve8fd1f07e8a9d1df@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 409 bytes --]

Currently qemu's i440FX PCI bridge emulation code does not set the
registers indicating the amount of RAM installed in each DIMM slot.
LinuxBIOS relies on this information to properly set up RAM before
booting Linux.

The attached patch sets a i440FX configuration register indicating the
highest RAM address in all slots, in units of 8MB. Since this is an
8-bit value, the maximum is capped at 2040MB.

--Ed

[-- Attachment #2: qemu-piix-ram-size.patch --]
[-- Type: text/x-patch, Size: 1308 bytes --]

--- qemu-0.8.2.orig/hw/piix_pci.c	2006-07-22 17:23:34.000000000 +0000
+++ qemu-0.8.2/hw/piix_pci.c	2006-09-13 03:05:53.000000000 +0000
@@ -42,7 +42,7 @@
 
 static void piix3_set_irq(PCIDevice *pci_dev, void *pic, int irq_num, int level);
 
-PCIBus *i440fx_init(void)
+PCIBus *i440fx_init(int ram_size)
 {
     PCIBus *b;
     PCIDevice *d;
@@ -73,6 +73,10 @@
     d->config[0x0a] = 0x00; // class_sub = host2pci
     d->config[0x0b] = 0x06; // class_base = PCI_bridge
     d->config[0x0e] = 0x00; // header_type
+    ram_size = ram_size / 8 / 1024 / 1024;
+    if (ram_size > 255)
+        ram_size = 255;
+    d->config[0x57] = ram_size;
     return b;
 }
 
--- qemu-0.8.2.orig/hw/pc.c	2006-09-12 23:33:03.000000000 +0000
+++ qemu-0.8.2/hw/pc.c	2006-09-13 02:38:33.000000000 +0000
@@ -747,7 +749,7 @@
     }
 
     if (pci_enabled) {
-        pci_bus = i440fx_init();
+        pci_bus = i440fx_init(ram_size);
         piix3_devfn = piix3_init(pci_bus);
     } else {
         pci_bus = NULL;
--- qemu-0.8.2.orig/vl.h	2006-09-12 23:33:03.000000000 +0000
+++ qemu-0.8.2/vl.h	2006-09-13 02:39:48.000000000 +0000
@@ -695,7 +695,7 @@
 PCIBus *pci_vpb_init(void *pic);
 
 /* piix_pci.c */
-PCIBus *i440fx_init(void);
+PCIBus *i440fx_init(int ram_size);
 int piix3_init(PCIBus *bus);
 void pci_bios_init(void);
 

                 reply	other threads:[~2006-09-13  3:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c1bf1cf0609122028w54f49fdbve8fd1f07e8a9d1df@mail.gmail.com \
    --to=eswierk@arastra.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).