Browse Source

Add "name" field to struct device to allow human-readable hardware device

names.

Add "dev" pointer in struct net_device to tie network interfaces back to a
hardware device.

Force natural alignment of data types in __table() macros.  This seems to
prevent gcc from taking the unilateral decision to occasionally increase
their alignment (which screws up the table packing).
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
dad5274522
51 changed files with 184 additions and 135 deletions
  1. 3
    0
      src/arch/i386/drivers/net/undi.c
  2. 1
    0
      src/arch/i386/drivers/net/undinet.c
  3. 3
    1
      src/arch/i386/drivers/net/undionly.c
  4. 4
    2
      src/core/background.c
  5. 4
    2
      src/core/console.c
  6. 8
    4
      src/core/dev.c
  7. 7
    5
      src/core/device.c
  8. 4
    2
      src/core/exec.c
  9. 4
    2
      src/core/init.c
  10. 4
    2
      src/core/resolv.c
  11. 8
    8
      src/core/settings.c
  12. 4
    2
      src/drivers/bus/isa.c
  13. 11
    5
      src/drivers/bus/pci.c
  14. 2
    2
      src/drivers/net/dmfe.c
  15. 5
    5
      src/drivers/net/forcedeth.c
  16. 1
    0
      src/drivers/net/legacy.c
  17. 1
    1
      src/drivers/net/mtd80x.c
  18. 1
    1
      src/drivers/net/natsemi.c
  19. 7
    7
      src/drivers/net/ns83820.c
  20. 1
    1
      src/drivers/net/pcnet32.c
  21. 1
    0
      src/drivers/net/pnic.c
  22. 5
    5
      src/drivers/net/r8169.c
  23. 1
    0
      src/drivers/net/rtl8139.c
  24. 3
    3
      src/drivers/net/sundance.c
  25. 3
    3
      src/drivers/net/tlan.c
  26. 1
    1
      src/drivers/net/tulip.c
  27. 3
    3
      src/drivers/net/via-velocity.c
  28. 4
    2
      src/hci/shell.c
  29. 4
    2
      src/hci/strerror.c
  30. 4
    4
      src/hci/tui/settings_ui.c
  31. 1
    1
      src/include/background.h
  32. 1
    1
      src/include/console.h
  33. 3
    3
      src/include/dev.h
  34. 2
    1
      src/include/gpxe/arp.h
  35. 1
    1
      src/include/gpxe/command.h
  36. 3
    3
      src/include/gpxe/device.h
  37. 1
    1
      src/include/gpxe/errortab.h
  38. 1
    1
      src/include/gpxe/init.h
  39. 5
    2
      src/include/gpxe/netdevice.h
  40. 3
    3
      src/include/gpxe/pci.h
  41. 3
    2
      src/include/gpxe/settings.h
  42. 12
    12
      src/include/gpxe/tables.h
  43. 4
    2
      src/include/gpxe/tcpip.h
  44. 4
    4
      src/include/image.h
  45. 1
    1
      src/include/isa.h
  46. 5
    5
      src/include/proto.h
  47. 1
    1
      src/include/resolv.h
  48. 2
    2
      src/net/arp.c
  49. 8
    4
      src/net/netdevice.c
  50. 8
    8
      src/net/tcpip.c
  51. 3
    2
      src/usr/ifmgmt.c

+ 3
- 0
src/arch/i386/drivers/net/undi.c View File

@@ -19,6 +19,7 @@
19 19
 #include <stdint.h>
20 20
 #include <stdlib.h>
21 21
 #include <string.h>
22
+#include <vsprintf.h>
22 23
 #include <gpxe/pci.h>
23 24
 #include <undi.h>
24 25
 #include <undirom.h>
@@ -96,6 +97,8 @@ static int undipci_probe ( struct pci_device *pci,
96 97
 	}
97 98
 
98 99
 	/* Add to device hierarchy */
100
+	snprintf ( undi->dev.name, sizeof ( undi->dev.name ),
101
+		   "UNDI%04x:%04x", undi->entry.segment, undi->entry.offset );
99 102
 	undi->dev.parent = &pci->dev;
100 103
 	INIT_LIST_HEAD ( &undi->dev.children );
101 104
 	list_add ( &undi->dev.siblings, &pci->dev.children );

+ 1
- 0
src/arch/i386/drivers/net/undinet.c View File

