printk_foo -> printk(BIOS_FOO, ...)
[coreboot.git] / src / cpu / amd / model_fxx / processor_name.c
index df187cb1d295dab1c75dc29429149df896d25453..4d86467632b62838b0e6066d9d44a64a09af5100 100644 (file)
 #include <console/console.h>
 #include <string.h>
 #include <cpu/x86/msr.h>
+#include <cpu/amd/model_fxx_rev.h>
 
 /* The maximum length of CPU names is 48 bytes, including the final NULL byte.
  * If you change these names your BIOS will _NOT_ pass the AMD validation and
  * your mainboard will not be posted on the AMD Recommended Motherboard Website
  */
 
-#if K8_REV_F_SUPPORT == 0
-static char *processor_names[]={
+#if CONFIG_K8_REV_F_SUPPORT == 0
+static const char *processor_names[]={
        /* 0x00 */ "AMD Engineering Sample",
        /* 0x01-0x03 */ NULL, NULL, NULL,
        /* 0x04 */ "AMD Athlon(tm) 64 Processor XX00+",
@@ -110,40 +111,7 @@ static inline void wrmsr_amd(unsigned index, msr_t msr)
                 );
 }
 
-static inline unsigned int cpuid_eax(unsigned int op)
-{
-        unsigned int eax;
-
-        __asm__("cpuid"
-                : "=a" (eax)
-                : "0" (op)
-                : "ebx", "ecx", "edx");
-        return eax;
-}
-
-static inline unsigned int cpuid_ebx(unsigned int op)
-{
-        unsigned int eax, ebx;
-
-        __asm__("cpuid"
-                : "=a" (eax), "=b" (ebx)
-                : "0" (op)
-                : "ecx", "edx" );
-        return ebx;
-}
-
-static inline unsigned int cpuid_ecx(unsigned int op)
-{
-        unsigned int eax, ecx;
-
-        __asm__("cpuid"
-                : "=a" (eax), "=c" (ecx)
-                : "0" (op)
-                : "ebx", "edx" );
-        return ecx;
-}
-
-static inline void strcpy(char *dst, char *src) 
+static inline void strcpy(char *dst, const char *src)
 {
        while (*src) *dst++ = *src++;
 }
