@@ -317,6 +317,7 @@ int css_residual_count(unsigned int schid);
void enable_io_isc(uint8_t isc);
int wait_and_check_io_completion(int schid);
+int check_io_completion(int schid);
/*
* CHSC definitions
@@ -483,55 +483,59 @@ struct ccw1 *ccw_alloc(int code, void *data, int count, unsigned char flags)
}
/* wait_and_check_io_completion:
+ * @schid: the subchannel ID
+ */
+int wait_and_check_io_completion(int schid)
+{
+ wait_for_interrupt(PSW_MASK_IO);
+
+ if (lowcore_ptr->io_int_param != schid) {
+ report(0, "interrupt parameter: expected %08x got %08x", schid, lowcore_ptr->io_int_param);
+ return -1;
+ }
+
+ return check_io_completion(schid);
+}
+
+/* check_io_completion:
* @schid: the subchannel ID
*
* Makes the most common check to validate a successful I/O
* completion.
* Only report failures.
*/
-int wait_and_check_io_completion(int schid)
+int check_io_completion(int schid)
{
- int ret = 0;
-
- wait_for_interrupt(PSW_MASK_IO);
+ int ret = -1;
report_prefix_push("check I/O completion");
- if (lowcore_ptr->io_int_param != schid) {
- report(0, "interrupt parameter: expected %08x got %08x",
- schid, lowcore_ptr->io_int_param);
- ret = -1;
- goto end;
- }
-
/* Verify that device status is valid */
if (!(irb.scsw.ctrl & SCSW_SC_PENDING)) {
report(0, "No status pending after interrupt. Subch Ctrl: %08x",
irb.scsw.ctrl);
- ret = -1;
goto end;
}
if (!(irb.scsw.ctrl & (SCSW_SC_SECONDARY | SCSW_SC_PRIMARY))) {
report(0, "Primary or secondary status missing. Subch Ctrl: %08x",
irb.scsw.ctrl);
- ret = -1;
goto end;
}
if (!(irb.scsw.dev_stat & (SCSW_DEVS_DEV_END | SCSW_DEVS_SCH_END))) {
report(0, "No device end or sch end. Dev. status: %02x",
irb.scsw.dev_stat);
- ret = -1;
goto end;
}
if (irb.scsw.sch_stat & ~SCSW_SCHS_IL) {
report_info("Unexpected Subch. status %02x", irb.scsw.sch_stat);
- ret = -1;
goto end;
}
+ ret = 0;
+
end:
report_prefix_pop();
return ret;
We will may want to check the result of an I/O without waiting for an interrupt. For example because we do not handle interrupt. Let's separate waiting for interrupt and the I/O completion check. Signed-off-by: Pierre Morel <pmorel@linux.ibm.com> --- lib/s390x/css.h | 1 + lib/s390x/css_lib.c | 34 +++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 15 deletions(-)