2 Include file matches things in the DXE CIS.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
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.
15 @par Revision Reference:
23 #include <Uefi/UefiSpec.h>
26 #define TIANO_ERROR(a) (MAX_2_BITS | (a))
28 #if (EFI_SPECIFICATION_VERSION < 0x00020000)
30 // Tiano added a couple of return types. These are owned by UEFI specification
31 // and Tiano can not use them. Thus for UEFI 2.0/R9 support we moved the values
32 // to a UEFI OEM extension range to conform to UEFI specification.
34 #define EFI_NOT_AVAILABLE_YET EFIERR (28)
35 #define EFI_UNLOAD_IMAGE EFIERR (29)
37 #define EFI_NOT_AVAILABLE_YET TIANO_ERROR (0)
38 #define EFI_UNLOAD_IMAGE TIANO_ERROR (1)
42 // BugBug: Implementation contamination of UEFI 2.0
43 // Pointer to internal runtime pointer
45 #define EFI_IPF_GP_POINTER 0x00000008
49 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
53 // attributes for reserved memory before it is promoted to system memory
55 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
56 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
57 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
60 // range for memory mapped port I/O on IPF
62 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
65 // Modifier for EFI DXE Services
67 #define EFI_DXESERVICE
71 // Global Coherencey Domain types
74 EfiGcdMemoryTypeNonExistent
,
75 EfiGcdMemoryTypeReserved
,
76 EfiGcdMemoryTypeSystemMemory
,
77 EfiGcdMemoryTypeMemoryMappedIo
,
78 EfiGcdMemoryTypeMaximum
79 } EFI_GCD_MEMORY_TYPE
;
82 EfiGcdIoTypeNonExistent
,
89 EfiGcdAllocateAnySearchBottomUp
,
90 EfiGcdAllocateMaxAddressSearchBottomUp
,
91 EfiGcdAllocateAddress
,
92 EfiGcdAllocateAnySearchTopDown
,
93 EfiGcdAllocateMaxAddressSearchTopDown
,
95 } EFI_GCD_ALLOCATE_TYPE
;
98 EFI_PHYSICAL_ADDRESS BaseAddress
;
102 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
103 EFI_HANDLE ImageHandle
;
104 EFI_HANDLE DeviceHandle
;
105 } EFI_GCD_MEMORY_SPACE_DESCRIPTOR
;
108 EFI_PHYSICAL_ADDRESS BaseAddress
;
110 EFI_GCD_IO_TYPE GcdIoType
;
111 EFI_HANDLE ImageHandle
;
112 EFI_HANDLE DeviceHandle
;
113 } EFI_GCD_IO_SPACE_DESCRIPTOR
;
116 Adds reserved memory, system memory, or memory-mapped I/O resources to the
117 global coherency domain of the processor.
119 @param GcdMemoryType Memory type of the memory space.
121 @param BaseAddress Base address of the memory space.
123 @param Length Length of the memory space.
125 @param Capabilities alterable attributes of the memory space.
127 @retval EFI_SUCCESS Merged this memory space into GCD map.
132 (EFIAPI
*EFI_ADD_MEMORY_SPACE
) (
133 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
134 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
136 IN UINT64 Capabilities
141 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
142 I/O resources from the global coherency domain of the processor.
144 @param GcdAllocateType The type of allocate operation
146 @param GcdMemoryType The desired memory type
148 @param Alignment Align with 2^Alignment
150 @param Length Length to allocate
152 @param BaseAddress Base address to allocate
154 @param Imagehandle The image handle consume the allocated space.
156 @param DeviceHandle The device handle consume the allocated space.
158 @retval EFI_INVALID_PARAMETER Invalid parameter.
160 @retval EFI_NOT_FOUND No descriptor contains the desired space.
162 @retval EFI_SUCCESS Memory space successfully allocated.
167 (EFIAPI
*EFI_ALLOCATE_MEMORY_SPACE
) (
168 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
169 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
172 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
173 IN EFI_HANDLE ImageHandle
,
174 IN EFI_HANDLE DeviceHandle OPTIONAL
179 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
180 I/O resources from the global coherency domain of the processor.
182 @param BaseAddress Base address of the segment.
184 @param Length Length of the segment.
186 @retval EFI_SUCCESS Space successfully freed.
191 (EFIAPI
*EFI_FREE_MEMORY_SPACE
) (
192 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
198 Removes reserved memory, system memory, or memory-mapped I/O resources from
199 the global coherency domain of the processor.
201 @param BaseAddress Base address of the memory space.
203 @param Length Length of the memory space.
205 @retval EFI_SUCCESS Successfully remove a segment of memory space.
210 (EFIAPI
*EFI_REMOVE_MEMORY_SPACE
) (
211 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
217 Retrieves the descriptor for a memory region containing a specified address.
219 @param BaseAddress Specified start address
221 @param Descriptor Specified length
223 @retval EFI_INVALID_PARAMETER Invalid parameter
225 @retval EFI_SUCCESS Successfully get memory space descriptor.
230 (EFIAPI
*EFI_GET_MEMORY_SPACE_DESCRIPTOR
) (
231 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
232 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
237 Modifies the attributes for a memory region in the global coherency domain of the
240 @param BaseAddress Specified start address
242 @param Length Specified length
244 @param Attributes Specified attributes
246 @retval EFI_SUCCESS Successfully set attribute of a segment of memory space.
252 (EFIAPI
*EFI_SET_MEMORY_SPACE_ATTRIBUTES
) (
253 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
260 Returns a map of the memory resources in the global coherency domain of the
263 @param NumberOfDescriptors Number of descriptors.
265 @param MemorySpaceMap Descriptor array
267 @retval EFI_INVALID_PARAMETER Invalid parameter
269 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
271 @retval EFI_SUCCESS Successfully get memory space map.
276 (EFIAPI
*EFI_GET_MEMORY_SPACE_MAP
) (
277 OUT UINTN
*NumberOfDescriptors
,
278 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
283 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
285 @param GcdIoType IO type of the segment.
287 @param BaseAddress Base address of the segment.
289 @param Length Length of the segment.
291 @retval EFI_SUCCESS Merged this segment into GCD map.
296 (EFIAPI
*EFI_ADD_IO_SPACE
) (
297 IN EFI_GCD_IO_TYPE GcdIoType
,
298 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
304 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
305 domain of the processor.
307 @param GcdAllocateType The type of allocate operation
309 @param GcdIoType The desired IO type
311 @param Alignment Align with 2^Alignment
313 @param Length Length to allocate
315 @param BaseAddress Base address to allocate
317 @param Imagehandle The image handle consume the allocated space.
319 @param DeviceHandle The device handle consume the allocated space.
321 @retval EFI_INVALID_PARAMETER Invalid parameter.
323 @retval EFI_NOT_FOUND No descriptor contains the desired space.
325 @retval EFI_SUCCESS IO space successfully allocated.
330 (EFIAPI
*EFI_ALLOCATE_IO_SPACE
) (
331 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
332 IN EFI_GCD_IO_TYPE GcdIoType
,
335 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
336 IN EFI_HANDLE ImageHandle
,
337 IN EFI_HANDLE DeviceHandle OPTIONAL
342 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
343 domain of the processor.
345 @param BaseAddress Base address of the segment.
347 @param Length Length of the segment.
349 @retval EFI_SUCCESS Space successfully freed.
354 (EFIAPI
*EFI_FREE_IO_SPACE
) (
355 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
361 Removes reserved I/O or I/O resources from the global coherency domain of the
364 @param BaseAddress Base address of the segment.
366 @param Length Length of the segment.
368 @retval EFI_SUCCESS Successfully removed a segment of IO space.
373 (EFIAPI
*EFI_REMOVE_IO_SPACE
) (
374 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
380 Retrieves the descriptor for an I/O region containing a specified address.
382 @param BaseAddress Specified start address
384 @param Descriptor Specified length
386 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
388 @retval EFI_SUCCESS Successfully get the IO space descriptor.
393 (EFIAPI
*EFI_GET_IO_SPACE_DESCRIPTOR
) (
394 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
395 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
400 Returns a map of the I/O resources in the global coherency domain of the processor.
402 @param NumberOfDescriptors Number of descriptors.
404 @param MemorySpaceMap Descriptor array
406 @retval EFI_INVALID_PARAMETER Invalid parameter
408 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
410 @retval EFI_SUCCESS Successfully get IO space map.
415 (EFIAPI
*EFI_GET_IO_SPACE_MAP
) (
416 OUT UINTN
*NumberOfDescriptors
,
417 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
422 Loads and executed DXE drivers from firmware volumes.
429 (EFIAPI
*EFI_DISPATCH
) (VOID
)
433 Clears the Schedule on Request (SOR) flag for a component that is stored in a firmware volume.
435 @param FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.
437 @param DriverName A pointer to the name of the file in a firmware volume.
444 (EFIAPI
*EFI_SCHEDULE
) (
445 IN EFI_HANDLE FirmwareVolumeHandle
,
446 IN EFI_GUID
*DriverName
451 Promotes a file stored in a firmware volume from the untrusted to the trusted state.
453 @param FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.
455 @param DriverName A pointer to the name of the file in a firmware volume.
462 (EFIAPI
*EFI_TRUST
) (
463 IN EFI_HANDLE FirmwareVolumeHandle
,
464 IN EFI_GUID
*DriverName
469 Creates a firmware volume handle for a firmware volume that is present in system memory.
471 @param FirmwareVolumeHeader A pointer to the header of the firmware volume.
472 @param Size The size, in bytes, of the firmware volume.
473 @param FirmwareVolumeHandle On output, a pointer to the created handle.
480 (EFIAPI
*EFI_PROCESS_FIRMWARE_VOLUME
) (
483 OUT EFI_HANDLE
*FirmwareVolumeHandle
488 // DXE Services Table
490 #define EFI_DXE_SERVICES_SIGNATURE 0x565245535f455844ULL
491 #define EFI_DXE_SERVICES_REVISION ((0 << 16) | (25))
494 EFI_TABLE_HEADER Hdr
;
497 // Global Coherency Domain Services
499 EFI_ADD_MEMORY_SPACE AddMemorySpace
;
500 EFI_ALLOCATE_MEMORY_SPACE AllocateMemorySpace
;
501 EFI_FREE_MEMORY_SPACE FreeMemorySpace
;
502 EFI_REMOVE_MEMORY_SPACE RemoveMemorySpace
;
503 EFI_GET_MEMORY_SPACE_DESCRIPTOR GetMemorySpaceDescriptor
;
504 EFI_SET_MEMORY_SPACE_ATTRIBUTES SetMemorySpaceAttributes
;
505 EFI_GET_MEMORY_SPACE_MAP GetMemorySpaceMap
;
506 EFI_ADD_IO_SPACE AddIoSpace
;
507 EFI_ALLOCATE_IO_SPACE AllocateIoSpace
;
508 EFI_FREE_IO_SPACE FreeIoSpace
;
509 EFI_REMOVE_IO_SPACE RemoveIoSpace
;
510 EFI_GET_IO_SPACE_DESCRIPTOR GetIoSpaceDescriptor
;
511 EFI_GET_IO_SPACE_MAP GetIoSpaceMap
;
514 // Dispatcher Services
516 EFI_DISPATCH Dispatch
;
517 EFI_SCHEDULE Schedule
;
520 // Service to process a single firmware volume found in a capsule
522 EFI_PROCESS_FIRMWARE_VOLUME ProcessFirmwareVolume
;
526 #include <Common/BootMode.h>
527 #include <Common/BootScript.h>
528 #include <Common/Capsule.h>
529 #include <Common/Dependency.h>
530 #include <Common/FirmwareVolumeImageFormat.h>
531 #include <Common/FirmwareVolumeHeader.h>
532 #include <Common/FirmwareFileSystem.h>
533 #include <Common/Hob.h>
534 #include <Common/InternalFormRepresentation.h>
535 #include <Common/StatusCode.h>
536 #include <Common/StatusCodeDataTypeId.h>
538 #include <Guid/AcpiTableStorage.h>
539 #include <Guid/Apriori.h>
540 #include <Guid/Capsule.h>
541 #include <Guid/DxeServices.h>
542 #include <Guid/EventLegacyBios.h>
543 #include <Guid/FirmwareFileSystem.h>
544 #include <Guid/FrameworkDevicePath.h>
545 #include <Guid/HobList.h>
546 #include <Guid/MemoryAllocationHob.h>
547 #include <Guid/SmramMemoryReserve.h>
548 #include <Guid/StatusCodeDataTypeId.h>
550 #include <Dxe/ArchProtocol/Bds.h>
551 #include <Dxe/ArchProtocol/Cpu.h>
552 #include <Dxe/ArchProtocol/Metronome.h>
553 #include <Dxe/ArchProtocol/MonotonicCounter.h>
554 #include <Dxe/ArchProtocol/RealTimeClock.h>
555 #include <Dxe/ArchProtocol/Reset.h>
556 #include <Dxe/ArchProtocol/Runtime.h>
557 #include <Dxe/ArchProtocol/Security.h>
558 #include <Dxe/ArchProtocol/SecurityPolicy.h>
559 #include <Dxe/ArchProtocol/StatusCode.h>
560 #include <Dxe/ArchProtocol/Timer.h>
561 #include <Dxe/ArchProtocol/Variable.h>
562 #include <Dxe/ArchProtocol/VariableWrite.h>
563 #include <Dxe/ArchProtocol/WatchdogTimer.h>
565 #include <Protocol/AcpiSupport.h>
566 #include <Protocol/BootScriptSave.h>
567 #include <Protocol/CpuIo.h>
568 #include <Protocol/DataHub.h>
569 #include <Protocol/FirmwareVolume.h>
570 #include <Protocol/FirmwareVolumeBlock.h>
571 #include <Protocol/FirmwareVolumeDispatch.h>
572 #include <Protocol/Hii.h>
573 #include <Protocol/FormBrowser.h>
574 #include <Protocol/FormCallback.h>
575 #include <Protocol/GuidedSectionExtraction.h>
576 #include <Protocol/IdeControllerInit.h>
577 #include <Protocol/IncompatiblePciDeviceSupport.h>
578 #include <Protocol/PciHostBridgeResourceAllocation.h>
579 #include <Protocol/PciHotPlugInit.h>
580 #include <Protocol/PciPlatform.h>
581 #include <Protocol/SectionExtraction.h>
582 #include <Protocol/Smbus.h>
583 #include <Protocol/LegacyBios.h>
584 #include <Protocol/Legacy8259.h>
585 #include <Protocol/LegacyRegion.h>
586 #include <Protocol/LegacyBiosPlatform.h>
587 #include <Protocol/LegacyInterrupt.h>