Lines Matching refs:zs
101 zs_h_log[zs_h_log_n++] = 'A' + zs->zs_unit; \
112 if (zsh_h_log_n[zs->zs_unit] >= ZSH_H_LOG_MAX) \
113 zsh_h_log_n[zs->zs_unit] = 0; \
114 zsh_h_log[zs->zs_unit][zsh_h_log_n[zs->zs_unit]++] = c; \
115 zsh_h_log[zs->zs_unit][zsh_h_log_n[zs->zs_unit]] = '\0'; \
120 for (p = &zsh_h_log[zs->zs_unit][ZSH_H_LOG_MAX]; \
121 p >= &zsh_h_log[zs->zs_unit][0]; p--) \
123 zsh_h_log_n[zs->zs_unit] = 0; \
163 static int zsh_start(struct zscom *zs, struct syncline *zss);
250 static void zsh_txint(struct zscom *zs);
251 static void zsh_xsint(struct zscom *zs);
252 static void zsh_rxint(struct zscom *zs);
253 static void zsh_srint(struct zscom *zs);
254 static int zsh_softint(struct zscom *zs);
266 static int zsh_program(struct zscom *zs, struct scc_mode *sm);
267 static void zsh_setmstat(struct zscom *zs, int event);
268 static void zsh_rxbad(struct zscom *zs, struct syncline *zss);
269 static void zsh_txbad(struct zscom *zs, struct syncline *zss);
272 static int zsh_hdp_ok_or_rts_state(struct zscom *zs, struct syncline *zss);
273 static void zsh_init_port(struct zscom *zs, struct syncline *zss);
274 static int zsh_setmode(struct zscom *zs, struct syncline *zss,
292 #define ZSH_GETBLOCK(zs, allocbcount) \ argument
300 mutex_enter(zs->zs_excl_hi); \
302 mutex_exit(zs->zs_excl_hi); \
304 BPRI_MED, zsh_callback, zs); \
307 mutex_exit(zs->zs_excl_hi); \
343 ZSSETSOFT(zs); \
442 register struct zscom *zs; in zsh_info() local
452 zs = &zscom[unit]; in zsh_info()
453 *result = zs->zs_hdlc_dip; in zsh_info()
479 zsh_init_port(struct zscom *zs, struct syncline *zss) in zsh_init_port() argument
504 zs, SIO_WATCHDOG_TICK); in zsh_init_port()
522 register struct zscom *zs; in zsh_open() local
538 zs = &zscom[unit]; in zsh_open()
540 if (zs->zs_ops == NULL) { in zsh_open()
546 mutex_enter(zs->zs_excl); in zsh_open()
547 if ((zs->zs_ops != &zsops_null) && in zsh_open()
548 (zs->zs_ops != &zsops_hdlc)) { in zsh_open()
549 mutex_exit(zs->zs_excl); in zsh_open()
554 (void) pm_busy_component(zs->zs_dip, unit%2+1); in zsh_open()
555 (void) ddi_dev_is_needed(zs->zs_dip, unit%2+1, 1); in zsh_open()
557 zsopinit(zs, &zsops_hdlc); in zsh_open()
562 stp->str_com = (caddr_t)zs; in zsh_open()
566 zs->zs_wr_cur = NULL; in zsh_open()
567 zs->zs_wr_lim = NULL; in zsh_open()
568 zs->zs_wr_cur = NULL; in zsh_open()
569 zs->zs_wr_lim = NULL; in zsh_open()
572 zs->zs_rd_cur = NULL; in zsh_open()
573 zs->zs_rd_lim = NULL; in zsh_open()
580 zs->zs_priv = (caddr_t)zss; in zsh_open()
584 ZSH_GETBLOCK(zs, tmp); in zsh_open()
587 mutex_exit(zs->zs_excl); in zsh_open()
590 mutex_enter(zs->zs_excl_hi); in zsh_open()
596 zsh_init_port(zs, zss); in zsh_open()
597 mutex_exit(zs->zs_excl_hi); in zsh_open()
598 mutex_exit(zs->zs_excl); in zsh_open()
639 struct zscom *zs; in zsh_close() local
659 zs = (struct zscom *)stp->str_com; in zsh_close()
660 if (zs == NULL) in zsh_close()
663 TRACE_1(TR_ZSH, TR_ZSH_CLOSE, "zs = %p", zs); in zsh_close()
665 zss = (struct syncline *)zs->zs_priv; in zsh_close()
666 mutex_enter(zs->zs_excl); in zsh_close()
668 mutex_enter(zs->zs_excl_hi); in zsh_close()
674 mutex_exit(zs->zs_excl_hi); in zsh_close()
690 mutex_enter(zs->zs_excl_hi); in zsh_close()
691 if (zs->zs_wr_cur) { in zsh_close()
692 zs->zs_wr_cur = NULL; in zsh_close()
693 zs->zs_wr_lim = NULL; in zsh_close()
700 zs->zs_wr_cur = NULL; in zsh_close()
701 zs->zs_wr_lim = NULL; in zsh_close()
727 zs->zs_rd_cur = NULL; in zsh_close()
728 zs->zs_rd_lim = NULL; in zsh_close()
731 mutex_exit(zs->zs_excl_hi); in zsh_close()
735 mutex_enter(zs->zs_excl_hi); in zsh_close()
737 zs->zs_rd_cur = NULL; in zsh_close()
738 zs->zs_rd_lim = NULL; in zsh_close()
741 mutex_exit(zs->zs_excl_hi); in zsh_close()
746 mutex_enter(zs->zs_excl_hi); in zsh_close()
749 mutex_exit(zs->zs_excl_hi); in zsh_close()
754 mutex_enter(zs->zs_excl_hi); in zsh_close()
759 mutex_exit(zs->zs_excl_hi); in zsh_close()
765 mutex_enter(zs->zs_excl_hi); in zsh_close()
768 mutex_exit(zs->zs_excl_hi); in zsh_close()
772 mutex_enter(zs->zs_excl_hi); in zsh_close()
776 mutex_exit(zs->zs_excl_hi); in zsh_close()
781 zsopinit(zs, &zsops_null); in zsh_close()
782 mutex_exit(zs->zs_excl); in zsh_close()
791 (void) pm_idle_component(zs->zs_dip, zs->zs_unit%2+1); in zsh_close()
804 zsh_hdp_ok_or_rts_state(struct zscom *zs, struct syncline *zss) in zsh_hdp_ok_or_rts_state() argument
830 register struct zscom *zs; in zsh_wput() local
845 zs = (struct zscom *)stp->str_com; in zsh_wput()
862 if ((zs == NULL) && (mp->b_datap->db_type != M_PROTO)) { in zsh_wput()
883 zss = (struct syncline *)zs->zs_priv; in zsh_wput()
893 mutex_enter(zs->zs_excl_hi); in zsh_wput()
895 mutex_exit(zs->zs_excl_hi); in zsh_wput()
898 zs->zs_unit); in zsh_wput()
903 mutex_exit(zs->zs_excl_hi); in zsh_wput()
904 if (zs->zs_flags & ZS_NEEDSOFT) { in zsh_wput()
905 zs->zs_flags &= ~ZS_NEEDSOFT; in zsh_wput()
906 (void) zsh_softint(zs); in zsh_wput()
916 mutex_enter(zs->zs_excl); in zsh_wput()
918 mutex_enter(zs->zs_excl_hi); in zsh_wput()
920 mutex_exit(zs->zs_excl_hi); in zsh_wput()
922 mutex_exit(zs->zs_excl); in zsh_wput()
925 "zsh_wput end: zs = %p", zs); in zsh_wput()
935 mutex_exit(zs->zs_excl_hi); in zsh_wput()
937 mutex_enter(zs->zs_excl_hi); in zsh_wput()
942 mutex_exit(zs->zs_excl_hi); in zsh_wput()
944 mutex_enter(zs->zs_excl_hi); in zsh_wput()
948 mutex_exit(zs->zs_excl_hi); in zsh_wput()
949 mutex_exit(zs->zs_excl); in zsh_wput()
952 "zsh_wput end: zs = %p", zs); in zsh_wput()
960 mutex_exit(zs->zs_excl_hi); in zsh_wput()
961 zss->sl_wd_id = timeout(zsh_watchdog, zs, in zsh_wput()
963 mutex_enter(zs->zs_excl_hi); in zsh_wput()
968 zsh_hdp_ok_or_rts_state(zs, zss)) in zsh_wput()
969 (void) zsh_start(zs, zss); in zsh_wput()
970 mutex_exit(zs->zs_excl_hi); in zsh_wput()
971 mutex_exit(zs->zs_excl); in zsh_wput()
1005 zs = &zscom[ppa]; in zsh_wput()
1006 if (zs->zs_ops == NULL) { in zsh_wput()
1010 mutex_enter(zs->zs_excl); in zsh_wput()
1011 if ((zs->zs_ops != &zsops_null) && in zsh_wput()
1012 (zs->zs_ops != &zsops_hdlc)) { in zsh_wput()
1017 mutex_exit(zs->zs_excl); in zsh_wput()
1022 stp->str_com = (caddr_t)zs; in zsh_wput()
1023 mutex_exit(zs->zs_excl); in zsh_wput()
1057 zss = (struct syncline *)&zs->zs_priv_str; in zsh_wput()
1058 mutex_enter(zs->zs_excl); in zsh_wput()
1059 error = zsh_setmode(zs, zss, in zsh_wput()
1068 mutex_exit(zs->zs_excl); in zsh_wput()
1073 zss = (struct syncline *)&zs->zs_priv_str; in zsh_wput()
1074 mutex_enter(zs->zs_excl); in zsh_wput()
1076 mutex_exit(zs->zs_excl); in zsh_wput()
1094 mutex_enter(zs->zs_excl); in zsh_wput()
1096 mutex_enter(zs->zs_excl_hi); in zsh_wput()
1099 mutex_exit(zs->zs_excl_hi); in zsh_wput()
1102 mutex_exit(zs->zs_excl); in zsh_wput()
1107 mutex_enter(zs->zs_excl); in zsh_wput()
1109 mutex_exit(zs->zs_excl); in zsh_wput()
1124 TRACE_1(TR_ZSH, TR_ZSH_WPUT_END, "zsh_wput end: zs = %p", zs); in zsh_wput()
1133 zsh_start(struct zscom *zs, struct syncline *zss) in zsh_start() argument
1152 "zsh_start start: zs = %p", zs); in zsh_start()
1169 "zsh_start end: zs = %d", zs); in zsh_start()
1188 "zsh_start end: zs = %p", zs); in zsh_start()
1197 ZSSETSOFT(zs); in zsh_start()
1215 zs->zs_wr_cur = rptr; in zsh_start()
1216 zs->zs_wr_lim = wptr; in zsh_start()
1221 "zsh_start end: zs = %p", zs); in zsh_start()
1235 register struct zscom *zs = (struct zscom *)stp->str_com; in zsh_ioctl() local
1236 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_ioctl()
1244 mutex_enter(zs->zs_excl); in zsh_ioctl()
1245 if ((zs->zs_ops != &zsops_null) && in zsh_ioctl()
1246 (zs->zs_ops != &zsops_hdlc)) { in zsh_ioctl()
1330 error = zsh_setmode(zs, zss, in zsh_ioctl()
1339 mutex_enter(zs->zs_excl_hi); in zsh_ioctl()
1341 mutex_exit(zs->zs_excl_hi); in zsh_ioctl()
1365 mutex_enter(zs->zs_excl_hi); in zsh_ioctl()
1367 (void) zsmctl(zs, ZSWR5_DTR, DMBIS); in zsh_ioctl()
1369 (void) zsmctl(zs, ZSWR5_DTR, DMBIC); in zsh_ioctl()
1370 mutex_exit(zs->zs_excl_hi); in zsh_ioctl()
1380 mutex_exit(zs->zs_excl); in zsh_ioctl()
1389 zsh_setmode(struct zscom *zs, struct syncline *zss, struct scc_mode *sm) in zsh_setmode() argument
1394 mutex_enter(zs->zs_excl_hi); in zsh_setmode()
1397 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1404 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1408 mutex_enter(zs->zs_excl_hi); in zsh_setmode()
1414 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1417 mutex_enter(zs->zs_excl_hi); in zsh_setmode()
1423 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1428 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1436 error = zsh_program(zs, sm); in zsh_setmode()
1437 if (!error && (zs->zs_ops != &zsops_null)) in zsh_setmode()
1438 zsh_init_port(zs, zss); in zsh_setmode()
1440 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1450 zsh_txint(struct zscom *zs) in zsh_txint() argument
1457 TRACE_1(TR_ZSH, TR_ZSH_TXINT, "zsh_txint: zs = %p", zs); in zsh_txint()
1459 if ((wr_cur = zs->zs_wr_cur) != NULL && (wr_cur < zs->zs_wr_lim)) { in zsh_txint()
1461 zs->zs_wr_cur = wr_cur; in zsh_txint()
1466 zss = (struct syncline *)&zs->zs_priv_str; in zsh_txint()
1484 zs->zs_wr_cur = mp->b_rptr; in zsh_txint()
1485 zs->zs_wr_lim = mp->b_wptr; in zsh_txint()
1486 SCC_WRITEDATA(*zs->zs_wr_cur++); in zsh_txint()
1498 zs->zs_wr_cur = zs->zs_wr_lim = NULL; in zsh_txint()
1509 ZSSETSOFT(zs); in zsh_txint()
1521 if (!zsh_start(zs, zss)) { in zsh_txint()
1534 (void) zsh_start(zs, zss); in zsh_txint()
1563 zsh_xsint(struct zscom *zs) in zsh_xsint() argument
1565 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_xsint()
1568 TRACE_1(TR_ZSH, TR_ZSH_XSINT, "zsh_xsint: zs = %p", zs); in zsh_xsint()
1590 zsh_txbad(zs, zss); in zsh_xsint()
1616 if ((x0 & ZSRR0_BREAK) && (s0 & ZSRR0_BREAK) && zs->zs_rd_cur) { in zsh_xsint()
1618 zsh_rxbad(zs, zss); in zsh_xsint()
1619 } else if ((s0 & ZSRR0_SYNC) && (zs->zs_rd_cur)) { in zsh_xsint()
1633 zsh_rxbad(zs, zss); in zsh_xsint()
1641 (void) zsh_start(zs, zss); in zsh_xsint()
1645 zsh_setmstat(zs, CS_CTS_UP); in zsh_xsint()
1658 zsh_setmstat(zs, CS_CTS_DOWN); in zsh_xsint()
1667 zsh_txbad(zs, zss); in zsh_xsint()
1676 zsh_rxint(struct zscom *zs) in zsh_rxint() argument
1678 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_rxint()
1682 TRACE_1(TR_ZSH, TR_ZSH_RXINT, "zsh_rxint: zs = %p", zs); in zsh_rxint()
1684 if (((rd_cur = zs->zs_rd_cur) != NULL) && rd_cur < zs->zs_rd_lim) { in zsh_rxint()
1686 zs->zs_rd_cur = rd_cur; in zsh_rxint()
1697 bp->b_wptr = zs->zs_rd_cur; in zsh_rxint()
1703 zsh_rxbad(zs, zss); in zsh_rxint()
1706 zs->zs_rd_cur = bp->b_wptr; in zsh_rxint()
1707 zs->zs_rd_lim = bp->b_datap->db_lim; in zsh_rxint()
1708 *zs->zs_rd_cur++ = SCC_READDATA(); /* Also resets interrupt */ in zsh_rxint()
1716 zsh_srint(struct zscom *zs) in zsh_srint() argument
1718 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_srint()
1722 TRACE_1(TR_ZSH, TR_ZSH_SRINT, "zsh_srint: zs = %p", zs); in zsh_srint()
1731 zsh_rxbad(zs, zss); in zsh_srint()
1735 if ((rd_cur = zs->zs_rd_cur) == NULL) in zsh_srint()
1750 zs->zs_rd_cur = NULL; in zsh_srint()
1751 zs->zs_rd_lim = NULL; in zsh_srint()
1752 ZSSETSOFT(zs); in zsh_srint()
1758 zsh_rxbad(zs, zss); in zsh_srint()
1768 zsh_softint(struct zscom *zs) in zsh_softint() argument
1777 TRACE_1(TR_ZSH, TR_ZSH_SOFT_START, "zsh_soft start: zs = %p", zs); in zsh_softint()
1779 mutex_enter(zs->zs_excl); in zsh_softint()
1780 zss = (struct syncline *)zs->zs_priv; in zsh_softint()
1782 mutex_exit(zs->zs_excl); in zsh_softint()
1793 mutex_enter(zs->zs_excl_hi); in zsh_softint()
1805 zsh_setmstat(zs, CS_CTS_UP); in zsh_softint()
1808 mutex_exit(zs->zs_excl_hi); in zsh_softint()
1814 mutex_exit(zs->zs_excl_hi); in zsh_softint()
1856 ZSH_GETBLOCK(zs, allocbcount); in zsh_softint()
1860 mutex_enter(zs->zs_excl_hi); in zsh_softint()
1864 mutex_exit(zs->zs_excl_hi); in zsh_softint()
1866 mutex_exit(zs->zs_excl_hi); in zsh_softint()
1871 mutex_exit(zs->zs_excl_hi); in zsh_softint()
1876 mutex_exit(zs->zs_excl); in zsh_softint()
1895 TRACE_1(TR_ZSH, TR_ZSH_SOFT_END, "zsh_soft end: zs = %p", zs); in zsh_softint()
1905 zsh_program(struct zscom *zs, struct scc_mode *sm) in zsh_program() argument
1907 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_program()
1917 ZSSETSOFT(zs); /* get our house in order */ in zsh_program()
2013 zspp = &zs_prog[zs->zs_unit]; in zsh_program()
2015 zspp->zs = zs; in zsh_program()
2060 zsh_setmstat(struct zscom *zs, int event) in zsh_setmstat() argument
2062 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_setmstat()
2077 ZSSETSOFT(zs); in zsh_setmstat()
2085 zsh_rxbad(struct zscom *zs, struct syncline *zss) in zsh_rxbad() argument
2106 zs->zs_rd_cur = NULL; in zsh_rxbad()
2107 zs->zs_rd_lim = NULL; in zsh_rxbad()
2112 zs->zs_rd_cur = NULL; in zsh_rxbad()
2113 zs->zs_rd_lim = NULL; in zsh_rxbad()
2116 ZSSETSOFT(zs); in zsh_rxbad()
2123 zsh_txbad(struct zscom *zs, struct syncline *zss) in zsh_txbad() argument
2129 zs->zs_wr_cur = NULL; in zsh_txbad()
2130 zs->zs_wr_lim = NULL; in zsh_txbad()
2153 struct zscom *zs = arg; in zsh_watchdog() local
2154 struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_watchdog()
2171 mutex_enter(zs->zs_excl); in zsh_watchdog()
2175 mutex_exit(zs->zs_excl); in zsh_watchdog()
2179 mutex_enter(zs->zs_excl_hi); in zsh_watchdog()
2183 zsh_hdp_ok_or_rts_state(zs, zss)) in zsh_watchdog()
2184 (void) zsh_start(zs, zss); in zsh_watchdog()
2200 zsh_setmstat(zs, CS_CTS_UP); in zsh_watchdog()
2213 (void) zsh_start(zs, zss); in zsh_watchdog()
2235 zsh_txbad(zs, zss); in zsh_watchdog()
2247 zsh_setmstat(zs, CS_CTS_TO); in zsh_watchdog()
2250 ZSSETSOFT(zs); in zsh_watchdog()
2263 mutex_exit(zs->zs_excl_hi); in zsh_watchdog()
2264 zss->sl_wd_id = timeout(zsh_watchdog, zs, SIO_WATCHDOG_TICK); in zsh_watchdog()
2267 mutex_exit(zs->zs_excl_hi); in zsh_watchdog()
2271 mutex_enter(zs->zs_excl_hi); in zsh_watchdog()
2274 mutex_exit(zs->zs_excl_hi); in zsh_watchdog()
2278 mutex_exit(zs->zs_excl); in zsh_watchdog()
2280 cmn_err(CE_WARN, "zsh%x: transmit hung", zs->zs_unit); in zsh_watchdog()
2286 struct zscom *zs = arg; in zsh_callback() local
2287 struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_callback()
2290 mutex_enter(zs->zs_excl); in zsh_callback()
2293 ZSH_GETBLOCK(zs, tmp); in zsh_callback()
2295 mutex_exit(zs->zs_excl); in zsh_callback()