Silicon/RK3588: Add option to change serial baud rate within UEFI

Firstly, split up the Dw8250 serial lib into "full" and "debug"
versions. The full version is only used at SEC phase (PrePi) for setting
the specified baud rate, while the debug one is used everywhere else and
cannot reinitialize the UART.

To read the baud rate NV variable in SEC, introduce BaseVariableLib,
which is just a slightly modified FaultTolerantWritePei + VariablePei to
not use HOBs and PPIs, since they're not available this early.

Previous boot stages (DDR, TF-A, U-Boot SPL) are still hardcoded to
output at 1.5 Mbaud.

Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
This commit is contained in:
Mario Bălănică
2024-01-10 02:55:29 +02:00
parent a7806a34ac
commit bc0a1bc833
22 changed files with 2172 additions and 265 deletions

View File

@@ -65,10 +65,10 @@ STATIC PLATFORM_SERIAL_CONSOLE mSerialConsole = {
{
{ MESSAGING_DEVICE_PATH, MSG_UART_DP, DP_NODE_LEN (UART_DEVICE_PATH) },
0, // Reserved
FixedPcdGet64 (PcdUartDefaultBaudRate), // BaudRate
FixedPcdGet8 (PcdUartDefaultDataBits), // DataBits
FixedPcdGet8 (PcdUartDefaultParity), // Parity
FixedPcdGet8 (PcdUartDefaultStopBits) // StopBits
0, // BaudRate
0, // DataBits
0, // Parity
0, // StopBits
},
//
@@ -926,6 +926,11 @@ PlatformBootManagerBeforeConsole (
"PcdUartDefaultStopBits must be set to an actual value, not 'default'"
);
mSerialConsole.Uart.BaudRate = PcdGet64 (PcdUartDefaultBaudRate);
mSerialConsole.Uart.DataBits = PcdGet8 (PcdUartDefaultDataBits);
mSerialConsole.Uart.Parity = PcdGet8 (PcdUartDefaultParity);
mSerialConsole.Uart.StopBits = PcdGet8 (PcdUartDefaultStopBits);
CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid);
EfiBootManagerUpdateConsoleVariable (