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