Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
0003  * anyone can use the definitions to implement compatible drivers/servers:
0004  *
0005  *
0006  * Redistribution and use in source and binary forms, with or without
0007  * modification, are permitted provided that the following conditions
0008  * are met:
0009  * 1. Redistributions of source code must retain the above copyright
0010  *    notice, this list of conditions and the following disclaimer.
0011  * 2. Redistributions in binary form must reproduce the above copyright
0012  *    notice, this list of conditions and the following disclaimer in the
0013  *    documentation and/or other materials provided with the distribution.
0014  * 3. Neither the name of IBM nor the names of its contributors
0015  *    may be used to endorse or promote products derived from this software
0016  *    without specific prior written permission.
0017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
0018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0020  * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
0021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0027  * SUCH DAMAGE.
0028  *
0029  * Copyright (C) Red Hat, Inc., 2009, 2010, 2011
0030  * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011
0031  */
0032 #ifndef _UAPI_LINUX_VIRTIO_CONSOLE_H
0033 #define _UAPI_LINUX_VIRTIO_CONSOLE_H
0034 #include <linux/types.h>
0035 #include <linux/virtio_types.h>
0036 #include <linux/virtio_ids.h>
0037 #include <linux/virtio_config.h>
0038 
0039 /* Feature bits */
0040 #define VIRTIO_CONSOLE_F_SIZE   0   /* Does host provide console size? */
0041 #define VIRTIO_CONSOLE_F_MULTIPORT 1    /* Does host provide multiple ports? */
0042 #define VIRTIO_CONSOLE_F_EMERG_WRITE 2 /* Does host support emergency write? */
0043 
0044 #define VIRTIO_CONSOLE_BAD_ID       (~(__u32)0)
0045 
0046 struct virtio_console_config {
0047     /* colums of the screens */
0048     __virtio16 cols;
0049     /* rows of the screens */
0050     __virtio16 rows;
0051     /* max. number of ports this device can hold */
0052     __virtio32 max_nr_ports;
0053     /* emergency write register */
0054     __virtio32 emerg_wr;
0055 } __attribute__((packed));
0056 
0057 /*
0058  * A message that's passed between the Host and the Guest for a
0059  * particular port.
0060  */
0061 struct virtio_console_control {
0062     __virtio32 id;      /* Port number */
0063     __virtio16 event;   /* The kind of control event (see below) */
0064     __virtio16 value;   /* Extra information for the key */
0065 };
0066 
0067 /* Some events for control messages */
0068 #define VIRTIO_CONSOLE_DEVICE_READY 0
0069 #define VIRTIO_CONSOLE_PORT_ADD     1
0070 #define VIRTIO_CONSOLE_PORT_REMOVE  2
0071 #define VIRTIO_CONSOLE_PORT_READY   3
0072 #define VIRTIO_CONSOLE_CONSOLE_PORT 4
0073 #define VIRTIO_CONSOLE_RESIZE       5
0074 #define VIRTIO_CONSOLE_PORT_OPEN    6
0075 #define VIRTIO_CONSOLE_PORT_NAME    7
0076 
0077 
0078 #endif /* _UAPI_LINUX_VIRTIO_CONSOLE_H */