From 8346b04445acab02b0120d12c55abb0edb4eabdd Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Tue, 3 May 2016 15:26:29 -0500 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/14592 Tested-by: build bot (Jenkins) Reviewed-by: York Yang --- src/soc/intel/fsp_broadwell_de/cpu.c | 60 +++++++++++++++------------- 1 file 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 #include -static void configure_mca(void); +static void pre_mp_init(void) +{ + x86_mtrr_check(); -static struct mp_flight_record mp_steps[] = { - MP_FR_BLOCK_APS(mp_initialize_cpu, mp_initialize_cpu), + /* Enable the local cpu apics */ + setup_lapic(); +} + +static int get_cpu_count(void) +{ + const struct pattrs *pattrs = pattrs_get(); + + 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");