TianoCore EDK2 master
Loading...
Searching...
No Matches
SmbiosDxe.c File Reference
#include "SmbiosDxe.h"

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI GetSmbiosStructureSize (IN CONST EFI_SMBIOS_PROTOCOL *This, IN EFI_SMBIOS_TABLE_HEADER *Head, OUT UINTN *Size, OUT UINTN *NumberOfStrings)
 
BOOLEAN EFIAPI CheckSmbiosHandleExistance (IN LIST_ENTRY *Head, IN EFI_SMBIOS_HANDLE Handle)
 
VOID EFIAPI GetMaxSmbiosHandle (IN CONST EFI_SMBIOS_PROTOCOL *This, IN OUT EFI_SMBIOS_HANDLE *MaxHandle)
 
EFI_STATUS EFIAPI GetAvailableSmbiosHandle (IN CONST EFI_SMBIOS_PROTOCOL *This, IN OUT EFI_SMBIOS_HANDLE *Handle)
 
EFI_STATUS EFIAPI SmbiosAdd (IN CONST EFI_SMBIOS_PROTOCOL *This, IN EFI_HANDLE ProducerHandle OPTIONAL, IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle, IN EFI_SMBIOS_TABLE_HEADER *Record)
 
EFI_STATUS EFIAPI SmbiosUpdateString (IN CONST EFI_SMBIOS_PROTOCOL *This, IN EFI_SMBIOS_HANDLE *SmbiosHandle, IN UINTN *StringNumber, IN CHAR8 *String)
 
EFI_STATUS EFIAPI SmbiosRemove (IN CONST EFI_SMBIOS_PROTOCOL *This, IN EFI_SMBIOS_HANDLE SmbiosHandle)
 
EFI_STATUS EFIAPI SmbiosGetNext (IN CONST EFI_SMBIOS_PROTOCOL *This, IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle, IN EFI_SMBIOS_TYPE *Type OPTIONAL, OUT EFI_SMBIOS_TABLE_HEADER **Record, OUT EFI_HANDLE *ProducerHandle OPTIONAL)
 
EFI_STATUS EFIAPI GetNextSmbiosRecord (IN CONST EFI_SMBIOS_PROTOCOL *This, IN OUT EFI_SMBIOS_ENTRY **CurrentSmbiosEntry, OUT EFI_SMBIOS_TABLE_HEADER **Record)
 
EFI_STATUS EFIAPI SmbiosCreateTable (OUT VOID **TableEntryPointStructure)
 
EFI_STATUS EFIAPI SmbiosCreate64BitTable (OUT VOID **TableEntryPointStructure)
 
VOID EFIAPI SmbiosTableConstruction (BOOLEAN Smbios32BitTable, BOOLEAN Smbios64BitTable)
 
STATIC BOOLEAN IsValidSmbios20Table (IN VOID *TableEntry, OUT VOID **TableAddress, OUT UINTN *TableMaximumSize, OUT UINT8 *MajorVersion, OUT UINT8 *MinorVersion)
 
STATIC BOOLEAN IsValidSmbios30Table (IN VOID *TableEntry, OUT VOID **TableAddress, OUT UINTN *TableMaximumSize, OUT UINT8 *MajorVersion, OUT UINT8 *MinorVersion)
 
STATIC EFI_STATUS ParseAndAddExistingSmbiosTable (IN EFI_HANDLE ImageHandle, IN SMBIOS_STRUCTURE_POINTER Smbios, IN UINTN Length, IN UINT8 MajorVersion, IN UINT8 MinorVersion)
 
EFI_STATUS RetrieveSmbiosFromHob (IN EFI_HANDLE ImageHandle)
 
EFI_STATUS EFIAPI SmbiosDriverEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

SMBIOS_INSTANCE mPrivateData
 
UINTN mPreAllocatedPages = 0
 
UINTN mPre64BitAllocatedPages = 0
 
SMBIOS_TABLE_ENTRY_POINTEntryPointStructure = NULL
 
SMBIOS_TABLE_ENTRY_POINT EntryPointStructureData
 
SMBIOS_TABLE_3_0_ENTRY_POINTSmbios30EntryPointStructure = NULL
 
SMBIOS_TABLE_3_0_ENTRY_POINT Smbios30EntryPointStructureData
 
IS_SMBIOS_TABLE_VALID_ENTRY mIsSmbiosTableValid []
 

Detailed Description

This code produces the Smbios protocol. It also responsible for constructing SMBIOS table into system table.

Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SmbiosDxe.c.

Function Documentation

◆ CheckSmbiosHandleExistance()

BOOLEAN EFIAPI CheckSmbiosHandleExistance ( IN LIST_ENTRY Head,
IN EFI_SMBIOS_HANDLE  Handle 
)

Determin whether an SmbiosHandle has already in use.

