Skip to content

Fix serial port on AMD picasso and newer #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: edk2-stable202411-amd
Choose a base branch
from
Open
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;
EFI_PHYSICAL_ADDRESS RegisterBase;
} UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO;
#pragma pack()
Expand Down
7 changes: 2 additions & 5 deletions PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,9 @@ PcRtcInit (
RtcRead (RTC_ADDRESS_REGISTER_C);

//
// Clear RTC register D with changing the VRT bit.
// On most platforms VRT is read-only, but when it's not it must
// be preserved to prevent failing in RtcWaitToUpdate().
// Clear RTC register D
//
RegisterD.Data = RtcRead (RTC_ADDRESS_REGISTER_D);
RegisterD.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterD) | (RegisterD.Data & BIT7);
RegisterD.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterD);
RtcWrite (RTC_ADDRESS_REGISTER_D, RegisterD.Data);

//
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);
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 @@ -560,6 +560,7 @@ _ModuleEntryPoint (
UniversalSerialPort->UseMmio = (SerialPortInfo.Type == 1) ? FALSE : TRUE;
UniversalSerialPort->RegisterBase = SerialPortInfo.BaseAddr;
UniversalSerialPort->BaudRate = SerialPortInfo.Baud;
UniversalSerialPort->ClockRate = SerialPortInfo.InputHertz;
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