freebsd11_network: More changes for freebsd11_wlan.
This commit is contained in:
@@ -41,6 +41,7 @@ KernelStaticLibrary libfreebsd11_network.a :
|
|||||||
mutex.c
|
mutex.c
|
||||||
priv.cpp
|
priv.cpp
|
||||||
smp.c
|
smp.c
|
||||||
|
subr_autoconf.cpp
|
||||||
synch.c
|
synch.c
|
||||||
systm.c
|
systm.c
|
||||||
taskqueue.c
|
taskqueue.c
|
||||||
|
|||||||
@@ -160,7 +160,7 @@
|
|||||||
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
||||||
#else
|
#else
|
||||||
#define __offsetof(type, field) \
|
#define __offsetof(type, field) \
|
||||||
(__offsetof__ (reinterpret_cast <size_t> \
|
((reinterpret_cast <size_t> \
|
||||||
(&reinterpret_cast <const volatile char &> \
|
(&reinterpret_cast <const volatile char &> \
|
||||||
(static_cast<type *> (0)->field))))
|
(static_cast<type *> (0)->field))))
|
||||||
#endif
|
#endif
|
||||||
@@ -307,6 +307,10 @@
|
|||||||
#define __UNCONST(var) ((void*)(uintptr_t)(const void *)(var))
|
#define __UNCONST(var) ((void*)(uintptr_t)(const void *)(var))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __DEVOLATILE
|
||||||
|
#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
|
||||||
|
#endif
|
||||||
|
|
||||||
#if __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
|
#if __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
|
||||||
/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
|
/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
|
||||||
#elif defined(__COUNTER__)
|
#elif defined(__COUNTER__)
|
||||||
|
|||||||
@@ -205,10 +205,13 @@ extern void __haiku_reenable_interrupts(device_t dev);
|
|||||||
extern int __haiku_driver_requirements;
|
extern int __haiku_driver_requirements;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
FBSD_TASKQUEUES = 1 << 0,
|
FBSD_TASKQUEUES = 1 << 0,
|
||||||
FBSD_FAST_TASKQUEUE = 1 << 1,
|
FBSD_FAST_TASKQUEUE = 1 << 1,
|
||||||
FBSD_SWI_TASKQUEUE = 1 << 2,
|
FBSD_SWI_TASKQUEUE = 1 << 2,
|
||||||
FBSD_WLAN = 1 << 3,
|
FBSD_THREAD_TASKQUEUE = 1 << 3,
|
||||||
|
FBSD_WLAN_FEATURE = 1 << 4,
|
||||||
|
FBSD_WLAN = FBSD_WLAN_FEATURE | FBSD_TASKQUEUES
|
||||||
|
| FBSD_THREAD_TASKQUEUE,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define HAIKU_DRIVER_REQUIREMENTS(flags) \
|
#define HAIKU_DRIVER_REQUIREMENTS(flags) \
|
||||||
|
|||||||
@@ -29,21 +29,15 @@
|
|||||||
|
|
||||||
#define ticks_to_usecs(t) (1000000*((bigtime_t)t) / hz)
|
#define ticks_to_usecs(t) (1000000*((bigtime_t)t) / hz)
|
||||||
|
|
||||||
typedef void (*system_init_func_t)(void *);
|
extern int32 ticks;
|
||||||
|
|
||||||
|
|
||||||
|
typedef void (*system_init_func_t)(void *);
|
||||||
|
|
||||||
struct __system_init {
|
struct __system_init {
|
||||||
system_init_func_t func;
|
system_init_func_t func;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*ich_func_t)(void *_arg);
|
|
||||||
|
|
||||||
struct intr_config_hook {
|
|
||||||
TAILQ_ENTRY(intr_config_hook) ich_links;
|
|
||||||
ich_func_t ich_func;
|
|
||||||
void *ich_arg;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* TODO implement SYSINIT/SYSUNINIT subsystem */
|
/* TODO implement SYSINIT/SYSUNINIT subsystem */
|
||||||
#define SYSINIT(uniquifier, subsystem, order, func, ident) \
|
#define SYSINIT(uniquifier, subsystem, order, func, ident) \
|
||||||
struct __system_init __init_##uniquifier = { (system_init_func_t) func }
|
struct __system_init __init_##uniquifier = { (system_init_func_t) func }
|
||||||
@@ -51,9 +45,21 @@ struct intr_config_hook {
|
|||||||
#define SYSUNINIT(uniquifier, subsystem, order, func, ident) \
|
#define SYSUNINIT(uniquifier, subsystem, order, func, ident) \
|
||||||
struct __system_init __uninit_##uniquifier = { (system_init_func_t) func }
|
struct __system_init __uninit_##uniquifier = { (system_init_func_t) func }
|
||||||
|
|
||||||
|
|
||||||
#define TUNABLE_INT(path, var)
|
#define TUNABLE_INT(path, var)
|
||||||
#define TUNABLE_INT_FETCH(path, var)
|
#define TUNABLE_INT_FETCH(path, var)
|
||||||
|
|
||||||
extern int32 ticks;
|
|
||||||
|
|
||||||
#endif
|
typedef void (*ich_func_t)(void *_arg);
|
||||||
|
|
||||||
|
struct intr_config_hook {
|
||||||
|
TAILQ_ENTRY(intr_config_hook) ich_links;
|
||||||
|
ich_func_t ich_func;
|
||||||
|
void *ich_arg;
|
||||||
|
};
|
||||||
|
|
||||||
|
int config_intrhook_establish(struct intr_config_hook *hook);
|
||||||
|
void config_intrhook_disestablish(struct intr_config_hook *hook);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _FBSD_COMPAT_SYS_KERNEL_H_
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ extern struct mtx Giant;
|
|||||||
|
|
||||||
|
|
||||||
void mtx_init(struct mtx*, const char*, const char*, int);
|
void mtx_init(struct mtx*, const char*, const char*, int);
|
||||||
|
void mtx_sysinit(void *arg);
|
||||||
void mtx_destroy(struct mtx*);
|
void mtx_destroy(struct mtx*);
|
||||||
|
|
||||||
|
|
||||||
@@ -89,4 +90,22 @@ mtx_owned(struct mtx* mutex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct mtx_args {
|
||||||
|
void *ma_mtx;
|
||||||
|
const char *ma_desc;
|
||||||
|
int ma_opts;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MTX_SYSINIT(name, mtx, desc, opts) \
|
||||||
|
static struct mtx_args name##_args = { \
|
||||||
|
(mtx), \
|
||||||
|
(desc), \
|
||||||
|
(opts) \
|
||||||
|
}; \
|
||||||
|
SYSINIT(name##_mtx_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
|
||||||
|
mtx_sysinit, &name##_args); \
|
||||||
|
SYSUNINIT(name##_mtx_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \
|
||||||
|
mtx_destroy, __DEVOLATILE(void *, &(mtx)->mtx_lock))
|
||||||
|
|
||||||
|
|
||||||
#endif /* _FBSD_COMPAT_SYS_MUTEX_H_ */
|
#endif /* _FBSD_COMPAT_SYS_MUTEX_H_ */
|
||||||
|
|||||||
@@ -76,8 +76,15 @@ sysctl_ctx_free(struct sysctl_ctx_list *clist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
sysctl_wire_old_buffer(struct sysctl_req *req, size_t len)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
sysctl_add_oid(struct sysctl_ctx_list *clist, void *parent, int nbr,
|
sysctl_add_oid(struct sysctl_ctx_list *clist, void *parent, int nbr,
|
||||||
const char *name, int kind, void *arg1, int arg2,
|
const char *name, int kind, void *arg1, int arg2,
|
||||||
int (*handler) (SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr)
|
int (*handler) (SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ void taskqueue_thread_enqueue(void *context);
|
|||||||
|
|
||||||
extern struct taskqueue *taskqueue_fast;
|
extern struct taskqueue *taskqueue_fast;
|
||||||
extern struct taskqueue *taskqueue_swi;
|
extern struct taskqueue *taskqueue_swi;
|
||||||
|
extern struct taskqueue *taskqueue_thread;
|
||||||
|
|
||||||
int taskqueue_enqueue_fast(struct taskqueue *queue, struct task *task);
|
int taskqueue_enqueue_fast(struct taskqueue *queue, struct task *task);
|
||||||
struct taskqueue *taskqueue_create_fast(const char *name, int mflags,
|
struct taskqueue *taskqueue_create_fast(const char *name, int mflags,
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ compat_open(const char *name, uint32 flags, void **cookie)
|
|||||||
|
|
||||||
ifp->if_init(ifp->if_softc);
|
ifp->if_init(ifp->if_softc);
|
||||||
|
|
||||||
if (!HAIKU_DRIVER_REQUIRES(FBSD_WLAN)) {
|
if (!HAIKU_DRIVER_REQUIRES(FBSD_WLAN_FEATURE)) {
|
||||||
ifp->if_flags &= ~IFF_UP;
|
ifp->if_flags &= ~IFF_UP;
|
||||||
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
|
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,16 @@ mtx_init(struct mtx *mutex, const char *name, const char *type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
mtx_sysinit(void *arg)
|
||||||
|
{
|
||||||
|
struct mtx_args *margs = arg;
|
||||||
|
|
||||||
|
mtx_init((struct mtx *)margs->ma_mtx, margs->ma_desc, NULL,
|
||||||
|
margs->ma_opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mtx_destroy(struct mtx *mutex)
|
mtx_destroy(struct mtx *mutex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018, Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Augustin Cavalier <waddlesplash>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
# include <sys/kernel.h>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
config_intrhook_establish(struct intr_config_hook *hook)
|
||||||
|
{
|
||||||
|
// By the time we get here, interrupts have already been set up, so
|
||||||
|
// unlike FreeBSD we do not need to store the hooks in a queue for later,
|
||||||
|
// but we can call them immediately. This is the same behavior that
|
||||||
|
// FreeBSD has as of 11.1 (however, they have a comment stating that
|
||||||
|
// it should probably not happen this way...)
|
||||||
|
(*hook->ich_func)(hook->ich_arg);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
config_intrhook_disestablish(struct intr_config_hook *hook)
|
||||||
|
{
|
||||||
|
// We don't store the hooks, so we don't need to do anything here.
|
||||||
|
}
|
||||||
@@ -336,8 +336,26 @@ init_taskqueues()
|
|||||||
goto err_2;
|
goto err_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HAIKU_DRIVER_REQUIRES(FBSD_THREAD_TASKQUEUE)) {
|
||||||
|
taskqueue_thread = taskqueue_create_fast("thread taskq", 0,
|
||||||
|
taskqueue_thread_enqueue, &taskqueue_thread);
|
||||||
|
if (taskqueue_thread == NULL) {
|
||||||
|
status = B_NO_MEMORY;
|
||||||
|
goto err_2;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = taskqueue_start_threads(&taskqueue_thread, 1,
|
||||||
|
B_REAL_TIME_PRIORITY, "swi taskq");
|
||||||
|
if (status < B_OK)
|
||||||
|
goto err_3;
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
|
err_3:
|
||||||
|
if (taskqueue_thread)
|
||||||
|
taskqueue_free(taskqueue_thread);
|
||||||
|
|
||||||
err_2:
|
err_2:
|
||||||
if (taskqueue_swi)
|
if (taskqueue_swi)
|
||||||
taskqueue_free(taskqueue_swi);
|
taskqueue_free(taskqueue_swi);
|
||||||
@@ -353,6 +371,9 @@ err_1:
|
|||||||
void
|
void
|
||||||
uninit_taskqueues()
|
uninit_taskqueues()
|
||||||
{
|
{
|
||||||
|
if (HAIKU_DRIVER_REQUIRES(FBSD_THREAD_TASKQUEUE))
|
||||||
|
taskqueue_free(taskqueue_thread);
|
||||||
|
|
||||||
if (HAIKU_DRIVER_REQUIRES(FBSD_SWI_TASKQUEUE))
|
if (HAIKU_DRIVER_REQUIRES(FBSD_SWI_TASKQUEUE))
|
||||||
taskqueue_free(taskqueue_swi);
|
taskqueue_free(taskqueue_swi);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user