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

Go to the source code of this file.

Functions

EFI_STATUS AddTableToList (IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, IN VOID *Table, IN BOOLEAN Checksum, IN EFI_ACPI_TABLE_VERSION Version, IN BOOLEAN IsFromHob, OUT UINTN *Handle)
 
EFI_STATUS RemoveTableFromList (IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, IN EFI_ACPI_TABLE_VERSION Version, IN UINTN Handle)
 
EFI_STATUS AcpiPlatformChecksum (IN VOID *Buffer, IN UINTN Size, IN UINTN ChecksumOffset)
 
EFI_STATUS ChecksumCommonTables (IN OUT EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance)
 
EFI_STATUS EFIAPI PublishTables (IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, IN EFI_ACPI_TABLE_VERSION Version)
 
EFI_STATUS EFIAPI InstallAcpiTable (IN EFI_ACPI_TABLE_PROTOCOL *This, IN VOID *AcpiTableBuffer, IN UINTN AcpiTableBufferSize, OUT UINTN *TableKey)
 
EFI_STATUS EFIAPI UninstallAcpiTable (IN EFI_ACPI_TABLE_PROTOCOL *This, IN UINTN TableKey)
 
EFI_STATUS ReallocateAcpiTableBuffer (IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance)
 
STATIC VOID FreeTableMemory (EFI_ACPI_TABLE_LIST *TableEntry)
 
EFI_STATUS FindTableByHandle (IN UINTN Handle, IN LIST_ENTRY *TableList, OUT EFI_ACPI_TABLE_LIST **Table)
 
EFI_STATUS RemoveTableFromRsdt (IN OUT EFI_ACPI_TABLE_LIST *Table, IN OUT UINTN *NumberOfTableEntries, IN OUT EFI_ACPI_DESCRIPTION_HEADER *Rsdt OPTIONAL, IN OUT EFI_ACPI_DESCRIPTION_HEADER *Xsdt OPTIONAL)
 
EFI_STATUS DeleteTable (IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, IN EFI_ACPI_TABLE_VERSION Version, IN OUT EFI_ACPI_TABLE_LIST *Table)
 
EFI_STATUS InstallAcpiTableFromHob (EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance)
 
EFI_STATUS InstallAcpiTableFromAcpiSiliconHob (EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, EFI_HOB_GUID_TYPE *GuidHob)
 
EFI_STATUS AcpiTableAcpiTableConstructor (EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance)
 

Variables

UINTN mEfiAcpiMaxNumTables = EFI_ACPI_MAX_NUM_TABLES
 
STATIC EFI_ALLOCATE_TYPE mAcpiTableAllocType
 

Detailed Description

ACPI Table Protocol Implementation

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

Definition in file AcpiTableProtocol.c.

Function Documentation

◆ AcpiPlatformChecksum()

EFI_STATUS AcpiPlatformChecksum ( IN VOID *  Buffer,
IN UINTN  Size,
IN UINTN  ChecksumOffset 
)

This function calculates and updates an UINT8 checksum.

Parameters
BufferPointer to buffer to checksum
SizeNumber of bytes to checksum
ChecksumOffsetOffset to place the checksum result in
Returns
EFI_SUCCESS The function completed successfully.

Definition at line 1666 of file AcpiTableProtocol.c.

◆ AcpiTableAcpiTableConstructor()

EFI_STATUS AcpiTableAcpiTableConstructor ( EFI_ACPI_TABLE_INSTANCE AcpiTableInstance)

Constructor for the ACPI table protocol. Initializes instance data.

Parameters
AcpiTableInstanceInstance to construct
Returns
EFI_SUCCESS Instance initialized.
EFI_OUT_OF_RESOURCES Unable to allocate required resources.

Definition at line 2062 of file AcpiTableProtocol.c.

◆ AddTableToList()

EFI_STATUS AddTableToList ( IN EFI_ACPI_TABLE_INSTANCE AcpiTableInstance,
IN VOID *  Table,
IN BOOLEAN  Checksum,
IN EFI_ACPI_TABLE_VERSION  Version,
IN BOOLEAN  IsFromHob,
OUT UINTN Handle 
)

This function adds an ACPI table to the table list. It will detect FACS and allocate the correct type of memory and properly align the table.

Parameters
AcpiTableInstanceInstance of the protocol.
TableTable to add.
ChecksumDoes the table require checksumming.
VersionThe version of the list to add the table to.
IsFromHobTrue, if add Apci Table from Hob List.
HandlePointer for returning the handle.
Returns
EFI_SUCCESS The function completed successfully.
EFI_OUT_OF_RESOURCES Could not allocate a required resource.
EFI_ABORTED The table is a duplicate of a table that is required to be unique.

