]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Dxe/DxeCis.h
9b1d5ce966ed7e18ac67808f6353c56739b06401
[mirror_edk2.git] / MdePkg / Include / Dxe / DxeCis.h
1 /** @file
2 Include file matches things in the DXE CIS.
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. 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 Module Name: DxeCis.h
14
15 @par Revision Reference:
16 Version 0.91B.
17
18 **/
19
20 #ifndef __DXE_CIS__
21 #define __DXE_CIS__
22
23 #include <Uefi/UefiSpec.h>
24
25
26 #define TIANO_ERROR(a) (MAX_2_BITS | (a))
27
28 #if (EFI_SPECIFICATION_VERSION < 0x00020000)
29 //
30 // Tiano added a couple of return types. These are owned by UEFI specification
31 // and Tiano can not use them. Thus for UEFI 2.0/R9 support we moved the values
32 // to a UEFI OEM extension range to conform to UEFI specification.
33 //
34 #define EFI_NOT_AVAILABLE_YET EFIERR (28)
35 #define EFI_UNLOAD_IMAGE EFIERR (29)
36 #else
37 #define EFI_NOT_AVAILABLE_YET TIANO_ERROR (0)
38 #define EFI_UNLOAD_IMAGE TIANO_ERROR (1)
39 #endif
40
41 //
42 // Implementation contamination of UEFI 2.0
43 // Pointer to internal runtime pointer
44 //
45 #define EFI_IPF_GP_POINTER 0x00000008
46
47
48 //
49 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
50 //
51
52 //
53 // attributes for reserved memory before it is promoted to system memory
54 //
55 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
56 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
57 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
58
59 //
60 // range for memory mapped port I/O on IPF
61 //
62 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
63
64 //
65 // Modifier for EFI DXE Services
66 //
67 #define EFI_DXESERVICE
68
69
70 //
71 // Global Coherencey Domain types
72 //
73 typedef enum {
74 EfiGcdMemoryTypeNonExistent,
75 EfiGcdMemoryTypeReserved,
76 EfiGcdMemoryTypeSystemMemory,
77 EfiGcdMemoryTypeMemoryMappedIo,
78 EfiGcdMemoryTypeMaximum
79 } EFI_GCD_MEMORY_TYPE;
80
81 typedef enum {
82 EfiGcdIoTypeNonExistent,
83 EfiGcdIoTypeReserved,
84 EfiGcdIoTypeIo,
85 EfiGcdIoTypeMaximum
86 } EFI_GCD_IO_TYPE;
87
88 typedef enum {
89 EfiGcdAllocateAnySearchBottomUp,
90 EfiGcdAllocateMaxAddressSearchBottomUp,
91 EfiGcdAllocateAddress,
92 EfiGcdAllocateAnySearchTopDown,
93 EfiGcdAllocateMaxAddressSearchTopDown,
94 EfiGcdMaxAllocateType
95 } EFI_GCD_ALLOCATE_TYPE;
96
97 typedef struct {
98 EFI_PHYSICAL_ADDRESS BaseAddress;
99 UINT64 Length;
100 UINT64 Capabilities;
101 UINT64 Attributes;
102 EFI_GCD_MEMORY_TYPE GcdMemoryType;
103 EFI_HANDLE ImageHandle;
104 EFI_HANDLE DeviceHandle;
105 } EFI_GCD_MEMORY_SPACE_DESCRIPTOR;
106
107 typedef struct {
108 EFI_PHYSICAL_ADDRESS BaseAddress;
109 UINT64 Length;
110 EFI_GCD_IO_TYPE GcdIoType;
111 EFI_HANDLE ImageHandle;
112 EFI_HANDLE DeviceHandle;
113 } EFI_GCD_IO_SPACE_DESCRIPTOR;
114
115 /**
116 Adds reserved memory, system memory, or memory-mapped I/O resources to the
117 global coherency domain of the processor.
118
119 @param GcdMemoryType Memory type of the memory space.
120 @param BaseAddress Base address of the memory space.
121 @param Length Length of the memory space.
122 @param Capabilities alterable attributes of the memory space.
123
124 @retval EFI_SUCCESS Merged this memory space into GCD map.
125
126 **/
127 typedef
128 EFI_STATUS
129 (EFIAPI *EFI_ADD_MEMORY_SPACE) (
130 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
131 IN EFI_PHYSICAL_ADDRESS BaseAddress,
132 IN UINT64 Length,
133 IN UINT64 Capabilities
134 )
135 ;
136
137 /**
138 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
139 I/O resources from the global coherency domain of the processor.
140
141 @param GcdAllocateType The type of allocate operation
142 @param GcdMemoryType The desired memory type
143 @param Alignment Align with 2^Alignment
144 @param Length Length to allocate
145 @param BaseAddress Base address to allocate
146 @param Imagehandle The image handle consume the allocated space.
147 @param DeviceHandle The device handle consume the allocated space.
148
149 @retval EFI_INVALID_PARAMETER Invalid parameter.
150 @retval EFI_NOT_FOUND No descriptor contains the desired space.
151 @retval EFI_SUCCESS Memory space successfully allocated.
152
153 **/
154 typedef
155 EFI_STATUS
156 (EFIAPI *EFI_ALLOCATE_MEMORY_SPACE) (
157 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
158 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
159 IN UINTN Alignment,
160 IN UINT64 Length,
161 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
162 IN EFI_HANDLE ImageHandle,
163 IN EFI_HANDLE DeviceHandle OPTIONAL
164 )
165 ;
166
167 /**
168 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
169 I/O resources from the global coherency domain of the processor.
170
171 @param BaseAddress Base address of the segment.
172 @param Length Length of the segment.
173
174 @retval EFI_SUCCESS Space successfully freed.
175
176 **/
177 typedef
178 EFI_STATUS
179 (EFIAPI *EFI_FREE_MEMORY_SPACE) (
180 IN EFI_PHYSICAL_ADDRESS BaseAddress,
181 IN UINT64 Length
182 )
183 ;
184
185 /**
186 Removes reserved memory, system memory, or memory-mapped I/O resources from
187 the global coherency domain of the processor.
188
189 @param BaseAddress Base address of the memory space.
190 @param Length Length of the memory space.
191
192 @retval EFI_SUCCESS Successfully remove a segment of memory space.
193
194 **/
195 typedef
196 EFI_STATUS
197 (EFIAPI *EFI_REMOVE_MEMORY_SPACE) (
198 IN EFI_PHYSICAL_ADDRESS BaseAddress,
199 IN UINT64 Length
200 )
201 ;
202
203 /**
204 Retrieves the descriptor for a memory region containing a specified address.
205
206 @param BaseAddress Specified start address
207 @param Descriptor Specified length
208
209 @retval EFI_INVALID_PARAMETER Invalid parameter
210 @retval EFI_SUCCESS Successfully get memory space descriptor.
211
212 **/
213 typedef
214 EFI_STATUS
215 (EFIAPI *EFI_GET_MEMORY_SPACE_DESCRIPTOR) (
216 IN EFI_PHYSICAL_ADDRESS BaseAddress,
217 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor
218 )
219 ;
220
221 /**
222 Modifies the attributes for a memory region in the global coherency domain of the
223 processor.
224
225 @param BaseAddress Specified start address
226 @param Length Specified length
227 @param Attributes Specified attributes
228
229 @retval EFI_SUCCESS Successfully set attribute of a segment of memory space.
230
231 **/
232 typedef
233
234 EFI_STATUS
235 (EFIAPI *EFI_SET_MEMORY_SPACE_ATTRIBUTES) (
236 IN EFI_PHYSICAL_ADDRESS BaseAddress,
237 IN UINT64 Length,
238 IN UINT64 Attributes
239 )
240 ;
241
242 /**
243 Returns a map of the memory resources in the global coherency domain of the
244 processor.
245
246 @param NumberOfDescriptors Number of descriptors.
247 @param MemorySpaceMap Descriptor array
248
249 @retval EFI_INVALID_PARAMETER Invalid parameter
250 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
251 @retval EFI_SUCCESS Successfully get memory space map.
252
253 **/
254 typedef
255 EFI_STATUS
256 (EFIAPI *EFI_GET_MEMORY_SPACE_MAP) (
257 OUT UINTN *NumberOfDescriptors,
258 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap
259 )
260 ;
261
262 /**
263 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
264
265 @param GcdIoType IO type of the segment.
266 @param BaseAddress Base address of the segment.
267 @param Length Length of the segment.
268
269 @retval EFI_SUCCESS Merged this segment into GCD map.
270
271 **/
272 typedef
273 EFI_STATUS
274 (EFIAPI *EFI_ADD_IO_SPACE) (
275 IN EFI_GCD_IO_TYPE GcdIoType,
276 IN EFI_PHYSICAL_ADDRESS BaseAddress,
277 IN UINT64 Length
278 )
279 ;
280
281 /**
282 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
283 domain of the processor.
284
285 @param GcdAllocateType The type of allocate operation
286 @param GcdIoType The desired IO type
287 @param Alignment Align with 2^Alignment
288 @param Length Length to allocate
289 @param BaseAddress Base address to allocate
290 @param Imagehandle The image handle consume the allocated space.
291 @param DeviceHandle The device handle consume the allocated space.
292
293 @retval EFI_INVALID_PARAMETER Invalid parameter.
294 @retval EFI_NOT_FOUND No descriptor contains the desired space.
295 @retval EFI_SUCCESS IO space successfully allocated.
296
297 **/
298 typedef
299 EFI_STATUS
300 (EFIAPI *EFI_ALLOCATE_IO_SPACE) (
301 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
302 IN EFI_GCD_IO_TYPE GcdIoType,
303 IN UINTN Alignment,
304 IN UINT64 Length,
305 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
306 IN EFI_HANDLE ImageHandle,
307 IN EFI_HANDLE DeviceHandle OPTIONAL
308 )
309 ;
310
311 /**
312 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
313 domain of the processor.
314
315 @param BaseAddress Base address of the segment.
316 @param Length Length of the segment.
317
318 @retval EFI_SUCCESS Space successfully freed.
319
320 **/
321 typedef
322 EFI_STATUS
323 (EFIAPI *EFI_FREE_IO_SPACE) (
324 IN EFI_PHYSICAL_ADDRESS BaseAddress,
325 IN UINT64 Length
326 )
327 ;
328
329 /**
330 Removes reserved I/O or I/O resources from the global coherency domain of the
331 processor.
332
333 @param BaseAddress Base address of the segment.
334 @param Length Length of the segment.
335
336 @retval EFI_SUCCESS Successfully removed a segment of IO space.
337
338 **/
339 typedef
340 EFI_STATUS
341 (EFIAPI *EFI_REMOVE_IO_SPACE) (
342 IN EFI_PHYSICAL_ADDRESS BaseAddress,
343 IN UINT64 Length
344 )
345 ;
346
347 /**
348 Retrieves the descriptor for an I/O region containing a specified address.
349
350 @param BaseAddress Specified start address
351 @param Descriptor Specified length
352
353 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
354 @retval EFI_SUCCESS Successfully get the IO space descriptor.
355
356 **/
357 typedef
358 EFI_STATUS
359 (EFIAPI *EFI_GET_IO_SPACE_DESCRIPTOR) (
360 IN EFI_PHYSICAL_ADDRESS BaseAddress,
361 OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor
362 )
363 ;
364
365 /**
366 Returns a map of the I/O resources in the global coherency domain of the processor.
367
368 @param NumberOfDescriptors Number of descriptors.
369 @param MemorySpaceMap Descriptor array
370
371 @retval EFI_INVALID_PARAMETER Invalid parameter
372 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
373 @retval EFI_SUCCESS Successfully get IO space map.
374
375 **/
376 typedef
377 EFI_STATUS
378 (EFIAPI *EFI_GET_IO_SPACE_MAP) (
379 OUT UINTN *NumberOfDescriptors,
380 OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap
381 )
382 ;
383
384 /**
385 Loads and executed DXE drivers from firmware volumes.
386
387 @return Status code
388
389 **/
390 typedef
391 EFI_STATUS
392 (EFIAPI *EFI_DISPATCH) (VOID)
393 ;
394
395 /**
396 Clears the Schedule on Request (SOR) flag for a component that is stored in a firmware volume.
397
398 @param FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.
399 @param DriverName A pointer to the name of the file in a firmware volume.
400
401 @return Status code
402
403 **/
404 typedef
405 EFI_STATUS
406 (EFIAPI *EFI_SCHEDULE) (
407 IN EFI_HANDLE FirmwareVolumeHandle,
408 IN EFI_GUID *DriverName
409 )
410 ;
411
412 /**
413 Promotes a file stored in a firmware volume from the untrusted to the trusted state.
414
415 @param FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.
416 @param DriverName A pointer to the name of the file in a firmware volume.
417
418 @return Status code
419
420 **/
421 typedef
422 EFI_STATUS
423 (EFIAPI *EFI_TRUST) (
424 IN EFI_HANDLE FirmwareVolumeHandle,
425 IN EFI_GUID *DriverName
426 )
427 ;
428
429 /**
430 Creates a firmware volume handle for a firmware volume that is present in system memory.
431
432 @param FirmwareVolumeHeader A pointer to the header of the firmware volume.
433 @param Size The size, in bytes, of the firmware volume.
434 @param FirmwareVolumeHandle On output, a pointer to the created handle.
435
436 @return Status code
437
438 **/
439 typedef
440 EFI_STATUS
441 (EFIAPI *EFI_PROCESS_FIRMWARE_VOLUME) (
442 IN VOID *FvHeader,
443 IN UINTN Size,
444 OUT EFI_HANDLE *FirmwareVolumeHandle
445 )
446 ;
447
448 //
449 // DXE Services Table
450 //
451 #define EFI_DXE_SERVICES_SIGNATURE 0x565245535f455844ULL
452 #define EFI_DXE_SERVICES_REVISION ((0 << 16) | (90))
453
454 typedef struct {
455 EFI_TABLE_HEADER Hdr;
456
457 //
458 // Global Coherency Domain Services
459 //
460 EFI_ADD_MEMORY_SPACE AddMemorySpace;
461 EFI_ALLOCATE_MEMORY_SPACE AllocateMemorySpace;
462 EFI_FREE_MEMORY_SPACE FreeMemorySpace;
463 EFI_REMOVE_MEMORY_SPACE RemoveMemorySpace;
464 EFI_GET_MEMORY_SPACE_DESCRIPTOR GetMemorySpaceDescriptor;
465 EFI_SET_MEMORY_SPACE_ATTRIBUTES SetMemorySpaceAttributes;
466 EFI_GET_MEMORY_SPACE_MAP GetMemorySpaceMap;
467 EFI_ADD_IO_SPACE AddIoSpace;
468 EFI_ALLOCATE_IO_SPACE AllocateIoSpace;
469 EFI_FREE_IO_SPACE FreeIoSpace;
470 EFI_REMOVE_IO_SPACE RemoveIoSpace;
471 EFI_GET_IO_SPACE_DESCRIPTOR GetIoSpaceDescriptor;
472 EFI_GET_IO_SPACE_MAP GetIoSpaceMap;
473
474 //
475 // Dispatcher Services
476 //
477 EFI_DISPATCH Dispatch;
478 EFI_SCHEDULE Schedule;
479 EFI_TRUST Trust;
480 //
481 // Service to process a single firmware volume found in a capsule
482 //
483 EFI_PROCESS_FIRMWARE_VOLUME ProcessFirmwareVolume;
484 } EFI_DXE_SERVICES;
485
486
487 #include <Common/BootMode.h>
488 #include <Common/BootScript.h>
489 #include <Common/Capsule.h>
490 #include <Common/Dependency.h>
491 #include <Common/FirmwareVolumeImageFormat.h>
492 #include <Common/FirmwareVolumeHeader.h>
493 #include <Common/FirmwareFileSystem.h>
494 #include <Common/Hob.h>
495 #include <Common/InternalFormRepresentation.h>
496 #include <Common/StatusCode.h>
497 #include <Common/StatusCodeDataTypeId.h>
498
499 #include <Guid/AcpiTableStorage.h>
500 #include <Guid/Apriori.h>
501 #include <Guid/Capsule.h>
502 #include <Guid/DxeServices.h>
503 #include <Guid/EventLegacyBios.h>
504 #include <Guid/FirmwareFileSystem.h>
505 #include <Guid/FrameworkDevicePath.h>
506 #include <Guid/HobList.h>
507 #include <Guid/MemoryAllocationHob.h>
508 #include <Guid/SmramMemoryReserve.h>
509 #include <Guid/StatusCodeDataTypeId.h>
510
511 #include <Dxe/ArchProtocol/Bds.h>
512 #include <Dxe/ArchProtocol/Cpu.h>
513 #include <Dxe/ArchProtocol/Metronome.h>
514 #include <Dxe/ArchProtocol/MonotonicCounter.h>
515 #include <Dxe/ArchProtocol/RealTimeClock.h>
516 #include <Dxe/ArchProtocol/Reset.h>
517 #include <Dxe/ArchProtocol/Runtime.h>
518 #include <Dxe/ArchProtocol/Security.h>
519 #include <Dxe/ArchProtocol/SecurityPolicy.h>
520 #include <Dxe/ArchProtocol/StatusCode.h>
521 #include <Dxe/ArchProtocol/Timer.h>
522 #include <Dxe/ArchProtocol/Variable.h>
523 #include <Dxe/ArchProtocol/VariableWrite.h>
524 #include <Dxe/ArchProtocol/WatchdogTimer.h>
525
526 #include <Protocol/AcpiSupport.h>
527 #include <Protocol/BootScriptSave.h>
528 #include <Protocol/CpuIo.h>
529 #include <Protocol/DataHub.h>
530 #include <Protocol/FirmwareVolume.h>
531 #include <Protocol/FirmwareVolumeBlock.h>
532 #include <Protocol/FirmwareVolumeDispatch.h>
533 #include <Protocol/Hii.h>
534 #include <Protocol/FormBrowser.h>
535 #include <Protocol/FormCallback.h>
536 #include <Protocol/GuidedSectionExtraction.h>
537 #include <Protocol/IdeControllerInit.h>
538 #include <Protocol/IncompatiblePciDeviceSupport.h>
539 #include <Protocol/PciHostBridgeResourceAllocation.h>
540 #include <Protocol/PciHotPlugInit.h>
541 #include <Protocol/PciPlatform.h>
542 #include <Protocol/SectionExtraction.h>
543 #include <Protocol/Smbus.h>
544 #include <Protocol/LegacyBios.h>
545 #include <Protocol/Legacy8259.h>
546 #include <Protocol/LegacyRegion.h>
547 #include <Protocol/LegacyBiosPlatform.h>
548 #include <Protocol/LegacyInterrupt.h>
549
550 #endif