1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /****************************************************************************** 3 * 4 * Copyright(c) 2007 - 2017 Realtek Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of version 2 of the GNU General Public License as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 * more details. 14 * 15 *****************************************************************************/ 16 17 #ifndef __OSDEP_INTF_H_ 18 #define __OSDEP_INTF_H_ 19 20 21 struct intf_priv { 22 23 u8 *intf_dev; 24 u32 max_iosz; /* USB2.0: 128, USB1.1: 64, SDIO:64 */ 25 u32 max_xmitsz; /* USB2.0: unlimited, SDIO:512 */ 26 u32 max_recvsz; /* USB2.0: unlimited, SDIO:512 */ 27 28 volatile u8 *io_rwmem; 29 volatile u8 *allocated_io_rwmem; 30 u32 io_wsz; /* unit: 4bytes */ 31 u32 io_rsz;/* unit: 4bytes */ 32 u8 intf_status; 33 34 void (*_bus_io)(u8 *priv); 35 36 /* 37 Under Sync. IRP (SDIO/USB) 38 A protection mechanism is necessary for the io_rwmem(read/write protocol) 39 40 Under Async. IRP (SDIO/USB) 41 The protection mechanism is through the pending queue. 42 */ 43 44 _mutex ioctl_mutex; 45 46 47 #ifdef PLATFORM_LINUX 48 #ifdef CONFIG_USB_HCI 49 /* when in USB, IO is through interrupt in/out endpoints */ 50 struct usb_device *udev; 51 PURB piorw_urb; 52 u8 io_irp_cnt; 53 u8 bio_irp_pending; 54 _sema io_retevt; 55 _timer io_timer; 56 u8 bio_irp_timeout; 57 u8 bio_timer_cancel; 58 #endif 59 #endif 60 61 }; 62 63 struct dvobj_priv *devobj_init(void); 64 void devobj_deinit(struct dvobj_priv *pdvobj); 65 66 u8 rtw_init_drv_sw(_adapter *padapter); 67 u8 rtw_free_drv_sw(_adapter *padapter); 68 u8 rtw_reset_drv_sw(_adapter *padapter); 69 void rtw_dev_unload(PADAPTER padapter); 70 71 u32 rtw_start_drv_threads(_adapter *padapter); 72 void rtw_stop_drv_threads(_adapter *padapter); 73 #if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) 74 void rtw_cancel_dynamic_chk_timer(_adapter *padapter); 75 #endif 76 void rtw_cancel_all_timer(_adapter *padapter); 77 78 uint loadparam(_adapter *adapter); 79 80 #ifdef PLATFORM_LINUX 81 int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 82 83 int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname); 84 struct net_device *rtw_init_netdev(_adapter *padapter); 85 86 void rtw_os_ndev_free(_adapter *adapter); 87 int rtw_os_ndev_init(_adapter *adapter, const char *name); 88 void rtw_os_ndev_deinit(_adapter *adapter); 89 void rtw_os_ndev_unregister(_adapter *adapter); 90 void rtw_os_ndevs_unregister(struct dvobj_priv *dvobj); 91 int rtw_os_ndevs_init(struct dvobj_priv *dvobj); 92 void rtw_os_ndevs_deinit(struct dvobj_priv *dvobj); 93 94 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) 95 u16 rtw_recv_select_queue(struct sk_buff *skb); 96 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) */ 97 98 int rtw_ndev_notifier_register(void); 99 void rtw_ndev_notifier_unregister(void); 100 void rtw_inetaddr_notifier_register(void); 101 void rtw_inetaddr_notifier_unregister(void); 102 103 #include "../os_dep/linux/rtw_proc.h" 104 105 #ifdef CONFIG_IOCTL_CFG80211 106 #include "../os_dep/linux/ioctl_cfg80211.h" 107 #endif /* CONFIG_IOCTL_CFG80211 */ 108 109 u8 rtw_rtnl_lock_needed(struct dvobj_priv *dvobj); 110 void rtw_set_rtnl_lock_holder(struct dvobj_priv *dvobj, _thread_hdl_ thd_hdl); 111 112 #endif /* PLATFORM_LINUX */ 113 114 115 #ifdef PLATFORM_FREEBSD 116 extern int rtw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); 117 #endif 118 119 void rtw_ips_dev_unload(_adapter *padapter); 120 121 #ifdef CONFIG_IPS 122 int rtw_ips_pwr_up(_adapter *padapter); 123 void rtw_ips_pwr_down(_adapter *padapter); 124 #endif 125 126 #ifdef CONFIG_CONCURRENT_MODE 127 struct _io_ops; 128 struct dvobj_priv; 129 _adapter *rtw_drv_add_vir_if(_adapter *primary_padapter, void (*set_intf_ops)(_adapter *primary_padapter, struct _io_ops *pops)); 130 void rtw_drv_stop_vir_ifaces(struct dvobj_priv *dvobj); 131 void rtw_drv_free_vir_ifaces(struct dvobj_priv *dvobj); 132 #endif 133 134 void rtw_ndev_destructor(_nic_hdl ndev); 135 #ifdef CONFIG_ARP_KEEP_ALIVE 136 int rtw_gw_addr_query(_adapter *padapter); 137 #endif 138 139 int rtw_suspend_common(_adapter *padapter); 140 int rtw_resume_common(_adapter *padapter); 141 142 #endif /* _OSDEP_INTF_H_ */ 143