Пример #1
0
    // Move the OCCs to active state or log unrecoverable error and
    // stay in safe mode
    void processOccStartStatus(const bool i_startCompleted,
                               TARGETING::Target * i_failedOccTarget)
    {
        TMGT_INF(">>processOccStartStatus(%d,0x%p)",
                 i_startCompleted, i_failedOccTarget);
        errlHndl_t l_err = NULL;
        uint32_t l_huid = 0;
        if (i_failedOccTarget)
        {
            l_huid = TARGETING::get_huid(i_failedOccTarget);
        }
        TMGT_INF("processOccStartStatus(Start Success=%c, failedOcc=0x%08X)",
                 i_startCompleted?'y':'n', l_huid);
        if (i_startCompleted)
        {
            // Query functional OCCs
            l_err = OccManager::buildOccs();
            if (NULL == l_err)
            {
                if (NULL != OccManager::getMasterOcc())
                {
                    do
                    {
#ifndef __HOSTBOOT_RUNTIME
                        // Build pstate tables (once per IPL)
                        l_err = genPstateTables();
                        if(l_err)
                        {
                            break;
                        }

                        // Calc memory throttles (once per IPL)
                        calcMemThrottles();
#endif

                        // Make sure OCCs are ready for communication
                        OccManager::waitForOccCheckpoint();

#ifdef __HOSTBOOT_RUNTIME
                        // TODO RTC 124738  Final solution TBD
                        //  Perhapse POLL scom 0x6a214 until bit 31 is set?
                        nanosleep(1,0);
#endif

                        // Send poll to establish comm
                        TMGT_INF("Send initial poll to all OCCs to"
                                 " establish comm");
                        l_err = OccManager::sendOccPoll();
                        if (l_err)
                        {
                            // Continue even if failed (poll will be retried)
                            ERRORLOG::errlCommit(l_err, HTMGT_COMP_ID);
                        }

                        // Send ALL config data
                        sendOccConfigData();

                        // Set the User PCAP
                        l_err = sendOccUserPowerCap();
                        if (l_err)
                        {
                            break;
                        }

                        // Wait for all OCCs to go to the target state
                        l_err = waitForOccState();
                        if ( l_err )
                        {
                            break;
                        }

                        // Set active sensors for all OCCs,
                        // so BMC can start communication with OCCs
                        l_err = setOccActiveSensors(true);
                        if (l_err)
                        {
                            // Continue even if failed to update sensor
                            ERRORLOG::errlCommit(l_err, HTMGT_COMP_ID);
                        }

                    } while(0);
                }
                else
                {
                    TMGT_ERR("Unable to find any Master capable OCCs");
                    /*@
                     * @errortype
                     * @reasoncode      HTMGT_RC_OCC_MASTER_NOT_FOUND
                     * @moduleid        HTMGT_MOD_LOAD_START_STATUS
                     * @userdata1[0:7]  number of OCCs
                     * @devdesc         No OCC master was found
                     */
                    bldErrLog(l_err, HTMGT_MOD_LOAD_START_STATUS,
                              HTMGT_RC_OCC_MASTER_NOT_FOUND,
                              OccManager::getNumOccs(), 0, 0, 0,
                              ERRORLOG::ERRL_SEV_INFORMATIONAL);
                }
            }
            else
            {
                // Failed to find functional OCCs, no need to try again
                // Set original error log  as unrecoverable and commit
                l_err->setSev(ERRORLOG::ERRL_SEV_UNRECOVERABLE);
                ERRORLOG::errlCommit(l_err, HTMGT_COMP_ID);
            }
        }
        else
        {
            TMGT_ERR("All OCCs were not loaded/started successfully");
            /*@
             * @errortype
             * @reasoncode      HTMGT_RC_OCC_START_FAIL
             * @moduleid        HTMGT_MOD_LOAD_START_STATUS
             * @userdata1       Failing OCC HUID
             * @devdesc         OCCs were not loaded/started successfully
             */
            bldErrLog(l_err, HTMGT_MOD_LOAD_START_STATUS,
                      HTMGT_RC_OCC_START_FAIL,
                      l_huid, 0, 0, 0,
                      ERRORLOG::ERRL_SEV_INFORMATIONAL);
        }

        if (NULL != l_err)
        {
            TMGT_ERR("OCCs not all active.  Attempting OCC Reset");
            TMGT_CONSOLE("OCCs are not active (rc=0x%04X). "
                         "Attempting OCC Reset",
                         l_err->reasonCode());
            TMGT_INF("Calling resetOccs");
            errlHndl_t err2 = OccManager::resetOccs(NULL);
            if(err2)
            {
                TMGT_ERR("OccManager::resetOccs failed with 0x%04X",
                         err2->reasonCode());

                // Set original error log  as unrecoverable and commit
                l_err->setSev(ERRORLOG::ERRL_SEV_UNRECOVERABLE);
                ERRORLOG::errlCommit(l_err, HTMGT_COMP_ID);

                // Commit occReset error
                ERRORLOG::errlCommit(err2, HTMGT_COMP_ID);
            }
            else
            {
                // retry worked - commit original error as informational
                l_err->setSev(ERRORLOG::ERRL_SEV_INFORMATIONAL);
                ERRORLOG::errlCommit(l_err, HTMGT_COMP_ID);
            }
        }
        TMGT_INF("<<processOccStartStatus()");

    } // end processOccStartStatus()
