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