Lines Matching defs:zs

100 		zs_h_log[zs_h_log_n++] = 'A' + zs->zs_unit; \
111 if (zsh_h_log_n[zs->zs_unit] >= ZSH_H_LOG_MAX) \
112 zsh_h_log_n[zs->zs_unit] = 0; \
113 zsh_h_log[zs->zs_unit][zsh_h_log_n[zs->zs_unit]++] = c; \
114 zsh_h_log[zs->zs_unit][zsh_h_log_n[zs->zs_unit]] = '\0'; \
119 for (p = &zsh_h_log[zs->zs_unit][ZSH_H_LOG_MAX]; \
120 p >= &zsh_h_log[zs->zs_unit][0]; p--) \
122 zsh_h_log_n[zs->zs_unit] = 0; \
139 char _depends_on[] = "drv/zs";
165 static int zsh_start(struct zscom *zs, struct syncline *zss);
252 static void zsh_txint(struct zscom *zs);
253 static void zsh_xsint(struct zscom *zs);
254 static void zsh_rxint(struct zscom *zs);
255 static void zsh_srint(struct zscom *zs);
256 static int zsh_softint(struct zscom *zs);
268 static int zsh_program(struct zscom *zs, struct scc_mode *sm);
269 static void zsh_setmstat(struct zscom *zs, int event);
270 static void zsh_rxbad(struct zscom *zs, struct syncline *zss);
271 static void zsh_txbad(struct zscom *zs, struct syncline *zss);
274 static int zsh_hdp_ok_or_rts_state(struct zscom *zs, struct syncline *zss);
275 static void zsh_init_port(struct zscom *zs, struct syncline *zss);
276 static int zsh_setmode(struct zscom *zs, struct syncline *zss,
294 #define ZSH_GETBLOCK(zs, allocbcount) \
302 mutex_enter(zs->zs_excl_hi); \
304 mutex_exit(zs->zs_excl_hi); \
306 BPRI_MED, zsh_callback, zs); \
309 mutex_exit(zs->zs_excl_hi); \
345 ZSSETSOFT(zs); \
444 register struct zscom *zs;
454 zs = &zscom[unit];
455 *result = zs->zs_hdlc_dip;
481 zsh_init_port(struct zscom *zs, struct syncline *zss)
506 zs, SIO_WATCHDOG_TICK);
524 register struct zscom *zs;
540 zs = &zscom[unit];
542 if (zs->zs_ops == NULL) {
548 mutex_enter(zs->zs_excl);
549 if ((zs->zs_ops != &zsops_null) &&
550 (zs->zs_ops != &zsops_hdlc)) {
551 mutex_exit(zs->zs_excl);
556 (void) pm_busy_component(zs->zs_dip, unit%2+1);
557 (void) ddi_dev_is_needed(zs->zs_dip, unit%2+1, 1);
559 zsopinit(zs, &zsops_hdlc);
564 stp->str_com = (caddr_t)zs;
568 zs->zs_wr_cur = NULL;
569 zs->zs_wr_lim = NULL;
570 zs->zs_wr_cur = NULL;
571 zs->zs_wr_lim = NULL;
574 zs->zs_rd_cur = NULL;
575 zs->zs_rd_lim = NULL;
582 zs->zs_priv = (caddr_t)zss;
586 ZSH_GETBLOCK(zs, tmp);
589 mutex_exit(zs->zs_excl);
592 mutex_enter(zs->zs_excl_hi);
598 zsh_init_port(zs, zss);
599 mutex_exit(zs->zs_excl_hi);
600 mutex_exit(zs->zs_excl);
641 struct zscom *zs;
661 zs = (struct zscom *)stp->str_com;
662 if (zs == NULL)
665 TRACE_1(TR_ZSH, TR_ZSH_CLOSE, "zs = %p", zs);
667 zss = (struct syncline *)zs->zs_priv;
668 mutex_enter(zs->zs_excl);
670 mutex_enter(zs->zs_excl_hi);
676 mutex_exit(zs->zs_excl_hi);
692 mutex_enter(zs->zs_excl_hi);
693 if (zs->zs_wr_cur) {
694 zs->zs_wr_cur = NULL;
695 zs->zs_wr_lim = NULL;
702 zs->zs_wr_cur = NULL;
703 zs->zs_wr_lim = NULL;
729 zs->zs_rd_cur = NULL;
730 zs->zs_rd_lim = NULL;
733 mutex_exit(zs->zs_excl_hi);
737 mutex_enter(zs->zs_excl_hi);
739 zs->zs_rd_cur = NULL;
740 zs->zs_rd_lim = NULL;
743 mutex_exit(zs->zs_excl_hi);
748 mutex_enter(zs->zs_excl_hi);
751 mutex_exit(zs->zs_excl_hi);
756 mutex_enter(zs->zs_excl_hi);
761 mutex_exit(zs->zs_excl_hi);
767 mutex_enter(zs->zs_excl_hi);
770 mutex_exit(zs->zs_excl_hi);
774 mutex_enter(zs->zs_excl_hi);
778 mutex_exit(zs->zs_excl_hi);
783 zsopinit(zs, &zsops_null);
784 mutex_exit(zs->zs_excl);
793 (void) pm_idle_component(zs->zs_dip, zs->zs_unit%2+1);
806 zsh_hdp_ok_or_rts_state(struct zscom *zs, struct syncline *zss)
832 register struct zscom *zs;
847 zs = (struct zscom *)stp->str_com;
864 if ((zs == NULL) && (mp->b_datap->db_type != M_PROTO)) {
885 zss = (struct syncline *)zs->zs_priv;
895 mutex_enter(zs->zs_excl_hi);
897 mutex_exit(zs->zs_excl_hi);
900 zs->zs_unit);
905 mutex_exit(zs->zs_excl_hi);
906 if (zs->zs_flags & ZS_NEEDSOFT) {
907 zs->zs_flags &= ~ZS_NEEDSOFT;
908 (void) zsh_softint(zs);
918 mutex_enter(zs->zs_excl);
920 mutex_enter(zs->zs_excl_hi);
922 mutex_exit(zs->zs_excl_hi);
924 mutex_exit(zs->zs_excl);
927 "zsh_wput end: zs = %p", zs);
937 mutex_exit(zs->zs_excl_hi);
939 mutex_enter(zs->zs_excl_hi);
944 mutex_exit(zs->zs_excl_hi);
946 mutex_enter(zs->zs_excl_hi);
950 mutex_exit(zs->zs_excl_hi);
951 mutex_exit(zs->zs_excl);
954 "zsh_wput end: zs = %p", zs);
962 mutex_exit(zs->zs_excl_hi);
963 zss->sl_wd_id = timeout(zsh_watchdog, zs,
965 mutex_enter(zs->zs_excl_hi);
970 zsh_hdp_ok_or_rts_state(zs, zss))
971 (void) zsh_start(zs, zss);
972 mutex_exit(zs->zs_excl_hi);
973 mutex_exit(zs->zs_excl);
1007 zs = &zscom[ppa];
1008 if (zs->zs_ops == NULL) {
1012 mutex_enter(zs->zs_excl);
1013 if ((zs->zs_ops != &zsops_null) &&
1014 (zs->zs_ops != &zsops_hdlc)) {
1019 mutex_exit(zs->zs_excl);
1024 stp->str_com = (caddr_t)zs;
1025 mutex_exit(zs->zs_excl);
1059 zss = (struct syncline *)&zs->zs_priv_str;
1060 mutex_enter(zs->zs_excl);
1061 error = zsh_setmode(zs, zss,
1070 mutex_exit(zs->zs_excl);
1075 zss = (struct syncline *)&zs->zs_priv_str;
1076 mutex_enter(zs->zs_excl);
1078 mutex_exit(zs->zs_excl);
1096 mutex_enter(zs->zs_excl);
1098 mutex_enter(zs->zs_excl_hi);
1101 mutex_exit(zs->zs_excl_hi);
1104 mutex_exit(zs->zs_excl);
1109 mutex_enter(zs->zs_excl);
1111 mutex_exit(zs->zs_excl);
1126 TRACE_1(TR_ZSH, TR_ZSH_WPUT_END, "zsh_wput end: zs = %p", zs);
1135 zsh_start(struct zscom *zs, struct syncline *zss)
1154 "zsh_start start: zs = %p", zs);
1171 "zsh_start end: zs = %d", zs);
1190 "zsh_start end: zs = %p", zs);
1199 ZSSETSOFT(zs);
1217 zs->zs_wr_cur = rptr;
1218 zs->zs_wr_lim = wptr;
1223 "zsh_start end: zs = %p", zs);
1237 register struct zscom *zs = (struct zscom *)stp->str_com;
1238 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str;
1246 mutex_enter(zs->zs_excl);
1247 if ((zs->zs_ops != &zsops_null) &&
1248 (zs->zs_ops != &zsops_hdlc)) {
1332 error = zsh_setmode(zs, zss,
1341 mutex_enter(zs->zs_excl_hi);
1343 mutex_exit(zs->zs_excl_hi);
1367 mutex_enter(zs->zs_excl_hi);
1369 (void) zsmctl(zs, ZSWR5_DTR, DMBIS);
1371 (void) zsmctl(zs, ZSWR5_DTR, DMBIC);
1372 mutex_exit(zs->zs_excl_hi);
1382 mutex_exit(zs->zs_excl);
1391 zsh_setmode(struct zscom *zs, struct syncline *zss, struct scc_mode *sm)
1396 mutex_enter(zs->zs_excl_hi);
1399 mutex_exit(zs->zs_excl_hi);
1406 mutex_exit(zs->zs_excl_hi);
1410 mutex_enter(zs->zs_excl_hi);
1416 mutex_exit(zs->zs_excl_hi);
1419 mutex_enter(zs->zs_excl_hi);
1425 mutex_exit(zs->zs_excl_hi);
1430 mutex_exit(zs->zs_excl_hi);
1438 error = zsh_program(zs, sm);
1439 if (!error && (zs->zs_ops != &zsops_null))
1440 zsh_init_port(zs, zss);
1442 mutex_exit(zs->zs_excl_hi);
1452 zsh_txint(struct zscom *zs)
1459 TRACE_1(TR_ZSH, TR_ZSH_TXINT, "zsh_txint: zs = %p", zs);
1461 if ((wr_cur = zs->zs_wr_cur) != NULL && (wr_cur < zs->zs_wr_lim)) {
1463 zs->zs_wr_cur = wr_cur;
1468 zss = (struct syncline *)&zs->zs_priv_str;
1486 zs->zs_wr_cur = mp->b_rptr;
1487 zs->zs_wr_lim = mp->b_wptr;
1488 SCC_WRITEDATA(*zs->zs_wr_cur++);
1500 zs->zs_wr_cur = zs->zs_wr_lim = NULL;
1511 ZSSETSOFT(zs);
1523 if (!zsh_start(zs, zss)) {
1536 (void) zsh_start(zs, zss);
1565 zsh_xsint(struct zscom *zs)
1567 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str;
1570 TRACE_1(TR_ZSH, TR_ZSH_XSINT, "zsh_xsint: zs = %p", zs);
1592 zsh_txbad(zs, zss);
1618 if ((x0 & ZSRR0_BREAK) && (s0 & ZSRR0_BREAK) && zs->zs_rd_cur) {
1620 zsh_rxbad(zs, zss);
1621 } else if ((s0 & ZSRR0_SYNC) && (zs->zs_rd_cur)) {
1635 zsh_rxbad(zs, zss);
1643 (void) zsh_start(zs, zss);
1647 zsh_setmstat(zs, CS_CTS_UP);
1660 zsh_setmstat(zs, CS_CTS_DOWN);
1669 zsh_txbad(zs, zss);
1678 zsh_rxint(struct zscom *zs)
1680 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str;
1684 TRACE_1(TR_ZSH, TR_ZSH_RXINT, "zsh_rxint: zs = %p", zs);
1686 if (((rd_cur = zs->zs_rd_cur) != NULL) && rd_cur < zs->zs_rd_lim) {
1688 zs->zs_rd_cur = rd_cur;
1699 bp->b_wptr = zs->zs_rd_cur;
1705 zsh_rxbad(zs, zss);
1708 zs->zs_rd_cur = bp->b_wptr;
1709 zs->zs_rd_lim = bp->b_datap->db_lim;
1710 *zs->zs_rd_cur++ = SCC_READDATA(); /* Also resets interrupt */
1718 zsh_srint(struct zscom *zs)
1720 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str;
1724 TRACE_1(TR_ZSH, TR_ZSH_SRINT, "zsh_srint: zs = %p", zs);
1733 zsh_rxbad(zs, zss);
1737 if ((rd_cur = zs->zs_rd_cur) == NULL)
1752 zs->zs_rd_cur = NULL;
1753 zs->zs_rd_lim = NULL;
1754 ZSSETSOFT(zs);
1760 zsh_rxbad(zs, zss);
1770 zsh_softint(struct zscom *zs)
1779 TRACE_1(TR_ZSH, TR_ZSH_SOFT_START, "zsh_soft start: zs = %p", zs);
1781 mutex_enter(zs->zs_excl);
1782 zss = (struct syncline *)zs->zs_priv;
1784 mutex_exit(zs->zs_excl);
1795 mutex_enter(zs->zs_excl_hi);
1807 zsh_setmstat(zs, CS_CTS_UP);
1810 mutex_exit(zs->zs_excl_hi);
1816 mutex_exit(zs->zs_excl_hi);
1858 ZSH_GETBLOCK(zs, allocbcount);
1862 mutex_enter(zs->zs_excl_hi);
1866 mutex_exit(zs->zs_excl_hi);
1868 mutex_exit(zs->zs_excl_hi);
1873 mutex_exit(zs->zs_excl_hi);
1878 mutex_exit(zs->zs_excl);
1897 TRACE_1(TR_ZSH, TR_ZSH_SOFT_END, "zsh_soft end: zs = %p", zs);
1907 zsh_program(struct zscom *zs, struct scc_mode *sm)
1909 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str;
1919 ZSSETSOFT(zs); /* get our house in order */
2015 zspp = &zs_prog[zs->zs_unit];
2017 zspp->zs = zs;
2062 zsh_setmstat(struct zscom *zs, int event)
2064 register struct syncline *zss = (struct syncline *)&zs->zs_priv_str;
2079 ZSSETSOFT(zs);
2087 zsh_rxbad(struct zscom *zs, struct syncline *zss)
2108 zs->zs_rd_cur = NULL;
2109 zs->zs_rd_lim = NULL;
2114 zs->zs_rd_cur = NULL;
2115 zs->zs_rd_lim = NULL;
2118 ZSSETSOFT(zs);
2125 zsh_txbad(struct zscom *zs, struct syncline *zss)
2131 zs->zs_wr_cur = NULL;
2132 zs->zs_wr_lim = NULL;
2155 struct zscom *zs = arg;
2156 struct syncline *zss = (struct syncline *)&zs->zs_priv_str;
2173 mutex_enter(zs->zs_excl);
2177 mutex_exit(zs->zs_excl);
2181 mutex_enter(zs->zs_excl_hi);
2185 zsh_hdp_ok_or_rts_state(zs, zss))
2186 (void) zsh_start(zs, zss);
2202 zsh_setmstat(zs, CS_CTS_UP);
2215 (void) zsh_start(zs, zss);
2237 zsh_txbad(zs, zss);
2249 zsh_setmstat(zs, CS_CTS_TO);
2252 ZSSETSOFT(zs);
2265 mutex_exit(zs->zs_excl_hi);
2266 zss->sl_wd_id = timeout(zsh_watchdog, zs, SIO_WATCHDOG_TICK);
2269 mutex_exit(zs->zs_excl_hi);
2273 mutex_enter(zs->zs_excl_hi);
2276 mutex_exit(zs->zs_excl_hi);
2280 mutex_exit(zs->zs_excl);
2282 cmn_err(CE_WARN, "zsh%x: transmit hung", zs->zs_unit);
2288 struct zscom *zs = arg;
2289 struct syncline *zss = (struct syncline *)&zs->zs_priv_str;
2292 mutex_enter(zs->zs_excl);
2295 ZSH_GETBLOCK(zs, tmp);
2297 mutex_exit(zs->zs_excl);