@@ -316,8 +316,8 @@ void css_irq_io(void);
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);
+int wait_and_check_io_completion(int schid, uint32_t ctrl);
+int check_io_completion(int schid, uint32_t ctrl);
/*
* CHSC definitions
@@ -484,8 +484,9 @@ struct ccw1 *ccw_alloc(int code, void *data, int count, unsigned char flags)
/* wait_and_check_io_completion:
* @schid: the subchannel ID
+ * @ctrl : expected SCSW control flags
*/
-int wait_and_check_io_completion(int schid)
+int wait_and_check_io_completion(int schid, uint32_t ctrl)
{
wait_for_interrupt(PSW_MASK_IO);
@@ -494,22 +495,32 @@ int wait_and_check_io_completion(int schid)
return -1;
}
- return check_io_completion(schid);
+ return check_io_completion(schid, ctrl);
}
/* check_io_completion:
* @schid: the subchannel ID
+ * @ctrl : expected SCSW control flags
*
- * Makes the most common check to validate a successful I/O
- * completion.
+ * Perform some standard checks to validate a successful I/O completion.
+ * If the ctrl parameter is not zero, additionally verify that the
+ * specified bits are indicated in the IRB SCSW ctrl flags.
* Only report failures.
*/
-int check_io_completion(int schid)
+int check_io_completion(int schid, uint32_t ctrl)
{
int ret = -1;
report_prefix_push("check I/O completion");
+ if (ctrl) {
+ if (ctrl == irb.scsw.ctrl)
+ ret = 0;
+ else
+ report_info("extected %s != %s", dump_scsw_flags(irb.scsw.ctrl), dump_scsw_flags(ctrl));
+ 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",
@@ -84,7 +84,7 @@ static void test_sense(void)
goto error;
}
- if (wait_and_check_io_completion(test_device_sid) < 0)
+ if (wait_and_check_io_completion(test_device_sid, 0) < 0)
goto error;
/* Test transfer completion */
@@ -127,7 +127,7 @@ static void sense_id(void)
{
assert(!start_ccw1_chain(test_device_sid, ccw));
- assert(wait_and_check_io_completion(test_device_sid) >= 0);
+ assert(wait_and_check_io_completion(test_device_sid, 0) >= 0);
}
static void css_init(void)
When we check for the completion of an I/O, we may need to check the cause of the interrupt depending on the test case. Let's make it possible for the tests to check whether the last valid IRB received indicates the expected functions after executing an instruction or sequence of instructions and if all ctrl flags of the SCSW are set as expected. Signed-off-by: Pierre Morel <pmorel@linux.ibm.com> --- lib/s390x/css.h | 4 ++-- lib/s390x/css_lib.c | 21 ++++++++++++++++----- s390x/css.c | 4 ++-- 3 files changed, 20 insertions(+), 9 deletions(-)