]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Cleanup IO space and PCI magic numbers
authorAsias He <asias.hejun@gmail.com>
Fri, 8 Apr 2011 14:12:48 +0000 (22:12 +0800)
committerPekka Enberg <penberg@kernel.org>
Fri, 8 Apr 2011 11:53:24 +0000 (14:53 +0300)
This patch define macros for virtio device IO space size and PCI device
numbering.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/blk-virtio.c
tools/kvm/include/kvm/ioport.h

index 48211b5cbeffc4d53fd62c35ca0df2327ba336a0..9a723cc491fae63a16c660b5c8c65c4ba85a66df 100644 (file)
@@ -278,6 +278,8 @@ static struct pci_device_header blk_virtio_pci_device = {
        .irq_line               = VIRTIO_BLK_IRQ,
 };
 
+#define PCI_VIRTIO_BLK_DEVNUM 1
+
 void blk_virtio__init(struct kvm *self)
 {
        if (!self->disk_image)
@@ -285,7 +287,7 @@ void blk_virtio__init(struct kvm *self)
 
        device.blk_config.capacity = self->disk_image->size / SECTOR_SIZE;
 
-       pci__register(&blk_virtio_pci_device, 1);
+       pci__register(&blk_virtio_pci_device, PCI_VIRTIO_BLK_DEVNUM);
 
-       ioport__register(IOPORT_VIRTIO_BLK, &blk_virtio_io_ops, 256);
+       ioport__register(IOPORT_VIRTIO_BLK, &blk_virtio_io_ops, IOPORT_VIRTIO_BLK_SIZE);
 }
index 7b6af539c6845ca00156739764581956cfdd5136..b77f565a98c1c6b7230f3f1ec4a98ba5807b83f7 100644 (file)
@@ -5,8 +5,11 @@
 #include <stdint.h>
 
 /* some ports we reserve for own use */
-#define IOPORT_DBG             0xe0
-#define IOPORT_VIRTIO_BLK      0xc200  /* Virtio block device */
+#define IOPORT_DBG                     0xe0
+#define IOPORT_VIRTIO_BLK              0xc200  /* Virtio block device */
+#define IOPORT_VIRTIO_BLK_SIZE         256
+#define IOPORT_VIRTIO_CONSOLE          0xd200  /* Virtio console device */
+#define IOPORT_VIRTIO_CONSOLE_SIZE     256
 
 struct kvm;