qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrzej Zaborowski <balrogg@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5899] Don't wrap I2C registers addresses on PXA270.
Date: Sun, 07 Dec 2008 01:49:29 +0000	[thread overview]
Message-ID: <E1L98m1-0006GZ-4h@cvs.savannah.gnu.org> (raw)

Revision: 5899
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5899
Author:   balrog
Date:     2008-12-07 01:49:28 +0000 (Sun, 07 Dec 2008)

Log Message:
-----------
Don't wrap I2C registers addresses on PXA270.

This way the registers will only be visible at the given offset instead of
every 0x100 bytes.

Modified Paths:
--------------
    trunk/hw/pxa2xx.c

Modified: trunk/hw/pxa2xx.c
===================================================================
--- trunk/hw/pxa2xx.c	2008-12-07 00:14:21 UTC (rev 5898)
+++ trunk/hw/pxa2xx.c	2008-12-07 01:49:28 UTC (rev 5899)
@@ -1260,6 +1260,7 @@
     i2c_slave slave;
     i2c_bus *bus;
     qemu_irq irq;
+    target_phys_addr_t offset;
 
     uint16_t control;
     uint16_t status;
@@ -1340,7 +1341,7 @@
 {
     struct pxa2xx_i2c_s *s = (struct pxa2xx_i2c_s *) opaque;
 
-    addr &= 0xff;
+    addr -= s->offset;
     switch (addr) {
     case ICR:
         return s->control;
@@ -1369,7 +1370,7 @@
     struct pxa2xx_i2c_s *s = (struct pxa2xx_i2c_s *) opaque;
     int ack;
 
-    addr &= 0xff;
+    addr -= s->offset;
     switch (addr) {
     case ICR:
         s->control = value & 0xfff7;
@@ -1474,7 +1475,7 @@
 }
 
 struct pxa2xx_i2c_s *pxa2xx_i2c_init(target_phys_addr_t base,
-                qemu_irq irq, uint32_t page_size)
+                qemu_irq irq, uint32_t region_size)
 {
     int iomemtype;
     /* FIXME: Should the slave device really be on a separate bus?  */
@@ -1486,10 +1487,12 @@
     s->slave.recv = pxa2xx_i2c_rx;
     s->slave.send = pxa2xx_i2c_tx;
     s->bus = i2c_init_bus();
+    s->offset = base & region_size;
 
     iomemtype = cpu_register_io_memory(0, pxa2xx_i2c_readfn,
                     pxa2xx_i2c_writefn, s);
-    cpu_register_physical_memory(base & ~page_size, page_size + 1, iomemtype);
+    cpu_register_physical_memory(base & ~region_size,
+                    region_size + 1, iomemtype);
 
     register_savevm("pxa2xx_i2c", base, 1,
                     pxa2xx_i2c_save, pxa2xx_i2c_load, s);

                 reply	other threads:[~2008-12-07  1:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1L98m1-0006GZ-4h@cvs.savannah.gnu.org \
    --to=balrogg@gmail.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 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).