ibm-openbmc / dev

Product Development Project Mgmt and Tracking
16 stars 2 forks source link

pdbg: openbmc required HW access API's definition #3212

Closed ojayanth closed 3 years ago

ojayanth commented 3 years ago

Finalize the design direction to use common HW access API's to check HW states and othe miscellaneous functions.

Requirements details available here #2919 #3119 #3120

ojayanth commented 3 years ago

Discussed with @amitay and the direction is to create new library in pdbg repositories to add all required hardware specific wrapper function required for opebmc.

ojayanth commented 3 years ago

Int checkattn( bool & state ) global attention status register and mask for SBE error. If both these bits are ‘1’ for any proc the attention gpio should have gone active and triggered the attention handler. global interrupt status register is cfam 0x1007, global interrupt mask is cfam 0x100d, sbe error is bit 30

Int setSBEState(const Target* procTarget, SBE_STATE sbeSatate) { Update CFAM 2986 with input value. }

Int getSBEState((const Target* procTarget, SBE_STATE& sbeSatate) { Read cfam 2986 In case the SBE state is marked as CHECK_CFAM then SBE's //PERV_SB_MSG_FSI register must be checked to see if SBE is booted or   //NOT. static const uint32_t FSXCOMP_FSXLOG_SB_MSG_FSI = 0x00002809ull; }

//check SBE IPL completed. Int isPrimarySBEIplDone( bool &o_sbeIplDone) { Read SBE message register ( l_sbeReg.) if( (SBE_STATE_RUNTIME == l_sbeReg.currState) ||   (SBE_STATE_RUNTIME == l_sbeReg.prevState)) { o_sbeIplDone = true; break; } }

Additional Info:

Mailbox scratch 15 (CFAM 2986, SCOM 0x50186) – BMC SBE state register

enum SBE_STATE  {   SBE_STATE_NOT_USABLE = 0x00000000,   SBE_STATE_BOOTED = 0x00000001, SBE_STATE_CHECK_CFAM = 0x00000002,   SBE_STATE_DEBUG_MODE = 0x00000003, SBE_STATE_FAILED = 0x00000004,   SBE_STATE_UNKNOWN = 0x00000005,   SBE_STATE_INVALID = 0xFFFFFFFF,  }; . /// @brief A structure (bitfield) representing the SBE messaging register typedef union sbeMsgReg { struct {

ifdef _BIG_ENDIAN

    uint32_t sbeBooted : 1; ///< SBE control loop initialized
    uint32_t asyncFFDC : 1; // < async ffdc present on sbe
    uint32_t reserved1 : 2; ///< Reserved
    uint32_t prevState : 4; ///< Previous SBE state
    uint32_t currState : 4; ///< Current SBE state
    uint32_t majorStep : 8; ///< Last major istep executed by the SBE
    uint32_t minorStep : 6; ///< Last minor istep executed by the SBE
    uint32_t reserved2 : 6; ///< Reserved

else

    uint32_t reserved2 : 6; ///< Reserved
    uint32_t minorStep : 6; ///< Last minor istep executed by the SBE
    uint32_t majorStep : 8; ///< Last major istep executed by the SBE
    uint32_t currState : 4; ///< Current SBE state
    uint32_t prevState : 4; ///< Previous SBE state
    uint32_t reserved1 : 2; ///< Reserved
    uint32_t asyncFFDC : 1; // < async ffdc present on sbe
    uint32_t sbeBooted : 1; ///< SBE control loop initialized

endif

};
uint32_t reg; ///< The complete SBE messaging register as a uint32

} sbeMsgReg_t;

/**