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