Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197861
b: refs/heads/master
c: b99fa81
h: refs/heads/master
i:
  197859: d5af60e
v: v3
  • Loading branch information
Amit Shah authored and Rusty Russell committed May 19, 2010
1 parent a531956 commit b051086
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bbd603efb4238cf78083c00f0a81adfa8994aa33
refs/heads/master: b99fa815d71023b2e330d63cd7f47d6247ffa321
49 changes: 8 additions & 41 deletions trunk/drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,6 @@
#include <linux/workqueue.h>
#include "hvc_console.h"

/* Moved here from .h file in order to disable MULTIPORT. */
#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */

struct virtio_console_multiport_conf {
struct virtio_console_config config;
/* max. number of ports this device can hold */
__u32 max_nr_ports;
/* number of ports added so far */
__u32 nr_ports;
} __attribute__((packed));

/*
* A message that's passed between the Host and the Guest for a
* particular port.
*/
struct virtio_console_control {
__u32 id; /* Port number */
__u16 event; /* The kind of control event (see below) */
__u16 value; /* Extra information for the key */
};

/* Some events for control messages */
#define VIRTIO_CONSOLE_PORT_READY 0
#define VIRTIO_CONSOLE_CONSOLE_PORT 1
#define VIRTIO_CONSOLE_RESIZE 2
#define VIRTIO_CONSOLE_PORT_OPEN 3
#define VIRTIO_CONSOLE_PORT_NAME 4
#define VIRTIO_CONSOLE_PORT_REMOVE 5

/*
* This is a global struct for storing common data for all the devices
* this driver handles.
Expand Down Expand Up @@ -150,7 +121,7 @@ struct ports_device {
spinlock_t cvq_lock;

/* The current config space is stored here */
struct virtio_console_multiport_conf config;
struct virtio_console_config config;

/* The virtio device we're associated with */
struct virtio_device *vdev;
Expand Down Expand Up @@ -1243,7 +1214,7 @@ static int add_port(struct ports_device *portdev, u32 id)
*/
static void config_work_handler(struct work_struct *work)
{
struct virtio_console_multiport_conf virtconconf;
struct virtio_console_config virtconconf;
struct ports_device *portdev;
struct virtio_device *vdev;
int err;
Expand All @@ -1252,8 +1223,7 @@ static void config_work_handler(struct work_struct *work)

vdev = portdev->vdev;
vdev->config->get(vdev,
offsetof(struct virtio_console_multiport_conf,
nr_ports),
offsetof(struct virtio_console_config, nr_ports),
&virtconconf.nr_ports,
sizeof(virtconconf.nr_ports));

Expand Down Expand Up @@ -1445,19 +1415,16 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)
multiport = false;
portdev->config.nr_ports = 1;
portdev->config.max_nr_ports = 1;
#if 0 /* Multiport is not quite ready yet --RR */
if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT)) {
multiport = true;
vdev->features[0] |= 1 << VIRTIO_CONSOLE_F_MULTIPORT;

vdev->config->get(vdev,
offsetof(struct virtio_console_multiport_conf,
nr_ports),
vdev->config->get(vdev, offsetof(struct virtio_console_config,
nr_ports),
&portdev->config.nr_ports,
sizeof(portdev->config.nr_ports));
vdev->config->get(vdev,
offsetof(struct virtio_console_multiport_conf,
max_nr_ports),
vdev->config->get(vdev, offsetof(struct virtio_console_config,
max_nr_ports),
&portdev->config.max_nr_ports,
sizeof(portdev->config.max_nr_ports));
if (portdev->config.nr_ports > portdev->config.max_nr_ports) {
Expand All @@ -1473,7 +1440,6 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)

/* Let the Host know we support multiple ports.*/
vdev->config->finalize_features(vdev);
#endif

err = init_vqs(portdev);
if (err < 0) {
Expand Down Expand Up @@ -1556,6 +1522,7 @@ static struct virtio_device_id id_table[] = {

static unsigned int features[] = {
VIRTIO_CONSOLE_F_SIZE,
VIRTIO_CONSOLE_F_MULTIPORT,
};

static struct virtio_driver virtio_console = {
Expand Down
23 changes: 23 additions & 0 deletions trunk/include/linux/virtio_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,37 @@

/* Feature bits */
#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */

struct virtio_console_config {
/* colums of the screens */
__u16 cols;
/* rows of the screens */
__u16 rows;
/* max. number of ports this device can hold */
__u32 max_nr_ports;
/* number of ports added so far */
__u32 nr_ports;
} __attribute__((packed));

/*
* A message that's passed between the Host and the Guest for a
* particular port.
*/
struct virtio_console_control {
__u32 id; /* Port number */
__u16 event; /* The kind of control event (see below) */
__u16 value; /* Extra information for the key */
};

/* Some events for control messages */
#define VIRTIO_CONSOLE_PORT_READY 0
#define VIRTIO_CONSOLE_CONSOLE_PORT 1
#define VIRTIO_CONSOLE_RESIZE 2
#define VIRTIO_CONSOLE_PORT_OPEN 3
#define VIRTIO_CONSOLE_PORT_NAME 4
#define VIRTIO_CONSOLE_PORT_REMOVE 5

#ifdef __KERNEL__
int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));
#endif /* __KERNEL__ */
Expand Down

0 comments on commit b051086

Please sign in to comment.