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