On Fri, 5 Jun 2020 09:37:39 +0200 Pierre Morel <pmorel@xxxxxxxxxxxxx> wrote: > On 2020-05-27 12:09, Cornelia Huck wrote: > > On Mon, 18 May 2020 18:07:30 +0200 > > Pierre Morel <pmorel@xxxxxxxxxxxxx> wrote: > > > >> We add a new css_lib file to contain the I/O functions we may > >> share with different tests. > >> First function is the subchannel_enable() function. > >> > >> When a channel is enabled we can start a SENSE_ID command using > >> the SSCH instruction to recognize the control unit and device. > >> > >> This tests the success of SSCH, the I/O interruption and the TSCH > >> instructions. > >> > >> The test expects a device with a control unit type of 0xC0CA as the > >> first subchannel of the CSS. > > > > It might make sense to extend this to be able to check for any expected > > type (e.g. 0x3832, should my suggestion to split css tests and css-pong > > tests make sense.) > > right. > > > > >> > >> Signed-off-by: Pierre Morel <pmorel@xxxxxxxxxxxxx> > >> --- > >> lib/s390x/css.h | 20 ++++++ > >> lib/s390x/css_lib.c | 55 +++++++++++++++++ > >> s390x/Makefile | 1 + > >> s390x/css.c | 145 ++++++++++++++++++++++++++++++++++++++++++++ > >> 4 files changed, 221 insertions(+) > >> create mode 100644 lib/s390x/css_lib.c > > > > (...) > > > >> +int enable_subchannel(unsigned int sid) > >> +{ > >> + struct schib schib; > >> + struct pmcw *pmcw = &schib.pmcw; > >> + int try_count = 5; > >> + int cc; > >> + > >> + if (!(sid & SID_ONE)) > >> + return -1; > > > > Hm... this error is indistinguishable for the caller from a cc 1 for > > the msch. Use something else (as this is a coding error)? > > right it is a coding error -> assert ? Sounds good to me.