TianoCore EDK2 master
Loading...
Searching...
No Matches
CbParseLib.c File Reference
#include <Uefi/UefiBaseType.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
#include <Library/IoLib.h>
#include <Library/BlParseLib.h>
#include <IndustryStandard/Acpi.h>
#include <Coreboot.h>

Go to the source code of this file.

Functions

UINT64 cb_unpack64 (IN struct cbuint64 val)
 
UINT16 CbCheckSum16 (IN UINT16 *Buffer, IN UINTN Length)
 
BOOLEAN IsValidCbTable (IN struct cb_header *Header)
 
VOID *EFIAPI GetParameterBase (VOID)
 
VOID * FindCbTag (IN UINT32 Tag)
 
RETURN_STATUS FindCbMemTable (IN struct cbmem_root *Root, IN UINT32 TableId, OUT VOID **MemTable, OUT UINT32 *MemTableSize)
 
RETURN_STATUS ParseCbMemTable (IN UINT32 TableId, OUT VOID **MemTable, OUT UINT32 *MemTableSize)
 
RETURN_STATUS EFIAPI ParseMemoryInfo (IN BL_MEM_INFO_CALLBACK MemInfoCallback, IN VOID *Params)
 
RETURN_STATUS EFIAPI ParseSmbiosTable (OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE *SmbiosTable)
 
RETURN_STATUS EFIAPI ParseAcpiTableInfo (OUT UNIVERSAL_PAYLOAD_ACPI_TABLE *AcpiTableHob)
 
RETURN_STATUS EFIAPI ParseSerialInfo (OUT SERIAL_PORT_INFO *SerialPortInfo)
 
RETURN_STATUS EFIAPI ParseGfxInfo (OUT EFI_PEI_GRAPHICS_INFO_HOB *GfxInfo)
 
RETURN_STATUS EFIAPI ParseGfxDeviceInfo (OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *GfxDeviceInfo)
 
RETURN_STATUS EFIAPI ParseMiscInfo (VOID)
 

Detailed Description

This library will parse the coreboot table in memory and extract those required information.

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

Definition in file CbParseLib.c.

Function Documentation

◆ cb_unpack64()

UINT64 cb_unpack64 ( IN struct cbuint64  val)

Convert a packed value from cbuint64 to a UINT64 value.

Parameters
valThe pointer to packed data.
Returns
the UNIT64 value after conversion.

Definition at line 29 of file CbParseLib.c.

◆ CbCheckSum16()

UINT16 CbCheckSum16 ( IN UINT16 *  Buffer,
IN UINTN  Length 
)

Returns the sum of all elements in a buffer of 16-bit values. During calculation, the carry bits are also been added.

Parameters
BufferThe pointer to the buffer to carry out the sum operation.
LengthThe size, in bytes, of Buffer.
Returns
Sum The sum of Buffer with carry bits included during additions.

Definition at line 47 of file CbParseLib.c.

◆ FindCbMemTable()

RETURN_STATUS FindCbMemTable ( IN struct cbmem_root Root,
IN UINT32  TableId,
OUT VOID **  MemTable,
OUT UINT32 *  MemTableSize 
)

Find the given table with TableId from the given coreboot memory Root.

Parameters
RootThe coreboot memory table to be searched in
TableIdTable id to be found
MemTableTo save the base address of the memory table found
MemTableSizeTo save the size of memory table found
Return values
RETURN_SUCCESSSuccessfully find out the memory table.
RETURN_INVALID_PARAMETERInvalid input parameters.
RETURN_NOT_FOUNDFailed to find the memory table.

Definition at line 251 of file CbParseLib.c.

◆ FindCbTag()

VOID * FindCbTag ( IN UINT32  Tag)

Find coreboot record with given Tag.

Parameters
TagThe tag id to be found
Return values
NULLThe Tag is not found.
OthersThe pointer to the record found.

Definition at line 210 of file CbParseLib.c.

◆ GetParameterBase()

VOID *EFIAPI GetParameterBase ( VOID  )

This function retrieves the parameter base address from boot loader.

This function will get bootloader specific parameter address for UEFI payload. e.g. HobList pointer for Slim Bootloader, and coreboot table header for Coreboot.

Return values
NULLFailed to find the GUID HOB.
othersGUIDed HOB data pointer.

Definition at line 130 of file CbParseLib.c.

