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).
This commit is contained in:
Michael Brown
2007-01-10 04:22:09 +00:00
parent cc9b32c405
commit dad5274522
51 changed files with 184 additions and 135 deletions

View File

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

View File

@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <vsprintf.h>
#include <gpxe/tables.h>
#include <gpxe/device.h>
#include <gpxe/pci.h>
@@ -33,8 +34,10 @@
*
*/
static struct pci_driver pci_drivers[0] __table_start ( pci_drivers );
static struct pci_driver pci_drivers_end[0] __table_end ( pci_drivers );
static struct pci_driver pci_drivers[0]
__table_start ( struct pci_driver, pci_drivers );
static struct pci_driver pci_drivers_end[0]
__table_end ( struct pci_driver, pci_drivers );
static void pcibus_remove ( struct root_device *rootdev );
@@ -194,8 +197,8 @@ static int pci_probe ( struct pci_device *pci ) {
( id->device != pci->device ) )
continue;
pci->driver = driver;
pci->name = id->name;
DBG ( "...using driver %s\n", pci->name );
pci->driver_name = id->name;
DBG ( "...using driver %s\n", pci->driver_name );
if ( ( rc = driver->probe ( pci, id ) ) != 0 ) {
DBG ( "......probe failed\n" );
continue;
@@ -276,6 +279,9 @@ static int pcibus_probe ( struct root_device *rootdev ) {
pci_read_bases ( pci );
/* Add to device hierarchy */
snprintf ( pci->dev.name, sizeof ( pci->dev.name ),
"PCI%02x:%02x.%x", bus,
PCI_SLOT ( devfn ), PCI_FUNC ( devfn ) );
pci->dev.parent = &rootdev->dev;
list_add ( &pci->dev.siblings, &rootdev->dev.children);
INIT_LIST_HEAD ( &pci->dev.children );
@@ -325,6 +331,6 @@ static struct root_driver pci_root_driver = {
/** PCI bus root device */
struct root_device pci_root_device __root_device = {
.name = "PCI",
.dev = { .name = "PCI" },
.driver = &pci_root_driver,
};