Browse Source

[undi] Use meaningful driver and device names

Specify a driver name of "undionly" and a device name based on the
UNDI-reported underlying hardware device.  For example:

  net0: 52:54:00:12:34:56 using undionly on UNDI-PCI00:03.0 (open)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
a1f618c625
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      src/arch/i386/drivers/net/undionly.c

+ 10
- 2
src/arch/i386/drivers/net/undionly.c View File

@@ -20,9 +20,11 @@ FILE_LICENCE ( GPL2_OR_LATER );
20 20
 
21 21
 #include <stdint.h>
22 22
 #include <stdlib.h>
23
+#include <stdio.h>
23 24
 #include <string.h>
24 25
 #include <ipxe/device.h>
25 26
 #include <ipxe/init.h>
27
+#include <ipxe/pci.h>
26 28
 #include <undi.h>
27 29
 #include <undinet.h>
28 30
 #include <undipreload.h>
@@ -62,15 +64,21 @@ static int undibus_probe ( struct root_device *rootdev ) {
62 64
 	}
63 65
 
64 66
 	/* Add to device hierarchy */
65
-	strncpy ( undi->dev.name, "UNDI",
66
-		  ( sizeof ( undi->dev.name ) - 1 ) );
67
+	undi->dev.driver_name = "undionly";
67 68
 	if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
68 69
 		undi->dev.desc.bus_type = BUS_TYPE_PCI;
69 70
 		undi->dev.desc.location = undi->pci_busdevfn;
70 71
 		undi->dev.desc.vendor = undi->pci_vendor;
71 72
 		undi->dev.desc.device = undi->pci_device;
73
+		snprintf ( undi->dev.name, sizeof ( undi->dev.name ),
74
+			   "UNDI-PCI%02x:%02x.%x",
75
+			   PCI_BUS ( undi->pci_busdevfn ),
76
+			   PCI_SLOT ( undi->pci_busdevfn ),
77
+			   PCI_FUNC ( undi->pci_busdevfn ) );
72 78
 	} else if ( undi->isapnp_csn != UNDI_NO_ISAPNP_CSN ) {
73 79
 		undi->dev.desc.bus_type = BUS_TYPE_ISAPNP;
80
+		snprintf ( undi->dev.name, sizeof ( undi->dev.name ),
81
+			   "UNDI-ISAPNP" );
74 82
 	}
75 83
 	undi->dev.parent = &rootdev->dev;
76 84
 	list_add ( &undi->dev.siblings, &rootdev->dev.children);

Loading…
Cancel
Save