Parameters
HeadPointer to the beginning of SMBIOS structure.
HandleA unique handle will be assigned to the SMBIOS record.
Return values
TRUESmbios handle already in use.
FALSESmbios handle is NOT used.

Definition at line 258 of file SmbiosDxe.c.

◆ GetAvailableSmbiosHandle()

EFI_STATUS EFIAPI GetAvailableSmbiosHandle ( IN CONST EFI_SMBIOS_PROTOCOL This,
IN OUT EFI_SMBIOS_HANDLE *  Handle 
)

Get an SmbiosHandle that could use.

Parameters
ThisThe EFI_SMBIOS_PROTOCOL instance.
SmbiosHandleA unique handle will be assigned to the SMBIOS record.
Return values
EFI_SUCCESSSmbios handle got.
EFI_OUT_OF_RESOURCESSmbios handle is NOT available.

Definition at line 311 of file SmbiosDxe.c.

◆ GetMaxSmbiosHandle()

VOID EFIAPI GetMaxSmbiosHandle ( IN CONST EFI_SMBIOS_PROTOCOL This,
IN OUT EFI_SMBIOS_HANDLE *  MaxHandle 
)

Get the max SmbiosHandle that could be use.

Parameters
ThisThe EFI_SMBIOS_PROTOCOL instance.
MaxHandleThe max handle that could be assigned to the SMBIOS record.

Definition at line 286 of file SmbiosDxe.c.

◆ GetNextSmbiosRecord()

EFI_STATUS EFIAPI GetNextSmbiosRecord ( IN CONST EFI_SMBIOS_PROTOCOL This,
IN OUT EFI_SMBIOS_ENTRY **  CurrentSmbiosEntry,
OUT EFI_SMBIOS_TABLE_HEADER **  Record 
)

Allow the caller to discover all of the SMBIOS records.

Parameters
ThisThe EFI_SMBIOS_PROTOCOL instance.
CurrentSmbiosEntryOn exit, points to the SMBIOS entry on the list which includes the returned SMBIOS record information. If *CurrentSmbiosEntry is NULL on entry, then the first SMBIOS entry on the list will be returned.
RecordOn exit, points to the SMBIOS Record consisting of the formatted area followed by the unformatted area. The unformatted area optionally contains text strings.
Return values
EFI_SUCCESSSMBIOS record information was successfully returned in Record. CurrentSmbiosEntry points to the SMBIOS entry which includes the returned SMBIOS record information.
EFI_NOT_FOUNDThere is no more SMBIOS entry.

Definition at line 995 of file SmbiosDxe.c.

◆ GetSmbiosStructureSize()

EFI_STATUS EFIAPI GetSmbiosStructureSize ( IN CONST EFI_SMBIOS_PROTOCOL This,
IN EFI_SMBIOS_TABLE_HEADER Head,
OUT UINTN Size,
OUT UINTN NumberOfStrings 
)

Get the full size of SMBIOS structure including optional strings that follow the formatted structure.

Parameters
ThisThe EFI_SMBIOS_PROTOCOL instance.
HeadPointer to the beginning of SMBIOS structure.
SizeThe returned size.
NumberOfStringsThe returned number of optional strings that follow the formatted structure.
Return values
EFI_SUCCESSSize retured in Size.
EFI_INVALID_PARAMETERInput SMBIOS structure mal-formed or Size is NULL.

Definition at line 172 of file SmbiosDxe.c.

◆ IsValidSmbios20Table()

STATIC BOOLEAN IsValidSmbios20Table ( IN VOID *  TableEntry,
OUT VOID **  TableAddress,
OUT UINTN TableMaximumSize,
OUT UINT8 *  MajorVersion,
OUT UINT8 *  MinorVersion 
)

Validates a SMBIOS 2.0 table entry point.

Parameters
TableEntryThe SmBios table entry to validate.
TableAddressOn exit, point to the smbios table addres.
TableMaximumSizeOn exit, point to the maximum size of the table.
Return values
TRUESMBIOS table entry point is valid.
FALSESMBIOS table entry point is malformed.

Definition at line 1451 of file SmbiosDxe.c.

◆ IsValidSmbios30Table()

STATIC BOOLEAN IsValidSmbios30Table ( IN VOID *  TableEntry,
OUT VOID **  TableAddress,
OUT UINTN TableMaximumSize,
OUT UINT8 *  MajorVersion,
OUT UINT8 *  MinorVersion 
)

Validates a SMBIOS 3.0 table entry point.

Parameters
TableEntryThe SmBios table entry to validate.
TableAddressOn exit, point to the smbios table addres.
TableMaximumSizeOn exit, point to the maximum size of the table.
Return values
TRUESMBIOS table entry point is valid.
FALSESMBIOS table entry point is malformed.

Definition at line 1531 of file SmbiosDxe.c.

