qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: "Hervé Poussineau" <hpoussin@reactos.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 06/10] acpi-piix4: do not use old_portio-style callbacks
Date: Sat, 12 Jan 2013 17:20:05 +0100	[thread overview]
Message-ID: <50F18D35.8040006@suse.de> (raw)
In-Reply-To: <1357334986-13941-7-git-send-email-hpoussin@reactos.org>

Am 04.01.2013 22:29, schrieb Hervé Poussineau:
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>  hw/acpi_piix4.c |   91 ++++++++++++++++++++++++-------------------------------
>  1 file changed, 40 insertions(+), 51 deletions(-)
> 
> 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 = {
>      .endianness = DEVICE_LITTLE_ENDIAN,
>  };
>  
> -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 = opaque;
> -    uint32_t val;
> -
> -    /* Manufacture an "up" value to cause a device check on any hotplug
> -     * slot with a device.  Extra device checks are harmless. */
> -    val = 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 = opaque;
> -    uint32_t val = s->pci0_status.down;
> +    uint32_t val = 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 hotplug
> +         * slot with a device.  Extra device checks are harmless. */
> +        val = 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 = 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 = s->pci0_hotplug_enable;
> +        break;
> +    default:
> +        break;
> +    }
>  
> -    PIIX4_DPRINTF("pci_down_read %x\n", val);
>      return val;
>  }
>  
> -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 <== %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 = 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 <== % " PRIu64 "\n", addr, data);

...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 <== % " PRIu64 "\n", addr, data);
+        PIIX4_DPRINTF("pciej write %" HWADDR_PRIx " <== % " 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;
> +    }
>  }
>  
>  static const MemoryRegionOps piix4_pci_ops = {
> -    .old_portio = (MemoryRegionPortio[]) {
> -        {
> -            .offset = PCI_UP_BASE - PCI_HOTPLUG_ADDR,   .len = 4, .size = 4,
> -            .read = pci_up_read,
> -        },{
> -            .offset = PCI_DOWN_BASE - PCI_HOTPLUG_ADDR, .len = 4, .size = 4,
> -            .read = pci_down_read,
> -        },{
> -            .offset = PCI_EJ_BASE - PCI_HOTPLUG_ADDR,   .len = 4, .size = 4,
> -            .read = pci_features_read,
> -            .write = pciej_write,
> -        },{
> -            .offset = PCI_RMV_BASE - PCI_HOTPLUG_ADDR,  .len = 4, .size = 4,
> -            .read = pcirmv_read,
> -        },
> -        PORTIO_END_OF_LIST()
> +    .read = pci_read,
> +    .write = pci_write,
> +    .endianness = DEVICE_NATIVE_ENDIAN,
> +    .valid = {
> +        .min_access_size = 4,
> +        .max_access_size = 4,
>      },
> -    .endianness = DEVICE_LITTLE_ENDIAN,
>  };
>  
>  static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev,

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2013-01-12 16:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-04 21:29 [Qemu-devel] [PATCH 00/10] memory: remove old_portio usage Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 01/10] ppc/newworld: add ISA bus, required by VGA card Hervé Poussineau
2013-01-12 16:03   ` Andreas Färber
2013-01-04 21:29 ` [Qemu-devel] [PATCH 02/10] ppc/oldworld: " Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 03/10] uhci: stop using portio lists Hervé Poussineau
2013-01-10 17:18   ` Andreas Färber
2013-01-11  7:38     ` Gerd Hoffmann
2013-01-04 21:29 ` [Qemu-devel] [PATCH 04/10] sun4u: create VGA card after ISA bus Hervé Poussineau
2013-01-10 17:24   ` Andreas Färber
2013-01-10 19:30     ` Hervé Poussineau
2013-01-12 11:42       ` Blue Swirl
2013-01-12 15:58         ` Andreas Färber
2013-01-04 21:29 ` [Qemu-devel] [PATCH 05/10] xen_platform: do not use old_portio-style callbacks Hervé Poussineau
2013-01-12 16:06   ` Andreas Färber
2013-01-15 17:09     ` Andreas Färber
2013-01-15 17:43       ` Stefano Stabellini
2013-01-04 21:29 ` [Qemu-devel] [PATCH 06/10] acpi-piix4: " Hervé Poussineau
2013-01-12 16:20   ` Andreas Färber [this message]
2013-01-12 18:02   ` Andreas Färber
2013-01-12 19:20     ` Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 07/10] vga/qxl: do not use portio_list_init/portio_list_add Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 08/10] isa: use memory regions instead of portio_list_* functions Hervé Poussineau
2013-01-12 19:21   ` Andreas Färber
2013-01-04 21:29 ` [Qemu-devel] [PATCH 09/10] ioport: remove now useless " Hervé Poussineau
2013-01-04 21:29 ` [Qemu-devel] [PATCH 10/10] memory: remove old_portio-style callbacks support Hervé Poussineau
2013-01-10 17:45   ` Andreas Färber
2013-01-10 19:33     ` Hervé Poussineau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50F18D35.8040006@suse.de \
    --to=afaerber@suse.de \
    --cc=hpoussin@reactos.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).