]> err.no Git - linux-2.6/blobdiff - arch/x86/kernel/cpu/amd_64.c
x86: clean up init_amd()
[linux-2.6] / arch / x86 / kernel / cpu / amd_64.c
index f8d20588bde98b53b645833973f357166658468e..958526d6a74acdc13a7866e9191980eaeb08cccb 100644 (file)
@@ -6,10 +6,8 @@
 #include <asm/cacheflush.h>
 
 #include <mach_apic.h>
-#include "cpu.h"
 
-extern int __cpuinit get_model_name(struct cpuinfo_x86 *c);
-extern void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c);
+#include "cpu.h"
 
 int force_mwait __cpuinitdata;
 
@@ -110,7 +108,7 @@ static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c)
 #endif
 }
 
-void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
+static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
 {
        early_init_amd_mc(c);
 
@@ -119,7 +117,7 @@ void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
                set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 }
 
-void __cpuinit init_amd(struct cpuinfo_x86 *c)
+static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 {
        unsigned level;
 
@@ -133,7 +131,7 @@ void __cpuinit init_amd(struct cpuinfo_x86 *c)
         * Errata 63 for SH-B3 steppings
         * Errata 122 for all steppings (F+ have it disabled by default)
         */
-       if (c->x86 == 15) {
+       if (c->x86 == 0xf) {
                rdmsrl(MSR_K8_HWCR, value);
                value |= 1 << 6;
                wrmsrl(MSR_K8_HWCR, value);
@@ -145,10 +143,11 @@ void __cpuinit init_amd(struct cpuinfo_x86 *c)
        clear_cpu_cap(c, 0*32+31);
 
        /* On C+ stepping K8 rep microcode works well for copy/memset */
-       level = cpuid_eax(1);
-       if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) ||
-                            level >= 0x0f58))
-               set_cpu_cap(c, X86_FEATURE_REP_GOOD);
+       if (c->x86 == 0xf) {
+               level = cpuid_eax(1);
+               if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)
+                       set_cpu_cap(c, X86_FEATURE_REP_GOOD);
+       }
        if (c->x86 == 0x10 || c->x86 == 0x11)
                set_cpu_cap(c, X86_FEATURE_REP_GOOD);
 
@@ -159,7 +158,7 @@ void __cpuinit init_amd(struct cpuinfo_x86 *c)
        level = get_model_name(c);
        if (!level) {
                switch (c->x86) {
-               case 15:
+               case 0xf:
                        /* Should distinguish Models here, but this is only
                           a fallback anyways. */
                        strcpy(c->x86_model_id, "Hammer");
@@ -178,17 +177,19 @@ void __cpuinit init_amd(struct cpuinfo_x86 *c)
        else
                num_cache_leaves = 3;
 
-       if (c->x86 == 0xf || c->x86 == 0x10 || c->x86 == 0x11)
+       if (c->x86 >= 0xf && c->x86 <= 0x11)
                set_cpu_cap(c, X86_FEATURE_K8);
 
        /* MFENCE stops RDTSC speculation */
        set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC);
 
-       if (c->x86 == 0x10)
-               fam10h_check_enable_mmcfg();
+       if (c->x86 == 0x10) {
+               /* do this for boot cpu */
+               if (c == &boot_cpu_data)
+                       check_enable_amd_mmconf_dmi();
 
-       if (c->x86 == 0x10)
-               amd_enable_pci_ext_cfg(c);
+               fam10h_check_enable_mmcfg();
+       }
 
        if (c == &boot_cpu_data && c->x86 >= 0xf && c->x86 <= 0x11) {
                unsigned long long tseg;
@@ -204,3 +205,13 @@ void __cpuinit init_amd(struct cpuinfo_x86 *c)
                        set_memory_4k((unsigned long)__va(tseg), 1);
        }
 }
+
+static struct cpu_dev amd_cpu_dev __cpuinitdata = {
+       .c_vendor       = "AMD",
+       .c_ident        = { "AuthenticAMD" },
+       .c_early_init   = early_init_amd,
+       .c_init         = init_amd,
+};
+
+cpu_vendor_dev_register(X86_VENDOR_AMD, &amd_cpu_dev);
+