mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 03:15:00 +00:00
x86: emulation: Set an MTRR for the RAM
QEMU likes to have an MTRR set up, just like real machines. Add an MTRR which covers the total RAM size. This does nothing on machines without MTRRs. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
66c9ade35b
commit
790baef3b9
1 changed files with 18 additions and 0 deletions
|
@ -4,7 +4,9 @@
|
|||
*/
|
||||
|
||||
#include <init.h>
|
||||
#include <spl.h>
|
||||
#include <asm/global_data.h>
|
||||
#include <asm/mtrr.h>
|
||||
#include <asm/post.h>
|
||||
#include <asm/arch/qemu.h>
|
||||
#include <linux/sizes.h>
|
||||
|
@ -44,6 +46,22 @@ int dram_init(void)
|
|||
gd->ram_size += qemu_get_high_memory_size();
|
||||
post_code(POST_DRAM);
|
||||
|
||||
if (xpl_phase() == PHASE_BOARD_F) {
|
||||
u64 total = gd->ram_size;
|
||||
int ret;
|
||||
|
||||
if (total > SZ_2G + SZ_1G)
|
||||
total += SZ_1G;
|
||||
ret = mtrr_add_request(MTRR_TYPE_WRBACK, 0, total);
|
||||
if (ret != -ENOSYS) {
|
||||
if (ret)
|
||||
return log_msg_ret("mta", ret);
|
||||
ret = mtrr_commit(false);
|
||||
if (ret)
|
||||
return log_msg_ret("mtc", ret);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue