Store all configuration in a linked list, read config from INI file and EFI shell
This commit is contained in:
@@ -36,14 +36,14 @@ BlDebugPrint(IN PUINT16 Format,
|
||||
VA_START(Arguments, Format);
|
||||
|
||||
/* Check if serial debug port is enabled */
|
||||
if((BlpConfiguration.DebugPort & XTBL_DEBUGPORT_SERIAL) && (BlpSerialPort.Flags & COMPORT_FLAG_INIT))
|
||||
if((BlpDebugPort & XTBL_DEBUGPORT_SERIAL) && (BlpSerialPort.Flags & COMPORT_FLAG_INIT))
|
||||
{
|
||||
/* Format and print the string to the serial console */
|
||||
BlpStringPrint(BlpDebugPutChar, Format, Arguments);
|
||||
}
|
||||
|
||||
/* Check if screen debug port is enabled and Boot Services are still available */
|
||||
if((BlpConfiguration.DebugPort & XTBL_DEBUGPORT_SCREEN) && (BlpStatus.BootServices == TRUE))
|
||||
if((BlpDebugPort & XTBL_DEBUGPORT_SCREEN) && (BlpStatus.BootServices == TRUE))
|
||||
{
|
||||
/* Format and print the string to the screen */
|
||||
BlpStringPrint(BlpConsolePrintChar, Format, Arguments);
|
||||
@@ -66,7 +66,7 @@ EFI_STATUS
|
||||
BlpInitializeDebugConsole()
|
||||
{
|
||||
ULONG PortAddress, PortNumber, BaudRate;
|
||||
PWCHAR DebugPort, LastPort;
|
||||
PWCHAR DebugConfiguration, DebugPort, LastPort;
|
||||
EFI_STATUS Status;
|
||||
|
||||
/* Set default serial port options */
|
||||
@@ -74,11 +74,14 @@ BlpInitializeDebugConsole()
|
||||
PortNumber = 0;
|
||||
BaudRate = 0;
|
||||
|
||||
/* Make sure any debug options are provided */
|
||||
if(BlpConfiguration.Debug)
|
||||
/* Get debug configuration */
|
||||
DebugConfiguration = BlGetConfigValue(L"DEBUG");
|
||||
|
||||
/* Make sure any debug options are provided and debug console is not initialized yet */
|
||||
if(DebugConfiguration && BlpDebugPort == 0)
|
||||
{
|
||||
/* Find all debug ports */
|
||||
DebugPort = RtlTokenizeWideString(BlpConfiguration.Debug, L";", &LastPort);
|
||||
DebugPort = RtlTokenizeWideString(DebugConfiguration, L";", &LastPort);
|
||||
|
||||
/* Iterate over all debug ports */
|
||||
while(DebugPort != NULL)
|
||||
@@ -138,12 +141,12 @@ BlpInitializeDebugConsole()
|
||||
}
|
||||
|
||||
/* Enable debug port */
|
||||
BlpConfiguration.DebugPort |= XTBL_DEBUGPORT_SERIAL;
|
||||
BlpDebugPort |= XTBL_DEBUGPORT_SERIAL;
|
||||
}
|
||||
else if(RtlCompareWideStringInsensitive(DebugPort, L"SCREEN", 5) == 0)
|
||||
{
|
||||
/* Enable debug port */
|
||||
BlpConfiguration.DebugPort |= XTBL_DEBUGPORT_SCREEN;
|
||||
BlpDebugPort |= XTBL_DEBUGPORT_SCREEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -158,14 +161,14 @@ BlpInitializeDebugConsole()
|
||||
}
|
||||
|
||||
/* Check if serial debug port is enabled */
|
||||
if(BlpConfiguration.DebugPort & XTBL_DEBUGPORT_SERIAL)
|
||||
if(BlpDebugPort & XTBL_DEBUGPORT_SERIAL)
|
||||
{
|
||||
/* Try to initialize COM port */
|
||||
Status = BlpInitializeSerialPort(PortNumber, PortAddress, BaudRate);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Remove serial debug port, as COM port initialization failed and return */
|
||||
BlpConfiguration.DebugPort &= ~XTBL_DEBUGPORT_SERIAL;
|
||||
BlpDebugPort &= ~XTBL_DEBUGPORT_SERIAL;
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user