kvm: bios: reformat ram_probe() to match the surrounding code
Also fixes mem_top to always report the top of memory.
Signed-off-by: Alex Williamson <[EMAIL PROTECTED]>
---
bios/rombios32.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/bios/rombios32.c b/bios/rombios32.c
index 41025a0..4821ec4 100755
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -544,25 +544,26 @@ void setup_mtrr(void)
void ram_probe(void)
{
- if (cmos_readb(0x34) | cmos_readb(0x35))
- low_ram_size = (cmos_readb(0x34) | (cmos_readb(0x35) << 8)) * 65536 +
- 16 * 1024 * 1024;
- else
- low_ram_size = (cmos_readb(0x17) | (cmos_readb(0x18) << 8)) * 1024;
-
- if (cmos_readb(0x5b) | cmos_readb(0x5c) | cmos_readb(0x5d))
- mem_top = ((uint64_t)cmos_readb(0x5b) << 16) |
- ((uint64_t)cmos_readb(0x5c) << 24) | ((uint64_t)cmos_readb(0x5d) <<
32);
+ if (cmos_readb(0x34) | cmos_readb(0x35))
+ low_ram_size = (cmos_readb(0x34) | (cmos_readb(0x35) << 8)) *
+ 65536 + 16 * 1024 * 1024;
+ else
+ low_ram_size = (cmos_readb(0x17) | (cmos_readb(0x18) << 8)) * 1024;
- if (mem_top)
- mem_top += 1ull << 32;
+ if (cmos_readb(0x5b) | cmos_readb(0x5c) | cmos_readb(0x5d)) {
+ mem_top = ((uint64_t)cmos_readb(0x5b) << 16) |
+ ((uint64_t)cmos_readb(0x5c) << 24) |
+ ((uint64_t)cmos_readb(0x5d) << 32);
+ mem_top += 1ull << 32;
+ } else
+ mem_top = low_ram_size;
#ifdef BX_USE_EBDA_TABLES
ebda_cur_addr = ((*(uint16_t *)(0x40e)) << 4) + 0x380;
#endif
BX_INFO("low_ram_size=0x%08lx\n", low_ram_size);
- BX_INFO("top of ram %ldMB\n", mem_top >> 20);
- setup_mtrr();
+ BX_INFO("top of ram %ldMB\n", mem_top / (1024 * 1024));
+ setup_mtrr();
}
/****************************************************/
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html