use the FPGA registers to determine the number slots, which are used as private memory
This commit is contained in:
parent
7b2dfe4497
commit
01a7530d63
2 changed files with 39 additions and 15 deletions
|
@ -63,11 +63,6 @@ extern "C" {
|
|||
#define SHMADD
|
||||
#define SHMDBG
|
||||
//#define SHMADD_CACHEABLE
|
||||
/* default values for 16 GB system */
|
||||
#define PRIVATE_MEM1_START 0x00000000
|
||||
#define PRIVATE_MEM1_END 0x13FFFFFF
|
||||
#define PRIVATE_MEM2_START 0xFF000000
|
||||
#define PRIVATE_MEM2_END 0xFFFFFFFF
|
||||
#define SCC_BOOTINFO 0x80000
|
||||
|
||||
#define BUILTIN_EXPECT(exp, b) __builtin_expect((exp), (b))
|
||||
|
|
49
mm/memory.c
49
mm/memory.c
|
@ -30,6 +30,9 @@
|
|||
#include <asm/multiboot.h>
|
||||
#endif
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
#include <asm/RCCE.h>
|
||||
#include <asm/RCCE_lib.h>
|
||||
#include <asm/SCC_API.h>
|
||||
#include <asm/icc.h>
|
||||
#endif
|
||||
|
||||
|
@ -93,6 +96,7 @@ int mmu_init(void)
|
|||
size_t kernel_size;
|
||||
unsigned int i;
|
||||
size_t addr;
|
||||
int ret;
|
||||
|
||||
// at first, set default value of the bitmap
|
||||
memset(bitmap, 0xFF, sizeof(uint8_t)*BITMAP_SIZE);
|
||||
|
@ -148,15 +152,8 @@ int mmu_init(void)
|
|||
}
|
||||
}
|
||||
#elif defined(CONFIG_ROCKCREEK)
|
||||
for(addr=PRIVATE_MEM1_START; addr<PRIVATE_MEM1_END; 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);
|
||||
}
|
||||
|
||||
for(addr=PRIVATE_MEM2_START; addr<PRIVATE_MEM2_END; addr+=PAGE_SIZE) {
|
||||
/* of course, the first slot belongs to the private memory */
|
||||
for(addr=0x00; addr<0x1000000; addr+=PAGE_SIZE) {
|
||||
page_clear_mark(addr >> PAGE_SHIFT);
|
||||
if (addr > addr + PAGE_SIZE)
|
||||
break;
|
||||
|
@ -200,7 +197,39 @@ int mmu_init(void)
|
|||
if ((size_t) &kernel_end & (PAGE_SIZE-1))
|
||||
alloc_start++;
|
||||
|
||||
return paging_init();
|
||||
ret = paging_init();
|
||||
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
/*
|
||||
* Now, we are able to read the FPGA register and to
|
||||
* determin the number of slots.
|
||||
*/
|
||||
uint32_t slots = *((volatile uint32_t*) (FPGA_BASE + 0x8244));
|
||||
if (slots == 0)
|
||||
slots = 21;
|
||||
|
||||
kprintf("MetalSVM use %d slots for private memory\n", slots);
|
||||
|
||||
// define all the private slots as free
|
||||
for(addr=0x1000000; addr<(slots-1)*0x1000000; 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);
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue