X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FCore%2FDxe%2FDxeMain.h;h=e7ec3c856175928f40380d40f68bd51ef2eae9be;hp=6622a1d95ede47739623a5e9d2d806894b500c05;hb=0677cc4925d580f7016ac092dc591be0ebe03495;hpb=443109389ddd57137f367f7b310685be9ad2b22b diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index 6622a1d95e..e7ec3c8561 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -2,8 +2,8 @@ The internal header file includes the common header files, defines internal structure and functions used by DxeCore module. -Copyright (c) 2006 - 2008, Intel Corporation.
-All rights reserved. This program and the accompanying materials +Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -25,6 +25,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include #include @@ -39,7 +40,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include #include @@ -48,9 +48,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include -#include +#include +#include #include #include #include @@ -61,7 +61,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include - +#include #include #include @@ -74,24 +74,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include +#include #include #include +#include +#include +#include +#include +#include +#include -#include "DebugImageInfo.h" -#include "Library.h" -#include "FwVolBlock.h" -#include "FwVolDriver.h" -#include "Gcd.h" -#include "Imem.h" -#include "Image.h" -#include "Exec.h" -#include "Hand.h" - - -// -// Modifier for EFI DXE Services -// -#define EFI_DXESERVICE // // attributes for reserved memory before it is promoted to system memory @@ -109,7 +102,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /// /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression /// to save time. A EFI_DEP_PUSH is evauated one an -/// replaced with EFI_DEP_REPLACE_TRUE +/// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2 +/// Driver Execution Environment Core Interface use 0xff +/// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be +/// defined to a new value that is not conflicting with PI spec. /// #define EFI_DEP_REPLACE_TRUE 0xff @@ -124,21 +120,13 @@ typedef struct { EFI_EVENT Event; VOID *Registration; BOOLEAN Present; -} ARCHITECTURAL_PROTOCOL_ENTRY; - -typedef struct { - EFI_STATUS_CODE_DATA DataHeader; - EFI_HANDLE Handle; -} EFI_DXE_DEVICE_HANDLE_EXTENDED_DATA; - -#define EFI_STATUS_CODE_DXE_CORE_GUID \ - { 0x335984bd, 0xe805, 0x409a, { 0xb8, 0xf8, 0xd2, 0x7e, 0xce, 0x5f, 0xf7, 0xa6 } } +} EFI_CORE_PROTOCOL_NOTIFY_ENTRY; // // DXE Dispatcher Data structures // -#define KNOWN_HANDLE_SIGNATURE EFI_SIGNATURE_32('k','n','o','w') +#define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w') typedef struct { UINTN Signature; LIST_ENTRY Link; // mFvHandleList @@ -146,7 +134,7 @@ typedef struct { } KNOWN_HANDLE; -#define EFI_CORE_DRIVER_ENTRY_SIGNATURE EFI_SIGNATURE_32('d','r','v','r') +#define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r') typedef struct { UINTN Signature; LIST_ENTRY Link; // mDriverList @@ -179,7 +167,7 @@ typedef struct { // //The data structure of GCD memory map entry // -#define EFI_GCD_MAP_SIGNATURE EFI_SIGNATURE_32('g','c','d','m') +#define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m') typedef struct { UINTN Signature; LIST_ENTRY Link; @@ -197,7 +185,6 @@ typedef struct { // DXE Core Global Variables // extern EFI_SYSTEM_TABLE *gDxeCoreST; -extern EFI_BOOT_SERVICES *gDxeCoreBS; extern EFI_RUNTIME_SERVICES *gDxeCoreRT; extern EFI_DXE_SERVICES *gDxeCoreDS; extern EFI_HANDLE gDxeCoreImageHandle; @@ -211,7 +198,7 @@ extern EFI_METRONOME_ARCH_PROTOCOL *gMetronome; extern EFI_TIMER_ARCH_PROTOCOL *gTimer; extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity; extern EFI_BDS_ARCH_PROTOCOL *gBds; -extern EFI_STATUS_CODE_PROTOCOL *gStatusCode; +extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2; extern EFI_TPL gEfiCurrentTpl; @@ -223,6 +210,8 @@ extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMem extern BOOLEAN gDispatcherRunning; extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate; +extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable; +extern BOOLEAN gLoadFixedAddressCodeMemoryReady; // // Service Initialization Functions // @@ -284,12 +273,11 @@ CoreAcquireGcdMemoryLock ( /** - External function. Initializes the GCD and memory services based on the memory - descriptor HOBs. This function is responsible for priming the GCD map and the - memory map, so memory allocations and resource allocations can be made. The first - part of this function can not depend on any memory services until at least one - memory descriptor is provided to the memory services. Then the memory services - can be used to intialize the GCD map. + External function. Initializes memory services based on the memory + descriptor HOBs. This function is responsible for priming the memory + map, so memory allocations and resource allocations can be made. + The first part of this function can not depend on any memory services + until at least one memory descriptor is provided to the memory services. @param HobStart The start address of the HOB. @param MemoryBaseAddress Start address of memory region found to init DXE @@ -311,11 +299,8 @@ CoreInitializeMemoryServices ( /** External function. Initializes the GCD and memory services based on the memory descriptor HOBs. This function is responsible for priming the GCD map and the - memory map, so memory allocations and resource allocations can be made. The first - part of this function can not depend on any memory services until at least one - memory descriptor is provided to the memory services. Then the memory services - can be used to intialize the GCD map. The HobStart will be relocated to a pool - buffer. + memory map, so memory allocations and resource allocations can be made. The + HobStart will be relocated to a pool buffer. @param HobStart The start address of the HOB @param MemoryBaseAddress Start address of memory region found to init DXE @@ -334,7 +319,7 @@ CoreInitializeGcdServices ( /** - Initializes "event" support and populates parts of the System and Runtime Table. + Initializes "event" support. @retval EFI_SUCCESS Always return success @@ -365,7 +350,7 @@ CoreInitializeImageServices ( **/ VOID -CoreNotifyOnArchProtocolInstallation ( +CoreNotifyOnProtocolInstallation ( VOID ); @@ -930,6 +915,20 @@ CoreRegisterProtocolNotify ( ); +/** + Removes all the events in the protocol database that match Event. + + @param Event The event to search for in the protocol + database. + + @return EFI_SUCCESS when done searching the entire database. + +**/ +EFI_STATUS +CoreUnregisterProtocolNotify ( + IN EFI_EVENT Event + ); + /** Locates the requested handle(s) and returns them in Buffer. @@ -1022,8 +1021,8 @@ CoreLocateHandleBuffer ( /** Return the first Protocol Interface that matches the Protocol GUID. If - Registration is pasased in return a Protocol Instance that was just add - to the system. If Retistration is NULL return the first Protocol Interface + Registration is passed in, return a Protocol Instance that was just add + to the system. If Registration is NULL return the first Protocol Interface you find. @param Protocol The protocol to search for @@ -1299,6 +1298,14 @@ CoreFreePool ( protocol for loading the file. @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient resources. + @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not + understood. + @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error. + @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the + image from being loaded. NULL is returned in *ImageHandle. + @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a + valid EFI_LOADED_IMAGE_PROTOCOL. However, the current + platform policy specifies that the image should not be started. **/ EFI_STATUS @@ -1340,7 +1347,7 @@ CoreUnloadImage ( @param ImageHandle Handle of image to be started. @param ExitDataSize Pointer of the size to ExitData @param ExitData Pointer to a pointer to a data buffer that - includes a Null-terminated Unicode string, + includes a Null-terminated string, optionally followed by additional binary data. The string is a description that the caller may use to further indicate the reason for the @@ -1572,6 +1579,7 @@ CoreCheckEvent ( **/ EFI_STATUS +EFIAPI CoreAddMemorySpace ( IN EFI_GCD_MEMORY_TYPE GcdMemoryType, IN EFI_PHYSICAL_ADDRESS BaseAddress, @@ -1598,6 +1606,7 @@ CoreAddMemorySpace ( **/ EFI_STATUS +EFIAPI CoreAllocateMemorySpace ( IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType, IN EFI_GCD_MEMORY_TYPE GcdMemoryType, @@ -1620,6 +1629,7 @@ CoreAllocateMemorySpace ( **/ EFI_STATUS +EFIAPI CoreFreeMemorySpace ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length @@ -1637,6 +1647,7 @@ CoreFreeMemorySpace ( **/ EFI_STATUS +EFIAPI CoreRemoveMemorySpace ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length @@ -1654,6 +1665,7 @@ CoreRemoveMemorySpace ( **/ EFI_STATUS +EFIAPI CoreGetMemorySpaceDescriptor ( IN EFI_PHYSICAL_ADDRESS BaseAddress, OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor @@ -1673,6 +1685,7 @@ CoreGetMemorySpaceDescriptor ( **/ EFI_STATUS +EFIAPI CoreSetMemorySpaceAttributes ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, @@ -1693,6 +1706,7 @@ CoreSetMemorySpaceAttributes ( **/ EFI_STATUS +EFIAPI CoreGetMemorySpaceMap ( OUT UINTN *NumberOfDescriptors, OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap @@ -1711,6 +1725,7 @@ CoreGetMemorySpaceMap ( **/ EFI_STATUS +EFIAPI CoreAddIoSpace ( IN EFI_GCD_IO_TYPE GcdIoType, IN EFI_PHYSICAL_ADDRESS BaseAddress, @@ -1736,6 +1751,7 @@ CoreAddIoSpace ( **/ EFI_STATUS +EFIAPI CoreAllocateIoSpace ( IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType, IN EFI_GCD_IO_TYPE GcdIoType, @@ -1758,6 +1774,7 @@ CoreAllocateIoSpace ( **/ EFI_STATUS +EFIAPI CoreFreeIoSpace ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length @@ -1775,6 +1792,7 @@ CoreFreeIoSpace ( **/ EFI_STATUS +EFIAPI CoreRemoveIoSpace ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length @@ -1792,6 +1810,7 @@ CoreRemoveIoSpace ( **/ EFI_STATUS +EFIAPI CoreGetIoSpaceDescriptor ( IN EFI_PHYSICAL_ADDRESS BaseAddress, OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor @@ -1810,6 +1829,7 @@ CoreGetIoSpaceDescriptor ( **/ EFI_STATUS +EFIAPI CoreGetIoSpaceMap ( OUT UINTN *NumberOfDescriptors, OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap @@ -1878,29 +1898,6 @@ CoreTrust ( ); -/** - Helper function called as part of the code needed - to allocate the proper sized buffer for various - EFI interfaces. - - @param Status Current status - @param Buffer Current allocated buffer, or NULL - @param BufferSize Current buffer size needed - - @retval TRUE if the buffer was reallocated and the caller - should try the API again. - @retval FALSE buffer could not be allocated and the caller - should not try the API again. - -**/ -BOOLEAN -CoreGrowBuffer ( - IN OUT EFI_STATUS *Status, - IN OUT VOID **Buffer, - IN UINTN BufferSize - ); - - /** This routine is the driver initialization entry point. It initializes the libraries, and registers two notification functions. These notification @@ -1957,6 +1954,7 @@ InitializeSectionExtraction ( **/ EFI_STATUS +EFIAPI CoreProcessFirmwareVolume ( IN VOID *FvHeader, IN UINTN Size, @@ -2099,24 +2097,6 @@ CoreEfiNotAvailableYetArg5 ( ); -/** - Searches for a Protocol Interface passed from PEI through a HOB. - - @param ProtocolGuid The Protocol GUID to search for in the HOB List - @param Interface A pointer to the interface for the Protocol GUID - - @retval EFI_SUCCESS The Protocol GUID was found and its interface is - returned in Interface - @retval EFI_NOT_FOUND The Protocol GUID was not found in the HOB List - -**/ -EFI_STATUS -CoreGetPeiProtocol ( - IN EFI_GUID *ProtocolGuid, - IN VOID **Interface - ); - - /** Given a compressed source buffer, this function retrieves the size of the uncompressed buffer and the size of the scratch buffer required to decompress @@ -2325,4 +2305,157 @@ CloseSectionStream ( IN UINTN StreamHandleToClose ); +/** + Creates and initializes the DebugImageInfo Table. Also creates the configuration + table and registers it into the system table. + + Note: + This function allocates memory, frees it, and then allocates memory at an + address within the initial allocation. Since this function is called early + in DXE core initialization (before drivers are dispatched), this should not + be a problem. + +**/ +VOID +CoreInitializeDebugImageInfoTable ( + VOID + ); + + +/** + Update the CRC32 in the Debug Table. + Since the CRC32 service is made available by the Runtime driver, we have to + wait for the Runtime Driver to be installed before the CRC32 can be computed. + This function is called elsewhere by the core when the runtime architectural + protocol is produced. + +**/ +VOID +CoreUpdateDebugTableCrc32 ( + VOID + ); + + +/** + Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates + the table if it's not large enough to accomidate another entry. + + @param ImageInfoType type of debug image information + @param LoadedImage pointer to the loaded image protocol for the image being + loaded + @param ImageHandle image handle for the image being loaded + +**/ +VOID +CoreNewDebugImageInfoEntry ( + IN UINT32 ImageInfoType, + IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, + IN EFI_HANDLE ImageHandle + ); + + +/** + Removes and frees an entry from the DebugImageInfo Table. + + @param ImageHandle image handle for the image being unloaded + +**/ +VOID +CoreRemoveDebugImageInfoEntry ( + EFI_HANDLE ImageHandle + ); + + +/** + This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate. + + @param ImageHandle The image handle. + @param SystemTable The system table. + + @retval EFI_SUCCESS Successfully initialized firmware volume block + driver. + +**/ +EFI_STATUS +EFIAPI +FwVolBlockDriverInit ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); + + +/** + This routine produces a firmware volume block protocol on a given + buffer. + + @param BaseAddress base address of the firmware volume image + @param Length length of the firmware volume image + @param ParentHandle handle of parent firmware volume, if this image + came from an FV image file in another firmware + volume (ala capsules) + @param FvProtocol Firmware volume block protocol produced. + + @retval EFI_VOLUME_CORRUPTED Volume corrupted. + @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated. + @retval EFI_SUCCESS Successfully produced a FVB protocol on given + buffer. + +**/ +EFI_STATUS +ProduceFVBProtocolOnBuffer ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN EFI_HANDLE ParentHandle, + OUT EFI_HANDLE *FvProtocol OPTIONAL + ); + + +/** + Raising to the task priority level of the mutual exclusion + lock, and then acquires ownership of the lock. + + @param Lock The lock to acquire + + @return Lock owned + +**/ +VOID +CoreAcquireLock ( + IN EFI_LOCK *Lock + ); + + +/** + Initialize a basic mutual exclusion lock. Each lock + provides mutual exclusion access at it's task priority + level. Since there is no-premption (at any TPL) or + multiprocessor support, acquiring the lock only consists + of raising to the locks TPL. + + @param Lock The EFI_LOCK structure to initialize + + @retval EFI_SUCCESS Lock Owned. + @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned. + +**/ +EFI_STATUS +CoreAcquireLockOrFail ( + IN EFI_LOCK *Lock + ); + + +/** + Releases ownership of the mutual exclusion lock, and + restores the previous task priority level. + + @param Lock The lock to release + + @return Lock unowned + +**/ +VOID +CoreReleaseLock ( + IN EFI_LOCK *Lock + ); + #endif