]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1) Change Framework version of PeiServiceTable's PciCfg from PEI_PCI_CFG_PPI to ECP_P...
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 21 May 2008 07:21:30 +0000 (07:21 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 21 May 2008 07:21:30 +0000 (07:21 +0000)
2) Add ECP_PEI_PCI_CFG_PPI to EdkFrameworkPpiLib
3) Add PeiLibPciCfgModify which call PciCfg2. This function will used by modified Framework Module which will be working with a PI platform.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5260 6f19259b-4bc3-4df7-8a09-765794883524

EdkCompatibilityPkg/Foundation/Framework/Include/PeiApi.h
EdkCompatibilityPkg/Foundation/Framework/Ppi/EcpPciCfg/EcpPciCfg.c [new file with mode: 0644]
EdkCompatibilityPkg/Foundation/Framework/Ppi/EcpPciCfg/EcpPciCfg.h [new file with mode: 0644]
EdkCompatibilityPkg/Foundation/Framework/Ppi/EdkFrameworkPpiLib.inf
EdkCompatibilityPkg/Foundation/Library/Pei/Include/PeiLib.h
EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeiLib.c

index 674855640f32f3a71a0ebeef0d2d8fe9f14562c5..dde93c3204066bfa71588d0c2140e6856c75329e 100644 (file)
@@ -43,6 +43,7 @@ EFI_FORWARD_DECLARATION (EFI_PEI_SERVICES);
 #include EFI_PPI_DEFINITION (CpuIo)\r
 #include EFI_PPI_DEFINITION (PciCfg)\r
 #include EFI_PPI_DEFINITION (PciCfg2)\r
+#include EFI_PPI_DEFINITION (EcpPciCfg)\r
 \r
 //\r
 // PEI Specification Revision information\r
@@ -546,7 +547,11 @@ struct _EFI_PEI_SERVICES {
 #if (PI_SPECIFICATION_VERSION < 0x00010000)\r
 \r
   PEI_CPU_IO_PPI                 *CpuIo;\r
+#if defined (SUPPORT_DEPRECATED_PCI_CFG_PPI)\r
   PEI_PCI_CFG_PPI                *PciCfg;\r
+#else\r
+  ECP_PEI_PCI_CFG_PPI            *PciCfg;\r
+#endif\r
 #else\r
   EFI_PEI_CPU_IO_PPI             *CpuIo;\r
   EFI_PEI_PCI_CFG2_PPI           *PciCfg;\r
diff --git a/EdkCompatibilityPkg/Foundation/Framework/Ppi/EcpPciCfg/EcpPciCfg.c b/EdkCompatibilityPkg/Foundation/Framework/Ppi/EcpPciCfg/EcpPciCfg.c
new file mode 100644 (file)
index 0000000..6b93c4c
--- /dev/null
@@ -0,0 +1,28 @@
+/*++\r
+\r
+Copyright (c) 2004, Intel Corporation                                                         \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:\r
+\r
+ EcpPciCfg.c\r
+\r
+Abstract:\r
+\r
+  This PPI which is same with PciCfg PPI. But Modify API is removed.\r
+\r
+--*/\r
+\r
+#include "Tiano.h"\r
+#include "Pei.h"\r
+#include EFI_PPI_DEFINITION (EcpPciCfg)\r
+\r
+EFI_GUID  gEcpPeiPciCfgPpiGuid = ECP_PEI_PCI_CFG_PPI_GUID;\r
+\r
+EFI_GUID_STRING(&gEcpPeiPciCfgPpiGuid, "Ecp PciCfg", "Ecp PciCfg PPI");\r
diff --git a/EdkCompatibilityPkg/Foundation/Framework/Ppi/EcpPciCfg/EcpPciCfg.h b/EdkCompatibilityPkg/Foundation/Framework/Ppi/EcpPciCfg/EcpPciCfg.h
new file mode 100644 (file)
index 0000000..837183b
--- /dev/null
@@ -0,0 +1,50 @@
+/*++\r
+\r
+Copyright (c) 2008, Intel Corporation                                                         \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:\r
+\r
+ PciCfg.h\r
+\r
+Abstract:\r
+\r
+  This PPI which is same with PciCfg PPI. But Modify API is removed.\r
+\r
+--*/\r
+\r
+#ifndef _ECP_PEI_PCI_CFG_H_\r
+#define _ECP_PEI_PCI_CFG_H_\r
+#include EFI_PPI_DEFINITION (PciCfg)\r
+\r
+#define ECP_PEI_PCI_CFG_PPI_GUID \\r
+    {0xb0ee53d4, 0xa049, 0x4a79, { 0xb2, 0xff, 0x19, 0xd9, 0xfa, 0xef, 0xaa, 0x94 }}\r
+\r
+EFI_FORWARD_DECLARATION (ECP_PEI_PCI_CFG_PPI);\r
+\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *ECP_PEI_PCI_CFG_PPI_IO) (\r
+  IN EFI_PEI_SERVICES         **PeiServices,\r
+  IN PEI_PCI_CFG_PPI          *This,\r
+  IN PEI_PCI_CFG_PPI_WIDTH    Width,\r
+  IN UINT64                   Address,\r
+  IN OUT VOID                 *Buffer\r
+  );\r
+\r
+struct _ECP_PEI_PCI_CFG_PPI {\r
+  ECP_PEI_PCI_CFG_PPI_IO  Read;\r
+  ECP_PEI_PCI_CFG_PPI_IO  Write;\r
+};\r
+\r
+extern EFI_GUID gEcpPeiPciCfgPpiGuid;\r
+\r
+#endif\r
+\r
index 438bbffbf35f3196b553f7fb13731e557ae99117..d0447053ff953be28ec3a50dd217379dd0d251d2 100644 (file)
@@ -100,3 +100,6 @@ COMPONENT_TYPE=   LIBRARY
     FirmwareVolume/FirmwareVolume.c\r
     GuidedSectionExtraction/GuidedSectionExtraction.h\r
     GuidedSectionExtraction/GuidedSectionExtraction.c\r
+    EcpPciCfg/EcpPciCfg.h\r
+    EcpPciCfg/EcpPciCfg.c\r
+    \r
index bbd3713b904452bc304a048ff3dfa7bb54593395..e3afb4341f4a2ae1bfd85872c0b76c61eff977a0 100644 (file)
@@ -1301,4 +1301,75 @@ Returns:
 --*/\r
 ;\r
 \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
+\r
 #endif\r
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