summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-04-03 10:36:52 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-04-03 10:36:52 +0000
commit4259256b48aea70035b8e68e75ed12cdde36c908 (patch)
tree1ba6dac6689cd72dcff4fbdf231f87950a05ec9f /EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk
parenta8bf2e5a3c3d2d55452cdc7e4e2abb6fdc6b0ad4 (diff)
downloadedk2-platforms-4259256b48aea70035b8e68e75ed12cdde36c908.tar.xz
Fix a type in the directory name. Compatiblity -> Compatibility.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4994 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk')
-rw-r--r--EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.c219
-rw-r--r--EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.inf53
2 files changed, 272 insertions, 0 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.c b/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.c
new file mode 100644
index 0000000000..9cdf65ac92
--- /dev/null
+++ b/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.c
@@ -0,0 +1,219 @@
+/*++
+
+Copyright (c) 2006 - 2008 Intel Corporation. <BR>
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Module Name:
+
+ Variable.c
+
+Abstract:
+
+ PEIM to provide the Variable functionality
+
+--*/
+
+#include <PiPei.h>
+#include <Ppi/PciCfg.h>
+#include <Ppi/PciCfg2.h>
+#include <Ppi/EcpPciCfg.h>
+#include <Library/DebugLib.h>
+
+//
+// Function Prototypes - Callbacks
+//
+EFI_STATUS
+EFIAPI
+EcpPciCfgPpiNotifyCallback (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ );
+
+//
+// Function Prototypes
+//
+EFI_STATUS
+EFIAPI
+PciCfg2Read (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN CONST EFI_PEI_PCI_CFG2_PPI *This,
+ IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
+ IN UINT64 Address,
+ IN OUT VOID *Buffer
+ );
+
+EFI_STATUS
+EFIAPI
+PciCfg2Write (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN CONST EFI_PEI_PCI_CFG2_PPI *This,
+ IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
+ IN UINT64 Address,
+ IN OUT VOID *Buffer
+ );
+
+EFI_STATUS
+EFIAPI
+PciCfg2Modify (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN CONST EFI_PEI_PCI_CFG2_PPI *This,
+ IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
+ IN UINT64 Address,
+ IN CONST VOID *SetBits,
+ IN CONST VOID *ClearBits
+ );
+
+//
+// Module globals
+//
+EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnEcpPciCfgList = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEcpPeiPciCfgPpiGuid,
+ EcpPciCfgPpiNotifyCallback
+};
+
+EFI_PEI_PCI_CFG2_PPI mPciCfg2Ppi = {
+ PciCfg2Read,
+ PciCfg2Write,
+ PciCfg2Modify,
+ 0
+};
+
+EFI_PEI_PPI_DESCRIPTOR mPpiListPciCfg2 = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiPciCfg2PpiGuid,
+ &mPciCfg2Ppi
+};
+
+
+EFI_STATUS
+EFIAPI
+PeimInitializePciCfg2 (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+/*++
+
+Routine Description:
+
+ Provide the functionality of the variable services.
+
+Arguments:
+
+ FfsHeadher - The FFS file header
+ PeiServices - General purpose services available to every PEIM.
+
+Returns:
+
+ Status - EFI_SUCCESS if the interface could be successfully
+ installed
+
+--*/
+{
+ EFI_STATUS Status;
+
+ //
+ // Register a notification for ECP PCI CFG PPI
+ //
+ Status = (*PeiServices)->NotifyPpi (PeiServices, &mNotifyOnEcpPciCfgList);
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+EcpPciCfgPpiNotifyCallback (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
+ )
+{
+ //
+ // When ECP PCI CFG PPI is installed, publish the PCI CFG2 PPI in the
+ // PEI Services Table and the PPI database
+ //
+ (*PeiServices)->PciCfg = &mPciCfg2Ppi;
+ return (*PeiServices)->InstallPpi ((CONST EFI_PEI_SERVICES **)PeiServices, &mPpiListPciCfg2);
+}
+
+EFI_STATUS
+EFIAPI
+PciCfg2Read (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN CONST EFI_PEI_PCI_CFG2_PPI *This,
+ IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
+ IN UINT64 Address,
+ IN OUT VOID *Buffer
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_PCI_CFG_PPI *PciCfg;
+
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEcpPeiPciCfgPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&PciCfg
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return PciCfg->Read ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, Buffer);
+}
+
+EFI_STATUS
+EFIAPI
+PciCfg2Write (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN CONST EFI_PEI_PCI_CFG2_PPI *This,
+ IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
+ IN UINT64 Address,
+ IN OUT VOID *Buffer
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_PCI_CFG_PPI *PciCfg;
+
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEcpPeiPciCfgPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&PciCfg
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return PciCfg->Write ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, Buffer);
+}
+
+EFI_STATUS
+EFIAPI
+PciCfg2Modify (
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN CONST EFI_PEI_PCI_CFG2_PPI *This,
+ IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
+ IN UINT64 Address,
+ IN CONST VOID *SetBits,
+ IN CONST VOID *ClearBits
+ )
+{
+ EFI_STATUS Status;
+ EFI_PEI_PCI_CFG_PPI *PciCfg;
+
+ Status = (*PeiServices)->LocatePpi (
+ PeiServices,
+ &gEcpPeiPciCfgPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&PciCfg
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return PciCfg->Modify ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, *(UINTN *)SetBits, *(UINTN *)ClearBits);
+}
diff --git a/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.inf b/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.inf
new file mode 100644
index 0000000000..85e84e5795
--- /dev/null
+++ b/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.inf
@@ -0,0 +1,53 @@
+#/** @file
+# Component description file for PeiVariable module.
+#
+# PEIM to provide the Variable functionality.
+# Copyright (c) 2006 - 2007, Intel Corporation
+#
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#
+#**/
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = PciCfg2ToPciCfgThunk
+ FILE_GUID = 41401688-2862-431b-BAAC-6ECADAC384AB
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ EDK_RELEASE_VERSION = 0x00020000
+ EFI_SPECIFICATION_VERSION = 0x00020000
+
+ ENTRY_POINT = PeimInitializePciCfg2
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources.common]
+ PciCfg2ToPciCfgThunk.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ IntelFrameworkPkg/IntelFrameworkPkg.dec
+ EdkCompatibilityPkg/EdkCompatibilityPkg.dec
+
+[LibraryClasses]
+ PeimEntryPoint
+ DebugLib
+
+[Ppis]
+ gEfiPciCfgPpiInServiceTableGuid
+ gEfiPciCfg2PpiGuid
+ gEcpPeiPciCfgPpiGuid
+
+[Depex]
+ TRUE
+# gEcpPeiPciCfgPpiGuid