@@ -577,6 +577,7 @@ int undinet_probe ( struct undi_device *undi ) {
577 577
 		return -ENOMEM;
578 578
 	undinic = netdev->priv;
579 579
 	undi_set_drvdata ( undi, netdev );
580
+	netdev->dev = &undi->dev;
580 581
 	memset ( undinic, 0, sizeof ( *undinic ) );
581 582
 	undinic->entry = undi->entry;
582 583
 	DBGC ( undinic, "UNDINIC %p using UNDI %p\n", undinic, undi );

+ 3
- 1
src/arch/i386/drivers/net/undionly.c View File

@@ -58,6 +58,8 @@ static int undibus_probe ( struct root_device *rootdev ) {
58 58
 	}
59 59
 
60 60
 	/* Add to device hierarchy */
61
+	strncpy ( preloaded_undi.dev.name, "UNDI",
62
+		  ( sizeof ( preloaded_undi.dev.name ) - 1 ) );
61 63
 	preloaded_undi.dev.parent = &rootdev->dev;
62 64
 	list_add ( &preloaded_undi.dev.siblings, &rootdev->dev.children);
63 65
 	INIT_LIST_HEAD ( &preloaded_undi.dev.children );
@@ -91,6 +93,6 @@ static struct root_driver undi_root_driver = {
91 93
 
92 94
 /** UNDI bus root device */
93 95
 struct root_device undi_root_device __root_device = {
94
-	.name = "UNDI",
96
+	.dev = { .name = "UNDI" },
95 97
 	.driver = &undi_root_driver,
96 98
 };

+ 4
- 2
src/core/background.c View File

@@ -1,7 +1,9 @@
1 1
 #include "background.h"
2 2
 
3
-static struct background backgrounds[0] __table_start ( background );
4
-static struct background backgrounds_end[0] __table_end ( background );
3
+static struct background backgrounds[0]
4
+	__table_start ( struct background, background );
5
+static struct background backgrounds_end[0]
6
+	__table_end ( struct background, background );
5 7
 
6 8
 /** @file */
7 9
 

+ 4
- 2
src/core/console.c View File

@@ -6,8 +6,10 @@
6 6
 
7 7
 #include "bios.h"
8 8
 
9
-static struct console_driver console_drivers[0] __table_start ( console );
10
-static struct console_driver console_drivers_end[0] __table_end ( console );
9
+static struct console_driver console_drivers[0]
10
+	__table_start ( struct console_driver, console );
11
+static struct console_driver console_drivers_end[0]
12
+	__table_end ( struct console_driver, console );
11 13
 
12 14
 /**
13 15
  * Write a single character to each console device.

+ 8
- 4
src/core/dev.c View File

@@ -10,10 +10,14 @@
10 10
  */
11 11
 
12 12
 /* Linker symbols for the various tables */
13
-static struct bus_driver bus_drivers[0] __table_start ( bus_driver );
14
-static struct bus_driver bus_drivers_end[0] __table_end ( bus_driver );
15
-static struct device_driver device_drivers[0] __table_start ( device_driver );
16
-static struct device_driver device_drivers_end[0] __table_end (device_driver );
13
+static struct bus_driver bus_drivers[0]
14
+	__table_start ( struct bus_driver, bus_driver );
15
+static struct bus_driver bus_drivers_end[0]
16
+	__table_end ( struct bus_driver, bus_driver );
17
+static struct device_driver device_drivers[0]
18
+	__table_start ( struct device_driver, device_driver );
19
+static struct device_driver device_drivers_end[0]
20
+	__table_end ( struct device_driver, device_driver );
17 21
 
18 22
 /* Current attempted boot device */
19 23
 struct dev dev = {

+ 7
- 5
src/core/device.c View File

@@ -28,8 +28,10 @@
28 28
  *
29 29
  */
30 30
 
31
-static struct root_device root_devices[0] __table_start ( root_devices );
32
-static struct root_device root_devices_end[0] __table_end ( root_devices );
31
+static struct root_device root_devices[0]
32
+	__table_start ( struct root_device, root_devices );
33
+static struct root_device root_devices_end[0]
34
+	__table_end ( struct root_device, root_devices );
33 35
 
34 36
 /** Registered root devices */
35 37
 static LIST_HEAD ( devices );
@@ -43,10 +45,10 @@ static LIST_HEAD ( devices );
43 45
 static int rootdev_probe ( struct root_device *rootdev ) {
44 46
 	int rc;
45 47
 
46
-	DBG ( "Adding %s root bus\n", rootdev->name );
48
+	DBG ( "Adding %s root bus\n", rootdev->dev.name );
47 49
 	if ( ( rc = rootdev->driver->probe ( rootdev ) ) != 0 ) {
48 50
 		DBG ( "Failed to add %s root bus: %s\n",
49
-		      rootdev->name, strerror ( rc ) );
51
+		      rootdev->dev.name, strerror ( rc ) );
50 52
 		return rc;
51 53
 	}
52 54
 
@@ -60,7 +62,7 @@ static int rootdev_probe ( struct root_device *rootdev ) {
60 62
  */
61 63
 static void rootdev_remove ( struct root_device *rootdev ) {
62 64
 	rootdev->driver->remove ( rootdev );
63
-	DBG ( "Removed %s root bus\n", rootdev->name );
65
+	DBG ( "Removed %s root bus\n", rootdev->dev.name );
64 66
 }
65 67
 
66 68
 /**

+ 4
- 2
src/core/exec.c View File

@@ -33,8 +33,10 @@
33 33
  *
34 34
  */
35 35
 
36
-static struct command commands[0] __table_start ( commands );
37
-static struct command commands_end[0] __table_end ( commands );
36
+static struct command commands[0]
37
+	__table_start ( struct command, commands );
38
+static struct command commands_end[0]
39
+	__table_end ( struct command, commands );
38 40
 
39 41
 /* Avoid dragging in getopt.o unless a command really uses it */
40 42
 int optind;

+ 4
- 2
src/core/init.c View File

@@ -9,8 +9,10 @@
9 9
 
10 10
 #include <gpxe/init.h>
11 11
 
12
-static struct init_fn init_fns[0] __table_start(init_fn);
13
-static struct init_fn init_fns_end[0] __table_end(init_fn);
12
+static struct init_fn init_fns[0]
13
+	__table_start ( struct init_fn, init_fn );
14
+static struct init_fn init_fns_end[0]
15
+	__table_end ( struct init_fn, init_fn );
14 16
 
15 17
 void call_init_fns ( void ) {
16 18
 	struct init_fn *init_fn;

+ 4
- 2
src/core/resolv.c View File

@@ -1,7 +1,9 @@
1 1
 #include "resolv.h"
2 2
 
3
-static struct resolver resolvers[0] __table_start(resolver);
4
-static struct resolver resolvers_end[0] __table_end(resolver);
3
+static struct resolver resolvers[0]
4
+	__table_start ( struct resolver, resolver );
5
+static struct resolver resolvers_end[0]
6
+	__table_end ( struct resolver, resolver );
5 7
 
6 8
 /*
7 9
  * Resolve a name (which may be just a dotted quad IP address) to an

+ 8
- 8
src/core/settings.c View File

@@ -34,16 +34,16 @@
34 34
  */
35 35
 
36 36
 /** Registered configuration setting types */
37
-static struct config_setting_type
38
-config_setting_types[0] __table_start ( config_setting_types );
39
-static struct config_setting_type
40
-config_setting_types_end[0] __table_end ( config_setting_types );
37
+static struct config_setting_type config_setting_types[0]
38
+	__table_start ( struct config_setting_type, config_setting_types );
39
+static struct config_setting_type config_setting_types_end[0]
40
+	__table_end ( struct config_setting_type, config_setting_types );
41 41
 
42 42
 /** Registered configuration settings */
43
-static struct config_setting
44
-config_settings[0] __table_start ( config_settings );
45
-static struct config_setting
46
-config_settings_end[0] __table_end ( config_settings );
43
+static struct config_setting config_settings[0]
44
+	__table_start ( struct config_setting, config_settings );
45
+static struct config_setting config_settings_end[0]
46
+	__table_end ( struct config_setting, config_settings );
47 47
 
48 48
 /**
49 49
  * Find configuration setting type

+ 4
- 2
src/drivers/bus/isa.c View File

@@ -45,8 +45,10 @@ static isa_probe_addr_t isa_extra_probe_addrs[] = {
45 45
  * Symbols defined by linker
46 46
  *
47 47
  */
48
-static struct isa_driver isa_drivers[0] __table_start ( isa_driver );
49
-static struct isa_driver isa_drivers_end[0] __table_end ( isa_driver );
48
+static struct isa_driver isa_drivers[0]
49
+	__table_start ( struct isa_driver, isa_driver );
50
+static struct isa_driver isa_drivers_end[0]
51
+	__table_end ( struct isa_driver, isa_driver );
50 52
 
51 53
 /*
52 54
  * Increment a bus_loc structure to the next possible ISA location.

+ 11
- 5
src/drivers/bus/pci.c View File

@@ -23,6 +23,7 @@
23 23
 #include <stdlib.h>
24 24
 #include <string.h>
25 25
 #include <errno.h>
26
+#include <vsprintf.h>
26 27
 #include <gpxe/tables.h>
27 28
 #include <gpxe/device.h>
28 29
 #include <gpxe/pci.h>
@@ -33,8 +34,10 @@
33 34
  *
34 35
  */
35 36
 
36
-static struct pci_driver pci_drivers[0] __table_start ( pci_drivers );
37
-static struct pci_driver pci_drivers_end[0] __table_end ( pci_drivers );
37
+static struct pci_driver pci_drivers[0]
38
+	__table_start ( struct pci_driver, pci_drivers );
39
+static struct pci_driver pci_drivers_end[0]
40
+	__table_end ( struct pci_driver, pci_drivers );
38 41
 
39 42
 static void pcibus_remove ( struct root_device *rootdev );
40 43
 
@@ -194,8 +197,8 @@ static int pci_probe ( struct pci_device *pci ) {
194 197
 			     ( id->device != pci->device ) )
195 198
 				continue;
196 199
 			pci->driver = driver;
197
-			pci->name = id->name;
198
-			DBG ( "...using driver %s\n", pci->name );
200
+			pci->driver_name = id->name;
201
+			DBG ( "...using driver %s\n", pci->driver_name );
199 202
 			if ( ( rc = driver->probe ( pci, id ) ) != 0 ) {
200 203
 				DBG ( "......probe failed\n" );
201 204
 				continue;
@@ -276,6 +279,9 @@ static int pcibus_probe ( struct root_device *rootdev ) {
276 279
 			pci_read_bases ( pci );
277 280
 
278 281
 			/* Add to device hierarchy */
282
+			snprintf ( pci->dev.name, sizeof ( pci->dev.name ),
283
+				   "PCI%02x:%02x.%x", bus,
284
+				   PCI_SLOT ( devfn ), PCI_FUNC ( devfn ) );
279 285
 			pci->dev.parent = &rootdev->dev;
280 286
 			list_add ( &pci->dev.siblings, &rootdev->dev.children);
281 287
 			INIT_LIST_HEAD ( &pci->dev.children );
@@ -325,6 +331,6 @@ static struct root_driver pci_root_driver = {
325 331
 
326 332
 /** PCI bus root device */
327 333
 struct root_device pci_root_device __root_device = {
328
-	.name = "PCI",
334
+	.dev = { .name = "PCI" },
329 335
 	.driver = &pci_root_driver,
330 336
 };

+ 2
- 2
src/drivers/net/dmfe.c View File

@@ -457,7 +457,7 @@ static int dmfe_probe ( struct nic *nic, struct pci_device *pci ) {
457 457
 
458 458
 	BASE = pci->ioaddr;
459 459
 	printf("dmfe.c: Found %s Vendor=0x%hX Device=0x%hX\n",
460
-	       pci->name, pci->vendor, pci->device);
460
+	       pci->driver_name, pci->vendor, pci->device);
461 461
 
462 462
 	/* Read Chip revision */
463 463
 	pci_read_config_dword(pci, PCI_REVISION_ID, &dev_rev);
@@ -488,7 +488,7 @@ static int dmfe_probe ( struct nic *nic, struct pci_device *pci ) {
488 488
 		nic->node_addr[i] = db->srom[20 + i];
489 489
 
490 490
 	/* Print out some hardware info */
491
-	DBG ( "%s: %s at ioaddr %4.4lx\n", pci->name, eth_ntoa ( nic->node_addr ), BASE );
491
+	DBG ( "%s: %s at ioaddr %4.4lx\n", pci->driver_name, eth_ntoa ( nic->node_addr ), BASE );
492 492
 
493 493
 	/* Set the card as PCI Bus Master */
494 494
 	adjust_pci_device(pci);

+ 5
- 5
src/drivers/net/forcedeth.c View File

@@ -1246,7 +1246,7 @@ static int forcedeth_probe ( struct nic *nic, struct pci_device *pci ) {
1246 1246
 		return 0;
1247 1247
 
1248 1248
 	printf("forcedeth.c: Found %s, vendor=0x%hX, device=0x%hX\n",
1249
-	       pci->name, pci->vendor, pci->device);
1249
+	       pci->driver_name, pci->vendor, pci->device);
1250 1250
 
1251 1251
 	pci_fill_nic ( nic, pci );
1252 1252
 
@@ -1306,7 +1306,7 @@ static int forcedeth_probe ( struct nic *nic, struct pci_device *pci ) {
1306 1306
 	}
1307 1307
 #endif
1308 1308
 
1309
-	DBG ( "%s: MAC Address %s\n", pci->name, eth_ntoa ( nic->node_addr ) );
1309
+	DBG ( "%s: MAC Address %s\n", pci->driver_name, eth_ntoa ( nic->node_addr ) );
1310 1310
 
1311 1311
  	/* disable WOL */
1312 1312
 	writel(0, base + NvRegWakeUpFlags);
@@ -1381,7 +1381,7 @@ static int forcedeth_probe ( struct nic *nic, struct pci_device *pci ) {
1381 1381
  		id2 = (id2 & PHYID2_OUI_MASK) >> PHYID2_OUI_SHFT;
1382 1382
  		dprintf
1383 1383
 			(("%s: open: Found PHY %hX:%hX at address %d.\n",
1384
-			  pci->name, id1, id2, i));
1384
+			  pci->driver_name, id1, id2, i));
1385 1385
  		np->phyaddr = i;
1386 1386
  		np->phy_oui = id1 | id2;
1387 1387
  		break;
@@ -1391,7 +1391,7 @@ static int forcedeth_probe ( struct nic *nic, struct pci_device *pci ) {
1391 1391
  		 * test loopback? Very odd, but can be correct.
1392 1392
  		 */
1393 1393
  		printf
1394
-			("%s: open: Could not find a valid PHY.\n", pci->name);
1394
+			("%s: open: Could not find a valid PHY.\n", pci->driver_name);
1395 1395
  	}
1396 1396
 	
1397 1397
  	if (i != 32) {
@@ -1400,7 +1400,7 @@ static int forcedeth_probe ( struct nic *nic, struct pci_device *pci ) {
1400 1400
  	}
1401 1401
 	
1402 1402
 	dprintf(("%s: forcedeth.c: subsystem: %hX:%hX bound to %s\n",
1403
-		 pci->name, pci->vendor, pci->dev_id, pci->name));
1403
+		 pci->driver_name, pci->vendor, pci->dev_id, pci->driver_name));
1404 1404
 	if(!forcedeth_reset(nic)) return 0; // no valid link
1405 1405
 
1406 1406
 	/* point to NIC specific routines */

+ 1
- 0
src/drivers/net/legacy.c View File

@@ -84,6 +84,7 @@ int legacy_probe ( struct pci_device *pci,
84 84
 	netdev->priv = &nic;
85 85
 	memset ( &nic, 0, sizeof ( nic ) );
86 86
 	pci_set_drvdata ( pci, netdev );
87
+	netdev->dev = &pci->dev;
87 88
 
88 89
 	netdev->open = legacy_open;
89 90
 	netdev->close = legacy_close;

+ 1
- 1
src/drivers/net/mtd80x.c View File

@@ -677,7 +677,7 @@ static int mtd_probe ( struct nic *nic, struct pci_device *pci ) {
677 677
     pci_fill_nic ( nic, pci );
678 678
     adjust_pci_device(pci);
679 679
 
680
-    mtdx.nic_name = pci->name;
680
+    mtdx.nic_name = pci->driver_name;
681 681
     mtdx.dev_id = pci->device;
682 682
     mtdx.ioaddr = nic->ioaddr;
683 683
 

+ 1
- 1
src/drivers/net/natsemi.c View File

@@ -262,7 +262,7 @@ natsemi_probe ( struct nic *nic, struct pci_device *pci ) {
262 262
     ioaddr     = pci->ioaddr;
263 263
     vendor     = pci->vendor;
264 264
     dev_id     = pci->device;
265
-    nic_name   = pci->name;
265
+    nic_name   = pci->driver_name;
266 266
 
267 267
     /* natsemi has a non-standard PM control register
268 268
      * in PCI config space.  Some boards apparently need

+ 7
- 7
src/drivers/net/ns83820.c View File

@@ -821,7 +821,7 @@ static int ns83820_probe ( struct nic *nic, struct pci_device *pci ) {
821 821
 		return 0;
822 822
 
823 823
 	printf("ns83820.c: Found %s, vendor=0x%hX, device=0x%hX\n",
824
-	       pci->name, pci->vendor, pci->device);
824
+	       pci->driver_name, pci->vendor, pci->device);
825 825
 
826 826
 	/* point to private storage */
827 827
 	ns = &nsx;
@@ -860,12 +860,12 @@ static int ns83820_probe ( struct nic *nic, struct pci_device *pci ) {
860 860
 	ns->CFG_cache = readl(ns->base + CFG);
861 861
 
862 862
 	if ((ns->CFG_cache & CFG_PCI64_DET)) {
863
-		printf("%s: detected 64 bit PCI data bus.\n", pci->name);
863
+		printf("%s: detected 64 bit PCI data bus.\n", pci->driver_name);
864 864
 		/*dev->CFG_cache |= CFG_DATA64_EN; */
865 865
 		if (!(ns->CFG_cache & CFG_DATA64_EN))
866 866
 			printf
867 867
 			    ("%s: EEPROM did not enable 64 bit bus.  Disabled.\n",
868
-			     pci->name);
868
+			     pci->driver_name);
869 869
 	} else
870 870
 		ns->CFG_cache &= ~(CFG_DATA64_EN);
871 871
 
@@ -895,7 +895,7 @@ static int ns83820_probe ( struct nic *nic, struct pci_device *pci ) {
895 895
 
896 896
 	/* setup optical transceiver if we have one */
897 897
 	if (ns->CFG_cache & CFG_TBI_EN) {
898
-		dprintf(("%s: enabling optical transceiver\n", pci->name));
898
+		dprintf(("%s: enabling optical transceiver\n", pci->driver_name));
899 899
 		writel(readl(ns->base + GPIOR) | 0x3e8, ns->base + GPIOR);
900 900
 
901 901
 		/* setup auto negotiation feature advertisement */
@@ -916,7 +916,7 @@ static int ns83820_probe ( struct nic *nic, struct pci_device *pci ) {
916 916
 
917 917
 	/* FIXME: reset_phy is defaulted to 0, should we reset anyway? */
918 918
 	if (reset_phy) {
919
-		dprintf(("%s: resetting phy\n", pci->name));
919
+		dprintf(("%s: resetting phy\n", pci->driver_name));
920 920
 		writel(ns->CFG_cache | CFG_PHY_RST, ns->base + CFG);
921 921
 		writel(ns->CFG_cache, ns->base + CFG);
922 922
 	}
@@ -981,11 +981,11 @@ static int ns83820_probe ( struct nic *nic, struct pci_device *pci ) {
981 981
 	ns83820_getmac(nic, nic->node_addr);
982 982
 
983 983
 	if (using_dac) {
984
-		dprintf(("%s: using 64 bit addressing.\n", pci->name));
984
+		dprintf(("%s: using 64 bit addressing.\n", pci->driver_name));
985 985
 	}
986 986
 
987 987
 	dprintf(("%s: DP83820 %d.%d: %! io=0x%hX\n",
988
-		 pci->name,
988
+		 pci->driver_name,
989 989
 		 (unsigned) readl(ns->base + SRR) >> 8,
990 990
 		 (unsigned) readl(ns->base + SRR) & 0xff,
991 991
 		 nic->node_addr, pci->ioaddr));

+ 1
- 1
src/drivers/net/pcnet32.c View File

@@ -678,7 +678,7 @@ static int pcnet32_probe ( struct nic *nic, struct pci_device *pci ) {
678 678
 	/* BASE is used throughout to address the card */
679 679
 	ioaddr = pci->ioaddr;
680 680
 	printf("pcnet32.c: Found %s, Vendor=0x%hX Device=0x%hX\n",
681
-	       pci->name, pci->vendor, pci->device);
681
+	       pci->driver_name, pci->vendor, pci->device);
682 682
 
683 683
 	nic->irqno  = 0;
684 684
 	pci_fill_nic ( nic, pci );

+ 1
- 0
src/drivers/net/pnic.c View File

@@ -234,6 +234,7 @@ static int pnic_probe ( struct pci_device *pci,
234 234
 	}
235 235
 	pnic = netdev->priv;
236 236
 	pci_set_drvdata ( pci, netdev );
237
+	netdev->dev = &pci->dev;
237 238
 	pnic->ioaddr = pci->ioaddr;
238 239
 
239 240
 	/* API version check */

+ 5
- 5
src/drivers/net/r8169.c View File

@@ -884,7 +884,7 @@ static int r8169_probe ( struct nic *nic, struct pci_device *pci ) {
884 884
 	int option = -1, Cap10_100 = 0, Cap1000 = 0;
885 885
 
886 886
 	printf ( "r8169.c: Found %s, Vendor=%hX Device=%hX\n",
887
-	       pci->name, pci->vendor, pci->device );
887
+	       pci->driver_name, pci->vendor, pci->device );
888 888
 
889 889
 	board_idx++;
890 890
 
@@ -899,11 +899,11 @@ static int r8169_probe ( struct nic *nic, struct pci_device *pci ) {
899 899
 	for (i = 0; i < MAC_ADDR_LEN; i++)
900 900
 		nic->node_addr[i] = RTL_R8(MAC0 + i);
901 901
 
902
-	DBG ( "%s: Identified chip type is '%s'.\n", pci->name,
902
+	DBG ( "%s: Identified chip type is '%s'.\n", pci->driver_name,
903 903
 		 rtl_chip_info[tpc->chipset].name );
904 904
 
905 905
 	/* Print out some hardware info */
906
-	DBG ( "%s: %s at IOAddr %#hX, ", pci->name, eth_ntoa ( nic->node_addr ),
906
+	DBG ( "%s: %s at IOAddr %#hX, ", pci->driver_name, eth_ntoa ( nic->node_addr ),
907 907
 	       ioaddr );
908 908
 
909 909
 	/* Config PHY */
@@ -965,7 +965,7 @@ static int r8169_probe ( struct nic *nic, struct pci_device *pci ) {
965 965
 			RTL8169_WRITE_GMII_REG(ioaddr, PHY_1000_CTRL_REG,
966 966
 					       Cap1000);
967 967
 		} else {
968
-			DBG ( "%s: Auto-negotiation Enabled.\n",  pci->name );
968
+			DBG ( "%s: Auto-negotiation Enabled.\n",  pci->driver_name );
969 969
 
970 970
 			// enable 10/100 Full/Half Mode, leave PHY_AUTO_NEGO_REG bit4:0 unchanged
971 971
 			RTL8169_WRITE_GMII_REG(ioaddr, PHY_AUTO_NEGO_REG,
@@ -1016,7 +1016,7 @@ static int r8169_probe ( struct nic *nic, struct pci_device *pci ) {
1016 1016
 		udelay(100);
1017 1017
 		printf
1018 1018
 		    ("%s: 1000Mbps Full-duplex operation, TBI Link %s!\n",
1019
-		     pci->name,
1019
+		     pci->driver_name,
1020 1020
 		     (RTL_R32(TBICSR) & TBILinkOK) ? "OK" : "Failed");
1021 1021
 
1022 1022
 	}

+ 1
- 0
src/drivers/net/rtl8139.c View File

@@ -532,6 +532,7 @@ static int rtl_probe ( struct pci_device *pci,
532 532
 	}
533 533
 	rtl = netdev->priv;
534 534
 	pci_set_drvdata ( pci, netdev );
535
+	netdev->dev = &pci->dev;
535 536
 	memset ( rtl, 0, sizeof ( *rtl ) );
536 537
 	rtl->ioaddr = pci->ioaddr;
537 538
 

+ 3
- 3
src/drivers/net/sundance.c View File

@@ -581,7 +581,7 @@ static int sundance_probe ( struct nic *nic, struct pci_device *pci ) {
581 581
 	/* BASE is used throughout to address the card */
582 582
 	BASE = pci->ioaddr;
583 583
 	printf(" sundance.c: Found %s Vendor=0x%hX Device=0x%hX\n",
584
-	       pci->name, pci->vendor, pci->device);
584
+	       pci->driver_name, pci->vendor, pci->device);
585 585
 
586 586
 	/* Get the MAC Address by reading the EEPROM */
587 587
 	for (i = 0; i < 3; i++) {
@@ -603,7 +603,7 @@ static int sundance_probe ( struct nic *nic, struct pci_device *pci ) {
603 603
 	/* point to private storage */
604 604
 	sdc = &sdx;
605 605
 
606
-	sdc->nic_name = pci->name;
606
+	sdc->nic_name = pci->driver_name;
607 607
 	sdc->mtu = mtu;
608 608
 
609 609
 	pci_read_config_byte(pci, PCI_REVISION_ID, &sdc->pci_rev_id);
@@ -611,7 +611,7 @@ static int sundance_probe ( struct nic *nic, struct pci_device *pci ) {
611 611
 	DBG ( "Device revision id: %hx\n", sdc->pci_rev_id );
612 612
 
613 613
 	/* Print out some hardware info */
614
-	DBG ( "%s: %s at ioaddr %hX, ", pci->name, nic->node_addr, BASE);
614
+	DBG ( "%s: %s at ioaddr %hX, ", pci->driver_name, nic->node_addr, BASE);
615 615
 
616 616
 	sdc->mii_preamble_required = 0;
617 617
 	if (1) {

+ 3
- 3
src/drivers/net/tlan.c View File

@@ -809,7 +809,7 @@ static int tlan_probe ( struct nic *nic, struct pci_device *pci ) {
809 809
 
810 810
 	priv->vendor_id = pci->vendor;
811 811
 	priv->dev_id = pci->device;
812
-	priv->nic_name = pci->name;
812
+	priv->nic_name = pci->driver_name;
813 813
 	priv->eoc = 0;
814 814
 
815 815
 	err = 0;
@@ -820,10 +820,10 @@ static int tlan_probe ( struct nic *nic, struct pci_device *pci ) {
820 820
 				       (u8 *) & nic->node_addr[i]);
821 821
 	if (err) {
822 822
   	    printf ( "TLAN: %s: Error reading MAC from eeprom: %d\n",
823
-		    pci->name, err);
823
+		    pci->driver_name, err);
824 824
 	} else {
825 825
 	    DBG ( "%s: %s at ioaddr %#lX, ", 
826
-		  pci->name, eth_ntoa ( nic->node_addr ), pci->ioaddr );
826
+		  pci->driver_name, eth_ntoa ( nic->node_addr ), pci->ioaddr );
827 827
 	}
828 828
 
829 829
 	priv->tlanRev = TLan_DioRead8(BASE, TLAN_DEF_REVISION);

+ 1
- 1
src/drivers/net/tulip.c View File

@@ -1252,7 +1252,7 @@ static int tulip_probe ( struct nic *nic, struct pci_device *pci ) {
1252 1252
 
1253 1253
     tp->vendor_id  = pci->vendor;
1254 1254
     tp->dev_id     = pci->device;
1255
-    tp->nic_name   = pci->name;
1255
+    tp->nic_name   = pci->driver_name;
1256 1256
 
1257 1257
     tp->if_port = 0;
1258 1258
     tp->default_port = 0;

+ 3
- 3
src/drivers/net/via-velocity.c View File

@@ -673,7 +673,7 @@ static int velocity_probe(struct pci_device *dev, struct pci_device *pci)
673 673
 	struct mac_regs *regs;
674 674
 
675 675
 	printf("via-velocity.c: Found %s Vendor=0x%hX Device=0x%hX\n",
676
-	       pci->name, pci->vendor, pci->device);
676
+	       pci->driver_name, pci->vendor, pci->device);
677 677
 
678 678
 	/* point to private storage */
679 679
 	vptr = &vptx;
@@ -705,9 +705,9 @@ static int velocity_probe(struct pci_device *dev, struct pci_device *pci)
705 705
 	for (i = 0; i < 6; i++)
706 706
 		nic->node_addr[i] = readb(&regs->PAR[i]);
707 707
 
708
-	DBG ( "%s: %s at ioaddr %#hX\n", pci->name, eth_ntoa ( nic->node_addr ), BASE );
708
+	DBG ( "%s: %s at ioaddr %#hX\n", pci->driver_name, eth_ntoa ( nic->node_addr ), BASE );
709 709
 
710
-	velocity_get_options(&vptr->options, 0, pci->name);
710
+	velocity_get_options(&vptr->options, 0, pci->driver_name);
711 711
 
712 712
 	/* 
713 713
 	 *      Mask out the options cannot be set to the chip

+ 4
- 2
src/hci/shell.c View File

@@ -29,8 +29,10 @@
29 29
  *
30 30
  */
31 31
 
32
-static struct command commands[0] __table_start ( commands );
33
-static struct command commands_end[0] __table_end ( commands );
32
+static struct command commands[0]
33
+	__table_start ( struct command, commands );
34
+static struct command commands_end[0]
35
+	__table_end ( struct command, commands );
34 36
 
35 37
 /** The shell prompt string */
36 38
 static const char shell_prompt[] = "gPXE> ";

+ 4
- 2
src/hci/strerror.c View File

@@ -18,8 +18,10 @@
18 18
  *
19 19
  */
20 20
 
21
-static struct errortab errortab_start[0] __table_start(errortab);
22
-static struct errortab errortab_end[0] __table_end(errortab);
21
+static struct errortab errortab_start[0]
22
+	__table_start ( struct errortab, errortab );
23
+static struct errortab errortab_end[0]
24
+	__table_end ( struct errortab, errortab );
23 25
 
24 26
 /**
25 27
  * Retrieve string representation of error number.

+ 4
- 4
src/hci/tui/settings_ui.c View File

@@ -81,10 +81,10 @@ struct setting_widget {
81 81
 };
82 82
 
83 83
 /** Registered configuration settings */
84
-static struct config_setting
85
-config_settings[0] __table_start ( config_settings );
86
-static struct config_setting
87
-config_settings_end[0] __table_end ( config_settings );
84
+static struct config_setting config_settings[0]
85
+	__table_start ( struct config_setting, config_settings );
86
+static struct config_setting config_settings_end[0]
87
+	__table_end ( struct config_setting, config_settings );
88 88
 #define NUM_SETTINGS ( ( unsigned ) ( config_settings_end - config_settings ) )
89 89
 
90 90
 /**

+ 1
- 1
src/include/background.h View File

@@ -40,7 +40,7 @@ struct background {
40 40
 };
41 41
 
42 42
 /** A member of the background protocols table */
43
-#define __background __table ( background, 01 )
43
+#define __background __table ( struct background, background, 01 )
44 44
 
45 45
 /* Functions in background.c */
46 46
 

+ 1
- 1
src/include/console.h View File

@@ -93,7 +93,7 @@ struct console_driver {
93 93
  * @endcode
94 94
  *
95 95
  */
96
-#define __console_driver __table ( console, 01 )
96
+#define __console_driver __table ( struct console_driver, console, 01 )
97 97
 
98 98
 /* Function prototypes */
99 99
 

+ 3
- 3
src/include/dev.h View File

@@ -155,7 +155,7 @@ struct bus_driver {
155 155
 	const char * ( *name_device ) ( struct bus_dev *bus_dev );
156 156
 };
157 157
 
158
-#define __bus_driver __table ( bus_driver, 01 )
158
+#define __bus_driver __table ( struct bus_driver, bus_driver, 01 )
159 159
 
160 160
 /*
161 161
  * A structure fully describing the bus-independent parts of a
@@ -181,7 +181,7 @@ struct type_driver {
181 181
 	int ( * load ) ( struct type_dev *type_dev, struct buffer *buffer );
182 182
 };
183 183
 
184
-#define __type_driver __table ( type_driver, 01 )
184
+#define __type_driver __table ( struct type_driver, type_driver, 01 )
185 185
 
186 186
 /*
187 187
  * A driver for a device.
@@ -198,7 +198,7 @@ struct device_driver {
198 198
 			     struct bus_dev *bus_dev );
199 199
 };
200 200
 
201
-#define __device_driver __table ( device_driver, 01 )
201
+#define __device_driver __table ( struct device_driver, device_driver, 01 )
202 202
 
203 203
 #if 0
204 204
 #define DRIVER(_name,_type_driver,_bus_driver,_bus_info,	 	      \

+ 2
- 1
src/include/gpxe/arp.h View File

@@ -27,7 +27,8 @@ struct arp_net_protocol {
27 27
 };
28 28
 
29 29
 /** Declare an ARP protocol */
30
-#define __arp_net_protocol __table ( arp_net_protocols, 01 )
30
+#define __arp_net_protocol \
31
+	__table ( struct arp_net_protocol, arp_net_protocols, 01 )
31 32
 
32 33
 extern int arp_resolve ( struct net_device *netdev,
33 34
 			 struct net_protocol *net_protocol,

+ 1
- 1
src/include/gpxe/command.h View File

@@ -17,6 +17,6 @@ struct command {
17 17
 	int ( * exec ) ( int argc, char **argv );
18 18
 };
19 19
 
20
-#define __command __table ( commands, 01 )
20
+#define __command __table ( struct command, commands, 01 )
21 21
 
22 22
 #endif /* _GPXE_COMMAND_H */

+ 3
- 3
src/include/gpxe/device.h View File

@@ -13,6 +13,8 @@
13 13
 
14 14
 /** A hardware device */
15 15
 struct device {
16
+	/** Name */
17
+	char name[16];
16 18
 	/** Devices on the same bus */
17 19
 	struct list_head siblings;
18 20
 	/** Devices attached to this device */
@@ -28,8 +30,6 @@ struct device {
28 30
  *
29 31
  */
30 32
 struct root_device {
31
-	/** Name */
32
-	const char *name;
33 33
 	/** Device chain
34 34
 	 *
35 35
 	 * A root device has a NULL parent field.
@@ -62,7 +62,7 @@ struct root_driver {
62 62
 };
63 63
 
64 64
 /** Declare a root device */
65
-#define __root_device __table ( root_devices, 01 )
65
+#define __root_device __table ( struct root_device, root_devices, 01 )
66 66
 
67 67
 extern int probe_devices ( void );
68 68
 extern void remove_devices ( void );

+ 1
- 1
src/include/gpxe/errortab.h View File

@@ -15,6 +15,6 @@ struct errortab {
15 15
 	const char *text;
16 16
 };
17 17
 
18
-#define __errortab __table ( errortab, 01 )
18
+#define __errortab __table ( struct errortab, errortab, 01 )
19 19
 
20 20
 #endif /* _GPXE_ERRORTAB_H */

+ 1
- 1
src/include/gpxe/init.h View File

@@ -46,7 +46,7 @@ struct init_fn {
46 46
 /* Macro for creating an initialisation function table entry */
47 47
 #define INIT_FN( init_order, init_func, reset_func, exit_func )	\
48 48
 	struct init_fn PREFIX_OBJECT(init_fn__)			\
49
-	    __table ( init_fn, init_order ) = {			\
49
+	    __table ( struct init_fn, init_fn, init_order ) = {	\
50 50
 		.init = init_func,				\
51 51
 		.reset = reset_func,				\
52 52
 		.exit = exit_func,				\

+ 5
- 2
src/include/gpxe/netdevice.h View File

@@ -16,6 +16,7 @@ struct pk_buff;
16 16
 struct net_device;
17 17
 struct net_protocol;
18 18
 struct ll_protocol;
19
+struct device;
19 20
 
20 21
 /** Maximum length of a link-layer address */
21 22
 #define MAX_LL_ADDR_LEN 6
@@ -140,6 +141,8 @@ struct net_device {
140 141
 	struct list_head list;
141 142
 	/** Name of this network device */
142 143
 	char name[8];
144
+	/** Underlying hardware device */
145
+	struct device *dev;
143 146
 	/** List of persistent reference holders */
144 147
 	struct list_head references;
145 148
 
@@ -219,10 +222,10 @@ struct net_device {
219 222
 #define NETDEV_OPEN 0x0001
220 223
 
221 224
 /** Declare a link-layer protocol */
222
-#define __ll_protocol  __table ( ll_protocols, 01 )
225
+#define __ll_protocol  __table ( struct ll_protocol, ll_protocols, 01 )
223 226
 
224 227
 /** Declare a network-layer protocol */
225
-#define __net_protocol __table ( net_protocols, 01 )
228
+#define __net_protocol __table ( struct net_protocol, net_protocols, 01 )
226 229
 
227 230
 extern struct list_head net_devices;
228 231
 

+ 3
- 3
src/include/gpxe/pci.h View File

@@ -277,8 +277,8 @@ struct pci_device {
277 277
 	 * field.
278 278
 	 */
279 279
 	void *priv;
280
-	/** Device name */
281
-	const char *name;
280
+	/** Driver name */
281
+	const char *driver_name;
282 282
 };
283 283
 
284 284
 /** A PCI driver */
@@ -305,7 +305,7 @@ struct pci_driver {
305 305
 };
306 306
 
307 307
 /** Declare a PCI driver */
308
-#define __pci_driver __table ( pci_drivers, 01 )
308
+#define __pci_driver __table ( struct pci_driver, pci_drivers, 01 )
309 309
 
310 310
 #define PCI_DEVFN( slot, func )	( ( (slot) << 3 ) | (func) )
311 311
 #define PCI_SLOT( devfn )	( ( (devfn) >> 3 ) & 0x1f )

+ 3
- 2
src/include/gpxe/settings.h View File

@@ -66,7 +66,8 @@ struct config_setting_type {
66 66
 };
67 67
 
68 68
 /** Declare a configuration setting type */
69
-#define	__config_setting_type __table ( config_setting_types, 01 )
69
+#define	__config_setting_type \
70
+	__table ( struct config_setting_type, config_setting_types, 01 )
70 71
 
71 72
 /**
72 73
  * A configuration setting
@@ -98,7 +99,7 @@ struct config_setting {
98 99
 };
99 100
 
100 101
 /** Declare a configuration setting */
101
-#define	__config_setting __table ( config_settings, 01 )
102
+#define	__config_setting __table ( struct config_setting, config_settings, 01 )
102 103
 
103 104
 /**
104 105
  * Show value of setting

+ 12
- 12
src/include/gpxe/tables.h View File

@@ -165,16 +165,17 @@
165 165
  */
166 166
 
167 167
 #ifdef DOXYGEN
168
-#define __attribute__(x)
168
+#define __attribute__( x )
169 169
 #endif
170 170
 
171
-#define __table_str(x) #x
172
-#define __table_section(table,idx) \
173
-	__section__ ( ".tbl." __table_str(table) "." __table_str(idx) )
171
+#define __table_str( x ) #x
172
+#define __table_section( table, idx ) \
173
+	__section__ ( ".tbl." __table_str ( table ) "." __table_str ( idx ) )
174 174
 
175
-#define __table_section_start(table) __table_section(table,00)
176
-#define __table_section_end(table) __table_section(table,99)
175
+#define __table_section_start( table ) __table_section ( table, 00 )
176
+#define __table_section_end( table ) __table_section ( table, 99 )
177 177
 
178
+#define __natural_alignment( type ) __aligned__ ( __alignof__ ( type ) )
178 179
 
179 180
 /**
180 181
  * Linker table entry.
@@ -191,8 +192,9 @@
191 192
  * @endcode
192 193
  *
193 194
  */
194
-#define __table(table,idx) \
195
-	__attribute__ (( __table_section(table,idx) ))
195
+#define __table( type, table, idx )				\
196
+	__attribute__ (( __table_section ( table, idx ),	\
197
+			 __natural_alignment ( type ) ))
196 198
 
197 199
 /**
198 200
  * Linker table start marker.
@@ -207,8 +209,7 @@
207 209
  * @endcode
208 210
  *
209 211
  */
210
-#define __table_start(table) \
211
-	__attribute__ (( __table_section_start(table) ))
212
+#define __table_start( type, table ) __table ( type, table, 00 )
212 213
 
213 214
 /**
214 215
  * Linker table end marker.
@@ -223,7 +224,6 @@
223 224
  * @endcode
224 225
  *
225 226
  */
226
-#define __table_end(table) \
227
-	__attribute__ (( __table_section_end(table) ))
227
+#define __table_end( type, table ) __table ( type, table, 99 )
228 228
 
229 229
 #endif /* _GPXE_TABLES_H */

+ 4
- 2
src/include/gpxe/tcpip.h View File

@@ -99,10 +99,12 @@ struct tcpip_net_protocol {
99 99
 };
100 100
 
101 101
 /** Declare a TCP/IP transport-layer protocol */
102
-#define	__tcpip_protocol __table ( tcpip_protocols, 01 )
102
+#define	__tcpip_protocol \
103
+	__table ( struct tcpip_protocol, tcpip_protocols, 01 )
103 104
 
104 105
 /** Declare a TCP/IP network-layer protocol */
105
-#define	__tcpip_net_protocol __table ( tcpip_net_protocols, 01 )
106
+#define	__tcpip_net_protocol \
107
+	__table ( struct tcpip_net_protocol, tcpip_net_protocols, 01 )
106 108
 
107 109
 extern int tcpip_rx ( struct pk_buff *pkb, uint8_t tcpip_proto,
108 110
 		      struct sockaddr_tcpip *st_src,

+ 4
- 4
src/include/image.h View File

@@ -13,10 +13,10 @@ struct image {
13 13
 	int ( * boot ) ( void *context );
14 14
 };
15 15
 
16
-#define __image_start		__table_start(image)
17
-#define __image			__table(image,01)
18
-#define __default_image		__table(image,02)
19
-#define __image_end		__table_end(image)
16
+#define __image_start		__table_start ( struct image, image )
17
+#define __image			__table ( struct image, image, 01 )
18
+#define __default_image		__table ( struct image, image, 02 )
19
+#define __image_end		__table_end ( struct image, image )
20 20
 
21 21
 /* Functions in image.c */
22 22
 

+ 1
- 1
src/include/isa.h View File

@@ -54,7 +54,7 @@ struct isa_driver {
54 54
  *
55 55
  */
56 56
 #define ISA_DRIVER( _name, _probe_addrs, _probe_addr, _mfg_id, _prod_id )   \
57
-struct isa_driver _name __table(isa_driver,01 ) = {			    \
57
+struct isa_driver _name __table ( struct isa_driver, isa_driver, 01 ) = {   \
58 58
 	.probe_addrs = _probe_addrs,					    \
59 59
 	.addr_count = sizeof ( _probe_addrs ) / sizeof ( _probe_addrs[0] ), \
60 60
 	.probe_addr = _probe_addr,					    \

+ 5
- 5
src/include/proto.h View File

@@ -18,11 +18,11 @@ struct protocol {
18 18
  * should use __protocol.
19 19
  *
20 20
  */
21
-#define __protocol_start		__table_start(protocol)
22
-#define __protocol			__table(protocol,01)
23
-#define __default_protocol_start	__table(protocol,02)
24
-#define __default_protocol		__table(protocol,03)
25
-#define __protocol_end			__table_end(protocol)
21
+#define __protocol_start	 __table_start ( struct protocol, protocol )
22
+#define __protocol		 __table ( struct protocol, protocol, 01 )
23
+#define __default_protocol_start __table ( struct protocol, protocol, 02 )
24
+#define __default_protocol	 __table ( struct protocol, protocol, 03 )
25
+#define __protocol_end		 __table_end ( struct protocol, protocol )
26 26
 
27 27
 /*
28 28
  * Functions in proto.c

+ 1
- 1
src/include/resolv.h View File

@@ -9,7 +9,7 @@ struct resolver {
9 9
 	int ( * resolv ) ( struct in_addr *address, const char *name );
10 10
 };
11 11
 
12
-#define __resolver __table(resolver,01)
12
+#define __resolver __table ( struct resolver, resolver, 01 )
13 13
 
14 14
 extern int resolv ( struct in_addr *address, const char *name );
15 15
 

+ 2
- 2
src/net/arp.c View File

@@ -38,9 +38,9 @@
38 38
 
39 39
 /** Registered ARP protocols */
40 40
 static struct arp_net_protocol arp_net_protocols[0]
41
-	__table_start ( arp_net_protocols );
41
+	__table_start ( struct arp_net_protocol, arp_net_protocols );
42 42
 static struct arp_net_protocol arp_net_protocols_end[0]
43
-	__table_end ( arp_net_protocols );
43
+	__table_end ( struct arp_net_protocol, arp_net_protocols );
44 44
 
45 45
 /** An ARP cache entry */
46 46
 struct arp_entry {

+ 8
- 4
src/net/netdevice.c View File

@@ -27,6 +27,7 @@
27 27
 #include <gpxe/tables.h>
28 28
 #include <gpxe/process.h>
29 29
 #include <gpxe/init.h>
30
+#include <gpxe/device.h>
30 31
 #include <gpxe/netdevice.h>
31 32
 
32 33
 /** @file
@@ -36,8 +37,10 @@
36 37
  */
37 38
 
38 39
 /** Registered network-layer protocols */
39
-static struct net_protocol net_protocols[0] __table_start ( net_protocols );
40
-static struct net_protocol net_protocols_end[0] __table_end ( net_protocols );
40
+static struct net_protocol net_protocols[0]
41
+	__table_start ( struct net_protocol, net_protocols );
42
+static struct net_protocol net_protocols_end[0]
43
+	__table_end ( struct net_protocol, net_protocols );
41 44
 
42 45
 /** List of network devices */
43 46
 struct list_head net_devices = LIST_HEAD_INIT ( net_devices );
@@ -200,8 +203,9 @@ int register_netdev ( struct net_device *netdev ) {
200 203
 
201 204
 	/* Add to device list */
202 205
 	list_add_tail ( &netdev->list, &net_devices );
203
-	DBGC ( netdev, "NETDEV %p registered as %s (%s)\n",
204
-	       netdev, netdev->name, netdev_hwaddr ( netdev ) );
206
+	DBGC ( netdev, "NETDEV %p registered as %s (phys %s hwaddr %s)\n",
207
+	       netdev, netdev->name, netdev->dev->name,
208
+	       netdev_hwaddr ( netdev ) );
205 209
 
206 210
 	return 0;
207 211
 }

+ 8
- 8
src/net/tcpip.c View File

@@ -15,16 +15,16 @@
15 15
  */
16 16
 
17 17
 /** Registered network-layer protocols that support TCP/IP */
18
-static struct tcpip_net_protocol
19
-tcpip_net_protocols[0] __table_start ( tcpip_net_protocols );
20
-static struct tcpip_net_protocol
21
-tcpip_net_protocols_end[0] __table_end ( tcpip_net_protocols );
18
+static struct tcpip_net_protocol tcpip_net_protocols[0]
19
+	__table_start ( struct tcpip_net_protocol, tcpip_net_protocols );
20
+static struct tcpip_net_protocol tcpip_net_protocols_end[0]
21
+	__table_end ( struct tcpip_net_protocol, tcpip_net_protocols );
22 22
 
23 23
 /** Registered transport-layer protocols that support TCP/IP */
24
-static struct tcpip_protocol
25
-tcpip_protocols[0]__table_start ( tcpip_protocols );
26
-static struct tcpip_protocol
27
-tcpip_protocols_end[0] __table_end ( tcpip_protocols );
24
+static struct tcpip_protocol tcpip_protocols[0]
25
+	__table_start ( struct tcpip_protocol, tcpip_protocols );
26
+static struct tcpip_protocol tcpip_protocols_end[0]
27
+	__table_end ( struct tcpip_protocol, tcpip_protocols );
28 28
 
29 29
 /** Process a received TCP/IP packet
30 30
  *

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

@@ -19,6 +19,7 @@
19 19
 #include <string.h>
20 20
 #include <vsprintf.h>
21 21
 #include <gpxe/netdevice.h>
22
+#include <gpxe/device.h>
22 23
 #include <usr/ifmgmt.h>
23 24
 
24 25
 /** @file
@@ -60,7 +61,7 @@ void ifclose ( struct net_device *netdev ) {
60 61
  * @v netdev		Network device
61 62
  */
62 63
 void ifstat ( struct net_device *netdev ) {
63
-	printf ( "%s %s %s\n",
64
-		 netdev->name, netdev_hwaddr ( netdev ),
64
+	printf ( "%s: %s on %s (%s)\n",
65
+		 netdev->name, netdev_hwaddr ( netdev ), netdev->dev->name,
65 66
 		 ( ( netdev->state & NETDEV_OPEN ) ? "open" : "closed" ) );
66 67
 }

Loading…
Cancel
Save