diff options
Diffstat (limited to 'src')
10 files changed, 439 insertions, 263 deletions
diff --git a/src/import/chips/p9/procedures/hwp/lib/p9_pstate_parameter_block.h b/src/import/chips/p9/procedures/hwp/lib/p9_pstate_parameter_block.h index 185270126..13f2b2bee 100644 --- a/src/import/chips/p9/procedures/hwp/lib/p9_pstate_parameter_block.h +++ b/src/import/chips/p9/procedures/hwp/lib/p9_pstate_parameter_block.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -143,7 +143,7 @@ typedef struct IVRM_PARM_DATA //Section added back by ssrivath // START OF PARMS REQUIRED VPD parsing procedures -//#define S132A_POINTS 4 - Replaced by VPD_PV_POINTS +//#define S132A_POINTS 4 - Replaced by NUM_OP_POINTS #define PSTATE_STEPSIZE 1 #define EVRM_DELAY_NS 100 #define DEAD_ZONE_5MV 20 // 100mV @@ -399,8 +399,8 @@ load_wof_attributes ( PstateSuperStructure* pss, /// ------------------------------------------------------------ /// @brief Copy VPD operating point into destination in assending order -/// @param[in] &src[VPD_PV_POINTS] => reference to source VPD structure (array) -/// @param[out] *dest[VPD_PV_POINTS] => pointer to destination VpdOperatingPoint structure +/// @param[in] &src[NUM_OP_POINTS] => reference to source VPD structure (array) +/// @param[out] *dest[NUM_OP_POINTS] => pointer to destination VpdOperatingPoint structure /// @return FAPI2::SUCCESS /// ------------------------------------------------------------ diff --git a/src/import/chips/p9/procedures/hwp/lib/p9_pstates_cmeqm.h b/src/import/chips/p9/procedures/hwp/lib/p9_pstates_cmeqm.h index 2b162e417..274ad92de 100644 --- a/src/import/chips/p9/procedures/hwp/lib/p9_pstates_cmeqm.h +++ b/src/import/chips/p9/procedures/hwp/lib/p9_pstates_cmeqm.h @@ -168,11 +168,12 @@ typedef struct { uint16_t ivdd_tdp_ac_current_10ma; uint16_t ivdd_tdp_dc_current_10ma; - uint8_t vdm_overvold_small_thresholds; + uint8_t vdm_overvolt_small_thresholds; uint8_t vdm_large_extreme_thresholds; - uint8_t vdm_small_frequency_drop; - uint8_t vdm_large_frequency_drop; - uint16_t vdm_spare; + uint8_t vdm_small_large_normal_freq; + uint8_t vdm_large_small_normal_freq; + uint8_t vdm_vid_compare_ivid; + uint8_t vdm_spare; } poundw_entry_t; typedef struct @@ -186,45 +187,18 @@ typedef struct typedef struct { - poundw_entry_t poundw_nominal; - poundw_entry_t poundw_powersave; - poundw_entry_t poundw_turbo; - poundw_entry_t poundw_ultraturbo; + poundw_entry_t poundw[NUM_OP_POINTS]; resistance_entry_t resistance_data; uint64_t reserved1; uint16_t reserved2; } PoundW_data; + /// VDM/Droop Parameter Block /// typedef struct { - uint8_t vid_compare_override_mv_enable; - uint8_t vid_compare_override_mv[VPD_PV_POINTS]; - uint8_t vdm_response; - - // For the following *_enable fields, bits are defined to indicate - // which of the respective *override* array entries are valid. - // bit 0: UltraTurbo; bit 1: Turbo; bit 2: Nominal; bit 3: PowSave - uint8_t droop_small_override_enable; - uint8_t droop_large_override_enable; - uint8_t droop_extreme_override_enable; - uint8_t overvolt_override_enable; - uint8_t fmin_override_khz_enable; - uint8_t fmax_override_khz_enable; - - // The respecitve *_enable above indicate which index values are valid - uint8_t droop_small_override[VPD_PV_POINTS]; - uint8_t droop_large_override[VPD_PV_POINTS]; - uint8_t droop_extreme_override[VPD_PV_POINTS]; - uint8_t overvolt_override[VPD_PV_POINTS]; - uint8_t fmin_override_khz[VPD_PV_POINTS]; - uint8_t fmax_override_khz[VPD_PV_POINTS]; - - /// Pad structure to 8-byte alignment - /// @todo pad once fully structure is complete. - // uint8_t pad[1]; - -} VDMParmBlock; + PoundW_data vpd_w_data; +} LP_VDMParmBlock; /// The layout of the data created by the Pstate table creation firmware for @@ -278,6 +252,7 @@ typedef struct iVRMInfo } IvrmParmBlock; +typedef uint8_t CompareVIDPoints; /// The layout of the data created by the Pstate table creation firmware for /// comsumption by the CME Quad Manager. This data will reside in the Core @@ -297,7 +272,7 @@ typedef struct /// VPD operating points are stored without load-line correction. Frequencies /// are in MHz, voltages are specified in units of 5mV, and currents are /// in units of 500mA. - VpdOperatingPoint operating_points[VPD_PV_POINTS]; + VpdOperatingPoint operating_points[NUM_OP_POINTS]; /// Loadlines and Distribution values for the VDD rail SysPowerDistParms vdd_sysparm; @@ -308,7 +283,7 @@ typedef struct /// in setting the external voltages. This is used to recompute the Vin voltage /// based on the Global Actual Pstate . /// Values in 0.5% - VpdBias ext_biases[VPD_PV_POINTS]; + VpdBias ext_biases[NUM_OP_POINTS]; /// Internal Biases /// @@ -316,7 +291,7 @@ typedef struct /// in setting the internal voltages (eg Vout to the iVRMs) as part of the /// Local Actual Pstate. /// Values in 0.5% - VpdBias int_biases[VPD_PV_POINTS]; + VpdBias int_biases[NUM_OP_POINTS]; /// IVRM Data IvrmParmBlock ivrm; @@ -325,11 +300,23 @@ typedef struct ResonantClockingSetup resclk; /// VDM Data - VDMParmBlock vdm; + LP_VDMParmBlock vdm; /// DPLL pstate 0 value uint32_t dpll_pstate0_value; + // Biased Compare VID operating points + CompareVIDPoints vid_point_set[NUM_OP_POINTS]; + + // Biased Threshold operation points + int8_t threshold_set[NUM_OP_POINTS][NUM_THRESHOLD_POINTS]; + + //pstate-volt compare slopes + uint16_t PsVIDCompSlopes[VPD_NUM_SLOPES_REGION]; + + //pstate-volt threshold slopes + uint16_t PsVDMThreshSlopes[VPD_NUM_SLOPES_REGION][NUM_THRESHOLD_POINTS]; + } LocalPstateParmBlock; #ifdef __cplusplus diff --git a/src/import/chips/p9/procedures/hwp/lib/p9_pstates_common.h b/src/import/chips/p9/procedures/hwp/lib/p9_pstates_common.h index a45f93fcc..9f7457e53 100644 --- a/src/import/chips/p9/procedures/hwp/lib/p9_pstates_common.h +++ b/src/import/chips/p9/procedures/hwp/lib/p9_pstates_common.h @@ -90,15 +90,17 @@ // are warrented /// VPD #V Data from keyword (eg VPD order) -#define VPD_PV_POINTS 4 +#define NUM_OP_POINTS 4 +#define NUM_THRESHOLD_POINTS 4 #define VPD_PV_POWERSAVE 1 #define VPD_PV_NOMINAL 0 #define VPD_PV_TURBO 2 #define VPD_PV_ULTRA 3 #define VPD_PV_ORDER {VPD_PV_POWERSAVE, VPD_PV_NOMINAL, VPD_PV_TURBO, VPD_PV_ULTRA} #define VPD_PV_ORDER_STR {"Nominal ","PowerSave ", "Turbo ", "UltraTurbo"} +#define VPD_THRESHOLD_ORDER_STR {"Overvolt", "Small", "Large", "Extreme" } -/// VPD #V Operating Points (eg Natureal order) +/// VPD #V Operating Points (eg Natural order) #define POWERSAVE 0 #define NOMINAL 1 #define TURBO 2 @@ -133,7 +135,12 @@ #define VPD_PT_SET_ORDER {VPD_PT_SET_RAW, VPD_PT_SET_SYSP, VPD_PT_SET_BIASED, VPD_PT_SET_BIASED_SYSP} #define VPD_PT_SET_ORDER_STR {"Raw ", "SysParam ","Biased ", "Biased/SysParam"} -#define EVID_SLOPE_FP_SHIFT 13 +#define VID_SLOPE_FP_SHIFT 13 +#define THRESH_SLOPE_FP_SHIFT 12 + +// 0 = PowerSave, 1 = Nominal; 2 = Turbo; 3 = UltraTurbo; 4 = Enable +#define VDM_DROOP_OP_POINTS 5 + /// IDDQ readings, diff --git a/src/import/chips/p9/procedures/hwp/lib/p9_pstates_occ.h b/src/import/chips/p9/procedures/hwp/lib/p9_pstates_occ.h index acae42877..8f3f41556 100644 --- a/src/import/chips/p9/procedures/hwp/lib/p9_pstates_occ.h +++ b/src/import/chips/p9/procedures/hwp/lib/p9_pstates_occ.h @@ -167,7 +167,7 @@ typedef struct /// VPD operating points are stored without load-line correction. Frequencies /// are in MHz, voltages are specified in units of 5mV, and currents are /// in units of 500mA. - VpdOperatingPoint operating_points[VPD_PV_POINTS]; + VpdOperatingPoint operating_points[NUM_OP_POINTS]; /// Loadlines and Distribution values for the VDD rail SysPowerDistParms vdd_sysparm; diff --git a/src/import/chips/p9/procedures/hwp/lib/p9_pstates_pgpe.h b/src/import/chips/p9/procedures/hwp/lib/p9_pstates_pgpe.h index a089611cb..3c7752630 100644 --- a/src/import/chips/p9/procedures/hwp/lib/p9_pstates_pgpe.h +++ b/src/import/chips/p9/procedures/hwp/lib/p9_pstates_pgpe.h @@ -120,6 +120,30 @@ typedef struct } WOFElements; +/// VDM/Droop Parameter Block +/// +typedef struct +{ + uint8_t vid_compare_override_mv[VDM_DROOP_OP_POINTS]; + uint8_t vdm_response; + + // For the following *_enable fields, bits are defined to indicate + // which of the respective *override* array entries are valid. + // bit 0: UltraTurbo; bit 1: Turbo; bit 2: Nominal; bit 3: PowSave + + // The respecitve *_enable above indicate which index values are valid + uint8_t droop_small_override[VDM_DROOP_OP_POINTS]; + uint8_t droop_large_override[VDM_DROOP_OP_POINTS]; + uint8_t droop_extreme_override[VDM_DROOP_OP_POINTS]; + uint8_t overvolt_override[VDM_DROOP_OP_POINTS]; + uint16_t fmin_override_khz[VDM_DROOP_OP_POINTS]; + uint16_t fmax_override_khz[VDM_DROOP_OP_POINTS]; + + /// Pad structure to 8-byte alignment + /// @todo pad once fully structure is complete. + // uint8_t pad[1]; + +} GP_VDMParmBlock; /// Global Pstate Parameter Block /// @@ -162,14 +186,14 @@ typedef struct /// VPD operating points are stored without load-line correction. Frequencies /// are in MHz, voltages are specified in units of 5mV, and currents are /// in units of 500mA. - VpdOperatingPoint operating_points[VPD_PV_POINTS]; + VpdOperatingPoint operating_points[NUM_OP_POINTS]; /// Biases /// /// Biases applied to the VPD operating points prior to load-line correction /// in setting the external voltages. /// Values in 0.5% - VpdBias ext_biases[VPD_PV_POINTS]; + VpdBias ext_biases[NUM_OP_POINTS]; /// Loadlines and Distribution values for the VDD rail SysPowerDistParms vdd_sysparm; @@ -199,7 +223,7 @@ typedef struct uint8_t vrm_stepdelay_value; /// VDM Data - VDMParmBlock vdm; + GP_VDMParmBlock vdm; /// The following are needed to generated the Pstate Table to HOMER. @@ -209,7 +233,7 @@ typedef struct /// in setting the internal voltages (eg Vout to the iVRMs) as part of the /// Local Actual Pstate. /// Values in 0.5% - VpdBias int_biases[VPD_PV_POINTS]; + VpdBias int_biases[NUM_OP_POINTS]; /// IVRM Data IvrmParmBlock ivrm; @@ -242,7 +266,7 @@ typedef struct uint16_t VPsSlopes[VPD_NUM_SLOPES_SET][VPD_NUM_SLOPES_REGION]; /// All operating points - VpdOperatingPoint operating_points_set[NUM_VPD_PTS_SET][VPD_PV_POINTS]; + VpdOperatingPoint operating_points_set[NUM_VPD_PTS_SET][NUM_OP_POINTS]; //DPLL pstate 0 value uint32_t dpll_pstate0_value; diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C b/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C index 48bacd861..f808296be 100644 --- a/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C +++ b/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.C @@ -48,6 +48,11 @@ #include "p9_resclk_defines.H" #include <attribute_ids.H> #include <math.h> +//the value in this table are in Index format +uint8_t g_GreyCodeIndexMapping [] = +{ + 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, +}; fapi2::vdmData_t g_vpdData = {1, 2, @@ -132,7 +137,7 @@ p9_pstate_parameter_block( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ memset (&l_localppb, 0, sizeof(LocalPstateParmBlock)); memset (&l_occppb , 0, sizeof (OCCPstateParmBlock)); - PoundW_data l_w_data; + PoundW_data l_poundw_data; // Struct Variable for all attributes AttributeList attr; @@ -156,7 +161,9 @@ p9_pstate_parameter_block( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ double l_frequency_step_khz; //VDM Parm block - VDMParmBlock l_vdmpb; + GP_VDMParmBlock l_gp_vdmpb; + + LP_VDMParmBlock l_lp_vdmpb; //Resonant Clocking setup ResonantClockingSetup l_resclk_setup; @@ -165,7 +172,7 @@ p9_pstate_parameter_block( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ IvrmParmBlock l_ivrmpb; // VPD voltage and frequency biases - VpdBias l_vpdbias[VPD_PV_POINTS]; + VpdBias l_vpdbias[NUM_OP_POINTS]; // Quad Manager Flags QuadManagerFlags l_qm_flags; @@ -237,11 +244,10 @@ p9_pstate_parameter_block( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ // get VDM Parameters data // ---------------- FAPI_INF("Getting VDM Parameters Data"); - FAPI_TRY(proc_get_vdm_parms(i_target, &l_vdmpb)); - + FAPI_TRY(proc_get_vdm_parms(i_target, &l_gp_vdmpb)); FAPI_INF("Getting VDM points (#W) Data"); - FAPI_TRY(proc_get_mvpd_poundw(i_target, l_poundv_bucketId, &l_vdmpb, &l_w_data)); + FAPI_TRY(proc_get_mvpd_poundw(i_target, l_poundv_bucketId, &l_lp_vdmpb, &l_poundw_data, l_poundv_data)); // ---------------- // get IVRM Parameters data @@ -299,7 +305,7 @@ p9_pstate_parameter_block( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ "Loading MVPD operating point failed"); // VpdBias External and Internal Biases for Global and Local parameter block - for (uint8_t i = 0; i < VPD_PV_POINTS; i++) + for (uint8_t i = 0; i < NUM_OP_POINTS; i++) { l_globalppb.ext_biases[i] = l_vpdbias[i]; l_globalppb.int_biases[i] = l_vpdbias[i]; @@ -331,15 +337,16 @@ p9_pstate_parameter_block( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ // vrm_stepdelay_value -@todo RTC 161279 potential attributes to be defined // VDMParmBlock vdm - l_globalppb.vdm = l_vdmpb; + l_globalppb.vdm = l_gp_vdmpb; // IvrmParmBlock l_globalppb.ivrm = l_ivrmpb; - VpdOperatingPoint l_operating_points[NUM_VPD_PTS_SET][VPD_PV_POINTS]; + VpdOperatingPoint l_operating_points[NUM_VPD_PTS_SET][NUM_OP_POINTS]; // Compute VPD points p9_pstate_compute_vpd_pts(l_operating_points, &l_globalppb); + memcpy(l_globalppb.operating_points_set, l_operating_points, sizeof(l_operating_points)); // Calculate pre-calculated slopes @@ -371,13 +378,28 @@ p9_pstate_parameter_block( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ l_localppb.ivrm = l_ivrmpb; // VDMParmBlock - l_localppb.vdm = l_vdmpb; + l_localppb.vdm = l_lp_vdmpb; l_localppb.dpll_pstate0_value = revle32((revle32(l_localppb.operating_points[ULTRA].frequency_mhz) * 1000 / revle32( l_globalppb.frequency_step_khz))); FAPI_INF("l_localppb.dpll_pstate0_value %X", revle32(l_localppb.dpll_pstate0_value)); + + uint8_t l_biased_pstate[NUM_OP_POINTS]; + + for (uint8_t i = 0; i < NUM_OP_POINTS; ++i) + { + l_biased_pstate[i] = l_operating_points[VPD_PT_SET_BIASED][i].pstate; + FAPI_INF ("l_biased_pstate %d ", l_biased_pstate[i]); + } + + p9_pstate_compute_vdm_threshold_pts(l_poundw_data, &l_localppb); + + + p9_pstate_compute_PsVIDCompSlopes_slopes(l_poundw_data, &l_localppb, l_biased_pstate); + + p9_pstate_compute_PsVDMThreshSlopes(&l_localppb, l_biased_pstate); // ----------------------------------------------- // OCC parameter block // ----------------------------------------------- @@ -412,8 +434,8 @@ p9_pstate_parameter_block( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_ FAPI_INF("l_occppb.nest_leakage_percent %x", l_occppb.nest_leakage_percent); - l_occppb.lac_tdp_vdd_turbo_10ma = revle16(l_w_data.poundw_turbo.ivdd_tdp_ac_current_10ma); - l_occppb.lac_tdp_vdd_nominal_10ma = revle16(l_w_data.poundw_nominal.ivdd_tdp_ac_current_10ma); + l_occppb.lac_tdp_vdd_turbo_10ma = revle16(l_poundw_data.poundw[TURBO].ivdd_tdp_ac_current_10ma); + l_occppb.lac_tdp_vdd_nominal_10ma = revle16(l_poundw_data.poundw[NOMINAL].ivdd_tdp_ac_current_10ma); FAPI_INF("l_occppb.lac_tdp_vdd_turbo_10ma %x", revle16(l_occppb.lac_tdp_vdd_turbo_10ma)); FAPI_INF("l_occppb.lac_tdp_vdd_nominal_10ma %x", revle16(l_occppb.lac_tdp_vdd_nominal_10ma)); @@ -1196,7 +1218,7 @@ fapi_try_exit: fapi2::ReturnCode proc_get_extint_bias( uint32_t io_attr_mvpd_data[PV_D][PV_W], const AttributeList* i_attr, - VpdBias o_vpdbias[VPD_PV_POINTS] + VpdBias o_vpdbias[NUM_OP_POINTS] ) { @@ -1324,8 +1346,8 @@ proc_chk_valid_poundv(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_targe const uint8_t i_bucket_id) { - const uint8_t pv_op_order[VPD_PV_POINTS] = VPD_PV_ORDER; - const char* pv_op_str[VPD_PV_POINTS] = VPD_PV_ORDER_STR; + const uint8_t pv_op_order[NUM_OP_POINTS] = VPD_PV_ORDER; + const char* pv_op_str[NUM_OP_POINTS] = VPD_PV_ORDER_STR; uint8_t i = 0; bool suspend_ut_check = false; uint8_t l_attr_system_wof_enabled; @@ -1337,7 +1359,7 @@ proc_chk_valid_poundv(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_targe l_attr_system_wof_enabled)); // check for non-zero freq, voltage, or current in valid operating points - for (i = 0; i <= VPD_PV_POINTS - 1; i++) + for (i = 0; i <= NUM_OP_POINTS - 1; i++) { FAPI_INF("Checking for Zero valued data in each #V operating point (%s) f=%u v=%u i=%u v=%u i=%u", pv_op_str[pv_op_order[i]], @@ -1409,7 +1431,7 @@ proc_chk_valid_poundv(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_targe // Adjust the valid operating point based on UltraTurbo presence // and WOF enablement - *o_valid_pdv_points = VPD_PV_POINTS; + *o_valid_pdv_points = NUM_OP_POINTS; if (suspend_ut_check) { @@ -1465,8 +1487,8 @@ fapi_try_exit: /// ------------------------------------------------------------ /// \brief Copy VPD operating point into destination in assending order -/// \param[in] &src[VPD_PV_POINTS] => reference to source VPD structure (array) -/// \param[out] *dest[VPD_PV_POINTS] => pointer to destination VpdOperatingPoint structure +/// \param[in] &src[NUM_OP_POINTS] => reference to source VPD structure (array) +/// \param[out] *dest[NUM_OP_POINTS] => pointer to destination VpdOperatingPoint structure // \param[in] i_frequency_step_khz => Base frequency value for pstate calculation /// ------------------------------------------------------------ /// \note: this routine reads the keyword information in "VPD order" (eg Nominal, @@ -1479,9 +1501,9 @@ load_mvpd_operating_point ( const uint32_t i_src[PV_D][PV_W], uint32_t i_frequency_step_khz) { FAPI_INF(">> load_mvpd_operating_point"); - const uint8_t pv_op_order[VPD_PV_POINTS] = VPD_PV_ORDER; + const uint8_t pv_op_order[NUM_OP_POINTS] = VPD_PV_ORDER; - for (uint32_t i = 0; i < VPD_PV_POINTS; i++) + for (uint32_t i = 0; i < NUM_OP_POINTS; i++) { o_dest[i].frequency_mhz = revle32(i_src[pv_op_order[i]][0]); o_dest[i].vdd_mv = revle32(i_src[pv_op_order[i]][1]); @@ -1495,62 +1517,34 @@ load_mvpd_operating_point ( const uint32_t i_src[PV_D][PV_W], return fapi2::FAPI2_RC_SUCCESS; } // end load_mvpd_operating_point - fapi2::ReturnCode proc_get_vdm_parms ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, - VDMParmBlock* o_vdmpb) + GP_VDMParmBlock* o_vdmpb) { - uint8_t l_droop_small_override[VPD_PV_POINTS + 1]; - uint8_t l_droop_large_override[VPD_PV_POINTS + 1]; - uint8_t l_droop_extreme_override[VPD_PV_POINTS + 1]; - uint8_t l_overvolt_override[VPD_PV_POINTS + 1]; - uint16_t l_fmin_override_khz[VPD_PV_POINTS + 1]; - uint16_t l_fmax_override_khz[VPD_PV_POINTS + 1]; - uint8_t l_vid_compare_override_mv[VPD_PV_POINTS + 1]; - uint8_t l_vdm_response; - FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_VDM_DROOP_SMALL_OVERRIDE, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), - l_droop_small_override)); + o_vdmpb->droop_small_override)); FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_VDM_DROOP_LARGE_OVERRIDE, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), - l_droop_large_override)); + o_vdmpb->droop_large_override)); FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_VDM_DROOP_EXTREME_OVERRIDE, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), - l_droop_extreme_override)); + o_vdmpb->droop_extreme_override)); FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_VDM_OVERVOLT_OVERRIDE, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), - l_overvolt_override)); + o_vdmpb->overvolt_override)); FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_VDM_FMIN_OVERRIDE_KHZ, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), - l_fmin_override_khz)); + o_vdmpb->fmin_override_khz)); FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_VDM_FMAX_OVERRIDE_KHZ, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), - l_fmax_override_khz)); + o_vdmpb->fmax_override_khz)); FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_VDM_VID_COMPARE_OVERRIDE_MV, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), - l_vid_compare_override_mv)); - FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_DPLL_VDM_RESPONSE, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), l_vdm_response)); + o_vdmpb->vid_compare_override_mv)); + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_DPLL_VDM_RESPONSE, fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(), + o_vdmpb->vdm_response)); - o_vdmpb->droop_small_override_enable = l_droop_small_override[VPD_PV_POINTS]; - o_vdmpb->droop_large_override_enable = l_droop_large_override[VPD_PV_POINTS]; - o_vdmpb->droop_extreme_override_enable = l_droop_extreme_override[VPD_PV_POINTS]; - o_vdmpb->overvolt_override_enable = l_overvolt_override[VPD_PV_POINTS]; - o_vdmpb->fmin_override_khz_enable = l_fmin_override_khz[VPD_PV_POINTS]; - o_vdmpb->fmax_override_khz_enable = l_fmax_override_khz[VPD_PV_POINTS]; - o_vdmpb->vid_compare_override_mv_enable = l_vid_compare_override_mv[VPD_PV_POINTS]; - - o_vdmpb->vdm_response = l_vdm_response; - - for (uint8_t i = 0; i < VPD_PV_POINTS; i++) - { - o_vdmpb->droop_small_override[i] = l_droop_small_override[i]; - o_vdmpb->droop_large_override[i] = l_droop_large_override[i]; - o_vdmpb->droop_extreme_override[i] = l_droop_extreme_override[i]; - o_vdmpb->overvolt_override[i] = l_overvolt_override[i]; - o_vdmpb->fmin_override_khz[i] = l_fmin_override_khz[i]; - o_vdmpb->fmax_override_khz[i] = l_fmax_override_khz[i]; - o_vdmpb->vid_compare_override_mv[i] = l_vid_compare_override_mv[i]; - } fapi_try_exit: return fapi2::current_err; } + fapi2::ReturnCode proc_res_clock_setup ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, ResonantClockingSetup* o_resclk_setup, @@ -1666,13 +1660,13 @@ fapi_try_exit: // //p9_pstate_compute_vpd_pts // -void p9_pstate_compute_vpd_pts(VpdOperatingPoint (*o_operating_points)[VPD_PV_POINTS], +void p9_pstate_compute_vpd_pts(VpdOperatingPoint (*o_operating_points)[NUM_OP_POINTS], GlobalPstateParmBlock* i_gppb) { int p = 0; //RAW POINTS. We just copy them as is - for (p = 0; p < VPD_PV_POINTS; p++) + for (p = 0; p < NUM_OP_POINTS; p++) { o_operating_points[VPD_PT_SET_RAW][p].vdd_mv = (i_gppb->operating_points[p].vdd_mv) ; o_operating_points[VPD_PT_SET_RAW][p].vcs_mv = (i_gppb->operating_points[p].vcs_mv); @@ -1691,7 +1685,7 @@ void p9_pstate_compute_vpd_pts(VpdOperatingPoint (*o_operating_points)[VPD_PV_PO //SYSTEM PARAMS APPLIED POINTS //We first calculate everything in uV, and then divide by 1000. Doing this ensures //that integer division doesn't result in 0 for intermediate terms - for (p = 0; p < VPD_PV_POINTS; p++) + for (p = 0; p < NUM_OP_POINTS; p++) { o_operating_points[VPD_PT_SET_SYSP][p].vdd_mv = revle32((revle32(i_gppb->operating_points[p].vdd_mv) * 1000 + @@ -1717,7 +1711,7 @@ void p9_pstate_compute_vpd_pts(VpdOperatingPoint (*o_operating_points)[VPD_PV_PO } //BIASED POINTS - for (p = 0; p < VPD_PV_POINTS; p++) + for (p = 0; p < NUM_OP_POINTS; p++) { o_operating_points[VPD_PT_SET_BIASED][p].vdd_mv = revle32((revle32(i_gppb->operating_points[p].vdd_mv) * (200 + revle32(i_gppb->ext_biases[p].vdd_ext_hp))) / 200); @@ -1733,7 +1727,7 @@ void p9_pstate_compute_vpd_pts(VpdOperatingPoint (*o_operating_points)[VPD_PV_PO revle32(o_operating_points[VPD_PT_SET_BIASED][p].frequency_mhz)); } - for (p = 0; p < VPD_PV_POINTS; p++) + for (p = 0; p < NUM_OP_POINTS; p++) { o_operating_points[VPD_PT_SET_BIASED][p].pstate = (((revle32(o_operating_points[VPD_PT_SET_BIASED][ULTRA].frequency_mhz) - @@ -1748,7 +1742,7 @@ void p9_pstate_compute_vpd_pts(VpdOperatingPoint (*o_operating_points)[VPD_PV_PO //BIASED POINTS and SYSTEM PARMS APPLIED POINTS //We first calculate everything in uV, and then divide by 1000. Doing this ensures //that integer division doesn't result in 0 for intermediate terms - for (p = 0; p < VPD_PV_POINTS; p++) + for (p = 0; p < NUM_OP_POINTS; p++) { o_operating_points[VPD_PT_SET_BIASED_SYSP][p].vdd_mv = revle32(((revle32(o_operating_points[VPD_PT_SET_BIASED][p].vdd_mv) * 1000) + @@ -1798,7 +1792,7 @@ void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4], GlobalPstateParmBlock* o_gppb) { uint32_t tmp; - uint32_t eVidFP[VPD_PV_POINTS]; + uint32_t eVidFP[NUM_OP_POINTS]; do { @@ -1806,10 +1800,10 @@ void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4], //RAW VPD PTS SLOPES // //convert to a fixed-point number - eVidFP[POWERSAVE] = revle32(revle32(i_operating_points[VPD_PT_SET_RAW][POWERSAVE].vdd_mv) << EVID_SLOPE_FP_SHIFT); - eVidFP[NOMINAL] = revle32(revle32(i_operating_points[VPD_PT_SET_RAW][NOMINAL].vdd_mv) << EVID_SLOPE_FP_SHIFT); - eVidFP[TURBO] = revle32(revle32(i_operating_points[VPD_PT_SET_RAW][TURBO].vdd_mv) << EVID_SLOPE_FP_SHIFT); - eVidFP[ULTRA] = revle32(revle32(i_operating_points[VPD_PT_SET_RAW][ULTRA].vdd_mv) << EVID_SLOPE_FP_SHIFT); + eVidFP[POWERSAVE] = revle32(revle32(i_operating_points[VPD_PT_SET_RAW][POWERSAVE].vdd_mv) << VID_SLOPE_FP_SHIFT); + eVidFP[NOMINAL] = revle32(revle32(i_operating_points[VPD_PT_SET_RAW][NOMINAL].vdd_mv) << VID_SLOPE_FP_SHIFT); + eVidFP[TURBO] = revle32(revle32(i_operating_points[VPD_PT_SET_RAW][TURBO].vdd_mv) << VID_SLOPE_FP_SHIFT); + eVidFP[ULTRA] = revle32(revle32(i_operating_points[VPD_PT_SET_RAW][ULTRA].vdd_mv) << VID_SLOPE_FP_SHIFT); FAPI_INF("eVidFP[POWERSAVE] %x %04x", revle32(eVidFP[POWERSAVE]), revle32(i_operating_points[VPD_PT_SET_RAW][POWERSAVE].vdd_mv)); @@ -1818,7 +1812,7 @@ void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4], FAPI_INF("eVidFP[TURBO] %x %04x", revle32(eVidFP[TURBO]), revle32(i_operating_points[VPD_PT_SET_RAW][TURBO].vdd_mv)); FAPI_INF("eVidFP[ULTRA] %x %04x", revle32(eVidFP[ULTRA]), revle32(i_operating_points[VPD_PT_SET_RAW][ULTRA].vdd_mv)); - // ULTRA TURBO pstate check is not required..because it's pstate will be + // ULTRA TURBO pstate check is not required..because its pstate will be // 0 if (!(i_operating_points[VPD_PT_SET_RAW][POWERSAVE].pstate) || !(i_operating_points[VPD_PT_SET_RAW][NOMINAL].pstate) || @@ -1854,7 +1848,7 @@ void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4], //Calculate inverted slopes tmp = revle32((uint32_t)((-i_operating_points[VPD_PT_SET_RAW][NOMINAL].pstate + - i_operating_points[VPD_PT_SET_RAW][POWERSAVE].pstate) << EVID_SLOPE_FP_SHIFT) + i_operating_points[VPD_PT_SET_RAW][POWERSAVE].pstate) << VID_SLOPE_FP_SHIFT) / (uint32_t) (revle32(i_operating_points[VPD_PT_SET_RAW][NOMINAL].vdd_mv) - revle32(i_operating_points[VPD_PT_SET_RAW][POWERSAVE].vdd_mv))); o_gppb->VPsSlopes[VPD_SLOPES_RAW][REGION_POWERSAVE_NOMINAL] = revle16( revle32(tmp)); @@ -1863,7 +1857,7 @@ void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4], tmp = revle32((uint32_t)((-i_operating_points[VPD_PT_SET_RAW][TURBO].pstate + - i_operating_points[VPD_PT_SET_RAW][NOMINAL].pstate) << EVID_SLOPE_FP_SHIFT) + i_operating_points[VPD_PT_SET_RAW][NOMINAL].pstate) << VID_SLOPE_FP_SHIFT) / (uint32_t) (revle32(i_operating_points[VPD_PT_SET_RAW][TURBO].vdd_mv) - revle32(i_operating_points[VPD_PT_SET_RAW][NOMINAL].vdd_mv))); o_gppb->VPsSlopes[VPD_SLOPES_RAW][REGION_NOMINAL_TURBO] = revle16( revle32(tmp)); @@ -1872,7 +1866,7 @@ void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4], tmp = revle32((uint32_t)((-i_operating_points[VPD_PT_SET_RAW][ULTRA].pstate + - i_operating_points[VPD_PT_SET_RAW][TURBO].pstate) << EVID_SLOPE_FP_SHIFT) + i_operating_points[VPD_PT_SET_RAW][TURBO].pstate) << VID_SLOPE_FP_SHIFT) / (uint32_t) (revle32(i_operating_points[VPD_PT_SET_RAW][ULTRA].vdd_mv) - revle32(i_operating_points[VPD_PT_SET_RAW][TURBO].vdd_mv))); o_gppb->VPsSlopes[VPD_SLOPES_RAW][REGION_TURBO_ULTRA] = revle16( revle32(tmp)); @@ -1883,17 +1877,17 @@ void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4], //BIASED VPD PTS SLOPES // //convert to fixed-point number - eVidFP[POWERSAVE] = revle32(revle32(i_operating_points[VPD_PT_SET_BIASED][POWERSAVE].vdd_mv) << EVID_SLOPE_FP_SHIFT); - eVidFP[NOMINAL] = revle32(revle32(i_operating_points[VPD_PT_SET_BIASED][NOMINAL].vdd_mv) << EVID_SLOPE_FP_SHIFT); - eVidFP[TURBO] = revle32(revle32(i_operating_points[VPD_PT_SET_BIASED][TURBO].vdd_mv) << EVID_SLOPE_FP_SHIFT); - eVidFP[ULTRA] = revle32(revle32(i_operating_points[VPD_PT_SET_BIASED][ULTRA].vdd_mv) << EVID_SLOPE_FP_SHIFT); + eVidFP[POWERSAVE] = revle32(revle32(i_operating_points[VPD_PT_SET_BIASED][POWERSAVE].vdd_mv) << VID_SLOPE_FP_SHIFT); + eVidFP[NOMINAL] = revle32(revle32(i_operating_points[VPD_PT_SET_BIASED][NOMINAL].vdd_mv) << VID_SLOPE_FP_SHIFT); + eVidFP[TURBO] = revle32(revle32(i_operating_points[VPD_PT_SET_BIASED][TURBO].vdd_mv) << VID_SLOPE_FP_SHIFT); + eVidFP[ULTRA] = revle32(revle32(i_operating_points[VPD_PT_SET_BIASED][ULTRA].vdd_mv) << VID_SLOPE_FP_SHIFT); FAPI_INF("eVidFP[POWERSAVE] Biased %x", revle32(eVidFP[POWERSAVE])); FAPI_INF("eVidFP[NOMINAL] Biased %x", revle32(eVidFP[NOMINAL])); FAPI_INF("eVidFP[TURBO] Biased %x", revle32(eVidFP[TURBO])); FAPI_INF("eVidFP[ULTRA] Biased %x", revle32(eVidFP[ULTRA])); - // ULTRA TURBO pstate check is not required..because it's pstate will be + // ULTRA TURBO pstate check is not required..because its pstate will be // 0 if (!(i_operating_points[VPD_PT_SET_BIASED][POWERSAVE].pstate) || !(i_operating_points[VPD_PT_SET_BIASED][NOMINAL].pstate) || @@ -1945,7 +1939,7 @@ void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4], //Calculate inverted slopes tmp = revle32((uint32_t)((-i_operating_points[VPD_PT_SET_BIASED][NOMINAL].pstate + - i_operating_points[VPD_PT_SET_BIASED][POWERSAVE].pstate) << EVID_SLOPE_FP_SHIFT) + i_operating_points[VPD_PT_SET_BIASED][POWERSAVE].pstate) << VID_SLOPE_FP_SHIFT) / (uint32_t) (revle32(i_operating_points[VPD_PT_SET_BIASED][NOMINAL].vdd_mv) - revle32(i_operating_points[VPD_PT_SET_BIASED][POWERSAVE].vdd_mv))); o_gppb->VPsSlopes[VPD_SLOPES_BIASED][REGION_POWERSAVE_NOMINAL] = revle16(revle32(tmp)); @@ -1955,7 +1949,7 @@ void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4], tmp = revle32((uint32_t)((-i_operating_points[VPD_PT_SET_BIASED][TURBO].pstate + - i_operating_points[VPD_PT_SET_BIASED][NOMINAL].pstate) << EVID_SLOPE_FP_SHIFT) + i_operating_points[VPD_PT_SET_BIASED][NOMINAL].pstate) << VID_SLOPE_FP_SHIFT) / (uint32_t) (revle32(i_operating_points[VPD_PT_SET_BIASED][TURBO].vdd_mv) - revle32(i_operating_points[VPD_PT_SET_BIASED][NOMINAL].vdd_mv))); o_gppb->VPsSlopes[VPD_SLOPES_BIASED][REGION_NOMINAL_TURBO] = revle16(revle32(tmp)); @@ -1963,7 +1957,7 @@ void p9_pstate_compute_PsV_slopes(VpdOperatingPoint i_operating_points[][4], (revle16(o_gppb->VPsSlopes[VPD_SLOPES_BIASED][REGION_NOMINAL_TURBO])), revle32(tmp)); tmp = revle32((uint32_t)((-i_operating_points[VPD_PT_SET_BIASED][ULTRA].pstate + - i_operating_points[VPD_PT_SET_BIASED][TURBO].pstate) << EVID_SLOPE_FP_SHIFT) + i_operating_points[VPD_PT_SET_BIASED][TURBO].pstate) << VID_SLOPE_FP_SHIFT) / (uint32_t) (revle32(i_operating_points[VPD_PT_SET_BIASED][ULTRA].vdd_mv) - revle32(i_operating_points[VPD_PT_SET_BIASED][TURBO].vdd_mv))); o_gppb->VPsSlopes[VPD_SLOPES_BIASED][REGION_TURBO_ULTRA] = revle16(revle32(tmp)); @@ -1999,7 +1993,7 @@ gppb_print(GlobalPstateParmBlock* i_gppb) FAPI_INF("Operating Points: Frequency VDD(mV) IDD(100mA) VCS(mV) ICS(100mA)"); - for (uint32_t i = 0; i < VPD_PV_POINTS; i++) + for (uint32_t i = 0; i < NUM_OP_POINTS; i++) { sprintf(l_buffer, " "); sprintf(l_temp_buffer, " %04X (%4d) ", @@ -2169,45 +2163,6 @@ gppb_print(GlobalPstateParmBlock* i_gppb) FAPI_INF("%s", l_buffer); } - FAPI_INF( "VDM Param Block "); - FAPI_INF("Operating Points: Overvolt Thr Small Thr Large Thr Extreme Thr Small Freq Drop Large Freq Drop"); - - for (uint32_t i = 0; i < VPD_PV_POINTS; i++) - { - sprintf(l_buffer, " "); - sprintf(l_temp_buffer, " %04X (%4d) ", - i_gppb->vdm.overvolt_override[i], - (i_gppb->vdm.overvolt_override[i])); - strcat(l_buffer, l_temp_buffer); - - sprintf(l_temp_buffer, " %04X (%4d) ", - i_gppb->vdm.droop_small_override[i], - (i_gppb->vdm.droop_small_override[i])); - strcat(l_buffer, l_temp_buffer); - - sprintf(l_temp_buffer, " %04X (%4d) ", - i_gppb->vdm.droop_large_override[i], - (i_gppb->vdm.droop_large_override[i])); - strcat(l_buffer, l_temp_buffer); - - sprintf(l_temp_buffer, " %04X (%4d) ", - i_gppb->vdm.droop_extreme_override[i], - (i_gppb->vdm.droop_extreme_override[i])); - strcat(l_buffer, l_temp_buffer); - - sprintf(l_temp_buffer, " %04X (%4d) ", - i_gppb->vdm.fmin_override_khz[i], - (i_gppb->vdm.fmin_override_khz[i])); - strcat(l_buffer, l_temp_buffer); - - sprintf(l_temp_buffer, " %04X (%4d) ", - i_gppb->vdm.fmax_override_khz[i], - (i_gppb->vdm.fmax_override_khz[i])); - strcat(l_buffer, l_temp_buffer); - - FAPI_INF("%s", l_buffer); - } - // Resonant Clocking FAPI_DBG("Resonant Clocking Setup:"); FAPI_DBG("Pstates ResClk Index"); @@ -2241,7 +2196,7 @@ oppb_print(OCCPstateParmBlock* i_oppb) // fprintf(stream, "Magic: %llu\n", revle64(i_oppb->magic)); FAPI_INF("Operating Points: Frequency VDD(mV) IDD(100mA) VCS(mV) ICS(100mA)"); - for (uint32_t i = 0; i < VPD_PV_POINTS; i++) + for (uint32_t i = 0; i < NUM_OP_POINTS; i++) { sprintf(l_buffer, " "); sprintf(l_temp_buffer, " %04X (%4d) ", @@ -2379,23 +2334,20 @@ int freq2pState (const GlobalPstateParmBlock* gppb, fapi2::ReturnCode proc_get_mvpd_poundw(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, uint8_t i_poundv_bucketId, - VDMParmBlock* o_vdmpb, - PoundW_data* o_data) + LP_VDMParmBlock* o_vdmpb, + PoundW_data* o_data, + fapi2::voltageBucketData_t i_poundv_data) { std::vector<fapi2::Target<fapi2::TARGET_TYPE_EQ>> l_eqChiplets; fapi2::vdmData_t l_vdmBuf; uint8_t j = 0; uint8_t bucket_id = 0; - uint8_t l_overvolt_small_offset = 4; - uint8_t l_large_extreme_offset = 5; - uint8_t l_min_freq_offset = 6; - uint8_t l_max_freq_offset = 7; - uint8_t jump_to_next_mode = 0; - uint8_t l_data = 0; + const uint16_t VDM_VOLTAGE_IN_MV = 512; + const uint16_t VDM_GRANULARITY = 4; do { - // Below fiels for Nominal, Powersave, Turbo, Ultra Turbo + // Below fields for Nominal, Powersave, Turbo, Ultra Turbo // I-VDD Nominal TDP AC current 2B // I-VDD Nominal TDP DC current 2B // Overvolt Threshold 0.5 Upper nibble of byte @@ -2441,97 +2393,78 @@ proc_get_mvpd_poundw(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target if (l_poundw_static_data) { FAPI_INF("attribute ATTR_POUND_W_STATIC_DATA_ENABLE is set"); - memcpy (&l_vdmBuf, &g_vpdData, sizeof (g_vpdData)); - - // copy the data to the pound w structure + // copy the data to the pound w structure from a hardcoded table memcpy (o_data, &g_vpdData, sizeof (g_vpdData)); } else { FAPI_INF("attribute ATTR_POUND_W_STATIC_DATA_ENABLE is NOT set"); - // copy the data to the pound w structure + // copy the data to the pound w structure from the actual VPD image memcpy (o_data, l_vdmBuf.vdmData, sizeof (l_vdmBuf.vdmData)); } - const uint8_t pv_op_order[VPD_PV_POINTS] = VPD_PV_ORDER; - - if (!(o_vdmpb->overvolt_override_enable)) - { - jump_to_next_mode = 0; + //Re-ordering to Natural order + // When we read the data from VPD image the order will be N,PS,T,UT. + // But we need the order PS,N,T,UT.. hence we are swapping the data + // between PS and Nominal. + poundw_entry_t l_tmp_data; + memcpy (&l_tmp_data, &(o_data->poundw[VPD_PV_NOMINAL]), sizeof (poundw_entry_t)); + memcpy(&(o_data->poundw[VPD_PV_NOMINAL]), &(o_data->poundw[VPD_PV_POWERSAVE]), sizeof(poundw_entry_t)); + memcpy (&(o_data->poundw[VPD_PV_POWERSAVE]), &l_tmp_data, sizeof(poundw_entry_t)); - for (uint8_t i = 0; i < (VPD_PV_POINTS); i++) - { - l_data = l_vdmBuf.vdmData[l_overvolt_small_offset + jump_to_next_mode]; - jump_to_next_mode += 10; - l_data = l_data >> 4; - o_vdmpb->overvolt_override[pv_op_order[i]] = l_data; - } - } - if (!(o_vdmpb->droop_small_override_enable)) + //Validation of VPD Data + // + //If all VID compares are zero then use #V VDD voltage to populate local + //data structure..So that we make progress in lab with early hardware + if ( !(o_data->poundw[NOMINAL].vdm_vid_compare_ivid) && + !(o_data->poundw[POWERSAVE].vdm_vid_compare_ivid) && + !(o_data->poundw[TURBO].vdm_vid_compare_ivid) && + !(o_data->poundw[ULTRA].vdm_vid_compare_ivid)) { - jump_to_next_mode = 0; - - for (uint8_t i = 0; i < (VPD_PV_POINTS); i++) - { - l_data = l_vdmBuf.vdmData[l_overvolt_small_offset + jump_to_next_mode]; - jump_to_next_mode += 10; - l_data = l_data & 0x0F; - o_vdmpb->droop_small_override[pv_op_order[i]] = l_data; - } - } - - if (!(o_vdmpb->droop_large_override_enable)) + //vdm_vid_compare_ivid will be in ivid units (eg HEX((Compare + //Voltage (mv) - 512mV)/4mV). + o_data->poundw[NOMINAL].vdm_vid_compare_ivid = + (i_poundv_data.VddNomVltg - VDM_VOLTAGE_IN_MV) / VDM_GRANULARITY; + o_data->poundw[POWERSAVE].vdm_vid_compare_ivid = + (i_poundv_data.VddPSVltg - VDM_VOLTAGE_IN_MV ) / VDM_GRANULARITY; + o_data->poundw[TURBO].vdm_vid_compare_ivid = + (i_poundv_data.VddTurboVltg - VDM_VOLTAGE_IN_MV ) / VDM_GRANULARITY; + o_data->poundw[ULTRA].vdm_vid_compare_ivid = + (i_poundv_data.VddUTurboVltg - VDM_VOLTAGE_IN_MV) / VDM_GRANULARITY; + }//if any one of the VID compares are zero, then need to fail because of BAD VPD image. + else if ( !(o_data->poundw[NOMINAL].vdm_vid_compare_ivid) || + !(o_data->poundw[POWERSAVE].vdm_vid_compare_ivid) || + !(o_data->poundw[TURBO].vdm_vid_compare_ivid) || + !(o_data->poundw[ULTRA].vdm_vid_compare_ivid)) { - jump_to_next_mode = 0; - - for (uint8_t i = 0; i < (VPD_PV_POINTS); i++) - { - l_data = l_vdmBuf.vdmData[l_large_extreme_offset + jump_to_next_mode]; - jump_to_next_mode += 10; - l_data = l_data >> 4; - o_vdmpb->droop_large_override[pv_op_order[i]] = l_data; - } + FAPI_ERR("Pound W data contains invalid values"); + break; } - if (!(o_vdmpb->droop_extreme_override_enable)) - { - jump_to_next_mode = 0; - for (uint8_t i = 0; i < (VPD_PV_POINTS); i++) - { - l_data = l_vdmBuf.vdmData[l_large_extreme_offset + jump_to_next_mode]; - jump_to_next_mode += 10; - l_data = l_data & 0x0F; - o_vdmpb->droop_extreme_override[pv_op_order[i]] = l_data; - } - } + //Biased compare vid data + fapi2::ATTR_VDM_VID_COMPARE_BIAS_0P5PCT_Type l_bias_value; - if (!(o_vdmpb->fmin_override_khz_enable)) - { - jump_to_next_mode = 0; - for (uint8_t i = 0; i < (VPD_PV_POINTS); i++) - { - l_data = l_vdmBuf.vdmData[l_min_freq_offset + jump_to_next_mode]; - jump_to_next_mode += 10; - o_vdmpb->fmin_override_khz[pv_op_order[i]] = l_data; - } - } + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_VDM_VID_COMPARE_BIAS_0P5PCT, + i_target, + l_bias_value), + "Error from FAPI_ATTR_GET for attribute ATTR_VDM_VID_COMPARE_BIAS_0P5PCT"); - if (!(o_vdmpb->fmax_override_khz_enable)) + float l_pound_w_points[NUM_OP_POINTS]; + + for (uint8_t i = 0; i < NUM_OP_POINTS; i++) { - jump_to_next_mode = 0; + l_pound_w_points[i] = 1.0 + (BIAS_PCT_UNIT * (float)l_bias_value[i]); + o_data->poundw[i].vdm_vid_compare_ivid = (uint32_t)(o_data->poundw[i].vdm_vid_compare_ivid * l_pound_w_points[i]); - for (uint8_t i = 0; i < (VPD_PV_POINTS); i++) - { - l_data = l_vdmBuf.vdmData[l_max_freq_offset + jump_to_next_mode]; - jump_to_next_mode += 10; - o_vdmpb->fmax_override_khz[pv_op_order[i]] = l_data; - } + FAPI_INF ("vdm_vid_compare_ivid %x %x, %x", o_data->poundw[i].vdm_vid_compare_ivid, + o_data->poundw[i].vdm_vid_compare_ivid, l_pound_w_points[i]); } + memcpy(&(o_vdmpb->vpd_w_data), o_data, sizeof(o_vdmpb->vpd_w_data)); } while(0); @@ -2800,3 +2733,159 @@ uint16_t roundUp(float i_value) { return ((uint16_t)(i_value == (uint16_t)i_value ? i_value : i_value + 1)); } +// +// p9_pstate_compute_vdm_threshold_pts +// +void p9_pstate_compute_vdm_threshold_pts(PoundW_data i_data, + LocalPstateParmBlock* io_lppb) +{ + int p = 0; + + //VID POINTS + for (p = 0; p < NUM_OP_POINTS; p++) + { + io_lppb->vid_point_set[p] = i_data.poundw[p].vdm_vid_compare_ivid; + FAPI_INF("Bi:VID=%x", io_lppb->vid_point_set[p]); + } + + // Threshold points + for (p = 0; p < NUM_OP_POINTS; p++) + { + // overvolt threshold + io_lppb->threshold_set[p][0] = g_GreyCodeIndexMapping[(i_data.poundw[p].vdm_overvolt_small_thresholds >> 4) & 0x0F]; + + FAPI_INF("Bi: OV TSHLD =%d", io_lppb->threshold_set[p][0]); + // small threshold + io_lppb->threshold_set[p][1] = (g_GreyCodeIndexMapping[i_data.poundw[p].vdm_overvolt_small_thresholds & 0x0F]); + + FAPI_INF("Bi: SM TSHLD =%d", io_lppb->threshold_set[p][1]); + // large threshold + io_lppb->threshold_set[p][2] = (g_GreyCodeIndexMapping[(i_data.poundw[p].vdm_large_extreme_thresholds >> 4) & 0x0F]); + + FAPI_INF("Bi: LG TSHLD =%d", io_lppb->threshold_set[p][2]); + // extreme threshold + io_lppb->threshold_set[p][3] = (g_GreyCodeIndexMapping[i_data.poundw[p].vdm_large_extreme_thresholds & 0x0F]); + + FAPI_INF("Bi: EX TSHLD =%d", io_lppb->threshold_set[p][3]); + + } +} +// +// +// p9_pstate_compute_PsVIDCompSlopes_slopes +// +void p9_pstate_compute_PsVIDCompSlopes_slopes(PoundW_data i_data, + LocalPstateParmBlock* io_lppb, + uint8_t* i_pstate) +{ + uint32_t tmp; + uint32_t cVidFP[NUM_OP_POINTS]; + + do + { + // + //BIASED VPD PTS SLOPES + // + //convert to fixed-point number + for (uint8_t p = 0; p < NUM_OP_POINTS; ++p) + { + cVidFP[p] = revle32((io_lppb->vid_point_set[p]) << VID_SLOPE_FP_SHIFT); + } + + + FAPI_INF("cVidFP[POWERSAVE] Biased %x", revle32(cVidFP[POWERSAVE])); + FAPI_INF("cVidFP[NOMINAL] Biased %x", revle32(cVidFP[NOMINAL])); + FAPI_INF("cVidFP[TURBO] Biased %x", revle32(cVidFP[TURBO])); + FAPI_INF("cVidFP[ULTRA] Biased %x", revle32(cVidFP[ULTRA])); + + // ULTRA TURBO pstate check is not required..because its pstate will be + // 0 + if (!(i_pstate[POWERSAVE]) || + !(i_pstate[NOMINAL]) || + !(i_pstate[TURBO])) + { + FAPI_ERR("PSTATE value shouldn't be zero for VPD_PT_SET_BIASED"); + break; + } + + //Calculate slopes + + tmp = ((uint32_t)(cVidFP[NOMINAL] - cVidFP[POWERSAVE]) / + (uint32_t)(-i_pstate[NOMINAL] + i_pstate[POWERSAVE])); + io_lppb->PsVIDCompSlopes[REGION_POWERSAVE_NOMINAL] = revle32(tmp); + FAPI_INF("PsVIDCompSlopes[REGION_POWERSAVE_NOMINAL] %X tmp %X", + (revle16(io_lppb->PsVIDCompSlopes[REGION_POWERSAVE_NOMINAL])), revle32(tmp)); + + + tmp = ((uint32_t)(cVidFP[TURBO] - cVidFP[NOMINAL]) / + (uint32_t)(-i_pstate[TURBO] + i_pstate[NOMINAL])); + io_lppb->PsVIDCompSlopes[REGION_NOMINAL_TURBO] = revle32(tmp); + FAPI_INF("PsVIDCompSlopes[REGION_NOMINAL_TURBO] %X tmp %X", + (revle16(io_lppb->PsVIDCompSlopes[REGION_NOMINAL_TURBO])), revle32(tmp)); + + tmp = ((uint32_t)(cVidFP[ULTRA] - cVidFP[TURBO]) / + (uint32_t)(-i_pstate[ULTRA] + i_pstate[TURBO])); + io_lppb->PsVIDCompSlopes[REGION_TURBO_ULTRA] = revle32(tmp); + FAPI_INF("PsVIDCompSlopes[REGION_TURBO_ULTRA] %X tmp %X", + (revle16(io_lppb->PsVIDCompSlopes[REGION_TURBO_ULTRA])), revle32(tmp)); + } + while(0); +} + +// +// +// p9_pstate_compute_PsVDMThreshSlopes +// +void p9_pstate_compute_PsVDMThreshSlopes( + LocalPstateParmBlock* io_lppb, + uint8_t* i_pstate) +{ + do + { + // ULTRA TURBO pstate check is not required..because its pstate will be + // 0 + if (!(i_pstate[POWERSAVE]) || + !(i_pstate[NOMINAL]) || + !(i_pstate[TURBO])) + { + FAPI_ERR("PSTATE value shouldn't be zero"); + break; + } + + //Calculate slopes + // + for (uint8_t i = 0; i < NUM_THRESHOLD_POINTS; ++i) + { + io_lppb->PsVDMThreshSlopes[REGION_POWERSAVE_NOMINAL][i] = + revle16((uint16_t)((float)(1 << THRESH_SLOPE_FP_SHIFT) * ((float)(io_lppb->threshold_set[NOMINAL][i] - + io_lppb->threshold_set[POWERSAVE][i]) / + (float)(-i_pstate[NOMINAL] + i_pstate[POWERSAVE])))); + FAPI_INF("PsVDMThreshSlopes REGION_POWERSAVE_NOMINAL %x TH_N %d TH_P %d PS_P %d PS_N %d", + revle16(io_lppb->PsVDMThreshSlopes[REGION_POWERSAVE_NOMINAL][i]), io_lppb->threshold_set[NOMINAL][i], + io_lppb->threshold_set[POWERSAVE][i], i_pstate[POWERSAVE], i_pstate[NOMINAL]); + } + + for (uint8_t i = 0; i < NUM_THRESHOLD_POINTS; ++i) + { + io_lppb->PsVDMThreshSlopes[REGION_NOMINAL_TURBO][i] = + revle16((uint16_t)((float)(1 << THRESH_SLOPE_FP_SHIFT) * ((float)(io_lppb->threshold_set[TURBO][i] - + io_lppb->threshold_set[NOMINAL][i]) / + (float)(-i_pstate[TURBO] + i_pstate[NOMINAL])))); + FAPI_INF("PsVDMThreshSlopes REGION_NOMINAL_TURBO %x TH_T %d TH_N %d", + revle16(io_lppb->PsVDMThreshSlopes[REGION_NOMINAL_TURBO][i]), io_lppb->threshold_set[TURBO][i], + io_lppb->threshold_set[NOMINAL][i]); + } + + for (uint8_t i = 0; i < NUM_THRESHOLD_POINTS; ++i) + { + io_lppb->PsVDMThreshSlopes[REGION_TURBO_ULTRA][i] = + revle16((uint16_t)((float)(1 << THRESH_SLOPE_FP_SHIFT) * ((float)(io_lppb->threshold_set[ULTRA][i] - + io_lppb->threshold_set[TURBO][i]) / + (float) (-i_pstate[ULTRA] + i_pstate[TURBO])))); + FAPI_INF("PsVDMThreshSlopes REGION_TURBO_ULTRA %x TH_U %d TH_T %d", + revle16(io_lppb->PsVDMThreshSlopes[REGION_TURBO_ULTRA][i]), + io_lppb->threshold_set[ULTRA][i], io_lppb->threshold_set[TURBO][i]); + } + } + while(0); +} diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.H b/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.H index 3c49cc4ad..db7efc8f6 100644 --- a/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.H +++ b/src/import/chips/p9/procedures/hwp/pm/p9_pstate_parameter_block.H @@ -127,7 +127,7 @@ typedef struct //Section added back by ssrivath // START OF PARMS REQUIRED VPD parsing procedures -//#define S132A_POINTS 4 - Replaced by VPD_PV_POINTS +//#define S132A_POINTS 4 - Replaced by NUM_OP_POINTS #define PSTATE_STEPSIZE 1 #define EVRM_DELAY_NS 100 #define DEAD_ZONE_5MV 20 // 100mV @@ -319,16 +319,18 @@ proc_get_mvpd_iddq ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target /// ---------------------------------------------------------------- /// @brief Get #W data and put into array /// @param[in] i_target => Chip Target -/// @param[in] i_poundv_bucketId => Pound V bucket id +/// @param[in] i_poundv_bucketId => #V bucket id /// @param[out] o_vdmpb => Vdmparamblock data -/// @param[out] o_data => Pound w data +/// @param[out] o_poundw_data => #W data +/// @paramg[in] i_poundv_data => #V data /// @return FAPI2::SUCCESS /// ---------------------------------------------------------------- fapi2::ReturnCode proc_get_mvpd_poundw(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, uint8_t i_poundv_bucketId, - VDMParmBlock* o_vdmpb, - PoundW_data* o_data + LP_VDMParmBlock* o_vdmpb, + PoundW_data* o_poundw_data, + fapi2::voltageBucketData_t i_poundv_data ); /// ----------------------------------------------------------------------- /// @brief Get needed attributes @@ -352,7 +354,7 @@ proc_get_attributes ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_targe fapi2::ReturnCode proc_get_extint_bias ( uint32_t io_attr_mvpd_data[PV_D][PV_W], const AttributeList* i_attr, - VpdBias o_vpdbias[VPD_PV_POINTS] ); + VpdBias o_vpdbias[NUM_OP_POINTS] ); /// ------------------------------------------------------------------- /// @brief Boost max frequency in pstate table based on boost attribute @@ -411,8 +413,8 @@ load_wof_attributes ( PstateSuperStructure* io_pss, /// ------------------------------------------------------------ /// @brief Copy VPD operating point into destination in assending order -/// @param[in] i_src[VPD_PV_POINTS] => Source VPD structure (array) -/// @param[out] * o_dest[VPD_PV_POINTS] => pointer to destination VpdOperatingPoint structure +/// @param[in] i_src[NUM_OP_POINTS] => Source VPD structure (array) +/// @param[out] * o_dest[NUM_OP_POINTS] => pointer to destination VpdOperatingPoint structure /// @return FAPI2::SUCCESS /// ------------------------------------------------------------ @@ -430,7 +432,8 @@ load_mvpd_operating_point ( const uint32_t i_src[PV_D][PV_W], fapi2::ReturnCode proc_get_vdm_parms ( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, - VDMParmBlock* o_vdmpb); + GP_VDMParmBlock* o_vdmpb); + /// ---------------------------------------------------------------- /// @brief Get resonant clocking parameters from attributes @@ -467,7 +470,7 @@ proc_set_resclk_table_attrs(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i // // p9_pstate_compute_vpd_pts // -void p9_pstate_compute_vpd_pts(VpdOperatingPoint (*o_operating_points)[VPD_PV_POINTS], +void p9_pstate_compute_vpd_pts(VpdOperatingPoint (*o_operating_points)[NUM_OP_POINTS], GlobalPstateParmBlock* i_gppb); // // p9_pstate_compute_PsV_slopes @@ -558,6 +561,22 @@ uint16_t get_iac_vdn_value (uint16_t i_vdd_value, ///round up the floating point value uint16_t roundUp(float i_value); + +///Compute VID points +void p9_pstate_compute_vdm_threshold_pts(PoundW_data i_data, + LocalPstateParmBlock* io_lppb); + +///Biased slope calculation +void p9_pstate_compute_PsVIDCompSlopes_slopes(PoundW_data i_data, + LocalPstateParmBlock* io_lppb, + uint8_t* i_pstate); + +// p9_pstate_compute_PsVDMThreshSlopes +// +void p9_pstate_compute_PsVDMThreshSlopes( + LocalPstateParmBlock* io_lppb, + uint8_t* i_pstate); + /// @typedef p9_pstate_parameter_block_FP_t /// function pointer typedef definition for HWP call support typedef fapi2::ReturnCode (*p9_pstate_parameter_block_FP_t) ( diff --git a/src/import/chips/p9/procedures/xml/attribute_info/pm_plat_attributes.xml b/src/import/chips/p9/procedures/xml/attribute_info/pm_plat_attributes.xml index aa5fbea8e..19dfbb43a 100644 --- a/src/import/chips/p9/procedures/xml/attribute_info/pm_plat_attributes.xml +++ b/src/import/chips/p9/procedures/xml/attribute_info/pm_plat_attributes.xml @@ -1902,4 +1902,26 @@ </attribute> <!-- ********************************************************************* --> + <attribute> + <id>ATTR_VDM_VID_COMPARE_BIAS_0P5PCT</id> + <targetType>TARGET_TYPE_PROC_CHIP</targetType> + <description> + VDM Voltage Compare Bias - % of bias (signed twos + complement in + 0.5 percent steps) that is applied to the #W VDM + VID Compare before placement in the respective Pstate + Paramter Blocks that will be consumed + by Hcode. + Array of 4 entries: 0 = PowerSave, 1 = + Nominal; 2 = Turbo; 3 = UltraTurbo + If index 4 is non-zero, the + other entries are considered + valid.Producer:MRWB. + </description> + <valueType>int8</valueType> + <array>4</array> + <initToZero/> + <platInit/> + </attribute> + </attributes> diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml index 2ea4cf498..aff28aeef 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types.xml @@ -34079,4 +34079,31 @@ Measured in GB</description> </hwpfToHbAttrMap> </attribute> +<attribute> + <id>VDM_VID_COMPARE_BIAS_0P5PCT</id> + <description> + VDM Voltage Compare Bias - % of bias (signed twos + complement in + 0.5 percent steps) that is applied to the #W VDM + VID Compare before placement in the respective Pstate + Paramter Blocks that will be consumed + by Hcode. + Array of 4 entries: 0 = PowerSave, 1 = + Nominal; 2 = Turbo; 3 = UltraTurbo + If index 4 is non-zero, the + other entries are considered + valid.Producer:MRWB. + </description> + <simpleType> + <uint8_t></uint8_t> + <array>4</array> + </simpleType> + <persistency>volatile-zeroed</persistency> + <readable/> + <hwpfToHbAttrMap> + <id>ATTR_VDM_VID_COMPARE_BIAS_0P5PCT</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> + </attribute> + </attributes> diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml index cfba022be..54508e64d 100755 --- a/src/usr/targeting/common/xmltohb/target_types.xml +++ b/src/usr/targeting/common/xmltohb/target_types.xml @@ -1337,6 +1337,7 @@ <attribute><id>CME_CHTM_TRACE_ENABLE</id></attribute> <attribute><id>CME_CHTM_TRACE_MEMORY_CONFIG</id></attribute> <attribute><id>PRD_HWP_PLID</id></attribute> + <attribute><id>VDM_VID_COMPARE_BIAS_0P5PCT</id></attribute> </targetType><!-- chip-processor-power9 --> |