mirror of
https://github.com/fail0verflow/mini.git
synced 2024-11-30 23:24:19 +01:00
Woo MMU Woo Caches Woo AHBMemFlush!
This commit is contained in:
parent
debfa55f86
commit
99c38eebe1
13
memory.c
13
memory.c
@ -7,7 +7,7 @@
|
|||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
|
|
||||||
void _dc_inval_entries(void *start, int count);
|
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_flush(void);
|
||||||
void _dc_inval(void);
|
void _dc_inval(void);
|
||||||
void _ic_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();
|
u32 cookie = irq_kill();
|
||||||
if(size > 0x4000) {
|
if(size > 0x4000) {
|
||||||
@ -180,7 +180,7 @@ void dc_flushrange(void *start, u32 size)
|
|||||||
_dc_flush_entries(start, (end - start) / LINESIZE);
|
_dc_flush_entries(start, (end - start) / LINESIZE);
|
||||||
}
|
}
|
||||||
_drain_write_buffer();
|
_drain_write_buffer();
|
||||||
//ahb_memflush(MEMORY);
|
ahb_memflush(MEMORY);
|
||||||
irq_restore(cookie);
|
irq_restore(cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ void dc_invalidaterange(void *start, u32 size)
|
|||||||
void *end = ALIGN_FORWARD(((u8*)start) + size, LINESIZE);
|
void *end = ALIGN_FORWARD(((u8*)start) + size, LINESIZE);
|
||||||
start = ALIGN_BACKWARD(start, LINESIZE);
|
start = ALIGN_BACKWARD(start, LINESIZE);
|
||||||
_dc_inval_entries(start, (end - start) / LINESIZE);
|
_dc_inval_entries(start, (end - start) / LINESIZE);
|
||||||
//_magic_bullshit(0);
|
_magic_bullshit(0);
|
||||||
irq_restore(cookie);
|
irq_restore(cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ void dc_flushall(void)
|
|||||||
u32 cookie = irq_kill();
|
u32 cookie = irq_kill();
|
||||||
_dc_flush();
|
_dc_flush();
|
||||||
_drain_write_buffer();
|
_drain_write_buffer();
|
||||||
//ahb_memflush(MEMORY);
|
ahb_memflush(MEMORY);
|
||||||
irq_restore(cookie);
|
irq_restore(cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ void ic_invalidateall(void)
|
|||||||
{
|
{
|
||||||
u32 cookie = irq_kill();
|
u32 cookie = irq_kill();
|
||||||
_ic_inval();
|
_ic_inval();
|
||||||
//_magic_bullshit(0);
|
_magic_bullshit(0);
|
||||||
irq_restore(cookie);
|
irq_restore(cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,6 +274,7 @@ void mem_initialize(void)
|
|||||||
map_section(0xfff, 0xfff, 0x001, WRITEBACK_CACHE | DOMAIN(0) | AP_RWUSER);
|
map_section(0xfff, 0xfff, 0x001, WRITEBACK_CACHE | DOMAIN(0) | AP_RWUSER);
|
||||||
|
|
||||||
set_dacr(0xFFFFFFFF); //manager access for all domains, ignore AP
|
set_dacr(0xFFFFFFFF); //manager access for all domains, ignore AP
|
||||||
|
set_ttbr((u32)__page_table); //configure translation table
|
||||||
|
|
||||||
_drain_write_buffer();
|
_drain_write_buffer();
|
||||||
|
|
||||||
|
2
memory.h
2
memory.h
@ -15,7 +15,7 @@ enum AHBDEV {
|
|||||||
RAWF = 0x10F,
|
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_invalidaterange(void *start, u32 size);
|
||||||
void dc_flushall(void);
|
void dc_flushall(void);
|
||||||
void ic_invalidateall(void);
|
void ic_invalidateall(void);
|
||||||
|
3
sdhc.c
3
sdhc.c
@ -1076,12 +1076,14 @@ int sd_read(sdhci_t *sdhci, u32 start_block, u32 blk_cnt, void *buffer)
|
|||||||
if(sdhci->is_sdhc == 0)
|
if(sdhci->is_sdhc == 0)
|
||||||
start_block *= 512;
|
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));
|
retval = __sd_cmd(sdhci, SD_CMD_READ_MULTIPLE_BLOCK, SD_R1 | SD_READ, start_block, blk_cnt, buffer, &response, sizeof(response));
|
||||||
|
|
||||||
if(retval < 0)
|
if(retval < 0)
|
||||||
sdhc_debug(sdhci->reg_base, "reading blocks failed with %d.", retval);
|
sdhc_debug(sdhci->reg_base, "reading blocks failed with %d.", retval);
|
||||||
__sd_print_status(sdhci);
|
__sd_print_status(sdhci);
|
||||||
|
|
||||||
|
|
||||||
return retval;
|
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)
|
if(sdhci->is_sdhc == 0)
|
||||||
start_block *= 512;
|
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));
|
retval = __sd_cmd(sdhci, SD_CMD_WRITE_MULTIPLE_BLOCK, SD_R1, start_block, blk_cnt, (void *)buffer, &response, sizeof(response));
|
||||||
|
|
||||||
if(retval < 0)
|
if(retval < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user