board_f: x86: Use checkcpu() for CPU init
authorSimon Glass <sjg@chromium.org>
Tue, 28 Mar 2017 16:27:30 +0000 (10:27 -0600)
committerTom Rini <trini@konsulko.com>
Wed, 5 Apr 2017 17:55:09 +0000 (13:55 -0400)
At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
arch/x86/cpu/broadwell/cpu.c
arch/x86/cpu/coreboot/coreboot.c
arch/x86/cpu/efi/efi.c
arch/x86/cpu/ivybridge/cpu.c
arch/x86/cpu/qemu/qemu.c
arch/x86/cpu/quark/quark.c
arch/x86/cpu/x86_64/cpu.c
arch/x86/lib/efi/efi.c
arch/x86/lib/fsp/fsp_common.c
common/board_f.c

index 1b71d56..294dfa6 100644 (file)
@@ -131,10 +131,8 @@ int arch_cpu_init(void)
        return x86_cpu_init_f();
 }
 
-int print_cpuinfo(void)
+int checkcpu(void)
 {
-       char processor_name[CPU_MAX_NAME_LEN];
-       const char *name;
        int ret;
 
        set_max_freq();
@@ -144,6 +142,14 @@ int print_cpuinfo(void)
                return ret;
        gd->arch.pei_boot_mode = PEI_BOOT_NONE;
 
+       return 0;
+}
+
+int print_cpuinfo(void)
+{
+       char processor_name[CPU_MAX_NAME_LEN];
+       const char *name;
+
        /* Print processor name */
        name = cpu_get_name(processor_name);
        printf("CPU:   %s\n", name);
index 1b04203..658b900 100644 (file)
@@ -34,6 +34,11 @@ int board_early_init_f(void)
        return 0;
 }
 
+int checkcpu(void)
+{
+       return 0;
+}
+
 int print_cpuinfo(void)
 {
        return default_print_cpuinfo();
index 993ab8d..741613f 100644 (file)
@@ -18,6 +18,11 @@ int board_early_init_f(void)
        return 0;
 }
 
+int checkcpu(void)
+{
+       return 0;
+}
+
 int print_cpuinfo(void)
 {
        return default_print_cpuinfo();
index c4aca08..099cb94 100644 (file)
@@ -74,7 +74,7 @@ int arch_cpu_init_dm(void)
        /*
         * We should do as little as possible before the serial console is
         * up. Perhaps this should move to later. Our next lot of init
-        * happens in print_cpuinfo() when we have a console
+        * happens in checkcpu() when we have a console
         */
        ret = set_flex_ratio_to_tdp_nominal();
        if (ret)
@@ -125,12 +125,10 @@ static void enable_usb_bar(struct udevice *bus)
        pci_bus_write_config(bus, usb3, PCI_COMMAND, cmd, PCI_SIZE_32);
 }
 
-int print_cpuinfo(void)
+int checkcpu(void)
 {
        enum pei_boot_mode_t boot_mode = PEI_BOOT_NONE;
-       char processor_name[CPU_MAX_NAME_LEN];
        struct udevice *dev, *lpc;
-       const char *name;
        uint32_t pm1_cnt;
        uint16_t pm1_sts;
        int ret;
@@ -182,6 +180,14 @@ int print_cpuinfo(void)
 
        gd->arch.pei_boot_mode = boot_mode;
 
+       return 0;
+}
+
+int print_cpuinfo(void)
+{
+       char processor_name[CPU_MAX_NAME_LEN];
+       const char *name;
+
        /* Print processor name */
        name = cpu_get_name(processor_name);
        printf("CPU:   %s\n", name);
index 7153eb2..35a146c 100644 (file)
@@ -148,6 +148,12 @@ int arch_cpu_init(void)
 
 #if !CONFIG_IS_ENABLED(EFI_STUB) && \
        !CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
+
+int checkcpu(void)
+{
+       return 0;
+}
+
 int print_cpuinfo(void)
 {
        post_code(POST_CPU_INFO);
index bdd360a..0c2cea4 100644 (file)
@@ -264,6 +264,11 @@ int arch_cpu_init_dm(void)
        return 0;
 }
 
+int checkcpu(void)
+{
+       return 0;
+}
+
 int print_cpuinfo(void)
 {
        post_code(POST_CPU_INFO);
index db171f7..cafae15 100644 (file)
@@ -67,6 +67,11 @@ int misc_init_r(void)
        return 0;
 }
 
+int checkcpu(void)
+{
+       return 0;
+}
+
 int print_cpuinfo(void)
 {
        return 0;
index ede5d56..533318b 100644 (file)
@@ -125,6 +125,11 @@ void dram_init_banksize(void)
        }
 }
 
+int checkcpu(void)
+{
+       return 0;
+}
+
 int print_cpuinfo(void)
 {
        return default_print_cpuinfo();
index cebf85e..66a388d 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int checkcpu(void)
+{
+       return 0;
+}
+
 int print_cpuinfo(void)
 {
        post_code(POST_CPU_INFO);
index 91cb2a7..e98f319 100644 (file)
@@ -842,7 +842,8 @@ static const init_fnc_t init_sequence_f[] = {
        console_init_f,         /* stage 1 init of console */
        display_options,        /* say that we are here */
        display_text_info,      /* show debugging info if required */
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SH)
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SH) || \
+               defined(CONFIG_X86)
        checkcpu,
 #endif
 #if defined(CONFIG_DISPLAY_CPUINFO)