From ec90508b3d3ff22a698a0446cb09d551d7466045 Mon Sep 17 00:00:00 2001 From: eric_tian Date: Tue, 23 Sep 2008 07:35:34 +0000 Subject: [PATCH] move header files in MdeModulePkg\Core\Dxe except DxeMain.h into their corresponding sub-module directories. It is used to provide good modularity. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5949 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/DebugImageInfo.h | 84 --------- MdeModulePkg/Core/Dxe/DxeMain.h | 177 +++++++++++++++++- MdeModulePkg/Core/Dxe/DxeMain.inf | 16 +- MdeModulePkg/Core/Dxe/Event/Event.c | 1 + MdeModulePkg/Core/Dxe/{ => Event}/Event.h | 53 ++---- MdeModulePkg/Core/Dxe/Event/Timer.c | 1 + MdeModulePkg/Core/Dxe/Event/Tpl.c | 2 +- MdeModulePkg/Core/Dxe/FwVol/Ffs.c | 1 + MdeModulePkg/Core/Dxe/FwVol/FwVol.c | 6 +- MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c | 1 + .../Core/Dxe/{ => FwVol}/FwVolDriver.h | 11 -- MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c | 10 +- MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c | 2 +- MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c | 5 +- .../Core/Dxe/{ => FwVolBlock}/FwVolBlock.h | 69 +------ MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 1 + MdeModulePkg/Core/Dxe/{ => Gcd}/Gcd.h | 0 MdeModulePkg/Core/Dxe/Hand/DriverSupport.c | 1 + MdeModulePkg/Core/Dxe/Hand/Handle.c | 1 + MdeModulePkg/Core/Dxe/{ => Hand}/Handle.h | 111 ++++++----- MdeModulePkg/Core/Dxe/Hand/Locate.c | 1 + MdeModulePkg/Core/Dxe/Hand/Notify.c | 1 + MdeModulePkg/Core/Dxe/Image/Image.c | 3 +- MdeModulePkg/Core/Dxe/{ => Image}/Image.h | 98 ++++------ MdeModulePkg/Core/Dxe/Image/ImageFile.c | 1 + MdeModulePkg/Core/Dxe/Library.h | 68 ------- MdeModulePkg/Core/Dxe/{ => Mem}/Imem.h | 12 +- MdeModulePkg/Core/Dxe/Mem/Page.c | 1 + MdeModulePkg/Core/Dxe/Mem/Pool.c | 1 + MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c | 2 + 30 files changed, 322 insertions(+), 419 deletions(-) delete mode 100644 MdeModulePkg/Core/Dxe/DebugImageInfo.h rename MdeModulePkg/Core/Dxe/{ => Event}/Event.h (74%) rename MdeModulePkg/Core/Dxe/{ => FwVol}/FwVolDriver.h (96%) rename MdeModulePkg/Core/Dxe/{ => FwVolBlock}/FwVolBlock.h (78%) rename MdeModulePkg/Core/Dxe/{ => Gcd}/Gcd.h (100%) rename MdeModulePkg/Core/Dxe/{ => Hand}/Handle.h (71%) rename MdeModulePkg/Core/Dxe/{ => Image}/Image.h (75%) delete mode 100644 MdeModulePkg/Core/Dxe/Library.h rename MdeModulePkg/Core/Dxe/{ => Mem}/Imem.h (91%) diff --git a/MdeModulePkg/Core/Dxe/DebugImageInfo.h b/MdeModulePkg/Core/Dxe/DebugImageInfo.h deleted file mode 100644 index 317546b5ba..0000000000 --- a/MdeModulePkg/Core/Dxe/DebugImageInfo.h +++ /dev/null @@ -1,84 +0,0 @@ -/** @file - Support functions for managing debug image info table when loading and unloading - images. - -Copyright (c) 2006 - 2008, 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 - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __DEBUG_IMAGE_INFO_H__ -#define __DEBUG_IMAGE_INFO_H__ - -#define FOUR_MEG_ALIGNMENT 0x400000 - -#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *)) - - -/** - 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 - ); - -#endif diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h index 30fffb9f38..e46acf4147 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.h +++ b/MdeModulePkg/Core/Dxe/DxeMain.h @@ -80,16 +80,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include -#include "DebugImageInfo.h" -#include "Library.h" -#include "FwVolBlock.h" -#include "FwVolDriver.h" -#include "Gcd.h" -#include "Imem.h" -#include "Image.h" -#include "Event.h" -#include "Handle.h" - // // attributes for reserved memory before it is promoted to system memory // @@ -916,6 +906,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. @@ -2307,4 +2311,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 diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf index e6ba388bf4..5617880209 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain.inf +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf @@ -29,19 +29,11 @@ # VALID_ARCHITECTURES = IA32 X64 IPF [Sources.common] - Library.h - Imem.h - Image.h - Handle.h - Gcd.h - FwVolDriver.h - FwVolBlock.h - Event.h DxeMain.h - DebugImageInfo.h SectionExtraction/CoreSectionExtraction.c Image/ImageFile.c Image/Image.c + Image/Image.h Misc/DebugImageInfo.c Misc/Stall.c Misc/SetWatchdogTimer.c @@ -51,19 +43,25 @@ Hand/Notify.c Hand/Locate.c Hand/Handle.c + Hand/Handle.h Gcd/Gcd.c + Gcd/Gcd.h Mem/Pool.c Mem/Page.c Mem/MemData.c + Mem/Imem.h FwVolBlock/FwVolBlock.c + FwVolBlock/FwVolBlock.h FwVol/FwVolWrite.c FwVol/FwVolRead.c FwVol/FwVolAttrib.c FwVol/Ffs.c FwVol/FwVol.c + FwVol/FwVolDriver.h Event/Tpl.c Event/Timer.c Event/Event.c + Event/Event.h Dispatcher/Dependency.c Dispatcher/Dispatcher.c DxeMain/DxeProtocolNotify.c diff --git a/MdeModulePkg/Core/Dxe/Event/Event.c b/MdeModulePkg/Core/Dxe/Event/Event.c index 0e32aa4b66..204e9b3b70 100644 --- a/MdeModulePkg/Core/Dxe/Event/Event.c +++ b/MdeModulePkg/Core/Dxe/Event/Event.c @@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "DxeMain.h" +#include "Event.h" /// /// gEfiCurrentTpl - Current Task priority level diff --git a/MdeModulePkg/Core/Dxe/Event.h b/MdeModulePkg/Core/Dxe/Event/Event.h similarity index 74% rename from MdeModulePkg/Core/Dxe/Event.h rename to MdeModulePkg/Core/Dxe/Event/Event.h index 1709290a9f..f9384bc6cb 100644 --- a/MdeModulePkg/Core/Dxe/Event.h +++ b/MdeModulePkg/Core/Dxe/Event/Event.h @@ -15,7 +15,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #ifndef __EVENT_H__ #define __EVENT_H__ + #define VALID_TPL(a) ((a) <= TPL_HIGH_LEVEL) +extern UINTN gEventPending; + // // EFI_EVENT @@ -25,37 +28,30 @@ typedef struct { UINTN Signature; UINT32 Type; UINT32 SignalCount; - - // - // Entry if the event is registered to be signalled - // - + /// + /// Entry if the event is registered to be signalled + /// LIST_ENTRY SignalLink; - - // - // Notification information for this event - // - + /// + /// Notification information for this event + /// EFI_TPL NotifyTpl; EFI_EVENT_NOTIFY NotifyFunction; VOID *NotifyContext; EFI_GUID EventGroup; LIST_ENTRY NotifyLink; BOOLEAN ExFlag; - - // - // A list of all runtime events - // + /// + /// A list of all runtime events + /// EFI_RUNTIME_EVENT_ENTRY RuntimeData; - - // - // Information by event type - // - + /// + /// Information by event type + /// union { - // - // For timer events - // + /// + /// For timer events + /// struct { LIST_ENTRY Link; UINT64 TriggerTime; @@ -83,10 +79,6 @@ CoreDispatchEventNotifies ( ); - -// -// Exported functions -// /** Initializes timer support. @@ -96,13 +88,4 @@ CoreInitializeTimer ( VOID ); -// -// extern data declarations -// - -extern EFI_LOCK gEventQueueLock; -extern UINTN gEventPending; -extern LIST_ENTRY gEventQueue[]; -extern LIST_ENTRY gEventSignalQueue; - #endif diff --git a/MdeModulePkg/Core/Dxe/Event/Timer.c b/MdeModulePkg/Core/Dxe/Event/Timer.c index e1df72153d..eefd5a70c2 100644 --- a/MdeModulePkg/Core/Dxe/Event/Timer.c +++ b/MdeModulePkg/Core/Dxe/Event/Timer.c @@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "DxeMain.h" +#include "Event.h" // // Internal data diff --git a/MdeModulePkg/Core/Dxe/Event/Tpl.c b/MdeModulePkg/Core/Dxe/Event/Tpl.c index 43bc8add36..dd9c57e1d3 100644 --- a/MdeModulePkg/Core/Dxe/Event/Tpl.c +++ b/MdeModulePkg/Core/Dxe/Event/Tpl.c @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" - +#include "Event.h" /** Set Interrupt State. diff --git a/MdeModulePkg/Core/Dxe/FwVol/Ffs.c b/MdeModulePkg/Core/Dxe/FwVol/Ffs.c index 1c11dde036..3a50f9dd00 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/Ffs.c +++ b/MdeModulePkg/Core/Dxe/FwVol/Ffs.c @@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "DxeMain.h" +#include "FwVolDriver.h" /** diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c index 16d66fa0d4..9e26e4f020 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c @@ -15,8 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "FwVolDriver.h" -#define KEYSIZE sizeof (UINTN) // // Protocol notify related globals @@ -34,8 +34,8 @@ FV_DEVICE mFvDevice = { FvReadFile, FvReadFileSection, FvWriteFile, - FvGetNextFile, - KEYSIZE, + FvGetNextFile, + sizeof (UINTN), NULL, FvGetVolumeInfo, FvSetVolumeInfo diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c index 4c7dd99b57..f60af526e4 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "FwVolDriver.h" /** diff --git a/MdeModulePkg/Core/Dxe/FwVolDriver.h b/MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h similarity index 96% rename from MdeModulePkg/Core/Dxe/FwVolDriver.h rename to MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h index 5acbacc7c7..bb29cc4d44 100644 --- a/MdeModulePkg/Core/Dxe/FwVolDriver.h +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h @@ -313,17 +313,6 @@ FvSetVolumeInfo ( IN CONST VOID *Buffer ); -// -//Internal functions -// -typedef enum { - EfiCheckSumUint8 = 0, - EfiCheckSumUint16 = 1, - EfiCheckSumUint32 = 2, - EfiCheckSumUint64 = 3, - EfiCheckSumMaximum = 4 -} EFI_CHECKSUM_TYPE; - /** diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c index fbf6d0a1ba..e7cac455ff 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c @@ -13,10 +13,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "FwVolDriver.h" -/*++ - -Required Alignment Alignment Value in FFS Alignment Value in +/** +Required Alignment Alignment Value in FFS Alignment Value in (bytes) Attributes Field Firmware Volume Interfaces 1 0 0 2 0 1 @@ -29,9 +29,7 @@ Required Alignment Alignment Value in FFS Alignment Value in 4 KB 5 12 32 KB 6 15 64 KB 7 16 - ---*/ - +**/ UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16}; diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c index 1e0263e844..b54053e1c2 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" - +#include "FwVolDriver.h" /** diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c index 26e3dde57d..3966daf5b8 100644 --- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c +++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c @@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "FwVolBlock.h" EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = { @@ -511,9 +512,7 @@ ProduceFVBProtocolOnBuffer ( /** - This routine is the driver initialization entry point. It initializes the - libraries, consumes FV hobs and NT_NON_MM_FV environment variable and - produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate. + 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. diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock.h b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h similarity index 78% rename from MdeModulePkg/Core/Dxe/FwVolBlock.h rename to MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h index 18199ef896..0fa4c296bc 100644 --- a/MdeModulePkg/Core/Dxe/FwVolBlock.h +++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h @@ -19,11 +19,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define FVB_DEVICE_SIGNATURE EFI_SIGNATURE_32('_','F','V','B') + typedef struct { UINTN Base; UINTN Length; } LBA_CACHE; + typedef struct { MEMMAP_DEVICE_PATH MemMapDevPath; EFI_DEVICE_PATH_PROTOCOL EndDevPath; @@ -41,32 +43,11 @@ typedef struct { EFI_PHYSICAL_ADDRESS BaseAddress; } EFI_FW_VOL_BLOCK_DEVICE; + #define FVB_DEVICE_FROM_THIS(a) \ CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE) - -/** - This routine is the driver initialization entry point. It initializes the - libraries, consumes FV hobs and NT_NON_MM_FV environment variable 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 - ); - - - /** Retrieves Volume attributes. No polarity translations are done. @@ -252,49 +233,5 @@ FwVolBlockGetBlockSize ( IN OUT UINTN *NumberOfBlocks ); -/** - This routine is the driver initialization entry point. It initializes the - libraries, consumes FV hobs and NT_NON_MM_FV environment variable 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 - ); #endif diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index 88a11a6ffc..a379e5c5a7 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -15,6 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "Gcd.h" #define MINIMUM_INITIAL_MEMORY_SIZE 0x10000 diff --git a/MdeModulePkg/Core/Dxe/Gcd.h b/MdeModulePkg/Core/Dxe/Gcd/Gcd.h similarity index 100% rename from MdeModulePkg/Core/Dxe/Gcd.h rename to MdeModulePkg/Core/Dxe/Gcd/Gcd.h diff --git a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c index 74cc5dfca7..203a6e6b04 100644 --- a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c +++ b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "Handle.h" // diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index 38e27c4dfd..e817357cd3 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "Handle.h" // diff --git a/MdeModulePkg/Core/Dxe/Handle.h b/MdeModulePkg/Core/Dxe/Hand/Handle.h similarity index 71% rename from MdeModulePkg/Core/Dxe/Handle.h rename to MdeModulePkg/Core/Dxe/Hand/Handle.h index b73bad99e1..f7b85dba26 100644 --- a/MdeModulePkg/Core/Dxe/Handle.h +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.h @@ -16,52 +16,64 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define _HAND_H_ -// -// IHANDLE - contains a list of protocol handles -// - #define EFI_HANDLE_SIGNATURE EFI_SIGNATURE_32('h','n','d','l') + +/// +/// IHANDLE - contains a list of protocol handles +/// typedef struct { UINTN Signature; - LIST_ENTRY AllHandles; // All handles list of IHANDLE - LIST_ENTRY Protocols; // List of PROTOCOL_INTERFACE's for this handle - UINTN LocateRequest; // - UINT64 Key; // The Handle Database Key value when this handle was last created or modified + /// All handles list of IHANDLE + LIST_ENTRY AllHandles; + /// List of PROTOCOL_INTERFACE's for this handle + LIST_ENTRY Protocols; + UINTN LocateRequest; + /// The Handle Database Key value when this handle was last created or modified + UINT64 Key; } IHANDLE; #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE) - -// -// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol -// database. Each handler that supports this protocol is listed, along -// with a list of registered notifies. -// - #define PROTOCOL_ENTRY_SIGNATURE EFI_SIGNATURE_32('p','r','t','e') + +/// +/// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol +/// database. Each handler that supports this protocol is listed, along +/// with a list of registered notifies. +/// typedef struct { UINTN Signature; - LIST_ENTRY AllEntries; // Link Entry inserted to mProtocolDatabase - EFI_GUID ProtocolID; // ID of the protocol - LIST_ENTRY Protocols; // All protocol interfaces - LIST_ENTRY Notify; // Registerd notification handlers + /// Link Entry inserted to mProtocolDatabase + LIST_ENTRY AllEntries; + /// ID of the protocol + EFI_GUID ProtocolID; + /// All protocol interfaces + LIST_ENTRY Protocols; + /// Registerd notification handlers + LIST_ENTRY Notify; } PROTOCOL_ENTRY; -// -// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked -// with a protocol interface structure -// #define PROTOCOL_INTERFACE_SIGNATURE EFI_SIGNATURE_32('p','i','f','c') + +/// +/// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked +/// with a protocol interface structure +/// typedef struct { UINTN Signature; - LIST_ENTRY Link; // Link on IHANDLE.Protocols - IHANDLE *Handle; // Back pointer - LIST_ENTRY ByProtocol; // Link on PROTOCOL_ENTRY.Protocols - PROTOCOL_ENTRY *Protocol; // The protocol ID - VOID *Interface; // The interface value - - LIST_ENTRY OpenList; // OPEN_PROTOCOL_DATA list. + /// Link on IHANDLE.Protocols + LIST_ENTRY Link; + /// Back pointer + IHANDLE *Handle; + /// Link on PROTOCOL_ENTRY.Protocols + LIST_ENTRY ByProtocol; + /// The protocol ID + PROTOCOL_ENTRY *Protocol; + /// The interface value + VOID *Interface; + /// OPEN_PROTOCOL_DATA list + LIST_ENTRY OpenList; UINTN OpenListCount; } PROTOCOL_INTERFACE; @@ -70,7 +82,8 @@ typedef struct { typedef struct { UINTN Signature; - LIST_ENTRY Link; //Link on PROTOCOL_INTERFACE.OpenList + ///Link on PROTOCOL_INTERFACE.OpenList + LIST_ENTRY Link; EFI_HANDLE AgentHandle; EFI_HANDLE ControllerHandle; @@ -79,23 +92,22 @@ typedef struct { } OPEN_PROTOCOL_DATA; -// -// PROTOCOL_NOTIFY - used for each register notification for a protocol -// - #define PROTOCOL_NOTIFY_SIGNATURE EFI_SIGNATURE_32('p','r','t','n') + +/// +/// PROTOCOL_NOTIFY - used for each register notification for a protocol +/// typedef struct { UINTN Signature; PROTOCOL_ENTRY *Protocol; - LIST_ENTRY Link; // All notifications for this protocol - EFI_EVENT Event; // Event to notify - LIST_ENTRY *Position; // Last position notified + /// All notifications for this protocol + LIST_ENTRY Link; + /// Event to notify + EFI_EVENT Event; + /// Last position notified + LIST_ENTRY *Position; } PROTOCOL_NOTIFY; -// -// Internal prototypes -// - /** @@ -165,20 +177,6 @@ CoreRemoveInterfaceFromProtocol ( ); -/** - 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 - ); - /** Connects a controller to a driver. @@ -265,7 +263,6 @@ CoreValidateHandle ( // // Externs // - extern EFI_LOCK gProtocolDatabaseLock; extern LIST_ENTRY gHandleList; extern UINT64 gHandleDatabaseKey; diff --git a/MdeModulePkg/Core/Dxe/Hand/Locate.c b/MdeModulePkg/Core/Dxe/Hand/Locate.c index de3152107b..2b961c14d4 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Locate.c +++ b/MdeModulePkg/Core/Dxe/Hand/Locate.c @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "Handle.h" // // ProtocolRequest - Last LocateHandle request ID diff --git a/MdeModulePkg/Core/Dxe/Hand/Notify.c b/MdeModulePkg/Core/Dxe/Hand/Notify.c index 572ba12eed..dd170ac1cc 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Notify.c +++ b/MdeModulePkg/Core/Dxe/Hand/Notify.c @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "Handle.h" /** diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 954710c38f..6f89ddc24b 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -13,10 +13,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "Image.h" + // // Module Globals // - LOADED_IMAGE_PRIVATE_DATA *mCurrentImage = NULL; LOAD_PE32_IMAGE_PRIVATE_DATA mLoadPe32PrivateData = { diff --git a/MdeModulePkg/Core/Dxe/Image.h b/MdeModulePkg/Core/Dxe/Image/Image.h similarity index 75% rename from MdeModulePkg/Core/Dxe/Image.h rename to MdeModulePkg/Core/Dxe/Image/Image.h index 040941db14..37660201b1 100644 --- a/MdeModulePkg/Core/Dxe/Image.h +++ b/MdeModulePkg/Core/Dxe/Image/Image.h @@ -16,41 +16,48 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #ifndef _IMAGE_H_ #define _IMAGE_H_ - - #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32('l','d','r','i') typedef struct { UINTN Signature; - EFI_HANDLE Handle; // Image handle - UINTN Type; // Image type - - BOOLEAN Started; // If entrypoint has been called - - EFI_IMAGE_ENTRY_POINT EntryPoint; // The image's entry point - EFI_LOADED_IMAGE_PROTOCOL Info; // loaded image protocol - - EFI_PHYSICAL_ADDRESS ImageBasePage; // Location in memory - UINTN NumberOfPages; // Number of pages - - CHAR8 *FixupData; // Original fixup data - - EFI_TPL Tpl; // Tpl of started image - EFI_STATUS Status; // Status returned by started image - - UINTN ExitDataSize; // Size of ExitData from started image - VOID *ExitData; // Pointer to exit data from started image - VOID *JumpBuffer; // Pointer to pool allocation for context save/retore - BASE_LIBRARY_JUMP_BUFFER *JumpContext; // Pointer to buffer for context save/retore - UINT16 Machine; // Machine type from PE image - - EFI_EBC_PROTOCOL *Ebc; // EBC Protocol pointer - - EFI_RUNTIME_IMAGE_ENTRY *RuntimeData; // Runtime image list - - EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath; // Pointer to Loaded Image Device Path Protocl - - PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; // PeCoffLoader ImageContext + /// Image handle + EFI_HANDLE Handle; + /// Image type + UINTN Type; + /// If entrypoint has been called + BOOLEAN Started; + /// The image's entry point + EFI_IMAGE_ENTRY_POINT EntryPoint; + /// loaded image protocol + EFI_LOADED_IMAGE_PROTOCOL Info; + /// Location in memory + EFI_PHYSICAL_ADDRESS ImageBasePage; + /// Number of pages + UINTN NumberOfPages; + /// Original fixup data + CHAR8 *FixupData; + /// Tpl of started image + EFI_TPL Tpl; + /// Status returned by started image + EFI_STATUS Status; + /// Size of ExitData from started image + UINTN ExitDataSize; + /// Pointer to exit data from started image + VOID *ExitData; + /// Pointer to pool allocation for context save/retore + VOID *JumpBuffer; + /// Pointer to buffer for context save/retore + BASE_LIBRARY_JUMP_BUFFER *JumpContext; + /// Machine type from PE image + UINT16 Machine; + /// EBC Protocol pointer + EFI_EBC_PROTOCOL *Ebc; + /// Runtime image list + EFI_RUNTIME_IMAGE_ENTRY *RuntimeData; + /// Pointer to Loaded Image Device Path Protocl + EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath; + /// PeCoffLoader ImageContext + PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; } LOADED_IMAGE_PRIVATE_DATA; @@ -58,12 +65,12 @@ typedef struct { CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE) - #define LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32('l','p','e','i') typedef struct { UINTN Signature; - EFI_HANDLE Handle; // Image handle + /// Image handle + EFI_HANDLE Handle; EFI_PE32_IMAGE_PROTOCOL Pe32Image; } LOAD_PE32_IMAGE_PRIVATE_DATA; @@ -71,7 +78,6 @@ typedef struct { CR(a, LOAD_PE32_IMAGE_PRIVATE_DATA, Pe32Image, LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE) - // // Private Data Types // @@ -84,11 +90,6 @@ typedef struct { } IMAGE_FILE_HANDLE; -// -// Abstractions for reading image contents -// - - /** Opens a file for (simple) reading. The simple read abstraction will access the file either from a memory copy, from a file @@ -149,25 +150,6 @@ CoreReadImageFile ( ); -/** - A function out of date, should be removed. - - @param ImageFileHandle Handle of the file to close - -**/ -VOID -EFIAPI -CoreCloseImageFile ( - IN IMAGE_FILE_HANDLE *ImageFileHandle - ); - - - -// -// Exported Image functions -// - - /** Loads an EFI image into memory and returns a handle to the image with extended parameters. diff --git a/MdeModulePkg/Core/Dxe/Image/ImageFile.c b/MdeModulePkg/Core/Dxe/Image/ImageFile.c index 65ecde2cf4..453e88b940 100644 --- a/MdeModulePkg/Core/Dxe/Image/ImageFile.c +++ b/MdeModulePkg/Core/Dxe/Image/ImageFile.c @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "Image.h" /** Search a handle to a device on a specified device path that supports a specified protocol, diff --git a/MdeModulePkg/Core/Dxe/Library.h b/MdeModulePkg/Core/Dxe/Library.h deleted file mode 100644 index 0d907d8341..0000000000 --- a/MdeModulePkg/Core/Dxe/Library.h +++ /dev/null @@ -1,68 +0,0 @@ -/** @file - Internal functions shared in DxeCore module. - -Copyright (c) 2006 - 2008, 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 - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef _DXE_LIBRARY_H_ -#define _DXE_LIBRARY_H_ - - -/** - 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 diff --git a/MdeModulePkg/Core/Dxe/Imem.h b/MdeModulePkg/Core/Dxe/Mem/Imem.h similarity index 91% rename from MdeModulePkg/Core/Dxe/Imem.h rename to MdeModulePkg/Core/Dxe/Mem/Imem.h index 23e6d097fd..8a60d59f4c 100644 --- a/MdeModulePkg/Core/Dxe/Imem.h +++ b/MdeModulePkg/Core/Dxe/Mem/Imem.h @@ -16,16 +16,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define _IMEM_H_ #if defined (MDE_CPU_IPF) -// -// For Itanium machines make the default allocations 8K aligned -// +/// +/// For Itanium machines make the default allocations 8K aligned +/// #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2) #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2) #else -// -// For genric EFI machines make the default allocations 4K aligned -// +/// +/// For genric EFI machines make the default allocations 4K aligned +/// #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE) #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE) diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 179376dc31..5e3c81d786 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "Imem.h" #define EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE) diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/Pool.c index 2764a8ef9f..cea6fada4c 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Pool.c +++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "DxeMain.h" +#include "Imem.h" #define POOL_FREE_SIGNATURE EFI_SIGNATURE_32('p','f','r','0') typedef struct { diff --git a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c index 556c14c585..295f32f43e 100644 --- a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c +++ b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c @@ -24,7 +24,9 @@ EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = { EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL; +#define FOUR_MEG_ALIGNMENT 0x400000 +#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *)) /** Creates and initializes the DebugImageInfo Table. Also creates the configuration