BaseMemoryLib (BaseMemoryLibRepStr):

Fix a logic error in SetMem64 (); The correct stride should be 8 instead of 4.
	BasePrintLib:
	Fix Printf(“%\n”) passer error.
	Fix BufferSize = 0, 1 issue
	Fix some missing ASSERT ()s
	Move MAXIMUM_VALUE_CHARACTERS from PrintLibInternal.h to PrintLib.h
	ReportStatusCodeLib:
	Add CONST modifier to some interfaces
	Modify 
	DebugLib:
	Replace some Unicode in comments.
	PeiServicesTablePointerLib
	Add ASSERT()s
	PciLib:
	Remove unnecessary ASSERT()s in PciRead/WriteBuffer()


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@496 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8
2006-06-13 06:31:11 +00:00
parent ad82307c75
commit 8960cdebac
21 changed files with 147 additions and 168 deletions

View File

@ -72,7 +72,7 @@ DebugPrint (
Prints an assert message containing a filename, line number, and description. Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop. This may be followed by a breakpoint or a dead loop.
Print a message of the form <EFBFBD>ASSERT <FileName>(<LineNumber>): <Description>\n? Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
@ -411,7 +411,7 @@ DebugClearMemoryEnabled (
by TYPE is compared to TestSignature. If the signatures match, then a pointer by TYPE is compared to TestSignature. If the signatures match, then a pointer
to the pointer to a data structure of the type specified by TYPE is returned. to the pointer to a data structure of the type specified by TYPE is returned.
If the signatures do not match, then DebugAssert() is called with a description If the signatures do not match, then DebugAssert() is called with a description
of <EFBFBD>CR has a bad signature?and Record is returned. of "CR has a bad signature" and Record is returned.
If the data type specified by TYPE does not contain the field specified by Field, If the data type specified by TYPE does not contain the field specified by Field,
then the module will not compile. then the module will not compile.

View File

@ -17,9 +17,26 @@
#ifndef __PRINT_LIB_H__ #ifndef __PRINT_LIB_H__
#define __PRINT_LIB_H__ #define __PRINT_LIB_H__
// ///
// Print primitives /// Define the maximum number of characters that are required to
// /// encode a decimal, hexidecimal, GUID, or TIME value with a NULL
/// terminator.
///
/// Maximum Length Decimal String = 28
/// "-9,223,372,036,854,775,808"
/// Maximum Length Hexidecimal String = 17
/// "FFFFFFFFFFFFFFFF"
/// Maximum Length GUID = 37
/// "00000000-0000-0000-0000-000000000000"
/// Maximum Length TIME = 18
/// "12/12/2006 12:12"
///
#define MAXIMUM_VALUE_CHARACTERS 38
///
/// Flags bitmask values use in UnicodeValueToString() and
/// AcsiiValueToString()
///
#define LEFT_JUSTIFY 0x01 #define LEFT_JUSTIFY 0x01
#define COMMA_TYPE 0x08 #define COMMA_TYPE 0x08
#define PREFIX_ZERO 0x20 #define PREFIX_ZERO 0x20

View File

@ -241,12 +241,12 @@ CodeTypeToPostCode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
ReportStatusCodeExtractAssertInfo ( ReportStatusCodeExtractAssertInfo (
IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN EFI_STATUS_CODE_DATA *Data, IN CONST EFI_STATUS_CODE_DATA *Data,
OUT CHAR8 **Filename, OUT CHAR8 **Filename,
OUT CHAR8 **Description, OUT CHAR8 **Description,
OUT UINT32 *LineNumber OUT UINT32 *LineNumber
); );
@ -282,10 +282,10 @@ ReportStatusCodeExtractAssertInfo (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
ReportStatusCodeExtractDebugInfo ( ReportStatusCodeExtractDebugInfo (
IN EFI_STATUS_CODE_DATA *Data, IN CONST EFI_STATUS_CODE_DATA *Data,
OUT UINT32 *ErrorLevel, OUT UINT32 *ErrorLevel,
OUT VA_LIST *Marker, OUT VA_LIST *Marker,
OUT CHAR8 **Format OUT CHAR8 **Format
); );
@ -349,9 +349,9 @@ ReportStatusCode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ReportStatusCodeWithDevicePath ( ReportStatusCodeWithDevicePath (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
); );
@ -393,7 +393,7 @@ EFIAPI
ReportStatusCodeWithExtendedData ( ReportStatusCodeWithExtendedData (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN VOID *ExtendedData, IN CONST VOID *ExtendedData,
IN UINTN ExtendedDataSize IN UINTN ExtendedDataSize
); );
@ -445,9 +445,9 @@ ReportStatusCodeEx (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance, IN UINT32 Instance,
IN EFI_GUID *CallerId OPTIONAL, IN CONST EFI_GUID *CallerId OPTIONAL,
IN EFI_GUID *ExtendedDataGuid OPTIONAL, IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL,
IN VOID *ExtendedData OPTIONAL, IN CONST VOID *ExtendedData OPTIONAL,
IN UINTN ExtendedDataSize IN UINTN ExtendedDataSize
); );

View File

@ -61,7 +61,7 @@ DebugPrint (
Prints an assert message containing a filename, line number, and description. Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop. This may be followed by a breakpoint or a dead loop.
Print a message of the form <EFBFBD>ASSERT <FileName>(<LineNumber>): <Description>\n<EFBFBD> Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
@ -70,9 +70,9 @@ DebugPrint (
DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while
processing another DebugAssert(), then DebugAssert() must return immediately. processing another DebugAssert(), then DebugAssert() must return immediately.
If FileName is NULL, then a <FileName> string of <EFBFBD>(NULL) Filename<EFBFBD> is printed. If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.
If Description is NULL, then a <Description> string of <EFBFBD>(NULL) Description<EFBFBD> is printed. If Description is NULL, then a <Description> string of "(NULL) Description" is printed.
@param FileName Pointer to the name of the source file that generated the assert condition. @param FileName Pointer to the name of the source file that generated the assert condition.
@param LineNumber The line number in the source file that generated the assert condition @param LineNumber The line number in the source file that generated the assert condition

View File

@ -92,7 +92,7 @@ DebugPrint (
Prints an assert message containing a filename, line number, and description. Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop. This may be followed by a breakpoint or a dead loop.
Print a message of the form <EFBFBD>ASSERT <FileName>(<LineNumber>): <Description>\n<EFBFBD> Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
@ -101,9 +101,9 @@ DebugPrint (
DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while
processing another DebugAssert(), then DebugAssert() must return immediately. processing another DebugAssert(), then DebugAssert() must return immediately.
If FileName is NULL, then a <FileName> string of <EFBFBD>(NULL) Filename<EFBFBD> is printed. If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.
If Description is NULL, then a <Description> string of <EFBFBD>(NULL) Description<EFBFBD> is printed. If Description is NULL, then a <Description> string of "(NULL) Description" is printed.
@param FileName Pointer to the name of the source file that generated the assert condition. @param FileName Pointer to the name of the source file that generated the assert condition.
@param LineNumber The line number in the source file that generated the assert condition @param LineNumber The line number in the source file that generated the assert condition

View File

@ -31,8 +31,8 @@ InternalMemSetMem64 PROC USES edi
mov edx, [esp + 20] mov edx, [esp + 20]
mov edi, [esp + 8] mov edi, [esp + 8]
@@: @@:
mov [edi + ecx*4 - 8], eax mov [edi + ecx*8 - 8], eax
mov [edi + ecx*4 - 4], edx mov [edi + ecx*8 - 4], edx
loop @B loop @B
mov eax, edi mov eax, edi
ret ret

View File

@ -32,8 +32,8 @@ InternalMemSetMem64:
movl 20(%esp),%edx movl 20(%esp),%edx
movl 8(%esp),%edi movl 8(%esp),%edi
L0: L0:
mov %eax,-8(%edi,%ecx,4) mov %eax,-8(%edi,%ecx,8)
mov %edx,-4(%edi,%ecx,4) mov %edx,-4(%edi,%ecx,8)
loop L0 loop L0
movl %edi,%eax movl %edi,%eax
pop %edi pop %edi

View File

@ -1299,8 +1299,6 @@ PciCf8ReadBuffer (
UINTN EndAddress; UINTN EndAddress;
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
ASSERT ((StartAddress + Size - 1) <= 0x0FFFFFFF);
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
EndAddress = StartAddress + Size; EndAddress = StartAddress + Size;
@ -1388,8 +1386,6 @@ PciCf8WriteBuffer (
UINTN EndAddress; UINTN EndAddress;
ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0); ASSERT_INVALID_PCI_ADDRESS (StartAddress, 0);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
ASSERT ((StartAddress + Size - 1) <= 0x0FFFFFFF);
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
EndAddress = StartAddress + Size; EndAddress = StartAddress + Size;

View File

@ -1196,8 +1196,6 @@ PciExpressReadBuffer (
UINTN EndAddress; UINTN EndAddress;
ASSERT_INVALID_PCI_ADDRESS (StartAddress); ASSERT_INVALID_PCI_ADDRESS (StartAddress);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
ASSERT ((StartAddress + Size - 1) <= 0x0FFFFFFF);
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
EndAddress = StartAddress + Size; EndAddress = StartAddress + Size;
@ -1284,8 +1282,6 @@ PciExpressWriteBuffer (
UINTN EndAddress; UINTN EndAddress;
ASSERT_INVALID_PCI_ADDRESS (StartAddress); ASSERT_INVALID_PCI_ADDRESS (StartAddress);
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
ASSERT ((StartAddress + Size - 1) <= 0x0FFFFFFF);
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
EndAddress = StartAddress + Size; EndAddress = StartAddress + Size;

View File

@ -66,7 +66,6 @@ static CONST STATUS_LOOKUP_TABLE_ENTRY StatusString[] = {
@param Buffer Character buffer to print the results of the parsing @param Buffer Character buffer to print the results of the parsing
of Format into. of Format into.
@param BufferSize Maximum number of characters to put into buffer. @param BufferSize Maximum number of characters to put into buffer.
Zero means no limit.
@param Flags Intial flags value. @param Flags Intial flags value.
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set Can only have FORMAT_UNICODE and OUTPUT_UNICODE set
@param Format Null-terminated format string. @param Format Null-terminated format string.
@ -110,6 +109,9 @@ BasePrintLibVSPrint (
UINTN Radix; UINTN Radix;
RETURN_STATUS Status; RETURN_STATUS Status;
if (BufferSize == 0) {
return 0;
}
ASSERT (Buffer != NULL); ASSERT (Buffer != NULL);
ASSERT (Format != NULL); ASSERT (Format != NULL);
@ -130,7 +132,6 @@ BasePrintLibVSPrint (
// //
// Reserve space for the Null terminator. // Reserve space for the Null terminator.
// If BufferSize is 0, this will set BufferSize to the max unsigned value
// //
BufferSize--; BufferSize--;
@ -338,7 +339,7 @@ BasePrintLibVSPrint (
} else { } else {
BasePrintLibSPrint ( BasePrintLibSPrint (
ValueBuffer, ValueBuffer,
0, MAXIMUM_VALUE_CHARACTERS,
0, 0,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
TmpGuid->Data1, TmpGuid->Data1,
@ -364,7 +365,7 @@ BasePrintLibVSPrint (
} else { } else {
BasePrintLibSPrint ( BasePrintLibSPrint (
ValueBuffer, ValueBuffer,
0, MAXIMUM_VALUE_CHARACTERS,
0, 0,
"%02d/%02d/%04d %02d:%02d", "%02d/%02d/%04d %02d:%02d",
TmpTime->Month, TmpTime->Month,
@ -386,10 +387,14 @@ BasePrintLibVSPrint (
} }
} }
if (ArgumentString == ValueBuffer) { if (ArgumentString == ValueBuffer) {
BasePrintLibSPrint ((CHAR8 *) ValueBuffer, 0, 0, "%08X", Status); BasePrintLibSPrint ((CHAR8 *) ValueBuffer, MAXIMUM_VALUE_CHARACTERS, 0, "%08X", Status);
} }
break; break;
case '\n':
ArgumentString = "\r\n";
break;
case '%': case '%':
default: default:
// //
@ -400,9 +405,6 @@ BasePrintLibVSPrint (
break; break;
} }
break; break;
case '\n':
ArgumentString = "\r\n";
break;
default: default:
ArgumentString = (CHAR8 *)&FormatCharacter; ArgumentString = (CHAR8 *)&FormatCharacter;
Flags |= ARGUMENT_UNICODE; Flags |= ARGUMENT_UNICODE;
@ -717,7 +719,7 @@ UnicodeSPrintAsciiFormat (
VA_LIST Marker; VA_LIST Marker;
VA_START (Marker, FormatString); VA_START (Marker, FormatString);
return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize >> 1, FormatString, Marker); return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);
} }
/** /**

View File

@ -138,13 +138,20 @@ BasePrintLibConvertValueToString (
UINTN Digits; UINTN Digits;
UINTN Index; UINTN Index;
ASSERT (Buffer != NULL);
ASSERT (Width < MAXIMUM_VALUE_CHARACTERS);
//
// Make sure Flags can only contain supported bits.
//
ASSERT ((Flags & ~(LEFT_JUSTIFY | COMMA_TYPE | PREFIX_ZERO)) == 0);
OriginalBuffer = Buffer; OriginalBuffer = Buffer;
if (Width == 0 || (Flags & COMMA_TYPE) != 0) { if (Width == 0 || (Flags & COMMA_TYPE) != 0) {
Flags &= (~PREFIX_ZERO); Flags &= (~PREFIX_ZERO);
} }
if (Width == 0 || Width > (MAXIMUM_VALUE_CHARACTERS - 1)) { if (Width == 0) {
Width = MAXIMUM_VALUE_CHARACTERS - 1; Width = MAXIMUM_VALUE_CHARACTERS - 1;
} }

View File

@ -31,16 +31,6 @@
#define PRECISION 0x800 #define PRECISION 0x800
#define ARGUMENT_REVERSED 0x1000 #define ARGUMENT_REVERSED 0x1000
///
/// Define the maximum number of characters that are required to encode
/// a decimal, hexidecimal, GUID, or TIME value with a Nll terminator.
/// Maximum Length Decimal String = 28 "-9,223,372,036,854,775,808"
/// Maximum Length Hexidecimal String = 17 "FFFFFFFFFFFFFFFF"
/// Maximum Length GUID = 37 "00000000-0000-0000-0000-000000000000"
/// Maximum Length TIME = 18 "12/12/2006 12:12"
///
#define MAXIMUM_VALUE_CHARACTERS 38
// //
// Record date and time information // Record date and time information
// //

View File

@ -95,12 +95,12 @@ CodeTypeToPostCode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
ReportStatusCodeExtractAssertInfo ( ReportStatusCodeExtractAssertInfo (
IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN EFI_STATUS_CODE_DATA *Data, IN CONST EFI_STATUS_CODE_DATA *Data,
OUT CHAR8 **Filename, OUT CHAR8 **Filename,
OUT CHAR8 **Description, OUT CHAR8 **Description,
OUT UINT32 *LineNumber OUT UINT32 *LineNumber
) )
{ {
EFI_DEBUG_ASSERT_DATA *AssertData; EFI_DEBUG_ASSERT_DATA *AssertData;
@ -155,10 +155,10 @@ ReportStatusCodeExtractAssertInfo (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
ReportStatusCodeExtractDebugInfo ( ReportStatusCodeExtractDebugInfo (
IN EFI_STATUS_CODE_DATA *Data, IN CONST EFI_STATUS_CODE_DATA *Data,
OUT UINT32 *ErrorLevel, OUT UINT32 *ErrorLevel,
OUT VA_LIST *Marker, OUT VA_LIST *Marker,
OUT CHAR8 **Format OUT CHAR8 **Format
) )
{ {
EFI_DEBUG_INFO *DebugInfo; EFI_DEBUG_INFO *DebugInfo;
@ -256,9 +256,9 @@ ReportStatusCode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ReportStatusCodeWithDevicePath ( ReportStatusCodeWithDevicePath (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
) )
{ {
ASSERT (DevicePath != NULL); ASSERT (DevicePath != NULL);
@ -304,7 +304,7 @@ EFIAPI
ReportStatusCodeWithExtendedData ( ReportStatusCodeWithExtendedData (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN VOID *ExtendedData, IN CONST VOID *ExtendedData,
IN UINTN ExtendedDataSize IN UINTN ExtendedDataSize
) )
{ {
@ -361,9 +361,9 @@ ReportStatusCodeEx (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance, IN UINT32 Instance,
IN EFI_GUID *CallerId OPTIONAL, IN CONST EFI_GUID *CallerId OPTIONAL,
IN EFI_GUID *ExtendedDataGuid OPTIONAL, IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL,
IN VOID *ExtendedData OPTIONAL, IN CONST VOID *ExtendedData OPTIONAL,
IN UINTN ExtendedDataSize IN UINTN ExtendedDataSize
) )
{ {

View File

@ -45,7 +45,7 @@ InternalReportStatusCode (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance, IN UINT32 Instance,
IN EFI_GUID *CallerId OPTIONAL, IN CONST EFI_GUID *CallerId OPTIONAL,
IN EFI_STATUS_CODE_DATA *Data OPTIONAL IN EFI_STATUS_CODE_DATA *Data OPTIONAL
) )
{ {
@ -66,7 +66,7 @@ InternalReportStatusCode (
// A Status Code Protocol is present in the handle database, so pass in all the // A Status Code Protocol is present in the handle database, so pass in all the
// parameters to the ReportStatusCode() service of the Status Code Protocol // parameters to the ReportStatusCode() service of the Status Code Protocol
// //
return gStatusCode->ReportStatusCode (Type, Value, Instance, CallerId, Data); return gStatusCode->ReportStatusCode (Type, Value, Instance, (EFI_GUID *)CallerId, Data);
} }
@ -80,14 +80,10 @@ InternalReportStatusCode (
**/ **/
UINTN UINTN
InternalReportStatusCodeDevicePathSize ( InternalReportStatusCodeDevicePathSize (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
) )
{ {
EFI_DEVICE_PATH_PROTOCOL *Start; CONST EFI_DEVICE_PATH_PROTOCOL *Start;
if (DevicePath == NULL) {
return 0;
}
// //
// Search for the end of the device path structure // Search for the end of the device path structure
@ -187,12 +183,12 @@ CodeTypeToPostCode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
ReportStatusCodeExtractAssertInfo ( ReportStatusCodeExtractAssertInfo (
IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN EFI_STATUS_CODE_DATA *Data, IN CONST EFI_STATUS_CODE_DATA *Data,
OUT CHAR8 **Filename, OUT CHAR8 **Filename,
OUT CHAR8 **Description, OUT CHAR8 **Description,
OUT UINT32 *LineNumber OUT UINT32 *LineNumber
) )
{ {
EFI_DEBUG_ASSERT_DATA *AssertData; EFI_DEBUG_ASSERT_DATA *AssertData;
@ -247,10 +243,10 @@ ReportStatusCodeExtractAssertInfo (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
ReportStatusCodeExtractDebugInfo ( ReportStatusCodeExtractDebugInfo (
IN EFI_STATUS_CODE_DATA *Data, IN CONST EFI_STATUS_CODE_DATA *Data,
OUT UINT32 *ErrorLevel, OUT UINT32 *ErrorLevel,
OUT VA_LIST *Marker, OUT VA_LIST *Marker,
OUT CHAR8 **Format OUT CHAR8 **Format
) )
{ {
EFI_DEBUG_INFO *DebugInfo; EFI_DEBUG_INFO *DebugInfo;
@ -348,9 +344,9 @@ ReportStatusCode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ReportStatusCodeWithDevicePath ( ReportStatusCodeWithDevicePath (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
) )
{ {
ASSERT (DevicePath != NULL); ASSERT (DevicePath != NULL);
@ -401,7 +397,7 @@ EFIAPI
ReportStatusCodeWithExtendedData ( ReportStatusCodeWithExtendedData (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN VOID *ExtendedData, IN CONST VOID *ExtendedData,
IN UINTN ExtendedDataSize IN UINTN ExtendedDataSize
) )
{ {
@ -466,9 +462,9 @@ ReportStatusCodeEx (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance, IN UINT32 Instance,
IN EFI_GUID *CallerId OPTIONAL, IN CONST EFI_GUID *CallerId OPTIONAL,
IN EFI_GUID *ExtendedDataGuid OPTIONAL, IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL,
IN VOID *ExtendedData OPTIONAL, IN CONST VOID *ExtendedData OPTIONAL,
IN UINTN ExtendedDataSize IN UINTN ExtendedDataSize
) )
{ {

View File

@ -45,48 +45,21 @@ InternalReportStatusCode (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance, IN UINT32 Instance,
IN EFI_GUID *CallerId OPTIONAL, IN CONST EFI_GUID *CallerId OPTIONAL,
IN EFI_STATUS_CODE_DATA *Data OPTIONAL IN EFI_STATUS_CODE_DATA *Data OPTIONAL
) )
{ {
EFI_PEI_SERVICES **PeiServices; EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer (); PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->PeiReportStatusCode (PeiServices, Type, Value, Instance, CallerId, Data); return (*PeiServices)->PeiReportStatusCode (
} PeiServices,
Type,
Value,
/** Instance,
Computes and returns the size, in bytes, of a device path. (EFI_GUID *)CallerId,
Data
@param DevicePath A pointer to a device path. );
@return The size, in bytes, of DevicePath.
**/
UINTN
InternalReportStatusCodeDevicePathSize (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
EFI_DEVICE_PATH_PROTOCOL *Start;
if (DevicePath == NULL) {
return 0;
}
//
// Search for the end of the device path structure
//
Start = DevicePath;
while (!EfiIsDevicePathEnd (DevicePath)) {
DevicePath = EfiNextDevicePathNode (DevicePath);
}
//
// Subtract the start node from the end node and add in the size of the end node
//
return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath);
} }
@ -173,12 +146,12 @@ CodeTypeToPostCode (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
ReportStatusCodeExtractAssertInfo ( ReportStatusCodeExtractAssertInfo (
IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN EFI_STATUS_CODE_DATA *Data, IN CONST EFI_STATUS_CODE_DATA *Data,
OUT CHAR8 **Filename, OUT CHAR8 **Filename,
OUT CHAR8 **Description, OUT CHAR8 **Description,
OUT UINT32 *LineNumber OUT UINT32 *LineNumber
) )
{ {
EFI_DEBUG_ASSERT_DATA *AssertData; EFI_DEBUG_ASSERT_DATA *AssertData;
@ -233,10 +206,10 @@ ReportStatusCodeExtractAssertInfo (
BOOLEAN BOOLEAN
EFIAPI EFIAPI
ReportStatusCodeExtractDebugInfo ( ReportStatusCodeExtractDebugInfo (
IN EFI_STATUS_CODE_DATA *Data, IN CONST EFI_STATUS_CODE_DATA *Data,
OUT UINT32 *ErrorLevel, OUT UINT32 *ErrorLevel,
OUT VA_LIST *Marker, OUT VA_LIST *Marker,
OUT CHAR8 **Format OUT CHAR8 **Format
) )
{ {
EFI_DEBUG_INFO *DebugInfo; EFI_DEBUG_INFO *DebugInfo;
@ -334,18 +307,13 @@ ReportStatusCode (
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ReportStatusCodeWithDevicePath ( ReportStatusCodeWithDevicePath (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
) )
{ {
ASSERT (DevicePath != NULL); ASSERT (DevicePath != NULL);
return ReportStatusCodeWithExtendedData ( return EFI_UNSUPPORTED;
Type,
Value,
(VOID *)DevicePath,
InternalReportStatusCodeDevicePathSize (DevicePath)
);
} }
@ -387,7 +355,7 @@ EFIAPI
ReportStatusCodeWithExtendedData ( ReportStatusCodeWithExtendedData (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN VOID *ExtendedData, IN CONST VOID *ExtendedData,
IN UINTN ExtendedDataSize IN UINTN ExtendedDataSize
) )
{ {
@ -452,9 +420,9 @@ ReportStatusCodeEx (
IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value, IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance, IN UINT32 Instance,
IN EFI_GUID *CallerId OPTIONAL, IN CONST EFI_GUID *CallerId OPTIONAL,
IN EFI_GUID *ExtendedDataGuid OPTIONAL, IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL,
IN VOID *ExtendedData OPTIONAL, IN CONST VOID *ExtendedData OPTIONAL,
IN UINTN ExtendedDataSize IN UINTN ExtendedDataSize
) )
{ {

View File

@ -23,6 +23,7 @@ GetPeiServicesTablePointer (
VOID VOID
) )
{ {
ASSERT (gPeiServices != NULL);
return gPeiServices; return gPeiServices;
} }

View File

@ -33,6 +33,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</MsaLibHeader> </MsaLibHeader>
<LibraryClassDefinitions> <LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_PRODUCED">PeiServicesTablePointerLib</LibraryClass> <LibraryClass Usage="ALWAYS_PRODUCED">PeiServicesTablePointerLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
</LibraryClassDefinitions> </LibraryClassDefinitions>
<SourceFiles> <SourceFiles>
<Filename>PeiServicesTablePointer.c</Filename> <Filename>PeiServicesTablePointer.c</Filename>

View File

@ -21,7 +21,11 @@ GetPeiServicesTablePointer (
VOID VOID
) )
{ {
return (EFI_PEI_SERVICES **)(UINTN)AsmReadMm7 (); EFI_PEI_SERVICES **PeiServices;
PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadMm7 ();
ASSERT (PeiServices != NULL);
return PeiServices;
} }
/** /**

View File

@ -34,6 +34,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<LibraryClassDefinitions> <LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_PRODUCED">PeiServicesTablePointerLib</LibraryClass> <LibraryClass Usage="ALWAYS_PRODUCED">PeiServicesTablePointerLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass> <LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
</LibraryClassDefinitions> </LibraryClassDefinitions>
<SourceFiles> <SourceFiles>
<Filename>PeiServicesTablePointer.c</Filename> <Filename>PeiServicesTablePointer.c</Filename>

View File

@ -76,7 +76,7 @@ DebugPrint (
Prints an assert message containing a filename, line number, and description. Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop. This may be followed by a breakpoint or a dead loop.
Print a message of the form <EFBFBD>ASSERT <FileName>(<LineNumber>): <Description>\n<EFBFBD> Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
@ -85,9 +85,9 @@ DebugPrint (
DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while
processing another DebugAssert(), then DebugAssert() must return immediately. processing another DebugAssert(), then DebugAssert() must return immediately.
If FileName is NULL, then a <FileName> string of <EFBFBD>(NULL) Filename<EFBFBD> is printed. If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.
If Description is NULL, then a <Description> string of <EFBFBD>(NULL) Description<EFBFBD> is printed. If Description is NULL, then a <Description> string of "(NULL) Description" is printed.
@param FileName Pointer to the name of the source file that generated the assert condition. @param FileName Pointer to the name of the source file that generated the assert condition.
@param LineNumber The line number in the source file that generated the assert condition @param LineNumber The line number in the source file that generated the assert condition

View File

@ -76,7 +76,7 @@ DebugPrint (
Prints an assert message containing a filename, line number, and description. Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop. This may be followed by a breakpoint or a dead loop.
Print a message of the form <EFBFBD>ASSERT <FileName>(<LineNumber>): <Description>\n<EFBFBD> Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
@ -85,9 +85,9 @@ DebugPrint (
DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while
processing another DebugAssert(), then DebugAssert() must return immediately. processing another DebugAssert(), then DebugAssert() must return immediately.
If FileName is NULL, then a <FileName> string of <EFBFBD>(NULL) Filename<EFBFBD> is printed. If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.
If Description is NULL, then a <Description> string of <EFBFBD>(NULL) Description<EFBFBD> is printed. If Description is NULL, then a <Description> string of "(NULL) Description" is printed.
@param FileName Pointer to the name of the source file that generated the assert condition. @param FileName Pointer to the name of the source file that generated the assert condition.
@param LineNumber The line number in the source file that generated the assert condition @param LineNumber The line number in the source file that generated the assert condition