]> git.proxmox.com Git - mirror_edk2.git/commitdiff
move header files in MdeModulePkg\Core\Dxe except DxeMain.h into their corresponding...
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 23 Sep 2008 07:35:34 +0000 (07:35 +0000)
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 23 Sep 2008 07:35:34 +0000 (07:35 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5949 6f19259b-4bc3-4df7-8a09-765794883524

37 files changed:
MdeModulePkg/Core/Dxe/DebugImageInfo.h [deleted file]
MdeModulePkg/Core/Dxe/DxeMain.h
MdeModulePkg/Core/Dxe/DxeMain.inf
MdeModulePkg/Core/Dxe/Event.h [deleted file]
MdeModulePkg/Core/Dxe/Event/Event.c
MdeModulePkg/Core/Dxe/Event/Event.h [new file with mode: 0644]
MdeModulePkg/Core/Dxe/Event/Timer.c
MdeModulePkg/Core/Dxe/Event/Tpl.c
MdeModulePkg/Core/Dxe/FwVol/Ffs.c
MdeModulePkg/Core/Dxe/FwVol/FwVol.c
MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c
MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h [new file with mode: 0644]
MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c
MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c
MdeModulePkg/Core/Dxe/FwVolBlock.h [deleted file]
MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h [new file with mode: 0644]
MdeModulePkg/Core/Dxe/FwVolDriver.h [deleted file]
MdeModulePkg/Core/Dxe/Gcd.h [deleted file]
MdeModulePkg/Core/Dxe/Gcd/Gcd.c
MdeModulePkg/Core/Dxe/Gcd/Gcd.h [new file with mode: 0644]
MdeModulePkg/Core/Dxe/Hand/DriverSupport.c
MdeModulePkg/Core/Dxe/Hand/Handle.c
MdeModulePkg/Core/Dxe/Hand/Handle.h [new file with mode: 0644]
MdeModulePkg/Core/Dxe/Hand/Locate.c
MdeModulePkg/Core/Dxe/Hand/Notify.c
MdeModulePkg/Core/Dxe/Handle.h [deleted file]
MdeModulePkg/Core/Dxe/Image.h [deleted file]
MdeModulePkg/Core/Dxe/Image/Image.c
MdeModulePkg/Core/Dxe/Image/Image.h [new file with mode: 0644]
MdeModulePkg/Core/Dxe/Image/ImageFile.c
MdeModulePkg/Core/Dxe/Imem.h [deleted file]
MdeModulePkg/Core/Dxe/Library.h [deleted file]
MdeModulePkg/Core/Dxe/Mem/Imem.h [new file with mode: 0644]
MdeModulePkg/Core/Dxe/Mem/Page.c
MdeModulePkg/Core/Dxe/Mem/Pool.c
MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c

diff --git a/MdeModulePkg/Core/Dxe/DebugImageInfo.h b/MdeModulePkg/Core/Dxe/DebugImageInfo.h
deleted file mode 100644 (file)
index 317546b..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file\r
-  Support functions for managing debug image info table when loading and unloading\r
-  images.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __DEBUG_IMAGE_INFO_H__\r
-#define __DEBUG_IMAGE_INFO_H__\r
-\r
-#define FOUR_MEG_ALIGNMENT   0x400000\r
-\r
-#define EFI_DEBUG_TABLE_ENTRY_SIZE       (sizeof (VOID *))\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
-#endif\r
index 30fffb9f38fee673489492d286e2a0fb637c0fd9..e46acf41471877f1c016d388f527985eb43ce823 100644 (file)
@@ -80,16 +80,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/ReportStatusCodeLib.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
 //\r
@@ -916,6 +906,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
@@ -2307,4 +2311,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
index e6ba388bf4231c54914f6cf26514f4cb33b792b9..56178802097501df51c25d613c44b057c762de65 100644 (file)
 #  VALID_ARCHITECTURES           = IA32 X64 IPF\r
 \r
 [Sources.common]\r
-  Library.h\r
-  Imem.h\r
-  Image.h\r
-  Handle.h\r
-  Gcd.h\r
-  FwVolDriver.h\r
-  FwVolBlock.h\r
-  Event.h\r
   DxeMain.h\r
-  DebugImageInfo.h\r
   SectionExtraction/CoreSectionExtraction.c\r
   Image/ImageFile.c\r
   Image/Image.c\r
+  Image/Image.h\r
   Misc/DebugImageInfo.c\r
   Misc/Stall.c\r
   Misc/SetWatchdogTimer.c\r
   Hand/Notify.c\r
   Hand/Locate.c\r
   Hand/Handle.c\r
+  Hand/Handle.h\r
   Gcd/Gcd.c\r
+  Gcd/Gcd.h\r
   Mem/Pool.c\r
   Mem/Page.c\r
   Mem/MemData.c\r
+  Mem/Imem.h\r
   FwVolBlock/FwVolBlock.c\r
+  FwVolBlock/FwVolBlock.h\r
   FwVol/FwVolWrite.c\r
   FwVol/FwVolRead.c\r
   FwVol/FwVolAttrib.c\r
   FwVol/Ffs.c\r
   FwVol/FwVol.c\r
+  FwVol/FwVolDriver.h\r
   Event/Tpl.c\r
   Event/Timer.c\r
   Event/Event.c\r
+  Event/Event.h\r
   Dispatcher/Dependency.c\r
   Dispatcher/Dispatcher.c\r
   DxeMain/DxeProtocolNotify.c\r
diff --git a/MdeModulePkg/Core/Dxe/Event.h b/MdeModulePkg/Core/Dxe/Event.h
deleted file mode 100644 (file)
index 1709290..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/** @file\r
-  UEFI Event support functions and structure.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __EVENT_H__\r
-#define __EVENT_H__\r
-\r
-#define VALID_TPL(a)            ((a) <= TPL_HIGH_LEVEL)\r
-\r
-//\r
-// EFI_EVENT\r
-//\r
-#define EVENT_SIGNATURE         EFI_SIGNATURE_32('e','v','n','t')\r
-typedef struct {\r
-  UINTN                   Signature;\r
-  UINT32                  Type;\r
-  UINT32                  SignalCount;\r
-\r
-  //\r
-  // Entry if the event is registered to be signalled\r
-  //\r
-\r
-  LIST_ENTRY              SignalLink;\r
-\r
-  //\r
-  // Notification information for this event\r
-  //\r
-\r
-  EFI_TPL                 NotifyTpl;\r
-  EFI_EVENT_NOTIFY        NotifyFunction;\r
-  VOID                    *NotifyContext;\r
-  EFI_GUID                EventGroup;\r
-  LIST_ENTRY              NotifyLink;\r
-  BOOLEAN                 ExFlag;\r
-\r
-  //\r
-  // A list of all runtime events\r
-  //\r
-  EFI_RUNTIME_EVENT_ENTRY   RuntimeData;\r
-\r
-  //\r
-  // Information by event type\r
-  //\r
-\r
-  union {\r
-    //\r
-    // For timer events\r
-    //\r
-    struct {\r
-      LIST_ENTRY      Link;\r
-      UINT64          TriggerTime;\r
-      UINT64          Period;\r
-    } Timer;\r
-  } u;\r
-\r
-} IEVENT;\r
-\r
-//\r
-// Internal prototypes\r
-//\r
-\r
-\r
-/**\r
-  Dispatches all pending events.\r
-\r
-  @param  Priority               The task priority level of event notifications\r
-                                 to dispatch\r
-\r
-**/\r
-VOID\r
-CoreDispatchEventNotifies (\r
-  IN EFI_TPL      Priority\r
-  );\r
-\r
-\r
-\r
-//\r
-// Exported functions\r
-//\r
-/**\r
-  Initializes timer support.\r
-\r
-**/\r
-VOID\r
-CoreInitializeTimer (\r
-  VOID\r
-  );\r
-\r
-//\r
-// extern data declarations\r
-//\r
-\r
-extern EFI_LOCK       gEventQueueLock;\r
-extern UINTN          gEventPending;\r
-extern LIST_ENTRY     gEventQueue[];\r
-extern LIST_ENTRY     gEventSignalQueue;\r
-\r
-#endif\r
index 0e32aa4b6646adad50d9d0fb0d39aa3df871ccb4..204e9b3b70a7850c6d9fd0392da7880c89bebef1 100644 (file)
@@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 \r
 #include "DxeMain.h"\r
+#include "Event.h"\r
 \r
 ///\r
 /// gEfiCurrentTpl - Current Task priority level\r
diff --git a/MdeModulePkg/Core/Dxe/Event/Event.h b/MdeModulePkg/Core/Dxe/Event/Event.h
new file mode 100644 (file)
index 0000000..f9384bc
--- /dev/null
@@ -0,0 +1,91 @@
+/** @file\r
+  UEFI Event support functions and structure.\r
+\r
+Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+All rights reserved. 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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __EVENT_H__\r
+#define __EVENT_H__\r
+\r
+\r
+#define VALID_TPL(a)            ((a) <= TPL_HIGH_LEVEL)\r
+extern  UINTN                   gEventPending;\r
+\r
+\r
+//\r
+// EFI_EVENT\r
+//\r
+#define EVENT_SIGNATURE         EFI_SIGNATURE_32('e','v','n','t')\r
+typedef struct {\r
+  UINTN                   Signature;\r
+  UINT32                  Type;\r
+  UINT32                  SignalCount;\r
+  ///\r
+  /// Entry if the event is registered to be signalled\r
+  ///\r
+  LIST_ENTRY              SignalLink;\r
+  ///\r
+  /// Notification information for this event\r
+  ///\r
+  EFI_TPL                 NotifyTpl;\r
+  EFI_EVENT_NOTIFY        NotifyFunction;\r
+  VOID                    *NotifyContext;\r
+  EFI_GUID                EventGroup;\r
+  LIST_ENTRY              NotifyLink;\r
+  BOOLEAN                 ExFlag;\r
+  ///\r
+  /// A list of all runtime events\r
+  ///\r
+  EFI_RUNTIME_EVENT_ENTRY   RuntimeData;\r
+  ///\r
+  /// Information by event type\r
+  ///\r
+  union {\r
+    ///\r
+    /// For timer events\r
+    ///\r
+    struct {\r
+      LIST_ENTRY      Link;\r
+      UINT64          TriggerTime;\r
+      UINT64          Period;\r
+    } Timer;\r
+  } u;\r
+\r
+} IEVENT;\r
+\r
+//\r
+// Internal prototypes\r
+//\r
+\r
+\r
+/**\r
+  Dispatches all pending events.\r
+\r
+  @param  Priority               The task priority level of event notifications\r
+                                 to dispatch\r
+\r
+**/\r
+VOID\r
+CoreDispatchEventNotifies (\r
+  IN EFI_TPL      Priority\r
+  );\r
+\r
+\r
+/**\r
+  Initializes timer support.\r
+\r
+**/\r
+VOID\r
+CoreInitializeTimer (\r
+  VOID\r
+  );\r
+\r
+#endif\r
index e1df72153d68ffdc01e02e4b73d712ce98f29a38..eefd5a70c2e69ea4166162f7945d108c73eced5e 100644 (file)
@@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 \r
 #include "DxeMain.h"\r
+#include "Event.h"\r
 \r
 //\r
 // Internal data\r
index 43bc8add36f772a6d0cd6a87ad671b5ef6ce15ba..dd9c57e1d3d139779a6220de30b55a4945aeda45 100644 (file)
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
-\r
+#include "Event.h"\r
 \r
 /**\r
   Set Interrupt State.\r
index 1c11dde036b0607e0926837c59ba1a4b941b54aa..3a50f9dd000fe8d46e5779d436e10468a8ec8aae 100644 (file)
@@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 \r
 #include "DxeMain.h"\r
+#include "FwVolDriver.h"\r
 \r
 \r
 /**\r
index 16d66fa0d4dc807be0ceded0df16bf7d469d777d..9e26e4f020defbc129127d9d8935057db5f9320d 100644 (file)
@@ -15,8 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "FwVolDriver.h"\r
 \r
-#define KEYSIZE       sizeof (UINTN)\r
 \r
 //\r
 // Protocol notify related globals\r
@@ -34,8 +34,8 @@ FV_DEVICE mFvDevice = {
     FvReadFile,\r
     FvReadFileSection,\r
     FvWriteFile,\r
-    FvGetNextFile,\r
-    KEYSIZE,\r
+    FvGetNextFile,   \r
+       sizeof (UINTN),\r
     NULL,\r
     FvGetVolumeInfo,\r
     FvSetVolumeInfo\r
index 4c7dd99b573545fb5406c29cd36cba34473f1ac3..f60af526e4ec5231ca66b0670805e7526dd8f4dd 100644 (file)
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "FwVolDriver.h"\r
 \r
 \r
 /**\r
diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h b/MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h
new file mode 100644 (file)
index 0000000..bb29cc4
--- /dev/null
@@ -0,0 +1,458 @@
+/** @file\r
+  Firmware File System protocol. Layers on top of Firmware\r
+  Block protocol to produce a file abstraction of FV based files.\r
+\r
+Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+All rights reserved. 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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __FW_VOL_DRIVER_H_\r
+#define __FW_VOL_DRIVER_H_\r
+\r
+\r
+#define FV2_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('_', 'F', 'V', '2')\r
+\r
+//\r
+// Used to track all non-deleted files\r
+//\r
+typedef struct {\r
+  LIST_ENTRY                      Link;\r
+  EFI_FFS_FILE_HEADER             *FfsHeader;\r
+  UINTN                           StreamHandle;\r
+} FFS_FILE_LIST_ENTRY;\r
+\r
+typedef struct {\r
+  UINTN                                   Signature;\r
+  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL      *Fvb;\r
+  EFI_HANDLE                              Handle;\r
+  EFI_FIRMWARE_VOLUME2_PROTOCOL           Fv;\r
+\r
+  EFI_FIRMWARE_VOLUME_HEADER              *FwVolHeader;\r
+  UINT8                                   *CachedFv;\r
+  UINT8                                   *EndOfCachedFv;\r
+\r
+  FFS_FILE_LIST_ENTRY                     *LastKey;\r
+\r
+  LIST_ENTRY                              FfsFileListHeader;\r
+\r
+  UINT8                                   ErasePolarity;\r
+} FV_DEVICE;\r
+\r
+#define FV_DEVICE_FROM_THIS(a) CR(a, FV_DEVICE, Fv, FV2_DEVICE_SIGNATURE)\r
+\r
+/**\r
+  Retrieves attributes, insures positive polarity of attribute bits, returns\r
+  resulting attributes in output parameter.\r
+\r
+  @param  This             Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
+  @param  Attributes       output buffer which contains attributes.\r
+\r
+  @retval EFI_SUCCESS      Successfully got volume attributes.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FvGetVolumeAttributes (\r
+  IN  CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
+  OUT       EFI_FV_ATTRIBUTES             *Attributes\r
+  );\r
+\r
+\r
+/**\r
+  Sets current attributes for volume\r
+\r
+  @param  This             Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
+  @param  Attributes       At input, contains attributes to be set.  At output\r
+                           contains new value of FV.\r
+\r
+  @retval EFI_UNSUPPORTED  Could not be set.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FvSetVolumeAttributes (\r
+  IN     CONST EFI_FIRMWARE_VOLUME2_PROTOCOL  *This,\r
+  IN OUT       EFI_FV_ATTRIBUTES              *Attributes\r
+  );\r
+\r
+\r
+/**\r
+  Given the input key, search for the next matching file in the volume.\r
+\r
+  @param  This                       Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
+  @param  Key                        Key is a pointer to a caller allocated\r
+                                     buffer that contains implementation specific\r
+                                     data that is used to track where to begin\r
+                                     the search for the next file. The size of\r
+                                     the buffer must be at least This->KeySize\r
+                                     bytes long. To reinitialize the search and\r
+                                     begin from the beginning of the firmware\r
+                                     volume, the entire buffer must be cleared to\r
+                                     zero. Other than clearing the buffer to\r
+                                     initiate a new search, the caller must not\r
+                                     modify the data in the buffer between calls\r
+                                     to GetNextFile().\r
+  @param  FileType                   FileType is a pointer to a caller allocated\r
+                                     EFI_FV_FILETYPE. The GetNextFile() API can\r
+                                     filter it's search for files based on the\r
+                                     value of *FileType input. A *FileType input\r
+                                     of 0 causes GetNextFile() to search for\r
+                                     files of all types.  If a file is found, the\r
+                                     file's type is returned in *FileType.\r
+                                     *FileType is not modified if no file is\r
+                                     found.\r
+  @param  NameGuid                   NameGuid is a pointer to a caller allocated\r
+                                     EFI_GUID. If a file is found, the file's\r
+                                     name is returned in *NameGuid.  *NameGuid is\r
+                                     not modified if no file is found.\r
+  @param  Attributes                 Attributes is a pointer to a caller\r
+                                     allocated EFI_FV_FILE_ATTRIBUTES.  If a file\r
+                                     is found, the file's attributes are returned\r
+                                     in *Attributes. *Attributes is not modified\r
+                                     if no file is found.\r
+  @param  Size                       Size is a pointer to a caller allocated\r
+                                     UINTN. If a file is found, the file's size\r
+                                     is returned in *Size. *Size is not modified\r
+                                     if no file is found.\r
+\r
+  @retval EFI_SUCCESS                Successfully find the file.\r
+  @retval EFI_DEVICE_ERROR           Device error.\r
+  @retval EFI_ACCESS_DENIED          Fv could not read.\r
+  @retval EFI_NOT_FOUND              No matching file found.\r
+  @retval EFI_INVALID_PARAMETER      Invalid parameter\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FvGetNextFile (\r
+  IN CONST   EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
+  IN OUT     VOID                          *Key,\r
+  IN OUT     EFI_FV_FILETYPE               *FileType,\r
+  OUT        EFI_GUID                      *NameGuid,\r
+  OUT        EFI_FV_FILE_ATTRIBUTES        *Attributes,\r
+  OUT        UINTN                         *Size\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Locates a file in the firmware volume and\r
+  copies it to the supplied buffer.\r
+\r
+  @param  This                       Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
+  @param  NameGuid                   Pointer to an EFI_GUID, which is the\r
+                                     filename.\r
+  @param  Buffer                     Buffer is a pointer to pointer to a buffer\r
+                                     in which the file or section contents or are\r
+                                     returned.\r
+  @param  BufferSize                 BufferSize is a pointer to caller allocated\r
+                                     UINTN. On input *BufferSize indicates the\r
+                                     size in bytes of the memory region pointed\r
+                                     to by Buffer. On output, *BufferSize\r
+                                     contains the number of bytes required to\r
+                                     read the file.\r
+  @param  FoundType                  FoundType is a pointer to a caller allocated\r
+                                     EFI_FV_FILETYPE that on successful return\r
+                                     from Read() contains the type of file read.\r
+                                     This output reflects the file type\r
+                                     irrespective of the value of the SectionType\r
+                                     input.\r
+  @param  FileAttributes             FileAttributes is a pointer to a caller\r
+                                     allocated EFI_FV_FILE_ATTRIBUTES.  On\r
+                                     successful return from Read(),\r
+                                     *FileAttributes contains the attributes of\r
+                                     the file read.\r
+  @param  AuthenticationStatus       AuthenticationStatus is a pointer to a\r
+                                     caller allocated UINTN in which the\r
+                                     authentication status is returned.\r
+\r
+  @retval EFI_SUCCESS                Successfully read to memory buffer.\r
+  @retval EFI_WARN_BUFFER_TOO_SMALL  Buffer too small.\r
+  @retval EFI_NOT_FOUND              Not found.\r
+  @retval EFI_DEVICE_ERROR           Device error.\r
+  @retval EFI_ACCESS_DENIED          Could not read.\r
+  @retval EFI_INVALID_PARAMETER      Invalid parameter.\r
+  @retval EFI_OUT_OF_RESOURCES       Not enough buffer to be allocated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FvReadFile (\r
+  IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
+  IN CONST EFI_GUID                      *NameGuid,\r
+  IN OUT   VOID                          **Buffer,\r
+  IN OUT   UINTN                         *BufferSize,\r
+  OUT      EFI_FV_FILETYPE               *FoundType,\r
+  OUT      EFI_FV_FILE_ATTRIBUTES        *FileAttributes,\r
+  OUT      UINT32                        *AuthenticationStatus\r
+  );\r
+\r
+\r
+/**\r
+  Locates a section in a given FFS File and\r
+  copies it to the supplied buffer (not including section header).\r
+\r
+  @param  This                       Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
+  @param  NameGuid                   Pointer to an EFI_GUID, which is the\r
+                                     filename.\r
+  @param  SectionType                Indicates the section type to return.\r
+  @param  SectionInstance            Indicates which instance of sections with a\r
+                                     type of SectionType to return.\r
+  @param  Buffer                     Buffer is a pointer to pointer to a buffer\r
+                                     in which the file or section contents or are\r
+                                     returned.\r
+  @param  BufferSize                 BufferSize is a pointer to caller allocated\r
+                                     UINTN.\r
+  @param  AuthenticationStatus       AuthenticationStatus is a pointer to a\r
+                                     caller allocated UINT32 in which the\r
+                                     authentication status is returned.\r
+\r
+  @retval EFI_SUCCESS                Successfully read the file section into\r
+                                     buffer.\r
+  @retval EFI_WARN_BUFFER_TOO_SMALL  Buffer too small.\r
+  @retval EFI_NOT_FOUND              Section not found.\r
+  @retval EFI_DEVICE_ERROR           Device error.\r
+  @retval EFI_ACCESS_DENIED          Could not read.\r
+  @retval EFI_INVALID_PARAMETER      Invalid parameter.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FvReadFileSection (\r
+  IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL  *This,\r
+  IN CONST  EFI_GUID                       *NameGuid,\r
+  IN        EFI_SECTION_TYPE               SectionType,\r
+  IN        UINTN                          SectionInstance,\r
+  IN OUT    VOID                           **Buffer,\r
+  IN OUT    UINTN                          *BufferSize,\r
+  OUT       UINT32                         *AuthenticationStatus\r
+  );\r
+\r
+\r
+/**\r
+  Writes one or more files to the firmware volume.\r
+\r
+  @param  This                   Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
+  @param  NumberOfFiles          Number of files.\r
+  @param  WritePolicy            WritePolicy indicates the level of reliability\r
+                                 for the write in the event of a power failure or\r
+                                 other system failure during the write operation.\r
+  @param  FileData               FileData is an pointer to an array of\r
+                                 EFI_FV_WRITE_DATA. Each element of array\r
+                                 FileData represents a file to be written.\r
+\r
+  @retval EFI_SUCCESS            Files successfully written to firmware volume\r
+  @retval EFI_OUT_OF_RESOURCES   Not enough buffer to be allocated.\r
+  @retval EFI_DEVICE_ERROR       Device error.\r
+  @retval EFI_WRITE_PROTECTED    Write protected.\r
+  @retval EFI_NOT_FOUND          Not found.\r
+  @retval EFI_INVALID_PARAMETER  Invalid parameter.\r
+  @retval EFI_UNSUPPORTED        This function not supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FvWriteFile (\r
+  IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL  *This,\r
+  IN       UINT32                         NumberOfFiles,\r
+  IN       EFI_FV_WRITE_POLICY            WritePolicy,\r
+  IN       EFI_FV_WRITE_FILE_DATA         *FileData\r
+  );\r
+\r
+\r
+/**\r
+  Return information of type InformationType for the requested firmware\r
+  volume.\r
+\r
+  @param  This             Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
+  @param  InformationType  InformationType for requested.\r
+  @param  BufferSize       On input, size of Buffer.On output, the amount of data\r
+                           returned in Buffer.\r
+  @param  Buffer           A poniter to the data buffer to return.\r
+\r
+  @retval EFI_SUCCESS      Successfully got volume Information.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FvGetVolumeInfo (\r
+  IN  CONST EFI_FIRMWARE_VOLUME2_PROTOCOL       *This,\r
+  IN  CONST EFI_GUID                            *InformationType,\r
+  IN OUT UINTN                                  *BufferSize,\r
+  OUT VOID                                      *Buffer\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Set information of type InformationType for the requested firmware\r
+  volume.\r
+\r
+  @param  This             Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
+  @param  InformationType  InformationType for requested.\r
+  @param  BufferSize       On input, size of Buffer.On output, the amount of data\r
+                           returned in Buffer.\r
+  @param  Buffer           A poniter to the data buffer to return.\r
+\r
+  @retval EFI_SUCCESS      Successfully set volume Information.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FvSetVolumeInfo (\r
+  IN  CONST EFI_FIRMWARE_VOLUME2_PROTOCOL       *This,\r
+  IN  CONST EFI_GUID                            *InformationType,\r
+  IN  UINTN                                     BufferSize,\r
+  IN CONST  VOID                                *Buffer\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Check if a block of buffer is erased.\r
+\r
+  @param  ErasePolarity  Erase polarity attribute of the firmware volume\r
+  @param  InBuffer       The buffer to be checked\r
+  @param  BufferSize     Size of the buffer in bytes\r
+\r
+  @retval TRUE           The block of buffer is erased\r
+  @retval FALSE          The block of buffer is not erased\r
+\r
+**/\r
+BOOLEAN\r
+IsBufferErased (\r
+  IN UINT8    ErasePolarity,\r
+  IN VOID     *InBuffer,\r
+  IN UINTN    BufferSize\r
+  );\r
+\r
+\r
+/**\r
+  Get the FFS file state by checking the highest bit set in the header's state field.\r
+\r
+  @param  ErasePolarity  Erase polarity attribute of the firmware volume\r
+  @param  FfsHeader      Points to the FFS file header\r
+\r
+  @return FFS File state\r
+\r
+**/\r
+EFI_FFS_FILE_STATE\r
+GetFileState (\r
+  IN UINT8                ErasePolarity,\r
+  IN EFI_FFS_FILE_HEADER  *FfsHeader\r
+  );\r
+\r
+\r
+/**\r
+  Set the FFS file state.\r
+\r
+  @param  State                      The state to be set.\r
+  @param  FfsHeader                  Points to the FFS file header\r
+\r
+  @return None.\r
+\r
+**/\r
+VOID\r
+SetFileState (\r
+  IN UINT8                State,\r
+  IN EFI_FFS_FILE_HEADER  *FfsHeader\r
+  );\r
+\r
+\r
+/**\r
+  Verify checksum of the firmware volume header.\r
+\r
+  @param  FvHeader       Points to the firmware volume header to be checked\r
+\r
+  @retval TRUE           Checksum verification passed\r
+  @retval FALSE          Checksum verification failed\r
+\r
+**/\r
+BOOLEAN\r
+VerifyFvHeaderChecksum (\r
+  IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r
+  );\r
+\r
+\r
+/**\r
+  Check if it's a valid FFS file header.\r
+\r
+  @param  ErasePolarity  Erase polarity attribute of the firmware volume\r
+  @param  FfsHeader      Points to the FFS file header to be checked\r
+  @param  FileState      FFS file state to be returned\r
+\r
+  @retval TRUE           Valid FFS file header\r
+  @retval FALSE          Invalid FFS file header\r
+\r
+**/\r
+BOOLEAN\r
+IsValidFfsHeader (\r
+  IN UINT8                ErasePolarity,\r
+  IN EFI_FFS_FILE_HEADER  *FfsHeader,\r
+  OUT EFI_FFS_FILE_STATE  *FileState\r
+  );\r
+\r
+\r
+/**\r
+  Check if it's a valid FFS file.\r
+  Here we are sure that it has a valid FFS file header since we must call IsValidFfsHeader() first.\r
+\r
+  @param  ErasePolarity  Erase polarity attribute of the firmware volume\r
+  @param  FfsHeader      Points to the FFS file to be checked\r
+\r
+  @retval TRUE           Valid FFS file\r
+  @retval FALSE          Invalid FFS file\r
+\r
+**/\r
+BOOLEAN\r
+IsValidFfsFile (\r
+  IN UINT8                ErasePolarity,\r
+  IN EFI_FFS_FILE_HEADER  *FfsHeader\r
+  );\r
+\r
+\r
+/**\r
+  given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and\r
+  copy the volume header into it.\r
+\r
+  @param  Fvb                   The FW_VOL_BLOCK_PROTOCOL instance from which to\r
+                                read the volume header\r
+  @param  FwVolHeader           Pointer to pointer to allocated buffer in which\r
+                                the volume header is returned.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  No enough buffer could be allocated.\r
+  @retval EFI_SUCCESS           Successfully read volume header to the allocated\r
+                                buffer.\r
+\r
+**/\r
+EFI_STATUS\r
+GetFwVolHeader (\r
+  IN     EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL     *Fvb,\r
+  OUT    EFI_FIRMWARE_VOLUME_HEADER             **FwVolHeader\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Check if an FV is consistent and allocate cache for it.\r
+\r
+  @param  FvDevice              A pointer to the FvDevice to be checked.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  No enough buffer could be allocated.\r
+  @retval EFI_SUCCESS           FV is consistent and cache is allocated.\r
+  @retval EFI_VOLUME_CORRUPTED  File system is corrupted.\r
+\r
+**/\r
+EFI_STATUS\r
+FvCheck (\r
+  IN OUT FV_DEVICE  *FvDevice\r
+  );\r
+\r
+#endif\r
index fbf6d0a1ba53a7492c01f80249ceafec0371672e..e7cac455ff09d1e827d51d9a103faed58487a9ea 100644 (file)
@@ -13,10 +13,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "FwVolDriver.h"\r
 \r
-/*++\r
-\r
-Required Alignment    Alignment Value in FFS       Alignment Value in\r
+/**\r
+Required Alignment             Alignment Value in FFS         Alignment Value in\r
 (bytes)                        Attributes Field               Firmware Volume Interfaces\r
 1                                    0                                     0\r
 2                                    0                                     1\r
@@ -29,9 +29,7 @@ Required Alignment    Alignment Value in FFS       Alignment Value in
 4 KB                                 5                                     12\r
 32 KB                                6                                     15\r
 64 KB                                7                                     16\r
-\r
---*/\r
-\r
+**/\r
 UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16};\r
 \r
 \r
index 1e0263e844186ba8a9349e764fc928fefea8f4ad..b54053e1c26ae6295050f5acc461bc1cf75a37d0 100644 (file)
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
-\r
+#include "FwVolDriver.h"\r
 \r
 \r
 /**\r
diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock.h b/MdeModulePkg/Core/Dxe/FwVolBlock.h
deleted file mode 100644 (file)
index 18199ef..0000000
+++ /dev/null
@@ -1,300 +0,0 @@
-/** @file\r
-  Firmware Volume Block protocol functions.\r
-  Consumes FV hobs and creates appropriate block protocols.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _FWVOL_BLOCK_H_\r
-#define _FWVOL_BLOCK_H_\r
-\r
-\r
-#define FVB_DEVICE_SIGNATURE       EFI_SIGNATURE_32('_','F','V','B')\r
-\r
-typedef struct {\r
-  UINTN                       Base;\r
-  UINTN                       Length;\r
-} LBA_CACHE;\r
-\r
-typedef struct {\r
-  MEMMAP_DEVICE_PATH          MemMapDevPath;\r
-  EFI_DEVICE_PATH_PROTOCOL    EndDevPath;\r
-} FV_DEVICE_PATH;\r
-\r
-\r
-typedef struct {\r
-  UINTN                                 Signature;\r
-  EFI_HANDLE                            Handle;\r
-  FV_DEVICE_PATH                        DevicePath;\r
-  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL    FwVolBlockInstance;\r
-  UINTN                                 NumBlocks;\r
-  LBA_CACHE                             *LbaCache;\r
-  UINT32                                FvbAttributes;\r
-  EFI_PHYSICAL_ADDRESS                  BaseAddress;\r
-} EFI_FW_VOL_BLOCK_DEVICE;\r
-\r
-#define FVB_DEVICE_FROM_THIS(a) \\r
-  CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)\r
-\r
-\r
-\r
-/**\r
-  This routine is the driver initialization entry point.  It initializes the\r
-  libraries, consumes FV hobs and NT_NON_MM_FV environment variable and\r
-  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
-/**\r
-  Retrieves Volume attributes.  No polarity translations are done.\r
-\r
-  @param  This                   Calling context\r
-  @param  Attributes             output buffer which contains attributes\r
-\r
-  @retval EFI_SUCCESS            The firmware volume attributes were returned.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FwVolBlockGetAttributes (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
-  OUT       EFI_FVB_ATTRIBUTES_2                *Attributes\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Modifies the current settings of the firmware volume according to the input parameter.\r
-\r
-  @param  This                   Calling context\r
-  @param  Attributes             input buffer which contains attributes\r
-\r
-  @retval EFI_SUCCESS            The firmware volume attributes were returned.\r
-  @retval EFI_INVALID_PARAMETER  The attributes requested are in conflict with\r
-                                 the capabilities as declared in the firmware\r
-                                 volume header.\r
-  @retval EFI_UNSUPPORTED        Not supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FwVolBlockSetAttributes (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
-  IN CONST  EFI_FVB_ATTRIBUTES_2                *Attributes\r
-  );\r
-\r
-\r
-\r
-/**\r
-  The EraseBlock() function erases one or more blocks as denoted by the\r
-  variable argument list. The entire parameter list of blocks must be verified\r
-  prior to erasing any blocks.  If a block is requested that does not exist\r
-  within the associated firmware volume (it has a larger index than the last\r
-  block of the firmware volume), the EraseBlock() function must return\r
-  EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.\r
-\r
-  @param  This                   Calling context\r
-  @param  ...                    Starting LBA followed by Number of Lba to erase.\r
-                                 a -1 to terminate the list.\r
-\r
-  @retval EFI_SUCCESS            The erase request was successfully completed.\r
-  @retval EFI_ACCESS_DENIED      The firmware volume is in the WriteDisabled\r
-                                 state.\r
-  @retval EFI_DEVICE_ERROR       The block device is not functioning correctly\r
-                                 and could not be written. The firmware device\r
-                                 may have been partially erased.\r
-  @retval EFI_INVALID_PARAMETER  One or more of the LBAs listed in the variable\r
-                                 argument list do\r
-  @retval EFI_UNSUPPORTED        Not supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FwVolBlockEraseBlock (\r
-  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL    *This,\r
-  ...\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Read the specified number of bytes from the block to the input buffer.\r
-\r
-  @param  This                   Indicates the calling context.\r
-  @param  Lba                    The starting logical block index to read.\r
-  @param  Offset                 Offset into the block at which to begin reading.\r
-  @param  NumBytes               Pointer to a UINT32. At entry, *NumBytes\r
-                                 contains the total size of the buffer. At exit,\r
-                                 *NumBytes contains the total number of bytes\r
-                                 actually read.\r
-  @param  Buffer                 Pinter to a caller-allocated buffer that\r
-                                 contains the destine for the read.\r
-\r
-  @retval EFI_SUCCESS            The firmware volume was read successfully.\r
-  @retval EFI_BAD_BUFFER_SIZE    The read was attempted across an LBA boundary.\r
-  @retval EFI_ACCESS_DENIED      Access denied.\r
-  @retval EFI_DEVICE_ERROR       The block device is malfunctioning and could not\r
-                                 be read.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FwVolBlockReadBlock (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL   *This,\r
-  IN CONST  EFI_LBA                              Lba,\r
-  IN CONST  UINTN                                Offset,\r
-  IN OUT    UINTN                                *NumBytes,\r
-  IN OUT    UINT8                                *Buffer\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Writes the specified number of bytes from the input buffer to the block.\r
-\r
-  @param  This                   Indicates the calling context.\r
-  @param  Lba                    The starting logical block index to write to.\r
-  @param  Offset                 Offset into the block at which to begin writing.\r
-  @param  NumBytes               Pointer to a UINT32. At entry, *NumBytes\r
-                                 contains the total size of the buffer. At exit,\r
-                                 *NumBytes contains the total number of bytes\r
-                                 actually written.\r
-  @param  Buffer                 Pinter to a caller-allocated buffer that\r
-                                 contains the source for the write.\r
-\r
-  @retval EFI_SUCCESS            The firmware volume was written successfully.\r
-  @retval EFI_BAD_BUFFER_SIZE    The write was attempted across an LBA boundary.\r
-                                 On output, NumBytes contains the total number of\r
-                                 bytes actually written.\r
-  @retval EFI_ACCESS_DENIED      The firmware volume is in the WriteDisabled\r
-                                 state.\r
-  @retval EFI_DEVICE_ERROR       The block device is malfunctioning and could not\r
-                                 be written.\r
-  @retval EFI_UNSUPPORTED        Not supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FwVolBlockWriteBlock (\r
-  IN     EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL   *This,\r
-  IN     EFI_LBA                              Lba,\r
-  IN     UINTN                                Offset,\r
-  IN OUT UINTN                                *NumBytes,\r
-  IN     UINT8                                *Buffer\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Get Fvb's base address.\r
-\r
-  @param  This                   Indicates the calling context.\r
-  @param  Address                Fvb device base address.\r
-\r
-  @retval EFI_SUCCESS            Successfully got Fvb's base address.\r
-  @retval EFI_UNSUPPORTED        Not supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FwVolBlockGetPhysicalAddress (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
-  OUT       EFI_PHYSICAL_ADDRESS                *Address\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Retrieves the size in bytes of a specific block within a firmware volume.\r
-\r
-  @param  This                   Indicates the calling context.\r
-  @param  Lba                    Indicates the block for which to return the\r
-                                 size.\r
-  @param  BlockSize              Pointer to a caller-allocated UINTN in which the\r
-                                 size of the block is returned.\r
-  @param  NumberOfBlocks         Pointer to a caller-allocated UINTN in which the\r
-                                 number of consecutive blocks starting with Lba\r
-                                 is returned. All blocks in this range have a\r
-                                 size of BlockSize.\r
-\r
-  @retval EFI_SUCCESS            The firmware volume base address is returned.\r
-  @retval EFI_INVALID_PARAMETER  The requested LBA is out of range.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FwVolBlockGetBlockSize (\r
-  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
-  IN CONST  EFI_LBA                             Lba,\r
-  IN OUT    UINTN                               *BlockSize,\r
-  IN OUT    UINTN                               *NumberOfBlocks\r
-  );\r
-\r
-/**\r
-  This routine is the driver initialization entry point.  It initializes the\r
-  libraries, consumes FV hobs and NT_NON_MM_FV environment variable and\r
-  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
-#endif\r
index 26e3dde57d8b546a01c5039308f7f85ba085c0f3..3966daf5b84e2e3cc989113e5a45a9263f5c42ab 100644 (file)
@@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "FwVolBlock.h"\r
 \r
 \r
 EFI_FW_VOL_BLOCK_DEVICE  mFwVolBlock = {\r
@@ -511,9 +512,7 @@ ProduceFVBProtocolOnBuffer (
 \r
 \r
 /**\r
-  This routine is the driver initialization entry point.  It initializes the\r
-  libraries, consumes FV hobs and NT_NON_MM_FV environment variable and\r
-  produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\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
diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.h
new file mode 100644 (file)
index 0000000..0fa4c29
--- /dev/null
@@ -0,0 +1,237 @@
+/** @file\r
+  Firmware Volume Block protocol functions.\r
+  Consumes FV hobs and creates appropriate block protocols.\r
+\r
+Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+All rights reserved. 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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _FWVOL_BLOCK_H_\r
+#define _FWVOL_BLOCK_H_\r
+\r
+\r
+#define FVB_DEVICE_SIGNATURE       EFI_SIGNATURE_32('_','F','V','B')\r
+\r
+\r
+typedef struct {\r
+  UINTN                       Base;\r
+  UINTN                       Length;\r
+} LBA_CACHE;\r
+\r
+\r
+typedef struct {\r
+  MEMMAP_DEVICE_PATH          MemMapDevPath;\r
+  EFI_DEVICE_PATH_PROTOCOL    EndDevPath;\r
+} FV_DEVICE_PATH;\r
+\r
+\r
+typedef struct {\r
+  UINTN                                 Signature;\r
+  EFI_HANDLE                            Handle;\r
+  FV_DEVICE_PATH                        DevicePath;\r
+  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL    FwVolBlockInstance;\r
+  UINTN                                 NumBlocks;\r
+  LBA_CACHE                             *LbaCache;\r
+  UINT32                                FvbAttributes;\r
+  EFI_PHYSICAL_ADDRESS                  BaseAddress;\r
+} EFI_FW_VOL_BLOCK_DEVICE;\r
+\r
+\r
+#define FVB_DEVICE_FROM_THIS(a) \\r
+  CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)\r
+\r
+\r
+/**\r
+  Retrieves Volume attributes.  No polarity translations are done.\r
+\r
+  @param  This                   Calling context\r
+  @param  Attributes             output buffer which contains attributes\r
+\r
+  @retval EFI_SUCCESS            The firmware volume attributes were returned.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FwVolBlockGetAttributes (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  OUT       EFI_FVB_ATTRIBUTES_2                *Attributes\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Modifies the current settings of the firmware volume according to the input parameter.\r
+\r
+  @param  This                   Calling context\r
+  @param  Attributes             input buffer which contains attributes\r
+\r
+  @retval EFI_SUCCESS            The firmware volume attributes were returned.\r
+  @retval EFI_INVALID_PARAMETER  The attributes requested are in conflict with\r
+                                 the capabilities as declared in the firmware\r
+                                 volume header.\r
+  @retval EFI_UNSUPPORTED        Not supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FwVolBlockSetAttributes (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  IN CONST  EFI_FVB_ATTRIBUTES_2                *Attributes\r
+  );\r
+\r
+\r
+\r
+/**\r
+  The EraseBlock() function erases one or more blocks as denoted by the\r
+  variable argument list. The entire parameter list of blocks must be verified\r
+  prior to erasing any blocks.  If a block is requested that does not exist\r
+  within the associated firmware volume (it has a larger index than the last\r
+  block of the firmware volume), the EraseBlock() function must return\r
+  EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.\r
+\r
+  @param  This                   Calling context\r
+  @param  ...                    Starting LBA followed by Number of Lba to erase.\r
+                                 a -1 to terminate the list.\r
+\r
+  @retval EFI_SUCCESS            The erase request was successfully completed.\r
+  @retval EFI_ACCESS_DENIED      The firmware volume is in the WriteDisabled\r
+                                 state.\r
+  @retval EFI_DEVICE_ERROR       The block device is not functioning correctly\r
+                                 and could not be written. The firmware device\r
+                                 may have been partially erased.\r
+  @retval EFI_INVALID_PARAMETER  One or more of the LBAs listed in the variable\r
+                                 argument list do\r
+  @retval EFI_UNSUPPORTED        Not supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FwVolBlockEraseBlock (\r
+  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL    *This,\r
+  ...\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Read the specified number of bytes from the block to the input buffer.\r
+\r
+  @param  This                   Indicates the calling context.\r
+  @param  Lba                    The starting logical block index to read.\r
+  @param  Offset                 Offset into the block at which to begin reading.\r
+  @param  NumBytes               Pointer to a UINT32. At entry, *NumBytes\r
+                                 contains the total size of the buffer. At exit,\r
+                                 *NumBytes contains the total number of bytes\r
+                                 actually read.\r
+  @param  Buffer                 Pinter to a caller-allocated buffer that\r
+                                 contains the destine for the read.\r
+\r
+  @retval EFI_SUCCESS            The firmware volume was read successfully.\r
+  @retval EFI_BAD_BUFFER_SIZE    The read was attempted across an LBA boundary.\r
+  @retval EFI_ACCESS_DENIED      Access denied.\r
+  @retval EFI_DEVICE_ERROR       The block device is malfunctioning and could not\r
+                                 be read.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FwVolBlockReadBlock (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL   *This,\r
+  IN CONST  EFI_LBA                              Lba,\r
+  IN CONST  UINTN                                Offset,\r
+  IN OUT    UINTN                                *NumBytes,\r
+  IN OUT    UINT8                                *Buffer\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Writes the specified number of bytes from the input buffer to the block.\r
+\r
+  @param  This                   Indicates the calling context.\r
+  @param  Lba                    The starting logical block index to write to.\r
+  @param  Offset                 Offset into the block at which to begin writing.\r
+  @param  NumBytes               Pointer to a UINT32. At entry, *NumBytes\r
+                                 contains the total size of the buffer. At exit,\r
+                                 *NumBytes contains the total number of bytes\r
+                                 actually written.\r
+  @param  Buffer                 Pinter to a caller-allocated buffer that\r
+                                 contains the source for the write.\r
+\r
+  @retval EFI_SUCCESS            The firmware volume was written successfully.\r
+  @retval EFI_BAD_BUFFER_SIZE    The write was attempted across an LBA boundary.\r
+                                 On output, NumBytes contains the total number of\r
+                                 bytes actually written.\r
+  @retval EFI_ACCESS_DENIED      The firmware volume is in the WriteDisabled\r
+                                 state.\r
+  @retval EFI_DEVICE_ERROR       The block device is malfunctioning and could not\r
+                                 be written.\r
+  @retval EFI_UNSUPPORTED        Not supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FwVolBlockWriteBlock (\r
+  IN     EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL   *This,\r
+  IN     EFI_LBA                              Lba,\r
+  IN     UINTN                                Offset,\r
+  IN OUT UINTN                                *NumBytes,\r
+  IN     UINT8                                *Buffer\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Get Fvb's base address.\r
+\r
+  @param  This                   Indicates the calling context.\r
+  @param  Address                Fvb device base address.\r
+\r
+  @retval EFI_SUCCESS            Successfully got Fvb's base address.\r
+  @retval EFI_UNSUPPORTED        Not supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FwVolBlockGetPhysicalAddress (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  OUT       EFI_PHYSICAL_ADDRESS                *Address\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Retrieves the size in bytes of a specific block within a firmware volume.\r
+\r
+  @param  This                   Indicates the calling context.\r
+  @param  Lba                    Indicates the block for which to return the\r
+                                 size.\r
+  @param  BlockSize              Pointer to a caller-allocated UINTN in which the\r
+                                 size of the block is returned.\r
+  @param  NumberOfBlocks         Pointer to a caller-allocated UINTN in which the\r
+                                 number of consecutive blocks starting with Lba\r
+                                 is returned. All blocks in this range have a\r
+                                 size of BlockSize.\r
+\r
+  @retval EFI_SUCCESS            The firmware volume base address is returned.\r
+  @retval EFI_INVALID_PARAMETER  The requested LBA is out of range.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FwVolBlockGetBlockSize (\r
+  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *This,\r
+  IN CONST  EFI_LBA                             Lba,\r
+  IN OUT    UINTN                               *BlockSize,\r
+  IN OUT    UINTN                               *NumberOfBlocks\r
+  );\r
+\r
+\r
+#endif\r
diff --git a/MdeModulePkg/Core/Dxe/FwVolDriver.h b/MdeModulePkg/Core/Dxe/FwVolDriver.h
deleted file mode 100644 (file)
index 5acbacc..0000000
+++ /dev/null
@@ -1,469 +0,0 @@
-/** @file\r
-  Firmware File System protocol. Layers on top of Firmware\r
-  Block protocol to produce a file abstraction of FV based files.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __FW_VOL_DRIVER_H_\r
-#define __FW_VOL_DRIVER_H_\r
-\r
-\r
-#define FV2_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('_', 'F', 'V', '2')\r
-\r
-//\r
-// Used to track all non-deleted files\r
-//\r
-typedef struct {\r
-  LIST_ENTRY                      Link;\r
-  EFI_FFS_FILE_HEADER             *FfsHeader;\r
-  UINTN                           StreamHandle;\r
-} FFS_FILE_LIST_ENTRY;\r
-\r
-typedef struct {\r
-  UINTN                                   Signature;\r
-  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL      *Fvb;\r
-  EFI_HANDLE                              Handle;\r
-  EFI_FIRMWARE_VOLUME2_PROTOCOL           Fv;\r
-\r
-  EFI_FIRMWARE_VOLUME_HEADER              *FwVolHeader;\r
-  UINT8                                   *CachedFv;\r
-  UINT8                                   *EndOfCachedFv;\r
-\r
-  FFS_FILE_LIST_ENTRY                     *LastKey;\r
-\r
-  LIST_ENTRY                              FfsFileListHeader;\r
-\r
-  UINT8                                   ErasePolarity;\r
-} FV_DEVICE;\r
-\r
-#define FV_DEVICE_FROM_THIS(a) CR(a, FV_DEVICE, Fv, FV2_DEVICE_SIGNATURE)\r
-\r
-/**\r
-  Retrieves attributes, insures positive polarity of attribute bits, returns\r
-  resulting attributes in output parameter.\r
-\r
-  @param  This             Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
-  @param  Attributes       output buffer which contains attributes.\r
-\r
-  @retval EFI_SUCCESS      Successfully got volume attributes.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvGetVolumeAttributes (\r
-  IN  CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
-  OUT       EFI_FV_ATTRIBUTES             *Attributes\r
-  );\r
-\r
-\r
-/**\r
-  Sets current attributes for volume\r
-\r
-  @param  This             Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
-  @param  Attributes       At input, contains attributes to be set.  At output\r
-                           contains new value of FV.\r
-\r
-  @retval EFI_UNSUPPORTED  Could not be set.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvSetVolumeAttributes (\r
-  IN     CONST EFI_FIRMWARE_VOLUME2_PROTOCOL  *This,\r
-  IN OUT       EFI_FV_ATTRIBUTES              *Attributes\r
-  );\r
-\r
-\r
-/**\r
-  Given the input key, search for the next matching file in the volume.\r
-\r
-  @param  This                       Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
-  @param  Key                        Key is a pointer to a caller allocated\r
-                                     buffer that contains implementation specific\r
-                                     data that is used to track where to begin\r
-                                     the search for the next file. The size of\r
-                                     the buffer must be at least This->KeySize\r
-                                     bytes long. To reinitialize the search and\r
-                                     begin from the beginning of the firmware\r
-                                     volume, the entire buffer must be cleared to\r
-                                     zero. Other than clearing the buffer to\r
-                                     initiate a new search, the caller must not\r
-                                     modify the data in the buffer between calls\r
-                                     to GetNextFile().\r
-  @param  FileType                   FileType is a pointer to a caller allocated\r
-                                     EFI_FV_FILETYPE. The GetNextFile() API can\r
-                                     filter it's search for files based on the\r
-                                     value of *FileType input. A *FileType input\r
-                                     of 0 causes GetNextFile() to search for\r
-                                     files of all types.  If a file is found, the\r
-                                     file's type is returned in *FileType.\r
-                                     *FileType is not modified if no file is\r
-                                     found.\r
-  @param  NameGuid                   NameGuid is a pointer to a caller allocated\r
-                                     EFI_GUID. If a file is found, the file's\r
-                                     name is returned in *NameGuid.  *NameGuid is\r
-                                     not modified if no file is found.\r
-  @param  Attributes                 Attributes is a pointer to a caller\r
-                                     allocated EFI_FV_FILE_ATTRIBUTES.  If a file\r
-                                     is found, the file's attributes are returned\r
-                                     in *Attributes. *Attributes is not modified\r
-                                     if no file is found.\r
-  @param  Size                       Size is a pointer to a caller allocated\r
-                                     UINTN. If a file is found, the file's size\r
-                                     is returned in *Size. *Size is not modified\r
-                                     if no file is found.\r
-\r
-  @retval EFI_SUCCESS                Successfully find the file.\r
-  @retval EFI_DEVICE_ERROR           Device error.\r
-  @retval EFI_ACCESS_DENIED          Fv could not read.\r
-  @retval EFI_NOT_FOUND              No matching file found.\r
-  @retval EFI_INVALID_PARAMETER      Invalid parameter\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvGetNextFile (\r
-  IN CONST   EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
-  IN OUT     VOID                          *Key,\r
-  IN OUT     EFI_FV_FILETYPE               *FileType,\r
-  OUT        EFI_GUID                      *NameGuid,\r
-  OUT        EFI_FV_FILE_ATTRIBUTES        *Attributes,\r
-  OUT        UINTN                         *Size\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Locates a file in the firmware volume and\r
-  copies it to the supplied buffer.\r
-\r
-  @param  This                       Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
-  @param  NameGuid                   Pointer to an EFI_GUID, which is the\r
-                                     filename.\r
-  @param  Buffer                     Buffer is a pointer to pointer to a buffer\r
-                                     in which the file or section contents or are\r
-                                     returned.\r
-  @param  BufferSize                 BufferSize is a pointer to caller allocated\r
-                                     UINTN. On input *BufferSize indicates the\r
-                                     size in bytes of the memory region pointed\r
-                                     to by Buffer. On output, *BufferSize\r
-                                     contains the number of bytes required to\r
-                                     read the file.\r
-  @param  FoundType                  FoundType is a pointer to a caller allocated\r
-                                     EFI_FV_FILETYPE that on successful return\r
-                                     from Read() contains the type of file read.\r
-                                     This output reflects the file type\r
-                                     irrespective of the value of the SectionType\r
-                                     input.\r
-  @param  FileAttributes             FileAttributes is a pointer to a caller\r
-                                     allocated EFI_FV_FILE_ATTRIBUTES.  On\r
-                                     successful return from Read(),\r
-                                     *FileAttributes contains the attributes of\r
-                                     the file read.\r
-  @param  AuthenticationStatus       AuthenticationStatus is a pointer to a\r
-                                     caller allocated UINTN in which the\r
-                                     authentication status is returned.\r
-\r
-  @retval EFI_SUCCESS                Successfully read to memory buffer.\r
-  @retval EFI_WARN_BUFFER_TOO_SMALL  Buffer too small.\r
-  @retval EFI_NOT_FOUND              Not found.\r
-  @retval EFI_DEVICE_ERROR           Device error.\r
-  @retval EFI_ACCESS_DENIED          Could not read.\r
-  @retval EFI_INVALID_PARAMETER      Invalid parameter.\r
-  @retval EFI_OUT_OF_RESOURCES       Not enough buffer to be allocated.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvReadFile (\r
-  IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
-  IN CONST EFI_GUID                      *NameGuid,\r
-  IN OUT   VOID                          **Buffer,\r
-  IN OUT   UINTN                         *BufferSize,\r
-  OUT      EFI_FV_FILETYPE               *FoundType,\r
-  OUT      EFI_FV_FILE_ATTRIBUTES        *FileAttributes,\r
-  OUT      UINT32                        *AuthenticationStatus\r
-  );\r
-\r
-\r
-/**\r
-  Locates a section in a given FFS File and\r
-  copies it to the supplied buffer (not including section header).\r
-\r
-  @param  This                       Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
-  @param  NameGuid                   Pointer to an EFI_GUID, which is the\r
-                                     filename.\r
-  @param  SectionType                Indicates the section type to return.\r
-  @param  SectionInstance            Indicates which instance of sections with a\r
-                                     type of SectionType to return.\r
-  @param  Buffer                     Buffer is a pointer to pointer to a buffer\r
-                                     in which the file or section contents or are\r
-                                     returned.\r
-  @param  BufferSize                 BufferSize is a pointer to caller allocated\r
-                                     UINTN.\r
-  @param  AuthenticationStatus       AuthenticationStatus is a pointer to a\r
-                                     caller allocated UINT32 in which the\r
-                                     authentication status is returned.\r
-\r
-  @retval EFI_SUCCESS                Successfully read the file section into\r
-                                     buffer.\r
-  @retval EFI_WARN_BUFFER_TOO_SMALL  Buffer too small.\r
-  @retval EFI_NOT_FOUND              Section not found.\r
-  @retval EFI_DEVICE_ERROR           Device error.\r
-  @retval EFI_ACCESS_DENIED          Could not read.\r
-  @retval EFI_INVALID_PARAMETER      Invalid parameter.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvReadFileSection (\r
-  IN CONST  EFI_FIRMWARE_VOLUME2_PROTOCOL  *This,\r
-  IN CONST  EFI_GUID                       *NameGuid,\r
-  IN        EFI_SECTION_TYPE               SectionType,\r
-  IN        UINTN                          SectionInstance,\r
-  IN OUT    VOID                           **Buffer,\r
-  IN OUT    UINTN                          *BufferSize,\r
-  OUT       UINT32                         *AuthenticationStatus\r
-  );\r
-\r
-\r
-/**\r
-  Writes one or more files to the firmware volume.\r
-\r
-  @param  This                   Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
-  @param  NumberOfFiles          Number of files.\r
-  @param  WritePolicy            WritePolicy indicates the level of reliability\r
-                                 for the write in the event of a power failure or\r
-                                 other system failure during the write operation.\r
-  @param  FileData               FileData is an pointer to an array of\r
-                                 EFI_FV_WRITE_DATA. Each element of array\r
-                                 FileData represents a file to be written.\r
-\r
-  @retval EFI_SUCCESS            Files successfully written to firmware volume\r
-  @retval EFI_OUT_OF_RESOURCES   Not enough buffer to be allocated.\r
-  @retval EFI_DEVICE_ERROR       Device error.\r
-  @retval EFI_WRITE_PROTECTED    Write protected.\r
-  @retval EFI_NOT_FOUND          Not found.\r
-  @retval EFI_INVALID_PARAMETER  Invalid parameter.\r
-  @retval EFI_UNSUPPORTED        This function not supported.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvWriteFile (\r
-  IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL  *This,\r
-  IN       UINT32                         NumberOfFiles,\r
-  IN       EFI_FV_WRITE_POLICY            WritePolicy,\r
-  IN       EFI_FV_WRITE_FILE_DATA         *FileData\r
-  );\r
-\r
-\r
-/**\r
-  Return information of type InformationType for the requested firmware\r
-  volume.\r
-\r
-  @param  This             Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
-  @param  InformationType  InformationType for requested.\r
-  @param  BufferSize       On input, size of Buffer.On output, the amount of data\r
-                           returned in Buffer.\r
-  @param  Buffer           A poniter to the data buffer to return.\r
-\r
-  @retval EFI_SUCCESS      Successfully got volume Information.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvGetVolumeInfo (\r
-  IN  CONST EFI_FIRMWARE_VOLUME2_PROTOCOL       *This,\r
-  IN  CONST EFI_GUID                            *InformationType,\r
-  IN OUT UINTN                                  *BufferSize,\r
-  OUT VOID                                      *Buffer\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Set information of type InformationType for the requested firmware\r
-  volume.\r
-\r
-  @param  This             Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.\r
-  @param  InformationType  InformationType for requested.\r
-  @param  BufferSize       On input, size of Buffer.On output, the amount of data\r
-                           returned in Buffer.\r
-  @param  Buffer           A poniter to the data buffer to return.\r
-\r
-  @retval EFI_SUCCESS      Successfully set volume Information.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FvSetVolumeInfo (\r
-  IN  CONST EFI_FIRMWARE_VOLUME2_PROTOCOL       *This,\r
-  IN  CONST EFI_GUID                            *InformationType,\r
-  IN  UINTN                                     BufferSize,\r
-  IN CONST  VOID                                *Buffer\r
-  );\r
-\r
-//\r
-//Internal functions\r
-//\r
-typedef enum {\r
-  EfiCheckSumUint8    = 0,\r
-  EfiCheckSumUint16   = 1,\r
-  EfiCheckSumUint32   = 2,\r
-  EfiCheckSumUint64   = 3,\r
-  EfiCheckSumMaximum  = 4\r
-} EFI_CHECKSUM_TYPE;\r
-\r
-\r
-\r
-/**\r
-  Check if a block of buffer is erased.\r
-\r
-  @param  ErasePolarity  Erase polarity attribute of the firmware volume\r
-  @param  InBuffer       The buffer to be checked\r
-  @param  BufferSize     Size of the buffer in bytes\r
-\r
-  @retval TRUE           The block of buffer is erased\r
-  @retval FALSE          The block of buffer is not erased\r
-\r
-**/\r
-BOOLEAN\r
-IsBufferErased (\r
-  IN UINT8    ErasePolarity,\r
-  IN VOID     *InBuffer,\r
-  IN UINTN    BufferSize\r
-  );\r
-\r
-\r
-/**\r
-  Get the FFS file state by checking the highest bit set in the header's state field.\r
-\r
-  @param  ErasePolarity  Erase polarity attribute of the firmware volume\r
-  @param  FfsHeader      Points to the FFS file header\r
-\r
-  @return FFS File state\r
-\r
-**/\r
-EFI_FFS_FILE_STATE\r
-GetFileState (\r
-  IN UINT8                ErasePolarity,\r
-  IN EFI_FFS_FILE_HEADER  *FfsHeader\r
-  );\r
-\r
-\r
-/**\r
-  Set the FFS file state.\r
-\r
-  @param  State                      The state to be set.\r
-  @param  FfsHeader                  Points to the FFS file header\r
-\r
-  @return None.\r
-\r
-**/\r
-VOID\r
-SetFileState (\r
-  IN UINT8                State,\r
-  IN EFI_FFS_FILE_HEADER  *FfsHeader\r
-  );\r
-\r
-\r
-/**\r
-  Verify checksum of the firmware volume header.\r
-\r
-  @param  FvHeader       Points to the firmware volume header to be checked\r
-\r
-  @retval TRUE           Checksum verification passed\r
-  @retval FALSE          Checksum verification failed\r
-\r
-**/\r
-BOOLEAN\r
-VerifyFvHeaderChecksum (\r
-  IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r
-  );\r
-\r
-\r
-/**\r
-  Check if it's a valid FFS file header.\r
-\r
-  @param  ErasePolarity  Erase polarity attribute of the firmware volume\r
-  @param  FfsHeader      Points to the FFS file header to be checked\r
-  @param  FileState      FFS file state to be returned\r
-\r
-  @retval TRUE           Valid FFS file header\r
-  @retval FALSE          Invalid FFS file header\r
-\r
-**/\r
-BOOLEAN\r
-IsValidFfsHeader (\r
-  IN UINT8                ErasePolarity,\r
-  IN EFI_FFS_FILE_HEADER  *FfsHeader,\r
-  OUT EFI_FFS_FILE_STATE  *FileState\r
-  );\r
-\r
-\r
-/**\r
-  Check if it's a valid FFS file.\r
-  Here we are sure that it has a valid FFS file header since we must call IsValidFfsHeader() first.\r
-\r
-  @param  ErasePolarity  Erase polarity attribute of the firmware volume\r
-  @param  FfsHeader      Points to the FFS file to be checked\r
-\r
-  @retval TRUE           Valid FFS file\r
-  @retval FALSE          Invalid FFS file\r
-\r
-**/\r
-BOOLEAN\r
-IsValidFfsFile (\r
-  IN UINT8                ErasePolarity,\r
-  IN EFI_FFS_FILE_HEADER  *FfsHeader\r
-  );\r
-\r
-\r
-/**\r
-  given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and\r
-  copy the volume header into it.\r
-\r
-  @param  Fvb                   The FW_VOL_BLOCK_PROTOCOL instance from which to\r
-                                read the volume header\r
-  @param  FwVolHeader           Pointer to pointer to allocated buffer in which\r
-                                the volume header is returned.\r
-\r
-  @retval EFI_OUT_OF_RESOURCES  No enough buffer could be allocated.\r
-  @retval EFI_SUCCESS           Successfully read volume header to the allocated\r
-                                buffer.\r
-\r
-**/\r
-EFI_STATUS\r
-GetFwVolHeader (\r
-  IN     EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL     *Fvb,\r
-  OUT    EFI_FIRMWARE_VOLUME_HEADER             **FwVolHeader\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Check if an FV is consistent and allocate cache for it.\r
-\r
-  @param  FvDevice              A pointer to the FvDevice to be checked.\r
-\r
-  @retval EFI_OUT_OF_RESOURCES  No enough buffer could be allocated.\r
-  @retval EFI_SUCCESS           FV is consistent and cache is allocated.\r
-  @retval EFI_VOLUME_CORRUPTED  File system is corrupted.\r
-\r
-**/\r
-EFI_STATUS\r
-FvCheck (\r
-  IN OUT FV_DEVICE  *FvDevice\r
-  );\r
-\r
-#endif\r
diff --git a/MdeModulePkg/Core/Dxe/Gcd.h b/MdeModulePkg/Core/Dxe/Gcd.h
deleted file mode 100644 (file)
index a2005f8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file\r
-  GCD Operations and data structure used to\r
-  convert from GCD attributes to EFI Memory Map attributes.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _GCD_H_\r
-#define _GCD_H_\r
-\r
-//\r
-// GCD Operations\r
-//\r
-#define GCD_MEMORY_SPACE_OPERATION 0x20\r
-#define GCD_IO_SPACE_OPERATION     0x40\r
-\r
-#define GCD_ADD_MEMORY_OPERATION             (GCD_MEMORY_SPACE_OPERATION | 0)\r
-#define GCD_ALLOCATE_MEMORY_OPERATION        (GCD_MEMORY_SPACE_OPERATION | 1)\r
-#define GCD_FREE_MEMORY_OPERATION            (GCD_MEMORY_SPACE_OPERATION | 2)\r
-#define GCD_REMOVE_MEMORY_OPERATION          (GCD_MEMORY_SPACE_OPERATION | 3)\r
-#define GCD_SET_ATTRIBUTES_MEMORY_OPERATION  (GCD_MEMORY_SPACE_OPERATION | 4)\r
-\r
-#define GCD_ADD_IO_OPERATION                 (GCD_IO_SPACE_OPERATION | 0)\r
-#define GCD_ALLOCATE_IO_OPERATION            (GCD_IO_SPACE_OPERATION | 1)\r
-#define GCD_FREE_IO_OPERATION                (GCD_IO_SPACE_OPERATION | 2)\r
-#define GCD_REMOVE_IO_OPERATION              (GCD_IO_SPACE_OPERATION | 3)\r
-\r
-//\r
-// The data structure used to convert from GCD attributes to EFI Memory Map attributes\r
-//\r
-typedef struct {\r
-  UINT64   Attribute;\r
-  UINT64   Capability;\r
-  BOOLEAN  Memory;\r
-} GCD_ATTRIBUTE_CONVERSION_ENTRY;\r
-\r
-#endif\r
index 88a11a6ffc0d3724da75f4960f1c8f163a21c8af..a379e5c5a7de347d9b2da5b8056517954695dc80 100644 (file)
@@ -15,6 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "Gcd.h"\r
 \r
 #define MINIMUM_INITIAL_MEMORY_SIZE 0x10000\r
 \r
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.h b/MdeModulePkg/Core/Dxe/Gcd/Gcd.h
new file mode 100644 (file)
index 0000000..a2005f8
--- /dev/null
@@ -0,0 +1,45 @@
+/** @file\r
+  GCD Operations and data structure used to\r
+  convert from GCD attributes to EFI Memory Map attributes.\r
+\r
+Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+All rights reserved. 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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _GCD_H_\r
+#define _GCD_H_\r
+\r
+//\r
+// GCD Operations\r
+//\r
+#define GCD_MEMORY_SPACE_OPERATION 0x20\r
+#define GCD_IO_SPACE_OPERATION     0x40\r
+\r
+#define GCD_ADD_MEMORY_OPERATION             (GCD_MEMORY_SPACE_OPERATION | 0)\r
+#define GCD_ALLOCATE_MEMORY_OPERATION        (GCD_MEMORY_SPACE_OPERATION | 1)\r
+#define GCD_FREE_MEMORY_OPERATION            (GCD_MEMORY_SPACE_OPERATION | 2)\r
+#define GCD_REMOVE_MEMORY_OPERATION          (GCD_MEMORY_SPACE_OPERATION | 3)\r
+#define GCD_SET_ATTRIBUTES_MEMORY_OPERATION  (GCD_MEMORY_SPACE_OPERATION | 4)\r
+\r
+#define GCD_ADD_IO_OPERATION                 (GCD_IO_SPACE_OPERATION | 0)\r
+#define GCD_ALLOCATE_IO_OPERATION            (GCD_IO_SPACE_OPERATION | 1)\r
+#define GCD_FREE_IO_OPERATION                (GCD_IO_SPACE_OPERATION | 2)\r
+#define GCD_REMOVE_IO_OPERATION              (GCD_IO_SPACE_OPERATION | 3)\r
+\r
+//\r
+// The data structure used to convert from GCD attributes to EFI Memory Map attributes\r
+//\r
+typedef struct {\r
+  UINT64   Attribute;\r
+  UINT64   Capability;\r
+  BOOLEAN  Memory;\r
+} GCD_ATTRIBUTE_CONVERSION_ENTRY;\r
+\r
+#endif\r
index 74cc5dfca7a9ba6678212e56358f155140156dc2..203a6e6b044fc04d5737855c9cef27b397553570 100644 (file)
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "Handle.h"\r
 \r
 \r
 //\r
index 38e27c4dfd5f9fa64432b39670940da19e438bb8..e817357cd38cebe025476d445b73c30f50bd7507 100644 (file)
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "Handle.h"\r
 \r
 \r
 //\r
diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.h b/MdeModulePkg/Core/Dxe/Hand/Handle.h
new file mode 100644 (file)
index 0000000..f7b85db
--- /dev/null
@@ -0,0 +1,270 @@
+/** @file\r
+  Support functions for managing protocol.\r
+\r
+Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+All rights reserved. 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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef  _HAND_H_\r
+#define  _HAND_H_\r
+\r
+\r
+#define EFI_HANDLE_SIGNATURE            EFI_SIGNATURE_32('h','n','d','l')\r
+\r
+///\r
+/// IHANDLE - contains a list of protocol handles\r
+///\r
+typedef struct {\r
+  UINTN               Signature;\r
+  /// All handles list of IHANDLE\r
+  LIST_ENTRY          AllHandles;\r
+  /// List of PROTOCOL_INTERFACE's for this handle\r
+  LIST_ENTRY          Protocols;      \r
+  UINTN               LocateRequest;\r
+  /// The Handle Database Key value when this handle was last created or modified\r
+  UINT64              Key;\r
+} IHANDLE;\r
+\r
+#define ASSERT_IS_HANDLE(a)  ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)\r
+\r
+#define PROTOCOL_ENTRY_SIGNATURE        EFI_SIGNATURE_32('p','r','t','e')\r
+\r
+///\r
+/// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol\r
+/// database.  Each handler that supports this protocol is listed, along\r
+/// with a list of registered notifies.\r
+///\r
+typedef struct {\r
+  UINTN               Signature;\r
+  /// Link Entry inserted to mProtocolDatabase\r
+  LIST_ENTRY          AllEntries;  \r
+  /// ID of the protocol\r
+  EFI_GUID            ProtocolID;  \r
+  /// All protocol interfaces\r
+  LIST_ENTRY          Protocols;     \r
+  /// Registerd notification handlers\r
+  LIST_ENTRY          Notify;                 \r
+} PROTOCOL_ENTRY;\r
+\r
+\r
+#define PROTOCOL_INTERFACE_SIGNATURE  EFI_SIGNATURE_32('p','i','f','c')\r
+\r
+///\r
+/// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked\r
+/// with a protocol interface structure\r
+///\r
+typedef struct {\r
+  UINTN                       Signature;\r
+  /// Link on IHANDLE.Protocols\r
+  LIST_ENTRY                  Link;   \r
+  /// Back pointer\r
+  IHANDLE                     *Handle;  \r
+  /// Link on PROTOCOL_ENTRY.Protocols\r
+  LIST_ENTRY                  ByProtocol; \r
+  /// The protocol ID\r
+  PROTOCOL_ENTRY              *Protocol;  \r
+  /// The interface value\r
+  VOID                        *Interface; \r
+  /// OPEN_PROTOCOL_DATA list\r
+  LIST_ENTRY                  OpenList;       \r
+  UINTN                       OpenListCount;\r
+\r
+} PROTOCOL_INTERFACE;\r
+\r
+#define OPEN_PROTOCOL_DATA_SIGNATURE  EFI_SIGNATURE_32('p','o','d','l')\r
+\r
+typedef struct {\r
+  UINTN                       Signature;\r
+  ///Link on PROTOCOL_INTERFACE.OpenList\r
+  LIST_ENTRY                  Link;      \r
+\r
+  EFI_HANDLE                  AgentHandle;\r
+  EFI_HANDLE                  ControllerHandle;\r
+  UINT32                      Attributes;\r
+  UINT32                      OpenCount;\r
+} OPEN_PROTOCOL_DATA;\r
+\r
+\r
+#define PROTOCOL_NOTIFY_SIGNATURE       EFI_SIGNATURE_32('p','r','t','n')\r
+\r
+///\r
+/// PROTOCOL_NOTIFY - used for each register notification for a protocol\r
+///\r
+typedef struct {\r
+  UINTN               Signature;\r
+  PROTOCOL_ENTRY      *Protocol;\r
+  /// All notifications for this protocol\r
+  LIST_ENTRY          Link;                   \r
+  /// Event to notify\r
+  EFI_EVENT           Event;    \r
+  /// Last position notified\r
+  LIST_ENTRY          *Position;              \r
+} PROTOCOL_NOTIFY;\r
+\r
+\r
+\r
+/**\r
+  Finds the protocol entry for the requested protocol.\r
+  The gProtocolDatabaseLock must be owned\r
+\r
+  @param  Protocol               The ID of the protocol\r
+  @param  Create                 Create a new entry if not found\r
+\r
+  @return Protocol entry\r
+\r
+**/\r
+PROTOCOL_ENTRY  *\r
+CoreFindProtocolEntry (\r
+  IN EFI_GUID   *Protocol,\r
+  IN BOOLEAN    Create\r
+  );\r
+\r
+\r
+/**\r
+  Signal event for every protocol in protocol entry.\r
+\r
+  @param  ProtEntry              Protocol entry\r
+\r
+**/\r
+VOID\r
+CoreNotifyProtocolEntry (\r
+  IN PROTOCOL_ENTRY   *ProtEntry\r
+  );\r
+\r
+\r
+/**\r
+  Finds the protocol instance for the requested handle and protocol.\r
+  Note: This function doesn't do parameters checking, it's caller's responsibility\r
+  to pass in valid parameters.\r
+\r
+  @param  Handle                 The handle to search the protocol on\r
+  @param  Protocol               GUID of the protocol\r
+  @param  Interface              The interface for the protocol being searched\r
+\r
+  @return Protocol instance (NULL: Not found)\r
+\r
+**/\r
+PROTOCOL_INTERFACE *\r
+CoreFindProtocolInterface (\r
+  IN IHANDLE        *Handle,\r
+  IN EFI_GUID       *Protocol,\r
+  IN VOID           *Interface\r
+  );\r
+\r
+\r
+/**\r
+  Removes Protocol from the protocol list (but not the handle list).\r
+\r
+  @param  Handle                 The handle to remove protocol on.\r
+  @param  Protocol               GUID of the protocol to be moved\r
+  @param  Interface              The interface of the protocol\r
+\r
+  @return Protocol Entry\r
+\r
+**/\r
+PROTOCOL_INTERFACE *\r
+CoreRemoveInterfaceFromProtocol (\r
+  IN IHANDLE        *Handle,\r
+  IN EFI_GUID       *Protocol,\r
+  IN VOID           *Interface\r
+  );\r
+\r
+\r
+/**\r
+  Connects a controller to a driver.\r
+\r
+  @param  ControllerHandle                      Handle of the controller to be\r
+                                                connected.\r
+  @param  ContextDriverImageHandles             DriverImageHandle A pointer to an\r
+                                                ordered list of driver image\r
+                                                handles.\r
+  @param  RemainingDevicePath                   RemainingDevicePath A pointer to\r
+                                                the device path that specifies a\r
+                                                child  of the controller\r
+                                                specified by ControllerHandle.\r
+\r
+  @retval EFI_SUCCESS                           One or more drivers were\r
+                                                connected to ControllerHandle.\r
+  @retval EFI_OUT_OF_RESOURCES                  No enough system resources to\r
+                                                complete the request.\r
+  @retval EFI_NOT_FOUND                         No drivers were connected to\r
+                                                ControllerHandle.\r
+\r
+**/\r
+EFI_STATUS\r
+CoreConnectSingleController (\r
+  IN  EFI_HANDLE                ControllerHandle,\r
+  IN  EFI_HANDLE                *ContextDriverImageHandles OPTIONAL,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *RemainingDevicePath       OPTIONAL\r
+  );\r
+\r
+/**\r
+  Attempts to disconnect all drivers that are using the protocol interface being queried.\r
+  If failed, reconnect all drivers disconnected.\r
+  Note: This function doesn't do parameters checking, it's caller's responsibility\r
+  to pass in valid parameters.\r
+\r
+  @param  UserHandle             The handle on which the protocol is installed\r
+  @param  Prot                   The protocol to disconnect drivers from\r
+\r
+  @retval EFI_SUCCESS            Drivers using the protocol interface are all\r
+                                 disconnected\r
+  @retval EFI_ACCESS_DENIED      Failed to disconnect one or all of the drivers\r
+\r
+**/\r
+EFI_STATUS\r
+CoreDisconnectControllersUsingProtocolInterface (\r
+  IN EFI_HANDLE           UserHandle,\r
+  IN PROTOCOL_INTERFACE   *Prot\r
+  );\r
+\r
+\r
+/**\r
+  Acquire lock on gProtocolDatabaseLock.\r
+\r
+**/\r
+VOID\r
+CoreAcquireProtocolLock (\r
+  VOID\r
+  );\r
+\r
+\r
+/**\r
+  Release lock on gProtocolDatabaseLock.\r
+\r
+**/\r
+VOID\r
+CoreReleaseProtocolLock (\r
+  VOID\r
+  );\r
+\r
+\r
+/**\r
+  Check whether a handle is a valid EFI_HANDLE\r
+\r
+  @param  UserHandle             The handle to check\r
+\r
+  @retval EFI_INVALID_PARAMETER  The handle is NULL or not a valid EFI_HANDLE.\r
+  @retval EFI_SUCCESS            The handle is valid EFI_HANDLE.\r
+\r
+**/\r
+EFI_STATUS\r
+CoreValidateHandle (\r
+  IN  EFI_HANDLE                UserHandle\r
+  );\r
+\r
+//\r
+// Externs\r
+//\r
+extern EFI_LOCK         gProtocolDatabaseLock;\r
+extern LIST_ENTRY       gHandleList;\r
+extern UINT64           gHandleDatabaseKey;\r
+\r
+#endif\r
index de3152107b5f14c17193487fd531a164f4d1ef27..2b961c14d4e19a5fa1f34e31869c39296f1e57f4 100644 (file)
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "Handle.h"\r
 \r
 //\r
 // ProtocolRequest - Last LocateHandle request ID\r
index 572ba12eed776d74691a9afe82c43321e569658e..dd170ac1cc66209740b4f1ea1b7f9fa3c21d44fa 100644 (file)
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "Handle.h"\r
 \r
 \r
 /**\r
diff --git a/MdeModulePkg/Core/Dxe/Handle.h b/MdeModulePkg/Core/Dxe/Handle.h
deleted file mode 100644 (file)
index b73bad9..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-/** @file\r
-  Support functions for managing protocol.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef  _HAND_H_\r
-#define  _HAND_H_\r
-\r
-\r
-//\r
-// IHANDLE - contains a list of protocol handles\r
-//\r
-\r
-#define EFI_HANDLE_SIGNATURE            EFI_SIGNATURE_32('h','n','d','l')\r
-typedef struct {\r
-  UINTN               Signature;\r
-  LIST_ENTRY          AllHandles;     // All handles list of IHANDLE\r
-  LIST_ENTRY          Protocols;      // List of PROTOCOL_INTERFACE's for this handle\r
-  UINTN               LocateRequest;  //\r
-  UINT64              Key;            // The Handle Database Key value when this handle was last created or modified\r
-} IHANDLE;\r
-\r
-#define ASSERT_IS_HANDLE(a)  ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)\r
-\r
-\r
-//\r
-// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol\r
-// database.  Each handler that supports this protocol is listed, along\r
-// with a list of registered notifies.\r
-//\r
-\r
-#define PROTOCOL_ENTRY_SIGNATURE        EFI_SIGNATURE_32('p','r','t','e')\r
-typedef struct {\r
-  UINTN               Signature;\r
-  LIST_ENTRY          AllEntries;             // Link Entry inserted to mProtocolDatabase\r
-  EFI_GUID            ProtocolID;             // ID of the protocol\r
-  LIST_ENTRY          Protocols;              // All protocol interfaces\r
-  LIST_ENTRY          Notify;                 // Registerd notification handlers\r
-} PROTOCOL_ENTRY;\r
-\r
-//\r
-// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked\r
-// with a protocol interface structure\r
-//\r
-\r
-#define PROTOCOL_INTERFACE_SIGNATURE  EFI_SIGNATURE_32('p','i','f','c')\r
-typedef struct {\r
-  UINTN                       Signature;\r
-  LIST_ENTRY                  Link;       // Link on IHANDLE.Protocols\r
-  IHANDLE                     *Handle;    // Back pointer\r
-  LIST_ENTRY                  ByProtocol; // Link on PROTOCOL_ENTRY.Protocols\r
-  PROTOCOL_ENTRY              *Protocol;  // The protocol ID\r
-  VOID                        *Interface; // The interface value\r
-\r
-  LIST_ENTRY                  OpenList;       // OPEN_PROTOCOL_DATA list.\r
-  UINTN                       OpenListCount;\r
-\r
-} PROTOCOL_INTERFACE;\r
-\r
-#define OPEN_PROTOCOL_DATA_SIGNATURE  EFI_SIGNATURE_32('p','o','d','l')\r
-\r
-typedef struct {\r
-  UINTN                       Signature;\r
-  LIST_ENTRY                  Link;      //Link on PROTOCOL_INTERFACE.OpenList\r
-\r
-  EFI_HANDLE                  AgentHandle;\r
-  EFI_HANDLE                  ControllerHandle;\r
-  UINT32                      Attributes;\r
-  UINT32                      OpenCount;\r
-} OPEN_PROTOCOL_DATA;\r
-\r
-\r
-//\r
-// PROTOCOL_NOTIFY - used for each register notification for a protocol\r
-//\r
-\r
-#define PROTOCOL_NOTIFY_SIGNATURE       EFI_SIGNATURE_32('p','r','t','n')\r
-typedef struct {\r
-  UINTN               Signature;\r
-  PROTOCOL_ENTRY      *Protocol;\r
-  LIST_ENTRY          Link;                   // All notifications for this protocol\r
-  EFI_EVENT           Event;                  // Event to notify\r
-  LIST_ENTRY          *Position;              // Last position notified\r
-} PROTOCOL_NOTIFY;\r
-\r
-//\r
-// Internal prototypes\r
-//\r
-\r
-\r
-\r
-/**\r
-  Finds the protocol entry for the requested protocol.\r
-  The gProtocolDatabaseLock must be owned\r
-\r
-  @param  Protocol               The ID of the protocol\r
-  @param  Create                 Create a new entry if not found\r
-\r
-  @return Protocol entry\r
-\r
-**/\r
-PROTOCOL_ENTRY  *\r
-CoreFindProtocolEntry (\r
-  IN EFI_GUID   *Protocol,\r
-  IN BOOLEAN    Create\r
-  );\r
-\r
-\r
-/**\r
-  Signal event for every protocol in protocol entry.\r
-\r
-  @param  ProtEntry              Protocol entry\r
-\r
-**/\r
-VOID\r
-CoreNotifyProtocolEntry (\r
-  IN PROTOCOL_ENTRY   *ProtEntry\r
-  );\r
-\r
-\r
-/**\r
-  Finds the protocol instance for the requested handle and protocol.\r
-  Note: This function doesn't do parameters checking, it's caller's responsibility\r
-  to pass in valid parameters.\r
-\r
-  @param  Handle                 The handle to search the protocol on\r
-  @param  Protocol               GUID of the protocol\r
-  @param  Interface              The interface for the protocol being searched\r
-\r
-  @return Protocol instance (NULL: Not found)\r
-\r
-**/\r
-PROTOCOL_INTERFACE *\r
-CoreFindProtocolInterface (\r
-  IN IHANDLE        *Handle,\r
-  IN EFI_GUID       *Protocol,\r
-  IN VOID           *Interface\r
-  );\r
-\r
-\r
-/**\r
-  Removes Protocol from the protocol list (but not the handle list).\r
-\r
-  @param  Handle                 The handle to remove protocol on.\r
-  @param  Protocol               GUID of the protocol to be moved\r
-  @param  Interface              The interface of the protocol\r
-\r
-  @return Protocol Entry\r
-\r
-**/\r
-PROTOCOL_INTERFACE *\r
-CoreRemoveInterfaceFromProtocol (\r
-  IN IHANDLE        *Handle,\r
-  IN EFI_GUID       *Protocol,\r
-  IN VOID           *Interface\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
-  Connects a controller to a driver.\r
-\r
-  @param  ControllerHandle                      Handle of the controller to be\r
-                                                connected.\r
-  @param  ContextDriverImageHandles             DriverImageHandle A pointer to an\r
-                                                ordered list of driver image\r
-                                                handles.\r
-  @param  RemainingDevicePath                   RemainingDevicePath A pointer to\r
-                                                the device path that specifies a\r
-                                                child  of the controller\r
-                                                specified by ControllerHandle.\r
-\r
-  @retval EFI_SUCCESS                           One or more drivers were\r
-                                                connected to ControllerHandle.\r
-  @retval EFI_OUT_OF_RESOURCES                  No enough system resources to\r
-                                                complete the request.\r
-  @retval EFI_NOT_FOUND                         No drivers were connected to\r
-                                                ControllerHandle.\r
-\r
-**/\r
-EFI_STATUS\r
-CoreConnectSingleController (\r
-  IN  EFI_HANDLE                ControllerHandle,\r
-  IN  EFI_HANDLE                *ContextDriverImageHandles OPTIONAL,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL  *RemainingDevicePath       OPTIONAL\r
-  );\r
-\r
-/**\r
-  Attempts to disconnect all drivers that are using the protocol interface being queried.\r
-  If failed, reconnect all drivers disconnected.\r
-  Note: This function doesn't do parameters checking, it's caller's responsibility\r
-  to pass in valid parameters.\r
-\r
-  @param  UserHandle             The handle on which the protocol is installed\r
-  @param  Prot                   The protocol to disconnect drivers from\r
-\r
-  @retval EFI_SUCCESS            Drivers using the protocol interface are all\r
-                                 disconnected\r
-  @retval EFI_ACCESS_DENIED      Failed to disconnect one or all of the drivers\r
-\r
-**/\r
-EFI_STATUS\r
-CoreDisconnectControllersUsingProtocolInterface (\r
-  IN EFI_HANDLE           UserHandle,\r
-  IN PROTOCOL_INTERFACE   *Prot\r
-  );\r
-\r
-\r
-/**\r
-  Acquire lock on gProtocolDatabaseLock.\r
-\r
-**/\r
-VOID\r
-CoreAcquireProtocolLock (\r
-  VOID\r
-  );\r
-\r
-\r
-/**\r
-  Release lock on gProtocolDatabaseLock.\r
-\r
-**/\r
-VOID\r
-CoreReleaseProtocolLock (\r
-  VOID\r
-  );\r
-\r
-\r
-/**\r
-  Check whether a handle is a valid EFI_HANDLE\r
-\r
-  @param  UserHandle             The handle to check\r
-\r
-  @retval EFI_INVALID_PARAMETER  The handle is NULL or not a valid EFI_HANDLE.\r
-  @retval EFI_SUCCESS            The handle is valid EFI_HANDLE.\r
-\r
-**/\r
-EFI_STATUS\r
-CoreValidateHandle (\r
-  IN  EFI_HANDLE                UserHandle\r
-  );\r
-\r
-//\r
-// Externs\r
-//\r
-\r
-extern EFI_LOCK         gProtocolDatabaseLock;\r
-extern LIST_ENTRY       gHandleList;\r
-extern UINT64           gHandleDatabaseKey;\r
-\r
-#endif\r
diff --git a/MdeModulePkg/Core/Dxe/Image.h b/MdeModulePkg/Core/Dxe/Image.h
deleted file mode 100644 (file)
index 040941d..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-/** @file\r
-  Data structure and functions to load and unload PeImage.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-\r
-#ifndef _IMAGE_H_\r
-#define _IMAGE_H_\r
-\r
-\r
-\r
-#define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE   EFI_SIGNATURE_32('l','d','r','i')\r
-\r
-typedef struct {\r
-    UINTN                       Signature;\r
-    EFI_HANDLE                  Handle;         // Image handle\r
-    UINTN                       Type;           // Image type\r
-\r
-    BOOLEAN                     Started;        // If entrypoint has been called\r
-\r
-    EFI_IMAGE_ENTRY_POINT       EntryPoint;     // The image's entry point\r
-    EFI_LOADED_IMAGE_PROTOCOL   Info;           // loaded image protocol\r
-\r
-    EFI_PHYSICAL_ADDRESS        ImageBasePage;  // Location in memory\r
-    UINTN                       NumberOfPages;  // Number of pages\r
-\r
-    CHAR8                       *FixupData;     // Original fixup data\r
-\r
-    EFI_TPL                     Tpl;            // Tpl of started image\r
-    EFI_STATUS                  Status;         // Status returned by started image\r
-\r
-    UINTN                       ExitDataSize;   // Size of ExitData from started image\r
-    VOID                        *ExitData;      // Pointer to exit data from started image\r
-    VOID                        *JumpBuffer;    // Pointer to pool allocation for context save/retore\r
-    BASE_LIBRARY_JUMP_BUFFER    *JumpContext;   // Pointer to buffer for context save/retore\r
-    UINT16                      Machine;        // Machine type from PE image\r
-\r
-    EFI_EBC_PROTOCOL            *Ebc;           // EBC Protocol pointer\r
-\r
-    EFI_RUNTIME_IMAGE_ENTRY     *RuntimeData;   // Runtime image list\r
-\r
-    EFI_DEVICE_PATH_PROTOCOL    *LoadedImageDevicePath;  // Pointer to Loaded Image Device Path Protocl\r
-\r
-    PE_COFF_LOADER_IMAGE_CONTEXT  ImageContext; // PeCoffLoader ImageContext\r
-\r
-} LOADED_IMAGE_PRIVATE_DATA;\r
-\r
-#define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r
-          CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)\r
-\r
-\r
-\r
-#define LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE  EFI_SIGNATURE_32('l','p','e','i')\r
-\r
-typedef struct {\r
-    UINTN                       Signature;\r
-    EFI_HANDLE                  Handle;         // Image handle\r
-    EFI_PE32_IMAGE_PROTOCOL     Pe32Image;\r
-} LOAD_PE32_IMAGE_PRIVATE_DATA;\r
-\r
-#define LOAD_PE32_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r
-          CR(a, LOAD_PE32_IMAGE_PRIVATE_DATA, Pe32Image, LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE)\r
-\r
-\r
-\r
-//\r
-// Private Data Types\r
-//\r
-#define IMAGE_FILE_HANDLE_SIGNATURE       EFI_SIGNATURE_32('i','m','g','f')\r
-typedef struct {\r
-  UINTN               Signature;\r
-  BOOLEAN             FreeBuffer;\r
-  VOID                *Source;\r
-  UINTN               SourceSize;\r
-} IMAGE_FILE_HANDLE;\r
-\r
-\r
-//\r
-// Abstractions for reading image contents\r
-//\r
-\r
-\r
-/**\r
-  Opens a file for (simple) reading.  The simple read abstraction\r
-  will access the file either from a memory copy, from a file\r
-  system interface, or from the load file interface.\r
-\r
-  @param  BootPolicy             Policy for Open Image File.\r
-  @param  SourceBuffer           Pointer to the memory location containing copy\r
-                                 of the image to be loaded.\r
-  @param  SourceSize             The size in bytes of SourceBuffer.\r
-  @param  FilePath               The specific file path from which the image is\r
-                                 loaded\r
-  @param  DeviceHandle           Pointer to the return device handle.\r
-  @param  ImageFileHandle        Pointer to the image file handle.\r
-  @param  AuthenticationStatus   Pointer to a caller-allocated UINT32 in which\r
-                                 the authentication status is returned.\r
-\r
-  @retval EFI_SUCCESS            Image file successfully opened.\r
-  @retval EFI_LOAD_ERROR         If the caller passed a copy of the file, and\r
-                                 SourceSize is 0.\r
-  @retval EFI_INVALID_PARAMETER  File path is not valid.\r
-  @retval EFI_NOT_FOUND          File not found.\r
-\r
-**/\r
-EFI_STATUS\r
-CoreOpenImageFile (\r
-  IN BOOLEAN                        BootPolicy,\r
-  IN VOID                           *SourceBuffer   OPTIONAL,\r
-  IN UINTN                          SourceSize,\r
-  IN OUT EFI_DEVICE_PATH_PROTOCOL   **FilePath,\r
-  OUT EFI_HANDLE                    *DeviceHandle,\r
-  IN IMAGE_FILE_HANDLE              *ImageFileHandle,\r
-  OUT UINT32                        *AuthenticationStatus\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Read image file (specified by UserHandle) into user specified buffer with specified offset\r
-  and length.\r
-\r
-  @param  UserHandle             Image file handle\r
-  @param  Offset                 Offset to the source file\r
-  @param  ReadSize               For input, pointer of size to read; For output,\r
-                                 pointer of size actually read.\r
-  @param  Buffer                 Buffer to write into\r
-\r
-  @retval EFI_SUCCESS            Successfully read the specified part of file\r
-                                 into buffer.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-CoreReadImageFile (\r
-  IN     VOID    *UserHandle,\r
-  IN     UINTN   Offset,\r
-  IN OUT UINTN   *ReadSize,\r
-  OUT    VOID    *Buffer\r
-  );\r
-\r
-\r
-/**\r
-  A function out of date, should be removed.\r
-\r
-  @param  ImageFileHandle        Handle of the file to close\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-CoreCloseImageFile (\r
-  IN IMAGE_FILE_HANDLE *ImageFileHandle\r
-  );\r
-\r
-\r
-\r
-//\r
-// Exported Image functions\r
-//\r
-\r
-\r
-/**\r
-  Loads an EFI image into memory and returns a handle to the image with extended parameters.\r
-\r
-  @param  This                    Calling context\r
-  @param  ParentImageHandle       The caller's image handle.\r
-  @param  FilePath                The specific file path from which the image is\r
-                                  loaded.\r
-  @param  SourceBuffer            If not NULL, a pointer to the memory location\r
-                                  containing a copy of the image to be loaded.\r
-  @param  SourceSize              The size in bytes of SourceBuffer.\r
-  @param  DstBuffer               The buffer to store the image.\r
-  @param  NumberOfPages           For input, specifies the space size of the\r
-                                  image by caller if not NULL. For output,\r
-                                  specifies the actual space size needed.\r
-  @param  ImageHandle             Image handle for output.\r
-  @param  EntryPoint              Image entry point for output.\r
-  @param  Attribute               The bit mask of attributes to set for the load\r
-                                  PE image.\r
-\r
-  @retval EFI_SUCCESS             The image was loaded into memory.\r
-  @retval EFI_NOT_FOUND           The FilePath was not found.\r
-  @retval EFI_INVALID_PARAMETER   One of the parameters has an invalid value.\r
-  @retval EFI_UNSUPPORTED         The image type is not supported, or the device\r
-                                  path cannot be parsed to locate the proper\r
-                                  protocol for loading the file.\r
-  @retval EFI_OUT_OF_RESOURCES    Image was not loaded due to insufficient\r
-                                  resources.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-CoreLoadImageEx (\r
-  IN  EFI_PE32_IMAGE_PROTOCOL          *This,\r
-  IN  EFI_HANDLE                       ParentImageHandle,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL         *FilePath,\r
-  IN  VOID                             *SourceBuffer       OPTIONAL,\r
-  IN  UINTN                            SourceSize,\r
-  IN  EFI_PHYSICAL_ADDRESS             DstBuffer           OPTIONAL,\r
-  OUT UINTN                            *NumberOfPages      OPTIONAL,\r
-  OUT EFI_HANDLE                       *ImageHandle,\r
-  OUT EFI_PHYSICAL_ADDRESS             *EntryPoint         OPTIONAL,\r
-  IN  UINT32                           Attribute\r
-  );\r
-\r
-\r
-/**\r
-  Unload the specified image.\r
-\r
-  @param  This                    Indicates the calling context.\r
-  @param  ImageHandle             The specified image handle.\r
-\r
-  @retval EFI_INVALID_PARAMETER   Image handle is NULL.\r
-  @retval EFI_UNSUPPORTED         Attempt to unload an unsupported image.\r
-  @retval EFI_SUCCESS             Image successfully unloaded.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-CoreUnloadImageEx (\r
-  IN EFI_PE32_IMAGE_PROTOCOL  *This,\r
-  IN EFI_HANDLE                         ImageHandle\r
-  );\r
-#endif\r
index 954710c38fcad68dffbd4f97152fa3b05556afca..6f89ddc24b3a905f63d327448f0078ee11aa5c9a 100644 (file)
@@ -13,10 +13,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "Image.h"\r
+\r
 //\r
 // Module Globals\r
 //\r
-\r
 LOADED_IMAGE_PRIVATE_DATA  *mCurrentImage = NULL;\r
 \r
 LOAD_PE32_IMAGE_PRIVATE_DATA  mLoadPe32PrivateData = {\r
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.h b/MdeModulePkg/Core/Dxe/Image/Image.h
new file mode 100644 (file)
index 0000000..3766020
--- /dev/null
@@ -0,0 +1,215 @@
+/** @file\r
+  Data structure and functions to load and unload PeImage.\r
+\r
+Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+All rights reserved. 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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+\r
+#ifndef _IMAGE_H_\r
+#define _IMAGE_H_\r
+\r
+#define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE   EFI_SIGNATURE_32('l','d','r','i')\r
+\r
+typedef struct {\r
+    UINTN                       Signature;\r
+       /// Image handle\r
+    EFI_HANDLE                  Handle;   \r
+       /// Image type\r
+    UINTN                       Type;           \r
+       /// If entrypoint has been called\r
+    BOOLEAN                     Started;        \r
+       /// The image's entry point\r
+    EFI_IMAGE_ENTRY_POINT       EntryPoint;     \r
+       /// loaded image protocol\r
+    EFI_LOADED_IMAGE_PROTOCOL   Info;           \r
+       /// Location in memory\r
+    EFI_PHYSICAL_ADDRESS        ImageBasePage;  \r
+       /// Number of pages\r
+    UINTN                       NumberOfPages;  \r
+       /// Original fixup data\r
+    CHAR8                       *FixupData;     \r
+       /// Tpl of started image\r
+    EFI_TPL                     Tpl;            \r
+       /// Status returned by started image\r
+    EFI_STATUS                  Status;         \r
+       /// Size of ExitData from started image\r
+    UINTN                       ExitDataSize;   \r
+       /// Pointer to exit data from started image\r
+    VOID                        *ExitData;      \r
+       /// Pointer to pool allocation for context save/retore\r
+    VOID                        *JumpBuffer;    \r
+       /// Pointer to buffer for context save/retore\r
+    BASE_LIBRARY_JUMP_BUFFER    *JumpContext;  \r
+       /// Machine type from PE image\r
+    UINT16                      Machine;        \r
+       /// EBC Protocol pointer\r
+    EFI_EBC_PROTOCOL            *Ebc;           \r
+       /// Runtime image list\r
+    EFI_RUNTIME_IMAGE_ENTRY     *RuntimeData;   \r
+       /// Pointer to Loaded Image Device Path Protocl\r
+    EFI_DEVICE_PATH_PROTOCOL    *LoadedImageDevicePath;  \r
+       /// PeCoffLoader ImageContext\r
+    PE_COFF_LOADER_IMAGE_CONTEXT  ImageContext; \r
+\r
+} LOADED_IMAGE_PRIVATE_DATA;\r
+\r
+#define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r
+          CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)\r
+\r
+\r
+#define LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE  EFI_SIGNATURE_32('l','p','e','i')\r
+\r
+typedef struct {\r
+    UINTN                       Signature;\r
+       /// Image handle\r
+    EFI_HANDLE                  Handle;         \r
+    EFI_PE32_IMAGE_PROTOCOL     Pe32Image;\r
+} LOAD_PE32_IMAGE_PRIVATE_DATA;\r
+\r
+#define LOAD_PE32_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r
+          CR(a, LOAD_PE32_IMAGE_PRIVATE_DATA, Pe32Image, LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE)\r
+\r
+\r
+//\r
+// Private Data Types\r
+//\r
+#define IMAGE_FILE_HANDLE_SIGNATURE       EFI_SIGNATURE_32('i','m','g','f')\r
+typedef struct {\r
+  UINTN               Signature;\r
+  BOOLEAN             FreeBuffer;\r
+  VOID                *Source;\r
+  UINTN               SourceSize;\r
+} IMAGE_FILE_HANDLE;\r
+\r
+\r
+/**\r
+  Opens a file for (simple) reading.  The simple read abstraction\r
+  will access the file either from a memory copy, from a file\r
+  system interface, or from the load file interface.\r
+\r
+  @param  BootPolicy             Policy for Open Image File.\r
+  @param  SourceBuffer           Pointer to the memory location containing copy\r
+                                 of the image to be loaded.\r
+  @param  SourceSize             The size in bytes of SourceBuffer.\r
+  @param  FilePath               The specific file path from which the image is\r
+                                 loaded\r
+  @param  DeviceHandle           Pointer to the return device handle.\r
+  @param  ImageFileHandle        Pointer to the image file handle.\r
+  @param  AuthenticationStatus   Pointer to a caller-allocated UINT32 in which\r
+                                 the authentication status is returned.\r
+\r
+  @retval EFI_SUCCESS            Image file successfully opened.\r
+  @retval EFI_LOAD_ERROR         If the caller passed a copy of the file, and\r
+                                 SourceSize is 0.\r
+  @retval EFI_INVALID_PARAMETER  File path is not valid.\r
+  @retval EFI_NOT_FOUND          File not found.\r
+\r
+**/\r
+EFI_STATUS\r
+CoreOpenImageFile (\r
+  IN BOOLEAN                        BootPolicy,\r
+  IN VOID                           *SourceBuffer   OPTIONAL,\r
+  IN UINTN                          SourceSize,\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL   **FilePath,\r
+  OUT EFI_HANDLE                    *DeviceHandle,\r
+  IN IMAGE_FILE_HANDLE              *ImageFileHandle,\r
+  OUT UINT32                        *AuthenticationStatus\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Read image file (specified by UserHandle) into user specified buffer with specified offset\r
+  and length.\r
+\r
+  @param  UserHandle             Image file handle\r
+  @param  Offset                 Offset to the source file\r
+  @param  ReadSize               For input, pointer of size to read; For output,\r
+                                 pointer of size actually read.\r
+  @param  Buffer                 Buffer to write into\r
+\r
+  @retval EFI_SUCCESS            Successfully read the specified part of file\r
+                                 into buffer.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreReadImageFile (\r
+  IN     VOID    *UserHandle,\r
+  IN     UINTN   Offset,\r
+  IN OUT UINTN   *ReadSize,\r
+  OUT    VOID    *Buffer\r
+  );\r
+\r
+\r
+/**\r
+  Loads an EFI image into memory and returns a handle to the image with extended parameters.\r
+\r
+  @param  This                    Calling context\r
+  @param  ParentImageHandle       The caller's image handle.\r
+  @param  FilePath                The specific file path from which the image is\r
+                                  loaded.\r
+  @param  SourceBuffer            If not NULL, a pointer to the memory location\r
+                                  containing a copy of the image to be loaded.\r
+  @param  SourceSize              The size in bytes of SourceBuffer.\r
+  @param  DstBuffer               The buffer to store the image.\r
+  @param  NumberOfPages           For input, specifies the space size of the\r
+                                  image by caller if not NULL. For output,\r
+                                  specifies the actual space size needed.\r
+  @param  ImageHandle             Image handle for output.\r
+  @param  EntryPoint              Image entry point for output.\r
+  @param  Attribute               The bit mask of attributes to set for the load\r
+                                  PE image.\r
+\r
+  @retval EFI_SUCCESS             The image was loaded into memory.\r
+  @retval EFI_NOT_FOUND           The FilePath was not found.\r
+  @retval EFI_INVALID_PARAMETER   One of the parameters has an invalid value.\r
+  @retval EFI_UNSUPPORTED         The image type is not supported, or the device\r
+                                  path cannot be parsed to locate the proper\r
+                                  protocol for loading the file.\r
+  @retval EFI_OUT_OF_RESOURCES    Image was not loaded due to insufficient\r
+                                  resources.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreLoadImageEx (\r
+  IN  EFI_PE32_IMAGE_PROTOCOL          *This,\r
+  IN  EFI_HANDLE                       ParentImageHandle,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL         *FilePath,\r
+  IN  VOID                             *SourceBuffer       OPTIONAL,\r
+  IN  UINTN                            SourceSize,\r
+  IN  EFI_PHYSICAL_ADDRESS             DstBuffer           OPTIONAL,\r
+  OUT UINTN                            *NumberOfPages      OPTIONAL,\r
+  OUT EFI_HANDLE                       *ImageHandle,\r
+  OUT EFI_PHYSICAL_ADDRESS             *EntryPoint         OPTIONAL,\r
+  IN  UINT32                           Attribute\r
+  );\r
+\r
+\r
+/**\r
+  Unload the specified image.\r
+\r
+  @param  This                    Indicates the calling context.\r
+  @param  ImageHandle             The specified image handle.\r
+\r
+  @retval EFI_INVALID_PARAMETER   Image handle is NULL.\r
+  @retval EFI_UNSUPPORTED         Attempt to unload an unsupported image.\r
+  @retval EFI_SUCCESS             Image successfully unloaded.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CoreUnloadImageEx (\r
+  IN EFI_PE32_IMAGE_PROTOCOL  *This,\r
+  IN EFI_HANDLE                         ImageHandle\r
+  );\r
+#endif\r
index 65ecde2cf4c8991b6b6633c9ce2357de58d5be3c..453e88b940aca19604d658889d41fe3c8f001588 100644 (file)
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "Image.h"\r
 \r
 /**\r
   Search a handle to a device on a specified device path that supports a specified protocol,\r
diff --git a/MdeModulePkg/Core/Dxe/Imem.h b/MdeModulePkg/Core/Dxe/Imem.h
deleted file mode 100644 (file)
index 23e6d09..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/** @file\r
-  Data structure and functions to allocate and free memory space.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _IMEM_H_\r
-#define _IMEM_H_\r
-\r
-#if defined (MDE_CPU_IPF)\r
-//\r
-// For Itanium machines make the default allocations 8K aligned\r
-//\r
-#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT  (EFI_PAGE_SIZE * 2)\r
-#define DEFAULT_PAGE_ALLOCATION                     (EFI_PAGE_SIZE * 2)\r
-\r
-#else\r
-//\r
-// For genric EFI machines make the default allocations 4K aligned\r
-//\r
-#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT  (EFI_PAGE_SIZE)\r
-#define DEFAULT_PAGE_ALLOCATION                     (EFI_PAGE_SIZE)\r
-\r
-#endif\r
-\r
-\r
-//\r
-// MEMORY_MAP_ENTRY\r
-//\r
-\r
-#define MEMORY_MAP_SIGNATURE   EFI_SIGNATURE_32('m','m','a','p')\r
-typedef struct {\r
-  UINTN           Signature;\r
-  LIST_ENTRY      Link;\r
-  BOOLEAN         FromPages;\r
-\r
-  EFI_MEMORY_TYPE Type;\r
-  UINT64          Start;\r
-  UINT64          End;\r
-\r
-  UINT64          VirtualStart;\r
-  UINT64          Attribute;\r
-} MEMORY_MAP;\r
-\r
-//\r
-// Internal prototypes\r
-//\r
-\r
-\r
-/**\r
-  Internal function.  Used by the pool functions to allocate pages\r
-  to back pool allocation requests.\r
-\r
-  @param  PoolType               The type of memory for the new pool pages\r
-  @param  NumberOfPages          No of pages to allocate\r
-  @param  Alignment              Bits to align.\r
-\r
-  @return The allocated memory, or NULL\r
-\r
-**/\r
-VOID *\r
-CoreAllocatePoolPages (\r
-  IN EFI_MEMORY_TYPE    PoolType,\r
-  IN UINTN              NumberOfPages,\r
-  IN UINTN              Alignment\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Internal function.  Frees pool pages allocated via AllocatePoolPages ()\r
-\r
-  @param  Memory                 The base address to free\r
-  @param  NumberOfPages          The number of pages to free\r
-\r
-**/\r
-VOID\r
-CoreFreePoolPages (\r
-  IN EFI_PHYSICAL_ADDRESS   Memory,\r
-  IN UINTN                  NumberOfPages\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Internal function to allocate pool of a particular type.\r
-  Caller must have the memory lock held\r
-\r
-  @param  PoolType               Type of pool to allocate\r
-  @param  Size                   The amount of pool to allocate\r
-\r
-  @return The allocate pool, or NULL\r
-\r
-**/\r
-VOID *\r
-CoreAllocatePoolI (\r
-  IN EFI_MEMORY_TYPE  PoolType,\r
-  IN UINTN            Size\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Internal function to free a pool entry.\r
-  Caller must have the memory lock held\r
-\r
-  @param  Buffer                 The allocated pool entry to free\r
-\r
-  @retval EFI_INVALID_PARAMETER  Buffer not valid\r
-  @retval EFI_SUCCESS            Buffer successfully freed.\r
-\r
-**/\r
-EFI_STATUS\r
-CoreFreePoolI (\r
-  IN VOID       *Buffer\r
-  );\r
-\r
-\r
-\r
-/**\r
-  Enter critical section by gaining lock on gMemoryLock.\r
-\r
-**/\r
-VOID\r
-CoreAcquireMemoryLock (\r
-  VOID\r
-  );\r
-\r
-\r
-/**\r
-  Exit critical section by releasing lock on gMemoryLock.\r
-\r
-**/\r
-VOID\r
-CoreReleaseMemoryLock (\r
-  VOID\r
-  );\r
-\r
-\r
-//\r
-// Internal Global data\r
-//\r
-\r
-extern EFI_LOCK           gMemoryLock;\r
-extern LIST_ENTRY         gMemoryMap;\r
-extern LIST_ENTRY         mGcdMemorySpaceMap;\r
-#endif\r
diff --git a/MdeModulePkg/Core/Dxe/Library.h b/MdeModulePkg/Core/Dxe/Library.h
deleted file mode 100644 (file)
index 0d907d8..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/** @file\r
-  Internal functions shared in DxeCore module.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef _DXE_LIBRARY_H_\r
-#define _DXE_LIBRARY_H_\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
-\r
-#endif\r
diff --git a/MdeModulePkg/Core/Dxe/Mem/Imem.h b/MdeModulePkg/Core/Dxe/Mem/Imem.h
new file mode 100644 (file)
index 0000000..8a60d59
--- /dev/null
@@ -0,0 +1,155 @@
+/** @file\r
+  Data structure and functions to allocate and free memory space.\r
+\r
+Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+All rights reserved. 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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _IMEM_H_\r
+#define _IMEM_H_\r
+\r
+#if defined (MDE_CPU_IPF)\r
+///\r
+/// For Itanium machines make the default allocations 8K aligned\r
+///\r
+#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT  (EFI_PAGE_SIZE * 2)\r
+#define DEFAULT_PAGE_ALLOCATION                     (EFI_PAGE_SIZE * 2)\r
+\r
+#else\r
+///\r
+/// For genric EFI machines make the default allocations 4K aligned\r
+///\r
+#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT  (EFI_PAGE_SIZE)\r
+#define DEFAULT_PAGE_ALLOCATION                     (EFI_PAGE_SIZE)\r
+\r
+#endif\r
+\r
+\r
+//\r
+// MEMORY_MAP_ENTRY\r
+//\r
+\r
+#define MEMORY_MAP_SIGNATURE   EFI_SIGNATURE_32('m','m','a','p')\r
+typedef struct {\r
+  UINTN           Signature;\r
+  LIST_ENTRY      Link;\r
+  BOOLEAN         FromPages;\r
+\r
+  EFI_MEMORY_TYPE Type;\r
+  UINT64          Start;\r
+  UINT64          End;\r
+\r
+  UINT64          VirtualStart;\r
+  UINT64          Attribute;\r
+} MEMORY_MAP;\r
+\r
+//\r
+// Internal prototypes\r
+//\r
+\r
+\r
+/**\r
+  Internal function.  Used by the pool functions to allocate pages\r
+  to back pool allocation requests.\r
+\r
+  @param  PoolType               The type of memory for the new pool pages\r
+  @param  NumberOfPages          No of pages to allocate\r
+  @param  Alignment              Bits to align.\r
+\r
+  @return The allocated memory, or NULL\r
+\r
+**/\r
+VOID *\r
+CoreAllocatePoolPages (\r
+  IN EFI_MEMORY_TYPE    PoolType,\r
+  IN UINTN              NumberOfPages,\r
+  IN UINTN              Alignment\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Internal function.  Frees pool pages allocated via AllocatePoolPages ()\r
+\r
+  @param  Memory                 The base address to free\r
+  @param  NumberOfPages          The number of pages to free\r
+\r
+**/\r
+VOID\r
+CoreFreePoolPages (\r
+  IN EFI_PHYSICAL_ADDRESS   Memory,\r
+  IN UINTN                  NumberOfPages\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Internal function to allocate pool of a particular type.\r
+  Caller must have the memory lock held\r
+\r
+  @param  PoolType               Type of pool to allocate\r
+  @param  Size                   The amount of pool to allocate\r
+\r
+  @return The allocate pool, or NULL\r
+\r
+**/\r
+VOID *\r
+CoreAllocatePoolI (\r
+  IN EFI_MEMORY_TYPE  PoolType,\r
+  IN UINTN            Size\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Internal function to free a pool entry.\r
+  Caller must have the memory lock held\r
+\r
+  @param  Buffer                 The allocated pool entry to free\r
+\r
+  @retval EFI_INVALID_PARAMETER  Buffer not valid\r
+  @retval EFI_SUCCESS            Buffer successfully freed.\r
+\r
+**/\r
+EFI_STATUS\r
+CoreFreePoolI (\r
+  IN VOID       *Buffer\r
+  );\r
+\r
+\r
+\r
+/**\r
+  Enter critical section by gaining lock on gMemoryLock.\r
+\r
+**/\r
+VOID\r
+CoreAcquireMemoryLock (\r
+  VOID\r
+  );\r
+\r
+\r
+/**\r
+  Exit critical section by releasing lock on gMemoryLock.\r
+\r
+**/\r
+VOID\r
+CoreReleaseMemoryLock (\r
+  VOID\r
+  );\r
+\r
+\r
+//\r
+// Internal Global data\r
+//\r
+\r
+extern EFI_LOCK           gMemoryLock;\r
+extern LIST_ENTRY         gMemoryMap;\r
+extern LIST_ENTRY         mGcdMemorySpaceMap;\r
+#endif\r
index 179376dc31c6bc50a07845a5d80a3aafc259bc55..5e3c81d78693dcd4b827fd20223c3682851421f9 100644 (file)
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "Imem.h"\r
 \r
 #define EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT  (EFI_PAGE_SIZE)\r
 \r
index 2764a8ef9ff3f50680c21d9a4b772245bdec5484..cea6fada4c367c95b4b53c4ffef1d1900e1eb85f 100644 (file)
@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
+#include "Imem.h"\r
 \r
 #define POOL_FREE_SIGNATURE   EFI_SIGNATURE_32('p','f','r','0')\r
 typedef struct {\r
index 556c14c5850f40e58ec92b8f2a4920e5001fd2e3..295f32f43e8eee0b2c71335f43504973f26033d6 100644 (file)
@@ -24,7 +24,9 @@ EFI_DEBUG_IMAGE_INFO_TABLE_HEADER  mDebugInfoTableHeader = {
 \r
 EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;\r
 \r
+#define FOUR_MEG_ALIGNMENT   0x400000\r
 \r
+#define EFI_DEBUG_TABLE_ENTRY_SIZE       (sizeof (VOID *))\r
 \r
 /**\r
   Creates and initializes the DebugImageInfo Table.  Also creates the configuration\r