Add support for loading to slaves' internal memory on QNX Vayu
authorvwan@ti.com <vwan@ti.com>
Fri, 8 Nov 2013 00:47:44 +0000 (16:47 -0800)
committerChris Ring <cring@ti.com>
Fri, 8 Nov 2013 20:44:34 +0000 (12:44 -0800)
Add static memory entry to inform loader of internal memory areas on DSP1 and IPU2.
This addresses SDOCM00104907.

Signed-off-by: VW <vwan@ti.com>
qnx/src/ipc3x_dev/ti/syslink/family/common/vayu/vayudsp/VAYUDspProc.c
qnx/src/ipc3x_dev/ti/syslink/family/common/vayu/vayuipu/vayucore0/VAYUIpuCore0Proc.c
qnx/src/ipc3x_dev/ti/syslink/family/common/vayu/vayuipu/vayucore1/VAYUIpuCore1Proc.c

index 7bd73f730d6be196210698980bcd08d50fd94711..5dea43f7fa694dbd23aeb706d547785ef9f24b47 100644 (file)
@@ -90,7 +90,7 @@ extern "C" {
 /*!
  *  @brief  Number of static entries in address translation table.
  */
-#define AddrTable_STATIC_COUNT 0
+#define AddrTable_STATIC_COUNT 3
 
 /*!
  *  @brief  Max entries in address translation table.
@@ -132,6 +132,47 @@ static UInt32 AddrTable_count = AddrTable_STATIC_COUNT;
  */
 static ProcMgr_AddrInfo AddrTable[AddrTable_SIZE] =
     {
+        /* L2 RAM */
+        {
+            .addr[ProcMgr_AddrType_MasterKnlVirt] = -1u,
+            .addr[ProcMgr_AddrType_MasterUsrVirt] = -1u,
+            .addr[ProcMgr_AddrType_MasterPhys] = 0x40800000u,
+            .addr[ProcMgr_AddrType_SlaveVirt] = 0x800000u,
+            .addr[ProcMgr_AddrType_SlavePhys] = -1u,
+            .size = 0x40000u,
+            .isCached = FALSE,
+            .mapMask = ProcMgr_SLAVEVIRT,
+            .isMapped = TRUE,
+            .refCount = 0u      /* refCount set to 0 for static entry */
+        },
+
+        /* L1P RAM */
+        {
+            .addr[ProcMgr_AddrType_MasterKnlVirt] = -1u,
+            .addr[ProcMgr_AddrType_MasterUsrVirt] = -1u,
+            .addr[ProcMgr_AddrType_MasterPhys] = 0x40E00000u,
+            .addr[ProcMgr_AddrType_SlaveVirt] = 0xE00000u,
+            .addr[ProcMgr_AddrType_SlavePhys] = -1u,
+            .size = 0x8000u,
+            .isCached = FALSE,
+            .mapMask = ProcMgr_SLAVEVIRT,
+            .isMapped = TRUE,
+            .refCount = 0u      /* refCount set to 0 for static entry */
+        },
+
+        /* L1D RAM */
+        {
+            .addr[ProcMgr_AddrType_MasterKnlVirt] = -1u,
+            .addr[ProcMgr_AddrType_MasterUsrVirt] = -1u,
+            .addr[ProcMgr_AddrType_MasterPhys] = 0x40F00000u,
+            .addr[ProcMgr_AddrType_SlaveVirt] = 0xF00000u,
+            .addr[ProcMgr_AddrType_SlavePhys] = -1u,
+            .size = 0x8000u,
+            .isCached = FALSE,
+            .mapMask = ProcMgr_SLAVEVIRT,
+            .isMapped = TRUE,
+            .refCount = 0u      /* refCount set to 0 for static entry */
+        },
     };
 
 /* =============================================================================
@@ -1024,10 +1065,29 @@ VAYUDSPPROC_attach(
                                     "VAYUDSPPROC_attach", status,
                                     "Failed to enable the slave MMU");
                             }
+                            else {
+#endif
+                                GT_0trace(curTrace, GT_2CLASS,
+                                    "VAYUDSPPROC_attach: Slave MMU "
+                                    "is configured!");
+
+                                /*
+                                 * Pull DSP MMU out of reset to make internal
+                                 * memory "loadable"
+                                 */
+                                status = VAYUDSP_halResetCtrl(object->halObject,
+                                    Processor_ResetCtrlCmd_MMU_Release);
+                                if (status < 0) {
+                                    /*! @retval status */
+                                    GT_setFailureReason(curTrace,
+                                        GT_4CLASS,
+                                        "VAYUDSP_halResetCtrl",
+                                        status,
+                                        "Reset MMU_Release failed");
+                                }
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+                            }
 #endif
