Skip to content

Commit

Permalink
HDAT: Feature flag settings movement from PCRD to IPLP
Browse files Browse the repository at this point in the history
Added versioned HDIF header for Feature flag setting array.
Defined feature strings and settings agreed with OPAL

Change-Id: I08bccf55c661c1423eed9e4a4fe579f86d2ca924
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/50793
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Dean Sanner <dsanner@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
  • Loading branch information
nagendraIBM authored and wghoffa committed Dec 15, 2017
1 parent bd15194 commit aed872b
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 117 deletions.
92 changes: 92 additions & 0 deletions src/usr/hdat/hdatiplparms.C
Expand Up @@ -522,6 +522,81 @@ static errlHndl_t hdatGetPortInfo(HDAT::hdatHDIFDataArray_t &o_portArrayHdr,
return l_errlHndl;
}

/**
* @brief This routine gets the feature flag array based on processor type/DD
* level
*
* @pre None
*
* @post None
*
* @param o_featureFlagArr - output parameter - array of feature flags
*
*/
static void hdatGetFeatureFlagArray(const hdatIplpFeatureFlagSetting_t * o_featureFlagArr[],
uint32_t & o_size)
{
//Default to Nimbus DD2.2 settings (DD1.0 doesn't matter) and these are current
//settings for cumulus
*o_featureFlagArr = hdatIplpFeatureFlagSettingsArray_22;
o_size = sizeof(hdatIplpFeatureFlagSettingsArray_22);

//Modify for Nimubs DD2.0 and DD2.1
PVR_t l_pvr( mmio_pvr_read() & 0xFFFFFFFF );
if(l_pvr.chipType == PVR_t::NIMBUS_CHIP)
{
if(l_pvr.getDDLevel() == 0x20)
{
*o_featureFlagArr = hdatIplpFeatureFlagSettingsArray_20;
o_size = sizeof(hdatIplpFeatureFlagSettingsArray_20);

}
else if (l_pvr.getDDLevel() == 0x21)
{
*o_featureFlagArr = hdatIplpFeatureFlagSettingsArray_21;
o_size = sizeof(hdatIplpFeatureFlagSettingsArray_21);

}
}
}


/**
* @brief This routine gets the information on feature flags
*
* @pre None
*
* @post None
*
* @param o_featureFlagArrayHdr - output parameter - Array header
* @param o_featureFlagSettings - output parameter - The structure to update with
* Feature flag information
*
* @return A null error log handle if successful, else the return code pointed
* to by errlHndl_t contains one of:
*
* @retval HDAT_OTHER_COMP_ERROR
*/
static errlHndl_t hdatGetFeatureFlagInfo(HDAT::hdatHDIFVersionedDataArray_t &o_featureFlagArrayHdr,
hdatIplpFeatureFlagSetting_t o_featureFlagSettings[])
{
errlHndl_t l_errlHndl = NULL;
const hdatIplpFeatureFlagSetting_t * l_arr = NULL;
uint32_t l_arrSize = 0;
hdatGetFeatureFlagArray(&l_arr, l_arrSize);

o_featureFlagArrayHdr.hdatOffset = sizeof(HDAT::hdatHDIFVersionedDataArray_t);
o_featureFlagArrayHdr.hdatAllocSize = sizeof(hdatIplpFeatureFlagSetting_t);
o_featureFlagArrayHdr.hdatActSize = sizeof(hdatIplpFeatureFlagSetting_t);
o_featureFlagArrayHdr.hdatArrayCnt =
l_arrSize/sizeof(hdatIplpFeatureFlagSetting_t);
o_featureFlagArrayHdr.hdatVersion = HDAT_FEATURE_FLAG_VERSION::V1;

memcpy(o_featureFlagSettings , l_arr,
l_arrSize);
return l_errlHndl;
}


