blob: e8936be3867b50d9837996bd228b59f1ad218c51 [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
Angel Ponsd62a5012021-06-28 17:18:06 +020025 struct smbios_type_intel_wifi *t = smbios_carve_table(*current, 0x85,
26 sizeof(*t), *handle);
Furquan Shaikh507a98b2020-10-27 15:28:21 -070027
Furquan Shaikh507a98b2020-10-27 15:28:21 -070028 /* Intel wifi driver expects this string to be in the table 0x85. */
29 t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII");
30
Angel Ponsd62a5012021-06-28 17:18:06 +020031 const int len = t->length + smbios_string_table_len(t->eos);
Furquan Shaikh507a98b2020-10-27 15:28:21 -070032 *current += len;
33 *handle += 1;
34 return len;
35}
36
Furquan Shaikhd4367502020-10-27 18:00:46 -070037int smbios_write_wifi_pcie(struct device *dev, int *handle, unsigned long *current)
Furquan Shaikh507a98b2020-10-27 15:28:21 -070038{
39 if (dev->vendor == PCI_VENDOR_ID_INTEL)
40 return smbios_write_intel_wifi(dev, handle, current);
41
42 return 0;
43}
Furquan Shaikhd4367502020-10-27 18:00:46 -070044
45int 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}