Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/74619 )
Change subject: [RFC] include/cpu/amd/mtrr: rename TOP_MEM(2) and remove workaround ......................................................................
[RFC] include/cpu/amd/mtrr: rename TOP_MEM(2) and remove workaround
Both AGESA.h and cpu/amd/mtrr.h defined TOP_MEM and TOP_MEM2, but since it was defined as unsigned long in AGESA.h, a workaround was needed in cpu/amd/mtrr.h to not have the build fail due to a non-identical redefinition of TOP_MEM and TOP_MEM2. Just removing the workaround without reaming the defines isn't trivially possible, since the stoneyridge romstage.c still ends up including both definitions which can't be easily worked around. Now all non-vendorcode coreboot code uses TOP_MEM_MSR and TOP_MEM2_MSR while the vendorcode part uses TOP_MEM and TOP_MEM2 to avoid this.
Signed-off-by: Felix Held felix-coreboot@felixheld.de Change-Id: Ibad72dac17bd0b05734709d42c6802b7c8a87455 --- M src/drivers/amd/agesa/s3_mtrr.c M src/include/cpu/amd/mtrr.h 2 files changed, 26 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/19/74619/1
diff --git a/src/drivers/amd/agesa/s3_mtrr.c b/src/drivers/amd/agesa/s3_mtrr.c index 51e8a4d..55c9c40 100644 --- a/src/drivers/amd/agesa/s3_mtrr.c +++ b/src/drivers/amd/agesa/s3_mtrr.c @@ -39,8 +39,8 @@ MTRR_PHYS_BASE(7), MTRR_PHYS_MASK(7), SYSCFG_MSR, - TOP_MEM, - TOP_MEM2, + TOP_MEM_MSR, + TOP_MEM2_MSR, };
void backup_mtrr(void) diff --git a/src/include/cpu/amd/mtrr.h b/src/include/cpu/amd/mtrr.h index e96dc90..57edfe6 100644 --- a/src/include/cpu/amd/mtrr.h +++ b/src/include/cpu/amd/mtrr.h @@ -29,13 +29,8 @@ #define IORRBase_MSR(reg) (0xC0010016 + 2 * (reg)) #define IORRMask_MSR(reg) (0xC0010016 + 2 * (reg) + 1)
-#if defined(__ASSEMBLER__) -#define TOP_MEM 0xC001001A -#define TOP_MEM2 0xC001001D -#else -#define TOP_MEM 0xC001001Aul -#define TOP_MEM2 0xC001001Dul -#endif +#define TOP_MEM_MSR 0xC001001A +#define TOP_MEM2_MSR 0xC001001D
#if !defined(__ASSEMBLER__)
@@ -67,12 +62,12 @@
static inline uint32_t get_top_of_mem_below_4gb(void) { - return rdmsr(TOP_MEM).lo; + return rdmsr(TOP_MEM_MSR).lo; }
static inline uint64_t get_top_of_mem_above_4g(void) { - msr_t msr = rdmsr(TOP_MEM2); + msr_t msr = rdmsr(TOP_MEM2_MSR); return (uint64_t)msr.hi << 32 | msr.lo; } #endif