From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NezAk-0005Nw-Ji for qemu-devel@nongnu.org; Tue, 09 Feb 2010 18:07:10 -0500 Received: from [199.232.76.173] (port=45773 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NezAi-0005Mr-GZ for qemu-devel@nongnu.org; Tue, 09 Feb 2010 18:07:08 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NezAg-0003ra-82 for qemu-devel@nongnu.org; Tue, 09 Feb 2010 18:07:08 -0500 Received: from fe01x03-cgp.akado.ru ([77.232.31.164]:53410 helo=akado.ru) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NezAf-0003rU-Rl for qemu-devel@nongnu.org; Tue, 09 Feb 2010 18:07:06 -0500 Date: Wed, 10 Feb 2010 02:06:55 +0300 (MSK) From: malc Subject: Re: [Qemu-devel] [PATCH 07/15] ac97: convert to new PCI API In-Reply-To: <4B71E72C.8050702@codemonkey.ws> Message-ID: References: <1265752899-26980-1-git-send-email-aliguori@us.ibm.com> <1265752899-26980-8-git-send-email-aliguori@us.ibm.com> <4B71E72C.8050702@codemonkey.ws> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Michael Tsirkin , qemu-devel@nongnu.org, Alex Graf On Tue, 9 Feb 2010, Anthony Liguori wrote: > On 02/09/2010 04:45 PM, malc wrote: > > On Tue, 9 Feb 2010, Anthony Liguori wrote: > > > > > > > - fixed bug with size of registered ioport regions > > > > > > Signed-off-by: Anthony Liguori > > > --- > > > hw/ac97.c | 146 > > > +++++++++++++++++++++++++------------------------------------ > > > 1 files changed, 60 insertions(+), 86 deletions(-) > > > > > > diff --git a/hw/ac97.c b/hw/ac97.c > > > index 4319bc8..9fdf591 100644 > > > --- a/hw/ac97.c > > > +++ b/hw/ac97.c > > > @@ -223,7 +223,7 @@ static void fetch_bd (AC97LinkState *s, > > > AC97BusMasterRegs *r) > > > { > > > uint8_t b[8]; > > > > > > - cpu_physical_memory_read (r->bdbar + r->civ * 8, b, 8); > > > + pci_memory_read (&s->dev, r->bdbar + r->civ * 8, b, 8); > > > r->bd_valid = 1; > > > r->bd.addr = le32_to_cpu (*(uint32_t *)&b[0])& ~3; > > > r->bd.ctl_len = le32_to_cpu (*(uint32_t *)&b[4]); > > > @@ -569,50 +569,35 @@ static void mixer_reset (AC97LinkState *s) > > > > > > /** > > > * Native audio mixer > > > - * I/O Reads > > > */ > > > -static uint32_t nam_readb (void *opaque, uint32_t addr) > > > -{ > > > - AC97LinkState *s = opaque; > > > - dolog ("U nam readb %#x\n", addr); > > > - s->cas = 0; > > > - return ~0U; > > > -} > > > > > > -static uint32_t nam_readw (void *opaque, uint32_t addr) > > > +static uint32_t nam_read (PCIDevice *dev, pcibus_t addr, int size) > > > { > > > - AC97LinkState *s = opaque; > > > - uint32_t val = ~0U; > > > - uint32_t index = addr - s->base[0]; > > > - s->cas = 0; > > > - val = mixer_load (s, index); > > > - return val; > > > -} > > > + AC97LinkState *s = DO_UPCAST (AC97LinkState, dev, dev); > > > + uint32_t value; > > > + > > > + if (size == 2) { > > > + value = mixer_load (s, addr); > > > + } else { > > > + dolog ("U nam read[%d] %#" FMT_PCIBUS "\n", size, addr); > > > + s->cas = 0; > > > + value = ~0U; > > > + } > > > > > > > > Yeah right, and then PCI SIG adds qword accessors and all hell breaks > > loose, this interface sucks.. > > > > We already have this problem with the current interface. Uh, i've meant the registration of one function to rule them all, instead of how it's done currently - separate accessors for b/w/l/whatever. > > The options to address would be to always return/accept a uint64_t or to deal > with a void *. The later interface has non-obvious byte order semantics. > > I avoided the former to avoid complaints about possibly introducing a > performance regression with passing larger data types. I don't believe that > it would be a problem though. > > Regards, > > Anthony Liguori > > > [..snip..] > > > > -- mailto:av1474@comtv.ru