qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, alex.williamson@redhat.com
Subject: [Qemu-devel] [PATCH 11/24] pam: pass device to init_pam and use it to set owner
Date: Tue, 25 Jun 2013 16:14:52 +0200	[thread overview]
Message-ID: <1372169705-7645-12-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1372169705-7645-1-git-send-email-pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/pci-host/pam.c         | 16 +++++++++-------
 hw/pci-host/piix.c        |  4 ++--
 hw/pci-host/q35.c         |  4 ++--
 include/hw/pci-host/pam.h |  4 ++--
 4 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c
index ec935f440..ec6be46 100644
--- a/hw/pci-host/pam.c
+++ b/hw/pci-host/pam.c
@@ -26,6 +26,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
+#include "qom/object.h"
 #include "sysemu/sysemu.h"
 #include "hw/pci-host/pam.h"
 
@@ -49,24 +51,24 @@ void smram_set_smm(uint8_t *host_smm_enabled, int smm, uint8_t smram,
     }
 }
 
-void init_pam(MemoryRegion *ram_memory, MemoryRegion *system_memory,
-              MemoryRegion *pci_address_space, PAMMemoryRegion *mem,
-              uint32_t start, uint32_t size)
+void init_pam(DeviceState *dev, MemoryRegion *ram_memory,
+              MemoryRegion *system_memory, MemoryRegion *pci_address_space,
+              PAMMemoryRegion *mem, uint32_t start, uint32_t size)
 {
     int i;
 
     /* RAM */
-    memory_region_init_alias(&mem->alias[3], NULL, "pam-ram", ram_memory,
+    memory_region_init_alias(&mem->alias[3], OBJECT(dev), "pam-ram", ram_memory,
                              start, size);
     /* ROM (XXX: not quite correct) */
-    memory_region_init_alias(&mem->alias[1], NULL, "pam-rom", ram_memory,
+    memory_region_init_alias(&mem->alias[1], OBJECT(dev), "pam-rom", ram_memory,
                              start, size);
     memory_region_set_readonly(&mem->alias[1], true);
 
     /* XXX: should distinguish read/write cases */
-    memory_region_init_alias(&mem->alias[0], NULL, "pam-pci", pci_address_space,
+    memory_region_init_alias(&mem->alias[0], OBJECT(dev), "pam-pci", pci_address_space,
                              start, size);
-    memory_region_init_alias(&mem->alias[2], NULL, "pam-pci", pci_address_space,
+    memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", pci_address_space,
                              start, size);
 
     for (i = 0; i < 4; ++i) {
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 4d77b1e..e179912 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -275,10 +275,10 @@ static PCIBus *i440fx_common_init(const char *device_name,
     memory_region_add_subregion_overlap(f->system_memory, 0xa0000,
                                         &f->smram_region, 1);
     memory_region_set_enabled(&f->smram_region, false);
-    init_pam(f->ram_memory, f->system_memory, f->pci_address_space,
+    init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
              &f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
     for (i = 0; i < 12; ++i) {
-        init_pam(f->ram_memory, f->system_memory, f->pci_address_space,
+        init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
                  &f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
                  PAM_EXPAN_SIZE);
     }
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 70e7d8b..49ccf80 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -269,10 +269,10 @@ static int mch_init(PCIDevice *d)
     memory_region_add_subregion_overlap(mch->system_memory, 0xa0000,
                                         &mch->smram_region, 1);
     memory_region_set_enabled(&mch->smram_region, false);
-    init_pam(mch->ram_memory, mch->system_memory, mch->pci_address_space,
+    init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, mch->pci_address_space,
              &mch->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
     for (i = 0; i < 12; ++i) {
-        init_pam(mch->ram_memory, mch->system_memory, mch->pci_address_space,
+        init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, mch->pci_address_space,
                  &mch->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
                  PAM_EXPAN_SIZE);
     }
diff --git a/include/hw/pci-host/pam.h b/include/hw/pci-host/pam.h
index 8e9e349..a8b87b8 100644
--- a/include/hw/pci-host/pam.h
+++ b/include/hw/pci-host/pam.h
@@ -90,8 +90,8 @@ void smram_update(MemoryRegion *smram_region, uint8_t smram,
                   uint8_t smm_enabled);
 void smram_set_smm(uint8_t *host_smm_enabled, int smm, uint8_t smram,
                    MemoryRegion *smram_region);
-void init_pam(MemoryRegion *ram, MemoryRegion *system, MemoryRegion *pci,
-              PAMMemoryRegion *mem, uint32_t start, uint32_t size);
+void init_pam(DeviceState *dev, MemoryRegion *ram, MemoryRegion *system,
+              MemoryRegion *pci, PAMMemoryRegion *mem, uint32_t start, uint32_t size);
 void pam_update(PAMMemoryRegion *mem, int idx, uint8_t val);
 
 #endif /* QEMU_PAM_H */
-- 
1.8.1.4

  parent reply	other threads:[~2013-06-25 14:15 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25 14:14 [Qemu-devel] [PATCH 00/24] Memory patches, part 4: region ownership (devices part) Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 01/24] escc: rename struct to ESCCState Paolo Bonzini
2013-06-25 15:10   ` Andreas Färber
2013-06-25 14:14 ` [Qemu-devel] [PATCH 02/24] vga: pass owner to vga_init Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 03/24] vga: pass owner to vga_common_init Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 04/24] vga: pass owner to cirrus_init_common Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 05/24] vga: pass owner to vga_init_vbe Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 06/24] vga: pass owner to vga_init_io Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 07/24] vga: set owner in vga_update_memory_access Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 08/24] ne2000: pass device to ne2000_setup_io, use it as owner Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 09/24] vfio: pass device to vfio_mmap_bar and use it to set owner Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 10/24] spapr_iommu: pass device to spapr_tce_new_table " Paolo Bonzini
2013-06-25 14:14 ` Paolo Bonzini [this message]
2013-06-25 14:14 ` [Qemu-devel] [PATCH 12/24] piolist: add owner argument to initialization functions and pass devices Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 13/24] hw/a*: pass owner to memory_region_init_io Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 14/24] hw/block: " Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 15/24] hw/c*: " Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 16/24] hw/d*: " Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 17/24] hw/gpio: " Paolo Bonzini
2013-06-25 14:14 ` [Qemu-devel] [PATCH 18/24] hw/i*: " Paolo Bonzini
2013-07-01 23:27   ` Andreas Färber
2013-06-25 14:15 ` [Qemu-devel] [PATCH 19/24] hw/m*: " Paolo Bonzini
2013-06-25 14:15 ` [Qemu-devel] [PATCH 20/24] hw/n*: " Paolo Bonzini
2013-06-25 14:15 ` [Qemu-devel] [PATCH 21/24] hw/p*: " Paolo Bonzini
2013-07-01 23:31   ` Andreas Färber
2013-07-02  6:43     ` Paolo Bonzini
2013-06-25 14:15 ` [Qemu-devel] [PATCH 22/24] hw/s*: " Paolo Bonzini
2013-06-25 14:15 ` [Qemu-devel] [PATCH 23/24] hw/t*: " Paolo Bonzini
2013-06-25 14:15 ` [Qemu-devel] [PATCH 24/24] hw/[u-x]*: " Paolo Bonzini
2013-07-01 23:42   ` Andreas Färber
2013-07-02  5:49     ` Paolo Bonzini

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=1372169705-7645-12-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=peter.maydell@linaro.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).