The MII stuff did not work at all, this is at least an improvement for that; apparently,
probing/attaching the MII bus should come later, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22806 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include <compat/dev/mii/miivar.h>
|
#include <compat/dev/mii/miivar.h>
|
||||||
|
|
||||||
#define DEBUG_PCI
|
//#define DEBUG_PCI
|
||||||
#ifdef DEBUG_PCI
|
#ifdef DEBUG_PCI
|
||||||
# define TRACE_PCI(dev, format, args...) device_printf(dev, format , ##args)
|
# define TRACE_PCI(dev, format, args...) device_printf(dev, format , ##args)
|
||||||
#else
|
#else
|
||||||
@@ -352,6 +352,7 @@ device_add_child(device_t dev, const char *name, int order)
|
|||||||
if (child == NULL)
|
if (child == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
snprintf(child->dev_name, sizeof(child->dev_name), "%s", name);
|
||||||
child->parent = dev;
|
child->parent = dev;
|
||||||
list_add_item(&dev->children, child);
|
list_add_item(&dev->children, child);
|
||||||
|
|
||||||
@@ -370,10 +371,12 @@ __haiku_probe_miibus(device_t dev, driver_t *drivers[], int count)
|
|||||||
_resolve_method(drivers[i], "device_probe");
|
_resolve_method(drivers[i], "device_probe");
|
||||||
if (probe) {
|
if (probe) {
|
||||||
int result = probe(dev);
|
int result = probe(dev);
|
||||||
if (result >= 0) {
|
// the ukphy driver (fallback for unknown PHYs) return -100 here
|
||||||
|
if (result >= -100) {
|
||||||
if (selected == NULL || result > selcost) {
|
if (selected == NULL || result > selcost) {
|
||||||
selected = drivers[i];
|
selected = drivers[i];
|
||||||
selcost = result;
|
selcost = result;
|
||||||
|
device_printf(dev, "Found MII: %s\n", selected->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -392,15 +395,20 @@ bus_generic_attach(device_t dev)
|
|||||||
if (child->driver == NULL) {
|
if (child->driver == NULL) {
|
||||||
if (dev->driver == &miibus_driver) {
|
if (dev->driver == &miibus_driver) {
|
||||||
driver_t *driver = __haiku_select_miibus_driver(child);
|
driver_t *driver = __haiku_select_miibus_driver(child);
|
||||||
|
|
||||||
if (driver)
|
if (driver)
|
||||||
device_set_driver(child, driver);
|
device_set_driver(child, driver);
|
||||||
|
else {
|
||||||
|
struct mii_attach_args *ma = device_get_ivars(child);
|
||||||
|
|
||||||
|
device_printf(dev, "No PHY module found (%x/%x)!\n", ma->mii_id1,
|
||||||
|
ma->mii_id2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (child->driver == &miibus_driver) {
|
||||||
|
child->methods.probe(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->driver == NULL)
|
if (child->driver != NULL)
|
||||||
panic("can't attach unknown driver");
|
|
||||||
}
|
|
||||||
|
|
||||||
child->methods.attach(child);
|
child->methods.attach(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user