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