Add INTMEM resource type support in QNX
authorvwan@ti.com <vwan@ti.com>
Mon, 19 May 2014 17:20:20 +0000 (10:20 -0700)
committerRobert Tivy <rtivy@ti.com>
Tue, 20 May 2014 22:30:24 +0000 (15:30 -0700)
This commit adds support for the new INTMEM resource type (SDOCM00107479).

For this resource type, we map the entry only for the loader on the host,
without mapping it to the slave MMU.

This commit also removes support of the hard-coded static entries defined
in the address translation table, which was originally there to ensure
slave internal memories are always mapped. To match up with the Linux
implementation we'll now rely on the INTMEM resource type instead.

Note that this does break compatibility with slave executables that were
previously built without the INTMEM resource entries but were relying
on the hard-coded internal memory definitions in the ipc resource manager.

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
qnx/src/ipc3x_dev/ti/syslink/family/omap5430/ipu/omap5430BenelliProc.c
qnx/src/ipc3x_dev/ti/syslink/resources/RscTable.c
qnx/src/ipc3x_dev/ti/syslink/resources/rsc_types.h

index e3e264553a3624f3146b2013a6f99a54c01a7993..c968b59c3cd5338a859317e1500cfec13225b50b 100644 (file)
@@ -87,10 +87,6 @@ extern "C" {
  * =============================================================================
  */
 
-/*!
- *  @brief  Number of static entries in address translation table.
- */
-#define AddrTable_STATIC_COUNT 3
 
 /*!
  *  @brief  Max entries in address translation table.
@@ -119,55 +115,12 @@ typedef struct VAYUDSPPROC_ModuleObject_tag {
 } VAYUDSPPROC_ModuleObject;
 
 /* Default memory regions */
-static UInt32 AddrTable_count = AddrTable_STATIC_COUNT;
+static UInt32 AddrTable_count = 0;
 
-/* static memory regions
- * CAUTION: AddrTable_STATIC_COUNT must match number of entries below.
+/*
+ * Address translation table
  */
-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 */
-        },
-    };
+static ProcMgr_AddrInfo AddrTable[AddrTable_SIZE];
 
 /* =============================================================================
  *  Globals
@@ -187,7 +140,7 @@ VAYUDSPPROC_ModuleObject VAYUDSPPROC_state =
     .isSetup = FALSE,
     .configSize = sizeof(VAYUDSPPROC_Config),
     .gateHandle = NULL,
-    .defInstParams.numMemEntries = AddrTable_STATIC_COUNT
+    .defInstParams.numMemEntries = 0
 };
 
 /* config override specified in SysLinkCfg.c, defined in ProcMgr.c */
@@ -408,7 +361,7 @@ VAYUDSPPROC_Params_init(
                 ai->isMapped = FALSE;
             }
 
-            /* initialize refCount for all entries - both static and dynamic */
+            /* initialize refCount for all entries */
             for(i = 0; i < AddrTable_SIZE; i++) {
                 AddrTable[i].refCount = 0u;
             }
@@ -1137,7 +1090,7 @@ VAYUDSPPROC_detach (Processor_Handle handle)
 #endif
 
             /* delete all dynamically added entries */
-            for (i = AddrTable_STATIC_COUNT; i < AddrTable_count; i++) {
+            for (i = 0; i < AddrTable_count; i++) {
                 ai = &AddrTable[i];
                 ai->addr[ProcMgr_AddrType_MasterKnlVirt] = -1u;
                 ai->addr[ProcMgr_AddrType_MasterUsrVirt] = -1u;
@@ -1150,8 +1103,8 @@ VAYUDSPPROC_detach (Processor_Handle handle)
                 ai->isMapped = FALSE;
                 ai->refCount = 0u;
             }
-            object->params.numMemEntries = AddrTable_STATIC_COUNT;
-            AddrTable_count = AddrTable_STATIC_COUNT;
+            object->params.numMemEntries = 0;
+            AddrTable_count = 0;
 
             //No need to reset.. that will be done in STOP
             /*tmpStatus = VAYUDSP_halResetCtrl(object->halObject,
@@ -1738,7 +1691,6 @@ VAYUDSPPROC_map(
     UInt32                      i;
     UInt32                      j;
     ProcMgr_AddrInfo *          ai = NULL;
-    VAYUDSP_HalMmuCtrlArgs_AddEntry addEntryArgs;
 
     GT_4trace (curTrace, GT_ENTER, "VAYUDSPPROC_map",
                handle, dstAddr, nSegs, sglist);
@@ -1785,37 +1737,18 @@ VAYUDSPPROC_map(
              * is required. Add the entry only if the range does not exist
              * in the translation table.
              */
-
-            /* check in static entries first */
-            for (j = 0; j < AddrTable_STATIC_COUNT; j++) {
+            for (j = 0; j < AddrTable_count; j++) {
                 ai = &AddrTable [j];
-                startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
-                endAddr = startAddr + ai->size;
-
-                if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)) {
-                    found = TRUE;
-
-                    /* refCount does not need to be incremented for static entries */
 
-                    break;
-                 }
-            }
+                if (ai->isMapped == TRUE) {
+                    startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
+                    endAddr = startAddr + ai->size;
 
-            /* if not found in static entries, check in dynamic entries */
-            if (!found) {
-                for (j = AddrTable_STATIC_COUNT; j < AddrTable_count; j++) {
-                    ai = &AddrTable [j];
-
-                    if (ai->isMapped == TRUE) {
-                        startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
-                        endAddr = startAddr + ai->size;
-
-                        if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)
-                            && ((*dstAddr + sglist[i].size) <= endAddr)) {
-                            found = TRUE;
-                            ai->refCount++;
-                            break;
-                        }
+                    if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)
+                        && ((*dstAddr + sglist[i].size) <= endAddr)) {
+                        found = TRUE;
+                        ai->refCount++;
+                        break;
                     }
                 }
             }
