summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-12-17 07:27:24 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-12-17 07:27:24 +0000
commit6a67707b5ec3b2c649c401550bb7fdef2b7c8d07 (patch)
treebfe31942a4abbaac09ad0f4226effdcef8bf097e
parent43d7a75369286dc3b39b858df34f66b0b45de34e (diff)
downloadrockbox-6a67707b5ec3b2c649c401550bb7fdef2b7c8d07.tar.gz
rockbox-6a67707b5ec3b2c649c401550bb7fdef2b7c8d07.tar.bz2
rockbox-6a67707b5ec3b2c649c401550bb7fdef2b7c8d07.zip
Commit to certain names for cache coherency APIs and discard the aliases.
Wouldn't surprise me a bit to get some non-green. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31339 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codec_thread.c4
-rw-r--r--apps/codecs.c6
-rw-r--r--apps/codecs.h7
-rw-r--r--apps/codecs/codec_crt0.c4
-rw-r--r--apps/codecs/mpa.c2
-rw-r--r--apps/codecs/spc.c6
-rw-r--r--apps/plugin.c6
-rw-r--r--apps/plugin.h9
-rw-r--r--apps/plugins/fft/fft.c4
-rw-r--r--apps/plugins/mpegplayer/alloc.c2
-rw-r--r--apps/plugins/mpegplayer/video_thread.c8
-rw-r--r--apps/plugins/plugin_crt0.c8
-rw-r--r--bootloader/gigabeat-s.c2
-rw-r--r--bootloader/gigabeat.c4
-rw-r--r--firmware/export/load_code.h2
-rw-r--r--firmware/export/system.h29
-rw-r--r--firmware/load_code.c3
-rw-r--r--firmware/rolo.c8
-rw-r--r--firmware/target/arm/as3525/pcm-as3525.c4
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525.c6
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525v2.c4
-rw-r--r--firmware/target/arm/ata-pp5020.c4
-rw-r--r--firmware/target/arm/imx31/ata-imx31.c4
-rw-r--r--firmware/target/arm/imx31/crt0.S2
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c12
-rw-r--r--firmware/target/arm/imx31/sdma-imx31.c2
-rw-r--r--firmware/target/arm/mmu-arm.S20
-rw-r--r--firmware/target/arm/mmu-arm.h18
-rw-r--r--firmware/target/arm/mmu-armv6.S28
-rw-r--r--firmware/target/arm/pcm-pp.c4
-rw-r--r--firmware/target/arm/rk27xx/system-rk27xx.c7
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c4
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c4
-rw-r--r--firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c4
-rw-r--r--firmware/target/arm/system-pp5002.c15
-rw-r--r--firmware/target/arm/system-pp502x.c8
-rw-r--r--firmware/target/arm/system-target.h13
-rw-r--r--firmware/target/arm/thread-arm.c2
-rw-r--r--firmware/target/arm/thread-pp.c6
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c6
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c2
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c2
-rw-r--r--firmware/target/coldfire/system-coldfire.c4
-rw-r--r--firmware/target/coldfire/system-target.h8
-rw-r--r--firmware/target/hosted/android/system-target.h4
-rw-r--r--firmware/target/hosted/sdl/system-sdl.h4
-rw-r--r--firmware/target/mips/mmu-mips.c6
-rw-r--r--firmware/target/mips/mmu-mips.h4
-rw-r--r--firmware/target/sh/system-target.h4
-rw-r--r--firmware/thread.c2
-rw-r--r--firmware/usbstack/usb_storage.c2
51 files changed, 120 insertions, 213 deletions
diff --git a/apps/codec_thread.c b/apps/codec_thread.c
index 0498858be2..39db741054 100644
--- a/apps/codec_thread.c
+++ b/apps/codec_thread.c
@@ -550,9 +550,9 @@ static void do_callback(void (* callback)(void))
if (callback)
{
- cpucache_commit_discard();
+ commit_discard_idcache();
callback();
- cpucache_commit();
+ commit_dcache();
}
}
diff --git a/apps/codecs.c b/apps/codecs.c
index 93542e35ce..fafe4ac7a3 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -116,8 +116,8 @@ struct codec_api ci = {
semaphore_release,
#endif
- cpucache_flush,
- cpucache_invalidate,
+ commit_dcache,
+ commit_discard_dcache,
/* strings and memory */
strcpy,
@@ -165,6 +165,8 @@ struct codec_api ci = {
/* new stuff at the end, sort into place next time
the API gets incompatible */
+
+ commit_discard_idcache,
};
void codec_get_full_path(char *path, const char *codec_root_fn)
diff --git a/apps/codecs.h b/apps/codecs.h
index f1e2a51eac..1334953b82 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -75,7 +75,7 @@
#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */
/* increase this every time the api struct changes */
-#define CODEC_API_VERSION 43
+#define CODEC_API_VERSION 44
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
@@ -169,8 +169,8 @@ struct codec_api {
void (*semaphore_release)(struct semaphore *s);
#endif /* NUM_CORES */
- void (*cpucache_flush)(void);
- void (*cpucache_invalidate)(void);
+ void (*commit_dcache)(void);
+ void (*commit_discard_dcache)(void);
/* strings and memory */
char* (*strcpy)(char *dst, const char *src);
@@ -223,6 +223,7 @@ struct codec_api {
/* new stuff at the end, sort into place next time
the API gets incompatible */
+ void (*commit_discard_idcache)(void);
};
/* codec header */
diff --git a/apps/codecs/codec_crt0.c b/apps/codecs/codec_crt0.c
index 50a2d8b66a..e3c3321e54 100644
--- a/apps/codecs/codec_crt0.c
+++ b/apps/codecs/codec_crt0.c
@@ -45,7 +45,7 @@ enum codec_status codec_start(enum codec_entry_call_reason reason)
ci->memcpy(iramstart, iramcopy, iram_size);
ci->memset(iedata, 0, ibss_size);
/* make the icache (if it exists) up to date with the new code */
- ci->cpucache_invalidate();
+ ci->commit_discard_idcache();
/* barrier to prevent reordering iram copy and BSS clearing,
* because the BSS segment alias the IRAM copy.
*/
@@ -56,7 +56,7 @@ enum codec_status codec_start(enum codec_entry_call_reason reason)
/* Some parts of bss may be used via a no-cache alias (at least
* portalplayer has this). If we don't clear the cache, those aliases
* may read garbage */
- ci->cpucache_invalidate();
+ ci->commit_dcache();
}
#endif /* CONFIG_PLATFORM */
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index ac81f06cab..f9bf7e600f 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -274,7 +274,7 @@ static void mad_synth_thread_quit(void)
die = 1;
ci->semaphore_release(&synth_pending_sem);
ci->thread_wait(mad_synth_thread_id);
- ci->cpucache_invalidate();
+ ci->commit_discard_dcache();
}
#else
static inline void mad_synth_thread_ready(void)
diff --git a/apps/codecs/spc.c b/apps/codecs/spc.c
index 94ac9ffadc..809562e2a0 100644
--- a/apps/codecs/spc.c
+++ b/apps/codecs/spc.c
@@ -295,7 +295,7 @@ static bool emu_thread_process_msg(struct sample_queue_chunk *chunk)
if (id == SPC_EMU_LOAD)
{
struct spc_load *ld = (struct spc_load *)chunk->data;
- ci->cpucache_invalidate();
+ ci->commit_discard_dcache();
SPC_Init(&spc_emu);
sample_queue.retval = SPC_load_spc(&spc_emu, ld->buf, ld->size);
@@ -368,7 +368,7 @@ static bool spc_emu_start(void)
static inline int load_spc_buffer(uint8_t *buf, size_t size)
{
struct spc_load ld = { buf, size };
- ci->cpucache_flush();
+ ci->commit_dcache();
return emu_thread_send_msg(SPC_EMU_LOAD, (intptr_t)&ld);
}
@@ -378,7 +378,7 @@ static inline void spc_emu_quit(void)
emu_thread_send_msg(SPC_EMU_QUIT, 0);
/* Wait for emu thread to be killed */
ci->thread_wait(emu_thread_id);
- ci->cpucache_invalidate();
+ ci->commit_discard_dcache();
}
}
diff --git a/apps/plugin.c b/apps/plugin.c
index f5aa589072..6dd84af775 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -428,8 +428,8 @@ static const struct plugin_api rockbox_api = {
cancel_cpu_boost,
#endif
- cpucache_flush,
- cpucache_invalidate,
+ commit_dcache,
+ commit_discard_dcache,
lc_open,
lc_open_from_mem,
@@ -794,6 +794,8 @@ static const struct plugin_api rockbox_api = {
/* new stuff at the end, sort into place next time
the API gets incompatible */
+
+ commit_discard_idcache,
};
int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index e2b7fe7e11..4a62697724 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -148,7 +148,7 @@ void* plugin_get_buffer(size_t *buffer_size);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 214
+#define PLUGIN_API_VERSION 215
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
@@ -513,8 +513,8 @@ struct plugin_api {
void (*cancel_cpu_boost)(void);
#endif
- void (*cpucache_flush)(void);
- void (*cpucache_invalidate)(void);
+ void (*commit_dcache)(void);
+ void (*commit_discard_dcache)(void);
/* load code api for overlay */
void* (*lc_open)(const char *filename, unsigned char *buf, size_t buf_size);
@@ -948,7 +948,8 @@ struct plugin_api {
/* new stuff at the end, sort into place next time
the API gets incompatible */
-
+
+ void (*commit_discard_idcache)(void);
};
/* plugin header */
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c
index 11bdfc8e74..89205503e7 100644
--- a/apps/plugins/fft/fft.c
+++ b/apps/plugins/fft/fft.c
@@ -1249,7 +1249,7 @@ static void fft_thread_entry(void)
}
/* write back output for other processor and invalidate for next frame read */
- rb->cpucache_invalidate();
+ rb->commit_discard_dcache();
int new_tail = output_tail ^ 1;
@@ -1311,7 +1311,7 @@ static void fft_close_fft(void)
/* Handle our FFT thread. */
fft_thread_run = false;
rb->thread_wait(fft_thread);
- rb->cpucache_invalidate();
+ rb->commit_discard_dcache();
}
#else /* NUM_CORES == 1 */
/* everything serialize on single-core and FFT gets to use IRAM main stack if
diff --git a/apps/plugins/mpegplayer/alloc.c b/apps/plugins/mpegplayer/alloc.c
index c2165b2ea9..eb58c67f44 100644
--- a/apps/plugins/mpegplayer/alloc.c
+++ b/apps/plugins/mpegplayer/alloc.c
@@ -149,7 +149,7 @@ bool mpeg_alloc_init(unsigned char *buf, size_t mallocsize)
return false;
}
- IF_COP(rb->cpucache_invalidate());
+ IF_COP(rb->commit_discard_dcache());
return true;
}
diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c
index 5119712396..392cc6179f 100644
--- a/apps/plugins/mpegplayer/video_thread.c
+++ b/apps/plugins/mpegplayer/video_thread.c
@@ -550,7 +550,7 @@ static void video_thread_msg(struct video_thread_data *td)
}
else
{
- IF_COP(rb->cpucache_invalidate());
+ IF_COP(rb->commit_discard_dcache());
vo_lock();
rb->lcd_update();
vo_unlock();
@@ -1007,7 +1007,7 @@ bool video_thread_init(void)
{
intptr_t rep;
- IF_COP(rb->cpucache_flush());
+ IF_COP(rb->commit_dcache());
video_str.hdr.q = &video_str_queue;
rb->queue_init(video_str.hdr.q, false);
@@ -1025,7 +1025,7 @@ bool video_thread_init(void)
/* Wait for thread to initialize */
rep = str_send_msg(&video_str, STREAM_NULL, 0);
- IF_COP(rb->cpucache_invalidate());
+ IF_COP(rb->commit_discard_dcache());
return rep == 0; /* Normally STREAM_NULL should be ignored */
}
@@ -1037,7 +1037,7 @@ void video_thread_exit(void)
{
str_post_msg(&video_str, STREAM_QUIT, 0);
rb->thread_wait(video_str.thread);
- IF_COP(rb->cpucache_invalidate());
+ IF_COP(rb->commit_discard_dcache());
video_str.thread = 0;
}
}
diff --git a/apps/plugins/plugin_crt0.c b/apps/plugins/plugin_crt0.c
index 917ccb11a9..680bb0723d 100644
--- a/apps/plugins/plugin_crt0.c
+++ b/apps/plugins/plugin_crt0.c
@@ -76,10 +76,8 @@ enum plugin_status plugin__start(const void *param)
rb->audio_stop();
rb->memcpy(iramstart, iramcopy, iram_size);
rb->memset(iedata, 0, ibss_size);
-#ifdef HAVE_CPUCACHE_INVALIDATE
/* make the icache (if it exists) up to date with the new code */
- rb->cpucache_invalidate();
-#endif /* HAVE_CPUCACHE_INVALIDATE */
+ rb->commit_discard_idcache();
/* barrier to prevent reordering iram copy and BSS clearing,
* because the BSS segment alias the IRAM copy.
@@ -91,12 +89,10 @@ enum plugin_status plugin__start(const void *param)
/* zero out the bss section */
rb->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start);
-#ifdef HAVE_CPUCACHE_INVALIDATE
/* Some parts of bss may be used via a no-cache alias (at least
* portalplayer has this). If we don't clear the cache, those aliases
* may read garbage */
- rb->cpucache_invalidate();
-#endif /* HAVE_CPUCACHE_INVALIDATE */
+ rb->commit_dcache();
#endif
/* we come back here if exit() was called or the plugin returned normally */
diff --git a/bootloader/gigabeat-s.c b/bootloader/gigabeat-s.c
index 223d839010..8483170522 100644
--- a/bootloader/gigabeat-s.c
+++ b/bootloader/gigabeat-s.c
@@ -324,7 +324,7 @@ static void NORETURN_ATTR handle_firmware_load(void)
if (rc == EOK)
{
- cpucache_commit_discard();
+ commit_discard_idcache();
asm volatile ("bx %0": : "r"(start_addr));
}
diff --git a/bootloader/gigabeat.c b/bootloader/gigabeat.c
index cfba4bb38d..fb03f0ea4d 100644
--- a/bootloader/gigabeat.c
+++ b/bootloader/gigabeat.c
@@ -195,7 +195,7 @@ void main(void)
printf("Loading firmware");
/* Flush out anything pending first */
- cpucache_invalidate();
+ commit_discard_idcache();
loadbuffer = (unsigned char*) 0x31000000;
buffer_size = (unsigned char*)0x31400000 - loadbuffer;
@@ -209,7 +209,7 @@ void main(void)
if (rc == EOK)
{
- cpucache_invalidate();
+ commit_discard_idcache();
kernel_entry = (void*) loadbuffer;
rc = kernel_entry();
}
diff --git a/firmware/export/load_code.h b/firmware/export/load_code.h
index 55ce601ee5..6f8505aba7 100644
--- a/firmware/export/load_code.h
+++ b/firmware/export/load_code.h
@@ -35,7 +35,7 @@ static inline void *lc_open_from_mem(void* addr, size_t blob_size)
{
(void)blob_size;
/* commit dcache and discard icache */
- cpucache_invalidate();
+ commit_discard_idcache();
return addr;
}
static inline void *lc_get_header(void *handle) { return handle; }
diff --git a/firmware/export/system.h b/firmware/export/system.h
index aa079940d1..1055c65b60 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -302,35 +302,6 @@ static inline uint32_t swaw32_hw(uint32_t value)
#define DISABLE_INTERRUPTS HIGHEST_IRQ_LEVEL
#endif
-/* Just define these as empty if not declared */
-#ifdef HAVE_CPUCACHE_INVALIDATE
-void cpucache_commit_discard(void);
-/* deprecated alias */
-void cpucache_invalidate(void);
-#else
-static inline void cpucache_commit_discard(void)
-{
-}
-/* deprecated alias */
-static inline void cpucache_invalidate(void)
-{
-}
-#endif
-
-#ifdef HAVE_CPUCACHE_FLUSH
-void cpucache_commit(void);
-/* deprecated alias */
-void cpucache_flush(void);
-#else
-static inline void cpucache_commit(void)
-{
-}
-/* deprecated alias */
-static inline void cpucache_flush(void)
-{
-}
-#endif
-
/* Define this, if the CPU may take advantage of cache aligment. Is enabled
* for all ARM CPUs. */
#ifdef CPU_ARM
diff --git a/firmware/load_code.c b/firmware/load_code.c
index 59eb7ac0f7..a76aca380d 100644
--- a/firmware/load_code.c
+++ b/firmware/load_code.c
@@ -46,7 +46,6 @@ void * lc_open(const char *filename, unsigned char *buf, size_t buf_size)
/* Make sure COP cache is flushed and invalidated before loading */
{
int my_core = switch_core(CURRENT_CORE ^ 1);
- cpucache_commit_discard();
switch_core(my_core);
}
#endif
@@ -89,7 +88,7 @@ void * lc_open(const char *filename, unsigned char *buf, size_t buf_size)
}
/* commit dcache and discard icache */
- cpucache_commit_discard();
+ commit_discard_idcache();
/* return a pointer the header, reused by lc_get_header() */
return hdr.load_addr;
diff --git a/firmware/rolo.c b/firmware/rolo.c
index 283779d7ee..3569746258 100644
--- a/firmware/rolo.c
+++ b/firmware/rolo.c
@@ -75,7 +75,7 @@ void rolo_restart_cop(void)
COP_INT_DIS = -1;
/* Invalidate cache */
- cpucache_invalidate();
+ commit_discard_idcache();
/* Disable cache */
CACHE_CTL = CACHE_CTL_DISABLE;
@@ -148,7 +148,7 @@ void rolo_restart(const unsigned char* source, unsigned char* dest,
CPU_INT_DIS = -1;
/* Flush cache */
- cpucache_flush();
+ commit_discard_idcache();
/* Disable cache */
CACHE_CTL = CACHE_CTL_DISABLE;
@@ -174,10 +174,8 @@ void rolo_restart(const unsigned char* source, unsigned char* dest,
);
#elif defined(CPU_ARM)
-#ifdef HAVE_CPUCACHE_INVALIDATE
/* Flush and invalidate caches */
- cpucache_invalidate();
-#endif
+ commit_discard_idcache();
asm volatile(
"bx %0 \n"
: : "r"(dest)
diff --git a/firmware/target/arm/as3525/pcm-as3525.c b/firmware/target/arm/as3525/pcm-as3525.c
index b33ea2af84..0ecc63d018 100644
--- a/firmware/target/arm/as3525/pcm-as3525.c
+++ b/firmware/target/arm/as3525/pcm-as3525.c
@@ -109,7 +109,7 @@ static void dma_callback(void)
dma_rem_size = dma_start_size;
/* force writeback */
- clean_dcache_range(dma_start_addr, dma_start_size);
+ commit_dcache_range(dma_start_addr, dma_start_size);
play_start_pcm();
pcm_play_dma_started_callback();
}
@@ -131,7 +131,7 @@ void pcm_play_dma_start(const void *addr, size_t size)
dma_retain();
/* force writeback */
- clean_dcache_range(dma_start_addr, dma_start_size);
+ commit_dcache_range(dma_start_addr, dma_start_size);
bitset32(&CGU_AUDIO, (1<<11));
diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c
index 1f52d40ce6..d619a014f1 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525.c
@@ -432,7 +432,7 @@ int usb_drv_recv(int ep, void *ptr, int len)
endpoints[ep][1].rc = -1;
/* remove data buffer from cache */
- invalidate_dcache_range(ptr, len);
+ discard_dcache_range(ptr, len);
/* DMA setup */
uc_desc->status = USB_DMA_DESC_BS_HST_RDY |
@@ -509,7 +509,7 @@ static void ep_send(int ep, void *ptr, int len)
USB_IEP_CTRL(ep) |= USB_EP_CTRL_FLUSH;
/* Make sure data is committed to memory */
- clean_dcache_range(ptr, len);
+ commit_dcache_range(ptr, len);
logf("xx%s\n", make_hex(ptr, len));
@@ -625,7 +625,7 @@ static void handle_out_ep(int ep)
/*
* If parts of the just dmaed range are in cache, dump them now.
*/
- dump_dcache_range(uc_desc->data_ptr, dma_len);
+ discard_dcache_range(uc_desc->data_ptr, dma_len);
} else{
logf("EP%d OUT token, st:%08x frm:%x (no data)\n", ep,
dma_sts & 0xf8000000, (dma_sts >> 16) & 0x7ff);
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.c b/firmware/target/arm/as3525/usb-drv-as3525v2.c
index 7b5ce886c5..c0542d5c45 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525v2.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525v2.c
@@ -449,9 +449,9 @@ static void usb_drv_transfer(int ep, void *ptr, int len, bool out)
: (void*)0x10000000;
DEPTSIZ(ep, out) = (nb_packets << DEPTSIZ_pkcnt_bitp) | len;
if(out)
- dump_dcache_range(ptr, len);
+ discard_dcache_range(ptr, len);
else
- clean_dcache_range(ptr, len);
+ commit_dcache_range(ptr, len);
logf("pkt=%d dma=%lx", nb_packets, DEPDMA(ep, out));
diff --git a/firmware/target/arm/ata-pp5020.c b/firmware/target/arm/ata-pp5020.c
index 50e6e27c98..50a38cb23d 100644
--- a/firmware/target/arm/ata-pp5020.c
+++ b/firmware/target/arm/ata-pp5020.c
@@ -181,11 +181,11 @@ bool ata_dma_setup(void *addr, unsigned long bytes, bool write) {
if (write) {
/* If unflushed, old data may be written to disk */
- cpucache_flush();
+ commit_dcache();
}
else {
/* Invalidate cache because new data may be present in RAM */
- cpucache_invalidate();
+ commit_discard_dcache();
}
/* Clear pending interrupts so ata_dma_finish() can wait for an
diff --git a/firmware/target/arm/imx31/ata-imx31.c b/firmware/target/arm/imx31/ata-imx31.c
index 80539b9c9d..3b08a38c1b 100644
--- a/firmware/target/arm/imx31/ata-imx31.c
+++ b/firmware/target/arm/imx31/ata-imx31.c
@@ -475,7 +475,7 @@ bool ata_dma_setup(void *addr, unsigned long bytes, bool write)
if (LIKELY(buf != addr))
{
/* addr is virtual */
- clean_dcache_range(addr, bytes);
+ commit_dcache_range(addr, bytes);
}
/* Setup ATA controller for DMA transmit */
@@ -495,7 +495,7 @@ bool ata_dma_setup(void *addr, unsigned long bytes, bool write)
if (LIKELY(buf != addr))
{
/* addr is virtual */
- dump_dcache_range(addr, bytes);
+ discard_dcache_range(addr, bytes);
if ((unsigned long)addr & 31)
{
diff --git a/firmware/target/arm/imx31/crt0.S b/firmware/target/arm/imx31/crt0.S
index b6a49266ef..1c1ae55736 100644
--- a/firmware/target/arm/imx31/crt0.S
+++ b/firmware/target/arm/imx31/crt0.S
@@ -301,7 +301,7 @@ remap_end:
#endif
/* Make memory coherent for devices */
- bl cpucache_commit_discard
+ bl commit_discard_idcache
bl main
diff --git a/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c b/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c
index 180a0feee4..e106cf78e3 100644
--- a/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c
+++ b/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c
@@ -99,7 +99,7 @@ static void play_dma_callback(void)
return;
/* Flush any pending cache writes */
- clean_dcache_range(start, size);
+ commit_dcache_range(start, size);
dma_play_bd.buf_addr = (void *)addr_virt_to_phys((unsigned long)start);
dma_play_bd.mode.count = size;
dma_play_bd.mode.command = TRANSFER_16BIT;
@@ -202,7 +202,7 @@ static void play_stop_pcm(void)
unsigned long dsa = 0;
dma_play_bd.buf_addr = NULL;
dma_play_bd.mode.count = 0;
- clean_dcache_range(&dsa, sizeof(dsa));
+ discard_dcache_range(&dsa, sizeof(dsa));
sdma_write_words(&dsa, CHANNEL_CONTEXT_ADDR(DMA_PLAY_CH_NUM)+0x0b, 1);
}
@@ -221,7 +221,7 @@ void pcm_play_dma_start(const void *addr, size_t size)
if (!sdma_channel_reset(DMA_PLAY_CH_NUM))
return;
- clean_dcache_range(addr, size);
+ commit_dcache_range(addr, size);
dma_play_bd.buf_addr =
(void *)addr_virt_to_phys((unsigned long)(void *)addr);
dma_play_bd.mode.count = size;
@@ -353,7 +353,7 @@ static void rec_dma_callback(void)
return;
/* Invalidate - buffer must be coherent */
- dump_dcache_range(start, size);
+ discard_dcache_range(start, size);
start = (void *)addr_virt_to_phys((unsigned long)start);
@@ -412,7 +412,7 @@ void pcm_rec_dma_stop(void)
unsigned long pda = 0;
dma_rec_bd.buf_addr = NULL;
dma_rec_bd.mode.count = 0;
- clean_dcache_range(&pda, sizeof(pda));
+ discard_dcache_range(&pda, sizeof(pda));
sdma_write_words(&pda, CHANNEL_CONTEXT_ADDR(DMA_REC_CH_NUM)+0x0a, 1);
}
@@ -428,7 +428,7 @@ void pcm_rec_dma_start(void *addr, size_t size)
return;
/* Invalidate - buffer must be coherent */
- dump_dcache_range(addr, size);
+ discard_dcache_range(addr, size);
addr = (void *)addr_virt_to_phys((unsigned long)addr);
dma_rec_bd.buf_addr = addr;
diff --git a/firmware/target/arm/imx31/sdma-imx31.c b/firmware/target/arm/imx31/sdma-imx31.c
index 68aa0aa35f..d3e6233a4b 100644
--- a/firmware/target/arm/imx31/sdma-imx31.c
+++ b/firmware/target/arm/imx31/sdma-imx31.c
@@ -382,7 +382,7 @@ static bool setup_channel(struct channel_control_block *ccb_p)
}
/* Send channel context to SDMA core */
- clean_dcache_range(&context_buffer, sizeof (context_buffer));
+ commit_dcache_range(&context_buffer, sizeof (context_buffer));
sdma_write_words((unsigned long *)&context_buffer,
CHANNEL_CONTEXT_ADDR(channel),
sizeof (context_buffer)/4);
diff --git a/firmware/target/arm/mmu-arm.S b/firmware/target/arm/mmu-arm.S
index 88f9095d2f..522aa9f16f 100644
--- a/firmware/target/arm/mmu-arm.S
+++ b/firmware/target/arm/mmu-arm.S
@@ -184,11 +184,9 @@ enable_mmu:
.align 2
.global commit_discard_dcache_range
.type commit_discard_dcache_range, %function
- .global invalidate_dcache_range @ Alias, deprecated
@ MVA format: 31:5 = Modified virtual address, 4:0 = SBZ
commit_discard_dcache_range:
-invalidate_dcache_range:
add r1, r0, r1 @ size -> end
cmp r1, r0 @ end <= start?
bxls lr @
@@ -232,11 +230,9 @@ invalidate_dcache_range:
.align 2
.global commit_dcache_range
.type commit_dcache_range, %function
- .global clean_dcache_range @ Alias, deprecated
@ MVA format: 31:5 = Modified virtual address, 4:0 = SBZ
commit_dcache_range:
-clean_dcache_range:
add r1, r0, r1 @ size -> end
cmp r1, r0 @ end <= start?
bxls lr @
@@ -281,11 +277,9 @@ clean_dcache_range:
.align 2
.global discard_dcache_range
.type discard_dcache_range, %function
- .global dump_dcache_range @ Alias, deprecated
@ MVA format: 31:5 = Modified virtual address, 4:0 = SBZ
discard_dcache_range:
-dump_dcache_range:
add r1, r0, r1 @ size -> end
cmp r1, r0 @ end <= start?
bxls lr @
@@ -339,14 +333,8 @@ dump_dcache_range:
.align 2
.global commit_dcache
.type commit_dcache, %function
- .global cpucache_commit @ Alias
- .global clean_dcache @ Alias, deprecated
- .global cpucache_flush @ Alias, deprecated
commit_dcache:
-cpucache_commit:
-clean_dcache:
-cpucache_flush:
#ifdef HAVE_TEST_AND_CLEAN_CACHE
mrc p15, 0, r15, c7, c10, 3 @ test and clean dcache
bne commit_dcache
@@ -376,10 +364,8 @@ cpucache_flush:
.align 2
.global commit_discard_dcache
.type commit_discard_dcache, %function
- .global invalidate_dcache @ Alias, deprecated
commit_discard_dcache:
-invalidate_dcache:
#ifdef HAVE_TEST_AND_CLEAN_CACHE
mrc p15, 0, r15, c7, c14, 3 @ test, clean and invalidate dcache
bne commit_discard_dcache
@@ -409,14 +395,8 @@ invalidate_dcache:
.align 2
.global commit_discard_idcache
.type commit_discard_idcache, %function
- .global cpucache_commit_discard @ Alias
- .global invalidate_idcache @ Alias, deprecated
- .global cpucache_invalidate @ Alias, deprecated
commit_discard_idcache:
-cpucache_commit_discard:
-invalidate_idcache:
-cpucache_invalidate:
mov r2, lr @ save lr to r1, call uses r0 only
bl commit_discard_dcache @ commit and discard entire DCache
mcr p15, 0, r1, c7, c5, 0 @ Invalidate ICache (r1=0 from call)
diff --git a/firmware/target/arm/mmu-arm.h b/firmware/target/arm/mmu-arm.h
index 92a81c0c34..155769489e 100644
--- a/firmware/target/arm/mmu-arm.h
+++ b/firmware/target/arm/mmu-arm.h
@@ -53,42 +53,24 @@ void map_section(unsigned int pa, unsigned int va, int mb, int flags);
/* Commits entire DCache */
void commit_dcache(void);
-/* deprecated alias */
-void clean_dcache(void);
/* Commit and discard entire DCache, will do writeback */
void commit_discard_dcache(void);
-/* deprecated alias */
-void invalidate_dcache(void);
/* Write DCache back to RAM for the given range and remove cache lines
* from DCache afterwards */
void commit_discard_dcache_range(const void *base, unsigned int size);
-/* deprecated alias */
-void invalidate_dcache_range(const void *base, unsigned int size);
/* Write DCache back to RAM for the given range */
void commit_dcache_range(const void *base, unsigned int size);
-/* deprecated alias */
-void clean_dcache_range(const void *base, unsigned int size);
/*
* Remove cache lines for the given range from DCache
* will *NOT* do write back except for buffer edges not on a line boundary
*/
void discard_dcache_range(const void *base, unsigned int size);
-/* deprecated alias */
-void dump_dcache_range(const void *base, unsigned int size);
/* Discards the entire ICache, and commit+discards the entire DCache */
void commit_discard_idcache(void);
-/* deprecated alias */
-void invalidate_idcache(void);
-
-#define HAVE_CPUCACHE_COMMIT_DISCARD
-#define HAVE_CPUCACHE_COMMIT
-/* deprecated alias */
-#define HAVE_CPUCACHE_INVALIDATE
-#define HAVE_CPUCACHE_FLUSH
#endif /* MMU_ARM_H */
diff --git a/firmware/target/arm/mmu-armv6.S b/firmware/target/arm/mmu-armv6.S
index c4cb49ea26..30d719d475 100644
--- a/firmware/target/arm/mmu-armv6.S
+++ b/firmware/target/arm/mmu-armv6.S
@@ -36,11 +36,9 @@
.align 2
.global commit_discard_dcache_range
.type commit_discard_dcache_range, %function
- .global invalidate_dcache_range @ Alias, deprecated
@ MVA format: 31:5 = Modified virtual address, 4:0 = SBZ
commit_discard_dcache_range:
-invalidate_dcache_range:
add r1, r0, r1 @ size -> end
cmp r1, r0 @ end <= start?
subhi r1, r1, #1 @ round it down
@@ -60,11 +58,9 @@ invalidate_dcache_range:
.align 2
.global commit_dcache_range
.type commit_dcache_range, %function
- .global clean_dcache_range @ Alias, deprecated
@ MVA format: 31:5 = Modified virtual address, 4:0 = SBZ
commit_dcache_range:
-clean_dcache_range:
add r1, r0, r1 @ size -> end
cmp r1, r0 @ end <= start?
subhi r1, r1, #1 @ round it down
@@ -83,11 +79,9 @@ clean_dcache_range:
.align 2
.global discard_dcache_range
.type discard_dcache_range, %function
- .global dump_dcache_range @ Alias, deprecated
@ MVA format: 31:5 = Modified virtual address, 4:0 = SBZ
discard_dcache_range:
-dump_dcache_range:
add r1, r0, r1 @ size -> end
cmp r1, r0 @ end <= start?
bxls lr @
@@ -118,14 +112,8 @@ dump_dcache_range:
.align 2
.global commit_dcache
.type commit_dcache, %function
- .global cpucache_commit @ Alias
- .global clean_dcache @ Alias, deprecated
- .global cpucache_flush @ Alias, deprecated
commit_dcache:
-cpucache_commit:
-clean_dcache:
-cpucache_flush:
mov r0, #0 @
mcr p15, 0, r0, c7, c10, 0 @ Clean entire DCache
mcr p15, 0, r0, c7, c10, 4 @ Data synchronization barrier
@@ -140,10 +128,8 @@ cpucache_flush:
.align 2
.global commit_discard_dcache
.type commit_discard_dcache, %function
- .global invalidate_dcache @ Alias, deprecated
commit_discard_dcache:
-invalidate_dcache:
mov r0, #0 @
mcr p15, 0, r0, c7, c14, 0 @ Clean and invalidate entire DCache
mcr p15, 0, r0, c7, c10, 4 @ Data synchronization barrier
@@ -153,20 +139,14 @@ invalidate_dcache:
/*
* Discards the entire ICache, and commit+discards the entire DCache
- * void cpucache_commit_discard(void);
+ * void commit_discard_idcache(void);
*/
- .section .icode.cpucache_commit_discard, "ax", %progbits
+ .section .icode.commit_discard_idcache, "ax", %progbits
.align 2
- .global cpucache_commit_discard
- .type cpucache_commit_discard, %function
- .global commit_discard_idcache @ Alias
- .global invalidate_idcache @ Alias, deprecated
- .global cpucache_invalidate @ Alias, deprecated
+ .global commit_discard_idcache
+ .type commit_discard_idcache, %function
-cpucache_commit_discard:
commit_discard_idcache:
-invalidate_idcache:
-cpucache_invalidate:
mov r0, #0 @
mcr p15, 0, r0, c7, c14, 0 @ Clean and invalidate entire DCache
mcr p15, 0, r0, c7, c5, 0 @ Invalidate entire ICache
diff --git a/firmware/target/arm/pcm-pp.c b/firmware/target/arm/pcm-pp.c
index 695bc71567..3854206ae8 100644
--- a/firmware/target/arm/pcm-pp.c
+++ b/firmware/target/arm/pcm-pp.c
@@ -158,7 +158,7 @@ void ICODE_ATTR __attribute__((interrupt("FIQ"))) fiq_playback(void)
if (dma_play_data.addr < UNCACHED_BASE_ADDR) {
/* Flush any pending cache writes */
dma_play_data.addr = UNCACHED_ADDR(dma_play_data.addr);
- cpucache_flush();
+ commit_discard_idcache();
}
}
}
@@ -444,7 +444,7 @@ void pcm_play_dma_start(const void *addr, size_t size)
if ((unsigned long)addr < UNCACHED_BASE_ADDR) {
/* Flush any pending cache writes */
addr = UNCACHED_ADDR(addr);
- cpucache_flush();
+ commit_discard_idcache();
}
dma_play_data.addr = (unsigned long)addr;
diff --git a/firmware/target/arm/rk27xx/system-rk27xx.c b/firmware/target/arm/rk27xx/system-rk27xx.c
index e73edf1add..3349f9d0f1 100644
--- a/firmware/target/arm/rk27xx/system-rk27xx.c
+++ b/firmware/target/arm/rk27xx/system-rk27xx.c
@@ -163,7 +163,7 @@ void udelay(unsigned usecs)
);
}
-void cpucache_commit_discard(void)
+void commit_discard_idcache(void)
{
/* invalidate cache way 0 */
CACHEOP = 0x02;
@@ -178,8 +178,6 @@ void cpucache_commit_discard(void)
while (CACHEOP & 0x03);
}
-void cpucache_invalidate(void) __attribute__((alias("cpucache_commit_discard")));
-
void commit_discard_dcache_range (const void *base, unsigned int size)
{
int cnt = size + ((unsigned long)base & 0x1f);
@@ -196,4 +194,5 @@ void commit_discard_dcache_range (const void *base, unsigned int size)
}
}
-void clean_dcache_range(const void *base, unsigned int size) __attribute__((alias("commit_discard_dcache_range")));
+void commit_dcache_range(const void *base, unsigned int size)
+ __attribute__((alias("commit_discard_dcache_range")));
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c
index 89b00bbd1d..aae4c4b1d8 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c
@@ -121,7 +121,8 @@ void copy_read_sectors(unsigned char* buf, int wordcount)
/* Activate the channel */
DMASKTRIG0 = 0x2;
- invalidate_dcache_range((void *)buf, wordcount*2);
+ /* Dump cache for the buffer */
+ discard_dcache_range((void *)buf, wordcount*2);
/* Start DMA */
DMASKTRIG0 |= 0x1;
@@ -129,6 +130,5 @@ void copy_read_sectors(unsigned char* buf, int wordcount)
/* Wait for transfer to complete */
while((DSTAT0 & 0x000fffff))
yield();
- /* Dump cache for the buffer */
}
#endif
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c
index b133639e12..35905645dd 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c
@@ -111,7 +111,7 @@ static void play_start_pcm(void)
SRCPND = DMA2_MASK;
/* Flush any pending writes */
- clean_dcache_range((char*)DISRC2-0x30000000, (DCON2 & 0xFFFFF) * 2);
+ commit_dcache_range((char*)DISRC2-0x30000000, (DCON2 & 0xFFFFF) * 2);
/* unmask DMA interrupt when unlocking */
dma_play_lock.state = DMA2_MASK;
@@ -228,7 +228,7 @@ void fiq_handler(void)
return;
/* Flush any pending cache writes */
- clean_dcache_range(start, size);
+ commit_dcache_range(start, size);
/* set the new DMA values */
DCON2 = DMA_CONTROL_SETUP | (size >> 1);
diff --git a/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c b/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c
index 20332c12f8..a4f58a8e06 100644
--- a/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c
+++ b/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c
@@ -146,7 +146,7 @@ static void play_start_pcm(void)
SRCPND = DMA2_MASK;
/* Flush any pending writes */
- clean_dcache_range((char*)DISRC2-0x30000000, (DCON2 & 0xFFFFF) * 2);
+ commit_dcache_range((char*)DISRC2-0x30000000, (DCON2 & 0xFFFFF) * 2);
/* unmask DMA interrupt when unlocking */
dma_play_lock.state = DMA2_MASK;
@@ -268,7 +268,7 @@ void fiq_handler(void)
return;
/* Flush any pending cache writes */
- clean_dcache_range(start, size);
+ commit_dcache_range(start, size);
/* set the new DMA values */
DCON2 = DMA_CONTROL_SETUP | (size >> 1);
diff --git a/firmware/target/arm/system-pp5002.c b/firmware/target/arm/system-pp5002.c
index 04e052fa83..3186d3739a 100644
--- a/firmware/target/arm/system-pp5002.c
+++ b/firmware/target/arm/system-pp5002.c
@@ -54,15 +54,8 @@ void __attribute__((interrupt("IRQ"))) irq_handler(void)
#endif
-/* TODO: The following two function have been lifted straight from IPL, and
- hence have a lot of numeric addresses used straight. I'd like to use
- #defines for these, but don't know what most of them are for or even what
- they should be named. Because of this I also have no way of knowing how
- to extend the funtions to do alternate cache configurations and/or
- some other CPU frequency scaling. */
-
#ifndef BOOTLOADER
-void ICODE_ATTR __attribute__((naked)) cpucache_commit(void)
+void ICODE_ATTR __attribute__((naked)) commit_dcache(void)
{
asm volatile(
"mov r0, #0xf0000000 \n"
@@ -76,9 +69,8 @@ void ICODE_ATTR __attribute__((naked)) cpucache_commit(void)
"bx lr \n"
);
}
-void cpucache_flush(void) __attribute__((alias("cpucache_commit")));
-void ICODE_ATTR __attribute__((naked)) cpucache_commit_discard(void)
+void ICODE_ATTR __attribute__((naked)) commit_discard_idcache(void)
{
asm volatile(
"mov r0, #0xf0000000 \n"
@@ -94,7 +86,8 @@ void ICODE_ATTR __attribute__((naked)) cpucache_commit_discard(void)
"bx lr \n"
);
}
-void cpucache_invalidate(void) __attribute__((alias("cpucache_commit_discard")));
+
+void commit_discard_dcache(void) __attribute__((alias("commit_discard_idcache")));
static void ipod_init_cache(void)
{
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index 0422ea7d9c..08c2719aef 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -209,7 +209,7 @@ static void disable_all_interrupts(void)
GPIOL_INT_EN = 0;
}
-void ICODE_ATTR cpucache_commit(void)
+void ICODE_ATTR commit_dcache(void)
{
if (CACHE_CTL & CACHE_CTL_ENABLE)
{
@@ -218,9 +218,8 @@ void ICODE_ATTR cpucache_commit(void)
nop; nop; nop; nop;
}
}
-void cpucache_flush(void) __attribute__((alias("cpucache_commit")));
-void ICODE_ATTR cpucache_commit_discard(void)
+void ICODE_ATTR commit_discard_idcache(void)
{
if (CACHE_CTL & CACHE_CTL_ENABLE)
{
@@ -229,7 +228,8 @@ void ICODE_ATTR cpucache_commit_discard(void)
nop; nop; nop; nop;
}
}
-void cpucache_invalidate(void) __attribute__((alias("cpucache_commit_discard")));
+
+void commit_discard_dcache(void) __attribute__((alias("commit_discard_idcache")));
static void init_cache(void)
{
diff --git a/firmware/target/arm/system-target.h b/firmware/target/arm/system-target.h
index e5a8b15f64..730bc2dbbb 100644
--- a/firmware/target/arm/system-target.h
+++ b/firmware/target/arm/system-target.h
@@ -141,6 +141,10 @@ static inline void wake_core(int core)
}
#endif
+void commit_dcache(void);
+void commit_discard_dcache(void);
+void commit_discard_idcache(void);
+
#if defined(BOOTLOADER) && !defined(HAVE_BOOTLOADER_USB_MODE)
/* All addresses within rockbox are in IRAM in the bootloader so
are therefore uncached */
@@ -162,15 +166,6 @@ static inline void wake_core(int core)
#define STORAGE_WANTS_ALIGN
#endif
-/** cache functions **/
-#if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE)
-#define HAVE_CPUCACHE_COMMIT_DISCARD
-#define HAVE_CPUCACHE_COMMIT
-/* deprecated alias */
-#define HAVE_CPUCACHE_INVALIDATE
-#define HAVE_CPUCACHE_FLUSH
-#endif
-
#if defined(IPOD_VIDEO) && !defined(BOOTLOADER)
extern unsigned char probed_ramsize;
int battery_default_capacity(void);
diff --git a/firmware/target/arm/thread-arm.c b/firmware/target/arm/thread-arm.c
index e1bbc04248..0b46ca2558 100644
--- a/firmware/target/arm/thread-arm.c
+++ b/firmware/target/arm/thread-arm.c
@@ -34,7 +34,7 @@ static void __attribute__((naked)) USED_ATTR start_thread(void)
"mov r1, #0 \n" /* Mark thread as running */
"str r1, [r0, #40] \n"
#if NUM_CORES > 1
- "ldr r0, =cpucache_invalidate \n" /* Invalidate this core's cache. */
+ "ldr r0, =commit_discard_idcache \n" /* Invalidate this core's cache. */
"mov lr, pc \n" /* This could be the first entry into */
"bx r0 \n" /* plugin or codec code for this core. */
#endif
diff --git a/firmware/target/arm/thread-pp.c b/firmware/target/arm/thread-pp.c
index a0a4d4fd17..0836b27204 100644
--- a/firmware/target/arm/thread-pp.c
+++ b/firmware/target/arm/thread-pp.c
@@ -214,7 +214,7 @@ static inline void NORETURN_ATTR __attribute__((always_inline))
{
asm volatile (
"cmp %1, #0 \n" /* CPU? */
- "ldrne r0, =cpucache_flush \n" /* No? write back data */
+ "ldrne r0, =commit_dcache \n" /* No? write back data */
"movne lr, pc \n"
"bxne r0 \n"
"mov r0, %0 \n" /* copy thread parameter */
@@ -244,7 +244,7 @@ static inline void NORETURN_ATTR __attribute__((always_inline))
static void core_switch_blk_op(unsigned int core, struct thread_entry *thread)
{
/* Flush our data to ram */
- cpucache_flush();
+ commit_dcache();
/* Stash thread in r4 slot */
thread->context.r[0] = (uint32_t)thread;
/* Stash restart address in r5 slot */
@@ -285,7 +285,7 @@ static void __attribute__((naked))
"ldr sp, [r0, #32] \n" /* Reload original sp from context structure */
"mov r1, #0 \n" /* Clear start address */
"str r1, [r0, #40] \n"
- "ldr r0, =cpucache_invalidate \n" /* Invalidate new core's cache */
+ "ldr r0, =commit_discard_idcache \n" /* Invalidate new core's cache */
"mov lr, pc \n"
"bx r0 \n"
"ldmfd sp!, { r4-r11, pc } \n" /* Restore non-volatile context to new core and return */
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
index 94163eddbe..898013982b 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
@@ -318,7 +318,7 @@ static void dma_start_transfer16( char *src, int src_x, int src_y, int stride,
dst = (char *)FRAME + (y * LCD_HEIGHT + x) * pix_width;
/* Flush the area that is being copied from. */
- clean_dcache_range(src, (stride*pix_width*width));
+ commit_dcache_range(src, (stride*pix_width*width));
/* Addresses are relative to start of SDRAM */
src -= CONFIG_SDRAM_START;
@@ -393,9 +393,9 @@ static void dma_start_transfer16( char *src, int src_x, int src_y, int stride,
* pix_width;
/* Flush the area that is being copied from. */
- clean_dcache();
+ commit_dcache();
-// clean_dcache_range(src, (stride*pix_width*width));
+// commit_dcache_range(src, (stride*pix_width*width));
/* Addresses are relative to start of SDRAM */
src -= CONFIG_SDRAM_START;
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c
index c507428c57..91d6b66130 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c
@@ -170,7 +170,7 @@ void DSPHINT(void)
{
unsigned long sdem_addr=(unsigned long)start - CONFIG_SDRAM_START;
/* Flush any pending cache writes */
- clean_dcache_range(start, size);
+ commit_dcache_range(start, size);
/* set the new DMA values */
DSP_(_sdem_addrl) = sdem_addr & 0xffff;
diff --git a/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c
index 3f04838388..045f7b0ee9 100644
--- a/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c
+++ b/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c
@@ -180,7 +180,7 @@ void DSPHINT(void)
{
unsigned long sdem_addr=(unsigned long)start - CONFIG_SDRAM_START;
/* Flush any pending cache writes */
- clean_dcache_range(start, size);
+ commit_dcache_range(start, size);
/* set the new DMA values */
DSP_(_sdem_addrl) = sdem_addr & 0xffff;
diff --git a/firmware/target/coldfire/system-coldfire.c b/firmware/target/coldfire/system-coldfire.c
index 4f7ac43017..ed130fca1f 100644
--- a/firmware/target/coldfire/system-coldfire.c
+++ b/firmware/target/coldfire/system-coldfire.c
@@ -384,12 +384,10 @@ void coldfire_set_dataincontrol(unsigned long value)
restore_irq(level);
}
-void cpucache_commit_discard(void)
+void commit_discard_idcache(void)
{
asm volatile ("move.l #0x01000000,%d0\n"
"movec.l %d0,%cacr\n"
"move.l #0x80000000,%d0\n"
"movec.l %d0,%cacr");
}
-
-void cpucache_invalidate(void) __attribute__((alias("cpucache_commit_discard")));
diff --git a/firmware/target/coldfire/system-target.h b/firmware/target/coldfire/system-target.h
index 3d7502a6dd..74767c4583 100644
--- a/firmware/target/coldfire/system-target.h
+++ b/firmware/target/coldfire/system-target.h
@@ -194,10 +194,6 @@ static inline uint32_t swap_odd_even32_hw(uint32_t value)
return value;
}
-#define HAVE_CPUCACHE_COMMIT_DISCARD
-/* deprecated alias */
-#define HAVE_CPUCACHE_INVALIDATE
-
#define DEFAULT_PLLCR_AUDIO_BITS 0x10400000
void coldfire_set_pllcr_audio_bits(long bits);
@@ -223,4 +219,8 @@ extern void cf_set_cpu_frequency(long frequency);
#define CPUFREQ_MAX_MULT 11
#define CPUFREQ_MAX (CPUFREQ_MAX_MULT * CPU_FREQ)
+void commit_discard_idcache(void);
+static inline void commit_discard_dcache(void) {}
+static inline void commit_dcache(void) {}
+
#endif /* SYSTEM_TARGET_H */
diff --git a/firmware/target/hosted/android/system-target.h b/firmware/target/hosted/android/system-target.h
index 325c1012af..12610de42f 100644
--- a/firmware/target/hosted/android/system-target.h
+++ b/firmware/target/hosted/android/system-target.h
@@ -26,6 +26,10 @@
#define disable_irq_save() 0
#define restore_irq(level) (void)level
+static inline void commit_dcache(void) {}
+static inline void commit_discard_dcache(void) {}
+static inline void commit_discard_idcache(void) {}
+
void power_off(void);
void wait_for_interrupt(void);
void interrupt(void);
diff --git a/firmware/target/hosted/sdl/system-sdl.h b/firmware/target/hosted/sdl/system-sdl.h
index 9021a12543..d607e5e0a6 100644
--- a/firmware/target/hosted/sdl/system-sdl.h
+++ b/firmware/target/hosted/sdl/system-sdl.h
@@ -57,4 +57,8 @@ extern bool showremote;
extern int display_zoom;
extern long start_tick;
+static inline void commit_dcache(void) {}
+static inline void commit_discard_dcache(void) {}
+static inline void commit_discard_idcache(void) {}
+
#endif /* _SYSTEM_SDL_H_ */
diff --git a/firmware/target/mips/mmu-mips.c b/firmware/target/mips/mmu-mips.c
index 31b07409d5..9dcec43321 100644
--- a/firmware/target/mips/mmu-mips.c
+++ b/firmware/target/mips/mmu-mips.c
@@ -169,12 +169,6 @@ void __icache_invalidate_all(void)
: "r" (i));
}
-void cpucache_commit_discard(void)
-{
- __icache_invalidate_all();
-}
-void cpucache_invalidate(void) __attribute__((alias("cpucache_commit_discard")));
-
void __dcache_invalidate_all(void)
{
unsigned int i;
diff --git a/firmware/target/mips/mmu-mips.h b/firmware/target/mips/mmu-mips.h
index f3d35f606d..47aea807cc 100644
--- a/firmware/target/mips/mmu-mips.h
+++ b/firmware/target/mips/mmu-mips.h
@@ -37,4 +37,8 @@ void __icache_invalidate_all(void);
void __flush_dcache_line(unsigned long addr);
void dma_cache_wback_inv(unsigned long addr, unsigned long size);
+#define commit_discard_idcache __icache_invalidate_all
+#define commit_discard_dcache __dcache_invalidate_all
+#define commit_dcache __dcache_writeback_all
+
#endif /* __MMU_MIPS_INCLUDE_H */
diff --git a/firmware/target/sh/system-target.h b/firmware/target/sh/system-target.h
index d78c0587fc..5db9cc071f 100644
--- a/firmware/target/sh/system-target.h
+++ b/firmware/target/sh/system-target.h
@@ -133,4 +133,8 @@ extern const unsigned bit_n_table[32];
: bit_n_table[n] \
)
+static inline void commit_dcache(void) {}
+static inline void commit_discard_dcache(void) {}
+static inline void commit_discard_idcache(void) {}
+
#endif /* SYSTEM_TARGET_H */
diff --git a/firmware/thread.c b/firmware/thread.c
index 251646b0f5..732675abf8 100644
--- a/firmware/thread.c
+++ b/firmware/thread.c
@@ -1613,7 +1613,7 @@ unsigned int create_thread(void (*function)(void),
/* Writeback stack munging or anything else before starting */
if (core != CURRENT_CORE)
{
- cpucache_flush();
+ commit_discard_idcache();
}
#endif
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index 0b9e6a95db..c156d80396 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -474,7 +474,7 @@ void usb_storage_init_connection(void)
cbw_buffer = (void *)((unsigned int)(audio_buffer+31) & 0xffffffe0);
#endif
tb.transfer_buffer = cbw_buffer + MAX_CBW_SIZE;
- cpucache_invalidate();
+ commit_discard_dcache();
#ifdef USB_USE_RAMDISK
ramdisk_buffer = tb.transfer_buffer + ALLOCATE_BUFFER_SIZE;
#endif