* [PATCH v1] MdeModulePkg: BaseSerialPortLib16550: Add Mmio32 support
@ 2019-04-22 6:28 Wu, Hao A
0 siblings, 0 replies; only message in thread
From: Wu, Hao A @ 2019-04-22 6:28 UTC (permalink / raw)
To: devel; +Cc: Tien Hock, Loh, Jian J Wang, Hao Wu
From: "Tien Hock, Loh" <tien.hock.loh@intel.com>
Some busses doesn't allow 8 bit MMIO read/write, this adds support for
32 bits read/write
Signed-off-by: "Tien Hock, Loh" <tien.hock.loh@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
---
MdeModulePkg/MdeModulePkg.dec | 6 ++++++
MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf | 1 +
MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c | 10 ++++++++--
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index be84916cc0..4e53625767 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1170,6 +1170,12 @@
# @Prompt Serial port registers use MMIO.
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|FALSE|BOOLEAN|0x00020000
+ ## Indicates the 16550 serial port registers are in MMIO 32 bit space, or in I/O space. Default is I/O space.<BR><BR>
+ # TRUE - 16550 serial port registers are in MMIO 32 bit space.<BR>
+ # FALSE - 16550 serial port registers are in I/O space.<BR>
+ # @Prompt Serial port registers use MMIO.
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio32|FALSE|BOOLEAN|0x00020007
+
## Indicates if the 16550 serial port hardware flow control will be enabled. Default is FALSE.<BR><BR>
# TRUE - 16550 serial port hardware flow control will be enabled.<BR>
# FALSE - 16550 serial port hardware flow control will be disabled.<BR>
diff --git a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
index b60779cf57..575728af3a 100644
--- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
+++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
@@ -29,6 +29,7 @@
BaseSerialPortLib16550.c
[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio32 ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialDetectCable ## SOMETIMES_CONSUMES
diff --git a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
index 34df34d9c6..b242b23ec8 100644
--- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
+++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
@@ -76,7 +76,10 @@ SerialPortReadRegister (
UINTN Offset
)
{
- if (PcdGetBool (PcdSerialUseMmio)) {
+ if (PcdGetBool (PcdSerialUseMmio32)) {
+ return (UINT8) MmioRead32 (Base + Offset * PcdGet32 (PcdSerialRegisterStride));
+ }
+ else if (PcdGetBool (PcdSerialUseMmio)) {
return MmioRead8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride));
} else {
return IoRead8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride));
@@ -103,7 +106,10 @@ SerialPortWriteRegister (
UINT8 Value
)
{
- if (PcdGetBool (PcdSerialUseMmio)) {
+ if (PcdGetBool (PcdSerialUseMmio32)) {
+ return MmioWrite32 (Base + Offset * PcdGet32 (PcdSerialRegisterStride), (UINT8)Value);
+ }
+ else if (PcdGetBool (PcdSerialUseMmio)) {
return MmioWrite8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride), Value);
} else {
return IoWrite8 (Base + Offset * PcdGet32 (PcdSerialRegisterStride), Value);
--
2.12.0.windows.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-22 6:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-22 6:28 [PATCH v1] MdeModulePkg: BaseSerialPortLib16550: Add Mmio32 support Wu, Hao A
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox