]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeiLib.c
1) Change Framework version of PeiServiceTable's PciCfg from PEI_PCI_CFG_PPI to ECP_P...
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / Pei / PeiLib / PeiLib.c
index 23156bb573effe0b9366cffb4e12c007dc63f7e8..f05549fdcb51dd7b2cfff0031247b9551c393723 100644 (file)
@@ -153,6 +153,99 @@ Returns:
 }\r
 \r
 \r
+EFI_STATUS\r
+EFIAPI \r
+PeiLibPciCfgModify (\r
+  IN EFI_PEI_SERVICES         **PeiServices,\r
+  IN PEI_PCI_CFG_PPI_WIDTH    Width,\r
+  IN UINT64                   Address,\r
+  IN UINTN                    SetBits,\r
+  IN UINTN                    ClearBits\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  PCI read-modify-write operations.\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. "Modify" function  in these two PPI are not \r
+  compatibile with each other.\r
+  \r
+\r
+  For Framework code that make the following call:\r
+\r
+      PciCfg->Modify (\r
+                       PeiServices,\r
+                       PciCfg,\r
+                       Width,\r
+                       Address,\r
+                       SetBits,\r
+                       ClearBits\r
+                       );\r
+   it will be updated to the following code which call this library API:\r
+      PeiLibPciCfgModify (\r
+          PeiServices,\r
+          Width,\r
+          Address,\r
+          SetBits,\r
+          ClearBits\r
+          );\r
+\r
+   The \r
+\r
+Arguments:\r
+  \r
+  PeiServices     An indirect pointer to the PEI Services Table\r
+                          published by the PEI Foundation.\r
+\r
+  Width           The width of the access. Enumerated in bytes. Type\r
+                          EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r
+\r
+  Address         The physical address of the access.\r
+\r
+  SetBits         Points to value to bitwise-OR with the read configuration value.\r
+\r
+                          The size of the value is determined by Width.\r
+\r
+  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
+Returns:\r
+\r
+  EFI_SUCCESS           The function completed successfully.\r
+\r
+  EFI_DEVICE_ERROR      There was a problem with the transaction.\r
+\r
+--*/\r
+{\r
+  EFI_STATUS            Status;\r
+  EFI_PEI_PCI_CFG2_PPI  *PciCfg2;\r
+\r
+  Status = (*PeiServices)->LocatePpi (\r
+                             PeiServices,\r
+                             &gPeiPciCfg2PpiGuid,\r
+                             0,\r
+                             NULL,\r
+                             (VOID **) &PciCfg2\r
+                             );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  Status = PciCfg2->Modify (\r
+                      PeiServices,\r
+                      PciCfg2,\r
+                      Width,\r
+                      Address,\r
+                      &SetBits,\r
+                      &ClearBits\r
+                      );\r
+\r
+  return Status;\r
+}\r
+\r
+\r
 #if (PI_SPECIFICATION_VERSION >= 0x00010000)\r
 \r
 VOID *\r