diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-12-17 07:27:24 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-12-17 07:27:24 +0000 |
commit | 6a67707b5ec3b2c649c401550bb7fdef2b7c8d07 (patch) | |
tree | bfe31942a4abbaac09ad0f4226effdcef8bf097e /firmware/target | |
parent | 43d7a75369286dc3b39b858df34f66b0b45de34e (diff) |
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
Diffstat (limited to 'firmware/target')
31 files changed, 76 insertions, 139 deletions
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 */ |