coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
smbios.c
Go to the documentation of this file.
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 
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 
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 
39 int smbios_write_wifi_cnvi(struct device *dev, int *handle, unsigned long *current)
40 {
41  return smbios_write_wifi_pcie(dev->bus->dev, handle, current);
42 }
struct arm64_kernel_header header
Definition: fit_payload.c:30
int get_smbios_data(struct device *dev, int *handle, unsigned long *current)
Definition: smbios.c:1261
int smbios_add_string(u8 *start, const char *str)
Definition: smbios.c:40
void * smbios_carve_table(unsigned long start, u8 type, u8 length, u16 handle)
Definition: smbios.c:91
int smbios_full_table_len(struct smbios_header *header, u8 *str_table_start)
Definition: smbios.c:86
#define __packed
Definition: compiler.h:10
int smbios_write_wifi_pcie(struct device *dev, int *handle, unsigned long *current)
Definition: smbios.c:32
int smbios_write_wifi_cnvi(struct device *dev, int *handle, unsigned long *current)
Definition: smbios.c:39
static int smbios_write_intel_wifi(struct device *dev, int *handle, unsigned long *current)
Definition: smbios.c:9
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
uint8_t u8
Definition: stdint.h:45
DEVTREE_CONST struct device * dev
Definition: device.h:78
Definition: device.h:107
unsigned int vendor
Definition: device.h:116
DEVTREE_CONST struct bus * bus
Definition: device.h:108