* Added miibus_linkchg and miibus_mediainit methods to device_set_driver(); this was the actual

reason the MII bus did not work as mediainit was never called.
* Got rid of the delayed MII bus scanning again; not only did it not solve the problem, it was
  also completely unnecessary.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22812 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-11-03 13:00:12 +00:00
parent 38d3e0e20c
commit 7242a223a1
3 changed files with 10 additions and 30 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright 2007, Hugo Santos, hugosantos@gmail.com. All Rights Reserved.
* Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All Rights Reserved.
* Copyright 2004, Marcus Overhagen. All Rights Reserved.
*
* Distributed under the terms of the MIT License.
@ -310,6 +311,10 @@ device_set_driver(device_t dev, driver_t *driver)
dev->methods.miibus_writereg = (void *)mth->method;
else if (strcmp(mth->name, "miibus_statchg") == 0)
dev->methods.miibus_statchg = (void *)mth->method;
else if (!strcmp(mth->name, "miibus_linkchg"))
dev->methods.miibus_linkchg = (void *)mth->method;
else if (!strcmp(mth->name, "miibus_mediainit"))
dev->methods.miibus_mediainit = (void *)mth->method;
}
return 0;
@ -393,19 +398,11 @@ __haiku_probe_miibus(device_t dev, driver_t *drivers[], int count)
void
__haiku_scan_miibus(device_t dev)
bus_generic_attach(device_t dev)
{
device_t miibus = NULL;
device_t 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) {
while ((child = list_get_next_item(&dev->children, child)) != NULL) {
if (child->driver == NULL) {
driver_t *driver = __haiku_select_miibus_driver(child);
if (driver) {
@ -417,18 +414,7 @@ __haiku_scan_miibus(device_t dev)
device_printf(dev, "No PHY module found (%x/%x)!\n", ma->mii_id1,
ma->mii_id2);
}
}
}
}
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)
} else if (child->driver == &miibus_driver)
child->methods.probe(child);
if (child->driver != NULL)

View File

@ -54,7 +54,6 @@ 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.

View File

@ -1,11 +1,8 @@
/*
* Copyright 2007, Hugo Santos. All Rights Reserved.
* Copyright 2004, Marcus Overhagen. All Rights Reserved.
*
* Distributed under the terms of the MIT License.
*
* Authors:
* Hugo Santos, hugosantos@gmail.com
*
* Some of this code is based on previous work by Marcus Overhagen.
*/
#include "device.h"
@ -127,8 +124,6 @@ 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);