Skip to content

Commit

Permalink
x86, mtrr: replace MTRRdefType_MSR with msr-index's MSR_MTRRdefType
Browse files Browse the repository at this point in the history
Use standard msr-index.h's MSR declaration and no need to declare again.

[ Impact: cleanup, no object code change ]

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
  • Loading branch information
Jaswinder Singh Rajput authored and H. Peter Anvin committed May 15, 2009
1 parent ba5673f commit 5265025
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kernel/cpu/mtrr/cleanup.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ int __init mtrr_cleanup(unsigned address_bits)

if (!is_cpu(INTEL) || enable_mtrr_cleanup < 1)
return 0;
rdmsr(MTRRdefType_MSR, def, dummy);
rdmsr(MSR_MTRRdefType, def, dummy);
def &= 0xff;
if (def != MTRR_TYPE_UNCACHABLE)
return 0;
Expand Down Expand Up @@ -1003,7 +1003,7 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
*/
if (!is_cpu(INTEL) || disable_mtrr_trim)
return 0;
rdmsr(MTRRdefType_MSR, def, dummy);
rdmsr(MSR_MTRRdefType, def, dummy);
def &= 0xff;
if (def != MTRR_TYPE_UNCACHABLE)
return 0;
Expand Down
8 changes: 4 additions & 4 deletions arch/x86/kernel/cpu/mtrr/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ void __init get_mtrr_state(void)
if (mtrr_state.have_fixed)
get_fixed_ranges(mtrr_state.fixed_ranges);

rdmsr(MTRRdefType_MSR, lo, dummy);
rdmsr(MSR_MTRRdefType, lo, dummy);
mtrr_state.def_type = (lo & 0xff);
mtrr_state.enabled = (lo & 0xc00) >> 10;

Expand Down Expand Up @@ -579,10 +579,10 @@ static void prepare_set(void) __acquires(set_atomicity_lock)
__flush_tlb();

/* Save MTRR state */
rdmsr(MTRRdefType_MSR, deftype_lo, deftype_hi);
rdmsr(MSR_MTRRdefType, deftype_lo, deftype_hi);

/* Disable MTRRs, and set the default type to uncached */
mtrr_wrmsr(MTRRdefType_MSR, deftype_lo & ~0xcff, deftype_hi);
mtrr_wrmsr(MSR_MTRRdefType, deftype_lo & ~0xcff, deftype_hi);
}

static void post_set(void) __releases(set_atomicity_lock)
Expand All @@ -591,7 +591,7 @@ static void post_set(void) __releases(set_atomicity_lock)
__flush_tlb();

/* Intel (P6) standard MTRRs */
mtrr_wrmsr(MTRRdefType_MSR, deftype_lo, deftype_hi);
mtrr_wrmsr(MSR_MTRRdefType, deftype_lo, deftype_hi);

/* Enable caches */
write_cr0(read_cr0() & 0xbfffffff);
Expand Down
2 changes: 0 additions & 2 deletions arch/x86/kernel/cpu/mtrr/mtrr.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <linux/types.h>
#include <linux/stddef.h>

#define MTRRdefType_MSR 0x2ff

#define MTRR_CHANGE_MASK_FIXED 0x01
#define MTRR_CHANGE_MASK_VARIABLE 0x02
#define MTRR_CHANGE_MASK_DEFTYPE 0x04
Expand Down
6 changes: 3 additions & 3 deletions arch/x86/kernel/cpu/mtrr/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void set_mtrr_prepare_save(struct set_mtrr_context *ctxt)

if (use_intel())
/* Save MTRR state */
rdmsr(MTRRdefType_MSR, ctxt->deftype_lo, ctxt->deftype_hi);
rdmsr(MSR_MTRRdefType, ctxt->deftype_lo, ctxt->deftype_hi);
else
/* Cyrix ARRs - everything else were excluded at the top */
ctxt->ccr3 = getCx86(CX86_CCR3);
Expand All @@ -46,7 +46,7 @@ void set_mtrr_cache_disable(struct set_mtrr_context *ctxt)
{
if (use_intel())
/* Disable MTRRs, and set the default type to uncached */
mtrr_wrmsr(MTRRdefType_MSR, ctxt->deftype_lo & 0xf300UL,
mtrr_wrmsr(MSR_MTRRdefType, ctxt->deftype_lo & 0xf300UL,
ctxt->deftype_hi);
else if (is_cpu(CYRIX))
/* Cyrix ARRs - everything else were excluded at the top */
Expand All @@ -64,7 +64,7 @@ void set_mtrr_done(struct set_mtrr_context *ctxt)
/* Restore MTRRdefType */
if (use_intel())
/* Intel (P6) standard MTRRs */
mtrr_wrmsr(MTRRdefType_MSR, ctxt->deftype_lo, ctxt->deftype_hi);
mtrr_wrmsr(MSR_MTRRdefType, ctxt->deftype_lo, ctxt->deftype_hi);
else
/* Cyrix ARRs - everything else was excluded at the top */
setCx86(CX86_CCR3, ctxt->ccr3);
Expand Down

0 comments on commit 5265025

Please sign in to comment.