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