diff options
Diffstat (limited to 'MdeModulePkg/Universal/Acpi')
26 files changed, 2844 insertions, 2640 deletions
diff --git a/MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c b/MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c index 8d376af414..8b58b9e653 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c +++ b/MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c @@ -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;
}
-
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c index 5019b49afe..bb258c9710 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c @@ -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;
}
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h index 1b26729e71..89eb535136 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h @@ -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
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.c index 1d91737cbf..f50068d0e0 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.c @@ -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;
}
-
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h index 0af2d11a1a..9cfef3d718 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h @@ -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
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c index 34d4a1cec0..e09bc9b704 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c @@ -14,13 +14,13 @@ //
// The maximum number of tables that pre-allocated.
//
-UINTN mEfiAcpiMaxNumTables = EFI_ACPI_MAX_NUM_TABLES;
+UINTN mEfiAcpiMaxNumTables = EFI_ACPI_MAX_NUM_TABLES;
//
// Allocation strategy to use for AllocatePages ().
// Runtime value depends on PcdExposedAcpiTableVersions.
//
-STATIC EFI_ALLOCATE_TYPE mAcpiTableAllocType;
+STATIC EFI_ALLOCATE_TYPE mAcpiTableAllocType;
/**
This function adds an ACPI table to the table list. It will detect FACS and
@@ -41,12 +41,12 @@ STATIC EFI_ALLOCATE_TYPE mAcpiTableAllocType; **/
EFI_STATUS
AddTableToList (
- IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
- IN VOID *Table,
- IN BOOLEAN Checksum,
- IN EFI_ACPI_TABLE_VERSION Version,
- IN BOOLEAN IsFromHob,
- OUT UINTN *Handle
+ IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
+ IN VOID *Table,
+ IN BOOLEAN Checksum,
+ IN EFI_ACPI_TABLE_VERSION Version,
+ IN BOOLEAN IsFromHob,
+ OUT UINTN *Handle
);
/**
@@ -63,9 +63,9 @@ AddTableToList ( **/
EFI_STATUS
RemoveTableFromList (
- 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
);
/**
@@ -79,9 +79,9 @@ RemoveTableFromList ( **/
EFI_STATUS
AcpiPlatformChecksum (
- IN VOID *Buffer,
- IN UINTN Size,
- IN UINTN ChecksumOffset
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN UINTN ChecksumOffset
);
/**
@@ -94,7 +94,7 @@ AcpiPlatformChecksum ( **/
EFI_STATUS
ChecksumCommonTables (
- IN OUT EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
+ IN OUT EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
);
//
@@ -116,14 +116,14 @@ ChecksumCommonTables ( EFI_STATUS
EFIAPI
PublishTables (
- IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
- IN EFI_ACPI_TABLE_VERSION Version
+ IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
+ IN EFI_ACPI_TABLE_VERSION Version
)
{
- EFI_STATUS Status;
- UINT32 *CurrentRsdtEntry;
- VOID *CurrentXsdtEntry;
- UINT64 Buffer64;
+ EFI_STATUS Status;
+ UINT32 *CurrentRsdtEntry;
+ VOID *CurrentXsdtEntry;
+ UINT64 Buffer64;
//
// Reorder tables as some operating systems don't seem to find the
@@ -134,19 +134,20 @@ PublishTables ( // Add FADT as the first entry
//
if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
- CurrentRsdtEntry = (UINT32 *) ((UINT8 *) AcpiTableInstance->Rsdt1 + sizeof (EFI_ACPI_DESCRIPTION_HEADER));
- *CurrentRsdtEntry = (UINT32) (UINTN) AcpiTableInstance->Fadt1;
+ CurrentRsdtEntry = (UINT32 *)((UINT8 *)AcpiTableInstance->Rsdt1 + sizeof (EFI_ACPI_DESCRIPTION_HEADER));
+ *CurrentRsdtEntry = (UINT32)(UINTN)AcpiTableInstance->Fadt1;
- CurrentRsdtEntry = (UINT32 *) ((UINT8 *) AcpiTableInstance->Rsdt3 + sizeof (EFI_ACPI_DESCRIPTION_HEADER));
- *CurrentRsdtEntry = (UINT32) (UINTN) AcpiTableInstance->Fadt3;
+ CurrentRsdtEntry = (UINT32 *)((UINT8 *)AcpiTableInstance->Rsdt3 + sizeof (EFI_ACPI_DESCRIPTION_HEADER));
+ *CurrentRsdtEntry = (UINT32)(UINTN)AcpiTableInstance->Fadt3;
}
+
if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
- CurrentXsdtEntry = (VOID *) ((UINT8 *) AcpiTableInstance->Xsdt + sizeof (EFI_ACPI_DESCRIPTION_HEADER));
+ CurrentXsdtEntry = (VOID *)((UINT8 *)AcpiTableInstance->Xsdt + sizeof (EFI_ACPI_DESCRIPTION_HEADER));
//
// Add entry to XSDT, XSDT expects 64 bit pointers, but
// the table pointers in XSDT are not aligned on 8 byte boundary.
//
- Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Fadt3;
+ Buffer64 = (UINT64)(UINTN)AcpiTableInstance->Fadt3;
CopyMem (
CurrentXsdtEntry,
&Buffer64,
@@ -180,7 +181,6 @@ PublishTables ( return EFI_SUCCESS;
}
-
/**
Installs an ACPI table into the RSDT/XSDT.
Note that the ACPI table should be checksumed before installing it.
@@ -204,22 +204,23 @@ PublishTables ( EFI_STATUS
EFIAPI
InstallAcpiTable (
- IN EFI_ACPI_TABLE_PROTOCOL *This,
- IN VOID *AcpiTableBuffer,
- IN UINTN AcpiTableBufferSize,
- OUT UINTN *TableKey
+ IN EFI_ACPI_TABLE_PROTOCOL *This,
+ IN VOID *AcpiTableBuffer,
+ IN UINTN AcpiTableBufferSize,
+ OUT UINTN *TableKey
)
{
- EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
- EFI_STATUS Status;
- VOID *AcpiTableBufferConst;
- EFI_ACPI_TABLE_VERSION Version;
+ EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
+ EFI_STATUS Status;
+ VOID *AcpiTableBufferConst;
+ EFI_ACPI_TABLE_VERSION Version;
//
// Check for invalid input parameters
//
- if ((AcpiTableBuffer == NULL) || (TableKey == NULL)
- || (((EFI_ACPI_DESCRIPTION_HEADER *) AcpiTableBuffer)->Length != AcpiTableBufferSize)) {
+ if ( (AcpiTableBuffer == NULL) || (TableKey == NULL)
+ || (((EFI_ACPI_DESCRIPTION_HEADER *)AcpiTableBuffer)->Length != AcpiTableBufferSize))
+ {
return EFI_INVALID_PARAMETER;
}
@@ -233,22 +234,23 @@ InstallAcpiTable ( //
// Install the ACPI table
//
- AcpiTableBufferConst = AllocateCopyPool (AcpiTableBufferSize,AcpiTableBuffer);
- *TableKey = 0;
- Status = AddTableToList (
- AcpiTableInstance,
- AcpiTableBufferConst,
- TRUE,
- Version,
- FALSE,
- TableKey
- );
+ AcpiTableBufferConst = AllocateCopyPool (AcpiTableBufferSize, AcpiTableBuffer);
+ *TableKey = 0;
+ Status = AddTableToList (
+ AcpiTableInstance,
+ AcpiTableBufferConst,
+ TRUE,
+ Version,
+ FALSE,
+ TableKey
+ );
if (!EFI_ERROR (Status)) {
Status = PublishTables (
AcpiTableInstance,
Version
);
}
+
FreePool (AcpiTableBufferConst);
//
@@ -267,7 +269,6 @@ InstallAcpiTable ( return Status;
}
-
/**
Removes an ACPI table from the RSDT/XSDT.
@@ -281,13 +282,13 @@ InstallAcpiTable ( EFI_STATUS
EFIAPI
UninstallAcpiTable (
- IN EFI_ACPI_TABLE_PROTOCOL *This,
- IN UINTN TableKey
+ IN EFI_ACPI_TABLE_PROTOCOL *This,
+ IN UINTN TableKey
)
{
- EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
- EFI_STATUS Status;
- EFI_ACPI_TABLE_VERSION Version;
+ EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
+ EFI_STATUS Status;
+ EFI_ACPI_TABLE_VERSION Version;
//
// Get the instance of the ACPI table protocol
@@ -329,7 +330,7 @@ UninstallAcpiTable ( **/
EFI_STATUS
ReallocateAcpiTableBuffer (
- IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
+ IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
)
{
UINTN NewMaxTableNumber;
@@ -369,12 +370,12 @@ ReallocateAcpiTableBuffer ( // for convenience of implementation that we force memory below 4GB.
//
PageAddress = 0xFFFFFFFF;
- Status = gBS->AllocatePages (
- mAcpiTableAllocType,
- EfiACPIReclaimMemory,
- EFI_SIZE_TO_PAGES (TotalSize),
- &PageAddress
- );
+ Status = gBS->AllocatePages (
+ mAcpiTableAllocType,
+ EfiACPIReclaimMemory,
+ EFI_SIZE_TO_PAGES (TotalSize),
+ &PageAddress
+ );
} else {
Status = gBS->AllocatePool (
EfiACPIReclaimMemory,
@@ -393,22 +394,24 @@ ReallocateAcpiTableBuffer ( ZeroMem (Pointer, TotalSize);
- AcpiTableInstance->Rsdt1 = (EFI_ACPI_DESCRIPTION_HEADER *) Pointer;
+ AcpiTableInstance->Rsdt1 = (EFI_ACPI_DESCRIPTION_HEADER *)Pointer;
if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
- Pointer += (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + NewMaxTableNumber * sizeof (UINT32));
- AcpiTableInstance->Rsdt3 = (EFI_ACPI_DESCRIPTION_HEADER *) Pointer;
- Pointer += (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + NewMaxTableNumber * sizeof (UINT32));
+ Pointer += (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + NewMaxTableNumber * sizeof (UINT32));
+ AcpiTableInstance->Rsdt3 = (EFI_ACPI_DESCRIPTION_HEADER *)Pointer;
+ Pointer += (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + NewMaxTableNumber * sizeof (UINT32));
}
- AcpiTableInstance->Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) Pointer;
+
+ AcpiTableInstance->Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)Pointer;
//
// Update RSDP to point to the new Rsdt and Xsdt address.
//
if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
- AcpiTableInstance->Rsdp1->RsdtAddress = (UINT32) (UINTN) AcpiTableInstance->Rsdt1;
- AcpiTableInstance->Rsdp3->RsdtAddress = (UINT32) (UINTN) AcpiTableInstance->Rsdt3;
+ AcpiTableInstance->Rsdp1->RsdtAddress = (UINT32)(UINTN)AcpiTableInstance->Rsdt1;
+ AcpiTableInstance->Rsdp3->RsdtAddress = (UINT32)(UINTN)AcpiTableInstance->Rsdt3;
}
- CurrentData = (UINT64) (UINTN) AcpiTableInstance->Xsdt;
+
+ CurrentData = (UINT64)(UINTN)AcpiTableInstance->Xsdt;
CopyMem (&AcpiTableInstance->Rsdp3->XsdtAddress, &CurrentData, sizeof (UINT64));
//
@@ -418,6 +421,7 @@ ReallocateAcpiTableBuffer ( CopyMem (AcpiTableInstance->Rsdt1, TempPrivateData.Rsdt1, (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + mEfiAcpiMaxNumTables * sizeof (UINT32)));
CopyMem (AcpiTableInstance->Rsdt3, TempPrivateData.Rsdt3, (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + mEfiAcpiMaxNumTables * sizeof (UINT32)));
}
+
CopyMem (AcpiTableInstance->Xsdt, TempPrivateData.Xsdt, (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + mEfiAcpiMaxNumTables * sizeof (UINT64)));
if (mAcpiTableAllocType != AllocateAnyPages) {
@@ -434,8 +438,10 @@ ReallocateAcpiTableBuffer ( mEfiAcpiMaxNumTables * sizeof (UINT32);
}
- gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)TempPrivateData.Rsdt1,
- EFI_SIZE_TO_PAGES (TotalSize));
+ gBS->FreePages (
+ (EFI_PHYSICAL_ADDRESS)(UINTN)TempPrivateData.Rsdt1,
+ EFI_SIZE_TO_PAGES (TotalSize)
+ );
} else {
gBS->FreePool (TempPrivateData.Rsdt1);
}
@@ -456,14 +462,16 @@ ReallocateAcpiTableBuffer ( STATIC
VOID
FreeTableMemory (
- EFI_ACPI_TABLE_LIST *TableEntry
+ EFI_ACPI_TABLE_LIST *TableEntry
)
{
if (TableEntry->PoolAllocation) {
gBS->FreePool (TableEntry->Table);
} else {
- gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)TableEntry->Table,
- EFI_SIZE_TO_PAGES (TableEntry->TableSize));
+ gBS->FreePages (
+ (EFI_PHYSICAL_ADDRESS)(UINTN)TableEntry->Table,
+ EFI_SIZE_TO_PAGES (TableEntry->TableSize)
+ );
}
}
@@ -487,12 +495,12 @@ FreeTableMemory ( **/
EFI_STATUS
AddTableToList (
- IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
- IN VOID *Table,
- IN BOOLEAN Checksum,
- IN EFI_ACPI_TABLE_VERSION Version,
- IN BOOLEAN IsFromHob,
- OUT UINTN *Handle
+ IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
+ IN VOID *Table,
+ IN BOOLEAN Checksum,
+ IN EFI_ACPI_TABLE_VERSION Version,
+ IN BOOLEAN IsFromHob,
+ OUT UINTN *Handle
)
{
EFI_STATUS Status;
@@ -526,8 +534,8 @@ AddTableToList ( //
// Determine table type and size
//
- CurrentTableSignature = ((EFI_ACPI_COMMON_HEADER *) Table)->Signature;
- CurrentTableSize = ((EFI_ACPI_COMMON_HEADER *) Table)->Length;
+ CurrentTableSignature = ((EFI_ACPI_COMMON_HEADER *)Table)->Signature;
+ CurrentTableSize = ((EFI_ACPI_COMMON_HEADER *)Table)->Length;
//
// Allocate a buffer for the table. All tables are allocated in the lower 32 bits of address space
@@ -538,15 +546,16 @@ AddTableToList ( // There is no architectural reason these should be below 4GB, it is purely
// for convenience of implementation that we force memory below 4GB.
//
- AllocPhysAddress = 0xFFFFFFFF;
- CurrentTableList->TableSize = CurrentTableSize;
- CurrentTableList->PoolAllocation = FALSE;
+ AllocPhysAddress = 0xFFFFFFFF;
+ CurrentTableList->TableSize = CurrentTableSize;
+ CurrentTableList->PoolAllocation = FALSE;
//
// Allocation memory type depends on the type of the table
//
if ((CurrentTableSignature == EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ||
- (CurrentTableSignature == EFI_ACPI_4_0_UEFI_ACPI_DATA_TABLE_SIGNATURE)) {
+ (CurrentTableSignature == EFI_ACPI_4_0_UEFI_ACPI_DATA_TABLE_SIGNATURE))
+ {
//
// Allocate memory for the FACS. This structure must be aligned
// on a 64 byte boundary and must be ACPI NVS memory.
@@ -558,9 +567,9 @@ AddTableToList ( // SMM communication ACPI table.
//
ASSERT ((EFI_PAGE_SIZE % 64) == 0);
- if (IsFromHob){
+ if (IsFromHob) {
AllocPhysAddress = (UINTN)Table;
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
} else {
Status = gBS->AllocatePages (
AllocateMaxAddress,
@@ -593,6 +602,7 @@ AddTableToList ( );
CurrentTableList->Table = (EFI_ACPI_COMMON_HEADER *)(UINTN)AllocPhysAddress;
}
+
//
// Check return value from memory alloc.
//
@@ -621,368 +631,396 @@ AddTableToList ( // Calculate the checksum if the table is not FACS.
//
switch (CurrentTableSignature) {
-
- case EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE:
- //
- // We don't add the FADT in the standard way because some
- // OS expect the FADT to be early in the table list.
- // So we always add it as the first element in the list.
- //
- AddToRsdt = FALSE;
-
- //
- // Check that the table has not been previously added.
- //
- if (((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0 && AcpiTableInstance->Fadt1 != NULL) ||
- ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0 && AcpiTableInstance->Fadt3 != NULL)
- ) {
- FreeTableMemory (CurrentTableList);
- gBS->FreePool (CurrentTableList);
- return EFI_ACCESS_DENIED;
- }
- //
- // Add the table to the appropriate table version
- //
- if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
+ case EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE:
//
- // Save a pointer to the table
+ // We don't add the FADT in the standard way because some
+ // OS expect the FADT to be early in the table list.
+ // So we always add it as the first element in the list.
//
- AcpiTableInstance->Fadt1 = (EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *) CurrentTableList->Table;
+ AddToRsdt = FALSE;
//
- // Update pointers in FADT. If tables don't exist this will put NULL pointers there.
+ // Check that the table has not been previously added.
//
- AcpiTableInstance->Fadt1->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs1;
- AcpiTableInstance->Fadt1->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt1;
+ if ((((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) && (AcpiTableInstance->Fadt1 != NULL)) ||
+ (((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) && (AcpiTableInstance->Fadt3 != NULL))
+ )
+ {
+ FreeTableMemory (CurrentTableList);
+ gBS->FreePool (CurrentTableList);
+ return EFI_ACCESS_DENIED;
+ }
//
- // RSDP OEM information is updated to match the FADT OEM information
+ // Add the table to the appropriate table version
//
- CopyMem (
- &AcpiTableInstance->Rsdp1->OemId,
- &AcpiTableInstance->Fadt1->Header.OemId,
- 6
- );
+ if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
+ //
+ // Save a pointer to the table
+ //
+ AcpiTableInstance->Fadt1 = (EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *)CurrentTableList->Table;
- //
- // RSDT OEM information is updated to match the FADT OEM information.
- //
- CopyMem (
- &AcpiTableInstance->Rsdt1->OemId,
- &AcpiTableInstance->Fadt1->Header.OemId,
- 6
- );
+ //
+ // Update pointers in FADT. If tables don't exist this will put NULL pointers there.
+ //
+ AcpiTableInstance->Fadt1->FirmwareCtrl = (UINT32)(UINTN)AcpiTableInstance->Facs1;
+ AcpiTableInstance->Fadt1->Dsdt = (UINT32)(UINTN)AcpiTableInstance->Dsdt1;
- CopyMem (
- &AcpiTableInstance->Rsdt1->OemTableId,
- &AcpiTableInstance->Fadt1->Header.OemTableId,
- sizeof (UINT64)
- );
- AcpiTableInstance->Rsdt1->OemRevision = AcpiTableInstance->Fadt1->Header.OemRevision;
- }
+ //
+ // RSDP OEM information is updated to match the FADT OEM information
+ //
+ CopyMem (
+ &AcpiTableInstance->Rsdp1->OemId,
+ &AcpiTableInstance->Fadt1->Header.OemId,
+ 6
+ );
- if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
- //
- // Save a pointer to the table
- //
- AcpiTableInstance->Fadt3 = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *) CurrentTableList->Table;
+ //
+ // RSDT OEM information is updated to match the FADT OEM information.
+ //
+ CopyMem (
+ &AcpiTableInstance->Rsdt1->OemId,
+ &AcpiTableInstance->Fadt1->Header.OemId,
+ 6
+ );
- //
- // Update pointers in FADT. If tables don't exist this will put NULL pointers there.
- // Note: If the FIRMWARE_CTRL is non-zero, then X_FIRMWARE_CTRL must be zero, and
- // vice-versa.
- //
- if ((UINT64)(UINTN)AcpiTableInstance->Facs3 < BASE_4GB) {
- AcpiTableInstance->Fadt3->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs3;
- ZeroMem (&AcpiTableInstance->Fadt3->XFirmwareCtrl, sizeof (UINT64));
- } else {
- Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Facs3;
CopyMem (
- &AcpiTableInstance->Fadt3->XFirmwareCtrl,
- &Buffer64,
+ &AcpiTableInstance->Rsdt1->OemTableId,
+ &AcpiTableInstance->Fadt1->Header.OemTableId,
sizeof (UINT64)
);
- AcpiTableInstance->Fadt3->FirmwareCtrl = 0;
+ AcpiTableInstance->Rsdt1->OemRevision = AcpiTableInstance->Fadt1->Header.OemRevision;
}
- if ((UINT64)(UINTN)AcpiTableInstance->Dsdt3 < BASE_4GB) {
- AcpiTableInstance->Fadt3->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt3;
+
+ if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
//
- // Comment block "the caller installs the tables in "DSDT, FADT" order"
- // The below comments are also in "the caller installs the tables in "FADT, DSDT" order" comment block.
+ // Save a pointer to the table
//
- // The ACPI specification, up to and including revision 5.1 Errata A,
- // allows the DSDT and X_DSDT fields to be both set in the FADT.
- // (Obviously, this only makes sense if the DSDT address is representable in 4 bytes.)
- // Starting with 5.1 Errata B, specifically for Mantis 1393 <https://mantis.uefi.org/mantis/view.php?id=1393>,
- // the spec requires at most one of DSDT and X_DSDT fields to be set to a nonzero value,
- // but strangely an exception is 6.0 that has no this requirement.
+ AcpiTableInstance->Fadt3 = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)CurrentTableList->Table;
+
//
- // Here we do not make the DSDT and X_DSDT fields mutual exclusion conditionally
- // by checking FADT revision, but always set both DSDT and X_DSDT fields in the FADT
- // to have better compatibility as some OS may have assumption to only consume X_DSDT
- // field even the DSDT address is < 4G.
+ // Update pointers in FADT. If tables don't exist this will put NULL pointers there.
+ // Note: If the FIRMWARE_CTRL is non-zero, then X_FIRMWARE_CTRL must be zero, and
+ // vice-versa.
//
- Buffer64 = AcpiTableInstance->Fadt3->Dsdt;
- } else {
- AcpiTableInstance->Fadt3->Dsdt = 0;
- Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Dsdt3;
- }
- CopyMem (&AcpiTableInstance->Fadt3->XDsdt, &Buffer64, sizeof (UINT64));
+ if ((UINT64)(UINTN)AcpiTableInstance->Facs3 < BASE_4GB) {
+ AcpiTableInstance->Fadt3->FirmwareCtrl = (UINT32)(UINTN)AcpiTableInstance->Facs3;
+ ZeroMem (&AcpiTableInstance->Fadt3->XFirmwareCtrl, sizeof (UINT64));
+ } else {
+ Buffer64 = (UINT64)(UINTN)AcpiTableInstance->Facs3;
+ CopyMem (
+ &AcpiTableInstance->Fadt3->XFirmwareCtrl,
+ &Buffer64,
+ sizeof (UINT64)
+ );
+ AcpiTableInstance->Fadt3->FirmwareCtrl = 0;
+ }
- //
- // RSDP OEM information is updated to match the FADT OEM information
- //
- CopyMem (
- &AcpiTableInstance->Rsdp3->OemId,
- &AcpiTableInstance->Fadt3->Header.OemId,
- 6
- );
+ if ((UINT64)(UINTN)AcpiTableInstance->Dsdt3 < BASE_4GB) {
+ AcpiTableInstance->Fadt3->Dsdt = (UINT32)(UINTN)AcpiTableInstance->Dsdt3;
+ //
+ // Comment block "the caller installs the tables in "DSDT, FADT" order"
+ // The below comments are also in "the caller installs the tables in "FADT, DSDT" order" comment block.
+ //
+ // The ACPI specification, up to and including revision 5.1 Errata A,
+ // allows the DSDT and X_DSDT fields to be both set in the FADT.
+ // (Obviously, this only makes sense if the DSDT address is representable in 4 bytes.)
+ // Starting with 5.1 Errata B, specifically for Mantis 1393 <https://mantis.uefi.org/mantis/view.php?id=1393>,
+ // the spec requires at most one of DSDT and X_DSDT fields to be set to a nonzero value,
+ // but strangely an exception is 6.0 that has no this requirement.
+ //
+ // Here we do not make the DSDT and X_DSDT fields mutual exclusion conditionally
+ // by checking FADT revision, but always set both DSDT and X_DSDT fields in the FADT
+ // to have better compatibility as some OS may have assumption to only consume X_DSDT
+ // field even the DSDT address is < 4G.
+ //
+ Buffer64 = AcpiTableInstance->Fadt3->Dsdt;
+ } else {
+ AcpiTableInstance->Fadt3->Dsdt = 0;
+ Buffer64 = (UINT64)(UINTN)AcpiTableInstance->Dsdt3;
+ }
+
+ CopyMem (&AcpiTableInstance->Fadt3->XDsdt, &Buffer64, sizeof (UINT64));
+
+ //
+ // RSDP OEM information is updated to match the FADT OEM information
+ //
+ CopyMem (
+ &AcpiTableInstance->Rsdp3->OemId,
+ &AcpiTableInstance->Fadt3->Header.OemId,
+ 6
+ );
+
+ if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
+ //
+ // RSDT OEM information is updated to match FADT OEM information.
+ //
+ CopyMem (
+ &AcpiTableInstance->Rsdt3->OemId,
+ &AcpiTableInstance->Fadt3->Header.OemId,
+ 6
+ );
+ CopyMem (
+ &AcpiTableInstance->Rsdt3->OemTableId,
+ &AcpiTableInstance->Fadt3->Header.OemTableId,
+ sizeof (UINT64)
+ );
+ AcpiTableInstance->Rsdt3->OemRevision = AcpiTableInstance->Fadt3->Header.OemRevision;
+ }
- if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
//
- // RSDT OEM information is updated to match FADT OEM information.
+ // XSDT OEM information is updated to match FADT OEM information.
//
CopyMem (
- &AcpiTableInstance->Rsdt3->OemId,
+ &AcpiTableInstance->Xsdt->OemId,
&AcpiTableInstance->Fadt3->Header.OemId,
6
);
CopyMem (
- &AcpiTableInstance->Rsdt3->OemTableId,
+ &AcpiTableInstance->Xsdt->OemTableId,
&AcpiTableInstance->Fadt3->Header.OemTableId,
sizeof (UINT64)
);
- AcpiTableInstance->Rsdt3->OemRevision = AcpiTableInstance->Fadt3->Header.OemRevision;
+ AcpiTableInstance->Xsdt->OemRevision = AcpiTableInstance->Fadt3->Header.OemRevision;
}
//
- // XSDT OEM information is updated to match FADT OEM information.
+ // Checksum the table
//
- CopyMem (
- &AcpiTableInstance->Xsdt->OemId,
- &AcpiTableInstance->Fadt3->Header.OemId,
- 6
- );
- CopyMem (
- &AcpiTableInstance->Xsdt->OemTableId,
- &AcpiTableInstance->Fadt3->Header.OemTableId,
- sizeof (UINT64)
- );
- AcpiTableInstance->Xsdt->OemRevision = AcpiTableInstance->Fadt3->Header.OemRevision;
- }
- //
- // Checksum the table
- //
- if (Checksum) {
- AcpiPlatformChecksum (
- CurrentTableList->Table,
- CurrentTableList->Table->Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
- );
- }
- break;
-
- case EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE:
- //
- // Check that the table has not been previously added.
- //
- if (((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0 && AcpiTableInstance->Facs1 != NULL) ||
- ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0 && AcpiTableInstance->Facs3 != NULL)
- ) {
- FreeTableMemory (CurrentTableList);
- gBS->FreePool (CurrentTableList);
- return EFI_ACCESS_DENIED;
- }
- //
- // FACS is referenced by FADT and is not part of RSDT
- //
- AddToRsdt = FALSE;
+ if (Checksum) {
+ AcpiPlatformChecksum (
+ CurrentTableList->Table,
+ CurrentTableList->Table->Length,
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
+ );
+ }
- //
- // Add the table to the appropriate table version
- //
- if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
- //
- // Save a pointer to the table
- //
- AcpiTableInstance->Facs1 = (EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) CurrentTableList->Table;
+ break;
+ case EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE:
//
- // If FADT already exists, update table pointers.
+ // Check that the table has not been previously added.
//
- if (AcpiTableInstance->Fadt1 != NULL) {
- AcpiTableInstance->Fadt1->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs1;
-
- //
- // Checksum FADT table
- //
- AcpiPlatformChecksum (
- AcpiTableInstance->Fadt1,
- AcpiTableInstance->Fadt1->Header.Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
- );
+ if ((((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) && (AcpiTableInstance->Facs1 != NULL)) ||
+ (((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) && (AcpiTableInstance->Facs3 != NULL))
+ )
+ {
+ FreeTableMemory (CurrentTableList);
+ gBS->FreePool (CurrentTableList);
+ return EFI_ACCESS_DENIED;
}
- }
- if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
//
- // Save a pointer to the table
+ // FACS is referenced by FADT and is not part of RSDT
//
- AcpiTableInstance->Facs3 = (EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) CurrentTableList->Table;
+ AddToRsdt = FALSE;
//
- // If FADT already exists, update table pointers.
+ // Add the table to the appropriate table version
//
- if (AcpiTableInstance->Fadt3 != NULL) {
+ if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
//
- // Note: If the FIRMWARE_CTRL is non-zero, then X_FIRMWARE_CTRL must be zero, and
- // vice-versa.
+ // Save a pointer to the table
//
- if ((UINT64)(UINTN)AcpiTableInstance->Facs3 < BASE_4GB) {
- AcpiTableInstance->Fadt3->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs3;
- ZeroMem (&AcpiTableInstance->Fadt3->XFirmwareCtrl, sizeof (UINT64));
- } else {
- Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Facs3;
- CopyMem (
- &AcpiTableInstance->Fadt3->XFirmwareCtrl,
- &Buffer64,
- sizeof (UINT64)
+ AcpiTableInstance->Facs1 = (EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)CurrentTableList->Table;
+
+ //
+ // If FADT already exists, update table pointers.
+ //
+ if (AcpiTableInstance->Fadt1 != NULL) {
+ AcpiTableInstance->Fadt1->FirmwareCtrl = (UINT32)(UINTN)AcpiTableInstance->Facs1;
+
+ //
+ // Checksum FADT table
+ //
+ AcpiPlatformChecksum (
+ AcpiTableInstance->Fadt1,
+ AcpiTableInstance->Fadt1->Header.Length,
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
);
- AcpiTableInstance->Fadt3->FirmwareCtrl = 0;
}
+ }
+ if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
//
- // Checksum FADT table
+ // Save a pointer to the table
//
- AcpiPlatformChecksum (
- AcpiTableInstance->Fadt3,
- AcpiTableInstance->Fadt3->Header.Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
- );
- }
- }
+ AcpiTableInstance->Facs3 = (EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)CurrentTableList->Table;
- break;
+ //
+ // If FADT already exists, update table pointers.
+ //
+ if (AcpiTableInstance->Fadt3 != NULL) {
+ //
+ // Note: If the FIRMWARE_CTRL is non-zero, then X_FIRMWARE_CTRL must be zero, and
+ // vice-versa.
+ //
+ if ((UINT64)(UINTN)AcpiTableInstance->Facs3 < BASE_4GB) {
+ AcpiTableInstance->Fadt3->FirmwareCtrl = (UINT32)(UINTN)AcpiTableInstance->Facs3;
+ ZeroMem (&AcpiTableInstance->Fadt3->XFirmwareCtrl, sizeof (UINT64));
+ } else {
+ Buffer64 = (UINT64)(UINTN)AcpiTableInstance->Facs3;
+ CopyMem (
+ &AcpiTableInstance->Fadt3->XFirmwareCtrl,
+ &Buffer64,
+ sizeof (UINT64)
+ );
+ AcpiTableInstance->Fadt3->FirmwareCtrl = 0;
+ }
- case EFI_ACPI_1_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:
- //
- // Check that the table has not been previously added.
- //
- if (((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0 && AcpiTableInstance->Dsdt1 != NULL) ||
- ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0 && AcpiTableInstance->Dsdt3 != NULL)
- ) {
- FreeTableMemory (CurrentTableList);
- gBS->FreePool (CurrentTableList);
- return EFI_ACCESS_DENIED;
- }
- //
- // DSDT is referenced by FADT and is not part of RSDT
- //
- AddToRsdt = FALSE;
+ //
+ // Checksum FADT table
+ //
+ AcpiPlatformChecksum (
+ AcpiTableInstance->Fadt3,
+ AcpiTableInstance->Fadt3->Header.Length,
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
+ );
+ }
+ }
- //
- // Add the table to the appropriate table version
- //
- if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
- //
- // Save a pointer to the table
- //
- AcpiTableInstance->Dsdt1 = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTableList->Table;
+ break;
+ case EFI_ACPI_1_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:
//
- // If FADT already exists, update table pointers.
+ // Check that the table has not been previously added.
//
- if (AcpiTableInstance->Fadt1 != NULL) {
- AcpiTableInstance->Fadt1->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt1;
-
- //
- // Checksum FADT table
- //
- AcpiPlatformChecksum (
- AcpiTableInstance->Fadt1,
- AcpiTableInstance->Fadt1->Header.Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
- );
+ if ((((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) && (AcpiTableInstance->Dsdt1 != NULL)) ||
+ (((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) && (AcpiTableInstance->Dsdt3 != NULL))
+ )
+ {
+ FreeTableMemory (CurrentTableList);
+ gBS->FreePool (CurrentTableList);
+ return EFI_ACCESS_DENIED;
}
- }
- if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
//
- // Save a pointer to the table
+ // DSDT is referenced by FADT and is not part of RSDT
//
- AcpiTableInstance->Dsdt3 = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTableList->Table;
+ AddToRsdt = FALSE;
//
- // If FADT already exists, update table pointers.
+ // Add the table to the appropriate table version
//
- if (AcpiTableInstance->Fadt3 != NULL) {
- if ((UINT64)(UINTN)AcpiTableInstance->Dsdt3 < BASE_4GB) {
- AcpiTableInstance->Fadt3->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt3;
- //
- // Comment block "the caller installs the tables in "FADT, DSDT" order"
- // The below comments are also in "the caller installs the tables in "DSDT, FADT" order" comment block.
- //
- // The ACPI specification, up to and including revision 5.1 Errata A,
- // allows the DSDT and X_DSDT fields to be both set in the FADT.
- // (Obviously, this only makes sense if the DSDT address is representable in 4 bytes.)
- // Starting with 5.1 Errata B, specifically for Mantis 1393 <https://mantis.uefi.org/mantis/view.php?id=1393>,
- // the spec requires at most one of DSDT and X_DSDT fields to be set to a nonzero value,
- // but strangely an exception is 6.0 that has no this requirement.
+ if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
+ //
+ // Save a pointer to the table
+ //
+ AcpiTableInstance->Dsdt1 = (EFI_ACPI_DESCRIPTION_HEADER *)CurrentTableList->Table;
+
+ //
+ // If FADT already exists, update table pointers.
+ //
+ if (AcpiTableInstance->Fadt1 != NULL) {
+ AcpiTableInstance->Fadt1->Dsdt = (UINT32)(UINTN)AcpiTableInstance->Dsdt1;
+
//
- // Here we do not make the DSDT and X_DSDT fields mutual exclusion conditionally
- // by checking FADT revision, but always set both DSDT and X_DSDT fields in the FADT
- // to have better compatibility as some OS may have assumption to only consume X_DSDT
- // field even the DSDT address is < 4G.
+ // Checksum FADT table
//
- Buffer64 = AcpiTableInstance->Fadt3->Dsdt;
- } else {
- AcpiTableInstance->Fadt3->Dsdt = 0;
- Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Dsdt3;
+ AcpiPlatformChecksum (
+ AcpiTableInstance->Fadt1,
+ AcpiTableInstance->Fadt1->Header.Length,
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
+ );
}
- CopyMem (&AcpiTableInstance->Fadt3->XDsdt, &Buffer64, sizeof (UINT64));
+ }
+
+ if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
+ //
+ // Save a pointer to the table
+ //
+ AcpiTableInstance->Dsdt3 = (EFI_ACPI_DESCRIPTION_HEADER *)CurrentTableList->Table;
//
- // Checksum FADT table
+ // If FADT already exists, update table pointers.
//
+ if (AcpiTableInstance->Fadt3 != NULL) {
+ if ((UINT64)(UINTN)AcpiTableInstance->Dsdt3 < BASE_4GB) {
+ AcpiTableInstance->Fadt3->Dsdt = (UINT32)(UINTN)AcpiTableInstance->Dsdt3;
+ //
+ // Comment block "the caller installs the tables in "FADT, DSDT" order"
+ // The below comments are also in "the caller installs the tables in "DSDT, FADT" order" comment block.
+ //
+ // The ACPI specification, up to and including revision 5.1 Errata A,
+ // allows the DSDT and X_DSDT fields to be both set in the FADT.
+ // (Obviously, this only makes sense if the DSDT address is representable in 4 bytes.)
+ // Starting with 5.1 Errata B, specifically for Mantis 1393 <https://mantis.uefi.org/mantis/view.php?id=1393>,
+ // the spec requires at most one of DSDT and X_DSDT fields to be set to a nonzero value,
+ // but strangely an exception is 6.0 that has no this requirement.
+ //
+ // Here we do not make the DSDT and X_DSDT fields mutual exclusion conditionally
+ // by checking FADT revision, but always set both DSDT and X_DSDT fields in the FADT
+ // to have better compatibility as some OS may have assumption to only consume X_DSDT
+ // field even the DSDT address is < 4G.
+ //
+ Buffer64 = AcpiTableInstance->Fadt3->Dsdt;
+ } else {
+ AcpiTableInstance->Fadt3->Dsdt = 0;
+ Buffer64 = (UINT64)(UINTN)AcpiTableInstance->Dsdt3;
+ }
+
+ CopyMem (&AcpiTableInstance->Fadt3->XDsdt, &Buffer64, sizeof (UINT64));
+
+ //
+ // Checksum FADT table
+ //
+ AcpiPlatformChecksum (
+ AcpiTableInstance->Fadt3,
+ AcpiTableInstance->Fadt3->Header.Length,
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
+ );
+ }
+ }
+
+ //
+ // Checksum the table
+ //
+ if (Checksum) {
AcpiPlatformChecksum (
- AcpiTableInstance->Fadt3,
- AcpiTableInstance->Fadt3->Header.Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
+ CurrentTableList->Table,
+ CurrentTableList->Table->Length,
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
);
}
- }
- //
- // Checksum the table
- //
- if (Checksum) {
- AcpiPlatformChecksum (
- CurrentTableList->Table,
- CurrentTableList->Table->Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
- );
- }
- break;
- default:
- //
- // Checksum the table
- //
- if (Checksum) {
- AcpiPlatformChecksum (
- CurrentTableList->Table,
- CurrentTableList->Table->Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
- );
- }
- break;
+ break;
+
+ default:
+ //
+ // Checksum the table
+ //
+ if (Checksum) {
+ AcpiPlatformChecksum (
+ CurrentTableList->Table,
+ CurrentTableList->Table->Length,
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
+ );
+ }
+
+ break;
}
+
//
// Add the table to the current list of tables
//
@@ -1003,18 +1041,19 @@ AddTableToList ( Status = ReallocateAcpiTableBuffer (AcpiTableInstance);
ASSERT_EFI_ERROR (Status);
}
+
CurrentRsdtEntry = (UINT32 *)
- (
- (UINT8 *) AcpiTableInstance->Rsdt1 +
- sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
- AcpiTableInstance->NumberOfTableEntries1 *
- sizeof (UINT32)
- );
+ (
+ (UINT8 *)AcpiTableInstance->Rsdt1 +
+ sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
+ AcpiTableInstance->NumberOfTableEntries1 *
+ sizeof (UINT32)
+ );
//
// Add entry to the RSDT unless its the FACS or DSDT
//
- *CurrentRsdtEntry = (UINT32) (UINTN) CurrentTableList->Table;
+ *CurrentRsdtEntry = (UINT32)(UINTN)CurrentTableList->Table;
//
// Update RSDT length
@@ -1024,6 +1063,7 @@ AddTableToList ( AcpiTableInstance->NumberOfTableEntries1++;
}
}
+
//
// Add to ACPI 2.0/3.0 table tree
//
@@ -1043,17 +1083,17 @@ AddTableToList ( // If it becomes necessary to maintain separate table lists, changes will be required.
//
CurrentRsdtEntry = (UINT32 *)
- (
- (UINT8 *) AcpiTableInstance->Rsdt3 +
- sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
- AcpiTableInstance->NumberOfTableEntries3 *
- sizeof (UINT32)
- );
+ (
+ (UINT8 *)AcpiTableInstance->Rsdt3 +
+ sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
+ AcpiTableInstance->NumberOfTableEntries3 *
+ sizeof (UINT32)
+ );
//
// Add entry to the RSDT
//
- *CurrentRsdtEntry = (UINT32) (UINTN) CurrentTableList->Table;
+ *CurrentRsdtEntry = (UINT32)(UINTN)CurrentTableList->Table;
//
// Update RSDT length
@@ -1066,18 +1106,18 @@ AddTableToList ( // be 64 bit aligned resulting in a possible fault. Use CopyMem to update.
//
CurrentXsdtEntry = (VOID *)
- (
- (UINT8 *) AcpiTableInstance->Xsdt +
- sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
- AcpiTableInstance->NumberOfTableEntries3 *
- sizeof (UINT64)
- );
+ (
+ (UINT8 *)AcpiTableInstance->Xsdt +
+ sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
+ AcpiTableInstance->NumberOfTableEntries3 *
+ sizeof (UINT64)
+ );
//
// Add entry to XSDT, XSDT expects 64 bit pointers, but
// the table pointers in XSDT are not aligned on 8 byte boundary.
//
- Buffer64 = (UINT64) (UINTN) CurrentTableList->Table;
+ Buffer64 = (UINT64)(UINTN)CurrentTableList->Table;
CopyMem (
CurrentXsdtEntry,
&Buffer64,
@@ -1097,7 +1137,6 @@ AddTableToList ( return EFI_SUCCESS;
}
-
/**
This function finds the table specified by the handle and returns a pointer to it.
If the handle is not found, EFI_NOT_FOUND is returned and the contents of Table are
@@ -1113,13 +1152,13 @@ AddTableToList ( **/
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
)
{
- LIST_ENTRY *CurrentLink;
- EFI_ACPI_TABLE_LIST *CurrentTable;
+ LIST_ENTRY *CurrentLink;
+ EFI_ACPI_TABLE_LIST *CurrentTable;
//
// Check for invalid input parameters
@@ -1143,13 +1182,13 @@ FindTableByHandle ( CurrentLink = CurrentLink->ForwardLink;
}
+
//
// Table not found
//
return EFI_NOT_FOUND;
}
-
/**
This function removes a basic table from the RSDT and/or XSDT.
For Acpi 1.0 tables, pass in the Rsdt.
@@ -1166,10 +1205,10 @@ FindTableByHandle ( **/
EFI_STATUS
RemoveTableFromRsdt (
- IN OUT EFI_ACPI_TABLE_LIST * Table,
- IN OUT UINTN *NumberOfTableEntries,
- IN OUT EFI_ACPI_DESCRIPTION_HEADER * Rsdt OPTIONAL,
- IN OUT EFI_ACPI_DESCRIPTION_HEADER * Xsdt OPTIONAL
+ IN OUT EFI_ACPI_TABLE_LIST *Table,
+ IN OUT UINTN *NumberOfTableEntries,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER *Rsdt OPTIONAL,
+ IN OUT EFI_ACPI_DESCRIPTION_HEADER *Xsdt OPTIONAL
)
{
UINT32 *CurrentRsdtEntry;
@@ -1193,16 +1232,17 @@ RemoveTableFromRsdt ( // If it becomes necessary to maintain separate table lists, changes will be required.
//
if (Rsdt != NULL) {
- CurrentRsdtEntry = (UINT32 *) ((UINT8 *) Rsdt + sizeof (EFI_ACPI_DESCRIPTION_HEADER) + Index * sizeof (UINT32));
+ CurrentRsdtEntry = (UINT32 *)((UINT8 *)Rsdt + sizeof (EFI_ACPI_DESCRIPTION_HEADER) + Index * sizeof (UINT32));
} else {
CurrentRsdtEntry = NULL;
}
+
if (Xsdt != NULL) {
//
// This pointer must not be directly dereferenced as the XSDT entries may not
// be 64 bit aligned resulting in a possible fault. Use CopyMem to update.
//
- CurrentXsdtEntry = (VOID *) ((UINT8 *) Xsdt + sizeof (EFI_ACPI_DESCRIPTION_HEADER) + Index * sizeof (UINT64));
+ CurrentXsdtEntry = (VOID *)((UINT8 *)Xsdt + sizeof (EFI_ACPI_DESCRIPTION_HEADER) + Index * sizeof (UINT64));
//
// Read the entry value out of the XSDT
@@ -1215,12 +1255,14 @@ RemoveTableFromRsdt ( CurrentXsdtEntry = 0;
CurrentTablePointer64 = 0;
}
+
//
// Check if we have found the corresponding entry in both RSDT and XSDT
//
- if (((Rsdt == NULL) || *CurrentRsdtEntry == (UINT32) (UINTN) Table->Table) &&
- ((Xsdt == NULL) || CurrentTablePointer64 == (UINT64) (UINTN) Table->Table)
- ) {
+ if (((Rsdt == NULL) || (*CurrentRsdtEntry == (UINT32)(UINTN)Table->Table)) &&
+ ((Xsdt == NULL) || (CurrentTablePointer64 == (UINT64)(UINTN)Table->Table))
+ )
+ {
//
// Found entry, so copy all following entries and shrink table
// We actually copy all + 1 to copy the initialized value of memory over
@@ -1230,10 +1272,12 @@ RemoveTableFromRsdt ( CopyMem (CurrentRsdtEntry, CurrentRsdtEntry + 1, (*NumberOfTableEntries - Index) * sizeof (UINT32));
Rsdt->Length = Rsdt->Length - sizeof (UINT32);
}
+
if (Xsdt != NULL) {
- CopyMem (CurrentXsdtEntry, ((UINT64 *) CurrentXsdtEntry) + 1, (*NumberOfTableEntries - Index) * sizeof (UINT64));
+ CopyMem (CurrentXsdtEntry, ((UINT64 *)CurrentXsdtEntry) + 1, (*NumberOfTableEntries - Index) * sizeof (UINT64));
Xsdt->Length = Xsdt->Length - sizeof (UINT64);
}
+
break;
} else if (Index + 1 == *NumberOfTableEntries) {
//
@@ -1242,6 +1286,7 @@ RemoveTableFromRsdt ( return EFI_INVALID_PARAMETER;
}
}
+
//
// Checksum the tables
//
@@ -1249,8 +1294,10 @@ RemoveTableFromRsdt ( AcpiPlatformChecksum (
Rsdt,
Rsdt->Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
);
}
@@ -1258,10 +1305,13 @@ RemoveTableFromRsdt ( AcpiPlatformChecksum (
Xsdt,
Xsdt->Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
);
}
+
//
// Decrement the number of tables
//
@@ -1270,7 +1320,6 @@ RemoveTableFromRsdt ( return EFI_SUCCESS;
}
-
/**
This function removes a table and frees any associated memory.
@@ -1283,13 +1332,13 @@ RemoveTableFromRsdt ( **/
EFI_STATUS
DeleteTable (
- IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
- IN EFI_ACPI_TABLE_VERSION Version,
- IN OUT EFI_ACPI_TABLE_LIST *Table
+ IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
+ IN EFI_ACPI_TABLE_VERSION Version,
+ IN OUT EFI_ACPI_TABLE_LIST *Table
)
{
- UINT32 CurrentTableSignature;
- BOOLEAN RemoveFromRsdt;
+ UINT32 CurrentTableSignature;
+ BOOLEAN RemoveFromRsdt;
//
// Check for invalid input parameters
@@ -1300,12 +1349,12 @@ DeleteTable ( //
// Init locals
//
- RemoveFromRsdt = TRUE;
+ RemoveFromRsdt = TRUE;
//
// Check for Table->Table
//
ASSERT (Table->Table != NULL);
- CurrentTableSignature = ((EFI_ACPI_COMMON_HEADER *) Table->Table)->Signature;
+ CurrentTableSignature = ((EFI_ACPI_COMMON_HEADER *)Table->Table)->Signature;
//
// Basic tasks to accomplish delete are:
@@ -1323,9 +1372,11 @@ DeleteTable ( if ((CurrentTableSignature == EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ||
(CurrentTableSignature == EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) ||
(CurrentTableSignature == EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)
- ) {
+ )
+ {
RemoveFromRsdt = FALSE;
}
+
//
// We don't remove the FADT in the standard way because some
// OS expect the FADT to be early in the table list.
@@ -1390,119 +1441,130 @@ DeleteTable ( );
}
}
+
//
// Free the table, clean up any dependent tables and our private data pointers.
//
switch (Table->Table->Signature) {
+ case EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE:
+ if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
+ AcpiTableInstance->Fadt1 = NULL;
+ }
- case EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE:
- if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
- AcpiTableInstance->Fadt1 = NULL;
- }
-
- if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
- AcpiTableInstance->Fadt3 = NULL;
- }
- break;
+ if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
+ AcpiTableInstance->Fadt3 = NULL;
+ }
- case EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE:
- if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
- AcpiTableInstance->Facs1 = NULL;
+ break;
- //
- // Update FADT table pointers
- //
- if (AcpiTableInstance->Fadt1 != NULL) {
- AcpiTableInstance->Fadt1->FirmwareCtrl = 0;
+ case EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE:
+ if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
+ AcpiTableInstance->Facs1 = NULL;
//
- // Checksum table
+ // Update FADT table pointers
//
- AcpiPlatformChecksum (
- AcpiTableInstance->Fadt1,
- AcpiTableInstance->Fadt1->Header.Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
- );
+ if (AcpiTableInstance->Fadt1 != NULL) {
+ AcpiTableInstance->Fadt1->FirmwareCtrl = 0;
+
+ //
+ // Checksum table
+ //
+ AcpiPlatformChecksum (
+ AcpiTableInstance->Fadt1,
+ AcpiTableInstance->Fadt1->Header.Length,
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
+ );
+ }
}
- }
-
- if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
- AcpiTableInstance->Facs3 = NULL;
- //
- // Update FADT table pointers
- //
- if (AcpiTableInstance->Fadt3 != NULL) {
- AcpiTableInstance->Fadt3->FirmwareCtrl = 0;
- ZeroMem (&AcpiTableInstance->Fadt3->XFirmwareCtrl, sizeof (UINT64));
+ if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
+ AcpiTableInstance->Facs3 = NULL;
//
- // Checksum table
+ // Update FADT table pointers
//
- AcpiPlatformChecksum (
- AcpiTableInstance->Fadt3,
- AcpiTableInstance->Fadt3->Header.Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
- );
+ if (AcpiTableInstance->Fadt3 != NULL) {
+ AcpiTableInstance->Fadt3->FirmwareCtrl = 0;
+ ZeroMem (&AcpiTableInstance->Fadt3->XFirmwareCtrl, sizeof (UINT64));
+
+ //
+ // Checksum table
+ //
+ AcpiPlatformChecksum (
+ AcpiTableInstance->Fadt3,
+ AcpiTableInstance->Fadt3->Header.Length,
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
+ );
+ }
}
- }
- break;
- case EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:
- if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
- AcpiTableInstance->Dsdt1 = NULL;
+ break;
- //
- // Update FADT table pointers
- //
- if (AcpiTableInstance->Fadt1 != NULL) {
- AcpiTableInstance->Fadt1->Dsdt = 0;
+ case EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:
+ if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
+ AcpiTableInstance->Dsdt1 = NULL;
//
- // Checksum table
+ // Update FADT table pointers
//
- AcpiPlatformChecksum (
- AcpiTableInstance->Fadt1,
- AcpiTableInstance->Fadt1->Header.Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
- );
+ if (AcpiTableInstance->Fadt1 != NULL) {
+ AcpiTableInstance->Fadt1->Dsdt = 0;
+
+ //
+ // Checksum table
+ //
+ AcpiPlatformChecksum (
+ AcpiTableInstance->Fadt1,
+ AcpiTableInstance->Fadt1->Header.Length,
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
+ );
+ }
}
- }
-
- if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
- AcpiTableInstance->Dsdt3 = NULL;
-
- //
- // Update FADT table pointers
- //
- if (AcpiTableInstance->Fadt3 != NULL) {
- AcpiTableInstance->Fadt3->Dsdt = 0;
- ZeroMem (&AcpiTableInstance->Fadt3->XDsdt, sizeof (UINT64));
+ if ((Version & ACPI_TABLE_VERSION_GTE_2_0) != 0) {
+ AcpiTableInstance->Dsdt3 = NULL;
//
- // Checksum table
+ // Update FADT table pointers
//
- AcpiPlatformChecksum (
- AcpiTableInstance->Fadt3,
- AcpiTableInstance->Fadt3->Header.Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
- );
+ if (AcpiTableInstance->Fadt3 != NULL) {
+ AcpiTableInstance->Fadt3->Dsdt = 0;
+ ZeroMem (&AcpiTableInstance->Fadt3->XDsdt, sizeof (UINT64));
+
+ //
+ // Checksum table
+ //
+ AcpiPlatformChecksum (
+ AcpiTableInstance->Fadt3,
+ AcpiTableInstance->Fadt3->Header.Length,
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
+ );
+ }
}
- }
- break;
- default:
- //
- // Do nothing
- //
- break;
+ break;
+
+ default:
+ //
+ // Do nothing
+ //
+ break;
}
}
+
//
// If no version is using this table anymore, remove and free list entry.
//
@@ -1514,13 +1576,13 @@ DeleteTable ( RemoveEntryList (&(Table->Link));
gBS->FreePool (Table);
}
+
//
// Done
//
return EFI_SUCCESS;
}
-
/**
This function finds and removes the table specified by the handle.
@@ -1535,15 +1597,15 @@ DeleteTable ( **/
EFI_STATUS
RemoveTableFromList (
- 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_TABLE_LIST *Table;
- EFI_STATUS Status;
+ EFI_ACPI_TABLE_LIST *Table;
+ EFI_STATUS Status;
- Table = (EFI_ACPI_TABLE_LIST*) NULL;
+ Table = (EFI_ACPI_TABLE_LIST *)NULL;
//
// Check for invalid input parameters
@@ -1554,13 +1616,14 @@ RemoveTableFromList ( // Find the table
//
Status = FindTableByHandle (
- Handle,
- &AcpiTableInstance->TableList,
- &Table
- );
+ Handle,
+ &AcpiTableInstance->TableList,
+ &Table
+ );
if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
}
+
//
// Remove the table
//
@@ -1568,13 +1631,13 @@ RemoveTableFromList ( if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
+
//
// Completed successfully
//
return EFI_SUCCESS;
}
-
/**
This function calculates and updates an UINT8 checksum.
@@ -1587,13 +1650,13 @@ RemoveTableFromList ( **/
EFI_STATUS
AcpiPlatformChecksum (
- IN VOID *Buffer,
- IN UINTN Size,
- IN UINTN ChecksumOffset
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN UINTN ChecksumOffset
)
{
- UINT8 Sum;
- UINT8 *Ptr;
+ UINT8 Sum;
+ UINT8 *Ptr;
Sum = 0;
//
@@ -1610,18 +1673,18 @@ AcpiPlatformChecksum ( // add all content of buffer
//
while ((Size--) != 0) {
- Sum = (UINT8) (Sum + (*Ptr++));
+ Sum = (UINT8)(Sum + (*Ptr++));
}
+
//
// set checksum
//
Ptr = Buffer;
- Ptr[ChecksumOffset] = (UINT8) (0xff - Sum + 1);
+ Ptr[ChecksumOffset] = (UINT8)(0xff - Sum + 1);
return EFI_SUCCESS;
}
-
/**
Checksum all versions of the common tables, RSDP, RSDT, XSDT.
@@ -1632,7 +1695,7 @@ AcpiPlatformChecksum ( **/
EFI_STATUS
ChecksumCommonTables (
- IN OUT EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
+ IN OUT EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
)
{
//
@@ -1642,8 +1705,10 @@ ChecksumCommonTables ( AcpiPlatformChecksum (
AcpiTableInstance->Rsdp1,
sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER),
- OFFSET_OF (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER,
- Checksum)
+ OFFSET_OF (
+ EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER,
+ Checksum
+ )
);
}
@@ -1653,8 +1718,10 @@ ChecksumCommonTables ( AcpiPlatformChecksum (
AcpiTableInstance->Rsdp3,
sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER),
- OFFSET_OF (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER,
- Checksum)
+ OFFSET_OF (
+ EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER,
+ Checksum
+ )
);
//
@@ -1663,8 +1730,10 @@ ChecksumCommonTables ( AcpiPlatformChecksum (
AcpiTableInstance->Rsdp3,
sizeof (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER),
- OFFSET_OF (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER,
- ExtendedChecksum)
+ OFFSET_OF (
+ EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER,
+ ExtendedChecksum
+ )
);
if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
@@ -1674,15 +1743,19 @@ ChecksumCommonTables ( AcpiPlatformChecksum (
AcpiTableInstance->Rsdt1,
AcpiTableInstance->Rsdt1->Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
);
AcpiPlatformChecksum (
AcpiTableInstance->Rsdt3,
AcpiTableInstance->Rsdt3->Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
);
}
@@ -1692,8 +1765,10 @@ ChecksumCommonTables ( AcpiPlatformChecksum (
AcpiTableInstance->Xsdt,
AcpiTableInstance->Xsdt->Length,
- OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER,
- Checksum)
+ OFFSET_OF (
+ EFI_ACPI_DESCRIPTION_HEADER,
+ Checksum
+ )
);
return EFI_SUCCESS;
@@ -1711,7 +1786,7 @@ ChecksumCommonTables ( **/
EFI_STATUS
InstallAcpiTableFromHob (
- EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
+ EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
)
{
EFI_HOB_GUID_TYPE *GuidHob;
@@ -1731,8 +1806,8 @@ InstallAcpiTableFromHob ( UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;
TableKey = 0;
- Version = PcdGet32 (PcdAcpiExposedTableVersions);
- Status = EFI_SUCCESS;
+ Version = PcdGet32 (PcdAcpiExposedTableVersions);
+ Status = EFI_SUCCESS;
//
// HOB only contains the ACPI table in 2.0+ format.
//
@@ -1741,36 +1816,38 @@ InstallAcpiTableFromHob ( return EFI_NOT_FOUND;
}
- GenericHeader = (UNIVERSAL_PAYLOAD_GENERIC_HEADER *) GET_GUID_HOB_DATA (GuidHob);
+ GenericHeader = (UNIVERSAL_PAYLOAD_GENERIC_HEADER *)GET_GUID_HOB_DATA (GuidHob);
if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE (GuidHob)) || (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) {
return EFI_NOT_FOUND;
}
+
if (GenericHeader->Revision == UNIVERSAL_PAYLOAD_ACPI_TABLE_REVISION) {
//
// UNIVERSAL_PAYLOAD_ACPI_TABLE structure is used when Revision equals to UNIVERSAL_PAYLOAD_ACPI_TABLE_REVISION
//
- AcpiTableAdress = (UNIVERSAL_PAYLOAD_ACPI_TABLE *) GET_GUID_HOB_DATA (GuidHob);
+ AcpiTableAdress = (UNIVERSAL_PAYLOAD_ACPI_TABLE *)GET_GUID_HOB_DATA (GuidHob);
if (AcpiTableAdress->Header.Length < UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UNIVERSAL_PAYLOAD_ACPI_TABLE, Rsdp)) {
//
// Retrun if can't find the ACPI Info Hob with enough length
//
return EFI_NOT_FOUND;
}
- Rsdp = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *) (UINTN) (AcpiTableAdress->Rsdp);
+
+ Rsdp = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)(AcpiTableAdress->Rsdp);
//
// An ACPI-compatible OS must use the XSDT if present.
// It shouldn't happen that XsdtAddress points beyond 4G range in 32-bit environment.
//
- ASSERT ((UINTN) Rsdp->XsdtAddress == Rsdp->XsdtAddress);
+ ASSERT ((UINTN)Rsdp->XsdtAddress == Rsdp->XsdtAddress);
EntrySize = sizeof (UINT64);
- Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->XsdtAddress;
+ Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->XsdtAddress;
if (Rsdt == NULL) {
//
// XsdtAddress is zero, then we use Rsdt which has 32 bit entry
//
- Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress;
+ Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->RsdtAddress;
EntrySize = sizeof (UINT32);
}
@@ -1780,33 +1857,34 @@ InstallAcpiTableFromHob ( Count = (Rsdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / EntrySize;
- for (Index = 0; Index < Count; Index++){
+ for (Index = 0; Index < Count; Index++) {
ChildTableAddress = 0;
- CopyMem (&ChildTableAddress, (UINT8 *) (Rsdt + 1) + EntrySize * Index, EntrySize);
+ CopyMem (&ChildTableAddress, (UINT8 *)(Rsdt + 1) + EntrySize * Index, EntrySize);
//
// If the address is of UINT64 while this module runs at 32 bits,
// make sure the upper bits are all-zeros.
//
- ASSERT (ChildTableAddress == (UINTN) ChildTableAddress);
- if (ChildTableAddress != (UINTN) ChildTableAddress) {
+ ASSERT (ChildTableAddress == (UINTN)ChildTableAddress);
+ if (ChildTableAddress != (UINTN)ChildTableAddress) {
Status = EFI_ABORTED;
break;
}
- ChildTable = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) ChildTableAddress;
- Status = AddTableToList (AcpiTableInstance, ChildTable, TRUE, Version, TRUE, &TableKey);
+ ChildTable = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)ChildTableAddress;
+ Status = AddTableToList (AcpiTableInstance, ChildTable, TRUE, Version, TRUE, &TableKey);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACPI table at 0x%p\n", ChildTable));
ASSERT_EFI_ERROR (Status);
break;
}
- if (ChildTable->Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE){
+
+ if (ChildTable->Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {
//
// Add the FACS and DSDT tables if it is not NULL.
//
- if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *) ChildTable)->FirmwareCtrl != 0) {
- TableToInstall = (VOID *) (UINTN) ((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *) ChildTable)->FirmwareCtrl;
- Status = AddTableToList (AcpiTableInstance, TableToInstall, TRUE, Version, TRUE, &TableKey);
+ if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->FirmwareCtrl != 0) {
+ TableToInstall = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->FirmwareCtrl;
+ Status = AddTableToList (AcpiTableInstance, TableToInstall, TRUE, Version, TRUE, &TableKey);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACPI table FACS\n"));
ASSERT_EFI_ERROR (Status);
@@ -1814,9 +1892,9 @@ InstallAcpiTableFromHob ( }
}
- if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *) ChildTable)->Dsdt != 0) {
- TableToInstall = (VOID *) (UINTN) ((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *) ChildTable)->Dsdt;
- Status = AddTableToList (AcpiTableInstance, TableToInstall, TRUE, Version, TRUE, &TableKey);
+ if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsdt != 0) {
+ TableToInstall = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsdt;
+ Status = AddTableToList (AcpiTableInstance, TableToInstall, TRUE, Version, TRUE, &TableKey);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACPI table DSDT\n"));
ASSERT_EFI_ERROR (Status);
@@ -1857,7 +1935,7 @@ InstallAcpiTableFromHob ( **/
EFI_STATUS
AcpiTableAcpiTableConstructor (
- EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
+ EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
)
{
EFI_STATUS Status;
@@ -1883,7 +1961,7 @@ AcpiTableAcpiTableConstructor ( }
InitializeListHead (&AcpiTableInstance->TableList);
- AcpiTableInstance->CurrentHandle = 1;
+ AcpiTableInstance->CurrentHandle = 1;
AcpiTableInstance->AcpiTableProtocol.InstallAcpiTable = InstallAcpiTable;
AcpiTableInstance->AcpiTableProtocol.UninstallAcpiTable = UninstallAcpiTable;
@@ -1902,12 +1980,12 @@ AcpiTableAcpiTableConstructor ( if (mAcpiTableAllocType != AllocateAnyPages) {
PageAddress = 0xFFFFFFFF;
- Status = gBS->AllocatePages (
- mAcpiTableAllocType,
- EfiACPIReclaimMemory,
- EFI_SIZE_TO_PAGES (RsdpTableSize),
- &PageAddress
- );
+ Status = gBS->AllocatePages (
+ mAcpiTableAllocType,
+ EfiACPIReclaimMemory,
+ EFI_SIZE_TO_PAGES (RsdpTableSize),
+ &PageAddress
+ );
} else {
Status = gBS->AllocatePool (
EfiACPIReclaimMemory,
@@ -1923,13 +2001,15 @@ AcpiTableAcpiTableConstructor ( if (mAcpiTableAllocType != AllocateAnyPages) {
Pointer = (UINT8 *)(UINTN)PageAddress;
}
+
ZeroMem (Pointer, RsdpTableSize);
- AcpiTableInstance->Rsdp1 = (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *) Pointer;
+ AcpiTableInstance->Rsdp1 = (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)Pointer;
if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
Pointer += sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER);
}
- AcpiTableInstance->Rsdp3 = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *) Pointer;
+
+ AcpiTableInstance->Rsdp3 = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)Pointer;
//
// Create RSDT, XSDT structures
@@ -1955,12 +2035,12 @@ AcpiTableAcpiTableConstructor ( // for convenience of implementation that we force memory below 4GB.
//
PageAddress = 0xFFFFFFFF;
- Status = gBS->AllocatePages (
- mAcpiTableAllocType,
- EfiACPIReclaimMemory,
- EFI_SIZE_TO_PAGES (TotalSize),
- &PageAddress
- );
+ Status = gBS->AllocatePages (
+ mAcpiTableAllocType,
+ EfiACPIReclaimMemory,
+ EFI_SIZE_TO_PAGES (TotalSize),
+ &PageAddress
+ );
} else {
Status = gBS->AllocatePool (
EfiACPIReclaimMemory,
@@ -1971,26 +2051,31 @@ AcpiTableAcpiTableConstructor ( if (EFI_ERROR (Status)) {
if (mAcpiTableAllocType != AllocateAnyPages) {
- gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)AcpiTableInstance->Rsdp1,
- EFI_SIZE_TO_PAGES (RsdpTableSize));
+ gBS->FreePages (
+ (EFI_PHYSICAL_ADDRESS)(UINTN)AcpiTableInstance->Rsdp1,
+ EFI_SIZE_TO_PAGES (RsdpTableSize)
+ );
} else {
gBS->FreePool (AcpiTableInstance->Rsdp1);
}
+
return EFI_OUT_OF_RESOURCES;
}
if (mAcpiTableAllocType != AllocateAnyPages) {
Pointer = (UINT8 *)(UINTN)PageAddress;
}
+
ZeroMem (Pointer, TotalSize);
- AcpiTableInstance->Rsdt1 = (EFI_ACPI_DESCRIPTION_HEADER *) Pointer;
+ AcpiTableInstance->Rsdt1 = (EFI_ACPI_DESCRIPTION_HEADER *)Pointer;
if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
- Pointer += (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + EFI_ACPI_MAX_NUM_TABLES * sizeof (UINT32));
- AcpiTableInstance->Rsdt3 = (EFI_ACPI_DESCRIPTION_HEADER *) Pointer;
- Pointer += (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + EFI_ACPI_MAX_NUM_TABLES * sizeof (UINT32));
+ Pointer += (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + EFI_ACPI_MAX_NUM_TABLES * sizeof (UINT32));
+ AcpiTableInstance->Rsdt3 = (EFI_ACPI_DESCRIPTION_HEADER *)Pointer;
+ Pointer += (sizeof (EFI_ACPI_DESCRIPTION_HEADER) + EFI_ACPI_MAX_NUM_TABLES * sizeof (UINT32));
}
- AcpiTableInstance->Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) Pointer;
+
+ AcpiTableInstance->Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)Pointer;
//
// Initialize RSDP
@@ -2000,18 +2085,19 @@ AcpiTableAcpiTableConstructor ( CopyMem (&AcpiTableInstance->Rsdp1->Signature, &CurrentData, sizeof (UINT64));
CopyMem (AcpiTableInstance->Rsdp1->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (AcpiTableInstance->Rsdp1->OemId));
AcpiTableInstance->Rsdp1->Reserved = EFI_ACPI_RESERVED_BYTE;
- AcpiTableInstance->Rsdp1->RsdtAddress = (UINT32) (UINTN) AcpiTableInstance->Rsdt1;
+ AcpiTableInstance->Rsdp1->RsdtAddress = (UINT32)(UINTN)AcpiTableInstance->Rsdt1;
}
CurrentData = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE;
CopyMem (&AcpiTableInstance->Rsdp3->Signature, &CurrentData, sizeof (UINT64));
CopyMem (AcpiTableInstance->Rsdp3->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (AcpiTableInstance->Rsdp3->OemId));
- AcpiTableInstance->Rsdp3->Revision = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION;
- AcpiTableInstance->Rsdp3->Length = sizeof (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER);
+ AcpiTableInstance->Rsdp3->Revision = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION;
+ AcpiTableInstance->Rsdp3->Length = sizeof (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER);
if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) {
- AcpiTableInstance->Rsdp3->RsdtAddress = (UINT32) (UINTN) AcpiTableInstance->Rsdt3;
+ AcpiTableInstance->Rsdp3->RsdtAddress = (UINT32)(UINTN)AcpiTableInstance->Rsdt3;
}
- CurrentData = (UINT64) (UINTN) AcpiTableInstance->Xsdt;
+
+ CurrentData = (UINT64)(UINTN)AcpiTableInstance->Xsdt;
CopyMem (&AcpiTableInstance->Rsdp3->XsdtAddress, &CurrentData, sizeof (UINT64));
SetMem (AcpiTableInstance->Rsdp3->Reserved, 3, EFI_ACPI_RESERVED_BYTE);
@@ -2035,12 +2121,12 @@ AcpiTableAcpiTableConstructor ( //
// We always reserve first one for FADT
//
- AcpiTableInstance->NumberOfTableEntries1 = 1;
- AcpiTableInstance->Rsdt1->Length = AcpiTableInstance->Rsdt1->Length + sizeof(UINT32);
+ AcpiTableInstance->NumberOfTableEntries1 = 1;
+ AcpiTableInstance->Rsdt1->Length = AcpiTableInstance->Rsdt1->Length + sizeof (UINT32);
- AcpiTableInstance->Rsdt3->Signature = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE;
- AcpiTableInstance->Rsdt3->Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
- AcpiTableInstance->Rsdt3->Revision = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION;
+ AcpiTableInstance->Rsdt3->Signature = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE;
+ AcpiTableInstance->Rsdt3->Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
+ AcpiTableInstance->Rsdt3->Revision = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION;
CopyMem (AcpiTableInstance->Rsdt3->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (AcpiTableInstance->Rsdt3->OemId));
CurrentData = PcdGet64 (PcdAcpiDefaultOemTableId);
CopyMem (&AcpiTableInstance->Rsdt3->OemTableId, &CurrentData, sizeof (UINT64));
@@ -2050,26 +2136,27 @@ AcpiTableAcpiTableConstructor ( //
// We always reserve first one for FADT
//
- AcpiTableInstance->Rsdt3->Length = AcpiTableInstance->Rsdt3->Length + sizeof(UINT32);
+ AcpiTableInstance->Rsdt3->Length = AcpiTableInstance->Rsdt3->Length + sizeof (UINT32);
}
- AcpiTableInstance->NumberOfTableEntries3 = 1;
+
+ AcpiTableInstance->NumberOfTableEntries3 = 1;
//
// Initialize Xsdt
//
- AcpiTableInstance->Xsdt->Signature = EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE;
- AcpiTableInstance->Xsdt->Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
- AcpiTableInstance->Xsdt->Revision = EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION;
+ AcpiTableInstance->Xsdt->Signature = EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE;
+ AcpiTableInstance->Xsdt->Length = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
+ AcpiTableInstance->Xsdt->Revision = EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION;
CopyMem (AcpiTableInstance->Xsdt->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (AcpiTableInstance->Xsdt->OemId));
CurrentData = PcdGet64 (PcdAcpiDefaultOemTableId);
CopyMem (&AcpiTableInstance->Xsdt->OemTableId, &CurrentData, sizeof (UINT64));
- AcpiTableInstance->Xsdt->OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
- AcpiTableInstance->Xsdt->CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
- AcpiTableInstance->Xsdt->CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
+ AcpiTableInstance->Xsdt->OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
+ AcpiTableInstance->Xsdt->CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
+ AcpiTableInstance->Xsdt->CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
//
// We always reserve first one for FADT
//
- AcpiTableInstance->Xsdt->Length = AcpiTableInstance->Xsdt->Length + sizeof(UINT64);
+ AcpiTableInstance->Xsdt->Length = AcpiTableInstance->Xsdt->Length + sizeof (UINT64);
ChecksumCommonTables (AcpiTableInstance);
@@ -2080,4 +2167,3 @@ AcpiTableAcpiTableConstructor ( //
return EFI_SUCCESS;
}
-
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/Aml.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/Aml.c index 3688056740..2e16fef9ed 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/Aml.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/Aml.c @@ -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;
}
-
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlChild.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlChild.c index 5622718075..0c154576c1 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlChild.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlChild.c @@ -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;
}
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlNamespace.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlNamespace.c index d5d48f9455..61c7273048 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlNamespace.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlNamespace.c @@ -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;
}
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlOption.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlOption.c index d0374c5de8..fbcf340e4b 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlOption.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlOption.c @@ -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;
- }
+ case AML_OBJECT:
+ ChildAmlByteEncoding = AmlSearchByOpByte (Buffer);
+ if (ChildAmlByteEncoding == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
- //
- // It is real AML_OBJECT
- //
- *DataSize = AmlGetObjectSize (
- ChildAmlByteEncoding,
- Buffer,
- MaxBufferSize
- );
- if (*DataSize == 0) {
- return EFI_INVALID_PARAMETER;
- }
- break;
- case AML_NONE:
+ //
+ // 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 (
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlString.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlString.c index 96341b7fec..9f67770578 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlString.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlString.c @@ -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;
}
diff --git a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c index d16872e145..57f15d49ea 100644 --- a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c +++ b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c @@ -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;
}
diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c index 45c9b667cb..8f535af26a 100644 --- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c +++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c @@ -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 ();
}
diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c index 4ed23979bd..82481aacd6 100644 --- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c +++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c @@ -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);
+ 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);
+ 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 ;
+ EfiBootScriptExecutorVariable = (BOOT_SCRIPT_EXECUTOR_VARIABLE *)(UINTN)BootScriptExecutorBuffer;
+ EfiBootScriptExecutorVariable->BootScriptExecutorEntrypoint = (UINTN)S3BootScriptExecutorEntryFunction;
- Status = SaveLockBox (
- &gEfiBootScriptExecutorVariableGuid,
- &BootScriptExecutorBuffer,
- sizeof(BootScriptExecutorBuffer)
- );
- ASSERT_EFI_ERROR (Status);
+ 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);
- }
+ //
+ // 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;
+ return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.h b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.h index 14bb63f604..0ea38223d7 100644 --- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.h +++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.h @@ -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_
diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c index afb2d5c404..6b44f50bac 100644 --- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c +++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c @@ -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;
}
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c index 5c20002077..aa2c984b95 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c @@ -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 {
//
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c index 6881466201..2f2b2a80b2 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c @@ -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);
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceCommon.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceCommon.c index 47db9a2fc0..9046896c55 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceCommon.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceCommon.c @@ -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);
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceStandaloneMm.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceStandaloneMm.c index be52d8ce90..b0a55a8242 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceStandaloneMm.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceStandaloneMm.c @@ -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 ();
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceTraditional.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceTraditional.c index 5bd38b0ef3..ccf9a8609a 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceTraditional.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceTraditional.c @@ -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 ();
diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/AcpiS3ContextSave.c b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/AcpiS3ContextSave.c index 8df9d73a96..03f7a332d3 100644 --- a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/AcpiS3ContextSave.c +++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/AcpiS3ContextSave.c @@ -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);
diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/InternalS3SaveState.h b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/InternalS3SaveState.h index a8dece4286..8fb3f4219e 100644 --- a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/InternalS3SaveState.h +++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/InternalS3SaveState.h @@ -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_
diff --git a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c index e342f73485..c6e328d875 100644 --- a/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c +++ b/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c @@ -8,13 +8,14 @@ **/
#include "InternalS3SaveState.h"
-EFI_HANDLE mHandle = NULL;
-EFI_S3_SAVE_STATE_PROTOCOL mS3SaveState = {
+EFI_HANDLE mHandle = NULL;
+EFI_S3_SAVE_STATE_PROTOCOL mS3SaveState = {
BootScriptWrite,
BootScriptInsert,
BootScriptLabel,
BootScriptCompare
- };
+};
+
/**
Internal function to add IO write opcode to the table.
@@ -27,21 +28,22 @@ EFI_S3_SAVE_STATE_PROTOCOL mS3SaveState = { **/
EFI_STATUS
BootScriptWriteIoWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINTN Count;
+ UINT8 *Buffer;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Count = VA_ARG (Marker, UINTN);
+ Buffer = VA_ARG (Marker, UINT8 *);
return S3BootScriptSaveIoWrite (Width, Address, Count, Buffer);
}
+
/**
Internal function to add IO read/write opcode to the table.
@@ -54,18 +56,18 @@ BootScriptWriteIoWrite ( **/
EFI_STATUS
BootScriptWriteIoReadWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINT8 *Data;
+ UINT8 *DataMask;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, UINT8 *);
+ DataMask = VA_ARG (Marker, UINT8 *);
return S3BootScriptSaveIoReadWrite (Width, Address, Data, DataMask);
}
@@ -82,18 +84,18 @@ BootScriptWriteIoReadWrite ( **/
EFI_STATUS
BootScriptWriteMemWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINTN Count;
+ UINT8 *Buffer;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Count = VA_ARG (Marker, UINTN);
+ Buffer = VA_ARG (Marker, UINT8 *);
return S3BootScriptSaveMemWrite (Width, Address, Count, Buffer);
}
@@ -110,18 +112,18 @@ BootScriptWriteMemWrite ( **/
EFI_STATUS
BootScriptWriteMemReadWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINT8 *Data;
+ UINT8 *DataMask;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, UINT8 *);
+ DataMask = VA_ARG (Marker, UINT8 *);
return S3BootScriptSaveMemReadWrite (Width, Address, Data, DataMask);
}
@@ -138,18 +140,18 @@ BootScriptWriteMemReadWrite ( **/
EFI_STATUS
BootScriptWritePciCfgWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINTN Count;
+ UINT8 *Buffer;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Count = VA_ARG (Marker, UINTN);
+ Buffer = VA_ARG (Marker, UINT8 *);
return S3BootScriptSavePciCfgWrite (Width, Address, Count, Buffer);
}
@@ -166,21 +168,22 @@ BootScriptWritePciCfgWrite ( **/
EFI_STATUS
BootScriptWritePciCfgReadWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINT8 *Data;
+ UINT8 *DataMask;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, UINT8 *);
+ DataMask = VA_ARG (Marker, UINT8 *);
return S3BootScriptSavePciCfgReadWrite (Width, Address, Data, DataMask);
}
+
/**
Internal function to add PciCfg2 write opcode to the table.
@@ -193,20 +196,20 @@ BootScriptWritePciCfgReadWrite ( **/
EFI_STATUS
BootScriptWritePciCfg2Write (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
- UINT16 Segment;
-
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Segment = VA_ARG (Marker, UINT16);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINTN Count;
+ UINT8 *Buffer;
+ UINT16 Segment;
+
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Segment = VA_ARG (Marker, UINT16);
+ Address = VA_ARG (Marker, UINT64);
+ Count = VA_ARG (Marker, UINTN);
+ Buffer = VA_ARG (Marker, UINT8 *);
return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);
}
@@ -223,23 +226,24 @@ BootScriptWritePciCfg2Write ( **/
EFI_STATUS
BootScriptWritePciCfg2ReadWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT16 Segment;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
-
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Segment = VA_ARG (Marker, UINT16);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT16 Segment;
+ UINT64 Address;
+ UINT8 *Data;
+ UINT8 *DataMask;
+
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Segment = VA_ARG (Marker, UINT16);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, UINT8 *);
+ DataMask = VA_ARG (Marker, UINT8 *);
return S3BootScriptSavePciCfg2ReadWrite (Width, Segment, Address, Data, DataMask);
}
+
/**
Internal function to add smbus execute opcode to the table.
@@ -252,27 +256,28 @@ BootScriptWritePciCfg2ReadWrite ( **/
EFI_STATUS
BootScriptWriteSmbusExecute (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
EFI_SMBUS_DEVICE_COMMAND Command;
EFI_SMBUS_OPERATION Operation;
BOOLEAN PecCheck;
- VOID *Buffer;
- UINTN *DataSize;
+ VOID *Buffer;
+ UINTN *DataSize;
UINTN SmBusAddress;
SlaveAddress.SmbusDeviceAddress = VA_ARG (Marker, UINTN);
Command = VA_ARG (Marker, EFI_SMBUS_DEVICE_COMMAND);
Operation = VA_ARG (Marker, EFI_SMBUS_OPERATION);
PecCheck = VA_ARG (Marker, BOOLEAN);
- SmBusAddress = SMBUS_LIB_ADDRESS (SlaveAddress.SmbusDeviceAddress,Command,0,PecCheck);
+ SmBusAddress = SMBUS_LIB_ADDRESS (SlaveAddress.SmbusDeviceAddress, Command, 0, PecCheck);
DataSize = VA_ARG (Marker, UINTN *);
Buffer = VA_ARG (Marker, VOID *);
return S3BootScriptSaveSmbusExecute (SmBusAddress, Operation, DataSize, Buffer);
}
+
/**
Internal function to add stall opcode to the table.
@@ -285,12 +290,12 @@ BootScriptWriteSmbusExecute ( **/
EFI_STATUS
BootScriptWriteStall (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- UINT32 Duration;
+ UINT32 Duration;
- Duration = VA_ARG (Marker, UINT32);
+ Duration = VA_ARG (Marker, UINT32);
return S3BootScriptSaveStall (Duration);
}
@@ -308,12 +313,12 @@ BootScriptWriteStall ( **/
EFI_STATUS
BootScriptWriteDispatch (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- VOID *EntryPoint;
+ VOID *EntryPoint;
- EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
+ EntryPoint = (VOID *)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
return S3BootScriptSaveDispatch (EntryPoint);
}
@@ -329,11 +334,11 @@ BootScriptWriteDispatch ( **/
EFI_STATUS
BootScriptWriteMemPoll (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
VOID *Data;
VOID *DataMask;
UINT64 Delay;
@@ -361,10 +366,10 @@ BootScriptWriteMemPoll ( //
// If Remainder is not zero, LoopTimes will be rounded up by 1.
//
- LoopTimes +=1;
+ LoopTimes += 1;
}
- return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 1, LoopTimes);
+ return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 1, LoopTimes);
}
/**
@@ -380,17 +385,18 @@ BootScriptWriteMemPoll ( **/
EFI_STATUS
BootScriptWriteDispatch2 (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- VOID *EntryPoint;
- VOID *Context;
+ VOID *EntryPoint;
+ VOID *Context;
- EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
- Context = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
+ EntryPoint = (VOID *)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
+ Context = (VOID *)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
return S3BootScriptSaveDispatch2 (EntryPoint, Context);
}
+
/**
Internal function to add INFORAMTION opcode node to the table
list.
@@ -403,16 +409,17 @@ BootScriptWriteDispatch2 ( **/
EFI_STATUS
BootScriptWriteInformation (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
UINT32 InformationLength;
EFI_PHYSICAL_ADDRESS Information;
InformationLength = VA_ARG (Marker, UINT32);
- Information = VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
- return S3BootScriptSaveInformation (InformationLength, (VOID*)(UINTN)Information);
+ Information = VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
+ return S3BootScriptSaveInformation (InformationLength, (VOID *)(UINTN)Information);
}
+
/**
Internal function to add IO poll opcode node to the table
@param Marker The variable argument list to get the opcode
@@ -424,23 +431,24 @@ BootScriptWriteInformation ( **/
EFI_STATUS
BootScriptWriteIoPoll (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- VOID *Data;
- VOID *DataMask;
- UINT64 Delay;
-
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, VOID *);
- DataMask = VA_ARG (Marker, VOID *);
- Delay = (UINT64)VA_ARG (Marker, UINT64);
-
- return S3BootScriptSaveIoPoll (Width, Address, Data, DataMask, Delay);
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ VOID *Data;
+ VOID *DataMask;
+ UINT64 Delay;
+
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, VOID *);
+ DataMask = VA_ARG (Marker, VOID *);
+ Delay = (UINT64)VA_ARG (Marker, UINT64);
+
+ return S3BootScriptSaveIoPoll (Width, Address, Data, DataMask, Delay);
}
+
/**
Internal function to add PCI config poll opcode node to the table
@@ -453,24 +461,24 @@ BootScriptWriteIoPoll ( **/
EFI_STATUS
BootScriptWritePciConfigPoll (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- VOID *Data;
- VOID *DataMask;
- UINT64 Delay;
-
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ VOID *Data;
+ VOID *DataMask;
+ UINT64 Delay;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, VOID *);
- DataMask = VA_ARG (Marker, VOID *);
- Delay = (UINT64)VA_ARG (Marker, UINT64);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, VOID *);
+ DataMask = VA_ARG (Marker, VOID *);
+ Delay = (UINT64)VA_ARG (Marker, UINT64);
- return S3BootScriptSavePciPoll (Width, Address, Data, DataMask, Delay);
+ return S3BootScriptSavePciPoll (Width, Address, Data, DataMask, Delay);
}
+
/**
Internal function to add PCI config 2 poll opcode node to the table
@@ -483,26 +491,25 @@ BootScriptWritePciConfigPoll ( **/
EFI_STATUS
BootScriptWritePciConfig2Poll (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT16 Segment;
- UINT64 Address;
- VOID *Data;
- VOID *DataMask;
- UINT64 Delay;
-
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Segment = VA_ARG (Marker, UINT16);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, VOID *);
- DataMask = VA_ARG (Marker, VOID *);
- Delay = (UINT64)VA_ARG (Marker, UINT64);
-
- return S3BootScriptSavePci2Poll (Width, Segment, Address, Data, DataMask, Delay);
-}
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT16 Segment;
+ UINT64 Address;
+ VOID *Data;
+ VOID *DataMask;
+ UINT64 Delay;
+
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Segment = VA_ARG (Marker, UINT16);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, VOID *);
+ DataMask = VA_ARG (Marker, VOID *);
+ Delay = (UINT64)VA_ARG (Marker, UINT64);
+ return S3BootScriptSavePci2Poll (Width, Segment, Address, Data, DataMask, Delay);
+}
/**
Adds a record into S3 boot script table.
@@ -534,128 +541,129 @@ BootScriptWritePciConfig2Poll ( 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,
...
)
{
- EFI_STATUS Status;
- VA_LIST Marker;
+ EFI_STATUS Status;
+ VA_LIST Marker;
+
//
// Build script according to opcode
//
switch (OpCode) {
-
- case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfgWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfgReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteSmbusExecute (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_STALL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteStall (Marker);
- VA_END (Marker);
-
- break;
-
- case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteDispatch (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteDispatch2 (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteInformation (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfg2Write (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfg2ReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciConfigPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciConfig2Poll (Marker);
- VA_END (Marker);
- break;
-
- default:
- Status = EFI_INVALID_PARAMETER;
- break;
+ case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfgWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfgReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteSmbusExecute (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_STALL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteStall (Marker);
+ VA_END (Marker);
+
+ break;
+
+ case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteDispatch (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteDispatch2 (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteInformation (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfg2Write (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfg2ReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciConfigPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciConfig2Poll (Marker);
+ VA_END (Marker);
+ break;
+
+ default:
+ Status = EFI_INVALID_PARAMETER;
+ break;
}
return Status;
}
+
/**
Insert a record into a specified Framework boot script table.
@@ -687,133 +695,135 @@ 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,
...
)
{
- EFI_STATUS Status;
- VA_LIST Marker;
+ EFI_STATUS Status;
+ VA_LIST Marker;
+
//
// Build script according to opcode
//
switch (OpCode) {
-
- case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfgWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfgReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteSmbusExecute (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_STALL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteStall (Marker);
- VA_END (Marker);
-
- break;
-
- case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteDispatch (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteDispatch2 (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteInformation (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfg2Write (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfg2ReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciConfigPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciConfig2Poll (Marker);
- VA_END (Marker);
- break;
-
- default:
- Status = EFI_INVALID_PARAMETER;
- break;
+ case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfgWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfgReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteSmbusExecute (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_STALL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteStall (Marker);
+ VA_END (Marker);
+
+ break;
+
+ case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteDispatch (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteDispatch2 (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteInformation (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfg2Write (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfg2ReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciConfigPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciConfig2Poll (Marker);
+ VA_END (Marker);
+ break;
+
+ default:
+ Status = EFI_INVALID_PARAMETER;
+ break;
}
if (!EFI_ERROR (Status)) {
- Status = S3BootScriptMoveLastOpcode (BeforeOrAfter, (VOID **)Position);
+ Status = S3BootScriptMoveLastOpcode (BeforeOrAfter, (VOID **)Position);
}
+
return Status;
}
+
/**
Find a label within the boot script table and, if not present, optionally create it.
@@ -844,15 +854,16 @@ 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
)
{
return S3BootScriptLabel (BeforeOrAfter, CreateIfNotFound, (VOID **)Position, Label);
}
+
/**
Compare two positions in the boot script table and return their relative position.
@@ -873,14 +884,15 @@ 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
)
{
return S3BootScriptCompare (Position1, Position2, RelativePosition);
}
+
/**
This routine is entry point of ScriptSave driver.
@@ -895,12 +907,12 @@ BootScriptCompare ( EFI_STATUS
EFIAPI
InitializeS3SaveState (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- EFI_EVENT EndOfDxeEvent;
+ EFI_STATUS Status;
+ EFI_EVENT EndOfDxeEvent;
if (!PcdGetBool (PcdAcpiS3Enable)) {
return EFI_UNSUPPORTED;
@@ -916,13 +928,10 @@ InitializeS3SaveState ( );
ASSERT_EFI_ERROR (Status);
- return gBS->InstallProtocolInterface (
- &mHandle,
- &gEfiS3SaveStateProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mS3SaveState
- );
-
+ return gBS->InstallProtocolInterface (
+ &mHandle,
+ &gEfiS3SaveStateProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mS3SaveState
+ );
}
-
-
diff --git a/MdeModulePkg/Universal/Acpi/SmmS3SaveState/InternalSmmSaveState.h b/MdeModulePkg/Universal/Acpi/SmmS3SaveState/InternalSmmSaveState.h index afc41ed3fe..3684007497 100644 --- a/MdeModulePkg/Universal/Acpi/SmmS3SaveState/InternalSmmSaveState.h +++ b/MdeModulePkg/Universal/Acpi/SmmS3SaveState/InternalSmmSaveState.h @@ -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_
diff --git a/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c b/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c index 601c8218db..bf5a2ae73e 100644 --- a/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c +++ b/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c @@ -8,12 +8,13 @@ **/
#include "InternalSmmSaveState.h"
-EFI_S3_SMM_SAVE_STATE_PROTOCOL mS3SmmSaveState = {
- BootScriptWrite,
- BootScriptInsert,
- BootScriptLabel,
- BootScriptCompare
- };
+EFI_S3_SMM_SAVE_STATE_PROTOCOL mS3SmmSaveState = {
+ BootScriptWrite,
+ BootScriptInsert,
+ BootScriptLabel,
+ BootScriptCompare
+};
+
/**
Internal function to add IO write opcode to the table.
@@ -26,21 +27,22 @@ EFI_S3_SMM_SAVE_STATE_PROTOCOL mS3SmmSaveState = { **/
EFI_STATUS
BootScriptWriteIoWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINTN Count;
+ UINT8 *Buffer;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Count = VA_ARG (Marker, UINTN);
+ Buffer = VA_ARG (Marker, UINT8 *);
return S3BootScriptSaveIoWrite (Width, Address, Count, Buffer);
}
+
/**
Internal function to add IO read/write opcode to the table.
@@ -53,18 +55,18 @@ BootScriptWriteIoWrite ( **/
EFI_STATUS
BootScriptWriteIoReadWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINT8 *Data;
+ UINT8 *DataMask;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, UINT8 *);
+ DataMask = VA_ARG (Marker, UINT8 *);
return S3BootScriptSaveIoReadWrite (Width, Address, Data, DataMask);
}
@@ -81,18 +83,18 @@ BootScriptWriteIoReadWrite ( **/
EFI_STATUS
BootScriptWriteMemWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINTN Count;
+ UINT8 *Buffer;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Count = VA_ARG (Marker, UINTN);
+ Buffer = VA_ARG (Marker, UINT8 *);
return S3BootScriptSaveMemWrite (Width, Address, Count, Buffer);
}
@@ -109,18 +111,18 @@ BootScriptWriteMemWrite ( **/
EFI_STATUS
BootScriptWriteMemReadWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINT8 *Data;
+ UINT8 *DataMask;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, UINT8 *);
+ DataMask = VA_ARG (Marker, UINT8 *);
return S3BootScriptSaveMemReadWrite (Width, Address, Data, DataMask);
}
@@ -137,18 +139,18 @@ BootScriptWriteMemReadWrite ( **/
EFI_STATUS
BootScriptWritePciCfgWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINTN Count;
+ UINT8 *Buffer;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Count = VA_ARG (Marker, UINTN);
+ Buffer = VA_ARG (Marker, UINT8 *);
return S3BootScriptSavePciCfgWrite (Width, Address, Count, Buffer);
}
@@ -165,21 +167,22 @@ BootScriptWritePciCfgWrite ( **/
EFI_STATUS
BootScriptWritePciCfgReadWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINT8 *Data;
+ UINT8 *DataMask;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, UINT8 *);
+ DataMask = VA_ARG (Marker, UINT8 *);
return S3BootScriptSavePciCfgReadWrite (Width, Address, Data, DataMask);
}
+
/**
Internal function to add PciCfg2 write opcode to the table.
@@ -192,20 +195,20 @@ BootScriptWritePciCfgReadWrite ( **/
EFI_STATUS
BootScriptWritePciCfg2Write (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- UINTN Count;
- UINT8 *Buffer;
- UINT16 Segment;
-
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Segment = VA_ARG (Marker, UINT16);
- Address = VA_ARG (Marker, UINT64);
- Count = VA_ARG (Marker, UINTN);
- Buffer = VA_ARG (Marker, UINT8 *);
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ UINTN Count;
+ UINT8 *Buffer;
+ UINT16 Segment;
+
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Segment = VA_ARG (Marker, UINT16);
+ Address = VA_ARG (Marker, UINT64);
+ Count = VA_ARG (Marker, UINTN);
+ Buffer = VA_ARG (Marker, UINT8 *);
return S3BootScriptSavePciCfg2Write (Width, Segment, Address, Count, Buffer);
}
@@ -222,23 +225,24 @@ BootScriptWritePciCfg2Write ( **/
EFI_STATUS
BootScriptWritePciCfg2ReadWrite (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT16 Segment;
- UINT64 Address;
- UINT8 *Data;
- UINT8 *DataMask;
-
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Segment = VA_ARG (Marker, UINT16);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, UINT8 *);
- DataMask = VA_ARG (Marker, UINT8 *);
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT16 Segment;
+ UINT64 Address;
+ UINT8 *Data;
+ UINT8 *DataMask;
+
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Segment = VA_ARG (Marker, UINT16);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, UINT8 *);
+ DataMask = VA_ARG (Marker, UINT8 *);
return S3BootScriptSavePciCfg2ReadWrite (Width, Segment, Address, Data, DataMask);
}
+
/**
Internal function to add smbus execute opcode to the table.
@@ -251,27 +255,28 @@ BootScriptWritePciCfg2ReadWrite ( **/
EFI_STATUS
BootScriptWriteSmbusExecute (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
EFI_SMBUS_DEVICE_ADDRESS SlaveAddress;
EFI_SMBUS_DEVICE_COMMAND Command;
EFI_SMBUS_OPERATION Operation;
BOOLEAN PecCheck;
- VOID *Buffer;
- UINTN *DataSize;
+ VOID *Buffer;
+ UINTN *DataSize;
UINTN SmBusAddress;
SlaveAddress.SmbusDeviceAddress = VA_ARG (Marker, UINTN);
Command = VA_ARG (Marker, EFI_SMBUS_DEVICE_COMMAND);
Operation = VA_ARG (Marker, EFI_SMBUS_OPERATION);
PecCheck = VA_ARG (Marker, BOOLEAN);
- SmBusAddress = SMBUS_LIB_ADDRESS (SlaveAddress.SmbusDeviceAddress,Command,0,PecCheck);
+ SmBusAddress = SMBUS_LIB_ADDRESS (SlaveAddress.SmbusDeviceAddress, Command, 0, PecCheck);
DataSize = VA_ARG (Marker, UINTN *);
Buffer = VA_ARG (Marker, VOID *);
return S3BootScriptSaveSmbusExecute (SmBusAddress, Operation, DataSize, Buffer);
}
+
/**
Internal function to add stall opcode to the table.
@@ -284,12 +289,12 @@ BootScriptWriteSmbusExecute ( **/
EFI_STATUS
BootScriptWriteStall (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- UINT32 Duration;
+ UINT32 Duration;
- Duration = VA_ARG (Marker, UINT32);
+ Duration = VA_ARG (Marker, UINT32);
return S3BootScriptSaveStall (Duration);
}
@@ -307,12 +312,12 @@ BootScriptWriteStall ( **/
EFI_STATUS
BootScriptWriteDispatch (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- VOID *EntryPoint;
+ VOID *EntryPoint;
- EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
+ EntryPoint = (VOID *)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
return S3BootScriptSaveDispatch (EntryPoint);
}
@@ -328,16 +333,16 @@ BootScriptWriteDispatch ( **/
EFI_STATUS
BootScriptWriteMemPoll (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
VOID *Data;
VOID *DataMask;
- UINT64 Delay;
- UINT64 LoopTimes;
- UINT32 Remainder;
+ UINT64 Delay;
+ UINT64 LoopTimes;
+ UINT32 Remainder;
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
Address = VA_ARG (Marker, UINT64);
@@ -360,10 +365,10 @@ BootScriptWriteMemPoll ( //
// If Remainder is not zero, LoopTimes will be rounded up by 1.
//
- LoopTimes +=1;
+ LoopTimes += 1;
}
- return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 1, LoopTimes);
+ return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 1, LoopTimes);
}
/**
@@ -379,17 +384,18 @@ BootScriptWriteMemPoll ( **/
EFI_STATUS
BootScriptWriteDispatch2 (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- VOID *EntryPoint;
- VOID *Context;
+ VOID *EntryPoint;
+ VOID *Context;
- EntryPoint = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
- Context = (VOID*)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
+ EntryPoint = (VOID *)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
+ Context = (VOID *)(UINTN)VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
return S3BootScriptSaveDispatch2 (EntryPoint, Context);
}
+
/**
Internal function to add INFORAMTION opcode node to the table
list.
@@ -402,16 +408,17 @@ BootScriptWriteDispatch2 ( **/
EFI_STATUS
BootScriptWriteInformation (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
UINT32 InformationLength;
EFI_PHYSICAL_ADDRESS Information;
InformationLength = VA_ARG (Marker, UINT32);
- Information = VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
- return S3BootScriptSaveInformation (InformationLength, (VOID*)(UINTN)Information);
+ Information = VA_ARG (Marker, EFI_PHYSICAL_ADDRESS);
+ return S3BootScriptSaveInformation (InformationLength, (VOID *)(UINTN)Information);
}
+
/**
Internal function to add IO poll opcode node to the table
@param Marker The variable argument list to get the opcode
@@ -423,23 +430,24 @@ BootScriptWriteInformation ( **/
EFI_STATUS
BootScriptWriteIoPoll (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- VOID *Data;
- VOID *DataMask;
- UINT64 Delay;
-
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, VOID *);
- DataMask = VA_ARG (Marker, VOID *);
- Delay = (UINT64)VA_ARG (Marker, UINT64);
-
- return S3BootScriptSaveIoPoll (Width, Address, Data, DataMask, Delay);
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ VOID *Data;
+ VOID *DataMask;
+ UINT64 Delay;
+
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, VOID *);
+ DataMask = VA_ARG (Marker, VOID *);
+ Delay = (UINT64)VA_ARG (Marker, UINT64);
+
+ return S3BootScriptSaveIoPoll (Width, Address, Data, DataMask, Delay);
}
+
/**
Internal function to add PCI config poll opcode node to the table
@@ -452,24 +460,24 @@ BootScriptWriteIoPoll ( **/
EFI_STATUS
BootScriptWritePciConfigPoll (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT64 Address;
- VOID *Data;
- VOID *DataMask;
- UINT64 Delay;
-
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT64 Address;
+ VOID *Data;
+ VOID *DataMask;
+ UINT64 Delay;
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, VOID *);
- DataMask = VA_ARG (Marker, VOID *);
- Delay = (UINT64)VA_ARG (Marker, UINT64);
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, VOID *);
+ DataMask = VA_ARG (Marker, VOID *);
+ Delay = (UINT64)VA_ARG (Marker, UINT64);
- return S3BootScriptSavePciPoll (Width, Address, Data, DataMask, Delay);
+ return S3BootScriptSavePciPoll (Width, Address, Data, DataMask, Delay);
}
+
/**
Internal function to add PCI config 2 poll opcode node to the table
@@ -482,24 +490,24 @@ BootScriptWritePciConfigPoll ( **/
EFI_STATUS
BootScriptWritePciConfig2Poll (
- IN VA_LIST Marker
+ IN VA_LIST Marker
)
{
- S3_BOOT_SCRIPT_LIB_WIDTH Width;
- UINT16 Segment;
- UINT64 Address;
- VOID *Data;
- VOID *DataMask;
- UINT64 Delay;
-
- Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
- Segment = VA_ARG (Marker, UINT16);
- Address = VA_ARG (Marker, UINT64);
- Data = VA_ARG (Marker, VOID *);
- DataMask = VA_ARG (Marker, VOID *);
- Delay = (UINT64)VA_ARG (Marker, UINT64);
-
- return S3BootScriptSavePci2Poll (Width, Segment, Address, Data, DataMask, Delay);
+ S3_BOOT_SCRIPT_LIB_WIDTH Width;
+ UINT16 Segment;
+ UINT64 Address;
+ VOID *Data;
+ VOID *DataMask;
+ UINT64 Delay;
+
+ Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
+ Segment = VA_ARG (Marker, UINT16);
+ Address = VA_ARG (Marker, UINT64);
+ Data = VA_ARG (Marker, VOID *);
+ DataMask = VA_ARG (Marker, VOID *);
+ Delay = (UINT64)VA_ARG (Marker, UINT64);
+
+ return S3BootScriptSavePci2Poll (Width, Segment, Address, Data, DataMask, Delay);
}
/**
@@ -532,128 +540,129 @@ BootScriptWritePciConfig2Poll ( 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,
...
)
{
- EFI_STATUS Status;
- VA_LIST Marker;
+ EFI_STATUS Status;
+ VA_LIST Marker;
+
//
// Build script according to opcode
//
switch (OpCode) {
-
- case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfgWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfgReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteSmbusExecute (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_STALL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteStall (Marker);
- VA_END (Marker);
-
- break;
-
- case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteDispatch (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteDispatch2 (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteInformation (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfg2Write (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfg2ReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciConfigPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciConfig2Poll (Marker);
- VA_END (Marker);
- break;
-
- default:
- Status = EFI_INVALID_PARAMETER;
- break;
+ case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfgWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfgReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteSmbusExecute (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_STALL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteStall (Marker);
+ VA_END (Marker);
+
+ break;
+
+ case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteDispatch (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteDispatch2 (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteInformation (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfg2Write (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfg2ReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciConfigPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciConfig2Poll (Marker);
+ VA_END (Marker);
+ break;
+
+ default:
+ Status = EFI_INVALID_PARAMETER;
+ break;
}
return Status;
}
+
/**
Insert a record into a specified Framework boot script table.
@@ -685,133 +694,135 @@ 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,
...
)
{
- EFI_STATUS Status;
- VA_LIST Marker;
+ EFI_STATUS Status;
+ VA_LIST Marker;
+
//
// Build script according to opcode
//
switch (OpCode) {
-
- case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfgWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfgReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteSmbusExecute (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_STALL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteStall (Marker);
- VA_END (Marker);
-
- break;
-
- case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteDispatch (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteDispatch2 (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteInformation (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteMemPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfg2Write (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciCfg2ReadWrite (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWriteIoPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciConfigPoll (Marker);
- VA_END (Marker);
- break;
-
- case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:
- VA_START (Marker, OpCode);
- Status = BootScriptWritePciConfig2Poll (Marker);
- VA_END (Marker);
- break;
-
- default:
- Status = EFI_INVALID_PARAMETER;
- break;
+ case EFI_BOOT_SCRIPT_IO_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfgWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfgReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteSmbusExecute (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_STALL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteStall (Marker);
+ VA_END (Marker);
+
+ break;
+
+ case EFI_BOOT_SCRIPT_DISPATCH_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteDispatch (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteDispatch2 (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_INFORMATION_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteInformation (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_MEM_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteMemPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfg2Write (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciCfg2ReadWrite (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_IO_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWriteIoPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciConfigPoll (Marker);
+ VA_END (Marker);
+ break;
+
+ case EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE:
+ VA_START (Marker, OpCode);
+ Status = BootScriptWritePciConfig2Poll (Marker);
+ VA_END (Marker);
+ break;
+
+ default:
+ Status = EFI_INVALID_PARAMETER;
+ break;
}
if (!EFI_ERROR (Status)) {
- Status = S3BootScriptMoveLastOpcode (BeforeOrAfter, (VOID **)Position);
+ Status = S3BootScriptMoveLastOpcode (BeforeOrAfter, (VOID **)Position);
}
+
return Status;
}
+
/**
Find a label within the boot script table and, if not present, optionally create it.
@@ -842,15 +853,16 @@ 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
)
{
return S3BootScriptLabel (BeforeOrAfter, CreateIfNotFound, (VOID **)Position, Label);
}
+
/**
Compare two positions in the boot script table and return their relative position.
@@ -871,14 +883,15 @@ 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
)
{
return S3BootScriptCompare (Position1, Position2, RelativePosition);
}
+
/**
This routine is entry point of ScriptSave driver.
@@ -893,21 +906,21 @@ BootScriptCompare ( EFI_STATUS
EFIAPI
InitializeSmmS3SaveState (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_HANDLE Handle;
+ EFI_HANDLE Handle;
if (!PcdGetBool (PcdAcpiS3Enable)) {
return EFI_UNSUPPORTED;
}
- Handle = NULL;
- return gSmst->SmmInstallProtocolInterface (
- &Handle,
- &gEfiS3SmmSaveStateProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mS3SmmSaveState
- );
+ Handle = NULL;
+ return gSmst->SmmInstallProtocolInterface (
+ &Handle,
+ &gEfiS3SmmSaveStateProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mS3SmmSaveState
+ );
}
|