Woo MMU Woo Caches Woo AHBMemFlush!

This commit is contained in:
marcan 2009-01-16 09:07:33 +01:00 committed by bushing
parent debfa55f86
commit 99c38eebe1
3 changed files with 11 additions and 7 deletions

View File

@ -7,7 +7,7 @@
#include "irq.h"
void _dc_inval_entries(void *start, int count);
void _dc_flush_entries(void *start, int count);
void _dc_flush_entries(const void *start, int count);
void _dc_flush(void);
void _dc_inval(void);
void _ic_inval(void);
@ -169,7 +169,7 @@ void ahb_memflush(enum AHBDEV dev)
}
}
void dc_flushrange(void *start, u32 size)
void dc_flushrange(const void *start, u32 size)
{
u32 cookie = irq_kill();
if(size > 0x4000) {
@ -180,7 +180,7 @@ void dc_flushrange(void *start, u32 size)
_dc_flush_entries(start, (end - start) / LINESIZE);
}
_drain_write_buffer();
//ahb_memflush(MEMORY);
ahb_memflush(MEMORY);
irq_restore(cookie);
}
@ -190,7 +190,7 @@ void dc_invalidaterange(void *start, u32 size)
void *end = ALIGN_FORWARD(((u8*)start) + size, LINESIZE);
start = ALIGN_BACKWARD(start, LINESIZE);
_dc_inval_entries(start, (end - start) / LINESIZE);
//_magic_bullshit(0);
_magic_bullshit(0);
irq_restore(cookie);
}
@ -199,7 +199,7 @@ void dc_flushall(void)
u32 cookie = irq_kill();
_dc_flush();
_drain_write_buffer();
//ahb_memflush(MEMORY);
ahb_memflush(MEMORY);
irq_restore(cookie);
}
@ -207,7 +207,7 @@ void ic_invalidateall(void)
{
u32 cookie = irq_kill();
_ic_inval();
//_magic_bullshit(0);
_magic_bullshit(0);
irq_restore(cookie);
}
@ -274,6 +274,7 @@ void mem_initialize(void)
map_section(0xfff, 0xfff, 0x001, WRITEBACK_CACHE | DOMAIN(0) | AP_RWUSER);
set_dacr(0xFFFFFFFF); //manager access for all domains, ignore AP
set_ttbr((u32)__page_table); //configure translation table
_drain_write_buffer();

View File

@ -15,7 +15,7 @@ enum AHBDEV {
RAWF = 0x10F,
};
void dc_flushrange(void *start, u32 size);
void dc_flushrange(const void *start, u32 size);
void dc_invalidaterange(void *start, u32 size);
void dc_flushall(void);
void ic_invalidateall(void);

3
sdhc.c
View File

@ -1076,12 +1076,14 @@ int sd_read(sdhci_t *sdhci, u32 start_block, u32 blk_cnt, void *buffer)
if(sdhci->is_sdhc == 0)
start_block *= 512;
dc_invalidaterange(buffer, blk_cnt * 512);
retval = __sd_cmd(sdhci, SD_CMD_READ_MULTIPLE_BLOCK, SD_R1 | SD_READ, start_block, blk_cnt, buffer, &response, sizeof(response));
if(retval < 0)
sdhc_debug(sdhci->reg_base, "reading blocks failed with %d.", retval);
__sd_print_status(sdhci);
return retval;
}
@ -1104,6 +1106,7 @@ int sd_write(sdhci_t *sdhci, u32 start_block, u32 blk_cnt, const void *buffer)
if(sdhci->is_sdhc == 0)
start_block *= 512;
dc_flushrange(buffer, blk_cnt * 512);
retval = __sd_cmd(sdhci, SD_CMD_WRITE_MULTIPLE_BLOCK, SD_R1, start_block, blk_cnt, (void *)buffer, &response, sizeof(response));
if(retval < 0)