scsw.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  1. /*
  2. * Helper functions for scsw access.
  3. *
  4. * Copyright IBM Corp. 2008
  5. * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
  6. */
  7. #include <linux/types.h>
  8. #include <linux/module.h>
  9. #include <asm/cio.h>
  10. #include "css.h"
  11. #include "chsc.h"
  12. /**
  13. * scsw_is_tm - check for transport mode scsw
  14. * @scsw: pointer to scsw
  15. *
  16. * Return non-zero if the specified scsw is a transport mode scsw, zero
  17. * otherwise.
  18. */
  19. int scsw_is_tm(union scsw *scsw)
  20. {
  21. return css_general_characteristics.fcx && (scsw->tm.x == 1);
  22. }
  23. EXPORT_SYMBOL(scsw_is_tm);
  24. /**
  25. * scsw_key - return scsw key field
  26. * @scsw: pointer to scsw
  27. *
  28. * Return the value of the key field of the specified scsw, regardless of
  29. * whether it is a transport mode or command mode scsw.
  30. */
  31. u32 scsw_key(union scsw *scsw)
  32. {
  33. if (scsw_is_tm(scsw))
  34. return scsw->tm.key;
  35. else
  36. return scsw->cmd.key;
  37. }
  38. EXPORT_SYMBOL(scsw_key);
  39. /**
  40. * scsw_eswf - return scsw eswf field
  41. * @scsw: pointer to scsw
  42. *
  43. * Return the value of the eswf field of the specified scsw, regardless of
  44. * whether it is a transport mode or command mode scsw.
  45. */
  46. u32 scsw_eswf(union scsw *scsw)
  47. {
  48. if (scsw_is_tm(scsw))
  49. return scsw->tm.eswf;
  50. else
  51. return scsw->cmd.eswf;
  52. }
  53. EXPORT_SYMBOL(scsw_eswf);
  54. /**
  55. * scsw_cc - return scsw cc field
  56. * @scsw: pointer to scsw
  57. *
  58. * Return the value of the cc field of the specified scsw, regardless of
  59. * whether it is a transport mode or command mode scsw.
  60. */
  61. u32 scsw_cc(union scsw *scsw)
  62. {
  63. if (scsw_is_tm(scsw))
  64. return scsw->tm.cc;
  65. else
  66. return scsw->cmd.cc;
  67. }
  68. EXPORT_SYMBOL(scsw_cc);
  69. /**
  70. * scsw_ectl - return scsw ectl field
  71. * @scsw: pointer to scsw
  72. *
  73. * Return the value of the ectl field of the specified scsw, regardless of
  74. * whether it is a transport mode or command mode scsw.
  75. */
  76. u32 scsw_ectl(union scsw *scsw)
  77. {
  78. if (scsw_is_tm(scsw))
  79. return scsw->tm.ectl;
  80. else
  81. return scsw->cmd.ectl;
  82. }
  83. EXPORT_SYMBOL(scsw_ectl);
  84. /**
  85. * scsw_pno - return scsw pno field
  86. * @scsw: pointer to scsw
  87. *
  88. * Return the value of the pno field of the specified scsw, regardless of
  89. * whether it is a transport mode or command mode scsw.
  90. */
  91. u32 scsw_pno(union scsw *scsw)
  92. {
  93. if (scsw_is_tm(scsw))
  94. return scsw->tm.pno;
  95. else
  96. return scsw->cmd.pno;
  97. }
  98. EXPORT_SYMBOL(scsw_pno);
  99. /**
  100. * scsw_fctl - return scsw fctl field
  101. * @scsw: pointer to scsw
  102. *
  103. * Return the value of the fctl field of the specified scsw, regardless of
  104. * whether it is a transport mode or command mode scsw.
  105. */
  106. u32 scsw_fctl(union scsw *scsw)
  107. {
  108. if (scsw_is_tm(scsw))
  109. return scsw->tm.fctl;
  110. else
  111. return scsw->cmd.fctl;
  112. }
  113. EXPORT_SYMBOL(scsw_fctl);
  114. /**
  115. * scsw_actl - return scsw actl field
  116. * @scsw: pointer to scsw
  117. *
  118. * Return the value of the actl field of the specified scsw, regardless of
  119. * whether it is a transport mode or command mode scsw.
  120. */
  121. u32 scsw_actl(union scsw *scsw)
  122. {
  123. if (scsw_is_tm(scsw))
  124. return scsw->tm.actl;
  125. else
  126. return scsw->cmd.actl;
  127. }
  128. EXPORT_SYMBOL(scsw_actl);
  129. /**
  130. * scsw_stctl - return scsw stctl field
  131. * @scsw: pointer to scsw
  132. *
  133. * Return the value of the stctl field of the specified scsw, regardless of
  134. * whether it is a transport mode or command mode scsw.
  135. */
  136. u32 scsw_stctl(union scsw *scsw)
  137. {
  138. if (scsw_is_tm(scsw))
  139. return scsw->tm.stctl;
  140. else
  141. return scsw->cmd.stctl;
  142. }
  143. EXPORT_SYMBOL(scsw_stctl);
  144. /**
  145. * scsw_dstat - return scsw dstat field
  146. * @scsw: pointer to scsw
  147. *
  148. * Return the value of the dstat field of the specified scsw, regardless of
  149. * whether it is a transport mode or command mode scsw.
  150. */
  151. u32 scsw_dstat(union scsw *scsw)
  152. {
  153. if (scsw_is_tm(scsw))
  154. return scsw->tm.dstat;
  155. else
  156. return scsw->cmd.dstat;
  157. }
  158. EXPORT_SYMBOL(scsw_dstat);
  159. /**
  160. * scsw_cstat - return scsw cstat field
  161. * @scsw: pointer to scsw
  162. *
  163. * Return the value of the cstat field of the specified scsw, regardless of
  164. * whether it is a transport mode or command mode scsw.
  165. */
  166. u32 scsw_cstat(union scsw *scsw)
  167. {
  168. if (scsw_is_tm(scsw))
  169. return scsw->tm.cstat;
  170. else
  171. return scsw->cmd.cstat;
  172. }
  173. EXPORT_SYMBOL(scsw_cstat);
  174. /**
  175. * scsw_cmd_is_valid_key - check key field validity
  176. * @scsw: pointer to scsw
  177. *
  178. * Return non-zero if the key field of the specified command mode scsw is
  179. * valid, zero otherwise.
  180. */
  181. int scsw_cmd_is_valid_key(union scsw *scsw)
  182. {
  183. return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
  184. }
  185. EXPORT_SYMBOL(scsw_cmd_is_valid_key);
  186. /**
  187. * scsw_cmd_is_valid_sctl - check fctl field validity
  188. * @scsw: pointer to scsw
  189. *
  190. * Return non-zero if the fctl field of the specified command mode scsw is
  191. * valid, zero otherwise.
  192. */
  193. int scsw_cmd_is_valid_sctl(union scsw *scsw)
  194. {
  195. return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
  196. }
  197. EXPORT_SYMBOL(scsw_cmd_is_valid_sctl);
  198. /**
  199. * scsw_cmd_is_valid_eswf - check eswf field validity
  200. * @scsw: pointer to scsw
  201. *
  202. * Return non-zero if the eswf field of the specified command mode scsw is
  203. * valid, zero otherwise.
  204. */
  205. int scsw_cmd_is_valid_eswf(union scsw *scsw)
  206. {
  207. return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND);
  208. }
  209. EXPORT_SYMBOL(scsw_cmd_is_valid_eswf);
  210. /**
  211. * scsw_cmd_is_valid_cc - check cc field validity
  212. * @scsw: pointer to scsw
  213. *
  214. * Return non-zero if the cc field of the specified command mode scsw is
  215. * valid, zero otherwise.
  216. */
  217. int scsw_cmd_is_valid_cc(union scsw *scsw)
  218. {
  219. return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) &&
  220. (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND);
  221. }
  222. EXPORT_SYMBOL(scsw_cmd_is_valid_cc);
  223. /**
  224. * scsw_cmd_is_valid_fmt - check fmt field validity
  225. * @scsw: pointer to scsw
  226. *
  227. * Return non-zero if the fmt field of the specified command mode scsw is
  228. * valid, zero otherwise.
  229. */
  230. int scsw_cmd_is_valid_fmt(union scsw *scsw)
  231. {
  232. return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
  233. }
  234. EXPORT_SYMBOL(scsw_cmd_is_valid_fmt);
  235. /**
  236. * scsw_cmd_is_valid_pfch - check pfch field validity
  237. * @scsw: pointer to scsw
  238. *
  239. * Return non-zero if the pfch field of the specified command mode scsw is
  240. * valid, zero otherwise.
  241. */
  242. int scsw_cmd_is_valid_pfch(union scsw *scsw)
  243. {
  244. return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
  245. }
  246. EXPORT_SYMBOL(scsw_cmd_is_valid_pfch);
  247. /**
  248. * scsw_cmd_is_valid_isic - check isic field validity
  249. * @scsw: pointer to scsw
  250. *
  251. * Return non-zero if the isic field of the specified command mode scsw is
  252. * valid, zero otherwise.
  253. */
  254. int scsw_cmd_is_valid_isic(union scsw *scsw)
  255. {
  256. return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
  257. }
  258. EXPORT_SYMBOL(scsw_cmd_is_valid_isic);
  259. /**
  260. * scsw_cmd_is_valid_alcc - check alcc field validity
  261. * @scsw: pointer to scsw
  262. *
  263. * Return non-zero if the alcc field of the specified command mode scsw is
  264. * valid, zero otherwise.
  265. */
  266. int scsw_cmd_is_valid_alcc(union scsw *scsw)
  267. {
  268. return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
  269. }
  270. EXPORT_SYMBOL(scsw_cmd_is_valid_alcc);
  271. /**
  272. * scsw_cmd_is_valid_ssi - check ssi field validity
  273. * @scsw: pointer to scsw
  274. *
  275. * Return non-zero if the ssi field of the specified command mode scsw is
  276. * valid, zero otherwise.
  277. */
  278. int scsw_cmd_is_valid_ssi(union scsw *scsw)
  279. {
  280. return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC);
  281. }
  282. EXPORT_SYMBOL(scsw_cmd_is_valid_ssi);
  283. /**
  284. * scsw_cmd_is_valid_zcc - check zcc field validity
  285. * @scsw: pointer to scsw
  286. *
  287. * Return non-zero if the zcc field of the specified command mode scsw is
  288. * valid, zero otherwise.
  289. */
  290. int scsw_cmd_is_valid_zcc(union scsw *scsw)
  291. {
  292. return (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) &&
  293. (scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS);
  294. }
  295. EXPORT_SYMBOL(scsw_cmd_is_valid_zcc);
  296. /**
  297. * scsw_cmd_is_valid_ectl - check ectl field validity
  298. * @scsw: pointer to scsw
  299. *
  300. * Return non-zero if the ectl field of the specified command mode scsw is
  301. * valid, zero otherwise.
  302. */
  303. int scsw_cmd_is_valid_ectl(union scsw *scsw)
  304. {
  305. return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
  306. !(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) &&
  307. (scsw->cmd.stctl & SCSW_STCTL_ALERT_STATUS);
  308. }
  309. EXPORT_SYMBOL(scsw_cmd_is_valid_ectl);
  310. /**
  311. * scsw_cmd_is_valid_pno - check pno field validity
  312. * @scsw: pointer to scsw
  313. *
  314. * Return non-zero if the pno field of the specified command mode scsw is
  315. * valid, zero otherwise.
  316. */
  317. int scsw_cmd_is_valid_pno(union scsw *scsw)
  318. {
  319. return (scsw->cmd.fctl != 0) &&
  320. (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
  321. (!(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) ||
  322. ((scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) &&
  323. (scsw->cmd.actl & SCSW_ACTL_SUSPENDED)));
  324. }
  325. EXPORT_SYMBOL(scsw_cmd_is_valid_pno);
  326. /**
  327. * scsw_cmd_is_valid_fctl - check fctl field validity
  328. * @scsw: pointer to scsw
  329. *
  330. * Return non-zero if the fctl field of the specified command mode scsw is
  331. * valid, zero otherwise.
  332. */
  333. int scsw_cmd_is_valid_fctl(union scsw *scsw)
  334. {
  335. /* Only valid if pmcw.dnv == 1*/
  336. return 1;
  337. }
  338. EXPORT_SYMBOL(scsw_cmd_is_valid_fctl);
  339. /**
  340. * scsw_cmd_is_valid_actl - check actl field validity
  341. * @scsw: pointer to scsw
  342. *
  343. * Return non-zero if the actl field of the specified command mode scsw is
  344. * valid, zero otherwise.
  345. */
  346. int scsw_cmd_is_valid_actl(union scsw *scsw)
  347. {
  348. /* Only valid if pmcw.dnv == 1*/
  349. return 1;
  350. }
  351. EXPORT_SYMBOL(scsw_cmd_is_valid_actl);
  352. /**
  353. * scsw_cmd_is_valid_stctl - check stctl field validity
  354. * @scsw: pointer to scsw
  355. *
  356. * Return non-zero if the stctl field of the specified command mode scsw is
  357. * valid, zero otherwise.
  358. */
  359. int scsw_cmd_is_valid_stctl(union scsw *scsw)
  360. {
  361. /* Only valid if pmcw.dnv == 1*/
  362. return 1;
  363. }
  364. EXPORT_SYMBOL(scsw_cmd_is_valid_stctl);
  365. /**
  366. * scsw_cmd_is_valid_dstat - check dstat field validity
  367. * @scsw: pointer to scsw
  368. *
  369. * Return non-zero if the dstat field of the specified command mode scsw is
  370. * valid, zero otherwise.
  371. */
  372. int scsw_cmd_is_valid_dstat(union scsw *scsw)
  373. {
  374. return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
  375. (scsw->cmd.cc != 3);
  376. }
  377. EXPORT_SYMBOL(scsw_cmd_is_valid_dstat);
  378. /**
  379. * scsw_cmd_is_valid_cstat - check cstat field validity
  380. * @scsw: pointer to scsw
  381. *
  382. * Return non-zero if the cstat field of the specified command mode scsw is
  383. * valid, zero otherwise.
  384. */
  385. int scsw_cmd_is_valid_cstat(union scsw *scsw)
  386. {
  387. return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
  388. (scsw->cmd.cc != 3);
  389. }
  390. EXPORT_SYMBOL(scsw_cmd_is_valid_cstat);
  391. /**
  392. * scsw_tm_is_valid_key - check key field validity
  393. * @scsw: pointer to scsw
  394. *
  395. * Return non-zero if the key field of the specified transport mode scsw is
  396. * valid, zero otherwise.
  397. */
  398. int scsw_tm_is_valid_key(union scsw *scsw)
  399. {
  400. return (scsw->tm.fctl & SCSW_FCTL_START_FUNC);
  401. }
  402. EXPORT_SYMBOL(scsw_tm_is_valid_key);
  403. /**
  404. * scsw_tm_is_valid_eswf - check eswf field validity
  405. * @scsw: pointer to scsw
  406. *
  407. * Return non-zero if the eswf field of the specified transport mode scsw is
  408. * valid, zero otherwise.
  409. */
  410. int scsw_tm_is_valid_eswf(union scsw *scsw)
  411. {
  412. return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND);
  413. }
  414. EXPORT_SYMBOL(scsw_tm_is_valid_eswf);
  415. /**
  416. * scsw_tm_is_valid_cc - check cc field validity
  417. * @scsw: pointer to scsw
  418. *
  419. * Return non-zero if the cc field of the specified transport mode scsw is
  420. * valid, zero otherwise.
  421. */
  422. int scsw_tm_is_valid_cc(union scsw *scsw)
  423. {
  424. return (scsw->tm.fctl & SCSW_FCTL_START_FUNC) &&
  425. (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND);
  426. }
  427. EXPORT_SYMBOL(scsw_tm_is_valid_cc);
  428. /**
  429. * scsw_tm_is_valid_fmt - check fmt field validity
  430. * @scsw: pointer to scsw
  431. *
  432. * Return non-zero if the fmt field of the specified transport mode scsw is
  433. * valid, zero otherwise.
  434. */
  435. int scsw_tm_is_valid_fmt(union scsw *scsw)
  436. {
  437. return 1;
  438. }
  439. EXPORT_SYMBOL(scsw_tm_is_valid_fmt);
  440. /**
  441. * scsw_tm_is_valid_x - check x field validity
  442. * @scsw: pointer to scsw
  443. *
  444. * Return non-zero if the x field of the specified transport mode scsw is
  445. * valid, zero otherwise.
  446. */
  447. int scsw_tm_is_valid_x(union scsw *scsw)
  448. {
  449. return 1;
  450. }
  451. EXPORT_SYMBOL(scsw_tm_is_valid_x);
  452. /**
  453. * scsw_tm_is_valid_q - check q field validity
  454. * @scsw: pointer to scsw
  455. *
  456. * Return non-zero if the q field of the specified transport mode scsw is
  457. * valid, zero otherwise.
  458. */
  459. int scsw_tm_is_valid_q(union scsw *scsw)
  460. {
  461. return 1;
  462. }
  463. EXPORT_SYMBOL(scsw_tm_is_valid_q);
  464. /**
  465. * scsw_tm_is_valid_ectl - check ectl field validity
  466. * @scsw: pointer to scsw
  467. *
  468. * Return non-zero if the ectl field of the specified transport mode scsw is
  469. * valid, zero otherwise.
  470. */
  471. int scsw_tm_is_valid_ectl(union scsw *scsw)
  472. {
  473. return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
  474. !(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
  475. (scsw->tm.stctl & SCSW_STCTL_ALERT_STATUS);
  476. }
  477. EXPORT_SYMBOL(scsw_tm_is_valid_ectl);
  478. /**
  479. * scsw_tm_is_valid_pno - check pno field validity
  480. * @scsw: pointer to scsw
  481. *
  482. * Return non-zero if the pno field of the specified transport mode scsw is
  483. * valid, zero otherwise.
  484. */
  485. int scsw_tm_is_valid_pno(union scsw *scsw)
  486. {
  487. return (scsw->tm.fctl != 0) &&
  488. (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
  489. (!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) ||
  490. ((scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
  491. (scsw->tm.actl & SCSW_ACTL_SUSPENDED)));
  492. }
  493. EXPORT_SYMBOL(scsw_tm_is_valid_pno);
  494. /**
  495. * scsw_tm_is_valid_fctl - check fctl field validity
  496. * @scsw: pointer to scsw
  497. *
  498. * Return non-zero if the fctl field of the specified transport mode scsw is
  499. * valid, zero otherwise.
  500. */
  501. int scsw_tm_is_valid_fctl(union scsw *scsw)
  502. {
  503. /* Only valid if pmcw.dnv == 1*/
  504. return 1;
  505. }
  506. EXPORT_SYMBOL(scsw_tm_is_valid_fctl);
  507. /**
  508. * scsw_tm_is_valid_actl - check actl field validity
  509. * @scsw: pointer to scsw
  510. *
  511. * Return non-zero if the actl field of the specified transport mode scsw is
  512. * valid, zero otherwise.
  513. */
  514. int scsw_tm_is_valid_actl(union scsw *scsw)
  515. {
  516. /* Only valid if pmcw.dnv == 1*/
  517. return 1;
  518. }
  519. EXPORT_SYMBOL(scsw_tm_is_valid_actl);
  520. /**
  521. * scsw_tm_is_valid_stctl - check stctl field validity
  522. * @scsw: pointer to scsw
  523. *
  524. * Return non-zero if the stctl field of the specified transport mode scsw is
  525. * valid, zero otherwise.
  526. */
  527. int scsw_tm_is_valid_stctl(union scsw *scsw)
  528. {
  529. /* Only valid if pmcw.dnv == 1*/
  530. return 1;
  531. }
  532. EXPORT_SYMBOL(scsw_tm_is_valid_stctl);
  533. /**
  534. * scsw_tm_is_valid_dstat - check dstat field validity
  535. * @scsw: pointer to scsw
  536. *
  537. * Return non-zero if the dstat field of the specified transport mode scsw is
  538. * valid, zero otherwise.
  539. */
  540. int scsw_tm_is_valid_dstat(union scsw *scsw)
  541. {
  542. return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
  543. (scsw->tm.cc != 3);
  544. }
  545. EXPORT_SYMBOL(scsw_tm_is_valid_dstat);
  546. /**
  547. * scsw_tm_is_valid_cstat - check cstat field validity
  548. * @scsw: pointer to scsw
  549. *
  550. * Return non-zero if the cstat field of the specified transport mode scsw is
  551. * valid, zero otherwise.
  552. */
  553. int scsw_tm_is_valid_cstat(union scsw *scsw)
  554. {
  555. return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
  556. (scsw->tm.cc != 3);
  557. }
  558. EXPORT_SYMBOL(scsw_tm_is_valid_cstat);
  559. /**
  560. * scsw_tm_is_valid_fcxs - check fcxs field validity
  561. * @scsw: pointer to scsw
  562. *
  563. * Return non-zero if the fcxs field of the specified transport mode scsw is
  564. * valid, zero otherwise.
  565. */
  566. int scsw_tm_is_valid_fcxs(union scsw *scsw)
  567. {
  568. return 1;
  569. }
  570. EXPORT_SYMBOL(scsw_tm_is_valid_fcxs);
  571. /**
  572. * scsw_tm_is_valid_schxs - check schxs field validity
  573. * @scsw: pointer to scsw
  574. *
  575. * Return non-zero if the schxs field of the specified transport mode scsw is
  576. * valid, zero otherwise.
  577. */
  578. int scsw_tm_is_valid_schxs(union scsw *scsw)
  579. {
  580. return (scsw->tm.cstat & (SCHN_STAT_PROG_CHECK |
  581. SCHN_STAT_INTF_CTRL_CHK |
  582. SCHN_STAT_PROT_CHECK |
  583. SCHN_STAT_CHN_DATA_CHK));
  584. }
  585. EXPORT_SYMBOL(scsw_tm_is_valid_schxs);
  586. /**
  587. * scsw_is_valid_actl - check actl field validity
  588. * @scsw: pointer to scsw
  589. *
  590. * Return non-zero if the actl field of the specified scsw is valid,
  591. * regardless of whether it is a transport mode or command mode scsw.
  592. * Return zero if the field does not contain a valid value.
  593. */
  594. int scsw_is_valid_actl(union scsw *scsw)
  595. {
  596. if (scsw_is_tm(scsw))
  597. return scsw_tm_is_valid_actl(scsw);
  598. else
  599. return scsw_cmd_is_valid_actl(scsw);
  600. }
  601. EXPORT_SYMBOL(scsw_is_valid_actl);
  602. /**
  603. * scsw_is_valid_cc - check cc field validity
  604. * @scsw: pointer to scsw
  605. *
  606. * Return non-zero if the cc field of the specified scsw is valid,
  607. * regardless of whether it is a transport mode or command mode scsw.
  608. * Return zero if the field does not contain a valid value.
  609. */
  610. int scsw_is_valid_cc(union scsw *scsw)
  611. {
  612. if (scsw_is_tm(scsw))
  613. return scsw_tm_is_valid_cc(scsw);
  614. else
  615. return scsw_cmd_is_valid_cc(scsw);
  616. }
  617. EXPORT_SYMBOL(scsw_is_valid_cc);
  618. /**
  619. * scsw_is_valid_cstat - check cstat field validity
  620. * @scsw: pointer to scsw
  621. *
  622. * Return non-zero if the cstat field of the specified scsw is valid,
  623. * regardless of whether it is a transport mode or command mode scsw.
  624. * Return zero if the field does not contain a valid value.
  625. */
  626. int scsw_is_valid_cstat(union scsw *scsw)
  627. {
  628. if (scsw_is_tm(scsw))
  629. return scsw_tm_is_valid_cstat(scsw);
  630. else
  631. return scsw_cmd_is_valid_cstat(scsw);
  632. }
  633. EXPORT_SYMBOL(scsw_is_valid_cstat);
  634. /**
  635. * scsw_is_valid_dstat - check dstat field validity
  636. * @scsw: pointer to scsw
  637. *
  638. * Return non-zero if the dstat field of the specified scsw is valid,
  639. * regardless of whether it is a transport mode or command mode scsw.
  640. * Return zero if the field does not contain a valid value.
  641. */
  642. int scsw_is_valid_dstat(union scsw *scsw)
  643. {
  644. if (scsw_is_tm(scsw))
  645. return scsw_tm_is_valid_dstat(scsw);
  646. else
  647. return scsw_cmd_is_valid_dstat(scsw);
  648. }
  649. EXPORT_SYMBOL(scsw_is_valid_dstat);
  650. /**
  651. * scsw_is_valid_ectl - check ectl field validity
  652. * @scsw: pointer to scsw
  653. *
  654. * Return non-zero if the ectl field of the specified scsw is valid,
  655. * regardless of whether it is a transport mode or command mode scsw.
  656. * Return zero if the field does not contain a valid value.
  657. */
  658. int scsw_is_valid_ectl(union scsw *scsw)
  659. {
  660. if (scsw_is_tm(scsw))
  661. return scsw_tm_is_valid_ectl(scsw);
  662. else
  663. return scsw_cmd_is_valid_ectl(scsw);
  664. }
  665. EXPORT_SYMBOL(scsw_is_valid_ectl);
  666. /**
  667. * scsw_is_valid_eswf - check eswf field validity
  668. * @scsw: pointer to scsw
  669. *
  670. * Return non-zero if the eswf field of the specified scsw is valid,
  671. * regardless of whether it is a transport mode or command mode scsw.
  672. * Return zero if the field does not contain a valid value.
  673. */
  674. int scsw_is_valid_eswf(union scsw *scsw)
  675. {
  676. if (scsw_is_tm(scsw))
  677. return scsw_tm_is_valid_eswf(scsw);
  678. else
  679. return scsw_cmd_is_valid_eswf(scsw);
  680. }
  681. EXPORT_SYMBOL(scsw_is_valid_eswf);
  682. /**
  683. * scsw_is_valid_fctl - check fctl field validity
  684. * @scsw: pointer to scsw
  685. *
  686. * Return non-zero if the fctl field of the specified scsw is valid,
  687. * regardless of whether it is a transport mode or command mode scsw.
  688. * Return zero if the field does not contain a valid value.
  689. */
  690. int scsw_is_valid_fctl(union scsw *scsw)
  691. {
  692. if (scsw_is_tm(scsw))
  693. return scsw_tm_is_valid_fctl(scsw);
  694. else
  695. return scsw_cmd_is_valid_fctl(scsw);
  696. }
  697. EXPORT_SYMBOL(scsw_is_valid_fctl);
  698. /**
  699. * scsw_is_valid_key - check key field validity
  700. * @scsw: pointer to scsw
  701. *
  702. * Return non-zero if the key field of the specified scsw is valid,
  703. * regardless of whether it is a transport mode or command mode scsw.
  704. * Return zero if the field does not contain a valid value.
  705. */
  706. int scsw_is_valid_key(union scsw *scsw)
  707. {
  708. if (scsw_is_tm(scsw))
  709. return scsw_tm_is_valid_key(scsw);
  710. else
  711. return scsw_cmd_is_valid_key(scsw);
  712. }
  713. EXPORT_SYMBOL(scsw_is_valid_key);
  714. /**
  715. * scsw_is_valid_pno - check pno field validity
  716. * @scsw: pointer to scsw
  717. *
  718. * Return non-zero if the pno field of the specified scsw is valid,
  719. * regardless of whether it is a transport mode or command mode scsw.
  720. * Return zero if the field does not contain a valid value.
  721. */
  722. int scsw_is_valid_pno(union scsw *scsw)
  723. {
  724. if (scsw_is_tm(scsw))
  725. return scsw_tm_is_valid_pno(scsw);
  726. else
  727. return scsw_cmd_is_valid_pno(scsw);
  728. }
  729. EXPORT_SYMBOL(scsw_is_valid_pno);
  730. /**
  731. * scsw_is_valid_stctl - check stctl field validity
  732. * @scsw: pointer to scsw
  733. *
  734. * Return non-zero if the stctl field of the specified scsw is valid,
  735. * regardless of whether it is a transport mode or command mode scsw.
  736. * Return zero if the field does not contain a valid value.
  737. */
  738. int scsw_is_valid_stctl(union scsw *scsw)
  739. {
  740. if (scsw_is_tm(scsw))
  741. return scsw_tm_is_valid_stctl(scsw);
  742. else
  743. return scsw_cmd_is_valid_stctl(scsw);
  744. }
  745. EXPORT_SYMBOL(scsw_is_valid_stctl);
  746. /**
  747. * scsw_cmd_is_solicited - check for solicited scsw
  748. * @scsw: pointer to scsw
  749. *
  750. * Return non-zero if the command mode scsw indicates that the associated
  751. * status condition is solicited, zero if it is unsolicited.
  752. */
  753. int scsw_cmd_is_solicited(union scsw *scsw)
  754. {
  755. return (scsw->cmd.cc != 0) || (scsw->cmd.stctl !=
  756. (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS));
  757. }
  758. EXPORT_SYMBOL(scsw_cmd_is_solicited);
  759. /**
  760. * scsw_tm_is_solicited - check for solicited scsw
  761. * @scsw: pointer to scsw
  762. *
  763. * Return non-zero if the transport mode scsw indicates that the associated
  764. * status condition is solicited, zero if it is unsolicited.
  765. */
  766. int scsw_tm_is_solicited(union scsw *scsw)
  767. {
  768. return (scsw->tm.cc != 0) || (scsw->tm.stctl !=
  769. (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS));
  770. }
  771. EXPORT_SYMBOL(scsw_tm_is_solicited);
  772. /**
  773. * scsw_is_solicited - check for solicited scsw
  774. * @scsw: pointer to scsw
  775. *
  776. * Return non-zero if the transport or command mode scsw indicates that the
  777. * associated status condition is solicited, zero if it is unsolicited.
  778. */
  779. int scsw_is_solicited(union scsw *scsw)
  780. {
  781. if (scsw_is_tm(scsw))
  782. return scsw_tm_is_solicited(scsw);
  783. else
  784. return scsw_cmd_is_solicited(scsw);
  785. }
  786. EXPORT_SYMBOL(scsw_is_solicited);