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