@@ -1833,6 +1766,7 @@ VAYUDSPPROC_map(
                     ai->size = sglist[i].size;
                     ai->isCached = sglist[i].isCached;
                     ai->refCount++;
+                    ai->isMapped = TRUE;
 
                     AddrTable_count++;
                 }
@@ -1843,38 +1777,6 @@ VAYUDSPPROC_map(
                         "AddrTable_SIZE reached!");
                 }
             }
-
-            /* if new entry, map into dsp mmu */
-            if ((ai != NULL) && (ai->refCount == 1) && (status >= 0)) {
-                ai->isMapped = TRUE;
-
-                /* Add entry to Dsp mmu */
-                addEntryArgs.masterPhyAddr = sglist [i].paddr;
-                addEntryArgs.size          = sglist [i].size;
-                addEntryArgs.slaveVirtAddr = (UInt32)*dstAddr;
-                /* TBD: elementSize, endianism, mixedSized are
-                 * hard coded now, must be configurable later
-                 */
-                addEntryArgs.elementSize   = ELEM_SIZE_16BIT;
-                addEntryArgs.endianism     = LITTLE_ENDIAN;
-                addEntryArgs.mixedSize     = MMU_TLBES;
-                status = VAYUDSP_halMmuCtrl(object->halObject,
-                    Processor_MmuCtrlCmd_AddEntry, &addEntryArgs);
-#if !defined(SYSLINK_BUILD_OPTIMIZE)
-                if (status < 0) {
-                    GT_setFailureReason(curTrace, GT_4CLASS,
-                        "VAYUDSPPROC_map", status,
-                        "Processor_MmuCtrlCmd_AddEntry failed");
-                }
-#endif
-            }
-#if !defined(SYSLINK_BUILD_OPTIMIZE)
-            if (status < 0) {
-                GT_setFailureReason(curTrace, GT_4CLASS,
-                    "VAYUDSPPROC_map", status,
-                    "DSP MMU configuration failed");
-            }
-#endif
         }
 #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
     }
