162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so 362306a36Sopenharmony_ci * anyone can use the definitions to implement compatible drivers/servers: 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 762306a36Sopenharmony_ci * modification, are permitted provided that the following conditions 862306a36Sopenharmony_ci * are met: 962306a36Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright 1062306a36Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 1162306a36Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright 1262306a36Sopenharmony_ci * notice, this list of conditions and the following disclaimer in the 1362306a36Sopenharmony_ci * documentation and/or other materials provided with the distribution. 1462306a36Sopenharmony_ci * 3. Neither the name of IBM nor the names of its contributors 1562306a36Sopenharmony_ci * may be used to endorse or promote products derived from this software 1662306a36Sopenharmony_ci * without specific prior written permission. 1762306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 1862306a36Sopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1962306a36Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2062306a36Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE 2162306a36Sopenharmony_ci * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2262306a36Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2362306a36Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2462306a36Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2562306a36Sopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2662306a36Sopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2762306a36Sopenharmony_ci * SUCH DAMAGE. 2862306a36Sopenharmony_ci * 2962306a36Sopenharmony_ci * Copyright (C) Red Hat, Inc., 2009, 2010, 2011 3062306a36Sopenharmony_ci * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011 3162306a36Sopenharmony_ci */ 3262306a36Sopenharmony_ci#ifndef _UAPI_LINUX_VIRTIO_CONSOLE_H 3362306a36Sopenharmony_ci#define _UAPI_LINUX_VIRTIO_CONSOLE_H 3462306a36Sopenharmony_ci#include <linux/types.h> 3562306a36Sopenharmony_ci#include <linux/virtio_types.h> 3662306a36Sopenharmony_ci#include <linux/virtio_ids.h> 3762306a36Sopenharmony_ci#include <linux/virtio_config.h> 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci/* Feature bits */ 4062306a36Sopenharmony_ci#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ 4162306a36Sopenharmony_ci#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */ 4262306a36Sopenharmony_ci#define VIRTIO_CONSOLE_F_EMERG_WRITE 2 /* Does host support emergency write? */ 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#define VIRTIO_CONSOLE_BAD_ID (~(__u32)0) 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_cistruct virtio_console_config { 4762306a36Sopenharmony_ci /* colums of the screens */ 4862306a36Sopenharmony_ci __virtio16 cols; 4962306a36Sopenharmony_ci /* rows of the screens */ 5062306a36Sopenharmony_ci __virtio16 rows; 5162306a36Sopenharmony_ci /* max. number of ports this device can hold */ 5262306a36Sopenharmony_ci __virtio32 max_nr_ports; 5362306a36Sopenharmony_ci /* emergency write register */ 5462306a36Sopenharmony_ci __virtio32 emerg_wr; 5562306a36Sopenharmony_ci} __attribute__((packed)); 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci/* 5862306a36Sopenharmony_ci * A message that's passed between the Host and the Guest for a 5962306a36Sopenharmony_ci * particular port. 6062306a36Sopenharmony_ci */ 6162306a36Sopenharmony_cistruct virtio_console_control { 6262306a36Sopenharmony_ci __virtio32 id; /* Port number */ 6362306a36Sopenharmony_ci __virtio16 event; /* The kind of control event (see below) */ 6462306a36Sopenharmony_ci __virtio16 value; /* Extra information for the key */ 6562306a36Sopenharmony_ci}; 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci/* Some events for control messages */ 6862306a36Sopenharmony_ci#define VIRTIO_CONSOLE_DEVICE_READY 0 6962306a36Sopenharmony_ci#define VIRTIO_CONSOLE_PORT_ADD 1 7062306a36Sopenharmony_ci#define VIRTIO_CONSOLE_PORT_REMOVE 2 7162306a36Sopenharmony_ci#define VIRTIO_CONSOLE_PORT_READY 3 7262306a36Sopenharmony_ci#define VIRTIO_CONSOLE_CONSOLE_PORT 4 7362306a36Sopenharmony_ci#define VIRTIO_CONSOLE_RESIZE 5 7462306a36Sopenharmony_ci#define VIRTIO_CONSOLE_PORT_OPEN 6 7562306a36Sopenharmony_ci#define VIRTIO_CONSOLE_PORT_NAME 7 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci#endif /* _UAPI_LINUX_VIRTIO_CONSOLE_H */ 79