Skip to content

Commit

Permalink
P9a GPE support for up to 16 OCMBs
Browse files Browse the repository at this point in the history
Change-Id: I627143674e883b5baec3a44e4884ac26f1b9aab5
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/80212
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christopher J Cain <cjcain@us.ibm.com>
Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
  • Loading branch information
dgilbert999 authored and marthabroyles committed Jul 23, 2019
1 parent 7888141 commit 0ac1770
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 69 deletions.
31 changes: 18 additions & 13 deletions src/common/membuf_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
#include "gpe_pba_parms.h"
#include "centaur_firmware_registers.h"

#define OCCHW_N_MEMBUF 8
#define OCCHW_N_MEMBUF 16
#define OCCHW_N_CENT 8
#define OCCHW_N_MC_CHANNEL 8
#define OCCHW_N_MC_PORT 4

#define MEMTYPE_CENTAUR 1
#define MEMTYPE_OCMB 2
Expand Down Expand Up @@ -71,7 +74,7 @@ typedef struct
// and module_id.
// (Not used on OCMB)
///
uint64_t deviceId[OCCHW_N_MEMBUF];
uint64_t deviceId[OCCHW_N_CENT];

/// Designated sync scom address
/// \note One and Only one of the MCS units can be targeted with SYNC
Expand All @@ -97,18 +100,16 @@ typedef struct
/// A GpePbaParms parameter block for inband scom.
GpePbaParms scomParms;

// Digital Thermal Sensor configuration bitmap.
// use CONFIG_UBDTS0(n) CONFIG_MEMDTS0(n) CONFIG_MEMDTS1(n) to set/test
uint64_t dts_config;

/// A "chip configuration" bit mask denoting valid memory buffer.
///
/// It shoud always be true that a bit denoting a configured memory buffer
// is associated with a non-0 \a baseAddress and vice-versa.
uint32_t config;

// Digital Thermal Sensor configuration bitmap.
// use CONFIG_UBDTS0(n) CONFIG_MEMDTS0(n) CONFIG_MEMDTS1(n) to set/test
uint32_t dts_config;

uint32_t reserved; // Keep structure size multiple of 8

/// The final return code from gpe_*_configuration_create().
/// @see MemBufConfigurationCreateRc
/// If initialization fails then this value can be used to diagnose what
Expand Down Expand Up @@ -218,22 +219,26 @@ typedef enum
#define PBA_SLAVE_MEMBUF 2

// These are used to setup MemBufConfiguration.config field
#define CHIP_CONFIG_MCS_BASE 16
// [0:7] Mainstore Controller Channel is configured.
// [16:31] Memory Buffer chip is configured.
#define CHIP_CONFIG_MCS_BASE 0
#define CHIP_CONFIG_MCS(n) \
((0x80000000ul >> CHIP_CONFIG_MCS_BASE) >> (n))

#define CHIP_CONFIG_MEMBUF_BASE 24
#define CHIP_CONFIG_MEMBUF_BASE 16
#define CHIP_CONFIG_MEMBUF(n) \
((0x80000000ul >> CHIP_CONFIG_MEMBUF_BASE) >> (n))


// These are used to setup the MemBufConfiguration.dts_config
#define CONFIG_UBDTS0(n) \
(0x80000000ul >> (4*n))
(0x8000000000000000ull >> (4*n))

#define CONFIG_MEMDTS0(n) \
(0x40000000ul >> (4*n))
(0x4000000000000000ull >> (4*n))

#define CONFIG_MEMDTS1(n) \
(0x20000000ul >> (4*n))
(0x2000000000000000ull >> (4*n))

#endif

