Lines Matching refs:phy
202 static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd);
203 static void pc_rcode_actions(struct s_smc *smc, int bit, struct s_phy *phy);
204 static void pc_tcode_actions(struct s_smc *smc, const int bit, struct s_phy *phy);
205 static void reset_lem_struct(struct s_phy *phy);
209 static void sm_ph_linestate(struct s_smc *smc, int phy, int ls);
217 struct s_phy *phy) in start_pcm_timer0() argument
219 phy->timer0_exp = FALSE ; /* clear timer event flag */ in start_pcm_timer0()
220 smt_timer_start(smc,&phy->pcm_timer0,value, in start_pcm_timer0()
221 EV_TOKEN(EVENT_PCM+phy->np,event)) ; in start_pcm_timer0()
227 static void stop_pcm_timer0(struct s_smc *smc, struct s_phy *phy) in stop_pcm_timer0() argument
229 if (phy->pcm_timer0.tm_active) in stop_pcm_timer0()
230 smt_timer_stop(smc,&phy->pcm_timer0) ; in stop_pcm_timer0()
241 struct s_phy *phy ; in pcm_init() local
244 for (np = 0,phy = smc->y ; np < NUMPHYS ; np++,phy++) { in pcm_init()
246 mib = phy->mib ; in pcm_init()
248 phy->np = np ; in pcm_init()
280 phy->pmd_scramble = 0 ; in pcm_init()
281 switch (phy->pmd_type[PMD_SK_PMD]) { in pcm_init()
293 phy->pmd_scramble = TRUE ; in pcm_init()
297 phy->pmd_scramble = TRUE ; in pcm_init()
375 phy->pc_lem_fail = FALSE ; in pcm_init()
381 phy->ls_flag = 0 ; in pcm_init()
382 phy->rc_flag = 0 ; in pcm_init()
383 phy->tc_flag = 0 ; in pcm_init()
384 phy->td_flag = 0 ; in pcm_init()
386 phy->phy_name = '0' + np - PM ; in pcm_init()
388 phy->phy_name = 'A' + np ; in pcm_init()
389 phy->wc_flag = FALSE ; /* set by SMT */ in pcm_init()
390 memset((char *)&phy->lem,0,sizeof(struct lem_counter)) ; in pcm_init()
391 reset_lem_struct(phy) ; in pcm_init()
392 memset((char *)&phy->plc,0,sizeof(struct s_plc)) ; in pcm_init()
393 phy->plc.p_state = PS_OFF ; in pcm_init()
395 phy->t_next[i] = 0 ; in pcm_init()
501 int sm_pm_get_ls(struct s_smc *smc, int phy) in sm_pm_get_ls() argument
506 if (!plc_is_installed(smc,phy)) in sm_pm_get_ls()
510 state = inpw(PLC(phy,PL_STATUS_A)) & PL_LINE_ST ; in sm_pm_get_ls()
534 static int plc_send_bits(struct s_smc *smc, struct s_phy *phy, int len) in plc_send_bits() argument
536 int np = phy->np ; /* PHY index */ in plc_send_bits()
544 n = (n<<1) | phy->t_val[phy->bitn+i] ; in plc_send_bits()
562 printf("SIGNALING bit %d .. %d\n",phy->bitn,phy->bitn+len-1) ; in plc_send_bits()
599 struct s_phy *phy ; in pcm() local
609 phy = &smc->y[np] ; in pcm()
610 mib = phy->mib ; in pcm()
614 phy->phy_name, in pcm()
620 pcm_fsm(smc,phy,event) ; in pcm()
641 (int) (INDEX_PORT+ phy->np),0) ; in pcm()
674 static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd) in pcm_fsm() argument
677 int np = phy->np ; /* PHY index */ in pcm_fsm()
684 plc = &phy->plc ; in pcm_fsm()
685 mib = phy->mib ; in pcm_fsm()
714 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
722 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
727 phy->cf_loop = FALSE ; in pcm_fsm()
728 phy->cf_join = FALSE ; in pcm_fsm()
743 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
765 phy->cf_loop = FALSE ; in pcm_fsm()
766 phy->cf_join = FALSE ; in pcm_fsm()
768 phy->ls_flag = FALSE ; in pcm_fsm()
769 phy->pc_mode = PM_NONE ; /* needed by CFM */ in pcm_fsm()
770 phy->bitn = 0 ; /* bit signaling start bit */ in pcm_fsm()
772 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
794 if (plc_send_bits(smc,phy,3)) { in pcm_fsm()
831 (void) plc_send_bits(smc,phy,3) ; in pcm_fsm()
864 pc_rcode_actions(smc,i,phy) ; in pcm_fsm()
865 pc_tcode_actions(smc,3,phy) ; in pcm_fsm()
869 phy->bitn = 3 ; in pcm_fsm()
870 if (plc_send_bits(smc,phy,1)) { in pcm_fsm()
875 pc_rcode_actions(smc,3,phy) ; in pcm_fsm()
877 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
881 phy->bitn = 4 ; in pcm_fsm()
882 if (plc_send_bits(smc,phy,3)) { in pcm_fsm()
888 pc_rcode_actions(smc,i,phy) ; in pcm_fsm()
892 phy->bitn = 7 ; in pcm_fsm()
901 pc_tcode_actions(smc,7,phy) ; in pcm_fsm()
908 phy->bitn = 7 ; in pcm_fsm()
909 if (plc_send_bits(smc,phy,1)) { in pcm_fsm()
915 pc_rcode_actions(smc,7,phy) ; in pcm_fsm()
916 if (phy->t_val[7] || phy->r_val[7]) { in pcm_fsm()
922 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
926 phy->bitn = 8 ; in pcm_fsm()
927 if (plc_send_bits(smc,phy,2)) { in pcm_fsm()
933 pc_rcode_actions(smc,i,phy) ; in pcm_fsm()
961 if (!phy->cf_join) { in pcm_fsm()
962 phy->cf_join = TRUE ; in pcm_fsm()
983 sm_ph_lem_start(smc,(int)phy->np,LCT_LEM_MAX) ; in pcm_fsm()
985 phy->tr_flag = FALSE ; in pcm_fsm()
1004 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
1009 phy->cf_loop = FALSE ; in pcm_fsm()
1010 phy->cf_join = FALSE ; in pcm_fsm()
1020 DB_PCMN(1,"PCM %c : MAINT\n",phy->phy_name,0) ; in pcm_fsm()
1037 static void sm_ph_linestate(struct s_smc *smc, int phy, int ls) in sm_ph_linestate() argument
1043 cntrl = (inpw(PLC(phy,PL_CNTRL_B)) & ~PL_MAINT_LS) | in sm_ph_linestate()
1063 outpw(PLC(phy,PL_CNTRL_B),cntrl) ; in sm_ph_linestate()
1066 static void reset_lem_struct(struct s_phy *phy) in reset_lem_struct() argument
1068 struct lem_counter *lem = &phy->lem ; in reset_lem_struct()
1070 phy->mib->fddiPORTLer_Estimate = 15 ; in reset_lem_struct()
1077 static void lem_evaluate(struct s_smc *smc, struct s_phy *phy) in lem_evaluate() argument
1081 struct lem_counter *lem = &phy->lem ; in lem_evaluate()
1085 mib = phy->mib ; in lem_evaluate()
1090 errors = inpw(PLC(((int) phy->np),PL_LINK_ERR_CTR)) ; in lem_evaluate()
1129 DB_PCMN(1,"LEM %c :\n",phy->np == PB? 'B' : 'A',0) ; in lem_evaluate()
1144 smt_ler_alarm_check(smc,phy,cond) ; in lem_evaluate()
1148 (int) (INDEX_PORT+ phy->np) ,cond) ; in lem_evaluate()
1153 phy->pc_lem_fail = TRUE ; /* flag */ in lem_evaluate()
1164 phy->np, mib->fddiPORTLer_Cutoff) ; in lem_evaluate()
1167 smt_port_off_event(smc,phy->np); in lem_evaluate()
1169 queue_event(smc,(int)(EVENT_PCM+phy->np),PC_START) ; in lem_evaluate()
1185 static void lem_check_lct(struct s_smc *smc, struct s_phy *phy) in lem_check_lct() argument
1187 struct lem_counter *lem = &phy->lem ; in lem_check_lct()
1191 mib = phy->mib ; in lem_check_lct()
1193 phy->pc_lem_fail = FALSE ; /* flag */ in lem_check_lct()
1194 errors = inpw(PLC(((int)phy->np),PL_LINK_ERR_CTR)) ; in lem_check_lct()
1198 switch(phy->lc_test) { in lem_check_lct()
1201 phy->pc_lem_fail = TRUE ; in lem_check_lct()
1205 phy->pc_lem_fail = TRUE ; in lem_check_lct()
1209 phy->pc_lem_fail = TRUE ; in lem_check_lct()
1213 phy->pc_lem_fail = TRUE ; in lem_check_lct()
1218 if (phy->pc_lem_fail) { in lem_check_lct()
1256 void sm_pm_ls_latch(struct s_smc *smc, int phy, int on_off) in sm_pm_ls_latch() argument
1261 phy = phy ; on_off = on_off ; in sm_pm_ls_latch()
1274 static void pc_rcode_actions(struct s_smc *smc, int bit, struct s_phy *phy) in pc_rcode_actions() argument
1278 mib = phy->mib ; in pc_rcode_actions()
1280 DB_PCMN(1,"SIG rec %x %x:\n", bit,phy->r_val[bit] ) ; in pc_rcode_actions()
1289 if (phy->r_val[1] == 0 && phy->r_val[2] == 0) in pc_rcode_actions()
1291 else if (phy->r_val[1] == 0 && phy->r_val[2] == 1) in pc_rcode_actions()
1293 else if (phy->r_val[1] == 1 && phy->r_val[2] == 0) in pc_rcode_actions()
1295 else if (phy->r_val[1] == 1 && phy->r_val[2] == 1) in pc_rcode_actions()
1302 phy->phy_name,0) ; in pc_rcode_actions()
1306 else if (phy->t_val[3] || phy->r_val[3]) { in pc_rcode_actions()
1310 phy->pc_mode = PM_TREE ; in pc_rcode_actions()
1312 phy->pc_mode = PM_PEER ; in pc_rcode_actions()
1317 if (phy->wc_flag) { in pc_rcode_actions()
1325 phy->phy_name,0) ; in pc_rcode_actions()
1327 phy->twisted = ((mib->fddiPORTMy_Type != TS) && in pc_rcode_actions()
1331 if (phy->twisted) { in pc_rcode_actions()
1333 phy->phy_name,0) ; in pc_rcode_actions()
1339 if (phy->t_val[4] || phy->r_val[4]) { in pc_rcode_actions()
1340 if ((phy->t_val[4] && phy->t_val[5]) || in pc_rcode_actions()
1341 (phy->r_val[4] && phy->r_val[5]) ) in pc_rcode_actions()
1342 phy->lc_test = LC_EXTENDED ; in pc_rcode_actions()
1344 phy->lc_test = LC_LONG ; in pc_rcode_actions()
1346 else if (phy->t_val[5] || phy->r_val[5]) in pc_rcode_actions()
1347 phy->lc_test = LC_MEDIUM ; in pc_rcode_actions()
1349 phy->lc_test = LC_SHORT ; in pc_rcode_actions()
1350 switch (phy->lc_test) { in pc_rcode_actions()
1352 outpw(PLC((int)phy->np,PL_LC_LENGTH), TP_LC_LENGTH ) ; in pc_rcode_actions()
1353 phy->t_next[7] = smc->s.pcm_lc_short ; in pc_rcode_actions()
1356 outpw(PLC((int)phy->np,PL_LC_LENGTH), TP_LC_LONGLN ) ; in pc_rcode_actions()
1357 phy->t_next[7] = smc->s.pcm_lc_medium ; in pc_rcode_actions()
1360 SETMASK(PLC((int)phy->np,PL_CNTRL_B),PL_LONG,PL_LONG) ; in pc_rcode_actions()
1361 phy->t_next[7] = smc->s.pcm_lc_long ; in pc_rcode_actions()
1364 SETMASK(PLC((int)phy->np,PL_CNTRL_B),PL_LONG,PL_LONG) ; in pc_rcode_actions()
1365 phy->t_next[7] = smc->s.pcm_lc_extended ; in pc_rcode_actions()
1368 if (phy->t_next[7] > smc->s.pcm_lc_medium) { in pc_rcode_actions()
1369 start_pcm_timer0(smc,phy->t_next[7],PC_TIMEOUT_LCT,phy); in pc_rcode_actions()
1371 DB_PCMN(1,"LCT timer = %ld us\n", phy->t_next[7], 0) ; in pc_rcode_actions()
1372 phy->t_next[9] = smc->s.pcm_t_next_9 ; in pc_rcode_actions()
1375 if (phy->t_val[6]) { in pc_rcode_actions()
1376 phy->cf_loop = TRUE ; in pc_rcode_actions()
1378 phy->td_flag = TRUE ; in pc_rcode_actions()
1381 if (phy->t_val[7] || phy->r_val[7]) { in pc_rcode_actions()
1383 phy->phy_name,phy->t_val[7]? "local":"remote") ; in pc_rcode_actions()
1384 queue_event(smc,(int)(EVENT_PCM+phy->np),PC_START) ; in pc_rcode_actions()
1388 if (phy->t_val[8] || phy->r_val[8]) { in pc_rcode_actions()
1389 if (phy->t_val[8]) in pc_rcode_actions()
1390 phy->cf_loop = TRUE ; in pc_rcode_actions()
1391 phy->td_flag = TRUE ; in pc_rcode_actions()
1395 if (phy->r_val[9]) { in pc_rcode_actions()
1410 static void pc_tcode_actions(struct s_smc *smc, const int bit, struct s_phy *phy) in pc_tcode_actions() argument
1412 int np = phy->np ; in pc_tcode_actions()
1415 mib = phy->mib ; in pc_tcode_actions()
1419 phy->t_val[0] = 0 ; /* no escape used */ in pc_tcode_actions()
1423 phy->t_val[1] = 1 ; in pc_tcode_actions()
1425 phy->t_val[1] = 0 ; in pc_tcode_actions()
1429 phy->t_val[2] = 1 ; in pc_tcode_actions()
1431 phy->t_val[2] = 0 ; in pc_tcode_actions()
1442 phy->t_val[3] = 1 ; /* Accept connection */ in pc_tcode_actions()
1450 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1458 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1466 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1474 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1488 (int) (INDEX_PORT+ phy->np) ,0) ; in pc_tcode_actions()
1495 if (phy->pc_lem_fail) { in pc_tcode_actions()
1496 phy->t_val[4] = 1 ; /* long */ in pc_tcode_actions()
1497 phy->t_val[5] = 0 ; in pc_tcode_actions()
1500 phy->t_val[4] = 0 ; in pc_tcode_actions()
1502 phy->t_val[5] = 1 ; /* medium */ in pc_tcode_actions()
1504 phy->t_val[5] = 0 ; /* short */ in pc_tcode_actions()
1511 if (phy->wc_flag) in pc_tcode_actions()
1512 phy->t_val[5] = 1 ; /* medium */ in pc_tcode_actions()
1518 phy->t_val[4] = 1 ; /* extended */ in pc_tcode_actions()
1519 phy->t_val[5] = 1 ; in pc_tcode_actions()
1526 phy->t_val[6] = 0 ; in pc_tcode_actions()
1529 phy->cf_loop = FALSE ; in pc_tcode_actions()
1530 lem_check_lct(smc,phy) ; in pc_tcode_actions()
1531 if (phy->pc_lem_fail) { in pc_tcode_actions()
1533 phy->phy_name,0) ; in pc_tcode_actions()
1534 phy->t_val[7] = 1 ; in pc_tcode_actions()
1537 phy->t_val[7] = 0 ; in pc_tcode_actions()
1540 phy->t_val[8] = 0 ; /* Don't request MAC loopback */ in pc_tcode_actions()
1543 phy->cf_loop = 0 ; in pc_tcode_actions()
1545 ((smc->s.sas == SMT_DAS) && (phy->wc_flag))) { in pc_tcode_actions()
1549 phy->t_val[9] = FALSE ; in pc_tcode_actions()
1555 if (phy->pc_mode == PM_TREE) { in pc_tcode_actions()
1559 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1563 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1568 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1576 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1580 mib->fddiPORTMacIndicated.T_val = phy->t_val[9] ; in pc_tcode_actions()
1583 DB_PCMN(1,"SIG snd %x %x:\n", bit,phy->t_val[bit] ) ; in pc_tcode_actions()
1611 struct s_phy *phy = &smc->y[np] ; in pcm_status_state() local
1614 mib = phy->mib ; in pcm_status_state()
1650 struct s_phy *phy = &smc->y[np] ; in plc_irq() local
1651 struct s_plc *plc = &phy->plc ; in plc_irq()
1666 if (!plc->ebuf_cont && phy->mib->fddiPORTPCMState == PC8_ACTIVE){ in plc_irq()
1673 phy->mib->fddiPORTEBError_Ct ++ ; in plc_irq()
1746 if (phy->lem.lem_on) { in plc_irq()
1750 phy->lem.lem_errors += i ; in plc_irq()
1751 phy->mib->fddiPORTLem_Ct += i ; in plc_irq()
1765 case PL_I_IDLE : phy->curr_ls = PC_ILS ; break ; in plc_irq()
1766 case PL_I_HALT : phy->curr_ls = PC_HLS ; break ; in plc_irq()
1767 case PL_I_MASTR : phy->curr_ls = PC_MLS ; break ; in plc_irq()
1768 case PL_I_QUIET : phy->curr_ls = PC_QLS ; break ; in plc_irq()
1803 phy->r_val[plc->p_start+i] = n & 1 ; in plc_irq()
1812 if (!phy->tr_flag) { in plc_irq()
1815 phy->tr_flag = TRUE ; in plc_irq()
1824 if ((cmd & PL_SELF_TEST) && (phy->mib->fddiPORTPCMState == PC2_TRACE)) { in plc_irq()
1828 phy->mib->fddiPORTPCMState) ; in plc_irq()
1836 if (phy->mib->fddiPORTPCMState == PC8_ACTIVE) { in plc_irq()
1837 if (!phy->tr_flag) { in plc_irq()
1838 DB_PCMN(1,"PCM %c : PC81 %s\n",phy->phy_name,"NSE"); in plc_irq()
1867 struct s_phy *phy ; in pcm_get_state() local
1875 for (i = 0, phy = smc->y, pcs = state->pcm_state ; i < NUMPHYS ; in pcm_get_state()
1876 i++ , phy++, pcs++ ) { in pcm_get_state()
1877 mib = phy->mib ; in pcm_get_state()
1880 pcs->pcm_mode = phy->pc_mode ; in pcm_get_state()
1883 pcs->pcm_lsf = phy->ls_flag ; in pcm_get_state()
1889 if (phy->r_val[NUMBITS-1-ii]) in pcm_get_state()
1891 if (phy->t_val[NUMBITS-1-ii]) in pcm_get_state()
1996 struct s_phy *phy ; in pcm_lem_dump() local
2003 for (i = 0,phy = smc->y ; i < NUMPHYS ; i++,phy++) { in pcm_lem_dump()
2006 mib = phy->mib ; in pcm_lem_dump()