DriverBinding.c 21 KB

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