xref: /OK3568_Linux_fs/kernel/include/uapi/linux/virtio_console.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
3*4882a593Smuzhiyun  * anyone can use the definitions to implement compatible drivers/servers:
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Redistribution and use in source and binary forms, with or without
7*4882a593Smuzhiyun  * modification, are permitted provided that the following conditions
8*4882a593Smuzhiyun  * are met:
9*4882a593Smuzhiyun  * 1. Redistributions of source code must retain the above copyright
10*4882a593Smuzhiyun  *    notice, this list of conditions and the following disclaimer.
11*4882a593Smuzhiyun  * 2. Redistributions in binary form must reproduce the above copyright
12*4882a593Smuzhiyun  *    notice, this list of conditions and the following disclaimer in the
13*4882a593Smuzhiyun  *    documentation and/or other materials provided with the distribution.
14*4882a593Smuzhiyun  * 3. Neither the name of IBM nor the names of its contributors
15*4882a593Smuzhiyun  *    may be used to endorse or promote products derived from this software
16*4882a593Smuzhiyun  *    without specific prior written permission.
17*4882a593Smuzhiyun  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
18*4882a593Smuzhiyun  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*4882a593Smuzhiyun  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*4882a593Smuzhiyun  * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
21*4882a593Smuzhiyun  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*4882a593Smuzhiyun  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*4882a593Smuzhiyun  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*4882a593Smuzhiyun  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*4882a593Smuzhiyun  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*4882a593Smuzhiyun  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*4882a593Smuzhiyun  * SUCH DAMAGE.
28*4882a593Smuzhiyun  *
29*4882a593Smuzhiyun  * Copyright (C) Red Hat, Inc., 2009, 2010, 2011
30*4882a593Smuzhiyun  * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011
31*4882a593Smuzhiyun  */
32*4882a593Smuzhiyun #ifndef _UAPI_LINUX_VIRTIO_CONSOLE_H
33*4882a593Smuzhiyun #define _UAPI_LINUX_VIRTIO_CONSOLE_H
34*4882a593Smuzhiyun #include <linux/types.h>
35*4882a593Smuzhiyun #include <linux/virtio_types.h>
36*4882a593Smuzhiyun #include <linux/virtio_ids.h>
37*4882a593Smuzhiyun #include <linux/virtio_config.h>
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun /* Feature bits */
40*4882a593Smuzhiyun #define VIRTIO_CONSOLE_F_SIZE	0	/* Does host provide console size? */
41*4882a593Smuzhiyun #define VIRTIO_CONSOLE_F_MULTIPORT 1	/* Does host provide multiple ports? */
42*4882a593Smuzhiyun #define VIRTIO_CONSOLE_F_EMERG_WRITE 2 /* Does host support emergency write? */
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun #define VIRTIO_CONSOLE_BAD_ID		(~(__u32)0)
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun struct virtio_console_config {
47*4882a593Smuzhiyun 	/* colums of the screens */
48*4882a593Smuzhiyun 	__virtio16 cols;
49*4882a593Smuzhiyun 	/* rows of the screens */
50*4882a593Smuzhiyun 	__virtio16 rows;
51*4882a593Smuzhiyun 	/* max. number of ports this device can hold */
52*4882a593Smuzhiyun 	__virtio32 max_nr_ports;
53*4882a593Smuzhiyun 	/* emergency write register */
54*4882a593Smuzhiyun 	__virtio32 emerg_wr;
55*4882a593Smuzhiyun } __attribute__((packed));
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun /*
58*4882a593Smuzhiyun  * A message that's passed between the Host and the Guest for a
59*4882a593Smuzhiyun  * particular port.
60*4882a593Smuzhiyun  */
61*4882a593Smuzhiyun struct virtio_console_control {
62*4882a593Smuzhiyun 	__virtio32 id;		/* Port number */
63*4882a593Smuzhiyun 	__virtio16 event;	/* The kind of control event (see below) */
64*4882a593Smuzhiyun 	__virtio16 value;	/* Extra information for the key */
65*4882a593Smuzhiyun };
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun /* Some events for control messages */
68*4882a593Smuzhiyun #define VIRTIO_CONSOLE_DEVICE_READY	0
69*4882a593Smuzhiyun #define VIRTIO_CONSOLE_PORT_ADD		1
70*4882a593Smuzhiyun #define VIRTIO_CONSOLE_PORT_REMOVE	2
71*4882a593Smuzhiyun #define VIRTIO_CONSOLE_PORT_READY	3
72*4882a593Smuzhiyun #define VIRTIO_CONSOLE_CONSOLE_PORT	4
73*4882a593Smuzhiyun #define VIRTIO_CONSOLE_RESIZE		5
74*4882a593Smuzhiyun #define VIRTIO_CONSOLE_PORT_OPEN	6
75*4882a593Smuzhiyun #define VIRTIO_CONSOLE_PORT_NAME	7
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun #endif /* _UAPI_LINUX_VIRTIO_CONSOLE_H */
79