MdeModulePkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the MdeModulePkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:02 -08:00
committed by mergify[bot]
parent 7c7184e201
commit 1436aea4d5
994 changed files with 107608 additions and 101311 deletions

View File

@@ -32,18 +32,18 @@
**/
EFI_STATUS
LocateFvInstanceWithTables (
OUT EFI_FIRMWARE_VOLUME2_PROTOCOL **Instance
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;
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;
@@ -51,12 +51,12 @@ LocateFvInstanceWithTables (
// Locate protocol.
//
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiFirmwareVolume2ProtocolGuid,
NULL,
&NumberOfHandles,
&HandleBuffer
);
ByProtocol,
&gEfiFirmwareVolume2ProtocolGuid,
NULL,
&NumberOfHandles,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
//
// Defined errors at this time are not found and out of resources.
@@ -64,8 +64,6 @@ LocateFvInstanceWithTables (
return Status;
}
//
// Looking for FV with ACPI storage file
//
@@ -76,10 +74,10 @@ LocateFvInstanceWithTables (
// This should not fail because of LocateHandleBuffer
//
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiFirmwareVolume2ProtocolGuid,
(VOID**) &FvInstance
);
HandleBuffer[Index],
&gEfiFirmwareVolume2ProtocolGuid,
(VOID **)&FvInstance
);
ASSERT_EFI_ERROR (Status);
//
@@ -87,7 +85,7 @@ LocateFvInstanceWithTables (
//
Status = FvInstance->ReadFile (
FvInstance,
(EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
(EFI_GUID *)PcdGetPtr (PcdAcpiTableStorageFile),
NULL,
&Size,
&FileType,
@@ -117,7 +115,6 @@ LocateFvInstanceWithTables (
return Status;
}
/**
This function calculates and updates an UINT8 checksum.
@@ -127,11 +124,11 @@ LocateFvInstanceWithTables (
**/
VOID
AcpiPlatformChecksum (
IN UINT8 *Buffer,
IN UINTN Size
IN UINT8 *Buffer,
IN UINTN Size
)
{
UINTN ChecksumOffset;
UINTN ChecksumOffset;
ChecksumOffset = OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum);
@@ -143,10 +140,9 @@ AcpiPlatformChecksum (
//
// Update checksum value
//
Buffer[ChecksumOffset] = CalculateCheckSum8(Buffer, Size);
Buffer[ChecksumOffset] = CalculateCheckSum8 (Buffer, Size);
}
/**
Entrypoint of Acpi Platform driver.
@@ -161,8 +157,8 @@ AcpiPlatformChecksum (
EFI_STATUS
EFIAPI
AcpiPlatformEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -182,7 +178,7 @@ AcpiPlatformEntryPoint (
//
// Find the AcpiTable protocol
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTable);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
@@ -194,33 +190,33 @@ AcpiPlatformEntryPoint (
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
//
// Read tables from the storage file.
//
while (Status == EFI_SUCCESS) {
Status = FwVol->ReadSection (
FwVol,
(EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
(EFI_GUID *)PcdGetPtr (PcdAcpiTableStorageFile),
EFI_SECTION_RAW,
Instance,
(VOID**) &CurrentTable,
(VOID **)&CurrentTable,
&Size,
&FvStatus
);
if (!EFI_ERROR(Status)) {
if (!EFI_ERROR (Status)) {
//
// Add the table
//
TableHandle = 0;
TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *)CurrentTable)->Length;
ASSERT (Size >= TableSize);
//
// Checksum ACPI table
//
AcpiPlatformChecksum ((UINT8*)CurrentTable, TableSize);
AcpiPlatformChecksum ((UINT8 *)CurrentTable, TableSize);
//
// Install ACPI table
@@ -237,7 +233,7 @@ AcpiPlatformEntryPoint (
//
gBS->FreePool (CurrentTable);
if (EFI_ERROR(Status)) {
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
@@ -254,4 +250,3 @@ AcpiPlatformEntryPoint (
//
return EFI_REQUEST_UNLOAD_IMAGE;
}

View File

@@ -50,10 +50,10 @@ FindTableByBuffer (
IN VOID *Buffer
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
LIST_ENTRY *CurrentLink;
EFI_ACPI_TABLE_LIST *CurrentTableList;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
LIST_ENTRY *CurrentLink;
EFI_ACPI_TABLE_LIST *CurrentTableList;
LIST_ENTRY *StartLink;
//
// Get the instance of the ACPI Table
@@ -69,7 +69,8 @@ FindTableByBuffer (
while (CurrentLink != StartLink) {
CurrentTableList = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink);
if (((UINTN)CurrentTableList->Table <= (UINTN)Buffer) &&
((UINTN)CurrentTableList->Table + CurrentTableList->TableSize > (UINTN)Buffer)) {
((UINTN)CurrentTableList->Table + CurrentTableList->TableSize > (UINTN)Buffer))
{
//
// Good! Found Table.
//
@@ -96,7 +97,7 @@ SdtUpdateAmlChecksum (
IN VOID *Buffer
)
{
EFI_ACPI_TABLE_LIST *CurrentTableList;
EFI_ACPI_TABLE_LIST *CurrentTableList;
CurrentTableList = FindTableByBuffer (Buffer);
if (CurrentTableList == NULL) {
@@ -123,11 +124,11 @@ SdtUpdateAmlChecksum (
**/
EFI_STATUS
SdtGetMaxAmlBufferSize (
IN VOID *Buffer,
OUT UINTN *MaxSize
IN VOID *Buffer,
OUT UINTN *MaxSize
)
{
EFI_ACPI_TABLE_LIST *CurrentTableList;
EFI_ACPI_TABLE_LIST *CurrentTableList;
CurrentTableList = FindTableByBuffer (Buffer);
if (CurrentTableList == NULL) {
@@ -147,16 +148,16 @@ SdtGetMaxAmlBufferSize (
**/
VOID
SdtNotifyAcpiList (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN EFI_ACPI_TABLE_VERSION Version,
IN UINTN Handle
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN EFI_ACPI_TABLE_VERSION Version,
IN UINTN Handle
)
{
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_LIST *Table;
EFI_STATUS Status;
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_LIST *Table;
EFI_STATUS Status;
//
// We should not use Table buffer, because it is user input buffer.
@@ -185,7 +186,7 @@ SdtNotifyAcpiList (
CurrentLink = CurrentLink->ForwardLink;
}
return ;
return;
}
/**
@@ -215,33 +216,35 @@ SdtNotifyAcpiList (
**/
EFI_STATUS
SdtGetAcpiTable (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
)
{
UINTN TableIndex;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_LIST *CurrentTable;
UINTN TableIndex;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_LIST *CurrentTable;
//
// Find the table
//
StartLink = &AcpiTableInstance->TableList;
CurrentLink = StartLink->ForwardLink;
TableIndex = 0;
TableIndex = 0;
while (CurrentLink != StartLink) {
if (TableIndex == Index) {
break;
}
//
// Next one
//
CurrentLink = CurrentLink->ForwardLink;
TableIndex ++;
TableIndex++;
}
if ((TableIndex != Index) || (CurrentLink == StartLink)) {
@@ -251,10 +254,10 @@ SdtGetAcpiTable (
//
// Get handle and version
//
CurrentTable = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink);
*TableKey = CurrentTable->Handle;
*Version = CurrentTable->Version;
*Table = (EFI_ACPI_SDT_HEADER *)CurrentTable->Table;
CurrentTable = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink);
*TableKey = CurrentTable->Handle;
*Version = CurrentTable->Version;
*Table = (EFI_ACPI_SDT_HEADER *)CurrentTable->Table;
return EFI_SUCCESS;
}
@@ -287,13 +290,13 @@ SdtGetAcpiTable (
EFI_STATUS
EFIAPI
GetAcpiTable2 (
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
ASSERT (Table != NULL);
ASSERT (Version != NULL);
@@ -307,7 +310,6 @@ GetAcpiTable2 (
return SdtGetAcpiTable (AcpiTableInstance, Index, Table, Version, TableKey);
}
/**
Register a callback when an ACPI table is installed.
@@ -317,11 +319,11 @@ GetAcpiTable2 (
**/
VOID
SdtRegisterNotify (
IN EFI_ACPI_NOTIFICATION_FN Notification
IN EFI_ACPI_NOTIFICATION_FN Notification
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
//
// Get the instance of the ACPI Table
@@ -345,7 +347,7 @@ SdtRegisterNotify (
//
InsertTailList (&AcpiTableInstance->NotifyList, &CurrentNotifyList->Link);
return ;
return;
}
/**
@@ -360,13 +362,13 @@ SdtRegisterNotify (
**/
EFI_STATUS
SdtUnregisterNotify (
IN EFI_ACPI_NOTIFICATION_FN Notification
IN EFI_ACPI_NOTIFICATION_FN Notification
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
//
// Get the instance of the ACPI Table
@@ -418,8 +420,8 @@ SdtUnregisterNotify (
EFI_STATUS
EFIAPI
RegisterNotify (
IN BOOLEAN Register,
IN EFI_ACPI_NOTIFICATION_FN Notification
IN BOOLEAN Register,
IN EFI_ACPI_NOTIFICATION_FN Notification
)
{
//
@@ -454,14 +456,14 @@ RegisterNotify (
**/
EFI_STATUS
SdtOpenSdtTable (
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_STATUS Status;
EFI_ACPI_TABLE_LIST *Table;
EFI_AML_HANDLE *AmlHandle;
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_STATUS Status;
EFI_ACPI_TABLE_LIST *Table;
EFI_AML_HANDLE *AmlHandle;
//
// Get the instance of the ACPI Table
@@ -480,11 +482,11 @@ SdtOpenSdtTable (
return EFI_NOT_FOUND;
}
AmlHandle = AllocatePool (sizeof(*AmlHandle));
AmlHandle = AllocatePool (sizeof (*AmlHandle));
ASSERT (AmlHandle != NULL);
AmlHandle->Signature = EFI_AML_ROOT_HANDLE_SIGNATURE;
AmlHandle->Buffer = (VOID *)((UINTN)Table->Table + sizeof(EFI_ACPI_SDT_HEADER));
AmlHandle->Size = Table->Table->Length - sizeof(EFI_ACPI_SDT_HEADER);
AmlHandle->Buffer = (VOID *)((UINTN)Table->Table + sizeof (EFI_ACPI_SDT_HEADER));
AmlHandle->Size = Table->Table->Length - sizeof (EFI_ACPI_SDT_HEADER);
AmlHandle->AmlByteEncoding = NULL;
AmlHandle->Modified = FALSE;
@@ -508,8 +510,8 @@ SdtOpenSdtTable (
EFI_STATUS
EFIAPI
OpenSdt (
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
)
{
if (Handle == NULL) {
@@ -533,13 +535,13 @@ OpenSdt (
**/
EFI_STATUS
SdtOpenEx (
IN VOID *Buffer,
IN UINTN BufferSize,
OUT EFI_ACPI_HANDLE *Handle
IN VOID *Buffer,
IN UINTN BufferSize,
OUT EFI_ACPI_HANDLE *Handle
)
{
AML_BYTE_ENCODING *AmlByteEncoding;
EFI_AML_HANDLE *AmlHandle;
AML_BYTE_ENCODING *AmlByteEncoding;
EFI_AML_HANDLE *AmlHandle;
AmlByteEncoding = AmlSearchByOpByte (Buffer);
if (AmlByteEncoding == NULL) {
@@ -556,7 +558,7 @@ SdtOpenEx (
//
// Good, find it
//
AmlHandle = AllocatePool (sizeof(*AmlHandle));
AmlHandle = AllocatePool (sizeof (*AmlHandle));
ASSERT (AmlHandle != NULL);
AmlHandle->Signature = EFI_AML_HANDLE_SIGNATURE;
@@ -589,19 +591,19 @@ SdtOpenEx (
EFI_STATUS
EFIAPI
Open (
IN VOID *Buffer,
OUT EFI_ACPI_HANDLE *Handle
IN VOID *Buffer,
OUT EFI_ACPI_HANDLE *Handle
)
{
EFI_STATUS Status;
UINTN MaxSize;
EFI_STATUS Status;
UINTN MaxSize;
MaxSize = 0;
//
// Check for invalid input parameters
//
if (Buffer == NULL || Handle == NULL) {
if ((Buffer == NULL) || (Handle == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -624,11 +626,11 @@ Open (
EFI_STATUS
EFIAPI
Close (
IN EFI_ACPI_HANDLE Handle
IN EFI_ACPI_HANDLE Handle
)
{
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
//
// Check for invalid input parameters
@@ -639,7 +641,8 @@ Close (
AmlHandle = (EFI_AML_HANDLE *)Handle;
if ((AmlHandle->Signature != EFI_AML_ROOT_HANDLE_SIGNATURE) &&
(AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE)) {
(AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE))
{
return EFI_INVALID_PARAMETER;
}
@@ -682,9 +685,9 @@ GetOption (
OUT UINTN *DataSize
)
{
EFI_AML_HANDLE *AmlHandle;
AML_BYTE_ENCODING *AmlByteEncoding;
EFI_STATUS Status;
EFI_AML_HANDLE *AmlHandle;
AML_BYTE_ENCODING *AmlByteEncoding;
EFI_STATUS Status;
ASSERT (DataType != NULL);
ASSERT (Data != NULL);
@@ -740,10 +743,10 @@ GetOption (
EFI_STATUS
EFIAPI
SetOption (
IN EFI_ACPI_HANDLE Handle,
IN UINTN Index,
IN CONST VOID *Data,
IN UINTN DataSize
IN EFI_ACPI_HANDLE Handle,
IN UINTN Index,
IN CONST VOID *Data,
IN UINTN DataSize
)
{
EFI_AML_HANDLE *AmlHandle;
@@ -769,6 +772,7 @@ SetOption (
if (AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE) {
return EFI_INVALID_PARAMETER;
}
AmlByteEncoding = AmlHandle->AmlByteEncoding;
if (Index > AmlByteEncoding->MaxIndex) {
@@ -782,6 +786,7 @@ SetOption (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (DataType == EFI_ACPI_DATA_TYPE_NONE) {
return EFI_INVALID_PARAMETER;
}
@@ -813,14 +818,14 @@ SetOption (
EFI_STATUS
EFIAPI
GetChild (
IN EFI_ACPI_HANDLE ParentHandle,
IN OUT EFI_ACPI_HANDLE *Handle
IN EFI_ACPI_HANDLE ParentHandle,
IN OUT EFI_ACPI_HANDLE *Handle
)
{
EFI_AML_HANDLE *AmlParentHandle;
EFI_AML_HANDLE *AmlHandle;
VOID *Buffer;
EFI_STATUS Status;
EFI_AML_HANDLE *AmlParentHandle;
EFI_AML_HANDLE *AmlHandle;
VOID *Buffer;
EFI_STATUS Status;
ASSERT (Handle != NULL);
@@ -831,7 +836,7 @@ GetChild (
return EFI_INVALID_PARAMETER;
}
AmlHandle = *Handle;
AmlHandle = *Handle;
if ((AmlHandle != NULL) && (AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE)) {
return EFI_INVALID_PARAMETER;
}
@@ -857,10 +862,12 @@ GetChild (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (Buffer == NULL) {
*Handle = NULL;
return EFI_SUCCESS;
}
return SdtOpenEx (Buffer, (UINTN)AmlParentHandle->Buffer + AmlParentHandle->Size - (UINTN)Buffer, Handle);
}
@@ -877,16 +884,16 @@ GetChild (
**/
EFI_STATUS
SdtFindPathFromNonRoot (
IN EFI_ACPI_HANDLE HandleIn,
IN UINT8 *AmlPath,
OUT EFI_ACPI_HANDLE *HandleOut
IN EFI_ACPI_HANDLE HandleIn,
IN UINT8 *AmlPath,
OUT EFI_ACPI_HANDLE *HandleOut
)
{
EFI_AML_HANDLE *AmlHandle;
VOID *Buffer;
EFI_STATUS Status;
EFI_AML_HANDLE *AmlHandle;
VOID *Buffer;
EFI_STATUS Status;
Buffer = NULL;
Buffer = NULL;
AmlHandle = (EFI_AML_HANDLE *)HandleIn;
//
@@ -896,10 +903,12 @@ SdtFindPathFromNonRoot (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (Buffer == NULL) {
*HandleOut = NULL;
return EFI_SUCCESS;
}
return SdtOpenEx (Buffer, (UINTN)AmlHandle->Buffer + AmlHandle->Size - (UINTN)Buffer, HandleOut);
}
@@ -912,14 +921,14 @@ SdtFindPathFromNonRoot (
**/
EFI_AML_HANDLE *
SdtDuplicateHandle (
IN EFI_AML_HANDLE *AmlHandle
IN EFI_AML_HANDLE *AmlHandle
)
{
EFI_AML_HANDLE *DstAmlHandle;
DstAmlHandle = AllocatePool (sizeof(*DstAmlHandle));
DstAmlHandle = AllocatePool (sizeof (*DstAmlHandle));
ASSERT (DstAmlHandle != NULL);
CopyMem (DstAmlHandle, (VOID *)AmlHandle, sizeof(*DstAmlHandle));
CopyMem (DstAmlHandle, (VOID *)AmlHandle, sizeof (*DstAmlHandle));
return DstAmlHandle;
}
@@ -937,17 +946,17 @@ SdtDuplicateHandle (
**/
EFI_STATUS
SdtFindPathFromRoot (
IN EFI_ACPI_HANDLE HandleIn,
IN UINT8 *AmlPath,
OUT EFI_ACPI_HANDLE *HandleOut
IN EFI_ACPI_HANDLE HandleIn,
IN UINT8 *AmlPath,
OUT EFI_ACPI_HANDLE *HandleOut
)
{
EFI_ACPI_HANDLE ChildHandle;
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
VOID *Buffer;
EFI_ACPI_HANDLE ChildHandle;
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
VOID *Buffer;
Buffer = NULL;
Buffer = NULL;
AmlHandle = (EFI_AML_HANDLE *)HandleIn;
//
@@ -983,7 +992,7 @@ SdtFindPathFromRoot (
// More child
//
AmlHandle = (EFI_AML_HANDLE *)ChildHandle;
Status = AmlFindPath (AmlHandle, AmlPath, &Buffer, TRUE);
Status = AmlFindPath (AmlHandle, AmlPath, &Buffer, TRUE);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
@@ -993,9 +1002,10 @@ SdtFindPathFromRoot (
// Great! Find it, open
//
Status = SdtOpenEx (Buffer, (UINTN)AmlHandle->Buffer + AmlHandle->Size - (UINTN)Buffer, HandleOut);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR (Status)) {
return EFI_SUCCESS;
}
//
// Not success, try next one
//
@@ -1021,14 +1031,14 @@ SdtFindPathFromRoot (
EFI_STATUS
EFIAPI
FindPath (
IN EFI_ACPI_HANDLE HandleIn,
IN VOID *AcpiPath,
OUT EFI_ACPI_HANDLE *HandleOut
IN EFI_ACPI_HANDLE HandleIn,
IN VOID *AcpiPath,
OUT EFI_ACPI_HANDLE *HandleOut
)
{
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
UINT8 *AmlPath;
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
UINT8 *AmlPath;
//
// Check for invalid input parameters
@@ -1079,13 +1089,12 @@ FindPath (
**/
VOID
SdtAcpiTableAcpiSdtConstructor (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
)
{
InitializeListHead (&AcpiTableInstance->NotifyList);
CopyMem (&AcpiTableInstance->AcpiSdtProtocol, &mAcpiSdtProtocolTemplate, sizeof(mAcpiSdtProtocolTemplate));
CopyMem (&AcpiTableInstance->AcpiSdtProtocol, &mAcpiSdtProtocolTemplate, sizeof (mAcpiSdtProtocolTemplate));
AcpiTableInstance->AcpiSdtProtocol.AcpiVersion = (EFI_ACPI_TABLE_VERSION)PcdGet32 (PcdAcpiExposedTableVersions);
return ;
return;
}

View File

@@ -16,7 +16,7 @@
//
// ACPI Notify Linked List Signature.
//
#define EFI_ACPI_NOTIFY_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'N', 'L')
#define EFI_ACPI_NOTIFY_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'N', 'L')
//
// ACPI Notify List Entry definition.
@@ -26,9 +26,9 @@
// Notification is the callback function.
//
typedef struct {
UINT32 Signature;
LIST_ENTRY Link;
EFI_ACPI_NOTIFICATION_FN Notification;
UINT32 Signature;
LIST_ENTRY Link;
EFI_ACPI_NOTIFICATION_FN Notification;
} EFI_ACPI_NOTIFY_LIST;
//
@@ -36,13 +36,13 @@ typedef struct {
//
#define EFI_ACPI_NOTIFY_LIST_FROM_LINK(_link) CR (_link, EFI_ACPI_NOTIFY_LIST, Link, EFI_ACPI_NOTIFY_LIST_SIGNATURE)
typedef struct _AML_BYTE_ENCODING AML_BYTE_ENCODING;
typedef struct _EFI_AML_NODE_LIST EFI_AML_NODE_LIST;
typedef struct _AML_BYTE_ENCODING AML_BYTE_ENCODING;
typedef struct _EFI_AML_NODE_LIST EFI_AML_NODE_LIST;
//
// AML Node Linked List Signature.
//
#define EFI_AML_NODE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'M', 'L')
#define EFI_AML_NODE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'M', 'L')
//
// AML Node Linked List Entry definition.
@@ -58,14 +58,14 @@ typedef struct _EFI_AML_NODE_LIST EFI_AML_NODE_LIST;
//
struct _EFI_AML_NODE_LIST {
UINT32 Signature;
UINT8 Name[AML_NAME_SEG_SIZE];
UINT8 *Buffer;
UINTN Size;
LIST_ENTRY Link;
LIST_ENTRY Children;
EFI_AML_NODE_LIST *Parent;
AML_BYTE_ENCODING *AmlByteEncoding;
UINT32 Signature;
UINT8 Name[AML_NAME_SEG_SIZE];
UINT8 *Buffer;
UINTN Size;
LIST_ENTRY Link;
LIST_ENTRY Children;
EFI_AML_NODE_LIST *Parent;
AML_BYTE_ENCODING *AmlByteEncoding;
};
//
@@ -76,8 +76,8 @@ struct _EFI_AML_NODE_LIST {
//
// AML Handle Signature.
//
#define EFI_AML_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'H', 'S')
#define EFI_AML_ROOT_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'R', 'H')
#define EFI_AML_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'H', 'S')
#define EFI_AML_ROOT_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'R', 'H')
//
// AML Handle Entry definition.
@@ -88,50 +88,50 @@ struct _EFI_AML_NODE_LIST {
// Size is the total size of this ACPI node buffer.
//
typedef struct {
UINT32 Signature;
UINT8 *Buffer;
UINTN Size;
AML_BYTE_ENCODING *AmlByteEncoding;
BOOLEAN Modified;
UINT32 Signature;
UINT8 *Buffer;
UINTN Size;
AML_BYTE_ENCODING *AmlByteEncoding;
BOOLEAN Modified;
} EFI_AML_HANDLE;
typedef UINT32 AML_OP_PARSE_INDEX;
#define AML_OP_PARSE_INDEX_GET_OPCODE 0
#define AML_OP_PARSE_INDEX_GET_TERM1 1
#define AML_OP_PARSE_INDEX_GET_TERM2 2
#define AML_OP_PARSE_INDEX_GET_TERM3 3
#define AML_OP_PARSE_INDEX_GET_TERM4 4
#define AML_OP_PARSE_INDEX_GET_TERM5 5
#define AML_OP_PARSE_INDEX_GET_TERM6 6
#define AML_OP_PARSE_INDEX_GET_SIZE (AML_OP_PARSE_INDEX)-1
#define AML_OP_PARSE_INDEX_GET_OPCODE 0
#define AML_OP_PARSE_INDEX_GET_TERM1 1
#define AML_OP_PARSE_INDEX_GET_TERM2 2
#define AML_OP_PARSE_INDEX_GET_TERM3 3
#define AML_OP_PARSE_INDEX_GET_TERM4 4
#define AML_OP_PARSE_INDEX_GET_TERM5 5
#define AML_OP_PARSE_INDEX_GET_TERM6 6
#define AML_OP_PARSE_INDEX_GET_SIZE (AML_OP_PARSE_INDEX)-1
typedef UINT32 AML_OP_PARSE_FORMAT;
#define AML_NONE 0
#define AML_OPCODE 1
#define AML_UINT8 2
#define AML_UINT16 3
#define AML_UINT32 4
#define AML_UINT64 5
#define AML_NAME 6
#define AML_STRING 7
#define AML_OBJECT 8
#define AML_NONE 0
#define AML_OPCODE 1
#define AML_UINT8 2
#define AML_UINT16 3
#define AML_UINT32 4
#define AML_UINT64 5
#define AML_NAME 6
#define AML_STRING 7
#define AML_OBJECT 8
typedef UINT32 AML_OP_ATTRIBUTE;
#define AML_HAS_PKG_LENGTH 0x1 // It is ACPI attribute - if OpCode has PkgLength
#define AML_IS_NAME_CHAR 0x2 // It is ACPI attribute - if this is NameChar
#define AML_HAS_CHILD_OBJ 0x4 // it is ACPI attribute - if OpCode has Child Object.
#define AML_IN_NAMESPACE 0x10000 // It is UEFI SDT attribute - if OpCode will be in NameSpace
#define AML_HAS_PKG_LENGTH 0x1 // It is ACPI attribute - if OpCode has PkgLength
#define AML_IS_NAME_CHAR 0x2 // It is ACPI attribute - if this is NameChar
#define AML_HAS_CHILD_OBJ 0x4 // it is ACPI attribute - if OpCode has Child Object.
#define AML_IN_NAMESPACE 0x10000 // It is UEFI SDT attribute - if OpCode will be in NameSpace
// NOTE; Not all OBJECT will be in NameSpace
// For example, BankField | CreateBitField | CreateByteField | CreateDWordField |
// CreateField | CreateQWordField | CreateWordField | Field | IndexField.
struct _AML_BYTE_ENCODING {
UINT8 OpCode;
UINT8 SubOpCode;
AML_OP_PARSE_INDEX MaxIndex;
AML_OP_PARSE_FORMAT Format[6];
AML_OP_ATTRIBUTE Attribute;
UINT8 OpCode;
UINT8 SubOpCode;
AML_OP_PARSE_INDEX MaxIndex;
AML_OP_PARSE_FORMAT Format[6];
AML_OP_ATTRIBUTE Attribute;
};
//
@@ -167,10 +167,10 @@ struct _AML_BYTE_ENCODING {
EFI_STATUS
EFIAPI
GetAcpiTable2 (
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
);
/**
@@ -190,8 +190,8 @@ GetAcpiTable2 (
EFI_STATUS
EFIAPI
RegisterNotify (
IN BOOLEAN Register,
IN EFI_ACPI_NOTIFICATION_FN Notification
IN BOOLEAN Register,
IN EFI_ACPI_NOTIFICATION_FN Notification
);
/**
@@ -206,8 +206,8 @@ RegisterNotify (
EFI_STATUS
EFIAPI
OpenSdt (
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
);
/**
@@ -224,8 +224,8 @@ OpenSdt (
EFI_STATUS
EFIAPI
Open (
IN VOID *Buffer,
OUT EFI_ACPI_HANDLE *Handle
IN VOID *Buffer,
OUT EFI_ACPI_HANDLE *Handle
);
/**
@@ -239,7 +239,7 @@ Open (
EFI_STATUS
EFIAPI
Close (
IN EFI_ACPI_HANDLE Handle
IN EFI_ACPI_HANDLE Handle
);
/**
@@ -284,10 +284,10 @@ GetOption (
EFI_STATUS
EFIAPI
SetOption (
IN EFI_ACPI_HANDLE Handle,
IN UINTN Index,
IN CONST VOID *Data,
IN UINTN DataSize
IN EFI_ACPI_HANDLE Handle,
IN UINTN Index,
IN CONST VOID *Data,
IN UINTN DataSize
);
/**
@@ -304,8 +304,8 @@ SetOption (
EFI_STATUS
EFIAPI
GetChild (
IN EFI_ACPI_HANDLE ParentHandle,
IN OUT EFI_ACPI_HANDLE *Handle
IN EFI_ACPI_HANDLE ParentHandle,
IN OUT EFI_ACPI_HANDLE *Handle
);
/**
@@ -322,9 +322,9 @@ GetChild (
EFI_STATUS
EFIAPI
FindPath (
IN EFI_ACPI_HANDLE HandleIn,
IN VOID *AcpiPath,
OUT EFI_ACPI_HANDLE *HandleOut
IN EFI_ACPI_HANDLE HandleIn,
IN VOID *AcpiPath,
OUT EFI_ACPI_HANDLE *HandleOut
);
//
@@ -345,9 +345,9 @@ FindPath (
**/
EFI_STATUS
SdtOpenEx (
IN VOID *Buffer,
IN UINTN BufferSize,
OUT EFI_ACPI_HANDLE *Handle
IN VOID *Buffer,
IN UINTN BufferSize,
OUT EFI_ACPI_HANDLE *Handle
);
//
@@ -365,8 +365,8 @@ SdtOpenEx (
**/
EFI_STATUS
AmlGetNameStringSize (
IN UINT8 *Buffer,
OUT UINTN *BufferSize
IN UINT8 *Buffer,
OUT UINTN *BufferSize
);
/**
@@ -379,8 +379,8 @@ AmlGetNameStringSize (
**/
UINTN
AmlGetPkgLength (
IN UINT8 *Buffer,
OUT UINTN *PkgLength
IN UINT8 *Buffer,
OUT UINTN *PkgLength
);
/**
@@ -404,7 +404,7 @@ AmlTypeToAcpiType (
**/
AML_BYTE_ENCODING *
AmlSearchByOpByte (
IN UINT8 *OpByteBuffer
IN UINT8 *OpByteBuffer
);
/**
@@ -418,9 +418,9 @@ AmlSearchByOpByte (
**/
UINTN
AmlGetObjectSize (
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize
);
/**
@@ -432,7 +432,7 @@ AmlGetObjectSize (
**/
CHAR8 *
AmlGetObjectName (
IN EFI_AML_HANDLE *AmlHandle
IN EFI_AML_HANDLE *AmlHandle
);
/**
@@ -451,11 +451,11 @@ AmlGetObjectName (
**/
EFI_STATUS
AmlParseOptionHandleCommon (
IN EFI_AML_HANDLE *AmlHandle,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
IN EFI_AML_HANDLE *AmlHandle,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
);
/**
@@ -469,8 +469,8 @@ AmlParseOptionHandleCommon (
**/
EFI_STATUS
AmlGetOffsetAfterLastOption (
IN EFI_AML_HANDLE *AmlHandle,
OUT UINT8 **Buffer
IN EFI_AML_HANDLE *AmlHandle,
OUT UINT8 **Buffer
);
/**
@@ -486,9 +486,9 @@ AmlGetOffsetAfterLastOption (
**/
EFI_STATUS
AmlGetChildFromRoot (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
);
/**
@@ -504,9 +504,9 @@ AmlGetChildFromRoot (
**/
EFI_STATUS
AmlGetChildFromNonRoot (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
);
/**
@@ -519,7 +519,7 @@ AmlGetChildFromNonRoot (
**/
UINT8 *
AmlNameFromAslName (
IN UINT8 *AslPath
IN UINT8 *AslPath
);
/**
@@ -550,7 +550,7 @@ AmlFindPath (
**/
VOID
AmlPrintNameString (
IN UINT8 *Buffer
IN UINT8 *Buffer
);
/**
@@ -560,7 +560,7 @@ AmlPrintNameString (
**/
VOID
AmlPrintNameSeg (
IN UINT8 *Buffer
IN UINT8 *Buffer
);
/**
@@ -573,7 +573,7 @@ AmlPrintNameSeg (
**/
BOOLEAN
AmlIsRootPath (
IN UINT8 *Buffer
IN UINT8 *Buffer
);
#endif

View File

@@ -14,8 +14,8 @@
//
// Handle to install ACPI Table Protocol
//
EFI_HANDLE mHandle = NULL;
GLOBAL_REMOVE_IF_UNREFERENCED EFI_ACPI_TABLE_INSTANCE *mPrivateData = NULL;
EFI_HANDLE mHandle = NULL;
GLOBAL_REMOVE_IF_UNREFERENCED EFI_ACPI_TABLE_INSTANCE *mPrivateData = NULL;
/**
Entry point of the ACPI table driver.
@@ -33,12 +33,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_ACPI_TABLE_INSTANCE *mPrivateData = NULL;
EFI_STATUS
EFIAPI
InitializeAcpiTableDxe (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_ACPI_TABLE_INSTANCE *PrivateData;
EFI_STATUS Status;
EFI_ACPI_TABLE_INSTANCE *PrivateData;
//
// Initialize our protocol
@@ -61,14 +61,14 @@ InitializeAcpiTableDxe (
//
if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) {
mPrivateData = PrivateData;
Status = gBS->InstallMultipleProtocolInterfaces (
&mHandle,
&gEfiAcpiTableProtocolGuid,
&PrivateData->AcpiTableProtocol,
&gEfiAcpiSdtProtocolGuid,
&mPrivateData->AcpiSdtProtocol,
NULL
);
Status = gBS->InstallMultipleProtocolInterfaces (
&mHandle,
&gEfiAcpiTableProtocolGuid,
&PrivateData->AcpiTableProtocol,
&gEfiAcpiSdtProtocolGuid,
&mPrivateData->AcpiSdtProtocol,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&mHandle,
@@ -77,8 +77,8 @@ InitializeAcpiTableDxe (
NULL
);
}
ASSERT_EFI_ERROR (Status);
return Status;
}

View File

@@ -9,7 +9,6 @@
#ifndef _ACPI_TABLE_H_
#define _ACPI_TABLE_H_
#include <PiDxe.h>
#include <Protocol/AcpiTable.h>
@@ -37,7 +36,7 @@
//
// Great than or equal to 2.0.
//
#define ACPI_TABLE_VERSION_GTE_2_0 (EFI_ACPI_TABLE_VERSION_2_0 | \
#define ACPI_TABLE_VERSION_GTE_2_0 (EFI_ACPI_TABLE_VERSION_2_0 |\
EFI_ACPI_TABLE_VERSION_3_0 | \
EFI_ACPI_TABLE_VERSION_4_0 | \
EFI_ACPI_TABLE_VERSION_5_0)
@@ -48,7 +47,7 @@
//
// ACPI Table Linked List Signature.
//
#define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')
#define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')
//
// ACPI Table Linked List Entry definition.
@@ -65,13 +64,13 @@
// TRUE: Table points to TableSize bytes allocated using gBS->AllocatePool ()
//
typedef struct {
UINT32 Signature;
LIST_ENTRY Link;
EFI_ACPI_TABLE_VERSION Version;
EFI_ACPI_COMMON_HEADER *Table;
UINTN TableSize;
UINTN Handle;
BOOLEAN PoolAllocation;
UINT32 Signature;
LIST_ENTRY Link;
EFI_ACPI_TABLE_VERSION Version;
EFI_ACPI_COMMON_HEADER *Table;
UINTN TableSize;
UINTN Handle;
BOOLEAN PoolAllocation;
} EFI_ACPI_TABLE_LIST;
//
@@ -82,7 +81,7 @@ typedef struct {
//
// The maximum number of tables this driver supports
//
#define EFI_ACPI_MAX_NUM_TABLES 20
#define EFI_ACPI_MAX_NUM_TABLES 20
//
// Protocol private structure definition
@@ -96,25 +95,25 @@ typedef struct {
// 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;
EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;
EFI_ACPI_SDT_PROTOCOL AcpiSdtProtocol;
LIST_ENTRY NotifyList;
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;
EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;
EFI_ACPI_SDT_PROTOCOL AcpiSdtProtocol;
LIST_ENTRY NotifyList;
} EFI_ACPI_TABLE_INSTANCE;
//
@@ -143,10 +142,9 @@ typedef struct {
**/
EFI_STATUS
AcpiTableAcpiTableConstructor (
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
);
/**
Entry point of the ACPI table driver.
Creates and initializes an instance of the ACPI Table
@@ -163,8 +161,8 @@ AcpiTableAcpiTableConstructor (
EFI_STATUS
EFIAPI
InitializeAcpiTableDxe (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
@@ -183,9 +181,9 @@ InitializeAcpiTableDxe (
**/
EFI_STATUS
FindTableByHandle (
IN UINTN Handle,
IN LIST_ENTRY *TableList,
OUT EFI_ACPI_TABLE_LIST **Table
IN UINTN Handle,
IN LIST_ENTRY *TableList,
OUT EFI_ACPI_TABLE_LIST **Table
);
/**
@@ -201,9 +199,9 @@ FindTableByHandle (
**/
EFI_STATUS
AcpiPlatformChecksum (
IN VOID *Buffer,
IN UINTN Size,
IN UINTN ChecksumOffset
IN VOID *Buffer,
IN UINTN Size,
IN UINTN ChecksumOffset
);
/**
@@ -215,9 +213,9 @@ AcpiPlatformChecksum (
**/
VOID
SdtNotifyAcpiList (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN EFI_ACPI_TABLE_VERSION Version,
IN UINTN Handle
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN EFI_ACPI_TABLE_VERSION Version,
IN UINTN Handle
);
/**
@@ -227,7 +225,7 @@ SdtNotifyAcpiList (
**/
VOID
SdtAcpiTableAcpiSdtConstructor (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
);
/**
@@ -257,17 +255,17 @@ SdtAcpiTableAcpiSdtConstructor (
**/
EFI_STATUS
SdtGetAcpiTable (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
);
//
// export PrivateData symbol, because we need that in AcpiSdtProtol implementation
//
extern EFI_HANDLE mHandle;
extern EFI_ACPI_TABLE_INSTANCE *mPrivateData;
extern EFI_HANDLE mHandle;
extern EFI_ACPI_TABLE_INSTANCE *mPrivateData;
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -9,151 +9,151 @@
#include "AcpiTable.h"
GLOBAL_REMOVE_IF_UNREFERENCED
AML_BYTE_ENCODING mAmlByteEncoding[] = {
AML_BYTE_ENCODING mAmlByteEncoding[] = {
// OpCode SubOpCode Num 1 2 3 4 5 6 Attribute
/* ZeroOp - 0x00 */ {AML_ZERO_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* OneOp - 0x01 */ {AML_ONE_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* AliasOp - 0x06 */ {AML_ALIAS_OP, 0, 2, {AML_NAME, AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* NameOp - 0x08 */ {AML_NAME_OP, 0, 2, {AML_NAME, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* BytePrefix - 0x0A */ {AML_BYTE_PREFIX, 0, 1, {AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* WordPrefix - 0x0B */ {AML_WORD_PREFIX, 0, 1, {AML_UINT16, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* DWordPrefix - 0x0C */ {AML_DWORD_PREFIX, 0, 1, {AML_UINT32, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* StringPrefix - 0x0D */ {AML_STRING_PREFIX, 0, 1, {AML_STRING, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* QWordPrefix - 0x0E */ {AML_QWORD_PREFIX, 0, 1, {AML_UINT64, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ScopeOp - 0x10 */ {AML_SCOPE_OP, 0, 1, {AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* BufferOp - 0x11 */ {AML_BUFFER_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH},
/* PackageOp - 0x12 */ {AML_PACKAGE_OP, 0, 1, {AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
/* VarPackageOp - 0x13 */ {AML_VAR_PACKAGE_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
/* MethodOp - 0x14 */ {AML_METHOD_OP, 0, 2, {AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* DualNamePrefix - 0x2F */ {AML_DUAL_NAME_PREFIX, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* MultiNamePrefix - 0x2F */ {AML_MULTI_NAME_PREFIX, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x41 */ {'A', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x42 */ {'B', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x43 */ {'C', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x44 */ {'D', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x45 */ {'E', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x46 */ {'F', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x47 */ {'G', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x48 */ {'H', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x49 */ {'I', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4A */ {'J', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4B */ {'K', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4C */ {'L', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4D */ {'M', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4E */ {'N', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4F */ {'O', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x50 */ {'P', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x51 */ {'Q', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x52 */ {'R', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x53 */ {'S', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x54 */ {'T', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x55 */ {'U', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x56 */ {'V', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x57 */ {'W', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x58 */ {'X', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x59 */ {'Y', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x5A */ {'Z', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* MutexOp - 0x5B 0x01 */ {AML_EXT_OP, AML_EXT_MUTEX_OP, 2, {AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* EventOp - 0x5B 0x02 */ {AML_EXT_OP, AML_EXT_EVENT_OP, 1, {AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* CondRefOfOp - 0x5B 0x12 */ {AML_EXT_OP, AML_EXT_COND_REF_OF_OP, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CreateFieldOp - 0x5B 0x13 */ {AML_EXT_OP, AML_EXT_CREATE_FIELD_OP,4, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE}, 0},
/* LoadTableOp - 0x5B 0x1F */ {AML_EXT_OP, AML_EXT_LOAD_TABLE_OP, 6, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT}, 0},
/* LoadOp - 0x5B 0x20 */ {AML_EXT_OP, AML_EXT_LOAD_OP, 2, {AML_NAME, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* StallOp - 0x5B 0x21 */ {AML_EXT_OP, AML_EXT_STALL_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* SleepOp - 0x5B 0x22 */ {AML_EXT_OP, AML_EXT_SLEEP_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* AcquireOp - 0x5B 0x23 */ {AML_EXT_OP, AML_EXT_ACQUIRE_OP, 2, {AML_OBJECT, AML_UINT16, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* SignalOp - 0x5B 0x24 */ {AML_EXT_OP, AML_EXT_SIGNAL_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* WaitOp - 0x5B 0x25 */ {AML_EXT_OP, AML_EXT_WAIT_OP, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ResetOp - 0x5B 0x26 */ {AML_EXT_OP, AML_EXT_RESET_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ReleaseOp - 0x5B 0x27 */ {AML_EXT_OP, AML_EXT_RELEASE_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* FromBCDOp - 0x5B 0x28 */ {AML_EXT_OP, AML_EXT_FROM_BCD_OP, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToBCDOp - 0x5B 0x29 */ {AML_EXT_OP, AML_EXT_TO_BCD_OP, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* UnloadOp - 0x5B 0x2A */ {AML_EXT_OP, AML_EXT_UNLOAD_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* RevisionOp - 0x5B 0x30 */ {AML_EXT_OP, AML_EXT_REVISION_OP, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* DebugOp - 0x5B 0x31 */ {AML_EXT_OP, AML_EXT_DEBUG_OP, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* FatalOp - 0x5B 0x32 */ {AML_EXT_OP, AML_EXT_FATAL_OP, 3, {AML_UINT8, AML_UINT32, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* TimerOp - 0x5B 0x33 */ {AML_EXT_OP, AML_EXT_TIMER_OP, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* OpRegionOp - 0x5B 0x80 */ {AML_EXT_OP, AML_EXT_REGION_OP, 4, {AML_NAME, AML_UINT8, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* FieldOp - 0x5B 0x81 */ {AML_EXT_OP, AML_EXT_FIELD_OP, 2, {AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH},
/* DeviceOp - 0x5B 0x82 */ {AML_EXT_OP, AML_EXT_DEVICE_OP, 1, {AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* ProcessorOp - 0x5B 0x83 */ {AML_EXT_OP, AML_EXT_PROCESSOR_OP, 4, {AML_NAME, AML_UINT8, AML_UINT32, AML_UINT8, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* PowerResOp - 0x5B 0x84 */ {AML_EXT_OP, AML_EXT_POWER_RES_OP, 3, {AML_NAME, AML_UINT8, AML_UINT16, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* ThermalZoneOp - 0x5B 0x85 */ {AML_EXT_OP, AML_EXT_THERMAL_ZONE_OP,1, {AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* IndexFieldOp - 0x5B 0x86 */ {AML_EXT_OP, AML_EXT_INDEX_FIELD_OP, 3, {AML_NAME, AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH},
/* BankFieldOp - 0x5B 0x87 */ {AML_EXT_OP, AML_EXT_BANK_FIELD_OP, 4, {AML_NAME, AML_NAME, AML_OBJECT, AML_UINT8, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH},
/* DataRegionOp - 0x5B 0x88 */ {AML_EXT_OP, AML_EXT_DATA_REGION_OP, 4, {AML_NAME, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* RootChar - 0x5C */ {AML_ROOT_CHAR, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* ParentPrefixChar - 0x5E */ {AML_PARENT_PREFIX_CHAR, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x5F */ {'_', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* Local0Op - 0x60 */ {AML_LOCAL0, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local1Op - 0x61 */ {AML_LOCAL1, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local2Op - 0x62 */ {AML_LOCAL2, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local3Op - 0x63 */ {AML_LOCAL3, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local4Op - 0x64 */ {AML_LOCAL4, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local5Op - 0x65 */ {AML_LOCAL5, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local6Op - 0x66 */ {AML_LOCAL6, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local7Op - 0x67 */ {AML_LOCAL7, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg0Op - 0x68 */ {AML_ARG0, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg1Op - 0x69 */ {AML_ARG1, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg2Op - 0x6A */ {AML_ARG2, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg3Op - 0x6B */ {AML_ARG3, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg4Op - 0x6C */ {AML_ARG4, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg5Op - 0x6D */ {AML_ARG5, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg6Op - 0x6E */ {AML_ARG6, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* StoreOp - 0x70 */ {AML_STORE_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* RefOfOp - 0x71 */ {AML_REF_OF_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* AddOp - 0x72 */ {AML_ADD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ConcatOp - 0x73 */ {AML_CONCAT_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* SubtractOp - 0x74 */ {AML_SUBTRACT_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* IncrementOp - 0x75 */ {AML_INCREMENT_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* DecrementOp - 0x76 */ {AML_DECREMENT_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* MultiplyOp - 0x77 */ {AML_MULTIPLY_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* DivideOp - 0x78 */ {AML_DIVIDE_OP, 0, 4, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE}, 0},
/* ShiftLeftOp - 0x79 */ {AML_SHIFT_LEFT_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ShiftRightOp - 0x7A */ {AML_SHIFT_RIGHT_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* AndOp - 0x7B */ {AML_AND_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* NAndOp - 0x7C */ {AML_NAND_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* OrOp - 0x7D */ {AML_OR_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* NorOp - 0x7E */ {AML_NOR_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* XOrOp - 0x7F */ {AML_XOR_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* NotOp - 0x80 */ {AML_NOT_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* FindSetLeftBitOp - 0x81 */ {AML_FIND_SET_LEFT_BIT_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* FindSetRightBitOp - 0x82 */ {AML_FIND_SET_RIGHT_BIT_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* DerefOfOp - 0x83 */ {AML_DEREF_OF_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ConcatResOp - 0x84 */ {AML_CONCAT_RES_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ModOp - 0x85 */ {AML_MOD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* NotifyOp - 0x86 */ {AML_NOTIFY_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* SizeOfOp - 0x87 */ {AML_SIZE_OF_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* IndexOp - 0x88 */ {AML_INDEX_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* MatchOp - 0x89 */ {AML_MATCH_OP, 0, 6, {AML_OBJECT, AML_UINT8, AML_OBJECT, AML_UINT8, AML_OBJECT, AML_OBJECT}, 0},
/* CreateDWordFieldOp - 0x8A */ {AML_CREATE_DWORD_FIELD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CreateWordFieldOp - 0x8B */ {AML_CREATE_WORD_FIELD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CreateByteFieldOp - 0x8C */ {AML_CREATE_BYTE_FIELD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CreateBitFieldOp - 0x8D */ {AML_CREATE_BIT_FIELD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ObjectTypeOp - 0x8E */ {AML_OBJECT_TYPE_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CreateQWordFieldOp - 0x8F */ {AML_CREATE_QWORD_FIELD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LAndOp - 0x90 */ {AML_LAND_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LOrOp - 0x91 */ {AML_LOR_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LNotOp - 0x92 */ {AML_LNOT_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LEqualOp - 0x93 */ {AML_LEQUAL_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LGreaterOp - 0x94 */ {AML_LGREATER_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LLessOp - 0x95 */ {AML_LLESS_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToBufferOp - 0x96 */ {AML_TO_BUFFER_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToDecimalStringOp - 0x97 */ {AML_TO_DEC_STRING_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToHexStringOp - 0x98 */ {AML_TO_HEX_STRING_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToIntegerOp - 0x99 */ {AML_TO_INTEGER_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToStringOp - 0x9C */ {AML_TO_STRING_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CopyObjectOp - 0x9D */ {AML_COPY_OBJECT_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* MidOp - 0x9E */ {AML_MID_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ContinueOp - 0x9F */ {AML_CONTINUE_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* IfOp - 0xA0 */ {AML_IF_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
/* ElseOp - 0xA1 */ {AML_ELSE_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
/* WhileOp - 0xA2 */ {AML_WHILE_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
/* NoopOp - 0xA3 */ {AML_NOOP_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ReturnOp - 0xA4 */ {AML_RETURN_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* BreakOp - 0xA5 */ {AML_BREAK_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* BreakPointOp - 0xCC */ {AML_BREAK_POINT_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* OnesOp - 0xFF */ {AML_ONES_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ZeroOp - 0x00 */ { AML_ZERO_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* OneOp - 0x01 */ { AML_ONE_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* AliasOp - 0x06 */ { AML_ALIAS_OP, 0, 2, { AML_NAME, AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* NameOp - 0x08 */ { AML_NAME_OP, 0, 2, { AML_NAME, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* BytePrefix - 0x0A */ { AML_BYTE_PREFIX, 0, 1, { AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* WordPrefix - 0x0B */ { AML_WORD_PREFIX, 0, 1, { AML_UINT16, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* DWordPrefix - 0x0C */ { AML_DWORD_PREFIX, 0, 1, { AML_UINT32, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* StringPrefix - 0x0D */ { AML_STRING_PREFIX, 0, 1, { AML_STRING, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* QWordPrefix - 0x0E */ { AML_QWORD_PREFIX, 0, 1, { AML_UINT64, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ScopeOp - 0x10 */ { AML_SCOPE_OP, 0, 1, { AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* BufferOp - 0x11 */ { AML_BUFFER_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH },
/* PackageOp - 0x12 */ { AML_PACKAGE_OP, 0, 1, { AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* VarPackageOp - 0x13 */ { AML_VAR_PACKAGE_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* MethodOp - 0x14 */ { AML_METHOD_OP, 0, 2, { AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* DualNamePrefix - 0x2F */ { AML_DUAL_NAME_PREFIX, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* MultiNamePrefix - 0x2F */ { AML_MULTI_NAME_PREFIX, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x41 */ { 'A', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x42 */ { 'B', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x43 */ { 'C', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x44 */ { 'D', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x45 */ { 'E', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x46 */ { 'F', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x47 */ { 'G', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x48 */ { 'H', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x49 */ { 'I', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4A */ { 'J', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4B */ { 'K', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4C */ { 'L', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4D */ { 'M', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4E */ { 'N', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4F */ { 'O', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x50 */ { 'P', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x51 */ { 'Q', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x52 */ { 'R', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x53 */ { 'S', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x54 */ { 'T', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x55 */ { 'U', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x56 */ { 'V', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x57 */ { 'W', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x58 */ { 'X', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x59 */ { 'Y', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x5A */ { 'Z', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* MutexOp - 0x5B 0x01 */ { AML_EXT_OP, AML_EXT_MUTEX_OP, 2, { AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* EventOp - 0x5B 0x02 */ { AML_EXT_OP, AML_EXT_EVENT_OP, 1, { AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* CondRefOfOp - 0x5B 0x12 */ { AML_EXT_OP, AML_EXT_COND_REF_OF_OP, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CreateFieldOp - 0x5B 0x13 */ { AML_EXT_OP, AML_EXT_CREATE_FIELD_OP, 4, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE }, 0 },
/* LoadTableOp - 0x5B 0x1F */ { AML_EXT_OP, AML_EXT_LOAD_TABLE_OP, 6, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT }, 0 },
/* LoadOp - 0x5B 0x20 */ { AML_EXT_OP, AML_EXT_LOAD_OP, 2, { AML_NAME, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* StallOp - 0x5B 0x21 */ { AML_EXT_OP, AML_EXT_STALL_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* SleepOp - 0x5B 0x22 */ { AML_EXT_OP, AML_EXT_SLEEP_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* AcquireOp - 0x5B 0x23 */ { AML_EXT_OP, AML_EXT_ACQUIRE_OP, 2, { AML_OBJECT, AML_UINT16, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* SignalOp - 0x5B 0x24 */ { AML_EXT_OP, AML_EXT_SIGNAL_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* WaitOp - 0x5B 0x25 */ { AML_EXT_OP, AML_EXT_WAIT_OP, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ResetOp - 0x5B 0x26 */ { AML_EXT_OP, AML_EXT_RESET_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ReleaseOp - 0x5B 0x27 */ { AML_EXT_OP, AML_EXT_RELEASE_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* FromBCDOp - 0x5B 0x28 */ { AML_EXT_OP, AML_EXT_FROM_BCD_OP, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToBCDOp - 0x5B 0x29 */ { AML_EXT_OP, AML_EXT_TO_BCD_OP, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* UnloadOp - 0x5B 0x2A */ { AML_EXT_OP, AML_EXT_UNLOAD_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* RevisionOp - 0x5B 0x30 */ { AML_EXT_OP, AML_EXT_REVISION_OP, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* DebugOp - 0x5B 0x31 */ { AML_EXT_OP, AML_EXT_DEBUG_OP, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* FatalOp - 0x5B 0x32 */ { AML_EXT_OP, AML_EXT_FATAL_OP, 3, { AML_UINT8, AML_UINT32, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* TimerOp - 0x5B 0x33 */ { AML_EXT_OP, AML_EXT_TIMER_OP, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* OpRegionOp - 0x5B 0x80 */ { AML_EXT_OP, AML_EXT_REGION_OP, 4, { AML_NAME, AML_UINT8, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* FieldOp - 0x5B 0x81 */ { AML_EXT_OP, AML_EXT_FIELD_OP, 2, { AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH },
/* DeviceOp - 0x5B 0x82 */ { AML_EXT_OP, AML_EXT_DEVICE_OP, 1, { AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* ProcessorOp - 0x5B 0x83 */ { AML_EXT_OP, AML_EXT_PROCESSOR_OP, 4, { AML_NAME, AML_UINT8, AML_UINT32, AML_UINT8, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* PowerResOp - 0x5B 0x84 */ { AML_EXT_OP, AML_EXT_POWER_RES_OP, 3, { AML_NAME, AML_UINT8, AML_UINT16, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* ThermalZoneOp - 0x5B 0x85 */ { AML_EXT_OP, AML_EXT_THERMAL_ZONE_OP, 1, { AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* IndexFieldOp - 0x5B 0x86 */ { AML_EXT_OP, AML_EXT_INDEX_FIELD_OP, 3, { AML_NAME, AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH },
/* BankFieldOp - 0x5B 0x87 */ { AML_EXT_OP, AML_EXT_BANK_FIELD_OP, 4, { AML_NAME, AML_NAME, AML_OBJECT, AML_UINT8, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH },
/* DataRegionOp - 0x5B 0x88 */ { AML_EXT_OP, AML_EXT_DATA_REGION_OP, 4, { AML_NAME, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* RootChar - 0x5C */ { AML_ROOT_CHAR, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* ParentPrefixChar - 0x5E */ { AML_PARENT_PREFIX_CHAR, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x5F */ { '_', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* Local0Op - 0x60 */ { AML_LOCAL0, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local1Op - 0x61 */ { AML_LOCAL1, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local2Op - 0x62 */ { AML_LOCAL2, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local3Op - 0x63 */ { AML_LOCAL3, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local4Op - 0x64 */ { AML_LOCAL4, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local5Op - 0x65 */ { AML_LOCAL5, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local6Op - 0x66 */ { AML_LOCAL6, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local7Op - 0x67 */ { AML_LOCAL7, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg0Op - 0x68 */ { AML_ARG0, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg1Op - 0x69 */ { AML_ARG1, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg2Op - 0x6A */ { AML_ARG2, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg3Op - 0x6B */ { AML_ARG3, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg4Op - 0x6C */ { AML_ARG4, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg5Op - 0x6D */ { AML_ARG5, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg6Op - 0x6E */ { AML_ARG6, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* StoreOp - 0x70 */ { AML_STORE_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* RefOfOp - 0x71 */ { AML_REF_OF_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* AddOp - 0x72 */ { AML_ADD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ConcatOp - 0x73 */ { AML_CONCAT_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* SubtractOp - 0x74 */ { AML_SUBTRACT_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* IncrementOp - 0x75 */ { AML_INCREMENT_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* DecrementOp - 0x76 */ { AML_DECREMENT_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* MultiplyOp - 0x77 */ { AML_MULTIPLY_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* DivideOp - 0x78 */ { AML_DIVIDE_OP, 0, 4, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE }, 0 },
/* ShiftLeftOp - 0x79 */ { AML_SHIFT_LEFT_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ShiftRightOp - 0x7A */ { AML_SHIFT_RIGHT_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* AndOp - 0x7B */ { AML_AND_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* NAndOp - 0x7C */ { AML_NAND_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* OrOp - 0x7D */ { AML_OR_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* NorOp - 0x7E */ { AML_NOR_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* XOrOp - 0x7F */ { AML_XOR_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* NotOp - 0x80 */ { AML_NOT_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* FindSetLeftBitOp - 0x81 */ { AML_FIND_SET_LEFT_BIT_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* FindSetRightBitOp - 0x82 */ { AML_FIND_SET_RIGHT_BIT_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* DerefOfOp - 0x83 */ { AML_DEREF_OF_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ConcatResOp - 0x84 */ { AML_CONCAT_RES_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ModOp - 0x85 */ { AML_MOD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* NotifyOp - 0x86 */ { AML_NOTIFY_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* SizeOfOp - 0x87 */ { AML_SIZE_OF_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* IndexOp - 0x88 */ { AML_INDEX_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* MatchOp - 0x89 */ { AML_MATCH_OP, 0, 6, { AML_OBJECT, AML_UINT8, AML_OBJECT, AML_UINT8, AML_OBJECT, AML_OBJECT }, 0 },
/* CreateDWordFieldOp - 0x8A */ { AML_CREATE_DWORD_FIELD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CreateWordFieldOp - 0x8B */ { AML_CREATE_WORD_FIELD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CreateByteFieldOp - 0x8C */ { AML_CREATE_BYTE_FIELD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CreateBitFieldOp - 0x8D */ { AML_CREATE_BIT_FIELD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ObjectTypeOp - 0x8E */ { AML_OBJECT_TYPE_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CreateQWordFieldOp - 0x8F */ { AML_CREATE_QWORD_FIELD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LAndOp - 0x90 */ { AML_LAND_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LOrOp - 0x91 */ { AML_LOR_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LNotOp - 0x92 */ { AML_LNOT_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LEqualOp - 0x93 */ { AML_LEQUAL_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LGreaterOp - 0x94 */ { AML_LGREATER_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LLessOp - 0x95 */ { AML_LLESS_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToBufferOp - 0x96 */ { AML_TO_BUFFER_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToDecimalStringOp - 0x97 */ { AML_TO_DEC_STRING_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToHexStringOp - 0x98 */ { AML_TO_HEX_STRING_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToIntegerOp - 0x99 */ { AML_TO_INTEGER_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToStringOp - 0x9C */ { AML_TO_STRING_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CopyObjectOp - 0x9D */ { AML_COPY_OBJECT_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* MidOp - 0x9E */ { AML_MID_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ContinueOp - 0x9F */ { AML_CONTINUE_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* IfOp - 0xA0 */ { AML_IF_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* ElseOp - 0xA1 */ { AML_ELSE_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* WhileOp - 0xA2 */ { AML_WHILE_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* NoopOp - 0xA3 */ { AML_NOOP_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ReturnOp - 0xA4 */ { AML_RETURN_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* BreakOp - 0xA5 */ { AML_BREAK_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* BreakPointOp - 0xCC */ { AML_BREAK_POINT_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* OnesOp - 0xFF */ { AML_ONES_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
};
GLOBAL_REMOVE_IF_UNREFERENCED
@@ -178,12 +178,12 @@ EFI_ACPI_DATA_TYPE mAmlTypeToAcpiType[] = {
**/
AML_BYTE_ENCODING *
AmlSearchByOpByte (
IN UINT8 *OpByteBuffer
IN UINT8 *OpByteBuffer
)
{
UINT8 OpCode;
UINT8 SubOpCode;
UINTN Index;
UINT8 OpCode;
UINT8 SubOpCode;
UINTN Index;
//
// Get OpCode and SubOpCode
@@ -198,7 +198,7 @@ AmlSearchByOpByte (
//
// Search the table
//
for (Index = 0; Index < sizeof(mAmlByteEncoding)/sizeof(mAmlByteEncoding[0]); Index++) {
for (Index = 0; Index < sizeof (mAmlByteEncoding)/sizeof (mAmlByteEncoding[0]); Index++) {
if ((mAmlByteEncoding[Index].OpCode == OpCode) && (mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
return &mAmlByteEncoding[Index];
}
@@ -219,11 +219,12 @@ AmlTypeToAcpiType (
IN AML_OP_PARSE_FORMAT AmlType
)
{
if (AmlType >= sizeof(mAmlTypeToAcpiType)/sizeof(mAmlTypeToAcpiType[0])) {
ASSERT(FALSE);
if (AmlType >= sizeof (mAmlTypeToAcpiType)/sizeof (mAmlTypeToAcpiType[0])) {
ASSERT (FALSE);
return EFI_ACPI_DATA_TYPE_NONE;
}
return mAmlTypeToAcpiType [AmlType];
return mAmlTypeToAcpiType[AmlType];
}
/**
@@ -236,14 +237,14 @@ AmlTypeToAcpiType (
**/
UINTN
AmlGetPkgLength (
IN UINT8 *Buffer,
OUT UINTN *PkgLength
IN UINT8 *Buffer,
OUT UINTN *PkgLength
)
{
UINT8 LeadByte;
UINT8 ByteCount;
UINTN RealLength;
UINTN Offset;
UINT8 LeadByte;
UINT8 ByteCount;
UINTN RealLength;
UINTN Offset;
//
// <bit 7-6: ByteData count that follows (0-3)>
@@ -261,36 +262,35 @@ AmlGetPkgLength (
// length is 2**28.
//
LeadByte = *Buffer;
ByteCount = (UINT8)((LeadByte >> 6) & 0x03);
Offset = ByteCount + 1;
LeadByte = *Buffer;
ByteCount = (UINT8)((LeadByte >> 6) & 0x03);
Offset = ByteCount + 1;
RealLength = 0;
switch (ByteCount) {
case 0:
RealLength = (UINT32)LeadByte;
break;
case 1:
RealLength = *(Buffer + 1);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
case 2:
RealLength = *(Buffer + 1);
RealLength |= (UINTN)((*(Buffer + 2)) << 8);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
case 3:
RealLength = *(Buffer + 1);
RealLength |= (UINTN)((*(Buffer + 2)) << 8);
RealLength |= (UINTN)((*(Buffer + 3)) << 16);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
default:
ASSERT (0);
break;
case 0:
RealLength = (UINT32)LeadByte;
break;
case 1:
RealLength = *(Buffer + 1);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
case 2:
RealLength = *(Buffer + 1);
RealLength |= (UINTN)((*(Buffer + 2)) << 8);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
case 3:
RealLength = *(Buffer + 1);
RealLength |= (UINTN)((*(Buffer + 2)) << 8);
RealLength |= (UINTN)((*(Buffer + 3)) << 16);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
default:
ASSERT (0);
break;
}
*PkgLength = RealLength;
return Offset;
}

View File

@@ -21,13 +21,13 @@
**/
EFI_STATUS
AmlGetChildFromObjectBuffer (
IN EFI_AML_HANDLE *AmlParentHandle,
IN UINT8 *CurrentBuffer,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN UINT8 *CurrentBuffer,
OUT VOID **Buffer
)
{
AML_BYTE_ENCODING *AmlByteEncoding;
UINTN DataSize;
AML_BYTE_ENCODING *AmlByteEncoding;
UINTN DataSize;
//
// Root is considered as SCOPE, which has TermList.
@@ -38,6 +38,7 @@ AmlGetChildFromObjectBuffer (
if (AmlByteEncoding == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// NOTE: We need return everything, because user might need parse the returned object.
//
@@ -54,6 +55,7 @@ AmlGetChildFromObjectBuffer (
if (DataSize == 0) {
return EFI_INVALID_PARAMETER;
}
CurrentBuffer += DataSize;
}
@@ -77,12 +79,12 @@ AmlGetChildFromObjectBuffer (
**/
EFI_STATUS
AmlGetChildFromRoot (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
)
{
UINT8 *CurrentBuffer;
UINT8 *CurrentBuffer;
if (AmlHandle == NULL) {
//
@@ -109,9 +111,9 @@ AmlGetChildFromRoot (
**/
EFI_STATUS
AmlGetChildFromOptionList (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
)
{
EFI_ACPI_DATA_TYPE DataType;
@@ -121,7 +123,7 @@ AmlGetChildFromOptionList (
EFI_STATUS Status;
AML_OP_PARSE_INDEX MaxTerm;
Index = AML_OP_PARSE_INDEX_GET_TERM1;
Index = AML_OP_PARSE_INDEX_GET_TERM1;
MaxTerm = AmlParentHandle->AmlByteEncoding->MaxIndex;
while (Index <= MaxTerm) {
Status = AmlParseOptionHandleCommon (
@@ -134,6 +136,7 @@ AmlGetChildFromOptionList (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (DataType == EFI_ACPI_DATA_TYPE_NONE) {
//
// Not found
@@ -145,17 +148,19 @@ AmlGetChildFromOptionList (
// Find it, and Check Data
//
if ((DataType == EFI_ACPI_DATA_TYPE_CHILD) &&
((UINTN)AmlHandle->Buffer < (UINTN)Data)) {
((UINTN)AmlHandle->Buffer < (UINTN)Data))
{
//
// Buffer < Data means current node is next one
//
*Buffer = Data;
return EFI_SUCCESS;
}
//
// Not Child
//
Index ++;
Index++;
}
*Buffer = NULL;
@@ -175,13 +180,13 @@ AmlGetChildFromOptionList (
**/
EFI_STATUS
AmlGetChildFromObjectChildList (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
)
{
EFI_STATUS Status;
UINT8 *CurrentBuffer;
EFI_STATUS Status;
UINT8 *CurrentBuffer;
CurrentBuffer = NULL;
@@ -242,12 +247,12 @@ AmlGetChildFromObjectChildList (
**/
EFI_STATUS
AmlGetChildFromNonRoot (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
)
{
EFI_STATUS Status;
EFI_STATUS Status;
if (AmlHandle == NULL) {
//
@@ -263,6 +268,7 @@ AmlGetChildFromNonRoot (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (*Buffer != NULL) {
return EFI_SUCCESS;
}

View File

@@ -20,9 +20,9 @@
**/
EFI_STATUS
AmlConstructNodeList (
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
);
/**
@@ -41,18 +41,18 @@ AmlCreateNode (
IN AML_BYTE_ENCODING *AmlByteEncoding
)
{
EFI_AML_NODE_LIST *AmlNodeList;
EFI_AML_NODE_LIST *AmlNodeList;
AmlNodeList = AllocatePool (sizeof(*AmlNodeList));
AmlNodeList = AllocatePool (sizeof (*AmlNodeList));
ASSERT (AmlNodeList != NULL);
AmlNodeList->Signature = EFI_AML_NODE_LIST_SIGNATURE;
CopyMem (AmlNodeList->Name, NameSeg, AML_NAME_SEG_SIZE);
AmlNodeList->Buffer = NULL;
AmlNodeList->Size = 0;
AmlNodeList->Buffer = NULL;
AmlNodeList->Size = 0;
InitializeListHead (&AmlNodeList->Link);
InitializeListHead (&AmlNodeList->Children);
AmlNodeList->Parent = Parent;
AmlNodeList->Parent = Parent;
AmlNodeList->AmlByteEncoding = AmlByteEncoding;
return AmlNodeList;
@@ -69,15 +69,15 @@ AmlCreateNode (
**/
EFI_AML_NODE_LIST *
AmlFindNodeInThis (
IN UINT8 *NameSeg,
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN BOOLEAN Create
IN UINT8 *NameSeg,
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN BOOLEAN Create
)
{
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_AML_NODE_LIST *AmlNodeList;
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_AML_NODE_LIST *AmlNodeList;
StartLink = &AmlParentNodeList->Children;
CurrentLink = StartLink->ForwardLink;
@@ -93,6 +93,7 @@ AmlFindNodeInThis (
//
return CurrentAmlNodeList;
}
CurrentLink = CurrentLink->ForwardLink;
}
@@ -124,17 +125,17 @@ AmlFindNodeInThis (
**/
EFI_AML_NODE_LIST *
AmlFindNodeInTheTree (
IN UINT8 *NameString,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN BOOLEAN Create
IN UINT8 *NameString,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN BOOLEAN Create
)
{
UINT8 *Buffer;
EFI_AML_NODE_LIST *AmlNodeList;
EFI_AML_NODE_LIST *AmlCurrentNodeList;
UINT8 Index;
UINT8 SegCount;
UINT8 *Buffer;
EFI_AML_NODE_LIST *AmlNodeList;
EFI_AML_NODE_LIST *AmlCurrentNodeList;
UINT8 Index;
UINT8 SegCount;
Buffer = NameString;
@@ -143,7 +144,7 @@ AmlFindNodeInTheTree (
//
if (*Buffer == AML_ROOT_CHAR) {
AmlCurrentNodeList = AmlRootNodeList;
Buffer += 1;
Buffer += 1;
} else if (*Buffer == AML_PARENT_PREFIX_CHAR) {
AmlCurrentNodeList = AmlParentNodeList;
do {
@@ -155,6 +156,7 @@ AmlFindNodeInTheTree (
//
ASSERT (AmlCurrentNodeList == AmlRootNodeList);
}
Buffer += 1;
} while (*Buffer == AML_PARENT_PREFIX_CHAR);
} else {
@@ -165,12 +167,12 @@ AmlFindNodeInTheTree (
// Handle name segment
//
if (*Buffer == AML_DUAL_NAME_PREFIX) {
Buffer += 1;
Buffer += 1;
SegCount = 2;
} else if (*Buffer == AML_MULTI_NAME_PREFIX) {
Buffer += 1;
Buffer += 1;
SegCount = *Buffer;
Buffer += 1;
Buffer += 1;
} else if (*Buffer == 0) {
//
// NULL name, only for Root
@@ -190,9 +192,10 @@ AmlFindNodeInTheTree (
if (AmlNodeList == NULL) {
return NULL;
}
AmlCurrentNodeList = AmlNodeList;
Buffer += AML_NAME_SEG_SIZE;
Index ++;
Buffer += AML_NAME_SEG_SIZE;
Index++;
} while (Index < SegCount);
return AmlNodeList;
@@ -211,14 +214,14 @@ AmlFindNodeInTheTree (
**/
EFI_AML_NODE_LIST *
AmlInsertNodeToTree (
IN UINT8 *NameString,
IN VOID *Buffer,
IN UINTN Size,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
IN UINT8 *NameString,
IN VOID *Buffer,
IN UINTN Size,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
)
{
EFI_AML_NODE_LIST *AmlNodeList;
EFI_AML_NODE_LIST *AmlNodeList;
AmlNodeList = AmlFindNodeInTheTree (
NameString,
@@ -243,10 +246,11 @@ AmlInsertNodeToTree (
// We need check if new one is SCOPE_OP, because SCOPE_OP just means namespace, not a real device.
// We should not return SCOPE_OP.
//
AmlNodeList->Buffer = Buffer;
AmlNodeList->Size = Size;
AmlNodeList->Buffer = Buffer;
AmlNodeList->Size = Size;
AmlNodeList->AmlByteEncoding = AmlSearchByOpByte (Buffer);
}
return AmlNodeList;
}
@@ -282,17 +286,17 @@ AmlInsertNodeToTree (
**/
EFI_STATUS
AmlConstructNodeListForChild (
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
)
{
AML_BYTE_ENCODING *AmlByteEncoding;
UINT8 *Buffer;
UINTN BufferSize;
UINT8 *CurrentBuffer;
EFI_AML_HANDLE *AmlChildHandle;
EFI_STATUS Status;
AML_BYTE_ENCODING *AmlByteEncoding;
UINT8 *Buffer;
UINTN BufferSize;
UINT8 *CurrentBuffer;
EFI_AML_HANDLE *AmlChildHandle;
EFI_STATUS Status;
CurrentBuffer = NULL;
AmlChildHandle = NULL;
@@ -373,13 +377,13 @@ AmlConstructNodeListForChild (
**/
EFI_STATUS
AmlConstructNodeList (
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
)
{
VOID *NameString;
EFI_AML_NODE_LIST *AmlNodeList;
VOID *NameString;
EFI_AML_NODE_LIST *AmlNodeList;
//
// 1. Check if there is need to construct node for this OpCode.
@@ -419,12 +423,12 @@ AmlConstructNodeList (
**/
VOID
AmlDestructNodeList (
IN EFI_AML_NODE_LIST *AmlParentNodeList
IN EFI_AML_NODE_LIST *AmlParentNodeList
)
{
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
//
// Get the children link
@@ -440,7 +444,7 @@ AmlDestructNodeList (
// Destruct the child's list recursively
//
CurrentAmlNodeList = EFI_AML_NODE_LIST_FROM_LINK (CurrentLink);
CurrentLink = CurrentLink->ForwardLink;
CurrentLink = CurrentLink->ForwardLink;
//
// Remove this child from list and free the node
@@ -454,7 +458,7 @@ AmlDestructNodeList (
// Done.
//
FreePool (AmlParentNodeList);
return ;
return;
}
/**
@@ -465,13 +469,13 @@ AmlDestructNodeList (
**/
VOID
AmlDumpNodeInfo (
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN UINTN Level
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN UINTN Level
)
{
EFI_AML_NODE_LIST *CurrentAmlNodeList;
volatile LIST_ENTRY *CurrentLink;
UINTN Index;
EFI_AML_NODE_LIST *CurrentAmlNodeList;
volatile LIST_ENTRY *CurrentLink;
UINTN Index;
CurrentLink = AmlParentNodeList->Children.ForwardLink;
@@ -481,8 +485,10 @@ AmlDumpNodeInfo (
for (Index = 0; Index < Level; Index++) {
DEBUG ((DEBUG_ERROR, " "));
}
AmlPrintNameSeg (AmlParentNodeList->Name);
}
DEBUG ((DEBUG_ERROR, "\n"));
while (CurrentLink != &AmlParentNodeList->Children) {
@@ -491,7 +497,7 @@ AmlDumpNodeInfo (
CurrentLink = CurrentLink->ForwardLink;
}
return ;
return;
}
/**
@@ -515,12 +521,12 @@ AmlFindPath (
IN BOOLEAN FromRoot
)
{
EFI_AML_NODE_LIST *AmlRootNodeList;
EFI_STATUS Status;
EFI_AML_NODE_LIST *AmlNodeList;
UINT8 RootNameSeg[AML_NAME_SEG_SIZE];
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
EFI_AML_NODE_LIST *AmlRootNodeList;
EFI_STATUS Status;
EFI_AML_NODE_LIST *AmlNodeList;
UINT8 RootNameSeg[AML_NAME_SEG_SIZE];
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
//
// 1. create tree
@@ -529,8 +535,8 @@ AmlFindPath (
//
// Create root handle
//
RootNameSeg[0] = AML_ROOT_CHAR;
RootNameSeg[1] = 0;
RootNameSeg[0] = AML_ROOT_CHAR;
RootNameSeg[1] = 0;
AmlRootNodeList = AmlCreateNode (RootNameSeg, NULL, AmlHandle->AmlByteEncoding);
Status = AmlConstructNodeList (
@@ -594,8 +600,8 @@ AmlFindPath (
}
*Buffer = NULL;
Status = EFI_SUCCESS;
if (AmlNodeList != NULL && AmlNodeList->Buffer != NULL) {
Status = EFI_SUCCESS;
if ((AmlNodeList != NULL) && (AmlNodeList->Buffer != NULL)) {
*Buffer = AmlNodeList->Buffer;
}

View File

@@ -25,95 +25,103 @@
**/
EFI_STATUS
AmlParseOptionTerm (
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize,
IN AML_OP_PARSE_INDEX TermIndex,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize,
IN AML_OP_PARSE_INDEX TermIndex,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
)
{
AML_BYTE_ENCODING *ChildAmlByteEncoding;
EFI_STATUS Status;
AML_BYTE_ENCODING *ChildAmlByteEncoding;
EFI_STATUS Status;
if (DataType != NULL) {
*DataType = AmlTypeToAcpiType (AmlByteEncoding->Format[TermIndex - 1]);
}
if (Data != NULL) {
*Data = Buffer;
}
//
// Parse term according to AML type
//
switch (AmlByteEncoding->Format[TermIndex - 1]) {
case AML_UINT8:
*DataSize = sizeof(UINT8);
break;
case AML_UINT16:
*DataSize = sizeof(UINT16);
break;
case AML_UINT32:
*DataSize = sizeof(UINT32);
break;
case AML_UINT64:
*DataSize = sizeof(UINT64);
break;
case AML_STRING:
*DataSize = AsciiStrSize((CHAR8 *)Buffer);
break;
case AML_NAME:
Status = AmlGetNameStringSize (Buffer, DataSize);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
break;
case AML_OBJECT:
ChildAmlByteEncoding = AmlSearchByOpByte (Buffer);
if (ChildAmlByteEncoding == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// NOTE: We need override DataType here, if there is a case the AML_OBJECT is AML_NAME.
// We need convert type from EFI_ACPI_DATA_TYPE_CHILD to EFI_ACPI_DATA_TYPE_NAME_STRING.
// We should not return CHILD because there is NO OpCode for NameString.
//
if ((ChildAmlByteEncoding->Attribute & AML_IS_NAME_CHAR) != 0) {
if (DataType != NULL) {
*DataType = AmlTypeToAcpiType (AML_NAME);
}
case AML_UINT8:
*DataSize = sizeof (UINT8);
break;
case AML_UINT16:
*DataSize = sizeof (UINT16);
break;
case AML_UINT32:
*DataSize = sizeof (UINT32);
break;
case AML_UINT64:
*DataSize = sizeof (UINT64);
break;
case AML_STRING:
*DataSize = AsciiStrSize ((CHAR8 *)Buffer);
break;
case AML_NAME:
Status = AmlGetNameStringSize (Buffer, DataSize);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
break;
}
//
// It is real AML_OBJECT
//
*DataSize = AmlGetObjectSize (
ChildAmlByteEncoding,
Buffer,
MaxBufferSize
);
if (*DataSize == 0) {
return EFI_INVALID_PARAMETER;
}
break;
case AML_NONE:
break;
case AML_OBJECT:
ChildAmlByteEncoding = AmlSearchByOpByte (Buffer);
if (ChildAmlByteEncoding == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// NOTE: We need override DataType here, if there is a case the AML_OBJECT is AML_NAME.
// We need convert type from EFI_ACPI_DATA_TYPE_CHILD to EFI_ACPI_DATA_TYPE_NAME_STRING.
// We should not return CHILD because there is NO OpCode for NameString.
//
if ((ChildAmlByteEncoding->Attribute & AML_IS_NAME_CHAR) != 0) {
if (DataType != NULL) {
*DataType = AmlTypeToAcpiType (AML_NAME);
}
Status = AmlGetNameStringSize (Buffer, DataSize);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
break;
}
//
// It is real AML_OBJECT
//
*DataSize = AmlGetObjectSize (
ChildAmlByteEncoding,
Buffer,
MaxBufferSize
);
if (*DataSize == 0) {
return EFI_INVALID_PARAMETER;
}
break;
case AML_NONE:
//
// No term
//
case AML_OPCODE:
default:
ASSERT (FALSE);
return EFI_INVALID_PARAMETER;
case AML_OPCODE:
default:
ASSERT (FALSE);
return EFI_INVALID_PARAMETER;
}
if (*DataSize > MaxBufferSize) {
return EFI_INVALID_PARAMETER;
}
return EFI_SUCCESS;
}
@@ -135,13 +143,13 @@ AmlParseOptionTerm (
**/
EFI_STATUS
AmlParseOptionCommon (
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
)
{
UINT8 *CurrentBuffer;
@@ -163,6 +171,7 @@ AmlParseOptionCommon (
if (Index != AML_OP_PARSE_INDEX_GET_SIZE) {
return EFI_INVALID_PARAMETER;
}
//
// return NameString size
//
@@ -170,9 +179,11 @@ AmlParseOptionCommon (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (*DataSize > MaxBufferSize) {
return EFI_INVALID_PARAMETER;
}
return EFI_SUCCESS;
}
@@ -186,27 +197,31 @@ AmlParseOptionCommon (
//
if (Index != AML_OP_PARSE_INDEX_GET_SIZE) {
*DataType = EFI_ACPI_DATA_TYPE_OPCODE;
*Data = (VOID *)CurrentBuffer;
*Data = (VOID *)CurrentBuffer;
}
if (*CurrentBuffer == AML_EXT_OP) {
OpLength = 2;
} else {
OpLength = 1;
}
*DataSize = OpLength;
if (Index == AML_OP_PARSE_INDEX_GET_OPCODE) {
return EFI_SUCCESS;
}
if (OpLength > MaxBufferSize) {
return EFI_INVALID_PARAMETER;
}
CurrentBuffer += OpLength;
//
// 2. Skip PkgLength field, if have
//
if ((AmlByteEncoding->Attribute & AML_HAS_PKG_LENGTH) != 0) {
PkgOffset = AmlGetPkgLength(CurrentBuffer, &PkgLength);
PkgOffset = AmlGetPkgLength (CurrentBuffer, &PkgLength);
//
// Override MaxBufferSize if it is valid PkgLength
//
@@ -219,6 +234,7 @@ AmlParseOptionCommon (
PkgOffset = 0;
PkgLength = 0;
}
CurrentBuffer += PkgOffset;
//
@@ -250,7 +266,7 @@ AmlParseOptionCommon (
// Parse next one
//
CurrentBuffer += *DataSize;
TermIndex ++;
TermIndex++;
}
//
@@ -259,6 +275,7 @@ AmlParseOptionCommon (
if ((UINTN)CurrentBuffer > (UINTN)Buffer + MaxBufferSize) {
return EFI_INVALID_PARAMETER;
}
if ((UINTN)CurrentBuffer == (UINTN)Buffer + MaxBufferSize) {
if (Index != AML_OP_PARSE_INDEX_GET_SIZE) {
return EFI_INVALID_PARAMETER;
@@ -289,23 +306,23 @@ AmlParseOptionCommon (
**/
UINTN
AmlGetObjectSize (
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize
)
{
EFI_STATUS Status;
UINTN DataSize;
EFI_STATUS Status;
UINTN DataSize;
Status = AmlParseOptionCommon (
AmlByteEncoding,
Buffer,
MaxBufferSize,
AML_OP_PARSE_INDEX_GET_SIZE,
NULL,
NULL,
&DataSize
);
AmlByteEncoding,
Buffer,
MaxBufferSize,
AML_OP_PARSE_INDEX_GET_SIZE,
NULL,
NULL,
&DataSize
);
if (EFI_ERROR (Status)) {
return 0;
} else {
@@ -322,7 +339,7 @@ AmlGetObjectSize (
**/
CHAR8 *
AmlGetObjectName (
IN EFI_AML_HANDLE *AmlHandle
IN EFI_AML_HANDLE *AmlHandle
)
{
AML_BYTE_ENCODING *AmlByteEncoding;
@@ -346,6 +363,7 @@ AmlGetObjectName (
break;
}
}
ASSERT (TermIndex != 0);
//
@@ -361,6 +379,7 @@ AmlGetObjectName (
if (EFI_ERROR (Status)) {
return NULL;
}
ASSERT (DataType == EFI_ACPI_DATA_TYPE_NAME_STRING);
return NameString;
@@ -377,8 +396,8 @@ AmlGetObjectName (
**/
EFI_STATUS
AmlGetOffsetAfterLastOption (
IN EFI_AML_HANDLE *AmlHandle,
OUT UINT8 **Buffer
IN EFI_AML_HANDLE *AmlHandle,
OUT UINT8 **Buffer
)
{
EFI_ACPI_DATA_TYPE DataType;
@@ -408,6 +427,7 @@ AmlGetOffsetAfterLastOption (
if (DataType == EFI_ACPI_DATA_TYPE_OPCODE) {
*Buffer += AmlGetPkgLength (*Buffer, &DataSize);
}
return EFI_SUCCESS;
}
@@ -427,11 +447,11 @@ AmlGetOffsetAfterLastOption (
**/
EFI_STATUS
AmlParseOptionHandleCommon (
IN EFI_AML_HANDLE *AmlHandle,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
IN EFI_AML_HANDLE *AmlHandle,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
)
{
return AmlParseOptionCommon (

View File

@@ -18,7 +18,7 @@
**/
BOOLEAN
AmlIsRootPath (
IN UINT8 *Buffer
IN UINT8 *Buffer
)
{
if ((Buffer[0] == AML_ROOT_CHAR) && (Buffer[1] == 0)) {
@@ -38,10 +38,10 @@ AmlIsRootPath (
**/
BOOLEAN
AmlIsLeadName (
IN CHAR8 Ch
IN CHAR8 Ch
)
{
if ((Ch == '_') || (Ch >= 'A' && Ch <= 'Z')) {
if ((Ch == '_') || ((Ch >= 'A') && (Ch <= 'Z'))) {
return TRUE;
} else {
return FALSE;
@@ -58,10 +58,10 @@ AmlIsLeadName (
**/
BOOLEAN
AmlIsName (
IN CHAR8 Ch
IN CHAR8 Ch
)
{
if (AmlIsLeadName (Ch) || (Ch >= '0' && Ch <= '9')) {
if (AmlIsLeadName (Ch) || ((Ch >= '0') && (Ch <= '9'))) {
return TRUE;
} else {
return FALSE;
@@ -78,18 +78,21 @@ AmlIsName (
**/
BOOLEAN
AmlIsNameSeg (
IN UINT8 *Buffer
IN UINT8 *Buffer
)
{
UINTN Index;
if (!AmlIsLeadName (Buffer[0])) {
return FALSE;
}
for (Index = 1; Index < AML_NAME_SEG_SIZE; Index++) {
if (!AmlIsName (Buffer[Index])) {
return FALSE;
}
}
return TRUE;
}
@@ -104,13 +107,13 @@ AmlIsNameSeg (
**/
EFI_STATUS
AmlGetNameStringSize (
IN UINT8 *Buffer,
OUT UINTN *BufferSize
IN UINT8 *Buffer,
OUT UINTN *BufferSize
)
{
UINTN SegCount;
UINTN Length;
UINTN Index;
UINTN SegCount;
UINTN Length;
UINTN Index;
Length = 0;
@@ -118,12 +121,12 @@ AmlGetNameStringSize (
// Parse root or parent prefix
//
if (*Buffer == AML_ROOT_CHAR) {
Buffer ++;
Length ++;
Buffer++;
Length++;
} else if (*Buffer == AML_PARENT_PREFIX_CHAR) {
do {
Buffer ++;
Length ++;
Buffer++;
Length++;
} while (*Buffer == AML_PARENT_PREFIX_CHAR);
}
@@ -131,21 +134,21 @@ AmlGetNameStringSize (
// Parse name segment
//
if (*Buffer == AML_DUAL_NAME_PREFIX) {
Buffer ++;
Length ++;
Buffer++;
Length++;
SegCount = 2;
} else if (*Buffer == AML_MULTI_NAME_PREFIX) {
Buffer ++;
Length ++;
Buffer++;
Length++;
SegCount = *Buffer;
Buffer ++;
Length ++;
Buffer++;
Length++;
} else if (*Buffer == 0) {
//
// NULL Name, only for Root
//
SegCount = 0;
Buffer --;
Buffer--;
if ((Length == 1) && (*Buffer == AML_ROOT_CHAR)) {
*BufferSize = 2;
return EFI_SUCCESS;
@@ -164,9 +167,10 @@ AmlGetNameStringSize (
if (!AmlIsNameSeg (Buffer)) {
return EFI_INVALID_PARAMETER;
}
Buffer += AML_NAME_SEG_SIZE;
Length += AML_NAME_SEG_SIZE;
Index ++;
Index++;
} while (Index < SegCount);
*BufferSize = Length;
@@ -183,10 +187,10 @@ AmlGetNameStringSize (
**/
BOOLEAN
AmlIsAslLeadName (
IN CHAR8 Ch
IN CHAR8 Ch
)
{
if (AmlIsLeadName (Ch) || (Ch >= 'a' && Ch <= 'z')) {
if (AmlIsLeadName (Ch) || ((Ch >= 'a') && (Ch <= 'z'))) {
return TRUE;
} else {
return FALSE;
@@ -203,10 +207,10 @@ AmlIsAslLeadName (
**/
BOOLEAN
AmlIsAslName (
IN CHAR8 Ch
IN CHAR8 Ch
)
{
if (AmlIsAslLeadName (Ch) || (Ch >= '0' && Ch <= '9')) {
if (AmlIsAslLeadName (Ch) || ((Ch >= '0') && (Ch <= '9'))) {
return TRUE;
} else {
return FALSE;
@@ -222,11 +226,11 @@ AmlIsAslName (
**/
UINTN
AmlGetAslNameSegLength (
IN UINT8 *Buffer
IN UINT8 *Buffer
)
{
UINTN Length;
UINTN Index;
UINTN Length;
UINTN Index;
if (*Buffer == 0) {
return 0;
@@ -237,20 +241,23 @@ AmlGetAslNameSegLength (
// 1st
//
if (AmlIsAslLeadName (*Buffer)) {
Length ++;
Buffer ++;
Length++;
Buffer++;
}
if ((*Buffer == 0) || (*Buffer == '.')) {
return Length;
}
//
// 2, 3, 4 name char
//
for (Index = 0; Index < 3; Index++) {
if (AmlIsAslName (*Buffer)) {
Length ++;
Buffer ++;
Length++;
Buffer++;
}
if ((*Buffer == 0) || (*Buffer == '.')) {
return Length;
}
@@ -274,27 +281,27 @@ AmlGetAslNameSegLength (
**/
UINTN
AmlGetAslNameStringSize (
IN UINT8 *Buffer,
OUT UINTN *Root,
OUT UINTN *Parent,
OUT UINTN *SegCount
IN UINT8 *Buffer,
OUT UINTN *Root,
OUT UINTN *Parent,
OUT UINTN *SegCount
)
{
UINTN NameLength;
UINTN TotalLength;
UINTN NameLength;
UINTN TotalLength;
*Root = 0;
*Parent = 0;
*SegCount = 0;
*Root = 0;
*Parent = 0;
*SegCount = 0;
TotalLength = 0;
NameLength = 0;
NameLength = 0;
if (*Buffer == AML_ROOT_CHAR) {
*Root = 1;
Buffer ++;
Buffer++;
} else if (*Buffer == AML_PARENT_PREFIX_CHAR) {
do {
Buffer ++;
(*Parent) ++;
Buffer++;
(*Parent)++;
} while (*Buffer == AML_PARENT_PREFIX_CHAR);
}
@@ -306,12 +313,14 @@ AmlGetAslNameStringSize (
if ((NameLength == 0) || (NameLength > AML_NAME_SEG_SIZE)) {
return 0;
}
(*SegCount) ++;
(*SegCount)++;
Buffer += NameLength;
if (*Buffer == 0) {
break;
}
Buffer ++;
Buffer++;
}
//
@@ -334,7 +343,7 @@ AmlGetAslNameStringSize (
//
// Add NULL char
//
TotalLength ++;
TotalLength++;
return TotalLength;
}
@@ -348,15 +357,15 @@ AmlGetAslNameStringSize (
**/
VOID
AmlUpperCaseCopyMem (
IN UINT8 *DstBuffer,
IN UINT8 *SrcBuffer,
IN UINTN Length
IN UINT8 *DstBuffer,
IN UINT8 *SrcBuffer,
IN UINTN Length
)
{
UINTN Index;
UINTN Index;
for (Index = 0; Index < Length; Index++) {
if (SrcBuffer[Index] >= 'a' && SrcBuffer[Index] <= 'z') {
if ((SrcBuffer[Index] >= 'a') && (SrcBuffer[Index] <= 'z')) {
DstBuffer[Index] = (UINT8)(SrcBuffer[Index] - 'a' + 'A');
} else {
DstBuffer[Index] = SrcBuffer[Index];
@@ -374,17 +383,17 @@ AmlUpperCaseCopyMem (
**/
UINT8 *
AmlNameFromAslName (
IN UINT8 *AslPath
IN UINT8 *AslPath
)
{
UINTN Root;
UINTN Parent;
UINTN SegCount;
UINTN TotalLength;
UINTN NameLength;
UINT8 *Buffer;
UINT8 *AmlPath;
UINT8 *AmlBuffer;
UINTN Root;
UINTN Parent;
UINTN SegCount;
UINTN TotalLength;
UINTN NameLength;
UINT8 *Buffer;
UINT8 *AmlPath;
UINT8 *AmlBuffer;
TotalLength = AmlGetAslNameStringSize (AslPath, &Root, &Parent, &SegCount);
if (TotalLength == 0) {
@@ -395,19 +404,19 @@ AmlNameFromAslName (
ASSERT (AmlPath != NULL);
AmlBuffer = AmlPath;
Buffer = AslPath;
Buffer = AslPath;
//
// Handle Root and Parent
//
if (Root == 1) {
*AmlBuffer = AML_ROOT_CHAR;
AmlBuffer ++;
Buffer ++;
AmlBuffer++;
Buffer++;
} else if (Parent > 0) {
SetMem (AmlBuffer, Parent, AML_PARENT_PREFIX_CHAR);
AmlBuffer += Parent;
Buffer += Parent;
Buffer += Parent;
}
//
@@ -415,12 +424,12 @@ AmlNameFromAslName (
//
if (SegCount > 2) {
*AmlBuffer = AML_MULTI_NAME_PREFIX;
AmlBuffer ++;
AmlBuffer++;
*AmlBuffer = (UINT8)SegCount;
AmlBuffer ++;
AmlBuffer++;
} else if (SegCount == 2) {
*AmlBuffer = AML_DUAL_NAME_PREFIX;
AmlBuffer ++;
AmlBuffer++;
}
//
@@ -431,12 +440,13 @@ AmlNameFromAslName (
ASSERT ((NameLength != 0) && (NameLength <= AML_NAME_SEG_SIZE));
AmlUpperCaseCopyMem (AmlBuffer, Buffer, NameLength);
SetMem (AmlBuffer + NameLength, AML_NAME_SEG_SIZE - NameLength, AML_NAME_CHAR__);
Buffer += NameLength;
Buffer += NameLength;
AmlBuffer += AML_NAME_SEG_SIZE;
if (*Buffer == 0) {
break;
}
Buffer ++;
Buffer++;
}
//
@@ -454,23 +464,26 @@ AmlNameFromAslName (
**/
VOID
AmlPrintNameSeg (
IN UINT8 *Buffer
IN UINT8 *Buffer
)
{
DEBUG ((DEBUG_ERROR, "%c", Buffer[0]));
if ((Buffer[1] == '_') && (Buffer[2] == '_') && (Buffer[3] == '_')) {
return ;
return;
}
DEBUG ((DEBUG_ERROR, "%c", Buffer[1]));
if ((Buffer[2] == '_') && (Buffer[3] == '_')) {
return ;
return;
}
DEBUG ((DEBUG_ERROR, "%c", Buffer[2]));
if (Buffer[3] == '_') {
return ;
return;
}
DEBUG ((DEBUG_ERROR, "%c", Buffer[3]));
return ;
return;
}
/**
@@ -480,24 +493,24 @@ AmlPrintNameSeg (
**/
VOID
AmlPrintNameString (
IN UINT8 *Buffer
IN UINT8 *Buffer
)
{
UINT8 SegCount;
UINT8 Index;
UINT8 SegCount;
UINT8 Index;
if (*Buffer == AML_ROOT_CHAR) {
//
// RootChar
//
Buffer ++;
Buffer++;
DEBUG ((DEBUG_ERROR, "\\"));
} else if (*Buffer == AML_PARENT_PREFIX_CHAR) {
//
// ParentPrefixChar
//
do {
Buffer ++;
Buffer++;
DEBUG ((DEBUG_ERROR, "^"));
} while (*Buffer == AML_PARENT_PREFIX_CHAR);
}
@@ -506,20 +519,20 @@ AmlPrintNameString (
//
// DualName
//
Buffer ++;
Buffer++;
SegCount = 2;
} else if (*Buffer == AML_MULTI_NAME_PREFIX) {
//
// MultiName
//
Buffer ++;
Buffer++;
SegCount = *Buffer;
Buffer ++;
Buffer++;
} else if (*Buffer == 0) {
//
// NULL Name
//
return ;
return;
} else {
//
// NameSeg
@@ -535,5 +548,5 @@ AmlPrintNameString (
Buffer += AML_NAME_SEG_SIZE;
}
return ;
return;
}

View File

@@ -132,36 +132,36 @@ EFI_BOOT_LOGO_PROTOCOL mBootLogoProtocolTemplate = {
///
/// Boot Logo 2 Protocol instance
///
EDKII_BOOT_LOGO2_PROTOCOL mBootLogo2ProtocolTemplate = {
EDKII_BOOT_LOGO2_PROTOCOL mBootLogo2ProtocolTemplate = {
SetBootLogo2,
GetBootLogo2
};
EFI_EVENT mBootGraphicsReadyToBootEvent;
UINTN mBootGraphicsResourceTableKey = 0;
BOOLEAN mIsLogoValid = FALSE;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *mLogoBltBuffer = NULL;
UINTN mLogoDestX = 0;
UINTN mLogoDestY = 0;
UINTN mLogoWidth = 0;
UINTN mLogoHeight = 0;
BOOLEAN mAcpiBgrtInstalled = FALSE;
BOOLEAN mAcpiBgrtStatusChanged = FALSE;
BOOLEAN mAcpiBgrtBufferChanged = FALSE;
BOOLEAN mIsLogoValid = FALSE;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *mLogoBltBuffer = NULL;
UINTN mLogoDestX = 0;
UINTN mLogoDestY = 0;
UINTN mLogoWidth = 0;
UINTN mLogoHeight = 0;
BOOLEAN mAcpiBgrtInstalled = FALSE;
BOOLEAN mAcpiBgrtStatusChanged = FALSE;
BOOLEAN mAcpiBgrtBufferChanged = FALSE;
//
// ACPI Boot Graphics Resource Table template
//
EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE mBootGraphicsResourceTableTemplate = {
EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE mBootGraphicsResourceTableTemplate = {
{
EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE,
sizeof (EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE),
EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE_REVISION, // Revision
0x00, // Checksum will be updated at runtime
EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE_REVISION, // Revision
0x00, // Checksum will be updated at runtime
//
// It is expected that these values will be updated at EntryPoint.
//
{0x00}, // OEM ID is a 6 bytes long field
{ 0x00 }, // OEM ID is a 6 bytes long field
0x00, // OEM Table ID(8 bytes long)
0x00, // OEM Revision
0x00, // Creator ID
@@ -196,12 +196,12 @@ EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE mBootGraphicsResourceTableTemplate = {
EFI_STATUS
EFIAPI
SetBootLogo (
IN EFI_BOOT_LOGO_PROTOCOL *This,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height
IN EFI_BOOT_LOGO_PROTOCOL *This,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height
)
{
//
@@ -250,7 +250,7 @@ SetBootLogo2 (
UINT32 Result32;
if (BltBuffer == NULL) {
mIsLogoValid = FALSE;
mIsLogoValid = FALSE;
mAcpiBgrtStatusChanged = TRUE;
return EFI_SUCCESS;
}
@@ -258,7 +258,7 @@ SetBootLogo2 (
//
// Width and height are not allowed to be zero.
//
if (Width == 0 || Height == 0) {
if ((Width == 0) || (Height == 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -270,14 +270,17 @@ SetBootLogo2 (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
Status = SafeUintnToUint32 (DestinationY, &Result32);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
Status = SafeUintnToUint32 (Width, &Result32);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
Status = SafeUintnToUint32 (Height, &Result32);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
@@ -295,6 +298,7 @@ SetBootLogo2 (
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
Status = SafeUintnMult (
BufferSize,
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL),
@@ -382,8 +386,9 @@ GetBootLogo2 (
//
// Make sure none of the boot logo location parameters are NULL.
//
if (BltBuffer == NULL || DestinationX == NULL || DestinationY == NULL ||
Width == NULL || Height == NULL) {
if ((BltBuffer == NULL) || (DestinationX == NULL) || (DestinationY == NULL) ||
(Width == NULL) || (Height == NULL))
{
return EFI_INVALID_PARAMETER;
}
@@ -425,7 +430,7 @@ BgrtReadyToBootEventNotify (
Status = gBS->LocateProtocol (
&gEfiAcpiTableProtocolGuid,
NULL,
(VOID **) &AcpiTableProtocol
(VOID **)&AcpiTableProtocol
);
if (EFI_ERROR (Status)) {
return;
@@ -475,13 +480,13 @@ BgrtReadyToBootEventNotify (
// so the BMP image is allocated by TranslateGopBltToBmp().
//
ImageBuffer = NULL;
Status = TranslateGopBltToBmp (
mLogoBltBuffer,
(UINT32)mLogoHeight,
(UINT32)mLogoWidth,
&ImageBuffer,
&BmpSize
);
Status = TranslateGopBltToBmp (
mLogoBltBuffer,
(UINT32)mLogoHeight,
(UINT32)mLogoWidth,
&ImageBuffer,
&BmpSize
);
if (EFI_ERROR (Status)) {
return;
}

View File

@@ -18,18 +18,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
SetIdtEntry (
IN ACPI_S3_CONTEXT *AcpiS3Context
IN ACPI_S3_CONTEXT *AcpiS3Context
)
{
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
IA32_DESCRIPTOR *IdtDescriptor;
UINTN S3DebugBuffer;
EFI_STATUS Status;
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
IA32_DESCRIPTOR *IdtDescriptor;
UINTN S3DebugBuffer;
EFI_STATUS Status;
//
// Restore IDT for debug
//
IdtDescriptor = (IA32_DESCRIPTOR *) (UINTN) (AcpiS3Context->IdtrProfile);
IdtDescriptor = (IA32_DESCRIPTOR *)(UINTN)(AcpiS3Context->IdtrProfile);
AsmWriteIdtr (IdtDescriptor);
//
@@ -39,17 +39,18 @@ SetIdtEntry (
ASSERT_EFI_ERROR (Status);
DEBUG_CODE_BEGIN ();
//
// Update IDT entry INT3 if the instruction is valid in it
//
S3DebugBuffer = (UINTN) (AcpiS3Context->S3DebugBufferAddress);
if (*(UINTN *)S3DebugBuffer != (UINTN) -1) {
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
IdtEntry->Bits.OffsetLow = (UINT16)S3DebugBuffer;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16);
}
//
// Update IDT entry INT3 if the instruction is valid in it
//
S3DebugBuffer = (UINTN)(AcpiS3Context->S3DebugBufferAddress);
if (*(UINTN *)S3DebugBuffer != (UINTN)-1) {
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
IdtEntry->Bits.OffsetLow = (UINT16)S3DebugBuffer;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16);
}
DEBUG_CODE_END ();
}

View File

@@ -13,12 +13,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "ScriptExecute.h"
EFI_GUID mBootScriptExecutorImageGuid = {
EFI_GUID mBootScriptExecutorImageGuid = {
0x9a8d3433, 0x9fe8, 0x42b6, { 0x87, 0xb, 0x1e, 0x31, 0xc8, 0x4e, 0xbe, 0x3b }
};
BOOLEAN mPage1GSupport = FALSE;
UINT64 mAddressEncMask = 0;
BOOLEAN mPage1GSupport = FALSE;
UINT64 mAddressEncMask = 0;
/**
Entry function of Boot script exector. This function will be executed in
@@ -34,8 +34,8 @@ UINT64 mAddressEncMask = 0;
EFI_STATUS
EFIAPI
S3BootScriptExecutorEntryFunction (
IN ACPI_S3_CONTEXT *AcpiS3Context,
IN PEI_S3_RESUME_STATE *PeiS3ResumeState
IN ACPI_S3_CONTEXT *AcpiS3Context,
IN PEI_S3_RESUME_STATE *PeiS3ResumeState
)
{
EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs;
@@ -82,7 +82,7 @@ S3BootScriptExecutorEntryFunction (
//
// Get ACPI Table Address
//
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) ((UINTN) (AcpiS3Context->AcpiFacsTable));
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)((UINTN)(AcpiS3Context->AcpiFacsTable));
//
// We need turn back to S3Resume - install boot script done ppi and report status code on S3resume.
@@ -102,13 +102,14 @@ S3BootScriptExecutorEntryFunction (
if ((Facs != NULL) &&
(Facs->Signature == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) &&
(Facs->FirmwareWakingVector != 0) ) {
(Facs->FirmwareWakingVector != 0))
{
//
// more step needed - because relative address is handled differently between X64 and IA32.
//
AsmTransferControl16Address = (UINTN)AsmTransferControl16;
AsmFixAddress16 = (UINT32)AsmTransferControl16Address;
AsmJmpAddr32 = (UINT32)((Facs->FirmwareWakingVector & 0xF) | ((Facs->FirmwareWakingVector & 0xFFFF0) << 12));
AsmFixAddress16 = (UINT32)AsmTransferControl16Address;
AsmJmpAddr32 = (UINT32)((Facs->FirmwareWakingVector & 0xF) | ((Facs->FirmwareWakingVector & 0xFFFF0) << 12));
}
AsmDisablePaging64 (
@@ -136,7 +137,7 @@ S3BootScriptExecutorEntryFunction (
//
// Never run to here
//
CpuDeadLoop();
CpuDeadLoop ();
return EFI_UNSUPPORTED;
}
@@ -147,10 +148,11 @@ S3BootScriptExecutorEntryFunction (
//
// Switch to native waking vector
//
TempStackTop = (UINTN)&TempStack + sizeof(TempStack);
TempStackTop = (UINTN)&TempStack + sizeof (TempStack);
if ((Facs->Version == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
((Facs->Flags & EFI_ACPI_4_0_64BIT_WAKE_SUPPORTED_F) != 0) &&
((Facs->OspmFlags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0)) {
((Facs->OspmFlags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0))
{
//
// X64 long mode waking vector
//
@@ -164,7 +166,7 @@ S3BootScriptExecutorEntryFunction (
);
} else {
// Unsupported for 32bit DXE, 64bit OS vector
DEBUG (( DEBUG_ERROR, "Unsupported for 32bit DXE transfer to 64bit OS waking vector!\r\n"));
DEBUG ((DEBUG_ERROR, "Unsupported for 32bit DXE transfer to 64bit OS waking vector!\r\n"));
ASSERT (FALSE);
}
} else {
@@ -200,7 +202,7 @@ S3BootScriptExecutorEntryFunction (
//
// Never run to here
//
CpuDeadLoop();
CpuDeadLoop ();
return EFI_UNSUPPORTED;
}
@@ -215,28 +217,27 @@ S3BootScriptExecutorEntryFunction (
**/
VOID
RegisterMemoryProfileImage (
IN EFI_GUID *FileName,
IN PHYSICAL_ADDRESS ImageBase,
IN UINT64 ImageSize,
IN EFI_FV_FILETYPE FileType
IN EFI_GUID *FileName,
IN PHYSICAL_ADDRESS ImageBase,
IN UINT64 ImageSize,
IN EFI_FV_FILETYPE FileType
)
{
EFI_STATUS Status;
EDKII_MEMORY_PROFILE_PROTOCOL *ProfileProtocol;
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FilePath;
UINT8 TempBuffer[sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH) + sizeof (EFI_DEVICE_PATH_PROTOCOL)];
EFI_STATUS Status;
EDKII_MEMORY_PROFILE_PROTOCOL *ProfileProtocol;
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FilePath;
UINT8 TempBuffer[sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH) + sizeof (EFI_DEVICE_PATH_PROTOCOL)];
if ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT0) != 0) {
FilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)TempBuffer;
Status = gBS->LocateProtocol (&gEdkiiMemoryProfileGuid, NULL, (VOID **) &ProfileProtocol);
Status = gBS->LocateProtocol (&gEdkiiMemoryProfileGuid, NULL, (VOID **)&ProfileProtocol);
if (!EFI_ERROR (Status)) {
EfiInitializeFwVolDevicepathNode (FilePath, FileName);
SetDevicePathEndNode (FilePath + 1);
Status = ProfileProtocol->RegisterImage (
ProfileProtocol,
(EFI_DEVICE_PATH_PROTOCOL *) FilePath,
(EFI_DEVICE_PATH_PROTOCOL *)FilePath,
ImageBase,
ImageSize,
FileType
@@ -259,15 +260,15 @@ ReadyToLockEventNotify (
IN VOID *Context
)
{
EFI_STATUS Status;
VOID *Interface;
UINT8 *Buffer;
UINTN BufferSize;
EFI_HANDLE NewImageHandle;
UINTN Pages;
EFI_PHYSICAL_ADDRESS FfsBuffer;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemDesc;
EFI_STATUS Status;
VOID *Interface;
UINT8 *Buffer;
UINTN BufferSize;
EFI_HANDLE NewImageHandle;
UINTN Pages;
EFI_PHYSICAL_ADDRESS FfsBuffer;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemDesc;
Status = gBS->LocateProtocol (&gEfiDxeSmmReadyToLockProtocolGuid, NULL, &Interface);
if (EFI_ERROR (Status)) {
@@ -278,22 +279,22 @@ ReadyToLockEventNotify (
// A workaround: Here we install a dummy handle
//
NewImageHandle = NULL;
Status = gBS->InstallProtocolInterface (
&NewImageHandle,
&gEfiCallerIdGuid,
EFI_NATIVE_INTERFACE,
NULL
);
Status = gBS->InstallProtocolInterface (
&NewImageHandle,
&gEfiCallerIdGuid,
EFI_NATIVE_INTERFACE,
NULL
);
ASSERT_EFI_ERROR (Status);
//
// Reload BootScriptExecutor image itself to RESERVED mem
//
Status = GetSectionFromAnyFv (
Status = GetSectionFromAnyFv (
&gEfiCallerIdGuid,
EFI_SECTION_PE32,
0,
(VOID **) &Buffer,
(VOID **)&Buffer,
&BufferSize
);
ASSERT_EFI_ERROR (Status);
@@ -305,24 +306,25 @@ ReadyToLockEventNotify (
Status = PeCoffLoaderGetImageInfo (&ImageContext);
ASSERT_EFI_ERROR (Status);
if (ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
Pages = EFI_SIZE_TO_PAGES ((UINTN) (ImageContext.ImageSize + ImageContext.SectionAlignment));
Pages = EFI_SIZE_TO_PAGES ((UINTN)(ImageContext.ImageSize + ImageContext.SectionAlignment));
} else {
Pages = EFI_SIZE_TO_PAGES ((UINTN) ImageContext.ImageSize);
Pages = EFI_SIZE_TO_PAGES ((UINTN)ImageContext.ImageSize);
}
FfsBuffer = 0xFFFFFFFF;
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
Pages,
&FfsBuffer
);
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
Pages,
&FfsBuffer
);
ASSERT_EFI_ERROR (Status);
//
// Make sure that the buffer can be used to store code.
//
Status = gDS->GetMemorySpaceDescriptor (FfsBuffer, &MemDesc);
if (!EFI_ERROR (Status) && (MemDesc.Attributes & EFI_MEMORY_XP) != 0) {
if (!EFI_ERROR (Status) && ((MemDesc.Attributes & EFI_MEMORY_XP) != 0)) {
gDS->SetMemorySpaceAttributes (
FfsBuffer,
EFI_PAGES_TO_SIZE (Pages),
@@ -365,7 +367,7 @@ ReadyToLockEventNotify (
EFI_FV_FILETYPE_DRIVER
);
Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint)) (NewImageHandle, gST);
Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint))(NewImageHandle, gST);
ASSERT_EFI_ERROR (Status);
//
@@ -398,20 +400,20 @@ ReadyToLockEventNotify (
EFI_STATUS
EFIAPI
BootScriptExecutorEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
UINTN BufferSize;
UINTN Pages;
BOOT_SCRIPT_EXECUTOR_VARIABLE *EfiBootScriptExecutorVariable;
EFI_PHYSICAL_ADDRESS BootScriptExecutorBuffer;
EFI_STATUS Status;
VOID *DevicePath;
EFI_EVENT ReadyToLockEvent;
VOID *Registration;
UINT32 RegEax;
UINT32 RegEdx;
UINTN BufferSize;
UINTN Pages;
BOOT_SCRIPT_EXECUTOR_VARIABLE *EfiBootScriptExecutorVariable;
EFI_PHYSICAL_ADDRESS BootScriptExecutorBuffer;
EFI_STATUS Status;
VOID *DevicePath;
EFI_EVENT ReadyToLockEvent;
VOID *Registration;
UINT32 RegEax;
UINT32 RegEdx;
if (!PcdGetBool (PcdAcpiS3Enable)) {
return EFI_UNSUPPORTED;
@@ -429,68 +431,68 @@ BootScriptExecutorEntryPoint (
//
Status = gBS->LocateProtocol (&gEfiCallerIdGuid, NULL, &DevicePath);
if (EFI_ERROR (Status)) {
//
// Create ReadyToLock event to reload BootScriptExecutor image
// to RESERVED mem and save it to LockBox.
//
ReadyToLockEvent = EfiCreateProtocolNotifyEvent (
&gEfiDxeSmmReadyToLockProtocolGuid,
TPL_NOTIFY,
ReadyToLockEventNotify,
NULL,
&Registration
);
ASSERT (ReadyToLockEvent != NULL);
} else {
//
// the entry point is invoked after reloading. following code only run in RESERVED mem
//
if (PcdGetBool(PcdUse1GPageTable)) {
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000001) {
AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
if ((RegEdx & BIT26) != 0) {
mPage1GSupport = TRUE;
}
//
// Create ReadyToLock event to reload BootScriptExecutor image
// to RESERVED mem and save it to LockBox.
//
ReadyToLockEvent = EfiCreateProtocolNotifyEvent (
&gEfiDxeSmmReadyToLockProtocolGuid,
TPL_NOTIFY,
ReadyToLockEventNotify,
NULL,
&Registration
);
ASSERT (ReadyToLockEvent != NULL);
} else {
//
// the entry point is invoked after reloading. following code only run in RESERVED mem
//
if (PcdGetBool (PcdUse1GPageTable)) {
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000001) {
AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
if ((RegEdx & BIT26) != 0) {
mPage1GSupport = TRUE;
}
}
BufferSize = sizeof (BOOT_SCRIPT_EXECUTOR_VARIABLE);
BootScriptExecutorBuffer = 0xFFFFFFFF;
Pages = EFI_SIZE_TO_PAGES(BufferSize);
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
Pages,
&BootScriptExecutorBuffer
);
ASSERT_EFI_ERROR (Status);
EfiBootScriptExecutorVariable = (BOOT_SCRIPT_EXECUTOR_VARIABLE *)(UINTN)BootScriptExecutorBuffer;
EfiBootScriptExecutorVariable->BootScriptExecutorEntrypoint = (UINTN) S3BootScriptExecutorEntryFunction ;
Status = SaveLockBox (
&gEfiBootScriptExecutorVariableGuid,
&BootScriptExecutorBuffer,
sizeof(BootScriptExecutorBuffer)
);
ASSERT_EFI_ERROR (Status);
//
// Additional step for BootScript integrity
// Save BootScriptExecutor context
//
Status = SaveLockBox (
&gEfiBootScriptExecutorContextGuid,
EfiBootScriptExecutorVariable,
sizeof(*EfiBootScriptExecutorVariable)
);
ASSERT_EFI_ERROR (Status);
Status = SetLockBoxAttributes (&gEfiBootScriptExecutorContextGuid, LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE);
ASSERT_EFI_ERROR (Status);
}
return EFI_SUCCESS;
BufferSize = sizeof (BOOT_SCRIPT_EXECUTOR_VARIABLE);
BootScriptExecutorBuffer = 0xFFFFFFFF;
Pages = EFI_SIZE_TO_PAGES (BufferSize);
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
Pages,
&BootScriptExecutorBuffer
);
ASSERT_EFI_ERROR (Status);
EfiBootScriptExecutorVariable = (BOOT_SCRIPT_EXECUTOR_VARIABLE *)(UINTN)BootScriptExecutorBuffer;
EfiBootScriptExecutorVariable->BootScriptExecutorEntrypoint = (UINTN)S3BootScriptExecutorEntryFunction;
Status = SaveLockBox (
&gEfiBootScriptExecutorVariableGuid,
&BootScriptExecutorBuffer,
sizeof (BootScriptExecutorBuffer)
);
ASSERT_EFI_ERROR (Status);
//
// Additional step for BootScript integrity
// Save BootScriptExecutor context
//
Status = SaveLockBox (
&gEfiBootScriptExecutorContextGuid,
EfiBootScriptExecutorVariable,
sizeof (*EfiBootScriptExecutorVariable)
);
ASSERT_EFI_ERROR (Status);
Status = SetLockBoxAttributes (&gEfiBootScriptExecutorContextGuid, LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE);
ASSERT_EFI_ERROR (Status);
}
return EFI_SUCCESS;
}

View File

@@ -10,6 +10,7 @@ Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _BOOT_SCRIPT_EXECUTOR_H_
#define _BOOT_SCRIPT_EXECUTOR_H_
@@ -51,9 +52,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
AsmTransferControl (
IN UINT32 S3WakingVector,
IN UINT32 AcpiLowMemoryBase
IN UINT32 S3WakingVector,
IN UINT32 AcpiLowMemoryBase
);
/**
a 32bit ASM function to transfer control to OS.
@@ -62,9 +64,10 @@ AsmTransferControl (
**/
VOID
AsmTransferControl32 (
IN UINT32 S3WakingVector,
IN UINT32 AcpiLowMemoryBase
IN UINT32 S3WakingVector,
IN UINT32 AcpiLowMemoryBase
);
/**
a 16bit ASM function to transfer control to OS.
**/
@@ -72,6 +75,7 @@ VOID
AsmTransferControl16 (
VOID
);
/**
Set a IDT entry for interrupt vector 3 for debug purpose.
@@ -80,12 +84,12 @@ AsmTransferControl16 (
**/
VOID
SetIdtEntry (
IN ACPI_S3_CONTEXT *AcpiS3Context
IN ACPI_S3_CONTEXT *AcpiS3Context
);
extern UINT32 AsmFixAddress16;
extern UINT32 AsmJmpAddr32;
extern BOOLEAN mPage1GSupport;
extern UINT64 mAddressEncMask;
extern UINT32 AsmFixAddress16;
extern UINT32 AsmJmpAddr32;
extern BOOLEAN mPage1GSupport;
extern UINT64 mAddressEncMask;
#endif //_BOOT_SCRIPT_EXECUTOR_H_

View File

@@ -15,20 +15,20 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// 8 extra pages for PF handler.
//
#define EXTRA_PAGE_TABLE_PAGES 8
#define EXTRA_PAGE_TABLE_PAGES 8
#define IA32_PG_P BIT0
#define IA32_PG_RW BIT1
#define IA32_PG_PS BIT7
#define IA32_PG_P BIT0
#define IA32_PG_RW BIT1
#define IA32_PG_PS BIT7
UINT64 mPhyMask;
VOID *mOriginalHandler;
UINTN mPageFaultBuffer;
UINTN mPageFaultIndex = 0;
UINT64 mPhyMask;
VOID *mOriginalHandler;
UINTN mPageFaultBuffer;
UINTN mPageFaultIndex = 0;
//
// Store the uplink information for each page being used.
//
UINT64 *mPageFaultUplink[EXTRA_PAGE_TABLE_PAGES];
UINT64 *mPageFaultUplink[EXTRA_PAGE_TABLE_PAGES];
/**
Page fault handler.
@@ -48,41 +48,43 @@ PageFaultHandlerHook (
**/
VOID
HookPageFaultHandler (
IN IA32_IDT_GATE_DESCRIPTOR *IdtEntry
IN IA32_IDT_GATE_DESCRIPTOR *IdtEntry
)
{
UINT32 RegEax;
UINT8 PhysicalAddressBits;
UINTN PageFaultHandlerHookAddress;
UINT32 RegEax;
UINT8 PhysicalAddressBits;
UINTN PageFaultHandlerHookAddress;
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000008) {
AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
PhysicalAddressBits = (UINT8) RegEax;
PhysicalAddressBits = (UINT8)RegEax;
} else {
PhysicalAddressBits = 36;
}
mPhyMask = LShiftU64 (1, PhysicalAddressBits) - 1;
mPhyMask = LShiftU64 (1, PhysicalAddressBits) - 1;
mPhyMask &= (1ull << 48) - SIZE_4KB;
//
// Set Page Fault entry to catch >4G access
//
PageFaultHandlerHookAddress = (UINTN)PageFaultHandlerHook;
mOriginalHandler = (VOID *)(UINTN)(LShiftU64 (IdtEntry->Bits.OffsetUpper, 32) + IdtEntry->Bits.OffsetLow + (IdtEntry->Bits.OffsetHigh << 16));
IdtEntry->Bits.OffsetLow = (UINT16)PageFaultHandlerHookAddress;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(PageFaultHandlerHookAddress >> 16);
IdtEntry->Bits.OffsetUpper = (UINT32)(PageFaultHandlerHookAddress >> 32);
IdtEntry->Bits.Reserved_1 = 0;
mOriginalHandler = (VOID *)(UINTN)(LShiftU64 (IdtEntry->Bits.OffsetUpper, 32) + IdtEntry->Bits.OffsetLow + (IdtEntry->Bits.OffsetHigh << 16));
IdtEntry->Bits.OffsetLow = (UINT16)PageFaultHandlerHookAddress;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(PageFaultHandlerHookAddress >> 16);
IdtEntry->Bits.OffsetUpper = (UINT32)(PageFaultHandlerHookAddress >> 32);
IdtEntry->Bits.Reserved_1 = 0;
if (mPage1GSupport) {
mPageFaultBuffer = (UINTN)(AsmReadCr3 () & mPhyMask) + EFI_PAGES_TO_SIZE(2);
}else {
mPageFaultBuffer = (UINTN)(AsmReadCr3 () & mPhyMask) + EFI_PAGES_TO_SIZE(6);
mPageFaultBuffer = (UINTN)(AsmReadCr3 () & mPhyMask) + EFI_PAGES_TO_SIZE (2);
} else {
mPageFaultBuffer = (UINTN)(AsmReadCr3 () & mPhyMask) + EFI_PAGES_TO_SIZE (6);
}
ZeroMem (mPageFaultUplink, sizeof (mPageFaultUplink));
}
@@ -96,28 +98,32 @@ HookPageFaultHandler (
**/
BOOLEAN
IsLongModeWakingVector (
IN ACPI_S3_CONTEXT *AcpiS3Context
IN ACPI_S3_CONTEXT *AcpiS3Context
)
{
EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs;
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) ((UINTN) (AcpiS3Context->AcpiFacsTable));
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)((UINTN)(AcpiS3Context->AcpiFacsTable));
if ((Facs == NULL) ||
(Facs->Signature != EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ||
((Facs->FirmwareWakingVector == 0) && (Facs->XFirmwareWakingVector == 0)) ) {
((Facs->FirmwareWakingVector == 0) && (Facs->XFirmwareWakingVector == 0)))
{
// Something wrong with FACS
return FALSE;
}
if (Facs->XFirmwareWakingVector != 0) {
if ((Facs->Version == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
((Facs->Flags & EFI_ACPI_4_0_64BIT_WAKE_SUPPORTED_F) != 0) &&
((Facs->OspmFlags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0)) {
((Facs->OspmFlags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0))
{
// Both BIOS and OS wants 64bit vector
if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
return TRUE;
}
}
}
return FALSE;
}
@@ -129,18 +135,18 @@ IsLongModeWakingVector (
**/
VOID
SetIdtEntry (
IN ACPI_S3_CONTEXT *AcpiS3Context
IN ACPI_S3_CONTEXT *AcpiS3Context
)
{
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
IA32_DESCRIPTOR *IdtDescriptor;
UINTN S3DebugBuffer;
EFI_STATUS Status;
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
IA32_DESCRIPTOR *IdtDescriptor;
UINTN S3DebugBuffer;
EFI_STATUS Status;
//
// Restore IDT for debug
//
IdtDescriptor = (IA32_DESCRIPTOR *) (UINTN) (AcpiS3Context->IdtrProfile);
IdtDescriptor = (IA32_DESCRIPTOR *)(UINTN)(AcpiS3Context->IdtrProfile);
AsmWriteIdtr (IdtDescriptor);
//
@@ -150,20 +156,21 @@ SetIdtEntry (
ASSERT_EFI_ERROR (Status);
DEBUG_CODE_BEGIN ();
//
// Update IDT entry INT3 if the instruction is valid in it
//
S3DebugBuffer = (UINTN) (AcpiS3Context->S3DebugBufferAddress);
if (*(UINTN *)S3DebugBuffer != (UINTN) -1) {
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
IdtEntry->Bits.OffsetLow = (UINT16)S3DebugBuffer;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16);
IdtEntry->Bits.OffsetUpper = (UINT32)(S3DebugBuffer >> 32);
IdtEntry->Bits.Reserved_1 = 0;
}
//
// Update IDT entry INT3 if the instruction is valid in it
//
S3DebugBuffer = (UINTN)(AcpiS3Context->S3DebugBufferAddress);
if (*(UINTN *)S3DebugBuffer != (UINTN)-1) {
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
IdtEntry->Bits.OffsetLow = (UINT16)S3DebugBuffer;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16);
IdtEntry->Bits.OffsetUpper = (UINT32)(S3DebugBuffer >> 32);
IdtEntry->Bits.Reserved_1 = 0;
}
DEBUG_CODE_END ();
//
@@ -185,26 +192,27 @@ SetIdtEntry (
**/
VOID
AcquirePage (
IN OUT UINT64 *Uplink
IN OUT UINT64 *Uplink
)
{
UINTN Address;
UINTN Address;
Address = mPageFaultBuffer + EFI_PAGES_TO_SIZE (mPageFaultIndex);
ZeroMem ((VOID *) Address, EFI_PAGES_TO_SIZE (1));
ZeroMem ((VOID *)Address, EFI_PAGES_TO_SIZE (1));
//
// Cut the previous uplink if it exists and wasn't overwritten.
//
if ((mPageFaultUplink[mPageFaultIndex] != NULL) &&
((*mPageFaultUplink[mPageFaultIndex] & ~mAddressEncMask & mPhyMask) == Address)) {
((*mPageFaultUplink[mPageFaultIndex] & ~mAddressEncMask & mPhyMask) == Address))
{
*mPageFaultUplink[mPageFaultIndex] = 0;
}
//
// Link & Record the current uplink.
//
*Uplink = Address | mAddressEncMask | IA32_PG_P | IA32_PG_RW;
*Uplink = Address | mAddressEncMask | IA32_PG_P | IA32_PG_RW;
mPageFaultUplink[mPageFaultIndex] = Uplink;
mPageFaultIndex = (mPageFaultIndex + 1) % EXTRA_PAGE_TABLE_PAGES;
@@ -223,9 +231,9 @@ PageFaultHandler (
VOID
)
{
UINT64 *PageTable;
UINT64 PFAddress;
UINTN PTIndex;
UINT64 *PageTable;
UINT64 PFAddress;
UINTN PTIndex;
PFAddress = AsmReadCr2 ();
DEBUG ((DEBUG_INFO, "BootScript - PageFaultHandler: Cr2 - %lx\n", PFAddress));
@@ -233,17 +241,19 @@ PageFaultHandler (
if (PFAddress >= mPhyMask + SIZE_4KB) {
return FALSE;
}
PFAddress &= mPhyMask;
PageTable = (UINT64*)(UINTN)(AsmReadCr3 () & mPhyMask);
PageTable = (UINT64 *)(UINTN)(AsmReadCr3 () & mPhyMask);
PTIndex = BitFieldRead64 (PFAddress, 39, 47);
// PML4E
if ((PageTable[PTIndex] & IA32_PG_P) == 0) {
AcquirePage (&PageTable[PTIndex]);
}
PageTable = (UINT64*)(UINTN)(PageTable[PTIndex] & ~mAddressEncMask & mPhyMask);
PTIndex = BitFieldRead64 (PFAddress, 30, 38);
PageTable = (UINT64 *)(UINTN)(PageTable[PTIndex] & ~mAddressEncMask & mPhyMask);
PTIndex = BitFieldRead64 (PFAddress, 30, 38);
// PDPTE
if (mPage1GSupport) {
PageTable[PTIndex] = ((PFAddress | mAddressEncMask) & ~((1ull << 30) - 1)) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS;
@@ -251,8 +261,9 @@ PageFaultHandler (
if ((PageTable[PTIndex] & IA32_PG_P) == 0) {
AcquirePage (&PageTable[PTIndex]);
}
PageTable = (UINT64*)(UINTN)(PageTable[PTIndex] & ~mAddressEncMask & mPhyMask);
PTIndex = BitFieldRead64 (PFAddress, 21, 29);
PageTable = (UINT64 *)(UINTN)(PageTable[PTIndex] & ~mAddressEncMask & mPhyMask);
PTIndex = BitFieldRead64 (PFAddress, 21, 29);
// PD
PageTable[PTIndex] = ((PFAddress | mAddressEncMask) & ~((1ull << 21) - 1)) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS;
}

View File

@@ -36,31 +36,31 @@
#include <Library/VariablePolicyHelperLib.h>
#include <Library/PerformanceLib.h>
#define SMM_BOOT_RECORD_COMM_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE))
#define SMM_BOOT_RECORD_COMM_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE))
EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
BOOLEAN mLockBoxReady = FALSE;
EFI_EVENT mReadyToBootEvent;
EFI_EVENT mLegacyBootEvent;
static EFI_EVENT mExitBootServicesEvent;
UINTN mFirmwarePerformanceTableTemplateKey = 0;
BOOLEAN mDxeCoreReportStatusCodeEnable = FALSE;
BOOLEAN mLockBoxReady = FALSE;
EFI_EVENT mReadyToBootEvent;
EFI_EVENT mLegacyBootEvent;
static EFI_EVENT mExitBootServicesEvent;
UINTN mFirmwarePerformanceTableTemplateKey = 0;
BOOLEAN mDxeCoreReportStatusCodeEnable = FALSE;
BOOT_PERFORMANCE_TABLE *mAcpiBootPerformanceTable = NULL;
BOOT_PERFORMANCE_TABLE *mReceivedAcpiBootPerformanceTable = NULL;
S3_PERFORMANCE_TABLE *mAcpiS3PerformanceTable = NULL;
BOOT_PERFORMANCE_TABLE *mAcpiBootPerformanceTable = NULL;
BOOT_PERFORMANCE_TABLE *mReceivedAcpiBootPerformanceTable = NULL;
S3_PERFORMANCE_TABLE *mAcpiS3PerformanceTable = NULL;
FIRMWARE_PERFORMANCE_TABLE mFirmwarePerformanceTableTemplate = {
{
EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE,
sizeof (FIRMWARE_PERFORMANCE_TABLE),
EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_REVISION, // Revision
0x00, // Checksum will be updated at runtime
EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_REVISION, // Revision
0x00, // Checksum will be updated at runtime
//
// It is expected that these values will be updated at EntryPoint.
//
{0x00}, // OEM ID is a 6 bytes long field
{ 0x00 }, // OEM ID is a 6 bytes long field
0x00, // OEM Table ID(8 bytes long)
0x00, // OEM Revision
0x00, // Creator ID
@@ -71,7 +71,7 @@ FIRMWARE_PERFORMANCE_TABLE mFirmwarePerformanceTableTemplate = {
//
{
{
EFI_ACPI_5_0_FPDT_RECORD_TYPE_FIRMWARE_BASIC_BOOT_POINTER , // Type
EFI_ACPI_5_0_FPDT_RECORD_TYPE_FIRMWARE_BASIC_BOOT_POINTER, // Type
sizeof (EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_POINTER_RECORD), // Length
EFI_ACPI_5_0_FPDT_RECORD_REVISION_FIRMWARE_BASIC_BOOT_POINTER // Revision
},
@@ -92,7 +92,7 @@ FIRMWARE_PERFORMANCE_TABLE mFirmwarePerformanceTableTemplate = {
}
};
BOOT_PERFORMANCE_TABLE mBootPerformanceTableTemplate = {
BOOT_PERFORMANCE_TABLE mBootPerformanceTableTemplate = {
{
EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_SIGNATURE,
sizeof (BOOT_PERFORMANCE_TABLE)
@@ -115,7 +115,7 @@ BOOT_PERFORMANCE_TABLE mBootPerformanceTableTemplate = {
}
};
S3_PERFORMANCE_TABLE mS3PerformanceTableTemplate = {
S3_PERFORMANCE_TABLE mS3PerformanceTableTemplate = {
{
EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_SIGNATURE,
sizeof (S3_PERFORMANCE_TABLE)
@@ -156,11 +156,11 @@ S3_PERFORMANCE_TABLE mS3PerformanceTableTemplate = {
**/
VOID
FpdtAcpiTableChecksum (
IN UINT8 *Buffer,
IN UINTN Size
IN UINT8 *Buffer,
IN UINTN Size
)
{
UINTN ChecksumOffset;
UINTN ChecksumOffset;
ChecksumOffset = OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum);
@@ -185,15 +185,15 @@ FpdtAcpiTableChecksum (
VOID
EFIAPI
FpdtAllocateS3PerformanceTableMemory (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
VOID *Interface;
FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;
UINTN Size;
EFI_PHYSICAL_ADDRESS S3PerformanceTablePointer;
EFI_STATUS Status;
VOID *Interface;
FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;
UINTN Size;
EFI_PHYSICAL_ADDRESS S3PerformanceTablePointer;
if (mLockBoxReady && (mAcpiS3PerformanceTable != NULL)) {
//
@@ -220,7 +220,7 @@ FpdtAllocateS3PerformanceTableMemory (
// Try to allocate the same runtime buffer as last time boot.
//
ZeroMem (&PerformanceVariable, sizeof (PerformanceVariable));
Size = sizeof (PerformanceVariable);
Size = sizeof (PerformanceVariable);
Status = gRT->GetVariable (
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
@@ -236,18 +236,20 @@ FpdtAllocateS3PerformanceTableMemory (
&PerformanceVariable.S3PerformanceTablePointer
);
if (!EFI_ERROR (Status)) {
mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) (UINTN) PerformanceVariable.S3PerformanceTablePointer;
mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *)(UINTN)PerformanceVariable.S3PerformanceTablePointer;
}
}
if (mAcpiS3PerformanceTable == NULL) {
//
// Fail to allocate at specified address, continue to allocate at any address.
//
mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) AllocatePeiAccessiblePages (
EfiReservedMemoryType,
EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE))
);
mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *)AllocatePeiAccessiblePages (
EfiReservedMemoryType,
EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE))
);
}
DEBUG ((DEBUG_INFO, "FPDT: ACPI S3 Performance Table address = 0x%x\n", mAcpiS3PerformanceTable));
if (mAcpiS3PerformanceTable != NULL) {
CopyMem (mAcpiS3PerformanceTable, &mS3PerformanceTableTemplate, sizeof (mS3PerformanceTableTemplate));
@@ -260,12 +262,12 @@ FpdtAllocateS3PerformanceTableMemory (
// If LockBox services has been ready and memory for FPDT S3 performance table has been allocated,
// save the pointer to LockBox for use in S3 resume.
//
S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;
Status = SaveLockBox (
&gFirmwarePerformanceS3PointerGuid,
&S3PerformanceTablePointer,
sizeof (EFI_PHYSICAL_ADDRESS)
);
S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS)(UINTN)mAcpiS3PerformanceTable;
Status = SaveLockBox (
&gFirmwarePerformanceS3PointerGuid,
&S3PerformanceTablePointer,
sizeof (EFI_PHYSICAL_ADDRESS)
);
ASSERT_EFI_ERROR (Status);
}
}
@@ -291,7 +293,7 @@ InstallFirmwarePerformanceDataTable (
//
// Get AcpiTable Protocol.
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -299,13 +301,13 @@ InstallFirmwarePerformanceDataTable (
//
// Get VariablePolicy Protocol.
//
Status = gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL, (VOID **)&VariablePolicyProtocol);
Status = gBS->LocateProtocol (&gEdkiiVariablePolicyProtocolGuid, NULL, (VOID **)&VariablePolicyProtocol);
if (EFI_ERROR (Status)) {
return Status;
}
if (mReceivedAcpiBootPerformanceTable != NULL) {
mAcpiBootPerformanceTable = mReceivedAcpiBootPerformanceTable;
mAcpiBootPerformanceTable = mReceivedAcpiBootPerformanceTable;
mAcpiBootPerformanceTable->BasicBoot.ResetEnd = mBootPerformanceTableTemplate.BasicBoot.ResetEnd;
} else {
//
@@ -313,7 +315,7 @@ InstallFirmwarePerformanceDataTable (
//
BootPerformanceDataSize = sizeof (BOOT_PERFORMANCE_TABLE);
ZeroMem (&PerformanceVariable, sizeof (PerformanceVariable));
Size = sizeof (PerformanceVariable);
Size = sizeof (PerformanceVariable);
Status = gRT->GetVariable (
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
@@ -329,57 +331,61 @@ InstallFirmwarePerformanceDataTable (
&PerformanceVariable.BootPerformanceTablePointer
);
if (!EFI_ERROR (Status)) {
mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) (UINTN) PerformanceVariable.BootPerformanceTablePointer;
mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *)(UINTN)PerformanceVariable.BootPerformanceTablePointer;
}
}
if (mAcpiBootPerformanceTable == NULL) {
//
// Fail to allocate at specified address, continue to allocate at any address.
//
mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) AllocatePeiAccessiblePages (
EfiReservedMemoryType,
EFI_SIZE_TO_PAGES (BootPerformanceDataSize)
);
mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *)AllocatePeiAccessiblePages (
EfiReservedMemoryType,
EFI_SIZE_TO_PAGES (BootPerformanceDataSize)
);
}
DEBUG ((DEBUG_INFO, "FPDT: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable));
if (mAcpiBootPerformanceTable == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Fill Basic Boot record to Boot Performance Table.
//
CopyMem (mAcpiBootPerformanceTable, &mBootPerformanceTableTemplate, sizeof (mBootPerformanceTableTemplate));
}
BootPerformanceDataSize = mAcpiBootPerformanceTable->Header.Length;
BootPerformanceDataSize = mAcpiBootPerformanceTable->Header.Length;
//
// Save Boot Performance Table address to Variable for use in S4 resume.
//
PerformanceVariable.BootPerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiBootPerformanceTable;
PerformanceVariable.BootPerformanceTablePointer = (EFI_PHYSICAL_ADDRESS)(UINTN)mAcpiBootPerformanceTable;
//
// Update Boot Performance Table Pointer in template.
//
mFirmwarePerformanceTableTemplate.BootPointerRecord.BootPerformanceTablePointer = (UINT64) (UINTN) mAcpiBootPerformanceTable;
mFirmwarePerformanceTableTemplate.BootPointerRecord.BootPerformanceTablePointer = (UINT64)(UINTN)mAcpiBootPerformanceTable;
//
// Save S3 Performance Table address to Variable for use in S4 resume.
//
PerformanceVariable.S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;
PerformanceVariable.S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS)(UINTN)mAcpiS3PerformanceTable;
//
// Update S3 Performance Table Pointer in template.
//
mFirmwarePerformanceTableTemplate.S3PointerRecord.S3PerformanceTablePointer = (UINT64) (UINTN) mAcpiS3PerformanceTable;
mFirmwarePerformanceTableTemplate.S3PointerRecord.S3PerformanceTablePointer = (UINT64)(UINTN)mAcpiS3PerformanceTable;
//
// Save Runtime Performance Table pointers to Variable.
// Don't check SetVariable return status. It doesn't impact FPDT table generation.
//
gRT->SetVariable (
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (PerformanceVariable),
&PerformanceVariable
);
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (PerformanceVariable),
&PerformanceVariable
);
//
// Lock the variable which stores the Performance Table pointers.
@@ -394,15 +400,15 @@ InstallFirmwarePerformanceDataTable (
VARIABLE_POLICY_NO_CANT_ATTR,
VARIABLE_POLICY_TYPE_LOCK_NOW
);
if (EFI_ERROR(Status)) {
DEBUG((DEBUG_ERROR, "[FirmwarePerformanceDxe] Error when lock variable %s, Status = %r\n", EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME, Status));
ASSERT_EFI_ERROR(Status);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[FirmwarePerformanceDxe] Error when lock variable %s, Status = %r\n", EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME, Status));
ASSERT_EFI_ERROR (Status);
}
//
// Publish Firmware Performance Data Table.
//
FpdtAcpiTableChecksum ((UINT8 *) &mFirmwarePerformanceTableTemplate, mFirmwarePerformanceTableTemplate.Header.Length);
FpdtAcpiTableChecksum ((UINT8 *)&mFirmwarePerformanceTableTemplate, mFirmwarePerformanceTableTemplate.Header.Length);
Status = AcpiTableProtocol->InstallAcpiTable (
AcpiTableProtocol,
&mFirmwarePerformanceTableTemplate,
@@ -413,13 +419,16 @@ InstallFirmwarePerformanceDataTable (
if (mAcpiBootPerformanceTable != NULL) {
FreePages (mAcpiBootPerformanceTable, EFI_SIZE_TO_PAGES (BootPerformanceDataSize));
}
if (mAcpiS3PerformanceTable != NULL) {
FreePages (mAcpiS3PerformanceTable, EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE)));
}
mAcpiBootPerformanceTable = NULL;
mAcpiS3PerformanceTable = NULL;
mAcpiS3PerformanceTable = NULL;
return Status;
}
return EFI_SUCCESS;
}
@@ -445,11 +454,11 @@ InstallFirmwarePerformanceDataTable (
EFI_STATUS
EFIAPI
FpdtStatusCodeListenerDxe (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId,
IN EFI_STATUS_CODE_DATA *Data
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId,
IN EFI_STATUS_CODE_DATA *Data
)
{
EFI_STATUS Status;
@@ -531,13 +540,13 @@ FpdtStatusCodeListenerDxe (
DEBUG ((DEBUG_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart));
DEBUG ((DEBUG_INFO, "FPDT: Boot Performance - ExitBootServicesEntry = 0\n"));
DEBUG ((DEBUG_INFO, "FPDT: Boot Performance - ExitBootServicesExit = 0\n"));
} else if (Data != NULL && CompareGuid (&Data->Type, &gEdkiiFpdtExtendedFirmwarePerformanceGuid)) {
} else if ((Data != NULL) && CompareGuid (&Data->Type, &gEdkiiFpdtExtendedFirmwarePerformanceGuid)) {
//
// Get the Boot performance table and then install it to ACPI table.
//
CopyMem (&mReceivedAcpiBootPerformanceTable, Data + 1, Data->Size);
InstallFirmwarePerformanceDataTable ();
} else if (Data != NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
} else if ((Data != NULL) && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
DEBUG ((DEBUG_ERROR, "FpdtStatusCodeListenerDxe: Performance data reported through gEfiFirmwarePerformanceGuid will not be collected by FirmwarePerformanceDataTableDxe\n"));
Status = EFI_UNSUPPORTED;
} else {
@@ -562,17 +571,18 @@ FpdtStatusCodeListenerDxe (
VOID
EFIAPI
FpdtEndOfDxeEventNotify (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
//
// When performance is enabled, the FPDT will be installed when DxeCorePerformanceLib report the data to FimwarePerformanceDxe.
// This is used to install the FPDT for the basic boot recods when performance infrastructure is not enabled.
//
if ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0) {
if ((PcdGet8 (PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0) {
return;
}
ASSERT (mReceivedAcpiBootPerformanceTable == NULL);
InstallFirmwarePerformanceDataTable ();
}
@@ -588,8 +598,8 @@ FpdtEndOfDxeEventNotify (
VOID
EFIAPI
FpdtExitBootServicesEventNotify (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
if (!mDxeCoreReportStatusCodeEnable) {
@@ -604,7 +614,7 @@ FpdtExitBootServicesEventNotify (
//
// Firmware Performance Data Table not installed, do nothing.
//
return ;
return;
}
//
@@ -637,16 +647,16 @@ FpdtExitBootServicesEventNotify (
EFI_STATUS
EFIAPI
FirmwarePerformanceDxeEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_HOB_GUID_TYPE *GuidHob;
FIRMWARE_SEC_PERFORMANCE *Performance;
VOID *Registration;
UINT64 OemTableId;
EFI_EVENT EndOfDxeEvent;
EFI_STATUS Status;
EFI_HOB_GUID_TYPE *GuidHob;
FIRMWARE_SEC_PERFORMANCE *Performance;
VOID *Registration;
UINT64 OemTableId;
EFI_EVENT EndOfDxeEvent;
CopyMem (
mFirmwarePerformanceTableTemplate.Header.OemId,
@@ -655,14 +665,14 @@ FirmwarePerformanceDxeEntryPoint (
);
OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
CopyMem (&mFirmwarePerformanceTableTemplate.Header.OemTableId, &OemTableId, sizeof (UINT64));
mFirmwarePerformanceTableTemplate.Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
mFirmwarePerformanceTableTemplate.Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
mFirmwarePerformanceTableTemplate.Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
mFirmwarePerformanceTableTemplate.Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
mFirmwarePerformanceTableTemplate.Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
mFirmwarePerformanceTableTemplate.Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
//
// Get Report Status Code Handler Protocol.
//
Status = gBS->LocateProtocol (&gEfiRscHandlerProtocolGuid, NULL, (VOID **) &mRscHandlerProtocol);
Status = gBS->LocateProtocol (&gEfiRscHandlerProtocolGuid, NULL, (VOID **)&mRscHandlerProtocol);
ASSERT_EFI_ERROR (Status);
//
@@ -702,7 +712,7 @@ FirmwarePerformanceDxeEntryPoint (
//
GuidHob = GetFirstGuidHob (&gEfiFirmwarePerformanceGuid);
if (GuidHob != NULL) {
Performance = (FIRMWARE_SEC_PERFORMANCE *) GET_GUID_HOB_DATA (GuidHob);
Performance = (FIRMWARE_SEC_PERFORMANCE *)GET_GUID_HOB_DATA (GuidHob);
mBootPerformanceTableTemplate.BasicBoot.ResetEnd = Performance->ResetEnd;
} else {
//

View File

@@ -51,12 +51,12 @@
EFI_STATUS
EFIAPI
FpdtStatusCodeListenerPei (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN CONST EFI_GUID *CallerId,
IN CONST EFI_STATUS_CODE_DATA *Data
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN CONST EFI_GUID *CallerId,
IN CONST EFI_STATUS_CODE_DATA *Data
)
{
EFI_STATUS Status;
@@ -80,7 +80,8 @@ FpdtStatusCodeListenerPei (
// Check whether status code is what we are interested in.
//
if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) ||
(Value != (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE))) {
(Value != (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE)))
{
return EFI_UNSUPPORTED;
}
@@ -93,17 +94,18 @@ FpdtStatusCodeListenerPei (
// Update S3 Resume Performance Record.
//
S3PerformanceTablePointer = 0;
VarSize = sizeof (EFI_PHYSICAL_ADDRESS);
Status = RestoreLockBox (&gFirmwarePerformanceS3PointerGuid, &S3PerformanceTablePointer, &VarSize);
VarSize = sizeof (EFI_PHYSICAL_ADDRESS);
Status = RestoreLockBox (&gFirmwarePerformanceS3PointerGuid, &S3PerformanceTablePointer, &VarSize);
ASSERT_EFI_ERROR (Status);
AcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) (UINTN) S3PerformanceTablePointer;
AcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *)(UINTN)S3PerformanceTablePointer;
ASSERT (AcpiS3PerformanceTable != NULL);
if (AcpiS3PerformanceTable->Header.Signature != EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_SIGNATURE) {
DEBUG ((DEBUG_ERROR, "FPDT S3 performance data in ACPI memory get corrupted\n"));
return EFI_ABORTED;
}
AcpiS3ResumeRecord = &AcpiS3PerformanceTable->S3Resume;
AcpiS3ResumeRecord = &AcpiS3PerformanceTable->S3Resume;
AcpiS3ResumeRecord->FullResume = CurrentTime;
//
// Calculate average S3 resume time.
@@ -120,7 +122,7 @@ FpdtStatusCodeListenerPei (
// Update S3 Suspend Performance Record.
//
AcpiS3SuspendRecord = &AcpiS3PerformanceTable->S3Suspend;
VarSize = sizeof (EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD);
VarSize = sizeof (EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD);
ZeroMem (&S3SuspendRecord, sizeof (EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD));
Status = RestoreLockBox (
&gEfiFirmwarePerformanceGuid,
@@ -139,7 +141,7 @@ FpdtStatusCodeListenerPei (
&gEfiPeiReadOnlyVariable2PpiGuid,
0,
NULL,
(VOID **) &VariableServices
(VOID **)&VariableServices
);
ASSERT_EFI_ERROR (Status);
@@ -147,27 +149,28 @@ FpdtStatusCodeListenerPei (
// Update S3 boot records into the basic boot performance table.
//
VarSize = sizeof (PerformanceVariable);
Status = VariableServices->GetVariable (
VariableServices,
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
NULL,
&VarSize,
&PerformanceVariable
);
Status = VariableServices->GetVariable (
VariableServices,
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
NULL,
&VarSize,
&PerformanceVariable
);
if (EFI_ERROR (Status)) {
return Status;
}
BootPerformanceTable = (UINT8*) (UINTN) PerformanceVariable.BootPerformanceTablePointer;
BootPerformanceTable = (UINT8 *)(UINTN)PerformanceVariable.BootPerformanceTablePointer;
//
// Dump PEI boot records
//
FirmwarePerformanceTablePtr = (BootPerformanceTable + sizeof (BOOT_PERFORMANCE_TABLE));
GuidHob = GetFirstGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid);
GuidHob = GetFirstGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid);
while (GuidHob != NULL) {
FirmwarePerformanceData = GET_GUID_HOB_DATA (GuidHob);
PeiPerformanceLogHeader = (FPDT_PEI_EXT_PERF_HEADER *) FirmwarePerformanceData;
PeiPerformanceLogHeader = (FPDT_PEI_EXT_PERF_HEADER *)FirmwarePerformanceData;
CopyMem (FirmwarePerformanceTablePtr, FirmwarePerformanceData + sizeof (FPDT_PEI_EXT_PERF_HEADER), (UINTN)(PeiPerformanceLogHeader->SizeOfAllEntries));
@@ -179,7 +182,7 @@ FpdtStatusCodeListenerPei (
//
// Update Table length.
//
((BOOT_PERFORMANCE_TABLE *) BootPerformanceTable)->Header.Length = (UINT32)((UINTN)FirmwarePerformanceTablePtr - (UINTN)BootPerformanceTable);
((BOOT_PERFORMANCE_TABLE *)BootPerformanceTable)->Header.Length = (UINT32)((UINTN)FirmwarePerformanceTablePtr - (UINTN)BootPerformanceTable);
return EFI_SUCCESS;
}
@@ -213,7 +216,7 @@ FirmwarePerformancePeiEntryPoint (
&gEfiPeiRscHandlerPpiGuid,
0,
NULL,
(VOID **) &RscHandler
(VOID **)&RscHandler
);
ASSERT_EFI_ERROR (Status);

View File

@@ -31,10 +31,9 @@
#include <Library/BaseMemoryLib.h>
#include "FirmwarePerformanceCommon.h"
EFI_MM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
UINT64 mSuspendStartTime = 0;
BOOLEAN mS3SuspendLockBoxSaved = FALSE;
EFI_MM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
UINT64 mSuspendStartTime = 0;
BOOLEAN mS3SuspendLockBoxSaved = FALSE;
/**
Report status code listener for MM. This is used to record the performance
@@ -58,11 +57,11 @@ BOOLEAN mS3SuspendLockBoxSaved = FALSE;
EFI_STATUS
EFIAPI
FpdtStatusCodeListenerMm (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId,
IN EFI_STATUS_CODE_DATA *Data
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId,
IN EFI_STATUS_CODE_DATA *Data
)
{
EFI_STATUS Status;
@@ -76,13 +75,14 @@ FpdtStatusCodeListenerMm (
return EFI_UNSUPPORTED;
}
if (Data != NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
if ((Data != NULL) && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
DEBUG ((DEBUG_ERROR, "FpdtStatusCodeListenerMm: Performance data reported through gEfiFirmwarePerformanceGuid will not be collected by FirmwarePerformanceDataTableMm\n"));
return EFI_UNSUPPORTED;
}
if ((Value != PcdGet32 (PcdProgressCodeS3SuspendStart)) &&
(Value != PcdGet32 (PcdProgressCodeS3SuspendEnd))) {
(Value != PcdGet32 (PcdProgressCodeS3SuspendEnd)))
{
return EFI_UNSUPPORTED;
}
@@ -142,7 +142,7 @@ FirmwarePerformanceCommonEntryPoint (
VOID
)
{
EFI_STATUS Status;
EFI_STATUS Status;
//
// Get MM Report Status Code Handler Protocol.
@@ -150,7 +150,7 @@ FirmwarePerformanceCommonEntryPoint (
Status = gMmst->MmLocateProtocol (
&gEfiMmRscHandlerProtocolGuid,
NULL,
(VOID **) &mRscHandlerProtocol
(VOID **)&mRscHandlerProtocol
);
ASSERT_EFI_ERROR (Status);

View File

@@ -34,8 +34,8 @@
EFI_STATUS
EFIAPI
FirmwarePerformanceStandaloneMmEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_MM_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_MM_SYSTEM_TABLE *SystemTable
)
{
return FirmwarePerformanceCommonEntryPoint ();

View File

@@ -34,8 +34,8 @@
EFI_STATUS
EFIAPI
FirmwarePerformanceSmmEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return FirmwarePerformanceCommonEntryPoint ();

View File

@@ -23,9 +23,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// 8 extra pages for PF handler.
//
#define EXTRA_PAGE_TABLE_PAGES 8
#define EXTRA_PAGE_TABLE_PAGES 8
EFI_GUID mAcpiS3IdtrProfileGuid = {
EFI_GUID mAcpiS3IdtrProfileGuid = {
0xdea652b0, 0xd587, 0x4c54, { 0xb5, 0xb4, 0xc6, 0x82, 0xe7, 0xa0, 0xaa, 0x3d }
};
@@ -40,29 +40,29 @@ EFI_GUID mAcpiS3IdtrProfileGuid = {
@return Allocated address for output.
**/
VOID*
VOID *
AllocateMemoryBelow4G (
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Size
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Size
)
{
UINTN Pages;
EFI_PHYSICAL_ADDRESS Address;
EFI_STATUS Status;
VOID* Buffer;
VOID *Buffer;
Pages = EFI_SIZE_TO_PAGES (Size);
Pages = EFI_SIZE_TO_PAGES (Size);
Address = 0xffffffff;
Status = gBS->AllocatePages (
AllocateMaxAddress,
MemoryType,
Pages,
&Address
);
Status = gBS->AllocatePages (
AllocateMaxAddress,
MemoryType,
Pages,
&Address
);
ASSERT_EFI_ERROR (Status);
Buffer = (VOID *) (UINTN) Address;
Buffer = (VOID *)(UINTN)Address;
ZeroMem (Buffer, Size);
return Buffer;
@@ -79,18 +79,21 @@ AllocateMemoryBelow4G (
**/
BOOLEAN
IsLongModeWakingVectorSupport (
IN EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs
IN EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs
)
{
if ((Facs == NULL) ||
(Facs->Signature != EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ) {
(Facs->Signature != EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE))
{
//
// Something wrong with FACS.
//
return FALSE;
}
if ((Facs->Version == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
((Facs->Flags & EFI_ACPI_4_0_64BIT_WAKE_SUPPORTED_F) != 0)) {
((Facs->Flags & EFI_ACPI_4_0_64BIT_WAKE_SUPPORTED_F) != 0))
{
//
// BIOS supports 64bit waking vector.
//
@@ -98,6 +101,7 @@ IsLongModeWakingVectorSupport (
return TRUE;
}
}
return FALSE;
}
@@ -117,23 +121,23 @@ IsLongModeWakingVectorSupport (
**/
EFI_PHYSICAL_ADDRESS
S3AllocatePageTablesBuffer (
IN BOOLEAN LongModeWakingVectorSupport
IN BOOLEAN LongModeWakingVectorSupport
)
{
if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
UINTN ExtraPageTablePages;
UINT32 RegEax;
UINT32 RegEdx;
UINT8 PhysicalAddressBits;
UINT32 NumberOfPml4EntriesNeeded;
UINT32 NumberOfPdpEntriesNeeded;
EFI_PHYSICAL_ADDRESS S3NvsPageTableAddress;
UINTN TotalPageTableSize;
VOID *Hob;
BOOLEAN Page1GSupport;
UINTN ExtraPageTablePages;
UINT32 RegEax;
UINT32 RegEdx;
UINT8 PhysicalAddressBits;
UINT32 NumberOfPml4EntriesNeeded;
UINT32 NumberOfPdpEntriesNeeded;
EFI_PHYSICAL_ADDRESS S3NvsPageTableAddress;
UINTN TotalPageTableSize;
VOID *Hob;
BOOLEAN Page1GSupport;
Page1GSupport = FALSE;
if (PcdGetBool(PcdUse1GPageTable)) {
if (PcdGetBool (PcdUse1GPageTable)) {
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000001) {
AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
@@ -148,12 +152,12 @@ S3AllocatePageTablesBuffer (
//
Hob = GetFirstHob (EFI_HOB_TYPE_CPU);
if (Hob != NULL) {
PhysicalAddressBits = ((EFI_HOB_CPU *) Hob)->SizeOfMemorySpace;
PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
} else {
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000008) {
AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
PhysicalAddressBits = (UINT8) RegEax;
PhysicalAddressBits = (UINT8)RegEax;
} else {
PhysicalAddressBits = 36;
}
@@ -182,10 +186,10 @@ S3AllocatePageTablesBuffer (
//
if (PhysicalAddressBits <= 39 ) {
NumberOfPml4EntriesNeeded = 1;
NumberOfPdpEntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 30));
NumberOfPdpEntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 30));
} else {
NumberOfPml4EntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 39));
NumberOfPdpEntriesNeeded = 512;
NumberOfPdpEntriesNeeded = 512;
}
//
@@ -203,14 +207,14 @@ S3AllocatePageTablesBuffer (
//
// By architecture only one PageMapLevel4 exists - so lets allocate storage for it.
//
S3NvsPageTableAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateMemoryBelow4G (EfiReservedMemoryType, EFI_PAGES_TO_SIZE(TotalPageTableSize));
S3NvsPageTableAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateMemoryBelow4G (EfiReservedMemoryType, EFI_PAGES_TO_SIZE (TotalPageTableSize));
ASSERT (S3NvsPageTableAddress != 0);
return S3NvsPageTableAddress;
} else {
//
// If DXE is running 32-bit mode, no need to establish page table.
//
return (EFI_PHYSICAL_ADDRESS) 0;
return (EFI_PHYSICAL_ADDRESS)0;
}
}
@@ -244,29 +248,29 @@ AcpiS3ContextSaveOnEndOfDxe (
goto Done;
}
AcpiS3Context = AllocateMemoryBelow4G (EfiReservedMemoryType, sizeof(*AcpiS3Context));
AcpiS3Context = AllocateMemoryBelow4G (EfiReservedMemoryType, sizeof (*AcpiS3Context));
ASSERT (AcpiS3Context != NULL);
AcpiS3ContextBuffer = (EFI_PHYSICAL_ADDRESS)(UINTN)AcpiS3Context;
//
// Get ACPI Table because we will save its position to variable
//
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) EfiLocateFirstAcpiTable (
EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE
);
AcpiS3Context->AcpiFacsTable = (EFI_PHYSICAL_ADDRESS) (UINTN) Facs;
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)EfiLocateFirstAcpiTable (
EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE
);
AcpiS3Context->AcpiFacsTable = (EFI_PHYSICAL_ADDRESS)(UINTN)Facs;
ASSERT (AcpiS3Context->AcpiFacsTable != 0);
IdtGate = AllocateMemoryBelow4G (EfiReservedMemoryType, sizeof(IA32_IDT_GATE_DESCRIPTOR) * 0x100 + sizeof(IA32_DESCRIPTOR));
Idtr = (IA32_DESCRIPTOR *)(IdtGate + 0x100);
Idtr->Base = (UINTN)IdtGate;
Idtr->Limit = (UINT16)(sizeof(IA32_IDT_GATE_DESCRIPTOR) * 0x100 - 1);
IdtGate = AllocateMemoryBelow4G (EfiReservedMemoryType, sizeof (IA32_IDT_GATE_DESCRIPTOR) * 0x100 + sizeof (IA32_DESCRIPTOR));
Idtr = (IA32_DESCRIPTOR *)(IdtGate + 0x100);
Idtr->Base = (UINTN)IdtGate;
Idtr->Limit = (UINT16)(sizeof (IA32_IDT_GATE_DESCRIPTOR) * 0x100 - 1);
AcpiS3Context->IdtrProfile = (EFI_PHYSICAL_ADDRESS)(UINTN)Idtr;
Status = SaveLockBox (
&mAcpiS3IdtrProfileGuid,
(VOID *)(UINTN)Idtr,
(UINTN)sizeof(IA32_DESCRIPTOR)
(UINTN)sizeof (IA32_DESCRIPTOR)
);
ASSERT_EFI_ERROR (Status);
@@ -291,24 +295,24 @@ AcpiS3ContextSaveOnEndOfDxe (
AcpiS3Context->S3DebugBufferAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateMemoryBelow4G (EfiReservedMemoryType, EFI_PAGE_SIZE);
SetMem ((VOID *)(UINTN)AcpiS3Context->S3DebugBufferAddress, EFI_PAGE_SIZE, 0xff);
DEBUG((DEBUG_INFO, "AcpiS3Context: AcpiFacsTable is 0x%8x\n", AcpiS3Context->AcpiFacsTable));
DEBUG((DEBUG_INFO, "AcpiS3Context: IdtrProfile is 0x%8x\n", AcpiS3Context->IdtrProfile));
DEBUG((DEBUG_INFO, "AcpiS3Context: S3NvsPageTableAddress is 0x%8x\n", AcpiS3Context->S3NvsPageTableAddress));
DEBUG((DEBUG_INFO, "AcpiS3Context: S3DebugBufferAddress is 0x%8x\n", AcpiS3Context->S3DebugBufferAddress));
DEBUG((DEBUG_INFO, "AcpiS3Context: BootScriptStackBase is 0x%8x\n", AcpiS3Context->BootScriptStackBase));
DEBUG((DEBUG_INFO, "AcpiS3Context: BootScriptStackSize is 0x%8x\n", AcpiS3Context->BootScriptStackSize));
DEBUG ((DEBUG_INFO, "AcpiS3Context: AcpiFacsTable is 0x%8x\n", AcpiS3Context->AcpiFacsTable));
DEBUG ((DEBUG_INFO, "AcpiS3Context: IdtrProfile is 0x%8x\n", AcpiS3Context->IdtrProfile));
DEBUG ((DEBUG_INFO, "AcpiS3Context: S3NvsPageTableAddress is 0x%8x\n", AcpiS3Context->S3NvsPageTableAddress));
DEBUG ((DEBUG_INFO, "AcpiS3Context: S3DebugBufferAddress is 0x%8x\n", AcpiS3Context->S3DebugBufferAddress));
DEBUG ((DEBUG_INFO, "AcpiS3Context: BootScriptStackBase is 0x%8x\n", AcpiS3Context->BootScriptStackBase));
DEBUG ((DEBUG_INFO, "AcpiS3Context: BootScriptStackSize is 0x%8x\n", AcpiS3Context->BootScriptStackSize));
Status = SaveLockBox (
&gEfiAcpiVariableGuid,
&AcpiS3ContextBuffer,
sizeof(AcpiS3ContextBuffer)
sizeof (AcpiS3ContextBuffer)
);
ASSERT_EFI_ERROR (Status);
Status = SaveLockBox (
&gEfiAcpiS3ContextGuid,
(VOID *)(UINTN)AcpiS3Context,
(UINTN)sizeof(*AcpiS3Context)
(UINTN)sizeof (*AcpiS3Context)
);
ASSERT_EFI_ERROR (Status);

View File

@@ -6,6 +6,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _INTERNAL_S3_SAVE_STATE_H_
#define _INTERNAL_S3_SAVE_STATE_H_
#include <PiDxe.h>
@@ -67,10 +68,11 @@ AcpiS3ContextSaveOnEndOfDxe (
EFI_STATUS
EFIAPI
BootScriptWrite (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN UINTN OpCode,
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN UINTN OpCode,
...
);
/**
Insert a record into a specified Framework boot script table.
@@ -102,12 +104,13 @@ BootScriptWrite (
EFI_STATUS
EFIAPI
BootScriptInsert (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN UINTN OpCode,
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN UINTN OpCode,
...
);
/**
Find a label within the boot script table and, if not present, optionally create it.
@@ -137,12 +140,13 @@ BootScriptInsert (
EFI_STATUS
EFIAPI
BootScriptLabel (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN BOOLEAN CreateIfNotFound,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN CONST CHAR8 *Label
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN BOOLEAN CreateIfNotFound,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN CONST CHAR8 *Label
);
/**
Compare two positions in the boot script table and return their relative position.
@@ -162,10 +166,10 @@ BootScriptLabel (
EFI_STATUS
EFIAPI
BootScriptCompare (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN EFI_S3_BOOT_SCRIPT_POSITION Position1,
IN EFI_S3_BOOT_SCRIPT_POSITION Position2,
OUT UINTN *RelativePosition
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN EFI_S3_BOOT_SCRIPT_POSITION Position1,
IN EFI_S3_BOOT_SCRIPT_POSITION Position2,
OUT UINTN *RelativePosition
);
#endif //_INTERNAL_S3_SAVE_STATE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _INTERNAL_SMM_S3_SAVE_STATE_H_
#define _INTERNAL_SMM_S3_SAVE_STATE_H_
#include <PiDxe.h>
@@ -20,6 +21,7 @@
#include <Library/PcdLib.h>
#include <Library/SmbusLib.h>
#include <IndustryStandard/SmBus.h>
/**
Adds a record into S3 boot script table.
@@ -50,10 +52,11 @@
EFI_STATUS
EFIAPI
BootScriptWrite (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN UINTN OpCode,
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN UINTN OpCode,
...
);
/**
Insert a record into a specified Framework boot script table.
@@ -85,12 +88,13 @@ BootScriptWrite (
EFI_STATUS
EFIAPI
BootScriptInsert (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN UINTN OpCode,
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN UINTN OpCode,
...
);
/**
Find a label within the boot script table and, if not present, optionally create it.
@@ -120,12 +124,13 @@ BootScriptInsert (
EFI_STATUS
EFIAPI
BootScriptLabel (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN BOOLEAN CreateIfNotFound,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN CONST CHAR8 *Label
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN BOOLEAN CreateIfNotFound,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN CONST CHAR8 *Label
);
/**
Compare two positions in the boot script table and return their relative position.
@@ -145,10 +150,10 @@ BootScriptLabel (
EFI_STATUS
EFIAPI
BootScriptCompare (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN EFI_S3_BOOT_SCRIPT_POSITION Position1,
IN EFI_S3_BOOT_SCRIPT_POSITION Position2,
OUT UINTN *RelativePosition
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN EFI_S3_BOOT_SCRIPT_POSITION Position1,
IN EFI_S3_BOOT_SCRIPT_POSITION Position2,
OUT UINTN *RelativePosition
);
#endif //_INTERNAL_SMM_S3_SAVE_STATE_H_

File diff suppressed because it is too large Load Diff