]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Core / PiSmmCore / PiSmmCore.h
index fbbecfae520f7d5ed59283e5c4defa7b68961446..da01a1f07dc36be6325c82f9e62827a24dc9f24f 100644 (file)
@@ -2,14 +2,8 @@
   The internal header file includes the common header files, defines\r
   internal structure and functions used by SmmCore module.\r
 \r
-  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
-  This program and the accompanying materials are licensed and made available \r
-  under the terms and conditions of the BSD License which accompanies this \r
-  distribution.  The full text of the license may be found at        \r
-  http://opensource.org/licenses/bsd-license.php                                            \r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #include <Protocol/CpuIo2.h>\r
 #include <Protocol/SmmCommunication.h>\r
 #include <Protocol/SmmAccess2.h>\r
-#include <Protocol/FirmwareVolume2.h>   \r
-#include <Protocol/LoadedImage.h>       \r
-#include <Protocol/DevicePath.h>        \r
-#include <Protocol/Security.h>          \r
+#include <Protocol/FirmwareVolume2.h>\r
+#include <Protocol/LoadedImage.h>\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/Security.h>\r
 #include <Protocol/Security2.h>\r
 #include <Protocol/SmmExitBootServices.h>\r
 #include <Protocol/SmmLegacyBoot.h>\r
 #include <Protocol/SmmReadyToBoot.h>\r
-#include <Protocol/SmmEndOfS3Resume.h>\r
-#include <Protocol/SmmMemoryAttribute.h>
+#include <Protocol/SmmMemoryAttribute.h>\r
+#include <Protocol/SmmSxDispatch2.h>\r
 \r
 #include <Guid/Apriori.h>\r
 #include <Guid/EventGroup.h>\r
@@ -41,6 +35,8 @@
 #include <Guid/MemoryProfile.h>\r
 #include <Guid/LoadModuleAtFixedAddress.h>\r
 #include <Guid/SmiHandlerProfile.h>\r
+#include <Guid/EndOfS3Resume.h>\r
+#include <Guid/S3SmmInitDone.h>\r
 \r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
-#include <Library/DevicePathLib.h>             \r
-#include <Library/UefiLib.h>                   \r
+#include <Library/DevicePathLib.h>\r
+#include <Library/UefiLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/SmmCorePlatformHookLib.h>\r
 #include <Library/PerformanceLib.h>\r
-#include <Library/TimerLib.h>\r
 #include <Library/HobLib.h>\r
 #include <Library/SmmMemLib.h>\r
 \r
 #include "PiSmmCorePrivateData.h"\r
-#include "HeapGuard.h"
+#include "HeapGuard.h"\r
 \r
 //\r
 // Used to build a table of SMI Handlers that the SMM Core registers\r
