int css_do_ssch(SubchDev *sch, ORB *orb)

{

    SCSW *s = &sch->curr_status.scsw;

    PMCW *p = &sch->curr_status.pmcw;

    int ret;



    if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) {

        ret = -ENODEV;

        goto out;

    }



    if (s->ctrl & SCSW_STCTL_STATUS_PEND) {

        ret = -EINPROGRESS;

        goto out;

    }



    if (s->ctrl & (SCSW_FCTL_START_FUNC |

                   SCSW_FCTL_HALT_FUNC |

                   SCSW_FCTL_CLEAR_FUNC)) {

        ret = -EBUSY;

        goto out;

    }



    /* If monitoring is active, update counter. */

    if (channel_subsys.chnmon_active) {

        css_update_chnmon(sch);

    }

    sch->channel_prog = orb->cpa;

    /* Trigger the start function. */

    s->ctrl |= (SCSW_FCTL_START_FUNC | SCSW_ACTL_START_PEND);

    s->flags &= ~SCSW_FLAGS_MASK_PNO;



    do_subchannel_work(sch, orb);

    ret = 0;



out:

    return ret;

}

int css_do_ssch(SubchDev *sch, ORB *orb)

{

    SCSW *s = &sch->curr_status.scsw;

    PMCW *p = &sch->curr_status.pmcw;

    int ret;



    if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) {

        ret = -ENODEV;

        goto out;

    }



    if (s->ctrl & SCSW_STCTL_STATUS_PEND) {

        ret = -EINPROGRESS;

        goto out;

    }



    if (s->ctrl & (SCSW_FCTL_START_FUNC |

                   SCSW_FCTL_HALT_FUNC |

                   SCSW_FCTL_CLEAR_FUNC)) {

        ret = -EBUSY;

        goto out;

    }



    

    if (channel_subsys.chnmon_active) {

        css_update_chnmon(sch);

    }

    sch->channel_prog = orb->cpa;

    

    s->ctrl |= (SCSW_FCTL_START_FUNC | SCSW_ACTL_START_PEND);

    s->flags &= ~SCSW_FLAGS_MASK_PNO;



    do_subchannel_work(sch, orb);

    ret = 0;



out:

    return ret;

}

int FUNC_0(SubchDev *VAR_0, ORB *VAR_1)

{

    SCSW *s = &VAR_0->curr_status.scsw;

    PMCW *p = &VAR_0->curr_status.pmcw;

    int VAR_2;



    if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) {

        VAR_2 = -ENODEV;

        goto out;

    }



    if (s->ctrl & SCSW_STCTL_STATUS_PEND) {

        VAR_2 = -EINPROGRESS;

        goto out;

    }



    if (s->ctrl & (SCSW_FCTL_START_FUNC |

                   SCSW_FCTL_HALT_FUNC |

                   SCSW_FCTL_CLEAR_FUNC)) {

        VAR_2 = -EBUSY;

        goto out;

    }



    

    if (channel_subsys.chnmon_active) {

        css_update_chnmon(VAR_0);

    }

    VAR_0->channel_prog = VAR_1->cpa;

    

    s->ctrl |= (SCSW_FCTL_START_FUNC | SCSW_ACTL_START_PEND);

    s->flags &= ~SCSW_FLAGS_MASK_PNO;



    do_subchannel_work(VAR_0, VAR_1);

    VAR_2 = 0;



out:

    return VAR_2;

}

int FUNC_0(SubchDev *VAR_0, ORB *VAR_1)
{ SCSW *s = &VAR_0->curr_status.scsw; PMCW *p = &VAR_0->curr_status.pmcw; int VAR_2; if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) { VAR_2 = -ENODEV; goto out; } if (s->ctrl & SCSW_STCTL_STATUS_PEND) { VAR_2 = -EINPROGRESS; goto out; } if (s->ctrl & (SCSW_FCTL_START_FUNC |
SCSW_FCTL_HALT_FUNC |
SCSW_FCTL_CLEAR_FUNC)) { VAR_2 = -EBUSY; goto out; } if (channel_subsys.chnmon_active) { css_update_chnmon(VAR_0); } VAR_0->channel_prog = VAR_1->cpa; s->ctrl |= (SCSW_FCTL_START_FUNC | SCSW_ACTL_START_PEND); s->flags &= ~SCSW_FLAGS_MASK_PNO; do_subchannel_work(VAR_0, VAR_1); VAR_2 = 0; out:
return VAR_2; }