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