qdio.h 16 KB

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