coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
generic.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/device.h>
4 #include <device/pci.h>
5 #include <device/pci_def.h>
6 #include <device/pci_ids.h>
7 #include <elog.h>
8 #include "chip.h"
9 #include "wifi_private.h"
10 #include "wifi.h"
11 
12 static void wifi_pci_dev_init(struct device *dev)
13 {
16 }
17 
20  .set_resources = pci_dev_set_resources,
21  .enable_resources = pci_dev_enable_resources,
22  .init = wifi_pci_dev_init,
23  .ops_pci = &pci_dev_ops_pci,
24  .scan_bus = scan_static_bus,
25 #if CONFIG(HAVE_ACPI_TABLES)
26  .acpi_name = wifi_pcie_acpi_name,
27  .acpi_fill_ssdt = wifi_pcie_fill_ssdt,
28 #endif
29 #if CONFIG(GENERATE_SMBIOS_TABLES)
30  .get_smbios_data = smbios_write_wifi_pcie,
31 #endif
32 };
33 
36  .set_resources = noop_set_resources,
37 #if CONFIG(HAVE_ACPI_TABLES)
38  .acpi_fill_ssdt = wifi_cnvi_fill_ssdt,
39 #endif
40 #if CONFIG(GENERATE_SMBIOS_TABLES)
41  .get_smbios_data = smbios_write_wifi_cnvi,
42 #endif
43 };
44 
47  .set_resources = noop_set_resources,
48 };
49 
50 static bool is_cnvi(const struct device *dev)
51 {
52  return dev && dev->path.type != DEVICE_PATH_PCI;
53 }
54 
56 {
57  const struct drivers_wifi_generic_config *config;
58 
59  if (!dev || !is_cnvi(dev) || !dev->chip_info)
60  return false;
61 
62  config = dev->chip_info;
63  return config->enable_cnvi_ddr_rfim;
64 }
65 
66 static void wifi_generic_enable(struct device *dev)
67 {
68 #if !DEVTREE_EARLY
69  const struct device *parent = dev->bus->dev;
70  if (parent && parent->ops == &wifi_pcie_ops)
71  dev->ops = &wifi_generic_ops;
72  else
73  dev->ops = &wifi_cnvi_ops;
74 #endif
75 }
76 
78  CHIP_NAME("WIFI Device")
79  .enable_dev = wifi_generic_enable
80 };
81 
82 static const unsigned short intel_pci_device_ids[] = {
101  /* Wilkins Peak 2 */
104  /* Stone Peak 2 */
107  /* Stone Field Peak */
110  /* Windstorm Peak */
112  /* Thunder Peak 2 */
114  /* Cyclone Peak */
116  /* Typhoon Peak */
118  /* Garfield Peak */
121  0
122 };
123 
124 /*
125  * The PCI driver is retained for backward compatibility with boards that never utilized the
126  * chip driver to support Intel WiFi device. For these devices, the PCI driver helps perform the
127  * same operations as above (except exposing the wake property) by utilizing the same
128  * `wifi_generic_ops`.
129  */
130 static const struct pci_driver intel_wifi_pci_driver __pci_driver = {
131  .ops = &wifi_pcie_ops,
132  .vendor = PCI_VID_INTEL,
133  .devices = intel_pci_device_ids,
134 };
#define ELOG_WAKE_SOURCE_PME_WIFI
Definition: elog.h:182
int elog_add_event_wake(u8 source, u32 instance)
Definition: elog.c:883
void wifi_cnvi_fill_ssdt(const struct device *dev)
Definition: acpi.c:644
const char * wifi_pcie_acpi_name(const struct device *dev)
Definition: acpi.c:634
void wifi_pcie_fill_ssdt(const struct device *dev)
Definition: acpi.c:620
static const struct pci_driver intel_wifi_pci_driver __pci_driver
Definition: generic.c:130
bool wifi_generic_cnvi_ddr_rfim_enabled(const struct device *dev)
Definition: generic.c:55
static void wifi_generic_enable(struct device *dev)
Definition: generic.c:66
static bool is_cnvi(const struct device *dev)
Definition: generic.c:50
static const unsigned short intel_pci_device_ids[]
Definition: generic.c:82
struct device_operations wifi_pcie_ops
Definition: generic.c:18
static void wifi_pci_dev_init(struct device *dev)
Definition: generic.c:12
struct chip_operations drivers_wifi_generic_ops
Definition: generic.c:77
struct device_operations wifi_cnvi_ops
Definition: generic.c:34
struct device_operations wifi_generic_ops
Definition: generic.c:45
int smbios_write_wifi_pcie(struct device *dev, int *handle, unsigned long *current)
Definition: smbios.c:32
int smbios_write_wifi_cnvi(struct device *dev, int *handle, unsigned long *current)
Definition: smbios.c:39
#define CHIP_NAME(X)
Definition: device.h:32
static void noop_read_resources(struct device *dev)
Standard device operations function pointers shims.
Definition: device.h:73
static void noop_set_resources(struct device *dev)
Definition: device.h:74
enum board_config config
Definition: memory.c:448
@ DEVICE_PATH_PCI
Definition: path.h:9
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
struct pci_operations pci_dev_ops_pci
Default device operation for PCI devices.
Definition: pci_device.c:911
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
#define PCI_DID_0135_SERIES_WIFI
Definition: pci_ids.h:4351
#define PCI_DID_6000_SERIES_WIFI
Definition: pci_ids.h:4356
#define PCI_DID_6005_I_SERIES_WIFI
Definition: pci_ids.h:4344
#define PCI_DID_WP_7260_SERIES_1_WIFI
Definition: pci_ids.h:4360
#define PCI_DID_GrP_6SERIES_2_WIFI
Definition: pci_ids.h:4371
#define PCI_DID_6150_SERIES_WIFI
Definition: pci_ids.h:4348
#define PCI_DID_5300_SERIES_WIFI
Definition: pci_ids.h:4354
#define PCI_DID_SFP_8260_SERIES_1_WIFI
Definition: pci_ids.h:4364
#define PCI_DID_6030_I_SERIES_WIFI
Definition: pci_ids.h:4346
#define PCI_DID_GrP_6SERIES_1_WIFI
Definition: pci_ids.h:4370
#define PCI_DID_1000_SERIES_WIFI
Definition: pci_ids.h:4342
#define PCI_DID_6000_I_SERIES_WIFI
Definition: pci_ids.h:4357
#define PCI_DID_2030_SERIES_WIFI
Definition: pci_ids.h:4349
#define PCI_DID_6005_SERIES_WIFI
Definition: pci_ids.h:4343
#define PCI_DID_2000_SERIES_WIFI
Definition: pci_ids.h:4350
#define PCI_DID_CyP_6SERIES_WIFI
Definition: pci_ids.h:4368
#define PCI_DID_SP_7265_SERIES_1_WIFI
Definition: pci_ids.h:4362
#define PCI_DID_TyP_6SERIES_WIFI
Definition: pci_ids.h:4369
#define PCI_DID_WSP_8275_SERIES_1_WIFI
Definition: pci_ids.h:4366
#define PCI_DID_0105_SERIES_WIFI
Definition: pci_ids.h:4352
#define PCI_DID_6035_SERIES_WIFI
Definition: pci_ids.h:4353
#define PCI_DID_TP_9260_SERIES_WIFI
Definition: pci_ids.h:4367
#define PCI_DID_5350_SERIES_WIFI
Definition: pci_ids.h:4358
#define PCI_DID_WP_7260_SERIES_2_WIFI
Definition: pci_ids.h:4361
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
#define PCI_DID_5100_SERIES_WIFI
Definition: pci_ids.h:4355
#define PCI_DID_SP_7265_SERIES_2_WIFI
Definition: pci_ids.h:4363
#define PCI_DID_1030_SERIES_WIFI
Definition: pci_ids.h:4345
#define PCI_DID_SFP_8260_SERIES_2_WIFI
Definition: pci_ids.h:4365
#define PCI_DID_6030_SERIES_WIFI
Definition: pci_ids.h:4347
#define PCI_DID_5150_SERIES_WIFI
Definition: pci_ids.h:4359
bool pci_dev_is_wake_source(pci_devfn_t dev)
Definition: pci_ops.c:82
#define PCI_BDF(dev)
Definition: pci_type.h:28
void scan_static_bus(struct device *bus)
Definition: root_device.c:89
DEVTREE_CONST struct device * dev
Definition: device.h:78
void(* read_resources)(struct device *dev)
Definition: device.h:39
enum device_path_type type
Definition: path.h:114
Definition: device.h:107
struct device_path path
Definition: device.h:115
struct device_operations * ops
Definition: device.h:143
DEVTREE_CONST struct bus * bus
Definition: device.h:108
DEVTREE_CONST void * chip_info
Definition: device.h:164
struct drivers_wifi_generic_config - Data structure to contain generic wifi config @wake: Wake pin fo...
Definition: chip.h:10