ソースを参照

[efi] Allow for non-PCI snpnet devices

We currently require information about the underlying PCI device to
populate the snpnet device's name and description.  If the underlying
device is not a PCI device, this will fail and prevent the device from
being registered.

Fix by falling back to populating the device description with
information based on the EFI handle, if no PCI device information is
available.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10年前
コミット
0ce3c97095
1個のファイルの変更8行の追加7行の削除
  1. 8
    7
      src/drivers/net/efi/snpnet.c

+ 8
- 7
src/drivers/net/efi/snpnet.c ファイルの表示

@@ -447,19 +447,22 @@ static int snpnet_pci_info ( struct efi_device *efidev, struct device *dev ) {
447 447
  *
448 448
  * @v efidev		EFI device
449 449
  * @v dev		Generic device to fill in
450
- * @ret rc		Return status code
451 450
  */
452
-static int snpnet_dev_info ( struct efi_device *efidev, struct device *dev ) {
451
+static void snpnet_dev_info ( struct efi_device *efidev, struct device *dev ) {
453 452
 	EFI_HANDLE device = efidev->device;
454 453
 	int rc;
455 454
 
456 455
 	/* Try getting underlying PCI device information */
457 456
 	if ( ( rc = snpnet_pci_info ( efidev, dev ) ) == 0 )
458
-		return 0;
457
+		return;
459 458
 
459
+	/* If we cannot get any underlying device information, fall
460
+	 * back to providing information about the EFI handle.
461
+	 */
460 462
 	DBGC ( device, "SNP %p %s could not get underlying device "
461 463
 	       "information\n", device, efi_handle_name ( device ) );
462
-	return -ENOTTY;
464
+	dev->desc.bus_type = BUS_TYPE_EFI;
465
+	snprintf ( dev->name, sizeof ( dev->name ), "SNP-%p", device );
463 466
 }
464 467
 
465 468
 /**
@@ -506,8 +509,7 @@ int snpnet_start ( struct efi_device *efidev ) {
506 509
 	efidev_set_drvdata ( efidev, netdev );
507 510
 
508 511
 	/* Populate underlying device information */
509
-	if ( ( rc = snpnet_dev_info ( efidev, &snp->dev ) ) != 0 )
510
-		goto err_info;
512
+	snpnet_dev_info ( efidev, &snp->dev );
511 513
 	snp->dev.driver_name = "SNP";
512 514
 	snp->dev.parent = &efidev->dev;
513 515
 	list_add ( &snp->dev.siblings, &efidev->dev.children );
@@ -574,7 +576,6 @@ int snpnet_start ( struct efi_device *efidev ) {
574 576
  err_shutdown:
575 577
  err_start:
576 578
 	list_del ( &snp->dev.siblings );
577
- err_info:
578 579
 	netdev_nullify ( netdev );
579 580
 	netdev_put ( netdev );
580 581
  err_alloc:

読み込み中…
キャンセル
保存