Received: from eggs.gnu.org ([208.118.235.92]:39245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5drG-000771-Qj for qemu-devel@nongnu.org; Thu, 08 Mar 2012 08:58:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5drA-0004sw-EE for qemu-devel@nongnu.org; Thu, 08 Mar 2012 08:58:18 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:48506) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5drA-0004so-5o for qemu-devel@nongnu.org; Thu, 08 Mar 2012 08:58:12 -0500 From: Peter Maydell Date: Thu, 8 Mar 2012 13:58:08 +0000 Message-Id: <1331215088-28816-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH] hw/pxa2xx.c: Fix handling of pxa2xx_i2c variable offset within region List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Avi Kivity , patches@linaro.org The pxa2xx I2C controller can be at an arbitrary offset within its region (this is used because one of the controllers starts at offset 0x1600 into an 0x10000 sized region). The previous implementation of this included an adjustment which worked around the fact that memory region read/write functions were passed an offset from the start of a page rather than from the start of the region. Since commit 5312bd8b3 offsets are now from the start of the region and so we were applying an incorrect adjustment, resulting in warnings like "pxa2xx_i2c_read: Bad register 0xffffff90". Retain the offset handling but remove the adjustment to the page boundary. Signed-off-by: Peter Maydell --- hw/pxa2xx.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c index 1ab2701..d1efef4 100644 --- a/hw/pxa2xx.c +++ b/hw/pxa2xx.c @@ -1507,8 +1507,7 @@ PXA2xxI2CState *pxa2xx_i2c_init(target_phys_addr_t base, i2c_dev = sysbus_from_qdev(qdev_create(NULL, "pxa2xx_i2c")); qdev_prop_set_uint32(&i2c_dev->qdev, "size", region_size + 1); - qdev_prop_set_uint32(&i2c_dev->qdev, "offset", - base - (base & (~region_size) & TARGET_PAGE_MASK)); + qdev_prop_set_uint32(&i2c_dev->qdev, "offset", base & region_size); qdev_init_nofail(&i2c_dev->qdev); -- 1.7.1