Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 123984
b: refs/heads/master
c: c298345
h: refs/heads/master
v: v3
  • Loading branch information
Christian Borntraeger authored and Rusty Russell committed Dec 29, 2008
1 parent 96e4dbe commit f205aec
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 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: 29f9f12ec737af62835124e4a8bdb9de631f04dd
refs/heads/master: c29834584ea4eafccf2f62a0b8a32e64f792044c
1 change: 1 addition & 0 deletions trunk/drivers/char/hvc_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ void hvc_resize(struct hvc_struct *hp, struct winsize ws)
hp->ws = ws;
schedule_work(&hp->tty_resize);
}
EXPORT_SYMBOL_GPL(hvc_resize);

/*
* This kthread is either polling or interrupt driven. This is determined by
Expand Down
30 changes: 29 additions & 1 deletion trunk/drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,34 @@ int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int))
return hvc_instantiate(0, 0, &virtio_cons);
}

/*
* virtio console configuration. This supports:
* - console resize
*/
static void virtcons_apply_config(struct virtio_device *dev)
{
struct winsize ws;

if (virtio_has_feature(dev, VIRTIO_CONSOLE_F_SIZE)) {
dev->config->get(dev,
offsetof(struct virtio_console_config, cols),
&ws.ws_col, sizeof(u16));
dev->config->get(dev,
offsetof(struct virtio_console_config, rows),
&ws.ws_row, sizeof(u16));
hvc_resize(hvc, ws);
}
}

/*
* we support only one console, the hvc struct is a global var
* There is no need to do anything
* We set the configuration at this point, since we now have a tty
*/
static int notifier_add_vio(struct hvc_struct *hp, int data)
{
hp->irq_requested = 1;
virtcons_apply_config(vdev);

return 0;
}

Expand Down Expand Up @@ -234,11 +255,18 @@ static struct virtio_device_id id_table[] = {
{ 0 },
};

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

static struct virtio_driver virtio_console = {
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtcons_probe,
.config_changed = virtcons_apply_config,
};

static int __init init(void)
Expand Down
11 changes: 11 additions & 0 deletions trunk/include/linux/virtio_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
/* The ID for virtio console */
#define VIRTIO_ID_CONSOLE 3

/* Feature bits */
#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */

struct virtio_console_config {
/* colums of the screens */
__u16 cols;
/* rows of the screens */
__u16 rows;
} __attribute__((packed));


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

0 comments on commit f205aec

Please sign in to comment.