This function adds an ACPI table to the table list. It will detect FACS and allocate the correct type of memory and properly align the table.

Parameters
AcpiTableInstanceInstance of the protocol.
TableTable to add.
ChecksumDoes the table require checksumming.
VersionThe version of the list to add the table to.
IsFromHobTrue, if add Apci Table from Hob List.
HandlePointer for returning the handle.
Returns
EFI_SUCCESS The function completed successfully.
EFI_OUT_OF_RESOURCES Could not allocate a required resource.
Return values
EFI_ACCESS_DENIEDThe table signature matches a table already present in the system and platform policy does not allow duplicate tables of this type.

Definition at line 504 of file AcpiTableProtocol.c.

◆ ChecksumCommonTables()

EFI_STATUS ChecksumCommonTables ( IN OUT EFI_ACPI_TABLE_INSTANCE AcpiTableInstance)

Checksum all versions of the common tables, RSDP, RSDT, XSDT.

Parameters
AcpiTableInstanceProtocol instance private data.
Returns
EFI_SUCCESS The function completed successfully.

Definition at line 1711 of file AcpiTableProtocol.c.

◆ DeleteTable()

EFI_STATUS DeleteTable ( IN EFI_ACPI_TABLE_INSTANCE AcpiTableInstance,
IN EFI_ACPI_TABLE_VERSION  Version,
IN OUT EFI_ACPI_TABLE_LIST Table 
)

This function removes a table and frees any associated memory.

Parameters
AcpiTableInstanceInstance of the protocol.
VersionVersion(s) to delete.
TablePointer to table found.
Returns
EFI_SUCCESS The function completed successfully.

Definition at line 1348 of file AcpiTableProtocol.c.

◆ FindTableByHandle()

EFI_STATUS FindTableByHandle ( IN UINTN  Handle,
IN LIST_ENTRY TableList,
OUT EFI_ACPI_TABLE_LIST **  Table 
)

This function finds the table specified by the handle and returns a pointer to it. If the handle is not found, EFI_NOT_FOUND is returned and the contents of Table are undefined.

Parameters
HandleTable to find.
TableListTable list to search
TablePointer to table found.
Returns
EFI_SUCCESS The function completed successfully.
EFI_NOT_FOUND No table found matching the handle specified.

Definition at line 1168 of file AcpiTableProtocol.c.

◆ FreeTableMemory()

STATIC VOID FreeTableMemory ( EFI_ACPI_TABLE_LIST TableEntry)

Free the memory associated with the provided EFI_ACPI_TABLE_LIST instance.

Parameters
TableEntryEFI_ACPI_TABLE_LIST instance pointer

Definition at line 471 of file AcpiTableProtocol.c.

◆ InstallAcpiTable()

EFI_STATUS EFIAPI InstallAcpiTable ( IN EFI_ACPI_TABLE_PROTOCOL This,
IN VOID *  AcpiTableBuffer,
IN UINTN  AcpiTableBufferSize,
OUT UINTN TableKey 
)

Installs an ACPI table into the RSDT/XSDT. Note that the ACPI table should be checksumed before installing it. Otherwise it will assert.

Parameters
ThisProtocol instance pointer.
AcpiTableBufferA pointer to a buffer containing the ACPI table to be installed.
AcpiTableBufferSizeSpecifies the size, in bytes, of the AcpiTableBuffer buffer.
TableKeyReurns a key to refer to the ACPI table.
Returns
EFI_SUCCESS The table was successfully inserted.
EFI_INVALID_PARAMETER Either AcpiTableBuffer is NULL, TableKey is NULL, or AcpiTableBufferSize and the size field embedded in the ACPI table pointed to by AcpiTableBuffer are not in sync.
EFI_OUT_OF_RESOURCES Insufficient resources exist to complete the request.
Return values
EFI_ACCESS_DENIEDThe table signature matches a table already present in the system and platform policy does not allow duplicate tables of this type.

Definition at line 206 of file AcpiTableProtocol.c.

◆ InstallAcpiTableFromAcpiSiliconHob()

EFI_STATUS InstallAcpiTableFromAcpiSiliconHob ( EFI_ACPI_TABLE_INSTANCE AcpiTableInstance,
EFI_HOB_GUID_TYPE GuidHob 
)

This function is updating the instance with RSDP and RSDT, these are steps in the constructor that will be skipped if this HOB is available.

Parameters
AcpiTableInstanceProtocol instance private data.
GuidHobGUID HOB header.
Returns
EFI_SUCCESS The function completed successfully.
EFI_NOT_FOUND The function doesn't find the Rsdp from AcpiSiliconHob.
EFI_ABORTED The function could not complete successfully.

