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