/** @file\r
Serial I/O status code reporting worker.\r
\r
- Copyright (c) 2006 - 2009, Intel Corporation \r
- All rights reserved. This program and the accompanying materials \r
+ Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
http://opensource.org/licenses/bsd-license.php \r
\r
#include "StatusCodeRuntimeDxe.h"\r
\r
-EFI_SERIAL_IO_PROTOCOL *mSerialIoProtocol;\r
-\r
-/**\r
- Locates Serial I/O Protocol as initialization for serial status code worker.\r
- \r
- @retval EFI_SUCCESS Serial I/O Protocol is successfully located.\r
-\r
-**/\r
-EFI_STATUS\r
-EfiSerialStatusCodeInitializeWorker (\r
- VOID\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- Status = gBS->LocateProtocol (\r
- &gEfiSerialIoProtocolGuid,\r
- NULL,\r
- (VOID **) &mSerialIoProtocol\r
- );\r
-\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
/**\r
Convert status code value and extended data to readable ASCII string, send string to serial I/O device.\r
\r
UINT32 ErrorLevel;\r
UINT32 LineNumber;\r
UINTN CharCount;\r
- VA_LIST Marker;\r
-\r
- if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {\r
- if (EfiAtRuntime ()) {\r
- return EFI_DEVICE_ERROR;\r
- }\r
- if (EfiGetCurrentTpl () > TPL_CALLBACK ) {\r
- return EFI_DEVICE_ERROR;\r
- }\r
- }\r
+ BASE_LIST Marker;\r
\r
Buffer[0] = '\0';\r
\r
//\r
CharCount = AsciiSPrint (\r
Buffer,\r
- EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+ sizeof (Buffer),\r
"\n\rDXE_ASSERT!: %a (%d): %a\n\r",\r
Filename,\r
LineNumber,\r
//\r
// Print DEBUG() information into output buffer.\r
//\r
- CharCount = AsciiVSPrint (\r
+ CharCount = AsciiBSPrint (\r
Buffer, \r
- EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+ sizeof (Buffer), \r
Format, \r
Marker\r
);\r
//\r
CharCount = AsciiSPrint (\r
Buffer, \r
- EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+ sizeof (Buffer), \r
"ERROR: C%x:V%x I%x", \r
CodeType, \r
Value, \r
\r
if (CallerId != NULL) {\r
CharCount += AsciiSPrint (\r
- &Buffer[CharCount - 1],\r
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+ &Buffer[CharCount],\r
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),\r
" %g",\r
CallerId\r
);\r
\r
if (Data != NULL) {\r
CharCount += AsciiSPrint (\r
- &Buffer[CharCount - 1],\r
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+ &Buffer[CharCount],\r
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),\r
" %x",\r
Data\r
);\r
}\r
\r
CharCount += AsciiSPrint (\r
- &Buffer[CharCount - 1],\r
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+ &Buffer[CharCount],\r
+ (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)),\r
"\n\r"\r
);\r
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
//\r
CharCount = AsciiSPrint (\r
Buffer, \r
- EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+ sizeof (Buffer), \r
"PROGRESS CODE: V%x I%x\n\r", \r
Value, \r
Instance\r
//\r
CharCount = AsciiSPrint (\r
Buffer, \r
- EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+ sizeof (Buffer), \r
"Undefined: C%x:V%x I%x\n\r", \r
CodeType, \r
Value, \r
);\r
}\r
\r
-\r
- if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {\r
- //\r
- // Call SerialPort Lib function to do print.\r
- //\r
- SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
- }\r
- if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {\r
- mSerialIoProtocol->Write (\r
- mSerialIoProtocol,\r
- &CharCount,\r
- Buffer\r
- );\r
- }\r
+ //\r
+ // Call SerialPort Lib function to do print.\r
+ //\r
+ SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
\r
return EFI_SUCCESS;\r
}\r