URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [drivers/] [or1200/] [cache.S] - Rev 530
Compare with Previous | Blame | View Log
#include "spr-defs.h"/* Cache init. To be called during init ONLY */.global _cache_init.type _cache_init,@function_cache_init:/* Instruction cache enable *//* Check if IC present and skip enabling otherwise */l.mfspr r3,r0,SPR_UPRl.andi r4,r3,SPR_UPR_ICPl.sfeq r4,r0l.bf .L8l.nop/* Disable IC */l.mfspr r6,r0,SPR_SRl.addi r5,r0,-1l.xori r5,r5,SPR_SR_ICEl.and r5,r6,r5l.mtspr r0,r5,SPR_SR/* Establish cache block sizeIf BS=0, 16;If BS=1, 32;r14 contain block size*/l.mfspr r3,r0,SPR_ICCFGRl.andi r4,r3,SPR_ICCFGR_CBSl.srli r5,r4,7l.ori r6,r0,16l.sll r14,r6,r5/* Establish number of cache setsr7 contains number of cache setsr5 contains log(# of cache sets)*/l.andi r4,r3,SPR_ICCFGR_NCSl.srli r5,r4,3l.ori r6,r0,1l.sll r7,r6,r5/* Invalidate IC */l.addi r6,r0,0l.sll r5,r14,r5.L7:l.mtspr r0,r6,SPR_ICBIRl.sfne r6,r5l.bf .L7l.add r6,r6,r14/* Enable IC */l.mfspr r6,r0,SPR_SRl.ori r6,r6,SPR_SR_ICEl.mtspr r0,r6,SPR_SRl.nopl.nopl.nopl.nopl.nopl.nopl.nopl.nop.L8:/* Data cache enable *//* Check if DC present and skip enabling otherwise */l.mfspr r3,r0,SPR_UPRl.andi r4,r3,SPR_UPR_DCPl.sfeq r4,r0l.bf .L10l.nop/* Disable DC */l.mfspr r6,r0,SPR_SRl.addi r5,r0,-1l.xori r5,r5,SPR_SR_DCEl.and r5,r6,r5l.mtspr r0,r5,SPR_SR/* Establish cache block sizeIf BS=0, 16;If BS=1, 32;r14 contain block size*/l.mfspr r3,r0,SPR_DCCFGRl.andi r4,r3,SPR_DCCFGR_CBSl.srli r5,r4,7l.ori r6,r0,16l.sll r14,r6,r5/* Establish number of cache setsr7 contains number of cache setsr5 contains log(# of cache sets)*/l.andi r4,r3,SPR_DCCFGR_NCSl.srli r5,r4,3l.ori r6,r0,1l.sll r7,r6,r5/* Invalidate DC */l.addi r6,r0,0l.sll r5,r14,r5.L9:l.mtspr r0,r6,SPR_DCBIRl.sfne r6,r5l.bf .L9l.add r6,r6,r14/* Enable DC */l.mfspr r6,r0,SPR_SRl.ori r6,r6,SPR_SR_DCEl.mtspr r0,r6,SPR_SR.L10:/* Return */l.jr r9l.nop
