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