sb,soc/intel: Replace smm_southbridge_enable_smi()
Change-Id: I8a2e8b0c104d9e08f07aeb6a2c32106480ace3e5 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41961 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
		
				
					committed by
					
						 Patrick Georgi
						Patrick Georgi
					
				
			
			
				
	
			
			
			
						parent
						
							040c531158
						
					
				
				
					commit
					0778c86b3b
				
			| @@ -745,7 +745,7 @@ static void post_mp_init(void) | |||||||
| { | { | ||||||
| 	/* Now that all APs have been relocated as well as the BSP let SMIs | 	/* Now that all APs have been relocated as well as the BSP let SMIs | ||||||
| 	 * start flowing. */ | 	 * start flowing. */ | ||||||
| 	smm_southbridge_enable_smi(); | 	global_smi_enable(); | ||||||
|  |  | ||||||
| 	/* Lock down the SMRAM space. */ | 	/* Lock down the SMRAM space. */ | ||||||
| 	smm_lock(); | 	smm_lock(); | ||||||
|   | |||||||
| @@ -79,7 +79,7 @@ static void post_mp_init(void) | |||||||
| { | { | ||||||
| 	/* Now that all APs have been relocated as well as the BSP let SMIs | 	/* Now that all APs have been relocated as well as the BSP let SMIs | ||||||
| 	 * start flowing. */ | 	 * start flowing. */ | ||||||
| 	smm_southbridge_enable_smi(); | 	global_smi_enable(); | ||||||
|  |  | ||||||
| 	/* Lock down the SMRAM space. */ | 	/* Lock down the SMRAM space. */ | ||||||
| 	smm_lock(); | 	smm_lock(); | ||||||
|   | |||||||
| @@ -302,7 +302,7 @@ static void post_mp_init(void) | |||||||
| { | { | ||||||
| 	/* Now that all APs have been relocated as well as the BSP let SMIs | 	/* Now that all APs have been relocated as well as the BSP let SMIs | ||||||
| 	 * start flowing. */ | 	 * start flowing. */ | ||||||
| 	smm_southbridge_enable_smi(); | 	global_smi_enable(); | ||||||
|  |  | ||||||
| 	/* Lock down the SMRAM space. */ | 	/* Lock down the SMRAM space. */ | ||||||
| 	smm_lock(); | 	smm_lock(); | ||||||
|   | |||||||
| @@ -528,7 +528,7 @@ static void post_mp_init(void) | |||||||
| { | { | ||||||
| 	/* Now that all APs have been relocated as well as the BSP let SMIs | 	/* Now that all APs have been relocated as well as the BSP let SMIs | ||||||
| 	 * start flowing. */ | 	 * start flowing. */ | ||||||
| 	smm_southbridge_enable_smi(); | 	global_smi_enable(); | ||||||
|  |  | ||||||
| 	/* Lock down the SMRAM space. */ | 	/* Lock down the SMRAM space. */ | ||||||
| 	smm_lock(); | 	smm_lock(); | ||||||
|   | |||||||
| @@ -43,7 +43,6 @@ void smm_relocate(void); | |||||||
|  * for clearing the state in the SMM registers. The other is for enabling |  * for clearing the state in the SMM registers. The other is for enabling | ||||||
|  * SMIs. They are split so that other work between the 2 actions. */ |  * SMIs. They are split so that other work between the 2 actions. */ | ||||||
| void smm_southbridge_clear_state(void); | void smm_southbridge_clear_state(void); | ||||||
| void smm_southbridge_enable_smi(void); |  | ||||||
|  |  | ||||||
| /* To be removed. */ | /* To be removed. */ | ||||||
| void smm_initialize(void); | void smm_initialize(void); | ||||||
|   | |||||||
| @@ -178,6 +178,11 @@ static void relocation_handler(int cpu, uintptr_t curr_smbase, | |||||||
| 	smm_state->smbase = staggered_smbase; | 	smm_state->smbase = staggered_smbase; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void post_mp_init(void) | ||||||
|  | { | ||||||
|  | 	global_smi_enable(); | ||||||
|  | } | ||||||
|  |  | ||||||
| static const struct mp_ops mp_ops = { | static const struct mp_ops mp_ops = { | ||||||
| 	.pre_mp_init = pre_mp_init, | 	.pre_mp_init = pre_mp_init, | ||||||
| 	.get_cpu_count = get_cpu_count, | 	.get_cpu_count = get_cpu_count, | ||||||
| @@ -186,7 +191,7 @@ static const struct mp_ops mp_ops = { | |||||||
| 	.pre_mp_smm_init = smm_southbridge_clear_state, | 	.pre_mp_smm_init = smm_southbridge_clear_state, | ||||||
| 	.per_cpu_smm_trigger = per_cpu_smm_trigger, | 	.per_cpu_smm_trigger = per_cpu_smm_trigger, | ||||||
| 	.relocation_handler = relocation_handler, | 	.relocation_handler = relocation_handler, | ||||||
| 	.post_mp_init = smm_southbridge_enable_smi, | 	.post_mp_init = post_mp_init, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| void baytrail_init_cpus(struct device *dev) | void baytrail_init_cpus(struct device *dev) | ||||||
|   | |||||||
| @@ -70,9 +70,8 @@ static void smm_southcluster_route_gpios(void) | |||||||
| 	outl(alt_gpio_reg, alt_gpio_smi); | 	outl(alt_gpio_reg, alt_gpio_smi); | ||||||
| } | } | ||||||
|  |  | ||||||
| void smm_southbridge_enable_smi(void) | static void smm_southbridge_enable(uint16_t pm1_events) | ||||||
| { | { | ||||||
| 	uint16_t pm1_events = PWRBTN_EN | GBL_EN; |  | ||||||
|  |  | ||||||
| 	printk(BIOS_DEBUG, "Enabling SMIs.\n"); | 	printk(BIOS_DEBUG, "Enabling SMIs.\n"); | ||||||
| 	if (!smm_save_params[SMM_SAVE_PARAM_PCIE_WAKE_ENABLE]) | 	if (!smm_save_params[SMM_SAVE_PARAM_PCIE_WAKE_ENABLE]) | ||||||
| @@ -94,6 +93,11 @@ void smm_southbridge_enable_smi(void) | |||||||
| 	enable_smi(APMC_EN | SLP_SMI_EN | GBL_SMI_EN | EOS); | 	enable_smi(APMC_EN | SLP_SMI_EN | GBL_SMI_EN | EOS); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void global_smi_enable(void) | ||||||
|  | { | ||||||
|  | 	smm_southbridge_enable(PWRBTN_EN | GBL_EN); | ||||||
|  | } | ||||||
|  |  | ||||||
| void smm_setup_structures(void *gnvs, void *tcg, void *smi1) | void smm_setup_structures(void *gnvs, void *tcg, void *smi1) | ||||||
| { | { | ||||||
| 	/* | 	/* | ||||||
|   | |||||||
| @@ -188,6 +188,11 @@ static void relocation_handler(int cpu, uintptr_t curr_smbase, uintptr_t stagger | |||||||
| 	smm_state->smbase = staggered_smbase; | 	smm_state->smbase = staggered_smbase; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static void post_mp_init(void) | ||||||
|  | { | ||||||
|  | 	global_smi_enable(); | ||||||
|  | } | ||||||
|  |  | ||||||
| static const struct mp_ops mp_ops = { | static const struct mp_ops mp_ops = { | ||||||
| 	.pre_mp_init         = pre_mp_init, | 	.pre_mp_init         = pre_mp_init, | ||||||
| 	.get_cpu_count       = get_cpu_count, | 	.get_cpu_count       = get_cpu_count, | ||||||
| @@ -196,7 +201,7 @@ static const struct mp_ops mp_ops = { | |||||||
| 	.pre_mp_smm_init     = smm_southbridge_clear_state, | 	.pre_mp_smm_init     = smm_southbridge_clear_state, | ||||||
| 	.per_cpu_smm_trigger = per_cpu_smm_trigger, | 	.per_cpu_smm_trigger = per_cpu_smm_trigger, | ||||||
| 	.relocation_handler  = relocation_handler, | 	.relocation_handler  = relocation_handler, | ||||||
| 	.post_mp_init        = smm_southbridge_enable_smi, | 	.post_mp_init        = post_mp_init, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| void soc_init_cpus(struct device *dev) | void soc_init_cpus(struct device *dev) | ||||||
|   | |||||||
| @@ -70,9 +70,8 @@ static void smm_southcluster_route_gpios(void) | |||||||
| 	outl(alt_gpio_reg, alt_gpio_smi); | 	outl(alt_gpio_reg, alt_gpio_smi); | ||||||
| } | } | ||||||
|  |  | ||||||
| void smm_southbridge_enable_smi(void) | static void smm_southbridge_enable(uint16_t pm1_events) | ||||||
| { | { | ||||||
| 	uint16_t pm1_events = PWRBTN_EN | GBL_EN; |  | ||||||
|  |  | ||||||
| 	printk(BIOS_DEBUG, "Enabling SMIs.\n"); | 	printk(BIOS_DEBUG, "Enabling SMIs.\n"); | ||||||
| 	if (!smm_save_params[SMM_SAVE_PARAM_PCIE_WAKE_ENABLE]) | 	if (!smm_save_params[SMM_SAVE_PARAM_PCIE_WAKE_ENABLE]) | ||||||
| @@ -96,6 +95,11 @@ void smm_southbridge_enable_smi(void) | |||||||
| 	enable_smi(APMC_EN | SLP_SMI_EN | GBL_SMI_EN | EOS); | 	enable_smi(APMC_EN | SLP_SMI_EN | GBL_SMI_EN | EOS); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void global_smi_enable(void) | ||||||
|  | { | ||||||
|  | 	smm_southbridge_enable(PWRBTN_EN | GBL_EN); | ||||||
|  | } | ||||||
|  |  | ||||||
| void smm_setup_structures(void *gnvs, void *tcg, void *smi1) | void smm_setup_structures(void *gnvs, void *tcg, void *smi1) | ||||||
| { | { | ||||||
| 	/* | 	/* | ||||||
|   | |||||||
| @@ -494,7 +494,7 @@ static void post_mp_init(void) | |||||||
|  |  | ||||||
| 	/* Now that all APs have been relocated as well as the BSP let SMIs | 	/* Now that all APs have been relocated as well as the BSP let SMIs | ||||||
| 	 * start flowing. */ | 	 * start flowing. */ | ||||||
| 	smm_southbridge_enable_smi(); | 	global_smi_enable(); | ||||||
|  |  | ||||||
| 	/* Lock down the SMRAM space. */ | 	/* Lock down the SMRAM space. */ | ||||||
| 	smm_lock(); | 	smm_lock(); | ||||||
|   | |||||||
| @@ -32,11 +32,11 @@ void smm_southbridge_clear_state(void) | |||||||
| 	clear_gpe_status(); | 	clear_gpe_status(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void smm_southbridge_enable_smi(void) | static void smm_southbridge_enable(uint16_t pm1_events) | ||||||
| { | { | ||||||
| 	printk(BIOS_DEBUG, "Enabling SMIs.\n"); | 	printk(BIOS_DEBUG, "Enabling SMIs.\n"); | ||||||
| 	/* Configure events */ | 	/* Configure events */ | ||||||
| 	enable_pm1(PWRBTN_EN | GBL_EN); | 	enable_pm1(pm1_events); | ||||||
| 	disable_gpe(PME_B0_EN); | 	disable_gpe(PME_B0_EN); | ||||||
|  |  | ||||||
| 	/* Enable SMI generation: | 	/* Enable SMI generation: | ||||||
| @@ -50,6 +50,11 @@ void smm_southbridge_enable_smi(void) | |||||||
| 	enable_smi(APMC_EN | SLP_SMI_EN | GBL_SMI_EN | EOS); | 	enable_smi(APMC_EN | SLP_SMI_EN | GBL_SMI_EN | EOS); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void global_smi_enable(void) | ||||||
|  | { | ||||||
|  | 	smm_southbridge_enable(PWRBTN_EN | GBL_EN); | ||||||
|  | } | ||||||
|  |  | ||||||
| static void __unused southbridge_trigger_smi(void) | static void __unused southbridge_trigger_smi(void) | ||||||
| { | { | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -246,7 +246,7 @@ static void post_mp_init(void) | |||||||
| 	 * Now that all APs have been relocated as well as the BSP let SMIs | 	 * Now that all APs have been relocated as well as the BSP let SMIs | ||||||
| 	 * start flowing. | 	 * start flowing. | ||||||
| 	 */ | 	 */ | ||||||
| 	smm_southbridge_enable_smi(); | 	global_smi_enable(); | ||||||
| } | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
|   | |||||||
| @@ -33,12 +33,12 @@ void smm_southbridge_clear_state(void) | |||||||
| 	clear_pmc_status(); | 	clear_pmc_status(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void smm_southbridge_enable_smi(void) | static void smm_southbridge_enable(uint16_t pm1_events) | ||||||
| { | { | ||||||
|  |  | ||||||
| 	printk(BIOS_DEBUG, "Enabling SMIs.\n"); | 	printk(BIOS_DEBUG, "Enabling SMIs.\n"); | ||||||
| 	/* Configure events Disable PCIe wake. */ | 	/* Configure events Disable PCIe wake. */ | ||||||
| 	enable_pm1(PWRBTN_EN | GBL_EN | PCIEXPWAK_DIS); | 	enable_pm1(pm1_events | PCIEXPWAK_DIS); | ||||||
| 	disable_gpe(PME_B0_EN); | 	disable_gpe(PME_B0_EN); | ||||||
|  |  | ||||||
| 	/* Enable SMI generation: | 	/* Enable SMI generation: | ||||||
| @@ -52,6 +52,11 @@ void smm_southbridge_enable_smi(void) | |||||||
| 	enable_smi(APMC_EN | SLP_SMI_EN | GBL_SMI_EN | EOS); | 	enable_smi(APMC_EN | SLP_SMI_EN | GBL_SMI_EN | EOS); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void global_smi_enable(void) | ||||||
|  | { | ||||||
|  | 	smm_southbridge_enable(PWRBTN_EN | GBL_EN); | ||||||
|  | } | ||||||
|  |  | ||||||
| void smm_setup_structures(void *gnvs, void *tcg, void *smi1) | void smm_setup_structures(void *gnvs, void *tcg, void *smi1) | ||||||
| { | { | ||||||
| 	/* | 	/* | ||||||
|   | |||||||
| @@ -152,6 +152,12 @@ static void post_mp_init(void) | |||||||
| { | { | ||||||
| 	/* Set Max Ratio */ | 	/* Set Max Ratio */ | ||||||
| 	set_max_turbo_freq(); | 	set_max_turbo_freq(); | ||||||
|  |  | ||||||
|  | 	/* | ||||||
|  | 	 * TODO: Now that all APs have been relocated as well as the BSP let SMIs | ||||||
|  | 	 * start flowing. | ||||||
|  | 	 */ | ||||||
|  | 	if (0) global_smi_enable(); | ||||||
| } | } | ||||||
|  |  | ||||||
| static const struct mp_ops mp_ops = { | static const struct mp_ops mp_ops = { | ||||||
|   | |||||||
| @@ -199,6 +199,7 @@ static void post_mp_init(void) | |||||||
| 	 * TODO: Now that all APs have been relocated as well as the BSP let SMIs | 	 * TODO: Now that all APs have been relocated as well as the BSP let SMIs | ||||||
| 	 * start flowing. | 	 * start flowing. | ||||||
| 	 */ | 	 */ | ||||||
|  | 	if (0) global_smi_enable(); | ||||||
| } | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
|   | |||||||
| @@ -17,10 +17,9 @@ u16 get_pmbase(void) | |||||||
| 	return lpc_get_pmbase(); | 	return lpc_get_pmbase(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void smm_southbridge_enable_smi(void) | static void smm_southbridge_enable(uint16_t pm1_events) | ||||||
| { | { | ||||||
| 	u32 smi_en; | 	u32 smi_en; | ||||||
| 	u16 pm1_en; |  | ||||||
| 	u32 gpe0_en; | 	u32 gpe0_en; | ||||||
|  |  | ||||||
| 	if (CONFIG(ELOG)) | 	if (CONFIG(ELOG)) | ||||||
| @@ -49,10 +48,7 @@ void smm_southbridge_enable_smi(void) | |||||||
| 	gpe0_en &= ~PME_B0_EN; | 	gpe0_en &= ~PME_B0_EN; | ||||||
| 	write_pmbase32(GPE0_EN, gpe0_en); | 	write_pmbase32(GPE0_EN, gpe0_en); | ||||||
|  |  | ||||||
| 	pm1_en = 0; | 	write_pmbase16(PM1_EN, pm1_events); | ||||||
| 	pm1_en |= PWRBTN_EN; |  | ||||||
| 	pm1_en |= GBL_EN; |  | ||||||
| 	write_pmbase16(PM1_EN, pm1_en); |  | ||||||
|  |  | ||||||
| 	/* Enable SMI generation: | 	/* Enable SMI generation: | ||||||
| 	 *  - on TCO events | 	 *  - on TCO events | ||||||
| @@ -75,6 +71,11 @@ void smm_southbridge_enable_smi(void) | |||||||
| 	write_pmbase32(SMI_EN, smi_en); | 	write_pmbase32(SMI_EN, smi_en); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void global_smi_enable(void) | ||||||
|  | { | ||||||
|  | 	smm_southbridge_enable(PWRBTN_EN | GBL_EN); | ||||||
|  | } | ||||||
|  |  | ||||||
| void smm_setup_structures(void *gnvs, void *tcg, void *smi1) | void smm_setup_structures(void *gnvs, void *tcg, void *smi1) | ||||||
| { | { | ||||||
| 	/* | 	/* | ||||||
|   | |||||||
| @@ -35,11 +35,11 @@ void smm_southbridge_clear_state(void) | |||||||
| 	clear_gpe_status(); | 	clear_gpe_status(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void smm_southbridge_enable_smi(void) | static void smm_southbridge_enable(uint16_t pm1_events) | ||||||
| { | { | ||||||
| 	printk(BIOS_DEBUG, "Enabling SMIs.\n"); | 	printk(BIOS_DEBUG, "Enabling SMIs.\n"); | ||||||
| 	/* Configure events */ | 	/* Configure events */ | ||||||
| 	enable_pm1(PWRBTN_EN | GBL_EN); | 	enable_pm1(pm1_events); | ||||||
| 	disable_gpe(PME_B0_EN); | 	disable_gpe(PME_B0_EN); | ||||||
|  |  | ||||||
| 	/* Enable SMI generation: | 	/* Enable SMI generation: | ||||||
| @@ -53,6 +53,11 @@ void smm_southbridge_enable_smi(void) | |||||||
| 	enable_smi(APMC_EN | SLP_SMI_EN | GBL_SMI_EN | EOS); | 	enable_smi(APMC_EN | SLP_SMI_EN | GBL_SMI_EN | EOS); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void global_smi_enable(void) | ||||||
|  | { | ||||||
|  | 	smm_southbridge_enable(PWRBTN_EN | GBL_EN); | ||||||
|  | } | ||||||
|  |  | ||||||
| static void  __unused southbridge_trigger_smi(void) | static void  __unused southbridge_trigger_smi(void) | ||||||
| { | { | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user