diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-03-08 10:59:53 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-03-09 20:04:30 +0000 |
commit | 777f63d5292df98253bbb00db9362ddbe55b778e (patch) | |
tree | be227688fb0dea649604a2dab7ac7b5a352c9855 /firmware/target/mips | |
parent | 4e6609e9f2388a2f855b53b7bbff903de1f26644 (diff) | |
download | rockbox-777f63d5292df98253bbb00db9362ddbe55b778e.tar.gz rockbox-777f63d5292df98253bbb00db9362ddbe55b778e.zip |
Move MIPS cache management functions to IRAM
Previously these were placed in DRAM, which is overwritten by RoLo
when it loads a new image, but RoLo must call commit_discard_idcache()
after loading the image.
Change-Id: I5dcc4ca711b774166f83c668695edbcabfab2604
Diffstat (limited to 'firmware/target/mips')
-rw-r--r-- | firmware/target/mips/mmu-mips.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/firmware/target/mips/mmu-mips.h b/firmware/target/mips/mmu-mips.h index f96ddcc28d..b54807f060 100644 --- a/firmware/target/mips/mmu-mips.h +++ b/firmware/target/mips/mmu-mips.h | |||
@@ -24,29 +24,37 @@ | |||
24 | 24 | ||
25 | #include "system-target.h" | 25 | #include "system-target.h" |
26 | 26 | ||
27 | /* By default the cache management functions go in .icode so they can be | ||
28 | * called safely eg. by the bootloader or RoLo, which need to flush the | ||
29 | * cache before jumping to the loaded binary. | ||
30 | */ | ||
31 | #ifndef MIPS_CACHEFUNC_ATTR | ||
32 | # define MIPS_CACHEFUNC_ATTR __attribute__((section(".icode"))) | ||
33 | #endif | ||
34 | |||
27 | void map_address(unsigned long virtual, unsigned long physical, | 35 | void map_address(unsigned long virtual, unsigned long physical, |
28 | unsigned long length, unsigned int cache_flags); | 36 | unsigned long length, unsigned int cache_flags); |
29 | void mmu_init(void); | 37 | void mmu_init(void); |
30 | 38 | ||
31 | /* Commits entire DCache */ | 39 | /* Commits entire DCache */ |
32 | void commit_dcache(void); | 40 | void commit_dcache(void) MIPS_CACHEFUNC_ATTR; |
33 | /* Commit and discard entire DCache, will do writeback */ | 41 | /* Commit and discard entire DCache, will do writeback */ |
34 | void commit_discard_dcache(void); | 42 | void commit_discard_dcache(void) MIPS_CACHEFUNC_ATTR; |
35 | 43 | ||
36 | /* Write DCache back to RAM for the given range and remove cache lines | 44 | /* Write DCache back to RAM for the given range and remove cache lines |
37 | * from DCache afterwards */ | 45 | * from DCache afterwards */ |
38 | void commit_discard_dcache_range(const void *base, unsigned int size); | 46 | void commit_discard_dcache_range(const void *base, unsigned int size) MIPS_CACHEFUNC_ATTR; |
39 | 47 | ||
40 | /* Write DCache back to RAM for the given range */ | 48 | /* Write DCache back to RAM for the given range */ |
41 | void commit_dcache_range(const void *base, unsigned int size); | 49 | void commit_dcache_range(const void *base, unsigned int size) MIPS_CACHEFUNC_ATTR; |
42 | 50 | ||
43 | /* | 51 | /* |
44 | * Remove cache lines for the given range from DCache | 52 | * Remove cache lines for the given range from DCache |
45 | * will *NOT* do write back except for buffer edges not on a line boundary | 53 | * will *NOT* do write back except for buffer edges not on a line boundary |
46 | */ | 54 | */ |
47 | void discard_dcache_range(const void *base, unsigned int size); | 55 | void discard_dcache_range(const void *base, unsigned int size) MIPS_CACHEFUNC_ATTR; |
48 | 56 | ||
49 | /* Discards the entire ICache, and commit+discards the entire DCache */ | 57 | /* Discards the entire ICache, and commit+discards the entire DCache */ |
50 | void commit_discard_idcache(void); | 58 | void commit_discard_idcache(void) MIPS_CACHEFUNC_ATTR; |
51 | 59 | ||
52 | #endif /* __MMU_MIPS_INCLUDE_H */ | 60 | #endif /* __MMU_MIPS_INCLUDE_H */ |