From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JmHVv-0002BG-1Z for qemu-devel@nongnu.org; Wed, 16 Apr 2008 19:58:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JmHVt-00028r-2b for qemu-devel@nongnu.org; Wed, 16 Apr 2008 19:58:05 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JmHVs-00028o-VW for qemu-devel@nongnu.org; Wed, 16 Apr 2008 19:58:05 -0400 Received: from savannah.gnu.org ([199.232.41.3] helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JmHVs-0008UA-BB for qemu-devel@nongnu.org; Wed, 16 Apr 2008 19:58:04 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1JmHVr-0008PG-CX for qemu-devel@nongnu.org; Wed, 16 Apr 2008 23:58:03 +0000 Received: from balrog by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1JmHVr-0008PB-49 for qemu-devel@nongnu.org; Wed, 16 Apr 2008 23:58:03 +0000 MIME-Version: 1.0 Errors-To: balrog Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Andrzej Zaborowski Message-Id: Date: Wed, 16 Apr 2008 23:58:03 +0000 Subject: [Qemu-devel] [4220] Optimize consecutive CFI02 writes by remapping memory lazily ( Jan Kiszka). 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 Revision: 4220 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4220 Author: balrog Date: 2008-04-16 23:58:02 +0000 (Wed, 16 Apr 2008) Log Message: ----------- Optimize consecutive CFI02 writes by remapping memory lazily (Jan Kiszka). Modified Paths: -------------- trunk/hw/pflash_cfi02.c Modified: trunk/hw/pflash_cfi02.c =================================================================== --- trunk/hw/pflash_cfi02.c 2008-04-16 23:45:36 UTC (rev 4219) +++ trunk/hw/pflash_cfi02.c 2008-04-16 23:58:02 UTC (rev 4220) @@ -70,6 +70,7 @@ QEMUTimer *timer; ram_addr_t off; int fl_mem; + int rom_mode; void *storage; }; @@ -80,6 +81,7 @@ if (rom_mode) phys_offset |= pfl->off | IO_MEM_ROMD; + pfl->rom_mode = rom_mode; for (i = 0; i < pfl->mappings; i++) cpu_register_physical_memory(pfl->base + i * pfl->chip_len, @@ -110,7 +112,13 @@ DPRINTF("%s: offset " TARGET_FMT_lx "\n", __func__, offset); ret = -1; - offset -= pfl->base; + if (pfl->rom_mode) { + offset -= (uint32_t)(long)pfl->storage; + /* Lazy reset of to ROMD mode */ + if (pfl->wcycle == 0) + pflash_register_memory(pfl, 1); + } else + offset -= pfl->base; offset &= pfl->chip_len - 1; boff = offset & 0xFF; if (pfl->width == 2) @@ -224,8 +232,6 @@ uint8_t *p; uint8_t cmd; - /* WARNING: when the memory area is in ROMD mode, the offset is a - ram offset, not a physical address */ cmd = value; if (pfl->cmd != 0xA0 && cmd == 0xF0) { #if 0 @@ -236,7 +242,9 @@ } DPRINTF("%s: offset " TARGET_FMT_lx " %08x %d %d\n", __func__, offset, value, width, pfl->wcycle); - if (pfl->wcycle == 0) + /* WARNING: when the memory area is in ROMD mode, the offset is a + ram offset, not a physical address */ + if (pfl->rom_mode) offset -= (uint32_t)(long)pfl->storage; else offset -= pfl->base; @@ -251,8 +259,9 @@ boff = boff >> 2; switch (pfl->wcycle) { case 0: - /* Set the device in I/O access mode */ - pflash_register_memory(pfl, 0); + /* Set the device in I/O access mode if required */ + if (pfl->rom_mode) + pflash_register_memory(pfl, 0); /* We're in read mode */ check_unlock0: if (boff == 0x55 && cmd == 0x98) { @@ -439,7 +448,6 @@ /* Reset flash */ reset_flash: - pflash_register_memory(pfl, 1); pfl->bypass = 0; pfl->wcycle = 0; pfl->cmd = 0;