From 2357d65a09d911cfa190cdc8fcd0340c502afce7 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Tue, 24 May 2011 15:04:44 -0700 Subject: [PATCH 1/3] add baremetal version of coreid, readLUT and writeLUT --- arch/x86/scc/RCCE_admin.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/arch/x86/scc/RCCE_admin.c b/arch/x86/scc/RCCE_admin.c index 34f0e677..a9a624ae 100644 --- a/arch/x86/scc/RCCE_admin.c +++ b/arch/x86/scc/RCCE_admin.c @@ -337,7 +337,7 @@ int RCCE_init( RCCE_shmalloc_init(RC_SHM_BUFFER_START()+RCCE_SHM_BUFFER_offset ,RCCE_SHM_SIZE_MAX); #ifdef SHMDBG - printf("\n%d:%s:%d: RCCE_SHM_BUFFER_offset, RCCE_SHM_SIZE_MAX: % x %x\n", RCCE_IAM, + kprintf("\n%d:%s:%d: RCCE_SHM_BUFFER_offset, RCCE_SHM_SIZE_MAX: % x %x\n", RCCE_IAM, __FILE__,__LINE__,RCCE_SHM_BUFFER_offset ,RCCE_SHM_SIZE_MAX); #endif #else @@ -439,8 +439,10 @@ int RCCE_num_ues(void) {return(RCCE_NP);} //-------------------------------------------------------------------------------------- void writeLUT(unsigned int lutSlot, unsigned int value) { -int PAGE_SIZE, NCMDeviceFD; +#ifndef MS_BAREMETAL +int page_size, NCMDeviceFD; // NCMDeviceFD is the file descriptor for non-cacheable memory (e.g. config regs). +#endif unsigned int result; @@ -453,6 +455,7 @@ unsigned int myCoreID, alignedAddr, pageOffset, ConfigAddr; else ConfigAddr = CRB_OWN+LUT0 + (lutSlot*0x08); +#ifndef MS_BAREMETAL PAGE_SIZE = getpagesize(); if ((NCMDeviceFD=open("/dev/rckncm", O_RDWR|O_SYNC))<0) { @@ -471,16 +474,19 @@ unsigned int myCoreID, alignedAddr, pageOffset, ConfigAddr; *(int*)(MappedAddr+pageOffset) = value; munmap((void*)MappedAddr, PAGE_SIZE); - +#else + *(int*)(ConfigAddr) = value; +#endif } //-------------------------------------------------------------------------------------- // FUNCTION: readLUT //-------------------------------------------------------------------------------------- unsigned int readLUT(unsigned int lutSlot) { - +#ifndef MS_BAREMETAL int PAGE_SIZE, NCMDeviceFD; // NCMDeviceFD is the file descriptor for non-cacheable memory (e.g. config regs). +#endif unsigned int result; t_vcharp MappedAddr; @@ -492,6 +498,7 @@ unsigned int myCoreID, alignedAddr, pageOffset, ConfigAddr; else ConfigAddr = CRB_OWN+LUT0 + (lutSlot*0x08); +#ifndef MS_BAREMETAL PAGE_SIZE = getpagesize(); if ((NCMDeviceFD=open("/dev/rckncm", O_RDWR|O_SYNC))<0) { @@ -510,6 +517,9 @@ unsigned int myCoreID, alignedAddr, pageOffset, ConfigAddr; result = *(unsigned int*)(MappedAddr+pageOffset); munmap((void*)MappedAddr, PAGE_SIZE); +#else + result = *(unsigned int*)(ConfigAddr); +#endif return result; } @@ -519,14 +529,16 @@ unsigned int myCoreID, alignedAddr, pageOffset, ConfigAddr; //-------------------------------------------------------------------------------------- unsigned int getCOREID() { +#ifndef MS_BAREMETAL int PAGE_SIZE, NCMDeviceFD; // NCMDeviceFD is the file descriptor for non-cacheable memory (e.g. config regs). - +#endif t_vcharp MappedAddr; unsigned int coreID,result, alignedAddr, pageOffset, ConfigAddr, coreID_mask=0x00000007; ConfigAddr = CRB_OWN+MYTILEID; +#ifndef MS_BAREMETAL PAGE_SIZE = getpagesize(); if ((NCMDeviceFD=open("/dev/rckncm", O_RDWR|O_SYNC))<0) { @@ -545,6 +557,9 @@ unsigned int coreID,result, alignedAddr, pageOffset, ConfigAddr, coreID_mask=0x result = *(unsigned int*)(MappedAddr+pageOffset); munmap((void*)MappedAddr, PAGE_SIZE); +#else + result = *(unsigned int*)(ConfigAddr); +#endif coreID = result & coreID_mask; return coreID; From f51b24a45f0aeced7a2c11113eb8e02a90a32bc8 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Tue, 24 May 2011 15:05:29 -0700 Subject: [PATCH 2/3] using of kprintf instead of printf --- arch/x86/scc/RCCE_shmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/scc/RCCE_shmalloc.c b/arch/x86/scc/RCCE_shmalloc.c index 915eef1d..c0e13309 100644 --- a/arch/x86/scc/RCCE_shmalloc.c +++ b/arch/x86/scc/RCCE_shmalloc.c @@ -56,7 +56,7 @@ void RCCE_shmalloc_init( /* make a circular list by connecting tail to itself */ RCCE_spacep->tail->next = RCCE_spacep->tail; #ifdef SHMDBG -printf("%s: %d: RCCE_spacep->tail->free_size, RCCE_spacep->tail->space: %x %x\n", +kprintf("%s: %d: RCCE_spacep->tail->free_size, RCCE_spacep->tail->space: %x %x\n", __FILE__, __LINE__,RCCE_spacep->tail->free_size, RCCE_spacep->tail->space); #endif } From 5d702411ab72ea3e7b11919767f5dd807e7e3cab Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Wed, 25 May 2011 15:28:20 -0700 Subject: [PATCH 3/3] enable in RCCE the shared memory support --- include/metalsvm/config.h.example | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/metalsvm/config.h.example b/include/metalsvm/config.h.example index bb405699..f5b35948 100644 --- a/include/metalsvm/config.h.example +++ b/include/metalsvm/config.h.example @@ -60,7 +60,8 @@ extern "C" { #define SCC #define MS_BAREMETAL //#define GORY -//#define SHMADD +#define SHMADD +#define SHMDBG //#define SHMADD_CACHEABLE /* default values for 16 GB system */ #define PRIVATE_MEM1_START 0x00000000