◆ ParseAndAddExistingSmbiosTable()

STATIC EFI_STATUS ParseAndAddExistingSmbiosTable ( IN EFI_HANDLE  ImageHandle,
IN SMBIOS_STRUCTURE_POINTER  Smbios,
IN UINTN  Length,
IN UINT8  MajorVersion,
IN UINT8  MinorVersion 
)

Parse an existing SMBIOS table and insert it using SmbiosAdd.

Parameters
ImageHandleThe EFI_HANDLE to this driver.
SmbiosThe SMBIOS table to parse.
LengthThe length of the SMBIOS table.
Return values
EFI_SUCCESSSMBIOS table was parsed and installed.
EFI_OUT_OF_RESOURCESRecord was not added due to lack of system resources.
EFI_INVALID_PARAMETERSmbios is not a correct smbios table

Definition at line 1589 of file SmbiosDxe.c.

◆ RetrieveSmbiosFromHob()

EFI_STATUS RetrieveSmbiosFromHob ( IN EFI_HANDLE  ImageHandle)

Retrieve SMBIOS from Hob.

Parameters
ImageHandleModule's image handle
Return values
EFI_SUCCESSSmbios from Hob is installed.
Returns
EFI_NOT_FOUND Not found Smbios from Hob.
Return values
OtherNo Smbios from Hob is installed.

Definition at line 1698 of file SmbiosDxe.c.

◆ SmbiosAdd()

EFI_STATUS EFIAPI SmbiosAdd ( IN CONST EFI_SMBIOS_PROTOCOL This,
IN EFI_HANDLE ProducerHandle  OPTIONAL,
IN OUT EFI_SMBIOS_HANDLE *  SmbiosHandle,
IN EFI_SMBIOS_TABLE_HEADER Record 
)

Add an SMBIOS record.

Parameters
ThisThe EFI_SMBIOS_PROTOCOL instance.
ProducerHandleThe handle of the controller or driver associated with the SMBIOS information. NULL means no handle.
SmbiosHandleOn entry, the handle of the SMBIOS record to add. If FFFEh, then a unique handle will be assigned to the SMBIOS record. If the SMBIOS handle is already in use, EFI_ALREADY_STARTED is returned and the SMBIOS record is not updated.
RecordThe data for the fixed portion of the SMBIOS record. The format of the record is determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or a set of null terminated strings and a null.
Return values
EFI_SUCCESSRecord was added.
EFI_OUT_OF_RESOURCESRecord was not added due to lack of system resources.
EFI_ALREADY_STARTEDThe SmbiosHandle passed in was already in use.

Definition at line 356 of file SmbiosDxe.c.

◆ SmbiosCreate64BitTable()

EFI_STATUS EFIAPI SmbiosCreate64BitTable ( OUT VOID **  TableEntryPointStructure)

Assembles SMBIOS 64-bit table from the SMBIOS protocol. Produce Table Entry Point and return the pointer to it.

Parameters
TableEntryPointStructureOn exit, points to the SMBIOS entrypoint structure.
Return values
EFI_SUCCESSStructure created sucessfully.
EFI_OUT_OF_RESOURCESNo enough memory.

Definition at line 1247 of file SmbiosDxe.c.

◆ SmbiosCreateTable()

EFI_STATUS EFIAPI SmbiosCreateTable ( OUT VOID **  TableEntryPointStructure)

Assembles SMBIOS table from the SMBIOS protocol. Produce Table Entry Point and return the pointer to it.

Parameters
TableEntryPointStructureOn exit, points to the SMBIOS entrypoint structure.
Return values
EFI_SUCCESSStructure created sucessfully.
EFI_OUT_OF_RESOURCESNo enough memory.

Definition at line 1048 of file SmbiosDxe.c.

◆ SmbiosDriverEntryPoint()

EFI_STATUS EFIAPI SmbiosDriverEntryPoint ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Driver to produce Smbios protocol and pre-allocate 1 page for the final SMBIOS table.

Parameters
ImageHandleModule's image handle
SystemTablePointer of EFI_SYSTEM_TABLE
Return values
EFI_SUCCESSSmbios protocol installed
OtherNo protocol installed, unload driver.

Definition at line 1763 of file SmbiosDxe.c.

◆ SmbiosGetNext()

EFI_STATUS EFIAPI SmbiosGetNext ( IN CONST EFI_SMBIOS_PROTOCOL This,
IN OUT EFI_SMBIOS_HANDLE *  SmbiosHandle,
IN EFI_SMBIOS_TYPE *Type  OPTIONAL,
OUT EFI_SMBIOS_TABLE_HEADER **  Record,
OUT EFI_HANDLE *ProducerHandle  OPTIONAL 
)

Allow the caller to discover all or some of the SMBIOS records.