◆ IsValidCbTable()

BOOLEAN IsValidCbTable ( IN struct cb_header Header)

Check the coreboot table if it is valid.

Parameters
HeaderPointer to coreboot table
Return values
TRUEThe coreboot table is valid.
OthersThe coreboot table is not valid.

Definition at line 86 of file CbParseLib.c.

◆ ParseAcpiTableInfo()

RETURN_STATUS EFIAPI ParseAcpiTableInfo ( OUT UNIVERSAL_PAYLOAD_ACPI_TABLE AcpiTableHob)

Acquire ACPI table from coreboot.

Parameters
AcpiTableHobPointer to the ACPI table info.
Return values
RETURN_SUCCESSSuccessfully find out the tables.
RETURN_NOT_FOUNDFailed to find the tables.

Definition at line 458 of file CbParseLib.c.

◆ ParseCbMemTable()

RETURN_STATUS ParseCbMemTable ( IN UINT32  TableId,
OUT VOID **  MemTable,
OUT UINT32 *  MemTableSize 
)

Acquire the coreboot memory table with the given table id

Parameters
TableIdTable id to be searched
MemTablePointer to the base address of the memory table
MemTableSizePointer to the size of the memory table
Return values
RETURN_SUCCESSSuccessfully find out the memory table.
RETURN_INVALID_PARAMETERInvalid input parameters.
RETURN_NOT_FOUNDFailed to find the memory table.

Definition at line 321 of file CbParseLib.c.

◆ ParseGfxDeviceInfo()

RETURN_STATUS EFIAPI ParseGfxDeviceInfo ( OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB GfxDeviceInfo)

Find the video frame buffer device information

Parameters
GfxDeviceInfoPointer to the EFI_PEI_GRAPHICS_DEVICE_INFO_HOB structure
Return values
RETURN_SUCCESSSuccessfully find the video frame buffer information.
RETURN_NOT_FOUNDFailed to find the video frame buffer information.

Definition at line 584 of file CbParseLib.c.

◆ ParseGfxInfo()

RETURN_STATUS EFIAPI ParseGfxInfo ( OUT EFI_PEI_GRAPHICS_INFO_HOB GfxInfo)

Find the video frame buffer information

Parameters
GfxInfoPointer to the EFI_PEI_GRAPHICS_INFO_HOB structure
Return values
RETURN_SUCCESSSuccessfully find the video frame buffer information.
RETURN_NOT_FOUNDFailed to find the video frame buffer information .

Definition at line 519 of file CbParseLib.c.

◆ ParseMemoryInfo()

RETURN_STATUS EFIAPI ParseMemoryInfo ( IN BL_MEM_INFO_CALLBACK  MemInfoCallback,
IN VOID *  Params 
)

Acquire the memory information from the coreboot table in memory.

Parameters
MemInfoCallbackThe callback routine
ParamsPointer to the callback routine parameter
Return values
RETURN_SUCCESSSuccessfully find out the memory information.
RETURN_NOT_FOUNDFailed to find the memory information.

Definition at line 379 of file CbParseLib.c.

◆ ParseMiscInfo()

RETURN_STATUS EFIAPI ParseMiscInfo ( VOID  )

Parse and handle the misc info provided by bootloader

Return values
RETURN_SUCCESSThe misc information was parsed successfully.
RETURN_NOT_FOUNDCould not find required misc info.
RETURN_OUT_OF_RESOURCESInsufficant memory space.

Definition at line 601 of file CbParseLib.c.

◆ ParseSerialInfo()

RETURN_STATUS EFIAPI ParseSerialInfo ( OUT SERIAL_PORT_INFO SerialPortInfo)

Find the serial port information

Parameters
SerialPortInfoPointer to serial port info structure
Return values
RETURN_SUCCESSSuccessfully find the serial port information.
RETURN_NOT_FOUNDFailed to find the serial port information .

Definition at line 487 of file CbParseLib.c.

◆ ParseSmbiosTable()

RETURN_STATUS EFIAPI ParseSmbiosTable ( OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE SmbiosTable)

Acquire SMBIOS table from coreboot.

Parameters
SmbiosTablePointer to the SMBIOS table info.
Return values
RETURN_SUCCESSSuccessfully find out the tables.
RETURN_NOT_FOUNDFailed to find the tables.

Definition at line 429 of file CbParseLib.c.