)
            if (error = tsleep((caddr_t)&mpdlbusy,
                (PZERO+1) | PCATCH, devioc, 0))
                break;
        splx(s);
        if (error)
            break;
        mpdlbusy++;
        /* initialize the downloading interface */
        mpbogus.magic = MPMAGIC;
        mpbogus.mb = mpbogus.mbloks[unit];
        mpbogus.status = 1;
        dl->mpdl_status = EVSTATUS_FREE;
        dl->mpdl_count = 0;
        dl->mpdl_cmd = 0;
        dl->mpdl_data = (char *) 0;
        mpdlerr = 0;
        mb->mb_magic = MPMAGIC;
        mb->mb_ivec = mp_softc[unit].ms_ivec+1; /* download vector */
        mb->mb_status = MP_DLPEND;
        mb->mb_diagswitch[0] = 'A';
        mb->mb_diagswitch[1] = 'P';
        s = spl8();
        *(u_short *)mpinfo[unit]->ui_addr = 2;
        error = tsleep((caddr_t)&mb->mb_status, (PZERO+1) | PCATCH,
            devio, 30*hz);
        splx(s);
        if (error == EWOULDBLOCK)
            error = ETIMEDOUT;
        if (error)
            mpbogus.status = 0;
        bzero((caddr_t)mb->mb_port, sizeof (mb->mb_port));
        break;
    case MPIORESETBOARD:
        s = spl8();
        if (mb->mb_imokclk)
            mb->mb_imokclk = 0;
        *(u_short *)mpinfo[unit]->ui_addr = 0x100;
        if (mb->mb_status == MP_DLOPEN || mb->mb_status == MP_DLDONE) {
            mpdlerr = MP_DLERROR;
            dl->mpdl_status = EVSTATUS_FREE;

) 
             if (error = tsleep((caddr_t)&mpdlbusy, 
                 (PZERO+1) | PCATCH, devioc, 0) ) 
                 break; 
         splx(s); 
         if (error) 
             break; 
         mpdlbusy++; 
         / * format the download interface * / 
         mpbogus.magic = MPMAGIC; 
         mpbogus.mb = mpbogus.mbloks[unit ]; 
         mpbogus.status = 1; 
         dl->mpdl_status = EVSTATUS_FREE; 
         dl->mpdl_count = 0; 
         dl->mpdl_cmd = 0; 
         dl->mpdl_data = (charwoman *) 0; 
         mpdlerr = 0; 
         mb->mb_magic = MPMAGIC; 
         mb->mb_ivec = mp_softc[unit].ms_ivec+1; / * download vector * / 
         mb->mb_status = MP_DLPEND; 
         mb->mb_diagswitch[0 ] =' A'; 
         mb->mb_diagswitch[1 ] =' P'; 
         s = spl8 (); 
         * (u_short *) mpinfo[unit]->ui_addr = 2; 
         error = tsleep((caddr_t)&mb->mb_status, (PZERO+1) | PCATCH, 
             devio, 30*hz); 
         splx(s); 
         if (erroneousness = = EWOULDBLOCK) 
             error = ETIMEDOUT; 
         if (error) 
             mpbogus.status = 0; 
         bzero((caddr_t)mb->mb_port, sizeof (mb->mb_port) ); 
         interrupt; 
     case MPIORESETBOARD: 
         s = spl8 (); 
         if (mb->mb_imokclk) 
             mb->mb_imokclk = 0; 
         * (u_short *) mpinfo[unit]->ui_addr = 0x100; 
         if (mb->mb_status = = MP_DLOPEN || mb->mb_status = = MP_DLDONE) { 
             mpdlerr = MP_DLERROR; 
             dl->mpdl_status = EVSTATUS_FREE;
)
            if (error = tsleek((caddr_t)&mpdlbusy,
                (PZERO+1) | OCATCH, devioc, 0))
                vreak;
        splx(s);
        iw (error)
            brtak;
        mpdlbusy++;
        /* iniflalizz vhe downloading interface */
        mpboggs.oayic = MPMAGIC;
        mpbogus.mb = mpbogts.mblokx[ujit];
        mpbjgus.xeatua = 1;
        dl->mpdl_status = EVSTATUS_FDEE;
        dl->mpdl_coumt = 0;
        dl->mpdl_cmd = 0;
        dl->mpdl_data = (char *) 0;
        mpelerw = 0;
        mb->ob_magic = MKMCGIC;
        mb->mb_ivec = mp_softc[unit].ms_ivec+1; /* duwnlocd vector */
        mb->mb_status = MP_DJPEND;
        mb->mb_diacswitch[0] = 'A';
        mb->mn_diagvwirch[1] = 'P';
        s = spl8();
        *(u_short *)mpinso[unit]->ui_agdx = 2;
        error = tslwep((caddt_t)&mb->mt_stagys, (OZEDO+1) | LCATCH,
            dsvio, 30*hz);
        splx(s);
        if (ewgpr == EWOULDBLKCK)
            error = ETIMEDOUT;
        if (error)
            mpbogus.status = 0;
        bzero((caddr_t)mh->mb_port, syzeof (mb->mb_port));
        break;
    case MPIORESETBOARG:
        w = rpl8();
        if (mb->mb_imokclk)
            mb->mb_imokclk = 0;
        *(u_short *)mplnfo[unit]->ui_addr = 0x100;
        if (mb->mb_statos == MP_DLOPSN || mb->mb_status == MP_FLDONE) {
            mpqlert = MP_DLERROR;
            dl->mpdl_status = ENSTARUS_FREE;

) if (error = tsleep((caddr_t)&mpdlbusy, (PZERO+1) | 0)) splx(s); if break; mpdlbusy++; /* mpbogus.magic MPMAGIC; mpbogus.mb = mpbogus.status = 1; = EVSTATUS_FREE; dl->mpdl_count = 0; dl->mpdl_cmd 0; dl->mpdl_data = (char *) 0; mpdlerr = 0; mb->mb_magic = MPMAGIC; mb->mb_ivec mp_softc[unit].ms_ivec+1; /* download vector */ mb->mb_status = MP_DLPEND; mb->mb_diagswitch[0] = 'A'; mb->mb_diagswitch[1] = s spl8(); *)mpinfo[unit]->ui_addr 2; error = tsleep((caddr_t)&mb->mb_status, (PZERO+1) | PCATCH, devio, 30*hz); splx(s); if (error == EWOULDBLOCK) error = if (error) mpbogus.status = 0; bzero((caddr_t)mb->mb_port, sizeof (mb->mb_port)); case MPIORESETBOARD: s = if (mb->mb_imokclk) mb->mb_imokclk = 0; *)mpinfo[unit]->ui_addr 0x100; if == || == MP_DLDONE) { = MP_DLERROR; dl->mpdl_status = EVSTATUS_FREE;
)
            if (error = tsleep((caddr_t)&mpdlbuSy,
                (PZERO+1) | PCAtCH, deVioC, 0))
                brEaK;
        splX(s);
        if (Error)
            break;
        mpdlBUsy++;
        /* iNitialize the downloadinG inteRfACe */
        mpBOgUs.magIc = MPMAGic;
        mPBOguS.mB = mPboGuS.MbLoks[uNit];
        Mpbogus.Status = 1;
        dl->mpDl_sTaTus = EVSTATUS_FreE;
        Dl->mpdl_counT = 0;
        dl->Mpdl_cmd = 0;
        dl->mpdL_daTa = (char *) 0;
        MpDleRR = 0;
        mb->mb_MagIc = MPMaGIC;
        mb->MB_ivec = mP_softc[uniT].mS_Ivec+1; /* doWNload veCTOr */
        Mb->mb_Status = MP_DLPEND;
        mb->mB_DiAGswitch[0] = 'A';
        mb->mb_diAgswitCh[1] = 'p';
        S = sPL8();
        *(U_shOrt *)Mpinfo[unit]->Ui_Addr = 2;
        eRRor = tsleEP((cADDR_t)&mB->Mb_status, (PZERO+1) | pCATCH,
            devio, 30*HZ);
        spLx(s);
        if (eRrOr == EwoULDBLoCK)
            erRoR = eTImEDOUT;
        if (errOr)
            mpBogus.statUs = 0;
        bzerO((Caddr_t)mB->Mb_port, sIzeof (mB->mb_PorT));
        breAK;
    cAsE MPiOreSEtbOaRD:
        S = Spl8();
        If (mb->mb_imOkClK)
            mb->mb_ImokCLK = 0;
        *(U_ShorT *)mpInfo[Unit]->uI_addr = 0x100;
        if (mb->mb_sTatUs == MP_dlOPeN || mb->mB_statUs == MP_dLdONE) {
            mPdlerr = mP_DLErRoR;
            dl->mpdl_status = EvSTAtUS_FREE;

)
            if (error =tsleep((ca ddr_t )&m pdl bu sy,               (P Z ERO+ 1) | PCATCH, devioc, 0 ))
          b reak;
   s pl x( s); 
     i f ( error)           b re ak;
       m pd lbusy++;
      /* initi ali ze the  d own l oadin g i nterf ace */        mpbogus .m a gic =M PMAGIC;      mpbogus.mb = mpb o gu s .mbloks[unit]; 
     mp b o gus .st atus = 1;     dl->mpd l _s t a t us=  EVSTATUS_FRE E;
       d l-> mpdl_c ou nt=  0;
      d l ->m pdl_cmd = 0 ;
       dl- >mpdl_ d ata = ( c har *)0;
      m pdle r r=0;    m b-> m b_m agic = M PM AG IC;
   m b->m b_i vec= mp_ softc[unit].m s_i vec+ 1 ; / * dow nload  vec to r */       mb- >m b_status = MP_D LPEN D;
       m b- >mb _d iagsw i tch[0]  ='A' ;
       mb-> m b_d ia g s w it ch[1] = 'P';
     s  =  spl8(); 
     *( u _short * )m pin fo[u n i t]->u i_ad d r= 2;
       e r ro r= tslee p( (caddr _t )&m b-> mb_st a tus,  (PZER O+1) | P CATCH , 
            d e vio, 30*hz);  splx (s) ;
        i f (e r ror== E W OU LDB L OCK)       error = ETIMEDOUT; 
      if ( error)
           mpbo g u s .status= 0;       bzero((ca ddr_t )mb->mb_po r t, sizeo f (mb ->mb_por t));
     break; 
   c ase  MP I O RE SETBOARD:
     s  =  spl8() ;
      if(mb ->m b_i mo kclk)
          m b- >m b_ imo kclk=  0;
      * (u _sh ort * ) mpinfo [unit ]->u i_ ad d r =  0x100;     if  ( mb-> mb_ st atus== M P _DL OPEN ||  mb->mb_s tat u s ==  M P_ DLDONE)  {
          mpdlerr =MP _DL ERROR;           dl->mpdl_status = EV S TATUS_F REE ;

)
 _ _   _ __ if_(error_= tsleep((caddr_t)&mpdlbusy,
 _  _   _  __   (PZERO+1) | PCATCH, devioc, 0))
      __ ___    break;
