]> git.proxmox.com Git - mirror_edk2.git/blame - OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c
OptionRomPkg: Ax88772b: support for multiple dongles and chips
[mirror_edk2.git] / OptionRomPkg / Bus / Usb / UsbNetworking / Ax88772b / DriverBinding.c
CommitLineData
7f556e4d 1/** @file\r
2 Implement the driver binding protocol for Asix AX88772 Ethernet driver.\r
3 \r
4986bbaf 4 Copyright (c) 2011-2013, Intel Corporation\r
7f556e4d 5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "Ax88772.h"\r
16\r
9a1c4bec
SS
17ASIX_DONGLE ASIX_DONGLES[] = {\r
18 { 0x05AC, 0x1402, FLAG_TYPE_AX88772 }, // Apple USB Ethernet Adapter\r
19 // ASIX 88772B\r
20 { 0x0B95, 0x772B, FLAG_TYPE_AX88772B | FLAG_EEPROM_MAC },\r
21 { 0x0000, 0x0000, FLAG_NONE } // END - Do not remove\r
22};\r
23\r
7f556e4d 24/**\r
25 Verify the controller type\r
26\r
27 @param [in] pThis Protocol instance pointer.\r
28 @param [in] Controller Handle of device to test.\r
29 @param [in] pRemainingDevicePath Not used.\r
30\r
31 @retval EFI_SUCCESS This driver supports this device.\r
32 @retval other This driver does not support this device.\r
33\r
34**/\r
35EFI_STATUS\r
36EFIAPI\r
37DriverSupported (\r
38 IN EFI_DRIVER_BINDING_PROTOCOL * pThis,\r
39 IN EFI_HANDLE Controller,\r
40 IN EFI_DEVICE_PATH_PROTOCOL * pRemainingDevicePath\r
41 )\r
42{\r
43 EFI_USB_DEVICE_DESCRIPTOR Device;\r
44 EFI_USB_IO_PROTOCOL * pUsbIo;\r
45 EFI_STATUS Status;\r
9a1c4bec
SS
46 UINT32 Index;\r
47\r
7f556e4d 48 //\r
49 // Connect to the USB stack\r
50 //\r
51 Status = gBS->OpenProtocol (\r
52 Controller,\r
53 &gEfiUsbIoProtocolGuid,\r
54 (VOID **) &pUsbIo,\r
55 pThis->DriverBindingHandle, \r
56 Controller,\r
57 EFI_OPEN_PROTOCOL_BY_DRIVER\r
58 );\r
59 if (!EFI_ERROR ( Status )) {\r
60\r
61 //\r
62 // Get the interface descriptor to check the USB class and find a transport\r
63 // protocol handler.\r
64 //\r
65 Status = pUsbIo->UsbGetDeviceDescriptor ( pUsbIo, &Device );\r
66 if (EFI_ERROR ( Status )) {\r
67 Status = EFI_UNSUPPORTED;\r
68 }\r
69 else {\r
70 //\r
71 // Validate the adapter\r
9a1c4bec
SS
72 //\r
73 for (Index = 0; ASIX_DONGLES[Index].VendorId != 0; Index++) {\r
74 if (ASIX_DONGLES[Index].VendorId == Device.IdVendor &&\r
75 ASIX_DONGLES[Index].ProductId == Device.IdProduct) {\r
76 DEBUG ((EFI_D_INFO, "Found the AX88772B\r\n"));\r
77 break;\r
7f556e4d 78 }\r
7f556e4d 79 }\r
9a1c4bec
SS
80\r
81 if (ASIX_DONGLES[Index].VendorId == 0)\r
82 Status = EFI_UNSUPPORTED;\r
7f556e4d 83 }\r
84 \r
85 //\r
86 // Done with the USB stack\r
87 //\r
88 gBS->CloseProtocol (\r
89 Controller,\r
90 &gEfiUsbIoProtocolGuid,\r
91 pThis->DriverBindingHandle,\r
92 Controller\r
93 );\r
94 }\r
95 return Status;\r
96}\r
97\r
98\r
99/**\r
100 Start this driver on Controller by opening UsbIo and DevicePath protocols.\r
101 Initialize PXE structures, create a copy of the Controller Device Path with the\r
102 NIC's MAC address appended to it, install the NetworkInterfaceIdentifier protocol\r
103 on the newly created Device Path.\r
104\r
105 @param [in] pThis Protocol instance pointer.\r
106 @param [in] Controller Handle of device to work with.\r
107 @param [in] pRemainingDevicePath Not used, always produce all possible children.\r
108\r
109 @retval EFI_SUCCESS This driver is added to Controller.\r
110 @retval other This driver does not support this device.\r
111\r
112**/\r
113EFI_STATUS\r
114EFIAPI\r
115DriverStart (\r
116 IN EFI_DRIVER_BINDING_PROTOCOL * pThis,\r
117 IN EFI_HANDLE Controller,\r
118 IN EFI_DEVICE_PATH_PROTOCOL * pRemainingDevicePath\r
119 )\r
120{\r
121\r
122 EFI_STATUS Status;\r
123 NIC_DEVICE *pNicDevice;\r
124 UINTN LengthInBytes;\r
125 EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath = NULL;\r
126 MAC_ADDR_DEVICE_PATH MacDeviceNode;\r
127\r
128 //\r
129 // Allocate the device structure\r
130 //\r
131 LengthInBytes = sizeof ( *pNicDevice );\r
132 Status = gBS->AllocatePool (\r
133 EfiRuntimeServicesData,\r
134 LengthInBytes,\r
135 (VOID **) &pNicDevice\r
136 );\r
137\r
138 if (EFI_ERROR (Status)) {\r
139 DEBUG ((EFI_D_ERROR, "gBS->AllocatePool:pNicDevice ERROR Status = %r\n", Status));\r
140 goto EXIT;\r
141 }\r
142 \r
143 //\r
144 // Set the structure signature\r
145 //\r
146 ZeroMem ( pNicDevice, LengthInBytes );\r
147 pNicDevice->Signature = DEV_SIGNATURE;\r
148\r
149 Status = gBS->OpenProtocol (\r
150 Controller,\r
151 &gEfiUsbIoProtocolGuid,\r
152 (VOID **) &pNicDevice->pUsbIo,\r
153 pThis->DriverBindingHandle,\r
154 Controller,\r
155 EFI_OPEN_PROTOCOL_BY_DRIVER\r
156 );\r
157\r
158 if (EFI_ERROR (Status)) {\r
159 DEBUG ((EFI_D_ERROR, "gBS->OpenProtocol:EFI_USB_IO_PROTOCOL ERROR Status = %r\n", Status));\r
160 gBS->FreePool ( pNicDevice );\r
161 goto EXIT;\r
162 }\r
163\r
164 //\r
165 // Initialize the simple network protocol\r
166 //\r
167 Status = SN_Setup ( pNicDevice );\r
168\r
169 if (EFI_ERROR(Status)){\r
170 DEBUG ((EFI_D_ERROR, "SN_Setup ERROR Status = %r\n", Status));\r
171 gBS->CloseProtocol (\r
172 Controller,\r
173 &gEfiUsbIoProtocolGuid,\r
174 pThis->DriverBindingHandle,\r
175 Controller\r
176 );\r
177 gBS->FreePool ( pNicDevice );\r
178 goto EXIT;\r
179 }\r
180\r
181 //\r
182 // Set Device Path\r
183 // \r
184 Status = gBS->OpenProtocol (\r
185 Controller,\r
186 &gEfiDevicePathProtocolGuid,\r
187 (VOID **) &ParentDevicePath,\r
188 pThis->DriverBindingHandle,\r
189 Controller,\r
190 EFI_OPEN_PROTOCOL_BY_DRIVER\r
191 );\r
192 if (EFI_ERROR(Status)) {\r
193 DEBUG ((EFI_D_ERROR, "gBS->OpenProtocol:EFI_DEVICE_PATH_PROTOCOL error. Status = %r\n",\r
194 Status)); \r
195 gBS->CloseProtocol (\r
196 Controller,\r
197 &gEfiUsbIoProtocolGuid,\r
198 pThis->DriverBindingHandle,\r
199 Controller\r
200 );\r
201 gBS->FreePool ( pNicDevice );\r
202 goto EXIT;\r
203 }\r
204\r
205 ZeroMem (&MacDeviceNode, sizeof (MAC_ADDR_DEVICE_PATH));\r
206 MacDeviceNode.Header.Type = MESSAGING_DEVICE_PATH;\r
207 MacDeviceNode.Header.SubType = MSG_MAC_ADDR_DP;\r
208\r
209 SetDevicePathNodeLength (&MacDeviceNode.Header, sizeof (MAC_ADDR_DEVICE_PATH));\r
210 \r
211 CopyMem (&MacDeviceNode.MacAddress,\r
212 &pNicDevice->SimpleNetworkData.CurrentAddress,\r
213 PXE_HWADDR_LEN_ETHER);\r
214 \r
215 MacDeviceNode.IfType = pNicDevice->SimpleNetworkData.IfType;\r
216\r
217 pNicDevice->MyDevPath = AppendDevicePathNode (\r
218 ParentDevicePath,\r
219 (EFI_DEVICE_PATH_PROTOCOL *) &MacDeviceNode\r
220 );\r
221\r
222 pNicDevice->Controller = NULL;\r
223\r
224 //\r
225 // Install both the simple network and device path protocols.\r
226 //\r
227 Status = gBS->InstallMultipleProtocolInterfaces (\r
228 &pNicDevice->Controller,\r
229 &gEfiCallerIdGuid,\r
230 pNicDevice,\r
231 &gEfiSimpleNetworkProtocolGuid, \r
232 &pNicDevice->SimpleNetwork,\r
233 &gEfiDevicePathProtocolGuid,\r
234 pNicDevice->MyDevPath,\r
235 NULL\r
236 );\r
237\r
238 if (EFI_ERROR(Status)){\r
239 DEBUG ((EFI_D_ERROR, "gBS->InstallMultipleProtocolInterfaces error. Status = %r\n",\r
240 Status)); \r
241 gBS->CloseProtocol (\r
242 Controller,\r
243 &gEfiDevicePathProtocolGuid,\r
244 pThis->DriverBindingHandle,\r
245 Controller);\r
246 gBS->CloseProtocol (\r
247 Controller,\r
248 &gEfiUsbIoProtocolGuid,\r
249 pThis->DriverBindingHandle,\r
250 Controller\r
251 );\r
252 gBS->FreePool ( pNicDevice );\r
253 goto EXIT;\r
254 }\r
255\r
256 //\r
257 // Open For Child Device\r
258 //\r
259 Status = gBS->OpenProtocol ( \r
260 Controller,\r
261 &gEfiUsbIoProtocolGuid,\r
262 (VOID **) &pNicDevice->pUsbIo,\r
263 pThis->DriverBindingHandle,\r
264 pNicDevice->Controller,\r
265 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
266 );\r
267\r
268 if (EFI_ERROR(Status)){\r
269 gBS->UninstallMultipleProtocolInterfaces (\r
270 &pNicDevice->Controller,\r
271 &gEfiCallerIdGuid,\r
272 pNicDevice,\r
273 &gEfiSimpleNetworkProtocolGuid, \r
274 &pNicDevice->SimpleNetwork,\r
275 &gEfiDevicePathProtocolGuid,\r
276 pNicDevice->MyDevPath,\r
277 NULL\r
278 );\r
279 gBS->CloseProtocol (\r
280 Controller,\r
281 &gEfiDevicePathProtocolGuid,\r
282 pThis->DriverBindingHandle,\r
283 Controller);\r
284 gBS->CloseProtocol (\r
285 Controller,\r
286 &gEfiUsbIoProtocolGuid,\r
287 pThis->DriverBindingHandle,\r
288 Controller\r
289 );\r
290 gBS->FreePool ( pNicDevice );\r
291 }\r
292\r
293EXIT:\r
294 return Status;\r
295\r
296}\r
297\r
298/**\r
299 Stop this driver on Controller by removing NetworkInterfaceIdentifier protocol and\r
300 closing the DevicePath and PciIo protocols on Controller.\r
301\r
302 @param [in] pThis Protocol instance pointer.\r
303 @param [in] Controller Handle of device to stop driver on.\r
304 @param [in] NumberOfChildren How many children need to be stopped.\r
305 @param [in] pChildHandleBuffer Not used.\r
306\r
307 @retval EFI_SUCCESS This driver is removed Controller.\r
308 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
309 @retval other This driver was not removed from this device.\r
310\r
311**/\r
312EFI_STATUS\r
313EFIAPI\r
314DriverStop (\r
315 IN EFI_DRIVER_BINDING_PROTOCOL * pThis,\r
316 IN EFI_HANDLE Controller,\r
317 IN UINTN NumberOfChildren,\r
318 IN EFI_HANDLE * ChildHandleBuffer\r
319 )\r
320{\r
321 BOOLEAN AllChildrenStopped;\r
322 UINTN Index;\r
323 EFI_SIMPLE_NETWORK_PROTOCOL *SimpleNetwork;\r
324 EFI_STATUS Status = EFI_SUCCESS;\r
325 NIC_DEVICE *pNicDevice;\r
326 \r
327 //\r
328 // Complete all outstanding transactions to Controller.\r
329 // Don't allow any new transaction to Controller to be started.\r
330 //\r
331 if (NumberOfChildren == 0) {\r
332 \r
333 Status = gBS->OpenProtocol (\r
334 Controller,\r
335 &gEfiSimpleNetworkProtocolGuid,\r
336 (VOID **) &SimpleNetwork,\r
337 pThis->DriverBindingHandle,\r
338 Controller,\r
339 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
340 );\r
341 \r
342 if (EFI_ERROR(Status)) {\r
343 //\r
344 // This is a 2nd type handle(multi-lun root), it needs to close devicepath\r
345 // and usbio protocol.\r
346 //\r
347 gBS->CloseProtocol (\r
348 Controller,\r
349 &gEfiDevicePathProtocolGuid,\r
350 pThis->DriverBindingHandle,\r
351 Controller\r
352 );\r
353 gBS->CloseProtocol (\r
354 Controller,\r
355 &gEfiUsbIoProtocolGuid,\r
356 pThis->DriverBindingHandle,\r
357 Controller\r
358 );\r
359 return EFI_SUCCESS;\r
360 }\r
361 \r
362 pNicDevice = DEV_FROM_SIMPLE_NETWORK ( SimpleNetwork );\r
363 \r
364 Status = gBS->UninstallMultipleProtocolInterfaces (\r
365 Controller, \r
366 &gEfiCallerIdGuid,\r
367 pNicDevice,\r
368 &gEfiSimpleNetworkProtocolGuid, \r
369 &pNicDevice->SimpleNetwork,\r
370 &gEfiDevicePathProtocolGuid,\r
371 pNicDevice->MyDevPath,\r
372 NULL\r
373 );\r
374 \r
375 if (EFI_ERROR (Status)) {\r
376 return Status;\r
377 }\r
378 //\r
379 // Close the bus driver\r
380 //\r
381 Status = gBS->CloseProtocol (\r
382 Controller,\r
383 &gEfiDevicePathProtocolGuid,\r
384 pThis->DriverBindingHandle,\r
385 Controller\r
386 );\r
387\r
388 if (EFI_ERROR(Status)){\r
389 DEBUG ((EFI_D_ERROR, "driver stop: gBS->CloseProtocol:EfiDevicePathProtocol error. Status %r\n", Status));\r
390 }\r
391\r
392 Status = gBS->CloseProtocol (\r
393 Controller,\r
394 &gEfiUsbIoProtocolGuid,\r
395 pThis->DriverBindingHandle,\r
396 Controller\r
397 );\r
398\r
399 if (EFI_ERROR(Status)){\r
400 DEBUG ((EFI_D_ERROR, "driver stop: gBS->CloseProtocol:EfiUsbIoProtocol error. Status %r\n", Status));\r
401 }\r
402 return EFI_SUCCESS;\r
403 } \r
404 AllChildrenStopped = TRUE;\r
405\r
406 for (Index = 0; Index < NumberOfChildren; Index++) {\r
407\r
408 Status = gBS->OpenProtocol (\r
409 ChildHandleBuffer[Index],\r
410 &gEfiSimpleNetworkProtocolGuid,\r
411 (VOID **) &SimpleNetwork,\r
412 pThis->DriverBindingHandle,\r
413 Controller,\r
414 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
415 );\r
416 \r
417 if (EFI_ERROR (Status)) {\r
418 AllChildrenStopped = FALSE;\r
419 DEBUG ((EFI_D_ERROR, "Fail to stop No.%d multi-lun child handle when opening SimpleNetwork\n", (UINT32)Index));\r
420 continue;\r
421 } \r
422 \r
423 pNicDevice = DEV_FROM_SIMPLE_NETWORK ( SimpleNetwork );\r
424 \r
425 gBS->CloseProtocol (\r
426 Controller,\r
427 &gEfiUsbIoProtocolGuid,\r
428 pThis->DriverBindingHandle,\r
429 ChildHandleBuffer[Index]\r
430 ); \r
431 \r
432 Status = gBS->UninstallMultipleProtocolInterfaces (\r
433 ChildHandleBuffer[Index], \r
434 &gEfiCallerIdGuid,\r
435 pNicDevice,\r
436 &gEfiSimpleNetworkProtocolGuid, \r
437 &pNicDevice->SimpleNetwork,\r
438 &gEfiDevicePathProtocolGuid,\r
439 pNicDevice->MyDevPath,\r
440 NULL\r
441 );\r
442 \r
443 if (EFI_ERROR (Status)) {\r
444 Status = gBS->OpenProtocol ( \r
445 Controller,\r
446 &gEfiUsbIoProtocolGuid,\r
447 (VOID **) &pNicDevice->pUsbIo,\r
448 pThis->DriverBindingHandle,\r
449 ChildHandleBuffer[Index],\r
450 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
451 );\r
452 }\r
453 else {\r
454 int i;\r
455 RX_PKT * pCurr = pNicDevice->QueueHead;\r
456 RX_PKT * pFree;\r
457 \r
458 for ( i = 0 ; i < MAX_QUEUE_SIZE ; i++) {\r
459 if ( NULL != pCurr ) {\r
460 pFree = pCurr;\r
461 pCurr = pCurr->pNext;\r
462 gBS->FreePool (pFree);\r
463 }\r
464 }\r
465 \r
466 if ( NULL != pNicDevice->pRxTest)\r
467 gBS->FreePool (pNicDevice->pRxTest);\r
468\r
469 if ( NULL != pNicDevice->pTxTest)\r
470 gBS->FreePool (pNicDevice->pTxTest);\r
471\r
472 if ( NULL != pNicDevice->MyDevPath)\r
473 gBS->FreePool (pNicDevice->MyDevPath);\r
474 \r
475 if ( NULL != pNicDevice)\r
476 gBS->FreePool (pNicDevice);\r
477 }\r
478 }\r
479 \r
480 if (!AllChildrenStopped) {\r
481 return EFI_DEVICE_ERROR;\r
482 }\r
483 return EFI_SUCCESS;\r
484}\r
485\r
486\r
487/**\r
488 Driver binding protocol declaration\r
489**/\r
490EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = {\r
491 DriverSupported,\r
492 DriverStart,\r
493 DriverStop,\r
494 0xa,\r
495 NULL,\r
496 NULL\r
497};\r
498\r
499\r
500/**\r
501 Ax88772 driver unload routine.\r
502\r
503 @param [in] ImageHandle Handle for the image.\r
504\r
505 @retval EFI_SUCCESS Image may be unloaded\r
506\r
507**/\r
508EFI_STATUS\r
509EFIAPI\r
510DriverUnload (\r
511 IN EFI_HANDLE ImageHandle\r
512 )\r
513{\r
514 UINTN BufferSize;\r
515 UINTN Index;\r
516 UINTN Max;\r
517 EFI_HANDLE * pHandle;\r
518 EFI_STATUS Status;\r
519\r
520 //\r
521 // Determine which devices are using this driver\r
522 //\r
523 BufferSize = 0;\r
524 pHandle = NULL;\r
525 Status = gBS->LocateHandle (\r
526 ByProtocol,\r
527 &gEfiCallerIdGuid,\r
528 NULL,\r
529 &BufferSize,\r
530 NULL );\r
531 if ( EFI_BUFFER_TOO_SMALL == Status ) {\r
532 for ( ; ; ) {\r
533 //\r
534 // One or more block IO devices are present\r
535 //\r
536 Status = gBS->AllocatePool (\r
537 EfiRuntimeServicesData,\r
538 BufferSize,\r
539 (VOID **) &pHandle\r
540 );\r
541 if ( EFI_ERROR ( Status )) {\r
542 DEBUG ((EFI_D_ERROR, "Insufficient memory, failed handle buffer allocation\r\n"));\r
543 break;\r
544 }\r
545\r
546 //\r
547 // Locate the block IO devices\r
548 //\r
549 Status = gBS->LocateHandle (\r
550 ByProtocol,\r
551 &gEfiCallerIdGuid,\r
552 NULL,\r
553 &BufferSize,\r
554 pHandle );\r
555 if ( EFI_ERROR ( Status )) {\r
556 //\r
557 // Error getting handles\r
558 //\r
559 break;\r
560 }\r
561 \r
562 //\r
563 // Remove any use of the driver\r
564 //\r
565 Max = BufferSize / sizeof ( pHandle[ 0 ]);\r
566 for ( Index = 0; Max > Index; Index++ ) {\r
567 Status = DriverStop ( &gDriverBinding,\r
568 pHandle[ Index ],\r
569 0,\r
570 NULL );\r
571 if ( EFI_ERROR ( Status )) {\r
572 DEBUG ((EFI_D_ERROR, "WARNING - Failed to shutdown the driver on handle %08x\r\n", pHandle[ Index ]));\r
573 break;\r
574 }\r
575 }\r
576 break;\r
577 }\r
578 }\r
579 else {\r
580 if ( EFI_NOT_FOUND == Status ) {\r
581 //\r
582 // No devices were found\r
583 //\r
584 Status = EFI_SUCCESS;\r
585 }\r
586 }\r
587\r
588 //\r
589 // Free the handle array \r
590 //\r
591 if ( NULL != pHandle ) {\r
592 gBS->FreePool ( pHandle );\r
593 }\r
594\r
595 //\r
596 // Remove the protocols installed by the EntryPoint routine.\r
597 //\r
598 if ( !EFI_ERROR ( Status )) {\r
599 gBS->UninstallMultipleProtocolInterfaces (\r
600 ImageHandle,\r
601 &gEfiDriverBindingProtocolGuid,\r
602 &gDriverBinding, \r
603 &gEfiComponentNameProtocolGuid,\r
604 &gComponentName,\r
605 &gEfiComponentName2ProtocolGuid,\r
606 &gComponentName2,\r
607 NULL\r
608 );\r
609\r
610 DEBUG (( DEBUG_POOL | DEBUG_INIT | DEBUG_INFO,\r
611 "Removed: gEfiComponentName2ProtocolGuid from 0x%08x\r\n",\r
612 ImageHandle ));\r
613 DEBUG (( DEBUG_POOL | DEBUG_INIT | DEBUG_INFO,\r
614 "Removed: gEfiComponentNameProtocolGuid from 0x%08x\r\n",\r
615 ImageHandle ));\r
616 DEBUG (( DEBUG_POOL | DEBUG_INIT | DEBUG_INFO,\r
617 "Removed: gEfiDriverBindingProtocolGuid from 0x%08x\r\n",\r
618 ImageHandle ));\r
619\r
620 }\r
621\r
622 return Status;\r
623}\r
624\r
625\r
626/**\r
627Ax88772 driver entry point.\r
628\r
629@param [in] ImageHandle Handle for the image.\r
630@param [in] pSystemTable Address of the system table.\r
631\r
632@retval EFI_SUCCESS Image successfully loaded.\r
633\r
634**/\r
635EFI_STATUS\r
636EFIAPI\r
637EntryPoint (\r
638 IN EFI_HANDLE ImageHandle,\r
639 IN EFI_SYSTEM_TABLE * pSystemTable\r
640 )\r
641{\r
7f556e4d 642 EFI_STATUS Status;\r
643\r
7f556e4d 644 //\r
645 // Add the driver to the list of drivers\r
646 //\r
647 Status = EfiLibInstallDriverBindingComponentName2 (\r
648 ImageHandle,\r
649 pSystemTable,\r
650 &gDriverBinding,\r
651 ImageHandle,\r
652 &gComponentName,\r
653 &gComponentName2\r
654 );\r
655 if ( !EFI_ERROR ( Status )) {\r
4986bbaf
YP
656 DEBUG ((EFI_D_INFO, "Installed: gEfiDriverBindingProtocolGuid on 0x%08x\r\n",\r
657 ImageHandle));\r
658 DEBUG ((EFI_D_INFO, "Installed: gEfiComponentNameProtocolGuid on 0x%08x\r\n",\r
659 ImageHandle));\r
660 DEBUG ((EFI_D_INFO,"Installed: gEfiComponentName2ProtocolGuid on 0x%08x\r\n",\r
661 ImageHandle ));\r
7f556e4d 662\r
663 }\r
664 return Status;\r
665}\r