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> |
| 6 | #include <string.h> |
| 7 | |
| 8 | #include "wifi_private.h" |
| 9 | |
| 10 | static int smbios_write_intel_wifi(struct device *dev, int *handle, unsigned long *current) |
| 11 | { |
| 12 | struct smbios_type_intel_wifi { |
Angel Pons | ca01baa | 2021-06-28 16:06:28 +0200 | [diff] [blame] | 13 | union { |
| 14 | struct { |
| 15 | u8 type; |
| 16 | u8 length; |
| 17 | u16 handle; |
| 18 | }; |
| 19 | struct smbios_header header; |
| 20 | }; |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 21 | u8 str; |
| 22 | u8 eos[2]; |
| 23 | } __packed; |
| 24 | |
Angel Pons | d62a501 | 2021-06-28 17:18:06 +0200 | [diff] [blame^] | 25 | struct smbios_type_intel_wifi *t = smbios_carve_table(*current, 0x85, |
| 26 | sizeof(*t), *handle); |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 27 | |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 28 | /* Intel wifi driver expects this string to be in the table 0x85. */ |
| 29 | t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII"); |
| 30 | |
Angel Pons | d62a501 | 2021-06-28 17:18:06 +0200 | [diff] [blame^] | 31 | const int len = t->length + smbios_string_table_len(t->eos); |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 32 | *current += len; |
| 33 | *handle += 1; |
| 34 | return len; |
| 35 | } |
| 36 | |
Furquan Shaikh | d436750 | 2020-10-27 18:00:46 -0700 | [diff] [blame] | 37 | 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] | 38 | { |
| 39 | if (dev->vendor == PCI_VENDOR_ID_INTEL) |
| 40 | return smbios_write_intel_wifi(dev, handle, current); |
| 41 | |
| 42 | return 0; |
| 43 | } |
Furquan Shaikh | d436750 | 2020-10-27 18:00:46 -0700 | [diff] [blame] | 44 | |
| 45 | int smbios_write_wifi_cnvi(struct device *dev, int *handle, unsigned long *current) |
| 46 | { |
| 47 | return smbios_write_wifi_pcie(dev->bus->dev, handle, current); |
| 48 | } |