blob: 96b11d3051694c36cecb718a0b72e5464bba5748 [file] [log] [blame]
Furquan Shaikh507a98b2020-10-27 15:28:21 -07001/* 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
10static int smbios_write_intel_wifi(struct device *dev, int *handle, unsigned long *current)
11{
12 struct smbios_type_intel_wifi {
Angel Ponsca01baa2021-06-28 16:06:28 +020013 union {
14 struct {
15 u8 type;
16 u8 length;
17 u16 handle;
18 };
19 struct smbios_header header;
20 };
Furquan Shaikh507a98b2020-10-27 15:28:21 -070021 u8 str;
22 u8 eos[2];
23 } __packed;
24
25 struct smbios_type_intel_wifi *t = (struct smbios_type_intel_wifi *)*current;
Angel Pons35b99c62021-06-28 15:36:23 +020026 int len = sizeof(*t);
Furquan Shaikh507a98b2020-10-27 15:28:21 -070027
Angel Pons35b99c62021-06-28 15:36:23 +020028 memset(t, 0, sizeof(*t));
Furquan Shaikh507a98b2020-10-27 15:28:21 -070029 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 Shaikhd4367502020-10-27 18:00:46 -070041int smbios_write_wifi_pcie(struct device *dev, int *handle, unsigned long *current)
Furquan Shaikh507a98b2020-10-27 15:28:21 -070042{
43 if (dev->vendor == PCI_VENDOR_ID_INTEL)
44 return smbios_write_intel_wifi(dev, handle, current);
45
46 return 0;
47}
Furquan Shaikhd4367502020-10-27 18:00:46 -070048
49int 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}