3 Copyright (c) 2006 - 2007, 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
25 // DXE Core Global Variables for Protocols from PEI
27 EFI_HANDLE mDecompressHandle
= NULL
;
30 // DXE Core globals for Architecture Protocols
32 EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
= NULL
;
33 EFI_CPU_ARCH_PROTOCOL
*gCpu
= NULL
;
34 EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
= NULL
;
35 EFI_TIMER_ARCH_PROTOCOL
*gTimer
= NULL
;
36 EFI_BDS_ARCH_PROTOCOL
*gBds
= NULL
;
37 EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
= NULL
;
41 // BugBug: I'n not runtime, but is the PPI?
43 EFI_STATUS_CODE_PROTOCOL gStatusCodeInstance
= {
47 EFI_STATUS_CODE_PROTOCOL
*gStatusCode
= &gStatusCodeInstance
;
51 // DXE Core Global used to update core loaded image protocol handle
53 EFI_GUID
*gDxeCoreFileName
;
54 EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
59 // DXE Core Module Variables
62 EFI_BOOT_SERVICES mBootServices
= {
64 EFI_BOOT_SERVICES_SIGNATURE
, // Signature
65 EFI_BOOT_SERVICES_REVISION
, // Revision
66 sizeof (EFI_BOOT_SERVICES
), // HeaderSize
70 (EFI_RAISE_TPL
) CoreRaiseTpl
, // RaiseTPL
71 (EFI_RESTORE_TPL
) CoreRestoreTpl
, // RestoreTPL
72 (EFI_ALLOCATE_PAGES
) CoreAllocatePages
, // AllocatePages
73 (EFI_FREE_PAGES
) CoreFreePages
, // FreePages
74 (EFI_GET_MEMORY_MAP
) CoreGetMemoryMap
, // GetMemoryMap
75 (EFI_ALLOCATE_POOL
) CoreAllocatePool
, // AllocatePool
76 (EFI_FREE_POOL
) CoreFreePool
, // FreePool
77 (EFI_CREATE_EVENT
) CoreCreateEvent
, // CreateEvent
78 (EFI_SET_TIMER
) CoreSetTimer
, // SetTimer
79 (EFI_WAIT_FOR_EVENT
) CoreWaitForEvent
, // WaitForEvent
80 (EFI_SIGNAL_EVENT
) CoreSignalEvent
, // SignalEvent
81 (EFI_CLOSE_EVENT
) CoreCloseEvent
, // CloseEvent
82 (EFI_CHECK_EVENT
) CoreCheckEvent
, // CheckEvent
83 (EFI_INSTALL_PROTOCOL_INTERFACE
) CoreInstallProtocolInterface
, // InstallProtocolInterface
84 (EFI_REINSTALL_PROTOCOL_INTERFACE
) CoreReinstallProtocolInterface
, // ReinstallProtocolInterface
85 (EFI_UNINSTALL_PROTOCOL_INTERFACE
) CoreUninstallProtocolInterface
, // UninstallProtocolInterface
86 (EFI_HANDLE_PROTOCOL
) CoreHandleProtocol
, // HandleProtocol
87 (VOID
*) NULL
, // Reserved
88 (EFI_REGISTER_PROTOCOL_NOTIFY
) CoreRegisterProtocolNotify
, // RegisterProtocolNotify
89 (EFI_LOCATE_HANDLE
) CoreLocateHandle
, // LocateHandle
90 (EFI_LOCATE_DEVICE_PATH
) CoreLocateDevicePath
, // LocateDevicePath
91 (EFI_INSTALL_CONFIGURATION_TABLE
) CoreInstallConfigurationTable
, // InstallConfigurationTable
92 (EFI_IMAGE_LOAD
) CoreLoadImage
, // LoadImage
93 (EFI_IMAGE_START
) CoreStartImage
, // StartImage
94 (EFI_EXIT
) CoreExit
, // Exit
95 (EFI_IMAGE_UNLOAD
) CoreUnloadImage
, // UnloadImage
96 (EFI_EXIT_BOOT_SERVICES
) CoreExitBootServices
, // ExitBootServices
97 (EFI_GET_NEXT_MONOTONIC_COUNT
) CoreEfiNotAvailableYetArg1
, // GetNextMonotonicCount
98 (EFI_STALL
) CoreStall
, // Stall
99 (EFI_SET_WATCHDOG_TIMER
) CoreSetWatchdogTimer
, // SetWatchdogTimer
100 (EFI_CONNECT_CONTROLLER
) CoreConnectController
, // ConnectController
101 (EFI_DISCONNECT_CONTROLLER
) CoreDisconnectController
, // DisconnectController
102 (EFI_OPEN_PROTOCOL
) CoreOpenProtocol
, // OpenProtocol
103 (EFI_CLOSE_PROTOCOL
) CoreCloseProtocol
, // CloseProtocol
104 (EFI_OPEN_PROTOCOL_INFORMATION
) CoreOpenProtocolInformation
, // OpenProtocolInformation
105 (EFI_PROTOCOLS_PER_HANDLE
) CoreProtocolsPerHandle
, // ProtocolsPerHandle
106 (EFI_LOCATE_HANDLE_BUFFER
) CoreLocateHandleBuffer
, // LocateHandleBuffer
107 (EFI_LOCATE_PROTOCOL
) CoreLocateProtocol
, // LocateProtocol
108 (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES
) CoreInstallMultipleProtocolInterfaces
, // InstallMultipleProtocolInterfaces
109 (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES
) CoreUninstallMultipleProtocolInterfaces
, // UninstallMultipleProtocolInterfaces
110 (EFI_CALCULATE_CRC32
) CoreEfiNotAvailableYetArg3
, // CalculateCrc32
111 (EFI_COPY_MEM
) CopyMem
, // CopyMem
112 (EFI_SET_MEM
) SetMem
, // SetMem
113 (EFI_CREATE_EVENT_EX
) CoreCreateEventEx
// CreateEventEx
116 EFI_DXE_SERVICES mDxeServices
= {
118 DXE_SERVICES_SIGNATURE
, // Signature
119 DXE_SERVICES_REVISION
, // Revision
120 sizeof (DXE_SERVICES
), // HeaderSize
124 (EFI_ADD_MEMORY_SPACE
) CoreAddMemorySpace
, // AddMemorySpace
125 (EFI_ALLOCATE_MEMORY_SPACE
) CoreAllocateMemorySpace
, // AllocateMemorySpace
126 (EFI_FREE_MEMORY_SPACE
) CoreFreeMemorySpace
, // FreeMemorySpace
127 (EFI_REMOVE_MEMORY_SPACE
) CoreRemoveMemorySpace
, // RemoveMemorySpace
128 (EFI_GET_MEMORY_SPACE_DESCRIPTOR
) CoreGetMemorySpaceDescriptor
, // GetMemorySpaceDescriptor
129 (EFI_SET_MEMORY_SPACE_ATTRIBUTES
) CoreSetMemorySpaceAttributes
, // SetMemorySpaceAttributes
130 (EFI_GET_MEMORY_SPACE_MAP
) CoreGetMemorySpaceMap
, // GetMemorySpaceMap
131 (EFI_ADD_IO_SPACE
) CoreAddIoSpace
, // AddIoSpace
132 (EFI_ALLOCATE_IO_SPACE
) CoreAllocateIoSpace
, // AllocateIoSpace
133 (EFI_FREE_IO_SPACE
) CoreFreeIoSpace
, // FreeIoSpace
134 (EFI_REMOVE_IO_SPACE
) CoreRemoveIoSpace
, // RemoveIoSpace
135 (EFI_GET_IO_SPACE_DESCRIPTOR
) CoreGetIoSpaceDescriptor
, // GetIoSpaceDescriptor
136 (EFI_GET_IO_SPACE_MAP
) CoreGetIoSpaceMap
, // GetIoSpaceMap
137 (EFI_DISPATCH
) CoreDispatcher
, // Dispatch
138 (EFI_SCHEDULE
) CoreSchedule
, // Schedule
139 (EFI_TRUST
) CoreTrust
, // Trust
140 (EFI_PROCESS_FIRMWARE_VOLUME
) CoreProcessFirmwareVolume
, // ProcessFirmwareVolume
143 EFI_SYSTEM_TABLE mEfiSystemTableTemplate
= {
145 EFI_SYSTEM_TABLE_SIGNATURE
, // Signature
146 EFI_SYSTEM_TABLE_REVISION
, // Revision
147 sizeof (EFI_SYSTEM_TABLE
), // HeaderSize
151 NULL
, // FirmwareVendor
152 0, // FirmwareRevision
153 NULL
, // ConsoleInHandle
155 NULL
, // ConsoleOutHandle
157 NULL
, // StandardErrorHandle
159 NULL
, // RuntimeServices
160 &mBootServices
, // BootServices
161 0, // NumberOfConfigurationTableEntries
162 NULL
// ConfigurationTable
165 EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate
= {
167 EFI_RUNTIME_SERVICES_SIGNATURE
, // Signature
168 EFI_RUNTIME_SERVICES_REVISION
, // Revision
169 sizeof (EFI_RUNTIME_SERVICES
), // HeaderSize
173 (EFI_GET_TIME
) CoreEfiNotAvailableYetArg2
, // GetTime
174 (EFI_SET_TIME
) CoreEfiNotAvailableYetArg1
, // SetTime
175 (EFI_GET_WAKEUP_TIME
) CoreEfiNotAvailableYetArg3
, // GetWakeupTime
176 (EFI_SET_WAKEUP_TIME
) CoreEfiNotAvailableYetArg2
, // SetWakeupTime
177 (EFI_SET_VIRTUAL_ADDRESS_MAP
) CoreEfiNotAvailableYetArg4
, // SetVirtualAddressMap
178 (EFI_CONVERT_POINTER
) CoreEfiNotAvailableYetArg2
, // ConvertPointer
179 (EFI_GET_VARIABLE
) CoreEfiNotAvailableYetArg5
, // GetVariable
180 (EFI_GET_NEXT_VARIABLE_NAME
) CoreEfiNotAvailableYetArg3
, // GetNextVariableName
181 (EFI_SET_VARIABLE
) CoreEfiNotAvailableYetArg5
, // SetVariable
182 (EFI_GET_NEXT_HIGH_MONO_COUNT
) CoreEfiNotAvailableYetArg1
, // GetNextHighMonotonicCount
183 (EFI_RESET_SYSTEM
) CoreEfiNotAvailableYetArg4
, // ResetSystem
184 (EFI_UPDATE_CAPSULE
) CoreEfiNotAvailableYetArg3
, // UpdateCapsule
185 (EFI_QUERY_CAPSULE_CAPABILITIES
) CoreEfiNotAvailableYetArg4
, // QueryCapsuleCapabilities
186 (EFI_QUERY_VARIABLE_INFO
) CoreEfiNotAvailableYetArg4
// QueryVariableInfo
189 EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
= {
190 INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate
.ImageHead
),
191 INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate
.EventHead
),
194 // Make sure Size != sizeof (EFI_MEMORY_DESCRIPTOR). This will
195 // prevent people from having pointer math bugs in their code.
196 // now you have to use *DescriptorSize to make things work.
198 sizeof (EFI_MEMORY_DESCRIPTOR
) + sizeof (UINT64
) - (sizeof (EFI_MEMORY_DESCRIPTOR
) % sizeof (UINT64
)),
199 EFI_MEMORY_DESCRIPTOR_VERSION
,
207 EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
= &gRuntimeTemplate
;
210 // DXE Core Global Variables for the EFI System Table, Boot Services Table,
211 // DXE Services Table, and Runtime Services Table
213 EFI_BOOT_SERVICES
*gDxeCoreBS
= &mBootServices
;
214 EFI_DXE_SERVICES
*gDxeCoreDS
= &mDxeServices
;
215 EFI_SYSTEM_TABLE
*gDxeCoreST
= NULL
;
218 // For debug initialize gDxeCoreRT to template. gDxeCoreRT must be allocated from RT memory
219 // but gDxeCoreRT is used for ASSERT () and DEBUG () type macros so lets give it
220 // a value that will not cause debug infrastructure to crash early on.
222 EFI_RUNTIME_SERVICES
*gDxeCoreRT
= &mEfiRuntimeServicesTableTemplate
;
223 EFI_HANDLE gDxeCoreImageHandle
= NULL
;
228 // EFI Decompress Protocol
230 EFI_DECOMPRESS_PROTOCOL gEfiDecompress
= {
231 DxeMainUefiDecompressGetInfo
,
232 DxeMainUefiDecompress
236 // Main entry point to the DXE Core
247 Main entry point to DXE Core.
251 HobStart - Pointer to the beginning of the HOB List from PEI
255 This function should never return
260 EFI_PHYSICAL_ADDRESS MemoryBaseAddress
;
263 mHobStart
= HobStart
;
266 // Initialize Memory Services
268 CoreInitializeMemoryServices (&HobStart
, &MemoryBaseAddress
, &MemoryLength
);
271 // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData
272 // Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table
274 gDxeCoreST
= CoreAllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE
), &mEfiSystemTableTemplate
);
275 ASSERT (gDxeCoreST
!= NULL
);
277 gDxeCoreRT
= CoreAllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES
), &mEfiRuntimeServicesTableTemplate
);
278 ASSERT (gDxeCoreRT
!= NULL
);
280 gDxeCoreST
->RuntimeServices
= gDxeCoreRT
;
283 // Start the Image Services.
285 Status
= CoreInitializeImageServices (HobStart
);
286 ASSERT_EFI_ERROR (Status
);
289 // Call constructor for all libraries
291 ProcessLibraryConstructorList (gDxeCoreImageHandle
, gDxeCoreST
);
292 PERF_END (0,PEI_TOK
, NULL
, 0) ;
293 PERF_START (0,DXE_TOK
, NULL
, 0) ;
296 // Initialize the Global Coherency Domain Services
298 Status
= CoreInitializeGcdServices (&HobStart
, MemoryBaseAddress
, MemoryLength
);
299 ASSERT_EFI_ERROR (Status
);
302 // The HobStart is relocated in gcd service init. Sync mHobStart varible.
304 mHobStart
= HobStart
;
306 // Install the DXE Services Table into the EFI System Tables's Configuration Table
308 Status
= CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid
, gDxeCoreDS
);
309 ASSERT_EFI_ERROR (Status
);
312 // Install the HOB List into the EFI System Tables's Configuration Table
314 Status
= CoreInstallConfigurationTable (&gEfiHobListGuid
, HobStart
);
315 ASSERT_EFI_ERROR (Status
);
318 // Install Memory Type Information Table into the EFI System Tables's Configuration Table
320 Status
= CoreInstallConfigurationTable (&gEfiMemoryTypeInformationGuid
, &gMemoryTypeInformation
);
321 ASSERT_EFI_ERROR (Status
);
324 // Initialize the ReportStatusCode with PEI version, if available
326 CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid
, (VOID
**)&gStatusCode
->ReportStatusCode
);
329 // Report Status Code here for DXE_ENTRY_POINT once it is available
331 CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE
| EFI_SW_DXE_CORE_PC_ENTRY_POINT
));
334 // Create the aligned system table pointer structure that is used by external
335 // debuggers to locate the system table... Also, install debug image info
336 // configuration table.
338 CoreInitializeDebugImageInfoTable ();
339 CoreNewDebugImageInfoEntry (
340 EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL
,
345 DEBUG ((EFI_D_INFO
| EFI_D_LOAD
, "HOBLIST address in DXE = 0x%016lx\n", (UINT64
) (UINTN
) HobStart
));
348 // Initialize the Event Services
350 Status
= CoreInitializeEventServices ();
351 ASSERT_EFI_ERROR (Status
);
355 // Get the Protocols that were passed in from PEI to DXE through GUIDed HOBs
357 // These Protocols are not architectural. This implementation is sharing code between
358 // PEI and DXE in order to save FLASH space. These Protocols could also be implemented
359 // as part of the DXE Core. However, that would also require the DXE Core to be ported
360 // each time a different CPU is used, a different Decompression algorithm is used, or a
361 // different Image type is used. By placing these Protocols in PEI, the DXE Core remains
362 // generic, and only PEI and the Arch Protocols need to be ported from Platform to Platform,
363 // and from CPU to CPU.
367 // Publish the EFI, Tiano, and Custom Decompress protocols for use by other DXE components
369 Status
= CoreInstallMultipleProtocolInterfaces (
371 &gEfiDecompressProtocolGuid
, &gEfiDecompress
,
374 ASSERT_EFI_ERROR (Status
);
377 // Register for the GUIDs of the Architectural Protocols, so the rest of the
378 // EFI Boot Services and EFI Runtime Services tables can be filled in.
380 CoreNotifyOnArchProtocolInstallation ();
383 // Produce Firmware Volume Protocols, one for each FV in the HOB list.
385 Status
= FwVolBlockDriverInit (gDxeCoreImageHandle
, gDxeCoreST
);
386 ASSERT_EFI_ERROR (Status
);
388 Status
= FwVolDriverInit (gDxeCoreImageHandle
, gDxeCoreST
);
389 ASSERT_EFI_ERROR (Status
);
392 // Produce the Section Extraction Protocol
394 Status
= InitializeSectionExtraction (gDxeCoreImageHandle
, gDxeCoreST
);
395 ASSERT_EFI_ERROR (Status
);
398 // Initialize the DXE Dispatcher
400 PERF_START (0,"CoreInitializeDispatcher", "DxeMain", 0) ;
401 CoreInitializeDispatcher ();
402 PERF_END (0,"CoreInitializeDispatcher", "DxeMain", 0) ;
405 // Invoke the DXE Dispatcher
407 PERF_START (0, "CoreDispatcher", "DxeMain", 0);
409 PERF_END (0, "CoreDispatcher", "DxeMain", 0);
412 // Display Architectural protocols that were not loaded if this is DEBUG build
415 CoreDisplayMissingArchProtocols ();
419 // Assert if the Architectural Protocols are not present.
421 ASSERT_EFI_ERROR (CoreAllEfiServicesAvailable ());
424 // Report Status code before transfer control to BDS
426 CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE
| EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT
));
428 // Display any drivers that were not dispatched because dependency expression
429 // evaluated to false if this is a debug build
432 CoreDisplayDiscoveredNotDispatched ();
436 // Transfer control to the BDS Architectural Protocol
441 // BDS should never return
450 CoreEfiNotAvailableYetArg0 (
457 Place holder function until all the Boot Services and Runtime Services are available
465 EFI_NOT_AVAILABLE_YET
470 // This function should never be executed. If it does, then the architectural protocols
471 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
472 // DXE Core and all the Architectural Protocols are complete.
475 return EFI_NOT_AVAILABLE_YET
;
480 CoreEfiNotAvailableYetArg1 (
487 Place holder function until all the Boot Services and Runtime Services are available
495 EFI_NOT_AVAILABLE_YET
500 // This function should never be executed. If it does, then the architectural protocols
501 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
502 // DXE Core and all the Architectural Protocols are complete.
505 return EFI_NOT_AVAILABLE_YET
;
510 CoreEfiNotAvailableYetArg2 (
518 Place holder function until all the Boot Services and Runtime Services are available
528 EFI_NOT_AVAILABLE_YET
533 // This function should never be executed. If it does, then the architectural protocols
534 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
535 // DXE Core and all the Architectural Protocols are complete.
538 return EFI_NOT_AVAILABLE_YET
;
543 CoreEfiNotAvailableYetArg3 (
552 Place holder function until all the Boot Services and Runtime Services are available
564 EFI_NOT_AVAILABLE_YET
569 // This function should never be executed. If it does, then the architectural protocols
570 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
571 // DXE Core and all the Architectural Protocols are complete.
574 return EFI_NOT_AVAILABLE_YET
;
579 CoreEfiNotAvailableYetArg4 (
589 Place holder function until all the Boot Services and Runtime Services are available
603 EFI_NOT_AVAILABLE_YET
608 // This function should never be executed. If it does, then the architectural protocols
609 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
610 // DXE Core and all the Architectural Protocols are complete.
613 return EFI_NOT_AVAILABLE_YET
;
618 CoreEfiNotAvailableYetArg5 (
629 Place holder function until all the Boot Services and Runtime Services are available
645 EFI_NOT_AVAILABLE_YET
650 // This function should never be executed. If it does, then the architectural protocols
651 // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
652 // DXE Core and all the Architectural Protocols are complete.
655 return EFI_NOT_AVAILABLE_YET
;
661 IN EFI_GUID
*ProtocolGuid
,
668 Searches for a Protocol Interface passed from PEI through a HOB
672 ProtocolGuid - The Protocol GUID to search for in the HOB List
674 Interface - A pointer to the interface for the Protocol GUID
678 EFI_SUCCESS - The Protocol GUID was found and its interface is returned in Interface
680 EFI_NOT_FOUND - The Protocol GUID was not found in the HOB List
684 EFI_HOB_GUID_TYPE
*GuidHob
;
687 GuidHob
= GetNextGuidHob (ProtocolGuid
, mHobStart
);
688 if (GuidHob
== NULL
) {
689 return EFI_NOT_FOUND
;
692 Buffer
= GET_GUID_HOB_DATA (GuidHob
);
693 ASSERT (Buffer
!= NULL
);
695 *Interface
= (VOID
*)(*(UINTN
*)(Buffer
));
703 IN OUT EFI_TABLE_HEADER
*Hdr
709 Calcualte the 32-bit CRC in a EFI table using the service provided by the
714 Hdr - Pointer to an EFI standard header
727 // If gDxeCoreBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then
728 // Crc will come back as zero if we set it to zero here
731 gDxeCoreBS
->CalculateCrc32 ((UINT8
*)Hdr
, Hdr
->HeaderSize
, &Crc
);
739 CoreExitBootServices (
740 IN EFI_HANDLE ImageHandle
,
747 Terminates all boot services.
751 ImageHandle - Handle that identifies the exiting image.
753 MapKey -Key to the latest memory map.
757 EFI_SUCCESS - Boot Services terminated
758 EFI_INVALID_PARAMETER - MapKey is incorrect.
765 // Terminate memory services if the MapKey matches
767 Status
= CoreTerminateMemoryMap (MapKey
);
768 if (EFI_ERROR (Status
)) {
773 // Notify other drivers that we are exiting boot services.
775 CoreNotifySignalList (&gEfiEventExitBootServicesGuid
);
780 gTimer
->SetTimerPeriod (gTimer
, 0);
783 // Disable CPU Interrupts
785 gCpu
->DisableInterrupt (gCpu
);
788 // Report that ExitBootServices() has been called
790 // We are using gEfiCallerIdGuid as the caller ID for Dxe Core
792 CoreReportProgressCode ((EFI_SOFTWARE_EFI_BOOT_SERVICE
| EFI_SW_BS_PC_EXIT_BOOT_SERVICES
));
795 // Clear the non-runtime values of the EFI System Table
797 gDxeCoreST
->BootServices
= NULL
;
798 gDxeCoreST
->ConIn
= NULL
;
799 gDxeCoreST
->ConsoleInHandle
= NULL
;
800 gDxeCoreST
->ConOut
= NULL
;
801 gDxeCoreST
->ConsoleOutHandle
= NULL
;
802 gDxeCoreST
->StdErr
= NULL
;
803 gDxeCoreST
->StandardErrorHandle
= NULL
;
806 // Recompute the 32-bit CRC of the EFI System Table
808 CalculateEfiHdrCrc (&gDxeCoreST
->Hdr
);
811 // Zero out the Boot Service Table
813 SetMem (gDxeCoreBS
, sizeof (EFI_BOOT_SERVICES
), 0);
817 // Update the AtRuntime field in Runtiem AP.
819 gRuntime
->AtRuntime
= TRUE
;
825 DxeMainUefiDecompressGetInfo (
826 IN EFI_DECOMPRESS_PROTOCOL
*This
,
828 IN UINT32 SourceSize
,
829 OUT UINT32
*DestinationSize
,
830 OUT UINT32
*ScratchSize
834 || DestinationSize
== NULL
835 || ScratchSize
== NULL
) {
836 return EFI_INVALID_PARAMETER
;
838 return UefiDecompressGetInfo (Source
, SourceSize
, DestinationSize
, ScratchSize
);
843 DxeMainUefiDecompress (
844 IN EFI_DECOMPRESS_PROTOCOL
*This
,
846 IN UINT32 SourceSize
,
847 IN OUT VOID
*Destination
,
848 IN UINT32 DestinationSize
,
849 IN OUT VOID
*Scratch
,
850 IN UINT32 ScratchSize
854 UINT32 TestDestinationSize
;
855 UINT32 TestScratchSize
;
858 || Destination
== NULL
859 || Scratch
== NULL
) {
860 return EFI_INVALID_PARAMETER
;
863 Status
= UefiDecompressGetInfo (Source
, SourceSize
, &TestDestinationSize
, &TestScratchSize
);
864 if (EFI_ERROR (Status
)) {
868 if (ScratchSize
< TestScratchSize
|| DestinationSize
< TestDestinationSize
) {
869 return RETURN_INVALID_PARAMETER
;
872 return UefiDecompress (Source
, Destination
, Scratch
);