/**
* @brief This routine gets the information for System Parameters
Expand Down Expand Up @@ -911,6 +986,9 @@ static void hdatSetIPLParamsHdrs(hdatIPLParameters_t *o_iplparams)
o_iplparams->hdatHdr.hdatDataPtrCnt = HDAT_IPL_PARAMS_DA_CNT;
o_iplparams->hdatHdr.hdatChildStrCnt = 0;
o_iplparams->hdatHdr.hdatChildStrOffset = 0;
const hdatIplpFeatureFlagSetting_t * l_arr = NULL;
uint32_t l_arrSize = 0;
hdatGetFeatureFlagArray(&l_arr, l_arrSize);

memcpy(o_iplparams->hdatHdr.hdatStructName, HDAT_IPLP_STRUCT_NAME,
sizeof(o_iplparams->hdatHdr.hdatStructName));
Expand Down Expand Up @@ -969,6 +1047,13 @@ static void hdatSetIPLParamsHdrs(hdatIPLParameters_t *o_iplparams)
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_SERIAL_PORTS].hdatSize =
sizeof(hdatHDIFDataArray_t) + sizeof(hdatPortCodes_t);

o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_FEATURE_FLAGS].hdatOffset =
offsetof(hdatIPLParameters_t, iv_featureFlagArrayHdr);

o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_FEATURE_FLAGS].hdatSize =
sizeof(hdatHDIFVersionedDataArray_t) + l_arrSize;


}

/**
Expand Down Expand Up @@ -1077,6 +1162,13 @@ errlHndl_t HdatIplParms::hdatLoadIplParams(uint32_t &o_size, uint32_t &o_count)
memset(this->iv_hdatIPLParams->iv_ports, 0x00, sizeof(hdatPortCodes_t) * 2);
hdatGetPortInfo(this->iv_hdatIPLParams->iv_portArrayHdr,
this->iv_hdatIPLParams->iv_ports);
// Get the feature flag information
memset(&this->iv_hdatIPLParams->iv_featureFlagArrayHdr, 0x00,
sizeof(HDAT::hdatHDIFVersionedDataArray_t));
memset(&this->iv_hdatIPLParams->iv_featureFlagSettings, 0x00,
sizeof(hdatIplpFeatureFlagSetting_t) * MAX_FEATURE_FLAGS);
hdatGetFeatureFlagInfo(this->iv_hdatIPLParams->iv_featureFlagArrayHdr,
this->iv_hdatIPLParams->iv_featureFlagSettings);

HDAT_DBG("HDAT:: IPL Parameters Loaded :: Size : 0x%X",
sizeof(hdatIPLParameters_t));
Expand Down
86 changes: 73 additions & 13 deletions src/usr/hdat/hdatiplparms.H
Expand Up @@ -54,7 +54,7 @@ namespace HDAT
/* Typedefs */
/*----------------------------------------------------------------------------*/

const uint16_t HDAT_IPL_PARAMS_VERSION = 0x70; // First P9 version
const uint16_t HDAT_IPL_PARAMS_VERSION = 0x71; // Second P9 version
const char HDAT_IPLP_STRUCT_NAME[7] = "IPLPMS";


Expand All @@ -64,16 +64,17 @@ const char HDAT_IPLP_STRUCT_NAME[7] = "IPLPMS";
*/
enum hdatIplDataPtrs
{
HDAT_IPL_SYS = 0,
HDAT_IPL_PARMS = 1,
HDAT_IPL_TIME = 2,
HDAT_IPL_PVT = 3,
HDAT_IPL_DUMP = 4,
HDAT_IPL_HMC = 5,
HDAT_IPL_CUOD = 6,
HDAT_IPL_MANF = 7,
HDAT_IPL_PORT_CODES = 8,
HDAT_IPL_LAST = 9
HDAT_IPL_SYS = 0,
HDAT_IPL_PARMS,
HDAT_IPL_TIME,
HDAT_IPL_PVT,
HDAT_IPL_DUMP,
HDAT_IPL_HMC,
HDAT_IPL_CUOD,
HDAT_IPL_MANF,
HDAT_IPL_PORT_CODES,
HDAT_IPL_FEATURE_FLAGS,
HDAT_IPL_LAST
};

