add code to initialize (i)RCCE and to test RCCE
This commit is contained in:
parent
f556608010
commit
622b403f08
2 changed files with 44 additions and 10 deletions
|
@ -17,7 +17,8 @@
|
|||
#include <metalsvm/processor.h>
|
||||
#include <metalsvm/errno.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/RCCE_lib.h>
|
||||
#include <asm/RCCE.h>
|
||||
#include <asm/iRCCE.h>
|
||||
#include <asm/SCC_API.h>
|
||||
|
||||
#ifdef CONFIG_ROCKCREEK
|
||||
|
@ -35,6 +36,9 @@ bootinfo_t* bootinfo = (bootinfo_t*) SCC_BOOTINFO;
|
|||
static int scc_clear(void)
|
||||
{
|
||||
int tmp, x, y, z, offset;
|
||||
|
||||
// Initialize API
|
||||
InitAPI(0);
|
||||
|
||||
// Find out who I am...
|
||||
tmp=ReadConfigReg(CRB_OWN+MYTILEID);
|
||||
|
@ -57,6 +61,9 @@ static int scc_clear(void)
|
|||
// Clear test&set register write. Next read-access will read "1" (lock granted).
|
||||
SetConfigReg(CRB_ADDR(x,y)+((z)?LOCK1:LOCK0), 1);
|
||||
|
||||
// frees Message Passing Buffer
|
||||
MPBunalloc(&MPB);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -64,31 +71,58 @@ int scc_init(void)
|
|||
{
|
||||
int num_ranks;
|
||||
int i, my_rank;
|
||||
uint64_t start, end, ticks, freq = 533;
|
||||
uint32_t cr4, msg = 0;
|
||||
|
||||
kputs("Initialize Rock Creek!\n");
|
||||
|
||||
/* Enable Messagepassing in CR4 */
|
||||
cr4 = read_cr4();
|
||||
cr4 = cr4 | _CR4_MPE;
|
||||
write_cr4(cr4);
|
||||
|
||||
kprintf("Initialize Rock Creek!\n");
|
||||
kprintf("address of the initrd: 0x%x\n", bootinfo->addr);
|
||||
kprintf("size of the initrd: %d\n", bootinfo->size);
|
||||
kprintf("rcce argc = %d\n", bootinfo->argc);
|
||||
for(i=0; i<bootinfo->argc; i++)
|
||||
kprintf("rcce argv[%d] = %s\n", i, bootinfo->argv[i]);
|
||||
|
||||
if (bootinfo->argc >= 3)
|
||||
freq = atoi(bootinfo->argv[2]);
|
||||
|
||||
kputs("Reset SCC!\n");
|
||||
scc_clear();
|
||||
kputs("Wait some time...\n");
|
||||
mb();
|
||||
start = rdtsc();
|
||||
do {
|
||||
mb();
|
||||
end = rdtsc();
|
||||
ticks = end > start ? end - start : start - end;
|
||||
} while(ticks*TIMER_FREQ < 1000ULL*freq*1000000ULL);
|
||||
kprintf("ticks %llu\n", ticks);
|
||||
|
||||
if (RCCE_init(&bootinfo->argc, &bootinfo->argv) != RCCE_SUCCESS)
|
||||
return -ENODEV;
|
||||
if (iRCCE_init() != iRCCE_SUCCESS)
|
||||
return -ENODEV;
|
||||
|
||||
my_rank = RCCE_ue();
|
||||
num_ranks = RCCE_num_ues();
|
||||
kprintf("Got rank %d of %d ranks\n", my_rank, num_ranks);
|
||||
|
||||
/* Enable Messagepassing in CR4 */
|
||||
uint32_t cr4 = read_cr4();
|
||||
cr4 = cr4 | _CR4_MPE;
|
||||
write_cr4(cr4);
|
||||
|
||||
i = ReadConfigReg(CRB_OWN+GLCFG0);
|
||||
kprintf("glcfg0 0x%x\n", i);
|
||||
|
||||
/* synchronize before starting MetalSVM: */
|
||||
//RCCE_barrier(&RCCE_COMM_WORLD);
|
||||
RCCE_barrier(&RCCE_COMM_WORLD);
|
||||
|
||||
kputs("RCCE test...\t");
|
||||
if (my_rank == 0)
|
||||
msg = 0x4711;
|
||||
if (RCCE_bcast((char*) &msg, sizeof(msg), 0, RCCE_COMM_WORLD) == RCCE_SUCCESS)
|
||||
kprintf("successfull! (0x%x)\n", msg);
|
||||
else
|
||||
kprintf("failed! (0x%x)\n", msg);
|
||||
|
||||
kputs("Now, the SCC is initialized!\n");
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ extern "C" {
|
|||
// RCCE specific flags
|
||||
#define SCC
|
||||
#define MS_BAREMETAL
|
||||
#define GORY
|
||||
//#define GORY
|
||||
//#define SHMADD
|
||||
//#define SHMADD_CACHEABLE
|
||||
/* default values for 16 GB system */
|
||||
|
|
Loading…
Add table
Reference in a new issue