]> git.proxmox.com Git - qemu.git/blame - pc-bios/bios-pq/0002_kvm-bios-update-smbios-table-to-report-memory-above-4g.patch
Update PC BIOS to latest bits from Bochs
[qemu.git] / pc-bios / bios-pq / 0002_kvm-bios-update-smbios-table-to-report-memory-above-4g.patch
CommitLineData
9a717b55
AL
1update SMBIOS table to report memory above 4G (Alex Williamson)
2
3Signed-off-by: Alex Williamson <alex.williamson@hp.com>
4Signed-off-by: Avi Kivity <avi@redhat.com>
5Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
6
7Index: bochs/bios/rombios32.c
8===================================================================
7217e124
AL
9diff --git a/bios/rombios32.c b/bios/rombios32.c
10index 3269be5..9587288 100644
11--- a/bios/rombios32.c
12+++ b/bios/rombios32.c
13@@ -429,6 +429,7 @@ uint32_t cpuid_signature;
14 uint32_t cpuid_features;
15 uint32_t cpuid_ext_features;
16 unsigned long ram_size;
17+uint64_t ram_end;
18 uint8_t bios_uuid[16];
19 #ifdef BX_USE_EBDA_TABLES
20 unsigned long ebda_cur_addr;
21@@ -571,6 +572,13 @@ void ram_probe(void)
22 ram_size = (cmos_readb(0x30) | (cmos_readb(0x31) << 8)) * 1024 +
23 1 * 1024 * 1024;
24 BX_INFO("ram_size=0x%08lx\n", ram_size);
25+ if (cmos_readb(0x5b) | cmos_readb(0x5c) | cmos_readb(0x5d))
26+ ram_end = (((uint64_t)cmos_readb(0x5b) << 16) |
27+ ((uint64_t)cmos_readb(0x5c) << 24) |
28+ ((uint64_t)cmos_readb(0x5d) << 32)) + (1ull << 32);
29+ else
30+ ram_end = ram_size;
31+ BX_INFO("end of ram=%ldMB\n", ram_end >> 20);
32 #ifdef BX_USE_EBDA_TABLES
33 ebda_cur_addr = ((*(uint16_t *)(0x40e)) << 4) + 0x380;
34 BX_INFO("ebda_cur_addr: 0x%08lx\n", ebda_cur_addr);
35@@ -2174,7 +2182,8 @@ void smbios_init(void)
9a717b55
AL
36 {
37 unsigned cpu_num, nr_structs = 0, max_struct_size = 0;
38 char *start, *p, *q;
39- int memsize = ram_size / (1024 * 1024);
40+ int memsize = (ram_end == ram_size) ? ram_size / (1024 * 1024) :
41+ (ram_end - (1ull << 32) + ram_size) / (1024 * 1024);
7217e124 42
9a717b55
AL
43 #ifdef BX_USE_EBDA_TABLES
44 ebda_cur_addr = align(ebda_cur_addr, 16);
7217e124 45@@ -2201,8 +2210,8 @@ void smbios_init(void)
9a717b55
AL
46 add_struct(smbios_type_4_init(p, cpu_num));
47 add_struct(smbios_type_16_init(p, memsize));
48 add_struct(smbios_type_17_init(p, memsize));
49- add_struct(smbios_type_19_init(p, memsize));
50- add_struct(smbios_type_20_init(p, memsize));
51+ add_struct(smbios_type_19_init(p, ram_end / (1024 * 1024)));
52+ add_struct(smbios_type_20_init(p, ram_end / (1024 * 1024)));
53 add_struct(smbios_type_32_init(p));
54 add_struct(smbios_type_127_init(p));
7217e124 55