Definition at line 1962 of file AcpiTableProtocol.c.

◆ InstallAcpiTableFromHob()

EFI_STATUS InstallAcpiTableFromHob ( EFI_ACPI_TABLE_INSTANCE AcpiTableInstance)

This function will find gUniversalPayloadAcpiTableGuid Guid Hob, and install Acpi table from it.

Parameters
AcpiTableInstanceProtocol instance private data.
Returns
EFI_SUCCESS The function completed successfully.
EFI_NOT_FOUND The function doesn't find the gEfiAcpiTableGuid Guid Hob.
EFI_ABORTED The function could not complete successfully.

Definition at line 1802 of file AcpiTableProtocol.c.

◆ PublishTables()

EFI_STATUS EFIAPI PublishTables ( IN EFI_ACPI_TABLE_INSTANCE AcpiTableInstance,
IN EFI_ACPI_TABLE_VERSION  Version 
)

This function publishes the specified versions of the ACPI tables by installing EFI configuration table entries for them. Any combination of table versions can be published.

Parameters
AcpiTableInstanceInstance of the protocol.
VersionVersion(s) to publish.
Returns
EFI_SUCCESS The function completed successfully.
EFI_ABORTED The function could not complete successfully.

Definition at line 118 of file AcpiTableProtocol.c.

◆ ReallocateAcpiTableBuffer()

EFI_STATUS ReallocateAcpiTableBuffer ( IN EFI_ACPI_TABLE_INSTANCE AcpiTableInstance)

If the number of APCI tables exceeds the preallocated max table number, enlarge the table buffer.

Parameters
AcpiTableInstanceACPI table protocol instance data structure.
Returns
EFI_SUCCESS reallocate the table beffer successfully.
EFI_OUT_OF_RESOURCES Unable to allocate required resources.

Definition at line 332 of file AcpiTableProtocol.c.

◆ RemoveTableFromList()

EFI_STATUS RemoveTableFromList ( IN EFI_ACPI_TABLE_INSTANCE AcpiTableInstance,
IN EFI_ACPI_TABLE_VERSION  Version,
IN UINTN  Handle 
)

This function finds and removes the table specified by the handle.

Parameters
AcpiTableInstanceInstance of the protocol.
VersionBitmask of which versions to remove.
HandleTable to remove.
Returns
EFI_SUCCESS The function completed successfully.
EFI_ABORTED An error occurred.
EFI_NOT_FOUND Handle not found in table list.

Definition at line 1613 of file AcpiTableProtocol.c.

◆ RemoveTableFromRsdt()

EFI_STATUS RemoveTableFromRsdt ( IN OUT EFI_ACPI_TABLE_LIST Table,
IN OUT UINTN NumberOfTableEntries,
IN OUT EFI_ACPI_DESCRIPTION_HEADER *Rsdt  OPTIONAL,
IN OUT EFI_ACPI_DESCRIPTION_HEADER *Xsdt  OPTIONAL 
)

This function removes a basic table from the RSDT and/or XSDT. For Acpi 1.0 tables, pass in the Rsdt. For Acpi 2.0 tables, pass in both Rsdt and Xsdt.

Parameters
TablePointer to table found.
NumberOfTableEntriesCurrent number of table entries in the RSDT/XSDT
RsdtPointer to the RSDT to remove from
XsdtPointer to the Xsdt to remove from
Returns
EFI_SUCCESS The function completed successfully.
EFI_INVALID_PARAMETER The table was not found in both Rsdt and Xsdt.

Definition at line 1221 of file AcpiTableProtocol.c.

◆ UninstallAcpiTable()

EFI_STATUS EFIAPI UninstallAcpiTable ( IN EFI_ACPI_TABLE_PROTOCOL This,
IN UINTN  TableKey 
)

Removes an ACPI table from the RSDT/XSDT.

Parameters
ThisProtocol instance pointer.
TableKeySpecifies the table to uninstall. The key was returned from InstallAcpiTable().
Returns
EFI_SUCCESS The table was successfully uninstalled.
EFI_NOT_FOUND TableKey does not refer to a valid key for a table entry.

Definition at line 284 of file AcpiTableProtocol.c.

Variable Documentation

◆ mAcpiTableAllocType

STATIC EFI_ALLOCATE_TYPE mAcpiTableAllocType

Definition at line 23 of file AcpiTableProtocol.c.

◆ mEfiAcpiMaxNumTables

UINTN mEfiAcpiMaxNumTables = EFI_ACPI_MAX_NUM_TABLES

Definition at line 17 of file AcpiTableProtocol.c.