All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Julien Grall <julien.grall@citrix.com>
Cc: Stefano.Stabellini@eu.citrix.com, qemu-devel@nongnu.org, avi@redhat.com
Subject: Re: [Qemu-devel] [PATCH V5 8/8] smb: replace_register_ioport*
Date: Fri, 24 Aug 2012 18:19:40 +0200	[thread overview]
Message-ID: <5037A99C.2000806@siemens.com> (raw)
In-Reply-To: <4af4c2525a01f506a6d70819cf4d4ce675dac00b.1345549695.git.julien.grall@citrix.com>

On 2012-08-22 14:27, Julien Grall wrote:
> This patch fix smb_ioport_* to be compliant with read/write memory callback.
> Moreover it replaces all register_ioport* which use theses functions by
> the new Memory API.
> 
> Signed-off-by: Julien Grall <julien.grall@citrix.com>
> ---
>  hw/pm_smbus.c |    7 ++++---
>  hw/pm_smbus.h |    6 ++++--
>  hw/vt82c686.c |   18 ++++++++++++++++--
>  3 files changed, 24 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/pm_smbus.c b/hw/pm_smbus.c
> index 5d6046d..fe59ca6 100644
> --- a/hw/pm_smbus.c
> +++ b/hw/pm_smbus.c
> @@ -94,7 +94,8 @@ static void smb_transaction(PMSMBus *s)
>      s->smb_stat |= 0x04;
>  }
>  
> -void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
> +void smb_ioport_writeb(void *opaque, target_phys_addr_t addr, uint64_t val,
> +                       unsigned size)
>  {
>      PMSMBus *s = opaque;
>      addr &= 0x3f;
> @@ -131,10 +132,10 @@ void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
>      }
>  }
>  
> -uint32_t smb_ioport_readb(void *opaque, uint32_t addr)
> +uint64_t smb_ioport_readb(void *opaque, target_phys_addr_t addr, unsigned size)
>  {
>      PMSMBus *s = opaque;
> -    uint32_t val;
> +    uint64_t val;
>  
>      addr &= 0x3f;
>      switch(addr) {
> diff --git a/hw/pm_smbus.h b/hw/pm_smbus.h
> index 4750a40..45b4330 100644
> --- a/hw/pm_smbus.h
> +++ b/hw/pm_smbus.h
> @@ -15,7 +15,9 @@ typedef struct PMSMBus {
>  } PMSMBus;
>  
>  void pm_smbus_init(DeviceState *parent, PMSMBus *smb);
> -void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val);
> -uint32_t smb_ioport_readb(void *opaque, uint32_t addr);
> +void smb_ioport_writeb(void *opaque, target_phys_addr_t addr, uint64_t val,
> +                       unsigned size);
> +uint64_t smb_ioport_readb(void *opaque, target_phys_addr_t addr,
> +                          unsigned size);
>  
>  #endif /* !PM_SMBUS_H */
> diff --git a/hw/vt82c686.c b/hw/vt82c686.c
> index 7f11dbe..6b35155 100644
> --- a/hw/vt82c686.c
> +++ b/hw/vt82c686.c
> @@ -163,6 +163,7 @@ typedef struct VT686PMState {
>      APMState apm;
>      PMSMBus smb;
>      uint32_t smb_io_base;
> +    MemoryRegion smb_io;
>  } VT686PMState;
>  
>  typedef struct VT686AC97State {
> @@ -405,6 +406,16 @@ static TypeInfo via_mc97_info = {
>      .class_init    = via_mc97_class_init,
>  };
>  
> +static const MemoryRegionOps smb_io_ops = {
> +    .read = smb_ioport_readb,
> +    .write = smb_ioport_writeb,
> +    .endianess = DEVICE_NATIVE_ENDIAN,
        ^^^^^^^^^
Typo. Please ensure that you build-test everything (full QEMU build).

> +    .impl = {
> +        .min_access_size = 1,
> +        .max_access_size = 1,
> +    },
> +};
> +
>  /* vt82c686 pm init */
>  static int vt82c686b_pm_initfn(PCIDevice *dev)
>  {
> @@ -424,8 +435,11 @@ static int vt82c686b_pm_initfn(PCIDevice *dev)
>      pci_conf[0x90] = s->smb_io_base | 1;
>      pci_conf[0x91] = s->smb_io_base >> 8;
>      pci_conf[0xd2] = 0x90;
> -    register_ioport_write(s->smb_io_base, 0xf, 1, smb_ioport_writeb, &s->smb);
> -    register_ioport_read(s->smb_io_base, 0xf, 1, smb_ioport_readb, &s->smb);
> +
> +    memory_region_init_io(&s->smb_io, &smb_io_ops, &s->smb, "vt82c686b-smb",
> +                          0xf);
> +    memory_region_add_subregion(pci_address_space_io(dev), s->smb_io_base,
> +                                &s->smb_io);
>  
>      apm_init(dev, &s->apm, NULL, s);
>  
> 

This file is only half-converted. Working on the other bits...

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2012-08-24 16:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-22 12:27 [Qemu-devel] [PATCH V5 0/8] memory: unifiy ioport registration Julien Grall
2012-08-22 12:27 ` [Qemu-devel] [PATCH V5 1/8] isa: add isa_address_space_io Julien Grall
2012-08-24 16:10   ` Andreas Färber
2012-08-28 15:42     ` Julien Grall
2012-08-28 17:08       ` Jan Kiszka
2012-08-22 12:27 ` [Qemu-devel] [PATCH V5 2/8] hw/acpi_piix4.c: replace register_ioport* Julien Grall
2012-08-23 18:01   ` Jan Kiszka
2012-08-26  9:10   ` Jan Kiszka
2012-08-26  9:36     ` Jan Kiszka
2012-08-22 12:27 ` [Qemu-devel] [PATCH V5 3/8] hw/cirrus_vga.c: " Julien Grall
2012-08-24 13:44   ` Jan Kiszka
2012-08-24 14:49     ` Julien Grall
2012-08-24 15:01       ` Jan Kiszka
2012-08-26  9:19   ` Jan Kiszka
2012-08-22 12:27 ` [Qemu-devel] [PATCH V5 4/8] hw/serial.c: " Julien Grall
2012-08-22 12:27 ` [Qemu-devel] [PATCH V5 5/8] hw/pc.c: " Julien Grall
2012-08-22 12:27 ` [Qemu-devel] [PATCH V5 6/8] hw/dma.c: " Julien Grall
2012-08-22 12:27 ` [Qemu-devel] [PATCH V5 7/8] hw/apm.c: " Julien Grall
2012-08-22 12:27 ` [Qemu-devel] [PATCH V5 8/8] smb: replace_register_ioport* Julien Grall
2012-08-24 16:19   ` Jan Kiszka [this message]
2012-08-23 18:06 ` [Qemu-devel] [PATCH V5 0/8] memory: unifiy ioport registration Jan Kiszka

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=5037A99C.2000806@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=avi@redhat.com \
    --cc=julien.grall@citrix.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.