summaryrefslogtreecommitdiffstats
path: root/src/drivers/bus
diff options
context:
space:
mode:
authorMichael Brown2007-01-10 05:22:09 +0100
committerMichael Brown2007-01-10 05:22:09 +0100
commitdad52745227fd06090e73ea535e0b0fe0f667c60 (patch)
tree6be296bedc785a5aab0d055ae148c6ffb1fe285f /src/drivers/bus
parentRemove uIP; we haven't used it for quite some time now. (diff)
downloadipxe-dad52745227fd06090e73ea535e0b0fe0f667c60.tar.gz
ipxe-dad52745227fd06090e73ea535e0b0fe0f667c60.tar.xz
ipxe-dad52745227fd06090e73ea535e0b0fe0f667c60.zip
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).
Diffstat (limited to 'src/drivers/bus')
-rw-r--r--src/drivers/bus/isa.c6
-rw-r--r--src/drivers/bus/pci.c16
2 files changed, 15 insertions, 7 deletions
diff --git a/src/drivers/bus/isa.c b/src/drivers/bus/isa.c
index 7529f1a2..d8b88fdb 100644
--- a/src/drivers/bus/isa.c
+++ b/src/drivers/bus/isa.c
@@ -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.
diff --git a/src/drivers/bus/pci.c b/src/drivers/bus/pci.c
index e7528e3c..11a8e0a0 100644
--- a/src/drivers/bus/pci.c
+++ b/src/drivers/bus/pci.c
@@ -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,
};