]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.h
remove some comments introduced by tools.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / pcibus.h
CommitLineData
ead42efc 1/*++\r
2\r
3Copyright (c) 2006 - 2007, Intel Corporation\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
11\r
12Module Name:\r
13\r
14 pcibus.h\r
15\r
16Abstract:\r
17\r
18 PCI Bus Driver\r
19\r
20Revision History\r
21\r
22--*/\r
23\r
24#ifndef _EFI_PCI_BUS_H\r
25#define _EFI_PCI_BUS_H\r
26\r
ed7748fe 27\r
694b922c 28#include <FrameworkDxe.h>\r
29\r
ed7748fe 30\r
ead42efc 31#include <Protocol/LoadedImage.h>\r
32#include <Protocol/PciHostBridgeResourceAllocation.h>\r
33#include <Protocol/PciIo.h>\r
34#include <Guid/PciHotplugDevice.h>\r
35#include <Protocol/PciRootBridgeIo.h>\r
36#include <Protocol/PciHotPlugRequest.h>\r
37#include <Protocol/DevicePath.h>\r
38#include <Protocol/PciPlatform.h>\r
39#include <Protocol/PciHotPlugInit.h>\r
40#include <Protocol/Decompress.h>\r
41#include <Guid/PciOptionRomTable.h>\r
42#include <Protocol/BusSpecificDriverOverride.h>\r
43#include <Protocol/UgaIo.h>\r
ed7748fe 44\r
ead42efc 45#include <Library/DebugLib.h>\r
46#include <Library/UefiDriverEntryPoint.h>\r
47#include <Library/BaseLib.h>\r
48#include <Library/UefiLib.h>\r
49#include <Library/BaseMemoryLib.h>\r
50#include <Library/ReportStatusCodeLib.h>\r
51#include <Library/MemoryAllocationLib.h>\r
52#include <Library/UefiBootServicesTableLib.h>\r
53#include <Library/DevicePathLib.h>\r
54#include <Library/PcdLib.h>\r
55#include <Library/PciIncompatibleDeviceSupportLib.h>\r
56\r
b1ef4015 57#include <IndustryStandard/Pci23.h>\r
58#include <IndustryStandard/PeImage.h>\r
ead42efc 59#include <IndustryStandard/Acpi.h>\r
60#include "ComponentName.h"\r
61\r
62//\r
63// Driver Produced Protocol Prototypes\r
64//\r
65\r
66#define VGABASE1 0x3B0\r
67#define VGALIMIT1 0x3BB\r
68\r
69#define VGABASE2 0x3C0\r
70#define VGALIMIT2 0x3DF\r
71\r
72#define ISABASE 0x100\r
73#define ISALIMIT 0x3FF\r
74\r
75typedef enum {\r
76 PciBarTypeUnknown = 0,\r
77 PciBarTypeIo16,\r
78 PciBarTypeIo32,\r
79 PciBarTypeMem32,\r
80 PciBarTypePMem32,\r
81 PciBarTypeMem64,\r
82 PciBarTypePMem64,\r
83 PciBarTypeIo,\r
84 PciBarTypeMem,\r
85 PciBarTypeMaxType\r
86} PCI_BAR_TYPE;\r
87\r
88typedef struct {\r
89 UINT64 BaseAddress;\r
90 UINT64 Length;\r
91 UINT64 Alignment;\r
92 PCI_BAR_TYPE BarType;\r
93 BOOLEAN Prefetchable;\r
94 UINT8 MemType;\r
95 UINT8 Offset;\r
96} PCI_BAR;\r
97\r
98#define PPB_BAR_0 0\r
99#define PPB_BAR_1 1\r
100#define PPB_IO_RANGE 2\r
101#define PPB_MEM32_RANGE 3\r
102#define PPB_PMEM32_RANGE 4\r
103#define PPB_PMEM64_RANGE 5\r
104#define PPB_MEM64_RANGE 0xFF\r
105\r
106#define P2C_BAR_0 0\r
107#define P2C_MEM_1 1\r
108#define P2C_MEM_2 2\r
109#define P2C_IO_1 3\r
110#define P2C_IO_2 4\r
111\r
112#define PCI_IO_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('p', 'c', 'i', 'o')\r
113\r
114#define EFI_BRIDGE_IO32_DECODE_SUPPORTED 0x0001\r
115#define EFI_BRIDGE_PMEM32_DECODE_SUPPORTED 0x0002\r
116#define EFI_BRIDGE_PMEM64_DECODE_SUPPORTED 0x0004\r
117#define EFI_BRIDGE_IO16_DECODE_SUPPORTED 0x0008\r
118#define EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED 0x0010\r
119#define EFI_BRIDGE_MEM64_DECODE_SUPPORTED 0x0020\r
120#define EFI_BRIDGE_MEM32_DECODE_SUPPORTED 0x0040\r
121\r
122#define PCI_MAX_HOST_BRIDGE_NUM 0x0010\r
123//\r
124// Define resource status constant\r
125//\r
126#define EFI_RESOURCE_NONEXISTENT 0xFFFFFFFFFFFFFFFFULL\r
127#define EFI_RESOURCE_LESS 0xFFFFFFFFFFFFFFFEULL\r
128#define EFI_RESOURCE_SATISFIED 0x0000000000000000ULL\r
129\r
130//\r
131// Define option for attribute\r
132//\r
133#define EFI_SET_SUPPORTS 0\r
134#define EFI_SET_ATTRIBUTES 1\r
135\r
136typedef struct _PCI_IO_DEVICE {\r
137 UINT32 Signature;\r
138 EFI_HANDLE Handle;\r
139 EFI_PCI_IO_PROTOCOL PciIo;\r
140 LIST_ENTRY Link;\r
141\r
142 EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL PciDriverOverride;\r
143 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
144 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;\r
145\r
146 //\r
147 // PCI configuration space header type\r
148 //\r
149 PCI_TYPE00 Pci;\r
150\r
151 //\r
152 // Bus number, Device number, Function number\r
153 //\r
154 UINT8 BusNumber;\r
155 UINT8 DeviceNumber;\r
156 UINT8 FunctionNumber;\r
157\r
158 //\r
159 // BAR for this PCI Device\r
160 //\r
161 PCI_BAR PciBar[PCI_MAX_BAR];\r
162\r
163 //\r
164 // The bridge device this pci device is subject to\r
165 //\r
166 struct _PCI_IO_DEVICE *Parent;\r
167\r
168 //\r
169 // A linked list for children Pci Device if it is bridge device\r
170 //\r
171 LIST_ENTRY ChildList;\r
172\r
173 //\r
174 // TURE if the PCI bus driver creates the handle for this PCI device\r
175 //\r
176 BOOLEAN Registered;\r
177\r
178 //\r
179 // TRUE if the PCI bus driver successfully allocates the resource required by\r
180 // this PCI device\r
181 //\r
182 BOOLEAN Allocated;\r
183\r
184 //\r
185 // The attribute this PCI device currently set\r
186 //\r
187 UINT64 Attributes;\r
188\r
189 //\r
190 // The attributes this PCI device actually supports\r
191 //\r
192 UINT64 Supports;\r
193\r
194 //\r
195 // The resource decode the bridge supports\r
196 //\r
197 UINT32 Decodes;\r
198\r
199 //\r
200 // The OptionRom Size\r
201 //\r
202 UINT64 RomSize;\r
203\r
204 //\r
205 // The OptionRom Size\r
206 //\r
207 UINT64 RomBase;\r
208\r
209 //\r
210 // TRUE if all OpROM (in device or in platform specific position) have been processed\r
211 //\r
212 BOOLEAN AllOpRomProcessed;\r
213\r
214 //\r
215 // TRUE if there is any EFI driver in the OptionRom\r
216 //\r
217 BOOLEAN BusOverride;\r
218\r
219 //\r
220 // A list tracking reserved resource on a bridge device\r
221 //\r
222 LIST_ENTRY ReservedResourceList;\r
223\r
224 //\r
225 // A list tracking image handle of platform specific overriding driver\r
226 //\r
227 LIST_ENTRY OptionRomDriverList;\r
228\r
229 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *ResourcePaddingDescriptors;\r
230 EFI_HPC_PADDING_ATTRIBUTES PaddingAttributes;\r
231\r
232 BOOLEAN IsPciExp;\r
233\r
234} PCI_IO_DEVICE;\r
235\r
236\r
237#define PCI_IO_DEVICE_FROM_PCI_IO_THIS(a) \\r
238 CR (a, PCI_IO_DEVICE, PciIo, PCI_IO_DEVICE_SIGNATURE)\r
239\r
240#define PCI_IO_DEVICE_FROM_PCI_DRIVER_OVERRIDE_THIS(a) \\r
241 CR (a, PCI_IO_DEVICE, PciDriverOverride, PCI_IO_DEVICE_SIGNATURE)\r
242\r
243#define PCI_IO_DEVICE_FROM_LINK(a) \\r
244 CR (a, PCI_IO_DEVICE, Link, PCI_IO_DEVICE_SIGNATURE)\r
245\r
246//\r
247// Global Variables\r
248//\r
249extern EFI_DRIVER_BINDING_PROTOCOL gPciBusDriverBinding;\r
250extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName;\r
251extern LIST_ENTRY gPciDevicePool;\r
252extern BOOLEAN gFullEnumeration;\r
253extern UINTN gPciHostBridgeNumber;\r
254extern EFI_HANDLE gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];\r
255extern UINT64 gAllOne;\r
256extern UINT64 gAllZero;\r
257\r
258extern EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol;\r
259\r
260#include "PciIo.h"\r
261#include "PciCommand.h"\r
262#include "PciDeviceSupport.h"\r
263#include "PciEnumerator.h"\r
264#include "PciEnumeratorSupport.h"\r
265#include "PciDriverOverride.h"\r
266#include "PciRomTable.h"\r
267#include "PciOptionRomSupport.h"\r
268#include "PciPowerManagement.h"\r
269#include "PciHotPlugSupport.h"\r
270#include "PciLib.h"\r
271\r
272//\r
273// PCI Bus Support Function Prototypes\r
274//\r
275EFI_STATUS\r
276EFIAPI\r
277PciBusDriverBindingSupported (\r
278 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
279 IN EFI_HANDLE Controller,\r
280 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
281 );\r
282\r
283EFI_STATUS\r
284EFIAPI\r
285PciBusDriverBindingStart (\r
286 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
287 IN EFI_HANDLE Controller,\r
288 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
289 );\r
290\r
291EFI_STATUS\r
292EFIAPI\r
293PciBusDriverBindingStop (\r
294 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
295 IN EFI_HANDLE Controller,\r
296 IN UINTN NumberOfChildren,\r
297 IN EFI_HANDLE *ChildHandleBuffer\r
298 );\r
299\r
300#endif\r