diff --git a/core/rtw_mp.c b/core/rtw_mp.c index af56483..cb8074e 100644 --- a/core/rtw_mp.c +++ b/core/rtw_mp.c @@ -14,9 +14,6 @@ *****************************************************************************/ #define _RTW_MP_C_ #include -#ifdef PLATFORM_FREEBSD - #include /* for RFHIGHPID */ -#endif #include "../hal/phydm/phydm_precomp.h" #if defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8821A) @@ -1997,18 +1994,6 @@ void SetPacketTx(PADAPTER padapter) pmp_priv->tx.PktTxThread = NULL; } #endif -#ifdef PLATFORM_FREEBSD - { - struct proc *p; - struct thread *td; - pmp_priv->tx.PktTxThread = kproc_kthread_add(mp_xmit_packet_thread, pmp_priv, - &p, &td, RFHIGHPID, 0, "MPXmitThread", "MPXmitThread"); - - if (pmp_priv->tx.PktTxThread < 0) - RTW_INFO("Create PktTx Thread Fail !!!!!\n"); - } -#endif - Rtw_MPSetMacTxEDCA(padapter); exit: return; diff --git a/core/rtw_security.c b/core/rtw_security.c index 8d8b4cd..44b1d69 100644 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -2129,8 +2129,6 @@ BIP_exit: return res; } #endif /* CONFIG_IEEE80211W */ - -#ifndef PLATFORM_FREEBSD #if defined(CONFIG_TDLS) /* compress 512-bits */ static int sha256_compress(struct sha256_state_rtk *md, unsigned char *buf) @@ -2406,7 +2404,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem, sha256_vector(2, _addr, _len, mac); } #endif /* CONFIG_TDLS */ -#endif /* PLATFORM_FREEBSD */ + /** * sha256_prf - SHA256-based Pseudo-Random Function (IEEE 802.11r, 8.5.1.5.2) * @key: Key for PRF @@ -2420,7 +2418,6 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem, * This function is used to derive new, cryptographically separate keys from a * given key. */ -#ifndef PLATFORM_FREEBSD /* Baron */ #if defined(CONFIG_TDLS) static void sha256_prf(u8 *key, size_t key_len, char *label, u8 *data, size_t data_len, u8 *buf, size_t buf_len) @@ -2459,7 +2456,6 @@ static void sha256_prf(u8 *key, size_t key_len, char *label, } } #endif -#endif /* PLATFORM_FREEBSD Baron */ /* AES tables*/ const u32 Te0[256] = { @@ -2638,7 +2634,6 @@ const u8 rcons[] = { * * @return the number of rounds for the given cipher key size. */ -#ifndef PLATFORM_FREEBSD /* Baron */ static void rijndaelKeySetupEnc(u32 rk[/*44*/], const u8 cipherKey[]) { int i; @@ -2855,7 +2850,6 @@ int omac1_aes_128(const u8 *key, const u8 *data, size_t data_len, u8 *mac) { return omac1_aes_128_vector(key, 1, &data, &data_len, mac); } -#endif /* PLATFORM_FREEBSD Baron */ #ifdef CONFIG_RTW_MESH_AEK /* for AES-SIV */ diff --git a/hal/hal_hci/hal_usb.c b/hal/hal_hci/hal_usb.c index a082532..de0fc65 100644 --- a/hal/hal_hci/hal_usb.c +++ b/hal/hal_hci/hal_usb.c @@ -29,12 +29,6 @@ int usb_init_recv_priv(_adapter *padapter, u16 ini_in_buf_sz) (unsigned long)padapter); #endif /* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD -#ifdef CONFIG_RX_INDICATE_QUEUE - TASK_INIT(&precvpriv->rx_indicate_tasklet, 0, rtw_rx_indicate_tasklet, padapter); -#endif /* CONFIG_RX_INDICATE_QUEUE */ -#endif /* PLATFORM_FREEBSD */ - #ifdef CONFIG_USB_INTERRUPT_IN_PIPE #ifdef PLATFORM_LINUX precvpriv->int_in_urb = usb_alloc_urb(0, GFP_KERNEL); @@ -93,7 +87,6 @@ int usb_init_recv_priv(_adapter *padapter, u16 ini_in_buf_sz) precvpriv->free_recv_buf_queue_cnt = NR_RECVBUFF; -#if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) skb_queue_head_init(&precvpriv->rx_skb_queue); @@ -122,11 +115,6 @@ int usb_init_recv_priv(_adapter *padapter, u16 ini_in_buf_sz) #endif /* CONFIG_PREALLOC_RX_SKB_BUFFER */ if (pskb) { -#ifdef PLATFORM_FREEBSD - pskb->dev = padapter->pifp; -#else - pskb->dev = padapter->pnetdev; -#endif /* PLATFORM_FREEBSD */ #ifndef CONFIG_PREALLOC_RX_SKB_BUFFER tmpaddr = (SIZE_PTR)pskb->data; @@ -139,8 +127,6 @@ int usb_init_recv_priv(_adapter *padapter, u16 ini_in_buf_sz) } #endif /* CONFIG_PREALLOC_RECV_SKB */ -#endif /* defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) */ - exit: return res; @@ -198,27 +184,6 @@ void usb_free_recv_priv(_adapter *padapter, u16 ini_in_buf_sz) #endif /* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - struct sk_buff *pskb; - while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) - rtw_skb_free(pskb); - -#if !defined(CONFIG_USE_USB_BUFFER_ALLOC_RX) - rtw_skb_queue_purge(&precvpriv->free_recv_skb_queue); -#endif - -#ifdef CONFIG_RX_INDICATE_QUEUE - struct mbuf *m; - for (;;) { - IF_DEQUEUE(&precvpriv->rx_indicate_queue, m); - if (m == NULL) - break; - rtw_os_pkt_free(m); - } - mtx_destroy(&precvpriv->rx_indicate_queue.ifq_mtx); -#endif /* CONFIG_RX_INDICATE_QUEUE */ - -#endif /* PLATFORM_FREEBSD */ } #ifdef CONFIG_FW_C2H_REG diff --git a/include/basic_types.h b/include/basic_types.h index 21b9126..37e0e2c 100644 --- a/include/basic_types.h +++ b/include/basic_types.h @@ -109,50 +109,6 @@ enum { #endif -#ifdef PLATFORM_FREEBSD - - typedef signed char s8; - typedef unsigned char u8; - - typedef signed short s16; - typedef unsigned short u16; - - typedef signed int s32; - typedef unsigned int u32; - - typedef unsigned int uint; - typedef signed int sint; - typedef long atomic_t; - - typedef signed long long s64; - typedef unsigned long long u64; - #define IN - #define OUT - #define VOID void - #define NDIS_OID uint - #define NDIS_STATUS uint - - #ifndef PVOID - typedef void *PVOID; - /* #define PVOID (void *) */ - #endif - typedef u32 dma_addr_t; - #define UCHAR u8 - #define USHORT u16 - #define UINT u32 - #define ULONG u32 - - typedef void (*proc_t)(void *); - - typedef unsigned int __kernel_size_t; - typedef int __kernel_ssize_t; - - typedef __kernel_size_t SIZE_T; - typedef __kernel_ssize_t SSIZE_T; - #define FIELD_OFFSET(s, field) ((SSIZE_T)&((s *)(0))->field) - -#endif - #define MEM_ALIGNMENT_OFFSET (sizeof (SIZE_T)) #define MEM_ALIGNMENT_PADDING (sizeof(SIZE_T) - 1) diff --git a/include/byteorder/generic.h b/include/byteorder/generic.h index 30882e7..4f5de12 100644 --- a/include/byteorder/generic.h +++ b/include/byteorder/generic.h @@ -160,15 +160,11 @@ extern __u32 ntohl(__u32); extern __u32 htonl(__u32); #else /* defined(PLATFORM_LINUX) || (defined (__GLIBC__) && __GLIBC__ >= 2) */ - #ifndef PLATFORM_FREEBSD - extern unsigned long int ntohl(unsigned long int); - extern unsigned long int htonl(unsigned long int); - #endif + extern unsigned long int ntohl(unsigned long int); + extern unsigned long int htonl(unsigned long int); #endif -#ifndef PLATFORM_FREEBSD extern unsigned short int ntohs(unsigned short int); extern unsigned short int htons(unsigned short int); -#endif #if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) || defined(PLATFORM_MPIXEL) diff --git a/include/byteorder/swab.h b/include/byteorder/swab.h index 9091d1d..13c974c 100644 --- a/include/byteorder/swab.h +++ b/include/byteorder/swab.h @@ -104,19 +104,11 @@ __inline static __u64 __arch__swab64(__u64 x) #define __swab64(x) __fswab64(x) #endif /* __swab16 */ -#ifdef PLATFORM_FREEBSD - __inline static __u16 __fswab16(__u16 x) -#else __inline static const __u16 __fswab16(__u16 x) -#endif /* PLATFORM_FREEBSD */ { return __arch__swab16(x); } -#ifdef PLATFORM_FREEBSD - __inline static __u32 __fswab32(__u32 x) -#else __inline static const __u32 __fswab32(__u32 x) -#endif /* PLATFORM_FREEBSD */ { return __arch__swab32(x); } diff --git a/include/drv_types.h b/include/drv_types.h index caecb95..ad48abc 100644 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -1151,10 +1151,6 @@ struct dvobj_priv { struct usb_device *pusbdev; #endif/* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - struct usb_interface *pusbintf; - struct usb_device *pusbdev; -#endif/* PLATFORM_FREEBSD */ #endif/* CONFIG_USB_HCI */ @@ -1521,11 +1517,6 @@ struct _ADAPTER { #endif /* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - _nic_hdl pifp; - int bup; - _lock glock; -#endif /* PLATFORM_FREEBSD */ u8 mac_addr[ETH_ALEN]; int net_closed; diff --git a/include/ieee80211.h b/include/ieee80211.h index 62e983a..79976d3 100644 --- a/include/ieee80211.h +++ b/include/ieee80211.h @@ -423,7 +423,6 @@ struct ieee_ibss_seq { _list list; }; -#if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8711FW) || defined(PLATFORM_FREEBSD) struct rtw_ieee80211_hdr { u16 frame_ctl; @@ -496,7 +495,6 @@ struct rtw_ieee80211s_hdr { u32 rann_interval; u32 rann_metric; } __attribute__((packed)); -#endif enum eap_type { EAP_PACKET = 0, @@ -606,7 +604,6 @@ enum eap_type { #define P80211_OUI_LEN 3 -#if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8711FW) || defined(PLATFORM_FREEBSD) struct ieee80211_snap_hdr { @@ -617,8 +614,6 @@ struct ieee80211_snap_hdr { } __attribute__((packed)); -#endif - #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) #define WLAN_FC_GET_TYPE(fc) ((fc) & RTW_IEEE80211_FCTL_FTYPE) @@ -1001,7 +996,6 @@ struct ieee80211_frag_entry { u8 dst_addr[ETH_ALEN]; }; -#ifndef PLATFORM_FREEBSD /* Baron BSD has already defined */ struct ieee80211_stats { uint tx_unicast_frames; uint tx_multicast_frames; @@ -1025,7 +1019,7 @@ struct ieee80211_stats { uint rx_message_in_msg_fragments; uint rx_message_in_bad_msg_fragments; }; -#endif /* PLATFORM_FREEBSD */ + struct ieee80211_softmac_stats { uint rx_ass_ok; uint rx_ass_err; @@ -1294,8 +1288,6 @@ join_res: > 0: TID */ -#ifndef PLATFORM_FREEBSD /* Baron BSD has already defined */ - enum ieee80211_state { /* the card is not linked at all */ @@ -1334,7 +1326,6 @@ enum ieee80211_state { IEEE80211_LINKED_SCANNING, }; -#endif /* PLATFORM_FREEBSD */ #define DEFAULT_MAX_SCAN_AGE (15 * HZ) #define DEFAULT_FTS 2346 @@ -1347,12 +1338,6 @@ enum ieee80211_state { #define PORT_FMT "%u" #define PORT_ARG(x) ntohs(*((u16 *)(x))) -#ifdef PLATFORM_FREEBSD /* Baron change func to macro */ -#define is_multicast_mac_addr(Addr) ((((Addr[0]) & 0x01) == 0x01) && ((Addr[0]) != 0xff)) -#define is_broadcast_mac_addr(Addr) ((((Addr[0]) & 0xff) == 0xff) && (((Addr[1]) & 0xff) == 0xff) && \ - (((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \ - (((Addr[5]) & 0xff) == 0xff)) -#else extern __inline int is_multicast_mac_addr(const u8 *addr) { return (addr[0] != 0xff) && (0x01 & addr[0]); @@ -1369,7 +1354,6 @@ extern __inline int is_zero_mac_addr(const u8 *addr) return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \ (addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00)); } -#endif /* PLATFORM_FREEBSD */ #define CFG_IEEE80211_RESERVE_FCS (1<<0) #define CFG_IEEE80211_COMPUTE_FCS (1<<1) @@ -1578,9 +1562,8 @@ enum rtw_ieee80211_wnm_actioncode { #define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs) * 00:50:F2 */ -#ifndef PLATFORM_FREEBSD /* Baron BSD has defined */ - #define WME_OUI_TYPE 2 -#endif /* PLATFORM_FREEBSD */ +#define WME_OUI_TYPE 2 + #define WME_OUI_SUBTYPE_INFORMATION_ELEMENT 0 #define WME_OUI_SUBTYPE_PARAMETER_ELEMENT 1 #define WME_OUI_SUBTYPE_TSPEC_ELEMENT 2 diff --git a/include/osdep_intf.h b/include/osdep_intf.h index 7be0880..c5d37c2 100644 --- a/include/osdep_intf.h +++ b/include/osdep_intf.h @@ -136,11 +136,6 @@ void rtw_set_rtnl_lock_holder(struct dvobj_priv *dvobj, _thread_hdl_ thd_hdl); #endif /* PLATFORM_LINUX */ - -#ifdef PLATFORM_FREEBSD -extern int rtw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); -#endif - void rtw_ips_dev_unload(_adapter *padapter); #ifdef CONFIG_IPS diff --git a/include/osdep_service.h b/include/osdep_service.h index 93475bd..e5d3fc2 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -36,11 +36,6 @@ #undef _FALSE #define _FALSE 0 - -#ifdef PLATFORM_FREEBSD - #include -#endif - #ifdef PLATFORM_LINUX #include #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)) @@ -264,9 +259,7 @@ void rtw_list_splice(_list *list, _list *head); void rtw_list_splice_init(_list *list, _list *head); void rtw_list_splice_tail(_list *list, _list *head); -#ifndef PLATFORM_FREEBSD extern void rtw_list_delete(_list *plist); -#endif /* PLATFORM_FREEBSD */ void rtw_hlist_head_init(rtw_hlist_head *h); void rtw_hlist_add_head(rtw_hlist_node *n, rtw_hlist_head *h); @@ -280,9 +273,7 @@ extern void _rtw_up_sema(_sema *sema); extern u32 _rtw_down_sema(_sema *sema); extern void _rtw_mutex_init(_mutex *pmutex); extern void _rtw_mutex_free(_mutex *pmutex); -#ifndef PLATFORM_FREEBSD extern void _rtw_spinlock_init(_lock *plock); -#endif /* PLATFORM_FREEBSD */ extern void _rtw_spinlock(_lock *plock); extern void _rtw_spinunlock(_lock *plock); extern void _rtw_spinlock_ex(_lock *plock); @@ -345,9 +336,6 @@ static __inline void thread_enter(char *name) #ifdef PLATFORM_LINUX allow_signal(SIGTERM); #endif -#ifdef PLATFORM_FREEBSD - printf("%s", "RTKTHREAD_enter"); -#endif } void thread_exit(_completion *comp); void _rtw_init_completion(_completion *comp); @@ -387,10 +375,7 @@ __inline static void flush_signals_thread(void) __inline static _OS_STATUS res_to_status(sint res) { - -#if defined(PLATFORM_LINUX) || defined (PLATFORM_MPIXEL) || defined (PLATFORM_FREEBSD) return res; -#endif } @@ -537,12 +522,7 @@ extern int rtw_is_file_readable_with_size(const char *path, u32 *sz); extern int rtw_retrieve_from_file(const char *path, u8 *buf, u32 sz); extern int rtw_store_to_file(const char *path, u8 *buf, u32 sz); - -#ifndef PLATFORM_FREEBSD extern void rtw_free_netdev(struct net_device *netdev); -#endif /* PLATFORM_FREEBSD */ - - extern u64 rtw_division64(u64 x, u64 y); extern u32 rtw_random32(void); diff --git a/include/osdep_service_bsd.h b/include/osdep_service_bsd.h deleted file mode 100644 index 7d5beb5..0000000 --- a/include/osdep_service_bsd.h +++ /dev/null @@ -1,746 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2017 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - *****************************************************************************/ -#ifndef __OSDEP_BSD_SERVICE_H_ -#define __OSDEP_BSD_SERVICE_H_ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include "usbdevs.h" - -#define USB_DEBUG_VAR rum_debug -#include - -#if 1 //Baron porting from linux, it's all temp solution, needs to check again -#include -#include /* XXX for PCPU_GET */ -// typedef struct semaphore _sema; - typedef struct sema _sema; -// typedef spinlock_t _lock; - typedef struct mtx _lock; - typedef struct mtx _mutex; - typedef struct rtw_timer_list _timer; - struct list_head { - struct list_head *next, *prev; - }; - struct __queue { - struct list_head queue; - _lock lock; - }; - - typedef struct mbuf _pkt; - typedef struct mbuf _buffer; - - typedef struct __queue _queue; - typedef struct list_head _list; - typedef int _OS_STATUS; - //typedef u32 _irqL; - typedef unsigned long _irqL; - typedef struct ifnet * _nic_hdl; - - typedef pid_t _thread_hdl_; -// typedef struct thread _thread_hdl_; - typedef void thread_return; - typedef void* thread_context; - - typedef void timer_hdl_return; - typedef void* timer_hdl_context; - typedef struct work_struct _workitem; - -#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -/* emulate a modern version */ -#define LINUX_VERSION_CODE KERNEL_VERSION(2, 6, 35) - -#define WIRELESS_EXT -1 -#define HZ hz -#define spin_lock_irqsave mtx_lock_irqsave -#define spin_lock_bh mtx_lock_irqsave -#define mtx_lock_irqsave(lock, x) mtx_lock(lock)//{local_irq_save((x)); mtx_lock_spin((lock));} -//#define IFT_RTW 0xf9 //ifnet allocate type for RTW -#define free_netdev if_free -#define LIST_CONTAINOR(ptr, type, member) \ - ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member))) -#define container_of(p,t,n) (t*)((p)-&(((t*)0)->n)) -/* - * Linux timers are emulated using FreeBSD callout functions - * (and taskqueue functionality). - * - * Currently no timer stats functionality. - * - * See (linux_compat) processes.c - * - */ -struct rtw_timer_list { - struct callout callout; - void (*function)(void *); - void *arg; -}; - -struct workqueue_struct; -struct work_struct; -typedef void (*work_func_t)(struct work_struct *work); -/* Values for the state of an item of work (work_struct) */ -typedef enum work_state { - WORK_STATE_UNSET = 0, - WORK_STATE_CALLOUT_PENDING = 1, - WORK_STATE_TASK_PENDING = 2, - WORK_STATE_WORK_CANCELLED = 3 -} work_state_t; - -struct work_struct { - struct task task; /* FreeBSD task */ - work_state_t state; /* the pending or otherwise state of work. */ - work_func_t func; -}; -#define spin_unlock_irqrestore mtx_unlock_irqrestore -#define spin_unlock_bh mtx_unlock_irqrestore -#define mtx_unlock_irqrestore(lock,x) mtx_unlock(lock); -extern void _rtw_spinlock_init(_lock *plock); - -//modify private structure to match freebsd -#define BITS_PER_LONG 32 -union ktime { - s64 tv64; -#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR) - struct { -#ifdef __BIG_ENDIAN - s32 sec, nsec; -#else - s32 nsec, sec; -#endif - } tv; -#endif -}; -#define kmemcheck_bitfield_begin(name) -#define kmemcheck_bitfield_end(name) -#define CHECKSUM_NONE 0 -typedef unsigned char *sk_buff_data_t; -typedef union ktime ktime_t; /* Kill this */ - -void rtw_mtx_lock(_lock *plock); - -void rtw_mtx_unlock(_lock *plock); - -/** - * struct sk_buff - socket buffer - * @next: Next buffer in list - * @prev: Previous buffer in list - * @sk: Socket we are owned by - * @tstamp: Time we arrived - * @dev: Device we arrived on/are leaving by - * @transport_header: Transport layer header - * @network_header: Network layer header - * @mac_header: Link layer header - * @_skb_refdst: destination entry (with norefcount bit) - * @sp: the security path, used for xfrm - * @cb: Control buffer. Free for use by every layer. Put private vars here - * @len: Length of actual data - * @data_len: Data length - * @mac_len: Length of link layer header - * @hdr_len: writable header length of cloned skb - * @csum: Checksum (must include start/offset pair) - * @csum_start: Offset from skb->head where checksumming should start - * @csum_offset: Offset from csum_start where checksum should be stored - * @local_df: allow local fragmentation - * @cloned: Head may be cloned (check refcnt to be sure) - * @nohdr: Payload reference only, must not modify header - * @pkt_type: Packet class - * @fclone: skbuff clone status - * @ip_summed: Driver fed us an IP checksum - * @priority: Packet queueing priority - * @users: User count - see {datagram,tcp}.c - * @protocol: Packet protocol from driver - * @truesize: Buffer size - * @head: Head of buffer - * @data: Data head pointer - * @tail: Tail pointer - * @end: End pointer - * @destructor: Destruct function - * @mark: Generic packet mark - * @nfct: Associated connection, if any - * @ipvs_property: skbuff is owned by ipvs - * @peeked: this packet has been seen already, so stats have been - * done for it, don't do them again - * @nf_trace: netfilter packet trace flag - * @nfctinfo: Relationship of this skb to the connection - * @nfct_reasm: netfilter conntrack re-assembly pointer - * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c - * @skb_iif: ifindex of device we arrived on - * @rxhash: the packet hash computed on receive - * @queue_mapping: Queue mapping for multiqueue devices - * @tc_index: Traffic control index - * @tc_verd: traffic control verdict - * @ndisc_nodetype: router type (from link layer) - * @dma_cookie: a cookie to one of several possible DMA operations - * done by skb DMA functions - * @secmark: security marking - * @vlan_tci: vlan tag control information - */ - -struct sk_buff { - /* These two members must be first. */ - struct sk_buff *next; - struct sk_buff *prev; - - ktime_t tstamp; - - struct sock *sk; - //struct net_device *dev; - struct ifnet *dev; - - /* - * This is the control buffer. It is free to use for every - * layer. Please put your private variables there. If you - * want to keep them across layers you have to do a skb_clone() - * first. This is owned by whoever has the skb queued ATM. - */ - char cb[48] __aligned(8); - - unsigned long _skb_refdst; -#ifdef CONFIG_XFRM - struct sec_path *sp; -#endif - unsigned int len, - data_len; - u16 mac_len, - hdr_len; - union { - u32 csum; - struct { - u16 csum_start; - u16 csum_offset; - }smbol2; - }smbol1; - u32 priority; - kmemcheck_bitfield_begin(flags1); - u8 local_df:1, - cloned:1, - ip_summed:2, - nohdr:1, - nfctinfo:3; - u8 pkt_type:3, - fclone:2, - ipvs_property:1, - peeked:1, - nf_trace:1; - kmemcheck_bitfield_end(flags1); - u16 protocol; - - void (*destructor)(struct sk_buff *skb); -#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) - struct nf_conntrack *nfct; - struct sk_buff *nfct_reasm; -#endif -#ifdef CONFIG_BRIDGE_NETFILTER - struct nf_bridge_info *nf_bridge; -#endif - - int skb_iif; -#ifdef CONFIG_NET_SCHED - u16 tc_index; /* traffic control index */ -#ifdef CONFIG_NET_CLS_ACT - u16 tc_verd; /* traffic control verdict */ -#endif -#endif - - u32 rxhash; - - kmemcheck_bitfield_begin(flags2); - u16 queue_mapping:16; -#ifdef CONFIG_IPV6_NDISC_NODETYPE - u8 ndisc_nodetype:2, - deliver_no_wcard:1; -#else - u8 deliver_no_wcard:1; -#endif - kmemcheck_bitfield_end(flags2); - - /* 0/14 bit hole */ - -#ifdef CONFIG_NET_DMA - dma_cookie_t dma_cookie; -#endif -#ifdef CONFIG_NETWORK_SECMARK - u32 secmark; -#endif - union { - u32 mark; - u32 dropcount; - }symbol3; - - u16 vlan_tci; - - sk_buff_data_t transport_header; - sk_buff_data_t network_header; - sk_buff_data_t mac_header; - /* These elements must be at the end, see alloc_skb() for details. */ - sk_buff_data_t tail; - sk_buff_data_t end; - unsigned char *head, - *data; - unsigned int truesize; - atomic_t users; -}; -struct sk_buff_head { - /* These two members must be first. */ - struct sk_buff *next; - struct sk_buff *prev; - - u32 qlen; - _lock lock; -}; -#define skb_tail_pointer(skb) skb->tail -static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) -{ - unsigned char *tmp = skb_tail_pointer(skb); - //SKB_LINEAR_ASSERT(skb); - skb->tail += len; - skb->len += len; - return tmp; -} - -static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) -{ - skb->len -= len; - if(skb->len < skb->data_len) - printf("%s(),%d,error!\n",__FUNCTION__,__LINE__); - return skb->data += len; -} -static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len) -{ - #ifdef PLATFORM_FREEBSD - return __skb_pull(skb, len); - #else - return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len); - #endif //PLATFORM_FREEBSD -} -static inline u32 skb_queue_len(const struct sk_buff_head *list_) -{ - return list_->qlen; -} -static inline void __skb_insert(struct sk_buff *newsk, - struct sk_buff *prev, struct sk_buff *next, - struct sk_buff_head *list) -{ - newsk->next = next; - newsk->prev = prev; - next->prev = prev->next = newsk; - list->qlen++; -} -static inline void __skb_queue_before(struct sk_buff_head *list, - struct sk_buff *next, - struct sk_buff *newsk) -{ - __skb_insert(newsk, next->prev, next, list); -} -static inline void skb_queue_tail(struct sk_buff_head *list, - struct sk_buff *newsk) -{ - mtx_lock(&list->lock); - __skb_queue_before(list, (struct sk_buff *)list, newsk); - mtx_unlock(&list->lock); -} -static inline struct sk_buff *skb_peek(struct sk_buff_head *list_) -{ - struct sk_buff *list = ((struct sk_buff *)list_)->next; - if (list == (struct sk_buff *)list_) - list = NULL; - return list; -} -static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) -{ - struct sk_buff *next, *prev; - - list->qlen--; - next = skb->next; - prev = skb->prev; - skb->next = skb->prev = NULL; - next->prev = prev; - prev->next = next; -} - -static inline struct sk_buff *skb_dequeue(struct sk_buff_head *list) -{ - mtx_lock(&list->lock); - - struct sk_buff *skb = skb_peek(list); - if (skb) - __skb_unlink(skb, list); - - mtx_unlock(&list->lock); - - return skb; -} -static inline void skb_reserve(struct sk_buff *skb, int len) -{ - skb->data += len; - skb->tail += len; -} -static inline void __skb_queue_head_init(struct sk_buff_head *list) -{ - list->prev = list->next = (struct sk_buff *)list; - list->qlen = 0; -} -/* - * This function creates a split out lock class for each invocation; - * this is needed for now since a whole lot of users of the skb-queue - * infrastructure in drivers have different locking usage (in hardirq) - * than the networking core (in softirq only). In the long run either the - * network layer or drivers should need annotation to consolidate the - * main types of usage into 3 classes. - */ -static inline void skb_queue_head_init(struct sk_buff_head *list) -{ - _rtw_spinlock_init(&list->lock); - __skb_queue_head_init(list); -} -unsigned long copy_from_user(void *to, const void *from, unsigned long n); -unsigned long copy_to_user(void *to, const void *from, unsigned long n); -struct sk_buff * dev_alloc_skb(unsigned int size); -struct sk_buff *skb_clone(const struct sk_buff *skb); -void dev_kfree_skb_any(struct sk_buff *skb); -#endif //Baron porting from linux, it's all temp solution, needs to check again - - -#if 1 // kenny add Linux compatibility code for Linux USB driver -#include - -#define __init // __attribute ((constructor)) -#define __exit // __attribute ((destructor)) - -/* - * Definitions for module_init and module_exit macros. - * - * These macros will use the SYSINIT framework to call a specified - * function (with no arguments) on module loading or unloading. - * - */ - -void module_init_exit_wrapper(void *arg); - -#define module_init(initfn) \ - SYSINIT(mod_init_ ## initfn, \ - SI_SUB_KLD, SI_ORDER_FIRST, \ - module_init_exit_wrapper, initfn) - -#define module_exit(exitfn) \ - SYSUNINIT(mod_exit_ ## exitfn, \ - SI_SUB_KLD, SI_ORDER_ANY, \ - module_init_exit_wrapper, exitfn) - -/* - * The usb_register and usb_deregister functions are used to register - * usb drivers with the usb subsystem. - */ -int usb_register(struct usb_driver *driver); -int usb_deregister(struct usb_driver *driver); - -/* - * usb_get_dev and usb_put_dev - increment/decrement the reference count - * of the usb device structure. - * - * Original body of usb_get_dev: - * - * if (dev) - * get_device(&dev->dev); - * return dev; - * - * Reference counts are not currently used in this compatibility - * layer. So these functions will do nothing. - */ -static inline struct usb_device * -usb_get_dev(struct usb_device *dev) -{ - return dev; -} - -static inline void -usb_put_dev(struct usb_device *dev) -{ - return; -} - - -// rtw_usb_compat_linux -int rtw_usb_submit_urb(struct urb *urb, uint16_t mem_flags); -int rtw_usb_unlink_urb(struct urb *urb); -int rtw_usb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe); -int rtw_usb_set_interface(struct usb_device *dev, uint8_t iface_no, uint8_t alt_index); -int rtw_usb_setup_endpoint(struct usb_device *dev, - struct usb_host_endpoint *uhe, usb_size_t bufsize); -struct urb *rtw_usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags); -struct usb_host_endpoint *rtw_usb_find_host_endpoint(struct usb_device *dev, uint8_t type, uint8_t ep); -struct usb_host_interface *rtw_usb_altnum_to_altsetting(const struct usb_interface *intf, uint8_t alt_index); -struct usb_interface *rtw_usb_ifnum_to_if(struct usb_device *dev, uint8_t iface_no); -void *rtw_usbd_get_intfdata(struct usb_interface *intf); -void rtw_usb_linux_register(void *arg); -void rtw_usb_linux_deregister(void *arg); -void rtw_usb_linux_free_device(struct usb_device *dev); -void rtw_usb_free_urb(struct urb *urb); -void rtw_usb_init_urb(struct urb *urb); -void rtw_usb_kill_urb(struct urb *urb); -void rtw_usb_set_intfdata(struct usb_interface *intf, void *data); -void rtw_usb_fill_bulk_urb(struct urb *urb, struct usb_device *udev, - struct usb_host_endpoint *uhe, void *buf, - int length, usb_complete_t callback, void *arg); -void *usb_get_intfdata(struct usb_interface *intf); -int usb_linux_init_endpoints(struct usb_device *udev); - - - -typedef struct urb * PURB; - -typedef unsigned gfp_t; -#define __GFP_WAIT ((gfp_t)0x10u) /* Can wait and reschedule? */ -#define __GFP_HIGH ((gfp_t)0x20u) /* Should access emergency pools? */ -#define __GFP_IO ((gfp_t)0x40u) /* Can start physical IO? */ -#define __GFP_FS ((gfp_t)0x80u) /* Can call down to low-level FS? */ -#define __GFP_COLD ((gfp_t)0x100u) /* Cache-cold page required */ -#define __GFP_NOWARN ((gfp_t)0x200u) /* Suppress page allocation failure warning */ -#define __GFP_REPEAT ((gfp_t)0x400u) /* Retry the allocation. Might fail */ -#define __GFP_NOFAIL ((gfp_t)0x800u) /* Retry for ever. Cannot fail */ -#define __GFP_NORETRY ((gfp_t)0x1000u)/* Do not retry. Might fail */ -#define __GFP_NO_GROW ((gfp_t)0x2000u)/* Slab internal usage */ -#define __GFP_COMP ((gfp_t)0x4000u)/* Add compound page metadata */ -#define __GFP_ZERO ((gfp_t)0x8000u)/* Return zeroed page on success */ -#define __GFP_NOMEMALLOC ((gfp_t)0x10000u) /* Don't use emergency reserves */ -#define __GFP_HARDWALL ((gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ - -/* This equals 0, but use constants in case they ever change */ -#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) -/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */ -#define GFP_ATOMIC (__GFP_HIGH) -#define GFP_NOIO (__GFP_WAIT) -#define GFP_NOFS (__GFP_WAIT | __GFP_IO) -#define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS) -#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL) -#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ - __GFP_HIGHMEM) - - -#endif // kenny add Linux compatibility code for Linux USB - -__inline static _list *get_next(_list *list) -{ - return list->next; -} - -__inline static _list *get_list_head(_queue *queue) -{ - return (&(queue->queue)); -} - - -#define LIST_CONTAINOR(ptr, type, member) \ - ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member))) - - -__inline static void _enter_critical(_lock *plock, _irqL *pirqL) -{ - spin_lock_irqsave(plock, *pirqL); -} - -__inline static void _exit_critical(_lock *plock, _irqL *pirqL) -{ - spin_unlock_irqrestore(plock, *pirqL); -} - -__inline static void _enter_critical_ex(_lock *plock, _irqL *pirqL) -{ - spin_lock_irqsave(plock, *pirqL); -} - -__inline static void _exit_critical_ex(_lock *plock, _irqL *pirqL) -{ - spin_unlock_irqrestore(plock, *pirqL); -} - -__inline static void _enter_critical_bh(_lock *plock, _irqL *pirqL) -{ - spin_lock_bh(plock, *pirqL); -} - -__inline static void _exit_critical_bh(_lock *plock, _irqL *pirqL) -{ - spin_unlock_bh(plock, *pirqL); -} - -__inline static void _enter_critical_mutex(_mutex *pmutex, _irqL *pirqL) -{ - - mtx_lock(pmutex); - -} - - -__inline static void _exit_critical_mutex(_mutex *pmutex, _irqL *pirqL) -{ - - mtx_unlock(pmutex); - -} -static inline void __list_del(struct list_head * prev, struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} -static inline void INIT_LIST_HEAD(struct list_head *list) -{ - list->next = list; - list->prev = list; -} -__inline static void rtw_list_delete(_list *plist) -{ - __list_del(plist->prev, plist->next); - INIT_LIST_HEAD(plist); -} - -static inline void timer_hdl(void *ctx) -{ - _timer *timer = (_timer *)ctx; - - rtw_mtx_lock(NULL); - if (callout_pending(&timer->callout)) { - /* callout was reset */ - rtw_mtx_unlock(NULL); - return; - } - - if (!callout_active(&timer->callout)) { - /* callout was stopped */ - rtw_mtx_unlock(NULL); - return; - } - - callout_deactivate(&timer->callout); - - timer->function(timer->arg); - - rtw_mtx_unlock(NULL); -} - -static inline void _init_timer(_timer *ptimer, _nic_hdl padapter, void *pfunc, void *cntx) -{ - ptimer->function = pfunc; - ptimer->arg = cntx; - callout_init(&ptimer->callout, CALLOUT_MPSAFE); -} - -__inline static void _set_timer(_timer *ptimer,u32 delay_time) -{ - if (ptimer->function && ptimer->arg) { - rtw_mtx_lock(NULL); - callout_reset(&ptimer->callout, delay_time, timer_hdl, ptimer); - rtw_mtx_unlock(NULL); - } -} - -__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled) -{ - rtw_mtx_lock(NULL); - callout_drain(&ptimer->callout); - rtw_mtx_unlock(NULL); - *bcancelled = 1; /* assume an pending timer to be canceled */ -} - -__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx) -{ - printf("%s Not implement yet! \n",__FUNCTION__); -} - -__inline static void _set_workitem(_workitem *pwork) -{ - printf("%s Not implement yet! \n",__FUNCTION__); -// schedule_work(pwork); -} - -// -// Global Mutex: can only be used at PASSIVE level. -// - -#define ACQUIRE_GLOBAL_MUTEX(_MutexCounter) \ -{ \ -} - -#define RELEASE_GLOBAL_MUTEX(_MutexCounter) \ -{ \ -} - -#define ATOMIC_INIT(i) { (i) } - -static __inline void thread_enter(char *name); - -#define rtw_netdev_priv(netdev) (((struct ifnet *)netdev)->if_softc) - -#define rtw_free_netdev(netdev) if_free((netdev)) - -#define NDEV_FMT "%s" -#define NDEV_ARG(ndev) "" -#define ADPT_FMT "%s" -#define ADPT_ARG(adapter) "" -#define FUNC_NDEV_FMT "%s" -#define FUNC_NDEV_ARG(ndev) __func__ -#define FUNC_ADPT_FMT "%s" -#define FUNC_ADPT_ARG(adapter) __func__ - -#define STRUCT_PACKED - -#endif - diff --git a/include/rtw_debug.h b/include/rtw_debug.h index 6f234e4..984aaf8 100644 --- a/include/rtw_debug.h +++ b/include/rtw_debug.h @@ -64,12 +64,6 @@ extern void rtl871x_cedbg(const char *fmt, ...); #define KERN_CONT #endif #define _seqdump seq_printf -#elif defined PLATFORM_FREEBSD - #define _dbgdump printf - #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) - #define KERN_CONT - #endif - #define _seqdump(sel, fmt, arg...) _dbgdump(fmt, ##arg) #endif void RTW_BUF_DUMP_SEL(uint _loglevel, void *sel, u8 *_titlestring, diff --git a/include/rtw_recv.h b/include/rtw_recv.h index 5975d7c..201ca95 100644 --- a/include/rtw_recv.h +++ b/include/rtw_recv.h @@ -388,14 +388,9 @@ struct recv_priv { #endif /* CONFIG_USB_INTERRUPT_IN_PIPE */ #endif -#if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) -#ifdef PLATFORM_FREEBSD - struct task irq_prepare_beacon_tasklet; - struct task recv_tasklet; -#else /* PLATFORM_FREEBSD */ - struct tasklet_struct irq_prepare_beacon_tasklet; - struct tasklet_struct recv_tasklet; -#endif /* PLATFORM_FREEBSD */ +struct tasklet_struct irq_prepare_beacon_tasklet; +struct tasklet_struct recv_tasklet; + struct sk_buff_head free_recv_skb_queue; struct sk_buff_head rx_skb_queue; #ifdef CONFIG_RTW_NAPI @@ -406,8 +401,6 @@ struct recv_priv { struct ifqueue rx_indicate_queue; #endif /* CONFIG_RX_INDICATE_QUEUE */ -#endif /* defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) */ - u8 *pallocated_recv_buf; u8 *precv_buf; /* 4 alignment */ _queue free_recv_buf_queue; @@ -521,11 +514,9 @@ struct recv_buf { #ifdef CONFIG_USB_HCI -#if defined(PLATFORM_OS_XP) || defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) - PURB purb; - dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */ - u32 alloc_sz; -#endif +PURB purb; +dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */ +u32 alloc_sz; #ifdef PLATFORM_OS_XP PIRP pirp; @@ -542,8 +533,6 @@ struct recv_buf { #if defined(PLATFORM_LINUX) _pkt *pskb; -#elif defined(PLATFORM_FREEBSD) /* skb solution */ - struct sk_buff *pskb; #endif }; diff --git a/include/rtw_xmit.h b/include/rtw_xmit.h index 6c718d5..45ecf0d 100644 --- a/include/rtw_xmit.h +++ b/include/rtw_xmit.h @@ -597,10 +597,8 @@ struct xmit_buf { u8 bulkout_id; /* for halmac */ #endif /* RTW_HALMAC */ -#if defined(PLATFORM_OS_XP) || defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) PURB pxmit_urb[8]; dma_addr_t dma_transfer_addr; /* (in) dma addr for transfer_buffer */ -#endif #ifdef PLATFORM_OS_XP PIRP pxmit_irp[8]; @@ -801,9 +799,6 @@ struct xmit_priv { #endif #ifdef PLATFORM_LINUX struct tasklet_struct xmit_tasklet; -#endif -#ifdef PLATFORM_FREEBSD - struct task xmit_tasklet; #endif /* per AC pending irp */ int beq_cnt; diff --git a/include/wifi.h b/include/wifi.h index 2f22b2a..427408e 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -711,10 +711,6 @@ struct rtw_ieee80211_bar { } __attribute__((packed)); #endif -#if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8712FW) || defined(PLATFORM_FREEBSD) - - - /** * struct rtw_ieee80211_ht_cap - HT capabilities * @@ -786,11 +782,6 @@ struct ADDBA_request { unsigned short BA_starting_seqctrl; } __attribute__((packed)); - - -#endif - - typedef enum _HT_CAP_AMPDU_FACTOR { MAX_AMPDU_FACTOR_8K = 0, MAX_AMPDU_FACTOR_16K = 1, diff --git a/include/wlan_bssdef.h b/include/wlan_bssdef.h index 48fc02c..3106cfc 100644 --- a/include/wlan_bssdef.h +++ b/include/wlan_bssdef.h @@ -269,251 +269,6 @@ typedef struct _NDIS_802_11_TEST { #endif /* end of #ifdef PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - -#define NDIS_802_11_LENGTH_SSID 32 -#define NDIS_802_11_LENGTH_RATES 8 -#define NDIS_802_11_LENGTH_RATES_EX 16 - -typedef unsigned char NDIS_802_11_MAC_ADDRESS[ETH_ALEN]; -typedef long NDIS_802_11_RSSI; /* in dBm */ -typedef unsigned char NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; /* Set of 8 data rates */ -typedef unsigned char NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; /* Set of 16 data rates */ - - -typedef ULONG NDIS_802_11_KEY_INDEX; -typedef unsigned long long NDIS_802_11_KEY_RSC; - - -typedef struct _NDIS_802_11_SSID { - ULONG SsidLength; - UCHAR Ssid[32]; -} NDIS_802_11_SSID, *PNDIS_802_11_SSID; - -typedef enum _NDIS_802_11_NETWORK_TYPE { - Ndis802_11FH, - Ndis802_11DS, - Ndis802_11OFDM5, - Ndis802_11OFDM24, - Ndis802_11NetworkTypeMax /* not a real type, defined as an upper bound */ -} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE; - -typedef struct _NDIS_802_11_CONFIGURATION_FH { - ULONG Length; /* Length of structure */ - ULONG HopPattern; /* As defined by 802.11, MSB set */ - ULONG HopSet; /* to one if non-802.11 */ - ULONG DwellTime; /* units are Kusec */ -} NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH; - - -/* - FW will only save the channel number in DSConfig. - ODI Handler will convert the channel number to freq. number. -*/ -typedef struct _NDIS_802_11_CONFIGURATION { - ULONG Length; /* Length of structure */ - ULONG BeaconPeriod; /* units are Kusec */ - ULONG ATIMWindow; /* units are Kusec */ - ULONG DSConfig; /* channel number */ - NDIS_802_11_CONFIGURATION_FH FHConfig; -} NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION; - - - -typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE { - Ndis802_11IBSS, - Ndis802_11Infrastructure, - Ndis802_11AutoUnknown, - Ndis802_11InfrastructureMax, /* Not a real value, defined as upper bound */ - Ndis802_11APMode -} NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE; - - - - - -typedef struct _NDIS_802_11_FIXED_IEs { - UCHAR Timestamp[8]; - USHORT BeaconInterval; - USHORT Capabilities; -} NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs; - - - -typedef struct _NDIS_802_11_VARIABLE_IEs { - UCHAR ElementID; - UCHAR Length; - UCHAR data[1]; -} NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs; - - - -/* - - - -Length is the 4 bytes multiples of the sume of - sizeof (NDIS_802_11_MAC_ADDRESS) + 2 + sizeof (NDIS_802_11_SSID) + sizeof (ULONG) -+ sizeof (NDIS_802_11_RSSI) + sizeof (NDIS_802_11_NETWORK_TYPE) + sizeof (NDIS_802_11_CONFIGURATION) -+ sizeof (NDIS_802_11_RATES_EX) + IELength - -Except the IELength, all other fields are fixed length. Therefore, we can define a marco to present the -partial sum. - -*/ -#if 0 -typedef struct _NDIS_WLAN_BSSID_EX { - ULONG Length; - NDIS_802_11_MAC_ADDRESS MacAddress; - UCHAR Reserved[2];/* [0]: IS beacon frame, [1]:optimum_antenna=>For antenna diversity; */ - NDIS_802_11_SSID Ssid; - ULONG Privacy; - NDIS_802_11_RSSI Rssi; - NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; - NDIS_802_11_CONFIGURATION Configuration; - NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; - NDIS_802_11_RATES_EX SupportedRates; - ULONG IELength; - UCHAR IEs[MAX_IE_SZ]; /* (timestamp, beacon interval, and capability information) */ -} NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX; - - -typedef struct _NDIS_802_11_BSSID_LIST_EX { - ULONG NumberOfItems; - NDIS_WLAN_BSSID_EX Bssid[1]; -} NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX; -#endif - -typedef enum _NDIS_802_11_AUTHENTICATION_MODE { - Ndis802_11AuthModeOpen, - Ndis802_11AuthModeShared, - Ndis802_11AuthModeAutoSwitch, - Ndis802_11AuthModeWPA, - Ndis802_11AuthModeWPAPSK, - Ndis802_11AuthModeWPANone, - Ndis802_11AuthModeMax /* Not a real mode, defined as upper bound */ -} NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE; - -typedef enum _NDIS_802_11_WEP_STATUS { - Ndis802_11WEPEnabled, - Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, - Ndis802_11WEPDisabled, - Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, - Ndis802_11WEPKeyAbsent, - Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, - Ndis802_11WEPNotSupported, - Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, - Ndis802_11Encryption2Enabled, - Ndis802_11Encryption2KeyAbsent, - Ndis802_11Encryption3Enabled, - Ndis802_11Encryption3KeyAbsent -} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, -NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; - - -#define NDIS_802_11_AI_REQFI_CAPABILITIES 1 -#define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2 -#define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4 - -#define NDIS_802_11_AI_RESFI_CAPABILITIES 1 -#define NDIS_802_11_AI_RESFI_STATUSCODE 2 -#define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4 - -typedef struct _NDIS_802_11_AI_REQFI { - USHORT Capabilities; - USHORT ListenInterval; - NDIS_802_11_MAC_ADDRESS CurrentAPAddress; -} NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI; - -typedef struct _NDIS_802_11_AI_RESFI { - USHORT Capabilities; - USHORT StatusCode; - USHORT AssociationId; -} NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI; - -typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION { - ULONG Length; - USHORT AvailableRequestFixedIEs; - NDIS_802_11_AI_REQFI RequestFixedIEs; - ULONG RequestIELength; - ULONG OffsetRequestIEs; - USHORT AvailableResponseFixedIEs; - NDIS_802_11_AI_RESFI ResponseFixedIEs; - ULONG ResponseIELength; - ULONG OffsetResponseIEs; -} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION; - -typedef enum _NDIS_802_11_RELOAD_DEFAULTS { - Ndis802_11ReloadWEPKeys -} NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS; - - -/* Key mapping keys require a BSSID */ -typedef struct _NDIS_802_11_KEY { - ULONG Length; /* Length of this structure */ - ULONG KeyIndex; - ULONG KeyLength; /* length of key in bytes */ - NDIS_802_11_MAC_ADDRESS BSSID; - NDIS_802_11_KEY_RSC KeyRSC; - UCHAR KeyMaterial[32]; /* variable length depending on above field */ -} NDIS_802_11_KEY, *PNDIS_802_11_KEY; - -typedef struct _NDIS_802_11_REMOVE_KEY { - ULONG Length; /* Length of this structure */ - ULONG KeyIndex; - NDIS_802_11_MAC_ADDRESS BSSID; -} NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY; - -typedef struct _NDIS_802_11_WEP { - ULONG Length; /* Length of this structure */ - ULONG KeyIndex; /* 0 is the per-client key, 1-N are the global keys */ - ULONG KeyLength; /* length of key in bytes */ - UCHAR KeyMaterial[16];/* variable length depending on above field */ -} NDIS_802_11_WEP, *PNDIS_802_11_WEP; - -typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST { - ULONG Length; /* Length of structure */ - NDIS_802_11_MAC_ADDRESS Bssid; - ULONG Flags; -} NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST; - -typedef enum _NDIS_802_11_STATUS_TYPE { - Ndis802_11StatusType_Authentication, - Ndis802_11StatusType_MediaStreamMode, - Ndis802_11StatusType_PMKID_CandidateList, - Ndis802_11StatusTypeMax /* not a real type, defined as an upper bound */ -} NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; - -typedef struct _NDIS_802_11_STATUS_INDICATION { - NDIS_802_11_STATUS_TYPE StatusType; -} NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION; - -/* mask for authentication/integrity fields */ -#define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f -#define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01 -#define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02 -#define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06 -#define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E - -/* MIC check time, 60 seconds. */ -#define MIC_CHECK_TIME 60000000 - -typedef struct _NDIS_802_11_AUTHENTICATION_EVENT { - NDIS_802_11_STATUS_INDICATION Status; - NDIS_802_11_AUTHENTICATION_REQUEST Request[1]; -} NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT; - -typedef struct _NDIS_802_11_TEST { - ULONG Length; - ULONG Type; - union { - NDIS_802_11_AUTHENTICATION_EVENT AuthenticationEvent; - NDIS_802_11_RSSI RssiTrigger; - } tt; -} NDIS_802_11_TEST, *PNDIS_802_11_TEST; - - -#endif /* PLATFORM_FREEBSD */ #ifndef Ndis802_11APMode #define Ndis802_11APMode (Ndis802_11InfrastructureMax+1) #endif diff --git a/include/xmit_osdep.h b/include/xmit_osdep.h index fa0200a..793b0c7 100644 --- a/include/xmit_osdep.h +++ b/include/xmit_osdep.h @@ -26,12 +26,6 @@ struct pkt_file { }; -#ifdef PLATFORM_FREEBSD -#define NR_XMITFRAME 256 -extern int rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev); -extern void rtw_xmit_entry_wrap(struct ifnet *pifp); -#endif /* PLATFORM_FREEBSD */ - #ifdef PLATFORM_LINUX #define NR_XMITFRAME 256 diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index 4f441d0..d1a4a4b 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -78,9 +78,6 @@ void *_rtw_malloc(u32 sz) pbuf = kmalloc(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); #endif -#ifdef PLATFORM_FREEBSD - pbuf = malloc(sz, M_DEVBUF, M_NOWAIT); -#endif #ifdef DBG_MEMORY_LEAK #ifdef PLATFORM_LINUX @@ -98,9 +95,6 @@ void *_rtw_malloc(u32 sz) void *_rtw_zmalloc(u32 sz) { -#ifdef PLATFORM_FREEBSD - return malloc(sz, M_DEVBUF, M_ZERO | M_NOWAIT); -#else /* PLATFORM_FREEBSD */ void *pbuf = _rtw_malloc(sz); if (pbuf != NULL) { @@ -112,7 +106,6 @@ void *_rtw_zmalloc(u32 sz) } return pbuf; -#endif /* PLATFORM_FREEBSD */ } void _rtw_mfree(void *pbuf, u32 sz) @@ -127,9 +120,6 @@ void _rtw_mfree(void *pbuf, u32 sz) kfree(pbuf); #endif -#ifdef PLATFORM_FREEBSD - free(pbuf, M_DEVBUF); -#endif #ifdef DBG_MEMORY_LEAK #ifdef PLATFORM_LINUX @@ -140,62 +130,12 @@ void _rtw_mfree(void *pbuf, u32 sz) } -#ifdef PLATFORM_FREEBSD -/* review again */ -struct sk_buff *dev_alloc_skb(unsigned int size) -{ - struct sk_buff *skb = NULL; - u8 *data = NULL; - - /* skb = _rtw_zmalloc(sizeof(struct sk_buff)); */ /* for skb->len, etc. */ - skb = _rtw_malloc(sizeof(struct sk_buff)); - if (!skb) - goto out; - data = _rtw_malloc(size); - if (!data) - goto nodata; - - skb->head = (unsigned char *)data; - skb->data = (unsigned char *)data; - skb->tail = (unsigned char *)data; - skb->end = (unsigned char *)data + size; - skb->len = 0; - /* printf("%s()-%d: skb=%p, skb->head = %p\n", __FUNCTION__, __LINE__, skb, skb->head); */ - -out: - return skb; -nodata: - _rtw_mfree(skb, sizeof(struct sk_buff)); - skb = NULL; - goto out; - -} - -void dev_kfree_skb_any(struct sk_buff *skb) -{ - /* printf("%s()-%d: skb->head = %p\n", __FUNCTION__, __LINE__, skb->head); */ - if (skb->head) - _rtw_mfree(skb->head, 0); - /* printf("%s()-%d: skb = %p\n", __FUNCTION__, __LINE__, skb); */ - if (skb) - _rtw_mfree(skb, 0); -} -struct sk_buff *skb_clone(const struct sk_buff *skb) -{ - return NULL; -} - -#endif /* PLATFORM_FREEBSD */ - inline struct sk_buff *_rtw_skb_alloc(u32 sz) { #ifdef PLATFORM_LINUX return __dev_alloc_skb(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); #endif /* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - return dev_alloc_skb(sz); -#endif /* PLATFORM_FREEBSD */ } inline void _rtw_skb_free(struct sk_buff *skb) @@ -209,9 +149,6 @@ inline struct sk_buff *_rtw_skb_copy(const struct sk_buff *skb) return skb_copy(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); #endif /* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - return NULL; -#endif /* PLATFORM_FREEBSD */ } inline struct sk_buff *_rtw_skb_clone(struct sk_buff *skb) @@ -220,9 +157,6 @@ inline struct sk_buff *_rtw_skb_clone(struct sk_buff *skb) return skb_clone(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); #endif /* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - return skb_clone(skb); -#endif /* PLATFORM_FREEBSD */ } inline struct sk_buff *_rtw_pskb_copy(struct sk_buff *skb) { @@ -234,9 +168,6 @@ inline struct sk_buff *_rtw_pskb_copy(struct sk_buff *skb) #endif #endif /* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - return NULL; -#endif /* PLATFORM_FREEBSD */ } inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb) @@ -244,11 +175,6 @@ inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb) #if defined(PLATFORM_LINUX) skb->dev = ndev; return netif_rx(skb); -#elif defined(PLATFORM_FREEBSD) - return (*ndev->if_input)(ndev, skb); -#else - rtw_warn_on(1); - return -1; #endif } @@ -296,9 +222,6 @@ inline void *_rtw_usb_buffer_alloc(struct usb_device *dev, size_t size, dma_addr #endif #endif /* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - return malloc(size, M_USBDEV, M_NOWAIT | M_ZERO); -#endif /* PLATFORM_FREEBSD */ } inline void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dma_addr_t dma) { @@ -310,9 +233,6 @@ inline void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr #endif #endif /* PLATFORM_LINUX */ -#ifdef PLATFORM_FREEBSD - free(addr, M_USBDEV); -#endif /* PLATFORM_FREEBSD */ } #endif /* CONFIG_USB_HCI */ @@ -738,10 +658,6 @@ inline void rtw_os_pkt_free(_pkt *pkt) { #if defined(PLATFORM_LINUX) rtw_skb_free(pkt); -#elif defined(PLATFORM_FREEBSD) - m_freem(pkt); -#else - #error "TBD\n" #endif } @@ -749,10 +665,6 @@ inline _pkt *rtw_os_pkt_copy(_pkt *pkt) { #if defined(PLATFORM_LINUX) return rtw_skb_copy(pkt); -#elif defined(PLATFORM_FREEBSD) - return m_dup(pkt, M_NOWAIT); -#else - #error "TBD\n" #endif } @@ -760,10 +672,6 @@ inline void *rtw_os_pkt_data(_pkt *pkt) { #if defined(PLATFORM_LINUX) return pkt->data; -#elif defined(PLATFORM_FREEBSD) - return pkt->m_data; -#else - #error "TBD\n" #endif } @@ -771,38 +679,20 @@ inline u32 rtw_os_pkt_len(_pkt *pkt) { #if defined(PLATFORM_LINUX) return pkt->len; -#elif defined(PLATFORM_FREEBSD) - return pkt->m_pkthdr.len; -#else - #error "TBD\n" #endif } int _rtw_memcmp(const void *dst, const void *src, u32 sz) { -#if defined(PLATFORM_LINUX) || defined (PLATFORM_FREEBSD) /* under Linux/GNU/GLibc, the return value of memcmp for two same mem. chunk is 0 */ if (!(memcmp(dst, src, sz))) return _TRUE; else return _FALSE; -#endif - } -#ifdef PLATFORM_FREEBSD -static inline void __list_add(_list *pnew, _list *pprev, _list *pnext) -{ - pnext->prev = pnew; - pnew->next = pnext; - pnew->prev = pprev; - pprev->next = pnew; -} -#endif /* PLATFORM_FREEBSD */ - - void _rtw_init_listhead(_list *list) { @@ -812,11 +702,6 @@ void _rtw_init_listhead(_list *list) #endif -#ifdef PLATFORM_FREEBSD - list->next = list; - list->prev = list; -#endif - } @@ -835,14 +720,6 @@ u32 rtw_is_list_empty(_list *phead) else return _FALSE; -#endif -#ifdef PLATFORM_FREEBSD - - if (phead->next == phead) - return _TRUE; - else - return _FALSE; - #endif } @@ -854,10 +731,6 @@ void rtw_list_insert_head(_list *plist, _list *phead) list_add(plist, phead); #endif -#ifdef PLATFORM_FREEBSD - __list_add(plist, phead, phead->next); -#endif - } void rtw_list_insert_tail(_list *plist, _list *phead) @@ -868,12 +741,6 @@ void rtw_list_insert_tail(_list *plist, _list *phead) list_add_tail(plist, phead); #endif -#ifdef PLATFORM_FREEBSD - - __list_add(plist, phead->prev, phead); - -#endif - } inline void rtw_list_splice(_list *list, _list *head) @@ -960,10 +827,6 @@ void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc, void *ctx) #ifdef PLATFORM_LINUX _init_timer(ptimer, adapter->pnetdev, pfunc, ctx); #endif -#ifdef PLATFORM_FREEBSD - _init_timer(ptimer, adapter->pifp, pfunc, ctx); -#endif - } /* @@ -981,9 +844,6 @@ void _rtw_init_sema(_sema *sema, int init_val) sema_init(sema, init_val); #endif -#ifdef PLATFORM_FREEBSD - sema_init(sema, init_val, "rtw_drv"); -#endif #ifdef PLATFORM_OS_XP KeInitializeSemaphore(sema, init_val, SEMA_UPBND); /* count=0; */ @@ -999,9 +859,6 @@ void _rtw_init_sema(_sema *sema, int init_val) void _rtw_free_sema(_sema *sema) { -#ifdef PLATFORM_FREEBSD - sema_destroy(sema); -#endif #ifdef PLATFORM_OS_CE CloseHandle(*sema); #endif @@ -1016,9 +873,6 @@ void _rtw_up_sema(_sema *sema) up(sema); #endif -#ifdef PLATFORM_FREEBSD - sema_post(sema); -#endif #ifdef PLATFORM_OS_XP KeReleaseSemaphore(sema, IO_NETWORK_INCREMENT, 1, FALSE); @@ -1041,10 +895,6 @@ u32 _rtw_down_sema(_sema *sema) return _SUCCESS; #endif -#ifdef PLATFORM_FREEBSD - sema_wait(sema); - return _SUCCESS; -#endif #ifdef PLATFORM_OS_XP if (STATUS_SUCCESS == KeWaitForSingleObject(sema, Executive, KernelMode, TRUE, NULL)) @@ -1067,10 +917,6 @@ inline void thread_exit(_completion *comp) complete_and_exit(comp, 0); #endif -#ifdef PLATFORM_FREEBSD - printf("%s", "RTKTHREAD_exit"); -#endif - #ifdef PLATFORM_OS_CE ExitThread(STATUS_SUCCESS); #endif @@ -1110,9 +956,7 @@ void _rtw_mutex_init(_mutex *pmutex) #endif #endif -#ifdef PLATFORM_FREEBSD - mtx_init(pmutex, "", NULL, MTX_DEF | MTX_RECURSE); -#endif + #ifdef PLATFORM_OS_XP KeInitializeMutex(pmutex, 0); @@ -1131,11 +975,6 @@ void _rtw_mutex_free(_mutex *pmutex) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) mutex_destroy(pmutex); -#else -#endif - -#ifdef PLATFORM_FREEBSD - sema_destroy(pmutex); #endif #endif @@ -1157,33 +996,8 @@ void _rtw_spinlock_init(_lock *plock) spin_lock_init(plock); #endif -#ifdef PLATFORM_FREEBSD - mtx_init(plock, "", NULL, MTX_DEF | MTX_RECURSE); -#endif - } -#ifdef PLATFORM_FREEBSD -extern PADAPTER prtw_lock; - -void rtw_mtx_lock(_lock *plock) -{ - if (prtw_lock) - mtx_lock(&prtw_lock->glock); - else - printf("%s prtw_lock==NULL", __FUNCTION__); -} -void rtw_mtx_unlock(_lock *plock) -{ - if (prtw_lock) - mtx_unlock(&prtw_lock->glock); - else - printf("%s prtw_lock==NULL", __FUNCTION__); - -} -#endif /* PLATFORM_FREEBSD */ - - void _rtw_spinlock(_lock *plock) { @@ -1192,10 +1006,6 @@ void _rtw_spinlock(_lock *plock) spin_lock(plock); #endif -#ifdef PLATFORM_FREEBSD - mtx_lock(plock); -#endif - } void _rtw_spinunlock(_lock *plock) @@ -1206,9 +1016,6 @@ void _rtw_spinunlock(_lock *plock) spin_unlock(plock); #endif -#ifdef PLATFORM_FREEBSD - mtx_unlock(plock); -#endif } @@ -1221,10 +1028,6 @@ void _rtw_spinlock_ex(_lock *plock) spin_lock(plock); #endif -#ifdef PLATFORM_FREEBSD - mtx_lock(plock); -#endif - } void _rtw_spinunlock_ex(_lock *plock) @@ -1235,10 +1038,6 @@ void _rtw_spinunlock_ex(_lock *plock) spin_unlock(plock); #endif -#ifdef PLATFORM_FREEBSD - mtx_unlock(plock); -#endif - } @@ -1274,11 +1073,6 @@ systime _rtw_get_current_time(void) #ifdef PLATFORM_LINUX return jiffies; #endif -#ifdef PLATFORM_FREEBSD - struct timeval tvp; - getmicrotime(&tvp); - return tvp.tv_sec; -#endif } inline u32 _rtw_systime_to_ms(systime stime) @@ -1286,9 +1080,6 @@ inline u32 _rtw_systime_to_ms(systime stime) #ifdef PLATFORM_LINUX return jiffies_to_msecs(stime); #endif -#ifdef PLATFORM_FREEBSD - return stime * 1000; -#endif } inline systime _rtw_ms_to_systime(u32 ms) @@ -1296,9 +1087,6 @@ inline systime _rtw_ms_to_systime(u32 ms) #ifdef PLATFORM_LINUX return msecs_to_jiffies(ms); #endif -#ifdef PLATFORM_FREEBSD - return ms / 1000; -#endif } inline systime _rtw_us_to_systime(u32 us) @@ -1350,13 +1138,6 @@ void rtw_usleep_os(int us) #endif #endif -#ifdef PLATFORM_FREEBSD - /* Delay for delay microseconds */ - DELAY(us); - - return ; -#endif - } @@ -1929,82 +1710,11 @@ error: } #endif -#ifdef PLATFORM_FREEBSD -/* - * Copy a buffer from userspace and write into kernel address - * space. - * - * This emulation just calls the FreeBSD copyin function (to - * copy data from user space buffer into a kernel space buffer) - * and is designed to be used with the above io_write_wrapper. - * - * This function should return the number of bytes not copied. - * I.e. success results in a zero value. - * Negative error values are not returned. - */ -unsigned long -copy_from_user(void *to, const void *from, unsigned long n) -{ - if (copyin(from, to, n) != 0) { - /* Any errors will be treated as a failure - to copy any of the requested bytes */ - return n; - } - - return 0; -} - -unsigned long -copy_to_user(void *to, const void *from, unsigned long n) -{ - if (copyout(from, to, n) != 0) { - /* Any errors will be treated as a failure - to copy any of the requested bytes */ - return n; - } - - return 0; -} - - -/* - * The usb_register and usb_deregister functions are used to register - * usb drivers with the usb subsystem. In this compatibility layer - * emulation a list of drivers (struct usb_driver) is maintained - * and is used for probing/attaching etc. - * - * usb_register and usb_deregister simply call these functions. - */ -int -usb_register(struct usb_driver *driver) -{ - rtw_usb_linux_register(driver); - return 0; -} - - -int -usb_deregister(struct usb_driver *driver) -{ - rtw_usb_linux_deregister(driver); - return 0; -} - -void module_init_exit_wrapper(void *arg) -{ - int (*func)(void) = arg; - func(); - return; -} - -#endif /* PLATFORM_FREEBSD */ u64 rtw_division64(u64 x, u64 y) { #ifdef PLATFORM_LINUX do_div(x, y); return x; -#elif defined(PLATFORM_FREEBSD) - return x / y; #endif } @@ -2020,8 +1730,6 @@ inline u32 rtw_random32(void) #else return random32(); #endif -#elif defined(PLATFORM_FREEBSD) -#error "to be implemented\n" #endif }