Пример #2
0
    // Send pass-thru command to HTMGT
    errlHndl_t passThruCommand(uint16_t   i_cmdLength,
                               uint8_t *  i_cmdData,
                               uint16_t & o_rspLength,
                               uint8_t *  o_rspData)
    {
        errlHndl_t err = NULL;
        htmgtReasonCode failingSrc = HTMGT_RC_NO_ERROR;
        o_rspLength = 0;

        if ((i_cmdLength > 0) && (NULL != i_cmdData))
        {
            switch (i_cmdData[0])
            {
                case PASSTHRU_OCC_STATUS:
                    TMGT_INF("passThruCommand: OCC Status");
                    OccManager::getOccData(o_rspLength, o_rspData);
                    break;

                case PASSTHRU_GENERATE_MFG_PSTATE:
                    if (i_cmdLength == 1)
                    {
                        TMGT_INF("passThruCommand: Generate MFG pstate tables",
                                 i_cmdData[1]);
                        err = genPstateTables(false);
                    }
                    else
                    {
                        TMGT_ERR("passThruCommand: invalid generate pstate "
                                 "command length %d", i_cmdLength);
                        /*@
                         * @errortype
                         * @reasoncode   HTMGT_RC_INVALID_LENGTH
                         * @moduleid     HTMGT_MOD_PASS_THRU
                         * @userdata1    command data[0-7]
                         * @userdata2    command data length
                         * @devdesc      Invalid pass thru command data length
                         */
                        failingSrc = HTMGT_RC_INVALID_LENGTH;
                    }
                    break;

                case PASSTHRU_LOAD_PSTATE:
                    if (i_cmdLength == 2)
                    {
                        const uint8_t pstateType = i_cmdData[1];
                        if ((0 == pstateType) || (1 == pstateType))
                        {
                            TMGT_INF("passThruCommand: Load pstate tables "
                                     "(type: %d)", pstateType);
                            // 0 = Normal Pstate Tables
                            err = OccManager::loadPstates(0 == pstateType);
                        }
                        else
                        {
                            TMGT_ERR("passThruCommand: invalid pstate type "
                                     "specified: %d", pstateType);
                            /*@
                             * @errortype
                             * @reasoncode   HTMGT_RC_INVALID_PARAMETER
                             * @moduleid     HTMGT_MOD_PASS_THRU
                             * @userdata1    command data[0-7]
                             * @userdata2    command data length
                             * @devdesc      Invalid load pstate table type
                             */
                            failingSrc = HTMGT_RC_INVALID_PARAMETER;
                        }
                    }
                    else
                    {
                        TMGT_ERR("passThruCommand: invalid load pstate "
                                 "command length %d", i_cmdLength);
                        failingSrc = HTMGT_RC_INVALID_LENGTH;
                    }
                    break;

                default:
                    TMGT_ERR("passThruCommand: Invalid command 0x%08X "
                             "(%d bytes)", UINT32_GET(i_cmdData), i_cmdLength);
                    /*@
                     * @errortype
                     * @reasoncode   HTMGT_RC_INVALID_DATA
                     * @moduleid     HTMGT_MOD_PASS_THRU
                     * @userdata1    command data[0-7]
                     * @userdata2    command data length
                     * @devdesc      Invalid pass thru command
                     */
                    failingSrc = HTMGT_RC_INVALID_DATA;
                    break;
            }

            if ((HTMGT_RC_NO_ERROR != failingSrc) && (NULL == err))
            {
                bldErrLog(err, HTMGT_MOD_PASS_THRU,
                          failingSrc,
                          UINT32_GET(i_cmdData),
                          UINT32_GET(&i_cmdData[4]),
                          0, i_cmdLength,
                          ERRORLOG::ERRL_SEV_INFORMATIONAL);
            }
        }

        return err;

    } // end passThruCommand()