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>
This commit is contained in:
Kyösti Mälkki
2013-03-25 12:48:49 +02:00
committed by Marc Jones
parent 4d6ab4e2ae
commit 190011e47c
16 changed files with 24 additions and 167 deletions

View File

@@ -33,9 +33,6 @@
#define CPU_ID_FEATURES_MSR 0xC0011004
#define CPU_ID_EXT_FEATURES_MSR 0xC0011005
msr_t rdmsr_amd(u32 index);
void wrmsr_amd(u32 index, msr_t msr);
//#if defined(__GNUC__)
//// it can be used to get unitid and coreid it running only
//struct node_core_id get_node_core_id(u32 nb_cfg_54);

View File

@@ -33,9 +33,6 @@
#define CPU_ID_FEATURES_MSR 0xC0011004
#define CPU_ID_EXT_FEATURES_MSR 0xC0011005
msr_t rdmsr_amd(u32 index);
void wrmsr_amd(u32 index, msr_t msr);
#if defined(__PRE_RAM__)
void wait_all_core0_started(void);
void wait_all_other_cores_started(u32 bsp_apicid);

View File

@@ -35,9 +35,6 @@
#define CPU_ID_FEATURES_MSR 0xC0011004
#define CPU_ID_EXT_FEATURES_MSR 0xC0011005
msr_t rdmsr_amd(u32 index);
void wrmsr_amd(u32 index, msr_t msr);
#if defined(__PRE_RAM__)
void wait_all_core0_started(void);
void wait_all_other_cores_started(u32 bsp_apicid);

View File

@@ -39,7 +39,4 @@
#define LOGICAL_CPUS_NUM_MSR 0xC001100d
#define CPU_ID_EXT_FEATURES_MSR 0xC0011005
msr_t rdmsr_amd(u32 index);
void wrmsr_amd(u32 index, msr_t msr);
#endif /* CPU_AMD_MODEL_10XXX_MSR_H */

View File

@@ -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);