1 /** @file
2   The default version of EFI_PEI_PCI_CFG2_PPI support published by PeiServices in
3   PeiCore initialization phase.
4 
5   EFI_PEI_PCI_CFG2_PPI is installed by the PEIM which supports a PCI root bridge.
6   When PeiCore is started, the default version of EFI_PEI_PCI_CFG2_PPI will be assigned
7   to PeiServices table.
8 
9 Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
10 This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution.  The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
14 
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 
18 **/
19 
20 #include "PeiMain.h"
21 
22 ///
23 /// This default instance of EFI_PEI_PCI_CFG2_PPI install assigned to EFI_PEI_SERVICE.PciCfg
24 /// when PeiCore's initialization.
25 ///
26 EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi = {
27   PeiDefaultPciCfg2Read,
28   PeiDefaultPciCfg2Write,
29   PeiDefaultPciCfg2Modify
30 };
31 
32 /**
33   Reads from a given location in the PCI configuration space.
34 
35   If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
36   return EFI_NOT_YET_AVAILABLE.
37 
38   @param  PeiServices     An indirect pointer to the PEI Services Table published by the PEI Foundation.
39   @param  This            Pointer to local data for the interface.
40   @param  Width           The width of the access. Enumerated in bytes.
41                           See EFI_PEI_PCI_CFG_PPI_WIDTH above.
42   @param  Address         The physical address of the access. The format of
43                           the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
44   @param  Buffer          A pointer to the buffer of data.
45 
46   @retval EFI_SUCCESS           The function completed successfully.
47   @retval EFI_INVALID_PARAMETER The invalid access width.
48   @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
49 
50 **/
51 EFI_STATUS
52 EFIAPI
PeiDefaultPciCfg2Read(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)53 PeiDefaultPciCfg2Read (
54   IN CONST  EFI_PEI_SERVICES          **PeiServices,
55   IN CONST  EFI_PEI_PCI_CFG2_PPI      *This,
56   IN        EFI_PEI_PCI_CFG_PPI_WIDTH Width,
57   IN        UINT64                    Address,
58   IN OUT    VOID                      *Buffer
59   )
60 {
61   return EFI_NOT_AVAILABLE_YET;
62 }
63 
64 /**
65   Write to a given location in the PCI configuration space.
66 
67   If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
68   return EFI_NOT_YET_AVAILABLE.
69 
70   @param  PeiServices     An indirect pointer to the PEI Services Table published by the PEI Foundation.
71   @param  This            Pointer to local data for the interface.
72   @param  Width           The width of the access. Enumerated in bytes.
73                           See EFI_PEI_PCI_CFG_PPI_WIDTH above.
74   @param  Address         The physical address of the access. The format of
75                           the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
76   @param  Buffer          A pointer to the buffer of data.
77 
78   @retval EFI_SUCCESS           The function completed successfully.
79   @retval EFI_INVALID_PARAMETER The invalid access width.
80   @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
81 **/
82 EFI_STATUS
83 EFIAPI
PeiDefaultPciCfg2Write(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)84 PeiDefaultPciCfg2Write (
85   IN CONST  EFI_PEI_SERVICES          **PeiServices,
86   IN CONST  EFI_PEI_PCI_CFG2_PPI      *This,
87   IN        EFI_PEI_PCI_CFG_PPI_WIDTH Width,
88   IN        UINT64                    Address,
89   IN OUT    VOID                      *Buffer
90   )
91 {
92   return EFI_NOT_AVAILABLE_YET;
93 }
94 
95 /**
96   This function performs a read-modify-write operation on the contents from a given
97   location in the PCI configuration space.
98   If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
99   return EFI_NOT_YET_AVAILABLE.
100 
101   @param  PeiServices     An indirect pointer to the PEI Services Table
102                           published by the PEI Foundation.
103   @param  This            Pointer to local data for the interface.
104   @param  Width           The width of the access. Enumerated in bytes. Type
105                           EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
106   @param  Address         The physical address of the access.
107   @param  SetBits         Points to value to bitwise-OR with the read configuration value.
108                           The size of the value is determined by Width.
109   @param  ClearBits       Points to the value to negate and bitwise-AND with the read configuration value.
110                           The size of the value is determined by Width.
111 
112   @retval EFI_SUCCESS           The function completed successfully.
113   @retval EFI_INVALID_PARAMETER The invalid access width.
114   @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
115 **/
116 EFI_STATUS
117 EFIAPI
PeiDefaultPciCfg2Modify(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)118 PeiDefaultPciCfg2Modify (
119   IN CONST  EFI_PEI_SERVICES          **PeiServices,
120   IN CONST  EFI_PEI_PCI_CFG2_PPI      *This,
121   IN        EFI_PEI_PCI_CFG_PPI_WIDTH Width,
122   IN        UINT64                    Address,
123   IN        VOID                      *SetBits,
124   IN        VOID                      *ClearBits
125   )
126 {
127   return EFI_NOT_AVAILABLE_YET;
128 }
129