@@ -151,7 +119,9 @@ static inline void strcpy(char *dst, char *src)
 
 int init_processor_name(void)
 {
+#if CONFIG_K8_REV_F_SUPPORT == 0
        u32 EightBitBrandId;
+#endif
        u32 BrandId;
        u32 BrandTableIndex;
        u32 NN;
@@ -159,11 +129,11 @@ int init_processor_name(void)
        msr_t progmsr;
        int i;
 
-       char *processor_name_string=NULL;
+       const char *processor_name_string=NULL;
        char program_string[48];
        unsigned int *program_values = (unsigned int *)program_string;
 
-#if K8_REV_F_SUPPORT == 0
+#if CONFIG_K8_REV_F_SUPPORT == 0
        /* Find out which CPU brand it is */
        EightBitBrandId = cpuid_ebx(0x00000001) & 0xff;
        BrandId = cpuid_ebx(0x80000001) & 0xffff;
@@ -187,7 +157,7 @@ int init_processor_name(void)
                processor_name_string = "AMD Processor model unknown";
 #endif
 
-#if K8_REV_F_SUPPORT == 1
+#if CONFIG_K8_REV_F_SUPPORT == 1
        u32 Socket;
        u32 CmpCap;
        u32 PwrLmt;
@@ -207,6 +177,10 @@ int init_processor_name(void)
                switch ((Socket << 16) | (CmpCap << 12) | (BrandTableIndex << 4)
                        | PwrLmt) {
                /* Socket F */
+               case 0x10012:
+                       processor_name_string =
+                           "AMD Opteron(tm) Processor 22RR EE";
+                       break;
                case 0x11002:
                        processor_name_string =
                            "Dual-Core AMD Opteron(tm) Processor 12RR EE";
@@ -252,6 +226,7 @@ int init_processor_name(void)
                            "AMD Athlon(tm) 64 Processor FX-ZZ Processor";
                        break;
                /* Socket AM2 */
+               /* single core */
                case 0x30015:
                        processor_name_string =
                            "AMD Sempron(tm) Processor LE-1RR0";
@@ -260,6 +235,10 @@ int init_processor_name(void)
                        processor_name_string =
                            "AMD Athlon(tm) Processor LE-1ZZ0";
                        break;
+               case 0x30036:
+                       processor_name_string =
+                           "AMD Athlon(tm) Processor 1ZZ0B";
+                       break;
                case 0x30041:
                case 0x30042:
                case 0x30043:
@@ -269,11 +248,33 @@ int init_processor_name(void)
                        processor_name_string =
                            "AMD Athlon(tm) 64 Processor TT00+";
                        break;
+               case 0x30052:
+                       processor_name_string =
+                           "AMD Sempron(tm) Processor RR50p";
                case 0x30064:
                case 0x30068:
                        processor_name_string =
                            "AMD Sempron(tm) Processor TT00+";
                        break;
+               case 0x30071:
+               case 0x30072:
+                       processor_name_string =
+                           "AMD Sempron(tm) Processor TT0U";
+                       break;
+               case 0x30082:
+               case 0x30083:
+                       processor_name_string =
+                           "AMD Athlon(tm) Processor TT50e";
+                       break;
+               case 0x30092:
+                       processor_name_string =
+                           "AMD Athlon(tm) Neo Processor MV-TT";
+                       break;
+               case 0x300c2:
+                       processor_name_string =
+                           "AMD Sempron(tm) Processor 2RRU";
+                       break;
+               /* dual-core */
                case 0x31016:
                        processor_name_string =
                            "Dual-Core AMD Opteron(tm) Processor 12RR HE";
@@ -290,6 +291,7 @@ int init_processor_name(void)
                        processor_name_string =
                            "AMD Athlon(tm) X2 Dual Core Processor BE-2TT0";
                        break;
+               case 0x31041:
                case 0x31042:
                case 0x31046:
                case 0x31048:
@@ -301,11 +303,47 @@ int init_processor_name(void)
                        processor_name_string =
                            "AMD Athlon(tm) 64 FX-ZZ Dual Core Processor";
                        break;
+               case 0x31066:
+                       processor_name_string =
+                           "AMD Sempron(tm) Dual Core Processor RR00";
+                       break;
+               case 0x31073:
+                       processor_name_string =
+                           "AMD Athlon(tm) Dual Core Processor TT50e";
+                       break;
+               case 0x31076:
+               case 0x31077:
+                       processor_name_string =
+                           "AMD Athlon(tm) Dual Core Processor TT00B";
+                       break;
+               case 0x31083:
+                       processor_name_string =
+                           "AMD Athlon(tm) Dual Core Processor TT50B";
+                       break;
+               case 0x31091:
+                       processor_name_string =
+                           "AMD Athlon(tm) X2 Dual Core Processor TT50e";
+                       break;
+               case 0x310a1:
+               case 0x310a2:
+                       processor_name_string =
+                           "AMD Athlon(tm) Neo X2 Dual Core Processor TT50e";
+                       break;
+               case 0x310b0:
+               case 0x310c0:
+                       processor_name_string =
+                           "AMD Turion(tm) Neo X2 Dual Core Processor L6RR";
+                       break;
                /* Socket S1g1 */
+               /* single core */
                case 0x00012:
                        processor_name_string =
                            "AMD Athlon(tm) 64 Processor TT00+";
                        break;
+               case 0x0002c:
+                       processor_name_string =
+                           "AMD Turion(tm) 64 Mobile Technology MK-YY";
+                       break;
                case 0x00031:
                        processor_name_string =
                            "Mobile AMD Sempron(tm) Processor TT00+";
@@ -314,18 +352,50 @@ int init_processor_name(void)
                        processor_name_string =
                            "Mobile AMD Sempron(tm) Processor PP00+";
                        break;
+               case 0x0003c:
+                       processor_name_string =
+                           "Mobile AMD Sempron(tm) Processor PP00+";
+                       break;
                case 0x00042:
                        processor_name_string =
                            "AMD Sempron(tm) Processor TT00+";
                        break;
+               case 0x00064:
+               case 0x00066:
+               case 0x0006c:
+                       processor_name_string =
+                           "AMD Athlon(tm) Processor TF-TT";
+                       break;
+               case 0x00073:
+                       processor_name_string =
+                           "AMD Athlon(tm) Processor L1RR";
+                       break;
+               /* dual-core */
+               case 0x0101c:
+                       processor_name_string =
+                           "AMD Sempron(tm) Dual Core Processor TJ-YY";
+                       break;
                case 0x0102c:
                        processor_name_string =
                            "AMD Turion(tm) 64 X2 Mobile Technology TL-YY";
                        break;
+               case 0x01034:
+               case 0x0103c:
+                       processor_name_string =
+                           "AMD Athlon(tm) 64 X2 Dual-Core Processor TK-YY";
+                       break;
                case 0x01054:
                        processor_name_string =
                            "AMD Athlon(tm) 64 X2 Dual Core Processor TT00+";
                        break;
+               case 0x01062:
+                       processor_name_string =
+                           "AMD Athlon(tm) X2 Dual Core Processor L3RR";
+                       break;
+               case 0x01074:
+                       processor_name_string =
+                           "AMD Athlon(tm) X2 Dual Core Processor L5RR";
+                       break;
                default:
                        processor_name_string = "AMD Processor model unknown";
                }
@@ -343,7 +413,7 @@ int init_processor_name(void)
        for (i=0; i<47; i++) { // 48 -1 
                if(program_string[i] == program_string[i+1]) {
                        switch (program_string[i]) {
-#if K8_REV_F_SUPPORT == 0
+#if CONFIG_K8_REV_F_SUPPORT == 0
                        case 'X': ModelNumber = 22+ NN; break;
                        case 'Y': ModelNumber = 38 + (2*NN); break;
                        case 'Z':
@@ -352,7 +422,7 @@ int init_processor_name(void)
                        case 'V': ModelNumber =  9 + NN; break;
 #endif
 
-#if K8_REV_F_SUPPORT == 1
+#if CONFIG_K8_REV_F_SUPPORT == 1
                        case 'R': ModelNumber = NN - 1; break;
                        case 'P': ModelNumber = 26 + NN; break;
                        case 'T': ModelNumber = 15 + (CmpCap * 10) + NN; break;
@@ -373,7 +443,7 @@ int init_processor_name(void)
                }
        }
        
-       printk_debug("CPU model %s\n", program_string);
+       printk(BIOS_DEBUG, "CPU model %s\n", program_string);
 
        for (i=0; i<6; i++) {
                progmsr.lo = program_values[(2*i)+0];