Rusty Russell | 3161043 | 2007-10-22 11:03:39 +1000 | [diff] [blame] | 1 | #ifndef _LINUX_VIRTIO_CONSOLE_H |
| 2 | #define _LINUX_VIRTIO_CONSOLE_H |
Jaswinder Singh Rajput | 8697325 | 2009-01-30 22:29:33 +0530 | [diff] [blame] | 3 | #include <linux/types.h> |
Christian Borntraeger | e95646c | 2009-09-30 11:17:21 +0200 | [diff] [blame] | 4 | #include <linux/virtio_ids.h> |
Rusty Russell | 3161043 | 2007-10-22 11:03:39 +1000 | [diff] [blame] | 5 | #include <linux/virtio_config.h> |
Rusty Russell | a23ea92 | 2010-01-18 19:14:55 +0530 | [diff] [blame] | 6 | /* |
| 7 | * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so |
| 8 | * anyone can use the definitions to implement compatible drivers/servers. |
Amit Shah | 17634ba | 2009-12-21 21:03:25 +0530 | [diff] [blame] | 9 | * |
| 10 | * Copyright (C) Red Hat, Inc., 2009, 2010 |
Rusty Russell | a23ea92 | 2010-01-18 19:14:55 +0530 | [diff] [blame] | 11 | */ |
Rusty Russell | 3161043 | 2007-10-22 11:03:39 +1000 | [diff] [blame] | 12 | |
Christian Borntraeger | c298345 | 2008-11-25 13:36:26 +0100 | [diff] [blame] | 13 | /* Feature bits */ |
| 14 | #define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ |
Amit Shah | b99fa81 | 2010-05-19 22:15:46 -0600 | [diff] [blame] | 15 | #define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */ |
Christian Borntraeger | c298345 | 2008-11-25 13:36:26 +0100 | [diff] [blame] | 16 | |
Amit Shah | eaeff96 | 2010-05-19 22:15:47 -0600 | [diff] [blame] | 17 | #define VIRTIO_CONSOLE_BAD_ID (~(u32)0) |
| 18 | |
Christian Borntraeger | c298345 | 2008-11-25 13:36:26 +0100 | [diff] [blame] | 19 | struct virtio_console_config { |
| 20 | /* colums of the screens */ |
| 21 | __u16 cols; |
| 22 | /* rows of the screens */ |
| 23 | __u16 rows; |
Amit Shah | b99fa81 | 2010-05-19 22:15:46 -0600 | [diff] [blame] | 24 | /* max. number of ports this device can hold */ |
| 25 | __u32 max_nr_ports; |
Christian Borntraeger | c298345 | 2008-11-25 13:36:26 +0100 | [diff] [blame] | 26 | } __attribute__((packed)); |
| 27 | |
Amit Shah | b99fa81 | 2010-05-19 22:15:46 -0600 | [diff] [blame] | 28 | /* |
| 29 | * A message that's passed between the Host and the Guest for a |
| 30 | * particular port. |
| 31 | */ |
| 32 | struct virtio_console_control { |
| 33 | __u32 id; /* Port number */ |
| 34 | __u16 event; /* The kind of control event (see below) */ |
| 35 | __u16 value; /* Extra information for the key */ |
| 36 | }; |
| 37 | |
| 38 | /* Some events for control messages */ |
Amit Shah | f909f85 | 2010-05-19 22:15:48 -0600 | [diff] [blame] | 39 | #define VIRTIO_CONSOLE_DEVICE_READY 0 |
| 40 | #define VIRTIO_CONSOLE_PORT_ADD 1 |
| 41 | #define VIRTIO_CONSOLE_PORT_REMOVE 2 |
| 42 | #define VIRTIO_CONSOLE_PORT_READY 3 |
| 43 | #define VIRTIO_CONSOLE_CONSOLE_PORT 4 |
| 44 | #define VIRTIO_CONSOLE_RESIZE 5 |
| 45 | #define VIRTIO_CONSOLE_PORT_OPEN 6 |
| 46 | #define VIRTIO_CONSOLE_PORT_NAME 7 |
Amit Shah | b99fa81 | 2010-05-19 22:15:46 -0600 | [diff] [blame] | 47 | |
Rusty Russell | 3161043 | 2007-10-22 11:03:39 +1000 | [diff] [blame] | 48 | #ifdef __KERNEL__ |
| 49 | int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); |
| 50 | #endif /* __KERNEL__ */ |
| 51 | |
| 52 | #endif /* _LINUX_VIRTIO_CONSOLE_H */ |