Browse Source

[device] Make driver name a generic device property

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
fc7e2be617

+ 2
- 2
src/drivers/bus/eisa.c View File

63
 			     ISA_PROD_ID ( eisa->prod_id ) )
63
 			     ISA_PROD_ID ( eisa->prod_id ) )
64
 				continue;
64
 				continue;
65
 			eisa->driver = driver;
65
 			eisa->driver = driver;
66
-			eisa->driver_name = id->name;
67
-			DBG ( "...using driver %s\n", eisa->driver_name );
66
+			eisa->dev.driver_name = id->name;
67
+			DBG ( "...using driver %s\n", eisa->dev.driver_name );
68
 			if ( ( rc = driver->probe ( eisa, id ) ) != 0 ) {
68
 			if ( ( rc = driver->probe ( eisa, id ) ) != 0 ) {
69
 				DBG ( "......probe failed\n" );
69
 				DBG ( "......probe failed\n" );
70
 				continue;
70
 				continue;

+ 1
- 0
src/drivers/bus/isa.c View File

114
 			/* Add to device hierarchy */
114
 			/* Add to device hierarchy */
115
 			snprintf ( isa->dev.name, sizeof ( isa->dev.name ),
115
 			snprintf ( isa->dev.name, sizeof ( isa->dev.name ),
116
 				   "ISA%04x", isa->ioaddr );
116
 				   "ISA%04x", isa->ioaddr );
117
+			isa->dev.driver_name = driver->name;
117
 			isa->dev.desc.bus_type = BUS_TYPE_ISA;
118
 			isa->dev.desc.bus_type = BUS_TYPE_ISA;
118
 			isa->dev.desc.vendor = driver->vendor_id;
119
 			isa->dev.desc.vendor = driver->vendor_id;
119
 			isa->dev.desc.device = driver->prod_id;
120
 			isa->dev.desc.device = driver->prod_id;

+ 2
- 2
src/drivers/bus/isapnp.c View File

600
 			     ISA_PROD_ID ( isapnp->prod_id ) )
600
 			     ISA_PROD_ID ( isapnp->prod_id ) )
601
 				continue;
601
 				continue;
602
 			isapnp->driver = driver;
602
 			isapnp->driver = driver;
