/** @file\r
Produces the CPU I/O PPI.\r
\r
-Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\r
+\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
\r
&gEfiPeiCpuIoPpiInstalledGuid,\r
NULL\r
};\r
- \r
+\r
//\r
// Lookup table for increment values based on transfer widths\r
//\r
@retval EFI_SUCCESS The parameters for this request pass the checks.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.\r
@retval EFI_INVALID_PARAMETER Buffer is NULL.\r
- @retval EFI_UNSUPPORTED The address range specified by Address, Width, \r
+ @retval EFI_UNSUPPORTED The address range specified by Address, Width,\r
and Count is not valid for this EFI system.\r
- \r
+\r
**/\r
EFI_STATUS\r
CpuIoCheckParameter (\r
if (!MmioOperation && (Width == EfiPeiCpuIoWidthUint64)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
- \r
+\r
//\r
- // Check to see if any address associated with this transfer exceeds the maximum \r
+ // Check to see if any address associated with this transfer exceeds the maximum\r
// allowed address. The maximum address implied by the parameters passed in is\r
// Address + Size * Count. If the following condition is met, then the transfer\r
// is not supported.\r
//\r
// Address + Size * Count > (MmioOperation ? MAX_ADDRESS : MAX_IO_PORT_ADDRESS) + 1\r
//\r
- // Since MAX_ADDRESS can be the maximum integer value supported by the CPU and Count \r
+ // Since MAX_ADDRESS can be the maximum integer value supported by the CPU and Count\r
// can also be the maximum integer value supported by the CPU, this range\r
// check must be adjusted to avoid all overflow conditions.\r
- // \r
- // The following form of the range check is equivalent but assumes that \r
+ //\r
+ // The following form of the range check is equivalent but assumes that\r
// MAX_ADDRESS and MAX_IO_PORT_ADDRESS are of the form (2^n - 1).\r
//\r
Limit = (MmioOperation ? MAX_ADDRESS : MAX_IO_PORT_ADDRESS);\r
if (Address > Limit) {\r
return EFI_UNSUPPORTED;\r
}\r
- } else { \r
+ } else {\r
MaxCount = RShiftU64 (Limit, Width);\r
if (MaxCount < (Count - 1)) {\r
return EFI_UNSUPPORTED;\r
return EFI_UNSUPPORTED;\r
}\r
}\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r
@retval EFI_SUCCESS The function completed successfully.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.\r
@retval EFI_INVALID_PARAMETER Buffer is NULL.\r
- @retval EFI_UNSUPPORTED The address range specified by Address, Width, \r
+ @retval EFI_UNSUPPORTED The address range specified by Address, Width,\r
and Count is not valid for this EFI system.\r
\r
**/\r
@retval EFI_SUCCESS The function completed successfully.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.\r
@retval EFI_INVALID_PARAMETER Buffer is NULL.\r
- @retval EFI_UNSUPPORTED The address range specified by Address, Width, \r
+ @retval EFI_UNSUPPORTED The address range specified by Address, Width,\r
and Count is not valid for this EFI system.\r
\r
**/\r
@retval EFI_SUCCESS The function completed successfully.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.\r
@retval EFI_INVALID_PARAMETER Buffer is NULL.\r
- @retval EFI_UNSUPPORTED The address range specified by Address, Width, \r
+ @retval EFI_UNSUPPORTED The address range specified by Address, Width,\r
and Count is not valid for this EFI system.\r
\r
**/\r
InStride = mInStride[Width];\r
OutStride = mOutStride[Width];\r
OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH) (Width & 0x03);\r
+\r
+ //\r
+ // Fifo operations supported for (mInStride[Width] == 0)\r
+ //\r
+ if (InStride == 0) {\r
+ switch (OperationWidth) {\r
+ case EfiPeiCpuIoWidthUint8:\r
+ IoReadFifo8 ((UINTN)Address, Count, Buffer);\r
+ return EFI_SUCCESS;\r
+ case EfiPeiCpuIoWidthUint16:\r
+ IoReadFifo16 ((UINTN)Address, Count, Buffer);\r
+ return EFI_SUCCESS;\r
+ case EfiPeiCpuIoWidthUint32:\r
+ IoReadFifo32 ((UINTN)Address, Count, Buffer);\r
+ return EFI_SUCCESS;\r
+ default:\r
+ //\r
+ // The CpuIoCheckParameter call above will ensure that this\r
+ // path is not taken.\r
+ //\r
+ ASSERT (FALSE);\r
+ break;\r
+ }\r
+ }\r
+\r
Aligned = (BOOLEAN)(((UINTN)Buffer & (mInStride[OperationWidth] - 1)) == 0x00);\r
for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {\r
if (OperationWidth == EfiPeiCpuIoWidthUint8) {\r
@retval EFI_SUCCESS The function completed successfully.\r
@retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.\r
@retval EFI_INVALID_PARAMETER Buffer is NULL.\r
- @retval EFI_UNSUPPORTED The address range specified by Address, Width, \r
+ @retval EFI_UNSUPPORTED The address range specified by Address, Width,\r
and Count is not valid for this EFI system.\r
\r
**/\r
InStride = mInStride[Width];\r
OutStride = mOutStride[Width];\r
OperationWidth = (EFI_PEI_CPU_IO_PPI_WIDTH) (Width & 0x03);\r
+\r
+ //\r
+ // Fifo operations supported for (mInStride[Width] == 0)\r
+ //\r
+ if (InStride == 0) {\r
+ switch (OperationWidth) {\r
+ case EfiPeiCpuIoWidthUint8:\r
+ IoWriteFifo8 ((UINTN)Address, Count, Buffer);\r
+ return EFI_SUCCESS;\r
+ case EfiPeiCpuIoWidthUint16:\r
+ IoWriteFifo16 ((UINTN)Address, Count, Buffer);\r
+ return EFI_SUCCESS;\r
+ case EfiPeiCpuIoWidthUint32:\r
+ IoWriteFifo32 ((UINTN)Address, Count, Buffer);\r
+ return EFI_SUCCESS;\r
+ default:\r
+ //\r
+ // The CpuIoCheckParameter call above will ensure that this\r
+ // path is not taken.\r
+ //\r
+ ASSERT (FALSE);\r
+ break;\r
+ }\r
+ }\r
+\r
Aligned = (BOOLEAN)(((UINTN)Buffer & (mInStride[OperationWidth] - 1)) == 0x00);\r
for (Uint8Buffer = (UINT8 *)Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {\r
if (OperationWidth == EfiPeiCpuIoWidthUint8) {\r
}\r
}\r
}\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r
/**\r
8-bit I/O read operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
16-bit I/O read operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
32-bit I/O read operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
64-bit I/O read operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
8-bit I/O write operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
16-bit I/O write operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
32-bit I/O write operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
64-bit I/O write operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
8-bit memory read operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
16-bit memory read operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
32-bit memory read operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
64-bit memory read operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
8-bit memory write operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
16-bit memory write operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
32-bit memory write operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
/**\r
64-bit memory write operations.\r
\r
- @param[in] PeiServices An indirect pointer to the PEI Services Table published \r
+ @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
by the PEI Foundation.\r
@param[in] This Pointer to local data for the interface.\r
@param[in] Address The physical address of the access.\r
This function is the Entry point of the CPU I/O PEIM which installs CpuIoPpi.\r
\r
@param[in] FileHandle Pointer to image file handle.\r
- @param[in] PeiServices Pointer to PEI Services Table \r
+ @param[in] PeiServices Pointer to PEI Services Table\r
\r
@retval EFI_SUCCESS CPU I/O PPI successfully installed\r
\r
// Register so it will be automatically shadowed to memory\r
//\r
Status = PeiServicesRegisterForShadow (FileHandle);\r
- \r
+\r
//\r
// Make CpuIo pointer in PeiService table point to gCpuIoPpi\r
//\r
(*((EFI_PEI_SERVICES **)PeiServices))->CpuIo = &gCpuIoPpi;\r
- \r
+\r
if (Status == EFI_ALREADY_STARTED) {\r
//\r
// Shadow completed and running from memory\r
Status = PeiServicesInstallPpi (&gPpiList);\r
ASSERT_EFI_ERROR (Status);\r
}\r
- \r
+\r
return EFI_SUCCESS;\r
}\r