@@ -906,23 +906,17 @@ static void es1370_adc_callback (void *opaque, int avail)
es1370_run_channel (s, ADC_CHANNEL, avail);
}
-static void es1370_map (PCIDevice *pci_dev, int region_num,
- pcibus_t addr, pcibus_t size, int type)
-{
- ES1370State *s = DO_UPCAST (ES1370State, dev, pci_dev);
-
- (void) region_num;
- (void) size;
- (void) type;
-
- register_ioport_write (addr, 0x40 * 4, 1, es1370_writeb, s);
- register_ioport_write (addr, 0x40 * 2, 2, es1370_writew, s);
- register_ioport_write (addr, 0x40, 4, es1370_writel, s);
+static IOPortWriteFunc * const es1370_writes[] = {
+ es1370_writeb,
+ es1370_writew,
+ es1370_writel
+};
- register_ioport_read (addr, 0x40 * 4, 1, es1370_readb, s);
- register_ioport_read (addr, 0x40 * 2, 2, es1370_readw, s);
- register_ioport_read (addr, 0x40, 4, es1370_readl, s);
-}
+static IOPortReadFunc * const es1370_reads[] = {
+ es1370_readb,
+ es1370_readw,
+ es1370_readl
+};
static const VMStateDescription vmstate_es1370_channel = {
.name = "es1370_channel",
@@ -997,6 +991,7 @@ static int es1370_initfn (PCIDevice *dev)
{
ES1370State *s = DO_UPCAST (ES1370State, dev, dev);
uint8_t *c = s->dev.config;
+ int io_index;
pci_config_set_vendor_id (c, PCI_VENDOR_ID_ENSONIQ);
pci_config_set_device_id (c, PCI_DEVICE_ID_ENSONIQ_ES1370);
@@ -1023,7 +1018,10 @@ static int es1370_initfn (PCIDevice *dev)
c[PCI_MIN_GNT] = 0x0c;
c[PCI_MAX_LAT] = 0x80;
- pci_register_bar (&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, es1370_map);
+ pci_register_bar (&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, NULL);
+ io_index = cpu_register_io (es1370_reads, es1370_writes, 256, s);
+ pci_bar_map (&s->dev, 0, 0, 0, 256, io_index);
+
qemu_register_reset (es1370_on_reset, s);
AUD_register_card ("es1370", &s->card);
Use pci_bar_map() instead of a mapping function. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> --- hw/es1370.c | 32 +++++++++++++++----------------- 1 files changed, 15 insertions(+), 17 deletions(-)