blob: e6ccd5d8a65a8b99fbe84902300333fb81ae9b8d [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>
Furquan Shaikh507a98b2020-10-27 15:28:21 -07006
7#include "wifi_private.h"
8
9static int smbios_write_intel_wifi(struct device *dev, int *handle, unsigned long *current)
10{
Felix Singer43b7f412022-03-07 04:34:52 +010011 if (dev->vendor != PCI_VID_INTEL)
Angel Pons6a73b242021-09-03 12:18:10 +020012 return 0;
13
Furquan Shaikh507a98b2020-10-27 15:28:21 -070014 struct smbios_type_intel_wifi {
Angel Ponsb554b7c2021-06-28 17:42:40 +020015 struct smbios_header header;
Furquan Shaikh507a98b2020-10-27 15:28:21 -070016 u8 str;
17 u8 eos[2];
18 } __packed;
19
Angel Ponsd62a5012021-06-28 17:18:06 +020020 struct smbios_type_intel_wifi *t = smbios_carve_table(*current, 0x85,
21 sizeof(*t), *handle);
Furquan Shaikh507a98b2020-10-27 15:28:21 -070022
Furquan Shaikh507a98b2020-10-27 15:28:21 -070023 /* Intel wifi driver expects this string to be in the table 0x85. */
24 t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII");
25
Angel Ponsa37701a2021-06-28 17:36:53 +020026 const int len = smbios_full_table_len(&t->header, t->eos);
Furquan Shaikh507a98b2020-10-27 15:28:21 -070027 *current += len;
28 *handle += 1;
29 return len;
30}
31
Furquan Shaikhd4367502020-10-27 18:00:46 -070032int smbios_write_wifi_pcie(struct device *dev, int *handle, unsigned long *current)
Furquan Shaikh507a98b2020-10-27 15:28:21 -070033{
Angel Pons6a73b242021-09-03 12:18:10 +020034 int len = smbios_write_intel_wifi(dev, handle, current);
35 len += get_smbios_data(dev, handle, current);
36 return len;
Furquan Shaikh507a98b2020-10-27 15:28:21 -070037}
Furquan Shaikhd4367502020-10-27 18:00:46 -070038
39int smbios_write_wifi_cnvi(struct device *dev, int *handle, unsigned long *current)
40{
Arthur Heymans7fcd4d52023-08-24 15:12:19 +020041 return smbios_write_wifi_pcie(dev->upstream->dev, handle, current);
Furquan Shaikhd4367502020-10-27 18:00:46 -070042}