/** @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
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