summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaresh G Solanki <naresh.solanki@intel.com>2017-07-03 21:57:11 +0530
committerMartin Roth <martinroth@google.com>2017-07-28 16:27:18 +0000
commit3c6377fb4fcdff89e1509e9eeab7ce563dc45053 (patch)
tree565b598d66ebbaa2848fdf5f93ea9f35446a30b4
parentb9810a4cd6ec082eaab476540324ae927cae1b53 (diff)
downloadcoreboot-3c6377fb4fcdff89e1509e9eeab7ce563dc45053.tar.xz
driver/intel/wifi: Update wifi wake source in elog
In S3 resume, wifi is one of the wake sources. If elog is enabled in config, then log wifi wakes in elog. BUG=b:36992859 TEST= Build for Soraka. Do WoWlan during S3. Verify elog having update on wake due to Wifi. Change-Id: I7d42c5c81e0a3f7a3f94c3f6b7d2ebdf029d1aff Signed-off-by: Naresh G Solanki <naresh.solanki@intel.com> Reviewed-on: https://review.coreboot.org/20455 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--src/drivers/intel/wifi/wifi.c18
-rw-r--r--src/include/elog.h1
2 files changed, 18 insertions, 1 deletions
diff --git a/src/drivers/intel/wifi/wifi.c b/src/drivers/intel/wifi/wifi.c
index 91c21fecff..d1d5684a19 100644
--- a/src/drivers/intel/wifi/wifi.c
+++ b/src/drivers/intel/wifi/wifi.c
@@ -21,12 +21,16 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
+#include <elog.h>
#include <sar.h>
#include <smbios.h>
#include <string.h>
#include <wrdd.h>
#include "chip.h"
+#define PMCS_DR 0xcc
+#define PME_STS (1 << 15)
+
#if IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLES)
static int smbios_write_wifi(struct device *dev, int *handle,
unsigned long *current)
@@ -197,6 +201,18 @@ static const char *intel_wifi_acpi_name(struct device *dev)
}
#endif
+static void wifi_pci_dev_init(struct device *dev)
+{
+ pci_dev_init(dev);
+
+ if (IS_ENABLED(CONFIG_ELOG)) {
+ uint32_t val;
+ val = pci_read_config16(dev, PMCS_DR);
+ if (val & PME_STS)
+ elog_add_event_wake(ELOG_WAKE_SOURCE_PME_WIFI, 0);
+ }
+}
+
static struct pci_operations pci_ops = {
.set_subsystem = pci_dev_set_subsystem,
};
@@ -205,7 +221,7 @@ struct device_operations device_ops = {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
- .init = pci_dev_init,
+ .init = wifi_pci_dev_init,
#if IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLES)
.get_smbios_data = smbios_write_wifi,
#endif
diff --git a/src/include/elog.h b/src/include/elog.h
index 57e278e151..bab7eb0594 100644
--- a/src/include/elog.h
+++ b/src/include/elog.h
@@ -149,6 +149,7 @@
#define ELOG_WAKE_SOURCE_PME_XDCI 0x1c
#define ELOG_WAKE_SOURCE_PME_XHCI_USB_2 0x1d
#define ELOG_WAKE_SOURCE_PME_XHCI_USB_3 0x1e
+#define ELOG_WAKE_SOURCE_PME_WIFI 0x1f
struct elog_event_data_wake {
u8 source;