PcAtChipsetPkg/SerialIoLib: Allow configurable UART IO Port Base Address

Today's implementation used a hardcoded value for the I/O Port
Base Address. This creates a problem for platform configurability.
If a platform needs to use a different I/O port address, then
it requires modification of a source file.

Create gPcAtChipsetPkgTokenSpaceGuid.PcdUartIoPortBaseAddress
as a FixedAtBuild pcd scoped to PcAtChipsetPkg, with default
value for 0x3f8 to match existing value, and update
code to use PCD.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
This commit is contained in:
Sean Brogan 2024-07-02 13:28:04 -07:00 committed by mergify[bot]
parent 99afb1ffb0
commit 2d43dcfc6c
3 changed files with 9 additions and 1 deletions

View file

@ -17,6 +17,7 @@
[Packages]
MdePkg/MdePkg.dec
PcAtChipsetPkg/PcAtChipsetPkg.dec
[LibraryClasses]
BaseLib
@ -25,3 +26,5 @@
[Sources]
SerialPortLib.c
[Pcd]
gPcAtChipsetPkgTokenSpaceGuid.PcdUartIoPortBaseAddress

View file

@ -43,7 +43,7 @@
// ---------------------------------------------
// UART Settings
// ---------------------------------------------
UINT16 gUartBase = 0x3F8;
UINT16 gUartBase = FixedPcdGet16 (PcdUartIoPortBaseAddress);
UINTN gBps = 115200;
UINT8 gData = 8;
UINT8 gStop = 1;

View file

@ -164,5 +164,10 @@
# @Prompt RTC Update Timeout Value.
gPcAtChipsetPkgTokenSpaceGuid.PcdRealTimeClockUpdateTimeout|100000|UINT32|0x00000020
[PcdsFixedAtBuild]
## Defines the UART base address.
# @Prompt UART IO Port Base Address
gPcAtChipsetPkgTokenSpaceGuid.PcdUartIoPortBaseAddress|0x3F8|UINT16|0x00000024
[UserExtensions.TianoCore."ExtraFiles"]
PcAtChipsetPkgExtra.uni