4 Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _CAPSULE_COMMON_HEADER_
16 #define _CAPSULE_COMMON_HEADER_
19 // 8 extra pages for PF handler.
21 #define EXTRA_PAGE_TABLE_PAGES 8
24 // This capsule PEIM puts its private data at the start of the
25 // coalesced capsule. Here's the structure definition.
27 #define EFI_CAPSULE_PEIM_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('C', 'a', 'p', 'P')
32 UINT64 CapsuleAllImageSize
;
34 UINT64 CapsuleOffset
[1];
35 } EFI_CAPSULE_PEIM_PRIVATE_DATA
;
38 #define CAPSULE_TEST_SIGNATURE SIGNATURE_32('T', 'E', 'S', 'T')
40 #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
43 EFI_PHYSICAL_ADDRESS EntryPoint
;
44 EFI_PHYSICAL_ADDRESS StackBufferBase
;
45 UINT64 StackBufferLength
;
46 EFI_PHYSICAL_ADDRESS JumpBuffer
;
47 EFI_PHYSICAL_ADDRESS BlockListAddr
;
48 EFI_PHYSICAL_ADDRESS MemoryBase64Ptr
;
49 EFI_PHYSICAL_ADDRESS MemorySize64Ptr
;
50 BOOLEAN Page1GSupport
;
51 } SWITCH_32_TO_64_CONTEXT
;
55 EFI_PHYSICAL_ADDRESS ReturnEntryPoint
;
59 // Be careful about the Base field of IA32_DESCRIPTOR
60 // that is UINTN type.
61 // To extend new field for this structure, add it to
62 // right before this Gdtr field.
65 } SWITCH_64_TO_32_CONTEXT
;
70 The function to coalesce a fragmented capsule in memory.
72 @param PeiServices General purpose services available to every PEIM.
73 @param BlockListBuffer Point to the buffer of Capsule Descriptor Variables.
74 @param MemoryBase Pointer to the base of a block of memory that we can walk
75 all over while trying to coalesce our buffers.
76 On output, this variable will hold the base address of
78 @param MemorySize Size of the memory region pointed to by MemoryBase.
79 On output, this variable will contain the size of the
82 @retval EFI_NOT_FOUND if we can't determine the boot mode
83 if the boot mode is not flash-update
84 if we could not find the capsule descriptors
86 @retval EFI_BUFFER_TOO_SMALL
87 if we could not coalesce the capsule in the memory
90 @retval EFI_SUCCESS if there's no capsule, or if we processed the
96 IN EFI_PEI_SERVICES
**PeiServices
,
97 IN IN EFI_PHYSICAL_ADDRESS
*BlockListBuffer
,
98 IN OUT VOID
**MemoryBase
,
99 IN OUT UINTN
*MemorySize