]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciBusDxe / PciDeviceSupport.h
CommitLineData
9060e3ec 1/** @file\r
2 Supporting functions declaration for PCI devices management.\r
3\r
fcdfcdbf 4Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
9060e3ec 6\r
7**/\r
8\r
9#ifndef _EFI_PCI_DEVICE_SUPPORT_H_\r
10#define _EFI_PCI_DEVICE_SUPPORT_H_\r
11\r
12/**\r
13 Initialize the PCI devices pool.\r
14\r
15**/\r
16VOID\r
17InitializePciDevicePool (\r
18 VOID\r
19 );\r
20\r
21/**\r
22 Insert a root bridge into PCI device pool.\r
23\r
24 @param RootBridge A pointer to the PCI_IO_DEVICE.\r
25\r
26**/\r
27VOID\r
28InsertRootBridge (\r
1436aea4 29 IN PCI_IO_DEVICE *RootBridge\r
9060e3ec 30 );\r
31\r
32/**\r
33 This function is used to insert a PCI device node under\r
34 a bridge.\r
35\r
36 @param Bridge The PCI bridge.\r
37 @param PciDeviceNode The PCI device needs inserting.\r
38\r
39**/\r
40VOID\r
41InsertPciDevice (\r
1436aea4
MK
42 IN PCI_IO_DEVICE *Bridge,\r
43 IN PCI_IO_DEVICE *PciDeviceNode\r
9060e3ec 44 );\r
45\r
46/**\r
fcdfcdbf 47 Destroy root bridge and remove it from device tree.\r
9060e3ec 48\r
49 @param RootBridge The bridge want to be removed.\r
50\r
51**/\r
52VOID\r
53DestroyRootBridge (\r
1436aea4 54 IN PCI_IO_DEVICE *RootBridge\r
9060e3ec 55 );\r
56\r
57/**\r
58 Destroy all the pci device node under the bridge.\r
59 Bridge itself is not included.\r
60\r
61 @param Bridge A pointer to the PCI_IO_DEVICE.\r
62\r
63**/\r
64VOID\r
65DestroyPciDeviceTree (\r
1436aea4 66 IN PCI_IO_DEVICE *Bridge\r
9060e3ec 67 );\r
68\r
69/**\r
70 Destroy all device nodes under the root bridge\r
71 specified by Controller.\r
72\r
73 The root bridge itself is also included.\r
74\r
75 @param Controller Root bridge handle.\r
76\r
fcdfcdbf 77 @retval EFI_SUCCESS Destroy all device nodes successfully.\r
9060e3ec 78 @retval EFI_NOT_FOUND Cannot find any PCI device under specified\r
79 root bridge.\r
80\r
81**/\r
82EFI_STATUS\r
83DestroyRootBridgeByHandle (\r
1436aea4 84 IN EFI_HANDLE Controller\r
9060e3ec 85 );\r
86\r
87/**\r
88 This function registers the PCI IO device.\r
89\r
90 It creates a handle for this PCI IO device (if the handle does not exist), attaches\r
91 appropriate protocols onto the handle, does necessary initialization, and sets up\r
92 parent/child relationship with its bus controller.\r
93\r
94 @param Controller An EFI handle for the PCI bus controller.\r
95 @param PciIoDevice A PCI_IO_DEVICE pointer to the PCI IO device to be registered.\r
96 @param Handle A pointer to hold the returned EFI handle for the PCI IO device.\r
97\r
98 @retval EFI_SUCCESS The PCI device is successfully registered.\r
99 @retval other An error occurred when registering the PCI device.\r
100\r
101**/\r
102EFI_STATUS\r
103RegisterPciDevice (\r
1436aea4
MK
104 IN EFI_HANDLE Controller,\r
105 IN PCI_IO_DEVICE *PciIoDevice,\r
106 OUT EFI_HANDLE *Handle OPTIONAL\r
9060e3ec 107 );\r
108\r
109/**\r
110 This function is used to remove the whole PCI devices on the specified bridge from\r
111 the root bridge.\r
112\r
113 @param RootBridgeHandle The root bridge device handle.\r
114 @param Bridge The bridge device to be removed.\r
115\r
116**/\r
117VOID\r
118RemoveAllPciDeviceOnBridge (\r
1436aea4
MK
119 EFI_HANDLE RootBridgeHandle,\r
120 PCI_IO_DEVICE *Bridge\r
9060e3ec 121 );\r
122\r
123/**\r
124 This function is used to de-register the PCI IO device.\r
125\r
126 That includes un-installing PciIo protocol from the specified PCI\r
127 device handle.\r
128\r
129 @param Controller An EFI handle for the PCI bus controller.\r
130 @param Handle PCI device handle.\r
131\r
132 @retval EFI_SUCCESS The PCI device is successfully de-registered.\r
133 @retval other An error occurred when de-registering the PCI device.\r
134\r
135**/\r
136EFI_STATUS\r
137DeRegisterPciDevice (\r
1436aea4
MK
138 IN EFI_HANDLE Controller,\r
139 IN EFI_HANDLE Handle\r
9060e3ec 140 );\r
141\r
142/**\r
143 Start to manage the PCI device on the specified root bridge or PCI-PCI Bridge.\r
144\r
145 @param Controller The root bridge handle.\r
146 @param RootBridge A pointer to the PCI_IO_DEVICE.\r
147 @param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.\r
148 @param NumberOfChildren Children number.\r
149 @param ChildHandleBuffer A pointer to the child handle buffer.\r
150\r
151 @retval EFI_NOT_READY Device is not allocated.\r
152 @retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.\r
153 @retval EFI_NOT_FOUND Can not find the specific device.\r
154 @retval EFI_SUCCESS Success to start Pci devices on bridge.\r
155\r
156**/\r
157EFI_STATUS\r
158StartPciDevicesOnBridge (\r
1436aea4
MK
159 IN EFI_HANDLE Controller,\r
160 IN PCI_IO_DEVICE *RootBridge,\r
161 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,\r
162 IN OUT UINT8 *NumberOfChildren,\r
163 IN OUT EFI_HANDLE *ChildHandleBuffer\r
9060e3ec 164 );\r
165\r
166/**\r
167 Start to manage all the PCI devices it found previously under\r
168 the entire host bridge.\r
169\r
170 @param Controller The root bridge handle.\r
171\r
172 @retval EFI_NOT_READY Device is not allocated.\r
173 @retval EFI_SUCCESS Success to start Pci device on host bridge.\r
174\r
175**/\r
176EFI_STATUS\r
177StartPciDevices (\r
1436aea4 178 IN EFI_HANDLE Controller\r
9060e3ec 179 );\r
180\r
181/**\r
182 Create root bridge device.\r
183\r
fcdfcdbf 184 @param RootBridgeHandle Specified root bridge handle.\r
9060e3ec 185\r
186 @return The crated root bridge device instance, NULL means no\r
187 root bridge device instance created.\r
188\r
189**/\r
190PCI_IO_DEVICE *\r
191CreateRootBridge (\r
1436aea4 192 IN EFI_HANDLE RootBridgeHandle\r
9060e3ec 193 );\r
194\r
195/**\r
196 Get root bridge device instance by specific root bridge handle.\r
197\r
198 @param RootBridgeHandle Given root bridge handle.\r
199\r
200 @return The root bridge device instance, NULL means no root bridge\r
201 device instance found.\r
202\r
203**/\r
204PCI_IO_DEVICE *\r
205GetRootBridgeByHandle (\r
1436aea4 206 EFI_HANDLE RootBridgeHandle\r
9060e3ec 207 );\r
208\r
9060e3ec 209/**\r
fcdfcdbf 210 Judge whether Pci device existed.\r
9060e3ec 211\r
fcdfcdbf 212 @param Bridge Parent bridge instance.\r
9060e3ec 213 @param PciIoDevice Device instance.\r
214\r
215 @retval TRUE Pci device existed.\r
216 @retval FALSE Pci device did not exist.\r
217\r
218**/\r
219BOOLEAN\r
220PciDeviceExisted (\r
1436aea4
MK
221 IN PCI_IO_DEVICE *Bridge,\r
222 IN PCI_IO_DEVICE *PciIoDevice\r
9060e3ec 223 );\r
224\r
225/**\r
983f5abb 226 Get the active VGA device on the specified Host Bridge.\r
9060e3ec 227\r
983f5abb 228 @param HostBridgeHandle Host Bridge handle.\r
9060e3ec 229\r
983f5abb 230 @return The active VGA device on the specified Host Bridge.\r
9060e3ec 231\r
232**/\r
233PCI_IO_DEVICE *\r
983f5abb 234LocateVgaDeviceOnHostBridge (\r
1436aea4 235 IN EFI_HANDLE HostBridgeHandle\r
9060e3ec 236 );\r
237\r
238/**\r
06da1e31 239 Locate the active VGA device under the bridge.\r
9060e3ec 240\r
06da1e31 241 @param Bridge PCI IO instance for the bridge.\r
9060e3ec 242\r
243 @return The active VGA device.\r
244\r
245**/\r
246PCI_IO_DEVICE *\r
06da1e31 247LocateVgaDevice (\r
1436aea4 248 IN PCI_IO_DEVICE *Bridge\r
9060e3ec 249 );\r
250\r
9060e3ec 251/**\r
252 Destroy a pci device node.\r
253\r
254 All direct or indirect allocated resource for this node will be freed.\r
255\r
fcdfcdbf 256 @param PciIoDevice A pointer to the PCI_IO_DEVICE to be destroyed.\r
9060e3ec 257\r
258**/\r
259VOID\r
260FreePciDevice (\r
1436aea4 261 IN PCI_IO_DEVICE *PciIoDevice\r
9060e3ec 262 );\r
263\r
264#endif\r