iPXE
efi_smbios.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008 Michael Brown <mbrown@fensystems.co.uk>.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 */
19
20FILE_LICENCE ( GPL2_OR_LATER );
21FILE_SECBOOT ( PERMITTED );
22
23#include <errno.h>
24#include <ipxe/uaccess.h>
25#include <ipxe/smbios.h>
26#include <ipxe/efi/efi.h>
28
29/** @file
30 *
31 * iPXE SMBIOS API for EFI
32 *
33 */
34
35/** SMBIOS configuration table */
37EFI_USE_TABLE ( SMBIOS_TABLE, &smbios_entry, 0 );
38
39/** SMBIOS configuration table */
41EFI_USE_TABLE ( SMBIOS3_TABLE, &smbios3_entry, 0 );
42
43/**
44 * Find SMBIOS
45 *
46 * @v smbios SMBIOS entry point descriptor structure to fill in
47 * @ret rc Return status code
48 */
49static int efi_find_smbios ( struct smbios *smbios ) {
50
51 /* Use 64-bit table if present */
53 smbios->address = phys_to_virt ( smbios3_entry->smbios_address );
55 smbios->count = 0;
58 DBG ( "Found 64-bit SMBIOS v%d.%d entry point at %p (%lx+%zx)\n",
60 virt_to_phys ( smbios->address ), smbios->len );
61 return 0;
62 }
63
64 /* Otherwise, use 32-bit table if present */
66 smbios->address = phys_to_virt ( smbios_entry->smbios_address );
71 DBG ( "Found 32-bit SMBIOS v%d.%d entry point at %p (%lx+%zx)\n",
73 virt_to_phys ( smbios->address ), smbios->len );
74 return 0;
75 }
76
77 DBG ( "No SMBIOS table provided\n" );
78 return -ENODEV;
79}
80
GUIDs used to locate the SMBIOS tables in the UEFI 2.5 system table.
static int efi_find_smbios(struct smbios *smbios)
Find SMBIOS.
Definition efi_smbios.c:49
Error codes.
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define ENODEV
No such device.
Definition errno.h:510
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
EFI API.
#define EFI_USE_TABLE(_table, _ptr, _required)
Declare an EFI configuration table to be used by iPXE.
Definition efi.h:154
System Management BIOS.
#define SMBIOS3_SIGNATURE
Signature for 64-bit SMBIOS entry point.
Definition smbios.h:40
#define SMBIOS_SIGNATURE
Signature for 32-bit SMBIOS entry point.
Definition smbios.h:36
int find_smbios(struct smbios *smbios)
#define PROVIDE_SMBIOS(_subsys, _api_func, _func)
Provide an SMBIOS API implementation.
Definition smbios.h:24
#define SMBIOS_VERSION(major, minor)
Calculate SMBIOS version.
Definition smbios.h:216
Access to external ("user") memory.
SMBIOS 64-bit entry point.
Definition smbios.h:91
uint8_t major
Major version.
Definition smbios.h:104
uint64_t smbios_address
Structure table address.
Definition smbios.h:116
uint8_t minor
Minor version.
Definition smbios.h:106
uint32_t signature
Signature.
Definition smbios.h:96
uint32_t smbios_len
Structure table length.
Definition smbios.h:114
SMBIOS 32-bit entry point.
Definition smbios.h:50
uint32_t smbios_address
Structure table address.
Definition smbios.h:77
uint8_t minor
Minor version.
Definition smbios.h:63
uint32_t signature
Signature.
Definition smbios.h:55
uint16_t smbios_count
Number of SMBIOS structures.
Definition smbios.h:79
uint16_t smbios_len
Structure table length.
Definition smbios.h:75
uint8_t major
Major version.
Definition smbios.h:61
SMBIOS entry point descriptor.
Definition smbios.h:198
size_t len
Length of SMBIOS structures.
Definition smbios.h:202
unsigned int count
Number of SMBIOS structures.
Definition smbios.h:204
uint16_t version
SMBIOS version.
Definition smbios.h:206
const void * address
Start of SMBIOS structures.
Definition smbios.h:200