From 2cc4d8e3494697a1c1287279a692af0175d49df3 Mon Sep 17 00:00:00 2001 From: Bilicon Patil Date: Thu, 6 Dec 2012 08:28:05 -0600 Subject: Support for DMI lane restore capability for Tuleta hardware bringup Change-Id: Ie1bd86424eb4547407eb9d7dbc77b3aa048be251 RTC: 59900 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2580 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- src/include/usr/hwpf/hwp/erepairAccessorHwpFuncs.H | 217 +++++++++++++++++++++ src/include/usr/hwpf/hwp/erepairConsts.H | 83 +++++++- .../usr/hwpf/hwp/erepairGetFailedLanesHwp.H | 13 +- .../usr/hwpf/hwp/erepairGetMnfgFailedLanesHwp.H | 75 +++++++ src/include/usr/hwpf/istepreasoncodes.H | 8 + src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H | 2 + 6 files changed, 386 insertions(+), 12 deletions(-) create mode 100644 src/include/usr/hwpf/hwp/erepairAccessorHwpFuncs.H create mode 100644 src/include/usr/hwpf/hwp/erepairGetMnfgFailedLanesHwp.H (limited to 'src/include') diff --git a/src/include/usr/hwpf/hwp/erepairAccessorHwpFuncs.H b/src/include/usr/hwpf/hwp/erepairAccessorHwpFuncs.H new file mode 100644 index 000000000..20dc8ebbc --- /dev/null +++ b/src/include/usr/hwpf/hwp/erepairAccessorHwpFuncs.H @@ -0,0 +1,217 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/hwpf/hwp/erepairAccessorHwpFuncs.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* 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. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +/** + * @file erepairAccessorHwpFuncs.H + * + * @brief FW Team Utility functions that accesses fabric and memory eRepair + * data. + */ + +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * bilicon 10/24/2012 Created. + */ + +#ifndef EREPAIRACCESSORHWPFUNCS_H_ +#define EREPAIRACCESSORHWPFUNCS_H_ + +#include + +// VPD Type to read-write +enum erepairVpdType +{ + EREPAIR_VPD_UNKNOWN = 0, + EREPAIR_VPD_MNFG = 1, + EREPAIR_VPD_FIELD = 2, +}; + +const uint8_t EREPAIR_MAX_CENTAUR_PER_MCS = 1; + +typedef fapi::ReturnCode (*getLanes_t)( + const fapi::Target &i_tgtHandle, + std::vector &o_txFailLanes, + std::vector &o_rxFailLanes); + +typedef fapi::ReturnCode (*setLanes_t)( + const fapi::Target &i_tgtHandle, + const std::vector &i_txFailLanes, + const std::vector &i_rxFailLanes); + +/** + * @brief FW Team Utility function that gets eRepair data from the VPD + * + * @param[in] i_endp_target Reference to X-Bus or A-Bus or MCS Target + * @param[out] o_txFailLanes Reference to a Vector that will contain the fail + * lanes read from the VPD for Drive side + * @param[out] o_rxFailLanes Reference to a Vector that will contain the fail + * lanes read from the VPD for Receive side + * @return ReturnCode + * + * TODO: i_endp_target There will be future support for Centaur Target. + * RTC Task 51234. Depends on RTC Story 44009 + */ +fapi::ReturnCode erepairGetFailedLanes(const fapi::Target &i_endp_target, + std::vector &o_txFailLanes, + std::vector &o_rxFailLanes); + +/** + * @brief FW Team Utility function that gets eRepair data + * + * This is a wrapper function for the Accessor HWP which reads failed lane + * numbers from the Field VPD + * + * @param[in] i_endp_target Reference to X-Bus or A-Bus or MCS Target + * @param[out] o_txFailLanes Reference to a Vector that will contain the fail + * lanes read from the Field VPD for Drive side + * @param[out] o_rxFailLanes Reference to a Vector that will contain the fail + * lanes read from the Field VPD for Receive side + * @return ReturnCode + * + * TODO: i_endp_target There will be future support for Centaur Target. + * RTC Task 51234. Depends on RTC Story 44009 + */ +fapi::ReturnCode erepairGetFieldFailedLanes(const fapi::Target &i_endp_target, + std::vector &o_txFailLanes, + std::vector &o_rxFailLanes); + +/** + * @brief FW Team Utility function that gets eRepair data + * + * This is a wrapper function for the Accessor HWP which reads failed lane + * numbers from the Manufacturing VPD + * + * @param[in] i_endp_target Reference to X-Bus or A-Bus or MCS Target + * @param[out] o_txFailLanes Reference to a Vector that will contain the fail + * lanes read from the Mnfg VPD for Drive side + * @param[out] o_rxFailLanes Reference to a Vector that will contain the fail + * lanes read from the Mnfg VPD for Receive side + * @return ReturnCode + * + * TODO: i_endp_target There will be future support for Centaur Target. + * RTC Task 51234. Depends on RTC Story 44009 + */ +fapi::ReturnCode erepairGetMnfgFailedLanes(const fapi::Target &i_endp_target, + std::vector &o_txFailLanes, + std::vector &o_rxFailLanes); + +/** + * @brief FW Team Utility function that sets eRepair data in the VPD + * + * @param[in] i_endp_target Reference to X-Bus or A-Bus or MCS Target + * @param[in] i_txFailLanes Vector that will contain the fail lane + * to be written to VPD for Drive side + * @param[in] i_rxFailLanes Vector that will contain the fail lanes + * to be written to VPD for Receive side + * + * @return ReturnCode + */ +fapi::ReturnCode erepairSetFailedLanes( + const fapi::Target &i_endp_target, + const std::vector &i_txFailLanes, + const std::vector &i_rxFailLanes); + +/** + * @brief FW Team Utility function that sets eRepair data in Field VPD + * + * This is a wrapper function for the Accessor HWP which write failed lane + * numbers in the Field VPD + * + * @param[in] i_endp_target Reference to X-Bus or A-Bus or MCS Target + * @param[in] i_txFailLanes Vector that will contain the fail lane + * to be written to Field VPD for Drive side + * @param[in] i_rxFailLanes Vector that will contain the fail lanes + * to be written to Field VPD for Receive side + * + * @return ReturnCode + */ +fapi::ReturnCode erepairSetFieldFailedLanes( + const fapi::Target &i_endp_target, + const std::vector &i_txFailLanes, + const std::vector &i_rxFailLanes); + +/** + * @brief FW Team Utility function that sets eRepair data in Manufacturing VPD + * + * This is a wrapper function for the Accessor HWP which write failed lane + * numbers in the Manufacturing VPD + * + * @param[in] i_endp_target Reference to X-Bus or A-Bus or MCS Target + * @param[in] i_txFailLanes Vector that will contain the fail lane + * to be written to Mnfg VPD for Drive side + * @param[in] i_rxFailLanes Vector that will contain the fail lanes + * to be written to Mnfg VPD for Receive side + * + * @return ReturnCode + */ +fapi::ReturnCode erepairSetMnfgFailedLanes( + const fapi::Target &i_endp_target, + const std::vector &i_txFailLanes, + const std::vector &i_rxFailLanes); + +/** + * @brief Function which retrieves the lanes that need to be restored for the + * given end point targets + * + * This function is called by the iStep dispatcher during the Restore Repair + * iStep for Fabric buses and DMI buses. The caller need to make sure that the + * first two arguments of this function need to be end point targets of a + * Fabric bus or DMI bus. + * It calls the wrapper functions of Accessor HWP to read the fail lane data + * recorded in the VPD on both the ends and verifies that there are matching + * records on both the ends. If matching fail lanes are not found, the + * corresponding fail lane data is invalidated using the wrapper Accessor HWP + * that writes data to the VPD. + * + * @param [in] i_endp1_target Reference to X-Bus or A-Bus or MCS Target + * @param [out] o_endp1_txFaillanes Reference to vector that will have the + * fail lane numbers that need to be restored + * for the Tx side of the target passed + * as first param + * @param [out] o_endp1_rxFaillanes Reference to vector that will have the + * fail lane numbers that need to be restored + * for the Rx side of the target passed + * as first param + * @param [in] i_endp2_target Reference to X-Bus or A-Bus or MCS Target + * @param [out] o_endp2_txFaillanes Reference to vector that will have the + * fail lane numbers that need to be restored + * for the Tx side of the target passed + * as fourth param + * @param [out] o_endp2_rxFaillanes Reference to vector that will have the + * fail lane numbers that need to be restored + * for the Rx side of the target passed + * as fourth param + * + * @return ReturnCode + * + */ + +fapi::ReturnCode erepairGetRestoreLanes(const fapi::Target &i_endp1_target, + std::vector &o_endp1_txFaillanes, + std::vector &o_endp1_rxFaillanes, + const fapi::Target &i_endp2_target, + std::vector &o_endp2_txFaillanes, + std::vector &o_endp2_rxFaillanes); + +#endif diff --git a/src/include/usr/hwpf/hwp/erepairConsts.H b/src/include/usr/hwpf/hwp/erepairConsts.H index b67e27d39..2fb0f6e5a 100644 --- a/src/include/usr/hwpf/hwp/erepairConsts.H +++ b/src/include/usr/hwpf/hwp/erepairConsts.H @@ -48,9 +48,61 @@ namespace EREPAIR const uint8_t INVALID_FAIL_LANE_NUMBER = 0xFF; +// X-Bus is 78+2 lanes wide in 8 byte mode +// X-Bus is 44+2 lanes wide in 4 byte mode +// Data lanes numbering: 0 - 77 in 8 byte mode +// Spare lanes numbering: 78, 79 in 8 byte mode +// Data lanes numbering: 0 - 43 in 4 byte mode +// Spare lanes numbering: 44, 45 in 8 byte mode +const uint8_t XBUS_8_ACTIVE_LANE_START = 0; +const uint8_t XBUS_8_ACTIVE_LANE_END = 77; +const uint8_t XBUS_8_SPARE_LANE_1 = 78; +const uint8_t XBUS_8_SPARE_LANE_2 = 79; + +const uint8_t XBUS_4_ACTIVE_LANE_START = 0; +const uint8_t XBUS_4_ACTIVE_LANE_END = 43; +const uint8_t XBUS_4_SPARE_LANE_1 = 44; +const uint8_t XBUS_4_SPARE_LANE_2 = 45; + +const uint8_t XBUS_SPARE_DEPLOY_LANE_1 = 0; +const uint8_t XBUS_SPARE_DEPLOY_LANE_2 = 1; +const uint8_t XBUS_MAXSPARES_IN_HW = 2; + +// A-Bus is 21+1 lanes wide. +// Data lanes numbering: 0 - 20 +// Spare lane numbering: 21 +const uint8_t ABUS_ACTIVE_LANE_START = 0; +const uint8_t ABUS_ACTIVE_LANE_END = 20; + +const uint8_t ABUS_SPARE_LANE_1 = 21; +const uint8_t ABUS_SPARE_DEPLOY_LANE_1 = 0; +const uint8_t ABUS_MAXSPARES_IN_HW = 1; + +// UpStream DMI-Bus is 21+2 lanes wide. +// Data lanes numbering: 0 - 20 +// Spare lanes numbering: 21, 22 +const uint8_t DMIBUS_UPSTREAM_ACTIVE_LANE_START = 0; +const uint8_t DMIBUS_UPSTREAM_ACTIVE_LANE_END = 20; + +const uint8_t DMIBUS_UPSTREAM_SPARE_LANE_1 = 21; +const uint8_t DMIBUS_UPSTREAM_SPARE_LANE_2 = 22; + +// DownStream DMI-Bus is 14+2 lanes wide. +// Data lanes numbering: 0 - 13 +// Spare lanes numbering: 14, 15 +const uint8_t DMIBUS_DOWNSTREAM_ACTIVE_LANE_START = 0; +const uint8_t DMIBUS_DOWNSTREAM_ACTIVE_LANE_END = 13; + +const uint8_t DMIBUS_DOWNSTREAM_SPARE_LANE_1 = 14; +const uint8_t DMIBUS_DOWNSTREAM_SPARE_LANE_2 = 15; + +const uint8_t DMIBUS_SPARE_DEPLOY_LANE_1 = 0; +const uint8_t DMIBUS_SPARE_DEPLOY_LANE_2 = 1; +const uint8_t DMIBUS_MAXSPARES_IN_HW = 2; + enum busType { - EREPAIR_UNKNOWN_BUS_TYPE = 0, + UNKNOWN_BUS_TYPE = 0, PROCESSOR_EI4 = 1, PROCESSOR_EDI = 2, MEMORY_EDI = 3 @@ -58,7 +110,7 @@ enum busType enum interfaceType { - EREPAIR_UNKNOWN_INT_TYPE = 0, + UNKNOWN_INT_TYPE = 0, PBUS_DRIVER = 1, // X-Bus, A-Bus transmit PBUS_RECEIVER = 2, // X-Bus, A-Bus receive DMI_MCS_RECEIVE = 3, // MCS receive @@ -73,11 +125,24 @@ enum interfaceType * VPD Structures. *****************************************************************************/ +// eRepair Header +struct eRepairHeader +{ + struct + { + uint8_t eye1; + uint8_t eye2; + uint8_t eye3; + }eyeCatcher; + + uint8_t numRecords; +}; + // Device info structure of the P8 Processor struct eRepairProcDevInfo { uint8_t processor_id;// Range:0x00-0xFF. Value:Processor MRU IDs - uint8_t fabricBus; // Range:0x00-0xFF. Value:FabricBus(ATTR_CHIP_UNIT_POS) + uint8_t fabricBus; // Range:0x00-0xFF. Value: FabricBus(ATTR_CHIP_UNIT_POS) }; // eRepair structure for failing lanes on Power Bus @@ -95,8 +160,8 @@ struct eRepairPowerBus // Device info structure of the endpoints of the Memory Channel struct eRepairMemDevInfo { - uint8_t proc_Centaur_id;// Range:0x00-0xFF.Value:Processor or Centaur MRU ID - uint8_t memChannel; // Range:0x00-0xFF.Value:MemoryBus(ATTR_CHIP_UNIT_POS) + uint8_t proc_centaur_id;// Range:0x00-0xFF.Value:Processor or Centaur MRU ID + uint8_t memChannel; // Range:0x00-0xFF.Value: MemoryBus(ATTR_CHIP_UNIT_POS) }; // eRepair structure of failing lanes on Memory Channel @@ -104,10 +169,12 @@ struct eRepairMemBus { eRepairMemDevInfo device; // Device info of P8 and Centaur uint8_t type :4;// Range:0x0-0xF. Value:MEMORY_EDI - uint8_t interface :4;// Range:0x0-0xF. Value:UpIn, UpOut, - // DownIn, DownOut + uint8_t interface :4;// Range:0x0-0xF. Value:MCS_Receive, + // MCS_Drive, + // memBuf_Receive, + // memBuf_Drive uint8_t failBit; // Range:0x00-0xFF. - // Value:Failing lane number:0-13 OR 0-19 + // Value:Failing lane number:0-13 OR 0-20 // depends on DownStream or UpStream }; diff --git a/src/include/usr/hwpf/hwp/erepairGetFailedLanesHwp.H b/src/include/usr/hwpf/hwp/erepairGetFailedLanesHwp.H index 5c0231bab..a798d2296 100644 --- a/src/include/usr/hwpf/hwp/erepairGetFailedLanesHwp.H +++ b/src/include/usr/hwpf/hwp/erepairGetFailedLanesHwp.H @@ -39,16 +39,21 @@ #include #include + +typedef fapi::ReturnCode (*erepairGetFailedLanesHwp_FP_t)( + const fapi::Target &i_tgtHandle, + std::vector &o_txFailLanes, + std::vector &o_rxFailLanes); + extern "C" { /** * @brief FW Team HWP that retrieves the eRepair fail lanes. * It retrieves the eRepair data from the P8 MVPD and the Centaur FRU - * VPD. It then parses the eRepair data to determine the fail lane - * numbers on the sub-interfaces (Tx and Rx) of the passed bus target. - * Only Field eRepair data reading is currently supported. - * Manufacturing eRepair data reading is not supported yet. + * VPD sections reserved for Field usage. It then parses the + * eRepair data to determine the fail lane numbers on the sub-interfaces + * (Tx and Rx) of the passed bus target. * * @param[in] i_tgtHandle Reference to X-Bus or A-Bus or MCS or Target * @param[o] o_txFailLanes Reference to a vector that will hold eRepair fail diff --git a/src/include/usr/hwpf/hwp/erepairGetMnfgFailedLanesHwp.H b/src/include/usr/hwpf/hwp/erepairGetMnfgFailedLanesHwp.H new file mode 100644 index 000000000..656389cde --- /dev/null +++ b/src/include/usr/hwpf/hwp/erepairGetMnfgFailedLanesHwp.H @@ -0,0 +1,75 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/hwpf/hwp/erepairGetMnfgFailedLanesHwp.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* 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. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +/** + * @file erepairGetMnfgFailedLanesHwp.H.H + * + * @brief FW Team HWP that accesses the fail lanes of Fabric and Memory buses. + */ + +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * bilicon 12/02/2012 Created. + */ + +#ifndef EREPAIRGETMNFGFAILEDLANESHWP_H_ +#define EREPAIRGETMNFGFAILEDLANESHWP_H_ + +#include +#include + + +typedef fapi::ReturnCode (*erepairGetMnfgFailedLanesHwp_FP_t)( + const fapi::Target &i_tgtHandle, + std::vector &o_txFailLanes, + std::vector &o_rxFailLanes); + +extern "C" +{ + +/** + * @brief FW Team HWP that retrieves the eRepair fail lanes. + * It retrieves the eRepair data from the P8 MVPD and the Centaur FRU + * VPD sections that is reserved for Mnfg usage. It then parses the + * eRepair data to determine the fail lane numbers on the sub-interfaces + * (Tx and Rx) of the passed bus target. + * + * @param[in] i_tgtHandle Reference to X-Bus or A-Bus or MCS or Target + * @param[o] o_txFailLanes Reference to a vector that will hold eRepair fail + * lane numbers of the Tx sub-interface. + * @param[o] o_rxFailLanes Reference to a vector that will hold eRepair fail + * lane numbers of the Rx sub-interface. + * + * @return ReturnCode + * + * TODO: i_tgtHandle There will be future support for Centaur Target. + * RTC Task 51234. Depends on RTC Story 44009 + */ +fapi::ReturnCode erepairGetMnfgFailedLanesHwp(const fapi::Target &i_tgtHandle, + std::vector &o_txFailLanes, + std::vector &o_rxFailLanes); + +}// end of extern C + +#endif diff --git a/src/include/usr/hwpf/istepreasoncodes.H b/src/include/usr/hwpf/istepreasoncodes.H index 748a7bb94..d2d9e4f49 100644 --- a/src/include/usr/hwpf/istepreasoncodes.H +++ b/src/include/usr/hwpf/istepreasoncodes.H @@ -107,6 +107,8 @@ enum istepModuleId ISTEP_MSS_VOLT = 0x3A, ISTEP_MSS_GETECID = 0x3B, ISTEP_MSS_DRAMINIT_TRAINADV = 0x3C, + ISTEP_DMI_IO_RESTORE_EREPAIR = 0x3D, + ISTEP_FABRIC_IO_RESTORE_EREPAIR = 0x3E, }; /** @@ -144,6 +146,12 @@ enum istepReasonCode ISTEP_PROC_CHIPLET_SCOMINIT_FAILED = ISTEP_COMP_ID | 0x18, ISTEP_PROC_XBUS_IF_EXECUTION_FAILED = ISTEP_COMP_ID | 0x19, ISTEP_PROC_ABUS_IF_EXECUTION_FAILED = ISTEP_COMP_ID | 0x1A, + ISTEP_DMI_DRIVE_RESTORE_FAILED = ISTEP_COMP_ID | 0x1B, + ISTEP_DMI_RECEIVE_RESTORE_FAILED = ISTEP_COMP_ID | 0x1C, + ISTEP_FABRIC_DRIVE_RESTORE_FAILED = ISTEP_COMP_ID | 0x1D, + ISTEP_FABRIC_RECEIVE_RESTORE_FAILED = ISTEP_COMP_ID | 0x1E, + ISTEP_DMI_GET_RESTORE_LANES_FAILED = ISTEP_COMP_ID | 0x1F, + ISTEP_FABRIC_GET_RESTORE_LANES_FAILED = ISTEP_COMP_ID | 0x20, }; // end ISTEP } diff --git a/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H b/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H index addf6e1b3..bbc0f827b 100644 --- a/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H +++ b/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H @@ -41,6 +41,8 @@ #include #include #include +#include +#include /** * @brief HWP Executor macro -- cgit v1.2.1