diff options
Diffstat (limited to 'drivers/char')
| -rw-r--r-- | drivers/char/Kconfig | 4 | ||||
| -rw-r--r-- | drivers/char/Makefile | 2 | ||||
| -rw-r--r-- | drivers/char/hvc_lguest.c | 177 | ||||
| -rw-r--r-- | drivers/char/virtio_console.c | 225 |
4 files changed, 230 insertions, 178 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 65491103e0fb..bf18d757b876 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
| @@ -613,6 +613,10 @@ config HVC_XEN | |||
| 613 | help | 613 | help |
| 614 | Xen virtual console device driver | 614 | Xen virtual console device driver |
| 615 | 615 | ||
| 616 | config VIRTIO_CONSOLE | ||
| 617 | bool | ||
| 618 | select HVC_DRIVER | ||
| 619 | |||
| 616 | config HVCS | 620 | config HVCS |
| 617 | tristate "IBM Hypervisor Virtual Console Server support" | 621 | tristate "IBM Hypervisor Virtual Console Server support" |
| 618 | depends on PPC_PSERIES | 622 | depends on PPC_PSERIES |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index c78ff26647ee..07304d50e0cb 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
| @@ -42,7 +42,6 @@ obj-$(CONFIG_SYNCLINK_GT) += synclink_gt.o | |||
| 42 | obj-$(CONFIG_N_HDLC) += n_hdlc.o | 42 | obj-$(CONFIG_N_HDLC) += n_hdlc.o |
| 43 | obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o | 43 | obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o |
| 44 | obj-$(CONFIG_SX) += sx.o generic_serial.o | 44 | obj-$(CONFIG_SX) += sx.o generic_serial.o |
| 45 | obj-$(CONFIG_LGUEST_GUEST) += hvc_lguest.o | ||
| 46 | obj-$(CONFIG_RIO) += rio/ generic_serial.o | 45 | obj-$(CONFIG_RIO) += rio/ generic_serial.o |
| 47 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o | 46 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o |
| 48 | obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o | 47 | obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o |
| @@ -50,6 +49,7 @@ obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o | |||
| 50 | obj-$(CONFIG_HVC_BEAT) += hvc_beat.o | 49 | obj-$(CONFIG_HVC_BEAT) += hvc_beat.o |
| 51 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o | 50 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o |
| 52 | obj-$(CONFIG_HVC_XEN) += hvc_xen.o | 51 | obj-$(CONFIG_HVC_XEN) += hvc_xen.o |
| 52 | obj-$(CONFIG_VIRTIO_CONSOLE) += virtio_console.o | ||
| 53 | obj-$(CONFIG_RAW_DRIVER) += raw.o | 53 | obj-$(CONFIG_RAW_DRIVER) += raw.o |
| 54 | obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o | 54 | obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o |
| 55 | obj-$(CONFIG_MSPEC) += mspec.o | 55 | obj-$(CONFIG_MSPEC) += mspec.o |
diff --git a/drivers/char/hvc_lguest.c b/drivers/char/hvc_lguest.c deleted file mode 100644 index efccb2155830..000000000000 --- a/drivers/char/hvc_lguest.c +++ /dev/null | |||
| @@ -1,177 +0,0 @@ | |||
| 1 | /*D:300 | ||
| 2 | * The Guest console driver | ||
| 3 | * | ||
| 4 | * This is a trivial console driver: we use lguest's DMA mechanism to send | ||
| 5 | * bytes out, and register a DMA buffer to receive bytes in. It is assumed to | ||
| 6 | * be present and available from the very beginning of boot. | ||
| 7 | * | ||
| 8 | * Writing console drivers is one of the few remaining Dark Arts in Linux. | ||
| 9 | * Fortunately for us, the path of virtual consoles has been well-trodden by | ||
| 10 | * the PowerPC folks, who wrote "hvc_console.c" to generically support any | ||
| 11 | * virtual console. We use that infrastructure which only requires us to write | ||
| 12 | * the basic put_chars and get_chars functions and call the right register | ||
| 13 | * functions. | ||
| 14 | :*/ | ||
| 15 | |||
| 16 | /*M:002 The console can be flooded: while the Guest is processing input the | ||
| 17 | * Host can send more. Buffering in the Host could alleviate this, but it is a | ||
| 18 | * difficult problem in general. :*/ | ||
| 19 | /* Copyright (C) 2006 Rusty Russell, IBM Corporation | ||
| 20 | * | ||
| 21 | * This program is free software; you can redistribute it and/or modify | ||
| 22 | * it under the terms of the GNU General Public License as published by | ||
| 23 | * the Free Software Foundation; either version 2 of the License, or | ||
| 24 | * (at your option) any later version. | ||
| 25 | * | ||
| 26 | * This program is distributed in the hope that it will be useful, | ||
| 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 29 | * GNU General Public License for more details. | ||
| 30 | * | ||
| 31 | * You should have received a copy of the GNU General Public License | ||
| 32 | * along with this program; if not, write to the Free Software | ||
| 33 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 34 | */ | ||
| 35 | #include <linux/err.h> | ||
| 36 | #include <linux/init.h> | ||
| 37 | #include <linux/lguest_bus.h> | ||
| 38 | #include <asm/paravirt.h> | ||
| 39 | #include "hvc_console.h" | ||
| 40 | |||
| 41 | /*D:340 This is our single console input buffer, with associated "struct | ||
| 42 | * lguest_dma" referring to it. Note the 0-terminated length array, and the | ||
| 43 | * use of physical address for the buffer itself. */ | ||
| 44 | static char inbuf[256]; | ||
| 45 | static struct lguest_dma cons_input = { .used_len = 0, | ||
| 46 | .addr[0] = __pa(inbuf), | ||
| 47 | .len[0] = sizeof(inbuf), | ||
| 48 | .len[1] = 0 }; | ||
| 49 | |||
| 50 | /*D:310 The put_chars() callback is pretty straightforward. | ||
| 51 | * | ||
| 52 | * First we put the pointer and length in a "struct lguest_dma": we only have | ||
| 53 | * one pointer, so we set the second length to 0. Then we use SEND_DMA to send | ||
| 54 | * the data to (Host) buffers attached to the console key. Usually a device's | ||
| 55 | * key is a physical address within the device's memory, but because the | ||
| 56 | * console device doesn't have any associated physical memory, we use the | ||
| 57 | * LGUEST_CONSOLE_DMA_KEY constant (aka 0). */ | ||
| 58 | static int put_chars(u32 vtermno, const char *buf, int count) | ||
| 59 | { | ||
| 60 | struct lguest_dma dma; | ||
| 61 | |||
| 62 | /* FIXME: DMA buffers in a "struct lguest_dma" are not allowed | ||
| 63 | * to go over page boundaries. This never seems to happen, | ||
| 64 | * but if it did we'd need to fix this code. */ | ||
| 65 | dma.len[0] = count; | ||
| 66 | dma.len[1] = 0; | ||
| 67 | dma.addr[0] = __pa(buf); | ||
| 68 | |||
| 69 | lguest_send_dma(LGUEST_CONSOLE_DMA_KEY, &dma); | ||
| 70 | /* We're expected to return the amount of data we wrote: all of it. */ | ||
| 71 | return count; | ||
| 72 | } | ||
| 73 | |||
| 74 | /*D:350 get_chars() is the callback from the hvc_console infrastructure when | ||
| 75 | * an interrupt is received. | ||
| 76 | * | ||
| 77 | * Firstly we see if our buffer has been filled: if not, we return. The rest | ||
| 78 | * of the code deals with the fact that the hvc_console() infrastructure only | ||
| 79 | * asks us for 16 bytes at a time. We keep a "cons_offset" variable for | ||
| 80 | * partially-read buffers. */ | ||
| 81 | static int get_chars(u32 vtermno, char *buf, int count) | ||
| 82 | { | ||
| 83 | static int cons_offset; | ||
| 84 | |||
| 85 | /* Nothing left to see here... */ | ||
| 86 | if (!cons_input.used_len) | ||
| 87 | return 0; | ||
| 88 | |||
| 89 | /* You want more than we have to give? Well, try wanting less! */ | ||
| 90 | if (cons_input.used_len - cons_offset < count) | ||
| 91 | count = cons_input.used_len - cons_offset; | ||
| 92 | |||
| 93 | /* Copy across to their buffer and increment offset. */ | ||
| 94 | memcpy(buf, inbuf + cons_offset, count); | ||
| 95 | cons_offset += count; | ||
| 96 | |||
| 97 | /* Finished? Zero offset, and reset cons_input so Host will use it | ||
| 98 | * again. */ | ||
| 99 | if (cons_offset == cons_input.used_len) { | ||
| 100 | cons_offset = 0; | ||
| 101 | cons_input.used_len = 0; | ||
| 102 | } | ||
| 103 | return count; | ||
| 104 | } | ||
| 105 | /*:*/ | ||
| 106 | |||
| 107 | static struct hv_ops lguest_cons = { | ||
| 108 | .get_chars = get_chars, | ||
| 109 | .put_chars = put_chars, | ||
| 110 | }; | ||
| 111 | |||
| 112 | /*D:320 Console drivers are initialized very early so boot messages can go | ||
| 113 | * out. At this stage, the console is output-only. Our driver checks we're a | ||
| 114 | * Guest, and if so hands hvc_instantiate() the console number (0), priority | ||
| 115 | * (0), and the struct hv_ops containing the put_chars() function. */ | ||
| 116 | static int __init cons_init(void) | ||
| 117 | { | ||
| 118 | if (strcmp(pv_info.name, "lguest") != 0) | ||
| 119 | return 0; | ||
| 120 | |||
| 121 | return hvc_instantiate(0, 0, &lguest_cons); | ||
| 122 | } | ||
| 123 | console_initcall(cons_init); | ||
| 124 | |||
| 125 | /*D:370 To set up and manage our virtual console, we call hvc_alloc() and | ||
| 126 | * stash the result in the private pointer of the "struct lguest_device". | ||
| 127 | * Since we never remove the console device we never need this pointer again, | ||
| 128 | * but using ->private is considered good form, and you never know who's going | ||
| 129 | * to copy your driver. | ||
| 130 | * | ||
| 131 | * Once the console is set up, we bind our input buffer ready for input. */ | ||
| 132 | static int lguestcons_probe(struct lguest_device *lgdev) | ||
| 133 | { | ||
| 134 | int err; | ||
| 135 | |||
| 136 | /* The first argument of hvc_alloc() is the virtual console number, so | ||
| 137 | * we use zero. The second argument is the interrupt number. | ||
| 138 | * | ||
| 139 | * The third argument is a "struct hv_ops" containing the put_chars() | ||
| 140 | * and get_chars() pointers. The final argument is the output buffer | ||
| 141 | * size: we use 256 and expect the Host to have room for us to send | ||
| 142 | * that much. */ | ||
| 143 | lgdev->private = hvc_alloc(0, lgdev_irq(lgdev), &lguest_cons, 256); | ||
| 144 | if (IS_ERR(lgdev->private)) | ||
| 145 | return PTR_ERR(lgdev->private); | ||
| 146 | |||
| 147 | /* We bind a single DMA buffer at key LGUEST_CONSOLE_DMA_KEY. | ||
| 148 | * "cons_input" is that statically-initialized global DMA buffer we saw | ||
| 149 | * above, and we also give the interrupt we want. */ | ||
| 150 | err = lguest_bind_dma(LGUEST_CONSOLE_DMA_KEY, &cons_input, 1, | ||
| 151 | lgdev_irq(lgdev)); | ||
| 152 | if (err) | ||
| 153 | printk("lguest console: failed to bind buffer.\n"); | ||
| 154 | return err; | ||
| 155 | } | ||
| 156 | /* Note the use of lgdev_irq() for the interrupt number. We tell hvc_alloc() | ||
| 157 | * to expect input when this interrupt is triggered, and then tell | ||
| 158 | * lguest_bind_dma() that is the interrupt to send us when input comes in. */ | ||
| 159 | |||
| 160 | /*D:360 From now on the console driver follows standard Guest driver form: | ||
| 161 | * register_lguest_driver() registers the device type and probe function, and | ||
| 162 | * the probe function sets up the device. | ||
| 163 | * | ||
| 164 | * The standard "struct lguest_driver": */ | ||
| 165 | static struct lguest_driver lguestcons_drv = { | ||
| 166 | .name = "lguestcons", | ||
| 167 | .owner = THIS_MODULE, | ||
| 168 | .device_type = LGUEST_DEVICE_T_CONSOLE, | ||
| 169 | .probe = lguestcons_probe, | ||
| 170 | }; | ||
| 171 | |||
| 172 | /* The standard init function */ | ||
| 173 | static int __init hvc_lguest_init(void) | ||
| 174 | { | ||
| 175 | return register_lguest_driver(&lguestcons_drv); | ||
| 176 | } | ||
| 177 | module_init(hvc_lguest_init); | ||
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c new file mode 100644 index 000000000000..100e8a201e3a --- /dev/null +++ b/drivers/char/virtio_console.c | |||
| @@ -0,0 +1,225 @@ | |||
| 1 | /*D:300 | ||
| 2 | * The Guest console driver | ||
| 3 | * | ||
| 4 | * Writing console drivers is one of the few remaining Dark Arts in Linux. | ||
| 5 | * Fortunately for us, the path of virtual consoles has been well-trodden by | ||
| 6 | * the PowerPC folks, who wrote "hvc_console.c" to generically support any | ||
| 7 | * virtual console. We use that infrastructure which only requires us to write | ||
| 8 | * the basic put_chars and get_chars functions and call the right register | ||
| 9 | * functions. | ||
| 10 | :*/ | ||
| 11 | |||
| 12 | /*M:002 The console can be flooded: while the Guest is processing input the | ||
| 13 | * Host can send more. Buffering in the Host could alleviate this, but it is a | ||
| 14 | * difficult problem in general. :*/ | ||
| 15 | /* Copyright (C) 2006, 2007 Rusty Russell, IBM Corporation | ||
| 16 | * | ||
| 17 | * This program is free software; you can redistribute it and/or modify | ||
| 18 | * it under the terms of the GNU General Public License as published by | ||
| 19 | * the Free Software Foundation; either version 2 of the License, or | ||
| 20 | * (at your option) any later version. | ||
| 21 | * | ||
| 22 | * This program is distributed in the hope that it will be useful, | ||
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 25 | * GNU General Public License for more details. | ||
| 26 | * | ||
| 27 | * You should have received a copy of the GNU General Public License | ||
| 28 | * along with this program; if not, write to the Free Software | ||
| 29 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 30 | */ | ||
| 31 | #include <linux/err.h> | ||
| 32 | #include <linux/init.h> | ||
| 33 | #include <linux/virtio.h> | ||
| 34 | #include <linux/virtio_console.h> | ||
| 35 | #include "hvc_console.h" | ||
| 36 | |||
| 37 | /*D:340 These represent our input and output console queues, and the virtio | ||
| 38 | * operations for them. */ | ||
| 39 | static struct virtqueue *in_vq, *out_vq; | ||
| 40 | static struct virtio_device *vdev; | ||
| 41 | |||
| 42 | /* This is our input buffer, and how much data is left in it. */ | ||
| 43 | static unsigned int in_len; | ||
| 44 | static char *in, *inbuf; | ||
| 45 | |||
| 46 | /* The operations for our console. */ | ||
| 47 | static struct hv_ops virtio_cons; | ||
| 48 | |||
| 49 | /*D:310 The put_chars() callback is pretty straightforward. | ||
| 50 | * | ||
| 51 | * We turn the characters into a scatter-gather list, add it to the output | ||
| 52 | * queue and then kick the Host. Then we sit here waiting for it to finish: | ||
| 53 | * inefficient in theory, but in practice implementations will do it | ||
| 54 | * immediately (lguest's Launcher does). */ | ||
| 55 | static int put_chars(u32 vtermno, const char *buf, int count) | ||
| 56 | { | ||
| 57 | struct scatterlist sg[1]; | ||
| 58 | unsigned int len; | ||
| 59 | |||
| 60 | /* This is a convenient routine to initialize a single-elem sg list */ | ||
| 61 | sg_init_one(sg, buf, count); | ||
| 62 | |||
| 63 | /* add_buf wants a token to identify this buffer: we hand it any | ||
| 64 | * non-NULL pointer, since there's only ever one buffer. */ | ||
| 65 | if (out_vq->vq_ops->add_buf(out_vq, sg, 1, 0, (void *)1) == 0) { | ||
| 66 | /* Tell Host to go! */ | ||
| 67 | out_vq->vq_ops->kick(out_vq); | ||
| 68 | /* Chill out until it's done with the buffer. */ | ||
| 69 | while (!out_vq->vq_ops->get_buf(out_vq, &len)) | ||
| 70 | cpu_relax(); | ||
| 71 | } | ||
| 72 | |||
| 73 | /* We're expected to return the amount of data we wrote: all of it. */ | ||
| 74 | return count; | ||
| 75 | } | ||
| 76 | |||
| 77 | /* Create a scatter-gather list representing our input buffer and put it in the | ||
| 78 | * queue. */ | ||
| 79 | static void add_inbuf(void) | ||
| 80 | { | ||
| 81 | struct scatterlist sg[1]; | ||
| 82 | sg_init_one(sg, inbuf, PAGE_SIZE); | ||
| 83 | |||
| 84 | /* We should always be able to add one buffer to an empty queue. */ | ||
| 85 | if (in_vq->vq_ops->add_buf(in_vq, sg, 0, 1, inbuf) != 0) | ||
| 86 | BUG(); | ||
| 87 | in_vq->vq_ops->kick(in_vq); | ||
| 88 | } | ||
| 89 | |||
| 90 | /*D:350 get_chars() is the callback from the hvc_console infrastructure when | ||
| 91 | * an interrupt is received. | ||
| 92 | * | ||
| 93 | * Most of the code deals with the fact that the hvc_console() infrastructure | ||
| 94 | * only asks us for 16 bytes at a time. We keep in_offset and in_used fields | ||
| 95 | * for partially-filled buffers. */ | ||
| 96 | static int get_chars(u32 vtermno, char *buf, int count) | ||
| 97 | { | ||
| 98 | /* If we don't have an input queue yet, we can't get input. */ | ||
| 99 | BUG_ON(!in_vq); | ||
| 100 | |||
| 101 | /* No buffer? Try to get one. */ | ||
| 102 | if (!in_len) { | ||
| 103 | in = in_vq->vq_ops->get_buf(in_vq, &in_len); | ||
| 104 | if (!in) | ||
| 105 | return 0; | ||
| 106 | } | ||
| 107 | |||
| 108 | /* You want more than we have to give? Well, try wanting less! */ | ||
| 109 | if (in_len < count) | ||
| 110 | count = in_len; | ||
| 111 | |||
| 112 | /* Copy across to their buffer and increment offset. */ | ||
| 113 | memcpy(buf, in, count); | ||
| 114 | in += count; | ||
| 115 | in_len -= count; | ||
| 116 | |||
| 117 | /* Finished? Re-register buffer so Host will use it again. */ | ||
| 118 | if (in_len == 0) | ||
| 119 | add_inbuf(); | ||
| 120 | |||
| 121 | return count; | ||
| 122 | } | ||
| 123 | /*:*/ | ||
| 124 | |||
| 125 | /*D:320 Console drivers are initialized very early so boot messages can go out, | ||
| 126 | * so we do things slightly differently from the generic virtio initialization | ||
| 127 | * of the net and block drivers. | ||
| 128 | * | ||
| 129 | * At this stage, the console is output-only. It's too early to set up a | ||
| 130 | * virtqueue, so we let the drivers do some boutique early-output thing. */ | ||
| 131 | int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)) | ||
| 132 | { | ||
| 133 | virtio_cons.put_chars = put_chars; | ||
| 134 | return hvc_instantiate(0, 0, &virtio_cons); | ||
| 135 | } | ||
| 136 | |||
| 137 | /*D:370 Once we're further in boot, we get probed like any other virtio device. | ||
| 138 | * At this stage we set up the output virtqueue. | ||
| 139 | * | ||
| 140 | * To set up and manage our virtual console, we call hvc_alloc(). Since we | ||
| 141 | * never remove the console device we never need this pointer again. | ||
| 142 | * | ||
| 143 | * Finally we put our input buffer in the input queue, ready to receive. */ | ||
| 144 | static int virtcons_probe(struct virtio_device *dev) | ||
| 145 | { | ||
| 146 | int err; | ||
| 147 | struct hvc_struct *hvc; | ||
| 148 | |||
| 149 | vdev = dev; | ||
| 150 | |||
| 151 | /* This is the scratch page we use to receive console input */ | ||
| 152 | inbuf = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
| 153 | if (!inbuf) { | ||
| 154 | err = -ENOMEM; | ||
| 155 | goto fail; | ||
| 156 | } | ||
| 157 | |||
| 158 | /* Find the input queue. */ | ||
| 159 | /* FIXME: This is why we want to wean off hvc: we do nothing | ||
| 160 | * when input comes in. */ | ||
| 161 | in_vq = vdev->config->find_vq(vdev, NULL); | ||
| 162 | if (IS_ERR(in_vq)) { | ||
| 163 | err = PTR_ERR(in_vq); | ||
| 164 | goto free; | ||
| 165 | } | ||
| 166 | |||
| 167 | out_vq = vdev->config->find_vq(vdev, NULL); | ||
| 168 | if (IS_ERR(out_vq)) { | ||
| 169 | err = PTR_ERR(out_vq); | ||
| 170 | goto free_in_vq; | ||
| 171 | } | ||
| 172 | |||
| 173 | /* Start using the new console output. */ | ||
| 174 | virtio_cons.get_chars = get_chars; | ||
| 175 | virtio_cons.put_chars = put_chars; | ||
| 176 | |||
| 177 | /* The first argument of hvc_alloc() is the virtual console number, so | ||
| 178 | * we use zero. The second argument is the interrupt number; we | ||
| 179 | * currently leave this as zero: it would be better not to use the | ||
| 180 | * hvc mechanism and fix this (FIXME!). | ||
| 181 | * | ||
| 182 | * The third argument is a "struct hv_ops" containing the put_chars() | ||
| 183 | * and get_chars() pointers. The final argument is the output buffer | ||
| 184 | * size: we can do any size, so we put PAGE_SIZE here. */ | ||
| 185 | hvc = hvc_alloc(0, 0, &virtio_cons, PAGE_SIZE); | ||
| 186 | if (IS_ERR(hvc)) { | ||
| 187 | err = PTR_ERR(hvc); | ||
| 188 | goto free_out_vq; | ||
| 189 | } | ||
| 190 | |||
| 191 | /* Register the input buffer the first time. */ | ||
| 192 | add_inbuf(); | ||
| 193 | return 0; | ||
| 194 | |||
| 195 | free_out_vq: | ||
| 196 | vdev->config->del_vq(out_vq); | ||
| 197 | free_in_vq: | ||
| 198 | vdev->config->del_vq(in_vq); | ||
| 199 | free: | ||
| 200 | kfree(inbuf); | ||
| 201 | fail: | ||
| 202 | return err; | ||
| 203 | } | ||
| 204 | |||
| 205 | static struct virtio_device_id id_table[] = { | ||
| 206 | { VIRTIO_ID_CONSOLE, VIRTIO_DEV_ANY_ID }, | ||
| 207 | { 0 }, | ||
| 208 | }; | ||
| 209 | |||
| 210 | static struct virtio_driver virtio_console = { | ||
| 211 | .driver.name = KBUILD_MODNAME, | ||
| 212 | .driver.owner = THIS_MODULE, | ||
| 213 | .id_table = id_table, | ||
| 214 | .probe = virtcons_probe, | ||
| 215 | }; | ||
| 216 | |||
| 217 | static int __init init(void) | ||
| 218 | { | ||
| 219 | return register_virtio_driver(&virtio_console); | ||
| 220 | } | ||
| 221 | module_init(init); | ||
| 222 | |||
| 223 | MODULE_DEVICE_TABLE(virtio, id_table); | ||
| 224 | MODULE_DESCRIPTION("Virtio console driver"); | ||
| 225 | MODULE_LICENSE("GPL"); | ||
