Lines Matching refs:xcp

153 xenconssetup_avintr(struct xencons *xcp, int attach)  in xenconssetup_avintr()  argument
166 "xencons", xcp->console_irq, (caddr_t)xcp, NULL, NULL, in xenconssetup_avintr()
167 xcp->dip); in xenconssetup_avintr()
176 xcp->console_irq); in xenconssetup_avintr()
180 mutex_enter(&xcp->excl); in xenconssetup_avintr()
181 cv_signal(&xcp->excl_cv); in xenconssetup_avintr()
182 mutex_exit(&xcp->excl); in xenconssetup_avintr()
190 xenconssetup_add_avintr(struct xencons *xcp) in xenconssetup_add_avintr() argument
192 xenconssetup_avintr(xcp, B_TRUE); in xenconssetup_add_avintr()
196 xenconssetup_rem_avintr(struct xencons *xcp) in xenconssetup_rem_avintr() argument
198 xenconssetup_avintr(xcp, B_FALSE); in xenconssetup_rem_avintr()
205 struct xencons *xcp; in xenconsdetach() local
225 xcp = ddi_get_soft_state(xencons_soft_state, instance); in xenconsdetach()
226 if (xcp == NULL) in xenconsdetach()
235 mutex_enter(&xcp->excl); in xenconsdetach()
237 (void (*)(void *))xenconssetup_rem_avintr, xcp, TQ_SLEEP); in xenconsdetach()
238 cv_wait(&xcp->excl_cv, &xcp->excl); in xenconsdetach()
239 mutex_exit(&xcp->excl); in xenconsdetach()
245 xencons_soft_state_free(xcp); in xenconsdetach()
254 xenconssetup(struct xencons *xcp) in xenconssetup() argument
256 xcp->ifp = (volatile struct xencons_interface *)HYPERVISOR_console_page; in xenconssetup()
265 xcp->console_irq = ec_bind_virq_to_irq(VIRQ_CONSOLE, 0); in xenconssetup()
285 mutex_enter(&xcp->excl); in xenconssetup()
287 (void (*)(void *))xenconssetup_add_avintr, xcp, TQ_SLEEP); in xenconssetup()
288 cv_wait(&xcp->excl_cv, &xcp->excl); in xenconssetup()
289 mutex_exit(&xcp->excl); in xenconssetup()
291 (void) xvdi_alloc_evtchn(xcp->dip); in xenconssetup()
292 xcp->evtchn = xvdi_get_evtchn(xcp->dip); in xenconssetup()
293 (void) ddi_add_intr(xcp->dip, 0, NULL, NULL, xenconsintr, in xenconssetup()
294 (caddr_t)xcp); in xenconssetup()
302 struct xencons *xcp; in xenconsattach() local
311 xcp = xencons_console; in xenconsattach()
312 xenconssetup(xcp); in xenconsattach()
323 xcp = ddi_get_soft_state(xencons_soft_state, instance); in xenconsattach()
324 ASSERT(xcp != NULL); /* can't fail - we only just allocated it */ in xenconsattach()
329 xcp->unit = instance; in xenconsattach()
330 xcp->dip = devi; in xenconsattach()
333 xcp->polledio.cons_polledio_version = CONSPOLLEDIO_V0; in xenconsattach()
334 xcp->polledio.cons_polledio_argument = (cons_polledio_arg_t)xcp; in xenconsattach()
335 xcp->polledio.cons_polledio_putchar = xenconsputchar; in xenconsattach()
336 xcp->polledio.cons_polledio_getchar = xenconsgetchar; in xenconsattach()
337 xcp->polledio.cons_polledio_ischar = xenconsischar; in xenconsattach()
338 xcp->polledio.cons_polledio_enter = NULL; in xenconsattach()
339 xcp->polledio.cons_polledio_exit = NULL; in xenconsattach()
345 xcp->priv = kmem_zalloc(sizeof (struct asyncline), KM_SLEEP); in xenconsattach()
346 xcp->priv->async_common = xcp; in xenconsattach()
347 cv_init(&xcp->priv->async_flags_cv, NULL, CV_DRIVER, NULL); in xenconsattach()
350 mutex_init(&xcp->excl, NULL, MUTEX_DRIVER, NULL); in xenconsattach()
351 cv_init(&xcp->excl_cv, NULL, CV_DEFAULT, NULL); in xenconsattach()
358 xencons_soft_state_free(xcp); in xenconsattach()
363 xencons_console = xcp; in xenconsattach()
364 xenconssetup(xcp); in xenconsattach()
376 struct xencons *xcp; in xenconsinfo() local
379 xcp = ddi_get_soft_state(xencons_soft_state, instance); in xenconsinfo()
380 if (xcp == NULL) in xenconsinfo()
385 if (xcp->dip == NULL) in xenconsinfo()
388 *result = (void *) xcp->dip; in xenconsinfo()
405 xencons_soft_state_free(struct xencons *xcp) in xencons_soft_state_free() argument
407 mutex_destroy(&xcp->excl); in xencons_soft_state_free()
408 cv_destroy(&xcp->excl_cv); in xencons_soft_state_free()
409 kmem_free(xcp->priv, sizeof (struct asyncline)); in xencons_soft_state_free()
410 ddi_soft_state_free(xencons_soft_state, xcp->unit); in xencons_soft_state_free()
417 struct xencons *xcp; in xenconsopen() local
423 xcp = ddi_get_soft_state(xencons_soft_state, unit); in xenconsopen()
424 if (xcp == NULL) in xenconsopen()
426 async = xcp->priv; in xenconsopen()
427 mutex_enter(&xcp->excl); in xenconsopen()
445 mutex_exit(&xcp->excl); in xenconsopen()
454 mutex_exit(&xcp->excl); in xenconsopen()
475 struct xencons *xcp; in xenconsclose() local
482 xcp = async->async_common; in xenconsclose()
484 instance = xcp->unit; in xenconsclose()
488 mutex_enter(&xcp->excl); in xenconsclose()
518 mutex_exit(&xcp->excl); in xenconsclose()
532 xencons_rxint(struct xencons *xcp) in xencons_rxint() argument
548 mutex_enter(&xcp->excl); in xencons_rxint()
550 instance = xcp->unit; in xencons_rxint()
554 mutex_exit(&xcp->excl); in xencons_rxint()
561 async = xcp->priv; in xencons_rxint()
562 ifp = xcp->ifp; in xencons_rxint()
576 mutex_exit(&xcp->excl); in xencons_rxint()
591 mutex_exit(&xcp->excl); in xencons_rxint()
604 if ((abort_enable == KIOCABORTENABLE) && (xcp->flags & ASY_CONSOLE)) { in xencons_rxint()
624 mutex_exit(&xcp->excl); in xencons_rxint()
632 (void) xcasync_flowcontrol_sw_input(xcp, FLOW_STOP, in xencons_rxint()
635 mutex_exit(&xcp->excl); in xencons_rxint()
639 (void) xcasync_flowcontrol_sw_input(xcp, FLOW_START, in xencons_rxint()
645 mutex_exit(&xcp->excl); in xencons_rxint()
659 xcasync_flowcontrol_sw_output(xcp, FLOW_STOP); in xencons_rxint()
663 xcasync_flowcontrol_sw_output(xcp, FLOW_START); in xencons_rxint()
668 xcasync_flowcontrol_sw_output(xcp, FLOW_START); in xencons_rxint()
676 mutex_exit(&xcp->excl); in xencons_rxint()
691 ec_notify_via_evtchn(xcp->evtchn); in xencons_rxint()
700 xencons_txint(struct xencons *xcp) in xencons_txint() argument
709 if (mutex_owner(&xcp->excl) == curthread) { in xencons_txint()
713 mutex_enter(&xcp->excl); in xencons_txint()
715 mutex_exit(&xcp->excl); in xencons_txint()
720 async = xcp->priv; in xencons_txint()
724 mutex_exit(&xcp->excl); in xencons_txint()
737 struct xencons *xcp = (struct xencons *)arg; in xenconsintr() local
738 volatile struct xencons_interface *ifp = xcp->ifp; in xenconsintr()
741 xencons_rxint(xcp); in xenconsintr()
743 xencons_txint(xcp); in xenconsintr()
753 struct xencons *xcp = (struct xencons *)arg; in xenconsintr_priv() local
755 xencons_rxint(xcp); in xenconsintr_priv()
756 xencons_txint(xcp); in xenconsintr_priv()
767 struct xencons *xcp = async->async_common; in xcasync_start() local
775 int instance = xcp->unit; in xcasync_start()
779 ASSERT(mutex_owned(&xcp->excl)); in xcasync_start()
785 (void) xcasync_flowcontrol_sw_input(xcp, FLOW_CHECK, IN_FLOW_NULL); in xcasync_start()
809 mutex_exit(&xcp->excl); in xcasync_start()
811 mutex_enter(&xcp->excl); in xcasync_start()
850 mutex_exit(&xcp->excl); in xcasync_start()
853 mutex_enter(&xcp->excl); in xcasync_start()
864 volatile struct xencons_interface *ifp = xcp->ifp; in xcasync_start()
881 ec_notify_via_evtchn(xcp->evtchn); in xcasync_start()
897 struct xencons *xcp = async->async_common; in xcasync_ioctl() local
904 int instance = xcp->unit; in xcasync_ioctl()
972 mutex_enter(&xcp->excl); in xcasync_ioctl()
1014 (cons_polledio_arg_t)&xcp->polledio; in xcasync_ioctl()
1036 xcp->flags |= ASY_CONSOLE; in xcasync_ioctl()
1038 xcp->flags &= ~ASY_CONSOLE; in xcasync_ioctl()
1054 (xcp->flags & ASY_CONSOLE) != 0; in xcasync_ioctl()
1069 mutex_exit(&xcp->excl); in xcasync_ioctl()
1099 struct xencons *xcp; in xenconswput() local
1102 xcp = async->async_common; in xenconswput()
1107 mutex_enter(&xcp->excl); in xenconswput()
1109 mutex_exit(&xcp->excl); in xenconswput()
1114 mutex_enter(&xcp->excl); in xenconswput()
1119 mutex_exit(&xcp->excl); in xenconswput()
1139 mutex_enter(&xcp->excl); in xenconswput()
1141 mutex_exit(&xcp->excl); in xenconswput()
1155 mutex_enter(&xcp->excl); in xenconswput()
1164 mutex_exit(&xcp->excl); in xenconswput()
1178 mutex_enter(&xcp->excl); in xenconswput()
1180 mutex_exit(&xcp->excl); in xenconswput()
1191 mutex_enter(&xcp->excl); in xenconswput()
1193 mutex_exit(&xcp->excl); in xenconswput()
1197 mutex_enter(&xcp->excl); in xenconswput()
1198 mutex_enter(&xcp->excl); in xenconswput()
1200 (void) xcasync_flowcontrol_sw_input(xcp, FLOW_STOP, in xenconswput()
1203 mutex_exit(&xcp->excl); in xenconswput()
1204 mutex_exit(&xcp->excl); in xenconswput()
1209 mutex_enter(&xcp->excl); in xenconswput()
1210 mutex_enter(&xcp->excl); in xenconswput()
1212 (void) xcasync_flowcontrol_sw_input(xcp, FLOW_START, in xenconswput()
1215 mutex_exit(&xcp->excl); in xenconswput()
1216 mutex_exit(&xcp->excl); in xenconswput()
1246 struct xencons *xcp; in xcasync_reioctl() local
1250 xcp = ddi_get_soft_state(xencons_soft_state, instance); in xcasync_reioctl()
1251 ASSERT(xcp != NULL); in xcasync_reioctl()
1252 async = xcp->priv; in xcasync_reioctl()
1257 mutex_enter(&xcp->excl); in xcasync_reioctl()
1260 mutex_exit(&xcp->excl); in xcasync_reioctl()
1266 mutex_exit(&xcp->excl); in xcasync_reioctl()
1269 mutex_exit(&xcp->excl); in xcasync_reioctl()
1285 struct xencons *xcp = xencons_console; in xenconsputchar() local
1286 volatile struct xencons_interface *ifp = xcp->ifp; in xenconsputchar()
1313 ec_notify_via_evtchn(xcp->evtchn); in xenconsputchar()
1323 struct xencons *xcp = (struct xencons *)arg; in xenconsischar() local
1324 volatile struct xencons_interface *ifp = xcp->ifp; in xenconsischar()
1326 if (xcp->polldix < xcp->polllen) in xenconsischar()
1331 xcp->polldix = 0; in xenconsischar()
1332 xcp->polllen = 0; in xenconsischar()
1334 xcp->polllen = HYPERVISOR_console_io(CONSOLEIO_read, 1, in xenconsischar()
1335 (char *)xcp->pollbuf); in xenconsischar()
1336 return (xcp->polllen != 0); in xenconsischar()
1347 xcp->pollbuf[0] = ifp->in[MASK_XENCONS_IDX(cons++, ifp->in)]; in xenconsischar()
1350 xcp->polllen = 1; in xenconsischar()
1352 return (xcp->polllen != 0); in xenconsischar()
1361 struct xencons *xcp = (struct xencons *)arg; in xenconsgetchar() local
1363 ec_wait_on_evtchn(xcp->evtchn, (int (*)(void *))xenconsischar, arg); in xenconsgetchar()
1365 return (xcp->pollbuf[xcp->polldix++]); in xenconsgetchar()
1434 xcasync_flowcontrol_sw_output(struct xencons *xcp, async_flowc_action onoff) in xcasync_flowcontrol_sw_output() argument
1436 struct asyncline *async = xcp->priv; in xcasync_flowcontrol_sw_output()
1437 int instance = xcp->unit; in xcasync_flowcontrol_sw_output()
1439 ASSERT(mutex_owned(&xcp->excl)); in xcasync_flowcontrol_sw_output()
1479 xcasync_flowcontrol_sw_input(struct xencons *xcp, async_flowc_action onoff, in xcasync_flowcontrol_sw_input() argument
1482 struct asyncline *async = xcp->priv; in xcasync_flowcontrol_sw_input()
1483 int instance = xcp->unit; in xcasync_flowcontrol_sw_input()
1486 ASSERT(mutex_owned(&xcp->excl)); in xcasync_flowcontrol_sw_input()