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