From b6585481e8cb30ed04a1673b170af3df9e0e4320 Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Mon, 1 Jun 2020 15:11:14 +0300 Subject: arch/x86: Create helper for APM_CNT SMI triggers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Attempts to write to APM_CNT IO port should always be guarded with a test to verify SMI handler has been installed. Immediate followup removes redundant HAVE_SMI_HANDLER tests. Change-Id: If3fb0f1a8b32076f1d9f3fea9f817dd4b093ad98 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/41971 Reviewed-by: Angel Pons Reviewed-by: Patrick Rudolph Tested-by: build bot (Jenkins) --- src/southbridge/intel/bd82x6x/lpc.c | 6 ++---- src/southbridge/intel/i82801gx/lpc.c | 7 ++----- src/southbridge/intel/i82801ix/lpc.c | 7 ++----- src/southbridge/intel/i82801jx/lpc.c | 7 ++----- src/southbridge/intel/ibexpeak/lpc.c | 6 ++---- src/southbridge/intel/lynxpoint/lpc.c | 6 ++---- 6 files changed, 12 insertions(+), 27 deletions(-) (limited to 'src/southbridge/intel') diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c index 5e28cd2bc2..200463268f 100644 --- a/src/southbridge/intel/bd82x6x/lpc.c +++ b/src/southbridge/intel/bd82x6x/lpc.c @@ -405,9 +405,7 @@ static void enable_clock_gating(struct device *dev) static void pch_set_acpi_mode(void) { if (!acpi_is_wakeup_s3() && CONFIG(HAVE_SMI_HANDLER)) { - printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n"); - outb(APM_CNT_ACPI_DISABLE, APM_CNT); // Disable ACPI mode - printk(BIOS_DEBUG, "done.\n"); + apm_control(APM_CNT_ACPI_DISABLE); } } @@ -827,7 +825,7 @@ static void lpc_final(struct device *dev) if (CONFIG(HAVE_SMI_HANDLER)) { if (CONFIG(INTEL_CHIPSET_LOCKDOWN) || acpi_is_wakeup_s3()) { - outb(APM_CNT_FINALIZE, APM_CNT); + apm_control(APM_CNT_FINALIZE); } } } diff --git a/src/southbridge/intel/i82801gx/lpc.c b/src/southbridge/intel/i82801gx/lpc.c index e3bddf9aa1..9e1efac236 100644 --- a/src/southbridge/intel/i82801gx/lpc.c +++ b/src/southbridge/intel/i82801gx/lpc.c @@ -316,12 +316,9 @@ static void i82801gx_set_acpi_mode(struct device *dev) { if (CONFIG(HAVE_SMI_HANDLER)) { if (!acpi_is_wakeup_s3()) { - printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n"); - outb(APM_CNT_ACPI_DISABLE, APM_CNT); // Disable ACPI mode - printk(BIOS_DEBUG, "done.\n"); + apm_control(APM_CNT_ACPI_DISABLE); } else { - printk(BIOS_DEBUG, "S3 wakeup, enabling ACPI via APMC\n"); - outb(APM_CNT_ACPI_ENABLE, APM_CNT); + apm_control(APM_CNT_ACPI_ENABLE); } } } diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c index 732e69a385..2966b78b5e 100644 --- a/src/southbridge/intel/i82801ix/lpc.c +++ b/src/southbridge/intel/i82801ix/lpc.c @@ -345,12 +345,9 @@ static void i82801ix_set_acpi_mode(struct device *dev) { if (CONFIG(HAVE_SMI_HANDLER)) { if (!acpi_is_wakeup_s3()) { - printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n"); - outb(APM_CNT_ACPI_DISABLE, APM_CNT); // Disable ACPI mode - printk(BIOS_DEBUG, "done.\n"); + apm_control(APM_CNT_ACPI_DISABLE); } else { - printk(BIOS_DEBUG, "S3 wakeup, enabling ACPI via APMC\n"); - outb(APM_CNT_ACPI_ENABLE, APM_CNT); + apm_control(APM_CNT_ACPI_ENABLE); } } } diff --git a/src/southbridge/intel/i82801jx/lpc.c b/src/southbridge/intel/i82801jx/lpc.c index 07cf5274a5..d12e061226 100644 --- a/src/southbridge/intel/i82801jx/lpc.c +++ b/src/southbridge/intel/i82801jx/lpc.c @@ -349,12 +349,9 @@ static void i82801jx_set_acpi_mode(struct device *dev) { if (CONFIG(HAVE_SMI_HANDLER)) { if (!acpi_is_wakeup_s3()) { - printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n"); - outb(APM_CNT_ACPI_DISABLE, APM_CNT); // Disable ACPI mode - printk(BIOS_DEBUG, "done.\n"); + apm_control(APM_CNT_ACPI_DISABLE); } else { - printk(BIOS_DEBUG, "S3 wakeup, enabling ACPI via APMC\n"); - outb(APM_CNT_ACPI_ENABLE, APM_CNT); + apm_control(APM_CNT_ACPI_ENABLE); } } } diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c index b57e30ec8a..2362649ae6 100644 --- a/src/southbridge/intel/ibexpeak/lpc.c +++ b/src/southbridge/intel/ibexpeak/lpc.c @@ -409,9 +409,7 @@ static void enable_clock_gating(struct device *dev) static void pch_set_acpi_mode(void) { if (!acpi_is_wakeup_s3() && CONFIG(HAVE_SMI_HANDLER)) { - printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n"); - outb(APM_CNT_ACPI_DISABLE, APM_CNT); // Disable ACPI mode - printk(BIOS_DEBUG, "done.\n"); + apm_control(APM_CNT_ACPI_DISABLE); // Disable ACPI mode } } @@ -727,7 +725,7 @@ static void lpc_final(struct device *dev) if (CONFIG(HAVE_SMI_HANDLER)) { if (CONFIG(INTEL_CHIPSET_LOCKDOWN) || acpi_is_wakeup_s3()) { - outb(APM_CNT_FINALIZE, APM_CNT); + apm_control(APM_CNT_FINALIZE); } } } diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c index 8a61b295ae..bf03125a8a 100644 --- a/src/southbridge/intel/lynxpoint/lpc.c +++ b/src/southbridge/intel/lynxpoint/lpc.c @@ -474,9 +474,7 @@ static void enable_lp_clock_gating(struct device *dev) static void pch_set_acpi_mode(void) { if (CONFIG(HAVE_SMI_HANDLER) && !acpi_is_wakeup_s3()) { - printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n"); - outb(APM_CNT_ACPI_DISABLE, APM_CNT); - printk(BIOS_DEBUG, "done.\n"); + apm_control(APM_CNT_ACPI_DISABLE); } } @@ -923,7 +921,7 @@ static void lpc_final(struct device *dev) spi_finalize_ops(); if (acpi_is_wakeup_s3() || CONFIG(INTEL_CHIPSET_LOCKDOWN)) - outb(APM_CNT_FINALIZE, APM_CNT); + apm_control(APM_CNT_FINALIZE); } static struct device_operations device_ops = { -- cgit v1.2.3