5 #include <sys/module.h>
10 #include <sys/device.h>
12 typedef struct device
*device_t
;
15 #define CTLFLAG_RW CTLFLAG_READWRITE
18 #define mtx_init(mtx, desc, type, opts) mutex_init(mtx, MUTEX_DEFAULT, IPL_NONE)
20 #define mtx_lock(mtx) ndis_mtx_ipl = splnet() mutex_enter(mtx)
21 #define mtx_unlock(mtx) splx(ndis_mtx_ipl) mutex_exit(mtx)
24 void mtx_lock(struct mtx
*mutex
);
25 void mtx_unlock(struct mtx
*mutex
);
27 #define mtx_destroy(mtx) mutex_destroy(mtx)
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;
35 TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
39 #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
41 #define BUS_SPACE_MAXADDR 0xFFFFFFFFFULL
43 #define BUS_SPACE_MAXADDR 0xFFFFFFFF
45 #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
46 #define I386_BUS_SPACE_MEM 1
48 #define device_get_softc (struct ndis_softc *)
49 #define ticks hardclock_ticks
50 #define p_siglist p_sigctx.ps_siglist
53 #define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
58 #define PAGE_SIZE 4096
60 #define I386_BUS_SPACE_IO 0
62 #define device_get_nameunit(dev) device_xname(dev)
64 /* FreeBSD Loadable Kernel Module commands that have NetBSD counterparts */
65 #define MOD_LOAD LKM_E_LOAD
66 #define MOD_UNLOAD LKM_E_UNLOAD
72 #define MAX_SYSCTL_LEN 256
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)*/
83 typedef vaddr_t vm_offset_t
;
84 typedef vsize_t vm_size_t
;
85 typedef uint16_t linker_file_t
;
87 /* Write our own versions of some FreeBSD functions */
89 #define SYS_RES_IOPORT 0
90 #define SYS_RES_MEMORY 1
91 int bus_release_resource(device_t dev
, int type
, int rid
,
92 struct ndis_resource
*r
);
93 int device_is_attached(device_t dev
);
95 /* This is the same thing as NetBSD's kthread_create1(), except
96 * the stack can be specified.
99 ndis_kthread_create(void (*func
)(void *), void *arg
,
100 struct proc
**newpp
, void *stack
, size_t stacksize
, const char *name
);
102 #endif /* _NBCOMPAT_H_ */