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