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:
@@ -31,6 +31,9 @@ struct net_stack_module_info *gStack;
|
|||||||
pci_module_info *gPci;
|
pci_module_info *gPci;
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - PCI
|
||||||
|
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
pci_read_config(device_t dev, int offset, int size)
|
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
|
void
|
||||||
driver_printf(const char *format, ...)
|
driver_printf(const char *format, ...)
|
||||||
{
|
{
|
||||||
@@ -387,26 +393,43 @@ __haiku_probe_miibus(device_t dev, driver_t *drivers[], int count)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
bus_generic_attach(device_t dev)
|
__haiku_scan_miibus(device_t dev)
|
||||||
{
|
{
|
||||||
|
device_t miibus = NULL;
|
||||||
device_t child = 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 (child->driver == NULL) {
|
||||||
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 {
|
child->methods.attach(child);
|
||||||
|
} else {
|
||||||
struct mii_attach_args *ma = device_get_ivars(child);
|
struct mii_attach_args *ma = device_get_ivars(child);
|
||||||
|
|
||||||
device_printf(dev, "No PHY module found (%x/%x)!\n", ma->mii_id1,
|
device_printf(dev, "No PHY module found (%x/%x)!\n", ma->mii_id1,
|
||||||
ma->mii_id2);
|
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)
|
if (child->driver != NULL)
|
||||||
child->methods.attach(child);
|
child->methods.attach(child);
|
||||||
@@ -430,6 +453,9 @@ device_is_attached(device_t dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - Misc, Malloc
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
printf(const char *format, ...)
|
printf(const char *format, ...)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ void _fbsd_uninit_driver(driver_t *);
|
|||||||
extern const char gDriverName[];
|
extern const char gDriverName[];
|
||||||
driver_t *__haiku_select_miibus_driver(device_t dev);
|
driver_t *__haiku_select_miibus_driver(device_t dev);
|
||||||
driver_t *__haiku_probe_miibus(device_t dev, driver_t *drivers[], int count);
|
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
|
/* we define the driver methods with HAIKU_FBSD_DRIVER_GLUE to
|
||||||
* force the rest of the stuff to be linked back with the driver.
|
* force the rest of the stuff to be linked back with the driver.
|
||||||
|
|||||||
@@ -127,6 +127,8 @@ compat_open(const char *name, uint32 flags, void **cookie)
|
|||||||
struct ifnet *ifp = dev->ifp;
|
struct ifnet *ifp = dev->ifp;
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
|
|
||||||
|
__haiku_scan_miibus(DEVNET(dev));
|
||||||
|
|
||||||
ifp->if_flags &= ~IFF_UP;
|
ifp->if_flags &= ~IFF_UP;
|
||||||
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
|
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user