Update the local header file name.
[mirror_edk2.git] / IntelFrameworkPkg / Library / UefiLibFramework / UefiDriverModel.c
CommitLineData
6313f115 1/** @file\r
2 Library functions that abstract driver model protocols\r
3 installation.\r
4\r
5 Copyright (c) 2006 - 2007, Intel Corporation<BR> All rights\r
6 reserved. This program and the accompanying materials are\r
7 licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10 \r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/ \r
15\r
4aad6542 16#include "UefiLibFramework.h"\r
6313f115 17\r
18/**\r
19 Intialize a driver by installing the Driver Binding Protocol onto the driver's\r
20 DriverBindingHandle. This is typically the same as the driver's ImageHandle, but\r
21 it can be different if the driver produces multiple DriverBinding Protocols. \r
22 If the Drvier Binding Protocol interface is NULL, then ASSERT (). \r
23 If the installation fails, then ASSERT ().\r
24\r
25 @param ImageHandle The image handle of the driver.\r
26 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
27 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
28 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this\r
29 parameter is NULL, then a new handle is created.\r
30\r
31 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
32 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
33\r
34**/\r
35EFI_STATUS\r
36EFIAPI\r
37EfiLibInstallDriverBinding (\r
38 IN CONST EFI_HANDLE ImageHandle,\r
39 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
40 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
41 IN EFI_HANDLE DriverBindingHandle\r
42 )\r
43{\r
44 EFI_STATUS Status;\r
45\r
46 ASSERT (NULL != DriverBinding);\r
47\r
48 Status = gBS->InstallMultipleProtocolInterfaces (\r
49 &DriverBindingHandle,\r
50 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
51 NULL\r
52 );\r
53 //\r
54 // ASSERT if the call to InstallMultipleProtocolInterfaces() failed\r
55 //\r
56 ASSERT_EFI_ERROR (Status);\r
57\r
58 //\r
59 // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
60 //\r
61 DriverBinding->ImageHandle = ImageHandle;\r
62 DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
63\r
64 return Status;\r
65}\r
66\r
67\r
68/**\r
69 Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
70 Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle. This is\r
71 typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple\r
72 DriverBinding Protocols. \r
73 If the Drvier Binding Protocol interface is NULL, then ASSERT (). \r
74 If the installation fails, then ASSERT ().\r
75\r
76 @param ImageHandle The image handle of the driver.\r
77 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
78 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
79 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this\r
80 parameter is NULL, then a new handle is created.\r
81 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
82 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
83 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
84\r
85 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
86 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
87\r
88**/\r
89EFI_STATUS\r
90EFIAPI\r
91EfiLibInstallAllDriverProtocols (\r
92 IN CONST EFI_HANDLE ImageHandle,\r
93 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
94 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
95 IN EFI_HANDLE DriverBindingHandle,\r
96 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
97 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
98 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r
99 )\r
100{\r
101 EFI_STATUS Status;\r
102\r
103 ASSERT (NULL != DriverBinding);\r
104\r
105 if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {\r
106 if (DriverConfiguration == NULL) {\r
107 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
108 Status = gBS->InstallMultipleProtocolInterfaces (\r
109 &DriverBindingHandle,\r
110 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
111 NULL\r
112 );\r
113 } else {\r
114 Status = gBS->InstallMultipleProtocolInterfaces (\r
115 &DriverBindingHandle,\r
116 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
117 &gEfiComponentNameProtocolGuid, ComponentName,\r
118 NULL\r
119 );\r
120 }\r
121 } else {\r
122 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
123 Status = gBS->InstallMultipleProtocolInterfaces (\r
124 &DriverBindingHandle,\r
125 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
126 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
127 NULL\r
128 );\r
129 } else {\r
130 Status = gBS->InstallMultipleProtocolInterfaces (\r
131 &DriverBindingHandle,\r
132 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
133 &gEfiComponentNameProtocolGuid, ComponentName,\r
134 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
135 NULL\r
136 );\r
137 }\r
138 }\r
139 } else {\r
140 if (DriverConfiguration == NULL) {\r
141 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
142 Status = gBS->InstallMultipleProtocolInterfaces (\r
143 &DriverBindingHandle,\r
144 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
145 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
146 NULL\r
147 );\r
148 } else {\r
149 Status = gBS->InstallMultipleProtocolInterfaces (\r
150 &DriverBindingHandle,\r
151 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
152 &gEfiComponentNameProtocolGuid, ComponentName,\r
153 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
154 NULL\r
155 );\r
156 }\r
157 } else {\r
158 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
159 Status = gBS->InstallMultipleProtocolInterfaces (\r
160 &DriverBindingHandle,\r
161 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
162 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
163 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
164 NULL\r
165 );\r
166 } else {\r
167 Status = gBS->InstallMultipleProtocolInterfaces (\r
168 &DriverBindingHandle,\r
169 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
170 &gEfiComponentNameProtocolGuid, ComponentName,\r
171 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
172 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
173 NULL\r
174 );\r
175 }\r
176 }\r
177 }\r
178\r
179 //\r
180 // ASSERT if the call to InstallMultipleProtocolInterfaces() failed\r
181 //\r
182 ASSERT_EFI_ERROR (Status);\r
183\r
184 //\r
185 // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
186 //\r
187 DriverBinding->ImageHandle = ImageHandle;\r
188 DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
189\r
190 return Status;\r
191}\r
192\r
193\r
194\r
195/**\r
196 Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
197 Component Name 2 onto the driver's DriverBindingHandle. This is typically the same as the driver's\r
198 ImageHandle, but it can be different if the driver produces multiple DriverBinding Protocols. \r
199 If the Drvier Binding Protocol interface is NULL, then ASSERT (). \r
200 If the installation fails, then ASSERT ().\r
201\r
202 @param ImageHandle The image handle of the driver.\r
203 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
204 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
205 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this\r
206 parameter is NULL, then a new handle is created.\r
207 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
208 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
209\r
210 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
211 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
212\r
213**/\r
214EFI_STATUS\r
215EFIAPI\r
216EfiLibInstallDriverBindingComponentName2 (\r
217 IN CONST EFI_HANDLE ImageHandle,\r
218 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
219 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
220 IN EFI_HANDLE DriverBindingHandle,\r
221 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
222 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL\r
223 )\r
224{\r
225 EFI_STATUS Status;\r
226\r
227 ASSERT (NULL != DriverBinding);\r
228\r
229 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
230 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
231 Status = gBS->InstallMultipleProtocolInterfaces (\r
232 &DriverBindingHandle,\r
233 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
234 NULL\r
235 );\r
236 } else {\r
237 Status = gBS->InstallMultipleProtocolInterfaces (\r
238 &DriverBindingHandle,\r
239 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
240 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
241 NULL\r
242 );\r
243 }\r
244 } else {\r
245 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
246 Status = gBS->InstallMultipleProtocolInterfaces (\r
247 &DriverBindingHandle,\r
248 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
249 &gEfiComponentNameProtocolGuid, ComponentName,\r
250 NULL\r
251 );\r
252 } else {\r
253 Status = gBS->InstallMultipleProtocolInterfaces (\r
254 &DriverBindingHandle,\r
255 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
256 &gEfiComponentNameProtocolGuid, ComponentName,\r
257 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
258 NULL\r
259 );\r
260 }\r
261 }\r
262 //\r
263 // ASSERT if the call to InstallMultipleProtocolInterfaces() failed\r
264 //\r
265 ASSERT_EFI_ERROR (Status);\r
266\r
267 //\r
268 // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
269 //\r
270 DriverBinding->ImageHandle = ImageHandle;\r
271 DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
272\r
273 return Status;\r
274}\r
275\r
276\r
277\r
278/**\r
279 Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
280 Component Name 2, Driver Configure, Driver Diagnostic and Driver Diagnostic 2 Protocols onto the driver's\r
281 DriverBindingHandle. This is typically the same as the driver's ImageHandle, but it can be different if\r
282 the driver produces multiple DriverBinding Protocols. \r
283 If the Drvier Binding Protocol interface is NULL, then ASSERT (). \r
284 If the installation fails, then ASSERT ().\r
285\r
286 @param ImageHandle The image handle of the driver.\r
287 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
288 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
289 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this\r
290 parameter is NULL, then a new handle is created.\r
291 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
292 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
293 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
294 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
295 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.\r
296\r
297 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
298 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
299\r
300**/\r
301EFI_STATUS\r
302EFIAPI\r
303EfiLibInstallAllDriverProtocols2 (\r
304 IN CONST EFI_HANDLE ImageHandle,\r
305 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
306 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
307 IN EFI_HANDLE DriverBindingHandle,\r
308 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
309 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r
310 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
311 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL\r
312 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r
313 )\r
314{\r
315 EFI_STATUS Status;\r
316\r
317 ASSERT (NULL != DriverBinding);\r
318\r
319 if (DriverConfiguration == NULL) {\r
320 if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {\r
321 if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {\r
322 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
323 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
324 Status = gBS->InstallMultipleProtocolInterfaces (\r
325 &DriverBindingHandle,\r
326 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
327 NULL\r
328 );\r
329 } else {\r
330 Status = gBS->InstallMultipleProtocolInterfaces (\r
331 &DriverBindingHandle,\r
332 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
333 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
334 NULL\r
335 );\r
336 }\r
337 } else {\r
338 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
339 Status = gBS->InstallMultipleProtocolInterfaces (\r
340 &DriverBindingHandle,\r
341 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
342 &gEfiComponentNameProtocolGuid, ComponentName,\r
343 NULL\r
344 );\r
345 } else {\r
346 Status = gBS->InstallMultipleProtocolInterfaces (\r
347 &DriverBindingHandle,\r
348 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
349 &gEfiComponentNameProtocolGuid, ComponentName,\r
350 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
351 NULL\r
352 );\r
353 }\r
354 }\r
355 } else {\r
356 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
357 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
358 Status = gBS->InstallMultipleProtocolInterfaces (\r
359 &DriverBindingHandle,\r
360 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
361 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
362 NULL\r
363 );\r
364 } else {\r
365 Status = gBS->InstallMultipleProtocolInterfaces (\r
366 &DriverBindingHandle,\r
367 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
368 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
369 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
370 NULL\r
371 );\r
372 }\r
373 } else {\r
374 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
375 Status = gBS->InstallMultipleProtocolInterfaces (\r
376 &DriverBindingHandle,\r
377 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
378 &gEfiComponentNameProtocolGuid, ComponentName,\r
379 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
380 NULL\r
381 );\r
382 } else {\r
383 Status = gBS->InstallMultipleProtocolInterfaces (\r
384 &DriverBindingHandle,\r
385 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
386 &gEfiComponentNameProtocolGuid, ComponentName,\r
387 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
388 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
389 NULL\r
390 );\r
391 }\r
392 }\r
393 }\r
394 } else {\r
395 if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {\r
396 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
397 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
398 Status = gBS->InstallMultipleProtocolInterfaces (\r
399 &DriverBindingHandle,\r
400 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
401 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
402 NULL\r
403 );\r
404 } else {\r
405 Status = gBS->InstallMultipleProtocolInterfaces (\r
406 &DriverBindingHandle,\r
407 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
408 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
409 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
410 NULL\r
411 );\r
412 }\r
413 } else {\r
414 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
415 Status = gBS->InstallMultipleProtocolInterfaces (\r
416 &DriverBindingHandle,\r
417 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
418 &gEfiComponentNameProtocolGuid, ComponentName,\r
419 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
420 NULL\r
421 );\r
422 } else {\r
423 Status = gBS->InstallMultipleProtocolInterfaces (\r
424 &DriverBindingHandle,\r
425 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
426 &gEfiComponentNameProtocolGuid, ComponentName,\r
427 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
428 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
429 NULL\r
430 );\r
431 }\r
432 }\r
433 } else {\r
434 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
435 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
436 Status = gBS->InstallMultipleProtocolInterfaces (\r
437 &DriverBindingHandle,\r
438 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
439 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
440 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
441 NULL\r
442 );\r
443 } else {\r
444 Status = gBS->InstallMultipleProtocolInterfaces (\r
445 &DriverBindingHandle,\r
446 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
447 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
448 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
449 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
450 NULL\r
451 );\r
452 }\r
453 } else {\r
454 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
455 Status = gBS->InstallMultipleProtocolInterfaces (\r
456 &DriverBindingHandle,\r
457 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
458 &gEfiComponentNameProtocolGuid, ComponentName,\r
459 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
460 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
461 NULL\r
462 );\r
463 } else {\r
464 Status = gBS->InstallMultipleProtocolInterfaces (\r
465 &DriverBindingHandle,\r
466 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
467 &gEfiComponentNameProtocolGuid, ComponentName,\r
468 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
469 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
470 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
471 NULL\r
472 );\r
473 }\r
474 }\r
475 }\r
476 }\r
477 } else {\r
478 if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {\r
479 if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {\r
480 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
481 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
482 Status = gBS->InstallMultipleProtocolInterfaces (\r
483 &DriverBindingHandle,\r
484 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
485 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
486 NULL\r
487 );\r
488 } else {\r
489 Status = gBS->InstallMultipleProtocolInterfaces (\r
490 &DriverBindingHandle,\r
491 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
492 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
493 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
494 NULL\r
495 );\r
496 }\r
497 } else {\r
498 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
499 Status = gBS->InstallMultipleProtocolInterfaces (\r
500 &DriverBindingHandle,\r
501 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
502 &gEfiComponentNameProtocolGuid, ComponentName,\r
503 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
504 NULL\r
505 );\r
506 } else {\r
507 Status = gBS->InstallMultipleProtocolInterfaces (\r
508 &DriverBindingHandle,\r
509 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
510 &gEfiComponentNameProtocolGuid, ComponentName,\r
511 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
512 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
513 NULL\r
514 );\r
515 }\r
516 }\r
517 } else {\r
518 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
519 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
520 Status = gBS->InstallMultipleProtocolInterfaces (\r
521 &DriverBindingHandle,\r
522 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
523 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
524 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
525 NULL\r
526 );\r
527 } else {\r
528 Status = gBS->InstallMultipleProtocolInterfaces (\r
529 &DriverBindingHandle,\r
530 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
531 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
532 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
533 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
534 NULL\r
535 );\r
536 }\r
537 } else {\r
538 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
539 Status = gBS->InstallMultipleProtocolInterfaces (\r
540 &DriverBindingHandle,\r
541 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
542 &gEfiComponentNameProtocolGuid, ComponentName,\r
543 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
544 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
545 NULL\r
546 );\r
547 } else {\r
548 Status = gBS->InstallMultipleProtocolInterfaces (\r
549 &DriverBindingHandle,\r
550 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
551 &gEfiComponentNameProtocolGuid, ComponentName,\r
552 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
553 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
554 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
555 NULL\r
556 );\r
557 }\r
558 }\r
559 }\r
560 } else {\r
561 if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {\r
562 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
563 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
564 Status = gBS->InstallMultipleProtocolInterfaces (\r
565 &DriverBindingHandle,\r
566 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
567 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
568 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
569 NULL\r
570 );\r
571 } else {\r
572 Status = gBS->InstallMultipleProtocolInterfaces (\r
573 &DriverBindingHandle,\r
574 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
575 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
576 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
577 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
578 NULL\r
579 );\r
580 }\r
581 } else {\r
582 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
583 Status = gBS->InstallMultipleProtocolInterfaces (\r
584 &DriverBindingHandle,\r
585 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
586 &gEfiComponentNameProtocolGuid, ComponentName,\r
587 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
588 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
589 NULL\r
590 );\r
591 } else {\r
592 Status = gBS->InstallMultipleProtocolInterfaces (\r
593 &DriverBindingHandle,\r
594 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
595 &gEfiComponentNameProtocolGuid, ComponentName,\r
596 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
597 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
598 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
599 NULL\r
600 );\r
601 }\r
602 }\r
603 } else {\r
604 if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {\r
605 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
606 Status = gBS->InstallMultipleProtocolInterfaces (\r
607 &DriverBindingHandle,\r
608 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
609 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
610 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
611 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
612 NULL\r
613 );\r
614 } else {\r
615 Status = gBS->InstallMultipleProtocolInterfaces (\r
616 &DriverBindingHandle,\r
617 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
618 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
619 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
620 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
621 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
622 NULL\r
623 );\r
624 }\r
625 } else {\r
626 if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {\r
627 Status = gBS->InstallMultipleProtocolInterfaces (\r
628 &DriverBindingHandle,\r
629 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
630 &gEfiComponentNameProtocolGuid, ComponentName,\r
631 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
632 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
633 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
634 NULL\r
635 );\r
636 } else {\r
637 Status = gBS->InstallMultipleProtocolInterfaces (\r
638 &DriverBindingHandle,\r
639 &gEfiDriverBindingProtocolGuid, DriverBinding,\r
640 &gEfiComponentNameProtocolGuid, ComponentName,\r
641 &gEfiComponentName2ProtocolGuid, ComponentName2,\r
642 &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,\r
643 &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,\r
644 &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,\r
645 NULL\r
646 );\r
647 }\r
648 }\r
649 }\r
650 }\r
651 }\r
652\r
653 //\r
654 // ASSERT if the call to InstallMultipleProtocolInterfaces() failed\r
655 //\r
656 ASSERT_EFI_ERROR (Status);\r
657\r
658 //\r
659 // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol\r
660 //\r
661 DriverBinding->ImageHandle = ImageHandle;\r
662 DriverBinding->DriverBindingHandle = DriverBindingHandle;\r
663\r
664 return Status;\r
665}\r
666\r
667\r