Files
system76-coreboot/src/drivers/wifi/generic/generic.c
Tim Wawrzynczak 93982c3a6e device: Switch pci_dev_is_wake_source to take pci_devfn_t
With the recent switch to SMM module loader v2, the size of the SMM for
module google/volteer increased to above 64K in size, and thus failed to
install the permanent SMM handler. Turns out, the devicetree is all
pulled into the SMM build because of elog, which calls
`pci_dev_is_wake_source`, and is the only user of `struct device` in
SMM. Changing this function to take a pci_devfn_t instead allows the
linker to remove almost the entire devicetree from SMM (only usage left
is when disabling HECI via SMM).

BUG=b:186661594
TEST=Verify loaded program size of `smm.elf` for google/volteer is
almost ~50% smaller.

Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Change-Id: I4c39e5188321c8711d6479b15065e5aaedad8f38
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52765
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
2021-05-03 16:28:42 +00:00

114 lines
3.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_def.h>
#include <device/pci_ids.h>
#include <elog.h>
#include "chip.h"
#include "wifi_private.h"
static void wifi_pci_dev_init(struct device *dev)
{
if (pci_dev_is_wake_source(PCI_BDF(dev)))
elog_add_event_wake(ELOG_WAKE_SOURCE_PME_WIFI, 0);
}
struct device_operations wifi_pcie_ops = {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = wifi_pci_dev_init,
.ops_pci = &pci_dev_ops_pci,
#if CONFIG(HAVE_ACPI_TABLES)
.acpi_name = wifi_pcie_acpi_name,
.acpi_fill_ssdt = wifi_pcie_fill_ssdt,
#endif
#if CONFIG(GENERATE_SMBIOS_TABLES)
.get_smbios_data = smbios_write_wifi_pcie,
#endif
};
struct device_operations wifi_cnvi_ops = {
.read_resources = noop_read_resources,
.set_resources = noop_set_resources,
#if CONFIG(HAVE_ACPI_TABLES)
.acpi_fill_ssdt = wifi_cnvi_fill_ssdt,
#endif
#if CONFIG(GENERATE_SMBIOS_TABLES)
.get_smbios_data = smbios_write_wifi_cnvi,
#endif
};
static void wifi_generic_enable(struct device *dev)
{
struct drivers_wifi_generic_config *config = dev ? dev->chip_info : NULL;
if (!config)
return;
if (dev->path.type == DEVICE_PATH_PCI)
dev->ops = &wifi_pcie_ops;
else
dev->ops = &wifi_cnvi_ops;
}
struct chip_operations drivers_wifi_generic_ops = {
CHIP_NAME("WIFI Device")
.enable_dev = wifi_generic_enable
};
static const unsigned short intel_pci_device_ids[] = {
PCI_DEVICE_ID_1000_SERIES_WIFI,
PCI_DEVICE_ID_6005_SERIES_WIFI,
PCI_DEVICE_ID_6005_I_SERIES_WIFI,
PCI_DEVICE_ID_1030_SERIES_WIFI,
PCI_DEVICE_ID_6030_I_SERIES_WIFI,
PCI_DEVICE_ID_6030_SERIES_WIFI,
PCI_DEVICE_ID_6150_SERIES_WIFI,
PCI_DEVICE_ID_2030_SERIES_WIFI,
PCI_DEVICE_ID_2000_SERIES_WIFI,
PCI_DEVICE_ID_0135_SERIES_WIFI,
PCI_DEVICE_ID_0105_SERIES_WIFI,
PCI_DEVICE_ID_6035_SERIES_WIFI,
PCI_DEVICE_ID_5300_SERIES_WIFI,
PCI_DEVICE_ID_5100_SERIES_WIFI,
PCI_DEVICE_ID_6000_SERIES_WIFI,
PCI_DEVICE_ID_6000_I_SERIES_WIFI,
PCI_DEVICE_ID_5350_SERIES_WIFI,
PCI_DEVICE_ID_5150_SERIES_WIFI,
/* Wilkins Peak 2 */
PCI_DEVICE_ID_WP_7260_SERIES_1_WIFI,
PCI_DEVICE_ID_WP_7260_SERIES_2_WIFI,
/* Stone Peak 2 */
PCI_DEVICE_ID_SP_7265_SERIES_1_WIFI,
PCI_DEVICE_ID_SP_7265_SERIES_2_WIFI,
/* Stone Field Peak */
PCI_DEVICE_ID_SFP_8260_SERIES_1_WIFI,
PCI_DEVICE_ID_SFP_8260_SERIES_2_WIFI,
/* Windstorm Peak */
PCI_DEVICE_ID_WSP_8275_SERIES_1_WIFI,
/* Thunder Peak 2 */
PCI_DEVICE_ID_TP_9260_SERIES_WIFI,
/* Cyclone Peak */
PCI_DEVICE_ID_CyP_6SERIES_WIFI,
/* Typhoon Peak */
PCI_DEVICE_ID_TyP_6SERIES_WIFI,
/* Garfield Peak */
PCI_DEVICE_ID_GrP_6SERIES_1_WIFI,
PCI_DEVICE_ID_GrP_6SERIES_2_WIFI,
0
};
/*
* The PCI driver is retained for backward compatibility with boards that never utilized the
* chip driver to support Intel WiFi device. For these devices, the PCI driver helps perform the
* same operations as above (except exposing the wake property) by utilizing the same
* `wifi_generic_ops`.
*/
static const struct pci_driver intel_wifi_pci_driver __pci_driver = {
.ops = &wifi_pcie_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.devices = intel_pci_device_ids,
};