qdio.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. #ifndef _CIO_QDIO_H
  2. #define _CIO_QDIO_H
  3. #include <asm/page.h>
  4. #include "schid.h"
  5. #ifdef CONFIG_QDIO_DEBUG
  6. #define QDIO_VERBOSE_LEVEL 9
  7. #else /* CONFIG_QDIO_DEBUG */
  8. #define QDIO_VERBOSE_LEVEL 5
  9. #endif /* CONFIG_QDIO_DEBUG */
  10. #define QDIO_USE_PROCESSING_STATE
  11. #define QDIO_MINIMAL_BH_RELIEF_TIME 16
  12. #define QDIO_TIMER_POLL_VALUE 1
  13. #define IQDIO_TIMER_POLL_VALUE 1
  14. /*
  15. * unfortunately this can't be (QDIO_MAX_BUFFERS_PER_Q*4/3) or so -- as
  16. * we never know, whether we'll get initiative again, e.g. to give the
  17. * transmit skb's back to the stack, however the stack may be waiting for
  18. * them... therefore we define 4 as threshold to start polling (which
  19. * will stop as soon as the asynchronous queue catches up)
  20. * btw, this only applies to the asynchronous HiperSockets queue
  21. */
  22. #define IQDIO_FILL_LEVEL_TO_POLL 4
  23. #define TIQDIO_THININT_ISC 3
  24. #define TIQDIO_DELAY_TARGET 0
  25. #define QDIO_BUSY_BIT_PATIENCE 100 /* in microsecs */
  26. #define QDIO_BUSY_BIT_GIVE_UP 10000000 /* 10 seconds */
  27. #define IQDIO_GLOBAL_LAPS 2 /* GLOBAL_LAPS are not used as we */
  28. #define IQDIO_GLOBAL_LAPS_INT 1 /* don't global summary */
  29. #define IQDIO_LOCAL_LAPS 4
  30. #define IQDIO_LOCAL_LAPS_INT 1
  31. #define IQDIO_GLOBAL_SUMMARY_CC_MASK 2
  32. /*#define IQDIO_IQDC_INT_PARM 0x1234*/
  33. #define QDIO_Q_LAPS 5
  34. #define QDIO_STORAGE_KEY PAGE_DEFAULT_KEY
  35. #define L2_CACHELINE_SIZE 256
  36. #define INDICATORS_PER_CACHELINE (L2_CACHELINE_SIZE/sizeof(__u32))
  37. #define QDIO_PERF "qdio_perf"
  38. /* must be a power of 2 */
  39. /*#define QDIO_STATS_NUMBER 4
  40. #define QDIO_STATS_CLASSES 2
  41. #define QDIO_STATS_COUNT_NEEDED 2*/
  42. #define QDIO_NO_USE_COUNT_TIMEOUT (1*HZ) /* wait for 1 sec on each q before
  43. exiting without having use_count
  44. of the queue to 0 */
  45. #define QDIO_ESTABLISH_TIMEOUT (1*HZ)
  46. #define QDIO_ACTIVATE_TIMEOUT ((5*HZ)>>10)
  47. #define QDIO_CLEANUP_CLEAR_TIMEOUT (20*HZ)
  48. #define QDIO_CLEANUP_HALT_TIMEOUT (10*HZ)
  49. #define QDIO_FORCE_CHECK_TIMEOUT (10*HZ)
  50. enum qdio_irq_states {
  51. QDIO_IRQ_STATE_INACTIVE,
  52. QDIO_IRQ_STATE_ESTABLISHED,
  53. QDIO_IRQ_STATE_ACTIVE,
  54. QDIO_IRQ_STATE_STOPPED,
  55. QDIO_IRQ_STATE_CLEANUP,
  56. QDIO_IRQ_STATE_ERR,
  57. NR_QDIO_IRQ_STATES,
  58. };
  59. /* used as intparm in do_IO: */
  60. #define QDIO_DOING_SENSEID 0
  61. #define QDIO_DOING_ESTABLISH 1
  62. #define QDIO_DOING_ACTIVATE 2
  63. #define QDIO_DOING_CLEANUP 3
  64. /************************* DEBUG FACILITY STUFF *********************/
  65. #define QDIO_DBF_HEX(ex,name,level,addr,len) \
  66. do { \
  67. if (ex) \
  68. debug_exception(qdio_dbf_##name,level,(void*)(addr),len); \
  69. else \
  70. debug_event(qdio_dbf_##name,level,(void*)(addr),len); \
  71. } while (0)
  72. #define QDIO_DBF_TEXT(ex,name,level,text) \
  73. do { \
  74. if (ex) \
  75. debug_text_exception(qdio_dbf_##name,level,text); \
  76. else \
  77. debug_text_event(qdio_dbf_##name,level,text); \
  78. } while (0)
  79. #define QDIO_DBF_HEX0(ex,name,addr,len) QDIO_DBF_HEX(ex,name,0,addr,len)
  80. #define QDIO_DBF_HEX1(ex,name,addr,len) QDIO_DBF_HEX(ex,name,1,addr,len)
  81. #define QDIO_DBF_HEX2(ex,name,addr,len) QDIO_DBF_HEX(ex,name,2,addr,len)
  82. #ifdef CONFIG_QDIO_DEBUG
  83. #define QDIO_DBF_HEX3(ex,name,addr,len) QDIO_DBF_HEX(ex,name,3,addr,len)
  84. #define QDIO_DBF_HEX4(ex,name,addr,len) QDIO_DBF_HEX(ex,name,4,addr,len)
  85. #define QDIO_DBF_HEX5(ex,name,addr,len) QDIO_DBF_HEX(ex,name,5,addr,len)
  86. #define QDIO_DBF_HEX6(ex,name,addr,len) QDIO_DBF_HEX(ex,name,6,addr,len)
  87. #else /* CONFIG_QDIO_DEBUG */
  88. #define QDIO_DBF_HEX3(ex,name,addr,len) do {} while (0)
  89. #define QDIO_DBF_HEX4(ex,name,addr,len) do {} while (0)
  90. #define QDIO_DBF_HEX5(ex,name,addr,len) do {} while (0)
  91. #define QDIO_DBF_HEX6(ex,name,addr,len) do {} while (0)
  92. #endif /* CONFIG_QDIO_DEBUG */
  93. #define QDIO_DBF_TEXT0(ex,name,text) QDIO_DBF_TEXT(ex,name,0,text)
  94. #define QDIO_DBF_TEXT1(ex,name,text) QDIO_DBF_TEXT(ex,name,1,text)
  95. #define QDIO_DBF_TEXT2(ex,name,text) QDIO_DBF_TEXT(ex,name,2,text)
  96. #ifdef CONFIG_QDIO_DEBUG
  97. #define QDIO_DBF_TEXT3(ex,name,text) QDIO_DBF_TEXT(ex,name,3,text)
  98. #define QDIO_DBF_TEXT4(ex,name,text) QDIO_DBF_TEXT(ex,name,4,text)
  99. #define QDIO_DBF_TEXT5(ex,name,text) QDIO_DBF_TEXT(ex,name,5,text)
  100. #define QDIO_DBF_TEXT6(ex,name,text) QDIO_DBF_TEXT(ex,name,6,text)
  101. #else /* CONFIG_QDIO_DEBUG */
  102. #define QDIO_DBF_TEXT3(ex,name,text) do {} while (0)
  103. #define QDIO_DBF_TEXT4(ex,name,text) do {} while (0)
  104. #define QDIO_DBF_TEXT5(ex,name,text) do {} while (0)
  105. #define QDIO_DBF_TEXT6(ex,name,text) do {} while (0)
  106. #endif /* CONFIG_QDIO_DEBUG */
  107. #define QDIO_DBF_SETUP_NAME "qdio_setup"
  108. #define QDIO_DBF_SETUP_LEN 8
  109. #define QDIO_DBF_SETUP_PAGES 4
  110. #define QDIO_DBF_SETUP_NR_AREAS 1
  111. #ifdef CONFIG_QDIO_DEBUG
  112. #define QDIO_DBF_SETUP_LEVEL 6
  113. #else /* CONFIG_QDIO_DEBUG */
  114. #define QDIO_DBF_SETUP_LEVEL 2
  115. #endif /* CONFIG_QDIO_DEBUG */
  116. #define QDIO_DBF_SBAL_NAME "qdio_labs" /* sbal */
  117. #define QDIO_DBF_SBAL_LEN 256
  118. #define QDIO_DBF_SBAL_PAGES 4
  119. #define QDIO_DBF_SBAL_NR_AREAS 2
  120. #ifdef CONFIG_QDIO_DEBUG
  121. #define QDIO_DBF_SBAL_LEVEL 6
  122. #else /* CONFIG_QDIO_DEBUG */
  123. #define QDIO_DBF_SBAL_LEVEL 2
  124. #endif /* CONFIG_QDIO_DEBUG */
  125. #define QDIO_DBF_TRACE_NAME "qdio_trace"
  126. #define QDIO_DBF_TRACE_LEN 8
  127. #define QDIO_DBF_TRACE_NR_AREAS 2
  128. #ifdef CONFIG_QDIO_DEBUG
  129. #define QDIO_DBF_TRACE_PAGES 16
  130. #define QDIO_DBF_TRACE_LEVEL 4 /* -------- could be even more verbose here */
  131. #else /* CONFIG_QDIO_DEBUG */
  132. #define QDIO_DBF_TRACE_PAGES 4
  133. #define QDIO_DBF_TRACE_LEVEL 2
  134. #endif /* CONFIG_QDIO_DEBUG */
  135. #define QDIO_DBF_SENSE_NAME "qdio_sense"
  136. #define QDIO_DBF_SENSE_LEN 64
  137. #define QDIO_DBF_SENSE_PAGES 2
  138. #define QDIO_DBF_SENSE_NR_AREAS 1
  139. #ifdef CONFIG_QDIO_DEBUG
  140. #define QDIO_DBF_SENSE_LEVEL 6
  141. #else /* CONFIG_QDIO_DEBUG */
  142. #define QDIO_DBF_SENSE_LEVEL 2
  143. #endif /* CONFIG_QDIO_DEBUG */
  144. #ifdef CONFIG_QDIO_DEBUG
  145. #define QDIO_TRACE_QTYPE QDIO_ZFCP_QFMT
  146. #define QDIO_DBF_SLSB_OUT_NAME "qdio_slsb_out"
  147. #define QDIO_DBF_SLSB_OUT_LEN QDIO_MAX_BUFFERS_PER_Q
  148. #define QDIO_DBF_SLSB_OUT_PAGES 256
  149. #define QDIO_DBF_SLSB_OUT_NR_AREAS 1
  150. #define QDIO_DBF_SLSB_OUT_LEVEL 6
  151. #define QDIO_DBF_SLSB_IN_NAME "qdio_slsb_in"
  152. #define QDIO_DBF_SLSB_IN_LEN QDIO_MAX_BUFFERS_PER_Q
  153. #define QDIO_DBF_SLSB_IN_PAGES 256
  154. #define QDIO_DBF_SLSB_IN_NR_AREAS 1
  155. #define QDIO_DBF_SLSB_IN_LEVEL 6
  156. #endif /* CONFIG_QDIO_DEBUG */
  157. #define QDIO_PRINTK_HEADER QDIO_NAME ": "
  158. #if QDIO_VERBOSE_LEVEL>8
  159. #define QDIO_PRINT_STUPID(x...) printk( KERN_DEBUG QDIO_PRINTK_HEADER x)
  160. #else
  161. #define QDIO_PRINT_STUPID(x...) do { } while (0)
  162. #endif
  163. #if QDIO_VERBOSE_LEVEL>7
  164. #define QDIO_PRINT_ALL(x...) printk( QDIO_PRINTK_HEADER x)
  165. #else
  166. #define QDIO_PRINT_ALL(x...) do { } while (0)
  167. #endif
  168. #if QDIO_VERBOSE_LEVEL>6
  169. #define QDIO_PRINT_INFO(x...) printk( QDIO_PRINTK_HEADER x)
  170. #else
  171. #define QDIO_PRINT_INFO(x...) do { } while (0)
  172. #endif
  173. #if QDIO_VERBOSE_LEVEL>5
  174. #define QDIO_PRINT_WARN(x...) printk( QDIO_PRINTK_HEADER x)
  175. #else
  176. #define QDIO_PRINT_WARN(x...) do { } while (0)
  177. #endif
  178. #if QDIO_VERBOSE_LEVEL>4
  179. #define QDIO_PRINT_ERR(x...) printk( QDIO_PRINTK_HEADER x)
  180. #else
  181. #define QDIO_PRINT_ERR(x...) do { } while (0)
  182. #endif
  183. #if QDIO_VERBOSE_LEVEL>3
  184. #define QDIO_PRINT_CRIT(x...) printk( QDIO_PRINTK_HEADER x)
  185. #else
  186. #define QDIO_PRINT_CRIT(x...) do { } while (0)
  187. #endif
  188. #if QDIO_VERBOSE_LEVEL>2
  189. #define QDIO_PRINT_ALERT(x...) printk( QDIO_PRINTK_HEADER x)
  190. #else
  191. #define QDIO_PRINT_ALERT(x...) do { } while (0)
  192. #endif
  193. #if QDIO_VERBOSE_LEVEL>1
  194. #define QDIO_PRINT_EMERG(x...) printk( QDIO_PRINTK_HEADER x)
  195. #else
  196. #define QDIO_PRINT_EMERG(x...) do { } while (0)
  197. #endif
  198. #define QDIO_HEXDUMP16(importance,header,ptr) \
  199. QDIO_PRINT_##importance(header "%02x %02x %02x %02x " \
  200. "%02x %02x %02x %02x %02x %02x %02x %02x " \
  201. "%02x %02x %02x %02x\n",*(((char*)ptr)), \
  202. *(((char*)ptr)+1),*(((char*)ptr)+2), \
  203. *(((char*)ptr)+3),*(((char*)ptr)+4), \
  204. *(((char*)ptr)+5),*(((char*)ptr)+6), \
  205. *(((char*)ptr)+7),*(((char*)ptr)+8), \
  206. *(((char*)ptr)+9),*(((char*)ptr)+10), \
  207. *(((char*)ptr)+11),*(((char*)ptr)+12), \
  208. *(((char*)ptr)+13),*(((char*)ptr)+14), \
  209. *(((char*)ptr)+15)); \
  210. QDIO_PRINT_##importance(header "%02x %02x %02x %02x %02x %02x %02x %02x " \
  211. "%02x %02x %02x %02x %02x %02x %02x %02x\n", \
  212. *(((char*)ptr)+16),*(((char*)ptr)+17), \
  213. *(((char*)ptr)+18),*(((char*)ptr)+19), \
  214. *(((char*)ptr)+20),*(((char*)ptr)+21), \
  215. *(((char*)ptr)+22),*(((char*)ptr)+23), \
  216. *(((char*)ptr)+24),*(((char*)ptr)+25), \
  217. *(((char*)ptr)+26),*(((char*)ptr)+27), \
  218. *(((char*)ptr)+28),*(((char*)ptr)+29), \
  219. *(((char*)ptr)+30),*(((char*)ptr)+31));
  220. /****************** END OF DEBUG FACILITY STUFF *********************/
  221. /*
  222. * Some instructions as assembly
  223. */
  224. static inline int
  225. do_sqbs(unsigned long sch, unsigned char state, int queue,
  226. unsigned int *start, unsigned int *count)
  227. {
  228. #ifdef CONFIG_64BIT
  229. register unsigned long _ccq asm ("0") = *count;
  230. register unsigned long _sch asm ("1") = sch;
  231. unsigned long _queuestart = ((unsigned long)queue << 32) | *start;
  232. asm volatile(
  233. " .insn rsy,0xeb000000008A,%1,0,0(%2)"
  234. : "+d" (_ccq), "+d" (_queuestart)
  235. : "d" ((unsigned long)state), "d" (_sch)
  236. : "memory", "cc");
  237. *count = _ccq & 0xff;
  238. *start = _queuestart & 0xff;
  239. return (_ccq >> 32) & 0xff;
  240. #else
  241. return 0;
  242. #endif
  243. }
  244. static inline int
  245. do_eqbs(unsigned long sch, unsigned char *state, int queue,
  246. unsigned int *start, unsigned int *count)
  247. {
  248. #ifdef CONFIG_64BIT
  249. register unsigned long _ccq asm ("0") = *count;
  250. register unsigned long _sch asm ("1") = sch;
  251. unsigned long _queuestart = ((unsigned long)queue << 32) | *start;
  252. unsigned long _state = 0;
  253. asm volatile(
  254. " .insn rrf,0xB99c0000,%1,%2,0,0"
  255. : "+d" (_ccq), "+d" (_queuestart), "+d" (_state)
  256. : "d" (_sch)
  257. : "memory", "cc" );
  258. *count = _ccq & 0xff;
  259. *start = _queuestart & 0xff;
  260. *state = _state & 0xff;
  261. return (_ccq >> 32) & 0xff;
  262. #else
  263. return 0;
  264. #endif
  265. }
  266. static inline int
  267. do_siga_sync(struct subchannel_id schid, unsigned int mask1, unsigned int mask2)
  268. {
  269. register unsigned long reg0 asm ("0") = 2;
  270. register struct subchannel_id reg1 asm ("1") = schid;
  271. register unsigned long reg2 asm ("2") = mask1;
  272. register unsigned long reg3 asm ("3") = mask2;
  273. int cc;
  274. asm volatile(
  275. " siga 0\n"
  276. " ipm %0\n"
  277. " srl %0,28\n"
  278. : "=d" (cc)
  279. : "d" (reg0), "d" (reg1), "d" (reg2), "d" (reg3) : "cc");
  280. return cc;
  281. }
  282. static inline int
  283. do_siga_input(struct subchannel_id schid, unsigned int mask)
  284. {
  285. register unsigned long reg0 asm ("0") = 1;
  286. register struct subchannel_id reg1 asm ("1") = schid;
  287. register unsigned long reg2 asm ("2") = mask;
  288. int cc;
  289. asm volatile(
  290. " siga 0\n"
  291. " ipm %0\n"
  292. " srl %0,28\n"
  293. : "=d" (cc)
  294. : "d" (reg0), "d" (reg1), "d" (reg2) : "cc", "memory");
  295. return cc;
  296. }
  297. static inline int
  298. do_siga_output(unsigned long schid, unsigned long mask, __u32 *bb,
  299. unsigned int fc)
  300. {
  301. register unsigned long __fc asm("0") = fc;
  302. register unsigned long __schid asm("1") = schid;
  303. register unsigned long __mask asm("2") = mask;
  304. int cc;
  305. asm volatile(
  306. " siga 0\n"
  307. "0: ipm %0\n"
  308. " srl %0,28\n"
  309. "1:\n"
  310. EX_TABLE(0b,1b)
  311. : "=d" (cc), "+d" (__fc), "+d" (__schid), "+d" (__mask)
  312. : "0" (QDIO_SIGA_ERROR_ACCESS_EXCEPTION)
  313. : "cc", "memory");
  314. (*bb) = ((unsigned int) __fc) >> 31;
  315. return cc;
  316. }
  317. static inline unsigned long
  318. do_clear_global_summary(void)
  319. {
  320. register unsigned long __fn asm("1") = 3;
  321. register unsigned long __tmp asm("2");
  322. register unsigned long __time asm("3");
  323. asm volatile(
  324. " .insn rre,0xb2650000,2,0"
  325. : "+d" (__fn), "=d" (__tmp), "=d" (__time));
  326. return __time;
  327. }
  328. /*
  329. * QDIO device commands returned by extended Sense-ID
  330. */
  331. #define DEFAULT_ESTABLISH_QS_CMD 0x1b
  332. #define DEFAULT_ESTABLISH_QS_COUNT 0x1000
  333. #define DEFAULT_ACTIVATE_QS_CMD 0x1f
  334. #define DEFAULT_ACTIVATE_QS_COUNT 0
  335. /*
  336. * additional CIWs returned by extended Sense-ID
  337. */
  338. #define CIW_TYPE_EQUEUE 0x3 /* establish QDIO queues */
  339. #define CIW_TYPE_AQUEUE 0x4 /* activate QDIO queues */
  340. #define QDIO_CHSC_RESPONSE_CODE_OK 1
  341. /* flags for st qdio sch data */
  342. #define CHSC_FLAG_QDIO_CAPABILITY 0x80
  343. #define CHSC_FLAG_VALIDITY 0x40
  344. #define CHSC_FLAG_SIGA_INPUT_NECESSARY 0x40
  345. #define CHSC_FLAG_SIGA_OUTPUT_NECESSARY 0x20
  346. #define CHSC_FLAG_SIGA_SYNC_NECESSARY 0x10
  347. #define CHSC_FLAG_SIGA_SYNC_DONE_ON_THININTS 0x08
  348. #define CHSC_FLAG_SIGA_SYNC_DONE_ON_OUTB_PCIS 0x04
  349. struct qdio_perf_stats {
  350. #ifdef CONFIG_64BIT
  351. atomic64_t tl_runs;
  352. atomic64_t outbound_tl_runs;
  353. atomic64_t outbound_tl_runs_resched;
  354. atomic64_t inbound_tl_runs;
  355. atomic64_t inbound_tl_runs_resched;
  356. atomic64_t inbound_thin_tl_runs;
  357. atomic64_t inbound_thin_tl_runs_resched;
  358. atomic64_t siga_outs;
  359. atomic64_t siga_ins;
  360. atomic64_t siga_syncs;
  361. atomic64_t pcis;
  362. atomic64_t thinints;
  363. atomic64_t fast_reqs;
  364. atomic64_t outbound_cnt;
  365. atomic64_t inbound_cnt;
  366. #else /* CONFIG_64BIT */
  367. atomic_t tl_runs;
  368. atomic_t outbound_tl_runs;
  369. atomic_t outbound_tl_runs_resched;
  370. atomic_t inbound_tl_runs;
  371. atomic_t inbound_tl_runs_resched;
  372. atomic_t inbound_thin_tl_runs;
  373. atomic_t inbound_thin_tl_runs_resched;
  374. atomic_t siga_outs;
  375. atomic_t siga_ins;
  376. atomic_t siga_syncs;
  377. atomic_t pcis;
  378. atomic_t thinints;
  379. atomic_t fast_reqs;
  380. atomic_t outbound_cnt;
  381. atomic_t inbound_cnt;
  382. #endif /* CONFIG_64BIT */
  383. };
  384. /* unlikely as the later the better */
  385. #define SYNC_MEMORY if (unlikely(q->siga_sync)) qdio_siga_sync_q(q)
  386. #define SYNC_MEMORY_ALL if (unlikely(q->siga_sync)) \
  387. qdio_siga_sync(q,~0U,~0U)
  388. #define SYNC_MEMORY_ALL_OUTB if (unlikely(q->siga_sync)) \
  389. qdio_siga_sync(q,~0U,0)
  390. #define NOW qdio_get_micros()
  391. #define SAVE_TIMESTAMP(q) q->timing.last_transfer_time=NOW
  392. #define GET_SAVED_TIMESTAMP(q) (q->timing.last_transfer_time)
  393. #define SAVE_FRONTIER(q,val) q->last_move_ftc=val
  394. #define GET_SAVED_FRONTIER(q) (q->last_move_ftc)
  395. #define MY_MODULE_STRING(x) #x
  396. #ifdef CONFIG_64BIT
  397. #define QDIO_GET_ADDR(x) ((__u32)(unsigned long)x)
  398. #else /* CONFIG_64BIT */
  399. #define QDIO_GET_ADDR(x) ((__u32)(long)x)
  400. #endif /* CONFIG_64BIT */
  401. struct qdio_q {
  402. volatile struct slsb slsb;
  403. char unused[QDIO_MAX_BUFFERS_PER_Q];
  404. __u32 * dev_st_chg_ind;
  405. int is_input_q;
  406. struct subchannel_id schid;
  407. struct ccw_device *cdev;
  408. unsigned int is_iqdio_q;
  409. unsigned int is_thinint_q;
  410. /* bit 0 means queue 0, bit 1 means queue 1, ... */
  411. unsigned int mask;
  412. unsigned int q_no;
  413. qdio_handler_t (*handler);
  414. /* points to the next buffer to be checked for having
  415. * been processed by the card (outbound)
  416. * or to the next buffer the program should check for (inbound) */
  417. volatile int first_to_check;
  418. /* and the last time it was: */
  419. volatile int last_move_ftc;
  420. atomic_t number_of_buffers_used;
  421. atomic_t polling;
  422. unsigned int siga_in;
  423. unsigned int siga_out;
  424. unsigned int siga_sync;
  425. unsigned int siga_sync_done_on_thinints;
  426. unsigned int siga_sync_done_on_outb_tis;
  427. unsigned int hydra_gives_outbound_pcis;
  428. /* used to save beginning position when calling dd_handlers */
  429. int first_element_to_kick;
  430. atomic_t use_count;
  431. atomic_t is_in_shutdown;
  432. void *irq_ptr;
  433. struct timer_list timer;
  434. #ifdef QDIO_USE_TIMERS_FOR_POLLING
  435. atomic_t timer_already_set;
  436. spinlock_t timer_lock;
  437. #else /* QDIO_USE_TIMERS_FOR_POLLING */
  438. struct tasklet_struct tasklet;
  439. #endif /* QDIO_USE_TIMERS_FOR_POLLING */
  440. enum qdio_irq_states state;
  441. /* used to store the error condition during a data transfer */
  442. unsigned int qdio_error;
  443. unsigned int siga_error;
  444. unsigned int error_status_flags;
  445. /* list of interesting queues */
  446. volatile struct qdio_q *list_next;
  447. volatile struct qdio_q *list_prev;
  448. struct sl *sl;
  449. volatile struct sbal *sbal[QDIO_MAX_BUFFERS_PER_Q];
  450. struct qdio_buffer *qdio_buffers[QDIO_MAX_BUFFERS_PER_Q];
  451. unsigned long int_parm;
  452. /*struct {
  453. int in_bh_check_limit;
  454. int threshold;
  455. } threshold_classes[QDIO_STATS_CLASSES];*/
  456. struct {
  457. /* inbound: the time to stop polling
  458. outbound: the time to kick peer */
  459. int threshold; /* the real value */
  460. /* outbound: last time of do_QDIO
  461. inbound: last time of noticing incoming data */
  462. /*__u64 last_transfer_times[QDIO_STATS_NUMBER];
  463. int last_transfer_index; */
  464. __u64 last_transfer_time;
  465. __u64 busy_start;
  466. } timing;
  467. atomic_t busy_siga_counter;
  468. unsigned int queue_type;
  469. unsigned int is_pci_out;
  470. /* leave this member at the end. won't be cleared in qdio_fill_qs */
  471. struct slib *slib; /* a page is allocated under this pointer,
  472. sl points into this page, offset PAGE_SIZE/2
  473. (after slib) */
  474. } __attribute__ ((aligned(256)));
  475. struct qdio_irq {
  476. __u32 * volatile dev_st_chg_ind;
  477. unsigned long int_parm;
  478. struct subchannel_id schid;
  479. unsigned int is_iqdio_irq;
  480. unsigned int is_thinint_irq;
  481. unsigned int hydra_gives_outbound_pcis;
  482. unsigned int sync_done_on_outb_pcis;
  483. /* QEBSM facility */
  484. unsigned int is_qebsm;
  485. unsigned long sch_token;
  486. enum qdio_irq_states state;
  487. unsigned int no_input_qs;
  488. unsigned int no_output_qs;
  489. unsigned char qdioac;
  490. struct ccw1 ccw;
  491. struct ciw equeue;
  492. struct ciw aqueue;
  493. struct qib qib;
  494. void (*original_int_handler) (struct ccw_device *,
  495. unsigned long, struct irb *);
  496. /* leave these four members together at the end. won't be cleared in qdio_fill_irq */
  497. struct qdr *qdr;
  498. struct qdio_q *input_qs[QDIO_MAX_QUEUES_PER_IRQ];
  499. struct qdio_q *output_qs[QDIO_MAX_QUEUES_PER_IRQ];
  500. struct semaphore setting_up_sema;
  501. };
  502. #endif