Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GBmdA-0001cy-Dl for qemu-devel@nongnu.org; Sat, 12 Aug 2006 02:05:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GBmd7-0001aV-Ic for qemu-devel@nongnu.org; Sat, 12 Aug 2006 02:05:54 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GBmd7-0001aP-Bb for qemu-devel@nongnu.org; Sat, 12 Aug 2006 02:05:53 -0400 Received: from [195.130.133.69] (helo=assei2bl6.telenet-ops.be) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GBmiP-0003dv-NM for qemu-devel@nongnu.org; Sat, 12 Aug 2006 02:11:21 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by assei2bl6.telenet-ops.be (Postfix) with SMTP id 93E5AF0076 for ; Sat, 12 Aug 2006 08:05:50 +0200 (CEST) Received: from slug.be.48ers.dk (d54C2B670.access.telenet.be [84.194.182.112]) by assei2bl6.telenet-ops.be (Postfix) with ESMTP id 872DBF0063 for ; Sat, 12 Aug 2006 08:05:49 +0200 (CEST) Received: from jacmet by slug.be.48ers.dk with local (Exim 4.61) (envelope-from ) id 1GBmcl-0004lr-Gn for qemu-devel@nongnu.org; Sat, 12 Aug 2006 08:05:31 +0200 From: Peter Korsgaard Date: Sat, 12 Aug 2006 08:05:29 +0200 Message-ID: <87k65eqyja.fsf@slug.be.48ers.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] [PATCH] hw/pflash_cfi02.c: Fix CFI devsize Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, The devsize member of the CFI structure should contain log2(size), not log2(size) + 1 according to the CFI spec. This little patch fixes that. Index: hw/pflash_cfi02.c =================================================================== RCS file: /sources/qemu/qemu/hw/pflash_cfi02.c,v retrieving revision 1.3 diff -u -5 -p -r1.3 pflash_cfi02.c --- hw/pflash_cfi02.c 6 Aug 2006 21:13:56 -0000 1.3 +++ hw/pflash_cfi02.c 12 Aug 2006 05:58:16 -0000 @@ -602,11 +602,11 @@ pflash_t *pflash_register (target_ulong /* Max timeout for block erase */ pfl->cfi_table[0x25] = 0x0A; /* Max timeout for chip erase */ pfl->cfi_table[0x26] = 0x0D; /* Device size */ - pfl->cfi_table[0x27] = ctz32(total_len) + 1; + pfl->cfi_table[0x27] = ctz32(total_len); /* Flash device interface (8 & 16 bits) */ pfl->cfi_table[0x28] = 0x02; pfl->cfi_table[0x29] = 0x00; /* Max number of bytes in multi-bytes write */ pfl->cfi_table[0x2A] = 0x05; -- Bye, Peter Korsgaard