TianoCore EDK2 master
Loading...
Searching...
No Matches
SmbiosLib.h File Reference

Go to the source code of this file.

Data Structures

struct  SMBIOS_TEMPLATE_ENTRY
 

Functions

EFI_STATUS EFIAPI SmbiosLibInitializeFromTemplate (IN SMBIOS_TEMPLATE_ENTRY *Template)
 
EFI_STATUS EFIAPI SmbiosLibCreateEntry (IN SMBIOS_STRUCTURE *SmbiosEntry, IN CHAR8 **StringArray)
 
EFI_STATUS EFIAPI SmbiosLibUpdateString (IN EFI_SMBIOS_HANDLE SmbiosHandle, IN SMBIOS_TABLE_STRING StringNumber, IN CHAR8 *String)
 
EFI_STATUS EFIAPI SmbiosLibUpdateUnicodeString (IN EFI_SMBIOS_HANDLE SmbiosHandle, IN SMBIOS_TABLE_STRING StringNumber, IN CHAR16 *String)
 
CHAR8 *EFIAPI SmbiosLibReadString (IN SMBIOS_STRUCTURE *Header, IN EFI_SMBIOS_STRING StringNumber)
 
SMBIOS_STRUCTURE *EFIAPI SmbiosLibGetRecord (IN EFI_SMBIOS_TYPE Type, IN UINTN Instance, OUT EFI_SMBIOS_HANDLE *SmbiosHandle)
 
EFI_STATUS EFIAPI SmbiosLibRemove (OUT EFI_SMBIOS_HANDLE SmbiosHandle)
 

Variables

EFI_SMBIOS_PROTOCOLgSmbios
 

Detailed Description

Provides library functions for common SMBIOS operations. Only available to DXE and UEFI module types.

Copyright (c) 2012, Apple Inc. All rights reserved. Portitions Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SmbiosLib.h.

Function Documentation

◆ SmbiosLibCreateEntry()

EFI_STATUS EFIAPI SmbiosLibCreateEntry ( IN SMBIOS_STRUCTURE SmbiosEntry,
IN CHAR8 **  StringArray 
)

Create SMBIOS record.

Converts a fixed SMBIOS structure and an array of pointers to strings into an SMBIOS record where the strings are cat'ed on the end of the fixed record and terminated via a double NULL and add to SMBIOS table.

