Skip to content

Commit

Permalink
Fix reading EMPATH data from fused odd numbered cores
Browse files Browse the repository at this point in the history
Change-Id: I1014ed6adf3fc7b22356f907532aa6f88259462c
CQ: FW678428
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/58054
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
  • Loading branch information
dgilbert999 authored and marthabroyles committed May 3, 2018
1 parent 8aa6ad0 commit ba4bad1
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/include/core_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#define TOD_VALUE_REG 0x00040020
#define STOP_STATE_HIST_OCC_REG 0x000F0112

#define SELECT_ODD_CORE 0x100
#define CORE_RAW_CYCLES 0x200
#define CORE_RUN_CYCLES 0x208
#define CORE_WORKRATE_BUSY 0x210
Expand Down Expand Up @@ -88,6 +89,13 @@

#define WORKAROUND_SCOM_ADDRESS 0x10800

typedef enum
{
FUSED_UNKNOWN,
FUSED_FALSE,
FUSED_TRUE
} FusedCore;

typedef struct
{
uint32_t tod_2mhz;
Expand Down
8 changes: 6 additions & 2 deletions src/include/registers/cppm_firmware_registers.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ typedef union cppm_cpmmr {
#ifdef _BIG_ENDIAN
uint64_t ppm_write_disable : 1;
uint64_t ppm_write_override : 1;
uint64_t reserved1 : 10;
uint64_t reserved0 : 7;
uint64_t fused_core_mode : 1;
uint64_t reserved1 : 2;
uint64_t cme_err_notify_dis : 1;
uint64_t wkup_notify_select : 1;
uint64_t enable_pece : 1;
Expand All @@ -73,7 +75,9 @@ typedef union cppm_cpmmr {
uint64_t enable_pece : 1;
uint64_t wkup_notify_select : 1;
uint64_t cme_err_notify_dis : 1;
uint64_t reserved1 : 10;
uint64_t reserved1 : 2;
uint64_t fused_core_mode : 1;
uint64_t reserved0 : 7;
uint64_t ppm_write_override : 1;
uint64_t ppm_write_disable : 1;
#endif // _BIG_ENDIAN
Expand Down
2 changes: 1 addition & 1 deletion src/occ_405/occbuildname.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ volatile const char G_occ_buildname[16] __attribute__((section(".buildname"))) =

#else

volatile const char G_occ_buildname[16] __attribute__((section(".buildname"))) = /*<BuildName>*/ "op_occ_180425a\0" /*</BuildName>*/ ;
volatile const char G_occ_buildname[16] __attribute__((section(".buildname"))) = /*<BuildName>*/ "op_occ_180501a\0" /*</BuildName>*/ ;

#endif
31 changes: 30 additions & 1 deletion src/occ_gpe0/core_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@
#include "ppe42_msr.h"
#include "ppe42_scom.h"
#include "cme_register_addresses.h"
#include "cppm_register_addresses.h"
#include "cppm_firmware_registers.h"
#include "pk.h"

#define CME_VDSR_BASE (CME_SCOM_VDSR & 0x00ffffff)

// Global variables
uint32_t g_vdm_cache_large_droop_count[MAX_NUM_QUADS]__attribute__((section (".sbss")));
uint32_t g_vdm_core_small_droop_count[MAX_NUM_CORES]__attribute__((section (".sbss")));
int g_fused_core = FUSED_UNKNOWN;

uint32_t get_core_data(uint32_t i_core,
CoreData* o_data)
Expand Down Expand Up @@ -163,7 +166,33 @@ uint32_t get_core_data(uint32_t i_core,
// Send command to select which emmpath counter to read
do
{
uint64_t empath_scom_data = CORE_RAW_CYCLES;
uint64_t empath_scom_data = CORE_RAW_CYCLES;

if(FUSED_UNKNOWN == g_fused_core)
{
cppm_cpmmr_t cpmmr;
rc = getscom(coreSelect, CPPM_CPMMR, &(cpmmr.value));
if (rc)
{
// Retry on next tick
break;
}

if (1 == cpmmr.fields.fused_core_mode)
{
g_fused_core = FUSED_TRUE;
}
else
{
g_fused_core = FUSED_FALSE;
}
}

if(g_fused_core == FUSED_TRUE && ((i_core % 2) != 0))
{
empath_scom_data |= SELECT_ODD_CORE;
}

rc = putscom(coreSelect, PC_OCC_SPRC, empath_scom_data);
if (rc)
{
Expand Down

0 comments on commit ba4bad1

Please sign in to comment.