]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/DxeMain.h
Clean up DEC files:
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / DxeMain.h
index 0adaf1d4d4313ef17018ebc1a941e63977bd7922..e7ec3c856175928f40380d40f68bd51ef2eae9be 100644 (file)
@@ -2,8 +2,8 @@
   The internal header file includes the common header files, defines\r
   internal structure and functions used by DxeCore module.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -25,6 +25,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/DevicePath.h>\r
 #include <Protocol/Runtime.h>\r
 #include <Protocol/LoadFile.h>\r
+#include <Protocol/LoadFile2.h>\r
 #include <Protocol/DriverBinding.h>\r
 #include <Protocol/VariableWrite.h>\r
 #include <Protocol/PlatformDriverOverride.h>\r
@@ -39,7 +40,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #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
@@ -48,9 +48,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #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 <Protocol/HiiPackageList.h>\r
+#include <Protocol/SmmBase2.h>\r
 #include <Guid/MemoryTypeInformation.h>\r
 #include <Guid/FirmwareFileSystem2.h>\r
 #include <Guid/HobList.h>\r
@@ -61,7 +61,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/MemoryAllocationHob.h>\r
 #include <Guid/EventLegacyBios.h>\r
 #include <Guid/EventGroup.h>\r
-\r
+#include <Guid/LoadModuleAtFixedAddress.h>\r
 \r
 #include <Library/DxeCoreEntryPoint.h>\r
 #include <Library/DebugLib.h>\r
@@ -74,21 +74,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/CacheMaintenanceLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/PeCoffLib.h>\r
+#include <Library/PeCoffGetEntryPointLib.h>\r
+#include <Library/PeCoffExtraActionLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
+#include <Library/TimerLib.h>\r
+#include <Library/DxeServicesLib.h>\r
+#include <Library/DebugAgentLib.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 "Event.h"\r
-#include "Handle.h"\r
 \r
 //\r
 // attributes for reserved memory before it is promoted to system memory\r
@@ -124,13 +120,13 @@ typedef struct {
   EFI_EVENT                   Event;\r
   VOID                        *Registration;\r
   BOOLEAN                     Present;\r
-} ARCHITECTURAL_PROTOCOL_ENTRY;\r
+} EFI_CORE_PROTOCOL_NOTIFY_ENTRY;\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
@@ -138,7 +134,7 @@ typedef struct {
 } 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
@@ -171,7 +167,7 @@ typedef struct {
 //\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
@@ -202,6 +198,7 @@ extern EFI_METRONOME_ARCH_PROTOCOL              *gMetronome;
 extern EFI_TIMER_ARCH_PROTOCOL                  *gTimer;\r
 extern EFI_SECURITY_ARCH_PROTOCOL               *gSecurity;\r
 extern EFI_BDS_ARCH_PROTOCOL                    *gBds;\r
+extern EFI_SMM_BASE2_PROTOCOL                   *gSmmBase2;\r
 \r
 extern EFI_TPL                                  gEfiCurrentTpl;\r
 \r
@@ -213,6 +210,8 @@ extern EFI_MEMORY_TYPE_INFORMATION              gMemoryTypeInformation[EfiMaxMem
 extern BOOLEAN                                  gDispatcherRunning;\r
 extern EFI_RUNTIME_ARCH_PROTOCOL                gRuntimeTemplate;\r
 \r
+extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE    gLoadModuleAtFixAddressConfigurationTable;\r
+extern BOOLEAN                                       gLoadFixedAddressCodeMemoryReady;\r
 //\r
 // Service Initialization Functions\r
 //\r
@@ -320,7 +319,7 @@ CoreInitializeGcdServices (
 \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
@@ -351,7 +350,7 @@ CoreInitializeImageServices (
 \r
 **/\r
 VOID\r
-CoreNotifyOnArchProtocolInstallation (\r
+CoreNotifyOnProtocolInstallation (\r
   VOID\r
   );\r
 \r
@@ -916,6 +915,20 @@ CoreRegisterProtocolNotify (
   );\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
@@ -1008,8 +1021,8 @@ CoreLocateHandleBuffer (
 \r
 /**\r
   Return the first Protocol Interface that matches the Protocol GUID. If\r
-  Registration is pasased in return a Protocol Instance that was just add\r
-  to the system. If Retistration is NULL return the first Protocol Interface\r
+  Registration is passed in, return a Protocol Instance that was just add\r
+  to the system. If Registration is NULL return the first Protocol Interface\r
   you find.\r
 \r
   @param  Protocol               The protocol to search for\r
@@ -1285,6 +1298,14 @@ CoreFreePool (
                                   protocol for loading the file.\r
   @retval EFI_OUT_OF_RESOURCES    Image was not loaded due to insufficient\r
                                   resources.\r
+  @retval EFI_LOAD_ERROR          Image was not loaded because the image format was corrupt or not\r
+                                  understood.\r
+  @retval EFI_DEVICE_ERROR        Image was not loaded because the device returned a read error.\r
+  @retval EFI_ACCESS_DENIED       Image was not loaded because the platform policy prohibits the \r
+                                  image from being loaded. NULL is returned in *ImageHandle.\r
+  @retval EFI_SECURITY_VIOLATION  Image was loaded and an ImageHandle was created with a \r
+                                  valid EFI_LOADED_IMAGE_PROTOCOL. However, the current \r
+                                  platform policy specifies that the image should not be started.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1326,7 +1347,7 @@ CoreUnloadImage (
   @param  ImageHandle             Handle of image to be started.\r
   @param  ExitDataSize            Pointer of the size to ExitData\r
   @param  ExitData                Pointer to a pointer to a data buffer that\r
-                                  includes a Null-terminated Unicode string,\r
+                                  includes a Null-terminated string,\r
                                   optionally followed by additional binary data.\r
                                   The string is a description that the caller may\r
                                   use to further indicate the reason for the\r
@@ -1877,29 +1898,6 @@ CoreTrust (
   );\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
@@ -2307,4 +2305,157 @@ CloseSectionStream (
   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