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