mirror of
https://github.com/edk2-porting/edk2-rk3588.git
synced 2025-12-18 11:39:51 +08:00
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:
@@ -0,0 +1,90 @@
|
||||
/** @file
|
||||
*
|
||||
* Read-only non-volatile variable service library for early SEC phase.
|
||||
* Based on FaultTolerantWritePei and VariablePei, without using any HOBs.
|
||||
*
|
||||
* Copyright (c) 2024, Mario Bălănică <mariobalanica02@gmail.com>
|
||||
* Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||
* Copyright (c) Microsoft Corporation.<BR>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __BASE_VARIABLE_LIB_H__
|
||||
#define __BASE_VARIABLE_LIB_H__
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
/**
|
||||
This service retrieves a variable's value using its name and GUID.
|
||||
|
||||
Read the specified variable from the UEFI variable store. If the Data
|
||||
buffer is too small to hold the contents of the variable, the error
|
||||
EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer
|
||||
size to obtain the data.
|
||||
|
||||
@param VariableName A pointer to a null-terminated string that is the variable's name.
|
||||
@param VariableGuid A pointer to an EFI_GUID that is the variable's GUID. The combination of
|
||||
VariableGuid and VariableName must be unique.
|
||||
@param Attributes If non-NULL, on return, points to the variable's attributes.
|
||||
@param DataSize On entry, points to the size in bytes of the Data buffer.
|
||||
On return, points to the size of the data returned in Data.
|
||||
@param Data Points to the buffer which will hold the returned variable value.
|
||||
May be NULL with a zero DataSize in order to determine the size of the buffer needed.
|
||||
|
||||
@retval EFI_SUCCESS The variable was read successfully.
|
||||
@retval EFI_NOT_FOUND The variable was not found.
|
||||
@retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the resulting data.
|
||||
DataSize is updated with the size required for
|
||||
the specified variable.
|
||||
@retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.
|
||||
@retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BaseGetVariable (
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN CONST EFI_GUID *VariableGuid,
|
||||
OUT UINT32 *Attributes,
|
||||
IN OUT UINTN *DataSize,
|
||||
OUT VOID *Data OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Return the next variable name and GUID.
|
||||
|
||||
This function is called multiple times to retrieve the VariableName
|
||||
and VariableGuid of all variables currently available in the system.
|
||||
On each call, the previous results are passed into the interface,
|
||||
and, on return, the interface returns the data for the next
|
||||
interface. When the entire variable list has been returned,
|
||||
EFI_NOT_FOUND is returned.
|
||||
|
||||
@param VariableNameSize On entry, points to the size of the buffer pointed to by VariableName.
|
||||
@param VariableName On entry, a pointer to a null-terminated string that is the variable's name.
|
||||
On return, points to the next variable's null-terminated name string.
|
||||
|
||||
@param VariableGuid On entry, a pointer to an UEFI _GUID that is the variable's GUID.
|
||||
On return, a pointer to the next variable's GUID.
|
||||
|
||||
@retval EFI_SUCCESS The variable was read successfully.
|
||||
@retval EFI_NOT_FOUND The variable could not be found.
|
||||
@retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the resulting
|
||||
data. VariableNameSize is updated with the size
|
||||
required for the specified variable.
|
||||
@retval EFI_INVALID_PARAMETER VariableName, VariableGuid or
|
||||
VariableNameSize is NULL.
|
||||
@retval EFI_DEVICE_ERROR The variable could not be retrieved because of a device error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BaseGetNextVariableName (
|
||||
IN OUT UINTN *VariableNameSize,
|
||||
IN OUT CHAR16 *VariableName,
|
||||
IN OUT EFI_GUID *VariableGuid
|
||||
);
|
||||
|
||||
#endif // __BASE_VARIABLE_LIB_H__
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
#/** @file
|
||||
#
|
||||
# Read-only non-volatile variable service library for early SEC phase.
|
||||
# Based on FaultTolerantWritePei and VariablePei, without using any HOBs or PPIs.
|
||||
#
|
||||
# Copyright (c) 2024, Mario Bălănică <mariobalanica02@gmail.com>
|
||||
# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) Microsoft Corporation.<BR>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001A
|
||||
BASE_NAME = BaseVariableLib
|
||||
FILE_GUID = 0a9a1145-e20f-4d69-be68-eb13b3c3e4a3
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = BaseVariableLib
|
||||
|
||||
[Sources]
|
||||
BaseVariableLib.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
Silicon/Rockchip/RockchipPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
PcdLib
|
||||
|
||||
[Guids]
|
||||
gEdkiiWorkingBlockSignatureGuid ## SOMETIMES_CONSUMES ## GUID
|
||||
gEfiAuthenticatedVariableGuid ## SOMETIMES_CONSUMES ## GUID
|
||||
gEfiVariableGuid ## SOMETIMES_CONSUMES ## GUID
|
||||
gEfiSystemNvDataFvGuid ## SOMETIMES_CONSUMES ## GUID
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SOMETIMES_CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## SOMETIMES_CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## SOMETIMES_CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable ## SOMETIMES_CONSUMES
|
||||
@@ -0,0 +1,45 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2024, Mario Bălănică <mariobalanica02@gmail.com>
|
||||
* Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef _BASE_VARIABLE_H_
|
||||
#define _BASE_VARIABLE_H_
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <Uefi/UefiMultiPhase.h>
|
||||
#include <Pi/PiMultiPhase.h>
|
||||
|
||||
#include <Guid/VariableFormat.h>
|
||||
#include <Guid/VariableIndexTable.h>
|
||||
#include <Guid/SystemNvDataGuid.h>
|
||||
#include <Guid/FaultTolerantWrite.h>
|
||||
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/BaseVariableLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
|
||||
typedef enum {
|
||||
VariableStoreTypeHob,
|
||||
VariableStoreTypeNv,
|
||||
VariableStoreTypeMax
|
||||
} VARIABLE_STORE_TYPE;
|
||||
|
||||
typedef struct {
|
||||
VARIABLE_STORE_HEADER *VariableStoreHeader;
|
||||
VARIABLE_INDEX_TABLE *IndexTable;
|
||||
//
|
||||
// If it is not NULL, it means there may be an inconsecutive variable whose
|
||||
// partial content is still in NV storage, but another partial content is backed up
|
||||
// in spare block.
|
||||
//
|
||||
FAULT_TOLERANT_WRITE_LAST_WRITE_DATA *FtwLastWriteData;
|
||||
BOOLEAN AuthFlag;
|
||||
} VARIABLE_STORE_INFO;
|
||||
|
||||
#endif // _BASE_VARIABLE_H_
|
||||
@@ -0,0 +1,40 @@
|
||||
/** @file
|
||||
UART Serial Port library functions
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation
|
||||
Copyright (c) 2015 - 2016, Hisilicon Limited. All rights reserved.
|
||||
Copyright (c) 2015 - 2016, Linaro Limited. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Based on the files under ArmPlatformPkg/Library/PL011SerialPortLib/
|
||||
**/
|
||||
#include <Uefi.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/IoLib.h>
|
||||
#include <Protocol/SerialIo.h>
|
||||
|
||||
#include "Dw8250SerialPortLib.h"
|
||||
|
||||
/**
|
||||
Initialize the serial device hardware.
|
||||
|
||||
If no initialization is required, then return RETURN_SUCCESS.
|
||||
If the serial device was successfuly initialized, then return RETURN_SUCCESS.
|
||||
If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
|
||||
|
||||
@retval RETURN_SUCCESS The serial device was initialized.
|
||||
@retval RETURN_DEVICE_ERROR The serail device could not be initialized.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
//
|
||||
// Assume already initialized.
|
||||
//
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#/** @file
|
||||
#
|
||||
# Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
|
||||
# Copyright (c) 2015-2016, Hisilicon Limited. All rights reserved.<BR>
|
||||
# Copyright (c) 2015-2016, Linaro Limited. All rights reserved.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
# Based on the files under ArmPlatformPkg/Library/PL011SerialPortLib/
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = Dw8250SerialPortLib
|
||||
FILE_GUID = e9b88aa0-16a5-447b-9c05-a77521db1a9e
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = SerialPortLib
|
||||
|
||||
[Sources.common]
|
||||
DebugDw8250SerialPortLib.c
|
||||
Dw8250SerialPortLibCommon.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
Silicon/Hisilicon/HisiPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
IoLib
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
|
||||
gHisiTokenSpaceGuid.PcdSerialPortSendDelay
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include "Dw8250SerialPortLib.h"
|
||||
|
||||
|
||||
/**
|
||||
Initialize the serial device hardware.
|
||||
|
||||
@@ -49,248 +48,3 @@ SerialPortInitialize (
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Write data from buffer to serial device.
|
||||
|
||||
Writes NumberOfBytes data bytes from Buffer to the serial device.
|
||||
The number of bytes actually written to the serial device is returned.
|
||||
If the return value is less than NumberOfBytes, then the write operation failed.
|
||||
|
||||
If Buffer is NULL, then ASSERT().
|
||||
|
||||
If NumberOfBytes is zero, then return 0.
|
||||
|
||||
@param Buffer Pointer to the data buffer to be written.
|
||||
@param NumberOfBytes Number of bytes to written to the serial device.
|
||||
|
||||
@retval 0 NumberOfBytes is 0.
|
||||
@retval >0 The number of bytes written to the serial device.
|
||||
If this value is less than NumberOfBytes, then the read operation failed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
SerialPortWrite (
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
{
|
||||
UINTN Result;
|
||||
|
||||
if (NULL == Buffer) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result = NumberOfBytes;
|
||||
|
||||
while (NumberOfBytes--) {
|
||||
|
||||
SerialPortWriteChar(*Buffer);
|
||||
Buffer++;
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reads data from a serial device into a buffer.
|
||||
|
||||
@param Buffer Pointer to the data buffer to store the data read from the serial device.
|
||||
@param NumberOfBytes Number of bytes to read from the serial device.
|
||||
|
||||
@retval 0 NumberOfBytes is 0.
|
||||
@retval >0 The number of bytes read from the serial device.
|
||||
If this value is less than NumberOfBytes, then the read operation failed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
SerialPortRead (
|
||||
OUT UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
{
|
||||
UINTN Result;
|
||||
|
||||
if (NULL == Buffer) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result = 0;
|
||||
|
||||
while (NumberOfBytes--) {
|
||||
//
|
||||
// Wait for the serail port to be ready.
|
||||
//
|
||||
*Buffer=SerialPortReadChar();
|
||||
Buffer++ ;
|
||||
Result++;
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
/**
|
||||
Polls a serial device to see if there is any data waiting to be read.
|
||||
|
||||
Polls aserial device to see if there is any data waiting to be read.
|
||||
If there is data waiting to be read from the serial device, then TRUE is returned.
|
||||
If there is no data waiting to be read from the serial device, then FALSE is returned.
|
||||
|
||||
@retval TRUE Data is waiting to be read from the serial device.
|
||||
@retval FALSE There is no data waiting to be read from the serial device.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
SerialPortPoll (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
|
||||
return (BOOLEAN) ((MmioRead8 (UART_LSR_REG) & UART_LSR_DR) == UART_LSR_DR);
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID SerialPortWriteChar(UINT8 scShowChar)
|
||||
{
|
||||
UINT32 ulLoop = 0;
|
||||
|
||||
while(ulLoop < (UINT32)UART_SEND_DELAY)
|
||||
{
|
||||
|
||||
if ((MmioRead8 (UART_USR_REG) & 0x02) == 0x02)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ulLoop++;
|
||||
}
|
||||
MmioWrite8 (UART_THR_REG, (UINT8)scShowChar);
|
||||
|
||||
ulLoop = 0;
|
||||
while(ulLoop < (UINT32)UART_SEND_DELAY)
|
||||
{
|
||||
if ((MmioRead8 (UART_USR_REG) & 0x04) == 0x04)
|
||||
{
|
||||
break;
|
||||
}
|
||||
ulLoop++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
UINT8 SerialPortReadChar(VOID)
|
||||
{
|
||||
UINT8 recvchar = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
if ((MmioRead8 (UART_LSR_REG) & UART_LSR_DR) == UART_LSR_DR)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
recvchar = MmioRead8 (UART_RBR_REG);
|
||||
|
||||
return recvchar;
|
||||
}
|
||||
|
||||
/**
|
||||
Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
|
||||
data bits, and stop bits on a serial device.
|
||||
|
||||
@param BaudRate The requested baud rate. A BaudRate value of 0 will use the
|
||||
device's default interface speed.
|
||||
On output, the value actually set.
|
||||
@param ReveiveFifoDepth The requested depth of the FIFO on the receive side of the
|
||||
serial interface. A ReceiveFifoDepth value of 0 will use
|
||||
the device's default FIFO depth.
|
||||
On output, the value actually set.
|
||||
@param Timeout The requested time out for a single character in microseconds.
|
||||
This timeout applies to both the transmit and receive side of the
|
||||
interface. A Timeout value of 0 will use the device's default time
|
||||
out value.
|
||||
On output, the value actually set.
|
||||
@param Parity The type of parity to use on this serial device. A Parity value of
|
||||
DefaultParity will use the device's default parity value.
|
||||
On output, the value actually set.
|
||||
@param DataBits The number of data bits to use on the serial device. A DataBits
|
||||
vaule of 0 will use the device's default data bit setting.
|
||||
On output, the value actually set.
|
||||
@param StopBits The number of stop bits to use on this serial device. A StopBits
|
||||
value of DefaultStopBits will use the device's default number of
|
||||
stop bits.
|
||||
On output, the value actually set.
|
||||
|
||||
@retval RETURN_SUCCESS The new attributes were set on the serial device.
|
||||
@retval RETURN_UNSUPPORTED The serial device does not support this operation.
|
||||
@retval RETURN_INVALID_PARAMETER One or more of the attributes has an unsupported value.
|
||||
@retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortSetAttributes (
|
||||
IN OUT UINT64 *BaudRate,
|
||||
IN OUT UINT32 *ReceiveFifoDepth,
|
||||
IN OUT UINT32 *Timeout,
|
||||
IN OUT EFI_PARITY_TYPE *Parity,
|
||||
IN OUT UINT8 *DataBits,
|
||||
IN OUT EFI_STOP_BITS_TYPE *StopBits
|
||||
)
|
||||
{
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Set the serial device control bits.
|
||||
|
||||
@param Control Control bits which are to be set on the serial device.
|
||||
|
||||
@retval EFI_SUCCESS The new control bits were set on the serial device.
|
||||
@retval EFI_UNSUPPORTED The serial device does not support this operation.
|
||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortSetControl (
|
||||
IN UINT32 Control
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the serial device control bits.
|
||||
|
||||
@param Control Control signals read from the serial device.
|
||||
|
||||
@retval EFI_SUCCESS The control bits were read from the serial device.
|
||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortGetControl (
|
||||
OUT UINT32 *Control
|
||||
)
|
||||
{
|
||||
|
||||
if (SerialPortPoll ()) {
|
||||
// If a character is pending don't set EFI_SERIAL_INPUT_BUFFER_EMPTY
|
||||
*Control = EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
|
||||
} else {
|
||||
*Control = EFI_SERIAL_INPUT_BUFFER_EMPTY | EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,21 +11,19 @@
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = Dw8250SerialPortLib
|
||||
FILE_GUID = 78337705-D2A8-4EA7-9C18-27FC4A8A2C6E
|
||||
FILE_GUID = e7016ad2-40dd-406f-81ef-535da603c8e1
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = SerialPortLib
|
||||
|
||||
|
||||
[Sources.common]
|
||||
Dw8250SerialPortLib.c
|
||||
|
||||
Dw8250SerialPortLibCommon.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
|
||||
Silicon/Hisilicon/HisiPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
/** @file
|
||||
UART Serial Port library functions
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation
|
||||
Copyright (c) 2015 - 2016, Hisilicon Limited. All rights reserved.
|
||||
Copyright (c) 2015 - 2016, Linaro Limited. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
Based on the files under ArmPlatformPkg/Library/PL011SerialPortLib/
|
||||
**/
|
||||
#include <Uefi.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/IoLib.h>
|
||||
#include <Protocol/SerialIo.h>
|
||||
|
||||
#include "Dw8250SerialPortLib.h"
|
||||
|
||||
/**
|
||||
Write data from buffer to serial device.
|
||||
|
||||
Writes NumberOfBytes data bytes from Buffer to the serial device.
|
||||
The number of bytes actually written to the serial device is returned.
|
||||
If the return value is less than NumberOfBytes, then the write operation failed.
|
||||
|
||||
If Buffer is NULL, then ASSERT().
|
||||
|
||||
If NumberOfBytes is zero, then return 0.
|
||||
|
||||
@param Buffer Pointer to the data buffer to be written.
|
||||
@param NumberOfBytes Number of bytes to written to the serial device.
|
||||
|
||||
@retval 0 NumberOfBytes is 0.
|
||||
@retval >0 The number of bytes written to the serial device.
|
||||
If this value is less than NumberOfBytes, then the read operation failed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
SerialPortWrite (
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
{
|
||||
UINTN Result;
|
||||
|
||||
if (NULL == Buffer) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result = NumberOfBytes;
|
||||
|
||||
while (NumberOfBytes--) {
|
||||
|
||||
SerialPortWriteChar(*Buffer);
|
||||
Buffer++;
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reads data from a serial device into a buffer.
|
||||
|
||||
@param Buffer Pointer to the data buffer to store the data read from the serial device.
|
||||
@param NumberOfBytes Number of bytes to read from the serial device.
|
||||
|
||||
@retval 0 NumberOfBytes is 0.
|
||||
@retval >0 The number of bytes read from the serial device.
|
||||
If this value is less than NumberOfBytes, then the read operation failed.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
EFIAPI
|
||||
SerialPortRead (
|
||||
OUT UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
{
|
||||
UINTN Result;
|
||||
|
||||
if (NULL == Buffer) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result = 0;
|
||||
|
||||
while (NumberOfBytes--) {
|
||||
//
|
||||
// Wait for the serail port to be ready.
|
||||
//
|
||||
*Buffer=SerialPortReadChar();
|
||||
Buffer++ ;
|
||||
Result++;
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
/**
|
||||
Polls a serial device to see if there is any data waiting to be read.
|
||||
|
||||
Polls aserial device to see if there is any data waiting to be read.
|
||||
If there is data waiting to be read from the serial device, then TRUE is returned.
|
||||
If there is no data waiting to be read from the serial device, then FALSE is returned.
|
||||
|
||||
@retval TRUE Data is waiting to be read from the serial device.
|
||||
@retval FALSE There is no data waiting to be read from the serial device.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
SerialPortPoll (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
|
||||
return (BOOLEAN) ((MmioRead8 (UART_LSR_REG) & UART_LSR_DR) == UART_LSR_DR);
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID SerialPortWriteChar(UINT8 scShowChar)
|
||||
{
|
||||
UINT32 ulLoop = 0;
|
||||
|
||||
while(ulLoop < (UINT32)UART_SEND_DELAY)
|
||||
{
|
||||
|
||||
if ((MmioRead8 (UART_USR_REG) & 0x02) == 0x02)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ulLoop++;
|
||||
}
|
||||
MmioWrite8 (UART_THR_REG, (UINT8)scShowChar);
|
||||
|
||||
ulLoop = 0;
|
||||
while(ulLoop < (UINT32)UART_SEND_DELAY)
|
||||
{
|
||||
if ((MmioRead8 (UART_USR_REG) & 0x04) == 0x04)
|
||||
{
|
||||
break;
|
||||
}
|
||||
ulLoop++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
UINT8 SerialPortReadChar(VOID)
|
||||
{
|
||||
UINT8 recvchar = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
if ((MmioRead8 (UART_LSR_REG) & UART_LSR_DR) == UART_LSR_DR)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
recvchar = MmioRead8 (UART_RBR_REG);
|
||||
|
||||
return recvchar;
|
||||
}
|
||||
|
||||
/**
|
||||
Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
|
||||
data bits, and stop bits on a serial device.
|
||||
|
||||
@param BaudRate The requested baud rate. A BaudRate value of 0 will use the
|
||||
device's default interface speed.
|
||||
On output, the value actually set.
|
||||
@param ReveiveFifoDepth The requested depth of the FIFO on the receive side of the
|
||||
serial interface. A ReceiveFifoDepth value of 0 will use
|
||||
the device's default FIFO depth.
|
||||
On output, the value actually set.
|
||||
@param Timeout The requested time out for a single character in microseconds.
|
||||
This timeout applies to both the transmit and receive side of the
|
||||
interface. A Timeout value of 0 will use the device's default time
|
||||
out value.
|
||||
On output, the value actually set.
|
||||
@param Parity The type of parity to use on this serial device. A Parity value of
|
||||
DefaultParity will use the device's default parity value.
|
||||
On output, the value actually set.
|
||||
@param DataBits The number of data bits to use on the serial device. A DataBits
|
||||
vaule of 0 will use the device's default data bit setting.
|
||||
On output, the value actually set.
|
||||
@param StopBits The number of stop bits to use on this serial device. A StopBits
|
||||
value of DefaultStopBits will use the device's default number of
|
||||
stop bits.
|
||||
On output, the value actually set.
|
||||
|
||||
@retval RETURN_SUCCESS The new attributes were set on the serial device.
|
||||
@retval RETURN_UNSUPPORTED The serial device does not support this operation.
|
||||
@retval RETURN_INVALID_PARAMETER One or more of the attributes has an unsupported value.
|
||||
@retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortSetAttributes (
|
||||
IN OUT UINT64 *BaudRate,
|
||||
IN OUT UINT32 *ReceiveFifoDepth,
|
||||
IN OUT UINT32 *Timeout,
|
||||
IN OUT EFI_PARITY_TYPE *Parity,
|
||||
IN OUT UINT8 *DataBits,
|
||||
IN OUT EFI_STOP_BITS_TYPE *StopBits
|
||||
)
|
||||
{
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Set the serial device control bits.
|
||||
|
||||
@param Control Control bits which are to be set on the serial device.
|
||||
|
||||
@retval EFI_SUCCESS The new control bits were set on the serial device.
|
||||
@retval EFI_UNSUPPORTED The serial device does not support this operation.
|
||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortSetControl (
|
||||
IN UINT32 Control
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the serial device control bits.
|
||||
|
||||
@param Control Control signals read from the serial device.
|
||||
|
||||
@retval EFI_SUCCESS The control bits were read from the serial device.
|
||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortGetControl (
|
||||
OUT UINT32 *Control
|
||||
)
|
||||
{
|
||||
|
||||
if (SerialPortPoll ()) {
|
||||
// If a character is pending don't set EFI_SERIAL_INPUT_BUFFER_EMPTY
|
||||
*Control = EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
|
||||
} else {
|
||||
*Control = EFI_SERIAL_INPUT_BUFFER_EMPTY | EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -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 (
|
||||
|
||||
@@ -59,14 +59,14 @@
|
||||
[FixedPcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType
|
||||
|
||||
[Pcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy
|
||||
gRockchipTokenSpaceGuid.PcdDwcSdhciBaseAddress
|
||||
gRockchipTokenSpaceGuid.PcdRkSdmmcBaseAddress
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2023, Mario Bălănică <mariobalanica02@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
**/
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <VarStoreData.h>
|
||||
|
||||
#include "RK3588DxeFormSetGuid.h"
|
||||
#include "DebugSerialPort.h"
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
ApplyDebugSerialPortVariables (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
/* nothing to do here */
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
SetupDebugSerialPortVariables (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINTN Size;
|
||||
UINT64 Var64;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Size = sizeof (UINT64);
|
||||
|
||||
Status = gRT->GetVariable (L"DebugSerialPortBaudRate",
|
||||
&gRK3588DxeFormSetGuid,
|
||||
NULL, &Size, &Var64);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Var64 = DEBUG_SERIAL_PORT_BAUD_RATE_DEFAULT;
|
||||
Status = gRT->SetVariable (
|
||||
L"DebugSerialPortBaudRate",
|
||||
&gRK3588DxeFormSetGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
Size,
|
||||
&Var64);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2023, Mario Bălănică <mariobalanica02@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __RK3588DXE_DEBUG_SERIAL_PORT_H__
|
||||
#define __RK3588DXE_DEBUG_SERIAL_PORT_H__
|
||||
|
||||
#define DEBUG_SERIAL_PORT_BAUD_RATE_MIN 0
|
||||
#define DEBUG_SERIAL_PORT_BAUD_RATE_MAX 1500000
|
||||
#define DEBUG_SERIAL_PORT_BAUD_RATE_DEFAULT 1500000
|
||||
|
||||
//
|
||||
// Don't declare these in the VFR file.
|
||||
//
|
||||
#ifndef VFR_FILE_INCLUDE
|
||||
VOID
|
||||
EFIAPI
|
||||
ApplyDebugSerialPortVariables (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
SetupDebugSerialPortVariables (
|
||||
VOID
|
||||
);
|
||||
#endif // VFR_FILE_INCLUDE
|
||||
|
||||
#endif // __RK3588DXE_DEBUG_SERIAL_PORT_H__
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "ConfigTable.h"
|
||||
#include "FanControl.h"
|
||||
#include "UsbDpPhy.h"
|
||||
#include "DebugSerialPort.h"
|
||||
|
||||
extern UINT8 RK3588DxeHiiBin[];
|
||||
extern UINT8 RK3588DxeStrings[];
|
||||
@@ -162,6 +163,7 @@ SetupVariables (
|
||||
SetupConfigTableVariables ();
|
||||
SetupCoolingFanVariables ();
|
||||
SetupUsbDpPhyVariables ();
|
||||
SetupDebugSerialPortVariables ();
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -207,6 +209,7 @@ ApplyVariables (
|
||||
ApplyConfigTableVariables ();
|
||||
ApplyCoolingFanVariables ();
|
||||
ApplyUsbDpPhyVariables ();
|
||||
ApplyDebugSerialPortVariables ();
|
||||
|
||||
InstallConfigAppliedProtocol ();
|
||||
|
||||
|
||||
@@ -15,14 +15,15 @@
|
||||
|
||||
[Sources.common]
|
||||
RK3588Dxe.c
|
||||
RK3588DxeHii.uni
|
||||
RK3588DxeHii.vfr
|
||||
CpuPerformance.c
|
||||
ComboPhy.c
|
||||
PciExpress30.c
|
||||
ConfigTable.c
|
||||
FanControl.c
|
||||
UsbDpPhy.c
|
||||
RK3588DxeHii.uni
|
||||
RK3588DxeHii.vfr
|
||||
DebugSerialPort.c
|
||||
|
||||
[Packages]
|
||||
ArmPkg/ArmPkg.dec
|
||||
|
||||
@@ -155,3 +155,12 @@
|
||||
|
||||
#string STR_COOLING_FAN_SPEED_PROMPT #language en-US "Fan Speed (%)"
|
||||
#string STR_COOLING_FAN_SPEED_HELP #language en-US "PWM duty cycle of on-board fan output."
|
||||
|
||||
/*
|
||||
* Debug Serial Port configuration
|
||||
*/
|
||||
#string STR_DEBUG_SERIAL_PORT_FORM_TITLE #language en-US "Debug Serial Port"
|
||||
#string STR_DEBUG_SERIAL_PORT_FORM_HELP #language en-US "Configure the debug (UART) serial port."
|
||||
#string STR_DEBUG_SERIAL_PORT_SUBTITLE #language en-US "Note: These settings only take effect in UEFI and might be overridden by the OS. Earlier boot messages will be printed at the default settings."
|
||||
|
||||
#string STR_DEBUG_SERIAL_PORT_BAUD_RATE_PROMPT #language en-US "Baud Rate"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#define VFR_FILE_INCLUDE
|
||||
#include "CpuPerformance.h"
|
||||
#include "FanControl.h"
|
||||
#include "DebugSerialPort.h"
|
||||
|
||||
//
|
||||
// EFI Variable attributes
|
||||
@@ -146,6 +147,11 @@ formset
|
||||
name = CoolingFanSpeed,
|
||||
guid = RK3588DXE_FORMSET_GUID;
|
||||
|
||||
efivarstore DEBUG_SERIAL_PORT_BAUD_RATE_VARSTORE_DATA,
|
||||
attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
name = DebugSerialPortBaudRate,
|
||||
guid = RK3588DXE_FORMSET_GUID;
|
||||
|
||||
form formid = 1,
|
||||
title = STRING_TOKEN(STR_FORM_SET_TITLE);
|
||||
subtitle text = STRING_TOKEN(STR_FORM_SET_TITLE_SUBTITLE);
|
||||
@@ -182,6 +188,9 @@ formset
|
||||
help = STRING_TOKEN(STR_COOLING_FAN_FORM_HELP);
|
||||
#endif
|
||||
|
||||
goto 0x1006,
|
||||
prompt = STRING_TOKEN(STR_DEBUG_SERIAL_PORT_FORM_TITLE),
|
||||
help = STRING_TOKEN(STR_DEBUG_SERIAL_PORT_FORM_HELP);
|
||||
endform;
|
||||
|
||||
form formid = 0x1000,
|
||||
@@ -524,7 +533,23 @@ formset
|
||||
endnumeric;
|
||||
endif;
|
||||
endform;
|
||||
|
||||
#endif
|
||||
|
||||
form formid = 0x1006,
|
||||
title = STRING_TOKEN(STR_DEBUG_SERIAL_PORT_FORM_TITLE);
|
||||
|
||||
numeric varid = DebugSerialPortBaudRate.Value,
|
||||
prompt = STRING_TOKEN(STR_DEBUG_SERIAL_PORT_BAUD_RATE_PROMPT),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
flags = DISPLAY_UINT_DEC | NUMERIC_SIZE_8 | INTERACTIVE | RESET_REQUIRED,
|
||||
minimum = DEBUG_SERIAL_PORT_BAUD_RATE_MIN,
|
||||
maximum = DEBUG_SERIAL_PORT_BAUD_RATE_MAX,
|
||||
step = 0,
|
||||
default = DEBUG_SERIAL_PORT_BAUD_RATE_DEFAULT,
|
||||
endnumeric;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL_STRING);
|
||||
subtitle text = STRING_TOKEN(STR_DEBUG_SERIAL_PORT_SUBTITLE);
|
||||
endform;
|
||||
|
||||
endformset;
|
||||
|
||||
@@ -78,4 +78,8 @@ typedef struct {
|
||||
UINT32 State;
|
||||
} USBDP_PHY_USB3_STATE_VARSTORE_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT64 Value;
|
||||
} DEBUG_SERIAL_PORT_BAUD_RATE_VARSTORE_DATA;
|
||||
|
||||
#endif // __VARSTORE_DATA_H__
|
||||
|
||||
@@ -28,12 +28,14 @@
|
||||
|
||||
[LibraryClasses]
|
||||
ArmLib
|
||||
BaseVariableLib
|
||||
FdtLib
|
||||
IoLib
|
||||
MemoryAllocationLib
|
||||
PcdLib
|
||||
PrintLib
|
||||
SdramLib
|
||||
SerialPortLib
|
||||
|
||||
[Sources.common]
|
||||
Rk3588.c
|
||||
@@ -62,5 +64,11 @@
|
||||
gArmTokenSpaceGuid.PcdSystemMemoryBase
|
||||
gArmTokenSpaceGuid.PcdSystemMemorySize
|
||||
|
||||
[PatchPcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
|
||||
|
||||
[Ppis]
|
||||
gArmMpCoreInfoPpiGuid
|
||||
|
||||
[Guids]
|
||||
gRK3588DxeFormSetGuid
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <Library/IoLib.h>
|
||||
#include <Library/ArmPlatformLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseVariableLib.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Pi/PiBootMode.h>
|
||||
|
||||
#include <Ppi/ArmMpCoreInfo.h>
|
||||
@@ -40,6 +42,27 @@ ArmPlatformInitialize (
|
||||
IN UINTN MpId
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Size;
|
||||
UINT64 BaudRate;
|
||||
|
||||
Size = sizeof (UINT64);
|
||||
Status = BaseGetVariable (
|
||||
L"DebugSerialPortBaudRate",
|
||||
&gRK3588DxeFormSetGuid,
|
||||
NULL,
|
||||
&Size,
|
||||
&BaudRate
|
||||
);
|
||||
if (EFI_ERROR (Status) || BaudRate == 0) {
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "%a: Setting baud rate to %lu\n", __func__, BaudRate));
|
||||
|
||||
PatchPcdSet64 (PcdUartDefaultBaudRate, BaudRate);
|
||||
SerialPortInitialize ();
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,8 +100,8 @@
|
||||
# ACPI helpers
|
||||
AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf
|
||||
|
||||
# UART library
|
||||
SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortLib/Dw8250SerialPortLib.inf
|
||||
# Debug UART library
|
||||
SerialPortLib|Silicon/Rockchip/Library/Dw8250SerialPortLib/DebugDw8250SerialPortLib.inf
|
||||
|
||||
# SoC and memory descriptors
|
||||
ArmPlatformLib|Silicon/Rockchip/RK3588/Library/PlatformLib/PlatformLib.inf
|
||||
@@ -166,7 +166,6 @@
|
||||
# UART2 - Serial Terminal
|
||||
DEFINE SERIAL_BASE = 0xFEB50000 # UART2
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|$(SERIAL_BASE)
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|1500000
|
||||
gHisiTokenSpaceGuid.PcdSerialPortSendDelay|500000
|
||||
gHisiTokenSpaceGuid.PcdUartClkInHz|24000000
|
||||
|
||||
@@ -259,6 +258,9 @@
|
||||
# EHCI disabled by default since it crashes Windows.
|
||||
gRK3588TokenSpaceGuid.PcdAcpiUsb2StateDefault|$(ACPI_USB2_STATE_DISABLED)
|
||||
|
||||
[PcdsPatchableInModule]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|1500000
|
||||
|
||||
[PcdsDynamicDefault.common]
|
||||
#
|
||||
# Display
|
||||
@@ -322,6 +324,15 @@
|
||||
#
|
||||
################################################################################
|
||||
[Components.common]
|
||||
#
|
||||
# PEI Phase modules
|
||||
#
|
||||
ArmPlatformPkg/PrePi/PeiUniCore.inf {
|
||||
<LibraryClasses>
|
||||
# Full UART library
|
||||
SerialPortLib|Silicon/Rockchip/Library/Dw8250SerialPortLib/Dw8250SerialPortLib.inf
|
||||
}
|
||||
|
||||
# General platform manager
|
||||
Silicon/Rockchip/RK3588/Drivers/RK3588Dxe/RK3588Dxe.inf
|
||||
|
||||
|
||||
@@ -232,6 +232,8 @@
|
||||
PWMLib|Silicon/Rockchip/Library/PWMLib/PWMLib.inf
|
||||
RockchipDisplayLib|Silicon/Rockchip/Library/DisplayLib/RockchipDisplayLib.inf
|
||||
|
||||
BaseVariableLib|Silicon/Rockchip/Library/BaseVariableLib/BaseVariableLib.inf
|
||||
|
||||
[LibraryClasses.common.SEC]
|
||||
ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
|
||||
Reference in New Issue
Block a user