|
@@ -30,7 +30,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
30
|
30
|
#include <ipxe/efi/efi.h>
|
31
|
31
|
#include <ipxe/efi/Protocol/SimpleNetwork.h>
|
32
|
32
|
#include <ipxe/efi/efi_driver.h>
|
33
|
|
-#include <ipxe/efi/efi_pci.h>
|
34
|
33
|
#include <ipxe/efi/efi_utils.h>
|
35
|
34
|
#include "snpnet.h"
|
36
|
35
|
|
|
@@ -409,64 +408,6 @@ static struct net_device_operations snpnet_operations = {
|
409
|
408
|
.poll = snpnet_poll,
|
410
|
409
|
};
|
411
|
410
|
|
412
|
|
-/**
|
413
|
|
- * Get underlying PCI device information
|
414
|
|
- *
|
415
|
|
- * @v efidev EFI device
|
416
|
|
- * @v dev Generic device to fill in
|
417
|
|
- * @ret rc Return status code
|
418
|
|
- */
|
419
|
|
-static int snpnet_pci_info ( struct efi_device *efidev, struct device *dev ) {
|
420
|
|
- EFI_HANDLE device = efidev->device;
|
421
|
|
- EFI_HANDLE pci_device;
|
422
|
|
- struct pci_device pci;
|
423
|
|
- int rc;
|
424
|
|
-
|
425
|
|
- /* Find parent PCI device */
|
426
|
|
- if ( ( rc = efi_locate_device ( device, &efi_pci_io_protocol_guid,
|
427
|
|
- &pci_device ) ) != 0 ) {
|
428
|
|
- DBGC ( device, "SNP %p %s is not a PCI device: %s\n",
|
429
|
|
- device, efi_handle_name ( device ), strerror ( rc ) );
|
430
|
|
- return rc;
|
431
|
|
- }
|
432
|
|
-
|
433
|
|
- /* Get PCI device information */
|
434
|
|
- if ( ( rc = efipci_info ( pci_device, &pci ) ) != 0 ) {
|
435
|
|
- DBGC ( device, "SNP %p %s could not get PCI information: %s\n",
|
436
|
|
- device, efi_handle_name ( device ), strerror ( rc ) );
|
437
|
|
- return rc;
|
438
|
|
- }
|
439
|
|
-
|
440
|
|
- /* Populate SNP device information */
|
441
|
|
- memcpy ( &dev->desc, &pci.dev.desc, sizeof ( dev->desc ) );
|
442
|
|
- snprintf ( dev->name, sizeof ( dev->name ), "SNP-%s", pci.dev.name );
|
443
|
|
-
|
444
|
|
- return 0;
|
445
|
|
-}
|
446
|
|
-
|
447
|
|
-/**
|
448
|
|
- * Get underlying device information
|
449
|
|
- *
|
450
|
|
- * @v efidev EFI device
|
451
|
|
- * @v dev Generic device to fill in
|
452
|
|
- */
|
453
|
|
-static void snpnet_dev_info ( struct efi_device *efidev, struct device *dev ) {
|
454
|
|
- EFI_HANDLE device = efidev->device;
|
455
|
|
- int rc;
|
456
|
|
-
|
457
|
|
- /* Try getting underlying PCI device information */
|
458
|
|
- if ( ( rc = snpnet_pci_info ( efidev, dev ) ) == 0 )
|
459
|
|
- return;
|
460
|
|
-
|
461
|
|
- /* If we cannot get any underlying device information, fall
|
462
|
|
- * back to providing information about the EFI handle.
|
463
|
|
- */
|
464
|
|
- DBGC ( device, "SNP %p %s could not get underlying device "
|
465
|
|
- "information\n", device, efi_handle_name ( device ) );
|
466
|
|
- dev->desc.bus_type = BUS_TYPE_EFI;
|
467
|
|
- snprintf ( dev->name, sizeof ( dev->name ), "SNP-%p", device );
|
468
|
|
-}
|
469
|
|
-
|
470
|
411
|
/**
|
471
|
412
|
* Attach driver to device
|
472
|
413
|
*
|
|
@@ -511,7 +452,7 @@ int snpnet_start ( struct efi_device *efidev ) {
|
511
|
452
|
efidev_set_drvdata ( efidev, netdev );
|
512
|
453
|
|
513
|
454
|
/* Populate underlying device information */
|
514
|
|
- snpnet_dev_info ( efidev, &snp->dev );
|
|
455
|
+ efi_device_info ( device, "SNP", &snp->dev );
|
515
|
456
|
snp->dev.driver_name = "SNP";
|
516
|
457
|
snp->dev.parent = &efidev->dev;
|
517
|
458
|
list_add ( &snp->dev.siblings, &efidev->dev.children );
|