3 DXE Core Main Entry Point
4 Copyright (c) 2006 - 2007, 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.
18 // DXE Core Global Variables for Protocols from PEI
20 EFI_HANDLE mDecompressHandle
= NULL
;
23 // DXE Core globals for Architecture Protocols
25 EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
= NULL
;
26 EFI_CPU_ARCH_PROTOCOL
*gCpu
= NULL
;
27 EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
= NULL
;
28 EFI_TIMER_ARCH_PROTOCOL
*gTimer
= NULL
;
29 EFI_BDS_ARCH_PROTOCOL
*gBds
= NULL
;
30 EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
= NULL
;
34 // BugBug: I'n not runtime, but is the PPI?
36 EFI_STATUS_CODE_PROTOCOL gStatusCodeInstance
= {
40 EFI_STATUS_CODE_PROTOCOL
*gStatusCode
= &gStatusCodeInstance
;
44 // DXE Core Global used to update core loaded image protocol handle
46 EFI_GUID
*gDxeCoreFileName
;
47 EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
52 // DXE Core Module Variables
55 EFI_BOOT_SERVICES mBootServices
= {
57 EFI_BOOT_SERVICES_SIGNATURE
, // Signature
58 EFI_BOOT_SERVICES_REVISION
, // Revision
59 sizeof (EFI_BOOT_SERVICES
), // HeaderSize
63 (EFI_RAISE_TPL
) CoreRaiseTpl
, // RaiseTPL
64 (EFI_RESTORE_TPL
) CoreRestoreTpl
, // RestoreTPL
65 (EFI_ALLOCATE_PAGES
) CoreAllocatePages
, // AllocatePages
66 (EFI_FREE_PAGES
) CoreFreePages
, // FreePages
67 (EFI_GET_MEMORY_MAP
) CoreGetMemoryMap
, // GetMemoryMap
68 (EFI_ALLOCATE_POOL
) CoreAllocatePool
, // AllocatePool
69 (EFI_FREE_POOL
) CoreFreePool
, // FreePool
70 (EFI_CREATE_EVENT
) CoreCreateEvent
, // CreateEvent
71 (EFI_SET_TIMER
) CoreSetTimer
, // SetTimer
72 (EFI_WAIT_FOR_EVENT
) CoreWaitForEvent
, // WaitForEvent
73 (EFI_SIGNAL_EVENT
) CoreSignalEvent
, // SignalEvent
74 (EFI_CLOSE_EVENT
) CoreCloseEvent
, // CloseEvent
75 (EFI_CHECK_EVENT
) CoreCheckEvent
, // CheckEvent
76 (EFI_INSTALL_PROTOCOL_INTERFACE
) CoreInstallProtocolInterface
, // InstallProtocolInterface
77 (EFI_REINSTALL_PROTOCOL_INTERFACE
) CoreReinstallProtocolInterface
, // ReinstallProtocolInterface
78 (EFI_UNINSTALL_PROTOCOL_INTERFACE
) CoreUninstallProtocolInterface
, // UninstallProtocolInterface
79 (EFI_HANDLE_PROTOCOL
) CoreHandleProtocol
, // HandleProtocol
80 (VOID
*) NULL
, // Reserved
81 (EFI_REGISTER_PROTOCOL_NOTIFY
) CoreRegisterProtocolNotify
, // RegisterProtocolNotify
82 (EFI_LOCATE_HANDLE
) CoreLocateHandle
, // LocateHandle
83 (EFI_LOCATE_DEVICE_PATH
) CoreLocateDevicePath
, // LocateDevicePath
84 (EFI_INSTALL_CONFIGURATION_TABLE
) CoreInstallConfigurationTable
, // InstallConfigurationTable
85 (EFI_IMAGE_LOAD
) CoreLoadImage
, // LoadImage
86 (EFI_IMAGE_START
) CoreStartImage
, // StartImage
87 (EFI_EXIT
) CoreExit
, // Exit
88 (EFI_IMAGE_UNLOAD
) CoreUnloadImage
, // UnloadImage
89 (EFI_EXIT_BOOT_SERVICES
) CoreExitBootServices
, // ExitBootServices
90 (EFI_GET_NEXT_MONOTONIC_COUNT
) CoreEfiNotAvailableYetArg1
, // GetNextMonotonicCount
91 (EFI_STALL
) CoreStall
, // Stall
92 (EFI_SET_WATCHDOG_TIMER
) CoreSetWatchdogTimer
, // SetWatchdogTimer
93 (EFI_CONNECT_CONTROLLER
) CoreConnectController
, // ConnectController
94 (EFI_DISCONNECT_CONTROLLER
) CoreDisconnectController
, // DisconnectController
95 (EFI_OPEN_PROTOCOL
) CoreOpenProtocol
, // OpenProtocol
96 (EFI_CLOSE_PROTOCOL
) CoreCloseProtocol
, // CloseProtocol
97 (EFI_OPEN_PROTOCOL_INFORMATION
) CoreOpenProtocolInformation
, // OpenProtocolInformation
98 (EFI_PROTOCOLS_PER_HANDLE
) CoreProtocolsPerHandle
, // ProtocolsPerHandle
99 (EFI_LOCATE_HANDLE_BUFFER
) CoreLocateHandleBuffer
, // LocateHandleBuffer
100 (EFI_LOCATE_PROTOCOL
) CoreLocateProtocol
, // LocateProtocol
101 (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES
) CoreInstallMultipleProtocolInterfaces
, // InstallMultipleProtocolInterfaces
102 (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES
) CoreUninstallMultipleProtocolInterfaces
, // UninstallMultipleProtocolInterfaces
103 (EFI_CALCULATE_CRC32
) CoreEfiNotAvailableYetArg3
, // CalculateCrc32
104 (EFI_COPY_MEM
) CopyMem
, // CopyMem
105 (EFI_SET_MEM
) SetMem
, // SetMem
106 (EFI_CREATE_EVENT_EX
) CoreCreateEventEx
// CreateEventEx
109 EFI_DXE_SERVICES mDxeServices
= {
111 DXE_SERVICES_SIGNATURE
, // Signature
112 DXE_SERVICES_REVISION
, // Revision
113 sizeof (DXE_SERVICES
), // HeaderSize
117 (EFI_ADD_MEMORY_SPACE
) CoreAddMemorySpace
, // AddMemorySpace
118 (EFI_ALLOCATE_MEMORY_SPACE
) CoreAllocateMemorySpace
, // AllocateMemorySpace
119 (EFI_FREE_MEMORY_SPACE
) CoreFreeMemorySpace
, // FreeMemorySpace
120 (EFI_REMOVE_MEMORY_SPACE
) CoreRemoveMemorySpace
, // RemoveMemorySpace
121 (EFI_GET_MEMORY_SPACE_DESCRIPTOR
) CoreGetMemorySpaceDescriptor
, // GetMemorySpaceDescriptor
122 (EFI_SET_MEMORY_SPACE_ATTRIBUTES
) CoreSetMemorySpaceAttributes
, // SetMemorySpaceAttributes
123 (EFI_GET_MEMORY_SPACE_MAP
) CoreGetMemorySpaceMap
, // GetMemorySpaceMap
124 (EFI_ADD_IO_SPACE
) CoreAddIoSpace
, // AddIoSpace
125 (EFI_ALLOCATE_IO_SPACE
) CoreAllocateIoSpace
, // AllocateIoSpace
126 (EFI_FREE_IO_SPACE
) CoreFreeIoSpace
, // FreeIoSpace
127 (EFI_REMOVE_IO_SPACE
) CoreRemoveIoSpace
, // RemoveIoSpace
128 (EFI_GET_IO_SPACE_DESCRIPTOR
) CoreGetIoSpaceDescriptor
, // GetIoSpaceDescriptor
129 (EFI_GET_IO_SPACE_MAP
) CoreGetIoSpaceMap
, // GetIoSpaceMap
130 (EFI_DISPATCH
) CoreDispatcher
, // Dispatch
131 (EFI_SCHEDULE
) CoreSchedule
, // Schedule
132 (EFI_TRUST
) CoreTrust
, // Trust
133 (EFI_PROCESS_FIRMWARE_VOLUME
) CoreProcessFirmwareVolume
, // ProcessFirmwareVolume
136 EFI_SYSTEM_TABLE mEfiSystemTableTemplate
= {
138 EFI_SYSTEM_TABLE_SIGNATURE
, // Signature
139 EFI_SYSTEM_TABLE_REVISION
, // Revision
140 sizeof (EFI_SYSTEM_TABLE
), // HeaderSize
144 NULL
, // FirmwareVendor
145 0, // FirmwareRevision
146 NULL
, // ConsoleInHandle
148 NULL
, // ConsoleOutHandle
150 NULL
, // StandardErrorHandle
152 NULL
, // RuntimeServices
153 &mBootServices
, // BootServices
154 0, // NumberOfConfigurationTableEntries
155 NULL
// ConfigurationTable
158 EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate
= {
160 EFI_RUNTIME_SERVICES_SIGNATURE
, // Signature
161 EFI_RUNTIME_SERVICES_REVISION
, // Revision
162 sizeof (EFI_RUNTIME_SERVICES
), // HeaderSize
166 (EFI_GET_TIME
) CoreEfiNotAvailableYetArg2
, // GetTime
167 (EFI_SET_TIME
) CoreEfiNotAvailableYetArg1
, // SetTime
168 (EFI_GET_WAKEUP_TIME
) CoreEfiNotAvailableYetArg3
, // GetWakeupTime
169 (EFI_SET_WAKEUP_TIME
) CoreEfiNotAvailableYetArg2
, // SetWakeupTime
170 (EFI_SET_VIRTUAL_ADDRESS_MAP
) CoreEfiNotAvailableYetArg4
, // SetVirtualAddressMap
171 (EFI_CONVERT_POINTER
) CoreEfiNotAvailableYetArg2
, // ConvertPointer
172 (EFI_GET_VARIABLE
) CoreEfiNotAvailableYetArg5
, // GetVariable
173 (EFI_GET_NEXT_VARIABLE_NAME
) CoreEfiNotAvailableYetArg3
, // GetNextVariableName
174 (EFI_SET_VARIABLE
) CoreEfiNotAvailableYetArg5
, // SetVariable
175 (EFI_GET_NEXT_HIGH_MONO_COUNT
) CoreEfiNotAvailableYetArg1
, // GetNextHighMonotonicCount
176 (EFI_RESET_SYSTEM
) CoreEfiNotAvailableYetArg4
, // ResetSystem
177 (EFI_UPDATE_CAPSULE
) CoreEfiNotAvailableYetArg3
, // UpdateCapsule
178 (EFI_QUERY_CAPSULE_CAPABILITIES
) CoreEfiNotAvailableYetArg4
, // QueryCapsuleCapabilities
179 (EFI_QUERY_VARIABLE_INFO
) CoreEfiNotAvailableYetArg4
// QueryVariableInfo
182 EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
= {
183 INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate
.ImageHead
),
184 INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate
.EventHead
),
187 // Make sure Size != sizeof (EFI_MEMORY_DESCRIPTOR). This will
188 // prevent people from having pointer math bugs in their code.
189 // now you have to use *DescriptorSize to make things work.
191 sizeof (EFI_MEMORY_DESCRIPTOR
) + sizeof (UINT64
) - (sizeof (EFI_MEMORY_DESCRIPTOR
) % sizeof (UINT64
)),
192 EFI_MEMORY_DESCRIPTOR_VERSION
,
200 EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
= &gRuntimeTemplate
;
203 // DXE Core Global Variables for the EFI System Table, Boot Services Table,
204 // DXE Services Table, and Runtime Services Table
206 EFI_BOOT_SERVICES
*gDxeCoreBS
= &mBootServices
;
207 EFI_DXE_SERVICES
*gDxeCoreDS
= &mDxeServices
;
208 EFI_SYSTEM_TABLE
*gDxeCoreST
= NULL
;
211 // For debug initialize gDxeCoreRT to template. gDxeCoreRT must be allocated from RT memory
212 // but gDxeCoreRT is used for ASSERT () and DEBUG () type macros so lets give it
213 // a value that will not cause debug infrastructure to crash early on.
215 EFI_RUNTIME_SERVICES
*gDxeCoreRT
= &mEfiRuntimeServicesTableTemplate
;
216 EFI_HANDLE gDxeCoreImageHandle
= NULL
;
221 // EFI Decompress Protocol
223 EFI_DECOMPRESS_PROTOCOL gEfiDecompress
= {
224 DxeMainUefiDecompressGetInfo
,
225 DxeMainUefiDecompress
229 // Main entry point to the DXE Core
240 Main entry point to DXE Core.
244 HobStart - Pointer to the beginning of the HOB List from PEI
248 This function should never return
253 EFI_PHYSICAL_ADDRESS MemoryBaseAddress
;
256 mHobStart
= HobStart
;
259 // Initialize Memory Services
261 CoreInitializeMemoryServices (&HobStart
, &MemoryBaseAddress
, &MemoryLength
);
264 // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData
265 // Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table
267 gDxeCoreST
= CoreAllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE
), &mEfiSystemTableTemplate
);
268 ASSERT (gDxeCoreST
!= NULL
);
270 gDxeCoreRT
= CoreAllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES
), &mEfiRuntimeServicesTableTemplate
);
271 ASSERT (gDxeCoreRT
!= NULL
);
273 gDxeCoreST
->RuntimeServices
= gDxeCoreRT
;
276 // Start the Image Services.
278 Status
= CoreInitializeImageServices (HobStart
);
279 ASSERT_EFI_ERROR (Status
);
282 // Call constructor for all libraries
284 ProcessLibraryConstructorList (gDxeCoreImageHandle
, gDxeCoreST
);
285 PERF_END (0,PEI_TOK
, NULL
, 0) ;
286 PERF_START (0,DXE_TOK
, NULL
, 0) ;
289 // Initialize the Global Coherency Domain Services
291 Status
= CoreInitializeGcdServices (&HobStart
, MemoryBaseAddress
, MemoryLength
);
292 ASSERT_EFI_ERROR (Status
);
295 // The HobStart is relocated in gcd service init. Sync mHobStart varible.
297 mHobStart
= HobStart
;
299 // Install the DXE Services Table into the EFI System Tables's Configuration Table
301 Status
= CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid
, gDxeCoreDS
);
302 ASSERT_EFI_ERROR (Status
);
305 // Install the HOB List into the EFI System Tables's Configuration Table
307 Status
= CoreInstallConfigurationTable (&gEfiHobListGuid
, HobStart
);
308 ASSERT_EFI_ERROR (Status
);
311 // Install Memory Type Information Table into the EFI System Tables's Configuration Table
313 Status
= CoreInstallConfigurationTable (&gEfiMemoryTypeInformationGuid
, &gMemoryTypeInformation
);
314 ASSERT_EFI_ERROR (Status
);
317 // Initialize the ReportStatusCode with PEI version, if available
319 CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid
, (VOID
**)&gStatusCode
->ReportStatusCode
);
322 // Report Status Code here for DXE_ENTRY_POINT once it is available
324 CoreReportProgressCode (FixedPcdGet32(PcdStatusCodeValueDxeCoreEntry
));
327 // Create the aligned system table pointer structure that is used by external
328 // debuggers to locate the system table... Also, install debug image info
329 // configuration table.
331 CoreInitializeDebugImageInfoTable ();
332 CoreNewDebugImageInfoEntry (
333 EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL
,
338 DEBUG ((EFI_D_INFO
| EFI_D_LOAD
, "HOBLIST address in DXE = 0x%016lx\n", (UINT64
) (UINTN
) HobStart
));
341 // Initialize the Event Services
343 Status
= CoreInitializeEventServices ();
344 ASSERT_EFI_ERROR (Status
);
348 // Get the Protocols that were passed in from PEI to DXE through GUIDed HOBs
350 // These Protocols are not architectural. This implementation is sharing code between
351 // PEI and DXE in order to save FLASH space. These Protocols could also be implemented
352 // as part of the DXE Core. However, that would also require the DXE Core to be ported
353 // each time a different CPU is used, a different Decompression algorithm is used, or a
354 // different Image type is used. By placing these Protocols in PEI, the DXE Core remains
355 // generic, and only PEI and the Arch Protocols need to be ported from Platform to Platform,
356 // and from CPU to CPU.
360 // Publish the EFI, Tiano, and Custom Decompress protocols for use by other DXE components
362 Status
= CoreInstallMultipleProtocolInterfaces (
364 &gEfiDecompressProtocolGuid
, &gEfiDecompress
,
367 ASSERT_EFI_ERROR (Status
);
370 // Register for the GUIDs of the Architectural Protocols, so the rest of the
371 // EFI Boot Services and EFI Runtime Services tables can be filled in.
373 CoreNotifyOnArchProtocolInstallation ();
376 // Produce Firmware Volume Protocols, one for each FV in the HOB list.
378 Status
= FwVolBlockDriverInit (gDxeCoreImageHandle
, gDxeCoreST
);
379 ASSERT_EFI_ERROR (Status
);
381 Status
= FwVolDriverInit (gDxeCoreImageHandle
, gDxeCoreST
);
382 ASSERT_EFI_ERROR (Status
);
385 // Produce the Section Extraction Protocol
387 Status
= InitializeSectionExtraction (gDxeCoreImageHandle
, gDxeCoreST
);
388 ASSERT_EFI_ERROR (Status
);
391 // Initialize the DXE Dispatcher
393 PERF_START (0,"CoreInitializeDispatcher", "DxeMain", 0) ;
394 CoreInitializeDispatcher ();
395 PERF_END (0,"CoreInitializeDispatcher", "DxeMain", 0) ;
398 // Invoke the DXE Dispatcher
400 PERF_START (0, "CoreDispatcher", "DxeMain", 0);
402 PERF_END (0, "CoreDispatcher", "DxeMain", 0);
405 // Display Architectural protocols that were not loaded if this is DEBUG build
408 CoreDisplayMissingArchProtocols ();
412 // Assert if the Architectural Protocols are not present.
414 ASSERT_EFI_ERROR (CoreAllEfiServicesAvailable ());
417 // Report Status code before transfer control to BDS
419 CoreReportProgressCode (FixedPcdGet32 (PcdStatusCodeValueDxeCoreHandoffToBds
));
421 // Display any drivers that were not dispatched because dependency expression
422 // evaluated to false if this is a debug build
425 CoreDisplayDiscoveredNotDispatched ();
429 // Transfer control to the BDS Architectural Protocol
434 // BDS should never return
443 CoreEfiNotAvailableYetArg0 (
450 Place holder function until all the Boot Services and Runtime Services are available
458 EFI_NOT_AVAILABLE_YET
463 // This function should never be executed. If it does, then the architectural protocols
464 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
465 // DXE Core and all the Architectural Protocols are complete.
468 return EFI_NOT_AVAILABLE_YET
;
473 CoreEfiNotAvailableYetArg1 (
480 Place holder function until all the Boot Services and Runtime Services are available
488 EFI_NOT_AVAILABLE_YET
493 // This function should never be executed. If it does, then the architectural protocols
494 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
495 // DXE Core and all the Architectural Protocols are complete.
498 return EFI_NOT_AVAILABLE_YET
;
503 CoreEfiNotAvailableYetArg2 (
511 Place holder function until all the Boot Services and Runtime Services are available
521 EFI_NOT_AVAILABLE_YET
526 // This function should never be executed. If it does, then the architectural protocols
527 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
528 // DXE Core and all the Architectural Protocols are complete.
531 return EFI_NOT_AVAILABLE_YET
;
536 CoreEfiNotAvailableYetArg3 (
545 Place holder function until all the Boot Services and Runtime Services are available
557 EFI_NOT_AVAILABLE_YET
562 // This function should never be executed. If it does, then the architectural protocols
563 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
564 // DXE Core and all the Architectural Protocols are complete.
567 return EFI_NOT_AVAILABLE_YET
;
572 CoreEfiNotAvailableYetArg4 (
582 Place holder function until all the Boot Services and Runtime Services are available
596 EFI_NOT_AVAILABLE_YET
601 // This function should never be executed. If it does, then the architectural protocols
602 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
603 // DXE Core and all the Architectural Protocols are complete.
606 return EFI_NOT_AVAILABLE_YET
;
611 CoreEfiNotAvailableYetArg5 (
622 Place holder function until all the Boot Services and Runtime Services are available
638 EFI_NOT_AVAILABLE_YET
643 // This function should never be executed. If it does, then the architectural protocols
644 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
645 // DXE Core and all the Architectural Protocols are complete.
648 return EFI_NOT_AVAILABLE_YET
;
654 IN EFI_GUID
*ProtocolGuid
,
661 Searches for a Protocol Interface passed from PEI through a HOB
665 ProtocolGuid - The Protocol GUID to search for in the HOB List
667 Interface - A pointer to the interface for the Protocol GUID
671 EFI_SUCCESS - The Protocol GUID was found and its interface is returned in Interface
673 EFI_NOT_FOUND - The Protocol GUID was not found in the HOB List
677 EFI_HOB_GUID_TYPE
*GuidHob
;
680 GuidHob
= GetNextGuidHob (ProtocolGuid
, mHobStart
);
681 if (GuidHob
== NULL
) {
682 return EFI_NOT_FOUND
;
685 Buffer
= GET_GUID_HOB_DATA (GuidHob
);
686 ASSERT (Buffer
!= NULL
);
688 *Interface
= (VOID
*)(*(UINTN
*)(Buffer
));
696 IN OUT EFI_TABLE_HEADER
*Hdr
702 Calcualte the 32-bit CRC in a EFI table using the service provided by the
707 Hdr - Pointer to an EFI standard header
720 // If gDxeCoreBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then
721 // Crc will come back as zero if we set it to zero here
724 gDxeCoreBS
->CalculateCrc32 ((UINT8
*)Hdr
, Hdr
->HeaderSize
, &Crc
);
732 CoreExitBootServices (
733 IN EFI_HANDLE ImageHandle
,
740 Terminates all boot services.
744 ImageHandle - Handle that identifies the exiting image.
746 MapKey -Key to the latest memory map.
750 EFI_SUCCESS - Boot Services terminated
751 EFI_INVALID_PARAMETER - MapKey is incorrect.
756 EFI_STATUS StatusTemp
;
757 EFI_TCG_PLATFORM_PROTOCOL
*TcgPlatformProtocol
;
760 // Measure invocation of ExitBootServices,
761 // which is defined by TCG_EFI_Platform_1_20_Final Specification
763 TcgPlatformProtocol
= NULL
;
764 Status
= CoreLocateProtocol (
765 &gEfiTcgPlatformProtocolGuid
,
767 (VOID
**) &TcgPlatformProtocol
769 if (!EFI_ERROR (Status
)) {
770 Status
= TcgPlatformProtocol
->MeasureAction (EFI_EXIT_BOOT_SERVICES_INVOCATION
);
771 ASSERT_EFI_ERROR (Status
);
775 // Terminate memory services if the MapKey matches
777 Status
= CoreTerminateMemoryMap (MapKey
);
778 if (EFI_ERROR (Status
)) {
780 // Measure failure of ExitBootServices
782 if (TcgPlatformProtocol
!= NULL
) {
783 StatusTemp
= TcgPlatformProtocol
->MeasureAction (EFI_EXIT_BOOT_SERVICES_FAILED
);
784 ASSERT_EFI_ERROR (StatusTemp
);
791 // Notify other drivers that we are exiting boot services.
793 CoreNotifySignalList (&gEfiEventExitBootServicesGuid
);
798 gTimer
->SetTimerPeriod (gTimer
, 0);
801 // Disable CPU Interrupts
803 gCpu
->DisableInterrupt (gCpu
);
806 // Report that ExitBootServices() has been called
808 // We are using gEfiCallerIdGuid as the caller ID for Dxe Core
810 CoreReportProgressCode (FixedPcdGet32 (PcdStatusCodeValueBootServiceExit
));
813 // Clear the non-runtime values of the EFI System Table
815 gDxeCoreST
->BootServices
= NULL
;
816 gDxeCoreST
->ConIn
= NULL
;
817 gDxeCoreST
->ConsoleInHandle
= NULL
;
818 gDxeCoreST
->ConOut
= NULL
;
819 gDxeCoreST
->ConsoleOutHandle
= NULL
;
820 gDxeCoreST
->StdErr
= NULL
;
821 gDxeCoreST
->StandardErrorHandle
= NULL
;
824 // Recompute the 32-bit CRC of the EFI System Table
826 CalculateEfiHdrCrc (&gDxeCoreST
->Hdr
);
829 // Zero out the Boot Service Table
831 SetMem (gDxeCoreBS
, sizeof (EFI_BOOT_SERVICES
), 0);
835 // Update the AtRuntime field in Runtiem AP.
837 gRuntime
->AtRuntime
= TRUE
;
840 // Measure success of ExitBootServices
842 if (TcgPlatformProtocol
!= NULL
) {
843 StatusTemp
= TcgPlatformProtocol
->MeasureAction (EFI_EXIT_BOOT_SERVICES_SUCCEEDED
);
844 ASSERT_EFI_ERROR (StatusTemp
);
851 DxeMainUefiDecompressGetInfo (
852 IN EFI_DECOMPRESS_PROTOCOL
*This
,
854 IN UINT32 SourceSize
,
855 OUT UINT32
*DestinationSize
,
856 OUT UINT32
*ScratchSize
860 || DestinationSize
== NULL
861 || ScratchSize
== NULL
) {
862 return EFI_INVALID_PARAMETER
;
864 return UefiDecompressGetInfo (Source
, SourceSize
, DestinationSize
, ScratchSize
);
869 DxeMainUefiDecompress (
870 IN EFI_DECOMPRESS_PROTOCOL
*This
,
872 IN UINT32 SourceSize
,
873 IN OUT VOID
*Destination
,
874 IN UINT32 DestinationSize
,
875 IN OUT VOID
*Scratch
,
876 IN UINT32 ScratchSize
880 UINT32 TestDestinationSize
;
881 UINT32 TestScratchSize
;
884 || Destination
== NULL
885 || Scratch
== NULL
) {
886 return EFI_INVALID_PARAMETER
;
889 Status
= UefiDecompressGetInfo (Source
, SourceSize
, &TestDestinationSize
, &TestScratchSize
);
890 if (EFI_ERROR (Status
)) {
894 if (ScratchSize
< TestScratchSize
|| DestinationSize
< TestDestinationSize
) {
895 return RETURN_INVALID_PARAMETER
;
898 return UefiDecompress (Source
, Destination
, Scratch
);