/** @brief Structure definition for system model and feature code
Expand Down Expand Up @@ -263,6 +264,62 @@ struct hdatPortCodes_t
hdatReserved1 : 15;// Reserved for future use
} __attribute__ ((packed));

#define MAX_FEATURE_FLAGS 64 // Maximum number of feature flags

enum HDAT_FEATURE_FLAG_VERSION : uint32_t
{
V1 = 0x00000001
};
struct hdatIplpFeatureFlagSetting_t
{
char hdatIplpFeatureFlagString[64]; // Feature flag null terminated string
uint64_t hdatIplpFeatureFlagSetting; // bit0 indicates IPL time setting.
}__attribute__ ((packed));

// Agreed strings and settings of different feature flags
const hdatIplpFeatureFlagSetting_t hdatIplpFeatureFlagSettingsArray_20[]=
{
{"tm-suspend-mode-enabled", 0x8000000000000000},
{"inst-thread-reconfig-control-trig0-1", 0x8000000000000000},
{"inst-l1d-flush-trig2", 0x8000000000000000},
{"inst-l1d-flush-ori30,30,0", 0x0000000000000000},
{"inst-spec-barrier-ori31,31,0", 0x8000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0", 0x8000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1", 0x8000000000000000},
{"needs-spec-barrier-for-bound-checks", 0x8000000000000000},
{"fw-l1d-thread-split", 0x8000000000000000},
{"fw-bcctrl-serialized", 0x0000000000000000},
{"speculation-policy-favor-security", 0x8000000000000000}};

const hdatIplpFeatureFlagSetting_t hdatIplpFeatureFlagSettingsArray_21[]=
{
{"tm-suspend-mode-enabled", 0x0000000000000000},
{"inst-thread-reconfig-control-trig0-1", 0x8000000000000000},
{"inst-l1d-flush-trig2", 0x8000000000000000},
{"inst-l1d-flush-ori30,30,0", 0x0000000000000000},
{"inst-spec-barrier-ori31,31,0", 0x8000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0", 0x8000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1", 0x8000000000000000},
{"needs-spec-barrier-for-bound-checks", 0x8000000000000000},
{"fw-l1d-thread-split", 0x8000000000000000},
{"fw-bcctrl-serialized", 0x0000000000000000},
{"speculation-policy-favor-security", 0x8000000000000000}};

const hdatIplpFeatureFlagSetting_t hdatIplpFeatureFlagSettingsArray_22[]=
{
{"tm-suspend-mode-enabled", 0x8000000000000000},
{"inst-thread-reconfig-control-trig0-1", 0x0000000000000000},
{"inst-l1d-flush-trig2", 0x8000000000000000},
{"inst-l1d-flush-ori30,30,0", 0x0000000000000000},
{"inst-spec-barrier-ori31,31,0", 0x8000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0", 0x8000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1", 0x8000000000000000},
{"needs-spec-barrier-for-bound-checks", 0x8000000000000000},
{"fw-l1d-thread-split", 0x8000000000000000},
{"fw-bcctrl-serialized", 0x8000000000000000},
{"speculation-policy-favor-security", 0x8000000000000000}};



#define HDAT_CHIP_TYPE_MURANO "MURANO"
#define HDAT_CHIP_TYPE_VENICE "VENICE"
Expand Down Expand Up @@ -328,8 +385,9 @@ enum hdatIPLParamsDataPtrs
HDAT_IPL_PARAMS_CUOD_DATA = 6,
HDAT_IPL_PARAMS_MFG_DATA = 7,
HDAT_IPL_PARAMS_SERIAL_PORTS = 8,
HDAT_IPL_PARAMS_DA_CNT = 9,
HDAT_IPL_PARAMS_DA_LAST = 10
HDAT_IPL_PARAMS_FEATURE_FLAGS = 9,
HDAT_IPL_PARAMS_DA_CNT = 10,
HDAT_IPL_PARAMS_DA_LAST = 11
};

struct hdatIPLParameters_t{
Expand Down Expand Up @@ -358,6 +416,8 @@ struct hdatIPLParameters_t{
hdatManf_t iv_manf;
hdatHDIFDataArray_t iv_portArrayHdr;
hdatPortCodes_t iv_ports[hdatMaxPorts];
hdatHDIFVersionedDataArray_t iv_featureFlagArrayHdr;
hdatIplpFeatureFlagSetting_t iv_featureFlagSettings[MAX_FEATURE_FLAGS];
};

/*----------------------------------------------------------------------------*/
Expand Down
76 changes: 0 additions & 76 deletions src/usr/hdat/hdatpcrd.C
Expand Up @@ -122,11 +122,6 @@ static errlHndl_t hdatSetPcrdHdrs(hdatSpPcrd_t *i_pcrd)
i_pcrd->hdatPcrdIntData[HDAT_PCRD_CHIP_EC_LVL].hdatOffset = 0;
i_pcrd->hdatPcrdIntData[HDAT_PCRD_CHIP_EC_LVL].hdatSize = 0;

