diff options
author | Leo Duran <leo.duran@amd.com> | 2017-01-14 04:09:53 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2017-01-17 10:10:32 +0800 |
commit | ff5d3cc25f68eaa8ad058ffdf63db79ae67e841b (patch) | |
tree | 1ec060cf0ce981e06d0bb882a19b696851ebda98 /UefiCpuPkg | |
parent | 200b4223f0a1408de15779abed7826e20c10782c (diff) | |
download | edk2-ff5d3cc25f68eaa8ad058ffdf63db79ae67e841b.zip edk2-ff5d3cc25f68eaa8ad058ffdf63db79ae67e841b.tar.gz edk2-ff5d3cc25f68eaa8ad058ffdf63db79ae67e841b.tar.bz2 |
UefiCpuPkg: Modify CpuIoPei to support new IoLib library
The IO_PPI supports Fifo types by invoking the Fifo routines in the
new BaseIoLibIntrinsic (IoLib class) library.
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Leo Duran <leo.duran@amd.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r-- | UefiCpuPkg/CpuIoPei/CpuIoPei.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/UefiCpuPkg/CpuIoPei/CpuIoPei.c b/UefiCpuPkg/CpuIoPei/CpuIoPei.c index 3c5c8a7..b6d538b 100644 --- a/UefiCpuPkg/CpuIoPei/CpuIoPei.c +++ b/UefiCpuPkg/CpuIoPei/CpuIoPei.c @@ -2,6 +2,8 @@ Produces the CPU I/O PPI.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
+
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
@@ -375,6 +377,31 @@ CpuIoServiceRead ( InStride = mInStride[Width];
OutStride = mOutStride[Width];
OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH) (Width & 0x03);
+
+ //
+ // Fifo operations supported for (mInStride[Width] == 0)
+ //
+ if (InStride == 0) {
+ switch (OperationWidth) {
+ case EfiPeiCpuIoWidthUint8:
+ IoReadFifo8 ((UINTN)Address, Count, Buffer);
+ return EFI_SUCCESS;
+ case EfiPeiCpuIoWidthUint16:
+ IoReadFifo16 ((UINTN)Address, Count, Buffer);
+ return EFI_SUCCESS;
+ case EfiPeiCpuIoWidthUint32:
+ IoReadFifo32 ((UINTN)Address, Count, Buffer);
+ return EFI_SUCCESS;
+ default:
+ //
+ // The CpuIoCheckParameter call above will ensure that this
+ // path is not taken.
+ //
+ ASSERT (FALSE);
+ break;
+ }
+ }
+
Aligned = (BOOLEAN)(((UINTN)Buffer & (mInStride[OperationWidth] - 1)) == 0x00);
for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
if (OperationWidth == EfiPeiCpuIoWidthUint8) {
@@ -447,6 +474,31 @@ CpuIoServiceWrite ( InStride = mInStride[Width];
OutStride = mOutStride[Width];
OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH) (Width & 0x03);
+
+ //
+ // Fifo operations supported for (mInStride[Width] == 0)
+ //
+ if (InStride == 0) {
+ switch (OperationWidth) {
+ case EfiPeiCpuIoWidthUint8:
+ IoWriteFifo8 ((UINTN)Address, Count, Buffer);
+ return EFI_SUCCESS;
+ case EfiPeiCpuIoWidthUint16:
+ IoWriteFifo16 ((UINTN)Address, Count, Buffer);
+ return EFI_SUCCESS;
+ case EfiPeiCpuIoWidthUint32:
+ IoWriteFifo32 ((UINTN)Address, Count, Buffer);
+ return EFI_SUCCESS;
+ default:
+ //
+ // The CpuIoCheckParameter call above will ensure that this
+ // path is not taken.
+ //
+ ASSERT (FALSE);
+ break;
+ }
+ }
+
Aligned = (BOOLEAN)(((UINTN)Buffer & (mInStride[OperationWidth] - 1)) == 0x00);
for (Uint8Buffer = (UINT8 *)Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
if (OperationWidth == EfiPeiCpuIoWidthUint8) {
|