intel boards: Use acpi_is_wakeup_s3()

Change-Id: Icab0aeb2d5bf19b4029ca29b8a1e7564ef59a538
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/6071
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
This commit is contained in:
Kyösti Mälkki 2014-06-19 19:50:51 +03:00 committed by Patrick Georgi
parent 49380b87d1
commit c3ed88636a
27 changed files with 28 additions and 56 deletions

View File

@ -29,7 +29,7 @@ void mainboard_ec_init(void)
post_code(0xf0); post_code(0xf0);
/* Restore SCI event mask on resume. */ /* Restore SCI event mask on resume. */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3()) {
google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS | google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
MAINBOARD_EC_S3_WAKE_EVENTS); MAINBOARD_EC_S3_WAKE_EVENTS);

View File

@ -29,7 +29,7 @@ void mainboard_ec_init(void)
post_code(0xf0); post_code(0xf0);
/* Restore SCI event mask on resume. */ /* Restore SCI event mask on resume. */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3()) {
google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS | google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
MAINBOARD_EC_S3_WAKE_EVENTS); MAINBOARD_EC_S3_WAKE_EVENTS);

View File

@ -29,7 +29,7 @@ void link_ec_init(void)
post_code(0xf0); post_code(0xf0);
/* Restore SCI event mask on resume. */ /* Restore SCI event mask on resume. */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3()) {
google_chromeec_log_events(LINK_EC_LOG_EVENTS | google_chromeec_log_events(LINK_EC_LOG_EVENTS |
LINK_EC_S3_WAKE_EVENTS); LINK_EC_S3_WAKE_EVENTS);

View File

@ -29,7 +29,7 @@ void mainboard_ec_init(void)
post_code(0xf0); post_code(0xf0);
/* Restore SCI event mask on resume. */ /* Restore SCI event mask on resume. */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3()) {
google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS | google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
MAINBOARD_EC_S3_WAKE_EVENTS); MAINBOARD_EC_S3_WAKE_EVENTS);

View File

@ -29,7 +29,7 @@ void mainboard_ec_init(void)
post_code(0xf0); post_code(0xf0);
/* Restore SCI event mask on resume. */ /* Restore SCI event mask on resume. */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3()) {
google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS | google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
MAINBOARD_EC_S3_WAKE_EVENTS); MAINBOARD_EC_S3_WAKE_EVENTS);

View File

@ -29,7 +29,7 @@ void mainboard_ec_init(void)
post_code(0xf0); post_code(0xf0);
/* Restore SCI event mask on resume. */ /* Restore SCI event mask on resume. */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3()) {
google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS | google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
MAINBOARD_EC_S3_WAKE_EVENTS); MAINBOARD_EC_S3_WAKE_EVENTS);

View File

@ -27,7 +27,7 @@ void lumpy_ec_init(void)
{ {
printk(BIOS_DEBUG, "lumpy_ec_init\n"); printk(BIOS_DEBUG, "lumpy_ec_init\n");
if (acpi_slp_type == 3) if (acpi_is_wakeup_s3())
return; return;
/* /*

View File

@ -27,7 +27,7 @@ void lumpy_ec_init(void)
{ {
printk(BIOS_DEBUG, "lumpy_ec_init\n"); printk(BIOS_DEBUG, "lumpy_ec_init\n");
if (acpi_slp_type == 3) if (acpi_is_wakeup_s3())
return; return;
/* /*

View File

@ -143,7 +143,7 @@ static void ehci_init(device_t dev)
}; };
/* Don't reset controller in S3 resume path */ /* Don't reset controller in S3 resume path */
if (acpi_slp_type != 3) if (!acpi_is_wakeup_s3())
reg_script_run_on_dev(dev, ehci_hc_reset); reg_script_run_on_dev(dev, ehci_hc_reset);
/* Disable controller if ports are routed to XHCI */ /* Disable controller if ports are routed to XHCI */

View File

@ -73,7 +73,7 @@ static void log_wake_events(const struct chipset_power_state *ps)
if (ps->pm1_sts & WAK_STS) { if (ps->pm1_sts & WAK_STS) {
elog_add_event_byte(ELOG_TYPE_ACPI_WAKE, elog_add_event_byte(ELOG_TYPE_ACPI_WAKE,
acpi_slp_type == 3 ? 3 : 5); acpi_is_wakeup_s3() ? 3 : 5);
} }
if (ps->pm1_sts & PWRBTN_STS) { if (ps->pm1_sts & PWRBTN_STS) {

View File

@ -29,15 +29,6 @@
#include <baytrail/ramstage.h> #include <baytrail/ramstage.h>
#include <baytrail/efi_wrapper.h> #include <baytrail/efi_wrapper.h>
static inline int is_s3_resume(void)
{
#if CONFIG_HAVE_ACPI_RESUME
return acpi_slp_type == 3;
#else
return 0;
#endif
}
static inline struct ramstage_cache *next_cache(struct ramstage_cache *c) static inline struct ramstage_cache *next_cache(struct ramstage_cache *c)
{ {
return (struct ramstage_cache *)&c->program[c->size]; return (struct ramstage_cache *)&c->program[c->size];
@ -140,7 +131,7 @@ static efi_wrapper_entry_t load_reference_code(void)
}; };
int ret; int ret;
if (is_s3_resume()) { if (acpi_is_wakeup_s3()) {
return load_refcode_from_cache(); return load_refcode_from_cache();
} }

View File

@ -80,7 +80,7 @@ void pch_log_state(void)
/* ACPI Wake */ /* ACPI Wake */
if (pm1_sts & (1 << 15)) if (pm1_sts & (1 << 15))
elog_add_event_byte(ELOG_TYPE_ACPI_WAKE, elog_add_event_byte(ELOG_TYPE_ACPI_WAKE,
acpi_slp_type == 3 ? 3 : 5); acpi_is_wakeup_s3() ? 3 : 5);
/* /*
* Wake sources * Wake sources

View File

@ -431,7 +431,7 @@ static void pch_lock_smm(struct device *dev)
u8 reg8; u8 reg8;
#endif #endif
if (acpi_slp_type != 3) { if (!acpi_is_wakeup_s3()) {
#if ENABLE_ACPI_MODE_IN_COREBOOT #if ENABLE_ACPI_MODE_IN_COREBOOT
printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n"); printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n");
outb(0xe1, 0xb2); // Enable ACPI mode outb(0xe1, 0xb2); // Enable ACPI mode

View File

@ -554,12 +554,9 @@ static me_bios_path intel_me_path(device_t dev)
struct me_hfs hfs; struct me_hfs hfs;
struct me_gmes gmes; struct me_gmes gmes;
#if CONFIG_HAVE_ACPI_RESUME
/* S3 wake skips all MKHI messages */ /* S3 wake skips all MKHI messages */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3())
return ME_S3WAKE_BIOS_PATH; return ME_S3WAKE_BIOS_PATH;
}
#endif
pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS); pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS);
pci_read_dword_ptr(dev, &gmes, PCI_ME_GMES); pci_read_dword_ptr(dev, &gmes, PCI_ME_GMES);

View File

@ -535,12 +535,9 @@ static me_bios_path intel_me_path(device_t dev)
struct me_hfs hfs; struct me_hfs hfs;
struct me_gmes gmes; struct me_gmes gmes;
#if CONFIG_HAVE_ACPI_RESUME
/* S3 wake skips all MKHI messages */ /* S3 wake skips all MKHI messages */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3())
return ME_S3WAKE_BIOS_PATH; return ME_S3WAKE_BIOS_PATH;
}
#endif
pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS); pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS);
pci_read_dword_ptr(dev, &gmes, PCI_ME_GMES); pci_read_dword_ptr(dev, &gmes, PCI_ME_GMES);

View File

