]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Framework/Include/PeiHob.h
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Framework / Include / PeiHob.h
1 /*++
2
3 Copyright (c) 2004 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 PeiHob.h
15
16 Abstract:
17
18 PEI Hand Off Block (HOB) definition.
19
20 The HOB is a memory data structure used to hand-off system information from
21 PEI to DXE (the next phase).
22
23 --*/
24
25 #ifndef _PEI_HOB_H_
26 #define _PEI_HOB_H_
27
28 #include "BootMode.h"
29
30 //
31 // Every Hob must start with this data structure.
32 //
33 typedef struct {
34 UINT16 HobType;
35 UINT16 HobLength;
36 UINT32 Reserved;
37 } EFI_HOB_GENERIC_HEADER;
38
39 //
40 // End of HOB List HOB
41 //
42 #define EFI_HOB_TYPE_END_OF_HOB_LIST 0xffff
43
44 //
45 // Handoff Information Table HOB
46 //
47 #define EFI_HOB_TYPE_HANDOFF 0x0001
48
49 #define EFI_HOB_HANDOFF_TABLE_VERSION 0x0009
50
51 typedef UINT32 EFI_BOOT_MODE;
52
53 typedef struct {
54 EFI_HOB_GENERIC_HEADER Header;
55 UINT32 Version;
56 EFI_BOOT_MODE BootMode;
57 EFI_PHYSICAL_ADDRESS EfiMemoryTop;
58 EFI_PHYSICAL_ADDRESS EfiMemoryBottom;
59 EFI_PHYSICAL_ADDRESS EfiFreeMemoryTop;
60 EFI_PHYSICAL_ADDRESS EfiFreeMemoryBottom;
61 EFI_PHYSICAL_ADDRESS EfiEndOfHobList;
62 } EFI_HOB_HANDOFF_INFO_TABLE;
63
64 //
65 // Memory Descriptor HOB
66 //
67 #define EFI_HOB_TYPE_MEMORY_ALLOCATION 0x0002
68
69 typedef struct {
70 EFI_GUID Name;
71 EFI_PHYSICAL_ADDRESS MemoryBaseAddress;
72 UINT64 MemoryLength;
73 EFI_MEMORY_TYPE MemoryType;
74 UINT8 Reserved[4];
75 } EFI_HOB_MEMORY_ALLOCATION_HEADER;
76
77 typedef struct {
78 EFI_HOB_GENERIC_HEADER Header;
79 EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;
80 //
81 // Additional data pertaining to the "Name" Guid memory
82 // may go here.
83 //
84 } EFI_HOB_MEMORY_ALLOCATION;
85
86 typedef struct {
87 EFI_HOB_GENERIC_HEADER Header;
88 EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;
89 } EFI_HOB_MEMORY_ALLOCATION_BSP_STORE;
90
91 typedef struct {
92 EFI_HOB_GENERIC_HEADER Header;
93 EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor;
94 } EFI_HOB_MEMORY_ALLOCATION_STACK;
95
96 typedef struct {
97 EFI_HOB_GENERIC_HEADER Header;
98 EFI_HOB_MEMORY_ALLOCATION_HEADER MemoryAllocationHeader;
99 EFI_GUID ModuleName;
100 EFI_PHYSICAL_ADDRESS EntryPoint;
101 } EFI_HOB_MEMORY_ALLOCATION_MODULE;
102
103 #define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR 0x0003
104
105 typedef UINT32 EFI_RESOURCE_TYPE;
106
107 #define EFI_RESOURCE_SYSTEM_MEMORY 0
108 #define EFI_RESOURCE_MEMORY_MAPPED_IO 1
109 #define EFI_RESOURCE_IO 2
110 #define EFI_RESOURCE_FIRMWARE_DEVICE 3
111 #define EFI_RESOURCE_MEMORY_MAPPED_IO_PORT 4
112 #define EFI_RESOURCE_MEMORY_RESERVED 5
113 #define EFI_RESOURCE_IO_RESERVED 6
114 #define EFI_RESOURCE_MAX_MEMORY_TYPE 7
115
116 typedef UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE;
117
118 #define EFI_RESOURCE_ATTRIBUTE_PRESENT 0x00000001
119 #define EFI_RESOURCE_ATTRIBUTE_INITIALIZED 0x00000002
120 #define EFI_RESOURCE_ATTRIBUTE_TESTED 0x00000004
121 #define EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC 0x00000008
122 #define EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC 0x00000010
123 #define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_1 0x00000020
124 #define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_2 0x00000040
125 #define EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED 0x00000080
126 #define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED 0x00000100
127 #define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED 0x00000200
128 #define EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE 0x00000400
129 #define EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE 0x00000800
130 #define EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE 0x00001000
131 #define EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE 0x00002000
132 #define EFI_RESOURCE_ATTRIBUTE_16_BIT_IO 0x00004000
133 #define EFI_RESOURCE_ATTRIBUTE_32_BIT_IO 0x00008000
134 #define EFI_RESOURCE_ATTRIBUTE_64_BIT_IO 0x00010000
135 #define EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED 0x00020000
136
137 typedef struct {
138 EFI_HOB_GENERIC_HEADER Header;
139 EFI_GUID Owner;
140 EFI_RESOURCE_TYPE ResourceType;
141 EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
142 EFI_PHYSICAL_ADDRESS PhysicalStart;
143 UINT64 ResourceLength;
144 } EFI_HOB_RESOURCE_DESCRIPTOR;
145
146 //
147 // GUID Extension HOB
148 // The HobLength is variable as it includes the GUID specific data.
149 //
150 #define EFI_HOB_TYPE_GUID_EXTENSION 0x0004
151
152 typedef struct {
153 EFI_HOB_GENERIC_HEADER Header;
154 EFI_GUID Name;
155
156 //
157 // Guid specific data goes here
158 //
159 } EFI_HOB_GUID_TYPE;
160
161 //
162 // Firmware Volume HOB
163 //
164 #define EFI_HOB_TYPE_FV 0x0005
165
166 typedef struct {
167 EFI_HOB_GENERIC_HEADER Header;
168 EFI_PHYSICAL_ADDRESS BaseAddress;
169 UINT64 Length;
170 } EFI_HOB_FIRMWARE_VOLUME;
171
172 //
173 // CPU HOB
174 //
175 #define EFI_HOB_TYPE_CPU 0x0006
176
177 typedef struct {
178 EFI_HOB_GENERIC_HEADER Header;
179 UINT8 SizeOfMemorySpace;
180 UINT8 SizeOfIoSpace;
181 UINT8 Reserved[6];
182 } EFI_HOB_CPU;
183
184 //
185 // PEI Core Memory Pool HOB
186 // The HobLength is variable as the HOB contains pool allocations by
187 // the PeiServices AllocatePool function
188 //
189 #define EFI_HOB_TYPE_PEI_MEMORY_POOL 0x0007
190
191 typedef struct {
192 EFI_HOB_GENERIC_HEADER Header;
193 } EFI_HOB_MEMORY_POOL;
194
195 //
196 // Capsule volume HOB -- identical to a firmware volume
197 //
198 #define EFI_HOB_TYPE_CV 0x0008
199
200 typedef struct {
201 EFI_HOB_GENERIC_HEADER Header;
202 EFI_PHYSICAL_ADDRESS BaseAddress;
203 UINT64 Length;
204 } EFI_HOB_CAPSULE_VOLUME;
205
206 #if (PI_SPECIFICATION_VERSION >= 0x00010000)
207
208 #define EFI_HOB_TYPE_FV2 0x0009
209
210 typedef struct {
211 EFI_HOB_GENERIC_HEADER Header;
212 EFI_PHYSICAL_ADDRESS BaseAddress;
213 UINT64 Length;
214 EFI_GUID FvName;
215 EFI_GUID FileName;
216 } EFI_HOB_FIRMWARE_VOLUME2;
217
218 #define EFI_HOB_TYPE_LOAD_PEIM 0x000A
219
220 #endif
221
222 #define EFI_HOB_TYPE_UNUSED 0xFFFE
223
224 //
225 // Union of all the possible HOB Types
226 //
227 typedef union {
228 EFI_HOB_GENERIC_HEADER *Header;
229 EFI_HOB_HANDOFF_INFO_TABLE *HandoffInformationTable;
230 EFI_HOB_MEMORY_ALLOCATION *MemoryAllocation;
231 EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *MemoryAllocationBspStore;
232 EFI_HOB_MEMORY_ALLOCATION_STACK *MemoryAllocationStack;
233 EFI_HOB_MEMORY_ALLOCATION_MODULE *MemoryAllocationModule;
234 EFI_HOB_RESOURCE_DESCRIPTOR *ResourceDescriptor;
235 EFI_HOB_GUID_TYPE *Guid;
236 EFI_HOB_FIRMWARE_VOLUME *FirmwareVolume;
237 #if (PI_SPECIFICATION_VERSION >= 0x00010000)
238 EFI_HOB_FIRMWARE_VOLUME2 *FirmwareVolume2;
239 #endif
240 EFI_HOB_CPU *Cpu;
241 EFI_HOB_MEMORY_POOL *Pool;
242 EFI_HOB_CAPSULE_VOLUME *CapsuleVolume;
243 UINT8 *Raw;
244 } EFI_PEI_HOB_POINTERS;
245
246 #define GET_HOB_TYPE(Hob) ((Hob).Header->HobType)
247 #define GET_HOB_LENGTH(Hob) ((Hob).Header->HobLength)
248 #define GET_NEXT_HOB(Hob) ((Hob).Raw + GET_HOB_LENGTH (Hob))
249 #define END_OF_HOB_LIST(Hob) (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_END_OF_HOB_LIST)
250
251 #endif