]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/CapsulePei/Common/CommonHeader.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / CapsulePei / Common / CommonHeader.h
index 5c0aa3068c0fc331da5df2c9ac0be403f7f8d648..695520aa2664e26eb8670d92c27fa560e38e6580 100644 (file)
@@ -1,58 +1,88 @@
 /** @file\r
   Common header file.\r
 \r
-Copyright (c) 2011, 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
-http://opensource.org/licenses/bsd-license.php\r
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\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
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
-#ifndef _CAPSULE_THUNK_32_TO_64_\r
-#define _CAPSULE_THUNK_32_TO_64_\r
+#ifndef _CAPSULE_COMMON_HEADER_\r
+#define _CAPSULE_COMMON_HEADER_\r
 \r
-#include <Uefi.h>\r
-#include "PiPei.h"\r
+//\r
+// 8 extra pages for PF handler.\r
+//\r
+#define EXTRA_PAGE_TABLE_PAGES      8\r
+\r
+#define PAGING_1G_ADDRESS_MASK_64   0x000FFFFFC0000000ull\r
 \r
 //\r
 // This capsule PEIM puts its private data at the start of the\r
 // coalesced capsule. Here's the structure definition.\r
 //\r
-#define EFI_CAPSULE_PEIM_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('C', 'a', 'p', 'D')\r
+#define EFI_CAPSULE_PEIM_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('C', 'a', 'p', 'P')\r
 \r
+#pragma pack(1)\r
 typedef struct {\r
-  UINT32  Signature;\r
-  UINTN   CapsuleSize;\r
+  UINT64  Signature;\r
+  UINT64  CapsuleAllImageSize;\r
+  UINT64  CapsuleNumber;\r
+  UINT64  CapsuleOffset[1];\r
 } 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
+  UINT64                AddressEncMask;\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
   The function to coalesce a fragmented capsule in memory.\r
 \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
@@ -76,7 +106,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