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 | |
| 25 | struct smbios_type_intel_wifi *t = (struct smbios_type_intel_wifi *)*current; |
Angel Pons | 35b99c6 | 2021-06-28 15:36:23 +0200 | [diff] [blame] | 26 | int len = sizeof(*t); |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 27 | |
Angel Pons | 35b99c6 | 2021-06-28 15:36:23 +0200 | [diff] [blame] | 28 | memset(t, 0, sizeof(*t)); |
Furquan Shaikh | 507a98b | 2020-10-27 15:28:21 -0700 | [diff] [blame] | 29 | t->type = 0x85; |
| 30 | t->length = len - 2; |
| 31 | t->handle = *handle; |
| 32 | /* Intel wifi driver expects this string to be in the table 0x85. */ |
| 33 | t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII"); |
| 34 | |
| 35 | len = t->length + smbios_string_table_len(t->eos); |
| 36 | *current += len; |
| 37 | *handle += 1; |
| 38 | return len; |
| 39 | } |
| 40 | |
Furquan Shaikh | d436750 | 2020-10-27 18:00:46 -0700 | [diff] [blame] | 41 | 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] | 42 | { |
| 43 | if (dev->vendor == PCI_VENDOR_ID_INTEL) |
| 44 | return smbios_write_intel_wifi(dev, handle, current); |
| 45 | |
| 46 | return 0; |
| 47 | } |
Furquan Shaikh | d436750 | 2020-10-27 18:00:46 -0700 | [diff] [blame] | 48 | |
| 49 | int smbios_write_wifi_cnvi(struct device *dev, int *handle, unsigned long *current) |
| 50 | { |
| 51 | return smbios_write_wifi_pcie(dev->bus->dev, handle, current); |
| 52 | } |