]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Compatiblity/PciCfgToPciCfg2Thunk/PciCfgToPciCfg2Thunk.c
Both FrameworkHii and UefiHii declare some macros and structure with the same name...
[mirror_edk2.git] / EdkCompatibilityPkg / Compatiblity / PciCfgToPciCfg2Thunk / PciCfgToPciCfg2Thunk.c
CommitLineData
a69a84d3 1/*++\r
2\r
3Copyright (c) 2006 - 2008 Intel Corporation. <BR>\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11Module Name:\r
12\r
13 Variable.c\r
14\r
15Abstract:\r
16\r
17 PEIM to provide the Variable functionality\r
18\r
19--*/\r
20\r
21#include <PiPei.h>\r
22#include <Ppi/PciCfg.h>\r
23#include <Ppi/PciCfg2.h>\r
24#include <Library/DebugLib.h>\r
25\r
26//\r
27// Function Prototypes\r
28//\r
29EFI_STATUS\r
30EFIAPI\r
31PciCfgRead (\r
32 IN EFI_PEI_SERVICES **PeiServices,\r
33 IN EFI_PEI_PCI_CFG_PPI *This,\r
34 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
35 IN UINT64 Address,\r
36 IN OUT VOID *Buffer\r
37 );\r
38\r
39EFI_STATUS\r
40EFIAPI\r
41PciCfgWrite (\r
42 IN EFI_PEI_SERVICES **PeiServices,\r
43 IN EFI_PEI_PCI_CFG_PPI *This,\r
44 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
45 IN UINT64 Address,\r
46 IN OUT VOID *Buffer\r
47 );\r
48\r
49EFI_STATUS\r
50EFIAPI\r
51PciCfgModify (\r
52 IN EFI_PEI_SERVICES **PeiServices,\r
53 IN EFI_PEI_PCI_CFG_PPI *This,\r
54 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
55 IN UINT64 Address,\r
56 IN UINTN SetBits,\r
57 IN UINTN ClearBits\r
58 );\r
59\r
60//\r
61// Module globals\r
62//\r
63EFI_PEI_PCI_CFG_PPI mPciCfgPpi = {\r
64 PciCfgRead,\r
65 PciCfgWrite,\r
66 PciCfgModify,\r
67};\r
68\r
69EFI_PEI_PPI_DESCRIPTOR mPpiListPciCfg = {\r
70 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
71 &gEfiPciCfgPpiInServiceTableGuid,\r
72 &mPciCfgPpi\r
73};\r
74\r
75EFI_STATUS\r
76EFIAPI\r
77PeimInitializePciCfg (\r
78 IN EFI_FFS_FILE_HEADER *FfsHeader,\r
79 IN CONST EFI_PEI_SERVICES **PeiServices\r
80 )\r
81/*++\r
82\r
83Routine Description:\r
84\r
85 Provide the functionality of the variable services.\r
86\r
87Arguments:\r
88\r
89 FfsHeadher - The FFS file header\r
90 PeiServices - General purpose services available to every PEIM.\r
91\r
92Returns:\r
93\r
94 Status - EFI_SUCCESS if the interface could be successfully\r
95 installed\r
96\r
97--*/\r
98{\r
99 //\r
100 // Publish the variable capability to other modules\r
101 //\r
102 return (*PeiServices)->InstallPpi (PeiServices, &mPpiListPciCfg);\r
103}\r
104\r
105EFI_STATUS\r
106EFIAPI\r
107PciCfgRead (\r
108 IN EFI_PEI_SERVICES **PeiServices,\r
109 IN EFI_PEI_PCI_CFG_PPI *This,\r
110 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
111 IN UINT64 Address,\r
112 IN OUT VOID *Buffer\r
113 )\r
114{\r
115 EFI_PEI_PCI_CFG2_PPI *PciCfg2;\r
116\r
117 PciCfg2 = (*PeiServices)->PciCfg;\r
118\r
119 return PciCfg2->Read ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, Buffer);\r
120}\r
121\r
122EFI_STATUS\r
123EFIAPI\r
124PciCfgWrite (\r
125 IN EFI_PEI_SERVICES **PeiServices,\r
126 IN EFI_PEI_PCI_CFG_PPI *This,\r
127 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
128 IN UINT64 Address,\r
129 IN OUT VOID *Buffer\r
130 )\r
131{\r
132 EFI_PEI_PCI_CFG2_PPI *PciCfg2;\r
133\r
134 PciCfg2 = (*PeiServices)->PciCfg;\r
135\r
136 return PciCfg2->Write ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, Buffer);\r
137}\r
138\r
139EFI_STATUS\r
140EFIAPI\r
141PciCfgModify (\r
142 IN EFI_PEI_SERVICES **PeiServices,\r
143 IN EFI_PEI_PCI_CFG_PPI *This,\r
144 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
145 IN UINT64 Address,\r
146 IN UINTN SetBits,\r
147 IN UINTN ClearBits\r
148 )\r
149{\r
150 EFI_PEI_PCI_CFG2_PPI *PciCfg2;\r
151\r
152 PciCfg2 = (*PeiServices)->PciCfg;\r
153\r
154 return PciCfg2->Modify ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, &SetBits, &ClearBits);\r
155}\r