Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
Larry Finger | a8d7606 | 2012-01-07 20:46:42 -0600 | [diff] [blame] | 3 | * Copyright(c) 2009-2012 Realtek Corporation. |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of version 2 of the GNU General Public License as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA |
| 17 | * |
| 18 | * The full GNU General Public License is included in this distribution in the |
| 19 | * file called LICENSE. |
| 20 | * |
| 21 | * Contact Information: |
| 22 | * wlanfae <wlanfae@realtek.com> |
| 23 | * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, |
| 24 | * Hsinchu 300, Taiwan. |
| 25 | * |
| 26 | * Larry Finger <Larry.Finger@lwfinger.net> |
| 27 | * |
| 28 | *****************************************************************************/ |
| 29 | |
| 30 | #ifndef __RTL_PCI_H__ |
| 31 | #define __RTL_PCI_H__ |
| 32 | |
| 33 | #include <linux/pci.h> |
| 34 | /* |
| 35 | 1: MSDU packet queue, |
| 36 | 2: Rx Command Queue |
| 37 | */ |
| 38 | #define RTL_PCI_RX_MPDU_QUEUE 0 |
| 39 | #define RTL_PCI_RX_CMD_QUEUE 1 |
| 40 | #define RTL_PCI_MAX_RX_QUEUE 2 |
| 41 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 42 | #define RTL_PCI_MAX_RX_COUNT 512/*64*/ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 43 | #define RTL_PCI_MAX_TX_QUEUE_COUNT 9 |
| 44 | |
| 45 | #define RT_TXDESC_NUM 128 |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 46 | #define TX_DESC_NUM_92E 512 |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 47 | #define RT_TXDESC_NUM_BE_QUEUE 256 |
| 48 | |
| 49 | #define BK_QUEUE 0 |
| 50 | #define BE_QUEUE 1 |
| 51 | #define VI_QUEUE 2 |
| 52 | #define VO_QUEUE 3 |
| 53 | #define BEACON_QUEUE 4 |
| 54 | #define TXCMD_QUEUE 5 |
| 55 | #define MGNT_QUEUE 6 |
| 56 | #define HIGH_QUEUE 7 |
| 57 | #define HCCA_QUEUE 8 |
| 58 | |
| 59 | #define RTL_PCI_DEVICE(vend, dev, cfg) \ |
| 60 | .vendor = (vend), \ |
| 61 | .device = (dev), \ |
| 62 | .subvendor = PCI_ANY_ID, \ |
| 63 | .subdevice = PCI_ANY_ID,\ |
| 64 | .driver_data = (kernel_ulong_t)&(cfg) |
| 65 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 66 | #define INTEL_VENDOR_ID 0x8086 |
| 67 | #define SIS_VENDOR_ID 0x1039 |
| 68 | #define ATI_VENDOR_ID 0x1002 |
| 69 | #define ATI_DEVICE_ID 0x7914 |
| 70 | #define AMD_VENDOR_ID 0x1022 |
| 71 | |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 72 | #define PCI_MAX_BRIDGE_NUMBER 255 |
| 73 | #define PCI_MAX_DEVICES 32 |
| 74 | #define PCI_MAX_FUNCTION 8 |
| 75 | |
| 76 | #define PCI_CONF_ADDRESS 0x0CF8 /*PCI Configuration Space Address */ |
| 77 | #define PCI_CONF_DATA 0x0CFC /*PCI Configuration Space Data */ |
| 78 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 79 | #define PCI_CLASS_BRIDGE_DEV 0x06 |
| 80 | #define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04 |
| 81 | #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10 |
| 82 | #define PCI_CAP_ID_EXP 0x10 |
| 83 | |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 84 | #define U1DONTCARE 0xFF |
| 85 | #define U2DONTCARE 0xFFFF |
| 86 | #define U4DONTCARE 0xFFFFFFFF |
| 87 | |
| 88 | #define RTL_PCI_8192_DID 0x8192 /*8192 PCI-E */ |
| 89 | #define RTL_PCI_8192SE_DID 0x8192 /*8192 SE */ |
| 90 | #define RTL_PCI_8174_DID 0x8174 /*8192 SE */ |
| 91 | #define RTL_PCI_8173_DID 0x8173 /*8191 SE Crab */ |
| 92 | #define RTL_PCI_8172_DID 0x8172 /*8191 SE RE */ |
| 93 | #define RTL_PCI_8171_DID 0x8171 /*8191 SE Unicron */ |
Larry Finger | 0f01545 | 2012-10-25 13:46:46 -0500 | [diff] [blame] | 94 | #define RTL_PCI_8723AE_DID 0x8723 /*8723AE */ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 95 | #define RTL_PCI_0045_DID 0x0045 /*8190 PCI for Ceraga */ |
| 96 | #define RTL_PCI_0046_DID 0x0046 /*8190 Cardbus for Ceraga */ |
| 97 | #define RTL_PCI_0044_DID 0x0044 /*8192e PCIE for Ceraga */ |
| 98 | #define RTL_PCI_0047_DID 0x0047 /*8192e Express Card for Ceraga */ |
| 99 | #define RTL_PCI_700F_DID 0x700F |
| 100 | #define RTL_PCI_701F_DID 0x701F |
| 101 | #define RTL_PCI_DLINK_DID 0x3304 |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 102 | #define RTL_PCI_8723AE_DID 0x8723 /*8723e */ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 103 | #define RTL_PCI_8192CET_DID 0x8191 /*8192ce */ |
| 104 | #define RTL_PCI_8192CE_DID 0x8178 /*8192ce */ |
| 105 | #define RTL_PCI_8191CE_DID 0x8177 /*8192ce */ |
| 106 | #define RTL_PCI_8188CE_DID 0x8176 /*8192ce */ |
| 107 | #define RTL_PCI_8192CU_DID 0x8191 /*8192ce */ |
Chaoming_Li | c7cfe38 | 2011-04-25 13:23:15 -0500 | [diff] [blame] | 108 | #define RTL_PCI_8192DE_DID 0x8193 /*8192de */ |
| 109 | #define RTL_PCI_8192DE_DID2 0x002B /*92DE*/ |
Larry Finger | 5c69177 | 2013-03-24 22:06:56 -0500 | [diff] [blame] | 110 | #define RTL_PCI_8188EE_DID 0x8179 /*8188ee*/ |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 111 | #define RTL_PCI_8723BE_DID 0xB723 /*8723be*/ |
| 112 | #define RTL_PCI_8192EE_DID 0x818B /*8192ee*/ |
| 113 | #define RTL_PCI_8821AE_DID 0x8821 /*8821ae*/ |
| 114 | #define RTL_PCI_8812AE_DID 0x8812 /*8812ae*/ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 115 | |
| 116 | /*8192 support 16 pages of IO registers*/ |
| 117 | #define RTL_MEM_MAPPED_IO_RANGE_8190PCI 0x1000 |
| 118 | #define RTL_MEM_MAPPED_IO_RANGE_8192PCIE 0x4000 |
| 119 | #define RTL_MEM_MAPPED_IO_RANGE_8192SE 0x4000 |
| 120 | #define RTL_MEM_MAPPED_IO_RANGE_8192CE 0x4000 |
| 121 | #define RTL_MEM_MAPPED_IO_RANGE_8192DE 0x4000 |
| 122 | |
| 123 | #define RTL_PCI_REVISION_ID_8190PCI 0x00 |
| 124 | #define RTL_PCI_REVISION_ID_8192PCIE 0x01 |
| 125 | #define RTL_PCI_REVISION_ID_8192SE 0x10 |
| 126 | #define RTL_PCI_REVISION_ID_8192CE 0x1 |
| 127 | #define RTL_PCI_REVISION_ID_8192DE 0x0 |
| 128 | |
| 129 | #define RTL_DEFAULT_HARDWARE_TYPE HARDWARE_TYPE_RTL8192CE |
| 130 | |
| 131 | enum pci_bridge_vendor { |
| 132 | PCI_BRIDGE_VENDOR_INTEL = 0x0, /*0b'0000,0001 */ |
| 133 | PCI_BRIDGE_VENDOR_ATI, /*0b'0000,0010*/ |
| 134 | PCI_BRIDGE_VENDOR_AMD, /*0b'0000,0100*/ |
| 135 | PCI_BRIDGE_VENDOR_SIS, /*0b'0000,1000*/ |
| 136 | PCI_BRIDGE_VENDOR_UNKNOWN, /*0b'0100,0000*/ |
| 137 | PCI_BRIDGE_VENDOR_MAX, |
| 138 | }; |
| 139 | |
Chaoming_Li | c7cfe38 | 2011-04-25 13:23:15 -0500 | [diff] [blame] | 140 | struct rtl_pci_capabilities_header { |
| 141 | u8 capability_id; |
| 142 | u8 next; |
| 143 | }; |
| 144 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 145 | /* In new TRX flow, Buffer_desc is new concept |
| 146 | * But TX wifi info == TX descriptor in old flow |
| 147 | * RX wifi info == RX descriptor in old flow |
| 148 | */ |
| 149 | struct rtl_tx_buffer_desc { |
| 150 | #if (RTL8192EE_SEG_NUM == 2) |
| 151 | u32 dword[2*(DMA_IS_64BIT + 1)*8]; /*seg = 8*/ |
| 152 | #elif (RTL8192EE_SEG_NUM == 1) |
| 153 | u32 dword[2*(DMA_IS_64BIT + 1)*4]; /*seg = 4*/ |
| 154 | #elif (RTL8192EE_SEG_NUM == 0) |
| 155 | u32 dword[2*(DMA_IS_64BIT + 1)*2]; /*seg = 2*/ |
| 156 | #endif |
John W. Linville | e137478 | 2010-12-16 09:20:16 -0500 | [diff] [blame] | 157 | } __packed; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 158 | |
| 159 | struct rtl_tx_desc { |
| 160 | u32 dword[16]; |
John W. Linville | e137478 | 2010-12-16 09:20:16 -0500 | [diff] [blame] | 161 | } __packed; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 162 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 163 | struct rtl_rx_buffer_desc { /*rx buffer desc*/ |
| 164 | u32 dword[2]; |
John W. Linville | e137478 | 2010-12-16 09:20:16 -0500 | [diff] [blame] | 165 | } __packed; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 166 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 167 | struct rtl_rx_desc { /*old: rx desc new: rx wifi info*/ |
| 168 | u32 dword[8]; |
| 169 | } __packed; |
| 170 | |
| 171 | struct rtl_tx_cmd_desc { |
| 172 | u32 dword[16]; |
Larry Finger | f3355dd | 2014-03-04 16:53:47 -0600 | [diff] [blame] | 173 | } __packed; |
| 174 | |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 175 | struct rtl8192_tx_ring { |
| 176 | struct rtl_tx_desc *desc; |
| 177 | dma_addr_t dma; |
| 178 | unsigned int idx; |
| 179 | unsigned int entries; |
| 180 | struct sk_buff_head queue; |
Larry Finger | f3355dd | 2014-03-04 16:53:47 -0600 | [diff] [blame] | 181 | /*add for new trx flow*/ |
| 182 | struct rtl_tx_buffer_desc *buffer_desc; /*tx buffer descriptor*/ |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 183 | dma_addr_t buffer_desc_dma; /*tx bufferd desc dma memory*/ |
| 184 | u16 avl_desc; /* available_desc_to_write */ |
| 185 | u16 cur_tx_wp; /* current_tx_write_point */ |
| 186 | u16 cur_tx_rp; /* current_tx_read_point */ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 187 | }; |
| 188 | |
| 189 | struct rtl8192_rx_ring { |
| 190 | struct rtl_rx_desc *desc; |
| 191 | dma_addr_t dma; |
| 192 | unsigned int idx; |
| 193 | struct sk_buff *rx_buf[RTL_PCI_MAX_RX_COUNT]; |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 194 | /*add for new trx flow*/ |
| 195 | struct rtl_rx_buffer_desc *buffer_desc; /*rx buffer descriptor*/ |
| 196 | u16 next_rx_rp; /* next_rx_read_point */ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 197 | }; |
| 198 | |
| 199 | struct rtl_pci { |
| 200 | struct pci_dev *pdev; |
Larry Finger | a290593 | 2012-10-25 13:46:45 -0500 | [diff] [blame] | 201 | bool irq_enabled; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 202 | |
| 203 | bool driver_is_goingto_unload; |
| 204 | bool up_first_time; |
Chaoming_Li | c7cfe38 | 2011-04-25 13:23:15 -0500 | [diff] [blame] | 205 | bool first_init; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 206 | bool being_init_adapter; |
Chaoming_Li | c7cfe38 | 2011-04-25 13:23:15 -0500 | [diff] [blame] | 207 | bool init_ready; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 208 | |
| 209 | /*Tx */ |
| 210 | struct rtl8192_tx_ring tx_ring[RTL_PCI_MAX_TX_QUEUE_COUNT]; |
| 211 | int txringcount[RTL_PCI_MAX_TX_QUEUE_COUNT]; |
| 212 | u32 transmit_config; |
| 213 | |
| 214 | /*Rx */ |
| 215 | struct rtl8192_rx_ring rx_ring[RTL_PCI_MAX_RX_QUEUE]; |
| 216 | int rxringcount; |
| 217 | u16 rxbuffersize; |
| 218 | u32 receive_config; |
| 219 | |
| 220 | /*irq */ |
| 221 | u8 irq_alloc; |
| 222 | u32 irq_mask[2]; |
Larry Finger | 26634c4 | 2013-03-24 22:06:33 -0500 | [diff] [blame] | 223 | u32 sys_irq_mask; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 224 | |
| 225 | /*Bcn control register setting */ |
| 226 | u32 reg_bcn_ctrl_val; |
| 227 | |
| 228 | /*ASPM*/ u8 const_pci_aspm; |
| 229 | u8 const_amdpci_aspm; |
| 230 | u8 const_hwsw_rfoff_d3; |
| 231 | u8 const_support_pciaspm; |
| 232 | /*pci-e bridge */ |
| 233 | u8 const_hostpci_aspm_setting; |
| 234 | /*pci-e device */ |
| 235 | u8 const_devicepci_aspm_setting; |
| 236 | /*If it supports ASPM, Offset[560h] = 0x40, |
| 237 | otherwise Offset[560h] = 0x00. */ |
Larry Finger | 3247328 | 2011-03-27 16:19:57 -0500 | [diff] [blame] | 238 | bool support_aspm; |
| 239 | bool support_backdoor; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 240 | |
| 241 | /*QOS & EDCA */ |
| 242 | enum acm_method acm_method; |
Chaoming_Li | c7cfe38 | 2011-04-25 13:23:15 -0500 | [diff] [blame] | 243 | |
| 244 | u16 shortretry_limit; |
| 245 | u16 longretry_limit; |
Larry Finger | 2cddad3 | 2014-02-28 15:16:46 -0600 | [diff] [blame] | 246 | |
| 247 | /* MSI support */ |
| 248 | bool msi_support; |
| 249 | bool using_msi; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 250 | }; |
| 251 | |
| 252 | struct mp_adapter { |
| 253 | u8 linkctrl_reg; |
| 254 | |
| 255 | u8 busnumber; |
| 256 | u8 devnumber; |
| 257 | u8 funcnumber; |
| 258 | |
| 259 | u8 pcibridge_busnum; |
| 260 | u8 pcibridge_devnum; |
| 261 | u8 pcibridge_funcnum; |
| 262 | |
| 263 | u8 pcibridge_vendor; |
| 264 | u16 pcibridge_vendorid; |
| 265 | u16 pcibridge_deviceid; |
| 266 | |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 267 | u8 num4bytes; |
| 268 | |
| 269 | u8 pcibridge_pciehdr_offset; |
| 270 | u8 pcibridge_linkctrlreg; |
| 271 | |
| 272 | bool amd_l1_patch; |
| 273 | }; |
| 274 | |
| 275 | struct rtl_pci_priv { |
| 276 | struct rtl_pci dev; |
| 277 | struct mp_adapter ndis_adapter; |
| 278 | struct rtl_led_ctl ledctl; |
Chaoming_Li | c7cfe38 | 2011-04-25 13:23:15 -0500 | [diff] [blame] | 279 | struct bt_coexist_info bt_coexist; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 280 | }; |
| 281 | |
| 282 | #define rtl_pcipriv(hw) (((struct rtl_pci_priv *)(rtl_priv(hw))->priv)) |
| 283 | #define rtl_pcidev(pcipriv) (&((pcipriv)->dev)) |
| 284 | |
| 285 | int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw); |
| 286 | |
| 287 | extern struct rtl_intf_ops rtl_pci_ops; |
| 288 | |
Bill Pemberton | 9e2ff36 | 2012-12-03 09:56:43 -0500 | [diff] [blame] | 289 | int rtl_pci_probe(struct pci_dev *pdev, |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 290 | const struct pci_device_id *id); |
| 291 | void rtl_pci_disconnect(struct pci_dev *pdev); |
Hauke Mehrtens | 244a77e | 2012-11-29 23:27:17 +0100 | [diff] [blame] | 292 | #ifdef CONFIG_PM_SLEEP |
Larry Finger | 603be38 | 2011-10-11 21:28:47 -0500 | [diff] [blame] | 293 | int rtl_pci_suspend(struct device *dev); |
| 294 | int rtl_pci_resume(struct device *dev); |
Hauke Mehrtens | 244a77e | 2012-11-29 23:27:17 +0100 | [diff] [blame] | 295 | #endif /* CONFIG_PM_SLEEP */ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 296 | static inline u8 pci_read8_sync(struct rtl_priv *rtlpriv, u32 addr) |
| 297 | { |
Larry Finger | 62e6397 | 2011-02-11 14:27:46 -0600 | [diff] [blame] | 298 | return readb((u8 __iomem *) rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | static inline u16 pci_read16_sync(struct rtl_priv *rtlpriv, u32 addr) |
| 302 | { |
Larry Finger | 62e6397 | 2011-02-11 14:27:46 -0600 | [diff] [blame] | 303 | return readw((u8 __iomem *) rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | static inline u32 pci_read32_sync(struct rtl_priv *rtlpriv, u32 addr) |
| 307 | { |
Larry Finger | 62e6397 | 2011-02-11 14:27:46 -0600 | [diff] [blame] | 308 | return readl((u8 __iomem *) rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 309 | } |
| 310 | |
| 311 | static inline void pci_write8_async(struct rtl_priv *rtlpriv, u32 addr, u8 val) |
| 312 | { |
Larry Finger | 62e6397 | 2011-02-11 14:27:46 -0600 | [diff] [blame] | 313 | writeb(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 314 | } |
| 315 | |
| 316 | static inline void pci_write16_async(struct rtl_priv *rtlpriv, |
| 317 | u32 addr, u16 val) |
| 318 | { |
Larry Finger | 62e6397 | 2011-02-11 14:27:46 -0600 | [diff] [blame] | 319 | writew(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 320 | } |
| 321 | |
| 322 | static inline void pci_write32_async(struct rtl_priv *rtlpriv, |
| 323 | u32 addr, u32 val) |
| 324 | { |
Larry Finger | 62e6397 | 2011-02-11 14:27:46 -0600 | [diff] [blame] | 325 | writel(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 326 | } |
| 327 | |
Larry Finger | 6d4beca | 2015-02-03 11:15:18 -0600 | [diff] [blame] | 328 | static inline u16 calc_fifo_space(u16 rp, u16 wp) |
| 329 | { |
| 330 | if (rp <= wp) |
| 331 | return RTL_PCI_MAX_RX_COUNT - 1 + rp - wp; |
| 332 | return rp - wp - 1; |
| 333 | } |
| 334 | |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 335 | #endif |