/* wcn_core_dump_flush - Fulsh dump data and reset core dump sys
 *
 * Retunr 0 if success, else error code
 */
INT32 wcn_core_dump_flush(INT32 rst)
{
    PUINT8 pbuf = NULL;
    INT32 len = 0;

    if (!g_core_dump) {
        STP_DBG_ERR_FUNC("invalid pointer!\n");
        return -1;
    }

    wcn_core_dump_out(g_core_dump, &pbuf, &len);
    STP_DBG_INFO_FUNC("buf 0x%08x, len %d\n", (unsigned int)pbuf, len);

    // show coredump end info on UI
    //osal_dbg_assert_aee("MT662x f/w coredump end", "MT662x firmware coredump ends");
    aee_kernel_dal_show("MT662x coredump end\n");

    // call AEE driver API
    aed_combo_exception(NULL, 0, (const int*)pbuf, len, (const char*)g_core_dump->info);

    // reset
    wcn_core_dump_reset(g_core_dump, STP_CORE_DUMP_TIMEOUT);

    return 0;
}
示例#2
0
/* wcn_core_dump_flush - Fulsh dump data and reset core dump sys
 *
 * Retunr 0 if success, else error code
 */
INT32 wcn_core_dump_flush(INT32 rst)
{
    PUINT8 pbuf = NULL;
    INT32 len = 0;
    INT32 ret = 0;

    if (!g_core_dump) {
        STP_DBG_ERR_FUNC("invalid pointer!\n");
        return -1;
    }

    wcn_core_dump_out(g_core_dump, &pbuf, &len);
    STP_DBG_INFO_FUNC("buf 0x%08x, len %d\n", (unsigned int)pbuf, len);
            
    // show coredump end info on UI
    //osal_dbg_assert_aee("MT662x f/w coredump end", "MT662x firmware coredump ends");
    #if WMT_PLAT_ALPS
    aee_kernel_dal_show("MT662x coredump end\n");
            
    ret = stp_dbg_set_fw_info(pbuf, 512, STP_FW_ASSERT_ISSUE);
    if (ret) {
        STP_DBG_ERR_FUNC("set fw issue infor fail(%d),maybe fw warm reset...\n", ret);
        stp_dbg_set_fw_info("Fw Warm reset", osal_strlen("Fw Warm reset"), STP_FW_WARM_RST_ISSUE);
    }

    // call AEE driver API
    aed_combo_exception(NULL, 0, (const int*)pbuf, len, (const char*)g_core_dump->info);
    #endif
    // reset
    wcn_core_dump_reset(g_core_dump, STP_CORE_DUMP_TIMEOUT);
    
    return 0;
}
/* wcn_core_dump_in - add a packet to compressor buffer
 * @ dmp - pointer of object
 * @ buf - input buffer
 * @ len - data length
 *
 * Retunr 0 if success; return 1 if find end string; else error code
 */
INT32 wcn_core_dump_in(P_WCN_CORE_DUMP_T dmp, PUINT8 buf, INT32 len)
{
    INT32 ret = 0;
    INT32 tmp;
#define INFO_HEAD "MT6628 FW CORE, "

    if ((!dmp) || (!buf)) {
        STP_DBG_ERR_FUNC("invalid pointer!\n");
        return -1;
    }

    ret = osal_lock_sleepable_lock(&dmp->dmp_lock);
    if (ret) {
        STP_DBG_ERR_FUNC("--->lock dmp->dmp_lock failed, ret=%d\n", ret);
        return ret;
    }

    switch (dmp->sm) {
    case CORE_DUMP_INIT:
        wcn_compressor_reset(dmp->compressor, 1, GZIP);
        osal_timer_start(&dmp->dmp_timer, STP_CORE_DUMP_TIMEOUT);

        // first package, copy to info buffer
        osal_strcpy(&dmp->info[0], INFO_HEAD);
        tmp = STP_CORE_DUMP_INFO_SZ - osal_strlen(INFO_HEAD);
        tmp = (len > tmp) ? tmp : len;
        osal_memcpy(&dmp->info[osal_strlen(INFO_HEAD)], buf, tmp);
        dmp->info[STP_CORE_DUMP_INFO_SZ] = '\0';

        // show coredump start info on UI
        //osal_dbg_assert_aee("MT662x f/w coredump start", "MT662x firmware coredump start");
        aee_kernel_dal_show("MT662x coredump start, please wait up to 5 minutes.\n");

        // parsing data, and check end srting
        ret = wcn_core_dump_check_end(buf, len);
        if (ret == 1) {
            STP_DBG_INFO_FUNC("core dump end!\n");
            dmp->sm = CORE_DUMP_DONE;
            wcn_compressor_in(dmp->compressor, buf, len, 1);
        } else {
            dmp->sm = CORE_DUMP_DOING;
            wcn_compressor_in(dmp->compressor, buf, len, 0);
        }
        break;

    case CORE_DUMP_DOING:
        // parsing data, and check end srting
        ret = wcn_core_dump_check_end(buf, len);
        if (ret == 1) {
            STP_DBG_INFO_FUNC("core dump end!\n");
            dmp->sm = CORE_DUMP_DONE;
            wcn_compressor_in(dmp->compressor, buf, len, 1);
        } else {
            dmp->sm = CORE_DUMP_DOING;
            wcn_compressor_in(dmp->compressor, buf, len, 0);
        }
        break;

    case CORE_DUMP_DONE:
        wcn_compressor_reset(dmp->compressor, 1, GZIP);
        osal_timer_start(&dmp->dmp_timer, STP_CORE_DUMP_TIMEOUT);
        wcn_compressor_in(dmp->compressor, buf, len, 0);
        dmp->sm = CORE_DUMP_DOING;
        break;

    case CORE_DUMP_TIMEOUT:
        break;
    default:
        break;
    }

    osal_unlock_sleepable_lock(&dmp->dmp_lock);

    return ret;
}