1 #ifndef _NBCOMPAT_H_
2 #define _NBCOMPAT_H_
3
4 #include <sys/systm.h>
5 #include <sys/lkm.h>
6 #include <sys/cdefs.h>
7 #include <sys/queue.h>
8 #include <sys/mutex.h>
9 #ifdef _KERNEL
10 #include <sys/device.h>
11 #else
12 typedef struct device *device_t;
13 #endif
14
15 #define CTLFLAG_RW CTLFLAG_READWRITE
16
17 #define mtx kmutex
18 #define mtx_init(mtx, desc, type, opts) mutex_init(mtx, MUTEX_DEFAULT, IPL_NONE)
19 /*
20 #define mtx_lock(mtx) ndis_mtx_ipl = splnet() mutex_enter(mtx)
21 #define mtx_unlock(mtx) splx(ndis_mtx_ipl) mutex_exit(mtx)
22 */
23
24 void mtx_lock(struct mtx *mutex);
25 void mtx_unlock(struct mtx *mutex);
26
27 #define mtx_destroy(mtx) mutex_destroy(mtx)
28
29 /* I don't think this is going to work
30 struct sysctl_ctx_entry {
31 struct ctlname *entry;
32 TAILQ_ENTRY(sysctl_ctx_entry) link;
33 };
34
35 TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
36 */
37
38 #define ETHER_ALIGN 2
39 #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
40 #ifdef PAE
41 #define BUS_SPACE_MAXADDR 0xFFFFFFFFFULL
42 #else
43 #define BUS_SPACE_MAXADDR 0xFFFFFFFF
44 #endif
45 #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
46 #define I386_BUS_SPACE_MEM 1
47
48 #define device_get_softc (struct ndis_softc *)
49 #define ticks hardclock_ticks
50 #define p_siglist p_sigctx.ps_siglist
51
52 #ifndef __DECONST
53 #define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
54 #endif
55
56 /* 4096 on x86 */
57 #ifndef PAGE_SIZE
58 #define PAGE_SIZE 4096
59 #endif
60 #define I386_BUS_SPACE_IO 0
61
62 #define device_get_nameunit(dev) device_xname(dev)
63
64 /* FreeBSD Loadable Kernel Module commands that have NetBSD counterparts */
65 #define MOD_LOAD LKM_E_LOAD
66 #define MOD_UNLOAD LKM_E_UNLOAD
67
68 /* ethercom/arpcom */
69 #define ac_if ec_if
70
71 #ifdef __NetBSD__
72 #define MAX_SYSCTL_LEN 256
73 #endif
74
75 /* Capabilities that interfaces can advertise. */
76 /* TODO: is this the correct mapping? */
77 #define IFCAP_TXCSUM (IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_UDPv4_Tx|IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_UDPv6_Tx)
78 #define IFCAP_RXCSUM (IFCAP_CSUM_IPv4_Rx|IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx|IFCAP_CSUM_TCPv6_Rx|IFCAP_CSUM_UDPv6_Rx)
79 #define CSUM_IP M_CSUM_IPv4 /*(IFCAP_CSUM_IPv4_Rx |IFCAP_CSUM_IPv4_Tx)*/
80 #define CSUM_TCP M_CSUM_TCPv4 /*(IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_TCPv4_Tx)*/
81 #define CSUM_UDP M_CSUM_UDPv4 /*(IFCAP_CSUM_UDPv4_Rx|IFCAP_CSUM_UDPv4_Tx)*/
82
83 typedef vaddr_t vm_offset_t;
84 typedef vsize_t vm_size_t;
85 typedef uint16_t linker_file_t;
86 typedef struct lkm_table * module_t;
87
88 /* Write our own versions of some FreeBSD functions */
89 struct ndis_resource;
90 #define SYS_RES_IOPORT 0
91 #define SYS_RES_MEMORY 1
92 int bus_release_resource(device_t dev, int type, int rid,
93 struct ndis_resource *r);
94 int device_is_attached(device_t dev);
95
96 /* This is the same thing as NetBSD's kthread_create1(), except
97 * the stack can be specified.
98 */
99 int
100 ndis_kthread_create(void (*func)(void *), void *arg,
101 struct proc **newpp, void *stack, size_t stacksize, const char *name);
102
103 #endif /* _NBCOMPAT_H_ */
Cache object: de585d6f8ebb06bdd2dafc678384ad40
|