summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei')
-rw-r--r--MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf8
-rw-r--r--MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c218
2 files changed, 35 insertions, 191 deletions
diff --git a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf
index e46a1c32c8..2a78525785 100644
--- a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf
+++ b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf
@@ -1,8 +1,9 @@
#/** @file
-# Single Segment Pci Configuration PPI
+# This driver installs Single Segment Pci Configuration 2 PPI
+# to provide read, write and modify access to Pci configuration space in PEI phase.
+# To follow PI specification, these services also support access to the unaligned Pci address.
#
-# This file declares PciCfg PPI used to access PCI configuration space in PEI
-# Copyright (c) 2006 - 2007, Intel Corporation
+# Copyright (c) 2006 - 2008, 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
@@ -21,6 +22,7 @@
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
ENTRY_POINT = PeimInitializePciCfg
+ PI_SPECIFICATION_VERSION = 0x00010000
#
# The following information is for reference only and not required by the build tools.
diff --git a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c
index fdd67f7abb..d2ca19c7b0 100644
--- a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c
+++ b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c
@@ -1,7 +1,9 @@
/** @file
- Installs Single Segment Pci Configuration PPI.
+ This driver installs Single Segment Pci Configuration 2 PPI
+ to provide read, write and modify access to Pci configuration space in PEI phase.
+ To follow PI specification, these services also support access to the unaligned Pci address.
- Copyright (c) 2006 - 2007, Intel Corporation
+ Copyright (c) 2006 - 2008, 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
@@ -13,164 +15,19 @@
**/
#include <PiPei.h>
-
#include <Ppi/PciCfg2.h>
-
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/PciLib.h>
#include <Library/PeimEntryPoint.h>
-
#include <IndustryStandard/Pci.h>
/**
- Reads from a given location in the PCI configuration space.
-
- @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes.
- See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
- @param Address The physical address of the access. The format of
- the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
- time.
-
-**/
-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
- );
-
-/**
- Write to a given location in the PCI configuration space.
-
- @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes.
- See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
- @param Address The physical address of the access. The format of
- the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
- time.
-
-**/
-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
- );
-
-
-/**
- PCI read-modify-write operation.
-
- @param PeiServices An indirect pointer to the PEI Services Table
- published by the PEI Foundation.
-
- @param This Pointer to local data for the interface.
-
- @param Width The width of the access. Enumerated in bytes. Type
- EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
-
- @param Address The physical address of the access.
-
- @param SetBits Points to value to bitwise-OR with the read configuration value.
-
- The size of the value is determined by Width.
-
- @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
- The size of the value is determined by Width.
-
-
- @retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting
- the operation at this time.
-
-**/
-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 VOID *SetBits,
- IN VOID *ClearBits
- );
-
-
-
-/**
- @par Ppi Description:
- The EFI_PEI_PCI_CFG2_PPI interfaces are used to abstract
- accesses to PCI controllers behind a PCI root bridge
- controller.
-
- @param Read PCI read services. See the Read() function description.
-
- @param Write PCI write services. See the Write() function description.
-
- @param Modify PCI read-modify-write services. See the Modify() function description.
-
- @param Segment The PCI bus segment which the specified functions will access.
-
-**/
-GLOBAL_REMOVE_IF_UNREFERENCED
-EFI_PEI_PCI_CFG2_PPI gPciCfg2Ppi = {
- PciCfg2Read,
- PciCfg2Write,
- PciCfg2Modify
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED
-EFI_PEI_PPI_DESCRIPTOR gPciCfg2PpiList = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPciCfg2PpiGuid,
- &gPciCfg2Ppi
-};
-
-
-/**
Convert EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS to PCI_LIB_ADDRESS.
- @param Address PCI address with
- EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS format.
+ @param Address PCI address with EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS format.
- @return The PCI address with PCI_LIB_ADDRESS format.
+ @return PCI address with PCI_LIB_ADDRESS format.
**/
UINTN
@@ -185,30 +42,20 @@ PciCfgAddressConvert (
return PCI_LIB_ADDRESS (Address->Bus, Address->Device, Address->Function, Address->ExtendedRegister);
}
-
/**
Reads from a given location in the PCI configuration space.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
@param This Pointer to local data for the interface.
-
@param Width The width of the access. Enumerated in bytes.
See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
@param Address The physical address of the access. The format of
the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
+ @param Buffer A pointer to the buffer of data.
@retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
- time.
-
+ @retval EFI_INVALID_PARAMETER The invalid access width.
+
**/
EFI_STATUS
EFIAPI
@@ -271,24 +118,15 @@ PciCfg2Read (
Write to a given location in the PCI configuration space.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
-
@param This Pointer to local data for the interface.
-
@param Width The width of the access. Enumerated in bytes.
See EFI_PEI_PCI_CFG_PPI_WIDTH above.
-
@param Address The physical address of the access. The format of
the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
-
- @param Buffer A pointer to the buffer of data..
-
+ @param Buffer A pointer to the buffer of data.
@retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
- time.
+ @retval EFI_INVALID_PARAMETER The invalid access width.
**/
EFI_STATUS
@@ -350,32 +188,22 @@ PciCfg2Write (
/**
- PCI read-modify-write operation.
+ This function performs a read-modify-write operation on the contents from a given
+ location in the PCI configuration space.
@param PeiServices An indirect pointer to the PEI Services Table
published by the PEI Foundation.
-
@param This Pointer to local data for the interface.
-
@param Width The width of the access. Enumerated in bytes. Type
EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
-
@param Address The physical address of the access.
-
@param SetBits Points to value to bitwise-OR with the read configuration value.
-
The size of the value is determined by Width.
-
@param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
The size of the value is determined by Width.
-
@retval EFI_SUCCESS The function completed successfully.
-
- @retval EFI_DEVICE_ERROR There was a problem with the transaction.
-
- @retval EFI_DEVICE_NOT_READY The device is not capable of supporting
- the operation at this time.
+ @retval EFI_INVALID_PARAMETER The invalid access width.
**/
EFI_STATUS
@@ -445,9 +273,23 @@ PciCfg2Modify (
} else {
return EFI_INVALID_PARAMETER;
}
+
return EFI_SUCCESS;
}
+EFI_PEI_PCI_CFG2_PPI gPciCfg2Ppi = {
+ PciCfg2Read,
+ PciCfg2Write,
+ PciCfg2Modify,
+ 0
+};
+
+EFI_PEI_PPI_DESCRIPTOR gPciCfg2PpiList = {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiPciCfg2PpiGuid,
+ &gPciCfg2Ppi
+};
+
/**
Module's entry function.
This routine will install EFI_PEI_PCI_CFG2_PPI.
@@ -466,10 +308,10 @@ PeimInitializePciCfg (
{
EFI_STATUS Status;
- ASSERT ((**PeiServices).Hdr.Revision >= PEI_SERVICES_REVISION);
+ ASSERT ((**PeiServices).Hdr.Revision >= PI_SPECIFICATION_VERSION);
(**(EFI_PEI_SERVICES **)PeiServices).PciCfg = &gPciCfg2Ppi;
- Status = (**PeiServices).InstallPpi ((CONST EFI_PEI_SERVICES **)PeiServices, &gPciCfg2PpiList);
+ Status = (**PeiServices).InstallPpi (PeiServices, &gPciCfg2PpiList);
return Status;
}