@ -80,7 +80,7 @@ void pch_log_state(void)
/* ACPI Wake */ /* ACPI Wake */
if (pm1_sts & (1 << 15)) if (pm1_sts & (1 << 15))
elog_add_event_byte(ELOG_TYPE_ACPI_WAKE, elog_add_event_byte(ELOG_TYPE_ACPI_WAKE,
acpi_slp_type == 3 ? 3 : 5); acpi_is_wakeup_s3() ? 3 : 5);
/* /*
* Wake sources * Wake sources

View File

@ -406,7 +406,7 @@ static void pch_lock_smm(struct device *dev)
u8 reg8; u8 reg8;
#endif #endif
if (acpi_slp_type != 3) { if (!acpi_is_wakeup_s3()) {
#if ENABLE_ACPI_MODE_IN_COREBOOT #if ENABLE_ACPI_MODE_IN_COREBOOT
printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n"); printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n");
outb(0xe1, 0xb2); // Enable ACPI mode outb(0xe1, 0xb2); // Enable ACPI mode

View File

@ -553,12 +553,9 @@ static me_bios_path intel_me_path(device_t dev)
struct me_hfs hfs; struct me_hfs hfs;
struct me_gmes gmes; struct me_gmes gmes;
#if CONFIG_HAVE_ACPI_RESUME
/* S3 wake skips all MKHI messages */ /* S3 wake skips all MKHI messages */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3())
return ME_S3WAKE_BIOS_PATH; return ME_S3WAKE_BIOS_PATH;
}
#endif
pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS); pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS);
pci_read_dword_ptr(dev, &gmes, PCI_ME_GMES); pci_read_dword_ptr(dev, &gmes, PCI_ME_GMES);

View File

@ -533,12 +533,9 @@ static me_bios_path intel_me_path(device_t dev)
struct me_hfs hfs; struct me_hfs hfs;
struct me_gmes gmes; struct me_gmes gmes;
#if CONFIG_HAVE_ACPI_RESUME
/* S3 wake skips all MKHI messages */ /* S3 wake skips all MKHI messages */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3())
return ME_S3WAKE_BIOS_PATH; return ME_S3WAKE_BIOS_PATH;
}
#endif
pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS); pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS);
pci_read_dword_ptr(dev, &gmes, PCI_ME_GMES); pci_read_dword_ptr(dev, &gmes, PCI_ME_GMES);

View File

@ -330,7 +330,7 @@ static void i82801gx_lock_smm(struct device *dev)
u8 reg8; u8 reg8;
#endif #endif
if (acpi_slp_type != 3) { if (!acpi_is_wakeup_s3()) {
#if ENABLE_ACPI_MODE_IN_COREBOOT #if ENABLE_ACPI_MODE_IN_COREBOOT
printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n"); printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n");
outb(APM_CNT_ACPI_ENABLE, APM_CNT); // Enable ACPI mode outb(APM_CNT_ACPI_ENABLE, APM_CNT); // Enable ACPI mode

View File

@ -374,7 +374,7 @@ static void i82801ix_lock_smm(struct device *dev)
u8 reg8; u8 reg8;
#endif #endif
if (acpi_slp_type != 3) { if (!acpi_is_wakeup_s3()) {
#if ENABLE_ACPI_MODE_IN_COREBOOT #if ENABLE_ACPI_MODE_IN_COREBOOT
printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n"); printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n");
outb(APM_CNT_ACPI_ENABLE, APM_CNT); // Enable ACPI mode outb(APM_CNT_ACPI_ENABLE, APM_CNT); // Enable ACPI mode

View File

@ -438,7 +438,7 @@ static void pch_lock_smm(struct device *dev)
u8 reg8; u8 reg8;
#endif #endif
if (acpi_slp_type != 3) { if (!acpi_is_wakeup_s3()) {
#if ENABLE_ACPI_MODE_IN_COREBOOT #if ENABLE_ACPI_MODE_IN_COREBOOT
printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n"); printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n");
outb(0xe1, 0xb2); // Enable ACPI mode outb(0xe1, 0xb2); // Enable ACPI mode

View File

@ -436,12 +436,9 @@ static me_bios_path intel_me_path(device_t dev)
struct me_hfs hfs; struct me_hfs hfs;
struct me_gmes gmes; struct me_gmes gmes;
#if CONFIG_HAVE_ACPI_RESUME
/* S3 wake skips all MKHI messages */ /* S3 wake skips all MKHI messages */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3())
return ME_S3WAKE_BIOS_PATH; return ME_S3WAKE_BIOS_PATH;
}
#endif
pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS); pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS);
pci_read_dword_ptr(dev, &gmes, PCI_ME_GMES); pci_read_dword_ptr(dev, &gmes, PCI_ME_GMES);

