Annotation of src/sys/compat/ndis/nbcompat.c, Revision 1.12
1.12 ! joerg 1: /* $NetBSD: nbcompat.c,v 1.11 2011/05/14 12:44:16 rmind Exp $ */
1.8 lukem 2:
1.1 rittera 3: /* nbcompat.c
4: * Implementations of some FreeBSD functions on NetBSD to make things
5: * a bit smoother.
6: */
1.8 lukem 7:
8: #include <sys/cdefs.h>
1.12 ! joerg 9: __KERNEL_RCSID(0, "$NetBSD: nbcompat.c,v 1.11 2011/05/14 12:44:16 rmind Exp $");
1.8 lukem 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 "nbcompat.h"
24:
25: /* note: this is also defined in ntoskrnl_var.h, but I didn't want to include
26: * the whole file here
27: */
28: #define NDIS_KSTACK_PAGES 8
29:
30: struct ndis_resource{
31: bus_space_handle_t res_handle;
32: bus_space_tag_t res_tag;
33: bus_addr_t res_base;
34: bus_size_t res_size;
35: };
36:
1.3 christos 37: int
1.4 christos 38: bus_release_resource(device_t dev, int type, int rid,
1.3 christos 39: struct ndis_resource *r)
1.1 rittera 40: {
41: switch(type) {
42: case SYS_RES_IOPORT:
43: bus_space_unmap(r->res_tag, r->res_handle, r->res_size);
44: break;
45: case SYS_RES_MEMORY:
46: bus_space_unmap(r->res_tag, r->res_handle, r->res_size);
47: break;
48: default:
49: printf("error: bus_release_resource()");
50: }
51:
52: return 0;
53: }
54:
1.3 christos 55: int
1.4 christos 56: device_is_attached(device_t dev)
1.1 rittera 57: {
58: /* Sure, it's attached? */
59: return TRUE;
60: }
61:
62: /* I took this from sys/kern/kern_kthread.c (in the NetBSD source tree).
63: * The only difference is the kernel stack size
64: */
65:
66: /*
67: * Fork a kernel thread. Any process can request this to be done.
68: * The VM space and limits, etc. will be shared with proc0.
69: */
70: int
71: ndis_kthread_create(void (*func)(void *), void *arg,
1.9 rittera 72: struct proc **newpp, void *stack, size_t stacksize, const char *name)
1.1 rittera 73: {
1.9 rittera 74: struct lwp *l;
75: int error;
76:
77: error = kthread_create(PRI_NONE, 0, NULL, func, arg, &l, "%s", name);
78: if (__predict_false(error != 0))
79: return (error);
80:
81: /* All done! */
82: if (newpp != NULL)
83: *newpp = l->l_proc;
84: return (0);
1.1 rittera 85: }
CVSweb <webmaster@jp.NetBSD.org>