static int run_ccw(struct subchannel_id schid, int cmd, void *ptr, int len)

{

    struct ccw1 ccw = {};

    struct cmd_orb orb = {};

    struct schib schib;

    int r;



    /* start command processing */

    stsch_err(schid, &schib);

    schib.scsw.ctrl = SCSW_FCTL_START_FUNC;

    msch(schid, &schib);



    /* start subchannel command */

    orb.fmt = 1;

    orb.cpa = (u32)(long)&ccw;

    orb.lpm = 0x80;



    ccw.cmd_code = cmd;

    ccw.cda = (long)ptr;

    ccw.count = len;



    r = ssch(schid, &orb);

    /*

     * XXX Wait until device is done processing the CCW. For now we can

     *     assume that a simple tsch will have finished the CCW processing,

     *     but the architecture allows for asynchronous operation

     */

    drain_irqs(schid);

    return r;

}

static int run_ccw(struct subchannel_id schid, int cmd, void *ptr, int len)

{

    struct ccw1 ccw = {};

    struct cmd_orb orb = {};

    struct schib schib;

    int r;



    

    stsch_err(schid, &schib);

    schib.scsw.ctrl = SCSW_FCTL_START_FUNC;

    msch(schid, &schib);



    

    orb.fmt = 1;

    orb.cpa = (u32)(long)&ccw;

    orb.lpm = 0x80;



    ccw.cmd_code = cmd;

    ccw.cda = (long)ptr;

    ccw.count = len;



    r = ssch(schid, &orb);

    









    drain_irqs(schid);

    return r;

}

static int FUNC_0(struct subchannel_id VAR_0, int VAR_1, void *VAR_2, int VAR_3)

{

    struct ccw1 VAR_4 = {};

    struct cmd_orb VAR_5 = {};

    struct VAR_6 VAR_6;

    int VAR_7;



    

    stsch_err(VAR_0, &VAR_6);

    VAR_6.scsw.ctrl = SCSW_FCTL_START_FUNC;

    msch(VAR_0, &VAR_6);



    

    VAR_5.fmt = 1;

    VAR_5.cpa = (u32)(long)&VAR_4;

    VAR_5.lpm = 0x80;



    VAR_4.cmd_code = VAR_1;

    VAR_4.cda = (long)VAR_2;

    VAR_4.count = VAR_3;



    VAR_7 = ssch(VAR_0, &VAR_5);

    









    drain_irqs(VAR_0);

    return VAR_7;

}

static int FUNC_0(struct subchannel_id VAR_0, int VAR_1, void *VAR_2, int VAR_3)
{ struct ccw1 VAR_4 = {}; struct cmd_orb VAR_5 = {}; struct VAR_6 VAR_6; int VAR_7; stsch_err(VAR_0, &VAR_6); VAR_6.scsw.ctrl = SCSW_FCTL_START_FUNC; msch(VAR_0, &VAR_6); VAR_5.fmt = 1; VAR_5.cpa = (u32)(long)&VAR_4; VAR_5.lpm = 0x80; VAR_4.cmd_code = VAR_1; VAR_4.cda = (long)VAR_2; VAR_4.count = VAR_3; VAR_7 = ssch(VAR_0, &VAR_5); drain_irqs(VAR_0); return VAR_7; }