View File

@ -161,7 +161,7 @@ void pch_log_state(void)
/* ACPI Wake */ /* ACPI Wake */
if (pm1_sts & (1 << 15)) if (pm1_sts & (1 << 15))
elog_add_event_byte(ELOG_TYPE_ACPI_WAKE, elog_add_event_byte(ELOG_TYPE_ACPI_WAKE,
acpi_slp_type == 3 ? 3 : 5); acpi_is_wakeup_s3() ? 3 : 5);
/* /*
* Wake sources * Wake sources

View File

@ -499,7 +499,7 @@ static void enable_lp_clock_gating(device_t dev)
static void pch_set_acpi_mode(void) static void pch_set_acpi_mode(void)
{ {
#if CONFIG_HAVE_SMI_HANDLER #if CONFIG_HAVE_SMI_HANDLER
if (acpi_slp_type != 3) { if (!acpi_is_wakeup_s3()) {
#if ENABLE_ACPI_MODE_IN_COREBOOT #if ENABLE_ACPI_MODE_IN_COREBOOT
printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n"); printk(BIOS_DEBUG, "Enabling ACPI via APMC:\n");
outb(APM_CNT_ACPI_ENABLE, APM_CNT); outb(APM_CNT_ACPI_ENABLE, APM_CNT);
@ -716,7 +716,7 @@ static void pch_lpc_read_resources(device_t dev)
/* Allocate ACPI NVS in CBMEM */ /* Allocate ACPI NVS in CBMEM */
gnvs = cbmem_add(CBMEM_ID_ACPI_GNVS, sizeof(global_nvs_t)); gnvs = cbmem_add(CBMEM_ID_ACPI_GNVS, sizeof(global_nvs_t));
if (acpi_slp_type != 3 && gnvs) if (!acpi_is_wakeup_s3() && gnvs)
memset(gnvs, 0, sizeof(global_nvs_t)); memset(gnvs, 0, sizeof(global_nvs_t));
} }

View File

@ -878,13 +878,11 @@ static struct pci_operations pci_ops = {
static void intel_me_enable(device_t dev) static void intel_me_enable(device_t dev)
{ {
#if CONFIG_HAVE_ACPI_RESUME
/* Avoid talking to the device in S3 path */ /* Avoid talking to the device in S3 path */
if (acpi_slp_type == 3) { if (acpi_is_wakeup_s3()) {
dev->enabled = 0; dev->enabled = 0;
pch_disable_devfn(dev); pch_disable_devfn(dev);
} }
#endif
} }
static struct device_operations device_ops = { static struct device_operations device_ops = {

View File

@ -394,11 +394,9 @@ static void usb_xhci_init(device_t dev)
reg32 |= (1 << 31); reg32 |= (1 << 31);
pci_write_config32(dev, 0x40, reg32); pci_write_config32(dev, 0x40, reg32);
#if CONFIG_HAVE_ACPI_RESUME
/* Enable ports that are disabled before returning to OS */ /* Enable ports that are disabled before returning to OS */
if (acpi_slp_type == 3) if (acpi_is_wakeup_s3())
usb_xhci_enable_ports_usb3(dev); usb_xhci_enable_ports_usb3(dev);
#endif
} }
static void usb_xhci_set_subsystem(device_t dev, unsigned vendor, static void usb_xhci_set_subsystem(device_t dev, unsigned vendor,