From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tu3og-0001AP-It for qemu-devel@nongnu.org; Sat, 12 Jan 2013 11:20:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tu3ob-0005uq-6p for qemu-devel@nongnu.org; Sat, 12 Jan 2013 11:20:18 -0500 Received: from cantor2.suse.de ([195.135.220.15]:48515 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tu3oa-0005qL-Tj for qemu-devel@nongnu.org; Sat, 12 Jan 2013 11:20:13 -0500 Message-ID: <50F18D35.8040006@suse.de> Date: Sat, 12 Jan 2013 17:20:05 +0100 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1357334986-13941-1-git-send-email-hpoussin@reactos.org> <1357334986-13941-7-git-send-email-hpoussin@reactos.org> In-Reply-To: <1357334986-13941-7-git-send-email-hpoussin@reactos.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 06/10] acpi-piix4: do not use old_portio-style callbacks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?SGVydsOpIFBvdXNzaW5lYXU=?= Cc: qemu-devel@nongnu.org Am 04.01.2013 22:29, schrieb Herv=C3=A9 Poussineau: > Signed-off-by: Herv=C3=A9 Poussineau > --- > hw/acpi_piix4.c | 91 ++++++++++++++++++++++++-----------------------= -------- > 1 file changed, 40 insertions(+), 51 deletions(-) >=20 > diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c > index 06a8aca..63b41db 100644 > --- a/hw/acpi_piix4.c > +++ b/hw/acpi_piix4.c > @@ -531,68 +531,57 @@ static const MemoryRegionOps piix4_gpe_ops =3D { > .endianness =3D DEVICE_LITTLE_ENDIAN, > }; > =20 > -static uint32_t pci_up_read(void *opaque, uint32_t addr) > +static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size) > { > PIIX4PMState *s =3D opaque; > - uint32_t val; > - > - /* Manufacture an "up" value to cause a device check on any hotplu= g > - * slot with a device. Extra device checks are harmless. */ > - val =3D s->pci0_slot_device_present & s->pci0_hotplug_enable; > - > - PIIX4_DPRINTF("pci_up_read %x\n", val); > - return val; > -} > - > -static uint32_t pci_down_read(void *opaque, uint32_t addr) > -{ > - PIIX4PMState *s =3D opaque; > - uint32_t val =3D s->pci0_status.down; > + uint32_t val =3D 0; Here you are still using a local uint32_t variable... > + > + switch (addr) { > + case PCI_UP_BASE - PCI_HOTPLUG_ADDR: > + /* Manufacture an "up" value to cause a device check on any ho= tplug > + * slot with a device. Extra device checks are harmless. */ > + val =3D s->pci0_slot_device_present & s->pci0_hotplug_enable; > + PIIX4_DPRINTF("pci_up_read %x\n", val); > + break; > + case PCI_DOWN_BASE - PCI_HOTPLUG_ADDR: > + val =3D s->pci0_status.down; > + PIIX4_DPRINTF("pci_down_read %x\n", val); > + break; > + case PCI_EJ_BASE - PCI_HOTPLUG_ADDR: > + /* No feature defined yet */ > + PIIX4_DPRINTF("pci_features_read %x\n", val); > + break; > + case PCI_RMV_BASE - PCI_HOTPLUG_ADDR: > + val =3D s->pci0_hotplug_enable; > + break; > + default: > + break; > + } > =20 > - PIIX4_DPRINTF("pci_down_read %x\n", val); > return val; > } > =20 > -static uint32_t pci_features_read(void *opaque, uint32_t addr) > -{ > - /* No feature defined yet */ > - PIIX4_DPRINTF("pci_features_read %x\n", 0); > - return 0; > -} > - > -static void pciej_write(void *opaque, uint32_t addr, uint32_t val) > -{ > - acpi_piix_eject_slot(opaque, val); > - > - PIIX4_DPRINTF("pciej write %x <=3D=3D %d\n", addr, val); > -} > - > -static uint32_t pcirmv_read(void *opaque, uint32_t addr) > +static void pci_write(void *opaque, hwaddr addr, uint64_t data, > + unsigned int size) > { > - PIIX4PMState *s =3D opaque; > - > - return s->pci0_hotplug_enable; > + switch (addr) { > + case PCI_EJ_BASE - PCI_HOTPLUG_ADDR: > + acpi_piix_eject_slot(opaque, (uint32_t)data); > + PIIX4_DPRINTF("pciej write %x <=3D=3D % " PRIu64 "\n", addr, d= ata); ...but here you are printing hwaddr using %x. Fixing it up as follows: diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c index 61aea8c..ee81c05 100644 --- a/hw/acpi_piix4.c +++ b/hw/acpi_piix4.c @@ -567,7 +567,8 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t data, switch (addr) { case PCI_EJ_BASE - PCI_HOTPLUG_ADDR: acpi_piix_eject_slot(opaque, (uint32_t)data); - PIIX4_DPRINTF("pciej write %x <=3D=3D % " PRIu64 "\n", addr, dat= a); + PIIX4_DPRINTF("pciej write %" HWADDR_PRIx " <=3D=3D % " PRIu64 "= \n", + addr, data); break; default: break; Thanks, applied to memory-ioport queue: https://github.com/afaerber/qemu-cpu/commits/memory-ioport Andreas > + break; > + default: > + break; > + } > } > =20 > static const MemoryRegionOps piix4_pci_ops =3D { > - .old_portio =3D (MemoryRegionPortio[]) { > - { > - .offset =3D PCI_UP_BASE - PCI_HOTPLUG_ADDR, .len =3D 4, = .size =3D 4, > - .read =3D pci_up_read, > - },{ > - .offset =3D PCI_DOWN_BASE - PCI_HOTPLUG_ADDR, .len =3D 4, = .size =3D 4, > - .read =3D pci_down_read, > - },{ > - .offset =3D PCI_EJ_BASE - PCI_HOTPLUG_ADDR, .len =3D 4, = .size =3D 4, > - .read =3D pci_features_read, > - .write =3D pciej_write, > - },{ > - .offset =3D PCI_RMV_BASE - PCI_HOTPLUG_ADDR, .len =3D 4, = .size =3D 4, > - .read =3D pcirmv_read, > - }, > - PORTIO_END_OF_LIST() > + .read =3D pci_read, > + .write =3D pci_write, > + .endianness =3D DEVICE_NATIVE_ENDIAN, > + .valid =3D { > + .min_access_size =3D 4, > + .max_access_size =3D 4, > }, > - .endianness =3D DEVICE_LITTLE_ENDIAN, > }; > =20 > static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg