qcn.c revision ea841a36325080fa70fe84dbaff3b3e8c8ce458e
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * CDDL HEADER START
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * The contents of this file are subject to the terms of the
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * Common Development and Distribution License, Version 1.0 only
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * (the "License"). You may not use this file except in compliance
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * with the License.
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * or http://www.opensolaris.org/os/licensing.
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * See the License for the specific language governing permissions
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * and limitations under the License.
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * When distributing Covered Code, include this CDDL HEADER in each
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * If applicable, add the following below this CDDL HEADER, with the
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * fields enclosed by brackets "[]" replaced with your own identifying
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * information: Portions Copyright [yyyy] [name of copyright owner]
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * CDDL HEADER END
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * Use is subject to license terms.
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow#pragma ident "%Z%%M% %I% %E% SMI"
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow * sun4v console driver
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow/* dev_ops and cb_ops for device driver */
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulowstatic int qcn_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulowstatic int qcn_attach(dev_info_t *, ddi_attach_cmd_t);
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulowstatic int qcn_detach(dev_info_t *, ddi_detach_cmd_t);
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulowstatic int qcn_open(queue_t *, dev_t *, int, int, cred_t *);
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulowstatic int qcn_close(queue_t *, int, cred_t *);
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulow/* other internal qcn routines */
37c79205ad46187f54b2edbf6a468160935f14d9Joshua M. Clulowstatic void qcn_reioctl(void *);
static void qcn_start(void);
static void qcn_flush(void);
#ifdef QCN_POLLING
NULL,
&rinit,
&winit,
NULL,
(void*)&modldrv,
_init(void)
int error;
if (error != 0)
return (error);
_fini(void)
return (EBUSY);
qcn_add_intrs(void)
return (DDI_FAILURE);
return (DDI_FAILURE);
for (x = 0; x < actual; x++) {
return (DDI_FAILURE);
for (x = 0; x < actual; x++) {
return (DDI_FAILURE);
for (x = 0; x < actual; x++) {
(void) ddi_intr_remove_handler(
for (y = 0; y < actual; y++) {
return (DDI_FAILURE);
return (DDI_SUCCESS);
qcn_remove_intrs(void)
qcn_intr_enable(void)
int, minor_t);
#ifdef QCN_POLLING
char *binding_name;
return (DDI_FAILURE);
return (DDI_FAILURE);
#ifdef QCN_POLLING
return (DDI_FAILURE);
return (DDI_FAILURE);
(void) ddi_intr_remove_softint(
return (DDI_FAILURE);
#ifdef QCN_DEBUG
return (DDI_SUCCESS);
return (DDI_FAILURE);
#ifdef QCN_DEBUG
#ifdef QCN_POLLING
return (DDI_SUCCESS);
int instance = 0;
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
if (qcn_state) {
#ifdef QCN_DEBUG
case DDI_INFO_DEVT2INSTANCE:
#ifdef QCN_DEBUG
return (error);
#ifdef QCN_DEBUG
if (unit != 0)
return (ENXIO);
return (DDI_SUCCESS);
if (!qcn_state) {
return (ENXIO);
qprocson(q);
#ifdef QCN_DEBUG
return (DDI_SUCCESS);
qprocsoff(q);
return (DDI_SUCCESS);
#ifdef QCN_DEBUG
#ifdef QCN_DEBUG
case M_IOCTL:
case M_CTL:
#ifdef QCN_DEBUG
case TCSETSW:
case TCSETSF:
case TCSETAW:
case TCSETAF:
case TCSBRK:
qcn_start();
case M_FLUSH:
case M_STOP:
case M_START:
case M_DATA:
#ifdef QCN_DEBUG
qcn_start();
int data_size;
int error = 0;
#ifdef QCN_DEBUG
if (data_size != 0) {
if (error < 0) {
error = 0;
case TCSBRK:
case TIOCSBRK:
case TIOCCBRK:
case TIOCMSET:
case TIOCMBIS:
case TIOCMBIC:
case TIOCMGET:
if (error != 0) {
queue_t *q;
qcn_start(void)
queue_t *q;
int rv;
#ifdef QCN_DEBUG
for (i = 0; i < len; i++) {
if (i != len) {
return (EAGAIN);
qcn_flush(void)
queue_t *q;
gethrestime_sec());
qcn_trigger_softint(void)
(void) ddi_intr_trigger_softint(
static uint_t
int cc;
goto out;
goto out;
} while (--cc);
out:
qcn_start();
return (DDI_INTR_CLAIMED);
static uint_t
goto out;
out:
return (DDI_INTR_CLAIMED);
#ifdef QCN_POLLING
int qcn_writeq_flush = 0;
goto out;
goto out;
out:
if (qcn_writeq_flush) {
qcn_start();
* Check for abort character sequence, copied from zs_async.c
static boolean_t
static int state = 0;
state = 0;
return (B_TRUE);
return (B_FALSE);
if (canputnext(q))
qcn_start();