Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46862 )
Change subject: drivers/wifi/generic: Add support for CNVi dummy device ops ......................................................................
drivers/wifi/generic: Add support for CNVi dummy device ops
This change reorganizes drivers/wifi/generic to add a new device_operations structure for dummy CNVi device. This is done to make the organization of CNVi PCI device in devicetree consistent with all the other internal PCI devices of the SoC i.e. without a chip around the PCI device.
Thus, with this change, CNVi entry in devicetree can be changed from: ``` chip drivers/wifi/generic register "wake" = "xxyyzz" device pci xx.y on end # CNVi PCI device end ```
to:
``` device pci xx.y on chip drivers/wifi/generic register "wake" = "xxyyzz" device generic 0 on end # Dummy CNVi device end end # CNVi PCI device ```
The helper functions for ACPI/SMBIOS generation are also accordingly updated to include _pcie_ and _cnvi_ in the function name.
Change-Id: Ib3cb9ed9b81ff8d6ac85a9aaf57b641caaa2f907 Signed-off-by: Furquan Shaikh furquan@google.com --- M src/drivers/wifi/generic/acpi.c M src/drivers/wifi/generic/generic.c M src/drivers/wifi/generic/smbios.c M src/drivers/wifi/generic/wifi_private.h 4 files changed, 45 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/62/46862/1
diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c index 2afd99e..33862d9 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -218,7 +218,7 @@ dev_path(dev)); }
-void wifi_generic_fill_ssdt(const struct device *dev) +void wifi_pcie_fill_ssdt(const struct device *dev) { const char *path;
@@ -233,7 +233,7 @@ wifi_ssdt_write_properties(dev, path); }
-const char *wifi_generic_acpi_name(const struct device *dev) +const char *wifi_pcie_acpi_name(const struct device *dev) { static char wifi_acpi_name[WIFI_ACPI_NAME_MAX_LEN];
@@ -242,3 +242,17 @@ (dev_path_encode(dev) & 0xff)); return wifi_acpi_name; } + +void wifi_cnvi_fill_ssdt(const struct device *dev) +{ + const char *path; + + if (!dev->enabled) + return; + + path = acpi_device_path(dev->bus->dev); + if (!path) + return; + + wifi_ssdt_write_properties(dev, path); +} diff --git a/src/drivers/wifi/generic/generic.c b/src/drivers/wifi/generic/generic.c index fcb7294..0b13fa8 100644 --- a/src/drivers/wifi/generic/generic.c +++ b/src/drivers/wifi/generic/generic.c @@ -15,21 +15,32 @@ elog_add_event_wake(ELOG_WAKE_SOURCE_PME_WIFI, 0); }
-struct device_operations wifi_generic_ops = { +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_generic_acpi_name, - .acpi_fill_ssdt = wifi_generic_fill_ssdt, + .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, #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_cnvi, +#endif +}; + static void wifi_generic_enable(struct device *dev) { struct drivers_wifi_generic_config *config = dev ? dev->chip_info : NULL; @@ -37,7 +48,10 @@ if (!config) return;
- dev->ops = &wifi_generic_ops; + 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 = { @@ -104,7 +118,7 @@ * `wifi_generic_ops`. */ static const struct pci_driver intel_wifi_pci_driver __pci_driver = { - .ops = &wifi_generic_ops, + .ops = &wifi_pcie_ops, .vendor = PCI_VENDOR_ID_INTEL, .devices = intel_pci_device_ids, }; diff --git a/src/drivers/wifi/generic/smbios.c b/src/drivers/wifi/generic/smbios.c index 0c1b976..770b297 100644 --- a/src/drivers/wifi/generic/smbios.c +++ b/src/drivers/wifi/generic/smbios.c @@ -40,3 +40,8 @@
return 0; } + +int smbios_write_cnvi(struct device *dev, int *handle, unsigned long *current) +{ + return smbios_write_wifi(dev->bus->dev, handle, current); +} diff --git a/src/drivers/wifi/generic/wifi_private.h b/src/drivers/wifi/generic/wifi_private.h index 39cdfed..6360130 100644 --- a/src/drivers/wifi/generic/wifi_private.h +++ b/src/drivers/wifi/generic/wifi_private.h @@ -4,8 +4,11 @@ #define _WIFI_GENERIC_PRIVATE_H_
int smbios_write_wifi(struct device *dev, int *handle, unsigned long *current); +int smbios_write_cnvi(struct device *dev, int *handle, unsigned long *current);
-const char *wifi_generic_acpi_name(const struct device *dev); -void wifi_generic_fill_ssdt(const struct device *dev); +const char *wifi_pcie_acpi_name(const struct device *dev); +void wifi_pcie_fill_ssdt(const struct device *dev); + +void wifi_cnvi_fill_ssdt(const struct device *dev);
#endif
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46862 )
Change subject: drivers/wifi/generic: Add support for CNVi dummy device ops ......................................................................
Patch Set 1: Code-Review+2
(2 comments)
https://review.coreboot.org/c/coreboot/+/46862/1/src/drivers/wifi/generic/ac... File src/drivers/wifi/generic/acpi.c:
https://review.coreboot.org/c/coreboot/+/46862/1/src/drivers/wifi/generic/ac... PS1, Line 250: dev->enabled could use is_dev_enabled() but this is consistent with the pcie version so it seems ok.
https://review.coreboot.org/c/coreboot/+/46862/1/src/drivers/wifi/generic/wi... File src/drivers/wifi/generic/wifi_private.h:
https://review.coreboot.org/c/coreboot/+/46862/1/src/drivers/wifi/generic/wi... PS1, Line 7: smbios_write_cnvi maybe smbios_write_wifi_cnvi() would be more clear, but this is is in a local header so it doesn't really matter.
Hello build bot (Jenkins), Duncan Laurie,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46862
to look at the new patch set (#2).
Change subject: drivers/wifi/generic: Add support for CNVi dummy device ops ......................................................................
drivers/wifi/generic: Add support for CNVi dummy device ops
This change reorganizes drivers/wifi/generic to add a new device_operations structure for dummy CNVi device. This is done to make the organization of CNVi PCI device in devicetree consistent with all the other internal PCI devices of the SoC i.e. without a chip around the PCI device.
Thus, with this change, CNVi entry in devicetree can be changed from: ``` chip drivers/wifi/generic register "wake" = "xxyyzz" device pci xx.y on end # CNVi PCI device end ```
to:
``` device pci xx.y on chip drivers/wifi/generic register "wake" = "xxyyzz" device generic 0 on end # Dummy CNVi device end end # CNVi PCI device ```
The helper functions for ACPI/SMBIOS generation are also accordingly updated to include _pcie_ and _cnvi_ in the function name.
Change-Id: Ib3cb9ed9b81ff8d6ac85a9aaf57b641caaa2f907 Signed-off-by: Furquan Shaikh furquan@google.com --- M src/drivers/wifi/generic/acpi.c M src/drivers/wifi/generic/generic.c M src/drivers/wifi/generic/smbios.c M src/drivers/wifi/generic/wifi_private.h 4 files changed, 48 insertions(+), 12 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/62/46862/2
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46862 )
Change subject: drivers/wifi/generic: Add support for CNVi dummy device ops ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46862/1/src/drivers/wifi/generic/ac... File src/drivers/wifi/generic/acpi.c:
https://review.coreboot.org/c/coreboot/+/46862/1/src/drivers/wifi/generic/ac... PS1, Line 250: dev->enabled
could use is_dev_enabled() but this is consistent with the pcie version so it seems ok.
Done: https://review.coreboot.org/c/coreboot/+/46904
https://review.coreboot.org/c/coreboot/+/46862/1/src/drivers/wifi/generic/wi... File src/drivers/wifi/generic/wifi_private.h:
https://review.coreboot.org/c/coreboot/+/46862/1/src/drivers/wifi/generic/wi... PS1, Line 7: smbios_write_cnvi
maybe smbios_write_wifi_cnvi() would be more clear, but this is is in a local header so it doesn't r […]
Done.
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46862 )
Change subject: drivers/wifi/generic: Add support for CNVi dummy device ops ......................................................................
Patch Set 2: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46862 )
Change subject: drivers/wifi/generic: Add support for CNVi dummy device ops ......................................................................
drivers/wifi/generic: Add support for CNVi dummy device ops
This change reorganizes drivers/wifi/generic to add a new device_operations structure for dummy CNVi device. This is done to make the organization of CNVi PCI device in devicetree consistent with all the other internal PCI devices of the SoC i.e. without a chip around the PCI device.
Thus, with this change, CNVi entry in devicetree can be changed from: ``` chip drivers/wifi/generic register "wake" = "xxyyzz" device pci xx.y on end # CNVi PCI device end ```
to:
``` device pci xx.y on chip drivers/wifi/generic register "wake" = "xxyyzz" device generic 0 on end # Dummy CNVi device end end # CNVi PCI device ```
The helper functions for ACPI/SMBIOS generation are also accordingly updated to include _pcie_ and _cnvi_ in the function name.
Change-Id: Ib3cb9ed9b81ff8d6ac85a9aaf57b641caaa2f907 Signed-off-by: Furquan Shaikh furquan@google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/46862 Reviewed-by: Duncan Laurie dlaurie@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/drivers/wifi/generic/acpi.c M src/drivers/wifi/generic/generic.c M src/drivers/wifi/generic/smbios.c M src/drivers/wifi/generic/wifi_private.h 4 files changed, 48 insertions(+), 12 deletions(-)
Approvals: build bot (Jenkins): Verified Duncan Laurie: Looks good to me, approved
diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c index 2afd99e..33862d9 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -218,7 +218,7 @@ dev_path(dev)); }
-void wifi_generic_fill_ssdt(const struct device *dev) +void wifi_pcie_fill_ssdt(const struct device *dev) { const char *path;
@@ -233,7 +233,7 @@ wifi_ssdt_write_properties(dev, path); }
-const char *wifi_generic_acpi_name(const struct device *dev) +const char *wifi_pcie_acpi_name(const struct device *dev) { static char wifi_acpi_name[WIFI_ACPI_NAME_MAX_LEN];
@@ -242,3 +242,17 @@ (dev_path_encode(dev) & 0xff)); return wifi_acpi_name; } + +void wifi_cnvi_fill_ssdt(const struct device *dev) +{ + const char *path; + + if (!dev->enabled) + return; + + path = acpi_device_path(dev->bus->dev); + if (!path) + return; + + wifi_ssdt_write_properties(dev, path); +} diff --git a/src/drivers/wifi/generic/generic.c b/src/drivers/wifi/generic/generic.c index fcb7294..809238e 100644 --- a/src/drivers/wifi/generic/generic.c +++ b/src/drivers/wifi/generic/generic.c @@ -15,18 +15,29 @@ elog_add_event_wake(ELOG_WAKE_SOURCE_PME_WIFI, 0); }
-struct device_operations wifi_generic_ops = { +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_generic_acpi_name, - .acpi_fill_ssdt = wifi_generic_fill_ssdt, + .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, + .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 };
@@ -37,7 +48,10 @@ if (!config) return;
- dev->ops = &wifi_generic_ops; + 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 = { @@ -104,7 +118,7 @@ * `wifi_generic_ops`. */ static const struct pci_driver intel_wifi_pci_driver __pci_driver = { - .ops = &wifi_generic_ops, + .ops = &wifi_pcie_ops, .vendor = PCI_VENDOR_ID_INTEL, .devices = intel_pci_device_ids, }; diff --git a/src/drivers/wifi/generic/smbios.c b/src/drivers/wifi/generic/smbios.c index 0c1b976..a1a8e4f 100644 --- a/src/drivers/wifi/generic/smbios.c +++ b/src/drivers/wifi/generic/smbios.c @@ -33,10 +33,15 @@ return len; }
-int smbios_write_wifi(struct device *dev, int *handle, unsigned long *current) +int smbios_write_wifi_pcie(struct device *dev, int *handle, unsigned long *current) { if (dev->vendor == PCI_VENDOR_ID_INTEL) return smbios_write_intel_wifi(dev, handle, current);
return 0; } + +int smbios_write_wifi_cnvi(struct device *dev, int *handle, unsigned long *current) +{ + return smbios_write_wifi_pcie(dev->bus->dev, handle, current); +} diff --git a/src/drivers/wifi/generic/wifi_private.h b/src/drivers/wifi/generic/wifi_private.h index 39cdfed..4a2045d 100644 --- a/src/drivers/wifi/generic/wifi_private.h +++ b/src/drivers/wifi/generic/wifi_private.h @@ -3,9 +3,12 @@ #ifndef _WIFI_GENERIC_PRIVATE_H_ #define _WIFI_GENERIC_PRIVATE_H_
-int smbios_write_wifi(struct device *dev, int *handle, unsigned long *current); +int smbios_write_wifi_pcie(struct device *dev, int *handle, unsigned long *current); +int smbios_write_wifi_cnvi(struct device *dev, int *handle, unsigned long *current);
-const char *wifi_generic_acpi_name(const struct device *dev); -void wifi_generic_fill_ssdt(const struct device *dev); +const char *wifi_pcie_acpi_name(const struct device *dev); +void wifi_pcie_fill_ssdt(const struct device *dev); + +void wifi_cnvi_fill_ssdt(const struct device *dev);
#endif