Annotation of src/sys/compat/ndis/nbcompat.c, Revision 1.7.4.2
1.7.4.1 bouyer 1: /* $NetBSD$ */
2:
1.1 rittera 3: /* nbcompat.c
4: * Implementations of some FreeBSD functions on NetBSD to make things
5: * a bit smoother.
6: */
1.7.4.1 bouyer 7:
8: #include <sys/cdefs.h>
9: __KERNEL_RCSID(0, "$NetBSD$");
10:
1.1 rittera 11: #include <sys/param.h>
12: #include <sys/systm.h>
13: #include <sys/kernel.h>
14: #include <sys/kthread.h>
15: #include <sys/proc.h>
16: #include <sys/wait.h>
17: #include <sys/unistd.h>
18: #include <sys/types.h>
19: #include <sys/errno.h>
20: #include <sys/lock.h>
1.6 ad 21: #include <sys/bus.h>
1.1 rittera 22:
23: #include <machine/stdarg.h>
24:
25: #include "nbcompat.h"
26:
27: /* note: this is also defined in ntoskrnl_var.h, but I didn't want to include
28: * the whole file here
29: */
30: #define NDIS_KSTACK_PAGES 8
31:
32: struct ndis_resource{
33: bus_space_handle_t res_handle;
34: bus_space_tag_t res_tag;
35: bus_addr_t res_base;
36: bus_size_t res_size;
37: };
38:
1.3 christos 39: int
1.4 christos 40: bus_release_resource(device_t dev, int type, int rid,
1.3 christos 41: struct ndis_resource *r)
1.1 rittera 42: {
43: switch(type) {
44: case SYS_RES_IOPORT:
45: bus_space_unmap(r->res_tag, r->res_handle, r->res_size);
46: break;
47: case SYS_RES_MEMORY:
48: bus_space_unmap(r->res_tag, r->res_handle, r->res_size);
49: break;
50: default:
51: printf("error: bus_release_resource()");
52: }
53:
54: return 0;
55: }
56:
1.3 christos 57: void
1.4 christos 58: mtx_lock(struct mtx *mutex)
1.1 rittera 59: {
1.7 ad 60: /* XXXSMP needs doing
61: */
62: //mutex_enter(mutex);
1.1 rittera 63: }
64:
1.3 christos 65: void
1.4 christos 66: mtx_unlock(struct mtx *mutex)
1.1 rittera 67: {
1.7 ad 68: //mutex_exit(mutex);
1.1 rittera 69: }
70:
1.3 christos 71: int
1.4 christos 72: device_is_attached(device_t dev)
1.1 rittera 73: {
74: /* Sure, it's attached? */
75: return TRUE;
76: }
77:
78: /* I took this from sys/kern/kern_kthread.c (in the NetBSD source tree).
79: * The only difference is the kernel stack size
80: */
81:
82: /*
83: * Fork a kernel thread. Any process can request this to be done.
84: * The VM space and limits, etc. will be shared with proc0.
85: */
86: int
87: ndis_kthread_create(void (*func)(void *), void *arg,
1.7.4.2 ! bouyer 88: struct proc **newpp, void *stack, size_t stacksize, const char *name)
1.1 rittera 89: {
1.7.4.2 ! bouyer 90: struct lwp *l;
! 91: int error;
! 92:
! 93: error = kthread_create(PRI_NONE, 0, NULL, func, arg, &l, "%s", name);
! 94: if (__predict_false(error != 0))
! 95: return (error);
! 96:
! 97: /* All done! */
! 98: if (newpp != NULL)
! 99: *newpp = l->l_proc;
! 100: return (0);
1.1 rittera 101: }
CVSweb <webmaster@jp.NetBSD.org>