First cut at a fix to the FreeBSD rtl9139 driver. Some drivers require softc to
be initialized when probe(0 is called. The driver now loads and works for a while until it hangs. Looking into it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22826 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -390,6 +390,15 @@ _fbsd_init_hardware(driver_t *driver)
|
|||||||
|
|
||||||
memset(&fakeDevice, 0, sizeof(struct device));
|
memset(&fakeDevice, 0, sizeof(struct device));
|
||||||
|
|
||||||
|
// Some drivers, like the rtl8139 one require softc to be initialized
|
||||||
|
// before probe() is called.
|
||||||
|
// TODO(bga): Check if the fact that whatever initialization that is
|
||||||
|
// made here is essential as fakeDevice is local to this function and
|
||||||
|
// ceases to exist after we return.
|
||||||
|
DEVNET(&fakeDevice)->softc = malloc(driver->softc_size);
|
||||||
|
if (DEVNET(&fakeDevice)->softc == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
for (i = 0; gPci->get_nth_pci_info(i, &fakeDevice.pci_info) == B_OK; i++) {
|
for (i = 0; gPci->get_nth_pci_info(i, &fakeDevice.pci_info) == B_OK; i++) {
|
||||||
int result;
|
int result;
|
||||||
result = probe(DEVNET(&fakeDevice));
|
result = probe(DEVNET(&fakeDevice));
|
||||||
@@ -399,6 +408,9 @@ _fbsd_init_hardware(driver_t *driver)
|
|||||||
if (DEVNET(&fakeDevice)->flags & DEVICE_DESC_ALLOCED)
|
if (DEVNET(&fakeDevice)->flags & DEVICE_DESC_ALLOCED)
|
||||||
free((char *)DEVNET(&fakeDevice)->description);
|
free((char *)DEVNET(&fakeDevice)->description);
|
||||||
put_module(B_PCI_MODULE_NAME);
|
put_module(B_PCI_MODULE_NAME);
|
||||||
|
|
||||||
|
// Clean up softc.
|
||||||
|
free(DEVNET(&fakeDevice)->softc);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -406,6 +418,9 @@ _fbsd_init_hardware(driver_t *driver)
|
|||||||
dprintf("%s: no hardware found.\n", gDriverName);
|
dprintf("%s: no hardware found.\n", gDriverName);
|
||||||
put_module(B_PCI_MODULE_NAME);
|
put_module(B_PCI_MODULE_NAME);
|
||||||
|
|
||||||
|
// Clean up softc.
|
||||||
|
free(DEVNET(&fakeDevice)->softc);
|
||||||
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user