-                            GT_0trace(curTrace, GT_2CLASS,
-                                "VAYUDSPPROC_attach: Slave MMU "
-                                "is configured!");
                         }
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
                     }
@@ -1092,6 +1152,19 @@ VAYUDSPPROC_detach (Processor_Handle handle)
                 GT_0trace(curTrace, GT_2CLASS,
                     "VAYUDSPPROC_detach: Disabling Slave MMU ...");
 
+                status = VAYUDSP_halResetCtrl(object->halObject,
+                    Processor_ResetCtrlCmd_MMU_Reset);
+#if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
+                if (status < 0) {
+                    /*! @retval status */
+                    GT_setFailureReason (curTrace,
+                                         GT_4CLASS,
+                                         "VAYUDSP_halResetCtrl",
+                                         status,
+                                         "Reset MMU failed");
+                }
+#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS) */
+
                status = VAYUDSP_halMmuCtrl(object->halObject,
                    Processor_MmuCtrlCmd_Disable, NULL);
 
@@ -1232,17 +1305,6 @@ VAYUDSPPROC_start (Processor_Handle        handle,
             else {
 #endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS) */
                 if (object->params.mmuEnable) {
-                    status = VAYUDSP_halResetCtrl(object->halObject,
-                                            Processor_ResetCtrlCmd_MMU_Release);
-                    if (status < 0) {
-                        /*! @retval status */
-                        GT_setFailureReason (curTrace,
-                                             GT_4CLASS,
-                                             "VAYUDSP_halResetCtrl",
-                                             status,
-                                             "Reset MMU_Release failed");
-                    }
-                    else {
                         status = rproc_dsp_setup(object->halObject,
                                                  object->params.memEntries,
                                                  object->params.numMemEntries);
@@ -1254,7 +1316,6 @@ VAYUDSPPROC_start (Processor_Handle        handle,
                                                  status,
                                                  "rproc_dsp_setup failed");
                         }
-                    }
                 }
                 /* release the slave cpu from reset */
                 if (status >= 0) {
@@ -1354,18 +1415,6 @@ VAYUDSPPROC_stop (Processor_Handle handle)
 #endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS) */
             if (object->params.mmuEnable) {
                 rproc_dsp_destroy(object->halObject);
-                status = VAYUDSP_halResetCtrl(object->halObject,
-                                              Processor_ResetCtrlCmd_MMU_Reset);
-#if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
-                if (status < 0) {
-                    /*! @retval status */
-                    GT_setFailureReason (curTrace,
-                                         GT_4CLASS,
-                                         "VAYUDSP_halResetCtrl",
-                                         status,
-                                         "Reset MMU failed");
-                }
-#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS) */
             }
         }
 #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
@@ -1796,7 +1845,9 @@ VAYUDSPPROC_map(
 
                 if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)) {
                     found = TRUE;
-                    ai->refCount++;
+
+                    /* refCount does not need to be incremented for static entries */
+
                     break;
                  }
             }
index 1e9b7d06f5f886fd5f5cbc2a3d98b8cf6da0074b..c0d92d0211afe15f00a3d0baf0419747cb8d9507 100644 (file)
@@ -90,7 +90,7 @@ extern "C" {
 /*!
  *  @brief  Number of static entries in address translation table.
  */
-#define AddrTable_STATIC_COUNT 0
+#define AddrTable_STATIC_COUNT 1
 
 /*!
  *  @brief  Max entries in address translation table.
@@ -135,6 +135,19 @@ static UInt32 AddrTable_count = AddrTable_STATIC_COUNT;
  */
 static ProcMgr_AddrInfo AddrTable[AddrTable_SIZE] =
     {
+        /* L2 RAM */
+        {
+            .addr[ProcMgr_AddrType_MasterKnlVirt] = -1u,
+            .addr[ProcMgr_AddrType_MasterUsrVirt] = -1u,
+            .addr[ProcMgr_AddrType_MasterPhys] = 0x55020000u,
+            .addr[ProcMgr_AddrType_SlaveVirt] = 0x20000000u,
+            .addr[ProcMgr_AddrType_SlavePhys] = -1u,
+            .size = 0x10000u,
+            .isCached = FALSE,
+            .mapMask = ProcMgr_SLAVEVIRT,
+            .isMapped = TRUE,
+            .refCount = 0u      /* refCount set to 0 for static entry */
+        },
     };
 
 /* =============================================================================
@@ -1031,10 +1044,29 @@ VAYUIPUCORE0PROC_attach(
                                     "VAYUIPUCORE0PROC_attach", status,
                                     "Failed to enable the slave MMU");
                             }
+                            else {
+#endif
+                                GT_0trace(curTrace, GT_2CLASS,
+                                    "VAYUIPUCORE0PROC_attach: Slave MMU "
+                                    "is configured!");
+                                /*
+                                 * Pull IPU MMU out of reset to make internal
+                                 * memory "loadable"
+                                 */
+                                status = VAYUIPUCORE0_halResetCtrl(
+                                    object->halObject,
+                                    Processor_ResetCtrlCmd_MMU_Release);
+                                if (status < 0) {
+                                    /*! @retval status */
+                                    GT_setFailureReason(curTrace,
+                                        GT_4CLASS,
+                                        "VAYUIPUCORE0_halResetCtrl",
+                                        status,
+                                        "Reset MMU_Release failed");
+                                }
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+                             }
 #endif
