Skip to content

Commit

Permalink
PSTATE parameter block:POUNDV parsing function vs native implementation
Browse files Browse the repository at this point in the history
Change-Id: Ia480c2b2594b87e000e8c90cc3493fff57249338
RTC:162565
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/34330
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/34584
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
  • Loading branch information
prasrang authored and dcrowell77 committed Feb 7, 2017
1 parent 32f4cf4 commit 0bfa761
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 71 deletions.
33 changes: 2 additions & 31 deletions src/import/chips/p9/procedures/hwp/pm/p9_pm_get_poundv_bucket.C
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -39,11 +39,6 @@ fapi2::ReturnCode p9_pm_get_poundv_bucket(
{
FAPI_IMP("Entering p9_pm_get_poundv_bucket ....");


//Create a pointer version of the out param o_data so that
// we can access bytes individually
uint8_t* l_tempBuffer = reinterpret_cast<uint8_t*>(malloc(sizeof(o_data)));

//Set up a char array to hold the bucket data from an attr read
fapi2::ATTR_POUNDV_BUCKET_DATA_Type l_bucketAttr;

Expand All @@ -52,33 +47,9 @@ fapi2::ReturnCode p9_pm_get_poundv_bucket(
i_target,
l_bucketAttr));


#ifndef _BIG_ENDIAN
//The first byte is simply a uint8 that describes the bucket ID
l_tempBuffer[0] = l_bucketAttr[0];

//Skipping the first byte (which has already been taken of) start reading
//the voltage data 2 bytes at a time.
for(uint8_t offset = 1; offset < sizeof(o_data); offset += 2)
{
//Switch from Big Endian to Little Endian
l_tempBuffer[offset] = l_bucketAttr[offset + 1];
l_tempBuffer[offset + 1] = l_bucketAttr[offset];
}

memcpy(&o_data,
l_tempBuffer,
sizeof(o_data));

#else
memcpy(&o_data,
l_bucketAttr,
sizeof(o_data));
#endif

memcpy(&o_data, l_bucketAttr, sizeof(o_data));

fapi_try_exit:
free(l_tempBuffer);
FAPI_IMP("Exiting p9_pm_get_poundv_bucket ....");

return fapi2::current_err;
Expand Down
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -51,6 +51,7 @@ fapi2::ReturnCode p9_pm_get_poundv_bucket_attr(
uint32_t l_sysNestFreq = 0;
fapi2::voltageBucketData_t* l_currentBucket = NULL;
uint8_t l_numMatches = 0;
uint16_t l_pbFreq = 0;

fapi2::MvpdRecord lrpRecord = fapi2::MVPD_RECORD_LAST;
//To read MVPD we will need the proc parent of the inputted EQ target
Expand Down Expand Up @@ -186,7 +187,13 @@ fapi2::ReturnCode p9_pm_get_poundv_bucket_attr(

for(int i = 0; i < NUM_BUCKETS; i++)
{
if(l_buckets[i].pbFreq == l_sysNestFreq)
#ifndef _BIG_ENDIAN
l_pbFreq = ( (((l_buckets[i].pbFreq) >> 8) & 0x00FF) | (((l_buckets[i].pbFreq) << 8) & 0xFF00) );
#else
l_pbFreq = l_buckets[i].pbFreq;
#endif

if(l_pbFreq == l_sysNestFreq)
{
l_numMatches++;

Expand All @@ -196,7 +203,7 @@ fapi2::ReturnCode p9_pm_get_poundv_bucket_attr(
" Multiple buckets (%d) reporting the same nest frequency"
" Bucket Nest = %d Bucket ID = %d, First Bucket = %d",
l_numMatches,
l_buckets[i].pbFreq,
l_pbFreq,
(i + 1),
l_currentBucket);

Expand All @@ -208,7 +215,7 @@ fapi2::ReturnCode p9_pm_get_poundv_bucket_attr(
}

//save FFDC in case we fail
l_bucketNestFreqs[i] = l_buckets[i].pbFreq;
l_bucketNestFreqs[i] = l_pbFreq;
}

if(l_numMatches == 1)
Expand Down
43 changes: 8 additions & 35 deletions src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C
Expand Up @@ -43,12 +43,8 @@
// Includes
// ----------------------------------------------------------------------
#include <fapi2.H>
//#include <p9_pstates.h>
//#include <pstate_tables.h>
//#include <lab_pstates.h>
//#include <pstates.h>
//#include <p9_pm.H>
#include <p9_pstate_parameter_block.H>
#include "p9_pm_get_poundv_bucket.H"

// START OF PSTATE PARAMETER BLOCK function

Expand Down Expand Up @@ -502,10 +498,9 @@ proc_get_mvpd_data(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target,
{

std::vector<fapi2::Target<fapi2::TARGET_TYPE_EQ>> l_eqChiplets;
uint8_t* l_buffer = reinterpret_cast<uint8_t*>(malloc(PDV_BUFFER_ALLOC) );
fapi2::voltageBucketData_t l_poundv_data;
uint8_t* l_buffer = reinterpret_cast<uint8_t*>(malloc(sizeof(l_poundv_data)) );
uint8_t* l_buffer_inc;
uint32_t l_bufferSize = 512;
uint32_t l_record = 0;
uint32_t chiplet_mvpd_data[PV_D][PV_W];
uint8_t j = 0;
uint8_t i = 0;
Expand Down Expand Up @@ -533,47 +528,25 @@ proc_get_mvpd_data(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target,
for (j = 0; j < l_eqChiplets.size(); j++)
{

l_bufferSize = 512;
uint8_t l_chipNum = 0xFF;

FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_eqChiplets[j], l_chipNum));

FAPI_INF("Chip Number => %u", l_chipNum);

// set l_record to appropriate lprx record (add quad number to lrp0)
l_record = (uint32_t)fapi2::MVPD_RECORD_LRP0 + l_chipNum;

FAPI_INF("Record Number => %u", l_record);
// clear out buffer to known value before calling fapiGetMvpdField
memset(l_buffer, 0, 512);

//@todo RTC 162565 - Change code to use POUNDV accessor function
// Get Chiplet MVPD data and put in chiplet_mvpd_data using accessor function
FAPI_TRY(getMvpdField((fapi2::MvpdRecord)l_record,
fapi2::MVPD_KEYWORD_PDV,
i_target,
l_buffer,
l_bufferSize));

// check buffer size
if (l_bufferSize < PDV_BUFFER_SIZE)
{
FAPI_ERR("**** ERROR : Wrong size buffer returned from fapiGetMvpdField for #V => %d",
l_bufferSize );
// @todo-L3
//const uint32_t &BUFFER_SIZE = l_bufferSize; //const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& CHIP_TARGET= i_target;
//FAPI_SET_HWP_ERROR(l_rc, RC_PROCPM_PSTATE_DATABLOCK_PDV_BUFFER_SIZE_ERROR);
break;
}
memset(l_buffer, 0, sizeof(l_poundv_data));

FAPI_TRY(p9_pm_get_poundv_bucket(l_eqChiplets[j], l_poundv_data));

memcpy(l_buffer, &l_poundv_data, sizeof(l_poundv_data));

// clear array
memset(chiplet_mvpd_data, 0, sizeof(chiplet_mvpd_data));

// fill chiplet_mvpd_data 2d array with data iN buffer (skip first byte - bucket id)
#define UINT16_GET(__uint8_ptr) ((uint16_t)( ( (*((const uint8_t *)(__uint8_ptr)) << 8) | *((const uint8_t *)(__uint8_ptr) + 1) ) ))

//@todo RTC 162565 - Change code to use POUNDV accessor function
// use copy of allocated buffer pointer to increment through buffer
l_buffer_inc = l_buffer;

bucket_id = *l_buffer_inc;
Expand Down
Expand Up @@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2015,2016
# Contributors Listed Below - COPYRIGHT 2015,2017
# [+] International Business Machines Corp.
#
#
Expand All @@ -30,4 +30,5 @@ PPB_INCLUDES+=$(PROJECT_ROOT)/chips/p9/procedures/hwp/pm
$(call ADD_MODULE_INCDIR,$(PROCEDURE),$(PPB_INCLUDES))
#$(call ADD_MODULE_SRCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/procedures/hwp/lib)
lib$(PROCEDURE)_DEPLIBS+=p9_pm_utils
lib$(PROCEDURE)_DEPLIBS+=p9_pm_get_poundv_bucket
$(call BUILD_PROCEDURE)

0 comments on commit 0bfa761

Please sign in to comment.