📄 bvp_ssp.c
字号:
WBFLUSH Wait_own( bvrg ) /* Wait for PC own bit to reset */ s = Splscs(); /* Raise IPL to SCS level */ if (bvp_create_sys( pccb ) != RET_SUCCESS) { (void)splx(s); /* Lower IPL */ return(0); /* Failed to make system known */ } (void)splx(s); /* Lower IPL */ if(Pccb.poll_rate == 0) /* Set the rate for the polling */ Pccb.poll_rate = 2 * hz;/* *//* Start the timer running. The bvp_timer routine will check *//* for pending port commands and issuing one if possible. *//* */ if ( (Lpinfo.bvp_flags & BVP_TIM) == 0 ) { /* If timer not yet on */ Lpinfo.bvp_flags |= BVP_TIM; /* Indicate timer now on */ timeout(bvp_timer,pccb,Pccb.poll_rate); /* Start timer */ } numbvp++; /* hack for ft1 km_alloc flag */ return( RET_SUCCESS );}/* * * * Name: bvp_init_blks * * Abstract: Initialize fields in pqb and pccb * * Inputs: * * pccb - Ptr to pccb for this port * * * * Outputs: * * * * * * Return * Values: * * * * * Side * Effects: * */void bvp_init_blks( pccb )PCCB *pccb;{int binumber;int intr_dest;u_long intr_vec; binumber = Pccb.binumber;/* * Initialize PCCB */ pccb->pdt = &bvppdt; /* Init pdt pointer */ Vpccb.qtransition = bvp_qtrans; /* Queue transition handler */ Vpccb.pcommq.error = SE_ICMDQ0; /* Cmd queue 0 insqti error */ Vpccb.pcommq.cmask = CMDQ0; /* Cmd queue 0 mask */ Vpccb.pcommq.header = &Vpqb.cmdq0; /* Use cmd queue 0 for comm */ Vpccb.pcontrolq.error = SE_ICMDQ1; /* Cmd queue 1 insqti error */ Vpccb.pcontrolq.cmask = CMDQ1; /* Cmd queue 1 mask */ Vpccb.pcontrolq.header = &Vpqb.cmdq1; /* Use cmd queue 1 for control*/ Vpccb.pdfreeq.error = SE_IDFREEQ;/* Datagram free queue insqti error*/ Vpccb.pmfreeq.error = SE_IMFREEQ;/* Message free queue insqti error*/ Vpccb.pdfreeq.cmask = DFREEQ; /* Datagram free queue mask */ Vpccb.pmfreeq.cmask = MFREEQ; /* Message free queue mask */ Vpccb.pdfreeq.header = &Pccb.dfreeq; /* Init datagram free queue hdr*/ Vpccb.pmfreeq.header = &Pccb.mfreeq; /* Init message free queue hdr */ Vpccb.dfreeq_remerr = SE_RDFREEQ; /* Datagram free queue remqhi err*/ Vpccb.mfreeq_remerr = SE_RMFREEQ; /* Message free queue remqhi err*/ Vpccb.rspq_remerr = SE_RRSPQ; /* Response queue remqhi error */ Vpinfo.ovhd_pd = Gvph_size_imp; /* Implicit address format */ Vpinfo.dg_size = scs_dg_size + sizeof(GVPPPDH) + Vpinfo.ovhd_pd + sizeof(SCSH); Vpinfo.msg_size = scs_msg_size + sizeof(GVPPPDH) + Vpinfo.ovhd_pd + sizeof(SCSH); Vpinfo.ovhd = sizeof(GVPPPDH) + Vpinfo.ovhd_pd;/* *//* Set up SCS info *//* */ pccb->lpinfo.name = Ctrl_from_num( "bv ", Pccb.bvp_ctlr); /* Local port name */ Scaaddr_low( pccb->lpinfo.addr ) = *(u_short *)&Pccb.bvp_ctlr; /* Remote port address */ Scaaddr_mid( pccb->lpinfo.addr ) = 0; Scaaddr_hi( pccb->lpinfo.addr ) = 0; pccb->lpinfo.type.hwtype = HPT_BVPSSP; /* Local port type */ pccb->lpinfo.type.swtype = SPT_BVPSSP; /* Software port type */ pccb->lpinfo.type.ictype = ICT_BI; /* Interconnect type */ pccb->lpinfo.type.dual_path = 0; /* Single path port *//* * Initialize PQB */ intr_dest = (bidata[binumber].biintr_dst) << 16; intr_vec = (SCB_BI_VEC_ADDR(binumber,Pccb.binode,LEVEL14) - &scb.scb_stray) << 4; Bvpqb.piv = 0; /* Disable interrupts during initialization *//* * Compute interrupt vector for later use * Use BI interrupt level 15 but use LEV14 slot in SCB */ Pccb.ivec = intr_dest | intr_vec | BVP_LEV_15; /* intr_dest, vector, level *//* * Initialize various PQB fields */ Bvpqb.dfreeq_hdr = BVP_DFREEQ; Bvpqb.mfreeq_hdr = BVP_MFREEQ; Bvpqb.dqe_len = scs_dg_size + sizeof(GVPPPDH) + Vpinfo.ovhd_pd + sizeof(SCSH); Bvpqb.mqe_len = scs_msg_size + sizeof(GVPPPDH) + Vpinfo.ovhd_pd + sizeof(SCSH); Bvpqb.vpqb_base = VPQB_BASE; Bvpqb.bdt_base = BDT_BASE; Bvpqb.bdt_len = ( u_short ) gvp_max_bds; Bvpqb.spt_base = SPT_BASE; Bvpqb.spt_len = SPT_LEN; Bvpqb.gpt_base = GPT_BASE; Bvpqb.gpt_len = Bvpqb.spt_len; Bvpqb.keep_alive = 0; /* Disable timer */ Dm_pccbifISIS Bvpqb.bvp_level = 1; Bvpqb.pd_prtvrs = 1; Bvpqb.pd_max_dg = ( u_short ) scs_dg_size; Bvpqb.pd_max_msg = ( u_short ) scs_msg_size; bcopy("U-32",(u_char *)&Bvpqb.pd_sw_type , 4); bcopy(RELEASE,(u_char *)&Bvpqb.pd_sw_version, 4); Bvpqb.pd_hw_type = Lpinfo.bvp_type; (void)scs_unix_to_vms((struct timeval *)&boottime, &Bvpqb.pd_cur_time); }/* * * * Name: bvp_create_sys * * * Abstract: Obtain the necessary data structures to make a system * known to SCS. Initialize these structures and call the * appropriate routine to make the system known. * * Inputs: * * pccb - Pointer to PCCB for this port * * * * * * Outputs: * * pccb - Pointer to PCCB for this port * * * sb - System block for this port * * various fields initialized * * pb - Path Block for this port * * various fields initialized * * * * Return * Values: * * 0 - System could not be created * 1 - System could be created * * * Side * Effects: * * The SB and PB for the port are allocated and initialized. The PB * is placed on the System Block PB queue and the SB is place on the * scs_config_db systemwide queue. scs_new_path is called to notify * SCS of the existence of a new path to the system. */u_long bvp_create_sys(pccb)PCCB *pccb;{ register PIB *pib = &bvp_pib; register SIB *sib = &bvp_sib; PB *pb; SB *sb; int i; (void)bzero( pib, sizeof(PIB)); /* Clear pib */ (void)bzero( sib, sizeof(SIB)); /* Clear sib */ pib->lport_name = pccb->lpinfo.name; /* Local port name */ pib->type.hwtype = HPT_BVPSSP; /* Local port type */ pib->type.dual_path = 0; /* Single path port */ Scaaddr_low( pib->rport_addr ) = *(u_short *)&Pccb.bvp_ctlr; /* Remote port address */ Scaaddr_mid( pib->rport_addr ) = 0; Scaaddr_hi( pib->rport_addr ) = 0;/* If we can't get a pb then it's no go */ if((pb = scs_alloc_pb( PS_OPEN, pccb, pib )) == (PB *)NULL) { return(RET_FAILURE); } sib->max_dg = Bvpqb.ad_max_dg; /* Max datagram size */ sib->max_msg = Bvpqb.ad_max_msg; /* Max message size */ sib->npaths = 1; /* Only 1 path to these devices */ sib->swtype = Bvpqb.ad_sw_type; /* Adapter software type */ sib->swver = Bvpqb.ad_sw_version; /* Adapter software version */ (void)scs_unix_to_vms((struct timeval *)&boottime, &sib->swincrn); sib->hwtype = Bvpqb.ad_hw_type; /* Adapter hardware type */ sib->hwver = Bvpqb.ad_hw_version; /* Adapter hardware version */ *(u_long *)sib->node_name = pccb->lpinfo.name; /* SCA Node name */ bcopy(" ",(u_long *)sib->node_name+1, 4);/* The system id of bvp controllers is as follows: *//* *//* 47 32 31 0 *//* +----------------+------------------------------------+ *//* ! ! ! *//* ! BVP dev type ! Device Address (Port Regs) ! *//* ! ! ! *//* +----------------+------------------------------------+ *//* *//* */ { register u_long devaddr = *(u_long *)&Pccb.port_regs; Scaaddr_low( sib->sysid ) = ( u_short )( devaddr & 0xffff ); Scaaddr_mid( sib->sysid ) = ( u_short )(( devaddr >> 16 ) & 0xffff ); Scaaddr_hi( sib->sysid ) = *(u_short *)&Lpinfo.bvp_type; }/* If we can't get a sb then it's no go */ if((sb = scs_alloc_sb( sib )) == (SB *)NULL) { return(RET_FAILURE); } Pccb.pb = pb; /* Save on pccb */ pb->sb = sb; /* Point to System Block */ Insert_entry(pb->flink,Sb->pbs); /* Insert PB on SB queue */ Insert_entry(sb->flink,scs_config_db); /* Insert SB on system-wide */ /* configuration database */ scs_new_path( sb, pb ); return(RET_SUCCESS);}/* * * * Name: bvp_intr * * Abstract: Interrupt service handler for ssp bvp * * Inputs: * * ctlr - Controller number. Used as an index into * port-specific structures * * * * Outputs: * * * * * * Return * Values: * * * * * Side * Effects: * */void bvpsspintr( ctlr )int ctlr;{PCCB *pccb;struct bvp_port_info *pcinfo = &bvp_port_info[ctlr];struct bvpregs *bvrg;int s;u_long bvp_status; s = Splscs(); /* Raise IPL to SCS level */ pccb = pcinfo->pc_ptr; /* Get pointer to PCCB */ bvrg = (struct bvpregs *)Pccb.port_regs; /* Get pointer to regs */ bvp_status = bvrg->bvp_ps; Pccb.port_state = bvrg->bvp_ps & BVP_PS_PST; if (bvp_status & BVP_PS_SUME){ /* Summary Error set - handle error */ bvp_log_error(pccb); /* Log port error */ bvp_port_error(pccb); /* Take action on port error */ } if (bvp_status & BVP_PS_RSQ) /* Response Queued - process resp */ bvp_proc_rsp(pccb);/* * Clear PS ownership bit */ bvrg->bvp_ps = bvp_status & ~BVP_PS_OWN; (void)splx(s); /* Lower IPL to interrupt level */ return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -