]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/CapsulePei/Common/CommonHeader.h
CapsulePei coalesce need add more sanity check for each Capsule Fragment.
[mirror_edk2.git] / MdeModulePkg / Universal / CapsulePei / Common / CommonHeader.h
CommitLineData
ab7017fe 1/** @file\r
2 Common header file.\r
3\r
ff284c56 4Copyright (c) 2011 - 2014, 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
18//\r
19// This capsule PEIM puts its private data at the start of the\r
20// coalesced capsule. Here's the structure definition.\r
21//\r
ff284c56 22#define EFI_CAPSULE_PEIM_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('C', 'a', 'p', 'P')\r
ab7017fe 23\r
ff284c56 24#pragma pack(1)\r
ab7017fe 25typedef struct {\r
ff284c56
JY
26 UINT64 Signature;\r
27 UINT64 CapsuleAllImageSize;\r
28 UINT64 CapsuleNumber;\r
29 UINT64 CapsuleOffset[1];\r
ab7017fe 30} EFI_CAPSULE_PEIM_PRIVATE_DATA;\r
ff284c56 31#pragma pack()\r
ab7017fe 32\r
33#define CAPSULE_TEST_SIGNATURE SIGNATURE_32('T', 'E', 'S', 'T')\r
34\r
4e4f13d2 35#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)\r
ab7017fe 36typedef struct {\r
37 EFI_PHYSICAL_ADDRESS EntryPoint;\r
38 EFI_PHYSICAL_ADDRESS StackBufferBase;\r
39 UINT64 StackBufferLength;\r
40 EFI_PHYSICAL_ADDRESS JumpBuffer;\r
41 EFI_PHYSICAL_ADDRESS BlockListAddr;\r
42 EFI_PHYSICAL_ADDRESS MemoryBase64Ptr;\r
43 EFI_PHYSICAL_ADDRESS MemorySize64Ptr;\r
44} SWITCH_32_TO_64_CONTEXT;\r
45\r
46typedef struct {\r
47 UINT16 ReturnCs;\r
48 EFI_PHYSICAL_ADDRESS ReturnEntryPoint;\r
49 UINT64 ReturnStatus;\r
50 IA32_DESCRIPTOR Gdtr;\r
51} SWITCH_64_TO_32_CONTEXT;\r
4e4f13d2 52#endif\r
ab7017fe 53\r
54/**\r
55 The function to coalesce a fragmented capsule in memory.\r
56\r
57 @param PeiServices General purpose services available to every PEIM.\r
58 @param BlockListBuffer Point to the buffer of Capsule Descriptor Variables.\r
59 @param MemoryBase Pointer to the base of a block of memory that we can walk\r
60 all over while trying to coalesce our buffers.\r
61 On output, this variable will hold the base address of\r
62 a coalesced capsule.\r
63 @param MemorySize Size of the memory region pointed to by MemoryBase.\r
64 On output, this variable will contain the size of the\r
65 coalesced capsule.\r
66\r
67 @retval EFI_NOT_FOUND if we can't determine the boot mode\r
68 if the boot mode is not flash-update\r
69 if we could not find the capsule descriptors\r
70\r
71 @retval EFI_BUFFER_TOO_SMALL\r
72 if we could not coalesce the capsule in the memory\r
73 region provided to us\r
74\r
75 @retval EFI_SUCCESS if there's no capsule, or if we processed the\r
76 capsule successfully.\r
77**/\r
78EFI_STATUS\r
79EFIAPI\r
80CapsuleDataCoalesce (\r
81 IN EFI_PEI_SERVICES **PeiServices,\r
82 IN IN EFI_PHYSICAL_ADDRESS *BlockListBuffer,\r
83 IN OUT VOID **MemoryBase,\r
84 IN OUT UINTN *MemorySize\r
85 );\r
86\r
87#endif\r