freebsd compat. layer: some missing definitions as well as allowing multiple MII modules per driver.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21099 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
abb7cffa2f
commit
8a43628971
@ -4,6 +4,7 @@ HAIKU_FBSD_DRIVER_GLUE(e1000, em, pci)
|
||||
|
||||
NO_HAIKU_CHECK_DISABLE_INTERRUPTS();
|
||||
NO_HAIKU_REENABLE_INTERRUPTS();
|
||||
NO_HAIKU_FBSD_MII_DRIVER();
|
||||
|
||||
#ifdef EM_FAST_INTR
|
||||
HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_FAST_TASKQUEUE);
|
||||
|
@ -8,6 +8,9 @@
|
||||
|
||||
HAIKU_FBSD_DRIVER_GLUE(pcnet, le, pci);
|
||||
HAIKU_DRIVER_REQUIREMENTS(0);
|
||||
NO_HAIKU_FBSD_MII_DRIVER();
|
||||
|
||||
NO_HAIKU_REENABLE_INTERRUPTS();
|
||||
|
||||
/* from if_le_pci.c */
|
||||
#define PCNET_PCI_RDP 0x10
|
||||
@ -58,5 +61,3 @@ int HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) {
|
||||
|
||||
return value & LE_C0_INTR;
|
||||
}
|
||||
|
||||
NO_HAIKU_REENABLE_INTERRUPTS();
|
||||
|
@ -369,15 +369,29 @@ bus_generic_attach(device_t dev)
|
||||
child; child = list_get_next_item(&dev->children, child)) {
|
||||
if (child->driver == NULL) {
|
||||
if (dev->driver == &miibus_driver) {
|
||||
driver_t *driver = __haiku_get_miibus_driver(dev);
|
||||
int i, driver_count, driver_cost = INT_MIN;
|
||||
driver_t **drivers, *driver = NULL;
|
||||
|
||||
if (driver) {
|
||||
drivers = __haiku_get_miibus_drivers(&driver_count);
|
||||
|
||||
for (i = 0; i < driver_count; i++) {
|
||||
device_probe_t *probe = (device_probe_t *)
|
||||
_resolve_method(driver, "device_probe");
|
||||
_resolve_method(drivers[i], "device_probe");
|
||||
|
||||
if (probe && probe(child) >= 0)
|
||||
device_set_driver(child, driver);
|
||||
if (probe) {
|
||||
/* XXX this kinda reverses the original logic */
|
||||
int result = probe(child);
|
||||
if (result >= 0) {
|
||||
if (driver == NULL || result > driver_cost) {
|
||||
driver = drivers[i];
|
||||
driver_cost = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (driver)
|
||||
device_set_driver(child, driver);
|
||||
}
|
||||
|
||||
if (dev->driver == NULL)
|
||||
|
@ -52,7 +52,7 @@ status_t _fbsd_init_driver(driver_t *);
|
||||
void _fbsd_uninit_driver(driver_t *);
|
||||
|
||||
extern const char gDriverName[];
|
||||
driver_t *__haiku_get_miibus_driver(device_t dev);
|
||||
driver_t **__haiku_get_miibus_drivers(int *count);
|
||||
|
||||
/* we define the driver methods with HAIKU_FBSD_DRIVER_GLUE to
|
||||
* force the rest of the stuff to be linked back with the driver.
|
||||
@ -80,14 +80,20 @@ driver_t *__haiku_get_miibus_driver(device_t dev);
|
||||
device_hooks *find_device(const char *name) \
|
||||
{ return &gDeviceHooks; }
|
||||
|
||||
#define HAIKU_FBSD_MII_DRIVER(name) \
|
||||
driver_t *__haiku_get_miibus_driver(device_t dev) \
|
||||
{ extern driver_t *DRIVER_MODULE_NAME(name, miibus); \
|
||||
return DRIVER_MODULE_NAME(name, miibus); }
|
||||
#define HAIKU_FBSD_RETURN_MII_DRIVER(drivers, driver_count) \
|
||||
driver_t **__haiku_get_miibus_drivers(int *count) \
|
||||
{ \
|
||||
(*count) = (driver_count); \
|
||||
return (drivers); \
|
||||
}
|
||||
|
||||
#define HAIKU_NO_FBSD_MII_DRIVER() \
|
||||
driver_t *__haiku_get_miibus_driver(device_t dev) \
|
||||
{ return NULL; }
|
||||
#define HAIKU_FBSD_MII_DRIVER(name) \
|
||||
extern driver_t *DRIVER_MODULE_NAME(name, miibus); \
|
||||
HAIKU_FBSD_RETURN_MII_DRIVER( \
|
||||
&DRIVER_MODULE_NAME(name, miibus), 1)
|
||||
|
||||
#define NO_HAIKU_FBSD_MII_DRIVER() \
|
||||
HAIKU_FBSD_RETURN_MII_DRIVER(NULL, 0)
|
||||
|
||||
extern spinlock __haiku_intr_spinlock;
|
||||
extern int __haiku_disable_interrupts(device_t dev);
|
||||
@ -96,9 +102,9 @@ extern void __haiku_reenable_interrupts(device_t dev);
|
||||
#define HAIKU_CHECK_DISABLE_INTERRUPTS __haiku_disable_interrupts
|
||||
#define HAIKU_REENABLE_INTERRUPTS __haiku_reenable_interrupts
|
||||
|
||||
#define NO_HAIKU_CHECK_DISABLE_INTERRUPTS() \
|
||||
int HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) { \
|
||||
panic("should never be called."); \
|
||||
#define NO_HAIKU_CHECK_DISABLE_INTERRUPTS() \
|
||||
int HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev) { \
|
||||
panic("should never be called."); \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user