drop "arch/asm.h" and "arch/intel.h" and create "cpu/x86/post_code.h"
[coreboot.git] / src / arch / i386 / include / arch / cpu.h
index 4cdeded8bc590146dcb2facb4ee46d328e9ba9eb..30b6cc300bb533e9396b984207f14061cfb71266 100644 (file)
@@ -28,6 +28,7 @@ struct cpuid_result {
        uint32_t ecx;
        uint32_t edx;
 };
+
 /*
  * Generic CPUID function
  */
@@ -44,7 +45,6 @@ static inline struct cpuid_result cpuid(int op)
        return result;
 }
 
-
 /*
  * CPUID functions returning a single datum
  */
@@ -58,6 +58,7 @@ static inline unsigned int cpuid_eax(unsigned int op)
                : "ebx", "ecx", "edx");
        return eax;
 }
+
 static inline unsigned int cpuid_ebx(unsigned int op)
 {
        unsigned int eax, ebx;
@@ -68,6 +69,7 @@ static inline unsigned int cpuid_ebx(unsigned int op)
                : "ecx", "edx" );
        return ebx;
 }
+
 static inline unsigned int cpuid_ecx(unsigned int op)
 {
        unsigned int eax, ecx;
@@ -78,6 +80,7 @@ static inline unsigned int cpuid_ecx(unsigned int op)
                : "ebx", "edx" );
        return ecx;
 }
+
 static inline unsigned int cpuid_edx(unsigned int op)
 {
        unsigned int eax, edx;
@@ -89,8 +92,6 @@ static inline unsigned int cpuid_edx(unsigned int op)
        return edx;
 }
 
-
-
 #define X86_VENDOR_INVALID    0
 #define X86_VENDOR_INTEL      1
 #define X86_VENDOR_CYRIX      2
@@ -104,7 +105,7 @@ static inline unsigned int cpuid_edx(unsigned int op)
 #define X86_VENDOR_SIS       10 
 #define X86_VENDOR_UNKNOWN 0xff
 
-#if !defined( __ROMCC__ ) && defined( __GNUC__)
+#if !defined(__PRE_RAM__)
 #include <device/device.h>
 
 
@@ -112,6 +113,7 @@ struct cpu_device_id {
        unsigned vendor;
        unsigned device;
 };
+
 struct cpu_driver {
        struct device_operations *ops;
        struct cpu_device_id *id_table;
@@ -128,8 +130,8 @@ static inline struct cpu_info *cpu_info(void)
        __asm__("andl %%esp,%0; "
                "orl  %2, %0 "
                :"=r" (ci) 
-               : "0" (~(STACK_SIZE - 1)), 
-               "r" (STACK_SIZE - sizeof(struct cpu_info))
+               : "0" (~(CONFIG_STACK_SIZE - 1)), 
+               "r" (CONFIG_STACK_SIZE - sizeof(struct cpu_info))
        );
        return ci;
 }
@@ -141,6 +143,24 @@ static inline unsigned long cpu_index(void)
        return ci->index;
 }
 
+struct cpuinfo_x86 {
+        uint8_t    x86;            /* CPU family */
+        uint8_t    x86_vendor;     /* CPU vendor */
+        uint8_t    x86_model;
+        uint8_t    x86_mask;
+};
+
+static void inline get_fms(struct cpuinfo_x86 *c, uint32_t tfms)
+{
+        c->x86 = (tfms >> 8) & 0xf;
+        c->x86_model = (tfms >> 4) & 0xf;
+        c->x86_mask = tfms & 0xf;
+        if (c->x86 == 0xf)
+                c->x86 += (tfms >> 20) & 0xff;
+        if (c->x86 >= 0x6)
+                c->x86_model += ((tfms >> 16) & 0xF) << 4;
+
+}
 #endif
 
 #endif /* ARCH_CPU_H */