|
|
1.1 root 1: update SMBIOS table to report memory above 4G (Alex Williamson)
2:
3: Signed-off-by: Alex Williamson <[email protected]>
4: Signed-off-by: Avi Kivity <[email protected]>
5: Signed-off-by: Anthony Liguori <[email protected]>
6:
7: Index: bochs/bios/rombios32.c
8: ===================================================================
9: diff --git a/bios/rombios32.c b/bios/rombios32.c
10: index 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)
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);
42:
43: #ifdef BX_USE_EBDA_TABLES
44: ebda_cur_addr = align(ebda_cur_addr, 16);
45: @@ -2201,8 +2210,8 @@ void smbios_init(void)
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));
55:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.