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
7 #include "wifi_private.h"
8
smbios_write_intel_wifi(struct device * dev,int * handle,unsigned long * current)9 static int smbios_write_intel_wifi(struct device *dev, int *handle, unsigned long *current)
10 {
11 if (dev->vendor != PCI_VID_INTEL)
12 return 0;
13
14 struct smbios_type_intel_wifi {
15 struct smbios_header header;
16 u8 str;
17 u8 eos[2];
18 } __packed;
19
20 struct smbios_type_intel_wifi *t = smbios_carve_table(*current, 0x85,
21 sizeof(*t), *handle);
22
23 /* Intel wifi driver expects this string to be in the table 0x85. */
24 t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII");
25
26 const int len = smbios_full_table_len(&t->header, t->eos);
27 *current += len;
28 *handle += 1;
29 return len;
30 }
31
smbios_write_wifi_pcie(struct device * dev,int * handle,unsigned long * current)32 int smbios_write_wifi_pcie(struct device *dev, int *handle, unsigned long *current)
33 {
34 int len = smbios_write_intel_wifi(dev, handle, current);
35 len += get_smbios_data(dev, handle, current);
36 return len;
37 }
38
smbios_write_wifi_cnvi(struct device * dev,int * handle,unsigned long * current)39 int smbios_write_wifi_cnvi(struct device *dev, int *handle, unsigned long *current)
40 {
41 return smbios_write_wifi_pcie(dev->upstream->dev, handle, current);
42 }
43