diff options
author | Aaron Durbin <adurbin@chromium.org> | 2018-04-17 11:37:28 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2018-04-23 09:18:07 +0000 |
commit | ae18f80febc3ecaacc0314e942a4f8b248bfcc4c (patch) | |
tree | 0b18a060a00b7ec302e8bcb1fcb0edf166fbad5d /src/cpu/x86 | |
parent | 7f5e73463882a92b64dc9f3ffd72a3bc0762300c (diff) | |
download | coreboot-ae18f80febc3ecaacc0314e942a4f8b248bfcc4c.tar.xz |
cpu/x86: move NXE and PAT accesses to paging module
The EFER and PAT MSRs are x86 architecturally defined. Therefore,
move the macro defintions to msr.h. Add 'paging' prefix to the
PAT and NXE pae/paging functions to namespace things a little better.
BUG=b:72728953
Change-Id: I1ab2c4ff827e19d5ba4e3b6eaedb3fee6aaef14d
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/25713
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Diffstat (limited to 'src/cpu/x86')
-rw-r--r-- | src/cpu/x86/pae/pgtbl.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/cpu/x86/pae/pgtbl.c b/src/cpu/x86/pae/pgtbl.c index 0c4bff5067..063c9aba38 100644 --- a/src/cpu/x86/pae/pgtbl.c +++ b/src/cpu/x86/pae/pgtbl.c @@ -17,6 +17,7 @@ #include <console/console.h> #include <cpu/cpu.h> #include <arch/cpu.h> +#include <cpu/x86/msr.h> #include <cpu/x86/pae.h> #include <rules.h> #include <string.h> @@ -119,3 +120,23 @@ void *map_2M_page(unsigned long page) return result; } #endif + +void paging_set_nxe(int enable) +{ + msr_t msr = rdmsr(IA32_EFER); + + if (enable) + msr.lo |= EFER_NXE; + else + msr.lo &= ~EFER_NXE; + + wrmsr(IA32_EFER, msr); +} + +void paging_set_pat(uint64_t pat) +{ + msr_t msr; + msr.lo = pat; + msr.hi = pat >> 32; + wrmsr(MSR_IA32_PAT, msr); +} |