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
 
20
 
21
 #include <stdint.h>
21
 #include <stdint.h>
22
 #include <stdlib.h>
22
 #include <stdlib.h>
23
+#include <stdio.h>
23
 #include <string.h>
24
 #include <string.h>
24
 #include <ipxe/device.h>
25
 #include <ipxe/device.h>
25
 #include <ipxe/init.h>
26
 #include <ipxe/init.h>
27
+#include <ipxe/pci.h>
26
 #include <undi.h>
28
 #include <undi.h>
27
 #include <undinet.h>
29
 #include <undinet.h>
28
 #include <undipreload.h>
30
 #include <undipreload.h>
62
 	}
64
 	}
63
 
65
 
64
 	/* Add to device hierarchy */
66
 	/* Add to device hierarchy */
65
-	strncpy ( undi->dev.name, "UNDI",
66
-		  ( sizeof ( undi->dev.name ) - 1 ) );
67
+	undi->dev.driver_name = "undionly";
67
 	if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
68
 	if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
68
 		undi->dev.desc.bus_type = BUS_TYPE_PCI;
69
 		undi->dev.desc.bus_type = BUS_TYPE_PCI;
69
 		undi->dev.desc.location = undi->pci_busdevfn;
70
 		undi->dev.desc.location = undi->pci_busdevfn;
70
 		undi->dev.desc.vendor = undi->pci_vendor;
71
 		undi->dev.desc.vendor = undi->pci_vendor;
71
 		undi->dev.desc.device = undi->pci_device;
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
 	} else if ( undi->isapnp_csn != UNDI_NO_ISAPNP_CSN ) {
78
 	} else if ( undi->isapnp_csn != UNDI_NO_ISAPNP_CSN ) {
73
 		undi->dev.desc.bus_type = BUS_TYPE_ISAPNP;
79
 		undi->dev.desc.bus_type = BUS_TYPE_ISAPNP;
80
+		snprintf ( undi->dev.name, sizeof ( undi->dev.name ),
81
+			   "UNDI-ISAPNP" );
74
 	}
82
 	}
75
 	undi->dev.parent = &rootdev->dev;
83
 	undi->dev.parent = &rootdev->dev;
76
 	list_add ( &undi->dev.siblings, &rootdev->dev.children);
84
 	list_add ( &undi->dev.siblings, &rootdev->dev.children);

Loading…
Cancel
Save