This is an automated email from Gerrit.

Andreas Fritiofson (andreas.fritiof...@gmail.com) just uploaded a new patch set 
to Gerrit, which you can find at http://openocd.zylin.com/868

-- gerrit

commit 9f3c798fbdfe9cdc5a4e40dc4c31603bf079fc53
Author: Andreas Fritiofson <andreas.fritiof...@gmail.com>
Date:   Sun Sep 30 23:12:03 2012 +0200

    mips_m4k: Don't try to reuse working area
    
    The working area pointer is no longer cleared when the working area is
    freed so re-use won't work.
    
    This probably decreases performance quite a bit.
    
    Change-Id: I7da539857ba3a2207ee3b0c15802b4107ec943a7
    Signed-off-by: Andreas Fritiofson <andreas.fritiof...@gmail.com>

diff --git a/src/target/mips32.c b/src/target/mips32.c
index ab39e6e..c1420c3 100644
--- a/src/target/mips32.c
+++ b/src/target/mips32.c
@@ -290,7 +290,6 @@ int mips32_init_arch_info(struct target *target, struct 
mips32_common *mips32, s
 {
        target->arch_info = mips32;
        mips32->common_magic = MIPS32_COMMON_MAGIC;
-       mips32->fast_data_area = NULL;
 
        /* has breakpoint/watchpint unit been scanned */
        mips32->bp_scanned = 0;
diff --git a/src/target/mips32.h b/src/target/mips32.h
index a5bccdc..d3435d3 100644
--- a/src/target/mips32.h
+++ b/src/target/mips32.h
@@ -88,9 +88,6 @@ struct mips32_common {
        uint32_t core_regs[MIPS32NUMCOREREGS];
        enum mips32_isa_mode isa_mode;
 
-       /* working area for fastdata access */
-       struct working_area *fast_data_area;
-
        int bp_scanned;
        int num_inst_bpoints;
        int num_data_bpoints;
diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c
index 1a10d5a..3916a9c 100644
--- a/src/target/mips_m4k.c
+++ b/src/target/mips_m4k.c
@@ -970,6 +970,7 @@ static int mips_m4k_bulk_write_memory(struct target 
*target, uint32_t address,
 {
        struct mips32_common *mips32 = target_to_mips32(target);
        struct mips_ejtag *ejtag_info = &mips32->ejtag_info;
+       struct working_area *fast_data_area;
        int retval;
        int write_t = 1;
 
@@ -984,35 +985,30 @@ static int mips_m4k_bulk_write_memory(struct target 
*target, uint32_t address,
        if (address & 0x3u)
                return ERROR_TARGET_UNALIGNED_ACCESS;
 
-       if (mips32->fast_data_area == NULL) {
-               /* Get memory for block write handler
-                * we preserve this area between calls and gain a speed increase
-                * of about 3kb/sec when writing flash
-                * this will be released/nulled by the system when the target 
is resumed or reset */
-               retval = target_alloc_working_area(target,
-                               MIPS32_FASTDATA_HANDLER_SIZE,
-                               &mips32->fast_data_area);
-               if (retval != ERROR_OK) {
-                       LOG_WARNING("No working area available, falling back to 
non-bulk write");
-                       return mips_m4k_write_memory(target, address, 4, count, 
buffer);
-               }
-
-               /* reset fastadata state so the algo get reloaded */
-               ejtag_info->fast_access_save = -1;
+       /* Get memory for block write handler */
+       retval = target_alloc_working_area(target,
+                       MIPS32_FASTDATA_HANDLER_SIZE,
+                       &fast_data_area);
+       if (retval != ERROR_OK) {
+               LOG_WARNING("No working area available, falling back to 
non-bulk write");
+               return mips_m4k_write_memory(target, address, 4, count, buffer);
        }
 
+       /* reset fastadata state so the algo get reloaded */
+       ejtag_info->fast_access_save = -1;
+
        /* mips32_pracc_fastdata_xfer requires uint32_t in host endianness, */
        /* but byte array represents target endianness                      */
        uint32_t *t = NULL;
        t = malloc(count * sizeof(uint32_t));
        if (t == NULL) {
                LOG_ERROR("Out of memory");
-               return ERROR_FAIL;
+               goto cleanup;
        }
 
        target_buffer_get_u32_array(target, buffer, count, t);
 
-       retval = mips32_pracc_fastdata_xfer(ejtag_info, mips32->fast_data_area, 
write_t, address,
+       retval = mips32_pracc_fastdata_xfer(ejtag_info, fast_data_area, 
write_t, address,
                        count, t);
 
        if (t != NULL)
@@ -1024,6 +1020,9 @@ static int mips_m4k_bulk_write_memory(struct target 
*target, uint32_t address,
                retval = mips_m4k_write_memory(target, address, 4, count, 
buffer);
        }
 
+cleanup:
+       target_free_working_area(target, fast_data_area);
+
        return retval;
 }
 

-- 

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to