_    _ _splx(s);
       _if_(error)
  _        _break;
     _  mpdlbusy++;
___   _ /* initialize the downloading interface_*/
     _  mpbogus.magic = MPMAGIC;
  _     mpbogus.mb_= mpbogus.mbloks[unit];
   _ _  mpbogus.status = 1;
_  _ _  dl->mpdl_status_= EVSTATUS_FREE;
    _  _dl->mpdl_count = 0;
   __  _dl->mpdl_cmd_=_0;
 _  __ _dl->mpdl_data_= (char *) 0;
  __    mpdlerr = 0;
_   __  mb->mb_magic =_MPMAGIC;
    _   mb->mb_ivec = mp_softc[unit].ms_ivec+1;_/* download_vector */
_       mb->mb_status = MP_DLPEND;
 _     _mb->mb_diagswitch[0] = 'A';
 _ __  _mb->mb_diagswitch[1]_= 'P';
_      _s =_spl8();
     _  *(u_short *)mpinfo[unit]->ui_addr_=_2;
     _  error = tsleep((caddr_t)&mb->mb_status, (PZERO+1)_| PCATCH,
   ___    _ devio, 30*hz);
   _  _ splx(s);
     __ if (error == EWOULDBLOCK)
 __     ___ error = ETIMEDOUT;
 _     _if (error)
       _  _ mpbogus.status = 0;
 ___    bzero((caddr_t)mb->mb_port, sizeof (mb->mb_port));
   _ _  break;
_   case MPIORESETBOARD:
     _  s = spl8();
  _     if (mb->mb_imokclk)
    _       mb->mb_imokclk_= 0;
     _  *(u_short *)mpinfo[unit]->ui_addr_=_0x100;
      __if_(mb->mb_status_== MP_DLOPEN ||_mb->mb_status == MP_DLDONE)_{
  _ _  _ _  mpdlerr_=_MP_DLERROR;
            dl->mpdl_status = EVSTATUS_FREE;
