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