/** @file
ACPI Table Protocol Implementation
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
//
// Includes
//
#include "AcpiTable.h"
//
// The maximum number of tables that pre-allocated.
//
/**
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.
@param AcpiTableInstance Instance of the protocol.
@param Table Table to add.
@param Checksum Does the table require checksumming.
@param Version The version of the list to add the table to.
@param Handle Pointer for returning the handle.
@return EFI_SUCCESS The function completed successfully.
@return EFI_OUT_OF_RESOURCES Could not allocate a required resource.
@return EFI_ABORTED The table is a duplicate of a table that is required
to be unique.
**/
);
/**
This function finds and removes the table specified by the handle.
@param AcpiTableInstance Instance of the protocol.
@param Version Bitmask of which versions to remove.
@param Handle Table to remove.
@return EFI_SUCCESS The function completed successfully.
@return EFI_ABORTED An error occurred.
@return EFI_NOT_FOUND Handle not found in table list.
**/
);
/**
This function calculates and updates an UINT8 checksum.
@param Buffer Pointer to buffer to checksum
@param Size Number of bytes to checksum
@param ChecksumOffset Offset to place the checksum result in
@return EFI_SUCCESS The function completed successfully.
**/
);
/**
Checksum all versions of the common tables, RSDP, RSDT, XSDT.
@param AcpiTableInstance Protocol instance private data.
@return EFI_SUCCESS The function completed successfully.
**/
);
//
// Protocol function implementations.
//
/**
This function adds, removes, or updates ACPI tables. If the address is not
null and the handle value is null, the table is added. If both the address and
handle are not null, the table at handle is updated with the table at address.
If the address is null and the handle is not, the table at handle is deleted.
@param AcpiTableInstance Instance of the protocol.
@param Table Pointer to a table.
@param Checksum Boolean indicating if the checksum should be calculated.
@param Version Version(s) to set.
@param Handle Handle of the table.
@return EFI_SUCCESS The function completed successfully.
@return EFI_INVALID_PARAMETER Both the Table and *Handle were NULL.
@return EFI_ABORTED Could not complete the desired request.
**/
)
{
//
// Check for invalid input parameters
//
//
// Initialize locals
//
//
// Determine desired action
//
if (*Handle == 0) {
//
// Invalid parameter combination
//
return EFI_INVALID_PARAMETER;
} else {
//
// Add table
//
}
} else {
//
// Update table
//
//
// Delete the table list entry
//
//
// Should not get an error here ever, but abort if we do.
//
return EFI_ABORTED;
}
//
// Set the handle to replace the table at the same handle
//
//
// Add the table
//
//
// Restore the saved current handle
//
} else {
//
// Delete table
//
}
}
//
// Should not get an error here ever, but abort if we do.
//
return EFI_ABORTED;
}
//
// Done
//
return EFI_SUCCESS;
}
/**
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.
@param AcpiTableInstance Instance of the protocol.
@param Version Version(s) to publish.
@return EFI_SUCCESS The function completed successfully.
@return EFI_ABORTED The function could not complete successfully.
**/
)
{
//
// Reorder tables as some operating systems don't seem to find the
// FADT correctly if it is not in the first few entries
//
//
// Add FADT as the first entry
//
if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
CurrentRsdtEntry = (UINT32 *) ((UINT8 *) AcpiTableInstance->Rsdt1 + sizeof (EFI_ACPI_DESCRIPTION_HEADER));
}
if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 ||
(Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) {
CurrentRsdtEntry = (UINT32 *) ((UINT8 *) AcpiTableInstance->Rsdt3 + sizeof (EFI_ACPI_DESCRIPTION_HEADER));
CurrentXsdtEntry = (VOID *) ((UINT8 *) AcpiTableInstance->Xsdt + sizeof (EFI_ACPI_DESCRIPTION_HEADER));
//
// Add entry to XSDT, XSDT expects 64 bit pointers, but
// the table pointers in XSDT are not aligned on 8 byte boundary.
//
CopyMem (
&Buffer64,
sizeof (UINT64)
);
}
//
//
//
// Add the RSD_PTR to the system table and store that we have installed the
// tables.
//
if (((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) &&
return EFI_ABORTED;
}
}
if (((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 ||
(Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) &&
return EFI_ABORTED;
}
}
return EFI_SUCCESS;
}
/**
Note that the ACPI table should be checksumed before installing it.
Otherwise it will assert.
@param This Protocol instance pointer.
@param AcpiTableBuffer A pointer to a buffer containing the ACPI table to be installed.
@param AcpiTableBufferSize Specifies the size, in bytes, of the AcpiTableBuffer buffer.
@param TableKey Reurns a key to refer to the ACPI table.
@return EFI_SUCCESS The table was successfully inserted.
@return 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.
@return EFI_OUT_OF_RESOURCES Insufficient resources exist to complete the request.
**/
)
{
//
// Check for invalid input parameters
//
return EFI_INVALID_PARAMETER;
}
//
// Get the instance of the ACPI table protocol
//
//
// Install the ACPI table
//
*TableKey = 0;
Status = SetAcpiTable (
TRUE,
);
Status = PublishTables (
);
}
//
// Add a new table successfully, notify registed callback
//
if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) {
);
}
}
return Status;
}
/**
@param This Protocol instance pointer.
@param TableKey Specifies the table to uninstall. The key was returned from InstallAcpiTable().
@return EFI_SUCCESS The table was successfully uninstalled.
@return EFI_NOT_FOUND TableKey does not refer to a valid key for a table entry.
**/
)
{
//
// Get the instance of the ACPI table protocol
//
//
// Uninstall the ACPI table
//
Status = SetAcpiTable (
NULL,
);
Status = PublishTables (
);
}
return EFI_NOT_FOUND;
} else {
return EFI_SUCCESS;
}
}
/**
If the number of APCI tables exceeds the preallocated max table number, enlarge the table buffer.
@param AcpiTableInstance ACPI table protocol instance data structure.
@return EFI_SUCCESS reallocate the table beffer successfully.
@return EFI_OUT_OF_RESOURCES Unable to allocate required resources.
**/
)
{
//
// Enlarge the max table number from mEfiAcpiMaxNumTables to mEfiAcpiMaxNumTables + EFI_ACPI_MAX_NUM_TABLES
//
//
// Create RSDT, XSDT structures and allocate buffers.
//
NewMaxTableNumber * sizeof (UINT32) +
sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 2.0/3.0 RSDT
NewMaxTableNumber * sizeof (UINT32) +
sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 2.0/3.0 XSDT
NewMaxTableNumber * sizeof (UINT64);
//
// Allocate memory in the lower 32 bit of address range for
// compatibility with ACPI 1.0 OS.
//
// This is done because ACPI 1.0 pointers are 32 bit values.
// ACPI 2.0 OS and all 64 bit OS must use the 64 bit ACPI table addresses.
// There is no architectural reason these should be below 4GB, it is purely
// for convenience of implementation that we force memory below 4GB.
//
PageAddress = 0xFFFFFFFF;
);
return EFI_OUT_OF_RESOURCES;
}
//
// Update RSDP to point to the new Rsdt and Xsdt address.
//
//
// copy the original Rsdt1, Rsdt3 and Xsdt structure to new buffer
//
CopyMem (AcpiTableInstance->Rsdt1, TempPrivateData.Rsdt1, (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + mEfiAcpiMaxNumTables * sizeof (UINT32)));
CopyMem (AcpiTableInstance->Rsdt3, TempPrivateData.Rsdt3, (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + mEfiAcpiMaxNumTables * sizeof (UINT32)));
CopyMem (AcpiTableInstance->Xsdt, TempPrivateData.Xsdt, (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + mEfiAcpiMaxNumTables * sizeof (UINT64)));
//
// Calculate orignal ACPI table buffer size
//
mEfiAcpiMaxNumTables * sizeof (UINT32) +
sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 2.0/3.0 RSDT
mEfiAcpiMaxNumTables * sizeof (UINT32) +
sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 2.0/3.0 XSDT
mEfiAcpiMaxNumTables * sizeof (UINT64);
//
// Update the Max ACPI table number
//
return EFI_SUCCESS;
}
/**
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.
@param AcpiTableInstance Instance of the protocol.
@param Table Table to add.
@param Checksum Does the table require checksumming.
@param Version The version of the list to add the table to.
@param Handle Pointer for returning the handle.
@return EFI_SUCCESS The function completed successfully.
@return EFI_OUT_OF_RESOURCES Could not allocate a required resource.
@return EFI_ABORTED The table is a duplicate of a table that is required
to be unique.
**/
)
{
//
// Check for invalid input parameters
//
//
// Init locals
//
//
// Create a new list entry
//
//
// Determine table type and size
//
//
// Allocate a buffer for the table. All tables are allocated in the lower 32 bits of address space
// for backwards compatibility with ACPI 1.0 OS.
//
// This is done because ACPI 1.0 pointers are 32 bit values.
// ACPI 2.0 OS and all 64 bit OS must use the 64 bit ACPI table addresses.
// There is no architectural reason these should be below 4GB, it is purely
// for convenience of implementation that we force memory below 4GB.
//
//
// Allocation memory type depends on the type of the table
//
//
// Allocate memory for the FACS. This structure must be aligned
// on a 64 byte boundary and must be ACPI NVS memory.
// Using AllocatePages should ensure that it is always aligned.
// Do not change signature for new ACPI version because they are same.
//
// UEFI table also need to be in ACPI NVS memory, because some data field
// could be updated by OS present agent. For example, BufferPtrAddress in
// SMM communication ACPI table.
//
);
} else {
//
// All other tables are ACPI reclaim memory, no alignment requirements.
//
);
}
//
// Check return value from memory alloc.
//
return EFI_OUT_OF_RESOURCES;
}
//
// Update the table pointer with the allocated memory start
//
//
// Initialize the table contents
//
//
// Update internal pointers if this is a required table. If it is a required
// table and a table of that type already exists, return an error.
//
// Calculate the checksum if the table is not FACS.
//
switch (CurrentTableSignature) {
//
// We don't add the FADT in the standard way because some
// OS expect the FADT to be early in the table list.
// So we always add it as the first element in the list.
//
//
// Check that the table has not been previously added.
//
) {
return EFI_ABORTED;
}
//
// Add the table to the appropriate table version
//
if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
//
// Save a pointer to the table
//
//
// Update pointers in FADT. If tables don't exist this will put NULL pointers there.
//
//
// RSDP OEM information is updated to match the FADT OEM information
//
CopyMem (
6
);
//
// RSDT OEM information is updated to match the FADT OEM information.
//
CopyMem (
6
);
CopyMem (
sizeof (UINT64)
);
}
if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 ||
(Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) {
//
// Save a pointer to the table
//
//
// Update pointers in FADT. If tables don't exist this will put NULL pointers there.
//
CopyMem (
&Buffer64,
sizeof (UINT64)
);
CopyMem (
&Buffer64,
sizeof (UINT64)
);
//
// RSDP OEM information is updated to match the FADT OEM information
//
CopyMem (
6
);
//
// RSDT OEM information is updated to match FADT OEM information.
//
CopyMem (
6
);
CopyMem (
sizeof (UINT64)
);
//
// XSDT OEM information is updated to match FADT OEM information.
//
CopyMem (
6
);
CopyMem (
sizeof (UINT64)
);
}
//
// Checksum the table
//
if (Checksum) {
);
}
break;
//
// Check that the table has not been previously added.
//
) {
return EFI_ABORTED;
}
//
// FACS is referenced by FADT and is not part of RSDT
//
//
// Add the table to the appropriate table version
//
if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
//
// Save a pointer to the table
//
AcpiTableInstance->Facs1 = (EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) CurrentTableList->Table;
//
// If FADT already exists, update table pointers.
//
//
// Checksum FADT table
//
);
}
}
if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 ||
(Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) {
//
// Save a pointer to the table
//
AcpiTableInstance->Facs3 = (EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) CurrentTableList->Table;
//
// If FADT already exists, update table pointers.
//
CopyMem (
&Buffer64,
sizeof (UINT64)
);
//
// Checksum FADT table
//
);
}
}
break;
//
// Check that the table has not been previously added.
//
) {
return EFI_ABORTED;
}
//
// DSDT is referenced by FADT and is not part of RSDT
//
//
// Add the table to the appropriate table version
//
if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
//
// Save a pointer to the table
//
//
// If FADT already exists, update table pointers.
//
//
// Checksum FADT table
//
);
}
}
if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 ||
(Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) {
//
// Save a pointer to the table
//
//
// If FADT already exists, update table pointers.
//
CopyMem (
&Buffer64,
sizeof (UINT64)
);
//
// Checksum FADT table
//
);
}
}
//
// Checksum the table
//
if (Checksum) {
);
}
break;
default:
//
// Checksum the table
//
if (Checksum) {
);
}
break;
}
//
// Add the table to the current list of tables
//
//
//
//
// Add to ACPI 1.0b table tree
//
if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
if (AddToRsdt) {
//
// If the table number exceed the gEfiAcpiMaxNumTables, enlarge the table buffer
//
}
CurrentRsdtEntry = (UINT32 *)
(
sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
sizeof (UINT32)
);
//
// Add entry to the RSDT unless its the FACS or DSDT
//
//
// Update RSDT length
//
}
}
//
// Add to ACPI 2.0/3.0 table tree
//
if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 ||
(Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) {
if (AddToRsdt) {
//
// If the table number exceed the gEfiAcpiMaxNumTables, enlarge the table buffer
//
}
//
// At this time, it is assumed that RSDT and XSDT maintain parallel lists of tables.
// If it becomes necessary to maintain separate table lists, changes will be required.
//
CurrentRsdtEntry = (UINT32 *)
(
sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
sizeof (UINT32)
);
//
// This pointer must not be directly dereferenced as the XSDT entries may not
// be 64 bit aligned resulting in a possible fault. Use CopyMem to update.
//
CurrentXsdtEntry = (VOID *)
(
sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
sizeof (UINT64)
);
//
// Add entry to the RSDT
//
//
// Update RSDT length
//
//
// Add entry to XSDT, XSDT expects 64 bit pointers, but
// the table pointers in XSDT are not aligned on 8 byte boundary.
//
CopyMem (
&Buffer64,
sizeof (UINT64)
);
//
// Update length
//
}
}
return EFI_SUCCESS;
}
/**
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.
@param Handle Table to find.
@param TableList Table list to search
@param Table Pointer to table found.
@return EFI_SUCCESS The function completed successfully.
@return EFI_NOT_FOUND No table found matching the handle specified.
**/
)
{
//
// Check for invalid input parameters
//
//
// Find the table
//
while (CurrentLink != TableList) {
//
// Found handle, so return this table.
//
*Table = CurrentTable;
return EFI_SUCCESS;
}
}
//
// Table not found
//
return EFI_NOT_FOUND;
}
/**
For Acpi 1.0 tables, pass in the Rsdt.
For Acpi 2.0 tables, pass in both Rsdt and Xsdt.
@param Table Pointer to table found.
@param Rsdt Pointer to the RSDT to remove from
@param Xsdt Pointer to the Xsdt to remove from
@return EFI_SUCCESS The function completed successfully.
@return EFI_INVALID_PARAMETER The table was not found in both Rsdt and Xsdt.
**/
)
{
//
// Check for invalid input parameters
//
//
// Find the table entry in the RSDT and XSDT
//
//
// At this time, it is assumed that RSDT and XSDT maintain parallel lists of tables.
// If it becomes necessary to maintain separate table lists, changes will be required.
//
CurrentRsdtEntry = (UINT32 *) ((UINT8 *) Rsdt + sizeof (EFI_ACPI_DESCRIPTION_HEADER) + Index * sizeof (UINT32));
//
// This pointer must not be directly dereferenced as the XSDT entries may not
// be 64 bit aligned resulting in a possible fault. Use CopyMem to update.
//
CurrentXsdtEntry = (VOID *) ((UINT8 *) Xsdt + sizeof (EFI_ACPI_DESCRIPTION_HEADER) + Index * sizeof (UINT64));
//
// Read the entry value out of the XSDT
//
} else {
//
// Initialize to NULL
//
CurrentXsdtEntry = 0;
}
//
// Check if we have found the corresponding entry in both RSDT and XSDT
//
) {
//
// Found entry, so copy all following entries and shrink table
// We actually copy all + 1 to copy the initialized value of memory over
// the last entry.
//
CopyMem (CurrentRsdtEntry, CurrentRsdtEntry + 1, (*NumberOfTableEntries - Index) * sizeof (UINT32));
CopyMem (CurrentXsdtEntry, ((UINT64 *) CurrentXsdtEntry) + 1, (*NumberOfTableEntries - Index) * sizeof (UINT64));
}
break;
//
// At the last entry, and table not found
//
return EFI_INVALID_PARAMETER;
}
}
//
// Checksum the tables
//
Rsdt,
);
Xsdt,
);
}
//
// Decrement the number of tables
//
(*NumberOfTableEntries)--;
return EFI_SUCCESS;
}
/**
This function removes a table and frees any associated memory.
@param AcpiTableInstance Instance of the protocol.
@param Version Version(s) to delete.
@param Table Pointer to table found.
@return EFI_SUCCESS The function completed successfully.
**/
)
{
//
// Check for invalid input parameters
//
//
// Init locals
//
//
// Check for Table->Table
//
//
// Basic tasks to accomplish delete are:
// Remove any table references to the table
// If no one is using the table
// Free the table (removing pointers from private data and tables)
// Remove from list
// Free list structure
//
//
// Determine if this table is in the RSDT or XSDT
//
) {
}
//
// We don't remove the FADT in the standard way because some
// OS expect the FADT to be early in the table list.
// So we always put it as the first element in the list.
//
}
//
// Remove the table from RSDT and XSDT
//
//
//
//
// Remove this version from the table
//
}
//
// Remove this version from the table
//
//
// Remove from Rsdt. We don't care about the return value because it is
// acceptable for the table to not exist in Rsdt.
// We didn't add some tables so we don't remove them.
//
if (RemoveFromRsdt) {
);
}
}
//
// Remove this version from the table
//
}
}
//
// Remove from Rsdt and Xsdt. We don't care about the return value
// We didn't add some tables so we don't remove them.
//
if (RemoveFromRsdt) {
);
}
}
//
// Free the table, clean up any dependent tables and our private data pointers.
//
if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
}
if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 ||
(Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) {
}
break;
if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
//
// Update FADT table pointers
//
//
// Checksum table
//
);
}
}
if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 ||
(Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) {
//
// Update FADT table pointers
//
//
// Checksum table
//
);
}
}
break;
if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
//
// Update FADT table pointers
//
//
// Checksum table
//
);
}
}
if ((Version & EFI_ACPI_TABLE_VERSION_2_0) != 0 ||
(Version & EFI_ACPI_TABLE_VERSION_3_0) != 0) {
//
// Update FADT table pointers
//
//
// Checksum table
//
);
}
}
break;
default:
//
// Do nothing
//
break;
}
}
//
// If no version is using this table anymore, remove and free list entry.
//
//
// Free the Table
//
}
//
// Done
//
return EFI_SUCCESS;
}
/**
This function finds and removes the table specified by the handle.
@param AcpiTableInstance Instance of the protocol.
@param Version Bitmask of which versions to remove.
@param Handle Table to remove.
@return EFI_SUCCESS The function completed successfully.
@return EFI_ABORTED An error occurred.
@return EFI_NOT_FOUND Handle not found in table list.
**/
)
{
//
// Check for invalid input parameters
//
//
// Find the table
//
);
return EFI_NOT_FOUND;
}
//
// Remove the table
//
return EFI_ABORTED;
}
//
// Completed successfully
//
return EFI_SUCCESS;
}
/**
This function calculates and updates an UINT8 checksum.
@param Buffer Pointer to buffer to checksum
@param Size Number of bytes to checksum
@param ChecksumOffset Offset to place the checksum result in
@return EFI_SUCCESS The function completed successfully.
**/
)
{
Sum = 0;
//
// Initialize pointer
//
//
// set checksum to 0 first
//
Ptr[ChecksumOffset] = 0;
//
// add all content of buffer
//
while ((Size--) != 0) {
}
//
// set checksum
//
return EFI_SUCCESS;
}
/**
Checksum all versions of the common tables, RSDP, RSDT, XSDT.
@param AcpiTableInstance Protocol instance private data.
@return EFI_SUCCESS The function completed successfully.
**/
)
{
//
// RSDP ACPI 1.0 checksum for 1.0 table. This is only the first 20 bytes of the structure
//
);
//
// RSDP ACPI 1.0 checksum for 2.0/3.0 table. This is only the first 20 bytes of the structure
//
);
//
// RSDP ACPI 2.0/3.0 checksum, this is the entire table
//
);
//
// RSDT checksums
//
);
);
//
// XSDT checksum
//
);
return EFI_SUCCESS;
}
/**
Constructor for the ACPI table protocol. Initializes instance
data.
@param AcpiTableInstance Instance to construct
@return EFI_SUCCESS Instance initialized.
@return EFI_OUT_OF_RESOURCES Unable to allocate required resources.
**/
)
{
//
// Check for invalid input parameters
//
if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) {
}
//
// Create RSDP table
//
PageAddress = 0xFFFFFFFF;
);
return EFI_OUT_OF_RESOURCES;
}
Pointer += sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER);
//
// Create RSDT, XSDT structures
//
mEfiAcpiMaxNumTables * sizeof (UINT32) +
sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 2.0/3.0 RSDT
mEfiAcpiMaxNumTables * sizeof (UINT32) +
sizeof (EFI_ACPI_DESCRIPTION_HEADER) + // for ACPI 2.0/3.0 XSDT
mEfiAcpiMaxNumTables * sizeof (UINT64);
//
// Allocate memory in the lower 32 bit of address range for
// compatibility with ACPI 1.0 OS.
//
// This is done because ACPI 1.0 pointers are 32 bit values.
// ACPI 2.0 OS and all 64 bit OS must use the 64 bit ACPI table addresses.
// There is no architectural reason these should be below 4GB, it is purely
// for convenience of implementation that we force memory below 4GB.
//
PageAddress = 0xFFFFFFFF;
);
gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)AcpiTableInstance->Rsdp1, EFI_SIZE_TO_PAGES (RsdpTableSize));
return EFI_OUT_OF_RESOURCES;
}
//
// Initialize RSDP
//
//
// Initialize Rsdt
//
// Note that we "reserve" one entry for the FADT so it can always be
// at the beginning of the list of tables. Some OS don't seem
// to find it correctly if it is too far down the list.
//
//
// We always reserve first one for FADT
//
//
// We always reserve first one for FADT
//
//
// Initialize Xsdt
//
//
// We always reserve first one for FADT
//
//
// Completed successfully
//
return EFI_SUCCESS;
}