-                            GT_0trace(curTrace, GT_2CLASS,
-                                "VAYUIPUCORE0PROC_attach: Slave MMU "
-                                "is configured!");
                         }
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
                     }
@@ -1098,6 +1130,19 @@ VAYUIPUCORE0PROC_detach (Processor_Handle handle)
                 GT_0trace(curTrace, GT_2CLASS,
                     "VAYUIPUCORE0PROC_detach: Disabling Slave MMU ...");
 
+                status = VAYUIPUCORE0_halResetCtrl(object->halObject,
+                    Processor_ResetCtrlCmd_MMU_Reset);
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+                if (status < 0) {
+                    /*! @retval status */
+                    GT_setFailureReason (curTrace,
+                                         GT_4CLASS,
+                                         "VAYUIPUCORE0_halResetCtrl",
+                                         status,
+                                         "Reset MMU failed");
+                }
+#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
+
                 status = VAYUIPU_halMmuCtrl(object->halObject,
                                             Processor_MmuCtrlCmd_Disable, NULL);
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
@@ -1239,28 +1284,16 @@ VAYUIPUCORE0PROC_start (Processor_Handle        handle,
             else {
 #endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
                 if (object->params.mmuEnable) {
-                    status = VAYUIPUCORE0_halResetCtrl(object->halObject,
-                                            Processor_ResetCtrlCmd_MMU_Release);
+                    status = rproc_ipu_setup(object->halObject,
+                                             object->params.memEntries,
+                                             object->params.numMemEntries);
                     if (status < 0) {
                         /*! @retval status */
                         GT_setFailureReason (curTrace,
                                              GT_4CLASS,
                                              "VAYUIPUCORE0_halResetCtrl",
                                              status,
-                                             "Reset MMU_Release failed");
-                    }
-                    else {
-                        status = rproc_ipu_setup(object->halObject,
-                                                 object->params.memEntries,
-                                                 object->params.numMemEntries);
-                        if (status < 0) {
-                            /*! @retval status */
-                            GT_setFailureReason (curTrace,
-                                                 GT_4CLASS,
-                                                 "VAYUIPUCORE0_halResetCtrl",
-                                                 status,
-                                                 "rproc_ipu_setup failed");
-                        }
+                                             "rproc_ipu_setup failed");
                     }
                 }
                 /* release the slave cpu from reset */
@@ -1361,18 +1394,6 @@ VAYUIPUCORE0PROC_stop (Processor_Handle handle)
 #endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
             if (object->params.mmuEnable) {
                 rproc_ipu_destroy(object->halObject);
-                status = VAYUIPUCORE0_halResetCtrl(object->halObject,
-                                              Processor_ResetCtrlCmd_MMU_Reset);
-#if !defined(SYSLINK_BUILD_OPTIMIZE)
-                if (status < 0) {
-                    /*! @retval status */
-                    GT_setFailureReason (curTrace,
-                                         GT_4CLASS,
-                                         "VAYUIPUCORE0_halResetCtrl",
-                                         status,
-                                         "Reset MMU failed");
-                }
-#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
             }
         }
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
@@ -1810,7 +1831,7 @@ VAYUIPUCORE0PROC_map(
 
                 if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)) {
                     found = TRUE;
-                    ai->refCount++;
+                    /* refCount does not need to be incremented for static entries */
                     break;
                 }
             }
