diff options
author | crgeddes <crgeddes@us.ibm.com> | 2016-06-24 09:52:01 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-06-28 12:32:44 -0400 |
commit | 2af3c06087ba4cac442fe3c771f949effee014c0 (patch) | |
tree | f06dfc187dde047bafce36b599d1ad0b958b3717 | |
parent | d9924e34b630b7a57ab036dfb9f02808a5fec607 (diff) | |
download | talos-hostboot-2af3c06087ba4cac442fe3c771f949effee014c0.tar.gz talos-hostboot-2af3c06087ba4cac442fe3c771f949effee014c0.zip |
Add parameter to setup evid to define action for HWP
This hwp is called at 2 different points during the IPL and
we do not want to reset default values if we have already done
it once.
Change-Id: Ia621802762b7fc79cedb1f8609477936e2c2cec6
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/26254
Tested-by: Jenkins Server
Tested-by: PPE CI
Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com>
Tested-by: Hostboot CI
Reviewed-by: Andres A. Lugo-Reyes <aalugore@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/26267
Tested-by: FSP CI Jenkins
3 files changed, 138 insertions, 110 deletions
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_setup_evid.C b/src/import/chips/p9/procedures/hwp/pm/p9_setup_evid.C index 3206d9221..bf4e71489 100644 --- a/src/import/chips/p9/procedures/hwp/pm/p9_setup_evid.C +++ b/src/import/chips/p9/procedures/hwp/pm/p9_setup_evid.C @@ -174,7 +174,8 @@ struct avsbus_attrs_t //@return Return code void fapi2::ReturnCode avsInitAttributes(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, - avsbus_attrs_t* attrs) + avsbus_attrs_t* attrs, + const VoltageConfigActions_t i_action) { attrs->vdd_bus_num = DEFAULT_VDD_BUS_NUMBER; @@ -203,60 +204,71 @@ avsInitAttributes(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_VDN_BOOT_VOLTAGE, i_target, attrs->vdn_voltage_mv)); - // If attribute values are zero, use the default values (hardcoded) - // check VDD VID - if (attrs->vdd_voltage_mv == 0) + //We only wish to compute voltage setting defaults if the action + //inputed to the HWP tells us to + if(i_action == COMPUTE_VOLTAGE_SETTINGS) { - // Default voltage if mailbox value is not set - - // @todo L3 - Eventually, this should replaced with an error point - // to indicate that the mailbox -> attributes haven't been setup - - attrs->vdd_voltage_mv = DEFAULT_BOOT_VDD_VOLTAGE_MV; - FAPI_INF("VDD boot voltage not set in attributes. Setting to default of %d mV (%x)", - attrs->vdd_voltage_mv, attrs->vdd_voltage_mv); - } - else - { - FAPI_INF("VDD boot voltage = %d mV (%x)", - attrs->vdd_voltage_mv, attrs->vdd_voltage_mv); - } - - // check VCS VID - if (attrs->vcs_voltage_mv == 0) - { - // Default voltage if mailbox value is not set - - // @todo L3 - Eventually, this should replaced with an error point - // to indicate that the mailbox -> attributes haven't been setup - - attrs->vcs_voltage_mv = DEFAULT_BOOT_VCS_VOLTAGE_MV; - FAPI_INF("VCS boot voltage not set in attributes. Setting to default of %d mV (%x)", - attrs->vcs_voltage_mv, attrs->vcs_voltage_mv); - } - else - { - FAPI_INF("VCS boot voltage = %d mV (%x)", - attrs->vcs_voltage_mv, attrs->vcs_voltage_mv); - } - - // check VDN VID - if (attrs->vdn_voltage_mv == 0) - { - // Default voltage if mailbox value is not set - - // @todo -L3 Eventually, this should replaced with an error point - // to indicate that the mailbox -> attributes haven't been setup - - attrs->vdn_voltage_mv = DEFAULT_BOOT_VDN_VOLTAGE_MV; - FAPI_INF("VDN boot voltage not set in attributes. Setting to default of %d mV (%x)", - attrs->vdn_voltage_mv, attrs->vdn_voltage_mv); - } - else - { - FAPI_INF("VDN boot voltage = %d mV (%x)", - attrs->vdn_voltage_mv, attrs->vdn_voltage_mv); + // If attribute values are zero, use the default values (hardcoded) + // check VDD VID + if (attrs->vdd_voltage_mv == 0) + { + // Default voltage if mailbox value is not set + + // @todo L3 - Eventually, this should replaced with an error point + // to indicate that the mailbox -> attributes haven't been setup + + attrs->vdd_voltage_mv = DEFAULT_BOOT_VDD_VOLTAGE_MV; + FAPI_INF("VDD boot voltage not set in attributes. Setting to default of %d mV (%x)", + attrs->vdd_voltage_mv, attrs->vdd_voltage_mv); + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_VDD_BOOT_VOLTAGE, i_target, + attrs->vdd_voltage_mv)); + } + else + { + FAPI_INF("VDD boot voltage = %d mV (%x)", + attrs->vdd_voltage_mv, attrs->vdd_voltage_mv); + } + + // check VCS VID + if (attrs->vcs_voltage_mv == 0) + { + // Default voltage if mailbox value is not set + + // @todo L3 - Eventually, this should replaced with an error point + // to indicate that the mailbox -> attributes haven't been setup + + attrs->vcs_voltage_mv = DEFAULT_BOOT_VCS_VOLTAGE_MV; + FAPI_INF("VCS boot voltage not set in attributes. Setting to default of %d mV (%x)", + attrs->vcs_voltage_mv, attrs->vcs_voltage_mv); + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_VCS_BOOT_VOLTAGE, i_target, + attrs->vcs_voltage_mv)); + } + else + { + FAPI_INF("VCS boot voltage = %d mV (%x)", + attrs->vcs_voltage_mv, attrs->vcs_voltage_mv); + } + + // check VDN VID + if (attrs->vdn_voltage_mv == 0) + { + // Default voltage if mailbox value is not set + + // @todo -L3 Eventually, this should replaced with an error point + // to indicate that the mailbox -> attributes haven't been setup + + attrs->vdn_voltage_mv = DEFAULT_BOOT_VDN_VOLTAGE_MV; + FAPI_INF("VDN boot voltage not set in attributes. Setting to default of %d mV (%x)", + attrs->vdn_voltage_mv, attrs->vdn_voltage_mv); + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_VDN_BOOT_VOLTAGE, i_target, + attrs->vdn_voltage_mv)); + } + else + { + FAPI_INF("VDN boot voltage = %d mV (%x)", + attrs->vdn_voltage_mv, attrs->vdn_voltage_mv); + } } fapi_try_exit: @@ -265,58 +277,62 @@ fapi_try_exit: fapi2::ReturnCode -p9_setup_evid(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) +p9_setup_evid(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, const VoltageConfigActions_t i_action) { // AVSBus configuration variables avsbus_attrs_t attrs; // Read attribute - - FAPI_TRY(avsInitAttributes(i_target, &attrs)); - - // Initialize the buses - FAPI_TRY(avsInitExtVoltageControl(i_target, - p9avslib::AVSBUSVDD, BRIDGE_NUMBER), - "Initializing avsBus VDD, bridge %d", BRIDGE_NUMBER); - FAPI_TRY(avsInitExtVoltageControl(i_target, - p9avslib::AVSBUSVDN, BRIDGE_NUMBER), - "Initializing avsBus VDN, bridge %d", BRIDGE_NUMBER); - - // Should not be needed, as same AVSBus and different rails - // should share same initialization information - //FAPI_TRY(avsInitExtVoltageControl(i_target, - // p9avslib::AVSBUSVCS, BRIDGE_NUMBER), - // "Initializing avsBus VCS, bridge %d", BRIDGE_NUMBER); - - // Set Boot VDD Voltage - FAPI_TRY(avsVoltageWrite(i_target, - attrs.vdd_bus_num, - BRIDGE_NUMBER, - attrs.vdd_rail_select, - (uint32_t)attrs.vdd_voltage_mv), - "Setting VDD voltage via AVSBus %d, Bridge %d", - attrs.vdd_bus_num, - BRIDGE_NUMBER); - - // Set Boot VDN Voltage - FAPI_TRY(avsVoltageWrite(i_target, - attrs.vdn_bus_num, - BRIDGE_NUMBER, - attrs.vdn_rail_select, - (uint32_t)attrs.vdn_voltage_mv), - "Setting VDN voltage via AVSBus %d, Bridge %d", - attrs.vdn_bus_num, - BRIDGE_NUMBER); - - // Set Boot VCS Voltage - FAPI_TRY(avsVoltageWrite(i_target, - attrs.vcs_bus_num, - BRIDGE_NUMBER, - attrs.vcs_rail_select, - (uint32_t)attrs.vcs_voltage_mv), - "Setting VCS voltage via AVSBus %d, Bridge %d", - attrs.vcs_bus_num, - BRIDGE_NUMBER); + FAPI_TRY(avsInitAttributes(i_target, &attrs, i_action)); + + //We only wish to apply settings if i_action says to + if(i_action == APPLY_VOLTAGE_SETTINGS) + { + // Initialize the buses + FAPI_TRY(avsInitExtVoltageControl(i_target, + p9avslib::AVSBUSVDD, BRIDGE_NUMBER), + "Initializing avsBus VDD, bridge %d", BRIDGE_NUMBER); + FAPI_TRY(avsInitExtVoltageControl(i_target, + p9avslib::AVSBUSVDN, BRIDGE_NUMBER), + "Initializing avsBus VDN, bridge %d", BRIDGE_NUMBER); + + // Should not be needed, as same AVSBus and different rails + // should share same initialization information + //FAPI_TRY(avsInitExtVoltageControl(i_target, + // p9avslib::AVSBUSVCS, BRIDGE_NUMBER), + // "Initializing avsBus VCS, bridge %d", BRIDGE_NUMBER); + + // Set Boot VDD Voltage + FAPI_TRY(avsVoltageWrite(i_target, + attrs.vdd_bus_num, + BRIDGE_NUMBER, + attrs.vdd_rail_select, + (uint32_t)attrs.vdd_voltage_mv), + "Setting VDD voltage via AVSBus %d, Bridge %d", + attrs.vdd_bus_num, + BRIDGE_NUMBER); + + // Set Boot VDN Voltage + FAPI_TRY(avsVoltageWrite(i_target, + attrs.vdn_bus_num, + BRIDGE_NUMBER, + attrs.vdn_rail_select, + (uint32_t)attrs.vdn_voltage_mv), + "Setting VDN voltage via AVSBus %d, Bridge %d", + attrs.vdn_bus_num, + BRIDGE_NUMBER); + + // Set Boot VCS Voltage + FAPI_TRY(avsVoltageWrite(i_target, + attrs.vcs_bus_num, + BRIDGE_NUMBER, + attrs.vcs_rail_select, + (uint32_t)attrs.vcs_voltage_mv), + "Setting VCS voltage via AVSBus %d, Bridge %d", + attrs.vcs_bus_num, + BRIDGE_NUMBER); + } fapi_try_exit: return fapi2::current_err; diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_setup_evid.H b/src/import/chips/p9/procedures/hwp/pm/p9_setup_evid.H index 63e89d702..9bfa88c4f 100644 --- a/src/import/chips/p9/procedures/hwp/pm/p9_setup_evid.H +++ b/src/import/chips/p9/procedures/hwp/pm/p9_setup_evid.H @@ -36,15 +36,28 @@ extern "C" { +/// @typedef VoltageConfigActions_t +/// enum of the two actions this hwp can perform +/// it can either compute default voltage settings +/// otherwise it can apply voltage setting to the system + typedef enum + { + COMPUTE_VOLTAGE_SETTINGS, + APPLY_VOLTAGE_SETTINGS + } VoltageConfigActions_t; + /// @typedef p9_setup_evid_FP_t /// function pointer typedef definition for HWP call support typedef fapi2::ReturnCode (*p9_setup_evid_FP_t) ( - const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>&); + const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>&, + const VoltageConfigActions_t); /// @brief Read attributes containing part's boot voltages(VDD,VCS and VDN) /// and set these voltage using the AVSBUS interface (VDD, VDN and VCS). /// /// @param [in] i_target TARGET_TYPE_PROC_CHIP +/// @param [in] i_action Describes whether you wish to COMPUTE voltage settings +/// during the step or if you would like to APPLY them. /// @attr /// @attritem ATTR_VCS_BOOT_VOLTAGE - 1mV grandularity setting for VCS rail /// @attritem ATTR_VDD_BOOT_VOLTAGE - 1mV grandularity setting for VDD rail @@ -58,7 +71,8 @@ extern "C" /// /// @retval FAPI_RC_SUCCESS fapi2::ReturnCode - p9_setup_evid(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); + p9_setup_evid(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, + const VoltageConfigActions_t i_action); } // extern C 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 e3a9919ea..dc6099f81 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 @@ -223,12 +223,11 @@ Data (VPD) (typically the PowerSave value) and the minimum allowed for correct operation of the fabric bus. - Producer: Machine Readable Workbook + Producer: p9_setup_evid (first pass) - Consumer: p9_setup_evid + Consumer: p9_setup_evid (second pass) </description> <valueType>uint32</valueType> - <platInit/> <writeable/> </attribute> <!-- ********************************************************************* --> @@ -241,12 +240,12 @@ Data (VPD) (typically the PowerSave value) and the minimum allowed for correct operation of the fabric bus. - Producer: Machine Readable Workbook + Producer: p9_setup_evid (first pass) - Consumer: p9_setup_evid + Consumer: p9_setup_evid (second pass) </description> <valueType>uint32</valueType> - <platInit/> + <writeable/> </attribute> <!-- ********************************************************************* --> <attribute> @@ -258,12 +257,11 @@ Data (VPD) (typically the PowerSave value) and the minimum allowed for correct operation of the fabric bus. - Producer: Machine Readable Workbook + Producer: p9_setup_evid (first pass) - Consumer: p9_setup_evid + Consumer: p9_setup_evid (second pass) </description> <valueType>uint32</valueType> - <platInit/> <writeable/> </attribute> <!-- ********************************************************************* --> |