Parameters
ThisThe EFI_SMBIOS_PROTOCOL instance.
SmbiosHandleOn entry, points to the previous handle of the SMBIOS record. On exit, points to the next SMBIOS record handle. If it is FFFEh on entry, then the first SMBIOS record handle will be returned. If it returns FFFEh on exit, then there are no more SMBIOS records.
TypeOn entry it means return the next SMBIOS record of type Type. If a NULL is passed in this functionally it ignored. Type is not modified by the GetNext() function.
RecordOn exit, points to the SMBIOS Record consisting of the formatted area followed by the unformatted area. The unformatted area optionally contains text strings.
ProducerHandleOn exit, points to the ProducerHandle registered by Add(). If no ProducerHandle was passed into Add() NULL is returned. If a NULL pointer is passed in no data will be returned
Return values
EFI_SUCCESSSMBIOS record information was successfully returned in Record.
EFI_NOT_FOUNDThe SMBIOS record with SmbiosHandle was the last available record.

Definition at line 909 of file SmbiosDxe.c.

◆ SmbiosRemove()

EFI_STATUS EFIAPI SmbiosRemove ( IN CONST EFI_SMBIOS_PROTOCOL This,
IN EFI_SMBIOS_HANDLE  SmbiosHandle 
)

Remove an SMBIOS record.

Parameters
ThisThe EFI_SMBIOS_PROTOCOL instance.
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 804 of file SmbiosDxe.c.

◆ SmbiosTableConstruction()

VOID EFIAPI SmbiosTableConstruction ( BOOLEAN  Smbios32BitTable,
BOOLEAN  Smbios64BitTable 
)

Create Smbios Table and installs the Smbios Table to the System Table.

Parameters
Smbios32BitTableThe flag to update 32-bit table.
Smbios64BitTableThe flag to update 64-bit table.

Definition at line 1414 of file SmbiosDxe.c.

◆ SmbiosUpdateString()

EFI_STATUS EFIAPI SmbiosUpdateString ( IN CONST EFI_SMBIOS_PROTOCOL This,
IN EFI_SMBIOS_HANDLE *  SmbiosHandle,
IN UINTN StringNumber,
IN CHAR8 *  String 
)

Update the string associated with an existing SMBIOS record.

Parameters
ThisThe EFI_SMBIOS_PROTOCOL instance.
SmbiosHandleSMBIOS Handle of structure that will have its string updated.
StringNumberThe non-zero string number of the string to update
StringUpdate the StringNumber string with String.
Return values
EFI_SUCCESSSmbiosHandle had its StringNumber String updated.
EFI_INVALID_PARAMETERSmbiosHandle does not exist.
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 550 of file SmbiosDxe.c.

Variable Documentation

◆ EntryPointStructure

SMBIOS_TABLE_ENTRY_POINT* EntryPointStructure = NULL

Definition at line 25 of file SmbiosDxe.c.

◆ EntryPointStructureData

SMBIOS_TABLE_ENTRY_POINT EntryPointStructureData

Definition at line 26 of file SmbiosDxe.c.

◆ mIsSmbiosTableValid

IS_SMBIOS_TABLE_VALID_ENTRY mIsSmbiosTableValid[]
Initial value:
= {
{ &gUniversalPayloadSmbios3TableGuid, IsValidSmbios30Table },
{ &gUniversalPayloadSmbiosTableGuid, IsValidSmbios20Table }
}
STATIC BOOLEAN IsValidSmbios30Table(IN VOID *TableEntry, OUT VOID **TableAddress, OUT UINTN *TableMaximumSize, OUT UINT8 *MajorVersion, OUT UINT8 *MinorVersion)
Definition: SmbiosDxe.c:1531
STATIC BOOLEAN IsValidSmbios20Table(IN VOID *TableEntry, OUT VOID **TableAddress, OUT UINTN *TableMaximumSize, OUT UINT8 *MajorVersion, OUT UINT8 *MinorVersion)
Definition: SmbiosDxe.c:1451

Definition at line 152 of file SmbiosDxe.c.

◆ mPre64BitAllocatedPages

UINTN mPre64BitAllocatedPages = 0

Definition at line 20 of file SmbiosDxe.c.

◆ mPreAllocatedPages

UINTN mPreAllocatedPages = 0

Definition at line 19 of file SmbiosDxe.c.

◆ mPrivateData

SMBIOS_INSTANCE mPrivateData

Definition at line 17 of file SmbiosDxe.c.

◆ Smbios30EntryPointStructure

SMBIOS_TABLE_3_0_ENTRY_POINT* Smbios30EntryPointStructure = NULL

Definition at line 102 of file SmbiosDxe.c.

◆ Smbios30EntryPointStructureData

SMBIOS_TABLE_3_0_ENTRY_POINT Smbios30EntryPointStructureData

Definition at line 103 of file SmbiosDxe.c.