diff options
author | Sudheendra K Srivathsa <sudheendraks@in.ibm.com> | 2016-02-12 01:42:35 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-06-29 00:19:30 -0400 |
commit | c7fd2075a87a17f34cdc19278aba618960cf83a9 (patch) | |
tree | 53a3ed4d6fbbf51bf634f0b0caaef50ff077e599 /src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H | |
parent | c8eefe3008a465fef6d037af659993c051196369 (diff) | |
download | talos-hostboot-c7fd2075a87a17f34cdc19278aba618960cf83a9.tar.gz talos-hostboot-c7fd2075a87a17f34cdc19278aba618960cf83a9.zip |
p9_setup_evid L2 commit
Change-Id: I4c3efee1195d45b073464acca4ec185e193400ea
Original-Change-Id: I923c0d7da9e825dbbb4a111648fc3457da22d572
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/20613
Tested-by: Jenkins Server
Tested-by: PPE CI
Tested-by: Hostboot CI
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/26379
Tested-by: FSP CI Jenkins
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H')
-rw-r--r-- | src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H | 260 |
1 files changed, 260 insertions, 0 deletions
diff --git a/src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H b/src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H new file mode 100644 index 000000000..97878bc33 --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/lib/p9_avsbus_lib.H @@ -0,0 +1,260 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: chips/p9/procedures/hwp/lib/p9_avsbus_lib.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* EKB Project */ +/* */ +/* COPYRIGHT 2016 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/// +/// @file p9_avsbus_lib.H +/// @brief Library functions for AVSBus +/// +/// *HW Owner : Sudheendra K Srivathsa <sudheendraks@in.ibm.com> +/// *FW Owner : Sangeetha T S <sangeet2@in.ibm.com> +/// *Team : PM +/// *Consumed by : HB +/// *Level : 2 +/// +/// @todo (to be considered in L2/L3 development) AVSBus timing parameters +/// as attributes or not. They were hardcoded in P8. + +#ifndef __P9_AVSBUS_LIB_H__ +#define __P9_AVSBUS_LIB_H__ + +#include <fapi2.H> + +namespace p9avslib +{ +enum avsRails +{ + VDD, + VDN, + VCS +}; + +enum avsBusNum +{ + AVSBUSVDD = 0, + AVSBUSVDN = 1, + AVSBUSVCS = 0 +}; + +union avsMasterFrame +{ + uint32_t value; + struct + { +#ifdef _BIG_ENDIAN + uint32_t StartCode : 2; + uint32_t Cmd : 2; + uint32_t CmdGroup : 1; + uint32_t CmdDataType: 4; + uint32_t Select : 4; + uint32_t CmdData : 16; + uint32_t CRC : 3; +#else + uint32_t CRC : 3; + uint32_t CmdData : 16; + uint32_t Select : 4; + uint32_t CmdDataType: 4; + uint32_t CmdGroup : 1; + uint32_t Cmd : 2; + uint32_t StartCode : 2; +#endif // _BIG_ENDIAN + } fields; +}; + +union avsSlaveFrame +{ + uint32_t value; + struct + { +#ifdef _BIG_ENDIAN + uint32_t SlaveAck : 2; + uint32_t reserved1 : 1; + uint32_t StatusResp : 5; + uint32_t CmdData : 16; + uint32_t reserved5 : 5; + uint32_t CRC : 3; +#else + uint32_t CRC : 3; + uint32_t reserved5 : 5; + uint32_t CmdData : 16; + uint32_t StatusResp : 5; + uint32_t reserved1 : 1; + uint32_t SlaveAck : 2; +#endif // _BIG_ENDIAN + + } fields; +}; + +union avsStatus +{ + uint16_t value; + struct + { +#ifdef _BIG_ENDIAN + uint16_t VDone : 1; // Voltage done + uint16_t OCW : 1; // IOUT_OC_WARNING (Output over-current) + uint16_t UCW : 1; // VOUT_UV_WARNING (Output under-voltage) + uint16_t OTW : 1; // IOUT_OT_WARNING (Over-temperature) + uint16_t OPW : 1; // POUT_OP_WARNING (Output over-power) + uint16_t Reserved_3 : 3; + uint16_t MfrSpcfc_8 : 8; // Mfg Specific defined by the AVSBus Slave +#else + uint16_t MfrSpcfc_8 : 8; // Mfg Specific defined by the AVSBus Slave + uint16_t Reserved_3 : 3; + uint16_t OPW : 1; // POUT_OP_WARNING (Output over-power) + uint16_t OTW : 1; // IOUT_OT_WARNING (Over-temperature) + uint16_t UCW : 1; // VOUT_UV_WARNING (Output under-voltage) + uint16_t OCW : 1; // IOUT_OC_WARNING (Output over-current) + uint16_t VDone : 1; // Voltage done +#endif // _BIG_ENDIAN + } fields; +}; + +enum avslibconstants +{ + +// @todo: This should be calculated based on time (eg 100ms) and the projected +// time that a SCOM poll will take. +// const uint32_t MAX_POLL_COUNT_AVS = 0x1000; + MAX_POLL_COUNT_AVS = 0x1000, + AVS_CRC_DATA_MASK = 0xfffffff8, + O2S_FRAME_SIZE = 0x20, + O2S_IN_DELAY1 = 0x3F + +}; + +// Constant definitions +//const uint64_t O2S_FRAME_SIZE = 0x20; + +// OIMR Mask Values +const uint32_t OCB_OIMR1_MASK_VALUES[2][2] = +{ + 0xFFFFFBFF, //bit 21 + 0xFFFFFCFF, //bit 22 + 0xFFFFFBFF, //bit 23 + 0xFFFFFEFF //bit 24 +}; + +//const uint64_t OCB_O2SST_MASK = 0x8000000000000000; + +} //end of p9avslib namespace + +///@brief Generates a 3 bit CRC value for 29 bit data +///@param[i] i_data +///@return 3 bit CRC result (right aligned) + +uint32_t avsCRCcalc(uint32_t i_data); + + + +///@brief Initialize an O2S bridge for AVSBus usage +///@param[i] i_target Chip target +///@param[i] i_avsBusNum AVSBus Number (0 or 1) +///@param[i] i_o2sBridgeNum O2S Bridge Number (0 or 1) +///@return FAPI2::ReturnCode defined in XML + +fapi2::ReturnCode +avsInitExtVoltageControl(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, + const p9avslib::avsBusNum i_avsBusNum, + const uint8_t i_o2sBridgeNum); + + +///@brief Polls OCB status register O2SST for o2s_ongoing=0 +///@param[i] i_target Chip target +///@param[i] i_avsBusNum AVSBus Number (0 or 1) +///@param[i] i_o2sBridgeNum O2S Bridge Number (0 or 1) +///@return FAPI2::SUCCESS +///@return FAPI2::RC_PROCPM_AVSBUS_TIMEOUT + +fapi2::ReturnCode +avsPollVoltageTransDone(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, + const uint8_t i_avsBusNum, + const uint8_t i_o2sBridgeNum); + + + +///@brief Drives a downstream command to a select bus via a selected bridge +///@param[i] i_target Chip target +///@param[i] i_avsBusNum AVSBus Number (0 or 1) +///@param[i] i_o2sBridgeNum O2S Bridge Number (0 or 1) +///@param[i] i_RailSelect Rail Select (value depends on the system implementation) +///@param[i] i_CmdType Defined by AVSBus spec (4b, right justified) +///@param[i] i_CmdGroup Defined by AVSBus spec (0 = AVSBus defined; 1 = Mfg defined) +///@param[i] i_CmdData Defined by AVSBus spec and command dependent (16b, right justified) +///@return FAPI2::SUCCESS +///@return FAPI2::RC_PROCPM_AVSBUS_TIMEOUT + +fapi2::ReturnCode +avsDriveCommand(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, + const uint8_t i_avsBusNum, + const uint8_t i_o2sBridgeNum, + const uint32_t i_RailSelect, + const uint32_t i_CmdType, + const uint32_t i_CmdGroup, + const uint32_t i_CmdDataType, + const uint32_t i_CmdData); + + + +///@brief Perform an AVS read transaction +///@param[i] i_target Chip target +///@param[i] i_avsBusNum AVSBus Number (0 or 1) +///@param[i] i_o2sBridgeNum O2S Bridge Number (0 or 1) +///@param[i] i_RailSelect Rail Select (value depends on the system implementation) +///@param[o] o_CmdData Defined by AVSBus spec and command dependent (16b, right justified) +///@return FAPI2::SUCCESS +///@return FAPI2::RC_PROCPM_AVSBUS_TIMEOUT + +fapi2::ReturnCode +avsVoltageRead(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, + const uint8_t i_avsBusNum, + const uint8_t i_o2sBridgeNum, + const uint32_t i_RailSelect, + uint32_t* o_Voltage); + + +///@brief Perform an AVS write transaction +///@param[i] i_target Chip target +///@param[i] i_avsBusNum AVSBus Number (0 or 1) +///@param[i] i_o2sBridgeNum O2S Bridge Number (0 or 1) +///@param[i] i_RailSelect Rail Select (value depends on the system implementation) +///@param[i] i_CmdData Defined by AVSBus spec and command dependent (16b, right justified) +///@return FAPI2::SUCCESS +///@return FAPI2::RC_PROCPM_AVSBUS_TIMEOUT + +fapi2::ReturnCode +avsVoltageWrite(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, + const uint8_t i_avsBusNum, + const uint8_t i_o2sBridgeNum, + const uint32_t i_RailSelect, + const uint32_t o_Voltage); + + +///@brief Drive an Idle Frame on an AVSBus +///@param[i] i_target Chip target +///@param[i] i_avsBusNum AVSBus Number (0 or 1) +///@param[i] i_o2sBridgeNum O2S Bridge Number (0 or 1) +///@return FAPI2::SUCCESS + +fapi2::ReturnCode +avsIdleFrame(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, + const uint8_t i_avsBusNum, + const uint8_t i_o2sBridgeNum); + + +#endif // __P9_AVSBUS_LIB_H__ |