]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/CapsulePei/Common/CommonHeader.h
MdeModulePkg/Universal/CapsulePei: Add support for PCD PcdPteMemoryEncryptionAddressO...
[mirror_edk2.git] / MdeModulePkg / Universal / CapsulePei / Common / CommonHeader.h
CommitLineData
ab7017fe 1/** @file\r
2 Common header file.\r
3\r
359cb1a3 4Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
89a286ce
LD
5Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\r
6\r
ab7017fe 7This program and the accompanying materials\r
8are licensed and made available under the terms and conditions of the BSD License\r
9which accompanies this distribution. The full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
4e4f13d2 17#ifndef _CAPSULE_COMMON_HEADER_\r
18#define _CAPSULE_COMMON_HEADER_\r
ab7017fe 19\r
716087e2
SZ
20//\r
21// 8 extra pages for PF handler.\r
22//\r
23#define EXTRA_PAGE_TABLE_PAGES 8\r
24\r
89a286ce
LD
25#define PAGING_1G_ADDRESS_MASK_64 0x000FFFFFC0000000ull\r
26\r
ab7017fe 27//\r
28// This capsule PEIM puts its private data at the start of the\r
29// coalesced capsule. Here's the structure definition.\r
30//\r
ff284c56 31#define EFI_CAPSULE_PEIM_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('C', 'a', 'p', 'P')\r
ab7017fe 32\r
ff284c56 33#pragma pack(1)\r
ab7017fe 34typedef struct {\r
ff284c56
JY
35 UINT64 Signature;\r
36 UINT64 CapsuleAllImageSize;\r
37 UINT64 CapsuleNumber;\r
38 UINT64 CapsuleOffset[1];\r
ab7017fe 39} EFI_CAPSULE_PEIM_PRIVATE_DATA;\r
ff284c56 40#pragma pack()\r
ab7017fe 41\r
359cb1a3
SZ
42typedef struct {\r
43 ///\r
44 /// The physical start address of the resource region.\r
45 ///\r
46 EFI_PHYSICAL_ADDRESS PhysicalStart;\r
47 ///\r
48 /// The number of bytes of the resource region.\r
49 ///\r
50 UINT64 ResourceLength;\r
51} MEMORY_RESOURCE_DESCRIPTOR;\r
52\r
ab7017fe 53#define CAPSULE_TEST_SIGNATURE SIGNATURE_32('T', 'E', 'S', 'T')\r
54\r
4e4f13d2 55#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)\r
716087e2 56#pragma pack(1)\r
ab7017fe 57typedef struct {\r
58 EFI_PHYSICAL_ADDRESS EntryPoint;\r
59 EFI_PHYSICAL_ADDRESS StackBufferBase;\r
60 UINT64 StackBufferLength;\r
61 EFI_PHYSICAL_ADDRESS JumpBuffer;\r
62 EFI_PHYSICAL_ADDRESS BlockListAddr;\r
359cb1a3 63 EFI_PHYSICAL_ADDRESS MemoryResource;\r
ab7017fe 64 EFI_PHYSICAL_ADDRESS MemoryBase64Ptr;\r
65 EFI_PHYSICAL_ADDRESS MemorySize64Ptr;\r
716087e2 66 BOOLEAN Page1GSupport;\r
89a286ce 67 UINT64 AddressEncMask;\r
ab7017fe 68} SWITCH_32_TO_64_CONTEXT;\r
69\r
70typedef struct {\r
71 UINT16 ReturnCs;\r
72 EFI_PHYSICAL_ADDRESS ReturnEntryPoint;\r
73 UINT64 ReturnStatus;\r
716087e2
SZ
74 //\r
75 // NOTICE:\r
76 // Be careful about the Base field of IA32_DESCRIPTOR\r
77 // that is UINTN type.\r
78 // To extend new field for this structure, add it to\r
79 // right before this Gdtr field.\r
80 //\r
ab7017fe 81 IA32_DESCRIPTOR Gdtr;\r
82} SWITCH_64_TO_32_CONTEXT;\r
716087e2 83#pragma pack()\r
4e4f13d2 84#endif\r
ab7017fe 85\r
86/**\r
87 The function to coalesce a fragmented capsule in memory.\r
88\r
89 @param PeiServices General purpose services available to every PEIM.\r
90 @param BlockListBuffer Point to the buffer of Capsule Descriptor Variables.\r
359cb1a3 91 @param MemoryResource Pointer to the buffer of memory resource descriptor.\r
ab7017fe 92 @param MemoryBase Pointer to the base of a block of memory that we can walk\r
93 all over while trying to coalesce our buffers.\r
94 On output, this variable will hold the base address of\r
95 a coalesced capsule.\r
96 @param MemorySize Size of the memory region pointed to by MemoryBase.\r
97 On output, this variable will contain the size of the\r
98 coalesced capsule.\r
99\r
100 @retval EFI_NOT_FOUND if we can't determine the boot mode\r
101 if the boot mode is not flash-update\r
102 if we could not find the capsule descriptors\r
103\r
104 @retval EFI_BUFFER_TOO_SMALL\r
105 if we could not coalesce the capsule in the memory\r
106 region provided to us\r
107\r
108 @retval EFI_SUCCESS if there's no capsule, or if we processed the\r
109 capsule successfully.\r
110**/\r
111EFI_STATUS\r
112EFIAPI\r
113CapsuleDataCoalesce (\r
114 IN EFI_PEI_SERVICES **PeiServices,\r
359cb1a3
SZ
115 IN EFI_PHYSICAL_ADDRESS *BlockListBuffer,\r
116 IN MEMORY_RESOURCE_DESCRIPTOR *MemoryResource,\r
ab7017fe 117 IN OUT VOID **MemoryBase,\r
118 IN OUT UINTN *MemorySize\r
119 );\r
120\r
121#endif\r