3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 DXE Core Main Entry Point
32 CoreEfiNotAvailableYetArg0 (
38 CoreEfiNotAvailableYetArg1 (
44 CoreEfiNotAvailableYetArg2 (
51 CoreEfiNotAvailableYetArg3 (
59 CoreEfiNotAvailableYetArg4 (
68 CoreEfiNotAvailableYetArg5 (
78 IN EFI_GUID
*ProtocolGuid
,
83 DxeMainUefiDecompressGetInfo (
84 IN EFI_DECOMPRESS_PROTOCOL
*This
,
87 OUT UINT32
*DestinationSize
,
88 OUT UINT32
*ScratchSize
93 DxeMainUefiDecompress (
94 IN EFI_DECOMPRESS_PROTOCOL
*This
,
97 IN OUT VOID
*Destination
,
98 IN UINT32 DestinationSize
,
100 IN UINT32 ScratchSize
104 DxeMainTianoDecompressGetInfo (
105 IN EFI_TIANO_DECOMPRESS_PROTOCOL
*This
,
107 IN UINT32 SourceSize
,
108 OUT UINT32
*DestinationSize
,
109 OUT UINT32
*ScratchSize
114 DxeMainTianoDecompress (
115 IN EFI_TIANO_DECOMPRESS_PROTOCOL
*This
,
117 IN UINT32 SourceSize
,
118 IN OUT VOID
*Destination
,
119 IN UINT32 DestinationSize
,
120 IN OUT VOID
*Scratch
,
121 IN UINT32 ScratchSize
125 DxeMainCustomDecompressGetInfo (
126 IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL
*This
,
128 IN UINT32 SourceSize
,
129 OUT UINT32
*DestinationSize
,
130 OUT UINT32
*ScratchSize
135 DxeMainCustomDecompress (
136 IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL
*This
,
138 IN UINT32 SourceSize
,
139 IN OUT VOID
*Destination
,
140 IN UINT32 DestinationSize
,
141 IN OUT VOID
*Scratch
,
142 IN UINT32 ScratchSize
146 // DXE Core Global Variables for Protocols from PEI
148 EFI_HANDLE mDecompressHandle
= NULL
;
149 EFI_PEI_PE_COFF_LOADER_PROTOCOL
*gEfiPeiPeCoffLoader
= NULL
;
152 // DXE Core globals for Architecture Protocols
154 EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
= NULL
;
155 EFI_CPU_ARCH_PROTOCOL
*gCpu
= NULL
;
156 EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
= NULL
;
157 EFI_TIMER_ARCH_PROTOCOL
*gTimer
= NULL
;
158 EFI_BDS_ARCH_PROTOCOL
*gBds
= NULL
;
159 EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
= NULL
;
160 EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
= NULL
;
163 // BugBug: I'n not runtime, but is the PPI?
165 EFI_STATUS_CODE_PROTOCOL gStatusCodeInstance
= {
169 EFI_STATUS_CODE_PROTOCOL
*gStatusCode
= &gStatusCodeInstance
;
173 // DXE Core Global used to update core loaded image protocol handle
175 EFI_GUID
*gDxeCoreFileName
;
176 EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
181 // DXE Core Module Variables
184 EFI_BOOT_SERVICES mBootServices
= {
186 EFI_BOOT_SERVICES_SIGNATURE
, // Signature
187 EFI_BOOT_SERVICES_REVISION
, // Revision
188 sizeof (EFI_BOOT_SERVICES
), // HeaderSize
192 (EFI_RAISE_TPL
) CoreRaiseTpl
, // RaiseTPL
193 (EFI_RESTORE_TPL
) CoreRestoreTpl
, // RestoreTPL
194 (EFI_ALLOCATE_PAGES
) CoreAllocatePages
, // AllocatePages
195 (EFI_FREE_PAGES
) CoreFreePages
, // FreePages
196 (EFI_GET_MEMORY_MAP
) CoreGetMemoryMap
, // GetMemoryMap
197 (EFI_ALLOCATE_POOL
) CoreAllocatePool
, // AllocatePool
198 (EFI_FREE_POOL
) CoreFreePool
, // FreePool
199 (EFI_CREATE_EVENT
) CoreCreateEvent
, // CreateEvent
200 (EFI_SET_TIMER
) CoreSetTimer
, // SetTimer
201 (EFI_WAIT_FOR_EVENT
) CoreWaitForEvent
, // WaitForEvent
202 (EFI_SIGNAL_EVENT
) CoreSignalEvent
, // SignalEvent
203 (EFI_CLOSE_EVENT
) CoreCloseEvent
, // CloseEvent
204 (EFI_CHECK_EVENT
) CoreCheckEvent
, // CheckEvent
205 (EFI_INSTALL_PROTOCOL_INTERFACE
) CoreInstallProtocolInterface
, // InstallProtocolInterface
206 (EFI_REINSTALL_PROTOCOL_INTERFACE
) CoreReinstallProtocolInterface
, // ReinstallProtocolInterface
207 (EFI_UNINSTALL_PROTOCOL_INTERFACE
) CoreUninstallProtocolInterface
, // UninstallProtocolInterface
208 (EFI_HANDLE_PROTOCOL
) CoreHandleProtocol
, // HandleProtocol
209 (VOID
*) NULL
, // Reserved
210 (EFI_REGISTER_PROTOCOL_NOTIFY
) CoreRegisterProtocolNotify
, // RegisterProtocolNotify
211 (EFI_LOCATE_HANDLE
) CoreLocateHandle
, // LocateHandle
212 (EFI_LOCATE_DEVICE_PATH
) CoreLocateDevicePath
, // LocateDevicePath
213 (EFI_INSTALL_CONFIGURATION_TABLE
) CoreInstallConfigurationTable
, // InstallConfigurationTable
214 (EFI_IMAGE_LOAD
) CoreLoadImage
, // LoadImage
215 (EFI_IMAGE_START
) CoreStartImage
, // StartImage
216 (EFI_EXIT
) CoreExit
, // Exit
217 (EFI_IMAGE_UNLOAD
) CoreUnloadImage
, // UnloadImage
218 (EFI_EXIT_BOOT_SERVICES
) CoreExitBootServices
, // ExitBootServices
219 (EFI_GET_NEXT_MONOTONIC_COUNT
) CoreEfiNotAvailableYetArg1
, // GetNextMonotonicCount
220 (EFI_STALL
) CoreStall
, // Stall
221 (EFI_SET_WATCHDOG_TIMER
) CoreSetWatchdogTimer
, // SetWatchdogTimer
222 (EFI_CONNECT_CONTROLLER
) CoreConnectController
, // ConnectController
223 (EFI_DISCONNECT_CONTROLLER
) CoreDisconnectController
, // DisconnectController
224 (EFI_OPEN_PROTOCOL
) CoreOpenProtocol
, // OpenProtocol
225 (EFI_CLOSE_PROTOCOL
) CoreCloseProtocol
, // CloseProtocol
226 (EFI_OPEN_PROTOCOL_INFORMATION
) CoreOpenProtocolInformation
, // OpenProtocolInformation
227 (EFI_PROTOCOLS_PER_HANDLE
) CoreProtocolsPerHandle
, // ProtocolsPerHandle
228 (EFI_LOCATE_HANDLE_BUFFER
) CoreLocateHandleBuffer
, // LocateHandleBuffer
229 (EFI_LOCATE_PROTOCOL
) CoreLocateProtocol
, // LocateProtocol
230 (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES
) CoreInstallMultipleProtocolInterfaces
, // InstallMultipleProtocolInterfaces
231 (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES
) CoreUninstallMultipleProtocolInterfaces
, // UninstallMultipleProtocolInterfaces
232 (EFI_CALCULATE_CRC32
) CoreEfiNotAvailableYetArg3
, // CalculateCrc32
233 (EFI_COPY_MEM
) CopyMem
, // CopyMem
234 (EFI_SET_MEM
) SetMem
// SetMem
235 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
237 (EFI_CREATE_EVENT_EX
) CoreCreateEventEx
// CreateEventEx
241 EFI_DXE_SERVICES mDxeServices
= {
243 EFI_DXE_SERVICES_SIGNATURE
, // Signature
244 EFI_DXE_SERVICES_REVISION
, // Revision
245 sizeof (EFI_DXE_SERVICES
), // HeaderSize
249 (EFI_ADD_MEMORY_SPACE
) CoreAddMemorySpace
, // AddMemorySpace
250 (EFI_ALLOCATE_MEMORY_SPACE
) CoreAllocateMemorySpace
, // AllocateMemorySpace
251 (EFI_FREE_MEMORY_SPACE
) CoreFreeMemorySpace
, // FreeMemorySpace
252 (EFI_REMOVE_MEMORY_SPACE
) CoreRemoveMemorySpace
, // RemoveMemorySpace
253 (EFI_GET_MEMORY_SPACE_DESCRIPTOR
) CoreGetMemorySpaceDescriptor
, // GetMemorySpaceDescriptor
254 (EFI_SET_MEMORY_SPACE_ATTRIBUTES
) CoreSetMemorySpaceAttributes
, // SetMemorySpaceAttributes
255 (EFI_GET_MEMORY_SPACE_MAP
) CoreGetMemorySpaceMap
, // GetMemorySpaceMap
256 (EFI_ADD_IO_SPACE
) CoreAddIoSpace
, // AddIoSpace
257 (EFI_ALLOCATE_IO_SPACE
) CoreAllocateIoSpace
, // AllocateIoSpace
258 (EFI_FREE_IO_SPACE
) CoreFreeIoSpace
, // FreeIoSpace
259 (EFI_REMOVE_IO_SPACE
) CoreRemoveIoSpace
, // RemoveIoSpace
260 (EFI_GET_IO_SPACE_DESCRIPTOR
) CoreGetIoSpaceDescriptor
, // GetIoSpaceDescriptor
261 (EFI_GET_IO_SPACE_MAP
) CoreGetIoSpaceMap
, // GetIoSpaceMap
262 (EFI_DISPATCH
) CoreDispatcher
, // Dispatch
263 (EFI_SCHEDULE
) CoreSchedule
, // Schedule
264 (EFI_TRUST
) CoreTrust
, // Trust
265 (EFI_PROCESS_FIRMWARE_VOLUME
) CoreProcessFirmwareVolume
, // ProcessFirmwareVolume
268 EFI_SYSTEM_TABLE mEfiSystemTableTemplate
= {
270 EFI_SYSTEM_TABLE_SIGNATURE
, // Signature
271 EFI_SYSTEM_TABLE_REVISION
, // Revision
272 sizeof (EFI_SYSTEM_TABLE
), // HeaderSize
276 NULL
, // FirmwareVendor
277 0, // FirmwareRevision
278 NULL
, // ConsoleInHandle
280 NULL
, // ConsoleOutHandle
282 NULL
, // StandardErrorHandle
284 NULL
, // RuntimeServices
285 &mBootServices
, // BootServices
286 0, // NumberOfConfigurationTableEntries
287 NULL
// ConfigurationTable
290 EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate
= {
292 EFI_RUNTIME_SERVICES_SIGNATURE
, // Signature
293 EFI_RUNTIME_SERVICES_REVISION
, // Revision
294 sizeof (EFI_RUNTIME_SERVICES
), // HeaderSize
298 (EFI_GET_TIME
) CoreEfiNotAvailableYetArg2
, // GetTime
299 (EFI_SET_TIME
) CoreEfiNotAvailableYetArg1
, // SetTime
300 (EFI_GET_WAKEUP_TIME
) CoreEfiNotAvailableYetArg3
, // GetWakeupTime
301 (EFI_SET_WAKEUP_TIME
) CoreEfiNotAvailableYetArg2
, // SetWakeupTime
302 (EFI_SET_VIRTUAL_ADDRESS_MAP
) CoreEfiNotAvailableYetArg4
, // SetVirtualAddressMap
303 (EFI_CONVERT_POINTER
) CoreEfiNotAvailableYetArg2
, // ConvertPointer
304 (EFI_GET_VARIABLE
) CoreEfiNotAvailableYetArg5
, // GetVariable
305 (EFI_GET_NEXT_VARIABLE_NAME
) CoreEfiNotAvailableYetArg3
, // GetNextVariableName
306 (EFI_SET_VARIABLE
) CoreEfiNotAvailableYetArg5
, // SetVariable
307 (EFI_GET_NEXT_HIGH_MONO_COUNT
) CoreEfiNotAvailableYetArg1
, // GetNextHighMonotonicCount
308 (EFI_RESET_SYSTEM
) CoreEfiNotAvailableYetArg4
// ResetSystem
309 #if ((EDK_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))
311 // This Tiano extension was removed when UEFI 2.0 support was added.
312 // It's now just a protocol.
315 (EFI_REPORT_STATUS_CODE
) CoreEfiNotAvailableYetArg5
// ReportStatusCode
316 #elif (EFI_SPECIFICATION_VERSION >= 0x00020000)
318 // New runtime services added by UEFI 2.0
321 (EFI_UPDATE_CAPSULE
) CoreEfiNotAvailableYetArg3
, // UpdateCapsule
322 (EFI_QUERY_CAPSULE_CAPABILITIES
) CoreEfiNotAvailableYetArg4
, // QueryCapsuleCapabilities
323 (EFI_QUERY_VARIABLE_INFO
) CoreEfiNotAvailableYetArg4
// QueryVariableInfo
328 // DXE Core Global Variables for the EFI System Table, Boot Services Table,
329 // DXE Services Table, and Runtime Services Table
331 EFI_BOOT_SERVICES
*gBS
= &mBootServices
;
332 EFI_DXE_SERVICES
*gDS
= &mDxeServices
;
333 EFI_SYSTEM_TABLE
*gST
= NULL
;
336 // For debug initialize gRT to template. gRT must be allocated from RT memory
337 // but gRT is used for ASSERT () and DEBUG () type macros so lets give it
338 // a value that will not cause debug infrastructure to crash early on.
340 EFI_RUNTIME_SERVICES
*gRT
= &mEfiRuntimeServicesTableTemplate
;
341 EFI_HANDLE gDxeCoreImageHandle
= NULL
;
346 // EFI Decompress Protocol
348 EFI_DECOMPRESS_PROTOCOL gEfiDecompress
= {
349 DxeMainUefiDecompressGetInfo
,
350 DxeMainUefiDecompress
354 // Tiano Decompress Protocol
356 EFI_TIANO_DECOMPRESS_PROTOCOL gEfiTianoDecompress
= {
357 DxeMainTianoDecompressGetInfo
,
358 DxeMainTianoDecompress
362 // Customized Decompress Protocol
364 EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL gEfiCustomizedDecompress
= {
365 DxeMainCustomDecompressGetInfo
,
366 DxeMainCustomDecompress
370 // Main entry point to the DXE Core
381 Main entry point to DXE Core.
385 HobStart - Pointer to the beginning of the HOB List from PEI
389 This function should never return
394 EFI_PHYSICAL_ADDRESS MemoryBaseAddress
;
397 #ifdef EFI_DXE_PERFORMANCE
400 GetTimerValue (&Tick
);
403 mHobStart
= HobStart
;
406 // Initialize Memory Services
408 CoreInitializeMemoryServices (&HobStart
, &MemoryBaseAddress
, &MemoryLength
);
411 // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData
412 // Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table
414 gST
= CoreAllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE
), &mEfiSystemTableTemplate
);
415 ASSERT (gST
!= NULL
);
417 gRT
= CoreAllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES
), &mEfiRuntimeServicesTableTemplate
);
418 ASSERT (gRT
!= NULL
);
420 gST
->RuntimeServices
= gRT
;
423 // Start the Image Services.
425 Status
= CoreInitializeImageServices (HobStart
);
426 ASSERT_EFI_ERROR (Status
);
429 // Call constructor for all libraries
431 ProcessLibraryConstructorList (gDxeCoreImageHandle
, gST
);
434 // Initialize the Global Coherency Domain Services
436 Status
= CoreInitializeGcdServices (&HobStart
, MemoryBaseAddress
, MemoryLength
);
437 ASSERT_EFI_ERROR (Status
);
440 // Install the DXE Services Table into the EFI System Tables's Configuration Table
442 Status
= CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid
, gDS
);
443 ASSERT_EFI_ERROR (Status
);
446 // Install the HOB List into the EFI System Tables's Configuration Table
448 Status
= CoreInstallConfigurationTable (&gEfiHobListGuid
, HobStart
);
449 ASSERT_EFI_ERROR (Status
);
452 // Install Memory Type Information Table into the EFI System Tables's Configuration Table
454 Status
= CoreInstallConfigurationTable (&gEfiMemoryTypeInformationGuid
, &gMemoryTypeInformation
);
455 ASSERT_EFI_ERROR (Status
);
458 // Initialize the ReportStatusCode with PEI version, if availible
460 CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid
, (VOID
**)&gStatusCode
->ReportStatusCode
);
461 #if ((EDK_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))
463 // This Tiano extension was removed when UEFI 2.0 support was added.
464 // It's now just a protocol.
466 gRT
->ReportStatusCode
= gStatusCode
->ReportStatusCode
;
470 // Report Status Code here for DXE_ENTRY_POINT once it is available
472 CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE
| EFI_SW_DXE_CORE_PC_ENTRY_POINT
));
475 // Create the aligned system table pointer structure that is used by external
476 // debuggers to locate the system table... Also, install debug image info
477 // configuration table.
479 CoreInitializeDebugImageInfoTable ();
480 CoreNewDebugImageInfoEntry (
481 EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL
,
486 DEBUG ((EFI_D_INFO
| EFI_D_LOAD
, "HOBLIST address in DXE = 0x%08x\n", HobStart
));
489 // Initialize the Event Services
491 Status
= CoreInitializeEventServices ();
492 ASSERT_EFI_ERROR (Status
);
496 // Get the Protocols that were passed in from PEI to DXE through GUIDed HOBs
498 // These Protocols are not architectural. This implementation is sharing code between
499 // PEI and DXE in order to save FLASH space. These Protocols could also be implemented
500 // as part of the DXE Core. However, that would also require the DXE Core to be ported
501 // each time a different CPU is used, a different Decompression algorithm is used, or a
502 // different Image type is used. By placing these Protocols in PEI, the DXE Core remains
503 // generic, and only PEI and the Arch Protocols need to be ported from Platform to Platform,
504 // and from CPU to CPU.
508 // Publish the EFI, Tiano, and Custom Decompress protocols for use by other DXE components
510 Status
= CoreInstallMultipleProtocolInterfaces (
512 &gEfiDecompressProtocolGuid
, &gEfiDecompress
,
513 &gEfiTianoDecompressProtocolGuid
, &gEfiTianoDecompress
,
514 &gEfiCustomizedDecompressProtocolGuid
, &gEfiCustomizedDecompress
,
517 ASSERT_EFI_ERROR (Status
);
519 gEfiPeiPeCoffLoader
= GetPeCoffLoaderProtocol ();
520 ASSERT (gEfiPeiPeCoffLoader
!= NULL
);
523 // Register for the GUIDs of the Architectural Protocols, so the rest of the
524 // EFI Boot Services and EFI Runtime Services tables can be filled in.
526 CoreNotifyOnArchProtocolInstallation ();
529 // Produce Firmware Volume Protocols, one for each FV in the HOB list.
531 Status
= FwVolBlockDriverInit (gDxeCoreImageHandle
, gST
);
532 ASSERT_EFI_ERROR (Status
);
534 Status
= FwVolDriverInit (gDxeCoreImageHandle
, gST
);
535 ASSERT_EFI_ERROR (Status
);
538 // Produce the Section Extraction Protocol
540 Status
= InitializeSectionExtraction (gDxeCoreImageHandle
, gST
);
541 ASSERT_EFI_ERROR (Status
);
544 // Initialize the DXE Dispatcher
546 PERF_START (0,"CoreInitializeDispatcher", "DxeMain", 0) ;
547 CoreInitializeDispatcher ();
548 PERF_END (0,"CoreInitializeDispatcher", "DxeMain", 0) ;
551 // Invoke the DXE Dispatcher
553 PERF_START (0, "CoreDispatcher", "DxeMain", 0);
555 PERF_END (0, "CoreDispatcher", "DxeMain", 0);
558 // Display Architectural protocols that were not loaded if this is DEBUG build
561 CoreDisplayMissingArchProtocols ();
565 // Assert if the Architectural Protocols are not present.
567 ASSERT_EFI_ERROR (CoreAllEfiServicesAvailable ());
570 // Report Status code before transfer control to BDS
572 CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE
| EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT
));
574 // Display any drivers that were not dispatched because dependency expression
575 // evaluated to false if this is a debug build
578 CoreDisplayDiscoveredNotDispatched ();
582 // Transfer control to the BDS Architectural Protocol
587 // BDS should never return
596 CoreEfiNotAvailableYetArg0 (
603 Place holder function until all the Boot Services and Runtime Services are available
611 EFI_NOT_AVAILABLE_YET
616 // This function should never be executed. If it does, then the architectural protocols
617 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
618 // DXE Core and all the Architectural Protocols are complete.
621 return EFI_NOT_AVAILABLE_YET
;
626 CoreEfiNotAvailableYetArg1 (
633 Place holder function until all the Boot Services and Runtime Services are available
641 EFI_NOT_AVAILABLE_YET
646 // This function should never be executed. If it does, then the architectural protocols
647 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
648 // DXE Core and all the Architectural Protocols are complete.
651 return EFI_NOT_AVAILABLE_YET
;
656 CoreEfiNotAvailableYetArg2 (
664 Place holder function until all the Boot Services and Runtime Services are available
674 EFI_NOT_AVAILABLE_YET
679 // This function should never be executed. If it does, then the architectural protocols
680 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
681 // DXE Core and all the Architectural Protocols are complete.
684 return EFI_NOT_AVAILABLE_YET
;
689 CoreEfiNotAvailableYetArg3 (
698 Place holder function until all the Boot Services and Runtime Services are available
710 EFI_NOT_AVAILABLE_YET
715 // This function should never be executed. If it does, then the architectural protocols
716 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
717 // DXE Core and all the Architectural Protocols are complete.
720 return EFI_NOT_AVAILABLE_YET
;
725 CoreEfiNotAvailableYetArg4 (
735 Place holder function until all the Boot Services and Runtime Services are available
749 EFI_NOT_AVAILABLE_YET
754 // This function should never be executed. If it does, then the architectural protocols
755 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
756 // DXE Core and all the Architectural Protocols are complete.
759 return EFI_NOT_AVAILABLE_YET
;
764 CoreEfiNotAvailableYetArg5 (
775 Place holder function until all the Boot Services and Runtime Services are available
791 EFI_NOT_AVAILABLE_YET
796 // This function should never be executed. If it does, then the architectural protocols
797 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
798 // DXE Core and all the Architectural Protocols are complete.
801 return EFI_NOT_AVAILABLE_YET
;
807 IN EFI_GUID
*ProtocolGuid
,
814 Searches for a Protocol Interface passed from PEI through a HOB
818 ProtocolGuid - The Protocol GUID to search for in the HOB List
820 Interface - A pointer to the interface for the Protocol GUID
824 EFI_SUCCESS - The Protocol GUID was found and its interface is returned in Interface
826 EFI_NOT_FOUND - The Protocol GUID was not found in the HOB List
830 EFI_HOB_GUID_TYPE
*GuidHob
;
833 GuidHob
= GetNextGuidHob (ProtocolGuid
, mHobStart
);
834 if (GuidHob
== NULL
) {
835 return EFI_NOT_FOUND
;
838 Buffer
= GET_GUID_HOB_DATA (GuidHob
);
839 ASSERT (Buffer
!= NULL
);
841 *Interface
= (VOID
*)(*(UINTN
*)(Buffer
));
849 IN OUT EFI_TABLE_HEADER
*Hdr
855 Calcualte the 32-bit CRC in a EFI table using the service provided by the
860 Hdr - Pointer to an EFI standard header
873 // If gBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then
874 // Crc will come back as zero if we set it to zero here
877 gBS
->CalculateCrc32 ((UINT8
*)Hdr
, Hdr
->HeaderSize
, &Crc
);
885 CoreExitBootServices (
886 IN EFI_HANDLE ImageHandle
,
893 EFI 1.0 API to terminate Boot Services
897 ImageHandle - Handle that represents the identity of the calling image
899 MapKey -Key to the latest memory map.
903 EFI_SUCCESS - Boot Services terminated
904 EFI_INVALID_PARAMETER - MapKey is incorrect.
911 // Terminate memory services if the MapKey matches
913 Status
= CoreTerminateMemoryMap (MapKey
);
914 if (EFI_ERROR (Status
)) {
919 // Notify other drivers that we are exiting boot services.
921 CoreNotifySignalList (&gEfiEventExitBootServicesGuid
);
926 gTimer
->SetTimerPeriod (gTimer
, 0);
929 // Disable CPU Interrupts
931 gCpu
->DisableInterrupt (gCpu
);
934 // Register Runtime events with the Runtime Architectural Protocol
936 CoreShutdownEventServices ();
939 // Register Runtime images with the Runtime Architectural Protocol
941 CoreShutdownImageServices ();
944 // Report that ExitBootServices() has been called
946 // We are using gEfiDxeServicesTableGuid as the caller ID for Dxe Core
948 CoreReportProgressCode ((EFI_SOFTWARE_EFI_BOOT_SERVICE
| EFI_SW_BS_PC_EXIT_BOOT_SERVICES
));
951 // Clear the non-runtime values of the EFI System Table
953 gST
->BootServices
= NULL
;
955 gST
->ConsoleInHandle
= NULL
;
957 gST
->ConsoleOutHandle
= NULL
;
959 gST
->StandardErrorHandle
= NULL
;
962 // Recompute the 32-bit CRC of the EFI System Table
964 CalculateEfiHdrCrc (&gST
->Hdr
);
967 // Zero out the Boot Service Table
969 SetMem (gBS
, sizeof (EFI_BOOT_SERVICES
), 0);
976 DxeMainUefiDecompressGetInfo (
977 IN EFI_DECOMPRESS_PROTOCOL
*This
,
979 IN UINT32 SourceSize
,
980 OUT UINT32
*DestinationSize
,
981 OUT UINT32
*ScratchSize
984 return UefiDecompressGetInfo (Source
, SourceSize
, DestinationSize
, ScratchSize
);
989 DxeMainUefiDecompress (
990 IN EFI_DECOMPRESS_PROTOCOL
*This
,
992 IN UINT32 SourceSize
,
993 IN OUT VOID
*Destination
,
994 IN UINT32 DestinationSize
,
995 IN OUT VOID
*Scratch
,
996 IN UINT32 ScratchSize
1000 UINT32 TestDestinationSize
;
1001 UINT32 TestScratchSize
;
1003 Status
= UefiDecompressGetInfo (Source
, SourceSize
, &TestDestinationSize
, &TestScratchSize
);
1004 if (EFI_ERROR (Status
)) {
1008 if (ScratchSize
< TestScratchSize
|| DestinationSize
< TestDestinationSize
) {
1009 return RETURN_INVALID_PARAMETER
;
1012 return UefiDecompress (Source
, Destination
, Scratch
);
1016 DxeMainTianoDecompressGetInfo (
1017 IN EFI_TIANO_DECOMPRESS_PROTOCOL
*This
,
1019 IN UINT32 SourceSize
,
1020 OUT UINT32
*DestinationSize
,
1021 OUT UINT32
*ScratchSize
1024 return TianoDecompressGetInfo (Source
, SourceSize
, DestinationSize
, ScratchSize
);
1029 DxeMainTianoDecompress (
1030 IN EFI_TIANO_DECOMPRESS_PROTOCOL
*This
,
1032 IN UINT32 SourceSize
,
1033 IN OUT VOID
*Destination
,
1034 IN UINT32 DestinationSize
,
1035 IN OUT VOID
*Scratch
,
1036 IN UINT32 ScratchSize
1040 UINT32 TestDestinationSize
;
1041 UINT32 TestScratchSize
;
1043 Status
= TianoDecompressGetInfo (Source
, SourceSize
, &TestDestinationSize
, &TestScratchSize
);
1044 if (EFI_ERROR (Status
)) {
1048 if (ScratchSize
< TestScratchSize
|| DestinationSize
< TestDestinationSize
) {
1049 return RETURN_INVALID_PARAMETER
;
1052 return TianoDecompress (Source
, Destination
, Scratch
);
1056 DxeMainCustomDecompressGetInfo (
1057 IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL
*This
,
1059 IN UINT32 SourceSize
,
1060 OUT UINT32
*DestinationSize
,
1061 OUT UINT32
*ScratchSize
1064 return CustomDecompressGetInfo (Source
, SourceSize
, DestinationSize
, ScratchSize
);
1069 DxeMainCustomDecompress (
1070 IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL
*This
,
1072 IN UINT32 SourceSize
,
1073 IN OUT VOID
*Destination
,
1074 IN UINT32 DestinationSize
,
1075 IN OUT VOID
*Scratch
,
1076 IN UINT32 ScratchSize
1080 UINT32 TestDestinationSize
;
1081 UINT32 TestScratchSize
;
1083 Status
= CustomDecompressGetInfo (Source
, SourceSize
, &TestDestinationSize
, &TestScratchSize
);
1084 if (EFI_ERROR (Status
)) {
1088 if (ScratchSize
< TestScratchSize
|| DestinationSize
< TestDestinationSize
) {
1089 return RETURN_INVALID_PARAMETER
;
1092 return CustomDecompress (Source
, Destination
, Scratch
);