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