Expand Down
41 changes: 22 additions & 19 deletions src/occ_405/cent/ocmb_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,39 +57,42 @@ void ocmb_init(void)
{
TRAC_INFO("ocmb_init: Initializing Memory Data Controller");
// Create configuration data use G_membufConfiguration
G_membufConfiguration.config = 0;

for(membuf_idx = 0; membuf_idx<MAX_NUM_OCMBS; ++membuf_idx)
{
if(CENTAUR_PRESENT(membuf_idx)) //based on HTMGT config cmd
{
G_membufConfiguration.config |= CHIP_CONFIG_MEMBUF(membuf_idx);
}
}

rc = membuf_configuration_create(&G_membufConfiguration);
if( rc )
{
break;
}

// Configure OCC_405 global membuf present and sensor enabled flags
G_present_centaurs = 0;
for(membuf_idx=0; membuf_idx<MAX_NUM_OCMBS; ++membuf_idx)
{
// Check if this membuf is even possible to be present
if( CENTAUR_BY_MASK(membuf_idx) )
if( G_membufConfiguration.baseAddress[membuf_idx] )
{
if( G_membufConfiguration.baseAddress[membuf_idx] )
// A valid inband Bar Address was found, check which DTS are
// enabled.
if(G_membufConfiguration.dts_config & CONFIG_MEMDTS0(membuf_idx))
{
G_dimm_enabled_sensors.bytes[membuf_idx] = DIMM_SENSOR0;
}
if(G_membufConfiguration.dts_config & CONFIG_MEMDTS1(membuf_idx))
{
// A valid inband Bar Address was found
G_present_centaurs |= (CENTAUR0_PRESENT_MASK >> membuf_idx);

if(G_membufConfiguration.dts_config & CONFIG_MEMDTS0(membuf_idx))
{
G_dimm_enabled_sensors.bytes[membuf_idx] = DIMM_SENSOR0;
}
if(G_membufConfiguration.dts_config & CONFIG_MEMDTS1(membuf_idx))
{
G_dimm_enabled_sensors.bytes[membuf_idx] = (DIMM_SENSOR0 >> 1);
}
TRAC_INFO("ocmb_init: Membuf[%d] Found.",
membuf_idx);
G_dimm_enabled_sensors.bytes[membuf_idx] = (DIMM_SENSOR0 >> 1);
}
TRAC_INFO("ocmb_init: Membuf[%d] Found.",
membuf_idx);
}
}

TRAC_IMP("ocmb_init: G_present_centaurs = 0x%08x", G_present_centaurs);
TRAC_IMP("ocmb_init: G_present_OCMBs = 0x%08x", G_present_centaurs);

G_dimm_present_sensors = G_dimm_enabled_sensors;

Expand Down
7 changes: 7 additions & 0 deletions src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,13 @@ errlHndl_t data_store_mem_cfg(const cmdh_fsp_cmd_t * i_cmd_ptr,
// Store the temperature sensor ID
g_amec->proc[0].memctl[l_membuf_num].centaur.temp_sid = l_data_set->temp_sensor_id;

if (G_sysConfigData.mem_type == MEM_TYPE_OCM)
{
// Both OCMB and Centaur code use this global to idicate which MBs
// are present, but Centaur sets this up later in centaur_init()
G_present_centaurs |= (CENTAUR0_PRESENT_MASK >> l_membuf_num);
}

l_num_mem_bufs++;
}
else // individual DIMM
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_190723a\0" /*</BuildName>*/ ;
volatile const char G_occ_buildname[16] __attribute__((section(".buildname"))) = /*<BuildName>*/ "op_occ_190723b\0" /*</BuildName>*/ ;

#endif
16 changes: 8 additions & 8 deletions src/occ_gpe1/gpe_centaur.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#define PBA_HOST_OCC_CFG 0x0000000002000000ull;


const uint32_t MCFGPR[OCCHW_N_MEMBUF] =
const uint32_t MCFGPR[OCCHW_N_MC_CHANNEL] =
{
MCS_0_MCRSVDE,
MCS_0_MCRSVDF,
Expand All @@ -53,15 +53,15 @@ const uint32_t MCFGPR[OCCHW_N_MEMBUF] =
MCS_3_MCRSVDF
};

const uint32_t MCSYNC[OCCHW_N_MEMBUF/2] =
const uint32_t MCSYNC[OCCHW_N_MC_PORT] =
{
MCS_0_MCSYNC,
MCS_1_MCSYNC,
MCS_2_MCSYNC,
MCS_3_MCSYNC
};

const uint32_t MCCHIFIR[OCCHW_N_MEMBUF] =
const uint32_t MCCHIFIR[OCCHW_N_MC_CHANNEL] =
{
MCP_CHAN0_CHI_FIR,
MCP_CHAN1_CHI_FIR,
Expand All @@ -73,7 +73,7 @@ const uint32_t MCCHIFIR[OCCHW_N_MEMBUF] =
MCP_CHAN7_CHI_FIR
};

const uint32_t MCMCICFG1Q[OCCHW_N_MEMBUF] =
const uint32_t MCMCICFG1Q[OCCHW_N_MC_CHANNEL] =
{
MCP_CHAN0_CHI_MCICFG1Q,
MCP_CHAN1_CHI_MCICFG1Q,
Expand Down Expand Up @@ -229,7 +229,7 @@ int gpe_centaur_configuration_create(MemBufConfiguration_t* o_config)
// hardware, as well as for our VBU models where some of the "valid"
// MCS are not in the simulation models.

for (i = 0; i < OCCHW_N_MEMBUF; ++i)
for (i = 0; i < OCCHW_N_CENT; ++i)
{
// check for channel checkstop
rc = check_centaur_channel_chkstp(i);
Expand Down Expand Up @@ -278,7 +278,7 @@ int gpe_centaur_configuration_create(MemBufConfiguration_t* o_config)
}

// Find the designated sync
for (i = 0; i < (OCCHW_N_MEMBUF/2); ++i)
for (i = 0; i < (OCCHW_N_MC_PORT); ++i)
{
uint64_t mcsync;
rc = getscom_abs(MCSYNC[i], &mcsync);
Expand Down Expand Up @@ -619,7 +619,7 @@ int get_centaur_sensorcache(MemBufConfiguration_t* i_config,

if(i_parms->collect != -1)
{
if((i_parms->collect >= OCCHW_N_MEMBUF) ||
if((i_parms->collect >= OCCHW_N_CENT) ||
(0 == (CHIP_CONFIG_MEMBUF(i_parms->collect) & (i_config->config))))
{
rc = MEMBUF_GET_MEM_DATA_COLLECT_INVALID;
Expand Down Expand Up @@ -662,7 +662,7 @@ int get_centaur_sensorcache(MemBufConfiguration_t* i_config,
if(i_parms->update != -1)
{
int update_rc = 0;
if((i_parms->update >= OCCHW_N_MEMBUF) ||
if((i_parms->update >= OCCHW_N_CENT) ||
(0 == (CHIP_CONFIG_MEMBUF(i_parms->update) & (i_config->config))))
{
update_rc = MEMBUF_GET_MEM_DATA_UPDATE_INVALID;
Expand Down
24 changes: 21 additions & 3 deletions src/occ_gpe1/gpe_membuf_scom.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ int membuf_get_scom_vector(MemBufConfiguration_t* i_config,
int access_rc = 0;
int pba_rc = 0;
int instance = 0;
int max_mb = OCCHW_N_MEMBUF;
uint64_t pba_slvctln_save;

pbaslvctl_reset(&(i_config->scomParms));
Expand All @@ -234,7 +235,12 @@ int membuf_get_scom_vector(MemBufConfiguration_t* i_config,
// clear SIB errors in MSR
mtmsr((mfmsr() & ~(MSR_SIBRC | MSR_SIBRCA)));

for(instance = 0; instance < OCCHW_N_MEMBUF; ++instance)
if(i_config->membuf_type == MEMTYPE_CENTAUR)
{
max_mb = OCCHW_N_CENT;
}

for(instance = 0; instance < max_mb; ++instance)
{
if( CHIP_CONFIG_MEMBUF(instance) & (i_config->config))
{
Expand Down Expand Up @@ -332,12 +338,18 @@ int membuf_put_scom_all(MemBufConfiguration_t* i_config,
int pba_rc = 0;
int access_rc = 0;
int instance = 0;
int max_mb = OCCHW_N_MEMBUF;
uint64_t pba_slvctln_save;

pbaslvctl_reset(&(i_config->scomParms));
pba_slvctln_save = pbaslvctl_setup(&(i_config->scomParms));

for(instance = 0; instance < OCCHW_N_MEMBUF; ++instance)
if(i_config->membuf_type == MEMTYPE_CENTAUR)
{
max_mb = OCCHW_N_CENT;
}

for(instance = 0; instance < max_mb; ++instance)
{
if( CHIP_CONFIG_MEMBUF(instance) & (i_config->config))
{
Expand Down Expand Up @@ -473,12 +485,18 @@ int membuf_scom_rmw_all(MemBufConfiguration_t* i_config,
int pba_rc = 0;
int access_rc = 0;
int instance = 0;
int max_mb = OCCHW_N_MEMBUF;
uint64_t pba_slvctln_save;

pbaslvctl_reset(&(i_config->scomParms));
pba_slvctln_save = pbaslvctl_setup(&(i_config->scomParms));

for(instance = 0; (instance < OCCHW_N_MEMBUF); ++instance)
if(i_config->membuf_type == MEMTYPE_CENTAUR)
{
max_mb = OCCHW_N_CENT;
}

for(instance = 0; (instance < max_mb); ++instance)
{
if( CHIP_CONFIG_MEMBUF(instance) & (i_config->config))
{
Expand Down

0 comments on commit 0ac1770

Please sign in to comment.