@@ -278,6 +278,7 @@ int css_enumerate(void);
#define IO_SCH_ISC 3
int css_enable(int schid, int isc);
+bool css_enabled(int schid);
/* Library functions */
int start_ccw1_chain(unsigned int sid, struct ccw1 *ccw);
@@ -161,6 +161,31 @@ out:
return schid;
}
+/*
+ * css_enabled: report if the subchannel is enabled
+ * @schid: Subchannel Identifier
+ * Return value:
+ * true if the subchannel is enabled
+ * false otherwise
+ */
+bool css_enabled(int schid)
+{
+ struct pmcw *pmcw = &schib.pmcw;
+ int cc;
+
+ cc = stsch(schid, &schib);
+ if (cc) {
+ report_info("stsch: updating sch %08x failed with cc=%d",
+ schid, cc);
+ return false;
+ }
+
+ if (!(pmcw->flags & PMCW_ENABLE)) {
+ report_info("stsch: sch %08x not enabled", schid);
+ return false;
+ }
+ return true;
+}
/*
* css_enable: enable the subchannel with the specified ISC
* @schid: Subchannel Identifier
@@ -210,18 +235,8 @@ retry:
/*
* Read the SCHIB again to verify the enablement
*/
- cc = stsch(schid, &schib);
- if (cc) {
- report_info("stsch: updating sch %08x failed with cc=%d",
- schid, cc);
- return cc;
- }
-
- if ((pmcw->flags & flags) == flags) {
- report_info("stsch: sch %08x successfully modified after %d retries",
- schid, retry_count);
+ if (css_enabled(schid))
return 0;
- }
if (retry_count++ < MAX_ENABLE_RETRIES) {
mdelay(10); /* the hardware was not ready, give it some time */
@@ -250,10 +265,6 @@ void css_irq_io(void)
lowcore_ptr->io_int_param, sid);
goto pop;
}
- report_info("subsys_id_word: %08x io_int_param %08x io_int_word %08x",
- lowcore_ptr->subsys_id_word,
- lowcore_ptr->io_int_param,
- lowcore_ptr->io_int_word);
report_prefix_pop();
report_prefix_push("tsch");
@@ -25,6 +25,7 @@ static unsigned long cu_type = DEFAULT_CU_TYPE;
static int test_device_sid;
static struct senseid *senseid;
+struct ccw1 *ccw;
static void test_enumerate(void)
{
@@ -58,7 +59,6 @@ static void test_enable(void)
*/
static void test_sense(void)
{
- struct ccw1 *ccw;
int ret;
int len;
@@ -74,18 +74,12 @@ static void test_sense(void)
return;
}
- ret = register_io_int_func(css_irq_io);
- if (ret) {
- report(0, "Could not register IRQ handler");
- return;
- }
-
lowcore_ptr->io_int_param = 0;
senseid = alloc_io_mem(sizeof(*senseid), 0);
if (!senseid) {
report(0, "Allocation of senseid");
- goto error_senseid;
+ return;
}
ccw = ccw_alloc(CCW_CMD_SENSE_ID, senseid, sizeof(*senseid), CCW_F_SLI);
@@ -137,12 +131,13 @@ error:
free_io_mem(ccw, sizeof(*ccw));
error_ccw:
free_io_mem(senseid, sizeof(*senseid));
-error_senseid:
- unregister_io_int_func(css_irq_io);
}
static void css_init(void)
{
+ assert(register_io_int_func(css_irq_io) == 0);
+ lowcore_ptr->io_int_param = 0;
+
report(get_chsc_scsc(), "Store Channel Characteristics");
}