consdev.h revision 361ed64a5abddd9ed26f47e25824bbce82557ab4
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_CONSDEV_H
#define _SYS_CONSDEV_H
#include <sys/isa_defs.h>
#include <sys/dditypes.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Paths to console devices
*/
#define CONSKBD_PATH "/pseudo/conskbd@0:conskbd"
#define CONSMS_PATH "/pseudo/consms@0:mouse"
#define IWSCN_PATH "/pseudo/iwscn@0:iwscn"
/*
* Console redirection.
*/
/*
* Virtual Serial Console redirection.
*/
/*
* Mouse, keyboard, and frame buffer configuration information.
*
*/
extern int consmode; /* CONS_FW or CONS_KFB */
extern int cons_tem_disable;
#define CONS_FW 0
#define CONS_KFB 1
/*
* Workstation console redirection.
*
* The workstation console device is the multiplexor that hooks keyboard and
* frame buffer together into a single tty-like device. Access to it is
* through the redirecting driver, so that frame buffer output can be
* redirected to other devices. wsconsvp names the redirecting access point,
* and rwsconsvp names the workstation console itself.
*
* XXX: Assumes a single workstation console.
*/
/*
* Generic console ioctls.
*
* On systems without OBP, all potential console devices should implement these.
*
* On systems with OBP, all potential console devices should implement
* the ABORTENABLE ioctls. All potential console devices that cannot share
* their hardware with OBP should implement the POLLEDIO ioctls.
*/
/*
* Get the structure of function pointers to be used for polled I/O
*
* struct cons_polledio *polledio;
* struct strioctl str;
*
* str.ic_cmd = CONS_OPENPOLLEDIO;
* str.ic_timout = INFTIM;
* str.ic_len = sizeof (polledio);
* str.ic_dp = (char *)&polledio;
* ioctl(fd, I_STR, &str);
*/
#define CONSOPENPOLLEDIO (_CONSIOC|0)
/*
* Get the current state of abort enable
* enable = ioctl(fd, CONSGETABORTENABLE, 0)
*/
/*
* Set the current state of abort enable
* ioctl(fd, CONSSETABORTENABLE, boolean_t)
*/
/*
* Undo anything that was done with CONSOPENPOLLEDIO
* ioctl(fd, CONSCLOSEPOLLEDIO, 0)
*/
/*
* Set the type simulated by hardwares
* ioctl(fd, CONSSETKBDTYPE, kbdtype)
* kbdtype:
* KB_PC or KB_USB
*/
#define CONSPOLLEDIO_V0 0
#define CONSPOLLEDIO_V1 1
typedef int kbtrans_key_t;
/*
* Opaque state structure for driver state. Each driver has its own
* This allows better type-checking than "void *", helping to ensure
* that the structure passed in is the structure used in the callback.
*/
typedef struct __cons_polledio_arg *cons_polledio_arg_t;
/*
* This is the structure that is used to handle polled I/O. It is filled
* in by a lower driver, passed up, and eventually registered with the
* debugger that needs to do polled I/O.
*/
typedef struct cons_polledio {
/*
* version of this structure
*/
unsigned cons_polledio_version;
/*
* Argument that is passed to the following routines.
*/
/*
* Pointer to the routine and its argument that handles putting
* characters out to the polled device.
*/
void (*cons_polledio_putchar)(cons_polledio_arg_t,
uchar_t);
/*
* Pointer to the routine and its argument that handles getting
* characters from the polled device. This routine is blocking.
*/
int (*cons_polledio_getchar)(cons_polledio_arg_t);
/*
* Pointer to the routine and its argument that checks to see
* if a character is pending input. This routine is non-blocking.
*/
/*
* Initialize the polled subsystem. This routine is called once
* per mode change from non-polled to polled mode.
*/
void (*cons_polledio_enter)(cons_polledio_arg_t);
/*
* Restore the non-polled subsystem. This routine is called once
* per mode change from non-polled to polled mode.
*/
void (*cons_polledio_exit)(cons_polledio_arg_t);
/* Routine to set the LED's in polled mode */
void (*cons_polledio_setled)(cons_polledio_arg_t, int);
/* Routine to indicate that a scande is available in polled mode */
kbtrans_key_t *, enum keystate *);
extern cons_polledio_t *cons_polledio;
/*
* Workstation Console
*/
#define WC_OPEN_FB (_WCIOC | 0)
#endif /* _KERNEL || _KMDB */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_CONSDEV_H */