Lines Matching refs:phy
200 static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd);
201 static void pc_rcode_actions(struct s_smc *smc, int bit, struct s_phy *phy);
202 static void pc_tcode_actions(struct s_smc *smc, const int bit, struct s_phy *phy);
203 static void reset_lem_struct(struct s_phy *phy);
207 static void sm_ph_linestate(struct s_smc *smc, int phy, int ls);
215 struct s_phy *phy) in start_pcm_timer0() argument
217 phy->timer0_exp = FALSE ; /* clear timer event flag */ in start_pcm_timer0()
218 smt_timer_start(smc,&phy->pcm_timer0,value, in start_pcm_timer0()
219 EV_TOKEN(EVENT_PCM+phy->np,event)) ; in start_pcm_timer0()
225 static void stop_pcm_timer0(struct s_smc *smc, struct s_phy *phy) in stop_pcm_timer0() argument
227 if (phy->pcm_timer0.tm_active) in stop_pcm_timer0()
228 smt_timer_stop(smc,&phy->pcm_timer0) ; in stop_pcm_timer0()
239 struct s_phy *phy ; in pcm_init() local
242 for (np = 0,phy = smc->y ; np < NUMPHYS ; np++,phy++) { in pcm_init()
244 mib = phy->mib ; in pcm_init()
246 phy->np = np ; in pcm_init()
278 phy->pmd_scramble = 0 ; in pcm_init()
279 switch (phy->pmd_type[PMD_SK_PMD]) { in pcm_init()
291 phy->pmd_scramble = TRUE ; in pcm_init()
295 phy->pmd_scramble = TRUE ; in pcm_init()
373 phy->pc_lem_fail = FALSE ; in pcm_init()
379 phy->ls_flag = 0 ; in pcm_init()
380 phy->rc_flag = 0 ; in pcm_init()
381 phy->tc_flag = 0 ; in pcm_init()
382 phy->td_flag = 0 ; in pcm_init()
384 phy->phy_name = '0' + np - PM ; in pcm_init()
386 phy->phy_name = 'A' + np ; in pcm_init()
387 phy->wc_flag = FALSE ; /* set by SMT */ in pcm_init()
388 memset((char *)&phy->lem,0,sizeof(struct lem_counter)) ; in pcm_init()
389 reset_lem_struct(phy) ; in pcm_init()
390 memset((char *)&phy->plc,0,sizeof(struct s_plc)) ; in pcm_init()
391 phy->plc.p_state = PS_OFF ; in pcm_init()
393 phy->t_next[i] = 0 ; in pcm_init()
499 int sm_pm_get_ls(struct s_smc *smc, int phy) in sm_pm_get_ls() argument
504 if (!plc_is_installed(smc,phy)) in sm_pm_get_ls()
508 state = inpw(PLC(phy,PL_STATUS_A)) & PL_LINE_ST ; in sm_pm_get_ls()
532 static int plc_send_bits(struct s_smc *smc, struct s_phy *phy, int len) in plc_send_bits() argument
534 int np = phy->np ; /* PHY index */ in plc_send_bits()
542 n = (n<<1) | phy->t_val[phy->bitn+i] ; in plc_send_bits()
560 printf("SIGNALING bit %d .. %d\n",phy->bitn,phy->bitn+len-1) ; in plc_send_bits()
597 struct s_phy *phy ; in pcm() local
607 phy = &smc->y[np] ; in pcm()
608 mib = phy->mib ; in pcm()
612 phy->phy_name, in pcm()
617 pcm_fsm(smc,phy,event) ; in pcm()
638 (int) (INDEX_PORT+ phy->np),0) ; in pcm()
671 static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd) in pcm_fsm() argument
674 int np = phy->np ; /* PHY index */ in pcm_fsm()
681 plc = &phy->plc ; in pcm_fsm()
682 mib = phy->mib ; in pcm_fsm()
711 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
719 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
724 phy->cf_loop = FALSE ; in pcm_fsm()
725 phy->cf_join = FALSE ; in pcm_fsm()
740 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
762 phy->cf_loop = FALSE ; in pcm_fsm()
763 phy->cf_join = FALSE ; in pcm_fsm()
765 phy->ls_flag = FALSE ; in pcm_fsm()
766 phy->pc_mode = PM_NONE ; /* needed by CFM */ in pcm_fsm()
767 phy->bitn = 0 ; /* bit signaling start bit */ in pcm_fsm()
769 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
791 if (plc_send_bits(smc,phy,3)) { in pcm_fsm()
828 (void) plc_send_bits(smc,phy,3) ; in pcm_fsm()
861 pc_rcode_actions(smc,i,phy) ; in pcm_fsm()
862 pc_tcode_actions(smc,3,phy) ; in pcm_fsm()
866 phy->bitn = 3 ; in pcm_fsm()
867 if (plc_send_bits(smc,phy,1)) { in pcm_fsm()
872 pc_rcode_actions(smc,3,phy) ; in pcm_fsm()
874 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
878 phy->bitn = 4 ; in pcm_fsm()
879 if (plc_send_bits(smc,phy,3)) { in pcm_fsm()
885 pc_rcode_actions(smc,i,phy) ; in pcm_fsm()
889 phy->bitn = 7 ; in pcm_fsm()
898 pc_tcode_actions(smc,7,phy) ; in pcm_fsm()
905 phy->bitn = 7 ; in pcm_fsm()
906 if (plc_send_bits(smc,phy,1)) { in pcm_fsm()
912 pc_rcode_actions(smc,7,phy) ; in pcm_fsm()
913 if (phy->t_val[7] || phy->r_val[7]) { in pcm_fsm()
919 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
923 phy->bitn = 8 ; in pcm_fsm()
924 if (plc_send_bits(smc,phy,2)) { in pcm_fsm()
930 pc_rcode_actions(smc,i,phy) ; in pcm_fsm()
958 if (!phy->cf_join) { in pcm_fsm()
959 phy->cf_join = TRUE ; in pcm_fsm()
980 sm_ph_lem_start(smc,(int)phy->np,LCT_LEM_MAX) ; in pcm_fsm()
982 phy->tr_flag = FALSE ; in pcm_fsm()
1001 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
1006 phy->cf_loop = FALSE ; in pcm_fsm()
1007 phy->cf_join = FALSE ; in pcm_fsm()
1017 DB_PCMN(1, "PCM %c : MAINT", phy->phy_name); in pcm_fsm()
1034 static void sm_ph_linestate(struct s_smc *smc, int phy, int ls) in sm_ph_linestate() argument
1040 cntrl = (inpw(PLC(phy,PL_CNTRL_B)) & ~PL_MAINT_LS) | in sm_ph_linestate()
1060 outpw(PLC(phy,PL_CNTRL_B),cntrl) ; in sm_ph_linestate()
1063 static void reset_lem_struct(struct s_phy *phy) in reset_lem_struct() argument
1065 struct lem_counter *lem = &phy->lem ; in reset_lem_struct()
1067 phy->mib->fddiPORTLer_Estimate = 15 ; in reset_lem_struct()
1074 static void lem_evaluate(struct s_smc *smc, struct s_phy *phy) in lem_evaluate() argument
1078 struct lem_counter *lem = &phy->lem ; in lem_evaluate()
1082 mib = phy->mib ; in lem_evaluate()
1087 errors = inpw(PLC(((int) phy->np),PL_LINK_ERR_CTR)) ; in lem_evaluate()
1126 DB_PCMN(1, "LEM %c :", phy->np == PB ? 'B' : 'A'); in lem_evaluate()
1140 smt_ler_alarm_check(smc,phy,cond) ; in lem_evaluate()
1144 (int) (INDEX_PORT+ phy->np) ,cond) ; in lem_evaluate()
1149 phy->pc_lem_fail = TRUE ; /* flag */ in lem_evaluate()
1160 phy->np, mib->fddiPORTLer_Cutoff); in lem_evaluate()
1163 smt_port_off_event(smc,phy->np); in lem_evaluate()
1165 queue_event(smc,(int)(EVENT_PCM+phy->np),PC_START) ; in lem_evaluate()
1181 static void lem_check_lct(struct s_smc *smc, struct s_phy *phy) in lem_check_lct() argument
1183 struct lem_counter *lem = &phy->lem ; in lem_check_lct()
1187 mib = phy->mib ; in lem_check_lct()
1189 phy->pc_lem_fail = FALSE ; /* flag */ in lem_check_lct()
1190 errors = inpw(PLC(((int)phy->np),PL_LINK_ERR_CTR)) ; in lem_check_lct()
1194 switch(phy->lc_test) { in lem_check_lct()
1197 phy->pc_lem_fail = TRUE ; 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()
1214 if (phy->pc_lem_fail) { in lem_check_lct()
1252 void sm_pm_ls_latch(struct s_smc *smc, int phy, int on_off) in sm_pm_ls_latch() argument
1257 phy = phy ; on_off = on_off ; in sm_pm_ls_latch()
1270 static void pc_rcode_actions(struct s_smc *smc, int bit, struct s_phy *phy) in pc_rcode_actions() argument
1274 mib = phy->mib ; in pc_rcode_actions()
1276 DB_PCMN(1, "SIG rec %x %x:", bit, phy->r_val[bit]); in pc_rcode_actions()
1285 if (phy->r_val[1] == 0 && phy->r_val[2] == 0) in pc_rcode_actions()
1287 else if (phy->r_val[1] == 0 && phy->r_val[2] == 1) in pc_rcode_actions()
1289 else if (phy->r_val[1] == 1 && phy->r_val[2] == 0) in pc_rcode_actions()
1291 else if (phy->r_val[1] == 1 && phy->r_val[2] == 1) in pc_rcode_actions()
1298 phy->phy_name); in pc_rcode_actions()
1302 else if (phy->t_val[3] || phy->r_val[3]) { in pc_rcode_actions()
1306 phy->pc_mode = PM_TREE ; in pc_rcode_actions()
1308 phy->pc_mode = PM_PEER ; in pc_rcode_actions()
1313 if (phy->wc_flag) { in pc_rcode_actions()
1321 phy->phy_name); in pc_rcode_actions()
1323 phy->twisted = ((mib->fddiPORTMy_Type != TS) && in pc_rcode_actions()
1327 if (phy->twisted) { in pc_rcode_actions()
1329 phy->phy_name); in pc_rcode_actions()
1335 if (phy->t_val[4] || phy->r_val[4]) { in pc_rcode_actions()
1336 if ((phy->t_val[4] && phy->t_val[5]) || in pc_rcode_actions()
1337 (phy->r_val[4] && phy->r_val[5]) ) in pc_rcode_actions()
1338 phy->lc_test = LC_EXTENDED ; in pc_rcode_actions()
1340 phy->lc_test = LC_LONG ; in pc_rcode_actions()
1342 else if (phy->t_val[5] || phy->r_val[5]) in pc_rcode_actions()
1343 phy->lc_test = LC_MEDIUM ; in pc_rcode_actions()
1345 phy->lc_test = LC_SHORT ; in pc_rcode_actions()
1346 switch (phy->lc_test) { in pc_rcode_actions()
1348 outpw(PLC((int)phy->np,PL_LC_LENGTH), TP_LC_LENGTH ) ; in pc_rcode_actions()
1349 phy->t_next[7] = smc->s.pcm_lc_short ; in pc_rcode_actions()
1352 outpw(PLC((int)phy->np,PL_LC_LENGTH), TP_LC_LONGLN ) ; in pc_rcode_actions()
1353 phy->t_next[7] = smc->s.pcm_lc_medium ; in pc_rcode_actions()
1356 SETMASK(PLC((int)phy->np,PL_CNTRL_B),PL_LONG,PL_LONG) ; in pc_rcode_actions()
1357 phy->t_next[7] = smc->s.pcm_lc_long ; 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_extended ; in pc_rcode_actions()
1364 if (phy->t_next[7] > smc->s.pcm_lc_medium) { in pc_rcode_actions()
1365 start_pcm_timer0(smc,phy->t_next[7],PC_TIMEOUT_LCT,phy); in pc_rcode_actions()
1367 DB_PCMN(1, "LCT timer = %ld us", phy->t_next[7]); in pc_rcode_actions()
1368 phy->t_next[9] = smc->s.pcm_t_next_9 ; in pc_rcode_actions()
1371 if (phy->t_val[6]) { in pc_rcode_actions()
1372 phy->cf_loop = TRUE ; in pc_rcode_actions()
1374 phy->td_flag = TRUE ; in pc_rcode_actions()
1377 if (phy->t_val[7] || phy->r_val[7]) { in pc_rcode_actions()
1379 phy->phy_name, in pc_rcode_actions()
1380 phy->t_val[7] ? "local" : "remote"); in pc_rcode_actions()
1381 queue_event(smc,(int)(EVENT_PCM+phy->np),PC_START) ; in pc_rcode_actions()
1385 if (phy->t_val[8] || phy->r_val[8]) { in pc_rcode_actions()
1386 if (phy->t_val[8]) in pc_rcode_actions()
1387 phy->cf_loop = TRUE ; in pc_rcode_actions()
1388 phy->td_flag = TRUE ; in pc_rcode_actions()
1392 if (phy->r_val[9]) { in pc_rcode_actions()
1407 static void pc_tcode_actions(struct s_smc *smc, const int bit, struct s_phy *phy) in pc_tcode_actions() argument
1409 int np = phy->np ; in pc_tcode_actions()
1412 mib = phy->mib ; in pc_tcode_actions()
1416 phy->t_val[0] = 0 ; /* no escape used */ in pc_tcode_actions()
1420 phy->t_val[1] = 1 ; in pc_tcode_actions()
1422 phy->t_val[1] = 0 ; in pc_tcode_actions()
1426 phy->t_val[2] = 1 ; in pc_tcode_actions()
1428 phy->t_val[2] = 0 ; in pc_tcode_actions()
1439 phy->t_val[3] = 1 ; /* Accept connection */ in pc_tcode_actions()
1447 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1455 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1463 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1471 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1485 (int) (INDEX_PORT+ phy->np) ,0) ; in pc_tcode_actions()
1492 if (phy->pc_lem_fail) { in pc_tcode_actions()
1493 phy->t_val[4] = 1 ; /* long */ in pc_tcode_actions()
1494 phy->t_val[5] = 0 ; in pc_tcode_actions()
1497 phy->t_val[4] = 0 ; in pc_tcode_actions()
1499 phy->t_val[5] = 1 ; /* medium */ in pc_tcode_actions()
1501 phy->t_val[5] = 0 ; /* short */ in pc_tcode_actions()
1508 if (phy->wc_flag) in pc_tcode_actions()
1509 phy->t_val[5] = 1 ; /* medium */ in pc_tcode_actions()
1515 phy->t_val[4] = 1 ; /* extended */ in pc_tcode_actions()
1516 phy->t_val[5] = 1 ; in pc_tcode_actions()
1523 phy->t_val[6] = 0 ; in pc_tcode_actions()
1526 phy->cf_loop = FALSE ; in pc_tcode_actions()
1527 lem_check_lct(smc,phy) ; in pc_tcode_actions()
1528 if (phy->pc_lem_fail) { in pc_tcode_actions()
1529 DB_PCMN(1, "PCM %c : E104 LCT failed", phy->phy_name); in pc_tcode_actions()
1530 phy->t_val[7] = 1 ; in pc_tcode_actions()
1533 phy->t_val[7] = 0 ; in pc_tcode_actions()
1536 phy->t_val[8] = 0 ; /* Don't request MAC loopback */ in pc_tcode_actions()
1539 phy->cf_loop = 0 ; in pc_tcode_actions()
1541 ((smc->s.sas == SMT_DAS) && (phy->wc_flag))) { in pc_tcode_actions()
1545 phy->t_val[9] = FALSE ; in pc_tcode_actions()
1551 if (phy->pc_mode == PM_TREE) { in pc_tcode_actions()
1555 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1559 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1564 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1572 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1576 mib->fddiPORTMacIndicated.T_val = phy->t_val[9] ; in pc_tcode_actions()
1579 DB_PCMN(1, "SIG snd %x %x:", bit, phy->t_val[bit]); in pc_tcode_actions()
1607 struct s_phy *phy = &smc->y[np] ; in pcm_status_state() local
1610 mib = phy->mib ; in pcm_status_state()
1646 struct s_phy *phy = &smc->y[np] ; in plc_irq() local
1647 struct s_plc *plc = &phy->plc ; in plc_irq()
1662 if (!plc->ebuf_cont && phy->mib->fddiPORTPCMState == PC8_ACTIVE){ in plc_irq()
1669 phy->mib->fddiPORTEBError_Ct ++ ; in plc_irq()
1742 if (phy->lem.lem_on) { in plc_irq()
1746 phy->lem.lem_errors += i ; in plc_irq()
1747 phy->mib->fddiPORTLem_Ct += i ; in plc_irq()
1761 case PL_I_IDLE : phy->curr_ls = PC_ILS ; break ; in plc_irq()
1762 case PL_I_HALT : phy->curr_ls = PC_HLS ; break ; in plc_irq()
1763 case PL_I_MASTR : phy->curr_ls = PC_MLS ; break ; in plc_irq()
1764 case PL_I_QUIET : phy->curr_ls = PC_QLS ; break ; in plc_irq()
1800 phy->r_val[plc->p_start+i] = n & 1 ; in plc_irq()
1809 if (!phy->tr_flag) { in plc_irq()
1812 phy->tr_flag = TRUE ; in plc_irq()
1821 if ((cmd & PL_SELF_TEST) && (phy->mib->fddiPORTPCMState == PC2_TRACE)) { in plc_irq()
1826 phy->mib->fddiPORTPCMState); in plc_irq()
1834 if (phy->mib->fddiPORTPCMState == PC8_ACTIVE) { in plc_irq()
1835 if (!phy->tr_flag) { in plc_irq()
1837 phy->phy_name, "NSE"); in plc_irq()
1866 struct s_phy *phy ; in pcm_get_state() local
1874 for (i = 0, phy = smc->y, pcs = state->pcm_state ; i < NUMPHYS ; in pcm_get_state()
1875 i++ , phy++, pcs++ ) { in pcm_get_state()
1876 mib = phy->mib ; in pcm_get_state()
1879 pcs->pcm_mode = phy->pc_mode ; in pcm_get_state()
1882 pcs->pcm_lsf = phy->ls_flag ; in pcm_get_state()
1888 if (phy->r_val[NUMBITS-1-ii]) in pcm_get_state()
1890 if (phy->t_val[NUMBITS-1-ii]) in pcm_get_state()
1995 struct s_phy *phy ; in pcm_lem_dump() local
2002 for (i = 0,phy = smc->y ; i < NUMPHYS ; i++,phy++) { in pcm_lem_dump()
2005 mib = phy->mib ; in pcm_lem_dump()