4 #include "osdep_service.h"
5 #include "osdep_intf.h"
9 #define MAX_PROT_SZ (64-16)
12 #define _IO_WAIT_COMPLETE 1
13 #define _IO_WAIT_RSP 2
16 #define _IOSZ_MASK_ (0x7F)
17 #define _IO_WRITE_ BIT(7)
18 #define _IO_FIXED_ BIT(8)
19 #define _IO_BURST_ BIT(9)
20 #define _IO_BYTE_ BIT(10)
21 #define _IO_HW_ BIT(11)
22 #define _IO_WORD_ BIT(12)
23 #define _IO_SYNC_ BIT(13)
24 #define _IO_CMDMASK_ (0x1F80)
27 For prompt mode accessing, caller shall free io_req
28 Otherwise, io_handler will free io_req
31 #define _IO_ERR_ BIT(2)
32 #define _IO_SUCCESS_ BIT(1)
33 #define _IO_DONE_ BIT(0)
34 #define IO_RD32 (_IO_SYNC_ | _IO_WORD_)
35 #define IO_RD16 (_IO_SYNC_ | _IO_HW_)
36 #define IO_RD8 (_IO_SYNC_ | _IO_BYTE_)
37 #define IO_RD32_ASYNC (_IO_WORD_)
38 #define IO_RD16_ASYNC (_IO_HW_)
39 #define IO_RD8_ASYNC (_IO_BYTE_)
40 #define IO_WR32 (_IO_WRITE_ | _IO_SYNC_ | _IO_WORD_)
41 #define IO_WR16 (_IO_WRITE_ | _IO_SYNC_ | _IO_HW_)
42 #define IO_WR8 (_IO_WRITE_ | _IO_SYNC_ | _IO_BYTE_)
43 #define IO_WR32_ASYNC (_IO_WRITE_ | _IO_WORD_)
44 #define IO_WR16_ASYNC (_IO_WRITE_ | _IO_HW_)
45 #define IO_WR8_ASYNC (_IO_WRITE_ | _IO_BYTE_)
47 Only Sync. burst accessing is provided.
49 #define IO_WR_BURST(x) (IO_WRITE_ | _IO_SYNC_ | _IO_BURST_ | \
51 #define IO_RD_BURST(x) (_IO_SYNC_ | _IO_BURST_ | ((x) & _IOSZ_MASK_))
52 /*below is for the intf_option bit defition...*/
53 #define _INTF_ASYNC_ BIT(0) /*support async io*/
58 uint (*_sdbus_read_bytes_to_membuf)(struct intf_priv *pintfpriv,
59 u32 addr, u32 cnt, u8 *pbuf);
60 uint (*_sdbus_read_blocks_to_membuf)(struct intf_priv *pintfpriv,
61 u32 addr, u32 cnt, u8 *pbuf);
62 u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
63 u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
64 u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
65 uint (*_sdbus_write_blocks_from_membuf)(struct intf_priv *pintfpriv,
66 u32 addr, u32 cnt, u8 *pbuf,
68 uint (*_sdbus_write_bytes_from_membuf)(struct intf_priv *pintfpriv,
69 u32 addr, u32 cnt, u8 *pbuf);
70 u8 (*_cmd52r)(struct intf_priv *pintfpriv, u32 addr);
71 void (*_cmd52w)(struct intf_priv *pintfpriv, u32 addr, u8 val8);
72 u8 (*_cmdfunc152r)(struct intf_priv *pintfpriv, u32 addr);
73 void (*_cmdfunc152w)(struct intf_priv *pintfpriv, u32 addr, u8 val8);
74 void (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
75 void (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
76 void (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
77 void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
79 void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
81 void (*_sync_irp_protocol_rw)(struct io_queue *pio_q);
82 u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
84 u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
89 struct list_head list;
95 struct semaphore sema;
96 void (*_async_io_callback)(struct _adapter *padater,
97 struct io_req *pio_req, u8 *cnxt);
105 struct intf_priv *pintfpriv;
106 void (*intf_hdl_init)(u8 *priv);
107 void (*intf_hdl_unload)(u8 *priv);
108 void (*intf_hdl_open)(u8 *priv);
109 void (*intf_hdl_close)(u8 *priv);
110 struct _io_ops io_ops;
113 struct reg_protocol_rd {
115 #ifdef __LITTLE_ENDIAN
122 u32 WriteEnable:1; /*0:read, 1:write*/
123 u32 FixOrContinuous:1; /*0:continuous, 1: Fix*/
146 u32 FixOrContinuous:1;
154 struct reg_protocol_wt {
155 #ifdef __LITTLE_ENDIAN
162 u32 WriteEnable:1; /*0:read, 1:write*/
163 u32 FixOrContinuous:1; /*0:continuous, 1: Fix*/
187 u32 FixOrContinuous:1;
197 Below is the data structure used by _io_handler
202 struct list_head free_ioreqs;
203 /*The io_req list that will be served in the single protocol r/w.*/
204 struct list_head pending;
205 struct list_head processing;
206 u8 *free_ioreqs_buf; /* 4-byte aligned */
207 u8 *pallocated_free_ioreqs_buf;
208 struct intf_hdl intf;
211 static inline u32 _RND4(u32 sz)
214 val = ((sz >> 2) + ((sz & 3) ? 1 : 0)) << 2;
218 u8 r8712_read8(struct _adapter *adapter, u32 addr);
219 u16 r8712_read16(struct _adapter *adapter, u32 addr);
220 u32 r8712_read32(struct _adapter *adapter, u32 addr);
221 void r8712_read_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
222 void r8712_read_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
223 void r8712_write8(struct _adapter *adapter, u32 addr, u8 val);
224 void r8712_write16(struct _adapter *adapter, u32 addr, u16 val);
225 void r8712_write32(struct _adapter *adapter, u32 addr, u32 val);
226 void r8712_write_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
227 void r8712_write_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
229 uint r8712_alloc_io_queue(struct _adapter *adapter);
230 void r8712_free_io_queue(struct _adapter *adapter);
232 #endif /*_RTL8711_IO_H_*/