drivers/intel/wifi: Use newly added pci_dev_is_wake_source

This change uses the newly added `pci_dev_is_wake_source()` helper function
to determine and log WiFi wake source instead of assuming a hard-coded
register value to check. This is done in preparation to merge the
generic WiFi and Intel WiFi drivers in coreboot in follow-up changes.

BUG=b:169802515
BRANCH=zork

Change-Id: I9bdb453092b4ce7bdab2969f13e0c0aa8166dc0a
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/46031
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Rob Barnes <robbarnes@google.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Furquan Shaikh 2020-10-03 16:29:12 -07:00
parent 494f319be7
commit 59a863e14a
1 changed files with 2 additions and 9 deletions

View File

@ -10,9 +10,6 @@
#include "chip.h" #include "chip.h"
#include "drivers/wifi/generic/chip.h" #include "drivers/wifi/generic/chip.h"
#define PMCS_DR 0xcc
#define PME_STS (1 << 15)
#if CONFIG(GENERATE_SMBIOS_TABLES) #if CONFIG(GENERATE_SMBIOS_TABLES)
static int smbios_write_wifi(struct device *dev, int *handle, static int smbios_write_wifi(struct device *dev, int *handle,
unsigned long *current) unsigned long *current)
@ -63,13 +60,9 @@ static void intel_wifi_fill_ssdt(const struct device *dev)
static void wifi_pci_dev_init(struct device *dev) static void wifi_pci_dev_init(struct device *dev)
{ {
if (CONFIG(ELOG)) { if (pci_dev_is_wake_source(dev))
uint32_t val;
val = pci_read_config16(dev, PMCS_DR);
if (val & PME_STS)
elog_add_event_wake(ELOG_WAKE_SOURCE_PME_WIFI, 0); elog_add_event_wake(ELOG_WAKE_SOURCE_PME_WIFI, 0);
} }
}
struct device_operations device_ops = { struct device_operations device_ops = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,