From cd68e4a8de23e8992a98c281f6fda229ffad19c9 Mon Sep 17 00:00:00 2001 From: Michael Kinney Date: Mon, 27 Apr 2015 19:44:40 +0000 Subject: MdePkg/BaseSerialPortLib16550: Support UARTs with a register stride greater than 1 byte. Add stride PCD to MdeModulePkg to support 16550 UARTs with a register stride that is not 1 byte. The default value is 1 byte. Quark SoC uses a stride of 4 bytes. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney Reviewed-by: Jordan Justen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17215 6f19259b-4bc3-4df7-8a09-765794883524 --- .../BaseSerialPortLib16550.c | 10 +++++----- .../BaseSerialPortLib16550.inf | 11 ++++++----- MdeModulePkg/MdeModulePkg.dec | 6 +++++- MdeModulePkg/MdeModulePkg.uni | Bin 161746 -> 162360 bytes 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c index abf4f8f26a..3209115a3f 100644 --- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c +++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c @@ -2,7 +2,7 @@ 16550 UART Serial Port library functions (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -77,9 +77,9 @@ SerialPortReadRegister ( ) { if (PcdGetBool (PcdSerialUseMmio)) { - return MmioRead8 (Base + Offset); + return MmioRead8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride)); } else { - return IoRead8 (Base + Offset); + return IoRead8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride)); } } @@ -104,9 +104,9 @@ SerialPortWriteRegister ( ) { if (PcdGetBool (PcdSerialUseMmio)) { - return MmioWrite8 (Base + Offset, Value); + return MmioWrite8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride), Value); } else { - return IoWrite8 (Base + Offset, Value); + return IoWrite8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride), Value); } } diff --git a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf index ebbfa6e9a2..bb42f89676 100644 --- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf +++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf @@ -1,7 +1,7 @@ ## @file # SerialPortLib instance for 16550 UART. # -# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -18,7 +18,7 @@ MODULE_UNI_FILE = BaseSerialPortLib16550.uni FILE_GUID = 9E7C00CF-355A-4d4e-BF60-0428CFF95540 MODULE_TYPE = BASE - VERSION_STRING = 1.0 + VERSION_STRING = 1.1 LIBRARY_CLASS = SerialPortLib [Packages] @@ -42,6 +42,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdSerialLineControl ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl ## CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate ## CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialPciDeviceInfo ## CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialPciDeviceInfo ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride ## CONSUMES diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index a6309b8866..421c6977ab 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -20,7 +20,7 @@ PACKAGE_NAME = MdeModulePkg PACKAGE_UNI_FILE = MdeModulePkg.uni PACKAGE_GUID = BA0D78D6-2CAF-414b-BD4D-B6762A894288 - PACKAGE_VERSION = 0.94 + PACKAGE_VERSION = 0.96 [Includes] Include @@ -916,6 +916,10 @@ # @Prompt Serial Port Extended Transmit FIFO Size in Bytes gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|64|UINT32|0x00010068 + ## The number of bytes between registers in serial device. The default is 1 byte. + # @Prompt Serial Port Register Stride in Bytes + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|1|UINT32|0x0001006B + [PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] ## This PCD defines the Console output row. The default value is 25 according to UEFI spec. # This PCD could be set to 0 then console output would be at max column and max row. diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni index 1aab112223..add9a51e56 100644 Binary files a/MdeModulePkg/MdeModulePkg.uni and b/MdeModulePkg/MdeModulePkg.uni differ -- cgit v1.2.3