i_pcrd->hdatPcrdIntData[HDAT_PCRD_DA_FEATURE_FLAGS].hdatOffset = 0;
i_pcrd->hdatPcrdIntData[HDAT_PCRD_DA_FEATURE_FLAGS].hdatSize = 0;



return l_errlHndl;
}

Expand Down Expand Up @@ -664,77 +659,6 @@ errlHndl_t HdatPcrd::hdatLoadPcrd(uint32_t &o_size, uint32_t &o_count)
this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_CHIP_EC_LVL].hdatSize = l_pcrdECLvlTotalSize;
this->iv_spPcrd->hdatHdr.hdatSize += l_pcrdECLvlTotalSize;

//populating the feature flag settings
//as of now all values are initialized with 0s

//Get the the EQ(Quad id) targets
TARGETING::TargetHandleList l_eqList;
TARGETING::PredicateCTM
l_eqFilter(TARGETING::CLASS_UNIT, TARGETING::TYPE_EQ);

TARGETING::PredicateHwas l_predEqPresent;
l_predEqPresent.present(true);

TARGETING::PredicatePostfixExpr l_presentEq;
l_presentEq.push(&l_eqFilter).push(&l_predEqPresent).And();

TARGETING::targetService().getAssociated(
l_eqList,
l_pProcTarget,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::ALL,
&l_presentEq);

hdatPcrdFeatureFlagString *l_FeatureFlagStringPtr = NULL;

l_FeatureFlagStringPtr = reinterpret_cast<hdatPcrdFeatureFlagString *>
((uint8_t *)l_ECLvlInfoPcrdHdrPtr + sizeof(hdatHDIFDataArray_t) +
sizeof(hdatEcLvl_t));

memset(l_FeatureFlagStringPtr, 0x00, sizeof(hdatPcrdFeatureFlagString));
memcpy(l_FeatureFlagStringPtr,FFSTRING,sizeof(FFSTRING));

hdatHDIFDataArray_t *l_FeatureFlagsPcrdHdrPtr = NULL;

l_FeatureFlagsPcrdHdrPtr = reinterpret_cast<hdatHDIFDataArray_t *>
((uint8_t *)l_FeatureFlagStringPtr + sizeof(hdatPcrdFeatureFlagString));



l_FeatureFlagsPcrdHdrPtr->hdatOffset = 0x0010;
l_FeatureFlagsPcrdHdrPtr->hdatArrayCnt = l_eqList.size();
l_FeatureFlagsPcrdHdrPtr->hdatAllocSize = sizeof(hdatPcrdFeatureFlagSetting);
l_FeatureFlagsPcrdHdrPtr->hdatActSize = sizeof(hdatPcrdFeatureFlagSetting);

