diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2013-03-25 12:48:49 +0200 |
---|---|---|
committer | Marc Jones <marc.jones@se-eng.com> | 2013-04-04 04:52:18 +0200 |
commit | 190011e47c6187479db69344ccf87762009af444 (patch) | |
tree | 9fa99d7b08f37a734bcd4fd10e17ff94a78a6626 /src/include/cpu/amd/mtrr.h | |
parent | 4d6ab4e2ae25c8148e699e3821b71991ac4d80dc (diff) | |
download | coreboot-190011e47c6187479db69344ccf87762009af444.tar.xz |
AMD: Drop six copies of wrmsr_amd and rdmsr_amd
Based on comments in cpu/x86/msr.h for wrmsr/rdmsr, and for symmetry,
I have added __attribute__((always_inline)) for these.
Change-Id: Ia0a34c15241f9fbc8c78763386028ddcbe6690b1
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/2898
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
Diffstat (limited to 'src/include/cpu/amd/mtrr.h')
-rw-r--r-- | src/include/cpu/amd/mtrr.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/include/cpu/amd/mtrr.h b/src/include/cpu/amd/mtrr.h index aa904e6a25..a9e672b48b 100644 --- a/src/include/cpu/amd/mtrr.h +++ b/src/include/cpu/amd/mtrr.h @@ -40,6 +40,26 @@ #if !defined(__PRE_RAM__) && !defined(__ASSEMBLER__) void amd_setup_mtrrs(void); +static inline __attribute__((always_inline)) msr_t rdmsr_amd(unsigned index) +{ + msr_t result; + __asm__ __volatile__ ( + "rdmsr" + : "=a" (result.lo), "=d" (result.hi) + : "c"(index), "D"(0x9c5a203a) + ); + return result; +} + +static inline __attribute__((always_inline)) void wrmsr_amd(unsigned index, msr_t msr) +{ + __asm__ __volatile__ ( + "wrmsr" + : /* No outputs */ + : "c" (index), "a" (msr.lo), "d" (msr.hi), "D" (0x9c5a203a) + ); +} + /* To distribute topmem MSRs to APs. */ void setup_bsp_ramtop(void); uint64_t bsp_topmem(void); |