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>
This commit is contained in:
Naresh G Solanki 2017-07-03 21:57:11 +05:30 committed by Martin Roth
parent b9810a4cd6
commit 3c6377fb4f
2 changed files with 18 additions and 1 deletions

View File

@ -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

View File

@ -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;