*/
static void virtcons_apply_config(struct virtio_device *dev)
{
+ struct port *port = dev->priv;
struct winsize ws;
if (virtio_has_feature(dev, VIRTIO_CONSOLE_F_SIZE)) {
dev->config->get(dev,
offsetof(struct virtio_console_config, rows),
&ws.ws_row, sizeof(u16));
- hvc_resize(console.hvc, ws);
+ hvc_resize(port->hvc, ws);
}
}
static void hvc_handle_input(struct virtqueue *vq)
{
- if (hvc_poll(console.hvc))
+ struct port *port = vq->vdev->priv;
+
+ if (hvc_poll(port->hvc))
hvc_kick();
}
"Multiple virtio-console devices not supported yet\n");
return -EEXIST;
}
+
+ /* Attach this port to this virtio_device, and vice-versa. */
port->vdev = vdev;
+ vdev->priv = port;
/* This is the scratch page we use to receive console input */
port->inbuf = alloc_buf(PAGE_SIZE);