diff options
-rw-r--r-- | arch/i386/kernel/cpu/mtrr/main.c | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c index 8f67b490a7fd..54999e4c55fd 100644 --- a/arch/i386/kernel/cpu/mtrr/main.c +++ b/arch/i386/kernel/cpu/mtrr/main.c | |||
@@ -614,40 +614,21 @@ static int __init mtrr_init(void) | |||
614 | mtrr_if = &generic_mtrr_ops; | 614 | mtrr_if = &generic_mtrr_ops; |
615 | size_or_mask = 0xff000000; /* 36 bits */ | 615 | size_or_mask = 0xff000000; /* 36 bits */ |
616 | size_and_mask = 0x00f00000; | 616 | size_and_mask = 0x00f00000; |
617 | 617 | ||
618 | switch (boot_cpu_data.x86_vendor) { | 618 | /* This is an AMD specific MSR, but we assume(hope?) that |
619 | case X86_VENDOR_AMD: | 619 | Intel will implement it to when they extend the address |
620 | /* The original Athlon docs said that | 620 | bus of the Xeon. */ |
621 | total addressable memory is 44 bits wide. | 621 | if (cpuid_eax(0x80000000) >= 0x80000008) { |
622 | It was not really clear whether its MTRRs | 622 | u32 phys_addr; |
623 | follow this or not. (Read: 44 or 36 bits). | 623 | phys_addr = cpuid_eax(0x80000008) & 0xff; |
624 | However, "x86-64_overview.pdf" explicitly | 624 | size_or_mask = ~((1 << (phys_addr - PAGE_SHIFT)) - 1); |
625 | states that "previous implementations support | 625 | size_and_mask = ~size_or_mask & 0xfff00000; |
626 | 36 bit MTRRs" and also provides a way to | 626 | } else if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR && |
627 | query the width (in bits) of the physical | 627 | boot_cpu_data.x86 == 6) { |
628 | addressable memory on the Hammer family. | 628 | /* VIA C* family have Intel style MTRRs, but |
629 | */ | 629 | don't support PAE */ |
630 | if (boot_cpu_data.x86 == 15 | 630 | size_or_mask = 0xfff00000; /* 32 bits */ |
631 | && (cpuid_eax(0x80000000) >= 0x80000008)) { | 631 | size_and_mask = 0; |
632 | u32 phys_addr; | ||
633 | phys_addr = cpuid_eax(0x80000008) & 0xff; | ||
634 | size_or_mask = | ||
635 | ~((1 << (phys_addr - PAGE_SHIFT)) - 1); | ||
636 | size_and_mask = ~size_or_mask & 0xfff00000; | ||
637 | } | ||
638 | /* Athlon MTRRs use an Intel-compatible interface for | ||
639 | * getting and setting */ | ||
640 | break; | ||
641 | case X86_VENDOR_CENTAUR: | ||
642 | if (boot_cpu_data.x86 == 6) { | ||
643 | /* VIA Cyrix family have Intel style MTRRs, but don't support PAE */ | ||
644 | size_or_mask = 0xfff00000; /* 32 bits */ | ||
645 | size_and_mask = 0; | ||
646 | } | ||
647 | break; | ||
648 | |||
649 | default: | ||
650 | break; | ||
651 | } | 632 | } |
652 | } else { | 633 | } else { |
653 | switch (boot_cpu_data.x86_vendor) { | 634 | switch (boot_cpu_data.x86_vendor) { |