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.