fix bug in reading the FPGA registers to determine the size of the private memory
This commit is contained in:
parent
5c3c757cbb
commit
d641f5a211
1 changed files with 5 additions and 14 deletions
19
mm/memory.c
19
mm/memory.c
|
@ -152,8 +152,8 @@ int mmu_init(void)
|
|||
}
|
||||
}
|
||||
#elif defined(CONFIG_ROCKCREEK)
|
||||
/* of course, the first twenty slots belong to the private memory */
|
||||
for(addr=0x00; addr<20*0x1000000; addr+=PAGE_SIZE) {
|
||||
/* of course, the first slots belong to the private memory */
|
||||
for(addr=0x00; addr<1*0x1000000; addr+=PAGE_SIZE) {
|
||||
page_clear_mark(addr >> PAGE_SHIFT);
|
||||
if (addr > addr + PAGE_SIZE)
|
||||
break;
|
||||
|
@ -161,15 +161,6 @@ int mmu_init(void)
|
|||
atomic_int32_inc(&total_available_pages);
|
||||
}
|
||||
|
||||
// Note: The last slot belongs always to the private memory.
|
||||
for(addr=0xFF000000; addr<0xFFFFFFFF; addr+=PAGE_SIZE) {
|
||||
page_clear_mark(addr >> PAGE_SHIFT);
|
||||
if (addr > addr + PAGE_SIZE)
|
||||
break;
|
||||
atomic_int32_inc(&total_pages);
|
||||
atomic_int32_inc(&total_available_pages);
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark the bootinfo as used.
|
||||
*/
|
||||
|
@ -219,14 +210,14 @@ int mmu_init(void)
|
|||
* Now, we are able to read the FPGA registers and to
|
||||
* determine the number of slots for private memory.
|
||||
*/
|
||||
uint32_t slots = *((volatile uint32_t*) (FPGA_BASE + 0x8244));
|
||||
uint32_t slots = *((volatile uint8_t*) (FPGA_BASE + 0x8244));
|
||||
if (slots == 0)
|
||||
slots = 21;
|
||||
slots = 1;
|
||||
|
||||
kprintf("MetalSVM use %d slots for private memory\n", slots);
|
||||
|
||||
// define the residual private slots as free
|
||||
for(addr=20*0x1000000; addr<(slots-1)*0x1000000; addr+=PAGE_SIZE) {
|
||||
for(addr=1*0x1000000; addr<slots*0x1000000; addr+=PAGE_SIZE) {
|
||||
page_clear_mark(addr >> PAGE_SHIFT);
|
||||
if (addr > addr + PAGE_SIZE)
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue