]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | **/\r | |
13 | \r | |
14 | #ifndef _EFI_PCI_DEVICE_SUPPORT_H_\r | |
15 | #define _EFI_PCI_DEVICE_SUPPORT_H_\r | |
16 | \r | |
17 | /**\r | |
18 | Initialize the gPciDevicePool.\r | |
19 | **/\r | |
20 | EFI_STATUS\r | |
21 | InitializePciDevicePool (\r | |
22 | VOID\r | |
23 | );\r | |
24 | \r | |
25 | /**\r | |
26 | Insert a root bridge into PCI device pool\r | |
27 | \r | |
28 | @param RootBridge - A pointer to the PCI_IO_DEVICE.\r | |
29 | \r | |
30 | **/\r | |
31 | EFI_STATUS\r | |
32 | InsertRootBridge (\r | |
33 | PCI_IO_DEVICE *RootBridge\r | |
34 | );\r | |
35 | \r | |
36 | /**\r | |
37 | This function is used to insert a PCI device node under\r | |
38 | a bridge\r | |
39 | \r | |
40 | @param Bridge A pointer to the PCI_IO_DEVICE.\r | |
41 | @param PciDeviceNode A pointer to the PCI_IO_DEVICE.\r | |
42 | \r | |
43 | **/\r | |
44 | EFI_STATUS\r | |
45 | InsertPciDevice (\r | |
46 | PCI_IO_DEVICE *Bridge,\r | |
47 | PCI_IO_DEVICE *PciDeviceNode\r | |
48 | );\r | |
49 | \r | |
50 | /**\r | |
51 | Destroy root bridge and remove it from deivce tree.\r | |
52 | \r | |
53 | @param RootBridge The bridge want to be removed\r | |
54 | \r | |
55 | **/\r | |
56 | EFI_STATUS\r | |
57 | DestroyRootBridge (\r | |
58 | IN PCI_IO_DEVICE *RootBridge\r | |
59 | );\r | |
60 | \r | |
61 | /**\r | |
62 | Destroy all the pci device node under the bridge.\r | |
63 | Bridge itself is not included.\r | |
64 | \r | |
65 | @param Bridge A pointer to the PCI_IO_DEVICE.\r | |
66 | \r | |
67 | **/\r | |
68 | EFI_STATUS\r | |
69 | DestroyPciDeviceTree (\r | |
70 | IN PCI_IO_DEVICE *Bridge\r | |
71 | );\r | |
72 | \r | |
73 | /**\r | |
74 | Destroy all device nodes under the root bridge\r | |
75 | specified by Controller.\r | |
76 | The root bridge itself is also included.\r | |
77 | \r | |
78 | @param Controller An efi handle.\r | |
79 | \r | |
80 | **/\r | |
81 | EFI_STATUS\r | |
82 | DestroyRootBridgeByHandle (\r | |
83 | EFI_HANDLE Controller\r | |
84 | );\r | |
85 | \r | |
86 | /**\r | |
87 | This function registers the PCI IO device. It creates a handle for this PCI IO device\r | |
88 | (if the handle does not exist), attaches appropriate protocols onto the handle, does\r | |
89 | necessary initialization, and sets up parent/child relationship with its bus controller.\r | |
90 | \r | |
91 | @param Controller - An EFI handle for the PCI bus controller.\r | |
92 | @param PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.\r | |
93 | @param Handle - A pointer to hold the EFI handle for the PCI IO device.\r | |
94 | \r | |
95 | @retval EFI_SUCCESS - The PCI device is successfully registered.\r | |
96 | @retval Others - An error occurred when registering the PCI device.\r | |
97 | \r | |
98 | **/\r | |
99 | EFI_STATUS\r | |
100 | RegisterPciDevice (\r | |
101 | IN EFI_HANDLE Controller,\r | |
102 | IN PCI_IO_DEVICE *PciIoDevice,\r | |
103 | OUT EFI_HANDLE *Handle OPTIONAL\r | |
104 | );\r | |
105 | \r | |
106 | /**\r | |
107 | This function is used to remove the whole PCI devices from the bridge.\r | |
108 | \r | |
109 | @param RootBridgeHandle An efi handle.\r | |
110 | @param Bridge A pointer to the PCI_IO_DEVICE.\r | |
111 | \r | |
112 | @retval EFI_SUCCESS\r | |
113 | **/\r | |
114 | EFI_STATUS\r | |
115 | RemoveAllPciDeviceOnBridge (\r | |
116 | EFI_HANDLE RootBridgeHandle,\r | |
117 | PCI_IO_DEVICE *Bridge\r | |
118 | );\r | |
119 | \r | |
120 | /**\r | |
121 | \r | |
122 | This function is used to de-register the PCI device from the EFI,\r | |
123 | That includes un-installing PciIo protocol from the specified PCI\r | |
124 | device handle.\r | |
125 | \r | |
126 | @param Controller - controller handle\r | |
127 | @param Handle - device handle\r | |
128 | \r | |
129 | @return Status of de-register pci device\r | |
130 | **/\r | |
131 | EFI_STATUS\r | |
132 | DeRegisterPciDevice (\r | |
133 | IN EFI_HANDLE Controller,\r | |
134 | IN EFI_HANDLE Handle\r | |
135 | );\r | |
136 | \r | |
137 | /**\r | |
138 | Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge\r | |
139 | \r | |
140 | @param Controller An efi handle.\r | |
141 | @param RootBridge A pointer to the PCI_IO_DEVICE.\r | |
142 | @param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.\r | |
143 | @param NumberOfChildren Children number.\r | |
144 | @param ChildHandleBuffer A pointer to the child handle buffer.\r | |
145 | \r | |
146 | @retval EFI_NOT_READY Device is not allocated\r | |
147 | @retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.\r | |
148 | @retval EFI_NOT_FOUND Can not find the specific device\r | |
149 | @retval EFI_SUCCESS Success to start Pci device on bridge\r | |
150 | \r | |
151 | **/\r | |
152 | EFI_STATUS\r | |
153 | StartPciDevicesOnBridge (\r | |
154 | IN EFI_HANDLE Controller,\r | |
155 | IN PCI_IO_DEVICE *RootBridge,\r | |
156 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,\r | |
157 | IN OUT UINT8 *NumberOfChildren,\r | |
158 | IN OUT EFI_HANDLE *ChildHandleBuffer\r | |
159 | );\r | |
160 | \r | |
161 | /**\r | |
162 | Start to manage all the PCI devices it found previously under \r | |
163 | the entire host bridge.\r | |
164 | \r | |
165 | @param Controller - root bridge handle.\r | |
166 | \r | |
167 | **/\r | |
168 | EFI_STATUS\r | |
169 | StartPciDevices (\r | |
170 | IN EFI_HANDLE Controller\r | |
171 | );\r | |
172 | \r | |
173 | /**\r | |
174 | Create root bridge device\r | |
175 | \r | |
176 | @param RootBridgeHandle - Parent bridge handle.\r | |
177 | \r | |
178 | @return pointer to new root bridge \r | |
179 | **/\r | |
180 | PCI_IO_DEVICE *\r | |
181 | CreateRootBridge (\r | |
182 | IN EFI_HANDLE RootBridgeHandle\r | |
183 | );\r | |
184 | \r | |
185 | /**\r | |
186 | Get root bridge device instance by specific handle.\r | |
187 | \r | |
188 | @param RootBridgeHandle Given root bridge handle.\r | |
189 | \r | |
190 | @return root bridge device instance.\r | |
191 | **/\r | |
192 | PCI_IO_DEVICE *\r | |
193 | GetRootBridgeByHandle (\r | |
194 | EFI_HANDLE RootBridgeHandle\r | |
195 | );\r | |
196 | \r | |
197 | /**\r | |
198 | Check root bridge device is existed or not.\r | |
199 | \r | |
200 | @param RootBridgeHandle Given root bridge handle.\r | |
201 | \r | |
202 | @return root bridge device is existed or not.\r | |
203 | **/\r | |
204 | BOOLEAN\r | |
205 | RootBridgeExisted (\r | |
206 | IN EFI_HANDLE RootBridgeHandle\r | |
207 | );\r | |
208 | \r | |
209 | /**\r | |
210 | Judege whether Pci device existed.\r | |
211 | \r | |
212 | @param Bridge Parent bridege instance. \r | |
213 | @param PciIoDevice Device instance.\r | |
214 | \r | |
215 | @return whether Pci device existed.\r | |
216 | **/\r | |
217 | BOOLEAN\r | |
218 | PciDeviceExisted (\r | |
219 | IN PCI_IO_DEVICE *Bridge,\r | |
220 | IN PCI_IO_DEVICE *PciIoDevice\r | |
221 | );\r | |
222 | \r | |
223 | /**\r | |
224 | Active VGA device.\r | |
225 | \r | |
226 | @param VgaDevice device instance for VGA.\r | |
227 | \r | |
228 | @return device instance.\r | |
229 | **/\r | |
230 | PCI_IO_DEVICE *\r | |
231 | ActiveVGADeviceOnTheSameSegment (\r | |
232 | IN PCI_IO_DEVICE *VgaDevice\r | |
233 | );\r | |
234 | \r | |
235 | /**\r | |
236 | Active VGA device on root bridge.\r | |
237 | \r | |
238 | @param RootBridge Root bridge device instance.\r | |
239 | \r | |
240 | @return VGA device instance.\r | |
241 | **/\r | |
242 | PCI_IO_DEVICE *\r | |
243 | ActiveVGADeviceOnTheRootBridge (\r | |
244 | IN PCI_IO_DEVICE *RootBridge\r | |
245 | );\r | |
246 | \r | |
247 | /**\r | |
248 | Get HPC PCI address according to its device path.\r | |
249 | @param PciRootBridgeIo Root bridege Io instance.\r | |
250 | @param HpcDevicePath Given searching device path.\r | |
251 | @param PciAddress Buffer holding searched result.\r | |
252 | \r | |
253 | @retval EFI_NOT_FOUND Can not find the specific device path.\r | |
254 | @retval EFI_SUCCESS Success to get the device path.\r | |
255 | **/\r | |
256 | EFI_STATUS\r | |
257 | GetHpcPciAddress (\r | |
258 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,\r | |
259 | IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,\r | |
260 | OUT UINT64 *PciAddress\r | |
261 | );\r | |
262 | \r | |
263 | /**\r | |
264 | Get HPC PCI address according to its device path.\r | |
265 | @param RootBridge Root bridege Io instance.\r | |
266 | @param RemainingDevicePath Given searching device path.\r | |
267 | @param PciAddress Buffer holding searched result.\r | |
268 | \r | |
269 | @retval EFI_NOT_FOUND Can not find the specific device path.\r | |
270 | **/\r | |
271 | EFI_STATUS\r | |
272 | GetHpcPciAddressFromRootBridge (\r | |
273 | IN PCI_IO_DEVICE *RootBridge,\r | |
274 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,\r | |
275 | OUT UINT64 *PciAddress\r | |
276 | );\r | |
277 | \r | |
278 | /**\r | |
279 | Destroy a pci device node.\r | |
280 | Also all direct or indirect allocated resource for this node will be freed.\r | |
281 | \r | |
282 | @param PciIoDevice A pointer to the PCI_IO_DEVICE.\r | |
283 | \r | |
284 | **/\r | |
285 | EFI_STATUS\r | |
286 | FreePciDevice (\r | |
287 | IN PCI_IO_DEVICE *PciIoDevice\r | |
288 | );\r | |
289 | \r | |
290 | #endif\r |