]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OldMdePkg/Library/PeiIoLibCpuIo/IoLib.c
Retiring the ANT/JAVA build and removing the older EDK II packages that required...
[mirror_edk2.git] / OldMdePkg / Library / PeiIoLibCpuIo / IoLib.c
diff --git a/OldMdePkg/Library/PeiIoLibCpuIo/IoLib.c b/OldMdePkg/Library/PeiIoLibCpuIo/IoLib.c
deleted file mode 100644 (file)
index 1da0203..0000000
+++ /dev/null
@@ -1,550 +0,0 @@
-/** @file\r
-  I/O Library.\r
-\r
-  Copyright (c) 2006, Intel Corporation<BR>\r
-  All rights reserved. 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
-  Module Name:  IoLib.c\r
-\r
-**/\r
-\r
-/**\r
-  Reads an 8-bit I/O port.\r
-\r
-  Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.\r
-  This function must guarantee that all I/O read and write operations are\r
-  serialized.\r
-\r
-  If 8-bit I/O port operations are not supported, then ASSERT().\r
-\r
-  @param  Port  The I/O port to read.\r
-\r
-  @return The value read.\r
-\r
-**/\r
-UINT8\r
-EFIAPI\r
-IoRead8 (\r
-  IN      UINTN                     Port\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-\r
-  return CpuIo->IoRead8 (PeiServices, CpuIo, (UINT64) Port);\r
-}\r
-\r
-/**\r
-  Writes an 8-bit I/O port.\r
-\r
-  Writes the 8-bit I/O port specified by Port with the value specified by Value\r
-  and returns Value. This function must guarantee that all I/O read and write\r
-  operations are serialized.\r
-\r
-  If 8-bit I/O port operations are not supported, then ASSERT().\r
-\r
-  @param  Port  The I/O port to write.\r
-  @param  Value The value to write to the I/O port.\r
-\r
-  @return The value written the I/O port.\r
-\r
-**/\r
-UINT8\r
-EFIAPI\r
-IoWrite8 (\r
-  IN      UINTN                     Port,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-\r
-  CpuIo->IoWrite8 (PeiServices, CpuIo, (UINT64) Port, Value);\r
-  return Value;\r
-}\r
-\r
-/**\r
-  Reads a 16-bit I/O port.\r
-\r
-  Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.\r
-  This function must guarantee that all I/O read and write operations are\r
-  serialized.\r
-\r
-  If 16-bit I/O port operations are not supported, then ASSERT().\r
-\r
-  @param  Port  The I/O port to read.\r
-\r
-  @return The value read.\r
-\r
-**/\r
-UINT16\r
-EFIAPI\r
-IoRead16 (\r
-  IN      UINTN                     Port\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Port is aligned on a 16-bit boundary.\r
-  //\r
-  ASSERT ((Port & 1) == 0);\r
-  return CpuIo->IoRead16 (PeiServices, CpuIo, (UINT64) Port);\r
-}\r
-\r
-/**\r
-  Writes a 16-bit I/O port.\r
-\r
-  Writes the 16-bit I/O port specified by Port with the value specified by Value\r
-  and returns Value. This function must guarantee that all I/O read and write\r
-  operations are serialized.\r
-\r
-  If 16-bit I/O port operations are not supported, then ASSERT().\r
-\r
-  @param  Port  The I/O port to write.\r
-  @param  Value The value to write to the I/O port.\r
-\r
-  @return The value written the I/O port.\r
-\r
-**/\r
-UINT16\r
-EFIAPI\r
-IoWrite16 (\r
-  IN      UINTN                     Port,\r
-  IN      UINT16                    Value\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Port is aligned on a 16-bit boundary.\r
-  //\r
-  ASSERT ((Port & 1) == 0);\r
-  CpuIo->IoWrite16 (PeiServices, CpuIo, (UINT64) Port, Value);\r
-  return Value;\r
-}\r
-\r
-/**\r
-  Reads a 32-bit I/O port.\r
-\r
-  Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.\r
-  This function must guarantee that all I/O read and write operations are\r
-  serialized.\r
-\r
-  If 32-bit I/O port operations are not supported, then ASSERT().\r
-\r
-  @param  Port  The I/O port to read.\r
-\r
-  @return The value read.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-IoRead32 (\r
-  IN      UINTN                     Port\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Port is aligned on a 32-bit boundary.\r
-  //\r
-  ASSERT ((Port & 3) == 0);\r
-  return CpuIo->IoRead32 (PeiServices, CpuIo, (UINT64) Port);\r
-}\r
-\r
-/**\r
-  Writes a 32-bit I/O port.\r
-\r
-  Writes the 32-bit I/O port specified by Port with the value specified by Value\r
-  and returns Value. This function must guarantee that all I/O read and write\r
-  operations are serialized.\r
-\r
-  If 32-bit I/O port operations are not supported, then ASSERT().\r
-\r
-  @param  Port  The I/O port to write.\r
-  @param  Value The value to write to the I/O port.\r
-\r
-  @return The value written the I/O port.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-IoWrite32 (\r
-  IN      UINTN                     Port,\r
-  IN      UINT32                    Value\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Port is aligned on a 32-bit boundary.\r
-  //\r
-  ASSERT ((Port & 3) == 0);\r
-  CpuIo->IoWrite32 (PeiServices, CpuIo, (UINT64) Port, Value);\r
-  return Value;\r
-}\r
-\r
-/**\r
-  Reads a 64-bit I/O port.\r
-\r
-  Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.\r
-  This function must guarantee that all I/O read and write operations are\r
-  serialized.\r
-\r
-  If 64-bit I/O port operations are not supported, then ASSERT().\r
-\r
-  @param  Port  The I/O port to read.\r
-\r
-  @return The value read.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-IoRead64 (\r
-  IN      UINTN                     Port\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Port is aligned on a 64-bit boundary.\r
-  //\r
-  ASSERT ((Port & 7) == 0);\r
-  return CpuIo->IoRead64 (PeiServices, CpuIo, (UINT64) Port);\r
-}\r
-\r
-/**\r
-  Writes a 64-bit I/O port.\r
-\r
-  Writes the 64-bit I/O port specified by Port with the value specified by Value\r
-  and returns Value. This function must guarantee that all I/O read and write\r
-  operations are serialized.\r
-\r
-  If 64-bit I/O port operations are not supported, then ASSERT().\r
-\r
-  @param  Port  The I/O port to write.\r
-  @param  Value The value to write to the I/O port.\r
-\r
-  @return The value written the I/O port.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-IoWrite64 (\r
-  IN      UINTN                     Port,\r
-  IN      UINT64                    Value\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Port is aligned on a 64-bit boundary.\r
-  //\r
-  ASSERT ((Port & 7) == 0);\r
-  CpuIo->IoWrite64 (PeiServices, CpuIo, (UINT64) Port, Value);\r
-  return Value;;\r
-}\r
-\r
-/**\r
-  Reads an 8-bit MMIO register.\r
-\r
-  Reads the 8-bit MMIO register specified by Address. The 8-bit read value is\r
-  returned. This function must guarantee that all MMIO read and write\r
-  operations are serialized.\r
-\r
-  If 8-bit MMIO register operations are not supported, then ASSERT().\r
-\r
-  @param  Address The MMIO register to read.\r
-\r
-  @return The value read.\r
-\r
-**/\r
-UINT8\r
-EFIAPI\r
-MmioRead8 (\r
-  IN      UINTN                     Address\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-\r
-  return CpuIo->MemRead8 (PeiServices, CpuIo, (UINT64) Address);\r
-}\r
-\r
-/**\r
-  Writes an 8-bit MMIO register.\r
-\r
-  Writes the 8-bit MMIO register specified by Address with the value specified\r
-  by Value and returns Value. This function must guarantee that all MMIO read\r
-  and write operations are serialized.\r
-\r
-  If 8-bit MMIO register operations are not supported, then ASSERT().\r
-\r
-  @param  Address The MMIO register to write.\r
-  @param  Value   The value to write to the MMIO register.\r
-\r
-**/\r
-UINT8\r
-EFIAPI\r
-MmioWrite8 (\r
-  IN      UINTN                     Address,\r
-  IN      UINT8                     Value\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-\r
-  CpuIo->MemWrite8 (PeiServices, CpuIo, (UINT64) Address, Value);\r
-  return Value;\r
-}\r
-\r
-/**\r
-  Reads a 16-bit MMIO register.\r
-\r
-  Reads the 16-bit MMIO register specified by Address. The 16-bit read value is\r
-  returned. This function must guarantee that all MMIO read and write\r
-  operations are serialized.\r
-\r
-  If 16-bit MMIO register operations are not supported, then ASSERT().\r
-\r
-  @param  Address The MMIO register to read.\r
-\r
-  @return The value read.\r
-\r
-**/\r
-UINT16\r
-EFIAPI\r
-MmioRead16 (\r
-  IN      UINTN                     Address\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Address is aligned on a 16-bit boundary.\r
-  //\r
-  ASSERT ((Address & 1) == 0);\r
-  return CpuIo->MemRead16 (PeiServices, CpuIo, (UINT64) Address);\r
-\r
-}\r
-\r
-/**\r
-  Writes a 16-bit MMIO register.\r
-\r
-  Writes the 16-bit MMIO register specified by Address with the value specified\r
-  by Value and returns Value. This function must guarantee that all MMIO read\r
-  and write operations are serialized.\r
-\r
-  If 16-bit MMIO register operations are not supported, then ASSERT().\r
-\r
-  @param  Address The MMIO register to write.\r
-  @param  Value   The value to write to the MMIO register.\r
-\r
-**/\r
-UINT16\r
-EFIAPI\r
-MmioWrite16 (\r
-  IN      UINTN                     Address,\r
-  IN      UINT16                    Value\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Address is aligned on a 16-bit boundary.\r
-  //\r
-  ASSERT ((Address & 1) == 0);\r
-  CpuIo->MemWrite16 (PeiServices, CpuIo, (UINT64) Address, Value);\r
-  return Value;\r
-}\r
-\r
-/**\r
-  Reads a 32-bit MMIO register.\r
-\r
-  Reads the 32-bit MMIO register specified by Address. The 32-bit read value is\r
-  returned. This function must guarantee that all MMIO read and write\r
-  operations are serialized.\r
-\r
-  If 32-bit MMIO register operations are not supported, then ASSERT().\r
-\r
-  @param  Address The MMIO register to read.\r
-\r
-  @return The value read.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-MmioRead32 (\r
-  IN      UINTN                     Address\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Address is aligned on a 32-bit boundary.\r
-  //\r
-  ASSERT ((Address & 3) == 0);\r
-  return CpuIo->MemRead32 (PeiServices, CpuIo, (UINT64) Address);\r
-\r
-}\r
-\r
-/**\r
-  Writes a 32-bit MMIO register.\r
-\r
-  Writes the 32-bit MMIO register specified by Address with the value specified\r
-  by Value and returns Value. This function must guarantee that all MMIO read\r
-  and write operations are serialized.\r
-\r
-  If 32-bit MMIO register operations are not supported, then ASSERT().\r
-\r
-  @param  Address The MMIO register to write.\r
-  @param  Value   The value to write to the MMIO register.\r
-\r
-**/\r
-UINT32\r
-EFIAPI\r
-MmioWrite32 (\r
-  IN      UINTN                     Address,\r
-  IN      UINT32                    Value\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Address is aligned on a 32-bit boundary.\r
-  //\r
-  ASSERT ((Address & 3) == 0);\r
-  CpuIo->MemWrite32 (PeiServices, CpuIo, (UINT64) Address, Value);\r
-  return Value;\r
-}\r
-\r
-/**\r
-  Reads a 64-bit MMIO register.\r
-\r
-  Reads the 64-bit MMIO register specified by Address. The 64-bit read value is\r
-  returned. This function must guarantee that all MMIO read and write\r
-  operations are serialized.\r
-\r
-  If 64-bit MMIO register operations are not supported, then ASSERT().\r
-\r
-  @param  Address The MMIO register to read.\r
-\r
-  @return The value read.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-MmioRead64 (\r
-  IN      UINTN                     Address\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Address is aligned on a 64-bit boundary.\r
-  //\r
-  ASSERT ((Address & 7) == 0);\r
-  return CpuIo->MemRead64 (PeiServices, CpuIo, (UINT64) Address);\r
-\r
-}\r
-\r
-/**\r
-  Writes a 64-bit MMIO register.\r
-\r
-  Writes the 64-bit MMIO register specified by Address with the value specified\r
-  by Value and returns Value. This function must guarantee that all MMIO read\r
-  and write operations are serialized.\r
-\r
-  If 64-bit MMIO register operations are not supported, then ASSERT().\r
-\r
-  @param  Address The MMIO register to write.\r
-  @param  Value   The value to write to the MMIO register.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-MmioWrite64 (\r
-  IN      UINTN                     Address,\r
-  IN      UINT64                    Value\r
-  )\r
-{\r
-  EFI_PEI_SERVICES                  **PeiServices;\r
-  EFI_PEI_CPU_IO_PPI                *CpuIo;\r
-\r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  CpuIo       = (*PeiServices)->CpuIo;\r
-  ASSERT (CpuIo != NULL);\r
-  //\r
-  // Make sure Address is aligned on a 64-bit boundary.\r
-  //\r
-  ASSERT ((Address & 7) == 0);\r
-  CpuIo->MemWrite64 (PeiServices, CpuIo, (UINT64) Address, Value);\r
-  return Value;\r
-}\r