hdatPcrdFeatureFlagSetting *l_hdatFeatureFlagSettPtr = reinterpret_cast<hdatPcrdFeatureFlagSetting *>
((uint8_t *)l_FeatureFlagsPcrdHdrPtr + sizeof(hdatHDIFDataArray_t));


uint32_t l_EQOrdId = 0;
for(uint32_t l_eqIdx = 0; l_eqIdx < l_eqList.size();++l_eqIdx)
{
TARGETING::Target* l_pTarget = l_eqList[l_eqIdx];
l_EQOrdId = l_pTarget->getAttr<TARGETING::ATTR_ORDINAL_ID>();

l_hdatFeatureFlagSettPtr->hdatPcrdFFCurrentSetting = 0;
l_hdatFeatureFlagSettPtr->hdatPcrdFFDynChgCapability =0;
l_hdatFeatureFlagSettPtr->hdatPcrdEqOrdId = l_EQOrdId;

l_hdatFeatureFlagSettPtr++;
}

uint32_t l_pcrdFeatureFlagTotalSize = sizeof(hdatPcrdFeatureFlagString) + sizeof(hdatHDIFDataArray_t) +
sizeof(hdatPcrdFeatureFlagSetting) * MAX_EQ_PER_PROC;

this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_FEATURE_FLAGS].hdatOffset =
this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_CHIP_EC_LVL].hdatOffset + sizeof(hdatHDIFDataArray_t) +
sizeof(hdatEcLvl_t);

this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_FEATURE_FLAGS].hdatSize = l_pcrdFeatureFlagTotalSize;

this->iv_spPcrd->hdatHdr.hdatSize += l_pcrdFeatureFlagTotalSize;


if( NULL != l_errl)
{
break;
Expand Down
30 changes: 2 additions & 28 deletions src/usr/hdat/hdatpcrd.H
Expand Up @@ -62,8 +62,6 @@ const char HDAT_PCRD_STRUCT_NAME[7] = "SPPCRD";
#define HDAT_PCRD_MAX_I2C_DEV 128
#define HDAT_PCRD_MAX_SMP_LINK 12

//Max number of EQ per proc
#define MAX_EQ_PER_PROC 6
/** @enum hdatDataPtrs
* Enumeration which defines the data sections of the PCRD
*/
Expand All @@ -79,9 +77,8 @@ enum hdatPcrdDataPtrs
HDAT_PCRD_DA_PNOR = 6,
HDAT_PCRD_DA_SMP = 7,
HDAT_PCRD_CHIP_EC_LVL = 8,
HDAT_PCRD_DA_FEATURE_FLAGS = 9,
HDAT_PCRD_DA_CNT = 10,
HDAT_PCRD_DA_LAST = 11,
HDAT_PCRD_DA_CNT = 9,
HDAT_PCRD_DA_LAST = 10,
};

/*----------------------------------------------------------------------------*/
Expand Down Expand Up @@ -169,29 +166,6 @@ struct hdatSpPcrd_t
//add in padding here. uint32_t whatever it is.
} __attribute__ ((packed));


struct hdatPcrdFeatureFlagString
{
char hdatPcrdffString[64][32];
}__attribute__ ((packed));

struct hdatPcrdFeatureFlagSetting
{
uint64_t hdatPcrdFFCurrentSetting;
uint64_t hdatPcrdFFDynChgCapability;
uint32_t hdatPcrdEqOrdId;
}__attribute__ ((packed));

const char FFSTRING [64][32] = {"TM Suspend Mode Enabled",
"","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","","","","","","","",
"","","","" };


/*----------------------------------------------------------------------------*/
/* C++ class definition */
/*----------------------------------------------------------------------------*/
Expand Down

0 comments on commit aed872b

Please sign in to comment.