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()
552 mutex_exit(&xcp->excl); in xencons_rxint()
556 async = xcp->priv; in xencons_rxint()
557 instance = xcp->unit; in xencons_rxint()
558 ifp = xcp->ifp; in xencons_rxint()
572 mutex_exit(&xcp->excl); in xencons_rxint()
587 mutex_exit(&xcp->excl); in xencons_rxint()
600 if ((abort_enable == KIOCABORTENABLE) && (xcp->flags & ASY_CONSOLE)) { in xencons_rxint()
620 mutex_exit(&xcp->excl); in xencons_rxint()
628 (void) xcasync_flowcontrol_sw_input(xcp, FLOW_STOP, in xencons_rxint()
631 mutex_exit(&xcp->excl); in xencons_rxint()
635 (void) xcasync_flowcontrol_sw_input(xcp, FLOW_START, in xencons_rxint()
641 mutex_exit(&xcp->excl); in xencons_rxint()
655 xcasync_flowcontrol_sw_output(xcp, FLOW_STOP); in xencons_rxint()
659 xcasync_flowcontrol_sw_output(xcp, FLOW_START); in xencons_rxint()
664 xcasync_flowcontrol_sw_output(xcp, FLOW_START); in xencons_rxint()
672 mutex_exit(&xcp->excl); in xencons_rxint()
687 ec_notify_via_evtchn(xcp->evtchn); in xencons_rxint()
696 xencons_txint(struct xencons *xcp) in xencons_txint() argument
705 if (mutex_owner(&xcp->excl) == curthread) { in xencons_txint()
709 mutex_enter(&xcp->excl); in xencons_txint()
711 mutex_exit(&xcp->excl); in xencons_txint()
716 async = xcp->priv; in xencons_txint()
720 mutex_exit(&xcp->excl); in xencons_txint()
733 struct xencons *xcp = (struct xencons *)arg; in xenconsintr() local
734 volatile struct xencons_interface *ifp = xcp->ifp; in xenconsintr()
737 xencons_rxint(xcp); in xenconsintr()
739 xencons_txint(xcp); in xenconsintr()
749 struct xencons *xcp = (struct xencons *)arg; in xenconsintr_priv() local
751 xencons_rxint(xcp); in xenconsintr_priv()
752 xencons_txint(xcp); in xenconsintr_priv()
763 struct xencons *xcp = async->async_common; in xcasync_start() local
771 int instance = xcp->unit; in xcasync_start()
775 ASSERT(mutex_owned(&xcp->excl)); in xcasync_start()
781 (void) xcasync_flowcontrol_sw_input(xcp, FLOW_CHECK, IN_FLOW_NULL); in xcasync_start()
805 mutex_exit(&xcp->excl); in xcasync_start()
807 mutex_enter(&xcp->excl); in xcasync_start()
846 mutex_exit(&xcp->excl); in xcasync_start()
849 mutex_enter(&xcp->excl); in xcasync_start()
860 volatile struct xencons_interface *ifp = xcp->ifp; in xcasync_start()
877 ec_notify_via_evtchn(xcp->evtchn); in xcasync_start()
893 struct xencons *xcp = async->async_common; in xcasync_ioctl() local
900 int instance = xcp->unit; in xcasync_ioctl()
968 mutex_enter(&xcp->excl); in xcasync_ioctl()
1010 (cons_polledio_arg_t)&xcp->polledio; in xcasync_ioctl()
1032 xcp->flags |= ASY_CONSOLE; in xcasync_ioctl()
1034 xcp->flags &= ~ASY_CONSOLE; in xcasync_ioctl()
1050 (xcp->flags & ASY_CONSOLE) != 0; in xcasync_ioctl()
1065 mutex_exit(&xcp->excl); in xcasync_ioctl()
1095 struct xencons *xcp; in xenconswput() local
1098 xcp = async->async_common; in xenconswput()
1103 mutex_enter(&xcp->excl); in xenconswput()
1105 mutex_exit(&xcp->excl); in xenconswput()
1110 mutex_enter(&xcp->excl); in xenconswput()
1115 mutex_exit(&xcp->excl); in xenconswput()
1135 mutex_enter(&xcp->excl); in xenconswput()
1137 mutex_exit(&xcp->excl); in xenconswput()
1151 mutex_enter(&xcp->excl); in xenconswput()
1160 mutex_exit(&xcp->excl); in xenconswput()
1174 mutex_enter(&xcp->excl); in xenconswput()
1176 mutex_exit(&xcp->excl); in xenconswput()
1187 mutex_enter(&xcp->excl); in xenconswput()
1189 mutex_exit(&xcp->excl); in xenconswput()
1193 mutex_enter(&xcp->excl); in xenconswput()
1194 mutex_enter(&xcp->excl); in xenconswput()
1196 (void) xcasync_flowcontrol_sw_input(xcp, FLOW_STOP, in xenconswput()
1199 mutex_exit(&xcp->excl); in xenconswput()
1200 mutex_exit(&xcp->excl); in xenconswput()
1205 mutex_enter(&xcp->excl); in xenconswput()
1206 mutex_enter(&xcp->excl); in xenconswput()
1208 (void) xcasync_flowcontrol_sw_input(xcp, FLOW_START, in xenconswput()
1211 mutex_exit(&xcp->excl); in xenconswput()
1212 mutex_exit(&xcp->excl); in xenconswput()
1242 struct xencons *xcp; in xcasync_reioctl() local
1246 xcp = ddi_get_soft_state(xencons_soft_state, instance); in xcasync_reioctl()
1247 ASSERT(xcp != NULL); in xcasync_reioctl()
1248 async = xcp->priv; in xcasync_reioctl()
1253 mutex_enter(&xcp->excl); in xcasync_reioctl()
1256 mutex_exit(&xcp->excl); in xcasync_reioctl()
1262 mutex_exit(&xcp->excl); in xcasync_reioctl()
1265 mutex_exit(&xcp->excl); in xcasync_reioctl()
1281 struct xencons *xcp = xencons_console; in xenconsputchar() local
1282 volatile struct xencons_interface *ifp = xcp->ifp; in xenconsputchar()
1309 ec_notify_via_evtchn(xcp->evtchn); in xenconsputchar()
1319 struct xencons *xcp = (struct xencons *)arg; in xenconsischar() local
1320 volatile struct xencons_interface *ifp = xcp->ifp; in xenconsischar()
1322 if (xcp->polldix < xcp->polllen) in xenconsischar()
1327 xcp->polldix = 0; in xenconsischar()
1328 xcp->polllen = 0; in xenconsischar()
1330 xcp->polllen = HYPERVISOR_console_io(CONSOLEIO_read, 1, in xenconsischar()
1331 (char *)xcp->pollbuf); in xenconsischar()
1332 return (xcp->polllen != 0); in xenconsischar()
1343 xcp->pollbuf[0] = ifp->in[MASK_XENCONS_IDX(cons++, ifp->in)]; in xenconsischar()
1346 xcp->polllen = 1; in xenconsischar()
1348 return (xcp->polllen != 0); in xenconsischar()
1357 struct xencons *xcp = (struct xencons *)arg; in xenconsgetchar() local
1359 ec_wait_on_evtchn(xcp->evtchn, (int (*)(void *))xenconsischar, arg); in xenconsgetchar()
1361 return (xcp->pollbuf[xcp->polldix++]); in xenconsgetchar()
1430 xcasync_flowcontrol_sw_output(struct xencons *xcp, async_flowc_action onoff) in xcasync_flowcontrol_sw_output() argument
1432 struct asyncline *async = xcp->priv; in xcasync_flowcontrol_sw_output()
1433 int instance = xcp->unit; in xcasync_flowcontrol_sw_output()
1435 ASSERT(mutex_owned(&xcp->excl)); in xcasync_flowcontrol_sw_output()
1475 xcasync_flowcontrol_sw_input(struct xencons *xcp, async_flowc_action onoff, in xcasync_flowcontrol_sw_input() argument
1478 struct asyncline *async = xcp->priv; in xcasync_flowcontrol_sw_input()
1479 int instance = xcp->unit; in xcasync_flowcontrol_sw_input()
1482 ASSERT(mutex_owned(&xcp->excl)); in xcasync_flowcontrol_sw_input()