/src/hbfa-fl/HBFA/UefiHostTestPkg/Library/PeiServicesTablePointerLibHost/PciCfg2.c
Line | Count | Source (jump to first uncovered line) |
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 - 2018, Intel Corporation. All rights reserved.<BR> |
10 | | SPDX-License-Identifier: BSD-2-Clause-Patent |
11 | | |
12 | | **/ |
13 | | |
14 | | #include <PiPei.h> |
15 | | |
16 | | /** |
17 | | Reads from a given location in the PCI configuration space. |
18 | | |
19 | | If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then |
20 | | return EFI_NOT_YET_AVAILABLE. |
21 | | |
22 | | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation. |
23 | | @param This Pointer to local data for the interface. |
24 | | @param Width The width of the access. Enumerated in bytes. |
25 | | See EFI_PEI_PCI_CFG_PPI_WIDTH above. |
26 | | @param Address The physical address of the access. The format of |
27 | | the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS. |
28 | | @param Buffer A pointer to the buffer of data. |
29 | | |
30 | | @retval EFI_SUCCESS The function completed successfully. |
31 | | @retval EFI_INVALID_PARAMETER The invalid access width. |
32 | | @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM. |
33 | | |
34 | | **/ |
35 | | EFI_STATUS |
36 | | EFIAPI |
37 | | PeiDefaultPciCfg2Read ( |
38 | | IN CONST EFI_PEI_SERVICES **PeiServices, |
39 | | IN CONST EFI_PEI_PCI_CFG2_PPI *This, |
40 | | IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, |
41 | | IN UINT64 Address, |
42 | | IN OUT VOID *Buffer |
43 | | ) |
44 | 0 | { |
45 | 0 | return EFI_NOT_AVAILABLE_YET; |
46 | 0 | } |
47 | | |
48 | | /** |
49 | | Write to a given location in the PCI configuration space. |
50 | | |
51 | | If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then |
52 | | return EFI_NOT_YET_AVAILABLE. |
53 | | |
54 | | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation. |
55 | | @param This Pointer to local data for the interface. |
56 | | @param Width The width of the access. Enumerated in bytes. |
57 | | See EFI_PEI_PCI_CFG_PPI_WIDTH above. |
58 | | @param Address The physical address of the access. The format of |
59 | | the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS. |
60 | | @param Buffer A pointer to the buffer of data. |
61 | | |
62 | | @retval EFI_SUCCESS The function completed successfully. |
63 | | @retval EFI_INVALID_PARAMETER The invalid access width. |
64 | | @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM. |
65 | | **/ |
66 | | EFI_STATUS |
67 | | EFIAPI |
68 | | PeiDefaultPciCfg2Write ( |
69 | | IN CONST EFI_PEI_SERVICES **PeiServices, |
70 | | IN CONST EFI_PEI_PCI_CFG2_PPI *This, |
71 | | IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, |
72 | | IN UINT64 Address, |
73 | | IN OUT VOID *Buffer |
74 | | ) |
75 | 0 | { |
76 | 0 | return EFI_NOT_AVAILABLE_YET; |
77 | 0 | } |
78 | | |
79 | | /** |
80 | | This function performs a read-modify-write operation on the contents from a given |
81 | | location in the PCI configuration space. |
82 | | If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then |
83 | | return EFI_NOT_YET_AVAILABLE. |
84 | | |
85 | | @param PeiServices An indirect pointer to the PEI Services Table |
86 | | published by the PEI Foundation. |
87 | | @param This Pointer to local data for the interface. |
88 | | @param Width The width of the access. Enumerated in bytes. Type |
89 | | EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read(). |
90 | | @param Address The physical address of the access. |
91 | | @param SetBits Points to value to bitwise-OR with the read configuration value. |
92 | | The size of the value is determined by Width. |
93 | | @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value. |
94 | | The size of the value is determined by Width. |
95 | | |
96 | | @retval EFI_SUCCESS The function completed successfully. |
97 | | @retval EFI_INVALID_PARAMETER The invalid access width. |
98 | | @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM. |
99 | | **/ |
100 | | EFI_STATUS |
101 | | EFIAPI |
102 | | PeiDefaultPciCfg2Modify ( |
103 | | IN CONST EFI_PEI_SERVICES **PeiServices, |
104 | | IN CONST EFI_PEI_PCI_CFG2_PPI *This, |
105 | | IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, |
106 | | IN UINT64 Address, |
107 | | IN VOID *SetBits, |
108 | | IN VOID *ClearBits |
109 | | ) |
110 | 0 | { |
111 | 0 | return EFI_NOT_AVAILABLE_YET; |
112 | 0 | } |
113 | | |
114 | | /// |
115 | | /// This default instance of EFI_PEI_PCI_CFG2_PPI install assigned to EFI_PEI_SERVICE.PciCfg |
116 | | /// when PeiCore's initialization. |
117 | | /// |
118 | | EFI_PEI_PCI_CFG2_PPI mPeiDefaultPciCfg2Ppi = { |
119 | | PeiDefaultPciCfg2Read, |
120 | | PeiDefaultPciCfg2Write, |
121 | | PeiDefaultPciCfg2Modify |
122 | | }; |