aboutsummaryrefslogtreecommitdiffstats
path: root/src/fw/paravirt.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-10-18 12:18:19 +0200
committerGerd Hoffmann <kraxel@redhat.com>2013-11-06 12:31:24 +0100
commit6e1b082a68105061f079362b3bd9b632d27bcec8 (patch)
tree5450397c820f110651fe08c1a21e794fc2975828 /src/fw/paravirt.c
parent11948748495841bd54721b250d68c7b3cb0475ef (diff)
downloadseabios-6e1b082a68105061f079362b3bd9b632d27bcec8.tar.gz
Add qemu_cfg_e820 function.
Move all ram detection and e820 setup to the new function, except for lowmem detection which must remain in preinit so we can initialize our memory allocator properly. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'src/fw/paravirt.c')
-rw-r--r--src/fw/paravirt.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c
index c1184804..58973a2b 100644
--- a/src/fw/paravirt.c
+++ b/src/fw/paravirt.c
@@ -115,17 +115,10 @@ qemu_preinit(void)
RamSize = rs;
add_e820(0, rs, E820_RAM);
- // Check for memory over 4Gig
- u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
- | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
- | ((u64)rtc_read(CMOS_MEM_HIGHMEM_HIGH) << 32));
- RamSizeOver4G = high;
- add_e820(0x100000000ull, high, E820_RAM);
-
/* reserve 256KB BIOS area at the end of 4 GB */
add_e820(0xfffc0000, 256*1024, E820_RESERVED);
- dprintf(1, "Ram Size=0x%08x (0x%016llx high)\n", RamSize, RamSizeOver4G);
+ dprintf(1, "RamSize: 0x%08x [cmos]\n", RamSize);
}
void
@@ -254,6 +247,35 @@ struct qemu_smbios_header {
u16 fieldoffset;
} PACKED;
+static void
+qemu_cfg_e820(void)
+{
+ // QEMU_CFG_E820_TABLE has reservations only
+ u32 count32;
+ qemu_cfg_read_entry(&count32, QEMU_CFG_E820_TABLE, sizeof(count32));
+ if (count32) {
+ struct e820_reservation entry;
+ int i;
+ for (i = 0; i < count32; i++) {
+ qemu_cfg_read(&entry, sizeof(entry));
+ add_e820(entry.address, entry.length, entry.type);
+ }
+ } else if (runningOnKVM()) {
+ // Backwards compatibility - provide hard coded range.
+ // 4 pages before the bios, 3 pages for vmx tss pages, the
+ // other page for EPT real mode pagetable
+ add_e820(0xfffbc000, 4*4096, E820_RESERVED);
+ }
+
+ // Check for memory over 4Gig in cmos
+ u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
+ | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
+ | ((u64)rtc_read(CMOS_MEM_HIGHMEM_HIGH) << 32));
+ RamSizeOver4G = high;
+ add_e820(0x100000000ull, high, E820_RAM);
+ dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
+}
+
// Populate romfile entries for legacy fw_cfg ports (that predate the
// "file" interface).
static void
@@ -277,23 +299,6 @@ qemu_cfg_legacy(void)
, sizeof(numacount) + max_cpu*sizeof(u64)
, numacount*sizeof(u64));
- // e820 data
- u32 count32;
- qemu_cfg_read_entry(&count32, QEMU_CFG_E820_TABLE, sizeof(count32));
- if (count32) {
- struct e820_reservation entry;
- int i;
- for (i = 0; i < count32; i++) {
- qemu_cfg_read(&entry, sizeof(entry));
- add_e820(entry.address, entry.length, entry.type);
- }
- } else if (runningOnKVM()) {
- // Backwards compatibility - provide hard coded range.
- // 4 pages before the bios, 3 pages for vmx tss pages, the
- // other page for EPT real mode pagetable
- add_e820(0xfffbc000, 4*4096, E820_RESERVED);
- }
-
// ACPI tables
char name[128];
u16 cnt;
@@ -367,4 +372,6 @@ void qemu_cfg_init(void)
qemu_romfile_add(qfile.name, be16_to_cpu(qfile.select)
, 0, be32_to_cpu(qfile.size));
}
+
+ qemu_cfg_e820();
}