]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuIoPei/CpuIoPei.h
Code refinement.
[mirror_edk2.git] / UefiCpuPkg / CpuIoPei / CpuIoPei.h
diff --git a/UefiCpuPkg/CpuIoPei/CpuIoPei.h b/UefiCpuPkg/CpuIoPei/CpuIoPei.h
new file mode 100644 (file)
index 0000000..052f0e3
--- /dev/null
@@ -0,0 +1,448 @@
+/** @file\r
+  Internal include file for the CPU I/O PPI.\r
+\r
+Copyright (c) 2009 - 2010, 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
+\r
+**/\r
+\r
+#ifndef _CPU_IO2_PEI_H_\r
+#define _CPU_IO2_PEI_H_\r
+\r
+#include <PiDxe.h>\r
+\r
+#include <Ppi/CpuIo.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/IoLib.h>\r
+#include <Library/PeiServicesLib.h>\r
+\r
+#define MAX_IO_PORT_ADDRESS   0xFFFF\r
+\r
+/**\r
+  Reads memory-mapped registers.\r
+\r
+  @param[in]  PeiServices  An indirect pointer to the PEI Services Table\r
+                           published by the PEI Foundation.\r
+  @param[in]  This         Pointer to local data for the interface.\r
+  @param[in]  Width        The width of the access. Enumerated in bytes.\r
+  @param[in]  Address      The physical address of the access.\r
+  @param[in]  Count        The number of accesses to perform.\r
+  @param[out] Buffer       A pointer to the buffer of data.\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
+                                 and Count is not valid for this EFI system.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CpuMemoryServiceRead (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  EFI_PEI_CPU_IO_PPI_WIDTH  Width,\r
+  IN  UINT64                    Address,\r
+  IN  UINTN                     Count,\r
+  OUT VOID                      *Buffer\r
+  );\r
+\r
+/**\r
+  Writes memory-mapped registers.\r
+\r
+  @param[in]  PeiServices  An indirect pointer to the PEI Services Table\r
+                           published by the PEI Foundation.\r
+  @param[in]  This         Pointer to local data for the interface.\r
+  @param[in]  Width        The width of the access. Enumerated in bytes.\r
+  @param[in]  Address      The physical address of the access.\r
+  @param[in]  Count        The number of accesses to perform.\r
+  @param[in]  Buffer       A pointer to the buffer of data.\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
+                                 and Count is not valid for this EFI system.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CpuMemoryServiceWrite (\r
+  IN CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN EFI_PEI_CPU_IO_PPI_WIDTH  Width,\r
+  IN UINT64                    Address,\r
+  IN UINTN                     Count,\r
+  IN VOID                      *Buffer\r
+  );\r
+\r
+/**\r
+  Reads I/O registers.\r
+\r
+  @param[in]  PeiServices  An indirect pointer to the PEI Services Table\r
+                           published by the PEI Foundation.\r
+  @param[in]  This         Pointer to local data for the interface.\r
+  @param[in]  Width        The width of the access. Enumerated in bytes.\r
+  @param[in]  Address      The physical address of the access.\r
+  @param[in]  Count        The number of accesses to perform.\r
+  @param[out] Buffer       A pointer to the buffer of data.\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
+                                 and Count is not valid for this EFI system.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CpuIoServiceRead (\r
+  IN  CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN  EFI_PEI_CPU_IO_PPI_WIDTH  Width,\r
+  IN  UINT64                    Address,\r
+  IN  UINTN                     Count,\r
+  OUT VOID                      *Buffer\r
+  );\r
+\r
+/**\r
+  Write I/O registers.\r
+\r
+  @param[in]  PeiServices  An indirect pointer to the PEI Services Table\r
+                           published by the PEI Foundation.\r
+  @param[in]  This         Pointer to local data for the interface.\r
+  @param[in]  Width        The width of the access. Enumerated in bytes.\r
+  @param[in]  Address      The physical address of the access.\r
+  @param[in]  Count        The number of accesses to perform.\r
+  @param[in]  Buffer       A pointer to the buffer of data.\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
+                                 and Count is not valid for this EFI system.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+CpuIoServiceWrite (\r
+  IN CONST EFI_PEI_SERVICES    **PeiServices,\r
+  IN CONST EFI_PEI_CPU_IO_PPI  *This,\r
+  IN EFI_PEI_CPU_IO_PPI_WIDTH  Width,\r
+  IN UINT64                    Address,\r
+  IN UINTN                     Count,\r
+  IN VOID                      *Buffer\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
+                          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
+  @return  An 8-bit value returned from the I/O space.\r
+**/\r
+UINT8\r
+EFIAPI\r
+CpuIoRead8 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address\r
+  );\r
+\r
+/**\r
+  16-bit I/O read operations.\r
+\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
+  @return  A 16-bit value returned from the I/O space.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+CpuIoRead16 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address\r
+  );\r
+\r
+/**\r
+  32-bit I/O read operations.\r
+\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
+  @return  A 32-bit value returned from the I/O space.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+CpuIoRead32 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address\r
+  );\r
+\r
+/**\r
+  64-bit I/O read operations.\r
+\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
+  @return  A 64-bit value returned from the I/O space.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+CpuIoRead64 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address\r
+  );\r
+\r
+/**\r
+  8-bit I/O write operations.\r
+\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
+  @param[in] Data         The data to write.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuIoWrite8 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address,\r
+  IN  UINT8                       Data\r
+  );\r
+\r
+/**\r
+  16-bit I/O write operations.\r
+\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
+  @param[in] Data         The data to write.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuIoWrite16 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address,\r
+  IN  UINT16                      Data\r
+  );\r
+\r
+/**\r
+  32-bit I/O write operations.\r
+\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
+  @param[in] Data         The data to write.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuIoWrite32 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address,\r
+  IN  UINT32                      Data\r
+  );\r
+\r
+/**\r
+  64-bit I/O write operations.\r
+\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
+  @param[in] Data         The data to write.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuIoWrite64 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address,\r
+  IN  UINT64                      Data\r
+  );\r
+\r
+/**\r
+  8-bit memory read operations.\r
+\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
+  @return  An 8-bit value returned from the memory space.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+CpuMemRead8 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address\r
+  );\r
+\r
+/**\r
+  16-bit memory read operations.\r
+\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
+  @return  A 16-bit value returned from the memory space.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+CpuMemRead16 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address\r
+  );\r
+\r
+/**\r
+  32-bit memory read operations.\r
+\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
+  @return  A 32-bit value returned from the memory space.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+CpuMemRead32 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address\r
+  );\r
+\r
+/**\r
+  64-bit memory read operations.\r
+\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
+  @return  A 64-bit value returned from the memory space.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+CpuMemRead64 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address\r
+  );\r
+\r
+/**\r
+  8-bit memory write operations.\r
+\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
+  @param[in] Data         The data to write.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuMemWrite8 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address,\r
+  IN  UINT8                       Data\r
+  );\r
+\r
+/**\r
+  16-bit memory write operations.\r
+\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
+  @param[in] Data         The data to write.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuMemWrite16 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address,\r
+  IN  UINT16                      Data\r
+  );\r
+\r
+/**\r
+  32-bit memory write operations.\r
+\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
+  @param[in] Data         The data to write.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuMemWrite32 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address,\r
+  IN  UINT32                      Data\r
+  );\r
+\r
+/**\r
+  64-bit memory write operations.\r
+\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
+  @param[in] Data         The data to write.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuMemWrite64 (\r
+  IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
+  IN  CONST EFI_PEI_CPU_IO_PPI    *This,\r
+  IN  UINT64                      Address,\r
+  IN  UINT64                      Data\r
+  );\r
+  \r
+#endif\r