summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/drivers/net/undionly.c
diff options
context:
space:
mode:
authorMichael Brown2016-12-05 16:45:17 +0100
committerMichael Brown2016-12-05 16:48:37 +0100
commit6997d3c2fab72732d8af0955c9c760f7f5c4562b (patch)
treef6d8d2bc42b4393c1f85d95e336922af6f3991ba /src/arch/x86/drivers/net/undionly.c
parent[romprefix] Avoid using PMM-allocated memory in UNDI loader entry point (diff)
downloadipxe-6997d3c2fab72732d8af0955c9c760f7f5c4562b.tar.gz
ipxe-6997d3c2fab72732d8af0955c9c760f7f5c4562b.tar.xz
ipxe-6997d3c2fab72732d8af0955c9c760f7f5c4562b.zip
[undi] Clean up driver and device name information
Fix the <NULL> driver name reported by "ifstat" when using the undipci driver (due to the unnecessary extra device node inserted as a child of the PCI device). Remove the "UNDI-" prefix from device names since the driver name is also now visible via "ifstat", and tidy up the device name to match the format used by standard PCI devices. The output from "ifstat" now resembles: iPXE> ifstat net0: 52:54:00:12:34:56 using undipci on 0000:00:03.0 iPXE> ifstat net0: 52:54:00:12:34:56 using undionly on 0000:00:03.0 Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/drivers/net/undionly.c')
-rw-r--r--src/arch/x86/drivers/net/undionly.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/arch/x86/drivers/net/undionly.c b/src/arch/x86/drivers/net/undionly.c
index 70dbe4bf..9c9ca127 100644
--- a/src/arch/x86/drivers/net/undionly.c
+++ b/src/arch/x86/drivers/net/undionly.c
@@ -50,6 +50,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* addition to the UNDI driver, build e.g. "bin/undi.dsk".
*/
+/** UNDI root bus device */
+static struct device undibus_dev;
+
/**
* Probe UNDI root bus
*
@@ -60,6 +63,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
static int undibus_probe ( struct root_device *rootdev ) {
struct undi_device *undi = &preloaded_undi;
+ struct device *dev = &undibus_dev;
int rc;
/* Check for a valie preloaded UNDI device */
@@ -69,34 +73,32 @@ static int undibus_probe ( struct root_device *rootdev ) {
}
/* Add to device hierarchy */
- undi->dev.driver_name = "undionly";
+ dev->driver_name = "undionly";
if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
- undi->dev.desc.bus_type = BUS_TYPE_PCI;
- undi->dev.desc.location = undi->pci_busdevfn;
- undi->dev.desc.vendor = undi->pci_vendor;
- undi->dev.desc.device = undi->pci_device;
- snprintf ( undi->dev.name, sizeof ( undi->dev.name ),
- "UNDI-PCI%02x:%02x.%x",
- PCI_BUS ( undi->pci_busdevfn ),
+ dev->desc.bus_type = BUS_TYPE_PCI;
+ dev->desc.location = undi->pci_busdevfn;
+ dev->desc.vendor = undi->pci_vendor;
+ dev->desc.device = undi->pci_device;
+ snprintf ( dev->name, sizeof ( dev->name ),
+ "0000:%02x:%02x.%x", PCI_BUS ( undi->pci_busdevfn ),
PCI_SLOT ( undi->pci_busdevfn ),
PCI_FUNC ( undi->pci_busdevfn ) );
} else if ( undi->isapnp_csn != UNDI_NO_ISAPNP_CSN ) {
- undi->dev.desc.bus_type = BUS_TYPE_ISAPNP;
- snprintf ( undi->dev.name, sizeof ( undi->dev.name ),
- "UNDI-ISAPNP" );
+ dev->desc.bus_type = BUS_TYPE_ISAPNP;
+ snprintf ( dev->name, sizeof ( dev->name ), "ISAPNP" );
}
- undi->dev.parent = &rootdev->dev;
- list_add ( &undi->dev.siblings, &rootdev->dev.children);
- INIT_LIST_HEAD ( &undi->dev.children );
+ dev->parent = &rootdev->dev;
+ list_add ( &dev->siblings, &rootdev->dev.children);
+ INIT_LIST_HEAD ( &dev->children );
/* Create network device */
- if ( ( rc = undinet_probe ( undi ) ) != 0 )
+ if ( ( rc = undinet_probe ( undi, dev ) ) != 0 )
goto err;
return 0;
err:
- list_del ( &undi->dev.siblings );
+ list_del ( &dev->siblings );
return rc;
}
@@ -107,9 +109,10 @@ static int undibus_probe ( struct root_device *rootdev ) {
*/
static void undibus_remove ( struct root_device *rootdev __unused ) {
struct undi_device *undi = &preloaded_undi;
+ struct device *dev = &undibus_dev;
undinet_remove ( undi );
- list_del ( &undi->dev.siblings );
+ list_del ( &dev->siblings );
}
/** UNDI bus root device driver */