Message ID | 4E1AD4B4.2080305@redhat.com |
---|---|
State | New |
Headers | show |
On Mon, 11 Jul 2011, Avi Kivity wrote: > On 07/11/2011 04:42 AM, Anthony Liguori wrote: > > On 07/10/2011 03:33 PM, malc wrote: > > > On Sun, 10 Jul 2011, Avi Kivity wrote: > > > > > > > fixes BAR sizing as well. > > > > > > I find this patch disgusting, the read and write handlers in particular. > > > > Shouldn't it be possible to do something like: > > > > typedef struct OldMemoryRegionOps { > > MemoryRegionOps parent_ops; > > CPUReadMemoryFunc *readfn[3]; > > CPUWriteMemoryFunc *writefn[3]; > > void *opaque; > > } OldMemoryRegionOps; > > > > That should allow old-style implementations to be converted without > > introducing trampoline functions everywhere. > > Here's a new version: This one looks acceptable[1], original submission said: "fixes BAR sizing as well." what was wrong with it? [..snip..] P.S. Sans minor inconsistency with trailing commas.
On 07/12/2011 01:03 AM, malc wrote: > > > > Here's a new version: > > This one looks acceptable[1], original submission said: > "fixes BAR sizing as well." what was wrong with it? The nabm BAR, for example, was registered as 64 bytes of byte ioports, 128 bytes of word ioports, and 256 bytes of long ioports. I expect this was an error. The new patch preserves the error. > [..snip..] > > P.S. Sans minor inconsistency with trailing commas. > Where I expect more fields, I leave a trailing comma. It makes further patches nicer.
diff --git a/hw/ac97.c b/hw/ac97.c index 0b59896..b4f377d 100644 --- a/hw/ac97.c +++ b/hw/ac97.c @@ -160,8 +160,9 @@ typedef struct AC97LinkState { SWVoiceIn *voice_mc; int invalid_freq[3]; uint8_t silence[128]; - uint32_t base[2]; int bup_flag; + MemoryRegion io_nam; + MemoryRegion io_nabm; } AC97LinkState; enum { @@ -583,7 +584,7 @@ static uint32_t nam_readw (void *opaque, uint32_t addr) { AC97LinkState *s = opaque; uint32_t val = ~0U; - uint32_t index = addr - s->base[0]; + uint32_t index = addr; s->cas = 0; val = mixer_load (s, index); return val; @@ -611,7 +612,7 @@ static void nam_writeb (void *opaque, uint32_t addr, uint32_t val) static void nam_writew (void *opaque, uint32_t addr, uint32_t val) { AC97LinkState *s = opaque; - uint32_t index = addr - s->base[0]; + uint32_t index = addr; s->cas = 0; switch (index) {