1 /** @file
2   Include file matches things in PI.
3 
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7   @par Revision Reference:
8   PI Version 1.6
9 
10 **/
11 
12 #ifndef __PI_DXECIS_H__
13 #define __PI_DXECIS_H__
14 
15 #include <Uefi/UefiMultiPhase.h>
16 #include <Pi/PiMultiPhase.h>
17 
18 ///
19 /// Global Coherencey Domain types - Memory type.
20 ///
21 typedef enum {
22   ///
23   /// A memory region that is visible to the boot processor. However, there are no system
24   /// components that are currently decoding this memory region.
25   ///
26   EfiGcdMemoryTypeNonExistent,
27   ///
28   /// A memory region that is visible to the boot processor. This memory region is being
29   /// decoded by a system component, but the memory region is not considered to be either
30   /// system memory or memory-mapped I/O.
31   ///
32   EfiGcdMemoryTypeReserved,
33   ///
34   /// A memory region that is visible to the boot processor. A memory controller is
35   /// currently decoding this memory region and the memory controller is producing a
36   /// tested system memory region that is available to the memory services.
37   ///
38   EfiGcdMemoryTypeSystemMemory,
39   ///
40   /// A memory region that is visible to the boot processor. This memory region is
41   /// currently being decoded by a component as memory-mapped I/O that can be used to
42   /// access I/O devices in the platform.
43   ///
44   EfiGcdMemoryTypeMemoryMappedIo,
45   ///
46   /// A memory region that is visible to the boot processor.
47   /// This memory supports byte-addressable non-volatility.
48   ///
49   EfiGcdMemoryTypePersistent,
50   //
51   // Keep original one for the compatibility.
52   //
53   EfiGcdMemoryTypePersistentMemory = EfiGcdMemoryTypePersistent,
54   ///
55   /// A memory region that provides higher reliability relative to other memory in the
56   /// system. If all memory has the same reliability, then this bit is not used.
57   ///
58   EfiGcdMemoryTypeMoreReliable,
59   EfiGcdMemoryTypeMaximum
60 } EFI_GCD_MEMORY_TYPE;
61 
62 ///
63 /// Global Coherencey Domain types - IO type.
64 ///
65 typedef enum {
66   ///
67   /// An I/O region that is visible to the boot processor. However, there are no system
68   /// components that are currently decoding this I/O region.
69   ///
70   EfiGcdIoTypeNonExistent,
71   ///
72   /// An I/O region that is visible to the boot processor. This I/O region is currently being
73   /// decoded by a system component, but the I/O region cannot be used to access I/O devices.
74   ///
75   EfiGcdIoTypeReserved,
76   ///
77   /// An I/O region that is visible to the boot processor. This I/O region is currently being
78   /// decoded by a system component that is producing I/O ports that can be used to access I/O devices.
79   ///
80   EfiGcdIoTypeIo,
81   EfiGcdIoTypeMaximum
82 } EFI_GCD_IO_TYPE;
83 
84 ///
85 /// The type of allocation to perform.
86 ///
87 typedef enum {
88   ///
89   /// The GCD memory space map is searched from the lowest address up to the highest address
90   /// looking for unallocated memory ranges.
91   ///
92   EfiGcdAllocateAnySearchBottomUp,
93   ///
94   /// The GCD memory space map is searched from the lowest address up
95   /// to the specified MaxAddress looking for unallocated memory ranges.
96   ///
97   EfiGcdAllocateMaxAddressSearchBottomUp,
98   ///
99   /// The GCD memory space map is checked to see if the memory range starting
100   /// at the specified Address is available.
101   ///
102   EfiGcdAllocateAddress,
103   ///
104   /// The GCD memory space map is searched from the highest address down to the lowest address
105   /// looking for unallocated memory ranges.
106   ///
107   EfiGcdAllocateAnySearchTopDown,
108   ///
109   /// The GCD memory space map is searched from the specified MaxAddress
110   /// down to the lowest address looking for unallocated memory ranges.
111   ///
112   EfiGcdAllocateMaxAddressSearchTopDown,
113   EfiGcdMaxAllocateType
114 } EFI_GCD_ALLOCATE_TYPE;
115 
116 ///
117 /// EFI_GCD_MEMORY_SPACE_DESCRIPTOR.
118 ///
119 typedef struct {
120   ///
121   /// The physical address of the first byte in the memory region. Type
122   /// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function
123   /// description in the UEFI 2.0 specification.
124   ///
125   EFI_PHYSICAL_ADDRESS  BaseAddress;
126 
127   ///
128   /// The number of bytes in the memory region.
129   ///
130   UINT64                Length;
131 
132   ///
133   /// The bit mask of attributes that the memory region is capable of supporting. The bit
134   /// mask of available attributes is defined in the GetMemoryMap() function description
135   /// in the UEFI 2.0 specification.
136   ///
137   UINT64                Capabilities;
138   ///
139   /// The bit mask of attributes that the memory region is currently using. The bit mask of
140   /// available attributes is defined in GetMemoryMap().
141   ///
142   UINT64                Attributes;
143   ///
144   /// Type of the memory region. Type EFI_GCD_MEMORY_TYPE is defined in the
145   /// AddMemorySpace() function description.
146   ///
147   EFI_GCD_MEMORY_TYPE   GcdMemoryType;
148 
149   ///
150   /// The image handle of the agent that allocated the memory resource described by
151   /// PhysicalStart and NumberOfBytes. If this field is NULL, then the memory
152   /// resource is not currently allocated. Type EFI_HANDLE is defined in
153   /// InstallProtocolInterface() in the UEFI 2.0 specification.
154   ///
155   EFI_HANDLE            ImageHandle;
156 
157   ///
158   /// The device handle for which the memory resource has been allocated. If
159   /// ImageHandle is NULL, then the memory resource is not currently allocated. If this
160   /// field is NULL, then the memory resource is not associated with a device that is
161   /// described by a device handle. Type EFI_HANDLE is defined in
162   /// InstallProtocolInterface() in the UEFI 2.0 specification.
163   ///
164   EFI_HANDLE            DeviceHandle;
165 } EFI_GCD_MEMORY_SPACE_DESCRIPTOR;
166 
167 ///
168 /// EFI_GCD_IO_SPACE_DESCRIPTOR.
169 ///
170 typedef struct {
171   ///
172   /// Physical address of the first byte in the I/O region. Type
173   /// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function
174   /// description in the UEFI 2.0 specification.
175   ///
176   EFI_PHYSICAL_ADDRESS  BaseAddress;
177 
178   ///
179   /// Number of bytes in the I/O region.
180   ///
181   UINT64                Length;
182 
183   ///
184   /// Type of the I/O region. Type EFI_GCD_IO_TYPE is defined in the
185   /// AddIoSpace() function description.
186   ///
187   EFI_GCD_IO_TYPE       GcdIoType;
188 
189   ///
190   /// The image handle of the agent that allocated the I/O resource described by
191   /// PhysicalStart and NumberOfBytes. If this field is NULL, then the I/O
192   /// resource is not currently allocated. Type EFI_HANDLE is defined in
193   /// InstallProtocolInterface() in the UEFI 2.0 specification.
194   ///
195   EFI_HANDLE            ImageHandle;
196 
197   ///
198   /// The device handle for which the I/O resource has been allocated. If ImageHandle
199   /// is NULL, then the I/O resource is not currently allocated. If this field is NULL, then
200   /// the I/O resource is not associated with a device that is described by a device handle.
201   /// Type EFI_HANDLE is defined in InstallProtocolInterface() in the UEFI
202   /// 2.0 specification.
203   ///
204   EFI_HANDLE            DeviceHandle;
205 } EFI_GCD_IO_SPACE_DESCRIPTOR;
206 
207 
208 /**
209   Adds reserved memory, system memory, or memory-mapped I/O resources to the
210   global coherency domain of the processor.
211 
212   @param  GcdMemoryType    The type of memory resource being added.
213   @param  BaseAddress      The physical address that is the start address
214                            of the memory resource being added.
215   @param  Length           The size, in bytes, of the memory resource that
216                            is being added.
217   @param  Capabilities     The bit mask of attributes that the memory
218                            resource region supports.
219 
220   @retval EFI_SUCCESS            The memory resource was added to the global
221                                  coherency domain of the processor.
222   @retval EFI_INVALID_PARAMETER  GcdMemoryType is invalid.
223   @retval EFI_INVALID_PARAMETER  Length is zero.
224   @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to add
225                                  the memory resource to the global coherency
226                                  domain of the processor.
227   @retval EFI_UNSUPPORTED        The processor does not support one or more bytes
228                                  of the memory resource range specified by
229                                  BaseAddress and Length.
230   @retval EFI_ACCESS_DENIED      One or more bytes of the memory resource range
231                                  specified by BaseAddress and Length conflicts
232                                  with a memory resource range that was previously
233                                  added to the global coherency domain of the processor.
234   @retval EFI_ACCESS_DENIED      One or more bytes of the memory resource range
235                                  specified by BaseAddress and Length was allocated
236                                  in a prior call to AllocateMemorySpace().
237 
238 **/
239 typedef
240 EFI_STATUS
241 (EFIAPI *EFI_ADD_MEMORY_SPACE)(
242   IN EFI_GCD_MEMORY_TYPE   GcdMemoryType,
243   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
244   IN UINT64                Length,
245   IN UINT64                Capabilities
246   );
247 
248 /**
249   Allocates nonexistent memory, reserved memory, system memory, or memorymapped
250   I/O resources from the global coherency domain of the processor.
251 
252   @param  GcdAllocateType  The type of allocation to perform.
253   @param  GcdMemoryType    The type of memory resource being allocated.
254   @param  Alignment        The log base 2 of the boundary that BaseAddress must
255                            be aligned on output. Align with 2^Alignment.
256   @param  Length           The size in bytes of the memory resource range that
257                            is being allocated.
258   @param  BaseAddress      A pointer to a physical address to allocate.
259   @param  Imagehandle      The image handle of the agent that is allocating
260                            the memory resource.
261   @param  DeviceHandle     The device handle for which the memory resource
262                            is being allocated.
263 
264   @retval EFI_INVALID_PARAMETER GcdAllocateType is invalid.
265   @retval EFI_INVALID_PARAMETER GcdMemoryType is invalid.
266   @retval EFI_INVALID_PARAMETER Length is zero.
267   @retval EFI_INVALID_PARAMETER BaseAddress is NULL.
268   @retval EFI_INVALID_PARAMETER ImageHandle is NULL.
269   @retval EFI_NOT_FOUND         The memory resource request could not be satisfied.
270                                 No descriptor contains the desired space.
271   @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to allocate the memory
272                                 resource from the global coherency domain of the processor.
273   @retval EFI_SUCCESS           The memory resource was allocated from the global coherency
274                                 domain of the processor.
275 
276 
277 **/
278 typedef
279 EFI_STATUS
280 (EFIAPI *EFI_ALLOCATE_MEMORY_SPACE)(
281   IN     EFI_GCD_ALLOCATE_TYPE               GcdAllocateType,
282   IN     EFI_GCD_MEMORY_TYPE                 GcdMemoryType,
283   IN     UINTN                               Alignment,
284   IN     UINT64                              Length,
285   IN OUT EFI_PHYSICAL_ADDRESS                *BaseAddress,
286   IN     EFI_HANDLE                          ImageHandle,
287   IN     EFI_HANDLE                          DeviceHandle OPTIONAL
288   );
289 
290 /**
291   Frees nonexistent memory, reserved memory, system memory, or memory-mapped
292   I/O resources from the global coherency domain of the processor.
293 
294   @param  BaseAddress      The physical address that is the start address of the memory resource being freed.
295   @param  Length           The size in bytes of the memory resource range that is being freed.
296 
297   @retval EFI_SUCCESS           The memory resource was freed from the global coherency domain of
298                                 the processor.
299   @retval EFI_INVALID_PARAMETER Length is zero.
300   @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the memory
301                                 resource range specified by BaseAddress and Length.
302   @retval EFI_NOT_FOUND         The memory resource range specified by BaseAddress and
303                                 Length was not allocated with previous calls to AllocateMemorySpace().
304   @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to free the memory resource
305                                 from the global coherency domain of the processor.
306 
307 **/
308 typedef
309 EFI_STATUS
310 (EFIAPI *EFI_FREE_MEMORY_SPACE)(
311   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
312   IN UINT64                Length
313   );
314 
315 /**
316   Removes reserved memory, system memory, or memory-mapped I/O resources from
317   the global coherency domain of the processor.
318 
319   @param  BaseAddress      The physical address that is the start address of the memory resource being removed.
320   @param  Length           The size in bytes of the memory resource that is being removed.
321 
322   @retval EFI_SUCCESS           The memory resource was removed from the global coherency
323                                 domain of the processor.
324   @retval EFI_INVALID_PARAMETER Length is zero.
325   @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the memory
326                                 resource range specified by BaseAddress and Length.
327   @retval EFI_NOT_FOUND         One or more bytes of the memory resource range specified by
328                                 BaseAddress and Length was not added with previous calls to
329                                 AddMemorySpace().
330   @retval EFI_ACCESS_DEFINED    One or more bytes of the memory resource range specified by
331                                 BaseAddress and Length has been allocated with AllocateMemorySpace().
332   @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to remove the memory
333                                 resource from the global coherency domain of the processor.
334 
335 **/
336 typedef
337 EFI_STATUS
338 (EFIAPI *EFI_REMOVE_MEMORY_SPACE)(
339   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
340   IN UINT64                Length
341   );
342 
343 /**
344   Retrieves the descriptor for a memory region containing a specified address.
345 
346   @param  BaseAddress      The physical address that is the start address of a memory region.
347   @param  Descriptor       A pointer to a caller allocated descriptor.
348 
349   @retval EFI_SUCCESS           The descriptor for the memory resource region containing
350                                 BaseAddress was returned in Descriptor.
351   @retval EFI_INVALID_PARAMETER Descriptor is NULL.
352   @retval EFI_NOT_FOUND         A memory resource range containing BaseAddress was not found.
353 
354 **/
355 typedef
356 EFI_STATUS
357 (EFIAPI *EFI_GET_MEMORY_SPACE_DESCRIPTOR)(
358   IN  EFI_PHYSICAL_ADDRESS             BaseAddress,
359   OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  *Descriptor
360   );
361 
362 /**
363   Modifies the attributes for a memory region in the global coherency domain of the
364   processor.
365 
366   @param  BaseAddress      The physical address that is the start address of a memory region.
367   @param  Length           The size in bytes of the memory region.
368   @param  Attributes       The bit mask of attributes to set for the memory region.
369 
370   @retval EFI_SUCCESS           The attributes were set for the memory region.
371   @retval EFI_INVALID_PARAMETER Length is zero.
372   @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the memory
373                                 resource range specified by BaseAddress and Length.
374   @retval EFI_UNSUPPORTED       The bit mask of attributes is not support for the memory resource
375                                 range specified by BaseAddress and Length.
376   @retval EFI_ACCESS_DENIED     The attributes for the memory resource range specified by
377                                 BaseAddress and Length cannot be modified.
378   @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to modify the attributes of
379                                 the memory resource range.
380   @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
381                                 not available yet.
382 **/
383 typedef
384 EFI_STATUS
385 (EFIAPI *EFI_SET_MEMORY_SPACE_ATTRIBUTES)(
386   IN EFI_PHYSICAL_ADDRESS         BaseAddress,
387   IN UINT64                       Length,
388   IN UINT64                       Attributes
389   );
390 
391 /**
392   Modifies the capabilities for a memory region in the global coherency domain of the
393   processor.
394 
395   @param  BaseAddress      The physical address that is the start address of a memory region.
396   @param  Length           The size in bytes of the memory region.
397   @param  Capabilities     The bit mask of capabilities that the memory region supports.
398 
399   @retval EFI_SUCCESS           The capabilities were set for the memory region.
400   @retval EFI_INVALID_PARAMETER Length is zero.
401   @retval EFI_UNSUPPORTED       The capabilities specified by Capabilities do not include the
402                                 memory region attributes currently in use.
403   @retval EFI_ACCESS_DENIED     The capabilities for the memory resource range specified by
404                                 BaseAddress and Length cannot be modified.
405   @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to modify the capabilities
406                                 of the memory resource range.
407 **/
408 typedef
409 EFI_STATUS
410 (EFIAPI *EFI_SET_MEMORY_SPACE_CAPABILITIES) (
411   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
412   IN UINT64                Length,
413   IN UINT64                Capabilities
414   );
415 
416 /**
417   Returns a map of the memory resources in the global coherency domain of the
418   processor.
419 
420   @param  NumberOfDescriptors A pointer to number of descriptors returned in the MemorySpaceMap buffer.
421   @param  MemorySpaceMap      A pointer to the array of EFI_GCD_MEMORY_SPACE_DESCRIPTORs.
422 
423   @retval EFI_SUCCESS           The memory space map was returned in the MemorySpaceMap
424                                 buffer, and the number of descriptors in MemorySpaceMap was
425                                 returned in NumberOfDescriptors.
426   @retval EFI_INVALID_PARAMETER NumberOfDescriptors is NULL.
427   @retval EFI_INVALID_PARAMETER MemorySpaceMap is NULL.
428   @retval EFI_OUT_OF_RESOURCES  There are not enough resources to allocate MemorySpaceMap.
429 
430 **/
431 typedef
432 EFI_STATUS
433 (EFIAPI *EFI_GET_MEMORY_SPACE_MAP)(
434   OUT UINTN                            *NumberOfDescriptors,
435   OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  **MemorySpaceMap
436   );
437 
438 /**
439   Adds reserved I/O or I/O resources to the global coherency domain of the processor.
440 
441   @param  GcdIoType        The type of I/O resource being added.
442   @param  BaseAddress      The physical address that is the start address of the I/O resource being added.
443   @param  Length           The size in bytes of the I/O resource that is being added.
444 
445   @retval EFI_SUCCESS           The I/O resource was added to the global coherency domain of
446                                 the processor.
447   @retval EFI_INVALID_PARAMETER GcdIoType is invalid.
448   @retval EFI_INVALID_PARAMETER Length is zero.
449   @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to add the I/O resource to
450                                 the global coherency domain of the processor.
451   @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the I/O
452                                 resource range specified by BaseAddress and Length.
453   @retval EFI_ACCESS_DENIED     One or more bytes of the I/O resource range specified by
454                                 BaseAddress and Length conflicts with an I/O resource
455                                 range that was previously added to the global coherency domain
456                                 of the processor.
457   @retval EFI_ACCESS_DENIED     One or more bytes of the I/O resource range specified by
458                                 BaseAddress and Length was allocated in a prior call to
459                                 AllocateIoSpace().
460 
461 **/
462 typedef
463 EFI_STATUS
464 (EFIAPI *EFI_ADD_IO_SPACE)(
465   IN EFI_GCD_IO_TYPE       GcdIoType,
466   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
467   IN UINT64                Length
468   );
469 
470 /**
471   Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
472   domain of the processor.
473 
474   @param  GcdAllocateType  The type of allocation to perform.
475   @param  GcdIoType        The type of I/O resource being allocated.
476   @param  Alignment        The log base 2 of the boundary that BaseAddress must be aligned on output.
477   @param  Length           The size in bytes of the I/O resource range that is being allocated.
478   @param  BaseAddress      A pointer to a physical address.
479   @param  Imagehandle      The image handle of the agent that is allocating the I/O resource.
480   @param  DeviceHandle     The device handle for which the I/O resource is being allocated.
481 
482   @retval EFI_SUCCESS           The I/O resource was allocated from the global coherency domain
483                                 of the processor.
484   @retval EFI_INVALID_PARAMETER GcdAllocateType is invalid.
485   @retval EFI_INVALID_PARAMETER GcdIoType is invalid.
486   @retval EFI_INVALID_PARAMETER Length is zero.
487   @retval EFI_INVALID_PARAMETER BaseAddress is NULL.
488   @retval EFI_INVALID_PARAMETER ImageHandle is NULL.
489   @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to allocate the I/O
490                                 resource from the global coherency domain of the processor.
491   @retval EFI_NOT_FOUND         The I/O resource request could not be satisfied.
492 
493 **/
494 typedef
495 EFI_STATUS
496 (EFIAPI *EFI_ALLOCATE_IO_SPACE)(
497   IN     EFI_GCD_ALLOCATE_TYPE               GcdAllocateType,
498   IN     EFI_GCD_IO_TYPE                     GcdIoType,
499   IN     UINTN                               Alignment,
500   IN     UINT64                              Length,
501   IN OUT EFI_PHYSICAL_ADDRESS                *BaseAddress,
502   IN     EFI_HANDLE                          ImageHandle,
503   IN     EFI_HANDLE                          DeviceHandle OPTIONAL
504   );
505 
506 /**
507   Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
508   domain of the processor.
509 
510   @param  BaseAddress      The physical address that is the start address of the I/O resource being freed.
511   @param  Length           The size in bytes of the I/O resource range that is being freed.
512 
513   @retval EFI_SUCCESS           The I/O resource was freed from the global coherency domain of the
514                                 processor.
515   @retval EFI_INVALID_PARAMETER Length is zero.
516   @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the I/O resource
517                                 range specified by BaseAddress and Length.
518   @retval EFI_NOT_FOUND         The I/O resource range specified by BaseAddress and Length
519                                 was not allocated with previous calls to AllocateIoSpace().
520   @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to free the I/O resource from
521                                 the global coherency domain of the processor.
522 
523 **/
524 typedef
525 EFI_STATUS
526 (EFIAPI *EFI_FREE_IO_SPACE)(
527   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
528   IN UINT64                Length
529   );
530 
531 /**
532   Removes reserved I/O or I/O resources from the global coherency domain of the
533   processor.
534 
535   @param  BaseAddress      A pointer to a physical address that is the start address of the I/O resource being
536                            removed.
537   @param Length            The size in bytes of the I/O resource that is being removed.
538 
539   @retval EFI_SUCCESS           The I/O resource was removed from the global coherency domain
540                                 of the processor.
541   @retval EFI_INVALID_PARAMETER Length is zero.
542   @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the I/O
543                                 resource range specified by BaseAddress and Length.
544   @retval EFI_NOT_FOUND         One or more bytes of the I/O resource range specified by
545                                 BaseAddress and Length was not added with previous
546                                 calls to AddIoSpace().
547   @retval EFI_ACCESS_DENIED     One or more bytes of the I/O resource range specified by
548                                 BaseAddress and Length has been allocated with
549                                 AllocateIoSpace().
550   @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to remove the I/O
551                                 resource from the global coherency domain of the processor.
552 
553 **/
554 typedef
555 EFI_STATUS
556 (EFIAPI *EFI_REMOVE_IO_SPACE)(
557   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
558   IN UINT64                Length
559   );
560 
561 /**
562   Retrieves the descriptor for an I/O region containing a specified address.
563 
564   @param  BaseAddress      The physical address that is the start address of an I/O region.
565   @param  Descriptor       A pointer to a caller allocated descriptor.
566 
567   @retval EFI_SUCCESS           The descriptor for the I/O resource region containing
568                                 BaseAddress was returned in Descriptor.
569   @retval EFI_INVALID_PARAMETER Descriptor is NULL.
570   @retval EFI_NOT_FOUND         An I/O resource range containing BaseAddress was not found.
571 
572 **/
573 typedef
574 EFI_STATUS
575 (EFIAPI *EFI_GET_IO_SPACE_DESCRIPTOR)(
576   IN  EFI_PHYSICAL_ADDRESS         BaseAddress,
577   OUT EFI_GCD_IO_SPACE_DESCRIPTOR  *Descriptor
578   );
579 
580 /**
581   Returns a map of the I/O resources in the global coherency domain of the processor.
582 
583   @param  NumberOfDescriptors A pointer to number of descriptors returned in the IoSpaceMap buffer.
584   @param  MemorySpaceMap      A pointer to the array of EFI_GCD_IO_SPACE_DESCRIPTORs.
585 
586   @retval EFI_SUCCESS           The I/O space map was returned in the IoSpaceMap buffer, and
587                                 the number of descriptors in IoSpaceMap was returned in
588                                 NumberOfDescriptors.
589   @retval EFI_INVALID_PARAMETER NumberOfDescriptors is NULL.
590   @retval EFI_INVALID_PARAMETER IoSpaceMap is NULL.
591   @retval EFI_OUT_OF_RESOURCES  There are not enough resources to allocate IoSpaceMap.
592 
593 
594 **/
595 typedef
596 EFI_STATUS
597 (EFIAPI *EFI_GET_IO_SPACE_MAP)(
598   OUT UINTN                        *NumberOfDescriptors,
599   OUT EFI_GCD_IO_SPACE_DESCRIPTOR  **IoSpaceMap
600   );
601 
602 
603 
604 /**
605   Loads and executed DXE drivers from firmware volumes.
606 
607   The Dispatch() function searches for DXE drivers in firmware volumes that have been
608   installed since the last time the Dispatch() service was called. It then evaluates
609   the dependency expressions of all the DXE drivers and loads and executes those DXE
610   drivers whose dependency expression evaluate to TRUE. This service must interact with
611   the Security Architectural Protocol to authenticate DXE drivers before they are executed.
612   This process is continued until no more DXE drivers can be executed.
613 
614   @retval EFI_SUCCESS         One or more DXE driver were dispatched.
615   @retval EFI_NOT_FOUND       No DXE drivers were dispatched.
616   @retval EFI_ALREADY_STARTED An attempt is being made to start the DXE Dispatcher recursively.
617                               Thus, no action was taken.
618 
619 **/
620 typedef
621 EFI_STATUS
622 (EFIAPI *EFI_DISPATCH)(
623   VOID
624   );
625 
626 /**
627   Clears the Schedule on Request (SOR) flag for a component that is stored in a firmware volume.
628 
629   @param  FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.
630   @param  FileName             A pointer to the name of the file in a firmware volume.
631 
632   @retval EFI_SUCCESS         The DXE driver was found and its SOR bit was cleared.
633   @retval EFI_NOT_FOUND       The DXE driver does not exist, or the DXE driver exists and its SOR
634                               bit is not set.
635 
636 **/
637 typedef
638 EFI_STATUS
639 (EFIAPI *EFI_SCHEDULE)(
640   IN EFI_HANDLE  FirmwareVolumeHandle,
641   IN CONST EFI_GUID    *FileName
642   );
643 
644 /**
645   Promotes a file stored in a firmware volume from the untrusted to the trusted state.
646 
647   @param  FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.
648   @param  DriverName           A pointer to the name of the file in a firmware volume.
649 
650   @return Status of promoting FFS from untrusted to trusted
651           state.
652   @retval EFI_NOT_FOUND       The file was not found in the untrusted state.
653 
654 **/
655 typedef
656 EFI_STATUS
657 (EFIAPI *EFI_TRUST)(
658   IN EFI_HANDLE  FirmwareVolumeHandle,
659   IN CONST EFI_GUID    *FileName
660   );
661 
662 /**
663   Creates a firmware volume handle for a firmware volume that is present in system memory.
664 
665   @param  FirmwareVolumeHeader A pointer to the header of the firmware volume.
666   @param  Size                 The size, in bytes, of the firmware volume.
667   @param  FirmwareVolumeHandle On output, a pointer to the created handle.
668 
669   @retval EFI_SUCCESS          The EFI_FIRMWARE_VOLUME_PROTOCOL and
670                                EFI_DEVICE_PATH_PROTOCOL were installed onto
671                                FirmwareVolumeHandle for the firmware volume described
672                                by FirmwareVolumeHeader and Size.
673   @retval EFI_VOLUME_CORRUPTED The firmware volume described by FirmwareVolumeHeader
674                                and Size is corrupted.
675   @retval EFI_OUT_OF_RESOURCES There are not enough system resources available to produce the
676                                EFI_FIRMWARE_VOLUME_PROTOCOL and EFI_DEVICE_PATH_PROTOCOL
677                                for the firmware volume described by FirmwareVolumeHeader and Size.
678 
679 **/
680 typedef
681 EFI_STATUS
682 (EFIAPI *EFI_PROCESS_FIRMWARE_VOLUME)(
683   IN CONST VOID                       *FirmwareVolumeHeader,
684   IN UINTN                            Size,
685   OUT EFI_HANDLE                      *FirmwareVolumeHandle
686   );
687 
688 //
689 // DXE Services Table
690 //
691 #define DXE_SERVICES_SIGNATURE            0x565245535f455844ULL
692 #define DXE_SPECIFICATION_MAJOR_REVISION  1
693 #define DXE_SPECIFICATION_MINOR_REVISION  60
694 #define DXE_SERVICES_REVISION             ((DXE_SPECIFICATION_MAJOR_REVISION<<16) | (DXE_SPECIFICATION_MINOR_REVISION))
695 
696 typedef struct {
697   ///
698   /// The table header for the DXE Services Table.
699   /// This header contains the DXE_SERVICES_SIGNATURE and DXE_SERVICES_REVISION values.
700   ///
701   EFI_TABLE_HEADER                Hdr;
702 
703   //
704   // Global Coherency Domain Services
705   //
706   EFI_ADD_MEMORY_SPACE            AddMemorySpace;
707   EFI_ALLOCATE_MEMORY_SPACE       AllocateMemorySpace;
708   EFI_FREE_MEMORY_SPACE           FreeMemorySpace;
709   EFI_REMOVE_MEMORY_SPACE         RemoveMemorySpace;
710   EFI_GET_MEMORY_SPACE_DESCRIPTOR GetMemorySpaceDescriptor;
711   EFI_SET_MEMORY_SPACE_ATTRIBUTES SetMemorySpaceAttributes;
712   EFI_GET_MEMORY_SPACE_MAP        GetMemorySpaceMap;
713   EFI_ADD_IO_SPACE                AddIoSpace;
714   EFI_ALLOCATE_IO_SPACE           AllocateIoSpace;
715   EFI_FREE_IO_SPACE               FreeIoSpace;
716   EFI_REMOVE_IO_SPACE             RemoveIoSpace;
717   EFI_GET_IO_SPACE_DESCRIPTOR     GetIoSpaceDescriptor;
718   EFI_GET_IO_SPACE_MAP            GetIoSpaceMap;
719 
720   //
721   // Dispatcher Services
722   //
723   EFI_DISPATCH                    Dispatch;
724   EFI_SCHEDULE                    Schedule;
725   EFI_TRUST                       Trust;
726   //
727   // Service to process a single firmware volume found in a capsule
728   //
729   EFI_PROCESS_FIRMWARE_VOLUME     ProcessFirmwareVolume;
730   //
731   // Extensions to Global Coherency Domain Services
732   //
733   EFI_SET_MEMORY_SPACE_CAPABILITIES SetMemorySpaceCapabilities;
734 } DXE_SERVICES;
735 
736 typedef DXE_SERVICES EFI_DXE_SERVICES;
737 
738 #endif
739