qdio.h 17 KB

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