All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Benoît Canet" <benoit.canet@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Benoît Canet" <benoit.canet@gmail.com>, avi@redhat.com
Subject: [Qemu-devel] [PATCH v3 08/11] bonito: convert north bridge pci config to memory API
Date: Tue, 22 Nov 2011 21:34:59 +0100	[thread overview]
Message-ID: <1321994102-28263-9-git-send-email-benoit.canet@gmail.com> (raw)
In-Reply-To: <1321994102-28263-1-git-send-email-benoit.canet@gmail.com>

Signed-off-by: Benoît Canet <benoit.canet@gmail.com>
---
 hw/bonito.c |   38 ++++++++++++++++----------------------
 1 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/hw/bonito.c b/hw/bonito.c
index 9260848..8fa709a 100644
--- a/hw/bonito.c
+++ b/hw/bonito.c
@@ -202,10 +202,7 @@ typedef struct PCIBonitoState
 
     /* Bonito registers */
     MemoryRegion iomem;
-
-    target_phys_addr_t bonito_pciconf_start;
-    target_phys_addr_t bonito_pciconf_length;
-    int bonito_pciconf_handle;
+    MemoryRegion iomem_pciconf;
 
     target_phys_addr_t bonito_spciconf_start;
     target_phys_addr_t bonito_spciconf_length;
@@ -322,7 +319,7 @@ static const MemoryRegionOps bonito_ops = {
 };
 
 static void bonito_pciconf_writel(void *opaque, target_phys_addr_t addr,
-                                  uint32_t val)
+                                  uint64_t val, unsigned size)
 {
     PCIBonitoState *s = opaque;
 
@@ -330,7 +327,8 @@ static void bonito_pciconf_writel(void *opaque, target_phys_addr_t addr,
     s->dev.config_write(&s->dev, addr, val, 4);
 }
 
-static uint32_t bonito_pciconf_readl(void *opaque, target_phys_addr_t addr)
+static uint64_t bonito_pciconf_readl(void *opaque, target_phys_addr_t addr,
+                                     unsigned size)
 {
 
     PCIBonitoState *s = opaque;
@@ -340,16 +338,15 @@ static uint32_t bonito_pciconf_readl(void *opaque, target_phys_addr_t addr)
 }
 
 /* north bridge PCI configure space. 0x1fe0 0000 - 0x1fe0 00ff */
-static CPUWriteMemoryFunc * const bonito_pciconf_write[] = {
-    NULL,
-    NULL,
-    bonito_pciconf_writel,
-};
 
-static CPUReadMemoryFunc * const bonito_pciconf_read[] = {
-    NULL,
-    NULL,
-    bonito_pciconf_readl,
+static const MemoryRegionOps bonito_pciconf_ops = {
+    .read = bonito_pciconf_readl,
+    .write = bonito_pciconf_writel,
+    .endianness = DEVICE_NATIVE_ENDIAN,
+    .valid = {
+        .min_access_size = 4,
+        .max_access_size = 4,
+    },
 };
 
 static uint32_t bonito_ldma_readl(void *opaque, target_phys_addr_t addr)
@@ -700,13 +697,10 @@ static int bonito_initfn(PCIDevice *dev)
     sysbus_mmio_map(sysbus, 0, BONITO_INTERNAL_REG_BASE);
 
     /* set the north bridge pci configure  mapping */
-    s->bonito_pciconf_handle = cpu_register_io_memory(bonito_pciconf_read,
-                                                      bonito_pciconf_write, s,
-                                                      DEVICE_NATIVE_ENDIAN);
-    s->bonito_pciconf_start = BONITO_PCICONFIG_BASE;
-    s->bonito_pciconf_length = BONITO_PCICONFIG_SIZE;
-    cpu_register_physical_memory(s->bonito_pciconf_start, s->bonito_pciconf_length,
-                                 s->bonito_pciconf_handle);
+    memory_region_init_io(&s->iomem_pciconf, &bonito_pciconf_ops, s,
+                          "north-bridge-pci-config", BONITO_PCICONFIG_SIZE);
+    sysbus_init_mmio_region(sysbus, &s->iomem_pciconf);
+    sysbus_mmio_map(sysbus, 1, BONITO_PCICONFIG_BASE);
 
     /* set the south bridge pci configure  mapping */
     s->bonito_spciconf_handle = cpu_register_io_memory(bonito_spciconf_read,
-- 
1.7.7.3

  parent reply	other threads:[~2011-11-22 20:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22 20:34 [Qemu-devel] [PATCH v3 00/11] more memory API conversions Benoît Canet
2011-11-22 20:34 ` [Qemu-devel] [PATCH v3 01/11] mcf5206: convert to memory API Benoît Canet
2011-11-22 20:34 ` [Qemu-devel] [PATCH v3 02/11] mcf_uart: " Benoît Canet
2011-11-22 20:34 ` [Qemu-devel] [PATCH v3 03/11] mcf_fec: " Benoît Canet
2011-11-22 20:34 ` [Qemu-devel] [PATCH v3 04/11] mcf_intc: " Benoît Canet
2011-11-22 20:34 ` [Qemu-devel] [PATCH v3 05/11] lm32_uart: " Benoît Canet
2011-11-22 20:34 ` [Qemu-devel] [PATCH v3 06/11] lm32_sys: " Benoît Canet
2011-11-22 20:34 ` [Qemu-devel] [PATCH v3 07/11] bonito: convert north bridge register mapping " Benoît Canet
2011-11-22 23:03   ` Peter Maydell
2011-11-23 17:55     ` Benoît Canet
2011-11-23 18:25       ` Peter Maydell
2011-11-24  8:40     ` Avi Kivity
2011-11-24  8:47       ` Benoît Canet
2011-11-22 20:34 ` Benoît Canet [this message]
2011-11-22 20:35 ` [Qemu-devel] [PATCH v3 09/11] bonito: convert south bridge pci config " Benoît Canet
2011-11-22 20:35 ` [Qemu-devel] [PATCH v3 10/11] bonito: convert ldma " Benoît Canet
2011-11-22 20:35 ` [Qemu-devel] [PATCH v3 11/11] bonito: convert cop " Benoît Canet

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=1321994102-28263-9-git-send-email-benoit.canet@gmail.com \
    --to=benoit.canet@gmail.com \
    --cc=avi@redhat.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.