@@ -1941,10 +1843,10 @@ VAYUDSPPROC_unmap(
         object = (VAYUDSPPROC_Object *) procHandle->object;
         GT_assert (curTrace, (object != NULL));
 
-        /* Delete dynamically added non-default entries from translation
+        /* Delete entries from translation
          * table only in last unmap called on that entry
          */
-        for (i = AddrTable_STATIC_COUNT; i < AddrTable_count; i++) {
+        for (i = 0; i < AddrTable_count; i++) {
             ai = &AddrTable[i];
 
             if (!ai->isMapped) {
index adab529ed3143c9e36ce050b8612803ab1442459..f2ba037154f4ea998e02ce91d587875f218c71e3 100644 (file)
@@ -87,11 +87,6 @@ extern "C" {
  * =============================================================================
  */
 
-/*!
- *  @brief  Number of static entries in address translation table.
- */
-#define AddrTable_STATIC_COUNT 1
-
 /*!
  *  @brief  Max entries in address translation table.
  */
@@ -129,46 +124,15 @@ typedef struct VAYUIPUCORE0PROC_ModuleObject_tag {
 
 /* Memory region counters */
 static UInt32 AddrTable_count[NUM_IPUS] = {
-    AddrTable_STATIC_COUNT,
-    AddrTable_STATIC_COUNT,
+    0,
+    0
 };
 
-/* static memory regions
- * CAUTION: AddrTable_STATIC_COUNT must match number of entries below.
+/*
+ * Address translation tables
  */
-static ProcMgr_AddrInfo AddrTable_IPU1[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 */
-    },
-};
-
-static ProcMgr_AddrInfo AddrTable_IPU2[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 */
-    },
-};
+static ProcMgr_AddrInfo AddrTable_IPU1[AddrTable_SIZE];
+static ProcMgr_AddrInfo AddrTable_IPU2[AddrTable_SIZE];
 
 static ProcMgr_AddrInfo * AddrTable[NUM_IPUS] =
 {
@@ -194,7 +158,7 @@ VAYUIPUCORE0PROC_ModuleObject VAYUIPUCORE0PROC_state =
     .isSetup = FALSE,
     .configSize = sizeof(VAYUIPUCORE0PROC_Config),
     .gateHandle = NULL,
-    .defInstParams.numMemEntries = AddrTable_STATIC_COUNT,
+    .defInstParams.numMemEntries = 0,
 };
 
 /* config override specified in SysLinkCfg.c, defined in ProcMgr.c */
@@ -536,7 +500,6 @@ VAYUIPUCORE0PROC_create (      UInt16                procId,
 
                     /*
                      * initialize refCount for all entries
-                     * both static and dynamic
                      */
                     for (i = 0; i < AddrTable_SIZE; i++) {
                         AddrTable[PROCID_TO_IPU(procId)][i].refCount = 0u;
@@ -1157,7 +1120,7 @@ VAYUIPUCORE0PROC_detach (Processor_Handle handle)
 #endif
 
             /* delete all dynamically added entries */
-            for (i = AddrTable_STATIC_COUNT; i <
+            for (i = 0; i <
                 AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; i++) {
                 ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][i];
                 ai->addr[ProcMgr_AddrType_MasterKnlVirt] = -1u;
@@ -1171,9 +1134,8 @@ VAYUIPUCORE0PROC_detach (Processor_Handle handle)
                 ai->isMapped = FALSE;
                 ai->refCount = 0u;
             }
-            object->params.numMemEntries = AddrTable_STATIC_COUNT;
-            AddrTable_count[PROCID_TO_IPU(procHandle->procId)] =
-                AddrTable_STATIC_COUNT;
+            object->params.numMemEntries = 0;
+            AddrTable_count[PROCID_TO_IPU(procHandle->procId)] = 0;
 
             //No need to reset.. that will be done in STOP
             /*tmpStatus = VAYUIPUCORE0_halResetCtrl(object->halObject,
@@ -1767,7 +1729,6 @@ VAYUIPUCORE0PROC_map(
     UInt32                      i;
     UInt32                      j;
     ProcMgr_AddrInfo *          ai = NULL;
-    VAYUIPU_HalMmuCtrlArgs_AddEntry addEntryArgs;
 
     GT_4trace(curTrace, GT_ENTER, "VAYUIPUCORE0PROC_map:",
         handle, *dstAddr, nSegs, sglist);
@@ -1814,36 +1775,19 @@ VAYUIPUCORE0PROC_map(
              * is required. Add the entry only if the range does not exist
              * in the translation table.
              */
-
-            /* check in static entries first */
-            for (j = 0; j < AddrTable_STATIC_COUNT; j++) {
+            for (j = 0;
+                j < AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; j++) {
                 ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][j];
-                startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
-                endAddr = startAddr + ai->size;
 
-                if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)) {
-                    found = TRUE;
-                    /* refCount does not need to be incremented for static entries */
-                    break;
-                }
-            }
+                if (ai->isMapped == TRUE) {
+                    startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
+                    endAddr = startAddr + ai->size;
 
-            /* if not found in static entries, check in dynamic entries */
-            if (!found) {
-                for (j = AddrTable_STATIC_COUNT;
-                    j < AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; j++) {
-                    ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][j];
-
-                    if (ai->isMapped == TRUE) {
-                        startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
-                        endAddr = startAddr + ai->size;
-
-                        if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)
-                            && ((*dstAddr + sglist[i].size) <= endAddr)) {
-                            found = TRUE;
-                            ai->refCount++;
-                            break;
-                        }
+                    if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)
+                        && ((*dstAddr + sglist[i].size) <= endAddr)) {
+                        found = TRUE;
+                        ai->refCount++;
+                        break;
                     }
                 }
             }
@@ -1865,6 +1809,7 @@ VAYUIPUCORE0PROC_map(
                     ai->size = sglist[i].size;
                     ai->isCached = sglist[i].isCached;
                     ai->refCount++;
+                    ai->isMapped = TRUE;
 
                     AddrTable_count[PROCID_TO_IPU(procHandle->procId)]++;
                 }
@@ -1875,40 +1820,6 @@ VAYUIPUCORE0PROC_map(
                         "AddrTable_SIZE reached!");
                 }
             }
-
-            /* if new entry, map into dsp mmu */
-            if ((ai != NULL) && (ai->refCount == 1) && (status >= 0)) {
-                ai->isMapped = TRUE;
-
-                /* add entry to L2 MMU */
-                addEntryArgs.masterPhyAddr = sglist [i].paddr;
-                addEntryArgs.size          = sglist [i].size;
-                addEntryArgs.slaveVirtAddr = (UInt32)*dstAddr;
-                /* TBD: elementSize, endianism, mixedSized are
-                 * hard coded now, must be configurable later
-                 */
-                addEntryArgs.elementSize   = ELEM_SIZE_16BIT;
-                addEntryArgs.endianism     = LITTLE_ENDIAN;
-                addEntryArgs.mixedSize     = MMU_TLBES;
-
-                status = VAYUIPU_halMmuCtrl(object->halObject,
-                    Processor_MmuCtrlCmd_AddEntry, &addEntryArgs);
-
-#if !defined(SYSLINK_BUILD_OPTIMIZE)
-                if (status < 0) {
-                    GT_setFailureReason(curTrace, GT_4CLASS,
-                        "VAYUIPUCORE0PROC_map", status,
-                        "Processor_MmuCtrlCmd_AddEntry failed");
-                }
-#endif
-            }
-#if !defined(SYSLINK_BUILD_OPTIMIZE)
-            if (status < 0) {
-                GT_setFailureReason(curTrace, GT_4CLASS,
-                    "VAYUIPUCORE0PROC_map", status,
-                    "IPUCORE0 MMU configuration failed");
-            }
-#endif
         }
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
     }
