VirtualBox

Ignore:
Timestamp:
Oct 28, 2015 8:17:18 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
103761
Message:

EFI/Firmware: 'svn merge /vendor/edk2/UDK2010.SR1 /vendor/edk2/current .', reverting and removing files+dirs listed in ReadMe.vbox, resolving conflicts with help from ../UDK2014.SP1/. This is a raw untested merge.

Location:
trunk/src/VBox/Devices/EFI/Firmware
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware

  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf

    r48674 r58459  
    22#  Sample ACPI Platform Driver
    33#
    4 #  Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
    55#  This program and the accompanying materials
    66#  are licensed and made available under the terms and conditions of the BSD License
     
    1616  INF_VERSION                    = 0x00010005
    1717  BASE_NAME                      = AcpiPlatform
     18  MODULE_UNI_FILE                = AcpiPlatform.uni
    1819  FILE_GUID                      = cb933912-df8f-4305-b1f9-7b44fa11395c
    1920  MODULE_TYPE                    = DXE_DRIVER
     
    4445
    4546[Protocols]
    46   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
     47  gEfiAcpiTableProtocolGuid                     ## CONSUMES
    4748
    4849[Pcd]
    49   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile
     50  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile    ## CONSUMES
    5051
    5152[Depex]
    5253  gEfiAcpiTableProtocolGuid
    5354
     55[UserExtensions.TianoCore."ExtraFiles"]
     56  AcpiPlatformExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c

    r48674 r58459  
    22  ACPI Sdt Protocol Driver
    33
    4   Copyright (c) 2010, Intel Corporation. All rights reserved. <BR>
     4  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved. <BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    853853  EFI_STATUS          Status;
    854854
     855  Buffer = NULL;
    855856  AmlHandle = (EFI_AML_HANDLE *)HandleIn;
    856857
     
    913914  VOID                *Buffer;
    914915
     916  Buffer = NULL;
    915917  AmlHandle = (EFI_AML_HANDLE *)HandleIn;
    916918
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h

    r48674 r58459  
    22  ACPI Table Protocol Driver
    33
    4   Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    106106//
    107107#define EFI_ACPI_MAX_NUM_TABLES 20
    108 
    109 //
    110 // ACPI table information used to initialize tables.
    111 //
    112 #define EFI_ACPI_OEM_ID           "INTEL "
    113 #define EFI_ACPI_OEM_TABLE_ID     SIGNATURE_64('E', 'D', 'K', '2', ' ', ' ', ' ', ' ')
    114 #define EFI_ACPI_OEM_REVISION     0x00000002
    115 #define EFI_ACPI_CREATOR_ID       0x20202020
    116 #define EFI_ACPI_CREATOR_REVISION 0x01000013
    117108
    118109//
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf

    r48674 r58459  
    22#  ACPI Table Protocol Driver
    33#
    4 #  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55#  This program and the accompanying materials are
    66#  licensed and made available under the terms and conditions of the BSD License
     
    1616  INF_VERSION                    = 0x00010005
    1717  BASE_NAME                      = AcpiTableDxe
     18  MODULE_UNI_FILE                = AcpiTableDxe.uni
    1819  FILE_GUID                      = 9622E42C-8E38-4a08-9E8F-54F784652F6B
    1920  MODULE_TYPE                    = DXE_DRIVER
     
    5556
    5657[Guids]
    57   gEfiAcpi10TableGuid                           # ALWAYS_CONSUMED
    58   gEfiAcpiTableGuid
     58  gEfiAcpi10TableGuid                           ## PRODUCES ## SystemTable
     59  gEfiAcpiTableGuid                             ## PRODUCES ## SystemTable
    5960
    6061[FeaturePcd]
    61   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol
     62  gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol  ## CONSUMES
     63
     64[Pcd]
     65  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId            ## CONSUMES
     66  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId       ## CONSUMES
     67  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision      ## CONSUMES
     68  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId        ## CONSUMES
     69  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision  ## CONSUMES
    6270
    6371[Protocols]
    64   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_PRODUCED
    65   gEfiAcpiSdtProtocolGuid                       # PROTOCOL ALWAYS_PRODUCED
    66   gEfiDxeSmmReadyToLockProtocolGuid             # PROTOCOL ALWAYS_CONSUMED
     72  gEfiAcpiTableProtocolGuid                     ## PRODUCES
     73  gEfiAcpiSdtProtocolGuid                       ## PRODUCES
     74  ## NOTIFY
     75  ## SOMETIMES_CONSUMES
     76  gEfiDxeSmmReadyToLockProtocolGuid
    6777
    6878[Depex]
    6979  TRUE
    7080
     81[UserExtensions.TianoCore."ExtraFiles"]
     82  AcpiTableDxeExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c

    r48674 r58459  
    22  ACPI Table Protocol Implementation
    33
    4   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    9898// Protocol function implementations.
    9999//
    100 
    101 /**
    102   This function adds, removes, or updates ACPI tables.  If the address is not
    103   null and the handle value is null, the table is added.  If both the address and
    104   handle are not null, the table at handle is updated with the table at address.
    105   If the address is null and the handle is not, the table at handle is deleted.
    106 
    107   @param  AcpiTableInstance  Instance of the protocol.
    108   @param  Table              Pointer to a table.
    109   @param  Checksum           Boolean indicating if the checksum should be calculated.
    110   @param  Version            Version(s) to set.
    111   @param  Handle             Handle of the table.
    112 
    113   @return EFI_SUCCESS             The function completed successfully.
    114   @return EFI_INVALID_PARAMETER   Both the Table and *Handle were NULL.
    115   @return EFI_ABORTED             Could not complete the desired request.
    116 
    117 **/
    118 EFI_STATUS
    119 EFIAPI
    120 SetAcpiTable (
    121   IN EFI_ACPI_TABLE_INSTANCE              *AcpiTableInstance,
    122   IN VOID                                 *Table OPTIONAL,
    123   IN BOOLEAN                              Checksum,
    124   IN EFI_ACPI_TABLE_VERSION               Version,
    125   IN OUT UINTN                            *Handle
    126   )
    127 {
    128   UINTN                     SavedHandle;
    129   EFI_STATUS                Status;
    130 
    131   //
    132   // Check for invalid input parameters
    133   //
    134   ASSERT (Handle);
    135 
    136   //
    137   // Initialize locals
    138   //
    139   //
    140   // Determine desired action
    141   //
    142   if (*Handle == 0) {
    143     if (Table == NULL) {
    144       //
    145       // Invalid parameter combination
    146       //
    147       return EFI_INVALID_PARAMETER;
    148     } else {
    149       //
    150       // Add table
    151       //
    152       Status = AddTableToList (AcpiTableInstance, Table, Checksum, Version, Handle);
    153     }
    154   } else {
    155     if (Table != NULL) {
    156       //
    157       // Update table
    158       //
    159       //
    160       // Delete the table list entry
    161       //
    162       Status = RemoveTableFromList (AcpiTableInstance, Version, *Handle);
    163       if (EFI_ERROR (Status)) {
    164         //
    165         // Should not get an error here ever, but abort if we do.
    166         //
    167         return EFI_ABORTED;
    168       }
    169       //
    170       // Set the handle to replace the table at the same handle
    171       //
    172       SavedHandle                         = AcpiTableInstance->CurrentHandle;
    173       AcpiTableInstance->CurrentHandle  = *Handle;
    174 
    175       //
    176       // Add the table
    177       //
    178       Status = AddTableToList (AcpiTableInstance, Table, Checksum, Version, Handle);
    179 
    180       //
    181       // Restore the saved current handle
    182       //
    183       AcpiTableInstance->CurrentHandle = SavedHandle;
    184     } else {
    185       //
    186       // Delete table
    187       //
    188       Status = RemoveTableFromList (AcpiTableInstance, Version, *Handle);
    189     }
    190   }
    191 
    192   if (EFI_ERROR (Status)) {
    193     //
    194     // Should not get an error here ever, but abort if we do.
    195     //
    196     return EFI_ABORTED;
    197   }
    198   //
    199   // Done
    200   //
    201   return EFI_SUCCESS;
    202 }
    203100
    204101/**
     
    304201                                 are not in sync.
    305202  @return EFI_OUT_OF_RESOURCES   Insufficient resources exist to complete the request.
     203  @retval EFI_ACCESS_DENIED      The table signature matches a table already
     204                                 present in the system and platform policy
     205                                 does not allow duplicate tables of this type.
    306206
    307207**/
     
    337237  AcpiTableBufferConst = AllocateCopyPool (AcpiTableBufferSize,AcpiTableBuffer);
    338238  *TableKey = 0;
    339   Status = SetAcpiTable (
     239  Status = AddTableToList (
    340240             AcpiTableInstance,
    341241             AcpiTableBufferConst,
     
    397297  // Uninstall the ACPI table
    398298  //
    399   Status = SetAcpiTable (
     299  Status = RemoveTableFromList (
    400300             AcpiTableInstance,
    401              NULL,
    402              FALSE,
    403301             EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0,
    404              &TableKey
     302             TableKey
    405303             );
    406304  if (!EFI_ERROR (Status)) {
     
    529427  @return EFI_SUCCESS               The function completed successfully.
    530428  @return EFI_OUT_OF_RESOURCES      Could not allocate a required resource.
    531   @return EFI_ABORTED               The table is a duplicate of a table that is required
    532                                     to be unique.
     429  @retval EFI_ACCESS_DENIED         The table signature matches a table already
     430                                    present in the system and platform policy
     431                                    does not allow duplicate tables of this type.
    533432
    534433**/
     
    666565      gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);
    667566      gBS->FreePool (CurrentTableList);
    668       return EFI_ABORTED;
     567      return EFI_ACCESS_DENIED;
    669568    }
    670569    //
     
    718617      //
    719618      // Update pointers in FADT.  If tables don't exist this will put NULL pointers there.
    720       //
    721       AcpiTableInstance->Fadt3->FirmwareCtrl  = (UINT32) (UINTN) AcpiTableInstance->Facs3;
    722       Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Facs3;
    723       CopyMem (
    724         &AcpiTableInstance->Fadt3->XFirmwareCtrl,
    725         &Buffer64,
    726         sizeof (UINT64)
    727         );
     619      // Note: If the FIRMWARE_CTRL is non-zero, then X_FIRMWARE_CTRL must be zero, and
     620      // vice-versa.
     621      //
     622      if ((UINT64)(UINTN)AcpiTableInstance->Facs3 < BASE_4GB) {
     623        AcpiTableInstance->Fadt3->FirmwareCtrl  = (UINT32) (UINTN) AcpiTableInstance->Facs3;
     624      } else {
     625        Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Facs3;
     626        CopyMem (
     627          &AcpiTableInstance->Fadt3->XFirmwareCtrl,
     628          &Buffer64,
     629          sizeof (UINT64)
     630          );
     631      }
    728632      AcpiTableInstance->Fadt3->Dsdt  = (UINT32) (UINTN) AcpiTableInstance->Dsdt3;
    729633      Buffer64                          = (UINT64) (UINTN) AcpiTableInstance->Dsdt3;
     
    796700      gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);
    797701      gBS->FreePool (CurrentTableList);
    798       return EFI_ABORTED;
     702      return EFI_ACCESS_DENIED;
    799703    }
    800704    //
     
    841745      //
    842746      if (AcpiTableInstance->Fadt3 != NULL) {
    843         AcpiTableInstance->Fadt3->FirmwareCtrl  = (UINT32) (UINTN) AcpiTableInstance->Facs3;
    844         Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Facs3;
    845         CopyMem (
    846           &AcpiTableInstance->Fadt3->XFirmwareCtrl,
    847           &Buffer64,
    848           sizeof (UINT64)
    849           );
     747        //
     748        // Note: If the FIRMWARE_CTRL is non-zero, then X_FIRMWARE_CTRL must be zero, and
     749        // vice-versa.
     750        //
     751        if ((UINT64)(UINTN)AcpiTableInstance->Facs3 < BASE_4GB) {
     752          AcpiTableInstance->Fadt3->FirmwareCtrl  = (UINT32) (UINTN) AcpiTableInstance->Facs3;
     753        } else {
     754          Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Facs3;
     755          CopyMem (
     756            &AcpiTableInstance->Fadt3->XFirmwareCtrl,
     757            &Buffer64,
     758            sizeof (UINT64)
     759            );
     760        }
    850761
    851762        //
     
    873784      gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);
    874785      gBS->FreePool (CurrentTableList);
    875       return EFI_ABORTED;
     786      return EFI_ACCESS_DENIED;
    876787    }
    877788    //
     
    17841695  CurrentData = EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE;
    17851696  CopyMem (&AcpiTableInstance->Rsdp1->Signature, &CurrentData, sizeof (UINT64));
    1786   CopyMem (AcpiTableInstance->Rsdp1->OemId, EFI_ACPI_OEM_ID, 6);
     1697  CopyMem (AcpiTableInstance->Rsdp1->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (AcpiTableInstance->Rsdp1->OemId));
    17871698  AcpiTableInstance->Rsdp1->Reserved    = EFI_ACPI_RESERVED_BYTE;
    17881699  AcpiTableInstance->Rsdp1->RsdtAddress = (UINT32) (UINTN) AcpiTableInstance->Rsdt1;
     
    17901701  CurrentData = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE;
    17911702  CopyMem (&AcpiTableInstance->Rsdp3->Signature, &CurrentData, sizeof (UINT64));
    1792   CopyMem (AcpiTableInstance->Rsdp3->OemId, EFI_ACPI_OEM_ID, 6);
     1703  CopyMem (AcpiTableInstance->Rsdp3->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (AcpiTableInstance->Rsdp3->OemId));
    17931704  AcpiTableInstance->Rsdp3->Revision    = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION;
    17941705  AcpiTableInstance->Rsdp3->RsdtAddress = (UINT32) (UINTN) AcpiTableInstance->Rsdt3;
     
    18081719  AcpiTableInstance->Rsdt1->Length    = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
    18091720  AcpiTableInstance->Rsdt1->Revision  = EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION;
    1810   CopyMem (AcpiTableInstance->Rsdt1->OemId, EFI_ACPI_OEM_ID, 6);
    1811   CurrentData = EFI_ACPI_OEM_TABLE_ID;
     1721  CopyMem (AcpiTableInstance->Rsdt1->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (AcpiTableInstance->Rsdt1->OemId));
     1722  CurrentData = PcdGet64 (PcdAcpiDefaultOemTableId);
    18121723  CopyMem (&AcpiTableInstance->Rsdt1->OemTableId, &CurrentData, sizeof (UINT64));
    1813   AcpiTableInstance->Rsdt1->OemRevision     = EFI_ACPI_OEM_REVISION;
    1814   AcpiTableInstance->Rsdt1->CreatorId       = EFI_ACPI_CREATOR_ID;
    1815   AcpiTableInstance->Rsdt1->CreatorRevision = EFI_ACPI_CREATOR_REVISION;
     1724  AcpiTableInstance->Rsdt1->OemRevision     = PcdGet32 (PcdAcpiDefaultOemRevision);
     1725  AcpiTableInstance->Rsdt1->CreatorId       = PcdGet32 (PcdAcpiDefaultCreatorId);
     1726  AcpiTableInstance->Rsdt1->CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
    18161727  //
    18171728  // We always reserve first one for FADT
     
    18231734  AcpiTableInstance->Rsdt3->Length          = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
    18241735  AcpiTableInstance->Rsdt3->Revision        = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION;
    1825   CopyMem (AcpiTableInstance->Rsdt3->OemId, EFI_ACPI_OEM_ID, 6);
    1826   CurrentData = EFI_ACPI_OEM_TABLE_ID;
     1736  CopyMem (AcpiTableInstance->Rsdt3->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (AcpiTableInstance->Rsdt3->OemId));
     1737  CurrentData = PcdGet64 (PcdAcpiDefaultOemTableId);
    18271738  CopyMem (&AcpiTableInstance->Rsdt3->OemTableId, &CurrentData, sizeof (UINT64));
    1828   AcpiTableInstance->Rsdt3->OemRevision     = EFI_ACPI_OEM_REVISION;
    1829   AcpiTableInstance->Rsdt3->CreatorId       = EFI_ACPI_CREATOR_ID;
    1830   AcpiTableInstance->Rsdt3->CreatorRevision = EFI_ACPI_CREATOR_REVISION;
     1739  AcpiTableInstance->Rsdt3->OemRevision     = PcdGet32 (PcdAcpiDefaultOemRevision);
     1740  AcpiTableInstance->Rsdt3->CreatorId       = PcdGet32 (PcdAcpiDefaultCreatorId);
     1741  AcpiTableInstance->Rsdt3->CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
    18311742  //
    18321743  // We always reserve first one for FADT
     
    18411752  AcpiTableInstance->Xsdt->Length     = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
    18421753  AcpiTableInstance->Xsdt->Revision   = EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION;
    1843   CopyMem (AcpiTableInstance->Xsdt->OemId, EFI_ACPI_OEM_ID, 6);
    1844   CurrentData = EFI_ACPI_OEM_TABLE_ID;
     1754  CopyMem (AcpiTableInstance->Xsdt->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (AcpiTableInstance->Xsdt->OemId));
     1755  CurrentData = PcdGet64 (PcdAcpiDefaultOemTableId);
    18451756  CopyMem (&AcpiTableInstance->Xsdt->OemTableId, &CurrentData, sizeof (UINT64));
    1846   AcpiTableInstance->Xsdt->OemRevision      = EFI_ACPI_OEM_REVISION;
    1847   AcpiTableInstance->Xsdt->CreatorId        = EFI_ACPI_CREATOR_ID;
    1848   AcpiTableInstance->Xsdt->CreatorRevision  = EFI_ACPI_CREATOR_REVISION;
     1757  AcpiTableInstance->Xsdt->OemRevision      = PcdGet32 (PcdAcpiDefaultOemRevision);
     1758  AcpiTableInstance->Xsdt->CreatorId        = PcdGet32 (PcdAcpiDefaultCreatorId);
     1759  AcpiTableInstance->Xsdt->CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);
    18491760  //
    18501761  // We always reserve first one for FADT
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/AcpiTableDxe/Aml.c

    r48674 r58459  
    22  ACPI Sdt Protocol Driver
    33
    4   Copyright (c) 2010, Intel Corporation. All rights reserved. <BR>
     4  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved. <BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    1818AML_BYTE_ENCODING mAmlByteEncoding[] = {
    1919  //                             OpCode                      SubOpCode              Num 1           2           3           4           5           6           Attribute
    20 /* ZeroOp - 0x00 */              {AML_ZERO_OP,               0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    21 /* OneOp  - 0x01 */              {AML_ONE_OP,                0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    22 /* AliasOp - 0x06 */             {AML_ALIAS_OP,              0,                      2, AML_NAME,   AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IN_NAMESPACE},
    23 /* NameOp - 0x08 */              {AML_NAME_OP,               0,                      2, AML_NAME,   AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IN_NAMESPACE},
    24 /* BytePrefix - 0x0A */          {AML_BYTE_PREFIX,           0,                      1, AML_UINT8,  AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    25 /* WordPrefix - 0x0B */          {AML_WORD_PREFIX,           0,                      1, AML_UINT16, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    26 /* DWordPrefix - 0x0C */         {AML_DWORD_PREFIX,          0,                      1, AML_UINT32, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    27 /* StringPrefix - 0x0D */        {AML_STRING_PREFIX,         0,                      1, AML_STRING, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    28 /* QWordPrefix - 0x0E */         {AML_QWORD_PREFIX,          0,                      1, AML_UINT64, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    29 /* 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},
    30 /* BufferOp - 0x11 */            {AML_BUFFER_OP,             0,                      1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_HAS_PKG_LENGTH},
    31 /* 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},
    32 /* 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},
    33 /* 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},
    34 /* DualNamePrefix - 0x2F */      {AML_DUAL_NAME_PREFIX,      0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    35 /* MultiNamePrefix - 0x2F */     {AML_MULTI_NAME_PREFIX,     0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    36 /* NameChar - 0x41 */            {'A',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    37 /* NameChar - 0x42 */            {'B',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    38 /* NameChar - 0x43 */            {'C',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    39 /* NameChar - 0x44 */            {'D',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    40 /* NameChar - 0x45 */            {'E',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    41 /* NameChar - 0x46 */            {'F',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    42 /* NameChar - 0x47 */            {'G',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    43 /* NameChar - 0x48 */            {'H',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    44 /* NameChar - 0x49 */            {'I',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    45 /* NameChar - 0x4A */            {'J',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    46 /* NameChar - 0x4B */            {'K',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    47 /* NameChar - 0x4C */            {'L',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    48 /* NameChar - 0x4D */            {'M',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    49 /* NameChar - 0x4E */            {'N',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    50 /* NameChar - 0x4F */            {'O',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    51 /* NameChar - 0x50 */            {'P',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    52 /* NameChar - 0x51 */            {'Q',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    53 /* NameChar - 0x52 */            {'R',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    54 /* NameChar - 0x53 */            {'S',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    55 /* NameChar - 0x54 */            {'T',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    56 /* NameChar - 0x55 */            {'U',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    57 /* NameChar - 0x56 */            {'V',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    58 /* NameChar - 0x57 */            {'W',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    59 /* NameChar - 0x58 */            {'X',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    60 /* NameChar - 0x59 */            {'Y',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    61 /* NameChar - 0x5A */            {'Z',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    62 /* 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},
    63 /* 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},
    64 /* 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},
    65 /* 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},
    66 /* 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},
    67 /* LoadOp - 0x5B 0x20 */         {AML_EXT_OP,                AML_EXT_LOAD_OP,        2, AML_NAME,   AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    68 /* StallOp - 0x5B 0x21 */        {AML_EXT_OP,                AML_EXT_STALL_OP,       1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    69 /* SleepOp - 0x5B 0x22 */        {AML_EXT_OP,                AML_EXT_SLEEP_OP,       1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    70 /* AcquireOp - 0x5B 0x23 */      {AML_EXT_OP,                AML_EXT_ACQUIRE_OP,     2, AML_OBJECT, AML_UINT16, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    71 /* SignalOp - 0x5B 0x24 */       {AML_EXT_OP,                AML_EXT_SIGNAL_OP,      1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    72 /* WaitOp - 0x5B 0x25 */         {AML_EXT_OP,                AML_EXT_WAIT_OP,        2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    73 /* ResetOp - 0x5B 0x26 */        {AML_EXT_OP,                AML_EXT_RESET_OP,       1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    74 /* ReleaseOp - 0x5B 0x27 */      {AML_EXT_OP,                AML_EXT_RELEASE_OP,     1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    75 /* 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},
    76 /* 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},
    77 /* UnloadOp - 0x5B 0x2A */       {AML_EXT_OP,                AML_EXT_UNLOAD_OP,      1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    78 /* RevisionOp - 0x5B 0x30 */     {AML_EXT_OP,                AML_EXT_REVISION_OP,    0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    79 /* DebugOp - 0x5B 0x31 */        {AML_EXT_OP,                AML_EXT_DEBUG_OP,       0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    80 /* FatalOp - 0x5B 0x32 */        {AML_EXT_OP,                AML_EXT_FATAL_OP,       3, AML_UINT8,  AML_UINT32, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    81 /* TimerOp - 0x5B 0x33 */        {AML_EXT_OP,                AML_EXT_TIMER_OP,       0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    82 /* 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},
    83 /* 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},
    84 /* 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},
    85 /* 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},
    86 /* 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},
    87 /* 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},
    88 /* 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},
    89 /* 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},
    90 /* 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},
    91 /* RootChar - 0x5C */            {AML_ROOT_CHAR,             0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    92 /* ParentPrefixChar - 0x5E */    {AML_PARENT_PREFIX_CHAR,    0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    93 /* NameChar - 0x5F */            {'_',                       0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_IS_NAME_CHAR},
    94 /* Local0Op - 0x60 */            {AML_LOCAL0,                0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    95 /* Local1Op - 0x61 */            {AML_LOCAL1,                0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    96 /* Local2Op - 0x62 */            {AML_LOCAL2,                0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    97 /* Local3Op - 0x63 */            {AML_LOCAL3,                0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    98 /* Local4Op - 0x64 */            {AML_LOCAL4,                0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    99 /* Local5Op - 0x65 */            {AML_LOCAL5,                0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    100 /* Local6Op - 0x66 */            {AML_LOCAL6,                0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    101 /* Local7Op - 0x67 */            {AML_LOCAL7,                0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    102 /* Arg0Op - 0x68 */              {AML_ARG0,                  0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    103 /* Arg1Op - 0x69 */              {AML_ARG1,                  0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    104 /* Arg2Op - 0x6A */              {AML_ARG2,                  0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    105 /* Arg3Op - 0x6B */              {AML_ARG3,                  0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    106 /* Arg4Op - 0x6C */              {AML_ARG4,                  0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    107 /* Arg5Op - 0x6D */              {AML_ARG5,                  0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    108 /* Arg6Op - 0x6E */              {AML_ARG6,                  0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    109 /* StoreOp - 0x70 */             {AML_STORE_OP,              0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    110 /* RefOfOp - 0x71 */             {AML_REF_OF_OP,             0,                      1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    111 /* AddOp - 0x72 */               {AML_ADD_OP,                0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    112 /* ConcatOp - 0x73 */            {AML_CONCAT_OP,             0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    113 /* SubtractOp - 0x74 */          {AML_SUBTRACT_OP,           0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    114 /* IncrementOp - 0x75 */         {AML_INCREMENT_OP,          0,                      1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    115 /* DecrementOp - 0x76 */         {AML_DECREMENT_OP,          0,                      1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    116 /* MultiplyOp - 0x77 */          {AML_MULTIPLY_OP,           0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    117 /* DivideOp - 0x78 */            {AML_DIVIDE_OP,             0,                      4, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   0},
    118 /* ShiftLeftOp - 0x79 */         {AML_SHIFT_LEFT_OP,         0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    119 /* ShiftRightOp - 0x7A */        {AML_SHIFT_RIGHT_OP,        0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    120 /* AndOp - 0x7B */               {AML_AND_OP,                0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    121 /* NAndOp - 0x7C */              {AML_NAND_OP,               0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    122 /* OrOp - 0x7D */                {AML_OR_OP,                 0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    123 /* NorOp - 0x7E */               {AML_NOR_OP,                0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    124 /* XOrOp - 0x7F */               {AML_XOR_OP,                0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    125 /* NotOp - 0x80 */               {AML_NOT_OP,                0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    126 /* FindSetLeftBitOp - 0x81 */    {AML_FIND_SET_LEFT_BIT_OP,  0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    127 /* FindSetRightBitOp - 0x82 */   {AML_FIND_SET_RIGHT_BIT_OP, 0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    128 /* DerefOfOp - 0x83 */           {AML_DEREF_OF_OP,           0,                      1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    129 /* ConcatResOp - 0x84 */         {AML_CONCAT_RES_OP,         0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    130 /* ModOp - 0x85 */               {AML_MOD_OP,                0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    131 /* NotifyOp - 0x86 */            {AML_NOTIFY_OP,             0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    132 /* SizeOfOp - 0x87 */            {AML_SIZE_OF_OP,            0,                      1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    133 /* IndexOp - 0x88 */             {AML_INDEX_OP,              0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    134 /* MatchOp - 0x89 */             {AML_MATCH_OP,              0,                      6, AML_OBJECT, AML_UINT8,  AML_OBJECT, AML_UINT8,  AML_OBJECT, AML_OBJECT, 0},
    135 /* CreateDWordFieldOp - 0x8A */  {AML_CREATE_DWORD_FIELD_OP, 0,                      3, AML_OBJECT, AML_OBJECT, AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    136 /* CreateWordFieldOp - 0x8B */   {AML_CREATE_WORD_FIELD_OP,  0,                      3, AML_OBJECT, AML_OBJECT, AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    137 /* CreateByteFieldOp - 0x8C */   {AML_CREATE_BYTE_FIELD_OP,  0,                      3, AML_OBJECT, AML_OBJECT, AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    138 /* CreateBitFieldOp - 0x8D */    {AML_CREATE_BIT_FIELD_OP,   0,                      3, AML_OBJECT, AML_OBJECT, AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    139 /* ObjectTypeOp - 0x8E */        {AML_OBJECT_TYPE_OP,        0,                      1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    140 /* CreateQWordFieldOp - 0x8F */  {AML_CREATE_QWORD_FIELD_OP, 0,                      3, AML_OBJECT, AML_OBJECT, AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    141 /* LAndOp - 0x90 */              {AML_LAND_OP,               0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    142 /* LOrOp - 0x91 */               {AML_LOR_OP,                0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    143 /* LNotOp - 0x92 */              {AML_LNOT_OP,               0,                      1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    144 /* LEqualOp - 0x93 */            {AML_LEQUAL_OP,             0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    145 /* LGreaterOp - 0x94 */          {AML_LGREATER_OP,           0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    146 /* LLessOp - 0x95 */             {AML_LLESS_OP,              0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    147 /* ToBufferOp - 0x96 */          {AML_TO_BUFFER_OP,          0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    148 /* ToDecimalStringOp - 0x97 */   {AML_TO_DEC_STRING_OP,      0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    149 /* ToHexStringOp - 0x98 */       {AML_TO_HEX_STRING_OP,      0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    150 /* ToIntegerOp - 0x99 */         {AML_TO_INTEGER_OP,         0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    151 /* ToStringOp - 0x9C */          {AML_TO_STRING_OP,          0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    152 /* CopyObjectOp - 0x9D */        {AML_COPY_OBJECT_OP,        0,                      2, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    153 /* MidOp - 0x9E */               {AML_MID_OP,                0,                      3, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   0},
    154 /* ContinueOp - 0x9F */          {AML_CONTINUE_OP,           0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    155 /* 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},
    156 /* 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},
    157 /* 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},
    158 /* NoopOp - 0xA3 */              {AML_NOOP_OP,               0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    159 /* ReturnOp - 0xA4 */            {AML_RETURN_OP,             0,                      1, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    160 /* BreakOp - 0xA5 */             {AML_BREAK_OP,              0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    161 /* BreakPointOp - 0xCC */        {AML_BREAK_POINT_OP,        0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
    162 /* OnesOp - 0xFF */              {AML_ONES_OP,               0,                      0, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   0},
     20/* ZeroOp - 0x00 */              {AML_ZERO_OP,               0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     21/* OneOp  - 0x01 */              {AML_ONE_OP,                0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     22/* AliasOp - 0x06 */             {AML_ALIAS_OP,              0,                      2, {AML_NAME,   AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IN_NAMESPACE},
     23/* NameOp - 0x08 */              {AML_NAME_OP,               0,                      2, {AML_NAME,   AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IN_NAMESPACE},
     24/* BytePrefix - 0x0A */          {AML_BYTE_PREFIX,           0,                      1, {AML_UINT8,  AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     25/* WordPrefix - 0x0B */          {AML_WORD_PREFIX,           0,                      1, {AML_UINT16, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     26/* DWordPrefix - 0x0C */         {AML_DWORD_PREFIX,          0,                      1, {AML_UINT32, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     27/* StringPrefix - 0x0D */        {AML_STRING_PREFIX,         0,                      1, {AML_STRING, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     28/* QWordPrefix - 0x0E */         {AML_QWORD_PREFIX,          0,                      1, {AML_UINT64, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     29/* 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},
     30/* BufferOp - 0x11 */            {AML_BUFFER_OP,             0,                      1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_HAS_PKG_LENGTH},
     31/* 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},
     32/* 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},
     33/* 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},
     34/* DualNamePrefix - 0x2F */      {AML_DUAL_NAME_PREFIX,      0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     35/* MultiNamePrefix - 0x2F */     {AML_MULTI_NAME_PREFIX,     0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     36/* NameChar - 0x41 */            {'A',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     37/* NameChar - 0x42 */            {'B',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     38/* NameChar - 0x43 */            {'C',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     39/* NameChar - 0x44 */            {'D',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     40/* NameChar - 0x45 */            {'E',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     41/* NameChar - 0x46 */            {'F',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     42/* NameChar - 0x47 */            {'G',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     43/* NameChar - 0x48 */            {'H',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     44/* NameChar - 0x49 */            {'I',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     45/* NameChar - 0x4A */            {'J',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     46/* NameChar - 0x4B */            {'K',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     47/* NameChar - 0x4C */            {'L',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     48/* NameChar - 0x4D */            {'M',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     49/* NameChar - 0x4E */            {'N',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     50/* NameChar - 0x4F */            {'O',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     51/* NameChar - 0x50 */            {'P',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     52/* NameChar - 0x51 */            {'Q',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     53/* NameChar - 0x52 */            {'R',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     54/* NameChar - 0x53 */            {'S',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     55/* NameChar - 0x54 */            {'T',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     56/* NameChar - 0x55 */            {'U',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     57/* NameChar - 0x56 */            {'V',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     58/* NameChar - 0x57 */            {'W',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     59/* NameChar - 0x58 */            {'X',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     60/* NameChar - 0x59 */            {'Y',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     61/* NameChar - 0x5A */            {'Z',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     62/* 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},
     63/* 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},
     64/* 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},
     65/* 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},
     66/* 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},
     67/* LoadOp - 0x5B 0x20 */         {AML_EXT_OP,                AML_EXT_LOAD_OP,        2, {AML_NAME,   AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     68/* StallOp - 0x5B 0x21 */        {AML_EXT_OP,                AML_EXT_STALL_OP,       1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     69/* SleepOp - 0x5B 0x22 */        {AML_EXT_OP,                AML_EXT_SLEEP_OP,       1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     70/* AcquireOp - 0x5B 0x23 */      {AML_EXT_OP,                AML_EXT_ACQUIRE_OP,     2, {AML_OBJECT, AML_UINT16, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     71/* SignalOp - 0x5B 0x24 */       {AML_EXT_OP,                AML_EXT_SIGNAL_OP,      1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     72/* WaitOp - 0x5B 0x25 */         {AML_EXT_OP,                AML_EXT_WAIT_OP,        2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     73/* ResetOp - 0x5B 0x26 */        {AML_EXT_OP,                AML_EXT_RESET_OP,       1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     74/* ReleaseOp - 0x5B 0x27 */      {AML_EXT_OP,                AML_EXT_RELEASE_OP,     1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     75/* 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},
     76/* 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},
     77/* UnloadOp - 0x5B 0x2A */       {AML_EXT_OP,                AML_EXT_UNLOAD_OP,      1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     78/* RevisionOp - 0x5B 0x30 */     {AML_EXT_OP,                AML_EXT_REVISION_OP,    0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     79/* DebugOp - 0x5B 0x31 */        {AML_EXT_OP,                AML_EXT_DEBUG_OP,       0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     80/* FatalOp - 0x5B 0x32 */        {AML_EXT_OP,                AML_EXT_FATAL_OP,       3, {AML_UINT8,  AML_UINT32, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     81/* TimerOp - 0x5B 0x33 */        {AML_EXT_OP,                AML_EXT_TIMER_OP,       0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     82/* 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},
     83/* 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},
     84/* 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},
     85/* 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},
     86/* 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},
     87/* 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},
     88/* 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},
     89/* 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},
     90/* 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},
     91/* RootChar - 0x5C */            {AML_ROOT_CHAR,             0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     92/* ParentPrefixChar - 0x5E */    {AML_PARENT_PREFIX_CHAR,    0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     93/* NameChar - 0x5F */            {'_',                       0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   AML_IS_NAME_CHAR},
     94/* Local0Op - 0x60 */            {AML_LOCAL0,                0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     95/* Local1Op - 0x61 */            {AML_LOCAL1,                0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     96/* Local2Op - 0x62 */            {AML_LOCAL2,                0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     97/* Local3Op - 0x63 */            {AML_LOCAL3,                0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     98/* Local4Op - 0x64 */            {AML_LOCAL4,                0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     99/* Local5Op - 0x65 */            {AML_LOCAL5,                0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     100/* Local6Op - 0x66 */            {AML_LOCAL6,                0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     101/* Local7Op - 0x67 */            {AML_LOCAL7,                0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     102/* Arg0Op - 0x68 */              {AML_ARG0,                  0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     103/* Arg1Op - 0x69 */              {AML_ARG1,                  0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     104/* Arg2Op - 0x6A */              {AML_ARG2,                  0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     105/* Arg3Op - 0x6B */              {AML_ARG3,                  0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     106/* Arg4Op - 0x6C */              {AML_ARG4,                  0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     107/* Arg5Op - 0x6D */              {AML_ARG5,                  0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     108/* Arg6Op - 0x6E */              {AML_ARG6,                  0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     109/* StoreOp - 0x70 */             {AML_STORE_OP,              0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     110/* RefOfOp - 0x71 */             {AML_REF_OF_OP,             0,                      1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     111/* AddOp - 0x72 */               {AML_ADD_OP,                0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     112/* ConcatOp - 0x73 */            {AML_CONCAT_OP,             0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     113/* SubtractOp - 0x74 */          {AML_SUBTRACT_OP,           0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     114/* IncrementOp - 0x75 */         {AML_INCREMENT_OP,          0,                      1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     115/* DecrementOp - 0x76 */         {AML_DECREMENT_OP,          0,                      1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     116/* MultiplyOp - 0x77 */          {AML_MULTIPLY_OP,           0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     117/* DivideOp - 0x78 */            {AML_DIVIDE_OP,             0,                      4, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE},   0},
     118/* ShiftLeftOp - 0x79 */         {AML_SHIFT_LEFT_OP,         0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     119/* ShiftRightOp - 0x7A */        {AML_SHIFT_RIGHT_OP,        0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     120/* AndOp - 0x7B */               {AML_AND_OP,                0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     121/* NAndOp - 0x7C */              {AML_NAND_OP,               0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     122/* OrOp - 0x7D */                {AML_OR_OP,                 0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     123/* NorOp - 0x7E */               {AML_NOR_OP,                0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     124/* XOrOp - 0x7F */               {AML_XOR_OP,                0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     125/* NotOp - 0x80 */               {AML_NOT_OP,                0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     126/* FindSetLeftBitOp - 0x81 */    {AML_FIND_SET_LEFT_BIT_OP,  0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     127/* FindSetRightBitOp - 0x82 */   {AML_FIND_SET_RIGHT_BIT_OP, 0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     128/* DerefOfOp - 0x83 */           {AML_DEREF_OF_OP,           0,                      1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     129/* ConcatResOp - 0x84 */         {AML_CONCAT_RES_OP,         0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     130/* ModOp - 0x85 */               {AML_MOD_OP,                0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     131/* NotifyOp - 0x86 */            {AML_NOTIFY_OP,             0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     132/* SizeOfOp - 0x87 */            {AML_SIZE_OF_OP,            0,                      1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     133/* IndexOp - 0x88 */             {AML_INDEX_OP,              0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     134/* MatchOp - 0x89 */             {AML_MATCH_OP,              0,                      6, {AML_OBJECT, AML_UINT8,  AML_OBJECT, AML_UINT8,  AML_OBJECT, AML_OBJECT}, 0},
     135/* CreateDWordFieldOp - 0x8A */  {AML_CREATE_DWORD_FIELD_OP, 0,                      3, {AML_OBJECT, AML_OBJECT, AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     136/* CreateWordFieldOp - 0x8B */   {AML_CREATE_WORD_FIELD_OP,  0,                      3, {AML_OBJECT, AML_OBJECT, AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     137/* CreateByteFieldOp - 0x8C */   {AML_CREATE_BYTE_FIELD_OP,  0,                      3, {AML_OBJECT, AML_OBJECT, AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     138/* CreateBitFieldOp - 0x8D */    {AML_CREATE_BIT_FIELD_OP,   0,                      3, {AML_OBJECT, AML_OBJECT, AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     139/* ObjectTypeOp - 0x8E */        {AML_OBJECT_TYPE_OP,        0,                      1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     140/* CreateQWordFieldOp - 0x8F */  {AML_CREATE_QWORD_FIELD_OP, 0,                      3, {AML_OBJECT, AML_OBJECT, AML_NAME,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     141/* LAndOp - 0x90 */              {AML_LAND_OP,               0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     142/* LOrOp - 0x91 */               {AML_LOR_OP,                0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     143/* LNotOp - 0x92 */              {AML_LNOT_OP,               0,                      1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     144/* LEqualOp - 0x93 */            {AML_LEQUAL_OP,             0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     145/* LGreaterOp - 0x94 */          {AML_LGREATER_OP,           0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     146/* LLessOp - 0x95 */             {AML_LLESS_OP,              0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     147/* ToBufferOp - 0x96 */          {AML_TO_BUFFER_OP,          0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     148/* ToDecimalStringOp - 0x97 */   {AML_TO_DEC_STRING_OP,      0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     149/* ToHexStringOp - 0x98 */       {AML_TO_HEX_STRING_OP,      0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     150/* ToIntegerOp - 0x99 */         {AML_TO_INTEGER_OP,         0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     151/* ToStringOp - 0x9C */          {AML_TO_STRING_OP,          0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     152/* CopyObjectOp - 0x9D */        {AML_COPY_OBJECT_OP,        0,                      2, {AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     153/* MidOp - 0x9E */               {AML_MID_OP,                0,                      3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE},   0},
     154/* ContinueOp - 0x9F */          {AML_CONTINUE_OP,           0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     155/* 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},
     156/* 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},
     157/* 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},
     158/* NoopOp - 0xA3 */              {AML_NOOP_OP,               0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     159/* ReturnOp - 0xA4 */            {AML_RETURN_OP,             0,                      1, {AML_OBJECT, AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     160/* BreakOp - 0xA5 */             {AML_BREAK_OP,              0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     161/* BreakPointOp - 0xCC */        {AML_BREAK_POINT_OP,        0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
     162/* OnesOp - 0xFF */              {AML_ONES_OP,               0,                      0, {AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE,   AML_NONE},   0},
    163163};
    164164
     
    283283  case 2:
    284284    RealLength = *(Buffer + 1);
    285     RealLength |= (*(Buffer + 2)) << 8;
     285    RealLength |= (UINTN)((*(Buffer + 2)) << 8);
    286286    RealLength = (RealLength << 4) | (LeadByte & 0xF);
    287287    break;
    288288  case 3:
    289289    RealLength = *(Buffer + 1);
    290     RealLength |= (*(Buffer + 2)) << 8;
    291     RealLength |= (*(Buffer + 3)) << 16;
     290    RealLength |= (UINTN)((*(Buffer + 2)) << 8);
     291    RealLength |= (UINTN)((*(Buffer + 3)) << 16);
    292292    RealLength = (RealLength << 4) | (LeadByte & 0xF);
    293293    break;
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlChild.c

    r48674 r58459  
    22  ACPI Sdt Protocol Driver
    33
    4   Copyright (c) 2010, Intel Corporation. All rights reserved. <BR>
     4  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved. <BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    190190  UINT8               *CurrentBuffer;
    191191
     192  CurrentBuffer = NULL;
     193
    192194  if ((AmlParentHandle->AmlByteEncoding->Attribute & AML_HAS_CHILD_OBJ) == 0) {
    193195    //
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AmlNamespace.c

    r48674 r58459  
    22  ACPI Sdt Protocol Driver
    33
    4   Copyright (c) 2010, Intel Corporation. All rights reserved. <BR>
     4  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved. <BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    301301  EFI_STATUS          Status;
    302302
     303  CurrentBuffer   = NULL;
     304  AmlChildHandle  = NULL;
    303305  AmlByteEncoding = AmlHandle->AmlByteEncoding;
    304306  Buffer          = AmlHandle->Buffer;
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c

    r48674 r58459  
    22  This module install ACPI Boot Graphics Resource Table (BGRT).
    33
    4   Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
    55  This program and the accompanying materials
    66  are licensed and made available under the terms and conditions of the BSD License
     
    1414#include <Uefi.h>
    1515
    16 #include <IndustryStandard/Acpi50.h>
     16#include <IndustryStandard/Acpi.h>
    1717#include <IndustryStandard/Bmp.h>
    1818
     
    2828#include <Library/UefiBootServicesTableLib.h>
    2929#include <Library/DebugLib.h>
    30 
    31 //
    32 // ACPI table information used to initialize tables.
    33 //
    34 #define EFI_ACPI_OEM_ID           "INTEL"
    35 #define EFI_ACPI_OEM_TABLE_ID     0x2020204F4E414954ULL // "TIANO   "
    36 #define EFI_ACPI_OEM_REVISION     0x00000001
    37 #define EFI_ACPI_CREATOR_ID       0x5446534D            // TBD "MSFT"
    38 #define EFI_ACPI_CREATOR_REVISION 0x01000013            // TBD
     30#include <Library/PcdLib.h>
    3931
    4032//
     
    8274    0x00,  // Checksum will be updated at runtime
    8375    //
    84     // It is expected that these values will be updated at runtime.
    85     //
    86     EFI_ACPI_OEM_ID,            // OEMID is a 6 bytes long field
    87     EFI_ACPI_OEM_TABLE_ID,      // OEM table identification(8 bytes long)
    88     EFI_ACPI_OEM_REVISION,      // OEM revision number
    89     EFI_ACPI_CREATOR_ID,        // ASL compiler vendor ID
    90     EFI_ACPI_CREATOR_REVISION,  // ASL compiler revision number
     76    // It is expected that these values will be updated at EntryPoint.
     77    //
     78    {0x00},     // OEM ID is a 6 bytes long field
     79    0x00,       // OEM Table ID(8 bytes long)
     80    0x00,       // OEM Revision
     81    0x00,       // Creator ID
     82    0x00,       // Creator Revision
    9183  },
    9284  EFI_ACPI_5_0_BGRT_VERSION,         // Version
     
    236228
    237229/**
    238   Allocate EfiReservedMemoryType below 4G memory address.
    239 
    240   This function allocates EfiReservedMemoryType below 4G memory address.
     230  Allocate EfiBootServicesData below 4G memory address.
     231
     232  This function allocates EfiBootServicesData below 4G memory address.
    241233
    242234  @param[in]  Size   Size of memory to allocate.
     
    246238**/
    247239VOID *
    248 BgrtAllocateReservedMemoryBelow4G (
     240BgrtAllocateBsDataMemoryBelow4G (
    249241  IN UINTN       Size
    250242  )
     
    260252  Status = gBS->AllocatePages (
    261253                  AllocateMaxAddress,
    262                   EfiReservedMemoryType,
     254                  EfiBootServicesData,
    263255                  Pages,
    264256                  &Address
     
    362354      return EFI_UNSUPPORTED;
    363355    }
    364    
     356
     357    //
     358    // The image should be stored in EfiBootServicesData, allowing the system to reclaim the memory
     359    //
    365360    BmpSize = (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof (BMP_IMAGE_HEADER);
    366     ImageBuffer = BgrtAllocateReservedMemoryBelow4G (BmpSize);
     361    ImageBuffer = BgrtAllocateBsDataMemoryBelow4G (BmpSize);
    367362    if (ImageBuffer == NULL) {
    368363      return EFI_OUT_OF_RESOURCES;
     
    465460{
    466461  EFI_STATUS  Status;
     462  UINT64      OemTableId;
     463
     464  CopyMem (
     465    mBootGraphicsResourceTableTemplate.Header.OemId,
     466    PcdGetPtr (PcdAcpiDefaultOemId),
     467    sizeof (mBootGraphicsResourceTableTemplate.Header.OemId)
     468    );
     469  OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
     470  CopyMem (&mBootGraphicsResourceTableTemplate.Header.OemTableId, &OemTableId, sizeof (UINT64));
     471  mBootGraphicsResourceTableTemplate.Header.OemRevision      = PcdGet32 (PcdAcpiDefaultOemRevision);
     472  mBootGraphicsResourceTableTemplate.Header.CreatorId        = PcdGet32 (PcdAcpiDefaultCreatorId);
     473  mBootGraphicsResourceTableTemplate.Header.CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);
    467474
    468475  //
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf

    r48674 r58459  
    22#  This module install ACPI Boot Graphics Resource Table (BGRT).
    33#
    4 #  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
     4#  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
    55#  This program and the accompanying materials
    66#  are licensed and made available under the terms and conditions of the BSD License
     
    1616  INF_VERSION                    = 0x00010005
    1717  BASE_NAME                      = BootGraphicsResourceTableDxe
     18  MODULE_UNI_FILE                = BootGraphicsResourceTableDxe.uni
    1819  FILE_GUID                      = B8E62775-BB0A-43f0-A843-5BE8B14F8CCD
    1920  MODULE_TYPE                    = UEFI_DRIVER
     
    4243  UefiBootServicesTableLib
    4344  DebugLib
     45  PcdLib
    4446
    4547[Protocols]
    46   gEfiAcpiTableProtocolGuid                     ## SOMETIMES_CONSUMES
    47   gEfiBootLogoProtocolGuid                      ## SOMETIMES_CONSUMES
     48  gEfiAcpiTableProtocolGuid                     ## CONSUMES
     49  gEfiBootLogoProtocolGuid                      ## PRODUCES
     50
     51[Pcd]
     52  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId            ## CONSUMES
     53  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId       ## CONSUMES
     54  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision      ## CONSUMES
     55  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId        ## CONSUMES
     56  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision  ## CONSUMES
    4857
    4958[Guids]
    50   gEfiEventReadyToBootGuid                      ## CONSUMES
     59  gEfiEventReadyToBootGuid                      ## CONSUMES ## Event
     60
     61[UserExtensions.TianoCore."ExtraFiles"]
     62  BootGraphicsResourceTableDxeExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf

    r48674 r58459  
    55# depends on any PEI or DXE service.
    66#
    7 # Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
     7# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    88#
    99# This program and the accompanying materials are
     
    2020  INF_VERSION                    = 0x00010005
    2121  BASE_NAME                      = BootScriptExecutorDxe
     22  MODULE_UNI_FILE                = BootScriptExecutorDxe.uni
    2223  FILE_GUID                      = FA20568B-548B-4b2b-81EF-1BA08D4A3CEC
    2324  MODULE_TYPE                    = DXE_DRIVER
     
    5152
    5253[LibraryClasses]
    53   TimerLib
    5454  PcdLib
    5555  BaseMemoryLib
    56   SmbusLib
    5756  UefiDriverEntryPoint
    5857  BaseLib
    59   PciLib
    60   IoLib
    6158  S3BootScriptLib
    6259  PeCoffLib
    6360  DxeServicesLib
    6461  UefiBootServicesTableLib
    65   UefiRuntimeServicesTableLib
    6662  CacheMaintenanceLib
    67   PerformanceLib
    6863  UefiLib
    6964  DebugAgentLib
    7065  LockBoxLib
     66  CpuExceptionHandlerLib
     67  DevicePathLib
    7168
    7269[Guids]
    73   gEfiBootScriptExecutorVariableGuid
    74   gEfiBootScriptExecutorContextGuid
    75   gPerformanceProtocolGuid
    76   gEfiEventExitBootServicesGuid
     70  gEfiBootScriptExecutorVariableGuid    ## PRODUCES ## UNDEFINED # SaveLockBox
     71  gEfiBootScriptExecutorContextGuid     ## PRODUCES ## UNDEFINED # SaveLockBox
     72  gEdkiiMemoryProfileGuid               ## SOMETIMES_CONSUMES ## GUID # Locate protocol
     73
     74[Protocols]
     75  ## NOTIFY
     76  ## CONSUMES
     77  gEfiDxeSmmReadyToLockProtocolGuid
    7778
    7879[FeaturePcd]
    79   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
     80  gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode  ## CONSUMES
     81
     82[Pcd]
     83  gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable              ## SOMETIMES_CONSUMES
     84  gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfilePropertyMask   ## CONSUMES
    8085
    8186[Depex]
    8287  gEfiLockBoxProtocolGuid
    8388
     89[UserExtensions.TianoCore."ExtraFiles"]
     90  BootScriptExecutorDxeExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/IA32/SetIdtEntry.c

    r48674 r58459  
    44  Set a IDT entry for interrupt vector 3 for debug purpose for IA32 platform
    55
    6 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
     6Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    77
    88This program and the accompanying materials
     
    1616**/
    1717#include "ScriptExecute.h"
    18 //
    19 // INTERRUPT_GATE_DESCRIPTOR and SetIdtEntry () are used to setup IDT to do debug
    20 //
    2118
    22 #pragma pack(1)
    23 
    24 typedef struct {
    25   UINT16  OffsetLow;
    26   UINT16  SegmentSelector;
    27   UINT16  Attributes;
    28   UINT16  OffsetHigh;
    29 } INTERRUPT_GATE_DESCRIPTOR;
    30 
    31 #define INTERRUPT_GATE_ATTRIBUTE   0x8e00
    32 
    33 #pragma pack()
    3419/**
    3520  Set a IDT entry for interrupt vector 3 for debug purpose.
     
    4328  )
    4429{
    45   INTERRUPT_GATE_DESCRIPTOR                     *IdtEntry;
     30  IA32_IDT_GATE_DESCRIPTOR                      *IdtEntry;
    4631  IA32_DESCRIPTOR                               *IdtDescriptor;
    4732  UINTN                                         S3DebugBuffer;
     33  EFI_STATUS                                    Status;
    4834
    4935  //
     
    5137  //
    5238  IdtDescriptor = (IA32_DESCRIPTOR *) (UINTN) (AcpiS3Context->IdtrProfile);
    53   IdtEntry = (INTERRUPT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (INTERRUPT_GATE_DESCRIPTOR)));
    54   S3DebugBuffer = (UINTN) (AcpiS3Context->S3DebugBufferAddress);
     39  AsmWriteIdtr (IdtDescriptor);
    5540
    56   IdtEntry->OffsetLow       = (UINT16)S3DebugBuffer;
    57   IdtEntry->SegmentSelector = (UINT16)AsmReadCs ();;
    58   IdtEntry->Attributes      = (UINT16)INTERRUPT_GATE_ATTRIBUTE;
    59   IdtEntry->OffsetHigh      = (UINT16)(S3DebugBuffer >> 16);
     41  //
     42  // Setup the default CPU exception handlers
     43  //
     44  Status = InitializeCpuExceptionHandlers (NULL);
     45  ASSERT_EFI_ERROR (Status);
    6046
    61   AsmWriteIdtr (IdtDescriptor);
     47  DEBUG_CODE (
     48    //
     49    // Update IDT entry INT3 if the instruction is valid in it
     50    //
     51    S3DebugBuffer = (UINTN) (AcpiS3Context->S3DebugBufferAddress);
     52    if (*(UINTN *)S3DebugBuffer != (UINTN) -1) {
     53      IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
     54      IdtEntry->Bits.OffsetLow      = (UINT16)S3DebugBuffer;
     55      IdtEntry->Bits.Selector       = (UINT16)AsmReadCs ();
     56      IdtEntry->Bits.Reserved_0     = 0;
     57      IdtEntry->Bits.GateType       = IA32_IDT_GATE_TYPE_INTERRUPT_32;
     58      IdtEntry->Bits.OffsetHigh     = (UINT16)(S3DebugBuffer >> 16);
     59    }
     60  );
    6261}
    6362
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c

    r48674 r58459  
    22  This is the code for Boot Script Executer module.
    33
    4   This driver is dispatched by Dxe core and the driver will reload itself to ACPI NVS memory
     4  This driver is dispatched by Dxe core and the driver will reload itself to ACPI reserved memory
    55  in the entry point. The functionality is to interpret and restore the S3 boot script
    66
    7 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     7Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    88
    99This program and the accompanying materials
     
    1919#include "ScriptExecute.h"
    2020
    21 EFI_PHYSICAL_ADDRESS  mPerfDataMemAddress;
    22 UINT64                mS3BootScriptEntryTick;
    23 UINT64                mScriptStartTick;
    24 UINT64                mScriptEndTick;
    25 
    2621EFI_GUID              mBootScriptExecutorImageGuid = {
    27   0x9a8d3433, 0x9fe8, 0x42b6, 0x87, 0xb, 0x1e, 0x31, 0xc8, 0x4e, 0xbe, 0x3b
     22  0x9a8d3433, 0x9fe8, 0x42b6, { 0x87, 0xb, 0x1e, 0x31, 0xc8, 0x4e, 0xbe, 0x3b }
    2823};
    2924
    30 /**
    31   The event callback is used to get the base address of boot performance data structure on
    32   LegacyBoot event and ExitBootServices event.
    33 
    34   @param  Event    The event handle.
    35   @param  Context  The event context.
    36 
    37 **/
    38 VOID
    39 EFIAPI
    40 OnBootEvent (
    41   IN EFI_EVENT        Event,
    42   IN VOID             *Context
    43   )
    44 {
    45   EFI_STATUS Status;
    46   UINTN      VarSize;
    47 
    48   VarSize = sizeof (EFI_PHYSICAL_ADDRESS);
    49   Status = gRT->GetVariable (
    50                   L"PerfDataMemAddr",
    51                   &gPerformanceProtocolGuid,
    52                   NULL,
    53                   &VarSize,
    54                   &mPerfDataMemAddress
    55                   );
    56   if (EFI_ERROR (Status)) {
    57     mPerfDataMemAddress = 0;
    58   }
    59 }
    60 
    61 /**
    62   Record S3 Script execution time and adjust total S3 resume time for script running.
    63 **/
    64 VOID
    65 WriteToOsS3PerformanceData (
    66   VOID
    67   )
    68 {
    69   UINT64               Ticker;
    70   UINT64               StartValue;
    71   UINT64               EndValue;
    72   UINT64               Freq;
    73   UINT64               ScriptExecuteTicks;
    74   PERF_HEADER          *PerfHeader;
    75   PERF_DATA            *PerfData;
    76 
    77   Ticker = GetPerformanceCounter ();
    78 
    79   PerfHeader = (PERF_HEADER *)(UINTN)mPerfDataMemAddress;
    80   if (PerfHeader == NULL) {
    81     return;
    82   }
    83 
    84   Freq   = GetPerformanceCounterProperties (&StartValue, &EndValue);
    85   Freq   = DivU64x32 (Freq, 1000);
    86 
    87   if (EndValue >= StartValue) {
    88     ScriptExecuteTicks = mScriptEndTick - mScriptStartTick;
    89     PerfHeader->S3Resume += Ticker - mS3BootScriptEntryTick;
    90   } else {
    91     ScriptExecuteTicks = mScriptStartTick - mScriptEndTick;
    92     PerfHeader->S3Resume += mS3BootScriptEntryTick - Ticker;
    93   }
    94   if (PerfHeader->S3EntryNum < PERF_PEI_ENTRY_MAX_NUM) {
    95     PerfData = &PerfHeader->S3Entry[PerfHeader->S3EntryNum];
    96     PerfData->Duration = (UINT32) DivU64x32 (ScriptExecuteTicks, (UINT32) Freq);;
    97     AsciiStrnCpy (PerfData->Token, "ScriptExec", PERF_TOKEN_LENGTH);
    98     PerfHeader->S3EntryNum++;
    99   }
    100 }
     25BOOLEAN               mPage1GSupport = FALSE;
    10126
    10227/**
     
    12348  UINTN                                         TempStack[0x10];
    12449  UINTN                                         AsmTransferControl16Address;
    125 
    126   PERF_CODE (
    127     mS3BootScriptEntryTick = GetPerformanceCounter ();
    128     );
     50  IA32_DESCRIPTOR                               IdtDescriptor;
    12951
    13052  //
     
    13355  SaveAndSetDebugTimerInterrupt (FALSE);
    13456
     57  AsmReadIdtr (&IdtDescriptor);
    13558  //
    13659  // Restore IDT for debug
     
    13962
    14063  //
    141   // Initialize Debug Agent to support source level debug in S3 path.
    142   //
    143   InitializeDebugAgent (DEBUG_AGENT_INIT_S3, NULL, NULL);
     64  // Initialize Debug Agent to support source level debug in S3 path, it will disable interrupt and Debug Timer.
     65  //
     66  InitializeDebugAgent (DEBUG_AGENT_INIT_S3, (VOID *)&IdtDescriptor, NULL);
    14467
    14568  //
     
    14770  // for that parameter.
    14871  //
    149   PERF_CODE (
    150     mScriptStartTick = GetPerformanceCounter ();
    151     );
    15272  Status = S3BootScriptExecute ();
    153   PERF_CODE (
    154     mScriptEndTick = GetPerformanceCounter ();
    155     );
     73 
     74  //
     75  // If invalid script table or opcode in S3 boot script table.
     76  //
     77  ASSERT_EFI_ERROR (Status);
     78 
    15679  if (EFI_ERROR (Status)) {
     80    CpuDeadLoop ();
    15781    return Status;
    15882  }
     
    16589  Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) ((UINTN) (AcpiS3Context->AcpiFacsTable));
    16690
    167   if ((Facs == NULL) ||
    168       (Facs->Signature != EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ||
    169       ((Facs->FirmwareWakingVector == 0) && (Facs->XFirmwareWakingVector == 0)) ) {
    170     CpuDeadLoop();
    171     return EFI_INVALID_PARAMETER;
    172   }
    173 
    17491  //
    17592  // We need turn back to S3Resume - install boot script done ppi and report status code on S3resume.
    17693  //
    17794  if (PeiS3ResumeState != 0) {
     95    //
     96    // Need report status back to S3ResumePeim.
     97    // If boot script execution is failed, S3ResumePeim wil report the error status code.
     98    //
     99    PeiS3ResumeState->ReturnStatus = (UINT64)(UINTN)Status;
    178100    if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
    179101      //
     
    183105      PeiS3ResumeState->AsmTransferControl = (EFI_PHYSICAL_ADDRESS)(UINTN)AsmTransferControl32;
    184106
    185       //
    186       // more step needed - because relative address is handled differently between X64 and IA32.
    187       //
    188       AsmTransferControl16Address = (UINTN)AsmTransferControl16;
    189       AsmFixAddress16 = (UINT32)AsmTransferControl16Address;
    190       AsmJmpAddr32 = (UINT32)((Facs->FirmwareWakingVector & 0xF) | ((Facs->FirmwareWakingVector & 0xFFFF0) << 12));
     107      if ((Facs != NULL) &&
     108          (Facs->Signature == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) &&
     109          (Facs->FirmwareWakingVector != 0) ) {
     110        //
     111        // more step needed - because relative address is handled differently between X64 and IA32.
     112        //
     113        AsmTransferControl16Address = (UINTN)AsmTransferControl16;
     114        AsmFixAddress16 = (UINT32)AsmTransferControl16Address;
     115        AsmJmpAddr32 = (UINT32)((Facs->FirmwareWakingVector & 0xF) | ((Facs->FirmwareWakingVector & 0xFFFF0) << 12));
     116      }
    191117
    192118      AsmDisablePaging64 (
     
    218144    return EFI_UNSUPPORTED;
    219145  }
    220 
    221   PERF_CODE (
    222     WriteToOsS3PerformanceData ();
    223     );
    224 
     146 
     147  //
     148  // S3ResumePeim does not provide a way to jump back to itself, so resume to OS here directly
     149  //
    225150  if (Facs->XFirmwareWakingVector != 0) {
    226151    //
     
    283208  return EFI_UNSUPPORTED;
    284209}
     210
     211/**
     212  Register image to memory profile.
     213
     214  @param FileName       File name of the image.
     215  @param ImageBase      Image base address.
     216  @param ImageSize      Image size.
     217  @param FileType       File type of the image.
     218
     219**/
     220VOID
     221RegisterMemoryProfileImage (
     222  IN EFI_GUID                       *FileName,
     223  IN PHYSICAL_ADDRESS               ImageBase,
     224  IN UINT64                         ImageSize,
     225  IN EFI_FV_FILETYPE                FileType
     226  )
     227{
     228  EFI_STATUS                        Status;
     229  EDKII_MEMORY_PROFILE_PROTOCOL     *ProfileProtocol;
     230  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FilePath;
     231  UINT8                             TempBuffer[sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH) + sizeof (EFI_DEVICE_PATH_PROTOCOL)];
     232
     233  if ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT0) != 0) {
     234
     235    FilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)TempBuffer;
     236    Status = gBS->LocateProtocol (&gEdkiiMemoryProfileGuid, NULL, (VOID **) &ProfileProtocol);
     237    if (!EFI_ERROR (Status)) {
     238      EfiInitializeFwVolDevicepathNode (FilePath, FileName);
     239      SetDevicePathEndNode (FilePath + 1);
     240
     241      Status = ProfileProtocol->RegisterImage (
     242                                  ProfileProtocol,
     243                                  (EFI_DEVICE_PATH_PROTOCOL *) FilePath,
     244                                  ImageBase,
     245                                  ImageSize,
     246                                  FileType
     247                                  );
     248    }
     249  }
     250}
     251
     252/**
     253  This is the Event notification function to reload BootScriptExecutor image
     254  to RESERVED mem and save it to LockBox.
     255 
     256  @param    Event   Pointer to this event
     257  @param    Context Event handler private data
     258 **/
     259VOID
     260EFIAPI
     261ReadyToLockEventNotify (
     262  IN EFI_EVENT  Event,
     263  IN VOID       *Context
     264  )
     265{
     266  EFI_STATUS                                    Status;
     267  VOID                                          *Interface;
     268  UINT8                                         *Buffer;
     269  UINTN                                         BufferSize;
     270  EFI_HANDLE                                    NewImageHandle;
     271  UINTN                                         Pages;
     272  EFI_PHYSICAL_ADDRESS                          FfsBuffer;
     273  PE_COFF_LOADER_IMAGE_CONTEXT                  ImageContext;
     274
     275  Status = gBS->LocateProtocol (&gEfiDxeSmmReadyToLockProtocolGuid, NULL, &Interface);
     276  if (EFI_ERROR (Status)) {
     277    return;
     278  }
     279
     280  //
     281  // A workaround: Here we install a dummy handle
     282  //
     283  NewImageHandle = NULL;
     284  Status = gBS->InstallProtocolInterface (
     285                  &NewImageHandle,
     286                  &gEfiCallerIdGuid,
     287                  EFI_NATIVE_INTERFACE,
     288                  NULL
     289                  );
     290  ASSERT_EFI_ERROR (Status);
     291
     292  //
     293  // Reload BootScriptExecutor image itself to RESERVED mem
     294  //
     295  Status = GetSectionFromAnyFv  (
     296             &gEfiCallerIdGuid,
     297             EFI_SECTION_PE32,
     298             0,
     299             (VOID **) &Buffer,
     300             &BufferSize
     301             );
     302  ASSERT_EFI_ERROR (Status);
     303  ImageContext.Handle    = Buffer;
     304  ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
     305  //
     306  // Get information about the image being loaded
     307  //
     308  Status = PeCoffLoaderGetImageInfo (&ImageContext);
     309  ASSERT_EFI_ERROR (Status);
     310  Pages = EFI_SIZE_TO_PAGES(BufferSize + ImageContext.SectionAlignment);
     311  FfsBuffer = 0xFFFFFFFF;
     312  Status = gBS->AllocatePages (
     313                  AllocateMaxAddress,
     314                  EfiReservedMemoryType,
     315                  Pages,
     316                  &FfsBuffer
     317                  );
     318  ASSERT_EFI_ERROR (Status);
     319  ImageContext.ImageAddress = (PHYSICAL_ADDRESS)(UINTN)FfsBuffer;
     320  //
     321  // Align buffer on section boundry
     322  //
     323  ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;
     324  ImageContext.ImageAddress &= ~((EFI_PHYSICAL_ADDRESS)(ImageContext.SectionAlignment - 1));
     325  //
     326  // Load the image to our new buffer
     327  //
     328  Status = PeCoffLoaderLoadImage (&ImageContext);
     329  ASSERT_EFI_ERROR (Status);
     330
     331  //
     332  // Relocate the image in our new buffer
     333  //
     334  Status = PeCoffLoaderRelocateImage (&ImageContext);
     335  ASSERT_EFI_ERROR (Status);
     336
     337  //
     338  // Free the buffer allocated by ReadSection since the image has been relocated in the new buffer
     339  //
     340  gBS->FreePool (Buffer);
     341
     342  //
     343  // Flush the instruction cache so the image data is written before we execute it
     344  //
     345  InvalidateInstructionCacheRange ((VOID *)(UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.ImageSize);
     346
     347  RegisterMemoryProfileImage (
     348    &gEfiCallerIdGuid,
     349    ImageContext.ImageAddress,
     350    ImageContext.ImageSize,
     351    EFI_FV_FILETYPE_DRIVER
     352    );
     353
     354  Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint)) (NewImageHandle, gST);
     355  ASSERT_EFI_ERROR (Status);
     356
     357  //
     358  // Additional step for BootScript integrity
     359  // Save BootScriptExecutor image
     360  //
     361  Status = SaveLockBox (
     362             &mBootScriptExecutorImageGuid,
     363             (VOID *)(UINTN)ImageContext.ImageAddress,
     364             (UINTN)ImageContext.ImageSize
     365             );
     366  ASSERT_EFI_ERROR (Status);
     367
     368  Status = SetLockBoxAttributes (&mBootScriptExecutorImageGuid, LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE);
     369  ASSERT_EFI_ERROR (Status);
     370
     371  gBS->CloseEvent (Event);
     372}
     373
    285374/**
    286375  Entrypoint of Boot script exector driver, this function will be executed in
     
    300389  )
    301390{
    302   UINT8                                         *Buffer;
    303391  UINTN                                         BufferSize;
    304392  UINTN                                         Pages;
    305   EFI_PHYSICAL_ADDRESS                          FfsBuffer;
    306   PE_COFF_LOADER_IMAGE_CONTEXT                  ImageContext;
    307393  BOOT_SCRIPT_EXECUTOR_VARIABLE                 *EfiBootScriptExecutorVariable;
    308394  EFI_PHYSICAL_ADDRESS                          BootScriptExecutorBuffer;
    309395  EFI_STATUS                                    Status;
    310396  VOID                                          *DevicePath;
    311   EFI_HANDLE                                    NewImageHandle;
     397  EFI_EVENT                                     ReadyToLockEvent;
     398  VOID                                          *Registration;
     399  UINT32                                        RegEax;
     400  UINT32                                        RegEdx;
    312401
    313402  //
     
    318407  Status = gBS->LocateProtocol (&gEfiCallerIdGuid, NULL, &DevicePath);
    319408  if (EFI_ERROR (Status)) {
    320 
    321       //
    322       // This is the first-time loaded by DXE core. reload itself to NVS mem
    323       //
    324       //
    325       // A workarouond: Here we install a dummy handle
    326       //
    327       NewImageHandle = NULL;
    328       Status = gBS->InstallProtocolInterface (
    329                   &NewImageHandle,
    330                   &gEfiCallerIdGuid,
    331                   EFI_NATIVE_INTERFACE,
    332                   NULL
    333                   );
    334 
    335       Status = GetSectionFromAnyFv  (
    336                  &gEfiCallerIdGuid,
    337                  EFI_SECTION_PE32,
    338                  0,
    339                  (VOID **) &Buffer,
    340                  &BufferSize
    341                  );
    342       ImageContext.Handle    = Buffer;
    343       ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
    344       //
    345       // Get information about the image being loaded
    346       //
    347       Status = PeCoffLoaderGetImageInfo (&ImageContext);
    348       if (EFI_ERROR (Status)) {
    349         return Status;
     409      //
     410      // Create ReadyToLock event to reload BootScriptExecutor image
     411      // to RESERVED mem and save it to LockBox.
     412      //
     413      ReadyToLockEvent = EfiCreateProtocolNotifyEvent  (
     414                           &gEfiDxeSmmReadyToLockProtocolGuid,
     415                           TPL_NOTIFY,
     416                           ReadyToLockEventNotify,
     417                           NULL,
     418                           &Registration
     419                           );
     420      ASSERT (ReadyToLockEvent != NULL);
     421    } else {
     422      //
     423      // the entry point is invoked after reloading. following code only run in RESERVED mem
     424      //
     425      if (PcdGetBool(PcdUse1GPageTable)) {
     426        AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
     427        if (RegEax >= 0x80000001) {
     428          AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
     429          if ((RegEdx & BIT26) != 0) {
     430            mPage1GSupport = TRUE;
     431          }
     432        }
    350433      }
    351       Pages = EFI_SIZE_TO_PAGES(BufferSize + ImageContext.SectionAlignment);
    352       FfsBuffer = 0xFFFFFFFF;
    353       Status = gBS->AllocatePages (
    354                     AllocateMaxAddress,
    355                     EfiACPIMemoryNVS,
    356                     Pages,
    357                     &FfsBuffer
    358                     );
    359       if (EFI_ERROR (Status)) {
    360         return EFI_OUT_OF_RESOURCES;
    361       }
    362       ImageContext.ImageAddress = (PHYSICAL_ADDRESS)(UINTN)FfsBuffer;
    363       //
    364       // Align buffer on section boundry
    365       //
    366       ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;
    367       ImageContext.ImageAddress &= ~(ImageContext.SectionAlignment - 1);
    368       //
    369       // Load the image to our new buffer
    370       //
    371       Status = PeCoffLoaderLoadImage (&ImageContext);
    372       if (EFI_ERROR (Status)) {
    373         gBS->FreePages (FfsBuffer, Pages);
    374         return Status;
    375       }
    376 
    377       //
    378       // Relocate the image in our new buffer
    379       //
    380       Status = PeCoffLoaderRelocateImage (&ImageContext);
    381 
    382       if (EFI_ERROR (Status)) {
    383         PeCoffLoaderUnloadImage (&ImageContext);
    384         gBS->FreePages (FfsBuffer, Pages);
    385         return Status;
    386       }
    387       //
    388       // Flush the instruction cache so the image data is written before we execute it
    389       //
    390       InvalidateInstructionCacheRange ((VOID *)(UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.ImageSize);
    391       Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint)) (NewImageHandle, SystemTable);
    392       if (EFI_ERROR (Status)) {
    393         gBS->FreePages (FfsBuffer, Pages);
    394         return Status;
    395       }
    396       //
    397       // Additional step for BootScript integrity
    398       // Save BootScriptExecutor image
    399       //
    400       Status = SaveLockBox (
    401                  &mBootScriptExecutorImageGuid,
    402                  (VOID *)(UINTN)ImageContext.ImageAddress,
    403                  (UINTN)ImageContext.ImageSize
    404                  );
    405       ASSERT_EFI_ERROR (Status);
    406 
    407       Status = SetLockBoxAttributes (&mBootScriptExecutorImageGuid, LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE);
    408       ASSERT_EFI_ERROR (Status);
    409 
    410     } else {
    411       //
    412       // the entry point is invoked after reloading. following code only run in  ACPI NVS
    413       //
     434
    414435      BufferSize = sizeof (BOOT_SCRIPT_EXECUTOR_VARIABLE);
    415436
     
    418439      Status = gBS->AllocatePages (
    419440                      AllocateMaxAddress,
    420                       EfiACPIMemoryNVS,
     441                      EfiReservedMemoryType,
    421442                      Pages,
    422443                      &BootScriptExecutorBuffer
    423444                      );
    424       if (EFI_ERROR (Status)) {
    425         return EFI_OUT_OF_RESOURCES;
    426       }
     445      ASSERT_EFI_ERROR (Status);
    427446
    428447      EfiBootScriptExecutorVariable = (BOOT_SCRIPT_EXECUTOR_VARIABLE *)(UINTN)BootScriptExecutorBuffer;
     
    449468      Status = SetLockBoxAttributes (&gEfiBootScriptExecutorContextGuid, LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE);
    450469      ASSERT_EFI_ERROR (Status);
    451 
    452       PERF_CODE (
    453         EFI_EVENT Event;
    454 
    455         gBS->CreateEventEx (
    456               EVT_NOTIFY_SIGNAL,
    457               TPL_NOTIFY,
    458               OnBootEvent,
    459               NULL,
    460               &gEfiEventExitBootServicesGuid,
    461               &Event
    462               );
    463 
    464         EfiCreateEventLegacyBootEx(
    465           TPL_NOTIFY,
    466           OnBootEvent,
    467           NULL,
    468           &Event
    469           );
    470         );
    471470    }
    472471
     
    474473}
    475474
    476 
    477 
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.h

    r48674 r58459  
    22  The header file for Boot Script Executer module.
    33 
    4   This driver is dispatched by Dxe core and the driver will reload itself to ACPI NVS memory
     4  This driver is dispatched by Dxe core and the driver will reload itself to ACPI reserved memory
    55  in the entry point. The functionality is to interpret and restore the S3 boot script
    66 
    7 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     7Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
    88
    99This program and the accompanying materials
     
    3232#include <Library/PcdLib.h>
    3333#include <Library/CacheMaintenanceLib.h>
    34 #include <Library/PerformanceLib.h>
    3534#include <Library/TimerLib.h>
    3635#include <Library/UefiLib.h>
    3736#include <Library/DebugAgentLib.h>
    3837#include <Library/LockBoxLib.h>
     38#include <Library/CpuExceptionHandlerLib.h>
     39#include <Library/DevicePathLib.h>
    3940
    4041#include <Guid/AcpiS3Context.h>
    4142#include <Guid/BootScriptExecutorVariable.h>
    42 #include <Guid/EventGroup.h>
    43 #include <Guid/Performance.h>
     43#include <Guid/MemoryProfile.h>
     44
     45#include <Protocol/DxeSmmReadyToLock.h>
    4446#include <IndustryStandard/Acpi.h>
    4547/**
     
    8587extern UINT32 AsmFixAddress16;
    8688extern UINT32 AsmJmpAddr32;
     89extern BOOLEAN mPage1GSupport;
    8790
    8891#endif //_BOOT_SCRIPT_EXECUTOR_H_
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S

    r48674 r58459  
    33#   for X64 platform
    44#
    5 # Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
     5# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    66#
    77# This program and the accompanying materials are
     
    1919    # rcx S3WakingVector    :DWORD
    2020    # rdx AcpiLowMemoryBase :DWORD
    21     lea   _AsmTransferControl_al_0000, %eax
     21    lea   _AsmTransferControl_al_0000(%rip), %eax
    2222    movq  $0x2800000000, %r8
    2323    orq   %r8, %rax
     
    2626    andl  $0x0f, %ecx
    2727    movw  %cx, %bx
    28     movl  %ebx, jmp_addr
     28    movl  %ebx, jmp_addr(%rip)
    2929    lret
    3030_AsmTransferControl_al_0000:
     
    8181ASM_PFX(AsmJmpAddr32):
    8282    .long    0
     83
     84ASM_GLOBAL ASM_PFX(PageFaultHandlerHook)
     85ASM_PFX(PageFaultHandlerHook):
     86    pushq    %rax                         # save all volatile registers
     87    pushq    %rcx
     88    pushq    %rdx
     89    pushq    %r8
     90    pushq    %r9
     91    pushq    %r10
     92    pushq    %r11
     93    # save volatile fp registers
     94    addq     $-0x68, %rsp
     95    stmxcsr  0x60(%rsp)
     96    movdqa   %xmm0, 0x0(%rsp)
     97    movdqa   %xmm1, 0x10(%rsp)
     98    movdqa   %xmm2, 0x20(%rsp)
     99    movdqa   %xmm3, 0x30(%rsp)
     100    movdqa   %xmm4, 0x40(%rsp)
     101    movdqa   %xmm5, 0x50(%rsp)
     102
     103    addq     $-0x20, %rsp
     104    call     ASM_PFX(PageFaultHandler)
     105    addq     $0x20, %rsp
     106
     107    # load volatile fp registers
     108    ldmxcsr  0x60(%rsp)
     109    movdqa   0x0(%rsp), %xmm0
     110    movdqa   0x10(%rsp), %xmm1
     111    movdqa   0x20(%rsp), %xmm2
     112    movdqa   0x30(%rsp), %xmm3
     113    movdqa   0x40(%rsp), %xmm4
     114    movdqa   0x50(%rsp), %xmm5
     115    addq     $0x68, %rsp
     116
     117    testb    %al, %al
     118
     119    popq     %r11
     120    popq     %r10
     121    popq     %r9
     122    popq     %r8
     123    popq     %rdx
     124    popq     %rcx
     125    popq     %rax                         # restore all volatile registers
     126    jnz      L1
     127    jmpq     *ASM_PFX(mOriginalHandler)(%rip)
     128L1:
     129    addq     $0x08, %rsp                  # skip error code for PF
     130    iretq
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.asm

    r48674 r58459  
    33;   for X64 platform
    44;
    5 ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
     5; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
    66;
    77; This program and the accompanying materials
     
    1414;
    1515;;
     16
     17EXTERN mOriginalHandler:QWORD
     18EXTERN PageFaultHandler:PROC
    1619
    1720    .code
     
    8285AsmTransferControl16  ENDP
    8386
     87PageFaultHandlerHook PROC
     88    push    rax                         ; save all volatile registers
     89    push    rcx
     90    push    rdx
     91    push    r8
     92    push    r9
     93    push    r10
     94    push    r11
     95    ; save volatile fp registers
     96    add     rsp, -68h
     97    stmxcsr [rsp + 60h]
     98    movdqa  [rsp + 0h], xmm0
     99    movdqa  [rsp + 10h], xmm1
     100    movdqa  [rsp + 20h], xmm2
     101    movdqa  [rsp + 30h], xmm3
     102    movdqa  [rsp + 40h], xmm4
     103    movdqa  [rsp + 50h], xmm5
     104
     105    add     rsp, -20h
     106    call    PageFaultHandler
     107    add     rsp, 20h
     108   
     109    ; load volatile fp registers
     110    ldmxcsr [rsp + 60h]
     111    movdqa  xmm0,  [rsp + 0h]
     112    movdqa  xmm1,  [rsp + 10h]
     113    movdqa  xmm2,  [rsp + 20h]
     114    movdqa  xmm3,  [rsp + 30h]
     115    movdqa  xmm4,  [rsp + 40h]
     116    movdqa  xmm5,  [rsp + 50h]
     117    add     rsp, 68h
     118
     119    test    al, al
     120   
     121    pop     r11
     122    pop     r10
     123    pop     r9
     124    pop     r8
     125    pop     rdx
     126    pop     rcx
     127    pop     rax                         ; restore all volatile registers
     128    jnz     @F
     129    jmp     mOriginalHandler
     130@@:
     131    add     rsp, 08h                    ; skip error code for PF
     132    iretq
     133PageFaultHandlerHook ENDP
     134
    84135    END
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c

    r48674 r58459  
    44  Set a IDT entry for interrupt vector 3 for debug purpose for x64 platform
    55
    6 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
     6Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    77
    88This program and the accompanying materials
     
    1616**/
    1717#include "ScriptExecute.h"
    18 //
    19 // INTERRUPT_GATE_DESCRIPTOR and SetIdtEntry () are used to setup IDT to do debug
    20 //
    2118
    22 #pragma pack(1)
     19#define IA32_PG_P                   BIT0
     20#define IA32_PG_RW                  BIT1
     21#define IA32_PG_PS                  BIT7
    2322
    24 typedef struct {
    25   UINT16    Offset15To0;
    26   UINT16    SegmentSelector;
    27   UINT16    Attributes;
    28   UINT16    Offset31To16;
    29   UINT32    Offset63To32;
    30   UINT32    Reserved;
    31 } INTERRUPT_GATE_DESCRIPTOR;
     23UINT64                             mPhyMask;
     24VOID                               *mOriginalHandler;
     25UINTN                              mS3NvsPageTableAddress;
    3226
    33 #define INTERRUPT_GATE_ATTRIBUTE   0x8e00
     27/**
     28  Page fault handler.
    3429
    35 #pragma pack()
     30**/
     31VOID
     32EFIAPI
     33PageFaultHandlerHook (
     34  VOID
     35  );
     36
     37/**
     38  Hook IDT with our page fault handler so that the on-demand paging works on page fault.
     39
     40  @param  IdtEntry  a pointer to IDT entry
     41
     42**/
     43VOID
     44HookPageFaultHandler (
     45  IN IA32_IDT_GATE_DESCRIPTOR                   *IdtEntry
     46  )
     47{
     48  UINT32         RegEax;
     49  UINT8          PhysicalAddressBits;
     50  UINTN          PageFaultHandlerHookAddress;
     51
     52  AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
     53  if (RegEax >= 0x80000008) {
     54    AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
     55    PhysicalAddressBits = (UINT8) RegEax;
     56  } else {
     57    PhysicalAddressBits = 36;
     58  }
     59  mPhyMask = LShiftU64 (1, PhysicalAddressBits) - 1;
     60  mPhyMask &= (1ull << 48) - SIZE_4KB;
     61
     62  //
     63  // Set Page Fault entry to catch >4G access
     64  //
     65  PageFaultHandlerHookAddress = (UINTN)PageFaultHandlerHook;
     66  mOriginalHandler = (VOID *)(UINTN)(LShiftU64 (IdtEntry->Bits.OffsetUpper, 32) + IdtEntry->Bits.OffsetLow + (IdtEntry->Bits.OffsetHigh << 16));
     67  IdtEntry->Bits.OffsetLow      = (UINT16)PageFaultHandlerHookAddress;
     68  IdtEntry->Bits.Selector       = (UINT16)AsmReadCs ();
     69  IdtEntry->Bits.Reserved_0     = 0;
     70  IdtEntry->Bits.GateType       = IA32_IDT_GATE_TYPE_INTERRUPT_32;
     71  IdtEntry->Bits.OffsetHigh     = (UINT16)(PageFaultHandlerHookAddress >> 16);
     72  IdtEntry->Bits.OffsetUpper    = (UINT32)(PageFaultHandlerHookAddress >> 32);
     73  IdtEntry->Bits.Reserved_1     = 0;
     74
     75  if (mPage1GSupport) {
     76    mS3NvsPageTableAddress = (UINTN)(AsmReadCr3 () & mPhyMask) + EFI_PAGES_TO_SIZE(2);
     77  }else {
     78    mS3NvsPageTableAddress = (UINTN)(AsmReadCr3 () & mPhyMask) + EFI_PAGES_TO_SIZE(6);
     79  }
     80}
     81
    3682/**
    3783  Set a IDT entry for interrupt vector 3 for debug purpose.
     
    4591  )
    4692{
    47   INTERRUPT_GATE_DESCRIPTOR                     *IdtEntry;
     93  IA32_IDT_GATE_DESCRIPTOR                      *IdtEntry;
    4894  IA32_DESCRIPTOR                               *IdtDescriptor;
    4995  UINTN                                         S3DebugBuffer;
     96  EFI_STATUS                                    Status;
    5097
    5198  //
     
    53100  //
    54101  IdtDescriptor = (IA32_DESCRIPTOR *) (UINTN) (AcpiS3Context->IdtrProfile);
    55   IdtEntry = (INTERRUPT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (INTERRUPT_GATE_DESCRIPTOR)));
    56   S3DebugBuffer = (UINTN) (AcpiS3Context->S3DebugBufferAddress);
     102  AsmWriteIdtr (IdtDescriptor);
    57103
    58   IdtEntry->Offset15To0     = (UINT16)S3DebugBuffer;
    59   IdtEntry->SegmentSelector = (UINT16)AsmReadCs ();;
    60   IdtEntry->Attributes      = (UINT16)INTERRUPT_GATE_ATTRIBUTE;
    61   IdtEntry->Offset31To16    = (UINT16)(S3DebugBuffer >> 16);
    62   IdtEntry->Offset63To32    = (UINT32)(S3DebugBuffer >> 32);
    63   IdtEntry->Reserved        = 0;
     104  //
     105  // Setup the default CPU exception handlers
     106  //
     107  Status = InitializeCpuExceptionHandlers (NULL);
     108  ASSERT_EFI_ERROR (Status);
    64109
    65   AsmWriteIdtr (IdtDescriptor);
     110  DEBUG_CODE (
     111    //
     112    // Update IDT entry INT3 if the instruction is valid in it
     113    //
     114    S3DebugBuffer = (UINTN) (AcpiS3Context->S3DebugBufferAddress);
     115    if (*(UINTN *)S3DebugBuffer != (UINTN) -1) {
     116      IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
     117      IdtEntry->Bits.OffsetLow      = (UINT16)S3DebugBuffer;
     118      IdtEntry->Bits.Selector       = (UINT16)AsmReadCs ();
     119      IdtEntry->Bits.Reserved_0     = 0;
     120      IdtEntry->Bits.GateType       = IA32_IDT_GATE_TYPE_INTERRUPT_32;
     121      IdtEntry->Bits.OffsetHigh     = (UINT16)(S3DebugBuffer >> 16);
     122      IdtEntry->Bits.OffsetUpper    = (UINT32)(S3DebugBuffer >> 32);
     123      IdtEntry->Bits.Reserved_1     = 0;
     124    }
     125  );
     126
     127  IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (14 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
     128  HookPageFaultHandler (IdtEntry);
    66129}
    67130
     131/**
     132  Get new page address.
     133
     134  @param  PageNum  new page number needed
     135
     136  @return new page address
     137**/
     138UINTN
     139GetNewPage (
     140  IN UINTN  PageNum
     141  )
     142{
     143  UINTN  NewPage;
     144  NewPage = mS3NvsPageTableAddress;
     145  ZeroMem ((VOID *)NewPage, EFI_PAGES_TO_SIZE(PageNum));
     146  mS3NvsPageTableAddress += EFI_PAGES_TO_SIZE(PageNum);
     147  return NewPage;
     148}
     149
     150/**
     151  The page fault handler that on-demand read >4G memory/MMIO.
     152 
     153  @retval TRUE     The page fault is correctly handled.
     154  @retval FALSE    The page fault is not handled and is passed through to original handler.
     155
     156**/
     157BOOLEAN
     158EFIAPI
     159PageFaultHandler (
     160  VOID
     161  )
     162{
     163  UINT64         *PageTable;
     164  UINT64         PFAddress;
     165  UINTN          PTIndex;
     166
     167  PFAddress = AsmReadCr2 ();
     168  DEBUG ((EFI_D_ERROR, "BootScript - PageFaultHandler: Cr2 - %lx\n", PFAddress));
     169
     170  if (PFAddress >= mPhyMask + SIZE_4KB) {
     171    return FALSE;
     172  }
     173  PFAddress &= mPhyMask;
     174
     175  PageTable = (UINT64*)(UINTN)(AsmReadCr3 () & mPhyMask);
     176
     177  PTIndex = BitFieldRead64 (PFAddress, 39, 47);
     178  // PML4E
     179  if ((PageTable[PTIndex] & IA32_PG_P) == 0) {
     180    PageTable[PTIndex] = GetNewPage (1) | IA32_PG_P | IA32_PG_RW;
     181  }
     182  PageTable = (UINT64*)(UINTN)(PageTable[PTIndex] & mPhyMask);
     183  PTIndex = BitFieldRead64 (PFAddress, 30, 38);
     184  // PDPTE
     185  if (mPage1GSupport) {
     186    PageTable[PTIndex] = PFAddress | IA32_PG_P | IA32_PG_RW | IA32_PG_PS;
     187  } else {
     188    if ((PageTable[PTIndex] & IA32_PG_P) == 0) {
     189      PageTable[PTIndex] = GetNewPage (1) | IA32_PG_P | IA32_PG_RW;
     190    }
     191    PageTable = (UINT64*)(UINTN)(PageTable[PTIndex] & mPhyMask);
     192    PTIndex = BitFieldRead64 (PFAddress, 21, 29);
     193    // PD
     194    PageTable[PTIndex] = PFAddress | IA32_PG_P | IA32_PG_RW | IA32_PG_PS;
     195  }
     196
     197  return TRUE;
     198}
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c

    r48674 r58459  
    66  and install FPDT to ACPI table.
    77
    8   Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
     8  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
    99  This program and the accompanying materials
    1010  are licensed and made available under the terms and conditions of the BSD License
     
    1919#include <PiDxe.h>
    2020
    21 #include <IndustryStandard/Acpi50.h>
    22 
    2321#include <Protocol/ReportStatusCodeHandler.h>
    2422#include <Protocol/AcpiTable.h>
    2523#include <Protocol/SmmCommunication.h>
     24#include <Protocol/LockBox.h>
     25#include <Protocol/Variable.h>
    2626
    2727#include <Guid/Acpi.h>
     
    3939#include <Library/PcdLib.h>
    4040#include <Library/HobLib.h>
    41 #include <Library/PcdLib.h>
    42 
    43 //
    44 // ACPI table information used to initialize tables.
    45 //
    46 #define EFI_ACPI_OEM_ID           "INTEL"
    47 #define EFI_ACPI_OEM_TABLE_ID     0x2020204F4E414954ULL // "TIANO   "
    48 #define EFI_ACPI_OEM_REVISION     0x00000001
    49 #define EFI_ACPI_CREATOR_ID       0x5446534D            // TBD "MSFT"
    50 #define EFI_ACPI_CREATOR_REVISION 0x01000013            // TBD
     41#include <Library/LockBoxLib.h>
     42#include <Library/UefiLib.h>
     43
    5144#define EXTENSION_RECORD_SIZE     0x10000
    5245#define SMM_BOOT_RECORD_COMM_SIZE OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE)
     
    5447EFI_RSC_HANDLER_PROTOCOL    *mRscHandlerProtocol = NULL;
    5548
     49BOOLEAN                     mLockBoxReady = FALSE;
    5650EFI_EVENT                   mReadyToBootEvent;
    5751EFI_EVENT                   mLegacyBootEvent;
     
    6155UINT32                      mBootRecordMaxSize = 0;
    6256UINT8                       *mBootRecordBuffer = NULL;
     57BOOLEAN                     mDxeCoreReportStatusCodeEnable = FALSE;
    6358
    6459BOOT_PERFORMANCE_TABLE                      *mAcpiBootPerformanceTable = NULL;
     
    7267    0x00, // Checksum will be updated at runtime
    7368    //
    74     // It is expected that these values will be updated at runtime.
    75     //
    76     EFI_ACPI_OEM_ID,            // OEMID is a 6 bytes long field
    77     EFI_ACPI_OEM_TABLE_ID,      // OEM table identification(8 bytes long)
    78     EFI_ACPI_OEM_REVISION,      // OEM revision number
    79     EFI_ACPI_CREATOR_ID,        // ASL compiler vendor ID
    80     EFI_ACPI_CREATOR_REVISION,  // ASL compiler revision number
     69    // It is expected that these values will be updated at EntryPoint.
     70    //
     71    {0x00},     // OEM ID is a 6 bytes long field
     72    0x00,       // OEM Table ID(8 bytes long)
     73    0x00,       // OEM Revision
     74    0x00,       // Creator ID
     75    0x00,       // Creator Revision
    8176  },
    8277  //
     
    209204  VOID                  *Buffer;
    210205
     206  Buffer  = NULL;
    211207  Pages   = EFI_SIZE_TO_PAGES (Size);
    212208  Address = 0xffffffff;
     
    220216  ASSERT_EFI_ERROR (Status);
    221217
    222   Buffer = (VOID *) (UINTN) Address;
    223   ZeroMem (Buffer, Size);
     218  if (!EFI_ERROR (Status)) {
     219    Buffer = (VOID *) (UINTN) Address;
     220    ZeroMem (Buffer, Size);
     221  }
    224222
    225223  return Buffer;
     224}
     225
     226/**
     227  Callback function upon VariableArchProtocol and LockBoxProtocol
     228  to allocate S3 performance table memory and save the pointer to LockBox.
     229
     230  @param[in] Event    Event whose notification function is being invoked.
     231  @param[in] Context  Pointer to the notification function's context.
     232**/
     233VOID
     234EFIAPI
     235FpdtAllocateS3PerformanceTableMemory (
     236  IN  EFI_EVENT                             Event,
     237  IN  VOID                                  *Context
     238  )
     239{
     240  EFI_STATUS                    Status;
     241  VOID                          *Interface;
     242  FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;
     243  UINTN                         Size;
     244  EFI_PHYSICAL_ADDRESS          S3PerformanceTablePointer;
     245
     246  if (mLockBoxReady && (mAcpiS3PerformanceTable != NULL)) {
     247    //
     248    // The memory for S3 performance table should have been ready,
     249    // and the pointer should have been saved to LockBox, just return.
     250    //
     251    return;
     252  }
     253
     254  if (!mLockBoxReady) {
     255    Status = gBS->LocateProtocol (&gEfiLockBoxProtocolGuid, NULL, &Interface);
     256    if (!EFI_ERROR (Status)) {
     257      //
     258      // LockBox services has been ready.
     259      //
     260      mLockBoxReady = TRUE;
     261    }
     262  }
     263
     264  if (mAcpiS3PerformanceTable == NULL) {
     265    Status = gBS->LocateProtocol (&gEfiVariableArchProtocolGuid, NULL, &Interface);
     266    if (!EFI_ERROR (Status)) {
     267      //
     268      // Try to allocate the same runtime buffer as last time boot.
     269      //
     270      ZeroMem (&PerformanceVariable, sizeof (PerformanceVariable));
     271      Size = sizeof (PerformanceVariable);
     272      Status = gRT->GetVariable (
     273                      EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
     274                      &gEfiFirmwarePerformanceGuid,
     275                      NULL,
     276                      &Size,
     277                      &PerformanceVariable
     278                      );
     279      if (!EFI_ERROR (Status)) {
     280        Status = gBS->AllocatePages (
     281                        AllocateAddress,
     282                        EfiReservedMemoryType,
     283                        EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE)),
     284                        &PerformanceVariable.S3PerformanceTablePointer
     285                        );
     286        if (!EFI_ERROR (Status)) {
     287          mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) (UINTN) PerformanceVariable.S3PerformanceTablePointer;
     288        }
     289      }
     290      if (mAcpiS3PerformanceTable == NULL) {
     291        //
     292        // Fail to allocate at specified address, continue to allocate at any address.
     293        //
     294        mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) FpdtAllocateReservedMemoryBelow4G (sizeof (S3_PERFORMANCE_TABLE));
     295      }
     296      DEBUG ((EFI_D_INFO, "FPDT: ACPI S3 Performance Table address = 0x%x\n", mAcpiS3PerformanceTable));
     297      if (mAcpiS3PerformanceTable != NULL) {
     298        CopyMem (mAcpiS3PerformanceTable, &mS3PerformanceTableTemplate, sizeof (mS3PerformanceTableTemplate));
     299      }
     300    }
     301  }
     302
     303  if (mLockBoxReady && (mAcpiS3PerformanceTable != NULL)) {
     304    //
     305    // If LockBox services has been ready and memory for FPDT S3 performance table has been allocated,
     306    // save the pointer to LockBox for use in S3 resume.
     307    //
     308    S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;
     309    Status = SaveLockBox (
     310               &gFirmwarePerformanceS3PointerGuid,
     311               &S3PerformanceTablePointer,
     312               sizeof (EFI_PHYSICAL_ADDRESS)
     313               );
     314    ASSERT_EFI_ERROR (Status);
     315  }
    226316}
    227317
     
    239329  EFI_STATUS                    Status;
    240330  EFI_ACPI_TABLE_PROTOCOL       *AcpiTableProtocol;
    241   EFI_PHYSICAL_ADDRESS          Address;
    242331  UINTN                         Size;
    243   UINT8                         SmmBootRecordCommBuffer[SMM_BOOT_RECORD_COMM_SIZE];
     332  UINT8                         *SmmBootRecordCommBuffer;
    244333  EFI_SMM_COMMUNICATE_HEADER    *SmmCommBufferHeader;
    245334  SMM_BOOT_RECORD_COMMUNICATE   *SmmCommData;
    246335  UINTN                         CommSize;
    247   UINTN                         PerformanceRuntimeDataSize;
    248   UINT8                         *PerformanceRuntimeData;
    249   UINT8                         *PerformanceRuntimeDataHead;
     336  UINTN                         BootPerformanceDataSize;
     337  UINT8                         *BootPerformanceData;
    250338  EFI_SMM_COMMUNICATION_PROTOCOL  *Communication;
    251339  FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;
     
    262350  // Collect boot records from SMM drivers.
    263351  //
    264   SmmCommData = NULL;
     352  SmmBootRecordCommBuffer = NULL;
     353  SmmCommData             = NULL;
    265354  Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &Communication);
    266355  if (!EFI_ERROR (Status)) {
     
    268357    // Initialize communicate buffer
    269358    //
     359    SmmBootRecordCommBuffer = AllocateZeroPool (SMM_BOOT_RECORD_COMM_SIZE);
     360    ASSERT (SmmBootRecordCommBuffer != NULL);
    270361    SmmCommBufferHeader = (EFI_SMM_COMMUNICATE_HEADER*)SmmBootRecordCommBuffer;
    271362    SmmCommData = (SMM_BOOT_RECORD_COMMUNICATE*)SmmCommBufferHeader->Data;
     
    299390
    300391  //
    301   // Prepare memory for runtime Performance Record.
    302   // Runtime performance records includes two tables S3 performance table and Boot performance table.
    303   // S3 Performance table includes S3Resume and S3Suspend records.
     392  // Prepare memory for Boot Performance table.
    304393  // Boot Performance table includes BasicBoot record, and one or more appended Boot Records.
    305394  //
    306   PerformanceRuntimeData = NULL;
    307   PerformanceRuntimeDataSize = sizeof (S3_PERFORMANCE_TABLE) + sizeof (BOOT_PERFORMANCE_TABLE) + mBootRecordSize + PcdGet32 (PcdExtFpdtBootRecordPadSize);
     395  BootPerformanceDataSize = sizeof (BOOT_PERFORMANCE_TABLE) + mBootRecordSize + PcdGet32 (PcdExtFpdtBootRecordPadSize);
    308396  if (SmmCommData != NULL) {
    309     PerformanceRuntimeDataSize += SmmCommData->BootRecordSize;
     397    BootPerformanceDataSize += SmmCommData->BootRecordSize;
    310398  }
    311399
     
    323411                  );
    324412  if (!EFI_ERROR (Status)) {
    325     Address = PerformanceVariable.S3PerformanceTablePointer;
    326413    Status = gBS->AllocatePages (
    327414                    AllocateAddress,
    328415                    EfiReservedMemoryType,
    329                     EFI_SIZE_TO_PAGES (PerformanceRuntimeDataSize),
    330                     &Address
     416                    EFI_SIZE_TO_PAGES (BootPerformanceDataSize),
     417                    &PerformanceVariable.BootPerformanceTablePointer
    331418                    );
    332419    if (!EFI_ERROR (Status)) {
    333       PerformanceRuntimeData = (UINT8 *) (UINTN) Address;
    334     }
    335   }
    336 
    337   if (PerformanceRuntimeData == NULL) {
     420      mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) (UINTN) PerformanceVariable.BootPerformanceTablePointer;
     421    }
     422  }
     423
     424  if (mAcpiBootPerformanceTable == NULL) {
    338425    //
    339426    // Fail to allocate at specified address, continue to allocate at any address.
    340427    //
    341     PerformanceRuntimeData = FpdtAllocateReservedMemoryBelow4G (PerformanceRuntimeDataSize);
    342   }
    343   DEBUG ((EFI_D_INFO, "FPDT: Performance Runtime Data address = 0x%x\n", PerformanceRuntimeData));
    344 
    345   if (PerformanceRuntimeData == NULL) {
     428    mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) FpdtAllocateReservedMemoryBelow4G (BootPerformanceDataSize);
     429  }
     430  DEBUG ((EFI_D_INFO, "FPDT: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable));
     431
     432  if (mAcpiBootPerformanceTable == NULL) {
    346433    if (SmmCommData != NULL && SmmCommData->BootRecordData != NULL) {
    347434      FreePool (SmmCommData->BootRecordData);
    348435    }
     436    if (SmmBootRecordCommBuffer != NULL) {
     437      FreePool (SmmBootRecordCommBuffer);
     438    }
     439    if (mAcpiS3PerformanceTable != NULL) {
     440      FreePages (mAcpiS3PerformanceTable, EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE)));
     441    }
    349442    return EFI_OUT_OF_RESOURCES;
    350443  }
    351  
    352   PerformanceRuntimeDataHead = PerformanceRuntimeData;
    353 
    354   if (FeaturePcdGet (PcdFirmwarePerformanceDataTableS3Support)) {
    355     //
    356     // Prepare S3 Performance Table.
    357     //
    358     mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) PerformanceRuntimeData;
    359     CopyMem (mAcpiS3PerformanceTable, &mS3PerformanceTableTemplate, sizeof (mS3PerformanceTableTemplate));
    360     PerformanceRuntimeData  = PerformanceRuntimeData + mAcpiS3PerformanceTable->Header.Length;
    361     DEBUG ((EFI_D_INFO, "FPDT: ACPI S3 Performance Table address = 0x%x\n", mAcpiS3PerformanceTable));
    362     //
    363     // Save S3 Performance Table address to Variable for use in Firmware Performance PEIM.
    364     //
    365     PerformanceVariable.S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;
    366     //
    367     // Update S3 Performance Table Pointer in template.
    368     //
    369     mFirmwarePerformanceTableTemplate.S3PointerRecord.S3PerformanceTablePointer = (UINT64) PerformanceVariable.S3PerformanceTablePointer;
    370   } else {
    371     //
    372     // Exclude S3 Performance Table Pointer from FPDT table template.
    373     //
    374     mFirmwarePerformanceTableTemplate.Header.Length -= sizeof (EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_POINTER_RECORD);
    375   }
    376444
    377445  //
    378446  // Prepare Boot Performance Table.
    379447  //
    380   mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) PerformanceRuntimeData;
     448  BootPerformanceData = (UINT8 *) mAcpiBootPerformanceTable;
    381449  //
    382450  // Fill Basic Boot record to Boot Performance Table.
    383451  //
    384   CopyMem (PerformanceRuntimeData, &mBootPerformanceTableTemplate, sizeof (mBootPerformanceTableTemplate));
    385   PerformanceRuntimeData = PerformanceRuntimeData + mAcpiBootPerformanceTable->Header.Length;
     452  CopyMem (mAcpiBootPerformanceTable, &mBootPerformanceTableTemplate, sizeof (mBootPerformanceTableTemplate));
     453  BootPerformanceData = BootPerformanceData + mAcpiBootPerformanceTable->Header.Length;
    386454  //
    387455  // Fill Boot records from boot drivers.
    388456  //
    389   CopyMem (PerformanceRuntimeData, mBootRecordBuffer, mBootRecordSize);
     457  CopyMem (BootPerformanceData, mBootRecordBuffer, mBootRecordSize);
    390458  mAcpiBootPerformanceTable->Header.Length += mBootRecordSize;
    391   PerformanceRuntimeData = PerformanceRuntimeData + mBootRecordSize;
     459  BootPerformanceData = BootPerformanceData + mBootRecordSize;
    392460  if (SmmCommData != NULL && SmmCommData->BootRecordData != NULL) {
    393461    //
    394462    // Fill Boot records from SMM drivers.
    395463    //
    396     CopyMem (PerformanceRuntimeData, SmmCommData->BootRecordData, SmmCommData->BootRecordSize);
     464    CopyMem (BootPerformanceData, SmmCommData->BootRecordData, SmmCommData->BootRecordSize);
    397465    FreePool (SmmCommData->BootRecordData);
    398466    mAcpiBootPerformanceTable->Header.Length = (UINT32) (mAcpiBootPerformanceTable->Header.Length + SmmCommData->BootRecordSize);
    399     PerformanceRuntimeData = PerformanceRuntimeData + SmmCommData->BootRecordSize;
    400   }
    401   //
    402   // Reserve space for boot records after ReadyToBoot.
    403   //
    404   PerformanceRuntimeData = PerformanceRuntimeData + PcdGet32 (PcdExtFpdtBootRecordPadSize);
    405   DEBUG ((EFI_D_INFO, "FPDT: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable));
     467    BootPerformanceData = BootPerformanceData + SmmCommData->BootRecordSize;
     468  }
     469  if (SmmBootRecordCommBuffer != NULL) {
     470    FreePool (SmmBootRecordCommBuffer);
     471  }
     472
    406473  //
    407474  // Save Boot Performance Table address to Variable for use in S4 resume.
     
    414481
    415482  //
     483  // Save S3 Performance Table address to Variable for use in S4 resume.
     484  //
     485  PerformanceVariable.S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;
     486  //
     487  // Update S3 Performance Table Pointer in template.
     488  //
     489  mFirmwarePerformanceTableTemplate.S3PointerRecord.S3PerformanceTablePointer = (UINT64) (UINTN) mAcpiS3PerformanceTable;
     490  //
    416491  // Save Runtime Performance Table pointers to Variable.
    417   //
    418   Status = gRT->SetVariable (
    419                   EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
    420                   &gEfiFirmwarePerformanceGuid,
    421                   EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
    422                   sizeof (PerformanceVariable),
    423                   &PerformanceVariable
    424                   );
    425   ASSERT_EFI_ERROR (Status);
     492  // Don't check SetVariable return status. It doesn't impact FPDT table generation.
     493  //
     494  gRT->SetVariable (
     495        EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
     496        &gEfiFirmwarePerformanceGuid,
     497        EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
     498        sizeof (PerformanceVariable),
     499        &PerformanceVariable
     500        );
    426501
    427502  //
     
    436511                                );
    437512  if (EFI_ERROR (Status)) {
    438     FreePool (PerformanceRuntimeDataHead);
     513    FreePages (mAcpiBootPerformanceTable, EFI_SIZE_TO_PAGES (BootPerformanceDataSize));
     514    if (mAcpiS3PerformanceTable != NULL) {
     515      FreePages (mAcpiS3PerformanceTable, EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE)));
     516    }
    439517    mAcpiBootPerformanceTable = NULL;
    440518    mAcpiS3PerformanceTable = NULL;
     
    516594  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry   = 0\n"));
    517595  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesExit    = 0\n"));
    518 }
    519 
    520 /**
    521   Notify function for event EVT_SIGNAL_EXIT_BOOT_SERVICES. This is used to record
    522   performance data for ExitBootServicesEntry in FPDT.
    523 
    524   @param[in]  Event   The Event that is being processed.
    525   @param[in]  Context The Event Context.
    526 
    527 **/
    528 VOID
    529 EFIAPI
    530 FpdtExitBootServicesEventNotify (
    531   IN EFI_EVENT        Event,
    532   IN VOID             *Context
    533   )
    534 {
    535   if (mAcpiBootPerformanceTable == NULL) {
    536     //
    537     // Firmware Performance Data Table not installed, do nothing.
    538     //
    539     return ;
    540   }
    541 
    542   //
    543   // Update Firmware Basic Boot Performance Record for UEFI boot.
    544   //
    545   mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry = GetTimeInNanoSecond (GetPerformanceCounter ());
    546 
    547   //
    548   // Dump FPDT Boot Performance record.
    549   //
    550   DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ResetEnd                = %ld\n", mAcpiBootPerformanceTable->BasicBoot.ResetEnd));
    551   DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderLoadImageStart  = %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderLoadImageStart));
    552   DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart));
    553   DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry   = %ld\n", mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry));
    554   //
    555   // ExitBootServicesExit will be updated later, so don't dump it here.
    556   //
    557596}
    558597
     
    594633    return EFI_UNSUPPORTED;
    595634  }
     635 
     636  if (Value == (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT)) {
     637    //
     638    // DxeCore ReportStatusCode Enable so that the capability can be supported.
     639    //
     640    mDxeCoreReportStatusCodeEnable = TRUE;
     641  }
    596642
    597643  Status = EFI_SUCCESS;
     
    622668  } else if (Value == (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES)) {
    623669    //
     670    // Unregister boot time report status code listener.
     671    //
     672    mRscHandlerProtocol->Unregister (FpdtStatusCodeListenerDxe);
     673
     674    //
    624675    // Progress code for ExitBootServices.
    625676    //
     
    632683    //
    633684    mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesExit = GetTimeInNanoSecond (GetPerformanceCounter ());
    634 
    635     //
    636     // Unregister boot time report status code listener.
    637     //
    638     mRscHandlerProtocol->Unregister (FpdtStatusCodeListenerDxe);
    639685  } else if (Data != NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
    640686    //
     
    683729}
    684730
     731
     732/**
     733  Notify function for event EVT_SIGNAL_EXIT_BOOT_SERVICES. This is used to record
     734  performance data for ExitBootServicesEntry in FPDT.
     735
     736  @param[in]  Event   The Event that is being processed.
     737  @param[in]  Context The Event Context.
     738
     739**/
     740VOID
     741EFIAPI
     742FpdtExitBootServicesEventNotify (
     743  IN EFI_EVENT        Event,
     744  IN VOID             *Context
     745  )
     746{
     747  if (!mDxeCoreReportStatusCodeEnable) {
     748    //
     749    // When DxeCore Report Status Code is disabled,
     750    // Unregister boot time report status code listener at ExitBootService Event.
     751    //
     752    mRscHandlerProtocol->Unregister (FpdtStatusCodeListenerDxe);
     753  }
     754
     755  if (mAcpiBootPerformanceTable == NULL) {
     756    //
     757    // Firmware Performance Data Table not installed, do nothing.
     758    //
     759    return ;
     760  }
     761
     762  //
     763  // Update Firmware Basic Boot Performance Record for UEFI boot.
     764  //
     765  mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry = GetTimeInNanoSecond (GetPerformanceCounter ());
     766
     767  //
     768  // Dump FPDT Boot Performance record.
     769  //
     770  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ResetEnd                = %ld\n", mAcpiBootPerformanceTable->BasicBoot.ResetEnd));
     771  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderLoadImageStart  = %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderLoadImageStart));
     772  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart));
     773  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry   = %ld\n", mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry));
     774  //
     775  // ExitBootServicesExit will be updated later, so don't dump it here.
     776  //
     777}
     778
    685779/**
    686780  The module Entry Point of the Firmware Performance Data Table DXE driver.
     
    703797  EFI_HOB_GUID_TYPE        *GuidHob;
    704798  FIRMWARE_SEC_PERFORMANCE *Performance;
     799  VOID                     *Registration;
     800  UINT64                   OemTableId;
     801
     802  CopyMem (
     803    mFirmwarePerformanceTableTemplate.Header.OemId,
     804    PcdGetPtr (PcdAcpiDefaultOemId),
     805    sizeof (mFirmwarePerformanceTableTemplate.Header.OemId)
     806    );
     807  OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
     808  CopyMem (&mFirmwarePerformanceTableTemplate.Header.OemTableId, &OemTableId, sizeof (UINT64));
     809  mFirmwarePerformanceTableTemplate.Header.OemRevision      = PcdGet32 (PcdAcpiDefaultOemRevision);
     810  mFirmwarePerformanceTableTemplate.Header.CreatorId        = PcdGet32 (PcdAcpiDefaultCreatorId);
     811  mFirmwarePerformanceTableTemplate.Header.CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);
    705812
    706813  //
     
    769876  }
    770877
     878  if (FeaturePcdGet (PcdFirmwarePerformanceDataTableS3Support)) {
     879    //
     880    // Register callback function upon VariableArchProtocol and LockBoxProtocol
     881    // to allocate S3 performance table memory and save the pointer to LockBox.
     882    //
     883    EfiCreateProtocolNotifyEvent (
     884      &gEfiVariableArchProtocolGuid,
     885      TPL_CALLBACK,
     886      FpdtAllocateS3PerformanceTableMemory,
     887      NULL,
     888      &Registration
     889      );
     890    EfiCreateProtocolNotifyEvent (
     891      &gEfiLockBoxProtocolGuid,
     892      TPL_CALLBACK,
     893      FpdtAllocateS3PerformanceTableMemory,
     894      NULL,
     895      &Registration
     896      );
     897  } else {
     898    //
     899    // Exclude S3 Performance Table Pointer from FPDT table template.
     900    //
     901    mFirmwarePerformanceTableTemplate.Header.Length -= sizeof (EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_POINTER_RECORD);
     902  }
     903
    771904  return EFI_SUCCESS;
    772905}
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf

    r48674 r58459  
    66#  and install FPDT to ACPI table.
    77#
    8 #  Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
     8#  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
    99#  This program and the accompanying materials
    1010#  are licensed and made available under the terms and conditions of the BSD License
     
    2020  INF_VERSION                    = 0x00010005
    2121  BASE_NAME                      = FirmwarePerformanceDxe
     22  MODULE_UNI_FILE                = FirmwarePerformanceDxe.uni
    2223  FILE_GUID                      = 00160F8D-2B35-4df2-BBE0-B272A8D631F0
    2324  MODULE_TYPE                    = DXE_DRIVER
     
    4950  PcdLib
    5051  HobLib
    51   PcdLib
     52  LockBoxLib
     53  UefiLib
    5254
    5355[Protocols]
    54   gEfiAcpiTableProtocolGuid                     ## SOMETIMES_CONSUMES
     56  gEfiAcpiTableProtocolGuid                     ## CONSUMES
    5557  gEfiRscHandlerProtocolGuid                    ## CONSUMES
    5658  gEfiSmmCommunicationProtocolGuid              ## SOMETIMES_CONSUMES
     59  gEfiVariableArchProtocolGuid                  ## CONSUMES
     60  gEfiLockBoxProtocolGuid                       ## CONSUMES
    5761
    5862[Guids]
    59   gEfiEventExitBootServicesGuid                 ## CONSUMES
    60   gEfiEventReadyToBootGuid                      ## CONSUMES
    61   gEfiEventLegacyBootGuid                       ## CONSUMES
    62   gEfiAcpiTableGuid                             ## SOMETIMES_CONSUMES
    63   gEfiAcpi10TableGuid                           ## SOMETIMES_CONSUMES
    64   gEfiAcpi20TableGuid                           ## SOMETIMES_CONSUMES
    65   gEfiFirmwarePerformanceGuid                   ## PRODUCES  ## Variable:L"FirmwarePerformance"
    66   gEfiFirmwarePerformanceGuid                   ## SOMETIMES_CONSUMES ## Hob
    67   gEfiFirmwarePerformanceGuid                   ## SOMETIMES_CONSUMES ## SmiHandler
    68   gEfiFirmwarePerformanceGuid                   ## SOMETIMES_CONSUMES ## StatusCode Data
     63  gEfiEventExitBootServicesGuid                 ## CONSUMES             ## Event
     64  gEfiEventReadyToBootGuid                      ## CONSUMES             ## Event
     65  gEfiEventLegacyBootGuid                       ## SOMETIMES_CONSUMES   ## Event
     66  ## SOMETIMES_CONSUMES   ## HOB
     67  ## SOMETIMES_CONSUMES   ## Variable:L"FirmwarePerformance"
     68  ## PRODUCES             ## Variable:L"FirmwarePerformance"
     69  ## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communication
     70  ## SOMETIMES_CONSUMES ## UNDEFINED # StatusCode Data
     71  gEfiFirmwarePerformanceGuid
     72  gFirmwarePerformanceS3PointerGuid             ## PRODUCES ## UNDEFINED # SaveLockBox
    6973
    7074[Pcd]
    71   gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderLoad
    72   gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderStart
    73   gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize
     75  gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderLoad    ## CONSUMES
     76  gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderStart   ## CONSUMES
     77  gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize    ## CONSUMES
     78  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId            ## CONSUMES
     79  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId       ## CONSUMES
     80  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision      ## CONSUMES
     81  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId        ## CONSUMES
     82  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision  ## CONSUMES
    7483
    7584[FeaturePcd]
    76   gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwarePerformanceDataTableS3Support
     85  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwarePerformanceDataTableS3Support   ## CONSUMES
    7786
    7887[Depex]
    7988  gEfiRscHandlerProtocolGuid
     89
     90[UserExtensions.TianoCore."ExtraFiles"]
     91  FirmwarePerformanceDxeExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.c

    r48674 r58459  
    88  for S3 Resume Performance Record on S3 resume boot path.
    99
    10   Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
     10  Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
    1111  This program and the accompanying materials
    1212  are licensed and made available under the terms and conditions of the BSD License
     
    2121#include <PiPei.h>
    2222
    23 #include <IndustryStandard/Acpi50.h>
    24 
    25 #include <Ppi/ReadOnlyVariable2.h>
    2623#include <Ppi/ReportStatusCodeHandler.h>
    2724#include <Ppi/SecPerformance.h>
     
    7168  EFI_STATUS                           Status;
    7269  UINT64                               CurrentTime;
    73   EFI_PEI_READ_ONLY_VARIABLE2_PPI      *VariableServices;
    7470  UINTN                                VarSize;
    75   FIRMWARE_PERFORMANCE_VARIABLE        PerformanceVariable;
     71  EFI_PHYSICAL_ADDRESS                 S3PerformanceTablePointer;
    7672  S3_PERFORMANCE_TABLE                 *AcpiS3PerformanceTable;
    7773  EFI_ACPI_5_0_FPDT_S3_RESUME_RECORD   *AcpiS3ResumeRecord;
     
    9389  CurrentTime = GetTimeInNanoSecond (GetPerformanceCounter ());
    9490
    95   Status = PeiServicesLocatePpi (
    96              &gEfiPeiReadOnlyVariable2PpiGuid,
    97              0,
    98              NULL,
    99              (VOID **) &VariableServices
    100              );
     91  //
     92  // Update S3 Resume Performance Record.
     93  //
     94  S3PerformanceTablePointer = 0;
     95  VarSize = sizeof (EFI_PHYSICAL_ADDRESS);
     96  Status = RestoreLockBox (&gFirmwarePerformanceS3PointerGuid, &S3PerformanceTablePointer, &VarSize);
    10197  ASSERT_EFI_ERROR (Status);
    10298
    103   //
    104   // Update S3 Resume Performance Record.
    105   //
    106   VarSize = sizeof (FIRMWARE_PERFORMANCE_VARIABLE);
    107   Status = VariableServices->GetVariable (
    108                                VariableServices,
    109                                EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
    110                                &gEfiFirmwarePerformanceGuid,
    111                                NULL,
    112                                &VarSize,
    113                                &PerformanceVariable
    114                                );
    115   if (EFI_ERROR (Status)) {
    116     return Status;
     99  AcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) (UINTN) S3PerformanceTablePointer;
     100  ASSERT (AcpiS3PerformanceTable != NULL);
     101  if (AcpiS3PerformanceTable->Header.Signature != EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_SIGNATURE) {
     102    DEBUG ((EFI_D_ERROR, "FPDT S3 performance data in ACPI memory get corrupted\n"));
     103    return EFI_ABORTED;
    117104  }
    118 
    119   AcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) (UINTN) PerformanceVariable.S3PerformanceTablePointer;
    120   ASSERT (AcpiS3PerformanceTable != NULL);
    121   ASSERT (AcpiS3PerformanceTable->Header.Signature == EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_SIGNATURE);
    122105  AcpiS3ResumeRecord = &AcpiS3PerformanceTable->S3Resume;
    123106  AcpiS3ResumeRecord->FullResume = CurrentTime;
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf

    r48674 r58459  
    11## @file
    2 #  This module updates S3 Resume Performance Record in ACPI Firmware Performance
    3 #  Data Table in S3 resume boot mode. In normal boot mode, this module consumes
    4 #  SecPerformance PPI produced by SEC phase and build Hob to convey the SEC
    5 #  performance data to DXE phase.
     2#  Firmware Performance Pei Module.
     3#
     4#  In S3 resume boot mode, it updates S3 Resume Performance Record in ACPI Firmware Performance Data Table.
     5#  In normal boot mode, it consumes SecPerformance PPI produced by SEC phase
     6#  and build Hob to convey the SEC performance data to DXE phase.
    67#
    78#  This module register report status code listener to collect performance data
    89#  for S3 Resume Performance Record on S3 resume boot path.
    910#
    10 #  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
     11#  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
    1112#  This program and the accompanying materials
    1213#  are licensed and made available under the terms and conditions of the BSD License
     
    2223  INF_VERSION                    = 0x00010005
    2324  BASE_NAME                      = FirmwarePerformancePei
     25  MODULE_UNI_FILE                = FirmwarePerformancePei.uni
    2426  FILE_GUID                      = ADF01BF6-47D6-495d-B95B-687777807214
    2527  MODULE_TYPE                    = PEIM
     
    5355[Ppis]
    5456  gEfiPeiRscHandlerPpiGuid                      ## CONSUMES
    55   gEfiPeiReadOnlyVariable2PpiGuid               ## SOMETIMES_CONSUMES
    56   gPeiSecPerformancePpiGuid                     ## CONSUMES
     57  gPeiSecPerformancePpiGuid                     ## SOMETIMES_CONSUMES
    5758
    5859[Guids]
    59   gEfiFirmwarePerformanceGuid                   ## CONSUMES
     60  ## SOMETIMES_CONSUMES   ## UNDEFINED # RestoreLockBox
     61  ## SOMETIMES_PRODUCES   ## HOB
     62  ## SOMETIMES_CONSUMES   ## Variable:L"FirmwarePerformance"
     63  gEfiFirmwarePerformanceGuid
     64  gFirmwarePerformanceS3PointerGuid             ## SOMETIMES_CONSUMES ## UNDEFINED # RestoreLockBox
    6065
    6166[FeaturePcd]
    62   gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwarePerformanceDataTableS3Support
     67  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwarePerformanceDataTableS3Support   ## CONSUMES
    6368
    6469[Depex]
    6570  gEfiPeiMasterBootModePpiGuid AND gEfiPeiRscHandlerPpiGuid
     71
     72# [BootMode]
     73# S3_RESUME             ## SOMETIMES_CONSUMES
     74
     75[UserExtensions.TianoCore."ExtraFiles"]
     76  FirmwarePerformancePeiExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c

    r48674 r58459  
    55  for SMM driver boot records and S3 Suspend Performance Record.
    66
    7   Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
     7  Caution: This module requires additional review when modified.
     8  This driver will have external input - communicate buffer in SMM mode.
     9  This external input must be validated carefully to avoid security issue like
     10  buffer overflow, integer overflow.
     11
     12  FpdtSmiHandler() will receive untrusted input and do basic validation.
     13
     14  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
    815  This program and the accompanying materials
    916  are licensed and made available under the terms and conditions of the BSD License
     
    1825#include <PiSmm.h>
    1926
    20 #include <IndustryStandard/Acpi50.h>
    21 
    2227#include <Protocol/SmmReportStatusCodeHandler.h>
    23 #include <Protocol/SmmAccess2.h>
    2428
    2529#include <Guid/FirmwarePerformance.h>
     
    3539#include <Library/UefiBootServicesTableLib.h>
    3640#include <Library/SynchronizationLib.h>
     41#include <Library/SmmMemLib.h>
    3742
    3843#define EXTENSION_RECORD_SIZE     0x1000
     
    4550UINT8                         *mBootRecordBuffer = NULL;
    4651
    47 EFI_SMRAM_DESCRIPTOR          *mSmramRanges;
    48 UINTN                         mSmramRangeCount;
    4952SPIN_LOCK                     mSmmFpdtLock;
    5053BOOLEAN                       mSmramIsOutOfResource = FALSE;
     
    102105      //
    103106      if (mSmramIsOutOfResource) {
     107        ReleaseSpinLock (&mSmmFpdtLock);
    104108        return EFI_OUT_OF_RESOURCES;
    105109      }
    106       NewRecordBuffer = AllocatePool (mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE);
     110      NewRecordBuffer = ReallocatePool (mBootRecordSize, mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE, mBootRecordBuffer);
    107111      if (NewRecordBuffer == NULL) {
     112        ReleaseSpinLock (&mSmmFpdtLock);
    108113        mSmramIsOutOfResource = TRUE;
    109114        return EFI_OUT_OF_RESOURCES;
    110115      }
    111       CopyMem (NewRecordBuffer, mBootRecordBuffer, mBootRecordSize);
    112116      mBootRecordBuffer  = NewRecordBuffer;
    113117      mBootRecordMaxSize = mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE;
     
    173177
    174178/**
    175   This function check if the address is in SMRAM.
    176 
    177   @param Buffer  the buffer address to be checked.
    178   @param Length  the buffer length to be checked.
    179 
    180   @retval TRUE  this address is in SMRAM.
    181   @retval FALSE this address is NOT in SMRAM.
    182 **/
    183 BOOLEAN
    184 InternalIsAddressInSmram (
    185   IN EFI_PHYSICAL_ADDRESS  Buffer,
    186   IN UINT64                Length
    187   )
    188 {
    189   UINTN  Index;
    190 
    191   for (Index = 0; Index < mSmramRangeCount; Index ++) {
    192     if (((Buffer >= mSmramRanges[Index].CpuStart) && (Buffer < mSmramRanges[Index].CpuStart + mSmramRanges[Index].PhysicalSize)) ||
    193         ((mSmramRanges[Index].CpuStart >= Buffer) && (mSmramRanges[Index].CpuStart < Buffer + Length))) {
    194       return TRUE;
    195     }
    196   }
    197 
    198   return FALSE;
    199 }
    200 
    201 /**
    202179  Communication service SMI Handler entry.
    203180
    204181  This SMI handler provides services for report SMM boot records.
     182
     183  Caution: This function may receive untrusted input.
     184  Communicate buffer and buffer size are external input, so this function will do basic validation.
    205185
    206186  @param[in]     DispatchHandle  The unique handle assigned to this handler by SmiHandlerRegister().
     
    211191  @param[in, out] CommBufferSize The size of the CommBuffer.
    212192
    213   @retval EFI_SUCCESS            The interrupt was handled and quiesced. No other handlers should still be called.
    214   @retval EFI_INVALID_PARAMETER  The interrupt parameter is not valid.
    215   @retval EFI_ACCESS_DENIED      The interrupt buffer can't be written.
    216   @retval EFI_UNSUPPORTED        The interrupt is not supported.
     193  @retval EFI_SUCCESS                         The interrupt was handled and quiesced. No other handlers
     194                                              should still be called.
     195  @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED  The interrupt has been quiesced but other handlers should
     196                                              still be called.
     197  @retval EFI_WARN_INTERRUPT_SOURCE_PENDING   The interrupt is still pending and other handlers should still
     198                                              be called.
     199  @retval EFI_INTERRUPT_PENDING               The interrupt could not be quiesced.
     200
    217201**/
    218202EFI_STATUS
     
    227211  EFI_STATUS                   Status;
    228212  SMM_BOOT_RECORD_COMMUNICATE  *SmmCommData;
     213  UINTN                        BootRecordSize;
     214  VOID                         *BootRecordData;
     215  UINTN                        TempCommBufferSize;
     216
     217  //
     218  // If input is invalid, stop processing this SMI
     219  //
     220  if (CommBuffer == NULL || CommBufferSize == NULL) {
     221    return EFI_SUCCESS;
     222  }
     223
     224  TempCommBufferSize = *CommBufferSize;
     225
     226  if(TempCommBufferSize < sizeof (SMM_BOOT_RECORD_COMMUNICATE)) {
     227    return EFI_SUCCESS;
     228  }
    229229 
    230   ASSERT (CommBuffer != NULL);
    231   if (CommBuffer == NULL || *CommBufferSize < sizeof (SMM_BOOT_RECORD_COMMUNICATE)) {
    232     return EFI_INVALID_PARAMETER;
    233   }
     230  if (!SmmIsBufferOutsideSmmValid ((UINTN)CommBuffer, TempCommBufferSize)) {
     231    DEBUG ((EFI_D_ERROR, "FpdtSmiHandler: SMM communication data buffer in SMRAM or overflow!\n"));
     232    return EFI_SUCCESS;
     233  }
     234
     235  SmmCommData = (SMM_BOOT_RECORD_COMMUNICATE*)CommBuffer;
    234236
    235237  Status = EFI_SUCCESS;
    236   SmmCommData = (SMM_BOOT_RECORD_COMMUNICATE*)CommBuffer;
    237238
    238239  switch (SmmCommData->Function) {
     
    242243
    243244    case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA :
    244        if (SmmCommData->BootRecordData == NULL || SmmCommData->BootRecordSize < mBootRecordSize) {
     245       BootRecordData = SmmCommData->BootRecordData;
     246       BootRecordSize = SmmCommData->BootRecordSize;
     247       if (BootRecordData == NULL || BootRecordSize < mBootRecordSize) {
    245248         Status = EFI_INVALID_PARAMETER;
    246249         break;
    247250       }
    248            
     251
    249252       //
    250253       // Sanity check
    251254       //
    252255       SmmCommData->BootRecordSize = mBootRecordSize;
    253        if (InternalIsAddressInSmram ((EFI_PHYSICAL_ADDRESS)(UINTN)SmmCommData->BootRecordData, mBootRecordSize)) {
    254          DEBUG ((EFI_D_ERROR, "Smm Data buffer is in SMRAM!\n"));
     256       if (!SmmIsBufferOutsideSmmValid ((UINTN)BootRecordData, mBootRecordSize)) {
     257         DEBUG ((EFI_D_ERROR, "FpdtSmiHandler: SMM Data buffer in SMRAM or overflow!\n"));
    255258         Status = EFI_ACCESS_DENIED;
    256259         break;
     
    258261
    259262       CopyMem (
    260          (UINT8*)SmmCommData->BootRecordData,
     263         (UINT8*)BootRecordData,
    261264         mBootRecordBuffer,
    262265         mBootRecordSize
     
    265268
    266269    default:
    267        ASSERT (FALSE);
    268270       Status = EFI_UNSUPPORTED;
    269271  }
    270272
    271273  SmmCommData->ReturnStatus = Status;
     274 
    272275  return EFI_SUCCESS;
    273276}
     
    292295  EFI_STATUS                Status;
    293296  EFI_HANDLE                Handle;
    294   EFI_SMM_ACCESS2_PROTOCOL  *SmmAccess;
    295   UINTN                     Size;
    296297
    297298  //
     
    317318
    318319  //
    319   // Get SMRAM information
    320   //
    321   Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **)&SmmAccess);
    322   ASSERT_EFI_ERROR (Status);
    323 
    324   Size = 0;
    325   Status = SmmAccess->GetCapabilities (SmmAccess, &Size, NULL);
    326   ASSERT (Status == EFI_BUFFER_TOO_SMALL);
    327 
    328   Status = gSmst->SmmAllocatePool (
    329                     EfiRuntimeServicesData,
    330                     Size,
    331                     (VOID **)&mSmramRanges
    332                     );
    333   ASSERT_EFI_ERROR (Status);
    334 
    335   Status = SmmAccess->GetCapabilities (SmmAccess, &Size, mSmramRanges);
    336   ASSERT_EFI_ERROR (Status);
    337 
    338   mSmramRangeCount = Size / sizeof (EFI_SMRAM_DESCRIPTOR);
    339 
    340   //
    341320  // Register SMI handler.
    342321  //
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf

    r48674 r58459  
    55#  for SMM boot performance records and S3 Suspend Performance Record.
    66#
    7 #  Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
     7#  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
    88#  This program and the accompanying materials
    99#  are licensed and made available under the terms and conditions of the BSD License
     
    1919  INF_VERSION                    = 0x00010005
    2020  BASE_NAME                      = FirmwarePerformanceSmm
     21  MODULE_UNI_FILE                = FirmwarePerformanceSmm.uni
    2122  FILE_GUID                      = 044310AB-77FD-402a-AF1A-87D4120E7329
    2223  MODULE_TYPE                    = DXE_SMM_DRIVER
     
    5051  UefiBootServicesTableLib
    5152  SynchronizationLib
     53  SmmMemLib
    5254
    5355[Protocols]
    5456  gEfiSmmRscHandlerProtocolGuid                 ## CONSUMES
    55   gEfiSmmAccess2ProtocolGuid                    ## CONSUMES
    5657
    5758[Guids]
    58   gEfiFirmwarePerformanceGuid                   ## CONSUMES  ## LockBox
    59   gEfiFirmwarePerformanceGuid                   ## PRODUCES  ## SmiHandler
    60   gEfiFirmwarePerformanceGuid                   ## SOMETIMES_CONSUMES ## StatusCode Data
     59  ## SOMETIMES_PRODUCES   ## UNDEFINED # SaveLockBox
     60  ## PRODUCES             ## UNDEFINED # SmiHandlerRegister
     61  ## SOMETIMES_CONSUMES   ## UNDEFINED # StatusCode Data
     62  gEfiFirmwarePerformanceGuid
    6163
    6264[Pcd]
    63   gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeS3SuspendStart
    64   gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeS3SuspendEnd
     65  gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeS3SuspendStart  ## CONSUMES
     66  gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeS3SuspendEnd    ## CONSUMES
    6567
    6668[Depex]
    6769  gEfiSmmRscHandlerProtocolGuid
     70
     71[UserExtensions.TianoCore."ExtraFiles"]
     72  FirmwarePerformanceSmmExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/InternalS3SaveState.h

    r48674 r58459  
    2626#include <Library/UefiRuntimeServicesTableLib.h>
    2727#include <Library/S3BootScriptLib.h>
    28 #include <Library/PcdLib.h>
    2928#include <Library/SmbusLib.h>
    3029#include <IndustryStandard/SmBus.h>
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c

    r48674 r58459  
    22  Implementation for S3 Boot Script Saver state driver.
    33
    4   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
    55
    66  This program and the accompanying materials
     
    345345  VOID                      *DataMask;                                 
    346346  UINTN                     Delay;                                   
    347                                                                          
     347  UINTN                     LoopTimes;
     348  UINT32                    Remainder;
     349
    348350  Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);                 
    349351  Address  = VA_ARG (Marker, UINT64);                                   
     
    352354  Delay    = (UINTN)VA_ARG (Marker, UINT64);                           
    353355  //
    354   // According to the spec, the interval between 2 pools is 100ns
    355   //                                                                       
    356   return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 100, Delay);
     356  // According to the spec, the interval between 2 polls is 100ns,
     357  // but the unit of Duration for S3BootScriptSaveMemPoll() is microsecond(1000ns).
     358  // Duration * 1000ns * LoopTimes = Delay * 100ns
     359  // Duration will be minimum 1(microsecond) to be minimum deviation,
     360  // so LoopTimes = Delay / 10.
     361  //
     362  LoopTimes = (UINTN) DivU64x32Remainder (
     363                Delay,
     364                10,
     365                &Remainder
     366                );
     367  if (Remainder != 0) {
     368    //
     369    // If Remainder is not zero, LoopTimes will be rounded up by 1.
     370    //
     371    LoopTimes +=1;
     372  }
     373  return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 1, LoopTimes);
    357374
    358375}
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf

    r48674 r58459  
    11## @file
    2 # Component description file for ScriptSave module.
     2# S3 Boot Script Save State driver.
    33#
    4 # Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
     4# It will install S3 Save State protocol to store or record various IO operations to be replayed during an S3 resume.
     5#
     6# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
    57#
    68# This program and the accompanying materials are
     
    1719  INF_VERSION                    = 0x00010005
    1820  BASE_NAME                      = S3SaveStateDxe
     21  MODULE_UNI_FILE                = S3SaveStateDxe.uni
    1922  FILE_GUID                      = BDCE85BB-FBAA-4f4e-9264-501A2C249581
    2023  MODULE_TYPE                    = DXE_DRIVER
     
    3942
    4043[LibraryClasses]
    41   PcdLib
    42   UefiRuntimeServicesTableLib
    4344  UefiBootServicesTableLib
    4445  MemoryAllocationLib
    4546  UefiDriverEntryPoint
    4647  BaseMemoryLib
    47   DebugLib
    4848  BaseLib
    4949  S3BootScriptLib
    5050
    5151[Protocols]
    52   gEfiS3SaveStateProtocolGuid                # PROTOCOL ALWAYS_PRODUCED
     52  gEfiS3SaveStateProtocolGuid                ## PRODUCES
    5353
    5454
    5555[Depex]
    56   TRUE       
    57  
     56  TRUE
     57
     58[UserExtensions.TianoCore."ExtraFiles"]
     59  S3SaveStateDxeExtra.uni
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c

    r48674 r58459  
    22  Implementation for S3 SMM Boot Script Saver state driver.
    33
    4   Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
    55
    66  This program and the accompanying materials
     
    344344  VOID                      *DataMask;                                   
    345345  UINTN                      Delay;                                       
    346                                                                          
     346  UINTN                      LoopTimes;
     347  UINT32                     Remainder;
     348
    347349  Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);                 
    348350  Address  = VA_ARG (Marker, UINT64);                                   
     
    351353  Delay    = (UINTN)VA_ARG (Marker, UINT64);                           
    352354  //
    353   // According to the spec, the interval between 2 pools is 100ns
    354   //                                                                       
    355   return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 100, Delay);
     355  // According to the spec, the interval between 2 polls is 100ns,
     356  // but the unit of Duration for S3BootScriptSaveMemPoll() is microsecond(1000ns).
     357  // Duration * 1000ns * LoopTimes = Delay * 100ns
     358  // Duration will be minimum 1(microsecond) to be minimum deviation,
     359  // so LoopTimes = Delay / 10.
     360  //
     361  LoopTimes = (UINTN) DivU64x32Remainder (
     362                Delay,
     363                10,
     364                &Remainder
     365                );
     366  if (Remainder != 0) {
     367    //
     368    // If Remainder is not zero, LoopTimes will be rounded up by 1.
     369    //
     370    LoopTimes +=1;
     371  }
     372  return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 1, LoopTimes);
    356373
    357374}
  • trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.inf

    r48674 r58459  
    11## @file
    2 # Component description file for ScriptSave Lite module.
     2# S3 SMM Boot Script Save State driver.
    33#
    4 # This is an implementation of the Boot Script Save protocol.
     4# It will install S3 SMM Save State protocol to store or record various IO operations to be replayed during an S3 resume.
    55#
    6 # Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
     6# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
    77#
    88# This program and the accompanying materials are
     
    1919  INF_VERSION                    = 0x00010005
    2020  BASE_NAME                      = SmmS3SaveState
     21  MODULE_UNI_FILE                = SmmS3SaveState.uni
    2122  FILE_GUID                      = 2D59F041-53A4-40d0-A6CD-844DC0DFEF17
    2223  MODULE_TYPE                    = DXE_SMM_DRIVER
     
    4546  UefiDriverEntryPoint
    4647  BaseMemoryLib
    47   DebugLib
    4848  BaseLib
    4949  S3BootScriptLib
    5050
    5151[Protocols]
    52   gEfiS3SmmSaveStateProtocolGuid                # PROTOCOL ALWAYS_PRODUCED
     52  gEfiS3SmmSaveStateProtocolGuid                ## PRODUCES
    5353
    5454[Depex]
    5555  TRUE
    5656
     57[UserExtensions.TianoCore."ExtraFiles"]
     58  SmmS3SaveStateExtra.uni
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette