cpu/mtrr.h: Fix macro names for MTRR registers
We use UNDERSCORE_CASE. For the MTRR macros that refer to an MSR, we also remove the _MSR suffix, as they are, by definition, MSRs. Change-Id: Id4483a75d62cf1b478a9105ee98a8f55140ce0ef Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-on: http://review.coreboot.org/11761 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins)
This commit is contained in:
@@ -44,10 +44,10 @@ static void set_var_mtrr(
|
||||
msr_t basem, maskm;
|
||||
basem.lo = base | type;
|
||||
basem.hi = 0;
|
||||
wrmsr(MTRRphysBase_MSR(reg), basem);
|
||||
maskm.lo = ~(size - 1) | MTRRphysMaskValid;
|
||||
wrmsr(MTRR_PHYS_BASE(reg), basem);
|
||||
maskm.lo = ~(size - 1) | MTRR_PHYS_MASK_VALID;
|
||||
maskm.hi = (1 << (CONFIG_CPU_ADDR_BITS - 32)) - 1;
|
||||
wrmsr(MTRRphysMask_MSR(reg), maskm);
|
||||
wrmsr(MTRR_PHYS_MASK(reg), maskm);
|
||||
}
|
||||
|
||||
static void enable_rom_caching(void)
|
||||
@@ -61,7 +61,7 @@ static void enable_rom_caching(void)
|
||||
/* Enable Variable MTRRs */
|
||||
msr.hi = 0x00000000;
|
||||
msr.lo = 0x00000800;
|
||||
wrmsr(MTRRdefType_MSR, msr);
|
||||
wrmsr(MTRR_DEF_TYPE_MSR, msr);
|
||||
}
|
||||
|
||||
static void set_flex_ratio_to_tdp_nominal(void)
|
||||
@@ -113,12 +113,12 @@ static void set_flex_ratio_to_tdp_nominal(void)
|
||||
static void check_for_clean_reset(void)
|
||||
{
|
||||
msr_t msr;
|
||||
msr = rdmsr(MTRRdefType_MSR);
|
||||
msr = rdmsr(MTRR_DEF_TYPE_MSR);
|
||||
|
||||
/* Use the MTRR default type MSR as a proxy for detecting INIT#.
|
||||
* Reset the system if any known bits are set in that MSR. That is
|
||||
* an indication of the CPU not being properly reset. */
|
||||
if (msr.lo & (MTRRdefTypeEn | MTRRdefTypeFixEn)) {
|
||||
if (msr.lo & (MTRR_DEF_TYPE_EN | MTRR_DEF_TYPE_FIX_EN)) {
|
||||
outb(0x0, 0xcf9);
|
||||
outb(0x6, 0xcf9);
|
||||
halt();
|
||||
|
@@ -73,31 +73,31 @@ clear_mtrrs:
|
||||
|
||||
post_code(0x22)
|
||||
/* Configure the default memory type to uncacheable. */
|
||||
movl $MTRRdefType_MSR, %ecx
|
||||
movl $MTRR_DEF_TYPE_MSR, %ecx
|
||||
rdmsr
|
||||
andl $(~0x00000cff), %eax
|
||||
wrmsr
|
||||
|
||||
post_code(0x23)
|
||||
/* Set Cache-as-RAM base address. */
|
||||
movl $(MTRRphysBase_MSR(0)), %ecx
|
||||
movl $(MTRR_PHYS_BASE(0)), %ecx
|
||||
movl $(CACHE_AS_RAM_BASE | MTRR_TYPE_WRBACK), %eax
|
||||
xorl %edx, %edx
|
||||
wrmsr
|
||||
|
||||
post_code(0x24)
|
||||
/* Set Cache-as-RAM mask. */
|
||||
movl $(MTRRphysMask_MSR(0)), %ecx
|
||||
movl $(~(CACHE_AS_RAM_SIZE - 1) | MTRRphysMaskValid), %eax
|
||||
movl $(MTRR_PHYS_MASK(0)), %ecx
|
||||
movl $(~(CACHE_AS_RAM_SIZE - 1) | MTRR_PHYS_MASK_VALID), %eax
|
||||
movl $CPU_PHYSMASK_HI, %edx
|
||||
wrmsr
|
||||
|
||||
post_code(0x25)
|
||||
|
||||
/* Enable MTRR. */
|
||||
movl $MTRRdefType_MSR, %ecx
|
||||
movl $MTRR_DEF_TYPE_MSR, %ecx
|
||||
rdmsr
|
||||
orl $MTRRdefTypeEn, %eax
|
||||
orl $MTRR_DEF_TYPE_EN, %eax
|
||||
wrmsr
|
||||
|
||||
/* Enable cache (CR0.CD = 0, CR0.NW = 0). */
|
||||
@@ -134,7 +134,7 @@ clear_mtrrs:
|
||||
movl %eax, %cr0
|
||||
|
||||
/* Enable cache for our code in Flash because we do XIP here */
|
||||
movl $MTRRphysBase_MSR(1), %ecx
|
||||
movl $MTRR_PHYS_BASE(1), %ecx
|
||||
xorl %edx, %edx
|
||||
/*
|
||||
* IMPORTANT: The following calculation _must_ be done at runtime. See
|
||||
@@ -145,19 +145,19 @@ clear_mtrrs:
|
||||
orl $MTRR_TYPE_WRPROT, %eax
|
||||
wrmsr
|
||||
|
||||
movl $MTRRphysMask_MSR(1), %ecx
|
||||
movl $MTRR_PHYS_MASK(1), %ecx
|
||||
movl $CPU_PHYSMASK_HI, %edx
|
||||
movl $(~(CONFIG_XIP_ROM_SIZE - 1) | MTRRphysMaskValid), %eax
|
||||
movl $(~(CONFIG_XIP_ROM_SIZE - 1) | MTRR_PHYS_MASK_VALID), %eax
|
||||
wrmsr
|
||||
|
||||
post_code(0x27)
|
||||
/* Enable caching for ram init code to run faster */
|
||||
movl $MTRRphysBase_MSR(2), %ecx
|
||||
movl $MTRR_PHYS_BASE(2), %ecx
|
||||
movl $(CACHE_MRC_BASE | MTRR_TYPE_WRPROT), %eax
|
||||
xorl %edx, %edx
|
||||
wrmsr
|
||||
movl $MTRRphysMask_MSR(2), %ecx
|
||||
movl $(CACHE_MRC_MASK | MTRRphysMaskValid), %eax
|
||||
movl $MTRR_PHYS_MASK(2), %ecx
|
||||
movl $(CACHE_MRC_MASK | MTRR_PHYS_MASK_VALID), %eax
|
||||
movl $CPU_PHYSMASK_HI, %edx
|
||||
wrmsr
|
||||
|
||||
@@ -197,9 +197,9 @@ before_romstage:
|
||||
post_code(0x31)
|
||||
|
||||
/* Disable MTRR. */
|
||||
movl $MTRRdefType_MSR, %ecx
|
||||
movl $MTRR_DEF_TYPE_MSR, %ecx
|
||||
rdmsr
|
||||
andl $(~MTRRdefTypeEn), %eax
|
||||
andl $(~MTRR_DEF_TYPE_EN), %eax
|
||||
wrmsr
|
||||
|
||||
post_code(0x31)
|
||||
@@ -220,9 +220,9 @@ before_romstage:
|
||||
/* Clear MTRR that was used to cache MRC */
|
||||
xorl %eax, %eax
|
||||
xorl %edx, %edx
|
||||
movl $MTRRphysBase_MSR(2), %ecx
|
||||
movl $MTRR_PHYS_BASE(2), %ecx
|
||||
wrmsr
|
||||
movl $MTRRphysMask_MSR(2), %ecx
|
||||
movl $MTRR_PHYS_MASK(2), %ecx
|
||||
wrmsr
|
||||
|
||||
post_code(0x33)
|
||||
@@ -246,7 +246,7 @@ before_romstage:
|
||||
|
||||
/* Get number of MTRRs. */
|
||||
popl %ebx
|
||||
movl $MTRRphysBase_MSR(0), %ecx
|
||||
movl $MTRR_PHYS_BASE(0), %ecx
|
||||
1:
|
||||
testl %ebx, %ebx
|
||||
jz 1f
|
||||
@@ -279,9 +279,9 @@ before_romstage:
|
||||
post_code(0x3a)
|
||||
|
||||
/* Enable MTRR. */
|
||||
movl $MTRRdefType_MSR, %ecx
|
||||
movl $MTRR_DEF_TYPE_MSR, %ecx
|
||||
rdmsr
|
||||
orl $MTRRdefTypeEn, %eax
|
||||
orl $MTRR_DEF_TYPE_EN, %eax
|
||||
wrmsr
|
||||
|
||||
post_code(0x3b)
|
||||
|
@@ -117,14 +117,14 @@ static void *setup_romstage_stack_after_car(void)
|
||||
|
||||
/* Cache the ROM as WP just below 4GiB. */
|
||||
slot = stack_push(slot, mtrr_mask_upper); /* upper mask */
|
||||
slot = stack_push(slot, ~(CACHE_ROM_SIZE - 1) | MTRRphysMaskValid);
|
||||
slot = stack_push(slot, ~(CACHE_ROM_SIZE - 1) | MTRR_PHYS_MASK_VALID);
|
||||
slot = stack_push(slot, 0); /* upper base */
|
||||
slot = stack_push(slot, ~(CACHE_ROM_SIZE - 1) | MTRR_TYPE_WRPROT);
|
||||
num_mtrrs++;
|
||||
|
||||
/* Cache RAM as WB from 0 -> CONFIG_RAMTOP. */
|
||||
slot = stack_push(slot, mtrr_mask_upper); /* upper mask */
|
||||
slot = stack_push(slot, ~(CONFIG_RAMTOP - 1) | MTRRphysMaskValid);
|
||||
slot = stack_push(slot, ~(CONFIG_RAMTOP - 1) | MTRR_PHYS_MASK_VALID);
|
||||
slot = stack_push(slot, 0); /* upper base */
|
||||
slot = stack_push(slot, 0 | MTRR_TYPE_WRBACK);
|
||||
num_mtrrs++;
|
||||
@@ -135,7 +135,7 @@ static void *setup_romstage_stack_after_car(void)
|
||||
* be 8MiB aligned. Set this area as cacheable so it can be used later
|
||||
* for ramstage before setting up the entire RAM as cacheable. */
|
||||
slot = stack_push(slot, mtrr_mask_upper); /* upper mask */
|
||||
slot = stack_push(slot, ~((8 << 20) - 1) | MTRRphysMaskValid);
|
||||
slot = stack_push(slot, ~((8 << 20) - 1) | MTRR_PHYS_MASK_VALID);
|
||||
slot = stack_push(slot, 0); /* upper base */
|
||||
slot = stack_push(slot, (top_of_ram - (8 << 20)) | MTRR_TYPE_WRBACK);
|
||||
num_mtrrs++;
|
||||
@@ -146,7 +146,7 @@ static void *setup_romstage_stack_after_car(void)
|
||||
* to cacheable it provides faster access when relocating the SMM
|
||||
* handler as well as using the TSEG region for other purposes. */
|
||||
slot = stack_push(slot, mtrr_mask_upper); /* upper mask */
|
||||
slot = stack_push(slot, ~((8 << 20) - 1) | MTRRphysMaskValid);
|
||||
slot = stack_push(slot, ~((8 << 20) - 1) | MTRR_PHYS_MASK_VALID);
|
||||
slot = stack_push(slot, 0); /* upper base */
|
||||
slot = stack_push(slot, top_of_ram | MTRR_TYPE_WRBACK);
|
||||
num_mtrrs++;
|
||||
|
@@ -73,8 +73,8 @@ static inline void write_smrr(struct smm_relocation_params *relo_params)
|
||||
{
|
||||
printk(BIOS_DEBUG, "Writing SMRR. base = 0x%08x, mask=0x%08x\n",
|
||||
relo_params->smrr_base.lo, relo_params->smrr_mask.lo);
|
||||
wrmsr(SMRRphysBase_MSR, relo_params->smrr_base);
|
||||
wrmsr(SMRRphysMask_MSR, relo_params->smrr_mask);
|
||||
wrmsr(SMRR_PHYS_BASE, relo_params->smrr_base);
|
||||
wrmsr(SMRR_PHYS_MASK, relo_params->smrr_mask);
|
||||
}
|
||||
|
||||
static inline void write_emrr(struct smm_relocation_params *relo_params)
|
||||
@@ -214,7 +214,7 @@ static void asmlinkage cpu_smm_do_relocation(void *arg)
|
||||
update_save_state(cpu, relo_params, runtime);
|
||||
|
||||
/* Write EMRR and SMRR MSRs based on indicated support. */
|
||||
mtrr_cap = rdmsr(MTRRcap_MSR);
|
||||
mtrr_cap = rdmsr(MTRR_CAP_MSR);
|
||||
if (mtrr_cap.lo & SMRR_SUPPORTED)
|
||||
write_smrr(relo_params);
|
||||
|
||||
@@ -272,7 +272,7 @@ static void fill_in_relocation_params(struct device *dev,
|
||||
/* SMRR has 32-bits of valid address aligned to 4KiB. */
|
||||
params->smrr_base.lo = (params->smram_base & rmask) | MTRR_TYPE_WRBACK;
|
||||
params->smrr_base.hi = 0;
|
||||
params->smrr_mask.lo = (~(tseg_size - 1) & rmask) | MTRRphysMaskValid;
|
||||
params->smrr_mask.lo = (~(tseg_size - 1) & rmask) | MTRR_PHYS_MASK_VALID;
|
||||
params->smrr_mask.hi = 0;
|
||||
|
||||
/* The EMRR and UNCORE_EMRR are at IEDBASE + 2MiB */
|
||||
@@ -283,14 +283,14 @@ static void fill_in_relocation_params(struct device *dev,
|
||||
* on the number of physical address bits supported. */
|
||||
params->emrr_base.lo = emrr_base | MTRR_TYPE_WRBACK;
|
||||
params->emrr_base.hi = 0;
|
||||
params->emrr_mask.lo = (~(emrr_size - 1) & rmask) | MTRRphysMaskValid;
|
||||
params->emrr_mask.lo = (~(emrr_size - 1) & rmask) | MTRR_PHYS_MASK_VALID;
|
||||
params->emrr_mask.hi = (1 << (phys_bits - 32)) - 1;
|
||||
|
||||
/* UNCORE_EMRR has 39 bits of valid address aligned to 4KiB. */
|
||||
params->uncore_emrr_base.lo = emrr_base;
|
||||
params->uncore_emrr_base.hi = 0;
|
||||
params->uncore_emrr_mask.lo = (~(emrr_size - 1) & rmask) |
|
||||
MTRRphysMaskValid;
|
||||
MTRR_PHYS_MASK_VALID;
|
||||
params->uncore_emrr_mask.hi = (1 << (39 - 32)) - 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user