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