Debian Codegraph @

src/boot/smbios.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "efi.h"
5
6 typedef struct {
7 uint8_t type;
8 uint8_t length;
9 uint8_t handle[2];
10 } _packed_ SmbiosHeader;
11
12 typedef struct {
13 SmbiosHeader header;
14 uint8_t manufacturer;
15 uint8_t product_name;
16 uint8_t version;
17 uint8_t serial_number;
18 EFI_GUID uuid;
19 uint8_t wake_up_type;
20 uint8_t sku_number;
21 uint8_t family;
22 } _packed_ SmbiosTableType1;
23
24 bool smbios_in_hypervisor(void);
25
26 const char* smbios_find_oem_string(const char *name, const char *after);
27
28 /* Invoked by smbios_foreach() for each SMBIOS structure. 'header' points at the structure (which
29 * carries its type), and 'size' is the structure's total length (formatted area + trailing string
30 * set). Returning false stops the iteration. */
31 typedef bool (*SmbiosForeachFunc)(const SmbiosHeader *header, size_t size, void *userdata);
32
33 void smbios_foreach(SmbiosForeachFunc func, void *userdata);
34
35 typedef struct RawSmbiosInfo {
36 const char *manufacturer;
37 const char *product_name;
38 const char *product_sku;
39 const char *family;
40 const char *baseboard_product;
41 const char *baseboard_manufacturer;
42 } RawSmbiosInfo;
43
44 void smbios_raw_info_populate(RawSmbiosInfo *ret_info);
45 void smbios_raw_info_get_cached(RawSmbiosInfo *ret_info);