]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/CapsulePei/Common/CommonHeader.h
MdeModulePkg CapsulePei: Validate capsule integrity by memory resource hob
[mirror_edk2.git] / MdeModulePkg / Universal / CapsulePei / Common / CommonHeader.h
index d1ed24a572307c2e0446c8d92bbce2b19fa10487..7298874f9e629e92d89aca56d3d4d45ed4f847a5 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Common header file.\r
 \r
-Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -15,6 +15,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef _CAPSULE_COMMON_HEADER_\r
 #define _CAPSULE_COMMON_HEADER_\r
 \r
+//\r
+// 8 extra pages for PF handler.\r
+//\r
+#define EXTRA_PAGE_TABLE_PAGES      8\r
+\r
 //\r
 // This capsule PEIM puts its private data at the start of the\r
 // coalesced capsule. Here's the structure definition.\r
@@ -30,25 +35,47 @@ typedef struct {
 } EFI_CAPSULE_PEIM_PRIVATE_DATA;\r
 #pragma pack()\r
 \r
+typedef struct {\r
+  ///\r
+  /// The physical start address of the resource region.\r
+  ///\r
+  EFI_PHYSICAL_ADDRESS        PhysicalStart;\r
+  ///\r
+  /// The number of bytes of the resource region.\r
+  ///\r
+  UINT64                      ResourceLength;\r
+} MEMORY_RESOURCE_DESCRIPTOR;\r
+\r
 #define CAPSULE_TEST_SIGNATURE SIGNATURE_32('T', 'E', 'S', 'T')\r
 \r
 #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)\r
+#pragma pack(1)\r
 typedef struct {\r
   EFI_PHYSICAL_ADDRESS  EntryPoint;\r
   EFI_PHYSICAL_ADDRESS  StackBufferBase;\r
   UINT64                StackBufferLength;\r
   EFI_PHYSICAL_ADDRESS  JumpBuffer;\r
   EFI_PHYSICAL_ADDRESS  BlockListAddr;\r
+  EFI_PHYSICAL_ADDRESS  MemoryResource;\r
   EFI_PHYSICAL_ADDRESS  MemoryBase64Ptr;\r
   EFI_PHYSICAL_ADDRESS  MemorySize64Ptr;\r
+  BOOLEAN               Page1GSupport;\r
 } SWITCH_32_TO_64_CONTEXT;\r
 \r
 typedef struct {\r
   UINT16                ReturnCs;\r
   EFI_PHYSICAL_ADDRESS  ReturnEntryPoint;\r
   UINT64                ReturnStatus;\r
+  //\r
+  // NOTICE:\r
+  // Be careful about the Base field of IA32_DESCRIPTOR\r
+  // that is UINTN type.\r
+  // To extend new field for this structure, add it to\r
+  // right before this Gdtr field.\r
+  //\r
   IA32_DESCRIPTOR       Gdtr;\r
 } SWITCH_64_TO_32_CONTEXT;\r
+#pragma pack()\r
 #endif\r
 \r
 /**\r
@@ -56,6 +83,7 @@ typedef struct {
 \r
   @param PeiServices        General purpose services available to every PEIM.\r
   @param BlockListBuffer    Point to the buffer of Capsule Descriptor Variables.\r
+  @param MemoryResource     Pointer to the buffer of memory resource descriptor.\r
   @param MemoryBase         Pointer to the base of a block of memory that we can walk\r
                             all over while trying to coalesce our buffers.\r
                             On output, this variable will hold the base address of\r
@@ -79,7 +107,8 @@ EFI_STATUS
 EFIAPI\r
 CapsuleDataCoalesce (\r
   IN EFI_PEI_SERVICES                **PeiServices,\r
-  IN IN EFI_PHYSICAL_ADDRESS         *BlockListBuffer,\r
+  IN EFI_PHYSICAL_ADDRESS            *BlockListBuffer,\r
+  IN MEMORY_RESOURCE_DESCRIPTOR      *MemoryResource,\r
   IN OUT VOID                        **MemoryBase,\r
   IN OUT UINTN                       *MemorySize\r
   );\r