mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 14:44:28 +02:00
Add ACPI drivers:
* Universal/Acpi/AcpiTableDxe Implementation of EFI_ACPI_TABLE_PROTOCOL (MdePkg/Include/Protocol/AcpiTable.h) * Universal/Acpi/AcpiPlatformDxe Sample "ACPI Platform Driver" which populates the system ACPI tables by reading them from an FFS file and using EFI_ACPI_TABLE_PROTOCOL to make them available to the system. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7917 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
3c506ddd9e
commit
5f55c70046
@ -330,6 +330,9 @@
|
|||||||
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||||
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
|
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
|
||||||
|
|
||||||
|
MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
|
||||||
|
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
|
||||||
|
|
||||||
[Components.IA32, Components.X64]
|
[Components.IA32, Components.X64]
|
||||||
MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf
|
MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf
|
||||||
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||||
|
254
MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c
Executable file
254
MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c
Executable file
@ -0,0 +1,254 @@
|
|||||||
|
/** @file
|
||||||
|
Sample ACPI Platform Driver
|
||||||
|
|
||||||
|
Copyright (c) 2008 - 2009, Intel Corporation<BR>
|
||||||
|
All rights reserved. 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
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <PiDxe.h>
|
||||||
|
|
||||||
|
#include <Protocol/AcpiTable.h>
|
||||||
|
#include <Protocol/FirmwareVolume2.h>
|
||||||
|
|
||||||
|
#include <Library/BaseLib.h>
|
||||||
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/PcdLib.h>
|
||||||
|
|
||||||
|
#include <IndustryStandard/Acpi.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
Locate the first instance of a protocol. If the protocol requested is an
|
||||||
|
FV protocol, then it will return the first FV that contains the ACPI table
|
||||||
|
storage file.
|
||||||
|
|
||||||
|
@param Protocol The protocol to find.
|
||||||
|
@param Instance Return pointer to the first instance of the protocol
|
||||||
|
|
||||||
|
@return EFI_SUCCESS The function completed successfully.
|
||||||
|
@return EFI_NOT_FOUND The protocol could not be located.
|
||||||
|
@return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
LocateFvInstanceWithTables (
|
||||||
|
OUT EFI_FIRMWARE_VOLUME2_PROTOCOL **Instance
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_HANDLE *HandleBuffer;
|
||||||
|
UINTN NumberOfHandles;
|
||||||
|
EFI_FV_FILETYPE FileType;
|
||||||
|
UINT32 FvStatus;
|
||||||
|
EFI_FV_FILE_ATTRIBUTES Attributes;
|
||||||
|
UINTN Size;
|
||||||
|
UINTN Index;
|
||||||
|
EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance;
|
||||||
|
|
||||||
|
FvStatus = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Locate protocol.
|
||||||
|
//
|
||||||
|
Status = gBS->LocateHandleBuffer (
|
||||||
|
ByProtocol,
|
||||||
|
&gEfiFirmwareVolume2ProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
&NumberOfHandles,
|
||||||
|
&HandleBuffer
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// Defined errors at this time are not found and out of resources.
|
||||||
|
//
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Looking for FV with ACPI storage file
|
||||||
|
//
|
||||||
|
|
||||||
|
for (Index = 0; Index < NumberOfHandles; Index++) {
|
||||||
|
//
|
||||||
|
// Get the protocol on this handle
|
||||||
|
// This should not fail because of LocateHandleBuffer
|
||||||
|
//
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
HandleBuffer[Index],
|
||||||
|
&gEfiFirmwareVolume2ProtocolGuid,
|
||||||
|
(VOID**) &FvInstance
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
//
|
||||||
|
// See if it has the ACPI storage file
|
||||||
|
//
|
||||||
|
Status = FvInstance->ReadFile (
|
||||||
|
FvInstance,
|
||||||
|
FixedPcdGetPtr (PcdAcpiTableStorageFile),
|
||||||
|
NULL,
|
||||||
|
&Size,
|
||||||
|
&FileType,
|
||||||
|
&Attributes,
|
||||||
|
&FvStatus
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// If we found it, then we are done
|
||||||
|
//
|
||||||
|
if (Status == EFI_SUCCESS) {
|
||||||
|
*Instance = FvInstance;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Our exit status is determined by the success of the previous operations
|
||||||
|
// If the protocol was found, Instance already points to it.
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Free any allocated buffers
|
||||||
|
//
|
||||||
|
gBS->FreePool (HandleBuffer);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function calculates and updates an UINT8 checksum.
|
||||||
|
|
||||||
|
@param Buffer Pointer to buffer to checksum
|
||||||
|
@param Size Number of bytes to checksum
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
AcpiPlatformChecksum (
|
||||||
|
IN UINT8 *Buffer,
|
||||||
|
IN UINTN Size
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN ChecksumOffset;
|
||||||
|
|
||||||
|
ChecksumOffset = OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set checksum to 0 first
|
||||||
|
//
|
||||||
|
Buffer[ChecksumOffset] = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update checksum value
|
||||||
|
//
|
||||||
|
Buffer[ChecksumOffset] = CalculateCheckSum8(Buffer, Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Entrypoint of Acpi Platform driver.
|
||||||
|
|
||||||
|
@param ImageHandle
|
||||||
|
@param SystemTable
|
||||||
|
|
||||||
|
@return EFI_SUCCESS
|
||||||
|
@return EFI_LOAD_ERROR
|
||||||
|
@return EFI_OUT_OF_RESOURCES
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
AcpiPlatformEntryPoint (
|
||||||
|
IN EFI_HANDLE ImageHandle,
|
||||||
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
|
||||||
|
EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol;
|
||||||
|
INTN Instance;
|
||||||
|
EFI_ACPI_COMMON_HEADER *CurrentTable;
|
||||||
|
UINTN TableHandle;
|
||||||
|
UINT32 FvStatus;
|
||||||
|
UINTN TableSize;
|
||||||
|
UINTN Size;
|
||||||
|
|
||||||
|
Instance = 0;
|
||||||
|
CurrentTable = NULL;
|
||||||
|
TableHandle = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find the AcpiTable protocol
|
||||||
|
//
|
||||||
|
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return EFI_ABORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Locate the firmware volume protocol
|
||||||
|
//
|
||||||
|
Status = LocateFvInstanceWithTables (&FwVol);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return EFI_ABORTED;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Read tables from the storage file.
|
||||||
|
//
|
||||||
|
while (Status == EFI_SUCCESS) {
|
||||||
|
|
||||||
|
Status = FwVol->ReadSection (
|
||||||
|
FwVol,
|
||||||
|
FixedPcdGetPtr (PcdAcpiTableStorageFile),
|
||||||
|
EFI_SECTION_RAW,
|
||||||
|
Instance,
|
||||||
|
(VOID**) &CurrentTable,
|
||||||
|
&Size,
|
||||||
|
&FvStatus
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR(Status)) {
|
||||||
|
//
|
||||||
|
// Add the table
|
||||||
|
//
|
||||||
|
TableHandle = 0;
|
||||||
|
|
||||||
|
TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
|
||||||
|
ASSERT (Size >= TableSize);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checksum ACPI table
|
||||||
|
//
|
||||||
|
AcpiPlatformChecksum ((UINT8*)CurrentTable, TableSize);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Install ACPI table
|
||||||
|
//
|
||||||
|
Status = AcpiTable->InstallAcpiTable (
|
||||||
|
AcpiTable,
|
||||||
|
CurrentTable,
|
||||||
|
TableSize,
|
||||||
|
&TableHandle
|
||||||
|
);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
return EFI_ABORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Increment the instance
|
||||||
|
//
|
||||||
|
Instance++;
|
||||||
|
CurrentTable = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
55
MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
Executable file
55
MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#/** @file
|
||||||
|
# Sample ACPI Platform Driver
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 - 2009, Intel Corporation. <BR>
|
||||||
|
# All rights reserved. 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
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
#**/
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = AcpiPlatform
|
||||||
|
FILE_GUID = cb933912-df8f-4305-b1f9-7b44fa11395c
|
||||||
|
MODULE_TYPE = DXE_DRIVER
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
EDK_RELEASE_VERSION = 0x00020000
|
||||||
|
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||||
|
ENTRY_POINT = AcpiPlatformEntryPoint
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources.common]
|
||||||
|
AcpiPlatform.c
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
UefiLib
|
||||||
|
DxeServicesLib
|
||||||
|
PcdLib
|
||||||
|
BaseMemoryLib
|
||||||
|
DebugLib
|
||||||
|
UefiBootServicesTableLib
|
||||||
|
UefiDriverEntryPoint
|
||||||
|
|
||||||
|
[Protocols]
|
||||||
|
gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
|
||||||
|
[FixedPcd.common]
|
||||||
|
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile
|
||||||
|
|
||||||
|
[Depex]
|
||||||
|
gEfiAcpiTableProtocolGuid
|
||||||
|
|
77
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.c
Executable file
77
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.c
Executable file
@ -0,0 +1,77 @@
|
|||||||
|
/** @file
|
||||||
|
ACPI Table Protocol Driver
|
||||||
|
|
||||||
|
Copyright (c) 2006, 2008, 2009, Intel Corporation<BR>
|
||||||
|
All rights reserved. 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
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle to install ACPI Table Protocol
|
||||||
|
//
|
||||||
|
EFI_HANDLE mHandle = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Entry point of the ACPI table driver.
|
||||||
|
Creates and initializes an instance of the ACPI Table
|
||||||
|
Protocol and installs it on a new handle.
|
||||||
|
|
||||||
|
@param ImageHandle A handle for the image that is initializing this driver.
|
||||||
|
@param SystemTable A pointer to the EFI system table.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS Driver initialized successfully.
|
||||||
|
@return EFI_LOAD_ERROR Failed to Initialize or has been loaded.
|
||||||
|
@return EFI_OUT_OF_RESOURCES Could not allocate needed resources.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
InitializeAcpiTableDxe (
|
||||||
|
IN EFI_HANDLE ImageHandle,
|
||||||
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_ACPI_TABLE_INSTANCE *PrivateData;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize our protocol
|
||||||
|
//
|
||||||
|
PrivateData = AllocateZeroPool (sizeof (EFI_ACPI_TABLE_INSTANCE));
|
||||||
|
ASSERT (PrivateData);
|
||||||
|
PrivateData->Signature = EFI_ACPI_TABLE_SIGNATURE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Call all constructors per produced protocols
|
||||||
|
//
|
||||||
|
Status = AcpiTableAcpiTableConstructor (PrivateData);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
gBS->FreePool (PrivateData);
|
||||||
|
return EFI_LOAD_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Install ACPI Table protocol
|
||||||
|
//
|
||||||
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
|
&mHandle,
|
||||||
|
&gEfiAcpiTableProtocolGuid,
|
||||||
|
&PrivateData->AcpiTableProtocol,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
197
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h
Executable file
197
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h
Executable file
@ -0,0 +1,197 @@
|
|||||||
|
/** @file
|
||||||
|
ACPI Table Protocol Driver
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
|
All rights reserved. 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
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef _ACPI_TABLE_H_
|
||||||
|
#define _ACPI_TABLE_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <PiDxe.h>
|
||||||
|
|
||||||
|
#include <Protocol/AcpiTable.h>
|
||||||
|
#include <Guid/Acpi.h>
|
||||||
|
|
||||||
|
#include <Library/BaseLib.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/UefiLib.h>
|
||||||
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
#include <Library/UefiDriverEntryPoint.h>
|
||||||
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
#include <Library/PcdLib.h>
|
||||||
|
|
||||||
|
//
|
||||||
|
// Statements that include other files
|
||||||
|
//
|
||||||
|
#include <IndustryStandard/Acpi.h>
|
||||||
|
|
||||||
|
//
|
||||||
|
// From Protocol/AcpiSupport.h
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// ACPI Version bitmap definition:
|
||||||
|
//
|
||||||
|
// EFI_ACPI_TABLE_VERSION_1_0B - ACPI Version 1.0b
|
||||||
|
// EFI_ACPI_TABLE_VERSION_2_0 - ACPI Version 2.0
|
||||||
|
// EFI_ACPI_TABLE_VERSION_3_0 - ACPI Version 3.0
|
||||||
|
// EFI_ACPI_TABLE_VERSION_NONE - No ACPI Versions. This might be used
|
||||||
|
// to create memory-based operation regions or other information
|
||||||
|
// that is not part of the ACPI "tree" but must still be found
|
||||||
|
// in ACPI memory space and/or managed by the core ACPI driver.
|
||||||
|
//
|
||||||
|
// Note that EFI provides discrete GUIDs for each version of ACPI
|
||||||
|
// that is supported. It is expected that each EFI GUIDed
|
||||||
|
// version of ACPI will also have a corresponding bitmap
|
||||||
|
// definition. This allows maintenance of separate ACPI trees
|
||||||
|
// for each distinctly different version of ACPI.
|
||||||
|
//
|
||||||
|
#define EFI_ACPI_TABLE_VERSION UINT32
|
||||||
|
|
||||||
|
#define EFI_ACPI_TABLE_VERSION_NONE (1 << 0)
|
||||||
|
#define EFI_ACPI_TABLE_VERSION_1_0B (1 << 1)
|
||||||
|
#define EFI_ACPI_TABLE_VERSION_2_0 (1 << 2)
|
||||||
|
#define EFI_ACPI_TABLE_VERSION_3_0 (1 << 3)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Private Driver Data
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ACPI Table Linked List Signature.
|
||||||
|
//
|
||||||
|
#define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')
|
||||||
|
|
||||||
|
//
|
||||||
|
// ACPI Table Linked List Entry definition.
|
||||||
|
//
|
||||||
|
// Signature must be set to EFI_ACPI_TABLE_LIST_SIGNATURE
|
||||||
|
// Link is the linked list data.
|
||||||
|
// Version is the versions of the ACPI tables that this table belongs in.
|
||||||
|
// Table is a pointer to the table.
|
||||||
|
// PageAddress is the address of the pages allocated for the table.
|
||||||
|
// NumberOfPages is the number of pages allocated at PageAddress.
|
||||||
|
// Handle is used to identify a particular table.
|
||||||
|
//
|
||||||
|
typedef struct {
|
||||||
|
UINT32 Signature;
|
||||||
|
LIST_ENTRY Link;
|
||||||
|
EFI_ACPI_TABLE_VERSION Version;
|
||||||
|
EFI_ACPI_COMMON_HEADER *Table;
|
||||||
|
EFI_PHYSICAL_ADDRESS PageAddress;
|
||||||
|
UINTN NumberOfPages;
|
||||||
|
UINTN Handle;
|
||||||
|
} EFI_ACPI_TABLE_LIST;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Containment record for linked list.
|
||||||
|
//
|
||||||
|
#define EFI_ACPI_TABLE_LIST_FROM_LINK(_link) CR (_link, EFI_ACPI_TABLE_LIST, Link, EFI_ACPI_TABLE_LIST_SIGNATURE)
|
||||||
|
|
||||||
|
//
|
||||||
|
// The maximum number of tables this driver supports
|
||||||
|
//
|
||||||
|
#define EFI_ACPI_MAX_NUM_TABLES 20
|
||||||
|
|
||||||
|
//
|
||||||
|
// ACPI table information used to initialize tables.
|
||||||
|
//
|
||||||
|
#define EFI_ACPI_OEM_ID "INTEL "
|
||||||
|
#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('E', 'D', 'K', '2', ' ', ' ', ' ', ' ')
|
||||||
|
#define EFI_ACPI_OEM_REVISION 0x00000002
|
||||||
|
#define EFI_ACPI_CREATOR_ID 0x20202020
|
||||||
|
#define EFI_ACPI_CREATOR_REVISION 0x01000013
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protocol private structure definition
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ACPI support protocol instance signature definition.
|
||||||
|
//
|
||||||
|
#define EFI_ACPI_TABLE_SIGNATURE SIGNATURE_32 ('S', 'T', 'A', 'E')
|
||||||
|
|
||||||
|
//
|
||||||
|
// ACPI support protocol instance data structure
|
||||||
|
//
|
||||||
|
typedef struct {
|
||||||
|
UINTN Signature;
|
||||||
|
EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp1; // Pointer to RSD_PTR structure
|
||||||
|
EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp3; // Pointer to RSD_PTR structure
|
||||||
|
EFI_ACPI_DESCRIPTION_HEADER *Rsdt1; // Pointer to RSDT table header
|
||||||
|
EFI_ACPI_DESCRIPTION_HEADER *Rsdt3; // Pointer to RSDT table header
|
||||||
|
EFI_ACPI_DESCRIPTION_HEADER *Xsdt; // Pointer to XSDT table header
|
||||||
|
EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt1; // Pointer to FADT table header
|
||||||
|
EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt3; // Pointer to FADT table header
|
||||||
|
EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs1; // Pointer to FACS table header
|
||||||
|
EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs3; // Pointer to FACS table header
|
||||||
|
EFI_ACPI_DESCRIPTION_HEADER *Dsdt1; // Pointer to DSDT table header
|
||||||
|
EFI_ACPI_DESCRIPTION_HEADER *Dsdt3; // Pointer to DSDT table header
|
||||||
|
LIST_ENTRY TableList;
|
||||||
|
UINTN NumberOfTableEntries1; // Number of ACPI 1.0 tables
|
||||||
|
UINTN NumberOfTableEntries3; // Number of ACPI 3.0 tables
|
||||||
|
UINTN CurrentHandle;
|
||||||
|
BOOLEAN TablesInstalled1; // ACPI 1.0 tables published
|
||||||
|
BOOLEAN TablesInstalled3; // ACPI 3.0 tables published
|
||||||
|
EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;
|
||||||
|
} EFI_ACPI_TABLE_INSTANCE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// ACPI table protocol instance containing record macro
|
||||||
|
//
|
||||||
|
#define EFI_ACPI_TABLE_INSTANCE_FROM_THIS(a) \
|
||||||
|
CR (a, \
|
||||||
|
EFI_ACPI_TABLE_INSTANCE, \
|
||||||
|
AcpiTableProtocol, \
|
||||||
|
EFI_ACPI_TABLE_SIGNATURE \
|
||||||
|
)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protocol Constructor functions
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
Constructor for the ACPI support protocol. Initializes instance
|
||||||
|
data.
|
||||||
|
|
||||||
|
@param AcpiTableInstance Instance to construct
|
||||||
|
|
||||||
|
@return EFI_SUCCESS Instance initialized.
|
||||||
|
@return EFI_OUT_OF_RESOURCES Unable to allocate required resources.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
AcpiTableAcpiTableConstructor (
|
||||||
|
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Entry point of the ACPI table driver.
|
||||||
|
Creates and initializes an instance of the ACPI Table
|
||||||
|
Protocol and installs it on a new handle.
|
||||||
|
|
||||||
|
@param ImageHandle A handle for the image that is initializing this driver
|
||||||
|
@param SystemTable A pointer to the EFI system table
|
||||||
|
|
||||||
|
@return EFI_SUCCESS Driver initialized successfully
|
||||||
|
@return EFI_LOAD_ERROR Failed to Initialize or has been loaded
|
||||||
|
@return EFI_OUT_OF_RESOURCES Could not allocate needed resources
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
InitializeAcpiTableDxe (
|
||||||
|
IN EFI_HANDLE ImageHandle,
|
||||||
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
60
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
Executable file
60
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
Executable file
@ -0,0 +1,60 @@
|
|||||||
|
#/** @file
|
||||||
|
# ACPI Table Protocol Driver
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006, 2008, 2009 Intel Corporation<BR> All rights
|
||||||
|
# reserved. 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
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
#**/
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = AcpiTableDxe
|
||||||
|
FILE_GUID = 506533a6-e626-4500-b14f-17939c0e5b60
|
||||||
|
MODULE_TYPE = DXE_DRIVER
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
EDK_RELEASE_VERSION = 0x00020000
|
||||||
|
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||||
|
|
||||||
|
ENTRY_POINT = InitializeAcpiTableDxe
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources.common]
|
||||||
|
AcpiTableProtocol.c
|
||||||
|
AcpiTable.h
|
||||||
|
AcpiTable.c
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
UefiBootServicesTableLib
|
||||||
|
MemoryAllocationLib
|
||||||
|
UefiDriverEntryPoint
|
||||||
|
BaseMemoryLib
|
||||||
|
UefiLib
|
||||||
|
DebugLib
|
||||||
|
BaseLib
|
||||||
|
PcdLib
|
||||||
|
|
||||||
|
[Guids]
|
||||||
|
gEfiAcpi10TableGuid # ALWAYS_CONSUMED
|
||||||
|
gEfiAcpiTableGuid
|
||||||
|
|
||||||
|
[Protocols]
|
||||||
|
gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||||
|
|
||||||
|
[Depex]
|
||||||
|
TRUE
|
||||||
|
|
1703
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
Executable file
1703
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
Executable file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user