aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/net/efi
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2014-09-04 16:18:08 +0100
committerMichael Brown <mcb30@ipxe.org>2014-09-04 16:18:08 +0100
commit0ce3c9709578fa005ba931fc4198cb3b4b0b9d15 (patch)
treed0d2d83c18f922dc31e4891d6068eb02377281bd /src/drivers/net/efi
parent3bb910caa8cfb07c8d2858e70065dc2904ecaf99 (diff)
downloadipxe-0ce3c9709578fa005ba931fc4198cb3b4b0b9d15.zip
ipxe-0ce3c9709578fa005ba931fc4198cb3b4b0b9d15.tar.gz
ipxe-0ce3c9709578fa005ba931fc4198cb3b4b0b9d15.tar.bz2
[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>
Diffstat (limited to 'src/drivers/net/efi')
-rw-r--r--src/drivers/net/efi/snpnet.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/drivers/net/efi/snpnet.c b/src/drivers/net/efi/snpnet.c
index f5b294a..e54b529 100644
--- a/src/drivers/net/efi/snpnet.c
+++ b/src/drivers/net/efi/snpnet.c
@@ -447,19 +447,22 @@ static int snpnet_pci_info ( struct efi_device *efidev, struct device *dev ) {
*
* @v efidev EFI device
* @v dev Generic device to fill in
- * @ret rc Return status code
*/
-static int snpnet_dev_info ( struct efi_device *efidev, struct device *dev ) {
+static void snpnet_dev_info ( struct efi_device *efidev, struct device *dev ) {
EFI_HANDLE device = efidev->device;
int rc;
/* Try getting underlying PCI device information */
if ( ( rc = snpnet_pci_info ( efidev, dev ) ) == 0 )
- return 0;
+ return;
+ /* If we cannot get any underlying device information, fall
+ * back to providing information about the EFI handle.
+ */
DBGC ( device, "SNP %p %s could not get underlying device "
"information\n", device, efi_handle_name ( device ) );
- return -ENOTTY;
+ dev->desc.bus_type = BUS_TYPE_EFI;
+ snprintf ( dev->name, sizeof ( dev->name ), "SNP-%p", device );
}
/**
@@ -506,8 +509,7 @@ int snpnet_start ( struct efi_device *efidev ) {
efidev_set_drvdata ( efidev, netdev );
/* Populate underlying device information */
- if ( ( rc = snpnet_dev_info ( efidev, &snp->dev ) ) != 0 )
- goto err_info;
+ snpnet_dev_info ( efidev, &snp->dev );
snp->dev.driver_name = "SNP";
snp->dev.parent = &efidev->dev;
list_add ( &snp->dev.siblings, &efidev->dev.children );
@@ -574,7 +576,6 @@ int snpnet_start ( struct efi_device *efidev ) {
err_shutdown:
err_start:
list_del ( &snp->dev.siblings );
- err_info:
netdev_nullify ( netdev );
netdev_put ( netdev );
err_alloc: