|
From: | Avi Kivity |
Subject: | Re: [Qemu-devel] [PATCH 05/11] cs4231a: Convert to MemoryRegion. |
Date: | Thu, 11 Aug 2011 09:22:49 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0 |
On 08/11/2011 01:28 AM, Richard Henderson wrote:
} }; +static const MemoryRegionOps cs_ioport_ops = { + .read = cs_read, + .write = cs_write, + .impl = { + .min_access_size = 1, + .max_access_size = 1, + } +};
Should be .valid, not .impl..impl means the implementation only supports this access size; emulate other sizes by using a supported size (e.g. crack a 4-byte access into 4 1-byte accesses). .valid means what the device actually supports; if the guest uses another size something bus-defined happens.
+ static int cs4231a_initfn (ISADevice *dev) { CSState *s = DO_UPCAST (CSState, dev, dev); - int i; isa_init_irq (dev,&s->pic, s->irq); - for (i = 0; i< 4; i++) { - isa_init_ioport(dev, i); - register_ioport_write (s->port + i, 1, 1, cs_write, s); - register_ioport_read (s->port + i, 1, 1, cs_read, s); - } + memory_region_init_io(&s->ioports,&cs_ioport_ops, s, "cs4231a", 4); + isa_register_ioport(dev,&s->ioports, s->port); DMA_register_channel (s->dma, cs_dma_read, s);
-- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.
[Prev in Thread] | Current Thread | [Next in Thread] |