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 { |
| 13 | u8 type; |
| 14 | u8 length; |
| 15 | u16 handle; |
| 16 | u8 str; |
| 17 | u8 eos[2]; |
| 18 | } __packed; |
| 19 | |
| 20 | struct smbios_type_intel_wifi *t = (struct smbios_type_intel_wifi *)*current; |
| 21 | int len = sizeof(struct smbios_type_intel_wifi); |
| 22 | |
| 23 | memset(t, 0, sizeof(struct smbios_type_intel_wifi)); |
| 24 | t->type = 0x85; |
| 25 | t->length = len - 2; |
| 26 | t->handle = *handle; |
| 27 | /* Intel wifi driver expects this string to be in the table 0x85. */ |
| 28 | t->str = smbios_add_string(t->eos, "KHOIHGIUCCHHII"); |
| 29 | |
| 30 | len = t->length + smbios_string_table_len(t->eos); |
| 31 | *current += len; |
| 32 | *handle += 1; |
| 33 | return len; |
| 34 | } |
| 35 | |
| 36 | int smbios_write_wifi(struct device *dev, int *handle, unsigned long *current) |
| 37 | { |
| 38 | if (dev->vendor == PCI_VENDOR_ID_INTEL) |
| 39 | return smbios_write_intel_wifi(dev, handle, current); |
| 40 | |
| 41 | return 0; |
| 42 | } |