3095 * occurs if the ioctl in question was waiting for the output
3096 * to drain). If it's one of those, process it immediately.
3097 */
3098 switch (bp->b_datap->db_type) {
3099
3100 case M_BREAK:
3101 /*
3102 * Set the break bit, and arrange for "async_restart"
3103 * to be called in 1/4 second; it will turn the
3104 * break bit off, and call "async_start" to grab
3105 * the next message.
3106 */
3107 mutex_enter(&asy->asy_excl_hi);
3108 val = ddi_get8(asy->asy_iohandle,
3109 asy->asy_ioaddr + LCR);
3110 ddi_put8(asy->asy_iohandle, asy->asy_ioaddr + LCR,
3111 (val | SETBREAK));
3112 mutex_exit(&asy->asy_excl_hi);
3113 async->async_flags |= ASYNC_BREAK;
3114 (void) timeout(async_restart, (caddr_t)async,
3115 drv_usectohz(1000000)/4);
3116 freemsg(bp);
3117 return; /* wait for this to finish */
3118
3119 case M_DELAY:
3120 /*
3121 * Arrange for "async_restart" to be called when the
3122 * delay expires; it will turn ASYNC_DELAY off,
3123 * and call "async_start" to grab the next message.
3124 */
3125 (void) timeout(async_restart, (caddr_t)async,
3126 (int)(*(unsigned char *)bp->b_rptr + 6));
3127 async->async_flags |= ASYNC_DELAY;
3128 freemsg(bp);
3129 return; /* wait for this to finish */
3130
3131 case M_IOCTL:
3132 /*
3133 * This ioctl was waiting for the output ahead of
3134 * it to drain; obviously, it has. Do it, and
3135 * then grab the next message after it.
3562 mutex_exit(&asy->asy_excl_hi);
3563 mutex_exit(&asy->asy_excl);
3564 drv_usecwait(
3565 32*asyspdtab[index] & 0xfff);
3566 mutex_enter(&asy->asy_excl);
3567 mutex_enter(&asy->asy_excl_hi);
3568 }
3569 /*
3570 * Arrange for "async_restart"
3571 * to be called in 1/4 second;
3572 * it will turn the break bit off, and call
3573 * "async_start" to grab the next message.
3574 */
3575 val = ddi_get8(asy->asy_iohandle,
3576 asy->asy_ioaddr + LCR);
3577 ddi_put8(asy->asy_iohandle,
3578 asy->asy_ioaddr + LCR,
3579 (val | SETBREAK));
3580 mutex_exit(&asy->asy_excl_hi);
3581 (void) timeout(async_restart, (caddr_t)async,
3582 drv_usectohz(1000000)/4);
3583 } else {
3584 DEBUGCONT1(ASY_DEBUG_OUT,
3585 "async%d_ioctl: wait for flush.\n",
3586 instance);
3587 mutex_enter(&asy->asy_excl_hi);
3588 asy_waiteot(asy);
3589 mutex_exit(&asy->asy_excl_hi);
3590 DEBUGCONT1(ASY_DEBUG_OUT,
3591 "async%d_ioctl: ldterm satisfied.\n",
3592 instance);
3593 }
3594 break;
3595
3596 case TIOCSBRK:
3597 if (!(async->async_flags & ASYNC_OUT_SUSPEND)) {
3598 mutex_enter(&asy->asy_excl_hi);
3599 async->async_flags |= ASYNC_OUT_SUSPEND;
3600 async->async_flags |= ASYNC_HOLD_UTBRK;
3601 index = BAUDINDEX(
3602 async->async_ttycommon.t_cflag);
|
3095 * occurs if the ioctl in question was waiting for the output
3096 * to drain). If it's one of those, process it immediately.
3097 */
3098 switch (bp->b_datap->db_type) {
3099
3100 case M_BREAK:
3101 /*
3102 * Set the break bit, and arrange for "async_restart"
3103 * to be called in 1/4 second; it will turn the
3104 * break bit off, and call "async_start" to grab
3105 * the next message.
3106 */
3107 mutex_enter(&asy->asy_excl_hi);
3108 val = ddi_get8(asy->asy_iohandle,
3109 asy->asy_ioaddr + LCR);
3110 ddi_put8(asy->asy_iohandle, asy->asy_ioaddr + LCR,
3111 (val | SETBREAK));
3112 mutex_exit(&asy->asy_excl_hi);
3113 async->async_flags |= ASYNC_BREAK;
3114 (void) timeout(async_restart, (caddr_t)async,
3115 drv_sectohz(1) / 4);
3116 freemsg(bp);
3117 return; /* wait for this to finish */
3118
3119 case M_DELAY:
3120 /*
3121 * Arrange for "async_restart" to be called when the
3122 * delay expires; it will turn ASYNC_DELAY off,
3123 * and call "async_start" to grab the next message.
3124 */
3125 (void) timeout(async_restart, (caddr_t)async,
3126 (int)(*(unsigned char *)bp->b_rptr + 6));
3127 async->async_flags |= ASYNC_DELAY;
3128 freemsg(bp);
3129 return; /* wait for this to finish */
3130
3131 case M_IOCTL:
3132 /*
3133 * This ioctl was waiting for the output ahead of
3134 * it to drain; obviously, it has. Do it, and
3135 * then grab the next message after it.
3562 mutex_exit(&asy->asy_excl_hi);
3563 mutex_exit(&asy->asy_excl);
3564 drv_usecwait(
3565 32*asyspdtab[index] & 0xfff);
3566 mutex_enter(&asy->asy_excl);
3567 mutex_enter(&asy->asy_excl_hi);
3568 }
3569 /*
3570 * Arrange for "async_restart"
3571 * to be called in 1/4 second;
3572 * it will turn the break bit off, and call
3573 * "async_start" to grab the next message.
3574 */
3575 val = ddi_get8(asy->asy_iohandle,
3576 asy->asy_ioaddr + LCR);
3577 ddi_put8(asy->asy_iohandle,
3578 asy->asy_ioaddr + LCR,
3579 (val | SETBREAK));
3580 mutex_exit(&asy->asy_excl_hi);
3581 (void) timeout(async_restart, (caddr_t)async,
3582 drv_sectohz(1) / 4);
3583 } else {
3584 DEBUGCONT1(ASY_DEBUG_OUT,
3585 "async%d_ioctl: wait for flush.\n",
3586 instance);
3587 mutex_enter(&asy->asy_excl_hi);
3588 asy_waiteot(asy);
3589 mutex_exit(&asy->asy_excl_hi);
3590 DEBUGCONT1(ASY_DEBUG_OUT,
3591 "async%d_ioctl: ldterm satisfied.\n",
3592 instance);
3593 }
3594 break;
3595
3596 case TIOCSBRK:
3597 if (!(async->async_flags & ASYNC_OUT_SUSPEND)) {
3598 mutex_enter(&asy->asy_excl_hi);
3599 async->async_flags |= ASYNC_OUT_SUSPEND;
3600 async->async_flags |= ASYNC_HOLD_UTBRK;
3601 index = BAUDINDEX(
3602 async->async_ttycommon.t_cflag);
|