Mark serial port as fully initialized and always check that before printing anything to the serial console
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
a9171bd512
commit
e6aaa1a83c
@ -21,8 +21,9 @@
|
|||||||
#define COMPORT_DIV_DLM 0x01 /* Divisor Latch Most */
|
#define COMPORT_DIV_DLM 0x01 /* Divisor Latch Most */
|
||||||
|
|
||||||
/* Serial port control flags */
|
/* Serial port control flags */
|
||||||
#define COMPORT_FLAG_DBR 0x01 /* Default Baud Rate */
|
#define COMPORT_FLAG_INIT 0x01 /* Port Initialized */
|
||||||
#define COMPORT_FLAG_MC 0x02 /* Modem Control */
|
#define COMPORT_FLAG_DBR 0x02 /* Default Baud Rate */
|
||||||
|
#define COMPORT_FLAG_MC 0x04 /* Modem Control */
|
||||||
|
|
||||||
/* Serial port Fifo Control Register (FCR) access masks */
|
/* Serial port Fifo Control Register (FCR) access masks */
|
||||||
#define COMPORT_FCR_DISABLE 0x00 /* Disable */
|
#define COMPORT_FCR_DISABLE 0x00 /* Disable */
|
||||||
|
@ -212,6 +212,7 @@ HlInitializeComPort(IN OUT PCPPORT Port,
|
|||||||
{
|
{
|
||||||
PUCHAR Address;
|
PUCHAR Address;
|
||||||
UCHAR Byte = 0;
|
UCHAR Byte = 0;
|
||||||
|
USHORT Flags = 0;
|
||||||
ULONG Mode;
|
ULONG Mode;
|
||||||
|
|
||||||
/* Check if serial port is set */
|
/* Check if serial port is set */
|
||||||
@ -233,7 +234,7 @@ HlInitializeComPort(IN OUT PCPPORT Port,
|
|||||||
{
|
{
|
||||||
/* Use default baud (clock) rate if not set */
|
/* Use default baud (clock) rate if not set */
|
||||||
BaudRate = COMPORT_CLOCK_RATE;
|
BaudRate = COMPORT_CLOCK_RATE;
|
||||||
Port->Flags = COMPORT_FLAG_DBR;
|
Flags |= COMPORT_FLAG_DBR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store COM pointer */
|
/* Store COM pointer */
|
||||||
@ -288,10 +289,14 @@ HlInitializeComPort(IN OUT PCPPORT Port,
|
|||||||
return STATUS_IO_DEVICE_ERROR;
|
return STATUS_IO_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mark port as fully initialized */
|
||||||
|
Flags |= COMPORT_FLAG_INIT;
|
||||||
|
|
||||||
/* Disable loopback mode and use port normally */
|
/* Disable loopback mode and use port normally */
|
||||||
HlIoPortOutByte(PtrToUshort(Address + (ULONG)COMPORT_REG_MCR), COMPORT_MCR_NOM);
|
HlIoPortOutByte(PtrToUshort(Address + (ULONG)COMPORT_REG_MCR), COMPORT_MCR_NOM);
|
||||||
Port->Address = Address;
|
Port->Address = Address;
|
||||||
Port->Baud = BaudRate;
|
Port->Baud = BaudRate;
|
||||||
|
Port->Flags = Flags;
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -28,6 +28,9 @@ BlDbgPrint(IN PUINT16 Format,
|
|||||||
{
|
{
|
||||||
VA_LIST Arguments;
|
VA_LIST Arguments;
|
||||||
|
|
||||||
|
/* Check if EFI serial port is fully initialized */
|
||||||
|
if(EfiSerialPort.Flags & COMPORT_FLAG_INIT)
|
||||||
|
{
|
||||||
/* Initialise the va_list */
|
/* Initialise the va_list */
|
||||||
VA_START(Arguments, Format);
|
VA_START(Arguments, Format);
|
||||||
|
|
||||||
@ -37,6 +40,7 @@ BlDbgPrint(IN PUINT16 Format,
|
|||||||
/* Clean up the va_list */
|
/* Clean up the va_list */
|
||||||
VA_END(Arguments);
|
VA_END(Arguments);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This routine formats the input string and prints it out to the stdout and serial console.
|
* This routine formats the input string and prints it out to the stdout and serial console.
|
||||||
@ -65,8 +69,12 @@ BlEfiPrint(IN PUINT16 Format,
|
|||||||
/* Format and print the string to the stdout */
|
/* Format and print the string to the stdout */
|
||||||
BlStringPrint(BlConsolePutChar, Format, Arguments);
|
BlStringPrint(BlConsolePutChar, Format, Arguments);
|
||||||
|
|
||||||
|
/* Check if EFI serial port is fully initialized */
|
||||||
|
if(EfiSerialPort.Flags & COMPORT_FLAG_INIT)
|
||||||
|
{
|
||||||
/* Format and print the string to the serial console */
|
/* Format and print the string to the serial console */
|
||||||
BlStringPrint(BlComPortPutChar, Format, Arguments);
|
BlStringPrint(BlComPortPutChar, Format, Arguments);
|
||||||
|
}
|
||||||
|
|
||||||
/* Clean up the va_list */
|
/* Clean up the va_list */
|
||||||
VA_END(Arguments);
|
VA_END(Arguments);
|
||||||
|
Loading…
Reference in New Issue
Block a user