603
-			isapnp->driver_name = id->name;
604
-			DBG ( "...using driver %s\n", isapnp->driver_name );
603
+			isapnp->dev.driver_name = id->name;
604
+			DBG ( "...using driver %s\n", isapnp->dev.driver_name );
605
 			if ( ( rc = driver->probe ( isapnp, id ) ) != 0 ) {
605
 			if ( ( rc = driver->probe ( isapnp, id ) ) != 0 ) {
606
 				DBG ( "......probe failed\n" );
606
 				DBG ( "......probe failed\n" );
607
 				continue;
607
 				continue;

+ 2
- 2
src/drivers/bus/mca.c View File

44
 			if ( id->id != MCA_ID ( mca ) )
44
 			if ( id->id != MCA_ID ( mca ) )
45
 				continue;
45
 				continue;
46
 			mca->driver = driver;
46
 			mca->driver = driver;
47
-			mca->driver_name = id->name;
48
-			DBG ( "...using driver %s\n", mca->driver_name );
47
+			mca->dev.driver_name = id->name;
48
+			DBG ( "...using driver %s\n", mca->dev.driver_name );
49
 			if ( ( rc = driver->probe ( mca, id ) ) != 0 ) {
49
 			if ( ( rc = driver->probe ( mca, id ) ) != 0 ) {
50
 				DBG ( "......probe failed\n" );
50
 				DBG ( "......probe failed\n" );
51
 				continue;
51
 				continue;

+ 1
- 0
src/drivers/linux/linux.c View File

75
 
75
 
76
 		if (driver->probe(device, request) == 0) {
76
 		if (driver->probe(device, request) == 0) {
77
 			device->driver = driver;
77
 			device->driver = driver;
78
+			device->dev.driver_name = driver->name;
78
 			/* Driver handled the device so release ownership */
79
 			/* Driver handled the device so release ownership */
79
 			device = NULL;
80
 			device = NULL;
80
 		} else {
81
 		} else {

+ 2
- 0
src/include/ipxe/device.h View File

58
 struct device {
58
 struct device {
59
 	/** Name */
59
 	/** Name */
60
 	char name[16];
60
 	char name[16];
61
+	/** Driver name */
62
+	const char *driver_name;
61
 	/** Device description */
63
 	/** Device description */
62
 	struct device_description desc;
64
 	struct device_description desc;
63
 	/** Devices on the same bus */
65
 	/** Devices on the same bus */

+ 0
- 2
src/include/ipxe/eisa.h View File

54
 	 * this field.
54
 	 * this field.
55
 	 */
55
 	 */
56
 	void *priv;
56
 	void *priv;
57
-	/** Driver name */
58
-	const char *driver_name;
59
 };
57
 };
60
 
58
 
61
 /** An EISA driver */
59
 /** An EISA driver */

+ 0
- 2
src/include/ipxe/isa.h View File

22
 	 * this field.
22
 	 * this field.
23
 	 */
23
 	 */
24
 	void *priv;
24
 	void *priv;
25
-	/** Driver name */
26
-	const char *driver_name;
27
 };
25
 };
28
 
26
 
29
 /*
27
 /*

+ 0
- 2
src/include/ipxe/isapnp.h View File

198
 	 * this field.
198
 	 * this field.
199
 	 */
199
 	 */
200
 	void *priv;
200
 	void *priv;
201
-	/** Driver name */
202
-	const char *driver_name;
203
 };
201
 };
204
 
202
 
205
 /** An ISAPnP driver */
203
 /** An ISAPnP driver */

+ 0
- 2
src/include/ipxe/mca.h View File

50
 	 * this field.
50
 	 * this field.
51
 	 */
51
 	 */
52
 	void *priv;
52
 	void *priv;
53
-	/** Driver name */
54
-	const char *driver_name;
55
 };
53
 };
56
 
54
 
57
 #define MCA_ID(mca) ( ( (mca)->pos[1] << 8 ) + (mca)->pos[0] )
55
 #define MCA_ID(mca) ( ( (mca)->pos[1] << 8 ) + (mca)->pos[0] )

+ 1
- 0
src/include/ipxe/pci.h View File

410
 				    struct pci_device_id *id ) {
410
 				    struct pci_device_id *id ) {
411
 	pci->driver = driver;
411
 	pci->driver = driver;
412
 	pci->id = id;
412
 	pci->id = id;
413
+	pci->dev.driver_name = id->name;
413
 }
414
 }
414
 
415
 
415
 /**
416
 /**

+ 3
- 2
src/usr/ifmgmt.c View File

87
  * @v netdev		Network device
87
  * @v netdev		Network device
88
  */
88
  */
89
 void ifstat ( struct net_device *netdev ) {
89
 void ifstat ( struct net_device *netdev ) {
90
-	printf ( "%s: %s on %s (%s)\n"
90
+	printf ( "%s: %s using %s on %s (%s)\n"
91
 		 "  [Link:%s, TX:%d TXE:%d RX:%d RXE:%d]\n",
91
 		 "  [Link:%s, TX:%d TXE:%d RX:%d RXE:%d]\n",
92
-		 netdev->name, netdev_addr ( netdev ), netdev->dev->name,
92
+		 netdev->name, netdev_addr ( netdev ),
93
+		 netdev->dev->driver_name, netdev->dev->name,
93
 		 ( netdev_is_open ( netdev ) ? "open" : "closed" ),
94
 		 ( netdev_is_open ( netdev ) ? "open" : "closed" ),
94
 		 ( netdev_link_ok ( netdev ) ? "up" : "down" ),
95
 		 ( netdev_link_ok ( netdev ) ? "up" : "down" ),
95
 		 netdev->tx_stats.good, netdev->tx_stats.bad,
96
 		 netdev->tx_stats.good, netdev->tx_stats.bad,

Loading…
Cancel
Save