PMUFW: EM: Integrate new Error Management framework as a module

This patch integrates the new EM framework and removes
redundant error handler files

Signed-off-by: Jyotheeswar Reddy <jyothee@xilinx.com>
This commit is contained in:
Jyotheeswar Reddy 2015-08-06 11:02:26 -07:00 committed by Nava kishore Manne
parent a414510d6a
commit 15dfa120ad
5 changed files with 110 additions and 326 deletions

View file

@ -1,253 +0,0 @@
/******************************************************************************
*
* Copyright (C) 2015 Xilinx, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* Use of the Software is limited solely to applications:
* (a) running on a Xilinx device, or
* (b) that interact with a Xilinx device through a bus or interconnect.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/
#include "xpfw_default.h"
#include "xpfw_error_handler.h"
#include "xpfw_resets.h"
#define ERROR_ONE_EN (PMU_GLOBAL_ERROR_INT_EN_1_DDR_ECC_MASK |\
PMU_GLOBAL_ERROR_INT_EN_1_OCM_ECC_MASK |\
PMU_GLOBAL_ERROR_INT_EN_1_RPU0_MASK |\
PMU_GLOBAL_ERROR_INT_EN_1_RPU1_MASK |\
PMU_GLOBAL_ERROR_INT_EN_1_LPD_TEMP_MASK |\
PMU_GLOBAL_ERROR_INT_EN_1_FPD_TEMP_MASK |\
PMU_GLOBAL_ERROR_INT_EN_1_RPU_LS_MASK |\
PMU_GLOBAL_ERROR_INT_EN_1_RPU_CCF_MASK |\
PMU_GLOBAL_ERROR_INT_EN_1_LPD_SWDT_MASK |\
PMU_GLOBAL_ERROR_INT_EN_1_FPD_SWDT_MASK |\
PMU_GLOBAL_ERROR_INT_EN_1_PWR_SUPPLY_MASK |\
PMU_GLOBAL_ERROR_INT_EN_1_XMPU_MASK)
#define ERROR_TWO_EN (PMU_GLOBAL_ERROR_INT_EN_2_TO_MASK |\
PMU_GLOBAL_ERROR_INT_EN_2_PL_MASK |\
PMU_GLOBAL_ERROR_INT_EN_2_PLL_LOCK_MASK |\
PMU_GLOBAL_ERROR_INT_EN_2_CSU_MASK |\
PMU_GLOBAL_ERROR_INT_EN_2_PMU_UC_MASK |\
PMU_GLOBAL_ERROR_INT_EN_2_CSU_ROM_MASK)
/*Not Enabled : PMU_GLOBAL_ERROR_INT_EN_2_PMU_FW_MASK |\
PMU_GLOBAL_ERROR_INT_EN_2_PMU_SERVICE_MASK |\
PMU_GLOBAL_ERROR_STATUS_2_PMU_PB_MASK
*/
void XPfw_ErrorHandlerInit(void)
{
/* Enable All in Error-1 */
XPfw_Write32(PMU_GLOBAL_ERROR_EN_1, ERROR_ONE_EN);
XPfw_Write32(PMU_GLOBAL_ERROR_INT_EN_1, ERROR_ONE_EN);
/* PMU related errors are not enabled in Error-2*/
XPfw_Write32(PMU_GLOBAL_ERROR_EN_2, ERROR_TWO_EN);
XPfw_Write32(PMU_GLOBAL_ERROR_INT_EN_2, ERROR_TWO_EN);
}
void XPfw_ErrorHandlerOne(void)
{
u32 l_ErrorOneReg;
/* Latch the Error Flags */
l_ErrorOneReg = XPfw_Read32(PMU_GLOBAL_ERROR_STATUS_1);
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_DDR_ECC_MASK) != 0x00000000U) {
XPfw_ErrorEccDdr();
}
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_OCM_ECC_MASK) != 0x00000000U) {
XPfw_ErrorEccOcm();
}
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_RPU0_MASK) != 0x00000000U) {
XPfw_ErrorRpu0();
}
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_RPU1_MASK) != 0x00000000U) {
XPfw_ErrorRpu1();
}
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_LPD_TEMP_MASK) != 0x00000000U) {
XPfw_ErrorLpdTemp();
}
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_FPD_TEMP_MASK) != 0x00000000U) {
XPfw_ErrorFpdTemp();
}
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_RPU_LS_MASK) != 0x00000000U) {
XPfw_ErrorRpuLockStep();
}
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_RPU_CCF_MASK) != 0x00000000U) {
XPfw_ErrorRpuCcf();
}
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_LPD_SWDT_MASK) != 0x00000000U) {
XPfw_ErrorLpdSwdt();
}
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_FPD_SWDT_MASK) != 0x00000000U) {
XPfw_ErrorFpdSwdt();
}
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_PWR_SUPPLY_MASK) != 0x00000000U) {
XPfw_ErrorPowerSupply();
}
if( (l_ErrorOneReg & PMU_GLOBAL_ERROR_STATUS_1_XMPU_MASK) != 0x00000000U) {
XPfw_ErrorXmpu();
}
/* Clear Error Register */
XPfw_Write32(PMU_GLOBAL_ERROR_STATUS_1,l_ErrorOneReg);
}
void XPfw_ErrorHandlerTwo(void)
{
u32 l_ErrorTwoReg;
/* Latch the Error Flags */
l_ErrorTwoReg = XPfw_Read32(PMU_GLOBAL_ERROR_STATUS_2);
if( (l_ErrorTwoReg & PMU_GLOBAL_ERROR_STATUS_2_TO_MASK) != 0x00000000U) {
XPfw_ErrorTimeOut();
}
if( (l_ErrorTwoReg & PMU_GLOBAL_ERROR_STATUS_2_PL_MASK) != 0x00000000U) {
XPfw_ErrorPL();
}
if( (l_ErrorTwoReg & PMU_GLOBAL_ERROR_STATUS_2_PLL_LOCK_MASK) != 0x00000000U) {
XPfw_ErrorPLL();
}
if( (l_ErrorTwoReg & PMU_GLOBAL_ERROR_STATUS_2_CSU_MASK) != 0x00000000U) {
XPfw_ErrorCsu();
}
if( (l_ErrorTwoReg & PMU_GLOBAL_ERROR_STATUS_2_PMU_UC_MASK) != 0x00000000U) {
XPfw_ErrorPmuUncorrectable();
}
if( (l_ErrorTwoReg & PMU_GLOBAL_ERROR_STATUS_2_PMU_FW_MASK) != 0x00000000U) {
XPfw_ErrorPmuFw();
}
if( (l_ErrorTwoReg & PMU_GLOBAL_ERROR_STATUS_2_PMU_SERVICE_MASK) != 0x00000000U) {
XPfw_ErrorPmuServiceMode();
}
if( (l_ErrorTwoReg & PMU_GLOBAL_ERROR_STATUS_2_PMU_PB_MASK) != 0x00000000U) {
XPfw_ErrorPmuPreBoot();
}
if( (l_ErrorTwoReg & PMU_GLOBAL_ERROR_STATUS_2_CSU_ROM_MASK) != 0x00000000U) {
XPfw_ErrorCsuRom();
}
/* Clear Error Register */
XPfw_Write32(PMU_GLOBAL_ERROR_STATUS_2,l_ErrorTwoReg);
}
void XPfw_ErrorEccDdr(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorEccOcm(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorRpu0(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorRpu1(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorLpdTemp(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorFpdTemp(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorRpuLockStep(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
XPfw_ResetRpu();
}
void XPfw_ErrorRpuCcf(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorLpdSwdt(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorFpdSwdt(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorPowerSupply(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorXmpu(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorTimeOut(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorPL(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorPLL(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorCsu(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorPmuUncorrectable(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorPmuFw(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorPmuServiceMode(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}
void XPfw_ErrorPmuPreBoot(void)
{
fw_printf( " XPFW: Error Handler Triggered: %s\r\n " ,__func__);
}
void XPfw_ErrorCsuRom(void) {
fw_printf("XPFW: Error Handler Triggered: %s\r\n",__func__);
}

View file

@ -0,0 +1,104 @@
/******************************************************************************
* Copyright (C) 2015 Xilinx, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* Use of the Software is limited solely to applications:
* (a) running on a Xilinx device, or
* (b) that interact with a Xilinx device through a bus or interconnect.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
******************************************************************************/
#include "xpfw_default.h"
#include "xpfw_module.h"
#include "xpfw_error_manager.h"
#include "xpfw_resets.h"
#include "xpfw_events.h"
#include "xpfw_core.h"
#ifdef ENABLE_EM
/**
* Example Error handler for RPU lockstep error
*
* This handler should be called when an R5 lockstep error occurs
* and it resets the RPU gracefully
*/
static void RpuLsHandler(u8 ErrorId)
{
fw_printf("EM: RPU Lock-Step Error Occurred (Error ID: %d)\r\n", ErrorId);
fw_printf("EM: Initiating RPU Reset \r\n");
XPfw_ResetRpu();
}
/* CfgInit Handler */
static void EmCfgInit(const XPfw_Module_t *ModPtr, const u32 *CfgData,
u32 Len)
{
/* Register for Error events from Core */
(void) XPfw_CoreRegisterEvent(ModPtr, XPFW_EV_ERROR_1);
(void) XPfw_CoreRegisterEvent(ModPtr, XPFW_EV_ERROR_2);
/* Init the Error Manager */
XPfw_EmInit();
/* Set handlers for error manager */
XPfw_EmSetAction(EM_ERR_ID_RPU_LS, EM_ACTION_CUSTOM, RpuLsHandler);
fw_printf("Error Management Module (MOD-%d): Initialized.\r\n",
ModPtr->ModId);
}
/**
* Events handler receives error events from core and routes them to
* Error Manager for processing
*/
static void EmEventHandler(const XPfw_Module_t *ModPtr, u32 EventId)
{
switch (EventId) {
case XPFW_EV_ERROR_1:
XPfw_EmProcessError(EM_ERR_TYPE_1);
break;
case XPFW_EV_ERROR_2:
XPfw_EmProcessError(EM_ERR_TYPE_2);
break;
default:
fw_printf("EM:Unhandled Event(ID:%d)\r\n", EventId);
break;
}
}
/*
* Create a Mod and assign the Handlers. We will call this function
* from XPfw_UserStartup()
*/
void ModEmInit(void)
{
const XPfw_Module_t *EmModPtr = XPfw_CoreCreateMod();
(void) XPfw_CoreSetCfgHandler(EmModPtr, EmCfgInit);
(void) XPfw_CoreSetEventHandler(EmModPtr, EmEventHandler);
}
#else /* ENABLE_EM */
void ModEmInit(void) { }
#endif /* ENABLE_EM */

View file

@ -1,5 +1,4 @@
/******************************************************************************
*
* Copyright (C) 2015 Xilinx, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@ -27,40 +26,11 @@
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/
#ifndef XPFW_ERROR_HANDLER_H_
#define XPFW_ERROR_HANDLER_H_
#ifndef XPFW_MOD_EM_H_
#define XPFW_MOD_EM_H_
void XPfw_ErrorHandlerInit(void);
void ModEmInit(void);
void XPfw_ErrorHandlerOne(void);
void XPfw_ErrorHandlerTwo(void);
void XPfw_ErrorEccDdr(void);
void XPfw_ErrorEccOcm(void);
void XPfw_ErrorRpu0(void);
void XPfw_ErrorRpu1(void);
void XPfw_ErrorLpdTemp(void);
void XPfw_ErrorFpdTemp(void);
void XPfw_ErrorRpuLockStep(void);
void XPfw_ErrorRpuCcf(void);
void XPfw_ErrorLpdSwdt(void);
void XPfw_ErrorFpdSwdt(void);
void XPfw_ErrorPowerSupply(void);
void XPfw_ErrorXmpu(void);
void XPfw_ErrorTimeOut(void);
void XPfw_ErrorPL(void);
void XPfw_ErrorPLL(void);
void XPfw_ErrorCsu(void);
void XPfw_ErrorPmuUncorrectable(void);
void XPfw_ErrorPmuFw(void);
void XPfw_ErrorPmuServiceMode(void);
void XPfw_ErrorPmuPreBoot(void);
void XPfw_ErrorCsuRom(void);
#endif /* XPFW_ERROR_HANDLER_H_ */
#endif /* XPFW_MOD_EM_H_ */

View file

@ -37,14 +37,13 @@
#include "xpfw_user_startup.h"
#include "pm_binding.h"
#include "xpfw_error_handler.h"
#include "pm_api.h"
#include "ipi_buffer.h"
#include "pm_defs.h"
#include "xpfw_mod_dap.h"
#include "xpfw_mod_legacy.h"
#include "xpfw_mod_em.h"
#ifdef ENABLE_PM
static void PmIpiHandler(const XPfw_Module_t *ModPtr, u32 IpiNum, u32 SrcMask)
@ -168,42 +167,6 @@ static void ModPmInit(void)
static void ModPmInit(void) { }
#endif /* ENABLE_PM */
#ifdef ENABLE_EM
static void EmEventHandler(const XPfw_Module_t *ModPtr, u32 EventId)
{
switch (EventId) {
case XPFW_EV_ERROR_1:
XPfw_ErrorHandlerOne();
break;
case XPFW_EV_ERROR_2:
XPfw_ErrorHandlerTwo();
break;
default:
fw_printf("EM:Unhandled Event(ID:%d)\r\n", EventId);
break;
}
}
static void EmCfgInit(const XPfw_Module_t *ModPtr, const u32 *CfgData, u32 Len)
{
(void)XPfw_CoreRegisterEvent(ModPtr, XPFW_EV_ERROR_1);
(void)XPfw_CoreRegisterEvent(ModPtr, XPFW_EV_ERROR_2);
XPfw_ErrorHandlerInit();
fw_printf("EM (MOD-%d): Initialized.\r\n", ModPtr->ModId);
}
static void ModEmInit(void)
{
const XPfw_Module_t *EmModPtr = XPfw_CoreCreateMod();
(void)XPfw_CoreSetCfgHandler(EmModPtr, EmCfgInit);
(void)XPfw_CoreSetEventHandler(EmModPtr, EmEventHandler);
}
#else /* ENABLE_EM */
static void ModEmInit(void) { }
#endif /* ENABLE_EM */
#ifdef ENABLE_RTC_TEST
static void RtcEventHandler(const XPfw_Module_t *ModPtr, u32 EventId)
{

View file

@ -1,4 +1,4 @@
#ifndef ZYNQMP_XPFW_VERSION__H_
#define ZYNQMP_XPFW_VERSION__H_
#define ZYNQMP_XPFW_VERSION "2015.3-rc1-13-g4ae8a5e895b2"
#define ZYNQMP_XPFW_VERSION "2015.3-rc1-14-g00965c45d411"
#endif