diff options
author | Amit Shah <amit.shah@redhat.com> | 2010-01-18 08:45:08 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-02-23 22:52:45 -0500 |
commit | cb06e3676b22013e9b759627e41656ddb07dee6d (patch) | |
tree | 009a15cbc5d0efd3cf222b262c9084d0e7fffe9c /drivers/char | |
parent | 1c85bf35449196e74deb487961d2f90c98f7b7ff (diff) |
virtio: console: ensure console size is updated on hvc open
When multiple console support is added, ensure each port's size gets
updated when a new one is opened via hvc.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/virtio_console.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 8631d431fe7f..debc86542858 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -251,27 +251,28 @@ static int get_chars(u32 vtermno, char *buf, int count) | |||
251 | return count; | 251 | return count; |
252 | } | 252 | } |
253 | 253 | ||
254 | /* | 254 | static void resize_console(struct port *port) |
255 | * virtio console configuration. This supports: | ||
256 | * - console resize | ||
257 | */ | ||
258 | static void virtcons_apply_config(struct virtio_device *dev) | ||
259 | { | 255 | { |
256 | struct virtio_device *vdev; | ||
260 | struct winsize ws; | 257 | struct winsize ws; |
261 | 258 | ||
262 | if (virtio_has_feature(dev, VIRTIO_CONSOLE_F_SIZE)) { | 259 | vdev = port->portdev->vdev; |
263 | dev->config->get(dev, | 260 | if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)) { |
264 | offsetof(struct virtio_console_config, cols), | 261 | vdev->config->get(vdev, |
265 | &ws.ws_col, sizeof(u16)); | 262 | offsetof(struct virtio_console_config, cols), |
266 | dev->config->get(dev, | 263 | &ws.ws_col, sizeof(u16)); |
267 | offsetof(struct virtio_console_config, rows), | 264 | vdev->config->get(vdev, |
268 | &ws.ws_row, sizeof(u16)); | 265 | offsetof(struct virtio_console_config, rows), |
269 | /* This is the pre-multiport style: we use control messages | 266 | &ws.ws_row, sizeof(u16)); |
270 | * these days which specify the port. So this means port 0. */ | 267 | hvc_resize(port->hvc, ws); |
271 | hvc_resize(find_port_by_vtermno(0)->hvc, ws); | ||
272 | } | 268 | } |
273 | } | 269 | } |
274 | 270 | ||
271 | static void virtcons_apply_config(struct virtio_device *vdev) | ||
272 | { | ||
273 | resize_console(find_port_by_vtermno(0)); | ||
274 | } | ||
275 | |||
275 | /* We set the configuration at this point, since we now have a tty */ | 276 | /* We set the configuration at this point, since we now have a tty */ |
276 | static int notifier_add_vio(struct hvc_struct *hp, int data) | 277 | static int notifier_add_vio(struct hvc_struct *hp, int data) |
277 | { | 278 | { |
@@ -282,7 +283,7 @@ static int notifier_add_vio(struct hvc_struct *hp, int data) | |||
282 | return -EINVAL; | 283 | return -EINVAL; |
283 | 284 | ||
284 | hp->irq_requested = 1; | 285 | hp->irq_requested = 1; |
285 | virtcons_apply_config(port->portdev->vdev); | 286 | resize_console(port); |
286 | 287 | ||
287 | return 0; | 288 | return 0; |
288 | } | 289 | } |