PDK-5918: Added eccMemType to ECC callback.
authorDanny Jochelson <dsjochel@ti.com>
Thu, 1 Oct 2020 17:10:59 +0000 (12:10 -0500)
committerHao Zhang <hzhang@ti.com>
Fri, 2 Oct 2020 15:30:33 +0000 (10:30 -0500)
Propagated the eccMemType to the ECC callback so that the application
can receive this information.
Added to ECC example printout and checking of this information.

packages/ti/diag/examples/ecc_example_app/esm.c
packages/ti/diag/sdr/sdr_ecc.h
packages/ti/diag/sdr/src/sdr_ecc.c
packages/ti/diag/sdr/test/sdtf-test/src/sdtf_init.c

index d3707a40c851bfcf37521d418a3f1180e5909670..25b3fed85c8383f0b9a6d31c75739b876759aae9 100644 (file)
 /* ESM event log entry */
 typedef struct
 {
+    /* ECC Aggregator where the event originated from */
+    SDR_ECC_MemType eccMemType;
     /* Type of ECC Error Received
      * Possible values are SDR_INJECT_ECC_ERROR_FORCING_1BIT_ONCE = 1, or
      * SDR_INJECT_ECC_ERROR_FORCING_2BIT_ONCE = 2 */
     uint32_t             errorSrc;
+    /* Address where the ECC error occurred - Not currently populated/used */
     uint32_t             address;
     /* Ram ID for the memory where the error occurred */
     uint32_t             ramId;
     /* Offset into the Ram ID where the error occurred */
     uint64_t             bitErrorOffset;
+    /* ECC Error Group where the error occurred - Interconnect RAM ID types only */
     uint32_t             bitErrorGroup;
+    /* Use Case number */
     uint8_t              useCaseNum;
 } ECC_Example_log_entry_t;
 
