Page MenuHomePhabricator

Platarmboardfvpfvp Errcvsplatarmboardfvp Rfvp R Errc
Updated 1,222 Days AgoPublic

/*                                                            /*
 * Copyright (c) 2019-2020, Arm Limited. All rights reserv |   * Copyright (c) 2019-2021, Arm Limited. All rights reserv
 *                                                             *
 * SPDX-License-Identifier: BSD-3-Clause                       * SPDX-License-Identifier: BSD-3-Clause
 */                                                            */

#include <errno.h>                                            #include <errno.h>

#include <common/debug.h>                                     #include <common/debug.h>
#include <drivers/arm/sp805.h>                                #include <drivers/arm/sp805.h>
#include <drivers/cfi/v2m_flash.h>                            #include <drivers/cfi/v2m_flash.h>
#include <plat/arm/common/plat_arm.h>                         #include <plat/arm/common/plat_arm.h>
#include <platform_def.h>                                     #include <platform_def.h>

/*                                                            /*
 * FVP error handler                                       |   * FVP_R error handler
 */                                                            */
__dead2 void plat_arm_error_handler(int err)                  __dead2 void plat_arm_error_handler(int err)
{                                                             {
        int ret;                                                      int ret;

        switch (err) {                                                switch (err) {
        case -ENOENT:                                                 case -ENOENT:
        case -EAUTH:                                                  case -EAUTH:
                /* Image load or authentication error. Era                    /* Image load or authentication error. Era
                INFO("Erasing FIP ToC from flash...\n");                      INFO("Erasing FIP ToC from flash...\n");
                (void)nor_unlock(PLAT_ARM_FLASH_IMAGE_BASE                    (void)nor_unlock(PLAT_ARM_FLASH_IMAGE_BASE
                ret = nor_word_program(PLAT_ARM_FLASH_IMAG                    ret = nor_word_program(PLAT_ARM_FLASH_IMAG
                if (ret != 0) {                                               if (ret != 0) {
                        ERROR("Cannot erase ToC\n");                                  ERROR("Cannot erase ToC\n");
                } else {                                                      } else {
                        INFO("Done\n");                                               INFO("Done\n");
                }                                                             }
                break;                                                        break;
        default:                                                      default:
                /* Unexpected error */                                        /* Unexpected error */
                break;                                                        break;
        }                                                             }

        console_flush();                                   |          (void)console_flush();

        /* Setup the watchdog to reset the system as soon             /* Setup the watchdog to reset the system as soon 
        sp805_refresh(ARM_SP805_TWDG_BASE, 1U);                       sp805_refresh(ARM_SP805_TWDG_BASE, 1U);

        for (;;)                                           |          while (true) {
                wfi();                                                        wfi();
                                                           >          }
}                                                             }
Last Author
garymorrison-arm
Last Edited
Jul 2 2021, 10:41 PM