]> git.sur5r.net Git - u-boot/blobdiff - arch/x86/include/asm/cpu.h
x86: kconfig: Select ARCH_EARLY_INIT_R in the platform Kconfig
[u-boot] / arch / x86 / include / asm / cpu.h
index 08284ee29530c46a3d33ed52956b4f661113de01..bc2c4ffd9f11d82063d0b907b562cd14859ed0c1 100644 (file)
@@ -27,6 +27,37 @@ enum {
        X86_VENDOR_UNKNOWN = 0xff
 };
 
+/* Global descriptor table (GDT) bits */
+enum {
+       GDT_4KB                 = 1ULL << 55,
+       GDT_32BIT               = 1ULL << 54,
+       GDT_LONG                = 1ULL << 53,
+       GDT_PRESENT             = 1ULL << 47,
+       GDT_NOTSYS              = 1ULL << 44,
+       GDT_CODE                = 1ULL << 43,
+       GDT_LIMIT_LOW_SHIFT     = 0,
+       GDT_LIMIT_LOW_MASK      = 0xffff,
+       GDT_LIMIT_HIGH_SHIFT    = 48,
+       GDT_LIMIT_HIGH_MASK     = 0xf,
+       GDT_BASE_LOW_SHIFT      = 16,
+       GDT_BASE_LOW_MASK       = 0xffff,
+       GDT_BASE_HIGH_SHIFT     = 56,
+       GDT_BASE_HIGH_MASK      = 0xf,
+};
+
+/*
+ * System controllers in an x86 system. We mostly need to just find these and
+ * use them on PCI. At some point these might have their own uclass (e.g.
+ * UCLASS_VIDEO for the GMA device).
+ */
+enum {
+       X86_NONE,
+       X86_SYSCON_ME,          /* Intel Management Engine */
+       X86_SYSCON_PINCONF,     /* Intel x86 pin configuration */
+       X86_SYSCON_PMU,         /* Power Management Unit */
+       X86_SYSCON_SCU,         /* System Controller Unit */
+};
+
 struct cpuid_result {
        uint32_t eax;
        uint32_t ebx;
@@ -130,6 +161,8 @@ static inline unsigned int cpuid_edx(unsigned int op)
        return edx;
 }
 
+#if !CONFIG_IS_ENABLED(X86_64)
+
 /* Standard macro to see if a specific flag is changeable */
 static inline int flag_is_changeable_p(uint32_t flag)
 {
@@ -150,6 +183,7 @@ static inline int flag_is_changeable_p(uint32_t flag)
                : "ir" (flag));
        return ((f1^f2) & flag) != 0;
 }
+#endif
 
 static inline void mfence(void)
 {
@@ -211,6 +245,15 @@ char *cpu_get_name(char *name);
  */
 void cpu_call64(ulong pgtable, ulong setup_base, ulong target);
 
+/**
+ * cpu_call32() - Jump to a 32-bit entry point
+ *
+ * @code_seg32:        32-bit code segment to use (GDT offset, e.g. 0x20)
+ * @target:    Pointer to the start of the 32-bit U-Boot image/entry point
+ * @table:     Pointer to start of info table to pass to U-Boot
+ */
+void cpu_call32(ulong code_seg32, ulong target, ulong table);
+
 /**
  * cpu_jump_to_64bit() - Jump to a 64-bit Linux kernel
  *
@@ -222,4 +265,27 @@ void cpu_call64(ulong pgtable, ulong setup_base, ulong target);
  */
 int cpu_jump_to_64bit(ulong setup_base, ulong target);
 
+/**
+ * cpu_jump_to_64bit_uboot() - special function to jump from SPL to U-Boot
+ *
+ * This handles calling from 32-bit SPL to 64-bit U-Boot.
+ *
+ * @target:    Address of U-Boot in RAM
+ */
+int cpu_jump_to_64bit_uboot(ulong target);
+
+/**
+ * cpu_get_family_model() - Get the family and model for the CPU
+ *
+ * @return the CPU ID masked with 0x0fff0ff0
+ */
+u32 cpu_get_family_model(void);
+
+/**
+ * cpu_get_stepping() - Get the stepping value for the CPU
+ *
+ * @return the CPU ID masked with 0xf
+ */
+u32 cpu_get_stepping(void);
+
 #endif