@@ -119,49 +124,56 @@ static volatile uint32_t totalExpectedEccEvtsPerUseCase[6] = {2, 2, 2, 2, 20, 20
 
 static ECC_Example_log_entry_t expectedEccEventLog[MAX_ESM_EVENTS_LOGGED] =
 {
-    {CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MCU_R5F0_CORE,                   /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_R5F_MEM_SUBTYPE_VBUSM2AXI_EDC_VECTOR_ID, /* ramId */
      0x0000000000000004,                              /* bitErrorOffset */
      21,                                              /* bitErrorGroup */
      0                                                /* useCaseNum */
     },
-    {CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MCU_R5F0_CORE,                   /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_R5F_MEM_SUBTYPE_VBUSM2AXI_EDC_VECTOR_ID, /* ramId */
      0x0000000000000000,                              /* bitErrorOffset */
      21,                                              /* bitErrorGroup */
      0                                                /* useCaseNum */
     },
-    {CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MCU_R5F0_CORE,                   /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_R5F_MEM_SUBTYPE_KS_VIM_RAM_VECTOR_ID,    /* ramId */
      0x0000000000000024,                              /* bitErrorOffset */
      0,                                               /* bitErrorGroup */
      1                                                /* useCaseNum */
     },
-    {CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MCU_R5F0_CORE,                   /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_R5F_MEM_SUBTYPE_KS_VIM_RAM_VECTOR_ID,    /* ramId */
      0x0000000000000020,                              /* bitErrorOffset */
      0,                                               /* bitErrorGroup */
      1                                                /* useCaseNum */
     },
-    {CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MAIN_MSMC_AGGR0,                 /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_MAIN_MSMC_MEM_INTERCONN_SUBTYPE,         /* ramId */
      0x0000000000000004,                              /* bitErrorOffset */
      0,                                               /* bitErrorGroup */
      2                                                /* useCaseNum */
     },
-    {CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MAIN_MSMC_AGGR0,                 /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_MAIN_MSMC_MEM_INTERCONN_SUBTYPE,         /* ramId */
      0x0000000000000000,                              /* bitErrorOffset */
      0,                                               /* bitErrorGroup */
      2                                                /* useCaseNum */
     },
-    {CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MAIN_MSMC_AGGR0,                 /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_MAIN_MSMC_MEM_WRAPPER_SUBTYPE,           /* ramId */
      0x000000000000010c,                              /* bitErrorOffset - Note that
@@ -170,7 +182,8 @@ static ECC_Example_log_entry_t expectedEccEventLog[MAX_ESM_EVENTS_LOGGED] =
      0,                                               /* bitErrorGroup */
      3                                                /* useCaseNum */
     },
-    {CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MAIN_MSMC_AGGR0,                 /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_MAIN_MSMC_MEM_WRAPPER_SUBTYPE,           /* ramId */
      0x0000000000000108,                              /* bitErrorOffset - Note that
@@ -181,7 +194,8 @@ static ECC_Example_log_entry_t expectedEccEventLog[MAX_ESM_EVENTS_LOGGED] =
     },
     /* Multiple SEC events consecutively - the following entry should occur
      * NUM_MULTIPLE_SEC_EVENTS times */
-    {CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MAIN_MSMC_AGGR0,                 /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_MAIN_MSMC_MEM_INTERCONN_SUBTYPE,         /* ramId */
      0x0000000000000004,                              /* bitErrorOffset */
@@ -190,7 +204,8 @@ static ECC_Example_log_entry_t expectedEccEventLog[MAX_ESM_EVENTS_LOGGED] =
     },
     /* Multiple DED events consecutively - the following entry should occur
      * NUM_MULTIPLE_DED_EVENTS times */
-    {CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MAIN_MSMC_AGGR0,                 /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_MAIN_MSMC_MEM_INTERCONN_SUBTYPE,         /* ramId */
      0x0000000000000000,                              /* bitErrorOffset */
@@ -199,7 +214,8 @@ static ECC_Example_log_entry_t expectedEccEventLog[MAX_ESM_EVENTS_LOGGED] =
     },
     /* Multiple SEC events consecutively - the following entry should occur
      * NUM_MULTIPLE_SEC_EVENTS times */
-    {CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MAIN_MSMC_AGGR0,                 /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_SINGLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_MAIN_MSMC_MEM_WRAPPER_SUBTYPE,           /* ramId */
      0x000000000000010c,                              /* bitErrorOffset - Note that
@@ -210,7 +226,8 @@ static ECC_Example_log_entry_t expectedEccEventLog[MAX_ESM_EVENTS_LOGGED] =
     },
     /* Multiple DED events consecutively - the following entry should occur
      * NUM_MULTIPLE_DED_EVENTS times */
-    {CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
+    {SDR_ECC_MEMTYPE_MAIN_MSMC_AGGR0,                 /* eccMemType */
+     CSL_ECC_AGGR_INTR_SRC_DOUBLE_BIT,                /* errorSrc */
      SDR_ESM_ERRORADDR_INVALID,                       /* address */
      SDR_ECC_MAIN_MSMC_MEM_WRAPPER_SUBTYPE,           /* ramId */
      0x0000000000000108,                              /* bitErrorOffset - Note that
@@ -408,7 +425,8 @@ extern volatile uint8_t  currUseCase;
 /*                          Function Definitions                              */
 /* ========================================================================== */
 
-void SDR_ECC_applicationCallbackFunction(uint32_t errorSrc,
+void SDR_ECC_applicationCallbackFunction(SDR_ECC_MemType eccMemType,
+                                         uint32_t errorSrc,
                                          uint32_t address,
                                          uint32_t ramId,
                                          uint64_t bitErrorOffset,
@@ -417,15 +435,16 @@ void SDR_ECC_applicationCallbackFunction(uint32_t errorSrc,
     int32_t useCaseCheck;
 
 #ifdef PRINT_EVENTS
-    DIAG_printf("\n  ECC Error Call back function called : errorSrc 0x%x, address 0x%x, " \
-                "ramId %d, bitErrorOffset 0x%08x%08x, bitErrorGroup %d\n",
-                errorSrc, address, ramId, (uint32_t)(bitErrorOffset >> 32),
+    DIAG_printf("\n  ECC Error Call back function called : eccMemType %d, errorSrc 0x%x, " \
+                "address 0x%x, ramId %d, bitErrorOffset 0x%08x%08x, bitErrorGroup %d\n",
+                eccMemType, errorSrc, address, ramId, (uint32_t)(bitErrorOffset >> 32),
                 (uint32_t)(bitErrorOffset & 0x00000000FFFFFFFF), bitErrorGroup);
     DIAG_printf("  Take action \n");
 #endif
 
     /* Log the event */
     eccEventLog[totalEccEventsLogged].useCaseNum     = currUseCase;
+    eccEventLog[totalEccEventsLogged].eccMemType     = eccMemType;
     eccEventLog[totalEccEventsLogged].errorSrc       = errorSrc;
     eccEventLog[totalEccEventsLogged].address        = address;
     eccEventLog[totalEccEventsLogged].ramId          = ramId;
@@ -774,6 +793,27 @@ static const char *printEccErrorType(SDR_ECC_InjectErrorType eccErrorType)
 
 }
 
+static const char *printEccAggregator(SDR_ECC_MemType eccMemType)
+{
+    char *pStr;
+
+    switch(eccMemType)
+    {
+        case SDR_ECC_MEMTYPE_MCU_R5F0_CORE:
+            pStr = "R5FSS0_CORE0_ECC_AGGR ECC Aggregator";
+            break;
+        case SDR_ECC_MEMTYPE_MAIN_MSMC_AGGR0:
+            pStr = "COMPUTE_CLUSTER0_MSMC_ECC_AGGR0 ECC Aggregator";
+            break;
+        default:
+            pStr = NULL;
+            break;
+    }
+
+    return pStr;
+
+}
+
 /*********************************************************************
 * @fn      ECC_Example_printSummary
 *
@@ -798,9 +838,11 @@ void ECC_Example_printSummary(void)
     DIAG_printf("------------------\n");
     for (i = 0; i < totalEccEventsLogged; i++) {
         DIAG_printf("\nUse Case %d: ECC Call back function called : \n"
+                    "    ECC Aggregator = %s, \n" \
                     "    ECC Error Type = %s, address 0x%x, \n" \
                     "    ramId %d, bitErrorOffset 0x%08x%08x, bitErrorGroup %d\n",
                     eccEventLog[i].useCaseNum,
+                    printEccAggregator(eccEventLog[i].eccMemType),
                     printEccErrorType((SDR_ECC_InjectErrorType)eccEventLog[i].errorSrc),
                     eccEventLog[i].address,
                     eccEventLog[i].ramId,
@@ -828,6 +870,12 @@ static int32_t checkUseCaseStructs(uint8_t actualLogSlot, uint8_t expectedLogSlo
     }
 
     /* Check event for proper information */
+    if (expectedEccEventLog[expectedLogSlot].eccMemType !=
+        eccEventLog[actualLogSlot].eccMemType) {
+        DIAG_printf("Error - Incorrect eccMemType for %s event in " \
+                    "Use Case %d\n", pStrErrType, useCaseNum);
+        retValue = -1;
+    }
     if (expectedEccEventLog[expectedLogSlot].errorSrc !=
         eccEventLog[actualLogSlot].errorSrc) {
         DIAG_printf("Error - Incorrect errorSrc for %s event in " \
index 1fe318e85e84658b0ec3ab5c50c2a10ebc3c7988..fa3dcdf726127c6ce27bd08a3aae57715e08cb12 100644 (file)
@@ -571,7 +571,8 @@ void SDR_ECC_registerVIMDEDHandler(SDR_ECC_VIMDEDVector_t VIMDEDHandler);
  *
  * \return  None
  */
-void SDR_ECC_applicationCallbackFunction(uint32_t errorSrc,
+void SDR_ECC_applicationCallbackFunction(SDR_ECC_MemType eccMemType,
+                                         uint32_t errorSrc,
                                          uint32_t address,
                                          uint32_t ramId,
                                          uint64_t bitErrorOffset,
index 2dc7760a902f122ce5f054d94df62d4007763a2a..9f4329ae4561498d9b120bcf181f5fa5f8a01dff 100644 (file)
@@ -387,7 +387,8 @@ static void SDR_ECC_handleEccAggrEvent (SDR_ECC_MemType eccMemType, uint32_t err
                 }
 
                 /* Call application callback function to indicate error */
-                SDR_ECC_applicationCallbackFunction(errorSrc,
+                SDR_ECC_applicationCallbackFunction(eccMemType,
+                                                    errorSrc,
                                                     errorAddr,
                                                     ramId,
                                                     bitErrorOffset,
@@ -463,7 +464,8 @@ static void SDR_ECC_callBackFunction (uint32_t errorSrc, uint32_t errorAddr,
                 SDR_ECC_instance[eccMemType].eccErrorFlag = SDR_ECC_ERROR_FLAG_TRIGGERED;
             } else {
                 /* Execute call back */
-                SDR_ECC_applicationCallbackFunction(errorSrc,
+                SDR_ECC_applicationCallbackFunction(eccMemType,
+                                                    errorSrc,
                                                     errorAddr,
                                                     ramId,
                                                     bitErrorOffset,
index c4db114be8375e9499e56c16be54bacb824584d4..3046ff8df63b4292b5149ee4e988accc7fdb6156 100644 (file)
@@ -675,15 +675,16 @@ void SDR_ESM_applicationCallbackFunction(SDR_ESM_InstanceType esmInstType,
 \r
 }\r
 \r
-void SDR_ECC_applicationCallbackFunction(uint32_t errorSrc,\r
+void SDR_ECC_applicationCallbackFunction(SDR_ECC_MemType eccMemType,\r
+                                         uint32_t errorSrc,\r
                                          uint32_t address,\r
                                          uint32_t ramId,\r
                                          uint64_t bitErrorOffset,\r
                                          uint32_t bitErrorGroup){\r
 \r
-    SDTF_printf("\n  ECC Error Call back function called : errorSrc 0x%x, address 0x%x, " \\r
-                "ramId %d, bitErrorOffset 0x%04x%04x, bitErrorGroup %d\n",\r
-                errorSrc, address, ramId, (uint32_t)(bitErrorOffset >> 32),\r
+    SDTF_printf("\n  ECC Error Call back function called : eccMemType %d, errorSrc 0x%x, " \\r
+                "address 0x%x, ramId %d, bitErrorOffset 0x%04x%04x, bitErrorGroup %d\n",\r
+                eccMemType, errorSrc, address, ramId, (uint32_t)(bitErrorOffset >> 32),\r
                 (uint32_t)(bitErrorOffset & 0x00000000FFFFFFFF), bitErrorGroup);\r
     SDTF_printf("  Take action \n");\r
 \r