]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm: Add port range to ioport__register()
authorPekka Enberg <penberg@kernel.org>
Sun, 15 Aug 2010 12:03:01 +0000 (15:03 +0300)
committerPekka Enberg <penberg@kernel.org>
Sun, 15 Aug 2010 12:03:01 +0000 (15:03 +0300)
This patch adds a 'count' argument to ioport__register() to allow callers to
register a range of ioports.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/blk-virtio.c
tools/kvm/early_printk.c
tools/kvm/include/kvm/ioport.h
tools/kvm/ioport.c
tools/kvm/pci.c

index 65b1dd7bfc4d0307c87574714bb754ba5005d11c..2eab5cc144e60d33ae02b8094a2e7c6164cbd78a 100644 (file)
@@ -38,5 +38,5 @@ void blk_virtio__init(void)
 {
        pci__register(&virtio_device, 1);
 
-       ioport__register(IOPORT_VIRTIO, &virtio_io_ops);
+       ioport__register(IOPORT_VIRTIO, &virtio_io_ops, 1);
 }
index 118407c86e049e9a76dbfbeeec20986bf2785cc5..cb9fe243767565c9829eb0606e08ab2ea7142aeb 100644 (file)
@@ -50,6 +50,6 @@ static struct ioport_operations early_serial_lsr_ops = {
 
 void early_printk__init(void)
 {
-       ioport__register(early_serial_base + TXR, &early_serial_txr_rxr_ops);
-       ioport__register(early_serial_base + LSR, &early_serial_lsr_ops);
+       ioport__register(early_serial_base + TXR, &early_serial_txr_rxr_ops, 1);
+       ioport__register(early_serial_base + LSR, &early_serial_lsr_ops, 1);
 }
index 75678c0974a53c00e872d04253e660ab7038a054..eaedc1e7be820feffcfa211fe972f11eec537a7f 100644 (file)
@@ -15,6 +15,6 @@ struct ioport_operations {
        bool (*io_out)(struct kvm *self, uint16_t port, void *data, int size, uint32_t count);
 };
 
-void ioport__register(uint16_t port, struct ioport_operations *ops);
+void ioport__register(uint16_t port, struct ioport_operations *ops, int count);
 
 #endif /* KVM__IOPORT_H */
index 874894f47ef5481d23dd66082ce3b7ba385f0a04..4579e89135f60aa7929b6f69f7c33ba106860047 100644 (file)
@@ -137,9 +137,12 @@ static struct ioport_operations *ioport_ops[USHRT_MAX] = {
        [0x0CFE]        = &dummy_read_write_ioport_ops,
 };
 
-void ioport__register(uint16_t port, struct ioport_operations *ops)
+void ioport__register(uint16_t port, struct ioport_operations *ops, int count)
 {
-       ioport_ops[port]        = ops;
+       int i;
+
+       for (i = 0; i < count; i++)
+               ioport_ops[port + i]    = ops;
 }
 
 static const char *to_direction(int direction)
index 34a903340e62d200cafa30a29a06243727f3bda9..0b96990c42a71cacc4f01de8852302fc1e115fe9 100644 (file)
@@ -111,13 +111,6 @@ void pci__register(struct pci_device_header *dev, uint8_t dev_num)
 
 void pci__init(void)
 {
-       ioport__register(PCI_CONFIG_DATA + 0, &pci_config_data_ops);
-       ioport__register(PCI_CONFIG_DATA + 1, &pci_config_data_ops);
-       ioport__register(PCI_CONFIG_DATA + 2, &pci_config_data_ops);
-       ioport__register(PCI_CONFIG_DATA + 3, &pci_config_data_ops);
-
-       ioport__register(PCI_CONFIG_ADDRESS + 0, &pci_config_address_ops);
-       ioport__register(PCI_CONFIG_ADDRESS + 1, &pci_config_address_ops);
-       ioport__register(PCI_CONFIG_ADDRESS + 2, &pci_config_address_ops);
-       ioport__register(PCI_CONFIG_ADDRESS + 3, &pci_config_address_ops);
+       ioport__register(PCI_CONFIG_DATA + 0, &pci_config_data_ops, 4);
+       ioport__register(PCI_CONFIG_ADDRESS + 0, &pci_config_address_ops, 4);
 }