Delayed scanning the MII bus until the first ifm_media has been set for the

device.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22807 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-11-02 18:24:05 +00:00
parent 2949df37ae
commit 84eb0b5f5b
3 changed files with 43 additions and 14 deletions
+33 -7
View File
@@ -31,6 +31,9 @@ struct net_stack_module_info *gStack;
pci_module_info *gPci;
// #pragma mark - PCI
uint32_t
pci_read_config(device_t dev, int offset, int size)
{
@@ -131,6 +134,9 @@ pci_enable_io(device_t dev, int space)
}
// #pragma mark - Device
void
driver_printf(const char *format, ...)
{
@@ -387,26 +393,43 @@ __haiku_probe_miibus(device_t dev, driver_t *drivers[], int count)
void
bus_generic_attach(device_t dev)
__haiku_scan_miibus(device_t dev)
{
device_t miibus = NULL;
device_t child = NULL;
while ((child = list_get_next_item(&dev->children, child)) != NULL) {
// find miibus
while ((miibus = list_get_next_item(&dev->children, miibus)) != NULL) {
if (miibus->driver == &miibus_driver)
break;
}
while ((child = list_get_next_item(&miibus->children, child)) != NULL) {
if (child->driver == NULL) {
if (dev->driver == &miibus_driver) {
driver_t *driver = __haiku_select_miibus_driver(child);
if (driver)
if (driver) {
device_set_driver(child, driver);
else {
child->methods.attach(child);
} 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);
}
}
void
bus_generic_attach(device_t dev)
{
device_t child = NULL;
while ((child = list_get_next_item(&dev->children, child)) != NULL) {
if (child->driver == &miibus_driver)
child->methods.probe(child);
if (child->driver != NULL)
child->methods.attach(child);
@@ -430,6 +453,9 @@ device_is_attached(device_t dev)
}
// #pragma mark - Misc, Malloc
int
printf(const char *format, ...)
{
@@ -54,6 +54,7 @@ void _fbsd_uninit_driver(driver_t *);
extern const char gDriverName[];
driver_t *__haiku_select_miibus_driver(device_t dev);
driver_t *__haiku_probe_miibus(device_t dev, driver_t *drivers[], int count);
void __haiku_scan_miibus(device_t dev);
/* we define the driver methods with HAIKU_FBSD_DRIVER_GLUE to
* force the rest of the stuff to be linked back with the driver.
+2
View File
@@ -127,6 +127,8 @@ compat_open(const char *name, uint32 flags, void **cookie)
struct ifnet *ifp = dev->ifp;
struct ifreq ifr;
__haiku_scan_miibus(DEVNET(dev));
ifp->if_flags &= ~IFF_UP;
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);