@@ -134,7 +129,7 @@ typedef struct {
   //\r
   PHYSICAL_ADDRESS                ImageEntryPoint;\r
   //\r
-  // Image Buffer in SMRAM  \r
+  // Image Buffer in SMRAM\r
   //\r
   PHYSICAL_ADDRESS                ImageBuffer;\r
   //\r
@@ -320,7 +315,7 @@ SmmAllocatePages (
   @param  NumberOfPages          The number of pages to allocate\r
   @param  Memory                 A pointer to receive the base allocated memory\r
                                  address\r
-  @param  NeedGuard              Flag to indicate Guard page is needed or not
+  @param  NeedGuard              Flag to indicate Guard page is needed or not\r
 \r
   @retval EFI_INVALID_PARAMETER  Parameters violate checking rules defined in spec.\r
   @retval EFI_NOT_FOUND          Could not allocate pages match the requirement.\r
@@ -334,8 +329,8 @@ SmmInternalAllocatePages (
   IN      EFI_ALLOCATE_TYPE         Type,\r
   IN      EFI_MEMORY_TYPE           MemoryType,\r
   IN      UINTN                     NumberOfPages,\r
-  OUT     EFI_PHYSICAL_ADDRESS      *Memory,
-  IN      BOOLEAN                   NeedGuard
+  OUT     EFI_PHYSICAL_ADDRESS      *Memory,\r
+  IN      BOOLEAN                   NeedGuard\r
   );\r
 \r
 /**\r
@@ -361,8 +356,8 @@ SmmFreePages (
 \r
   @param  Memory                 Base address of memory being freed\r
   @param  NumberOfPages          The number of pages to free\r
-  @param  IsGuarded              Flag to indicate if the memory is guarded
-                                 or not
+  @param  IsGuarded              Flag to indicate if the memory is guarded\r
+                                 or not\r
 \r
   @retval EFI_NOT_FOUND          Could not find the entry that covers the range\r
   @retval EFI_INVALID_PARAMETER  Address not aligned, Address is zero or NumberOfPages is zero.\r
@@ -373,8 +368,8 @@ EFI_STATUS
 EFIAPI\r
 SmmInternalFreePages (\r
   IN      EFI_PHYSICAL_ADDRESS      Memory,\r
-  IN      UINTN                     NumberOfPages,
-  IN      BOOLEAN                   IsGuarded
+  IN      UINTN                     NumberOfPages,\r
+  IN      BOOLEAN                   IsGuarded\r
   );\r
 \r
 /**\r
@@ -809,6 +804,29 @@ SmmReadyToBootHandler (
   IN OUT UINTN                    *CommBufferSize  OPTIONAL\r
   );\r
 \r
+/**\r
+  Software SMI handler that is called when the S3SmmInitDone signal is triggered.\r
+  This function installs the SMM S3SmmInitDone Protocol so SMM Drivers are informed that\r
+  S3 SMM initialization has been done.\r
+\r
+  @param  DispatchHandle  The unique handle assigned to this handler by SmiHandlerRegister().\r
+  @param  Context         Points to an optional handler context which was specified when the handler was registered.\r
+  @param  CommBuffer      A pointer to a collection of data in memory that will\r
+                          be conveyed from a non-SMM environment into an SMM environment.\r
+  @param  CommBufferSize  The size of the CommBuffer.\r
+\r
+  @return Status Code\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmmS3SmmInitDoneHandler (\r
+  IN     EFI_HANDLE  DispatchHandle,\r
+  IN     CONST VOID  *Context,        OPTIONAL\r
+  IN OUT VOID        *CommBuffer,     OPTIONAL\r
+  IN OUT UINTN       *CommBufferSize  OPTIONAL\r
+  );\r
+\r
 /**\r
   Software SMI handler that is called when the EndOfS3Resume event is trigged.\r
   This function installs the SMM EndOfS3Resume Protocol so SMM Drivers are informed that\r
@@ -1262,74 +1280,74 @@ typedef enum {
 \r
 extern LIST_ENTRY  mSmmPoolLists[SmmPoolTypeMax][MAX_POOL_INDEX];\r
 \r
-/**
-  Internal Function. Allocate n pages from given free page node.
-
-  @param  Pages                  The free page node.
-  @param  NumberOfPages          Number of pages to be allocated.
-  @param  MaxAddress             Request to allocate memory below this address.
-
-  @return Memory address of allocated pages.
-
-**/
-UINTN
-InternalAllocPagesOnOneNode (
-  IN OUT FREE_PAGE_LIST   *Pages,
-  IN     UINTN            NumberOfPages,
-  IN     UINTN            MaxAddress
-  );
-
-/**
-  Update SMM memory map entry.
-
-  @param[in]  Type                   The type of allocation to perform.
-  @param[in]  Memory                 The base of memory address.
-  @param[in]  NumberOfPages          The number of pages to allocate.
-  @param[in]  AddRegion              If this memory is new added region.
-**/
-VOID
-ConvertSmmMemoryMapEntry (
-  IN EFI_MEMORY_TYPE       Type,
-  IN EFI_PHYSICAL_ADDRESS  Memory,
-  IN UINTN                 NumberOfPages,
-  IN BOOLEAN               AddRegion
-  );
-
-/**
-  Internal function.  Moves any memory descriptors that are on the
-  temporary descriptor stack to heap.
-
-**/
-VOID
-CoreFreeMemoryMapStack (
-  VOID
-  );
-
-/**
-  Frees previous allocated pages.
-
-  @param[in]  Memory                 Base address of memory being freed.
-  @param[in]  NumberOfPages          The number of pages to free.
-  @param[in]  AddRegion              If this memory is new added region.
-
-  @retval EFI_NOT_FOUND          Could not find the entry that covers the range.
-  @retval EFI_INVALID_PARAMETER  Address not aligned, Address is zero or NumberOfPages is zero.
-  @return EFI_SUCCESS            Pages successfully freed.
-
-**/
-EFI_STATUS
-SmmInternalFreePagesEx (
-  IN EFI_PHYSICAL_ADDRESS  Memory,
-  IN UINTN                 NumberOfPages,
-  IN BOOLEAN               AddRegion
-  );
-
-/**
-  Hook function used to set all Guard pages after entering SMM mode.
-**/
-VOID
-SmmEntryPointMemoryManagementHook (
-  VOID
-  );
-
+/**\r
+  Internal Function. Allocate n pages from given free page node.\r
+\r
+  @param  Pages                  The free page node.\r
+  @param  NumberOfPages          Number of pages to be allocated.\r
+  @param  MaxAddress             Request to allocate memory below this address.\r
+\r
+  @return Memory address of allocated pages.\r
+\r
+**/\r
+UINTN\r
+InternalAllocPagesOnOneNode (\r
+  IN OUT FREE_PAGE_LIST   *Pages,\r
+  IN     UINTN            NumberOfPages,\r
+  IN     UINTN            MaxAddress\r
+  );\r
+\r
+/**\r
+  Update SMM memory map entry.\r
+\r
+  @param[in]  Type                   The type of allocation to perform.\r
+  @param[in]  Memory                 The base of memory address.\r
+  @param[in]  NumberOfPages          The number of pages to allocate.\r
+  @param[in]  AddRegion              If this memory is new added region.\r
+**/\r
+VOID\r
+ConvertSmmMemoryMapEntry (\r
+  IN EFI_MEMORY_TYPE       Type,\r
+  IN EFI_PHYSICAL_ADDRESS  Memory,\r
+  IN UINTN                 NumberOfPages,\r
+  IN BOOLEAN               AddRegion\r
+  );\r
+\r
+/**\r
+  Internal function.  Moves any memory descriptors that are on the\r
+  temporary descriptor stack to heap.\r
+\r
+**/\r
+VOID\r
+CoreFreeMemoryMapStack (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Frees previous allocated pages.\r
+\r
+  @param[in]  Memory                 Base address of memory being freed.\r
+  @param[in]  NumberOfPages          The number of pages to free.\r
+  @param[in]  AddRegion              If this memory is new added region.\r
+\r
+  @retval EFI_NOT_FOUND          Could not find the entry that covers the range.\r
+  @retval EFI_INVALID_PARAMETER  Address not aligned, Address is zero or NumberOfPages is zero.\r
+  @return EFI_SUCCESS            Pages successfully freed.\r
+\r
+**/\r
+EFI_STATUS\r
+SmmInternalFreePagesEx (\r
+  IN EFI_PHYSICAL_ADDRESS  Memory,\r
+  IN UINTN                 NumberOfPages,\r
+  IN BOOLEAN               AddRegion\r
+  );\r
+\r
+/**\r
+  Hook function used to set all Guard pages after entering SMM mode.\r
+**/\r
+VOID\r
+SmmEntryPointMemoryManagementHook (\r
+  VOID\r
+  );\r
+\r
 #endif\r