@@ -1975,10 +1886,10 @@ VAYUIPUCORE0PROC_unmap(
         object = (VAYUIPUCORE0PROC_Object *) procHandle->object;
         GT_assert (curTrace, (object != NULL));
 
-        /* Delete dynamically added non-default entries from translation
+        /* Delete added entries from translation
          * table only in last unmap called on that entry
          */
-        for (i = AddrTable_STATIC_COUNT;
+        for (i = 0;
             i < AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; i++) {
             ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][i];
 
index 9cc0046a724813253903787b197893ba3157c5d3..9a67d1823c4b97dbb26d8f3eb8330211025bd658 100644 (file)
@@ -87,11 +87,6 @@ extern "C" {
  * =============================================================================
  */
 
-/*!
- *  @brief  Number of static entries in address translation table.
- */
-#define AddrTable_STATIC_COUNT 1
-
 /*!
  *  @brief  Max entries in address translation table.
  */
@@ -130,46 +125,13 @@ typedef struct VAYUIPUCORE1PROC_ModuleObject_tag {
 
 /* Memory region counters */
 static UInt32 AddrTable_count[NUM_IPUS] = {
-    AddrTable_STATIC_COUNT,
-    AddrTable_STATIC_COUNT,
+    0,
+    0,
 };
 
-/* static memory regions
- * CAUTION: AddrTable_STATIC_COUNT must match number of entries below.
- */
-static ProcMgr_AddrInfo AddrTable_IPU1[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 */
-    },
-};
-
-static ProcMgr_AddrInfo AddrTable_IPU2[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 */
-    },
-};
+/* Address translation table */
+static ProcMgr_AddrInfo AddrTable_IPU1[AddrTable_SIZE];
+static ProcMgr_AddrInfo AddrTable_IPU2[AddrTable_SIZE];
 
 static ProcMgr_AddrInfo * AddrTable[NUM_IPUS] =
 {
@@ -195,7 +157,7 @@ VAYUIPUCORE1PROC_ModuleObject VAYUIPUCORE1PROC_state =
     .isSetup = FALSE,
     .configSize = sizeof (VAYUIPUCORE1PROC_Config),
     .gateHandle = NULL,
-    .defInstParams.numMemEntries = AddrTable_STATIC_COUNT,
+    .defInstParams.numMemEntries = 0,
 };
 
 /* config override specified in SysLinkCfg.c, defined in ProcMgr.c */
@@ -538,7 +500,6 @@ VAYUIPUCORE1PROC_create (      UInt16                procId,
 
                     /*
                      * initialize refCount for all entries
-                     * both static and dynamic
                      */
                     for (i = 0; i < AddrTable_SIZE; i++) {
                         AddrTable[PROCID_TO_IPU(procId)][i].refCount = 0u;
@@ -1159,7 +1120,7 @@ VAYUIPUCORE1PROC_detach (Processor_Handle handle)
 #endif
 
             /* delete all dynamically added entries */
-            for (i = AddrTable_STATIC_COUNT; i <
+            for (i = 0; i <
                 AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; i++) {
                 ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][i];
                 ai->addr[ProcMgr_AddrType_MasterKnlVirt] = -1u;
@@ -1173,9 +1134,8 @@ VAYUIPUCORE1PROC_detach (Processor_Handle handle)
                 ai->isMapped = FALSE;
                 ai->refCount = 0u;
             }
-            object->params.numMemEntries = AddrTable_STATIC_COUNT;
-            AddrTable_count[PROCID_TO_IPU(procHandle->procId)] =
-                AddrTable_STATIC_COUNT;
+            object->params.numMemEntries = 0;
+            AddrTable_count[PROCID_TO_IPU(procHandle->procId)] = 0;
 
             //No need to reset.. that will be done in STOP
             /*tmpStatus = VAYUIPUCORE1_halResetCtrl(object->halObject,
@@ -1759,7 +1719,6 @@ VAYUIPUCORE1PROC_map(
     UInt32                      i;
     UInt32                      j;
     ProcMgr_AddrInfo *          ai = NULL;
-    VAYUIPU_HalMmuCtrlArgs_AddEntry addEntryArgs;
 
     GT_4trace(curTrace, GT_ENTER, "VAYUIPUCORE1PROC_map:",
         handle, *dstAddr, nSegs, sglist);
@@ -1806,36 +1765,19 @@ VAYUIPUCORE1PROC_map(
              * is required. Add the entry only if the range does not exist
              * in the translation table.
              */
-
-            /* check in static entries first */
-            for (j = 0; j < AddrTable_STATIC_COUNT; j++) {
+            for (j = 0;
+                j < AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; j++) {
                 ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][j];
-                startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
-                endAddr = startAddr + ai->size;
 
-                if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)) {
-                    found = TRUE;
-                    /* refCount does not need to be incremented for static entries */
-                    break;
-                }
-            }
+                if (ai->isMapped == TRUE) {
+                    startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
+                    endAddr = startAddr + ai->size;
 
-            /* if not found in static entries, check in dynamic entries */
-            if (!found) {
-                for (j = AddrTable_STATIC_COUNT;
-                    j < AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; j++) {
-                    ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][j];
-
-                    if (ai->isMapped == TRUE) {
-                        startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
-                        endAddr = startAddr + ai->size;
-
-                        if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)
-                            && ((*dstAddr + sglist[i].size) <= endAddr)) {
-                            found = TRUE;
-                            ai->refCount++;
-                            break;
-                        }
+                    if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)
+                        && ((*dstAddr + sglist[i].size) <= endAddr)) {
+                        found = TRUE;
+                        ai->refCount++;
+                        break;
                     }
                 }
             }
@@ -1857,6 +1799,7 @@ VAYUIPUCORE1PROC_map(
                     ai->size = sglist[i].size;
                     ai->isCached = sglist[i].isCached;
                     ai->refCount++;
+                    ai->isMapped = TRUE;
 
                     AddrTable_count[PROCID_TO_IPU(procHandle->procId)]++;
                 }
@@ -1867,40 +1810,6 @@ VAYUIPUCORE1PROC_map(
                         "AddrTable_SIZE reached!");
                 }
             }
-
-            /* if new entry, map into dsp mmu */
-            if ((ai != NULL) && (ai->refCount == 1) && (status >= 0)) {
-                ai->isMapped = TRUE;
-
-                /* add entry to L2 MMU */
-                addEntryArgs.masterPhyAddr = sglist [i].paddr;
-                addEntryArgs.size          = sglist [i].size;
-                addEntryArgs.slaveVirtAddr = (UInt32)*dstAddr;
-                /* TBD: elementSize, endianism, mixedSized are
-                 * hard coded now, must be configurable later
-                 */
-                addEntryArgs.elementSize   = ELEM_SIZE_16BIT;
-                addEntryArgs.endianism     = LITTLE_ENDIAN;
-                addEntryArgs.mixedSize     = MMU_TLBES;
-
-                status = VAYUIPU_halMmuCtrl(object->halObject,
-                    Processor_MmuCtrlCmd_AddEntry, &addEntryArgs);
-
-#if !defined(SYSLINK_BUILD_OPTIMIZE)
-                if (status < 0) {
-                    GT_setFailureReason(curTrace, GT_4CLASS,
-                        "VAYUIPUCORE1PROC_map", status,
-                        "Processor_MmuCtrlCmd_AddEntry failed");
-                }
-#endif
-            }
-#if !defined(SYSLINK_BUILD_OPTIMIZE)
-            if (status < 0) {
-                GT_setFailureReason(curTrace, GT_4CLASS,
-                    "VAYUIPUCORE1PROC_map", status,
-                    "IPUCORE1 MMU configuration failed");
-            }
-#endif
         }
 #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
     }
