iPXE
|
System Management BIOS. More...
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/uaccess.h>
#include <ipxe/smbios.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static uint8_t | smbios_checksum (userptr_t start, size_t offset, size_t len) |
Calculate SMBIOS entry point structure checksum. More... | |
int | find_smbios_entry (userptr_t start, size_t len, struct smbios_entry *entry) |
Scan for SMBIOS 32-bit entry point structure. More... | |
int | find_smbios3_entry (userptr_t start, size_t len, struct smbios3_entry *entry) |
Scan for SMBIOS 64-bit entry point structure. More... | |
static size_t | find_strings_terminator (size_t offset) |
Find SMBIOS strings terminator. More... | |
int | find_smbios_structure (unsigned int type, unsigned int instance, struct smbios_structure *structure) |
Find specific structure type within SMBIOS. More... | |
int | read_smbios_structure (struct smbios_structure *structure, void *data, size_t len) |
Copy SMBIOS structure. More... | |
int | read_smbios_string (struct smbios_structure *structure, unsigned int index, void *data, size_t len) |
Find indexed string within SMBIOS structure. More... | |
int | smbios_version (void) |
Get SMBIOS version. More... | |
void | smbios_clear (void) |
Clear SMBIOS entry point descriptor. More... | |
Variables | |
static struct smbios | smbios |
SMBIOS entry point descriptor. More... | |
System Management BIOS.
Definition in file smbios.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
Calculate SMBIOS entry point structure checksum.
start | Start address of region |
offset | Offset of SMBIOS entry point structure |
len | Length of entry point structure |
sum | Byte checksum |
Definition at line 52 of file smbios.c.
References copy_from_user(), end, len, offset, and start.
Referenced by find_smbios3_entry(), and find_smbios_entry().
int find_smbios_entry | ( | userptr_t | start, |
size_t | len, | ||
struct smbios_entry * | entry | ||
) |
Scan for SMBIOS 32-bit entry point structure.
start | Start address of region to scan |
len | Length of region to scan |
entry | SMBIOS entry point structure to fill in |
rc | Return status code |
Definition at line 72 of file smbios.c.
References copy_from_user(), DBG, ENODEV, len, smbios_entry::len, smbios_entry::major, smbios_entry::minor, offset, smbios_entry::signature, smbios_checksum(), SMBIOS_SIGNATURE, start, and user_to_phys().
Referenced by bios_find_smbios2().
int find_smbios3_entry | ( | userptr_t | start, |
size_t | len, | ||
struct smbios3_entry * | entry | ||
) |
Scan for SMBIOS 64-bit entry point structure.
start | Start address of region to scan |
len | Length of region to scan |
entry | SMBIOS entry point structure to fill in |
rc | Return status code |
Definition at line 112 of file smbios.c.
References copy_from_user(), DBG, ENODEV, len, smbios3_entry::len, smbios3_entry::major, smbios3_entry::minor, offset, smbios3_entry::signature, SMBIOS3_SIGNATURE, smbios_checksum(), start, and user_to_phys().
Referenced by bios_find_smbios3().
Find SMBIOS strings terminator.
offset | Offset to start of strings |
offset | Offset to strings terminator, or 0 if not found |
Definition at line 150 of file smbios.c.
References smbios::address, copy_from_user(), smbios::len, and offset.
Referenced by find_smbios_structure().
int find_smbios_structure | ( | unsigned int | type, |
unsigned int | instance, | ||
struct smbios_structure * | structure | ||
) |
Find specific structure type within SMBIOS.
type | Structure type to search for |
instance | Instance of this type of structure |
structure | SMBIOS structure descriptor to fill in |
rc | Return status code |
Definition at line 170 of file smbios.c.
References smbios::address, assert(), copy_from_user(), count, smbios::count, DBG, ENOENT, find_smbios(), find_strings_terminator(), smbios_structure::header, smbios_header::len, smbios::len, offset, smbios_structure::offset, rc, SMBIOS_TYPE_END, smbios_structure::strings_len, type, smbios_header::type, and UNULL.
Referenced by smbios_fetch(), and smsc95xx_vm3_fetch_mac().
int read_smbios_structure | ( | struct smbios_structure * | structure, |
void * | data, | ||
size_t | len | ||
) |
Copy SMBIOS structure.
structure | SMBIOS structure descriptor |
data | Buffer to hold SMBIOS structure |
len | Length of buffer |
rc | Return status code |
Definition at line 241 of file smbios.c.
References smbios::address, assert(), copy_from_user(), data, smbios_structure::header, len, smbios_header::len, smbios_structure::offset, and UNULL.
Referenced by smbios_fetch(), and smsc95xx_vm3_fetch_mac().
int read_smbios_string | ( | struct smbios_structure * | structure, |
unsigned int | index, | ||
void * | data, | ||
size_t | len | ||
) |
Find indexed string within SMBIOS structure.
structure | SMBIOS structure descriptor |
index | String index |
data | Buffer for string |
len | Length of string buffer |
rc | Length of string, or negative error |
Definition at line 261 of file smbios.c.
References smbios::address, assert(), copy_from_user(), data, DBG, ENOENT, smbios_structure::header, index, len, smbios_header::len, offset, smbios_structure::offset, smbios_structure::strings_len, strlen_user(), and UNULL.
Referenced by smbios_fetch(), and smsc95xx_vm3_fetch_mac().
int smbios_version | ( | void | ) |
Get SMBIOS version.
version | Version, or negative error |
Definition at line 299 of file smbios.c.
References smbios::address, assert(), find_smbios(), rc, UNULL, and smbios::version.
Referenced by smbios_fetch().
void smbios_clear | ( | void | ) |
Clear SMBIOS entry point descriptor.
Definition at line 315 of file smbios.c.
References smbios::address, and UNULL.