xref: /linux/include/uapi/linux/virtio_console.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1607ca46eSDavid Howells /*
2607ca46eSDavid Howells  * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
3607ca46eSDavid Howells  * anyone can use the definitions to implement compatible drivers/servers:
4607ca46eSDavid Howells  *
5607ca46eSDavid Howells  *
6607ca46eSDavid Howells  * Redistribution and use in source and binary forms, with or without
7607ca46eSDavid Howells  * modification, are permitted provided that the following conditions
8607ca46eSDavid Howells  * are met:
9607ca46eSDavid Howells  * 1. Redistributions of source code must retain the above copyright
10607ca46eSDavid Howells  *    notice, this list of conditions and the following disclaimer.
11607ca46eSDavid Howells  * 2. Redistributions in binary form must reproduce the above copyright
12607ca46eSDavid Howells  *    notice, this list of conditions and the following disclaimer in the
13607ca46eSDavid Howells  *    documentation and/or other materials provided with the distribution.
14607ca46eSDavid Howells  * 3. Neither the name of IBM nor the names of its contributors
15607ca46eSDavid Howells  *    may be used to endorse or promote products derived from this software
16607ca46eSDavid Howells  *    without specific prior written permission.
17607ca46eSDavid Howells  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
18607ca46eSDavid Howells  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19607ca46eSDavid Howells  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20607ca46eSDavid Howells  * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
21607ca46eSDavid Howells  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22607ca46eSDavid Howells  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23607ca46eSDavid Howells  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24607ca46eSDavid Howells  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25607ca46eSDavid Howells  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26607ca46eSDavid Howells  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27607ca46eSDavid Howells  * SUCH DAMAGE.
28607ca46eSDavid Howells  *
29607ca46eSDavid Howells  * Copyright (C) Red Hat, Inc., 2009, 2010, 2011
30607ca46eSDavid Howells  * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011
31607ca46eSDavid Howells  */
32607ca46eSDavid Howells #ifndef _UAPI_LINUX_VIRTIO_CONSOLE_H
33607ca46eSDavid Howells #define _UAPI_LINUX_VIRTIO_CONSOLE_H
34607ca46eSDavid Howells #include <linux/types.h>
351f0f9106SMichael S. Tsirkin #include <linux/virtio_types.h>
36607ca46eSDavid Howells #include <linux/virtio_ids.h>
37607ca46eSDavid Howells #include <linux/virtio_config.h>
38607ca46eSDavid Howells 
39607ca46eSDavid Howells /* Feature bits */
40607ca46eSDavid Howells #define VIRTIO_CONSOLE_F_SIZE	0	/* Does host provide console size? */
41607ca46eSDavid Howells #define VIRTIO_CONSOLE_F_MULTIPORT 1	/* Does host provide multiple ports? */
421c6264ccSPranavkumar Sawargaonkar #define VIRTIO_CONSOLE_F_EMERG_WRITE 2 /* Does host support emergency write? */
43607ca46eSDavid Howells 
446407d75aSMichael S. Tsirkin #define VIRTIO_CONSOLE_BAD_ID		(~(__u32)0)
45607ca46eSDavid Howells 
46607ca46eSDavid Howells struct virtio_console_config {
47607ca46eSDavid Howells 	/* colums of the screens */
48*dbe2dc8cSMichael S. Tsirkin 	__virtio16 cols;
49607ca46eSDavid Howells 	/* rows of the screens */
50*dbe2dc8cSMichael S. Tsirkin 	__virtio16 rows;
51607ca46eSDavid Howells 	/* max. number of ports this device can hold */
52*dbe2dc8cSMichael S. Tsirkin 	__virtio32 max_nr_ports;
531c6264ccSPranavkumar Sawargaonkar 	/* emergency write register */
54*dbe2dc8cSMichael S. Tsirkin 	__virtio32 emerg_wr;
55607ca46eSDavid Howells } __attribute__((packed));
56607ca46eSDavid Howells 
57607ca46eSDavid Howells /*
58607ca46eSDavid Howells  * A message that's passed between the Host and the Guest for a
59607ca46eSDavid Howells  * particular port.
60607ca46eSDavid Howells  */
61607ca46eSDavid Howells struct virtio_console_control {
621f0f9106SMichael S. Tsirkin 	__virtio32 id;		/* Port number */
631f0f9106SMichael S. Tsirkin 	__virtio16 event;	/* The kind of control event (see below) */
641f0f9106SMichael S. Tsirkin 	__virtio16 value;	/* Extra information for the key */
65607ca46eSDavid Howells };
66607ca46eSDavid Howells 
67607ca46eSDavid Howells /* Some events for control messages */
68607ca46eSDavid Howells #define VIRTIO_CONSOLE_DEVICE_READY	0
69607ca46eSDavid Howells #define VIRTIO_CONSOLE_PORT_ADD		1
70607ca46eSDavid Howells #define VIRTIO_CONSOLE_PORT_REMOVE	2
71607ca46eSDavid Howells #define VIRTIO_CONSOLE_PORT_READY	3
72607ca46eSDavid Howells #define VIRTIO_CONSOLE_CONSOLE_PORT	4
73607ca46eSDavid Howells #define VIRTIO_CONSOLE_RESIZE		5
74607ca46eSDavid Howells #define VIRTIO_CONSOLE_PORT_OPEN	6
75607ca46eSDavid Howells #define VIRTIO_CONSOLE_PORT_NAME	7
76607ca46eSDavid Howells 
77607ca46eSDavid Howells 
78607ca46eSDavid Howells #endif /* _UAPI_LINUX_VIRTIO_CONSOLE_H */
79