Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/intel/wifi: Change to PCI driver only ......................................................................
drivers/intel/wifi: Change to PCI driver only
Currently, drivers/intel/wifi is a PCI driver (provides `struct pci_driver`) as well as a chip driver (provids `struct chip_operations`). However, there is no need for a separate chip driver for the WiFi device since drivers/wifi/generic already provides one.
Having two separate chip drivers makes it difficult to multi-source WiFi devices and share the same firmware target without having to add a probe property for each of these devices. This is unnecessary since the WiFi driver in coreboot is primarily responsible for: 1. PCI resource allocation 2. ACPI SSDT node generation to expose wake property and SAR tables 3. SMBIOS table generation
For the most part, coreboot can perform the above operations without really caring about the specifics of which WiFi device is being used by the mainboard. Thus, this change drops the chip driver from drivers/intel/wifi and retains only the PCI driver. 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` exposed by drivers/wifi/generic.
BUG=b:169802515 BRANCH=zork
Change-Id: I780a7d1a87f387d5e01e6b35aac7cca31a2033ac Signed-off-by: Furquan Shaikh furquan@google.com --- M src/drivers/intel/wifi/Kconfig D src/drivers/intel/wifi/chip.h M src/drivers/intel/wifi/wifi.c M src/drivers/wifi/generic/generic.c 4 files changed, 5 insertions(+), 95 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/46036/1
diff --git a/src/drivers/intel/wifi/Kconfig b/src/drivers/intel/wifi/Kconfig index 83df822..5454e97 100644 --- a/src/drivers/intel/wifi/Kconfig +++ b/src/drivers/intel/wifi/Kconfig @@ -2,7 +2,7 @@ bool "Support Intel PCI-e WiFi adapters" depends on PCI default y if PCIEXP_PLUGIN_SUPPORT - select DRIVERS_WIFI_GENERIC if HAVE_ACPI_TABLES + select DRIVERS_WIFI_GENERIC help When enabled, add identifiers in ACPI and SMBIOS tables to make OS drivers work with certain Intel PCI-e WiFi chipsets. diff --git a/src/drivers/intel/wifi/chip.h b/src/drivers/intel/wifi/chip.h deleted file mode 100644 index 966573f..0000000 --- a/src/drivers/intel/wifi/chip.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#ifndef _INTEL_WIFI_CHIP_H_ -#define _INTEL_WIFI_CHIP_H_ - -struct drivers_intel_wifi_config { - unsigned int wake; /* Wake pin for ACPI _PRW */ -}; - -#endif /* _INTEL_WIFI_CHIP_H_ */ diff --git a/src/drivers/intel/wifi/wifi.c b/src/drivers/intel/wifi/wifi.c index 6010673..9674130 100644 --- a/src/drivers/intel/wifi/wifi.c +++ b/src/drivers/intel/wifi/wifi.c @@ -1,80 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
-#include <device/device.h> #include <device/pci.h> -#include <device/pci_ops.h> #include <device/pci_ids.h> -#include <elog.h> -#include <smbios.h> -#include <string.h> -#include "chip.h" -#include "drivers/wifi/generic/chip.h" - -#if CONFIG(GENERATE_SMBIOS_TABLES) -static int smbios_write_wifi(struct device *dev, int *handle, - unsigned long *current) -{ - struct smbios_type_intel_wifi { - u8 type; - u8 length; - u16 handle; - u8 str; - u8 eos[2]; - } __packed; - - struct smbios_type_intel_wifi *t = - (struct smbios_type_intel_wifi *)*current; - int len = sizeof(struct smbios_type_intel_wifi); - - memset(t, 0, sizeof(struct smbios_type_intel_wifi)); - t->type = 0x85; - t->length = len - 2; - t->handle = *handle; - /* - * Intel wifi driver expects this string to be in the table 0x85 - * with PCI IDs enumerated below. - */ - t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII"); - - len = t->length + smbios_string_table_len(t->eos); - *current += len; - *handle += 1; - return len; -} -#endif - -#if CONFIG(HAVE_ACPI_TABLES) -static void intel_wifi_fill_ssdt(const struct device *dev) -{ - struct drivers_intel_wifi_config *config = dev->chip_info; - struct drivers_wifi_generic_config generic_config; - - if (config) - generic_config.wake = config->wake; - - wifi_generic_fill_ssdt(dev, config ? &generic_config : NULL); -} -#endif - -static void wifi_pci_dev_init(struct device *dev) -{ - pci_dev_log_wake(dev, ELOG_WAKE_SOURCE_PME_WIFI, 0); -} - -struct device_operations device_ops = { - .read_resources = pci_dev_read_resources, - .set_resources = pci_dev_set_resources, - .enable_resources = pci_dev_enable_resources, - .init = wifi_pci_dev_init, -#if CONFIG(GENERATE_SMBIOS_TABLES) - .get_smbios_data = smbios_write_wifi, -#endif - .ops_pci = &pci_dev_ops_pci, -#if CONFIG(HAVE_ACPI_TABLES) - .acpi_name = wifi_generic_acpi_name, - .acpi_fill_ssdt = intel_wifi_fill_ssdt, -#endif -};
static const unsigned short pci_device_ids[] = { PCI_DEVICE_ID_1000_SERIES_WIFI, @@ -128,18 +55,10 @@ 0 };
+extern struct device_operations wifi_generic_ops; + static const struct pci_driver pch_intel_wifi __pci_driver = { - .ops = &device_ops, + .ops = &wifi_generic_ops, .vendor = PCI_VENDOR_ID_INTEL, .devices = pci_device_ids, }; - -static void intel_wifi_enable(struct device *dev) -{ - dev->ops = &device_ops; -} - -struct chip_operations drivers_intel_wifi_ops = { - CHIP_NAME("Intel WiFi") - .enable_dev = intel_wifi_enable -}; diff --git a/src/drivers/wifi/generic/generic.c b/src/drivers/wifi/generic/generic.c index 0fb4dc5..b515f3c 100644 --- a/src/drivers/wifi/generic/generic.c +++ b/src/drivers/wifi/generic/generic.c @@ -6,6 +6,7 @@ #include <device/device.h> #include <device/pci.h> #include <device/pci_def.h> +#include <device/pci_ids.h> #include <elog.h> #include <sar.h> #include <smbios.h>
Rob Barnes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/intel/wifi: Change to PCI driver only ......................................................................
Patch Set 1: Code-Review+1
(1 comment)
https://review.coreboot.org/c/coreboot/+/46036/1/src/drivers/intel/wifi/Kcon... File src/drivers/intel/wifi/Kconfig:
https://review.coreboot.org/c/coreboot/+/46036/1/src/drivers/intel/wifi/Kcon... PS1, Line 5: select DRIVERS_WIFI_GENERIC if HAVE_ACPI_TABLES Should this be part of CB:46037 instead
Hello build bot (Jenkins), Duncan Laurie, Rob Barnes, Patrick Rudolph, Karthik Ramasubramanian,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46036
to look at the new patch set (#2).
Change subject: drivers/intel/wifi: Change to PCI driver only ......................................................................
drivers/intel/wifi: Change to PCI driver only
Currently, drivers/intel/wifi is a PCI driver (provides `struct pci_driver`) as well as a chip driver (provids `struct chip_operations`). However, there is no need for a separate chip driver for the WiFi device since drivers/wifi/generic already provides one.
Having two separate chip drivers makes it difficult to multi-source WiFi devices and share the same firmware target without having to add a probe property for each of these devices. This is unnecessary since the WiFi driver in coreboot is primarily responsible for: 1. PCI resource allocation 2. ACPI SSDT node generation to expose wake property and SAR tables 3. SMBIOS table generation
For the most part, coreboot can perform the above operations without really caring about the specifics of which WiFi device is being used by the mainboard. Thus, this change drops the chip driver from drivers/intel/wifi and retains only the PCI driver. 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` exposed by drivers/wifi/generic.
BUG=b:169802515 BRANCH=zork
Change-Id: I780a7d1a87f387d5e01e6b35aac7cca31a2033ac Signed-off-by: Furquan Shaikh furquan@google.com --- D src/drivers/intel/wifi/chip.h M src/drivers/intel/wifi/wifi.c 2 files changed, 3 insertions(+), 95 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/46036/2
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/intel/wifi: Change to PCI driver only ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46036/1/src/drivers/intel/wifi/Kcon... File src/drivers/intel/wifi/Kconfig:
https://review.coreboot.org/c/coreboot/+/46036/1/src/drivers/intel/wifi/Kcon... PS1, Line 5: select DRIVERS_WIFI_GENERIC if HAVE_ACPI_TABLES
Should this be part of CB:46037 instead
Done
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/intel/wifi: Change to PCI driver only ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46036/3/src/drivers/intel/wifi/wifi... File src/drivers/intel/wifi/wifi.c:
https://review.coreboot.org/c/coreboot/+/46036/3/src/drivers/intel/wifi/wifi... PS3, Line 58: wifi_generic_ops could the required functions in this be exported from the other driver instead? and then this could have its own device_operations that uses those?
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/intel/wifi: Change to PCI driver only ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46036/3/src/drivers/intel/wifi/wifi... File src/drivers/intel/wifi/wifi.c:
https://review.coreboot.org/c/coreboot/+/46036/3/src/drivers/intel/wifi/wifi... PS3, Line 58: wifi_generic_ops
could the required functions in this be exported from the other driver instead? and then this could […]
The device operations are going to be exactly the same as for wifi_generic_ops. The reason why I did not create a new device_operations here is: 1. to avoid the overhead of keeping both structures in sync. 2. to ensure that irrespective of whether the Intel WiFi devices use chip driver or PCI driver, the handling is going through the same device ops structure.
Ideally we could move this pci_driver into drivers/generic/wifi, but I am not sure if we want to add all the Intel PCI IDs in the generic/wifi driver.
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/intel/wifi: Change to PCI driver only ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46036/3/src/drivers/intel/wifi/wifi... File src/drivers/intel/wifi/wifi.c:
https://review.coreboot.org/c/coreboot/+/46036/3/src/drivers/intel/wifi/wifi... PS3, Line 58: wifi_generic_ops
Ideally we could move this pci_driver into drivers/generic/wifi, but I am not sure if we want to add all the Intel PCI IDs in the generic/wifi driver.
IMHO that is cleaner than leaving these externs, and it's still semantically correct, the Intel wifi chips still use the machinery from the generic/wifi driver.
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/intel/wifi: Change to PCI driver only ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46036/3/src/drivers/intel/wifi/wifi... File src/drivers/intel/wifi/wifi.c:
https://review.coreboot.org/c/coreboot/+/46036/3/src/drivers/intel/wifi/wifi... PS3, Line 58: wifi_generic_ops
[…]
Okay. I can move this into the drivers/generic/wifi.
Hello build bot (Jenkins), Tim Wawrzynczak, Duncan Laurie, Rob Barnes, Patrick Rudolph, Karthik Ramasubramanian,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46036
to look at the new patch set (#4).
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver
Currently, drivers/intel/wifi is a PCI driver (provides `struct pci_driver`) as well as a chip driver (provides `struct chip_operations`). However, there is no need for a separate chip driver for the WiFi device since drivers/wifi/generic already provides one.
Having two separate chip drivers makes it difficult to multi-source WiFi devices and share the same firmware target without having to add a probe property for each of these devices. This is unnecessary since the WiFi driver in coreboot is primarily responsible for: 1. PCI resource allocation 2. ACPI SSDT node generation to expose wake property and SAR tables 3. SMBIOS table generation
For the most part, coreboot can perform the above operations without really caring about the specifics of which WiFi device is being used by the mainboard. Thus, this change drops the driver for intel/wifi and moves the PCI driver support required for Intel WiFi chips into drivers/wifi/generic. 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`.
This change also moves DRIVERS_INTEL_WIFI config to wifi/generic/Kconfig.
BUG=b:169802515 BRANCH=zork
Change-Id: I780a7d1a87f387d5e01e6b35aac7cca31a2033ac Signed-off-by: Furquan Shaikh furquan@google.com --- D src/drivers/intel/wifi/Kconfig D src/drivers/intel/wifi/Makefile.inc D src/drivers/intel/wifi/chip.h D src/drivers/intel/wifi/wifi.c M src/drivers/wifi/generic/Kconfig M src/drivers/wifi/generic/generic.c 6 files changed, 67 insertions(+), 167 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/46036/4
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46036/3/src/drivers/intel/wifi/wifi... File src/drivers/intel/wifi/wifi.c:
https://review.coreboot.org/c/coreboot/+/46036/3/src/drivers/intel/wifi/wifi... PS3, Line 58: wifi_generic_ops
Okay. I can move this into the drivers/generic/wifi.
Done
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
Patch Set 6: Code-Review+2
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
Patch Set 6: Code-Review+1
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
Patch Set 7: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/46036/7/src/drivers/wifi/generic/ge... File src/drivers/wifi/generic/generic.c:
https://review.coreboot.org/c/coreboot/+/46036/7/src/drivers/wifi/generic/ge... PS7, Line 369: static const struct pci_driver intel_wifi_pci_driver __pci_driver = { : .ops = &wifi_generic_ops, : .vendor = PCI_VENDOR_ID_INTEL, : .devices = intel_pci_device_ids, : }; Let's add a comment here describing what this does. I think a short version of the last paragraph of the commit message should suffice.
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Duncan Laurie, Tim Wawrzynczak, Michael Niewöhner, Rob Barnes, Patrick Rudolph, Karthik Ramasubramanian,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46036
to look at the new patch set (#8).
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver
Currently, drivers/intel/wifi is a PCI driver (provides `struct pci_driver`) as well as a chip driver (provides `struct chip_operations`). However, there is no need for a separate chip driver for the WiFi device since drivers/wifi/generic already provides one.
Having two separate chip drivers makes it difficult to multi-source WiFi devices and share the same firmware target without having to add a probe property for each of these devices. This is unnecessary since the WiFi driver in coreboot is primarily responsible for: 1. PCI resource allocation 2. ACPI SSDT node generation to expose wake property and SAR tables 3. SMBIOS table generation
For the most part, coreboot can perform the above operations without really caring about the specifics of which WiFi device is being used by the mainboard. Thus, this change drops the driver for intel/wifi and moves the PCI driver support required for Intel WiFi chips into drivers/wifi/generic. 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`.
This change also moves DRIVERS_INTEL_WIFI config to wifi/generic/Kconfig.
BUG=b:169802515 BRANCH=zork
Change-Id: I780a7d1a87f387d5e01e6b35aac7cca31a2033ac Signed-off-by: Furquan Shaikh furquan@google.com --- D src/drivers/intel/wifi/Kconfig D src/drivers/intel/wifi/Makefile.inc D src/drivers/intel/wifi/chip.h D src/drivers/intel/wifi/wifi.c M src/drivers/wifi/generic/Kconfig M src/drivers/wifi/generic/generic.c 6 files changed, 73 insertions(+), 167 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/46036/8
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46036/7/src/drivers/wifi/generic/ge... File src/drivers/wifi/generic/generic.c:
https://review.coreboot.org/c/coreboot/+/46036/7/src/drivers/wifi/generic/ge... PS7, Line 369: static const struct pci_driver intel_wifi_pci_driver __pci_driver = { : .ops = &wifi_generic_ops, : .vendor = PCI_VENDOR_ID_INTEL, : .devices = intel_pci_device_ids, : };
Let's add a comment here describing what this does. […]
Done
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46036/8/src/drivers/wifi/generic/ge... File src/drivers/wifi/generic/generic.c:
https://review.coreboot.org/c/coreboot/+/46036/8/src/drivers/wifi/generic/ge... PS8, Line 363: Garfiled Garfield
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Tim Wawrzynczak, Duncan Laurie, Michael Niewöhner, Rob Barnes, Patrick Rudolph, Karthik Ramasubramanian,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46036
to look at the new patch set (#9).
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver
Currently, drivers/intel/wifi is a PCI driver (provides `struct pci_driver`) as well as a chip driver (provides `struct chip_operations`). However, there is no need for a separate chip driver for the WiFi device since drivers/wifi/generic already provides one.
Having two separate chip drivers makes it difficult to multi-source WiFi devices and share the same firmware target without having to add a probe property for each of these devices. This is unnecessary since the WiFi driver in coreboot is primarily responsible for: 1. PCI resource allocation 2. ACPI SSDT node generation to expose wake property and SAR tables 3. SMBIOS table generation
For the most part, coreboot can perform the above operations without really caring about the specifics of which WiFi device is being used by the mainboard. Thus, this change drops the driver for intel/wifi and moves the PCI driver support required for Intel WiFi chips into drivers/wifi/generic. 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`.
This change also moves DRIVERS_INTEL_WIFI config to wifi/generic/Kconfig.
BUG=b:169802515 BRANCH=zork
Change-Id: I780a7d1a87f387d5e01e6b35aac7cca31a2033ac Signed-off-by: Furquan Shaikh furquan@google.com --- D src/drivers/intel/wifi/Kconfig D src/drivers/intel/wifi/Makefile.inc D src/drivers/intel/wifi/chip.h D src/drivers/intel/wifi/wifi.c M src/drivers/wifi/generic/Kconfig M src/drivers/wifi/generic/generic.c 6 files changed, 73 insertions(+), 167 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/46036/9
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46036/8/src/drivers/wifi/generic/ge... File src/drivers/wifi/generic/generic.c:
https://review.coreboot.org/c/coreboot/+/46036/8/src/drivers/wifi/generic/ge... PS8, Line 363: Garfiled
Garfield
Done
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
Patch Set 9: Code-Review+2
Furquan Shaikh has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46036 )
Change subject: drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver ......................................................................
drivers/{intel/wifi,wifi/generic}: Drop separate Intel WiFi driver
Currently, drivers/intel/wifi is a PCI driver (provides `struct pci_driver`) as well as a chip driver (provides `struct chip_operations`). However, there is no need for a separate chip driver for the WiFi device since drivers/wifi/generic already provides one.
Having two separate chip drivers makes it difficult to multi-source WiFi devices and share the same firmware target without having to add a probe property for each of these devices. This is unnecessary since the WiFi driver in coreboot is primarily responsible for: 1. PCI resource allocation 2. ACPI SSDT node generation to expose wake property and SAR tables 3. SMBIOS table generation
For the most part, coreboot can perform the above operations without really caring about the specifics of which WiFi device is being used by the mainboard. Thus, this change drops the driver for intel/wifi and moves the PCI driver support required for Intel WiFi chips into drivers/wifi/generic. 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`.
This change also moves DRIVERS_INTEL_WIFI config to wifi/generic/Kconfig.
BUG=b:169802515 BRANCH=zork
Change-Id: I780a7d1a87f387d5e01e6b35aac7cca31a2033ac Signed-off-by: Furquan Shaikh furquan@google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/46036 Reviewed-by: Tim Wawrzynczak twawrzynczak@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- D src/drivers/intel/wifi/Kconfig D src/drivers/intel/wifi/Makefile.inc D src/drivers/intel/wifi/chip.h D src/drivers/intel/wifi/wifi.c M src/drivers/wifi/generic/Kconfig M src/drivers/wifi/generic/generic.c 6 files changed, 73 insertions(+), 167 deletions(-)
Approvals: build bot (Jenkins): Verified Tim Wawrzynczak: Looks good to me, approved
diff --git a/src/drivers/intel/wifi/Kconfig b/src/drivers/intel/wifi/Kconfig deleted file mode 100644 index 5454e97..0000000 --- a/src/drivers/intel/wifi/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ -config DRIVERS_INTEL_WIFI - bool "Support Intel PCI-e WiFi adapters" - depends on PCI - default y if PCIEXP_PLUGIN_SUPPORT - select DRIVERS_WIFI_GENERIC - help - When enabled, add identifiers in ACPI and SMBIOS tables to - make OS drivers work with certain Intel PCI-e WiFi chipsets. diff --git a/src/drivers/intel/wifi/Makefile.inc b/src/drivers/intel/wifi/Makefile.inc deleted file mode 100644 index 9bfdd79..0000000 --- a/src/drivers/intel/wifi/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only - -ramstage-$(CONFIG_DRIVERS_INTEL_WIFI) += wifi.c diff --git a/src/drivers/intel/wifi/chip.h b/src/drivers/intel/wifi/chip.h deleted file mode 100644 index 966573f..0000000 --- a/src/drivers/intel/wifi/chip.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#ifndef _INTEL_WIFI_CHIP_H_ -#define _INTEL_WIFI_CHIP_H_ - -struct drivers_intel_wifi_config { - unsigned int wake; /* Wake pin for ACPI _PRW */ -}; - -#endif /* _INTEL_WIFI_CHIP_H_ */ diff --git a/src/drivers/intel/wifi/wifi.c b/src/drivers/intel/wifi/wifi.c deleted file mode 100644 index 3c90dde..0000000 --- a/src/drivers/intel/wifi/wifi.c +++ /dev/null @@ -1,146 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#include <device/device.h> -#include <device/pci.h> -#include <device/pci_ops.h> -#include <device/pci_ids.h> -#include <elog.h> -#include <smbios.h> -#include <string.h> -#include "chip.h" -#include "drivers/wifi/generic/chip.h" - -#if CONFIG(GENERATE_SMBIOS_TABLES) -static int smbios_write_wifi(struct device *dev, int *handle, - unsigned long *current) -{ - struct smbios_type_intel_wifi { - u8 type; - u8 length; - u16 handle; - u8 str; - u8 eos[2]; - } __packed; - - struct smbios_type_intel_wifi *t = - (struct smbios_type_intel_wifi *)*current; - int len = sizeof(struct smbios_type_intel_wifi); - - memset(t, 0, sizeof(struct smbios_type_intel_wifi)); - t->type = 0x85; - t->length = len - 2; - t->handle = *handle; - /* - * Intel wifi driver expects this string to be in the table 0x85 - * with PCI IDs enumerated below. - */ - t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII"); - - len = t->length + smbios_string_table_len(t->eos); - *current += len; - *handle += 1; - return len; -} -#endif - -#if CONFIG(HAVE_ACPI_TABLES) -static void intel_wifi_fill_ssdt(const struct device *dev) -{ - struct drivers_intel_wifi_config *config = dev->chip_info; - struct drivers_wifi_generic_config generic_config; - - if (config) - generic_config.wake = config->wake; - - wifi_generic_fill_ssdt(dev, config ? &generic_config : NULL); -} -#endif - -static void wifi_pci_dev_init(struct device *dev) -{ - if (pci_dev_is_wake_source(dev)) - elog_add_event_wake(ELOG_WAKE_SOURCE_PME_WIFI, 0); -} - -struct device_operations device_ops = { - .read_resources = pci_dev_read_resources, - .set_resources = pci_dev_set_resources, - .enable_resources = pci_dev_enable_resources, - .init = wifi_pci_dev_init, -#if CONFIG(GENERATE_SMBIOS_TABLES) - .get_smbios_data = smbios_write_wifi, -#endif - .ops_pci = &pci_dev_ops_pci, -#if CONFIG(HAVE_ACPI_TABLES) - .acpi_name = wifi_generic_acpi_name, - .acpi_fill_ssdt = intel_wifi_fill_ssdt, -#endif -}; - -static const unsigned short 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, - /* Jefferson Peak */ - PCI_DEVICE_ID_JP_9000_SERIES_1_WIFI, - PCI_DEVICE_ID_JP_9000_SERIES_2_WIFI, - PCI_DEVICE_ID_JP_9000_SERIES_3_WIFI, - /* Thunder Peak 2 */ - PCI_DEVICE_ID_TP_9260_SERIES_WIFI, - /* Harrison Peak */ - PCI_DEVICE_ID_HrP_9560_SERIES_1_WIFI, - PCI_DEVICE_ID_HrP_9560_SERIES_2_WIFI, - PCI_DEVICE_ID_HrP_9560_SERIES_3_WIFI, - PCI_DEVICE_ID_HrP_9560_SERIES_4_WIFI, - PCI_DEVICE_ID_HrP_6SERIES_WIFI, - /* Cyclone Peak */ - PCI_DEVICE_ID_CyP_6SERIES_WIFI, - /* Typhoon Peak */ - PCI_DEVICE_ID_TyP_6SERIES_WIFI, - /* Garfiled Peak */ - PCI_DEVICE_ID_GrP_6SERIES_1_WIFI, - PCI_DEVICE_ID_GrP_6SERIES_2_WIFI, - 0 -}; - -static const struct pci_driver pch_intel_wifi __pci_driver = { - .ops = &device_ops, - .vendor = PCI_VENDOR_ID_INTEL, - .devices = pci_device_ids, -}; - -static void intel_wifi_enable(struct device *dev) -{ - dev->ops = &device_ops; -} - -struct chip_operations drivers_intel_wifi_ops = { - CHIP_NAME("Intel WiFi") - .enable_dev = intel_wifi_enable -}; diff --git a/src/drivers/wifi/generic/Kconfig b/src/drivers/wifi/generic/Kconfig index ddd2be9..43c7d9e 100644 --- a/src/drivers/wifi/generic/Kconfig +++ b/src/drivers/wifi/generic/Kconfig @@ -5,6 +5,15 @@ When enabled, add identifiers in ACPI tables that are common to WiFi chipsets from multiple vendors.
+config DRIVERS_INTEL_WIFI + bool "Support Intel PCI-e WiFi adapters" + depends on PCI + default y if PCIEXP_PLUGIN_SUPPORT + select DRIVERS_WIFI_GENERIC + help + When enabled, add identifiers in ACPI and SMBIOS tables to + make OS drivers work with certain Intel PCI-e WiFi chipsets. + if DRIVERS_WIFI_GENERIC
config USE_SAR diff --git a/src/drivers/wifi/generic/generic.c b/src/drivers/wifi/generic/generic.c index bb36861..ba061d0 100644 --- a/src/drivers/wifi/generic/generic.c +++ b/src/drivers/wifi/generic/generic.c @@ -313,3 +313,67 @@ 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, + /* Jefferson Peak */ + PCI_DEVICE_ID_JP_9000_SERIES_1_WIFI, + PCI_DEVICE_ID_JP_9000_SERIES_2_WIFI, + PCI_DEVICE_ID_JP_9000_SERIES_3_WIFI, + /* Thunder Peak 2 */ + PCI_DEVICE_ID_TP_9260_SERIES_WIFI, + /* Harrison Peak */ + PCI_DEVICE_ID_HrP_9560_SERIES_1_WIFI, + PCI_DEVICE_ID_HrP_9560_SERIES_2_WIFI, + PCI_DEVICE_ID_HrP_9560_SERIES_3_WIFI, + PCI_DEVICE_ID_HrP_9560_SERIES_4_WIFI, + PCI_DEVICE_ID_HrP_6SERIES_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_generic_ops, + .vendor = PCI_VENDOR_ID_INTEL, + .devices = intel_pci_device_ids, +};