diff options
-rwxr-xr-x | src/common/gpe_export.h | 10 | ||||
-rwxr-xr-x | src/occ_405/linkocc.cmd | 25 | ||||
-rwxr-xr-x | src/occ_405/main.c | 7 | ||||
-rwxr-xr-x | src/occ_405/sensor/sensor_info.c | 22 | ||||
-rw-r--r-- | src/occ_gpe0/gpe0_main.c | 19 | ||||
-rw-r--r-- | src/occ_gpe1/gpe1_main.c | 17 |
6 files changed, 81 insertions, 19 deletions
diff --git a/src/common/gpe_export.h b/src/common/gpe_export.h index 9c53f77..e411abf 100755 --- a/src/common/gpe_export.h +++ b/src/common/gpe_export.h @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/gpe_export.h $ */ +/* $Source: src/common/gpe_export.h $ */ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2016 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -56,4 +56,10 @@ typedef struct nop GpeErrorStruct error; // Error of operation } nop_t; +typedef struct gpe_shared_data +{ + uint32_t nest_freq_div; // Nest freq / 4 + uint32_t reserved[63]; +} gpe_shared_data_t; + #endif //_GPE_EXPORT_H diff --git a/src/occ_405/linkocc.cmd b/src/occ_405/linkocc.cmd index 3c4556c..9c68116 100755 --- a/src/occ_405/linkocc.cmd +++ b/src/occ_405/linkocc.cmd @@ -543,7 +543,30 @@ SECTIONS _SSX_FREE_END = _PING_PONG_BUFFER_BASE - 1; - //////////////////////////////// + //////////////////////////////// + // Shared GPE data + // + // Section for sharing data with GPEs before IPC commands can be used + // NOTE: If this location is changed, the #define for the address + // needs to be changed in gpe0_main.c and gpe1_main.c. + //////////////////////////////// + __CUR_COUNTER__ = .; + _GPE_SHARED_DATA_BASE = 0xfffb3c00; + _GPE_SHARED_DATA_SIZE = 0x100; + . = _GPE_SHARED_DATA_BASE; +#if !PPC405_MMU_SUPPORT + . = . - writethrough_offset; + _LMA = . + writethrough_offset; + .gpe_shared . : AT(_LMA) {*(gpe_shared) . = ALIGN(_GPE_SHARED_DATA_SIZE);} + . = . + writethrough_offset; +#else + .gpe_shared . : {*(gpe_shared) . = ALIGN(_GPE_SHARED_DATA_SIZE);} > sram +#endif + . = __CUR_COUNTER__; + + + + //////////////////////////////// // Ping/Pong Buffer Section // // Contains two 256-byte buffers used to tell the PGPE which vfrt to use diff --git a/src/occ_405/main.c b/src/occ_405/main.c index 873e65d..ba36b59 100755 --- a/src/occ_405/main.c +++ b/src/occ_405/main.c @@ -104,7 +104,8 @@ extern uint16_t G_proc_fmax_mhz; // max(turbo,uturbo) frequencies // Set main thread timer for one second #define MAIN_THRD_TIMER_SLICE ((SsxInterval) SSX_SECONDS(1)) - +// Define location for data shared with GPEs +gpe_shared_data_t G_shared_gpe_data __attribute__ ((section (".gpe_shared"))); // SIMICS printf/printk SimicsStdio G_simics_stdout; @@ -1796,6 +1797,10 @@ int main(int argc, char **argv) 0, l_tb_freq_hz); + // Store the nest / 4 frequency in shared SRAM so the GPEs + // can be initialized with the correct timebase as well. + G_shared_gpe_data.nest_freq_div = l_tb_freq_hz; + CHECKPOINT(SSX_INITIALIZED); // TRAC_XXX needs ssx services, traces can only be done after ssx_initialize TRAC_init_buffers(); diff --git a/src/occ_405/sensor/sensor_info.c b/src/occ_405/sensor/sensor_info.c index a457c20..a664f69 100755 --- a/src/occ_405/sensor/sensor_info.c +++ b/src/occ_405/sensor/sensor_info.c @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2016 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -86,25 +86,25 @@ // (one for each core...) The base name of the sensor enum must be passed // and this macro will take care of the paste & stringify operations. #define SENS_CORE_ENTRY_SET(sensor_name, units, type, location, number, frequency, scaleFactor) \ - [SENSOR_W_NUM(sensor_name,0)] = {.name = SENSOR_STRING(sensor_name ## 0), \ + [SENSOR_W_NUM(sensor_name,0)] = {.name = SENSOR_STRING(sensor_name ## 00), \ .sensor = { units, type, location, number, frequency, scaleFactor },}, \ - [SENSOR_W_NUM(sensor_name,1)] = {.name = SENSOR_STRING(sensor_name ## 1), \ + [SENSOR_W_NUM(sensor_name,1)] = {.name = SENSOR_STRING(sensor_name ## 01), \ .sensor = { units, type, location, number, frequency, scaleFactor },}, \ - [SENSOR_W_NUM(sensor_name,2)] = {.name = SENSOR_STRING(sensor_name ## 2), \ + [SENSOR_W_NUM(sensor_name,2)] = {.name = SENSOR_STRING(sensor_name ## 02), \ .sensor = { units, type, location, number, frequency, scaleFactor },}, \ - [SENSOR_W_NUM(sensor_name,3)] = {.name = SENSOR_STRING(sensor_name ## 3), \ + [SENSOR_W_NUM(sensor_name,3)] = {.name = SENSOR_STRING(sensor_name ## 03), \ .sensor = { units, type, location, number, frequency, scaleFactor },}, \ - [SENSOR_W_NUM(sensor_name,4)] = {.name = SENSOR_STRING(sensor_name ## 4), \ + [SENSOR_W_NUM(sensor_name,4)] = {.name = SENSOR_STRING(sensor_name ## 04), \ .sensor = { units, type, location, number, frequency, scaleFactor },}, \ - [SENSOR_W_NUM(sensor_name,5)] = {.name = SENSOR_STRING(sensor_name ## 5), \ + [SENSOR_W_NUM(sensor_name,5)] = {.name = SENSOR_STRING(sensor_name ## 05), \ .sensor = { units, type, location, number, frequency, scaleFactor },}, \ - [SENSOR_W_NUM(sensor_name,6)] = {.name = SENSOR_STRING(sensor_name ## 6), \ + [SENSOR_W_NUM(sensor_name,6)] = {.name = SENSOR_STRING(sensor_name ## 06), \ .sensor = { units, type, location, number, frequency, scaleFactor },}, \ - [SENSOR_W_NUM(sensor_name,7)] = {.name = SENSOR_STRING(sensor_name ## 7), \ + [SENSOR_W_NUM(sensor_name,7)] = {.name = SENSOR_STRING(sensor_name ## 07), \ .sensor = { units, type, location, number, frequency, scaleFactor },}, \ - [SENSOR_W_NUM(sensor_name,8)] = {.name = SENSOR_STRING(sensor_name ## 8), \ + [SENSOR_W_NUM(sensor_name,8)] = {.name = SENSOR_STRING(sensor_name ## 08), \ .sensor = { units, type, location, number, frequency, scaleFactor },}, \ - [SENSOR_W_NUM(sensor_name,9)] = {.name = SENSOR_STRING(sensor_name ## 9), \ + [SENSOR_W_NUM(sensor_name,9)] = {.name = SENSOR_STRING(sensor_name ## 09), \ .sensor = { units, type, location, number, frequency, scaleFactor },}, \ [SENSOR_W_NUM(sensor_name,10)] = {.name = SENSOR_STRING(sensor_name ## 10), \ .sensor = { units, type, location, number, frequency, scaleFactor },}, \ diff --git a/src/occ_gpe0/gpe0_main.c b/src/occ_gpe0/gpe0_main.c index 398f137..5cb0174 100644 --- a/src/occ_gpe0/gpe0_main.c +++ b/src/occ_gpe0/gpe0_main.c @@ -32,6 +32,7 @@ #include "pk.h" #include "ipc_api.h" #include "ipc_ping.h" +#include "gpe_export.h" #define KERNEL_STACK_SIZE 256 #define MAIN_THREAD_STACK_SIZE 512 @@ -40,6 +41,12 @@ uint8_t G_kernel_stack[KERNEL_STACK_SIZE]; uint8_t G_main_thread_stack[MAIN_THREAD_STACK_SIZE]; PkThread G_main_thread; +//Point to the GPE shared structure +#define GPE_SHARED_DATA_ADDR 0xFFFB3C00 +#define GPE_SHARED_DATA_SIZE 256 + +gpe_shared_data_t * G_gpe_shared_data = (gpe_shared_data_t*) GPE_SHARED_DATA_ADDR; + //statically initialize a ping command message IPC_PING_CMD_CREATE(G_ping_cmd); @@ -68,14 +75,22 @@ void main_thread(void* arg) int main(int argc, char **argv) { int rc; + uint32_t l_timebase = G_gpe_shared_data->nest_freq_div; + + // Don't initialize with a 0 + if (!l_timebase) + { + l_timebase = PPE_TIMEBASE_HZ; + } + // initializes kernel data (stack, threads, timebase, timers, etc.) pk_initialize((PkAddress)G_kernel_stack, KERNEL_STACK_SIZE, PK_TIMEBASE_CONTINUES, - PPE_TIMEBASE_HZ); + l_timebase); - PK_TRACE("Kernel init completed"); + PK_TRACE("Kernel init completed, timebase is %d Hz", l_timebase); // Disable IPC's and register the IPC interrupt handler rc = ipc_init(); diff --git a/src/occ_gpe1/gpe1_main.c b/src/occ_gpe1/gpe1_main.c index a7a3ff5..e35720d 100644 --- a/src/occ_gpe1/gpe1_main.c +++ b/src/occ_gpe1/gpe1_main.c @@ -31,25 +31,38 @@ #include "pk.h" #include "ipc_api.h" +#include "gpe_export.h" #define KERNEL_STACK_SIZE 256 uint8_t G_kernel_stack[KERNEL_STACK_SIZE]; +//Point to the GPE shared structure +#define GPE_SHARED_DATA_ADDR 0xFFFB3C00 +#define GPE_SHARED_DATA_SIZE 256 + +gpe_shared_data_t * G_gpe_shared_data = (gpe_shared_data_t*) GPE_SHARED_DATA_ADDR; // The main function is called by the boot code (after initializing some // registers) int main(int argc, char **argv) { int rc; + uint32_t l_timebase = G_gpe_shared_data->nest_freq_div; + + // Don't initialize with a 0 + if (!l_timebase) + { + l_timebase = PPE_TIMEBASE_HZ; + } // initializes kernel data (stack, threads, timebase, timers, etc.) pk_initialize((PkAddress)G_kernel_stack, KERNEL_STACK_SIZE, PK_TIMEBASE_CONTINUES, - PPE_TIMEBASE_HZ); + l_timebase); - PK_TRACE("Kernel init completed"); + PK_TRACE("Kernel init completed, timebase is %d Hz", l_timebase); // Disable IPC's and register the IPC interrupt handler rc = ipc_init(); |