]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Compatibility/PciCfg2OnPciCfgThunk/PciCfg2OnPciCfgThunk.c
EdkCompatibilityPkg: Remove EdkCompatibilityPkg
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / PciCfg2OnPciCfgThunk / PciCfg2OnPciCfgThunk.c
diff --git a/EdkCompatibilityPkg/Compatibility/PciCfg2OnPciCfgThunk/PciCfg2OnPciCfgThunk.c b/EdkCompatibilityPkg/Compatibility/PciCfg2OnPciCfgThunk/PciCfg2OnPciCfgThunk.c
deleted file mode 100644 (file)
index dfa1d42..0000000
+++ /dev/null
@@ -1,447 +0,0 @@
-/** @file\r
- Module produces PciCfgPpi2 on top of PciCfgPpi. It also updates the \r
- PciCfg2Ppi pointer in the EFI_PEI_SERVICES upon a installation of\r
- EcpPeiPciCfgPpi. \r
-\r
- EcpPeiPciCfgPpi is installed by a framework module which\r
- produce PciCfgPpi originally. Such framework module is updated based on the \r
- following rule to install EcpPeiPciCfgPpi instead of updating the PciCfg pointer\r
- in the Framework PeiServicesTable: \r
\r
- Search pattern:\r
-          PeiServices->PciCfg = <*>;\r
- Replace pattern:\r
-         {\r
-           static EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = {\r
-             (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-             &gEcpPeiPciCfgPpiGuid,\r
-             <*>\r
-           };\r
-           (**PeiServices).InstallPpi (PeiServices, gEcpPeiPciCfgPpiList);\r
-         }\r
\r
- In addition, the PeiServicesTable definition in PeiApi.h is updated to\r
\r
- struct _EFI_PEI_SERVICES {\r
-   EFI_TABLE_HEADER              Hdr;\r
-   ...\r
\r
-   //\r
-   // Pointer to PPI interface\r
-   //\r
- if (PI_SPECIFICATION_VERSION < 0x00010000)\r
\r
-   PEI_CPU_IO_PPI                 *CpuIo;\r
-   ECP_PEI_PCI_CFG_PPI        *PciCfg;  //Changed.\r
- else\r
- ...\r
- endif\r
\r
- };\r
\r
- This change enable the detection of code segment which invokes PeiServices->PciCfg->Modify.\r
- Such code causes a build break as ECP_PEI_PCI_CFG_PPI does not has "Modify" field. \r
- This should be updated to a call to PeiLibPciCfgModify as shown below:\r
\r
- Search pattern:\r
-               *->Modify(<*>); \r
- Replace pattern:\r
-               PeiLibPciCfgModify(<*>);\r
-\r
-\r
-\r
-PIWG's PI specification replaces Inte's EFI Specification 1.10.\r
-EFI_PEI_PCI_CFG_PPI defined in Inte's EFI Specification 1.10 is replaced by\r
-EFI_PEI_PCI_CFG2_PPI in PI 1.0.\r
-This module produces PciCfgPpi on top of PciCfgPpi2. This module is used on platform when both of\r
-these two conditions are true:\r
-1) Framework module present that produces PCI CFG PPI  AND\r
-2) PI module that produces PCI CFG2 is not present\r
-\r
-Copyright (c) 2006 - 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
-#include <PiPei.h>\r
-#include <Ppi/PciCfg.h>\r
-#include <Ppi/PciCfg2.h>\r
-#include <Ppi/EcpPciCfg.h>\r
-#include <Library/DebugLib.h>\r
-\r
-//\r
-// Function Prototypes \r
-//\r
-\r
-/**\r
-  Notification service to be called when gEcpPeiPciCfgPpiGuid is installed.\r
-\r
-  @param  PeiServices                 Indirect reference to the PEI Services Table.\r
-  @param  NotifyDescriptor          Address of the notification descriptor data structure. Type\r
-          EFI_PEI_NOTIFY_DESCRIPTOR is defined above.\r
-  @param  Ppi                             Address of the PPI that was installed.\r
-\r
-  @retval   EFI_STATUS                This function will install a PPI to PPI database. The status\r
-                                                  code will be the code for (*PeiServices)->InstallPpi.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-EcpPciCfgPpiNotifyCallback (\r
-  IN EFI_PEI_SERVICES              **PeiServices,\r
-  IN EFI_PEI_NOTIFY_DESCRIPTOR     *NotifyDescriptor,\r
-  IN VOID                          *Ppi\r
-  );\r
-\r
-//\r
-// Function Prototypes\r
-//\r
-/**\r
-  Reads from a given location in the PCI configuration space.\r
-\r
-  @param  PeiServices                   An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
-\r
-  @param  This                              Pointer to local data for the interface.\r
-\r
-  @param  Width                           The width of the access. Enumerated in bytes.\r
-                                                   See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
-\r
-  @param  Address                       The physical address of the access. The format of\r
-                                                  the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
-\r
-  @param  Buffer                           A pointer to the buffer of data..\r
-\r
-\r
-  @retval EFI_SUCCESS                 The function completed successfully.\r
-\r
-  @retval EFI_DEVICE_ERROR        There was a problem with the transaction.\r
-\r
-  @retval EFI_DEVICE_NOT_READY  The device is not capable of supporting the operation at this\r
-                                                    time.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PciCfg2Read (\r
-  IN CONST  EFI_PEI_SERVICES          **PeiServices,\r
-  IN CONST  EFI_PEI_PCI_CFG2_PPI      *This,\r
-  IN        EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
-  IN        UINT64                    Address,\r
-  IN OUT    VOID                      *Buffer\r
-  );\r
-\r
-/**\r
-  Write to a given location in the PCI configuration space.\r
-\r
-  @param  PeiServices           An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
-\r
-  @param  This                  Pointer to local data for the interface.\r
-\r
-  @param  Width                 The width of the access. Enumerated in bytes.\r
-                                See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
-\r
-  @param  Address               The physical address of the access. The format of\r
-                                the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
-\r
-  @param  Buffer                A pointer to the buffer of data..\r
-\r
-\r
-  @retval EFI_SUCCESS           The function completed successfully.\r
-\r
-  @retval EFI_DEVICE_ERROR      There was a problem with the transaction.\r
-\r
-  @retval EFI_DEVICE_NOT_READY  The device is not capable of supporting the operation at this time.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PciCfg2Write (\r
-  IN CONST  EFI_PEI_SERVICES          **PeiServices,\r
-  IN CONST  EFI_PEI_PCI_CFG2_PPI      *This,\r
-  IN        EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
-  IN        UINT64                    Address,\r
-  IN OUT    VOID                      *Buffer\r
-  );\r
-\r
-/**\r
-  PCI read-modify-write operation.\r
-\r
-  @param  PeiServices                     An indirect pointer to the PEI Services Table\r
-                                                      published by the PEI Foundation.\r
-\r
-  @param  This                                Pointer to local data for the interface.\r
-\r
-  @param  Width                             The width of the access. Enumerated in bytes. Type\r
-                                                      EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r
-\r
-  @param  Address                           The physical address of the access.\r
-\r
-  @param  SetBits                            Points to value to bitwise-OR with the read configuration value.\r
-                                                      The size of the value is determined by Width.\r
-\r
-  @param  ClearBits                         Points to the value to negate and bitwise-AND with the read configuration value.\r
-                                                      The size of the value is determined by Width.\r
-\r
-\r
-  @retval EFI_SUCCESS                   The function completed successfully.\r
-\r
-  @retval EFI_DEVICE_ERROR          There was a problem with the transaction.\r
-\r
-  @retval EFI_DEVICE_NOT_READY  The device is not capable of supporting\r
-                                                    the operation at this time.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PciCfg2Modify (\r
-  IN CONST  EFI_PEI_SERVICES          **PeiServices,\r
-  IN CONST  EFI_PEI_PCI_CFG2_PPI      *This,\r
-  IN        EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
-  IN        UINT64                    Address,\r
-  IN        VOID                      *SetBits,\r
-  IN        VOID                      *ClearBits\r
-  );\r
-\r
-//\r
-// Module globals\r
-//\r
-EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnEcpPciCfgList = {\r
-  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-  &gEcpPeiPciCfgPpiGuid,\r
-  EcpPciCfgPpiNotifyCallback \r
-};\r
-\r
-EFI_PEI_PCI_CFG2_PPI mPciCfg2Ppi = {\r
-  PciCfg2Read,\r
-  PciCfg2Write,\r
-  PciCfg2Modify,\r
-  0\r
-};\r
-\r
-EFI_PEI_PPI_DESCRIPTOR mPpiListPciCfg2 = {\r
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-  &gEfiPciCfg2PpiGuid,\r
-  &mPciCfg2Ppi\r
-};\r
-\r
-\r
-/**\r
-\r
-  Standard PEIM entry point.\r
-\r
-  @param FileHandle   Handle of the file being invoked.\r
-  @param PeiServices  General purpose services available to every PEIM.\r
-\r
-  @retval EFI_SUCCESS The interface could be successfully installed.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PeimInitializePciCfg2 (\r
-  IN EFI_PEI_FILE_HANDLE     FileHandle,\r
-  IN CONST EFI_PEI_SERVICES  **PeiServices\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-  VOID        *Ppi;\r
-\r
-  //\r
-  // Make sure no other module has install the first instance of gEfiPciCfg2PpiGuid.\r
-  //\r
-  Status = (*PeiServices)->LocatePpi (PeiServices, &gEfiPciCfg2PpiGuid, 0, NULL, &Ppi);\r
-  ASSERT (Status == EFI_NOT_FOUND);\r
-\r
-  //\r
-  // Register a notification for ECP PCI CFG PPI\r
-  //\r
-  Status = (*PeiServices)->NotifyPpi (PeiServices, &mNotifyOnEcpPciCfgList);\r
-  ASSERT_EFI_ERROR (Status);\r
-  return Status;\r
-}\r
-\r
-\r
-/**\r
-  Notification service to be called when gEcpPeiPciCfgPpiGuid is installed.\r
-\r
-  @param  PeiServices                 Indirect reference to the PEI Services Table.\r
-  @param  NotifyDescriptor          Address of the notification descriptor data structure. Type\r
-          EFI_PEI_NOTIFY_DESCRIPTOR is defined above.\r
-  @param  Ppi                             Address of the PPI that was installed.\r
-\r
-  @retval   EFI_STATUS                This function will install a PPI to PPI database. The status\r
-                                                  code will be the code for (*PeiServices)->InstallPpi.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-EcpPciCfgPpiNotifyCallback (\r
-  IN EFI_PEI_SERVICES              **PeiServices,\r
-  IN EFI_PEI_NOTIFY_DESCRIPTOR     *NotifyDescriptor,\r
-  IN VOID                          *Ppi\r
-  )\r
-{\r
-  //\r
-  // When ECP PCI CFG PPI is installed, publish the PCI CFG2 PPI in the \r
-  // PEI Services Table and the PPI database\r
-  //\r
-  (*PeiServices)->PciCfg = &mPciCfg2Ppi;\r
-  return (*PeiServices)->InstallPpi ((CONST EFI_PEI_SERVICES **)PeiServices, &mPpiListPciCfg2);\r
-}\r
-\r
-/**\r
-  Reads from a given location in the PCI configuration space.\r
-\r
-  @param  PeiServices                   An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
-\r
-  @param  This                              Pointer to local data for the interface.\r
-\r
-  @param  Width                           The width of the access. Enumerated in bytes.\r
-                                                   See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
-\r
-  @param  Address                       The physical address of the access. The format of\r
-                                                  the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
-\r
-  @param  Buffer                           A pointer to the buffer of data..\r
-\r
-\r
-  @retval EFI_SUCCESS                 The function completed successfully.\r
-\r
-  @retval EFI_DEVICE_ERROR        There was a problem with the transaction.\r
-\r
-  @retval EFI_DEVICE_NOT_READY  The device is not capable of supporting the operation at this\r
-                                                    time.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PciCfg2Read (\r
-  IN CONST  EFI_PEI_SERVICES          **PeiServices,\r
-  IN CONST  EFI_PEI_PCI_CFG2_PPI      *This,\r
-  IN        EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
-  IN        UINT64                    Address,\r
-  IN OUT    VOID                      *Buffer\r
-  )\r
-{\r
-  EFI_STATUS           Status;\r
-  EFI_PEI_PCI_CFG_PPI  *PciCfg;\r
-\r
-  Status = (*PeiServices)->LocatePpi (\r
-             PeiServices,\r
-             &gEcpPeiPciCfgPpiGuid,\r
-             0,\r
-             NULL,\r
-             (VOID **)&PciCfg\r
-             );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  return PciCfg->Read ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, Buffer);\r
-}\r
-\r
-/**\r
-  Write to a given location in the PCI configuration space.\r
-\r
-  @param  PeiServices                   An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
-\r
-  @param  This                              Pointer to local data for the interface.\r
-\r
-  @param  Width                            The width of the access. Enumerated in bytes.\r
-                                                    See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
-\r
-  @param  Address                         The physical address of the access. The format of\r
-                                                    the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
-\r
-  @param  Buffer                            A pointer to the buffer of data..\r
-\r
-\r
-  @retval EFI_SUCCESS                   The function completed successfully.\r
-\r
-  @retval EFI_DEVICE_ERROR          There was a problem with the transaction.\r
-\r
-  @retval EFI_DEVICE_NOT_READY  The device is not capable of supporting the operation at this\r
-                                                     time.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PciCfg2Write (\r
-  IN CONST  EFI_PEI_SERVICES          **PeiServices,\r
-  IN CONST  EFI_PEI_PCI_CFG2_PPI      *This,\r
-  IN        EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
-  IN        UINT64                    Address,\r
-  IN OUT    VOID                      *Buffer\r
-  )\r
-{\r
-  EFI_STATUS           Status;\r
-  EFI_PEI_PCI_CFG_PPI  *PciCfg;\r
-\r
-  Status = (*PeiServices)->LocatePpi (\r
-             PeiServices,\r
-             &gEcpPeiPciCfgPpiGuid,\r
-             0,\r
-             NULL,\r
-             (VOID **)&PciCfg\r
-             );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  return PciCfg->Write ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, Buffer);\r
-}\r
-\r
-/**\r
-  PCI read-modify-write operation.\r
-\r
-  @param  PeiServices                     An indirect pointer to the PEI Services Table\r
-                                                      published by the PEI Foundation.\r
-\r
-  @param  This                                Pointer to local data for the interface.\r
-\r
-  @param  Width                             The width of the access. Enumerated in bytes. Type\r
-                                                      EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r
-\r
-  @param  Address                           The physical address of the access.\r
-\r
-  @param  SetBits                            Points to value to bitwise-OR with the read configuration value.\r
-                                                      The size of the value is determined by Width.\r
-\r
-  @param  ClearBits                         Points to the value to negate and bitwise-AND with the read configuration value.\r
-                                                      The size of the value is determined by Width.\r
-\r
-\r
-  @retval EFI_SUCCESS                   The function completed successfully.\r
-\r
-  @retval EFI_DEVICE_ERROR          There was a problem with the transaction.\r
-\r
-  @retval EFI_DEVICE_NOT_READY  The device is not capable of supporting\r
-                                                    the operation at this time.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PciCfg2Modify (\r
-  IN CONST  EFI_PEI_SERVICES          **PeiServices,\r
-  IN CONST  EFI_PEI_PCI_CFG2_PPI      *This,\r
-  IN        EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
-  IN        UINT64                    Address,\r
-  IN        VOID                      *SetBits,\r
-  IN        VOID                      *ClearBits\r
-  )\r
-{\r
-  EFI_STATUS           Status;\r
-  EFI_PEI_PCI_CFG_PPI  *PciCfg;\r
-\r
-  Status = (*PeiServices)->LocatePpi (\r
-             PeiServices,\r
-             &gEfiPciCfgPpiInServiceTableGuid,\r
-             0,\r
-             NULL,\r
-             (VOID **)&PciCfg\r
-             );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  return PciCfg->Modify ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, *(UINTN *)SetBits, *(UINTN *)ClearBits);\r
-}\r