* Fixed the KASSERT() macro - it panicked without reason.
* Fixed device_set_driver(): it needs to clear the allocated buffer (it's allocated with M_ZERO in FreeBSD). * The first mbuf buffer needs to have the M_PKTHDR flag set. * With these changes, the 3com driver now fails where it should have failed before, that is in the missing interrupt handling. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22769 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
96d028bd6a
commit
31154c5cc6
@ -283,6 +283,7 @@ device_set_driver(device_t dev, driver_t *driver)
|
|||||||
if (dev->softc == NULL)
|
if (dev->softc == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
memset(dev->softc, 0, driver->softc_size);
|
||||||
dev->driver = driver;
|
dev->driver = driver;
|
||||||
|
|
||||||
for (i = 0; method == NULL && driver->methods[i].name != NULL; i++) {
|
for (i = 0; method == NULL && driver->methods[i].name != NULL; i++) {
|
||||||
@ -387,10 +388,9 @@ __haiku_probe_miibus(device_t dev, driver_t *drivers[], int count)
|
|||||||
void
|
void
|
||||||
bus_generic_attach(device_t dev)
|
bus_generic_attach(device_t dev)
|
||||||
{
|
{
|
||||||
device_t child;
|
device_t child = NULL;
|
||||||
|
|
||||||
for (child = list_get_first_item(&dev->children);
|
for (; child != NULL; child = list_get_next_item(&dev->children, child)) {
|
||||||
child; child = list_get_next_item(&dev->children, child)) {
|
|
||||||
if (child->driver == NULL) {
|
if (child->driver == NULL) {
|
||||||
if (dev->driver == &miibus_driver) {
|
if (dev->driver == &miibus_driver) {
|
||||||
driver_t *driver = __haiku_select_miibus_driver(child);
|
driver_t *driver = __haiku_select_miibus_driver(child);
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
#define bootverbose 1
|
#define bootverbose 1
|
||||||
|
|
||||||
#define KASSERT(cond,msg) do { \
|
#define KASSERT(cond,msg) do { \
|
||||||
if (!cond) \
|
if (!(cond)) \
|
||||||
panic msg; \
|
panic msg; \
|
||||||
} while(0)
|
} while (0)
|
||||||
|
|
||||||
typedef void (*system_init_func_t)(void *);
|
typedef void (*system_init_func_t)(void *);
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <sys/sockio.h>
|
||||||
|
|
||||||
#include <Drivers.h>
|
#include <Drivers.h>
|
||||||
#include <ether_driver.h>
|
#include <ether_driver.h>
|
||||||
|
|
||||||
#include <sys/sockio.h>
|
|
||||||
|
|
||||||
#include <compat/sys/haiku-module.h>
|
#include <compat/sys/haiku-module.h>
|
||||||
|
|
||||||
#include <compat/sys/bus.h>
|
#include <compat/sys/bus.h>
|
||||||
@ -239,7 +239,7 @@ compat_write(void *cookie, off_t position, const void *buffer,
|
|||||||
device_printf(DEVNET(dev), "compat_write(%lld, %p, [%lu])\n", position,
|
device_printf(DEVNET(dev), "compat_write(%lld, %p, [%lu])\n", position,
|
||||||
buffer, *numBytes);
|
buffer, *numBytes);
|
||||||
|
|
||||||
mb = m_getcl(0, MT_DATA, 0);
|
mb = m_getcl(0, MT_DATA, M_PKTHDR);
|
||||||
if (mb == NULL)
|
if (mb == NULL)
|
||||||
return ENOBUFS;
|
return ENOBUFS;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user