]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.h
Dispatch the UEFI option rom returned from PciPlatform/PciOverride protocol.
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciBusDxe / PciHotPlugSupport.h
1 /** @file
2 PCI Hot Plug support functions declaration for PCI Bus module.
3
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _EFI_PCI_HOT_PLUG_SUPPORT_H_
16 #define _EFI_PCI_HOT_PLUG_SUPPORT_H_
17
18 //
19 // stall 1 second, its unit is 100ns
20 //
21 #define STALL_1_SECOND 1000000
22
23 //
24 // PCI Hot Plug controller private data
25 //
26 typedef struct {
27 EFI_EVENT Event;
28 BOOLEAN Found;
29 BOOLEAN Initialized;
30 VOID *Padding;
31 } ROOT_HPC_DATA;
32
33 //
34 // Reference of some global variabes
35 //
36 extern EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
37 extern EFI_HPC_LOCATION *gPciRootHpcPool;
38 extern ROOT_HPC_DATA *gPciRootHpcData;
39
40 /**
41 Event notification function to set Hot Plug controller status.
42
43 @param Event The event that invoke this function.
44 @param Context The calling context, pointer to ROOT_HPC_DATA.
45
46 **/
47 VOID
48 EFIAPI
49 PciHPCInitialized (
50 IN EFI_EVENT Event,
51 IN VOID *Context
52 );
53
54 /**
55 Compare two device pathes to check if they are exactly same.
56
57 @param DevicePath1 A pointer to the first device path data structure.
58 @param DevicePath2 A pointer to the second device path data structure.
59
60 @retval TRUE They are same.
61 @retval FALSE They are not same.
62
63 **/
64 BOOLEAN
65 EfiCompareDevicePath (
66 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
67 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
68 );
69
70 /**
71 Check hot plug support and initialize root hot plug private data.
72
73 If Hot Plug is supported by the platform, call PCI Hot Plug Init protocol
74 to get PCI Hot Plug controller's information and constructor the root hot plug
75 private data structure.
76
77 @retval EFI_SUCCESS They are same.
78 @retval EFI_UNSUPPORTED No PCI Hot Plug controler on the platform.
79 @retval EFI_OUT_OF_RESOURCES No memory to constructor root hot plug private
80 data structure.
81
82 **/
83 EFI_STATUS
84 InitializeHotPlugSupport (
85 VOID
86 );
87
88 /**
89 Test whether PCI device is hot plug bus.
90
91 @param PciIoDevice PCI device instance.
92
93 @retval TRUE PCI device is a hot plug bus.
94 @retval FALSE PCI device is not a hot plug bus.
95
96 **/
97 BOOLEAN
98 IsPciHotPlugBus (
99 PCI_IO_DEVICE *PciIoDevice
100 );
101
102 /**
103 Test whether device path is for root pci hot plug bus.
104
105 @param HpbDevicePath A pointer to device path data structure to be tested.
106 @param HpIndex If HpIndex is not NULL, return the index of root hot
107 plug in global array when TRUE is retuned.
108
109 @retval TRUE The device path is for root pci hot plug bus.
110 @retval FALSE The device path is not for root pci hot plug bus.
111
112 **/
113 BOOLEAN
114 IsRootPciHotPlugBus (
115 IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
116 OUT UINTN *HpIndex OPTIONAL
117 );
118
119 /**
120 Test whether device path is for root pci hot plug controller.
121
122 @param HpcDevicePath A pointer to device path data structure to be tested.
123 @param HpIndex If HpIndex is not NULL, return the index of root hot
124 plug in global array when TRUE is retuned.
125
126 @retval TRUE The device path is for root pci hot plug controller.
127 @retval FALSE The device path is not for root pci hot plug controller.
128
129 **/
130 BOOLEAN
131 IsRootPciHotPlugController (
132 IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
133 OUT UINTN *HpIndex
134 );
135
136 /**
137 Creating event object for PCI Hot Plug controller.
138
139 @param HpIndex Index of hot plug device in global array.
140 @param Event The retuned event that invoke this function.
141
142 @return Status of create event invoken.
143
144 **/
145 EFI_STATUS
146 CreateEventForHpc (
147 IN UINTN HpIndex,
148 OUT EFI_EVENT *Event
149 );
150
151 /**
152 Wait for all root PCI Hot Plug controller finished initializing.
153
154 @param TimeoutInMicroSeconds Microseconds to wait for all root HPCs' initialization.
155
156 @retval EFI_SUCCESS All HPCs initialization finished.
157 @retval EFI_TIMEOUT Not ALL HPCs initialization finished in Microseconds.
158
159 **/
160 EFI_STATUS
161 AllRootHPCInitialized (
162 IN UINTN TimeoutInMicroSeconds
163 );
164
165 /**
166 Check whether PCI-PCI bridge has PCI Hot Plug capability register block.
167
168 @param PciIoDevice A Pointer to the PCI-PCI bridge.
169
170 @retval TRUE PCI device is HPC.
171 @retval FALSE PCI device is not HPC.
172
173 **/
174 BOOLEAN
175 IsSHPC (
176 IN PCI_IO_DEVICE *PciIoDevice
177 );
178
179 /**
180 Get resource padding if the specified PCI bridge is a hot plug bus.
181
182 @param PciIoDevice PCI bridge instance.
183
184 **/
185 VOID
186 GetResourcePaddingForHpb (
187 IN PCI_IO_DEVICE *PciIoDevice
188 );
189
190 #endif