diff options
author | Aaron Durbin <adurbin@chromium.org> | 2016-05-03 15:26:29 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2016-05-06 16:41:01 +0200 |
commit | 8346b04445acab02b0120d12c55abb0edb4eabdd (patch) | |
tree | b9392965aab2cf2be2524668fe344cd0e9a39bb1 | |
parent | c681409a8a3429c8aa8572ce18f4560fecb0c0ae (diff) |
soc/intel/fsp_broadwell_de: convert to using common MP init
In order to reduce duplication of code use the common MP
initialization flow.
Change-Id: I2a7c628cfae7cf6af6e89fa8fc274f59127ff7c7
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/14592
Tested-by: build bot (Jenkins)
Reviewed-by: York Yang <york.yang@intel.com>
-rw-r--r-- | src/soc/intel/fsp_broadwell_de/cpu.c | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/src/soc/intel/fsp_broadwell_de/cpu.c b/src/soc/intel/fsp_broadwell_de/cpu.c index 2f6487a983..ca082041e9 100644 --- a/src/soc/intel/fsp_broadwell_de/cpu.c +++ b/src/soc/intel/fsp_broadwell_de/cpu.c @@ -27,15 +27,42 @@ #include <soc/pattrs.h> #include <soc/ramstage.h> -static void configure_mca(void); +static void pre_mp_init(void) +{ + x86_mtrr_check(); + + /* Enable the local cpu apics */ + setup_lapic(); +} + +static int get_cpu_count(void) +{ + const struct pattrs *pattrs = pattrs_get(); -static struct mp_flight_record mp_steps[] = { - MP_FR_BLOCK_APS(mp_initialize_cpu, mp_initialize_cpu), + return pattrs->num_cpus; +} + +static void get_microcode_info(const void **microcode, int *parallel) +{ + const struct pattrs *pattrs = pattrs_get(); + + *microcode = pattrs->microcode_patch; + *parallel = 1; +} + +static const struct mp_ops mp_ops = { + .pre_mp_init = pre_mp_init, + .get_cpu_count = get_cpu_count, + .get_microcode_info = get_microcode_info, }; -static int adjust_apic_id(int index, int apic_id) +void broadwell_de_init_cpus(device_t dev) { - return index; + struct bus *cpu_bus = dev->link_list; + + if (mp_init_with_smm(cpu_bus, &mp_ops)) { + printk(BIOS_ERR, "MP initialization failure.\n"); + } } static void configure_mca(void) @@ -63,29 +90,6 @@ static void configure_mca(void) wrmsr(MSR_IA32_MC0_STATUS + (i * 4), msr); } -void broadwell_de_init_cpus(device_t dev) -{ - struct bus *cpu_bus = dev->link_list; - const struct pattrs *pattrs = pattrs_get(); - struct mp_params mp_params; - - x86_mtrr_check(); - - /* Enable the local cpu apics */ - setup_lapic(); - - mp_params.num_cpus = pattrs->num_cpus, - mp_params.parallel_microcode_load = 1, - mp_params.adjust_apic_id = adjust_apic_id; - mp_params.flight_plan = &mp_steps[0]; - mp_params.num_records = ARRAY_SIZE(mp_steps); - mp_params.microcode_pointer = pattrs->microcode_patch; - - if (mp_init(cpu_bus, &mp_params)) { - printk(BIOS_ERR, "MP initialization failure.\n"); - } -} - static void broadwell_de_core_init(device_t cpu) { printk(BIOS_DEBUG, "Init Broadwell-DE core.\n"); |