Lines Matching refs:zs

102 		zs_h_log[zs_h_log_n++] = 'A' + zs->zs_unit; \
113 if (zsh_h_log_n[zs->zs_unit] >= ZSH_H_LOG_MAX) \
114 zsh_h_log_n[zs->zs_unit] = 0; \
115 zsh_h_log[zs->zs_unit][zsh_h_log_n[zs->zs_unit]++] = c; \
116 zsh_h_log[zs->zs_unit][zsh_h_log_n[zs->zs_unit]] = '\0'; \
121 for (p = &zsh_h_log[zs->zs_unit][ZSH_H_LOG_MAX]; \
122 p >= &zsh_h_log[zs->zs_unit][0]; p--) \
124 zsh_h_log_n[zs->zs_unit] = 0; \
164 static int zsh_start(struct zscom *zs, struct syncline *zss);
251 static void zsh_txint(struct zscom *zs);
252 static void zsh_xsint(struct zscom *zs);
253 static void zsh_rxint(struct zscom *zs);
254 static void zsh_srint(struct zscom *zs);
255 static int zsh_softint(struct zscom *zs);
267 static int zsh_program(struct zscom *zs, struct scc_mode *sm);
268 static void zsh_setmstat(struct zscom *zs, int event);
269 static void zsh_rxbad(struct zscom *zs, struct syncline *zss);
270 static void zsh_txbad(struct zscom *zs, struct syncline *zss);
273 static int zsh_hdp_ok_or_rts_state(struct zscom *zs, struct syncline *zss);
274 static void zsh_init_port(struct zscom *zs, struct syncline *zss);
275 static int zsh_setmode(struct zscom *zs, struct syncline *zss,
293 #define ZSH_GETBLOCK(zs, allocbcount) \ argument
301 mutex_enter(zs->zs_excl_hi); \
303 mutex_exit(zs->zs_excl_hi); \
305 BPRI_MED, zsh_callback, zs); \
308 mutex_exit(zs->zs_excl_hi); \
344 ZSSETSOFT(zs); \
442 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 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 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()
1134 zsh_start(struct zscom *zs, struct syncline *zss) in zsh_start() argument
1153 "zsh_start start: zs = %p", zs); in zsh_start()
1170 "zsh_start end: zs = %d", zs); in zsh_start()
1189 "zsh_start end: zs = %p", zs); in zsh_start()
1198 ZSSETSOFT(zs); in zsh_start()
1216 zs->zs_wr_cur = rptr; in zsh_start()
1217 zs->zs_wr_lim = wptr; in zsh_start()
1222 "zsh_start end: zs = %p", zs); in zsh_start()
1236 struct zscom *zs = (struct zscom *)stp->str_com; in zsh_ioctl() local
1237 struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_ioctl()
1245 mutex_enter(zs->zs_excl); in zsh_ioctl()
1246 if ((zs->zs_ops != &zsops_null) && in zsh_ioctl()
1247 (zs->zs_ops != &zsops_hdlc)) { in zsh_ioctl()
1331 error = zsh_setmode(zs, zss, in zsh_ioctl()
1340 mutex_enter(zs->zs_excl_hi); in zsh_ioctl()
1342 mutex_exit(zs->zs_excl_hi); in zsh_ioctl()
1366 mutex_enter(zs->zs_excl_hi); in zsh_ioctl()
1368 (void) zsmctl(zs, ZSWR5_DTR, DMBIS); in zsh_ioctl()
1370 (void) zsmctl(zs, ZSWR5_DTR, DMBIC); in zsh_ioctl()
1371 mutex_exit(zs->zs_excl_hi); in zsh_ioctl()
1381 mutex_exit(zs->zs_excl); in zsh_ioctl()
1390 zsh_setmode(struct zscom *zs, struct syncline *zss, struct scc_mode *sm) in zsh_setmode() argument
1395 mutex_enter(zs->zs_excl_hi); in zsh_setmode()
1398 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1405 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1409 mutex_enter(zs->zs_excl_hi); in zsh_setmode()
1415 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1418 mutex_enter(zs->zs_excl_hi); in zsh_setmode()
1424 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1429 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1437 error = zsh_program(zs, sm); in zsh_setmode()
1438 if (!error && (zs->zs_ops != &zsops_null)) in zsh_setmode()
1439 zsh_init_port(zs, zss); in zsh_setmode()
1441 mutex_exit(zs->zs_excl_hi); in zsh_setmode()
1451 zsh_txint(struct zscom *zs) in zsh_txint() argument
1458 TRACE_1(TR_ZSH, TR_ZSH_TXINT, "zsh_txint: zs = %p", zs); in zsh_txint()
1460 if ((wr_cur = zs->zs_wr_cur) != NULL && (wr_cur < zs->zs_wr_lim)) { in zsh_txint()
1462 zs->zs_wr_cur = wr_cur; in zsh_txint()
1467 zss = (struct syncline *)&zs->zs_priv_str; in zsh_txint()
1485 zs->zs_wr_cur = mp->b_rptr; in zsh_txint()
1486 zs->zs_wr_lim = mp->b_wptr; in zsh_txint()
1487 SCC_WRITEDATA(*zs->zs_wr_cur++); in zsh_txint()
1499 zs->zs_wr_cur = zs->zs_wr_lim = NULL; in zsh_txint()
1510 ZSSETSOFT(zs); in zsh_txint()
1522 if (!zsh_start(zs, zss)) { in zsh_txint()
1535 (void) zsh_start(zs, zss); in zsh_txint()
1564 zsh_xsint(struct zscom *zs) in zsh_xsint() argument
1566 struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_xsint()
1569 TRACE_1(TR_ZSH, TR_ZSH_XSINT, "zsh_xsint: zs = %p", zs); in zsh_xsint()
1591 zsh_txbad(zs, zss); in zsh_xsint()
1617 if ((x0 & ZSRR0_BREAK) && (s0 & ZSRR0_BREAK) && zs->zs_rd_cur) { in zsh_xsint()
1619 zsh_rxbad(zs, zss); in zsh_xsint()
1620 } else if ((s0 & ZSRR0_SYNC) && (zs->zs_rd_cur)) { in zsh_xsint()
1634 zsh_rxbad(zs, zss); in zsh_xsint()
1642 (void) zsh_start(zs, zss); in zsh_xsint()
1646 zsh_setmstat(zs, CS_CTS_UP); in zsh_xsint()
1659 zsh_setmstat(zs, CS_CTS_DOWN); in zsh_xsint()
1668 zsh_txbad(zs, zss); in zsh_xsint()
1677 zsh_rxint(struct zscom *zs) in zsh_rxint() argument
1679 struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_rxint()
1683 TRACE_1(TR_ZSH, TR_ZSH_RXINT, "zsh_rxint: zs = %p", zs); in zsh_rxint()
1685 if (((rd_cur = zs->zs_rd_cur) != NULL) && rd_cur < zs->zs_rd_lim) { in zsh_rxint()
1687 zs->zs_rd_cur = rd_cur; in zsh_rxint()
1698 bp->b_wptr = zs->zs_rd_cur; in zsh_rxint()
1704 zsh_rxbad(zs, zss); in zsh_rxint()
1707 zs->zs_rd_cur = bp->b_wptr; in zsh_rxint()
1708 zs->zs_rd_lim = bp->b_datap->db_lim; in zsh_rxint()
1709 *zs->zs_rd_cur++ = SCC_READDATA(); /* Also resets interrupt */ in zsh_rxint()
1717 zsh_srint(struct zscom *zs) in zsh_srint() argument
1719 struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_srint()
1723 TRACE_1(TR_ZSH, TR_ZSH_SRINT, "zsh_srint: zs = %p", zs); in zsh_srint()
1732 zsh_rxbad(zs, zss); in zsh_srint()
1736 if ((rd_cur = zs->zs_rd_cur) == NULL) in zsh_srint()
1751 zs->zs_rd_cur = NULL; in zsh_srint()
1752 zs->zs_rd_lim = NULL; in zsh_srint()
1753 ZSSETSOFT(zs); in zsh_srint()
1759 zsh_rxbad(zs, zss); in zsh_srint()
1769 zsh_softint(struct zscom *zs) in zsh_softint() argument
1778 TRACE_1(TR_ZSH, TR_ZSH_SOFT_START, "zsh_soft start: zs = %p", zs); in zsh_softint()
1780 mutex_enter(zs->zs_excl); in zsh_softint()
1781 zss = (struct syncline *)zs->zs_priv; in zsh_softint()
1783 mutex_exit(zs->zs_excl); in zsh_softint()
1794 mutex_enter(zs->zs_excl_hi); in zsh_softint()
1806 zsh_setmstat(zs, CS_CTS_UP); in zsh_softint()
1809 mutex_exit(zs->zs_excl_hi); in zsh_softint()
1815 mutex_exit(zs->zs_excl_hi); in zsh_softint()
1857 ZSH_GETBLOCK(zs, allocbcount); in zsh_softint()
1861 mutex_enter(zs->zs_excl_hi); in zsh_softint()
1865 mutex_exit(zs->zs_excl_hi); in zsh_softint()
1867 mutex_exit(zs->zs_excl_hi); in zsh_softint()
1872 mutex_exit(zs->zs_excl_hi); in zsh_softint()
1877 mutex_exit(zs->zs_excl); in zsh_softint()
1896 TRACE_1(TR_ZSH, TR_ZSH_SOFT_END, "zsh_soft end: zs = %p", zs); in zsh_softint()
1906 zsh_program(struct zscom *zs, struct scc_mode *sm) in zsh_program() argument
1908 struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_program()
1918 ZSSETSOFT(zs); /* get our house in order */ in zsh_program()
2014 zspp = &zs_prog[zs->zs_unit]; in zsh_program()
2016 zspp->zs = zs; in zsh_program()
2061 zsh_setmstat(struct zscom *zs, int event) in zsh_setmstat() argument
2063 struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_setmstat()
2078 ZSSETSOFT(zs); in zsh_setmstat()
2086 zsh_rxbad(struct zscom *zs, struct syncline *zss) in zsh_rxbad() argument
2107 zs->zs_rd_cur = NULL; in zsh_rxbad()
2108 zs->zs_rd_lim = NULL; in zsh_rxbad()
2113 zs->zs_rd_cur = NULL; in zsh_rxbad()
2114 zs->zs_rd_lim = NULL; in zsh_rxbad()
2117 ZSSETSOFT(zs); in zsh_rxbad()
2124 zsh_txbad(struct zscom *zs, struct syncline *zss) in zsh_txbad() argument
2130 zs->zs_wr_cur = NULL; in zsh_txbad()
2131 zs->zs_wr_lim = NULL; in zsh_txbad()
2154 struct zscom *zs = arg; in zsh_watchdog() local
2155 struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_watchdog()
2172 mutex_enter(zs->zs_excl); in zsh_watchdog()
2176 mutex_exit(zs->zs_excl); in zsh_watchdog()
2180 mutex_enter(zs->zs_excl_hi); in zsh_watchdog()
2184 zsh_hdp_ok_or_rts_state(zs, zss)) in zsh_watchdog()
2185 (void) zsh_start(zs, zss); in zsh_watchdog()
2201 zsh_setmstat(zs, CS_CTS_UP); in zsh_watchdog()
2214 (void) zsh_start(zs, zss); in zsh_watchdog()
2236 zsh_txbad(zs, zss); in zsh_watchdog()
2248 zsh_setmstat(zs, CS_CTS_TO); in zsh_watchdog()
2251 ZSSETSOFT(zs); in zsh_watchdog()
2264 mutex_exit(zs->zs_excl_hi); in zsh_watchdog()
2265 zss->sl_wd_id = timeout(zsh_watchdog, zs, SIO_WATCHDOG_TICK); in zsh_watchdog()
2268 mutex_exit(zs->zs_excl_hi); in zsh_watchdog()
2272 mutex_enter(zs->zs_excl_hi); in zsh_watchdog()
2275 mutex_exit(zs->zs_excl_hi); in zsh_watchdog()
2279 mutex_exit(zs->zs_excl); in zsh_watchdog()
2281 cmn_err(CE_WARN, "zsh%x: transmit hung", zs->zs_unit); in zsh_watchdog()
2287 struct zscom *zs = arg; in zsh_callback() local
2288 struct syncline *zss = (struct syncline *)&zs->zs_priv_str; in zsh_callback()
2291 mutex_enter(zs->zs_excl); in zsh_callback()
2294 ZSH_GETBLOCK(zs, tmp); in zsh_callback()
2296 mutex_exit(zs->zs_excl); in zsh_callback()