]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add two interfaces in PeCoffGetEntryPointLib.h
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 13 Feb 2007 11:12:05 +0000 (11:12 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 13 Feb 2007 11:12:05 +0000 (11:12 +0000)
2. Fix the description of EfiTestChildHandle & EfiTestManagedDevice
3. Clean up BasePciLbPciCf8 & BasePciLibPciExpress to remove the dependency on DebugLib

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2387 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/PeCoffGetEntryPointLib.h
MdePkg/Include/Library/PrintLib.h
MdePkg/Include/Library/UefiLib.h
MdePkg/Library/BasePciLibCf8/BasePciLibCf8.msa
MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.msa
MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
MdePkg/Library/BasePrintLib/PrintLib.c
MdePkg/Library/UefiLib/UefiLib.c

index 973a36865528e13efdeaa5bf3adf67d8a69b84ac..c1bc488c8df1f1fb6f3b7ded2a289ae856769df5 100644 (file)
@@ -42,18 +42,46 @@ PeCoffLoaderGetEntryPoint (
   );\r
 \r
 /**\r
-  Returns the machine type of PE/COFF image. \r
+  Returns the machine type of a PE/COFF image.\r
 \r
-  @param  Image   Pointer to a PE/COFF header\r
+  Returns the machine type from the PE/COFF image specified by Pe32Data.\r
+  If Pe32Data is NULL, then ASSERT().\r
+\r
+  @param  Pe32Data   Pointer to the PE/COFF image that is loaded in system\r
+                     memory.\r
 \r
-  @return         Machine type or zero if not a valid iamge\r
+  @return Machine type or zero if not a valid iamge.\r
 \r
 **/\r
 UINT16\r
 EFIAPI\r
 PeCoffLoaderGetMachineType (\r
-  IN  VOID    *Image\r
+  IN VOID  *Pe32Data\r
   );\r
 \r
+/**\r
+  Returns a pointer to the PDB file name for a PE/COFF image that has been\r
+  loaded into system memory with the PE/COFF Loader Library functions. \r
+\r
+  Returns the PDB file name for the PE/COFF image specified by Pe32Data.  If\r
+  the PE/COFF image specified by Pe32Data is not a valid, then NULL is\r
+  returned.  If the PE/COFF image specified by Pe32Data does not contain a\r
+  debug directory entry, then NULL is returned.  If the debug directory entry\r
+  in the PE/COFF image specified by Pe32Data does not contain a PDB file name,\r
+  then NULL is returned.\r
+  If Pe32Data is NULL, then ASSERT().\r
+\r
+  @param  Pe32Data   Pointer to the PE/COFF image that is loaded in system\r
+                     memory.\r
+\r
+  @return The PDB file name for the PE/COFF image specified by Pe32Data or NULL\r
+          if it cannot be retrieved.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+PeCoffLoaderGetPdbPointer (\r
+  IN VOID  *Pe32Data\r
+  );\r
 \r
 #endif\r
index 412dc530bd528c5afd412a8aa2308e0801d3e89b..eb8a33b9c13f5bb03ddc8e0f090ed17604be9cbd 100644 (file)
@@ -35,7 +35,7 @@
 
 ///
 /// Flags bitmask values use in UnicodeValueToString() and 
-/// AcsiiValueToString()
+/// AsciiValueToString()
 ///
 #define LEFT_JUSTIFY      0x01
 #define COMMA_TYPE        0x08
@@ -56,7 +56,9 @@
   If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
 
   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
+  If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
   If BufferSize > 1 and FormatString is NULL, then ASSERT().
+  If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 
   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
   ASSERT().
@@ -96,7 +98,9 @@ UnicodeVSPrint (
   If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
 
   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
+  If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
   If BufferSize > 1 and FormatString is NULL, then ASSERT().
+  If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 
   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
   ASSERT().
@@ -136,6 +140,7 @@ UnicodeSPrint (
   If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
 
   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
+  If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
   If BufferSize > 1 and FormatString is NULL, then ASSERT().
   If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
   PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
@@ -177,6 +182,7 @@ UnicodeVSPrintAsciiFormat (
   If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
 
   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
+  If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
   If BufferSize > 1 and FormatString is NULL, then ASSERT().
   If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
   PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
@@ -229,6 +235,7 @@ UnicodeSPrintAsciiFormat (
   add up to Width characters.
   If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
   If Buffer is NULL, then ASSERT().
+  If Buffer is not aligned on a 16-bit boundary, then ASSERT().
   If unsupported bits are set in Flags, then ASSERT().
   If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
   If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
@@ -348,6 +355,7 @@ AsciiSPrint (
 
   If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
   If BufferSize > 0 and FormatString is NULL, then ASSERT().
+  If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
   ASSERT().
@@ -389,6 +397,7 @@ AsciiVSPrintUnicodeFormat (
 
   If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
   If BufferSize > 0 and FormatString is NULL, then ASSERT().
+  If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
   ASSERT().
index a302c26beb51cdc983094ab53080bb0a00e7270f..ef10f136b417eae4e03101ef165a4e22436ca962 100644 (file)
@@ -254,24 +254,26 @@ EfiReleaseLock (
   );\r
 \r
 /**
-  Tests whether a controller is managed by a specific driver.
+  Tests whether a controller handle is being managed by a specific driver.
 
-  This function tests whether a specific driver manages ControllerHandle by\r
-  opening on DriverBindingHandle a protocol specified by ProtocolGuid with\r
-  attribute EFI_OPEN_PROTOCOL_BY_DRIVER.  This library function is used to\r
-  implement the Component Name Protocol for EFI Drivers.\r
+  This function tests whether the driver specified by DriverBindingHandle is\r
+  currently managing the controller specified by ControllerHandle.  This test\r
+  is performed by evaluating if the the protocol specified by ProtocolGuid is\r
+  present on ControllerHandle and is was opened by DriverBindingHandle with an\r
+  attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. \r
   If ProtocolGuid is NULL, then ASSERT().\r
 
   @param  ControllerHandle     A handle for a controller to test.
   @param  DriverBindingHandle  Specifies the driver binding handle for the
                                driver.
-  @param  ProtocolGuid         Supplies GUID for the protocol opened by the
-                               driver on the controller. 
+  @param  ProtocolGuid         Specifies the protocol that the driver specified
+                               by DriverBindingHandle opens in its Start()
+                               function.
 
-  @retval EFI_SUCCESS          ControllerHandle is managed by the specific
-                               driver.
-  @retval EFI_UNSUPPORTED      ControllerHandle is not managed by the specific
-                               driver.
+  @retval EFI_SUCCESS          ControllerHandle is managed by the driver
+                               specifed by DriverBindingHandle.
+  @retval EFI_UNSUPPORTED      ControllerHandle is not managed by the driver
+                               specifed by DriverBindingHandle.
 
 **/\r
 EFI_STATUS\r
@@ -283,19 +285,18 @@ EfiTestManagedDevice (
   );\r
 \r
 /**
-  Tests whether a child handle is a children device of the controller.
+  Tests whether a child handle is a child device of the controller.
 
-  This function tests whether ChildHandle is one of the children of
-  ControllerHandle which are consuming a protocol specified by ProtocolGuid
-  with the attribute bit EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER set.  This
-  library function is used to implement the Component Name Protocol for EFI
-  Drivers.
-  If ProtocolGuid is NULL, then ASSERT().
+  This function tests whether ChildHandle is one of the children of\r
+  ControllerHandle.  This test is performed by checking to see if the protocol\r
+  specified by ProtocolGuid is present on ControllerHandle and opened by\r
+  ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
+  If ProtocolGuid is NULL, then ASSERT().\r
 
   @param  ControllerHandle     A handle for a (parent) controller to test. 
   @param  ChildHandle          A child handle to test.
-  @param  ConsumsedGuid        Supplies GUID for the protocol consumed by
-                               children from controller. 
+  @param  ConsumsedGuid        Supplies the protocol that the child controller
+                               opens on its parent controller. 
 
   @retval EFI_SUCCESS          ChildHandle is a child of the ControllerHandle.
   @retval EFI_UNSUPPORTED      ChildHandle is not a child of the
index e2b6c5b6ee947f1f0b15dd8c0a3592515dfef3b5..85edbbabd73af2644955e0d32f185b56be1e7383 100644 (file)
@@ -8,7 +8,7 @@
     <Abstract>Component description file for PCI CF8 Base PCI Library</Abstract>\r
     <Description>PCI Library that uses I/O ports 0xCF8 and 0xCFC to perform\r
       PCI Configuration cycles.  Layers on top of an I/O Library instance.</Description>\r
-    <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
+    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>\r
     <License>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
@@ -29,9 +29,6 @@
     <LibraryClass Usage="ALWAYS_CONSUMED">\r
       <Keyword>PciCf8Lib</Keyword>\r
     </LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">\r
-      <Keyword>DebugLib</Keyword>\r
-    </LibraryClass>\r
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>PciLib.c</Filename>\r
index 0472d32e9432826e2fdb045e5d563f0fd9fb0f2e..b39faa841079a5b3637e8273dd4a1b4720088946 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
   <MsaHeader>\r
     <ModuleName>BasePciLibPciExpress</ModuleName>\r
     <ModuleType>BASE</ModuleType>\r
@@ -8,7 +8,7 @@
     <Abstract>Component description file for PCI Express Base PCI Library.</Abstract>\r
     <Description>PCI Library that uses the 256 MB PCI Express MMIO window to perform PCI\r
       Configuration cycles.  Layers on top of an I/O Library instance.</Description>\r
-    <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
+    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>\r
     <License>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
@@ -29,9 +29,6 @@
     <LibraryClass Usage="ALWAYS_CONSUMED">\r
       <Keyword>PciExpressLib</Keyword>\r
     </LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">\r
-      <Keyword>DebugLib</Keyword>\r
-    </LibraryClass>\r
   </LibraryClassDefinitions>\r
   <SourceFiles>\r
     <Filename>PciLib.c</Filename>\r
index 001e043d3f22cc4829a1f8f98f05180402420a55..d0a6746e50969a0371901a1c6c45ba97159d5b6d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Tiano PE/COFF loader.\r
 \r
-  Copyright (c) 2006, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2007, 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
@@ -69,17 +69,21 @@ PeCoffLoaderGetEntryPoint (
 \r
 \r
 /**\r
-  Returns the machine type of PE/COFF image. \r
+  Returns the machine type of a PE/COFF image.\r
 \r
-  @param  Image   Pointer to a PE/COFF header\r
+  Returns the machine type from the PE/COFF image specified by Pe32Data.\r
+  If Pe32Data is NULL, then ASSERT().\r
+\r
+  @param  Pe32Data   Pointer to the PE/COFF image that is loaded in system\r
+                     memory.\r
 \r
-  @return         Machine type or zero if not a valid iamge\r
+  @return Machine type or zero if not a valid iamge.\r
 \r
 **/\r
 UINT16\r
 EFIAPI\r
 PeCoffLoaderGetMachineType (\r
-  IN  VOID  *Pe32Data\r
+  IN VOID  *Pe32Data\r
   )\r
 {\r
   EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr;\r
@@ -99,4 +103,114 @@ PeCoffLoaderGetMachineType (
   return 0x0000;\r
 }\r
 \r
+/**\r
+  Returns a pointer to the PDB file name for a PE/COFF image that has been\r
+  loaded into system memory with the PE/COFF Loader Library functions. \r
+\r
+  Returns the PDB file name for the PE/COFF image specified by Pe32Data.  If\r
+  the PE/COFF image specified by Pe32Data is not a valid, then NULL is\r
+  returned.  If the PE/COFF image specified by Pe32Data does not contain a\r
+  debug directory entry, then NULL is returned.  If the debug directory entry\r
+  in the PE/COFF image specified by Pe32Data does not contain a PDB file name,\r
+  then NULL is returned.\r
+  If Pe32Data is NULL, then ASSERT().\r
+\r
+  @param  Pe32Data   Pointer to the PE/COFF image that is loaded in system\r
+                     memory.\r
+\r
+  @return The PDB file name for the PE/COFF image specified by Pe32Data or NULL\r
+          if it cannot be retrieved.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+PeCoffLoaderGetPdbPointer (\r
+  IN VOID  *Pe32Data\r
+  )\r
+{\r
+  EFI_IMAGE_DOS_HEADER                  *DosHeader;\r
+  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION   Hdr;\r
+  EFI_IMAGE_DATA_DIRECTORY              *DirectoryEntry;\r
+  EFI_IMAGE_DEBUG_DIRECTORY_ENTRY       *DebugEntry;\r
+  UINTN                                 DirCount;\r
+  VOID                                  *CodeViewEntryPointer;\r
+  INTN                                  TEImageAdjust;\r
+  UINT32                                NumberOfRvaAndSizes;\r
\r
+  ASSERT (Pe32Data   != NULL);\r
+\r
+  TEImageAdjust       = 0;\r
+  DirectoryEntry      = NULL;\r
+  DebugEntry          = NULL;\r
+  NumberOfRvaAndSizes = 0;\r
+\r
+  DosHeader = (EFI_IMAGE_DOS_HEADER *)Pe32Data;\r
+  if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {\r
+    //\r
+    // DOS image header is present, so read the PE header after the DOS image header.\r
+    //\r
+    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHeader->e_lfanew) & 0x0ffff));\r
+  } else {\r
+    //\r
+    // DOS image header is not present, so PE header is at the image base.\r
+    //\r
+    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;\r
+  }\r
+\r
+  if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {\r
+    if (Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress != 0) {\r
+      DirectoryEntry  = &Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG];\r
+      TEImageAdjust   = sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize;\r
+      DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +\r
+                    Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress +\r
+                    TEImageAdjust);\r
+    }\r
+  } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {\r
+    if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
+      //     \r
+      // Use PE32 offset get Debug Directory Entry\r
+      //\r
+      NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;\r
+      DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);\r
+      DebugEntry     = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) ((UINTN) Pe32Data + DirectoryEntry->VirtualAddress);\r
+    } else if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {\r
+      //     \r
+      // Use PE32+ offset get Debug Directory Entry\r
+      //\r
+      NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;\r
+      DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);\r
+      DebugEntry     = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) ((UINTN) Pe32Data + DirectoryEntry->VirtualAddress);\r
+    }\r
+\r
+    if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {\r
+      DirectoryEntry = NULL;\r
+      DebugEntry = NULL;\r
+    }\r
+  } else {\r
+    return NULL;\r
+  }\r
+\r
+  if (DebugEntry == NULL || DirectoryEntry == NULL) {\r
+    return NULL;\r
+  }\r
+\r
+  for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount++, DebugEntry++) {\r
+    if (DebugEntry->Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {\r
+      if (DebugEntry->SizeOfData > 0) {\r
+        CodeViewEntryPointer = (VOID *) ((UINTN) DebugEntry->RVA + ((UINTN)Pe32Data) + (UINTN)TEImageAdjust);\r
+        switch (* (UINT32 *) CodeViewEntryPointer) {\r
+        case CODEVIEW_SIGNATURE_NB10:\r
+          return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));\r
+        case CODEVIEW_SIGNATURE_RSDS:\r
+          return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY));\r
+        default:\r
+          break;\r
+        }\r
+      }\r
+    }\r
+  }\r
+\r
+  return NULL;\r
+}\r
+\r
 \r
index 5263dda28883e5dd1aa7c0ceef407cb40c7216e3..02725586e5a7747ace0e1c6ed297802e3bd60cf4 100644 (file)
@@ -16,8 +16,9 @@
 
 #include "PrintLibInternal.h"
 
-#define WARNING_STATUS_NUMBER          4
-#define ERROR_STATUS_NUMBER            24
+#define WARNING_STATUS_NUMBER         4
+#define ERROR_STATUS_NUMBER           24
+#define ASSERT_UNICODE_BUFFER(Buffer) ASSERT ((((UINTN) (Buffer)) & 0x01) == 0)
 
 GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *StatusString [] = {
   "Success",                      //  RETURN_SUCCESS                = 0
@@ -613,7 +614,9 @@ BasePrintLibSPrint (
   If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
 
   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
+  If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
   If BufferSize > 1 and FormatString is NULL, then ASSERT().
+  If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 
   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
   ASSERT().
@@ -640,6 +643,8 @@ UnicodeVSPrint (
   IN  VA_LIST       Marker
   )
 {
+  ASSERT_UNICODE_BUFFER(StartOfBuffer);
+  ASSERT_UNICODE_BUFFER(FormatString);
   return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker);
 }
 
@@ -656,7 +661,9 @@ UnicodeVSPrint (
   If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
 
   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
+  If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
   If BufferSize > 1 and FormatString is NULL, then ASSERT().
+  If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 
   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
   ASSERT().
@@ -702,6 +709,7 @@ UnicodeSPrint (
   If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
 
   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
+  If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
   If BufferSize > 1 and FormatString is NULL, then ASSERT().
   If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
   PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
@@ -729,6 +737,7 @@ UnicodeVSPrintAsciiFormat (
   IN  VA_LIST      Marker
   )
 {
+  ASSERT_UNICODE_BUFFER(StartOfBuffer);
   return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE,FormatString, Marker);
 }
 
@@ -746,6 +755,7 @@ UnicodeVSPrintAsciiFormat (
   If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
 
   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
+  If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
   If BufferSize > 1 and FormatString is NULL, then ASSERT().
   If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
   PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
@@ -804,6 +814,7 @@ UnicodeSPrintAsciiFormat (
   add up to Width characters.
   If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
   If Buffer is NULL, then ASSERT().
+  If Buffer is not aligned on a 16-bit boundary, then ASSERT().
   If unsupported bits are set in Flags, then ASSERT().
   If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
   If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
@@ -827,6 +838,7 @@ UnicodeValueToString (
   IN UINTN       Width
   )
 {
+  ASSERT_UNICODE_BUFFER(Buffer);
   return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 2);
 }
 
@@ -935,6 +947,7 @@ AsciiSPrint (
 
   If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
   If BufferSize > 0 and FormatString is NULL, then ASSERT().
+  If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
   ASSERT().
@@ -961,6 +974,7 @@ AsciiVSPrintUnicodeFormat (
   IN  VA_LIST       Marker
   )
 {
+  ASSERT_UNICODE_BUFFER (FormatString);
   return BasePrintLibVSPrint (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, Marker);
 }
 
@@ -979,6 +993,7 @@ AsciiVSPrintUnicodeFormat (
 
   If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
   If BufferSize > 0 and FormatString is NULL, then ASSERT().
+  If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
   ASSERT().
@@ -1060,6 +1075,6 @@ AsciiValueToString (
   IN UINTN      Width
   )
 {
-  return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 1);
+  return BasePrintLibConvertValueToString (Buffer, Flags, Value, Width, 1);
 }
 
index 765235c51519f3c80bbf66c693a2e353582bb4eb..f03b881d35289c90bbaa83e3a21abeeb5592a5cf 100644 (file)
@@ -383,24 +383,26 @@ EfiReleaseLock (
 }\r
 \r
 /**
-  Tests whether a controller is managed by a specific driver.
+  Tests whether a controller handle is being managed by a specific driver.
 
-  This function tests whether a specific driver manages ControllerHandle by\r
-  opening on DriverBindingHandle a protocol specified by ProtocolGuid with\r
-  attribute EFI_OPEN_PROTOCOL_BY_DRIVER.  This library function is used to\r
-  implement the Component Name Protocol for EFI Drivers.\r
+  This function tests whether the driver specified by DriverBindingHandle is\r
+  currently managing the controller specified by ControllerHandle.  This test\r
+  is performed by evaluating if the the protocol specified by ProtocolGuid is\r
+  present on ControllerHandle and is was opened by DriverBindingHandle with an\r
+  attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. \r
   If ProtocolGuid is NULL, then ASSERT().\r
 
   @param  ControllerHandle     A handle for a controller to test.
   @param  DriverBindingHandle  Specifies the driver binding handle for the
                                driver.
-  @param  ProtocolGuid         Supplies GUID for the protocol opened by the
-                               driver on the controller. 
+  @param  ProtocolGuid         Specifies the protocol that the driver specified
+                               by DriverBindingHandle opens in its Start()
+                               function.
 
-  @retval EFI_SUCCESS          ControllerHandle is managed by the specific
-                               driver.
-  @retval EFI_UNSUPPORTED      ControllerHandle is not managed by the specific
-                               driver.
+  @retval EFI_SUCCESS          ControllerHandle is managed by the driver
+                               specifed by DriverBindingHandle.
+  @retval EFI_UNSUPPORTED      ControllerHandle is not managed by the driver
+                               specifed by DriverBindingHandle.
 
 **/\r
 EFI_STATUS\r
@@ -442,19 +444,18 @@ EfiTestManagedDevice (
 }\r
 \r
 /**
-  Tests whether a child handle is a children device of the controller.
+  Tests whether a child handle is a child device of the controller.
 
-  This function tests whether ChildHandle is one of the children of
-  ControllerHandle which are consuming a protocol specified by ProtocolGuid
-  with the attribute bit EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER set.  This
-  library function is used to implement the Component Name Protocol for EFI
-  Drivers.
-  If ProtocolGuid is NULL, then ASSERT().
+  This function tests whether ChildHandle is one of the children of\r
+  ControllerHandle.  This test is performed by checking to see if the protocol\r
+  specified by ProtocolGuid is present on ControllerHandle and opened by\r
+  ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
+  If ProtocolGuid is NULL, then ASSERT().\r
 
   @param  ControllerHandle     A handle for a (parent) controller to test. 
   @param  ChildHandle          A child handle to test.
-  @param  ConsumsedGuid        Supplies GUID for the protocol consumed by
-                               children from controller. 
+  @param  ConsumsedGuid        Supplies the protocol that the child controller
+                               opens on its parent controller. 
 
   @retval EFI_SUCCESS          ChildHandle is a child of the ControllerHandle.
   @retval EFI_UNSUPPORTED      ChildHandle is not a child of the