sb/intel/ibexpeak/smihandler: Move finalizing to a common location

TODO: There is no reason to do this in SMM.

Change-Id: I8bbb2f65bbe674bd1bc4ae8a4086bd1f5e9a79fa
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/33139
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Arthur Heymans 2019-05-28 10:00:05 +02:00 committed by Patrick Georgi
parent 7c05d2a641
commit 04326aabcd
3 changed files with 7 additions and 38 deletions

View File

@ -20,10 +20,7 @@
#include <cpu/x86/smm.h> #include <cpu/x86/smm.h>
#include <southbridge/intel/ibexpeak/nvs.h> #include <southbridge/intel/ibexpeak/nvs.h>
#include <southbridge/intel/common/pmutil.h> #include <southbridge/intel/common/pmutil.h>
#include <southbridge/intel/ibexpeak/me.h>
#include <southbridge/intel/common/finalize.h>
#include <northbridge/intel/nehalem/nehalem.h> #include <northbridge/intel/nehalem/nehalem.h>
#include <cpu/intel/model_2065x/model_2065x.h>
#include <ec/acpi/ec.h> #include <ec/acpi/ec.h>
#include <ec/lenovo/h8/h8.h> #include <ec/lenovo/h8/h8.h>
#include <delay.h> #include <delay.h>
@ -135,25 +132,9 @@ void mainboard_smi_gpi(u32 gpi_sts)
mainboard_smi_handle_ec_sci(); mainboard_smi_handle_ec_sci();
} }
static int mainboard_finalized = 0;
int mainboard_smi_apmc(u8 data) int mainboard_smi_apmc(u8 data)
{ {
switch (data) { switch (data) {
case APM_CNT_FINALIZE:
printk(BIOS_DEBUG, "APMC: FINALIZE\n");
if (mainboard_finalized) {
printk(BIOS_DEBUG, "APMC#: Already finalized\n");
return 0;
}
intel_me_finalize_smm();
intel_pch_finalize_smm();
intel_nehalem_finalize_smm();
intel_model_2065x_finalize_smm();
mainboard_finalized = 1;
break;
case APM_CNT_ACPI_ENABLE: case APM_CNT_ACPI_ENABLE:
/* use 0x1600/0x1604 to prevent races with userspace */ /* use 0x1600/0x1604 to prevent races with userspace */
ec_set_ports(0x1604, 0x1600); ec_set_ports(0x1604, 0x1600);

View File

@ -18,11 +18,8 @@
#include <cpu/x86/smm.h> #include <cpu/x86/smm.h>
#include <device/pci_ops.h> #include <device/pci_ops.h>
#include <southbridge/intel/ibexpeak/nvs.h> #include <southbridge/intel/ibexpeak/nvs.h>
#include <southbridge/intel/ibexpeak/me.h>
#include <southbridge/intel/common/finalize.h>
#include <southbridge/intel/common/pmutil.h> #include <southbridge/intel/common/pmutil.h>
#include <northbridge/intel/nehalem/nehalem.h> #include <northbridge/intel/nehalem/nehalem.h>
#include <cpu/intel/model_2065x/model_2065x.h>
#include <ec/acpi/ec.h> #include <ec/acpi/ec.h>
static void mainboard_smm_init(void) static void mainboard_smm_init(void)
@ -54,26 +51,10 @@ void mainboard_smi_gpi(u32 gpi_sts)
{ {
} }
static int mainboard_finalized = 0;
int mainboard_smi_apmc(u8 data) int mainboard_smi_apmc(u8 data)
{ {
u8 tmp; u8 tmp;
switch (data) { switch (data) {
case APM_CNT_FINALIZE:
printk(BIOS_DEBUG, "APMC: FINALIZE\n");
if (mainboard_finalized) {
printk(BIOS_DEBUG, "APMC#: Already finalized\n");
return 0;
}
intel_me_finalize_smm();
intel_pch_finalize_smm();
intel_nehalem_finalize_smm();
intel_model_2065x_finalize_smm();
mainboard_finalized = 1;
break;
case APM_CNT_ACPI_ENABLE: case APM_CNT_ACPI_ENABLE:
tmp = pci_read_config8(PCI_DEV(0, 0x1f, 0), 0xbb); tmp = pci_read_config8(PCI_DEV(0, 0x1f, 0), 0xbb);
tmp &= ~0x03; tmp &= ~0x03;

View File

@ -24,7 +24,10 @@
#include <elog.h> #include <elog.h>
#include <halt.h> #include <halt.h>
#include <pc80/mc146818rtc.h> #include <pc80/mc146818rtc.h>
#include <cpu/intel/model_2065x/model_2065x.h>
#include <southbridge/intel/common/finalize.h>
#include <southbridge/intel/common/pmbase.h> #include <southbridge/intel/common/pmbase.h>
#include <southbridge/intel/ibexpeak/me.h>
#include "pch.h" #include "pch.h"
#include "nvs.h" #include "nvs.h"
@ -182,4 +185,8 @@ void southbridge_update_gnvs(u8 apm_cnt, int *smm_done)
void southbridge_finalize_all(void) void southbridge_finalize_all(void)
{ {
intel_me_finalize_smm();
intel_pch_finalize_smm();
intel_nehalem_finalize_smm();
intel_model_2065x_finalize_smm();
} }