index f35a95b423730cb5445c7917275c575718fbe28d..4c0c2cdc424917bb016904dfc0daf22286a985f7 100644 (file)
@@ -90,7 +90,7 @@ extern "C" {
 /*!
  *  @brief  Number of static entries in address translation table.
  */
-#define AddrTable_STATIC_COUNT 0
+#define AddrTable_STATIC_COUNT 1
 
 /*!
  *  @brief  Max entries in address translation table.
@@ -135,6 +135,19 @@ static UInt32 AddrTable_count = AddrTable_STATIC_COUNT;
  */
 static ProcMgr_AddrInfo AddrTable[AddrTable_SIZE] =
     {
+        /* L2 RAM */
+        {
+            .addr[ProcMgr_AddrType_MasterKnlVirt] = -1u,
+            .addr[ProcMgr_AddrType_MasterUsrVirt] = -1u,
+            .addr[ProcMgr_AddrType_MasterPhys] = 0x55020000u,
+            .addr[ProcMgr_AddrType_SlaveVirt] = 0x20000000u,
+            .addr[ProcMgr_AddrType_SlavePhys] = -1u,
+            .size = 0x10000u,
+            .isCached = FALSE,
+            .mapMask = ProcMgr_SLAVEVIRT,
+            .isMapped = TRUE,   /* Internal memory is always 'mapped' on the slave */
+            .refCount = 0u      /* refCount set to 0 for static entry */
+        },
     };
 
 /* =============================================================================
@@ -1028,10 +1041,29 @@ VAYUIPUCORE1PROC_attach(
                                     "VAYUIPUCORE1PROC_attach", status,
                                     "Failed to enable the slave MMU");
                             }
+                            else {
+#endif
+                                GT_0trace(curTrace, GT_2CLASS,
+                                    "VAYUIPUCORE1PROC_attach: Slave MMU "
+                                    "is configured!");
+                                /*
+                                 * Pull IPU MMU out of reset to make internal
+                                 * memory "loadable"
+                                 */
+                                status = VAYUIPUCORE1_halResetCtrl(
+                                    object->halObject,
+                                    Processor_ResetCtrlCmd_MMU_Release);
+                                if (status < 0) {
+                                    /*! @retval status */
+                                    GT_setFailureReason(curTrace,
+                                        GT_4CLASS,
+                                        "VAYUIPUCORE1_halResetCtrl",
+                                        status,
+                                        "Reset MMU_Release failed");
+                                }
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+                             }
 #endif
-                            GT_0trace(curTrace, GT_2CLASS,
-                                "VAYUIPUCORE1PROC_attach: Slave MMU "
-                                "is configured!");
                         }
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
                     }
@@ -1095,6 +1127,19 @@ VAYUIPUCORE1PROC_detach (Processor_Handle handle)
                 GT_0trace(curTrace, GT_2CLASS,
                     "VAYUIPUCORE1PROC_detach: Disabling Slave MMU ...");
 
+                status = VAYUIPUCORE1_halResetCtrl(object->halObject,
+                    Processor_ResetCtrlCmd_MMU_Reset);
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+                if (status < 0) {
+                    /*! @retval status */
+                    GT_setFailureReason (curTrace,
+                                         GT_4CLASS,
+                                         "VAYUIPUCORE1_halResetCtrl",
+                                         status,
+                                         "Reset MMU failed");
+                }
+#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) */
+
                 status = VAYUIPU_halMmuCtrl(object->halObject,
                     Processor_MmuCtrlCmd_Disable, NULL);
 #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
@@ -1235,20 +1280,7 @@ VAYUIPUCORE1PROC_start (Processor_Handle        handle,
             }
             else {
 #endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS) */
-                if (object->params.mmuEnable) {
-                    status = VAYUIPUCORE1_halResetCtrl(object->halObject,
-                                            Processor_ResetCtrlCmd_MMU_Release);
-                    if (status < 0) {
-                        /*! @retval status */
-                        GT_setFailureReason (curTrace,
-                                             GT_4CLASS,
-                                             "VAYUIPUCORE1_halResetCtrl",
-                                             status,
-                                             "Reset MMU_Release failed");
-                    }
-                    /* No need to call rproc_ipu_setup from here, handled in
-                     * core0 */
-                }
+
                 /* release the slave cpu from reset */
                 if (status >= 0) {
                     status = VAYUIPUCORE1_halResetCtrl(object->halObject,
@@ -1345,21 +1377,7 @@ VAYUIPUCORE1PROC_stop (Processor_Handle handle)
                                      "Failed to place slave in reset");
             }
 #endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS) */
-            if (object->params.mmuEnable) {
-                /* Don't need to call rproc_ipu_destroy, handled in core0 */
-                status = VAYUIPUCORE1_halResetCtrl(object->halObject,
-                                              Processor_ResetCtrlCmd_MMU_Reset);
-#if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
-                if (status < 0) {
-                    /*! @retval status */
-                    GT_setFailureReason (curTrace,
-                                         GT_4CLASS,
-                                         "VAYUIPUCORE1_halResetCtrl",
-                                         status,
-                                         "Reset MMU failed");
-                }
-#endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS) */
-            }
+
         }
 #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
     }
@@ -1796,7 +1814,7 @@ VAYUIPUCORE1PROC_map(
 
                 if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)) {
                     found = TRUE;
-                    ai->refCount++;
+                    /* refCount does not need to be incremented for static entries */
                     break;
                 }
             }