From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Ed Swierk <eswierk@skyportsystems.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Richard Smith <smithbone@gmail.com>
Subject: [Qemu-devel] [PULL 03/24] piix: Document coreboot-specific RAM size config register
Date: Thu, 13 Aug 2015 15:14:45 +0300 [thread overview]
Message-ID: <1439468033-6413-4-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1439468033-6413-1-git-send-email-mst@redhat.com>
From: Eduardo Habkost <ehabkost@redhat.com>
The existing i440fx initialization code sets a PCI config register that
isn't documented anywhere in the Intel 440FX datasheet. Register 0x57 is
DRAMC (DRAM Control) and has nothing to do with the RAM size.
This was implemented in commit ec5f92ce6ac8ec09056be77e03c941be188648fa
because old coreboot code tried to read registers 0x5a-0x5f,0x56,0x57 to
get the RAM size from QEMU, but I couldn't find out why coreboot did
that. I assume it was a mistake, and the original code was supposed to
be reading the DRB[0-7] registers (offsets 0x60-0x67).
Document that coreboot-specific register offset in a macro and a
comment, for future reference.
Cc: Ed Swierk <eswierk@skyportsystems.com>
Cc: Richard Smith <smithbone@gmail.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/pci-host/piix.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index ad55f99..1cb25f3 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -117,6 +117,11 @@ struct PCII440FXState {
#define I440FX_PAM_SIZE 7
#define I440FX_SMRAM 0x72
+/* Older coreboot versions (4.0 and older) read a config register that doesn't
+ * exist in real hardware, to get the RAM size from QEMU.
+ */
+#define I440FX_COREBOOT_RAM_SIZE 0x57
+
static void piix3_set_irq(void *opaque, int pirq, int level);
static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pci_intx);
static void piix3_write_config_xen(PCIDevice *dev,
@@ -394,7 +399,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
if (ram_size > 255) {
ram_size = 255;
}
- d->config[0x57] = ram_size;
+ d->config[I440FX_COREBOOT_RAM_SIZE] = ram_size;
i440fx_update_memory_mappings(f);
--
MST
next prev parent reply other threads:[~2015-08-13 12:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-13 12:14 [Qemu-devel] [PULL 00/24] virtio,pc,acpi fixes, cleanups Michael S. Tsirkin
2015-08-13 12:14 ` [Qemu-devel] [PULL 01/24] make: fix where dependency *.d are stored Michael S. Tsirkin
2015-08-13 12:14 ` [Qemu-devel] [PULL 02/24] make: load only required dependency files Michael S. Tsirkin
2015-08-13 12:14 ` Michael S. Tsirkin [this message]
2015-08-13 12:14 ` [Qemu-devel] [PULL 04/24] pc: Use PC_COMPAT_* for CPUID feature compatibility Michael S. Tsirkin
2015-08-13 12:14 ` [Qemu-devel] [PULL 05/24] target-i386: Remove x86_cpu_compat_set_features() Michael S. Tsirkin
2015-08-13 12:14 ` [Qemu-devel] [PULL 06/24] pc: Use error_abort when registering properties Michael S. Tsirkin
2015-08-13 12:14 ` [Qemu-devel] [PULL 07/24] pc: Rename pc_machine variables to pcms Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 08/24] pc: Move PCMachineClass, PCMachineState to qemu/typedefs.h Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 09/24] pc: Eliminate pc_common_machine_options() Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 10/24] pc: Eliminate pc_default_machine_options() Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 11/24] pc: Use PCMachineState for pc_cmos_init() argument Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 12/24] pc: Use PCMachineState for pc_memory_init() argument Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 13/24] pc: Move {above, below}_4g_mem_size variables to PCMachineState Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 14/24] pc: Use PCMachineState as pc_guest_info_init() argument Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 15/24] pc: Remove redundant arguments from *load_linux() Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 16/24] pc: Remove redundant arguments from pc_cmos_init() Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 17/24] pc: Remove redundant arguments from pc_memory_init() Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 18/24] pci: allow 0 address for PCI IO/MEM regions Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 19/24] virtio-net: remove useless codes Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 20/24] acpi: avoid potential uninitialized access to cpu_hp_io_base Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 21/24] smbios: extract x86 smbios building code into a function Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 22/24] smbios: remove dependency on x86 e820 tables Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 23/24] smbios: move smbios code into a common folder Michael S. Tsirkin
2015-08-13 12:15 ` [Qemu-devel] [PULL 24/24] MAINTAINERS: list smbios maintainers Michael S. Tsirkin
2015-08-13 16:41 ` [Qemu-devel] [PULL 00/24] virtio,pc,acpi fixes, cleanups Peter Maydell
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=1439468033-6413-4-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=ehabkost@redhat.com \
--cc=eswierk@skyportsystems.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=smithbone@gmail.com \
/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).