#include <Protocol/StatusCode.h>\r
#include <Protocol/Decompress.h>\r
#include <Protocol/LoadPe32Image.h>\r
-#include <Protocol/FirmwareVolumeDispatch.h>\r
#include <Protocol/Security.h>\r
#include <Protocol/Ebc.h>\r
#include <Protocol/Reset.h>\r
#include <Protocol/FirmwareVolumeBlock.h>\r
#include <Protocol/Capsule.h>\r
#include <Protocol/BusSpecificDriverOverride.h>\r
-#include <Protocol/Performance.h>\r
#include <Protocol/TcgService.h>\r
-#include <Protocol/TcgPlatform.h>\r
#include <Guid/MemoryTypeInformation.h>\r
#include <Guid/FirmwareFileSystem2.h>\r
#include <Guid/HobList.h>\r
#include <Library/PeCoffLib.h>\r
#include <Library/PcdLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
+#include <Library/DevicePathLib.h>\r
#include <Library/UefiBootServicesTableLib.h>\r
-\r
-#include "DebugImageInfo.h"\r
-#include "Library.h"\r
-#include "FwVolBlock.h"\r
-#include "FwVolDriver.h"\r
-#include "Gcd.h"\r
-#include "Imem.h"\r
-#include "Image.h"\r
-#include "Exec.h"\r
-#include "Hand.h"\r
-\r
-\r
-//\r
-// Modifier for EFI DXE Services\r
-//\r
-#define EFI_DXESERVICE\r
+#include <Library/ReportStatusCodeLib.h>\r
+#include <Library/TimerLib.h>\r
\r
//\r
// attributes for reserved memory before it is promoted to system memory\r
///\r
/// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression\r
/// to save time. A EFI_DEP_PUSH is evauated one an\r
-/// replaced with EFI_DEP_REPLACE_TRUE\r
+/// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2\r
+/// Driver Execution Environment Core Interface use 0xff\r
+/// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be\r
+/// defined to a new value that is not conflicting with PI spec.\r
///\r
#define EFI_DEP_REPLACE_TRUE 0xff\r
\r
BOOLEAN Present;\r
} ARCHITECTURAL_PROTOCOL_ENTRY;\r
\r
-typedef struct {\r
- EFI_STATUS_CODE_DATA DataHeader;\r
- EFI_HANDLE Handle;\r
-} EFI_DXE_DEVICE_HANDLE_EXTENDED_DATA;\r
-\r
-#define EFI_STATUS_CODE_DXE_CORE_GUID \\r
- { 0x335984bd, 0xe805, 0x409a, { 0xb8, 0xf8, 0xd2, 0x7e, 0xce, 0x5f, 0xf7, 0xa6 } }\r
-\r
//\r
// DXE Dispatcher Data structures\r
//\r
\r
-#define KNOWN_HANDLE_SIGNATURE EFI_SIGNATURE_32('k','n','o','w')\r
+#define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')\r
typedef struct {\r
UINTN Signature;\r
LIST_ENTRY Link; // mFvHandleList\r
} KNOWN_HANDLE;\r
\r
\r
-#define EFI_CORE_DRIVER_ENTRY_SIGNATURE EFI_SIGNATURE_32('d','r','v','r')\r
+#define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')\r
typedef struct {\r
UINTN Signature;\r
LIST_ENTRY Link; // mDriverList\r
//\r
//The data structure of GCD memory map entry\r
//\r
-#define EFI_GCD_MAP_SIGNATURE EFI_SIGNATURE_32('g','c','d','m')\r
+#define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')\r
typedef struct {\r
UINTN Signature;\r
LIST_ENTRY Link;\r
extern EFI_TIMER_ARCH_PROTOCOL *gTimer;\r
extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity;\r
extern EFI_BDS_ARCH_PROTOCOL *gBds;\r
-extern EFI_STATUS_CODE_PROTOCOL *gStatusCode;\r
\r
extern EFI_TPL gEfiCurrentTpl;\r
\r
\r
\r
/**\r
- External function. Initializes the GCD and memory services based on the memory\r
- descriptor HOBs. This function is responsible for priming the GCD map and the\r
- memory map, so memory allocations and resource allocations can be made. The first\r
- part of this function can not depend on any memory services until at least one\r
- memory descriptor is provided to the memory services. Then the memory services\r
- can be used to intialize the GCD map.\r
+ External function. Initializes memory services based on the memory\r
+ descriptor HOBs. This function is responsible for priming the memory\r
+ map, so memory allocations and resource allocations can be made.\r
+ The first part of this function can not depend on any memory services\r
+ until at least one memory descriptor is provided to the memory services.\r
\r
@param HobStart The start address of the HOB.\r
@param MemoryBaseAddress Start address of memory region found to init DXE\r
/**\r
External function. Initializes the GCD and memory services based on the memory\r
descriptor HOBs. This function is responsible for priming the GCD map and the\r
- memory map, so memory allocations and resource allocations can be made. The first\r
- part of this function can not depend on any memory services until at least one\r
- memory descriptor is provided to the memory services. Then the memory services\r
- can be used to intialize the GCD map. The HobStart will be relocated to a pool\r
- buffer.\r
+ memory map, so memory allocations and resource allocations can be made. The\r
+ HobStart will be relocated to a pool buffer.\r
\r
@param HobStart The start address of the HOB\r
@param MemoryBaseAddress Start address of memory region found to init DXE\r
\r
\r
/**\r
- Initializes "event" support and populates parts of the System and Runtime Table.\r
+ Initializes "event" support.\r
\r
@retval EFI_SUCCESS Always return success\r
\r
);\r
\r
\r
+/**\r
+ Removes all the events in the protocol database that match Event.\r
+\r
+ @param Event The event to search for in the protocol\r
+ database.\r
+\r
+ @return EFI_SUCCESS when done searching the entire database.\r
+\r
+**/\r
+EFI_STATUS\r
+CoreUnregisterProtocolNotify (\r
+ IN EFI_EVENT Event\r
+ );\r
+\r
\r
/**\r
Locates the requested handle(s) and returns them in Buffer.\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreAddMemorySpace (\r
IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreAllocateMemorySpace (\r
IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreFreeMemorySpace (\r
IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
IN UINT64 Length\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreRemoveMemorySpace (\r
IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
IN UINT64 Length\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreGetMemorySpaceDescriptor (\r
IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreSetMemorySpaceAttributes (\r
IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
IN UINT64 Length,\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreGetMemorySpaceMap (\r
OUT UINTN *NumberOfDescriptors,\r
OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreAddIoSpace (\r
IN EFI_GCD_IO_TYPE GcdIoType,\r
IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreAllocateIoSpace (\r
IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
IN EFI_GCD_IO_TYPE GcdIoType,\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreFreeIoSpace (\r
IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
IN UINT64 Length\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreRemoveIoSpace (\r
IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
IN UINT64 Length\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreGetIoSpaceDescriptor (\r
IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreGetIoSpaceMap (\r
OUT UINTN *NumberOfDescriptors,\r
OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap\r
);\r
\r
\r
-/**\r
- Helper function called as part of the code needed\r
- to allocate the proper sized buffer for various\r
- EFI interfaces.\r
-\r
- @param Status Current status\r
- @param Buffer Current allocated buffer, or NULL\r
- @param BufferSize Current buffer size needed\r
-\r
- @retval TRUE if the buffer was reallocated and the caller\r
- should try the API again.\r
- @retval FALSE buffer could not be allocated and the caller\r
- should not try the API again.\r
-\r
-**/\r
-BOOLEAN\r
-CoreGrowBuffer (\r
- IN OUT EFI_STATUS *Status,\r
- IN OUT VOID **Buffer,\r
- IN UINTN BufferSize\r
- );\r
-\r
-\r
/**\r
This routine is the driver initialization entry point. It initializes the\r
libraries, and registers two notification functions. These notification\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
CoreProcessFirmwareVolume (\r
IN VOID *FvHeader,\r
IN UINTN Size,\r
);\r
\r
\r
-/**\r
- Searches for a Protocol Interface passed from PEI through a HOB.\r
-\r
- @param ProtocolGuid The Protocol GUID to search for in the HOB List\r
- @param Interface A pointer to the interface for the Protocol GUID\r
-\r
- @retval EFI_SUCCESS The Protocol GUID was found and its interface is\r
- returned in Interface\r
- @retval EFI_NOT_FOUND The Protocol GUID was not found in the HOB List\r
-\r
-**/\r
-EFI_STATUS\r
-CoreGetPeiProtocol (\r
- IN EFI_GUID *ProtocolGuid,\r
- IN VOID **Interface\r
- );\r
-\r
-\r
/**\r
Given a compressed source buffer, this function retrieves the size of the\r
uncompressed buffer and the size of the scratch buffer required to decompress\r
IN UINTN StreamHandleToClose\r
);\r
\r
+/**\r
+ Creates and initializes the DebugImageInfo Table. Also creates the configuration\r
+ table and registers it into the system table.\r
+\r
+ Note:\r
+ This function allocates memory, frees it, and then allocates memory at an\r
+ address within the initial allocation. Since this function is called early\r
+ in DXE core initialization (before drivers are dispatched), this should not\r
+ be a problem.\r
+\r
+**/\r
+VOID\r
+CoreInitializeDebugImageInfoTable (\r
+ VOID\r
+ );\r
+\r
+\r
+/**\r
+ Update the CRC32 in the Debug Table.\r
+ Since the CRC32 service is made available by the Runtime driver, we have to\r
+ wait for the Runtime Driver to be installed before the CRC32 can be computed.\r
+ This function is called elsewhere by the core when the runtime architectural\r
+ protocol is produced.\r
+\r
+**/\r
+VOID\r
+CoreUpdateDebugTableCrc32 (\r
+ VOID\r
+ );\r
+\r
+\r
+/**\r
+ Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates\r
+ the table if it's not large enough to accomidate another entry.\r
+\r
+ @param ImageInfoType type of debug image information\r
+ @param LoadedImage pointer to the loaded image protocol for the image being\r
+ loaded\r
+ @param ImageHandle image handle for the image being loaded\r
+\r
+**/\r
+VOID\r
+CoreNewDebugImageInfoEntry (\r
+ IN UINT32 ImageInfoType,\r
+ IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r
+ IN EFI_HANDLE ImageHandle\r
+ );\r
+\r
+\r
+/**\r
+ Removes and frees an entry from the DebugImageInfo Table.\r
+\r
+ @param ImageHandle image handle for the image being unloaded\r
+\r
+**/\r
+VOID\r
+CoreRemoveDebugImageInfoEntry (\r
+ EFI_HANDLE ImageHandle\r
+ );\r
+\r
+\r
+/**\r
+ This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\r
+\r
+ @param ImageHandle The image handle.\r
+ @param SystemTable The system table.\r
+\r
+ @retval EFI_SUCCESS Successfully initialized firmware volume block\r
+ driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FwVolBlockDriverInit (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+\r
+/**\r
+ This routine produces a firmware volume block protocol on a given\r
+ buffer.\r
+\r
+ @param BaseAddress base address of the firmware volume image\r
+ @param Length length of the firmware volume image\r
+ @param ParentHandle handle of parent firmware volume, if this image\r
+ came from an FV image file in another firmware\r
+ volume (ala capsules)\r
+ @param FvProtocol Firmware volume block protocol produced.\r
+\r
+ @retval EFI_VOLUME_CORRUPTED Volume corrupted.\r
+ @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.\r
+ @retval EFI_SUCCESS Successfully produced a FVB protocol on given\r
+ buffer.\r
+\r
+**/\r
+EFI_STATUS\r
+ProduceFVBProtocolOnBuffer (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN EFI_HANDLE ParentHandle,\r
+ OUT EFI_HANDLE *FvProtocol OPTIONAL\r
+ );\r
+\r
+\r
+/**\r
+ Raising to the task priority level of the mutual exclusion\r
+ lock, and then acquires ownership of the lock.\r
+\r
+ @param Lock The lock to acquire\r
+\r
+ @return Lock owned\r
+\r
+**/\r
+VOID\r
+CoreAcquireLock (\r
+ IN EFI_LOCK *Lock\r
+ );\r
+\r
+\r
+/**\r
+ Initialize a basic mutual exclusion lock. Each lock\r
+ provides mutual exclusion access at it's task priority\r
+ level. Since there is no-premption (at any TPL) or\r
+ multiprocessor support, acquiring the lock only consists\r
+ of raising to the locks TPL.\r
+\r
+ @param Lock The EFI_LOCK structure to initialize\r
+\r
+ @retval EFI_SUCCESS Lock Owned.\r
+ @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.\r
+\r
+**/\r
+EFI_STATUS\r
+CoreAcquireLockOrFail (\r
+ IN EFI_LOCK *Lock\r
+ );\r
+\r
+\r
+/**\r
+ Releases ownership of the mutual exclusion lock, and\r
+ restores the previous task priority level.\r
+\r
+ @param Lock The lock to release\r
+\r
+ @return Lock unowned\r
+\r
+**/\r
+VOID\r
+CoreReleaseLock (\r
+ IN EFI_LOCK *Lock\r
+ );\r
+\r
#endif\r