@@ -1967,10 +1876,10 @@ VAYUIPUCORE1PROC_unmap(
         object = (VAYUIPUCORE1PROC_Object *) procHandle->object;
         GT_assert (curTrace, (object != NULL));
 
-        /* Delete dynamically added non-default entries from translation
+        /* Delete entries from translation
          * table only in last unmap called on that entry
          */
-        for (i = AddrTable_STATIC_COUNT;
+        for (i = 0;
             i < AddrTable_count[PROCID_TO_IPU(procHandle->procId)]; i++) {
             ai = &AddrTable[PROCID_TO_IPU(procHandle->procId)][i];
 
index 1c2cb7d411628ceb9233bb27a2f0d7f3d73130f2..a8aaf884bea466ced0fca26f143b77f97b5bad7c 100644 (file)
@@ -93,12 +93,6 @@ extern "C" {
 #define IS_RANGE_VALID(x,min,max) (((x) < (max)) && ((x) >= (min)))
 
 
-/*!
- *  @brief  Number of static entries in address translation table.
- */
-#define AddrTable_IPU_STATIC_COUNT 1
-#define AddrTable_DSP_STATIC_COUNT 0
-
 /*!
  *  @brief  max entries in translation table.
  */
@@ -149,32 +143,15 @@ typedef struct OMAP5430TESLAPROC_module_object_tag {
 }OMAP5430TESLAPROC_ModuleObject;
 
 
-/* Default memory regions */
-static UInt32 AddrTable_IPU_count = AddrTable_IPU_STATIC_COUNT;
-static UInt32 AddrTable_DSP_count = AddrTable_DSP_STATIC_COUNT;
+/* Number of  memory regions */
+static UInt32 AddrTable_IPU_count = 0;
+static UInt32 AddrTable_DSP_count = 0;
 
-/* Default memory regions */
-static ProcMgr_AddrInfo OMAP5430BENELLIPROC_defaultMemRegions [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 */
-        },
-};
+/* Address translation table for IPU */
+static ProcMgr_AddrInfo OMAP5430BENELLIPROC_addrTable[AddrTable_SIZE];
 
-/* Default memory regions for DSP */
-static ProcMgr_AddrInfo OMAP5430TESLAPROC_defaultMemRegions [AddrTable_SIZE] =
-{
-};
+/* Address translation table for DSP */
+static ProcMgr_AddrInfo OMAP5430TESLAPROC_addrTable[AddrTable_SIZE];
 
 /* =============================================================================
  *  Globals
@@ -191,7 +168,7 @@ static
 OMAP5430BENELLIPROC_ModuleObject OMAP5430IPU0PROC_state =
 {
     .config_size = sizeof (OMAP5430BENELLIPROC_Config),
-    .defInstParams.numMemEntries = AddrTable_IPU_STATIC_COUNT,
+    .defInstParams.numMemEntries = 0,
     .isSetup = FALSE,
     .procHandle = NULL,
     .gateHandle = NULL
@@ -204,7 +181,7 @@ static
 OMAP5430BENELLIPROC_ModuleObject OMAP5430IPU1PROC_state =
 {
     .config_size = sizeof (OMAP5430BENELLIPROC_Config),
-    .defInstParams.numMemEntries = AddrTable_IPU_STATIC_COUNT,
+    .defInstParams.numMemEntries = 0,
     .isSetup = FALSE,
     .procHandle = NULL,
     .gateHandle = NULL
@@ -217,7 +194,7 @@ static
 OMAP5430TESLAPROC_ModuleObject OMAP5430DSPPROC_state =
 {
     .config_size = sizeof (OMAP5430TESLAPROC_Config),
-    .defInstParams.numMemEntries = AddrTable_DSP_STATIC_COUNT,
+    .defInstParams.numMemEntries = 0,
     .isSetup = FALSE,
     .procHandle = NULL,
     .gateHandle = NULL
@@ -479,17 +456,17 @@ OMAP5430BENELLIPROC_Params_init (OMAP5430BENELLIPROC_Handle  handle,
     switch(ProcType)
     {
         case PROCTYPE_IPU0:
-            pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
+            pMemRegn = OMAP5430BENELLIPROC_addrTable;
             numMemEntries = AddrTable_IPU_count;
             break;
 #ifndef SYSLINK_SYSBIOS_SMP
         case PROCTYPE_IPU1:
-            pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
+            pMemRegn = OMAP5430BENELLIPROC_addrTable;
             numMemEntries = AddrTable_IPU_count;
             break;
 #endif
         case PROCTYPE_DSP:
-            pMemRegn = OMAP5430TESLAPROC_defaultMemRegions;
+            pMemRegn = OMAP5430TESLAPROC_addrTable;
             numMemEntries = AddrTable_DSP_count;
             break;
     }
@@ -1043,19 +1020,19 @@ OMAP5430BENELLIPROC_attach (Processor_Handle        handle,
     {
         case PROCTYPE_IPU0:
             pState = &OMAP5430IPU0PROC_state;
-            pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
+            pMemRegn = OMAP5430BENELLIPROC_addrTable;
             AddrTable_count = &AddrTable_IPU_count;
             break;
 #ifndef SYSLINK_SYSBIOS_SMP
         case PROCTYPE_IPU1:
             pState = &OMAP5430IPU1PROC_state;
-            pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
+            pMemRegn = OMAP5430BENELLIPROC_addrTable;
             AddrTable_count = &AddrTable_IPU_count;
             break;
 #endif
         case PROCTYPE_DSP:
             pState = (OMAP5430BENELLIPROC_ModuleObject *)&OMAP5430DSPPROC_state;
-            pMemRegn = OMAP5430TESLAPROC_defaultMemRegions;
+            pMemRegn = OMAP5430TESLAPROC_addrTable;
             AddrTable_count = &AddrTable_DSP_count;
             break;
     }
@@ -1293,7 +1270,6 @@ OMAP5430BENELLIPROC_detach (Processor_Handle handle)
     Int i                              = 0;
     ProcMgr_AddrInfo *    ai;
     ProcMgr_AddrInfo *          pMemRegn        = NULL;
-    UInt32                    staticCount = 0;
     UInt32 *                  AddrTable_count = NULL;
 
     GT_1trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_detach", handle);
@@ -1303,20 +1279,17 @@ OMAP5430BENELLIPROC_detach (Processor_Handle handle)
     switch(procHandle->procId)
     {
         case PROCTYPE_IPU0:
-            pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
-            staticCount = AddrTable_IPU_STATIC_COUNT;
+            pMemRegn = OMAP5430BENELLIPROC_addrTable;
             AddrTable_count = &AddrTable_IPU_count;
             break;
 #ifndef SYSLINK_SYSBIOS_SMP
         case PROCTYPE_IPU1:
-            pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
-            staticCount = AddrTable_IPU_STATIC_COUNT;
+            pMemRegn = OMAP5430BENELLIPROC_addrTable;
             AddrTable_count = &AddrTable_IPU_count;
             break;
 #endif
         case PROCTYPE_DSP:
-            pMemRegn = OMAP5430TESLAPROC_defaultMemRegions;
-            staticCount = AddrTable_DSP_STATIC_COUNT;
+            pMemRegn = OMAP5430TESLAPROC_addrTable;
             AddrTable_count = &AddrTable_DSP_count;
             break;
     }
@@ -1390,7 +1363,7 @@ OMAP5430BENELLIPROC_detach (Processor_Handle handle)
             }
 
             /* delete all dynamically added entries */
-            for (i = staticCount; i < *AddrTable_count; i++) {
+            for (i = 0; i < *AddrTable_count; i++) {
                 ai = &pMemRegn[i];
                 ai->addr[ProcMgr_AddrType_MasterKnlVirt] = -1u;
                 ai->addr[ProcMgr_AddrType_MasterUsrVirt] = -1u;
@@ -1403,8 +1376,8 @@ OMAP5430BENELLIPROC_detach (Processor_Handle handle)
                 ai->isMapped = FALSE;
                 ai->refCount = 0u;
             }
-            object->params.numMemEntries = staticCount;
-            *AddrTable_count = staticCount;
+            object->params.numMemEntries = 0;
+            *AddrTable_count = 0;
 
             //No need to reset.. that will be done in STOP
            /* tmpStatus = OMAP5430BENELLI_halResetCtrl (object->halObject,
@@ -2053,8 +2026,24 @@ OMAP5430BENELLIPROC_translate (Processor_Handle handle,
         object = (OMAP5430BENELLIPROC_Object *) procHandle->object;
         GT_assert (curTrace, (object != NULL));
 
-        pMemRegn = object->params.memEntries;
-        nRegions = object->params.numMemEntries;
+        switch(procHandle->procId)
+        {
+            case PROCTYPE_IPU0:
+                pMemRegn = OMAP5430BENELLIPROC_addrTable;
+                nRegions = AddrTable_IPU_count;
+                break;
+#ifndef SYSLINK_SYSBIOS_SMP
+            case PROCTYPE_IPU1:
+                pMemRegn = OMAP5430BENELLIPROC_addrTable;
+                nRegions = AddrTable_IPU_count;
+                break;
+#endif
+            case PROCTYPE_DSP:
+                pMemRegn = OMAP5430TESLAPROC_addrTable;
+                nRegions = AddrTable_DSP_count;
+                break;
+        }
+
 
         *dstAddr = -1u;
         for (i = 0;i < nRegions;i++)
@@ -2112,8 +2101,13 @@ OMAP5430BENELLIPROC_map (Processor_Handle handle,
     Int                          status       = PROCESSOR_SUCCESS ;
     Processor_Object *           procHandle   = (Processor_Object *) handle;
     OMAP5430BENELLIPROC_Object * object       = NULL;
-    UInt32                       i;
-    OMAP5430BENELLI_HalMmuCtrlArgs_AddEntry addEntryArgs;
+    UInt32                       i, j;
+    UInt32                      startAddr;
+    UInt32                      endAddr;
+    Bool                        found         = FALSE;
+    ProcMgr_AddrInfo *          pMemRegn      = NULL;
+    UInt32 *                    pNumRegions   = NULL;
+    ProcMgr_AddrInfo *          ai            = NULL;
 
     GT_4trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_map",
                handle, dstAddr, nSegs, sglist);
@@ -2154,36 +2148,78 @@ OMAP5430BENELLIPROC_map (Processor_Handle handle,
 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
         object = (OMAP5430BENELLIPROC_Object *) procHandle->object;
         GT_assert (curTrace, (object != NULL));
+
+        switch(procHandle->procId)
+        {
+            case PROCTYPE_IPU0:
+                pMemRegn = OMAP5430BENELLIPROC_addrTable;
+                pNumRegions = &AddrTable_IPU_count;
+                break;
+#ifndef SYSLINK_SYSBIOS_SMP
+            case PROCTYPE_IPU1:
+                pMemRegn = OMAP5430BENELLIPROC_addrTable;
+                pNumRegions = &ddrTable_IPU_count;
+                break;
+#endif
+            case PROCTYPE_DSP:
+                pMemRegn = OMAP5430TESLAPROC_addrTable;
+                pNumRegions = &AddrTable_DSP_count;
+                break;
+        }
+
         /* Program the mmu with the sglist */
         /* Program the DSP MMU also */
         for (i = 0; (i < nSegs) && (status >= 0); i++)
         {
-            addEntryArgs.masterPhyAddr = sglist [i].paddr;
-            addEntryArgs.size          = sglist [i].size;
-            addEntryArgs.slaveVirtAddr = (UInt32)*dstAddr;
-            /*TBD : elementSize, endianism, mixedSized are hard coded now,
-             *      must be configurable later*/
-            addEntryArgs.elementSize   = ELEM_SIZE_16BIT;
-            addEntryArgs.endianism     = LITTLE_ENDIAN;
-            addEntryArgs.mixedSize     = MMU_TLBES;
-            addEntryArgs.slaveVirtAddr = get_BenelliVirtAdd(object->halObject,
-                                                    addEntryArgs.masterPhyAddr);
-            *(dstAddr) = addEntryArgs.slaveVirtAddr;
-            if(addEntryArgs.slaveVirtAddr == 0) {
-                status = OMAP5430BENELLI_halMmuCtrl (object->halObject,
-                                                  Processor_MmuCtrlCmd_AddEntry,
-                                                  &addEntryArgs);
-
+            /* Update the translation table with entries for which mapping
+             * is required. Add the entry only if the range does not exist
+             * in the translation table.
+             */
+            for (j = 0;
+                j < *pNumRegions; j++) {
+                ai = &pMemRegn[j];
+
+                if (ai->isMapped == TRUE) {
+                    startAddr = ai->addr[ProcMgr_AddrType_SlaveVirt];
+                    endAddr = startAddr + ai->size;
+
+                    if ((startAddr <= *dstAddr) && (*dstAddr < endAddr)
+                        && ((*dstAddr + sglist[i].size) <= endAddr)) {
+                        found = TRUE;
+                        ai->refCount++;
+                        break;
+                    }
+                }
             }
-#if !defined(SYSLINK_BUILD_OPTIMIZE)
-            if (status < 0) {
-                GT_setFailureReason (curTrace,
-                                 GT_4CLASS,
-                                 "OMAP5430BENELLIPROC_map",
-                                 status,
-                                 "DSP MMU configuration failed");
+
+            /* If not found, add new entry to table. If mmu is disabled,
+             * the assumption is that the ammu will be used.
+             */
+            if (!found) {
+                if (*pNumRegions != AddrTable_SIZE) {
+                    ai = &pMemRegn[*pNumRegions];
+                    ai->addr[ProcMgr_AddrType_MasterKnlVirt] = -1u;
+                    ai->addr[ProcMgr_AddrType_MasterUsrVirt] = -1u;
+                    ai->addr[ProcMgr_AddrType_MasterPhys] = sglist[i].paddr;
+                    ai->addr[ProcMgr_AddrType_SlaveVirt] = *dstAddr;
+                    ai->addr[ProcMgr_AddrType_SlavePhys] = -1u;
+                    ai->size = sglist[i].size;
+                    ai->isCached = sglist[i].isCached;
+                    ai->refCount++;
+                    ai->isMapped = TRUE;
+
+                    (*pNumRegions)++;
+                }
+                else {
+                    status = PROCESSOR_E_FAIL;
+                    GT_setFailureReason(curTrace, GT_4CLASS,
+                        "OMAP5430BENELLIPROC_map", status,
+                        "AddrTable_SIZE reached!");
+                }
             }
-#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+
+            *(dstAddr) = get_BenelliVirtAdd(object->halObject,
+                sglist[i].paddr);
         }
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
     }
index d805116b546a1860f8b04353a81435434f2a347c..ba812c2867495ac564d7f2d2ace9cb1bdf9d8263 100644 (file)
@@ -444,6 +444,32 @@ RscTable_process (UInt16 procId, Bool tryAlloc, UInt32 * numBlocks)
                 printf ("RscTable_process: carveout [%s] @ da [0x%08x] pa [0x%08x] len [0x%x]\n", cout->name, cout->da, cout->pa, cout->len);
                 break;
             }
+            case TYPE_INTMEM :
+            {
+                struct fw_rsc_carveout * cout = (struct fw_rsc_carveout *)entry;
+
+                if (obj->numMemEntries == SYSLINK_MAX_MEMENTRIES) {
+                    ret = -1;
+                }
+                else {
+                    obj->memEntries[obj->numMemEntries].slaveVirtAddr =
+                            cout->da;
+                    obj->memEntries[obj->numMemEntries].masterPhysAddr =
+                            cout->pa;
+                    obj->memEntries[obj->numMemEntries].size = cout->len;
+                    /* do not map to slave MMU */
+                    obj->memEntries[obj->numMemEntries].map = FALSE;
+                    obj->memEntries[obj->numMemEntries].mapMask =
+                        ProcMgr_SLAVEVIRT;
+                    obj->memEntries[obj->numMemEntries].isCached = FALSE;
+                    obj->memEntries[obj->numMemEntries].isValid = TRUE;
+                    obj->numMemEntries++;
+                }
+                printf ("RscTable_process: intmem [%s] @ da [0x%08x]"
+                    " pa [0x%08x] len [0x%x]\n", cout->name, cout->da,
+                    cout->pa, cout->len);
+                break;
+            }
             case TYPE_DEVMEM :
             {
                 // only care about mem in DDR for now
@@ -597,9 +623,6 @@ RscTable_process (UInt16 procId, Bool tryAlloc, UInt32 * numBlocks)
                 }
                 break;
             }
-            case TYPE_CRASHDUMP :
-                // what to do with this?
-                break;
             default :
                 break;
         }
index b8b9e2e7be93707feb148b130aeb30d284a131bc..1e32a27e9554f024e51920aa4e5e19e638498db9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * Copyright (c) 2011-2014, Texas Instruments Incorporated
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -72,7 +72,7 @@
 #define TYPE_DEVMEM      1
 #define TYPE_TRACE       2
 #define TYPE_VDEV        3
-#define TYPE_CRASHDUMP   4
+#define TYPE_INTMEM      4
 
 /* Common Resource Structure Types */
 struct fw_rsc_carveout {