Received: from eggs.gnu.org ([2001:4830:134:3::10]:52427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWzpR-00015M-Id for qemu-devel@nongnu.org; Thu, 17 Oct 2013 22:30:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWzpL-0003ns-Bx for qemu-devel@nongnu.org; Thu, 17 Oct 2013 22:30:17 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:59083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWzpL-0003nZ-5Q for qemu-devel@nongnu.org; Thu, 17 Oct 2013 22:30:11 -0400 Received: by mail-pd0-f181.google.com with SMTP id y13so3809339pdi.12 for ; Thu, 17 Oct 2013 19:30:09 -0700 (PDT) From: Roy Franz Date: Thu, 17 Oct 2013 19:30:02 -0700 Message-Id: <1382063402-30359-1-git-send-email-roy.franz@linaro.org> Subject: [Qemu-devel] [PATCH] block: mask NOR flash buffered write length List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, kwolf@redhat.com, stefanha@redhat.com Cc: Roy Franz , patches@linaro.org For buffered writes, mask the length with the maximum supported length. This is required for block writes to work on the ARM vexpress platform, where the flash interface is 32 bits wide. For buffered writes to the 2 16 bit flashes on the interface, the length is repeated in each 16 bit word, and without this mask the two lengths are interpreted as a single 32 bit value that is very large. Signed-off-by: Roy Franz --- hw/block/pflash_cfi01.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 018a967..a364cca 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -378,6 +378,7 @@ static void pflash_write(pflash_t *pfl, hwaddr offset, break; case 0xe8: + value &= pfl->writeblock_size - 1; DPRINTF("%s: block write of %x bytes\n", __func__, value); pfl->counter = value; pfl->wcycle++; -- 1.7.10.4