Naresh Solanki has uploaded this change for review. ( https://review.coreboot.org/20455
Change subject: driver/intel/wifi: elog wifi wake source ......................................................................
driver/intel/wifi: elog wifi wake source
During S3 resume, if wifi is wake source then put it in elog if enabled in config.
Change-Id: I7d42c5c81e0a3f7a3f94c3f6b7d2ebdf029d1aff Signed-off-by: Naresh G Solanki naresh.solanki@intel.com --- M src/drivers/intel/wifi/wifi.c M src/include/elog.h 2 files changed, 30 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/55/20455/1
diff --git a/src/drivers/intel/wifi/wifi.c b/src/drivers/intel/wifi/wifi.c index a71f014..1fa3869 100644 --- a/src/drivers/intel/wifi/wifi.c +++ b/src/drivers/intel/wifi/wifi.c @@ -20,11 +20,15 @@ #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, @@ -196,6 +200,30 @@ } #endif
+static void wifi_pci_dev_init(struct device *dev) +{ + + pci_dev_init(dev); + +#if IS_ENABLED(CONFIG_ELOG) + + size_t j; + uint32_t val; + for ( j = 0 ; j < 0xff ; j+=4 ) { + if ( (j% 0x10) == 0 ) + printk(BIOS_DEBUG, "\n"); + val = pci_read_config32(dev, j); + printk(BIOS_DEBUG, "\t0x%08X", val); + } + printk(BIOS_DEBUG,"\n"); + + val = pci_read_config16(dev, PMCS_DR); + if ( val & PME_STS ) + elog_add_event_wake(ELOG_WAKE_SOURCE_PME_WIFI, 0); +#endif + +} + static struct pci_operations pci_ops = { .set_subsystem = pci_dev_set_subsystem, }; @@ -204,7 +232,7 @@ .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 c960186..9cb5b7c 100644 --- a/src/include/elog.h +++ b/src/include/elog.h @@ -147,6 +147,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;