SMBIOS_TABLE_TYPE32 gSmbiosType12 = { { EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 }, 1 // StringCount }; CHAR8 *gSmbiosType12Strings[] = { "Not Found", NULL };

... AddSmbiosEntryFromTemplate ( (EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12, gSmbiosType12Strings );

Parameters
SmbiosEntryFixed SMBIOS structure
StringArrayArray of strings to convert to an SMBIOS string pack. NULL is OK.
Return values
EFI_SUCCESSNew SmbiosEntry was added to SMBIOS table.
EFI_OUT_OF_RESOURCESSmbiosEntry was not added.

Create SMBIOS record.

Converts a fixed SMBIOS structure and an array of pointers to strings into an SMBIOS record where the strings are cat'ed on the end of the fixed record and terminated via a double NULL and add to SMBIOS table.

SMBIOS_TABLE_TYPE32 gSmbiosType12 = { { EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 }, 1 // StringCount }; CHAR8 *gSmbiosType12Strings[] = { "Not Found", NULL };

... CreateSmbiosEntry ( (EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12, gSmbiosType12Strings );

Parameters
SmbiosEntryFixed SMBIOS structure
StringArrayArray of strings to convert to an SMBIOS string pack. NULL is OK.

Definition at line 83 of file SmbiosLib.c.

◆ SmbiosLibGetRecord()

SMBIOS_STRUCTURE *EFIAPI SmbiosLibGetRecord ( IN EFI_SMBIOS_TYPE  Type,
IN UINTN  Instance,
OUT EFI_SMBIOS_HANDLE *  SmbiosHandle 
)

Allow the caller to discover a specific SMBIOS entry, and patch it if necissary.

Parameters
[in]TypeType of the next SMBIOS record to return.
[in[Instance Instance of SMBIOS record 0 - N-1.
[out]SmbiosHandleReturns SMBIOS handle for the matching record.
Return values
NULLInstance of Type SMBIOS record was not found.
OtherPointer to matching SMBIOS record.

Definition at line 278 of file SmbiosLib.c.

◆ SmbiosLibInitializeFromTemplate()

EFI_STATUS EFIAPI SmbiosLibInitializeFromTemplate ( IN SMBIOS_TEMPLATE_ENTRY Template)

Create an initial SMBIOS Table from an array of SMBIOS_TEMPLATE_ENTRY entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table.

Parameters
TemplateArray of SMBIOS_TEMPLATE_ENTRY entries.
Return values
EFI_SUCCESSNew SMBIOS tables were created.
EFI_OUT_OF_RESOURCESNew SMBIOS tables were not created.

Definition at line 34 of file SmbiosLib.c.

◆ SmbiosLibReadString()

CHAR8 *EFIAPI SmbiosLibReadString ( IN SMBIOS_STRUCTURE Header,
IN EFI_SMBIOS_STRING  StringNumber 
)

Allow caller to read a specific SMBIOS string

Parameters
[in]HeaderSMBIOS record that contains the string.
[in[StringNumber Instance of SMBIOS string 1 - N.
Return values
NULLInstance of Type SMBIOS string was not found.
OtherPointer to matching SMBIOS string.

Definition at line 243 of file SmbiosLib.c.

◆ SmbiosLibRemove()

EFI_STATUS EFIAPI SmbiosLibRemove ( OUT EFI_SMBIOS_HANDLE  SmbiosHandle)

Remove an SMBIOS record.

This function removes an SMBIOS record using the handle specified by SmbiosHandle.

Parameters
[in]SmbiosHandleThe handle of the SMBIOS record to remove.
Return values
EFI_SUCCESSSMBIOS record was removed.
EFI_INVALID_PARAMETERSmbiosHandle does not specify a valid SMBIOS record.

Definition at line 316 of file SmbiosLib.c.

◆ SmbiosLibUpdateString()

EFI_STATUS EFIAPI SmbiosLibUpdateString ( IN EFI_SMBIOS_HANDLE  SmbiosHandle,
IN SMBIOS_TABLE_STRING  StringNumber,
IN CHAR8 *  String 
)

Update the string associated with an existing SMBIOS record.

This function allows the update of specific SMBIOS strings. The number of valid strings for any SMBIOS record is defined by how many strings were present when Add() was called.

Parameters
[in]SmbiosHandleSMBIOS Handle of structure that will have its string updated.
[in]StringNumberThe non-zero string number of the string to update.
[in]StringUpdate the StringNumber string with String.
Return values
EFI_SUCCESSSmbiosHandle had its StringNumber String updated.
EFI_INVALID_PARAMETERSmbiosHandle does not exist. Or String is invalid.
EFI_UNSUPPORTEDString was not added because it is longer than the SMBIOS Table supports.
EFI_NOT_FOUNDThe StringNumber.is not valid for this SMBIOS record.

Definition at line 161 of file SmbiosLib.c.

◆ SmbiosLibUpdateUnicodeString()

EFI_STATUS EFIAPI SmbiosLibUpdateUnicodeString ( IN EFI_SMBIOS_HANDLE  SmbiosHandle,
IN SMBIOS_TABLE_STRING  StringNumber,
IN CHAR16 *  String 
)

Update the string associated with an existing SMBIOS record.

This function allows the update of specific SMBIOS strings. The number of valid strings for any SMBIOS record is defined by how many strings were present when Add() was called.

Parameters
[in]SmbiosHandleSMBIOS Handle of structure that will have its string updated.
[in]StringNumberThe non-zero string number of the string to update.
[in]StringUpdate the StringNumber string with String.
Return values
EFI_SUCCESSSmbiosHandle had its StringNumber String updated.
EFI_INVALID_PARAMETERSmbiosHandle does not exist. Or String is invalid.
EFI_UNSUPPORTEDString was not added because it is longer than the SMBIOS Table supports.
EFI_NOT_FOUNDThe StringNumber.is not valid for this SMBIOS record.

Definition at line 199 of file SmbiosLib.c.

Variable Documentation

◆ gSmbios

EFI_SMBIOS_PROTOCOL* gSmbios
extern

Cache copy of the SMBIOS Protocol pointer

Definition at line 21 of file SmbiosLib.c.