qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Set RAM size in i440FX PCI configuration
@ 2006-09-13  3:28 Ed Swierk
  0 siblings, 0 replies; only message in thread
From: Ed Swierk @ 2006-09-13  3:28 UTC (permalink / raw)
  To: qemu-devel

[-- 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);
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-09-13  3:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-13  3:28 [Qemu-devel] [PATCH] Set RAM size in i440FX PCI configuration Ed Swierk

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).