Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MdeModulePkg/Include/UniversalPayload/SerialPortInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ typedef struct {
BOOLEAN UseMmio;
UINT8 RegisterStride;
UINT32 BaudRate;
UINT32 ClockRate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow up backward compatible for structure, I want to recommend you put this code from line 22 to line 24

EFI_PHYSICAL_ADDRESS RegisterBase;
} UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO;
#pragma pack()
Expand Down
5 changes: 5 additions & 0 deletions UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ PlatformHookSerialPortInitialize (
return Status;
}

Status = PcdSet32S (PcdSerialClockRate, SerialPortInfo->ClockRate);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add backward compatible check here.
if (SerialPortInfo->ClockRate != 0) {
Status = PcdSet32S (PcdSerialClockRate, SerialPortInfo->ClockRate);
}

if (RETURN_ERROR (Status)) {
return Status;
}

return RETURN_SUCCESS;
}

Expand Down
1 change: 1 addition & 0 deletions UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## PRODUCES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate ## PRODUCES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride ## PRODUCES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate ## PRODUCES
1 change: 1 addition & 0 deletions UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ _ModuleEntryPoint (
UniversalSerialPort->UseMmio = (SerialPortInfo.Type == 1) ? FALSE : TRUE;
UniversalSerialPort->RegisterBase = SerialPortInfo.BaseAddr;
UniversalSerialPort->BaudRate = SerialPortInfo.Baud;
UniversalSerialPort->ClockRate = SerialPortInfo.InputHertz;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this has been handled by commit (#6215), could you check if existing implementation is good enough?

Some background:
We prefer to not touch UniversalPayload/SerialPortInfo.h as that will require USF->UPL spec update which is unnecessary effort if we could eliminate.(https://universalscalablefirmware.github.io/documentation/2_universal_payload.html#serial-information)

The PcdSerialClockRate should already have the value you need in line438 without relying on new field in UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO structure.

UniversalSerialPort->RegisterStride = (UINT8)SerialPortInfo.RegWidth;
// Set PCD here (vs in PlatformHookLib.c) to avoid adding a new field to UniversalSerialPort struct
if (SerialPortInfo.InputHertz > 0) {
Expand Down
Loading