Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <device/device.h> |
| 4 | #include <device/pci_ids.h> |
| 5 | #include <smbios.h> |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 6 | |
| 7 | #include "wifi_private.h" |
| 8 | |
| 9 | static int smbios_write_intel_wifi(struct device *dev, int *handle, unsigned long *current) |
| 10 | { |
Angel Pons | 6a73b24 | 2021-09-03 12:18:10 +0200 | [diff] [blame] | 11 | if (dev->vendor != PCI_VENDOR_ID_INTEL) |
| 12 | return 0; |
| 13 | |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 14 | struct smbios_type_intel_wifi { |
Angel Pons | b554b7c | 2021-06-28 17:42:40 +0200 | [diff] [blame] | 15 | struct smbios_header header; |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 16 | u8 str; |
| 17 | u8 eos[2]; |
| 18 | } __packed; |
| 19 | |
Angel Pons | d62a501 | 2021-06-28 17:18:06 +0200 | [diff] [blame] | 20 | struct smbios_type_intel_wifi *t = smbios_carve_table(*current, 0x85, |
| 21 | sizeof(*t), *handle); |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 22 | |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 23 | /* Intel wifi driver expects this string to be in the table 0x85. */ |
| 24 | t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII"); |
| 25 | |
Angel Pons | a37701a | 2021-06-28 17:36:53 +0200 | [diff] [blame] | 26 | const int len = smbios_full_table_len(&t->header, t->eos); |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 27 | *current += len; |
| 28 | *handle += 1; |
| 29 | return len; |
| 30 | } |
| 31 | |
Furquan Shaikh | d436750 | 2020-10-27 18:00:46 -0700 | [diff] [blame] | 32 | int smbios_write_wifi_pcie(struct device *dev, int *handle, unsigned long *current) |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 33 | { |
Angel Pons | 6a73b24 | 2021-09-03 12:18:10 +0200 | [diff] [blame] | 34 | int len = smbios_write_intel_wifi(dev, handle, current); |
| 35 | len += get_smbios_data(dev, handle, current); |
| 36 | return len; |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 37 | } |
Furquan Shaikh | d436750 | 2020-10-27 18:00:46 -0700 | [diff] [blame] | 38 | |
| 39 | int smbios_write_wifi_cnvi(struct device *dev, int *handle, unsigned long *current) |
| 40 | { |
| 41 | return smbios_write_wifi_pcie(dev->bus->dev, handle, current); |
| 42 | } |