Release the OMAP5 DSP MMU from reset after loading the core
[ipc/ipcdev.git] / qnx / src / ipc3x_dev / ti / syslink / family / omap5430 / ipu / omap5430BenelliProc.c
1 /*
2  *  @file   omap5430BenelliProc.c
3  *
4  * @brief       Processor implementation for OMAP5430BENELLI.
5  *
6  *              This module is responsible for taking care of device-specific
7  *              operations for the processor. This module can be used
8  *              stand-alone or as part of ProcMgr.
9  *              The implementation is specific to OMAP5430BENELLI.
10  *
11  *
12  *  @ver        02.00.00.44_pre-alpha3
13  *
14  *  ============================================================================
15  *
16  *  Copyright (c) 2010-2013, Texas Instruments Incorporated
17  *
18  *  Redistribution and use in source and binary forms, with or without
19  *  modification, are permitted provided that the following conditions
20  *  are met:
21  *
22  *  *  Redistributions of source code must retain the above copyright
23  *     notice, this list of conditions and the following disclaimer.
24  *
25  *  *  Redistributions in binary form must reproduce the above copyright
26  *     notice, this list of conditions and the following disclaimer in the
27  *     documentation and/or other materials provided with the distribution.
28  *
29  *  *  Neither the name of Texas Instruments Incorporated nor the names of
30  *     its contributors may be used to endorse or promote products derived
31  *     from this software without specific prior written permission.
32  *
33  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
34  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
35  *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
36  *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
37  *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
38  *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
39  *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
40  *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
41  *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
42  *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
43  *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44  *  Contact information for paper mail:
45  *  Texas Instruments
46  *  Post Office Box 655303
47  *  Dallas, Texas 75265
48  *  Contact information:
49  *  http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
50  *  DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
51  *  ============================================================================
52  *
53  */
56 /* Standard headers */
57 #include <ti/syslink/Std.h>
59 /* OSAL & Utils headers */
60 #include <ti/syslink/utils/IGateProvider.h>
61 #include <ti/syslink/utils/GateMutex.h>
62 #include <ti/syslink/utils/Trace.h>
63 #include <ti/syslink/utils/Cfg.h>
65 /* Module level headers */
66 #include <ProcDefs.h>
67 #include <Processor.h>
68 #include <OMAP5430BenelliHal.h>
69 #include <OMAP5430BenelliHalReset.h>
70 #include <OMAP5430BenelliHalMmu.h>
71 #include <OMAP5430BenelliProc.h>
72 #include <OMAP5430BenelliEnabler.h>
73 #include <_MultiProc.h>
74 #include <hw/inout.h>
75 #include <RscTable.h>
77 #if defined (__cplusplus)
78 extern "C" {
79 #endif
81 #define INREG32(x) in32(x)
82 #define OUTREG32(x, y) out32(x, y)
85 /* =============================================================================
86  *  Macros and types
87  * =============================================================================
88  */
90 /*!
91  *  @brief  Checks if a value lies in given range.
92  */
93 #define IS_RANGE_VALID(x,min,max) (((x) < (max)) && ((x) >= (min)))
96 /*!
97  *  @brief  Number of static entries in address translation table.
98  */
99 #define AddrTable_IPU_STATIC_COUNT 1
100 #define AddrTable_DSP_STATIC_COUNT 0
102 /*!
103  *  @brief  max entries in translation table.
104  */
105 #define AddrTable_SIZE 32
107 /* number of carveouts */
108 #define NumCarveouts 1
110 /* config param for core0 mmu */
111 #ifndef SYSLINK_SYSBIOS_SMP
112 #define PARAMS_mmuEnable "ProcMgr.proc[CORE0].mmuEnable="
113 #define PARAMS_carveoutAddr0 "ProcMgr.proc[CORE0].carveoutAddr0="
114 #define PARAMS_carveoutSize0 "ProcMgr.proc[CORE0].carveoutSize0="
115 #define PARAMS_carveoutAddr1 "ProcMgr.proc[CORE0].carveoutAddr1="
116 #define PARAMS_carveoutSize1 "ProcMgr.proc[CORE0].carveoutSize1="
117 #else
118 #define PARAMS_mmuEnable "ProcMgr.proc[IPU].mmuEnable="
119 #define PARAMS_carveoutAddr0 "ProcMgr.proc[IPU].carveoutAddr0="
120 #define PARAMS_carveoutSize0 "ProcMgr.proc[IPU].carveoutSize0="
121 #define PARAMS_carveoutAddr1 "ProcMgr.proc[IPU].carveoutAddr1="
122 #define PARAMS_carveoutSize1 "ProcMgr.proc[IPU].carveoutSize1="
123 #endif
124 #define PARAMS_mmuEnableDSP "ProcMgr.proc[DSP].mmuEnable="
125 #define PARAMS_carveoutAddr0DSP "ProcMgr.proc[DSP].carveoutAddr0="
126 #define PARAMS_carveoutSize0DSP "ProcMgr.proc[DSP].carveoutSize0="
127 #define PARAMS_carveoutAddr1DSP "ProcMgr.proc[DSP].carveoutAddr1="
128 #define PARAMS_carveoutSize1DSP "ProcMgr.proc[DSP].carveoutSize1="
131 /*!
132  *  @brief  OMAP5430BENELLIPROC Module state object
133  */
136 /*OMAP5430 Module state object */
137 typedef struct OMAP5430BENELLIPROC_module_object_tag {
138     UINT32 config_size;
139     /* Size of configuration structure */
140     struct OMAP5430BENELLIPROC_Config cfg;
141     /* OMAP5430 configuration structure */
142     struct OMAP5430BENELLIPROC_Config defCfg;
143     /* Default module configuration */
144     OMAP5430BENELLIPROC_Params      defInstParams;
145     /*!< Default parameters for the OMAP5430BENELLIPROC instances */
146     Bool                    isSetup;
147     /* Flag to indicate if module is setup */
148     OMAP5430BENELLIPROC_Handle procHandle;
149     /* Processor handle array. */
150     IGateProvider_Handle gateHandle;
151     /* void * of gate to be used for local thread safety */
152 }OMAP5430BENELLIPROC_ModuleObject;
154 typedef struct OMAP5430TESLAPROC_module_object_tag {
155     UINT32 config_size;
156     /* Size of configuration structure */
157     struct OMAP5430TESLAPROC_Config cfg;
158     /* OMAP5430 configuration structure */
159     struct OMAP5430TESLAPROC_Config defCfg;
160     /* Default module configuration */
161     OMAP5430BENELLIPROC_Params      defInstParams;
162     /*!< Default parameters for the OMAP5430TESLAPROC instances */
163     Bool                    isSetup;
164     /* Default parameters for the OMAP5430 instances */
165     OMAP5430BENELLIPROC_Handle procHandle;
166     /* Processor handle array. */
167     IGateProvider_Handle gateHandle;
168     /* void * of gate to be used for local thread safety */
169 }OMAP5430TESLAPROC_ModuleObject;
172 /* Default memory regions */
173 static UInt32 AddrTable_IPU_count = AddrTable_IPU_STATIC_COUNT;
174 static UInt32 AddrTable_DSP_count = AddrTable_DSP_STATIC_COUNT;
176 /* Default memory regions */
177 static ProcMgr_AddrInfo OMAP5430BENELLIPROC_defaultMemRegions [AddrTable_SIZE] =
179         /* L2 RAM */
180         {
181             .addr[ProcMgr_AddrType_MasterKnlVirt] = -1u,
182             .addr[ProcMgr_AddrType_MasterUsrVirt] = -1u,
183             .addr[ProcMgr_AddrType_MasterPhys] = 0x55020000u,
184             .addr[ProcMgr_AddrType_SlaveVirt] = 0x20000000u,
185             .addr[ProcMgr_AddrType_SlavePhys] = -1u,
186             .size = 0x10000u,
187             .isCached = FALSE,
188             .mapMask = ProcMgr_SLAVEVIRT,
189             .isMapped = TRUE,
190             .refCount = 0u      /* refCount set to 0 for static entry */
191         },
192 };
194 /* Default memory regions for DSP */
195 static ProcMgr_AddrInfo OMAP5430TESLAPROC_defaultMemRegions [AddrTable_SIZE] =
197 };
199 /* =============================================================================
200  *  Globals
201  * =============================================================================
202  */
203 /*!
204  *  @var    OMAP5430BENELLIPROC_state
205  *
206  *  @brief  OMAP5430BENELLIPROC state object variable
207  */
208 #if !defined(SYSLINK_BUILD_DEBUG)
209 static
210 #endif /* if !defined(SYSLINK_BUILD_DEBUG) */
211 OMAP5430BENELLIPROC_ModuleObject OMAP5430IPU0PROC_state =
213     .config_size = sizeof (OMAP5430BENELLIPROC_Config),
214     .defInstParams.numMemEntries = AddrTable_IPU_STATIC_COUNT,
215     .isSetup = FALSE,
216     .procHandle = NULL,
217     .gateHandle = NULL
218 };
220 #ifndef SYSLINK_SYSBIOS_SMP
221 #if !defined(SYSLINK_BUILD_DEBUG)
222 static
223 #endif /* if !defined(SYSLINK_BUILD_DEBUG) */
224 OMAP5430BENELLIPROC_ModuleObject OMAP5430IPU1PROC_state =
226     .config_size = sizeof (OMAP5430BENELLIPROC_Config),
227     .defInstParams.numMemEntries = AddrTable_IPU_STATIC_COUNT,
228     .isSetup = FALSE,
229     .procHandle = NULL,
230     .gateHandle = NULL
231 };
232 #endif
234 #if !defined(SYSLINK_BUILD_DEBUG)
235 static
236 #endif /* if !defined(SYSLINK_BUILD_DEBUG) */
237 OMAP5430TESLAPROC_ModuleObject OMAP5430DSPPROC_state =
239     .config_size = sizeof (OMAP5430TESLAPROC_Config),
240     .defInstParams.numMemEntries = AddrTable_DSP_STATIC_COUNT,
241     .isSetup = FALSE,
242     .procHandle = NULL,
243     .gateHandle = NULL
244 };
246 /* config override specified in SysLinkCfg.c, defined in ProcMgr.c */
247 extern String ProcMgr_sysLinkCfgParams;
250 /* =============================================================================
251  * APIs directly called by applications
252  * =============================================================================
253  */
254 /*!
255  *  @brief      Function to get the default configuration for the
256  *              OMAP5430BENELLIPROC module.
257  *
258  *              This function can be called by the application to get their
259  *              configuration parameter to OMAP5430BENELLIPROC_setup filled in by
260  *              the OMAP5430BENELLIPROC module with the default parameters. If
261  *              the user does not wish to make any change in the default
262  *              parameters, this API is not required to be called.
263  *
264  *  @param      cfg        Pointer to the OMAP5430BENELLIPROC module
265  *                         configuration structure in which the default config
266  *                         is to be returned.
267  *
268  *  @sa         OMAP5430BENELLIPROC_setup
269  */
270 Void
271 OMAP5430BENELLIPROC_get_config (OMAP5430BENELLIPROC_Config * cfg, Int ProcType)
273     GT_1trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_get_config", cfg);
275     GT_assert (curTrace, (cfg != NULL));
277 #if !defined(SYSLINK_BUILD_OPTIMIZE)
278     if (cfg == NULL) {
279         GT_setFailureReason (curTrace,
280                              GT_4CLASS,
281                              "OMAP5430BENELLIPROC_get_config",
282                              PROCESSOR_E_INVALIDARG,
283                              "Argument of type (OMAP5430BENELLIPROC_Config *) "
284                              "passed is null!");
285     }
286     else {
287 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
288         switch (ProcType)
289         {
290             case PROCTYPE_IPU0:
291                 Memory_copy (cfg,
292                              &(OMAP5430IPU0PROC_state.defCfg),
293                              sizeof (OMAP5430BENELLIPROC_Config));
294                 break;
295 #ifndef SYSLINK_SYSBIOS_SMP
296             case PROCTYPE_IPU1:
297                 Memory_copy (cfg,
298                              &(OMAP5430IPU1PROC_state.defCfg),
299                              sizeof (OMAP5430BENELLIPROC_Config));
300             break;
301 #endif
302             case PROCTYPE_DSP:
303                 Memory_copy (cfg,
304                              &(OMAP5430DSPPROC_state.defCfg),
305                              sizeof (OMAP5430TESLAPROC_Config));
306             break;
307         }
308 #if !defined(SYSLINK_BUILD_OPTIMIZE)
309     }
310 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
312     GT_0trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_get_config");
316 /*!
317  *  @brief      Function to setup the OMAP5430BENELLIPROC module.
318  *
319  *              This function sets up the OMAP5430BENELLIPROC module. This
320  *              function must be called before any other instance-level APIs
321  *              can be invoked.
322  *              Module-level configuration needs to be provided to this
323  *              function. If the user wishes to change some specific config
324  *              parameters, then OMAP5430BENELLIPROC_getConfig can be called to
325  *              get the configuration filled with the default values. After
326  *              this, only the required configuration values can be changed. If
327  *              the user does not wish to make any change in the default
328  *              parameters, the application can simply call
329  *              OMAP5430BENELLIPROC_setup with NULL parameters. The default
330  *              parameters would get automatically used.
331  *
332  *  @param      cfg   Optional OMAP5430BENELLIPROC module configuration. If
333  *                    provided as NULL, default configuration is used.
334  *
335  *  @sa         OMAP5430BENELLIPROC_destroy
336  *              GateMutex_create
337  */
338 Int
339 OMAP5430BENELLIPROC_setup (OMAP5430BENELLIPROC_Config * cfg, Int ProcType)
341     Int                                 status  = PROCESSOR_SUCCESS;
342     OMAP5430BENELLIPROC_Config          tmpCfg;
343     OMAP5430BENELLIPROC_ModuleObject *  pState = NULL;
344     Error_Block                         eb;
346     GT_1trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_setup", cfg);
348     Error_init(&eb);
350     if (cfg == NULL) {
351         OMAP5430BENELLIPROC_get_config (&tmpCfg,ProcType );
352         cfg = &tmpCfg;
353     }
355     switch (ProcType)
356     {
357         case PROCTYPE_IPU0:
358             pState = &OMAP5430IPU0PROC_state;
359             break;
360 #ifndef SYSLINK_SYSBIOS_SMP
361         case PROCTYPE_IPU1:
362             pState = &OMAP5430IPU1PROC_state;
363             break;
364 #endif
365         case PROCTYPE_DSP:
366             pState = (OMAP5430BENELLIPROC_ModuleObject *)&OMAP5430DSPPROC_state;
367             break;
368     }
370     if (pState == NULL) {
371         GT_setFailureReason (curTrace,
372                              GT_4CLASS,
373                              "OMAP5430BENELLIPROC_setup",
374                              PROCESSOR_E_INVALIDARG,
375                              "Unsupported procType");
376         return PROCESSOR_E_INVALIDARG;
377     }
379     /* Create a default gate handle for local module protection. */
380     pState->gateHandle = (IGateProvider_Handle)
381                                GateMutex_create ((GateMutex_Params *)NULL, &eb);
382 #if !defined(SYSLINK_BUILD_OPTIMIZE)
383     if (pState->gateHandle == NULL) {
384         /*! @retval PROCESSOR_E_FAIL Failed to create GateMutex! */
385         status = PROCESSOR_E_FAIL;
386         GT_setFailureReason (curTrace,
387                              GT_4CLASS,
388                              "OMAP5430BENELLIPROC_setup",
389                              status,
390                              "Failed to create GateMutex!");
391     }
392     else {
393 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
394         /* Copy the user provided values into the state object. */
395         Memory_copy (&pState->cfg,
396                      cfg,
397                      sizeof (OMAP5430BENELLIPROC_Config));
399         /* Initialize the name to handles mapping array. */
400         pState->procHandle = NULL;
402         pState->isSetup = TRUE;
403 #if !defined(SYSLINK_BUILD_OPTIMIZE)
404     }
405 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
407     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_setup", status);
409     /*! @retval PROCESSOR_SUCCESS Operation successful */
410     return (status);
414 /*!
415  *  @brief      Function to destroy the OMAP5430BENELLIPROC module.
416  *
417  *              Once this function is called, other OMAP5430BENELLIPROC module
418  *              APIs, except for the OMAP5430BENELLIPROC_getConfig API cannot be
419  *              called anymore.
420  *
421  *  @sa         OMAP5430BENELLIPROC_setup
422  *              GateMutex_delete
423  */
424 Int
425 OMAP5430BENELLIPROC_destroy (Int ProcType)
427     Int                                 status  = PROCESSOR_SUCCESS;
428     OMAP5430BENELLIPROC_ModuleObject *  pState = NULL;
430     GT_0trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_destroy");
432     switch(ProcType)
433     {
434         case PROCTYPE_IPU0:
435             pState = &OMAP5430IPU0PROC_state;
436             break;
437 #ifndef SYSLINK_SYSBIOS_SMP
438         case PROCTYPE_IPU1:
439             pState = &OMAP5430IPU1PROC_state;
440             break;
441 #endif
442         case PROCTYPE_DSP:
443             pState = (OMAP5430BENELLIPROC_ModuleObject *)&OMAP5430DSPPROC_state;
444             break;
445     }
447     if (pState == NULL) {
448         GT_setFailureReason (curTrace,
449                              GT_4CLASS,
450                              "OMAP5430BENELLIPROC_setup",
451                              PROCESSOR_E_INVALIDARG,
452                              "Unsupported procType");
453         return PROCESSOR_E_INVALIDARG;
454     }
456     /* Check if any OMAP5430BENELLIPROC instances have not been deleted so far.
457      * If not, delete them.
458      */
459     if (pState->procHandle != NULL) {
460         OMAP5430BENELLIPROC_delete(&pState->procHandle);
461     }
463     if (pState->gateHandle != NULL) {
464         GateMutex_delete ((GateMutex_Handle *)
465                                 &(pState->gateHandle));
466     }
468     pState->isSetup = FALSE;
470     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_destroy", status);
472     /*! @retval PROCESSOR_SUCCESS Operation successful */
473     return (status);
477 /*!
478  *  @brief      Function to initialize the parameters for this Processor
479  *              instance.
480  *
481  *  @param      params  Configuration parameters to be returned
482  *
483  *  @sa         OMAP5430BENELLIPROC_create
484  */
485 Void
486 OMAP5430BENELLIPROC_Params_init (OMAP5430BENELLIPROC_Handle  handle,
487                                 OMAP5430BENELLIPROC_Params * params,
488                                 Int ProcType)
490     OMAP5430BENELLIPROC_Object * procObject =
491                                           (OMAP5430BENELLIPROC_Object *) handle;
492     UInt32                      numMemEntries   = 0;
493     ProcMgr_AddrInfo *          pMemRegn        = NULL;
495     GT_2trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_Params_init",
496                handle, params);
498     GT_assert (curTrace, (params != NULL));
499     switch(ProcType)
500     {
501         case PROCTYPE_IPU0:
502             pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
503             numMemEntries = AddrTable_IPU_count;
504             break;
505 #ifndef SYSLINK_SYSBIOS_SMP
506         case PROCTYPE_IPU1:
507             pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
508             numMemEntries = AddrTable_IPU_count;
509             break;
510 #endif
511         case PROCTYPE_DSP:
512             pMemRegn = OMAP5430TESLAPROC_defaultMemRegions;
513             numMemEntries = AddrTable_DSP_count;
514             break;
515     }
517 #if !defined(SYSLINK_BUILD_OPTIMIZE)
518     if (params == NULL) {
519         GT_setFailureReason (curTrace,
520                              GT_4CLASS,
521                              "OMAP5430BENELLIPROC_Params_init",
522                              PROCESSOR_E_INVALIDARG,
523                              "Argument of type (OMAP5430BENELLIPROC_Params *) "
524                              "passed is null!");
525     }
526     else {
527 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
528         if (handle == NULL) {
529             params->numMemEntries =  numMemEntries;
530             Memory_copy ((Ptr) params->memEntries,
531                          pMemRegn,
532                          (sizeof(ProcMgr_AddrInfo) * params->numMemEntries));
533         }
534         else {
535             /* Return updated OMAP5430BENELLIPROC instance specific parameters. */
536             Memory_copy (params,
537                          &(procObject->params),
538                          sizeof (OMAP5430BENELLIPROC_Params));
539         }
540 #if !defined(SYSLINK_BUILD_OPTIMIZE)
541     }
542 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
544     GT_0trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_Params_init");
547 /*!
548  *  @brief      Function to create an instance of this Processor.
549  *
550  *  @param      name    Name of the Processor instance.
551  *  @param      params  Configuration parameters.
552  *
553  *  @sa         OMAP5430BENELLIPROC_delete
554  */
556 OMAP5430BENELLIPROC_Handle
557 OMAP5430BENELLIPROC_create (UInt16 procId,
558                             const OMAP5430BENELLIPROC_Params * params)
560 #if !defined(SYSLINK_BUILD_OPTIMIZE)
561     Int                                 status    = PROCESSOR_SUCCESS;
562 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
563     Processor_Object *                  handle    = NULL;
564     OMAP5430BENELLIPROC_Object *        object    = NULL;
565     IArg                                key;
566     OMAP5430BENELLIPROC_ModuleObject *  pState    = NULL;
567     List_Params                         listParams;
569     switch(procId)
570     {
571         case PROCTYPE_IPU0:
572             pState = &OMAP5430IPU0PROC_state;
573             break;
574 #ifndef SYSLINK_SYSBIOS_SMP
575         case PROCTYPE_IPU1:
576             pState = &OMAP5430IPU1PROC_state;
577             break;
578 #endif
579         case PROCTYPE_DSP:
580             pState = (OMAP5430BENELLIPROC_ModuleObject *)&OMAP5430DSPPROC_state;
581             break;
582     }
584     GT_2trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_create", procId, params);
586     GT_assert (curTrace, IS_VALID_PROCID (procId));
587     GT_assert (curTrace, (params != NULL));
589 #if !defined(SYSLINK_BUILD_OPTIMIZE)
590     if (pState == NULL) {
591         /* Not setting status here since this function does not return status.*/
592         GT_setFailureReason (curTrace,
593                              GT_4CLASS,
594                              "OMAP5430BENELLIPROC_create",
595                              PROCESSOR_E_INVALIDARG,
596                              "Invalid procId specified");
597     }
598     else if (params == NULL) {
599         GT_setFailureReason (curTrace,
600                              GT_4CLASS,
601                              "OMAP5430BENELLIPROC_create",
602                              PROCESSOR_E_INVALIDARG,
603                              "params passed is NULL!");
604     }
605     else {
606 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
607         /* Enter critical section protection. */
608         key = IGateProvider_enter (pState->gateHandle);
609 #if !defined(SYSLINK_BUILD_OPTIMIZE)
610         /* Check if the Processor already exists for specified procId. */
611         if (pState->procHandle!= NULL) {
612             status = PROCESSOR_E_ALREADYEXIST;
613             GT_setFailureReason (curTrace,
614                               GT_4CLASS,
615                               "OMAP5430BENELLIPROC_create",
616                               status,
617                               "Processor already exists for specified procId!");
618         }
619         else {
620 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
621             /* Allocate memory for the handle */
622             handle = (Processor_Object *) Memory_calloc (NULL,
623                                                       sizeof (Processor_Object),
624                                                       0,
625                                                       NULL);
626 #if !defined(SYSLINK_BUILD_OPTIMIZE)
627             if (handle == NULL) {
628                 GT_setFailureReason (curTrace,
629                                      GT_4CLASS,
630                                      "OMAP5430BENELLIPROC_create",
631                                      PROCESSOR_E_MEMORY,
632                                      "Memory allocation failed for handle!");
633             }
634             else {
635 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
636                 /* Populate the handle fields */
637                 handle->procFxnTable.attach      = &OMAP5430BENELLIPROC_attach;
638                 handle->procFxnTable.detach      = &OMAP5430BENELLIPROC_detach;
639                 handle->procFxnTable.start       = &OMAP5430BENELLIPROC_start;
640                 handle->procFxnTable.stop        = &OMAP5430BENELLIPROC_stop;
641                 handle->procFxnTable.read        = &OMAP5430BENELLIPROC_read;
642                 handle->procFxnTable.write       = &OMAP5430BENELLIPROC_write;
643                 handle->procFxnTable.control     = &OMAP5430BENELLIPROC_control;
644                 handle->procFxnTable.map         = &OMAP5430BENELLIPROC_map;
645                 handle->procFxnTable.unmap       = &OMAP5430BENELLIPROC_unmap;
646                 handle->procFxnTable.translateAddr = &OMAP5430BENELLIPROC_translate;
647                 handle->procFxnTable.virtToPhys  = &OMAP5430BENELLI_virtToPhys;
648                 handle->procFxnTable.getProcInfo = &OMAP5430BENELLIPROC_procInfo;
649                 handle->state = ProcMgr_State_Unknown;
651                 /* Allocate memory for the OMAP5430BENELLIPROC handle */
652                 handle->object = Memory_calloc (NULL,
653                                              sizeof (OMAP5430BENELLIPROC_Object),
654                                              0,
655                                              NULL);
656 #if !defined(SYSLINK_BUILD_OPTIMIZE)
657                 if (handle->object == NULL) {
658                     status = PROCESSOR_E_MEMORY;
659                     GT_setFailureReason (curTrace,
660                                 GT_4CLASS,
661                                 "OMAP5430BENELLIPROC_create",
662                                 status,
663                                 "Memory allocation failed for handle->object!");
664                 }
665                 else {
666 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
667                     handle->procId = procId;
668                     object = (OMAP5430BENELLIPROC_Object *) handle->object;
669                     object->halObject = NULL;
670                     object->procHandle = (Processor_Handle)handle;
671                     /* Copy params into instance object. */
672                     Memory_copy (&(object->params),
673                                  (Ptr) params,
674                                  sizeof (OMAP5430BENELLIPROC_Params));
675                     object->params.procHandle = object->procHandle;
677                     /* Set the handle in the state object. */
678                     pState->procHandle = handle->object;
680                     /* Initialize the list of listeners */
681                     List_Params_init(&listParams);
682                     handle->registeredNotifiers = List_create(&listParams);
684 #if !defined(SYSLINK_BUILD_OPTIMIZE)
685                     if (handle->registeredNotifiers == NULL) {
686                         /*! @retval PROCESSOR_E_FAIL OsalIsr_create failed */
687                         status = PROCESSOR_E_FAIL;
688                         GT_setFailureReason (curTrace,
689                                              GT_4CLASS,
690                                              "OMAP5430BENELLIPROC_create",
691                                              status,
692                                              "List_create failed");
693                     }
694                     else {
695 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
697                         handle->notifiersLock =
698                                  OsalMutex_create(OsalMutex_Type_Interruptible);
700 #if !defined(SYSLINK_BUILD_OPTIMIZE)
701                         if (handle->notifiersLock == NULL) {
702                             /*! @retval PROCESSOR_E_FAIL OsalIsr_create failed*/
703                             status = PROCESSOR_E_FAIL;
704                             GT_setFailureReason (curTrace,
705                                                  GT_4CLASS,
706                                                  "OMAP5430BENELLIPROC_create",
707                                                  status,
708                                                  "OsalMutex_create failed");
709                         }
710                     }
711                 }
712             }
713         }
714 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
716         /* Leave critical section protection. */
717         IGateProvider_leave (pState->gateHandle, key);
718 #if !defined(SYSLINK_BUILD_OPTIMIZE)
719     }
720 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
722 #if !defined(SYSLINK_BUILD_OPTIMIZE)
723     if (status < 0) {
724         if (handle !=  NULL) {
725             if (handle->registeredNotifiers != NULL) {
726                 List_delete (&handle->registeredNotifiers);
727             }
728             if (handle->object != NULL) {
729                 Memory_free (NULL,
730                              handle->object,
731                              sizeof (OMAP5430BENELLIPROC_Object));
732             }
733             Memory_free (NULL, handle, sizeof (Processor_Object));
734         }
735         /*! @retval NULL Function failed */
736         handle = NULL;
737     }
738 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
740     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_create", handle);
742     /*! @retval Valid-Handle Operation successful */
743     return (void*) handle;
747 /*!
748  *  @brief      Function to delete an instance of this Processor.
749  *
750  *              The user provided pointer to the handle is reset after
751  *              successful completion of this function.
752  *
753  *  @param      handlePtr  Pointer to Handle to the Processor instance
754  *
755  *  @sa         OMAP5430BENELLIPROC_create
756  */
757 Int
758 OMAP5430BENELLIPROC_delete (OMAP5430BENELLIPROC_Handle * handlePtr)
760     Int                                 status  = PROCESSOR_SUCCESS;
761     OMAP5430BENELLIPROC_Object *        object  = NULL;
762     Processor_Object *                  handle  = NULL;
763     IArg                                key     = NULL;
764     OMAP5430BENELLIPROC_ModuleObject *  pState  = NULL;
765     List_Elem *                         elem    = NULL;
766     Processor_RegisterElem *            regElem = NULL;
769     GT_1trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_delete", handlePtr);
771     GT_assert (curTrace, (handlePtr != NULL));
772     GT_assert (curTrace, ((handlePtr != NULL) && (*handlePtr != NULL)));
774 #if !defined(SYSLINK_BUILD_OPTIMIZE)
775     if (handlePtr == NULL) {
776         /*! @retval PROCESSOR_E_INVALIDARG Invalid NULL handlePtr pointer
777                                          specified*/
778         status = PROCESSOR_E_INVALIDARG;
779         GT_setFailureReason (curTrace,
780                              GT_4CLASS,
781                              "OMAP5430BENELLIPROC_delete",
782                              status,
783                              "Invalid NULL handlePtr pointer specified");
784     }
785     else if (*handlePtr == NULL) {
786         /*! @retval PROCESSOR_E_HANDLE Invalid NULL *handlePtr specified */
787         status = PROCESSOR_E_HANDLE;
788         GT_setFailureReason (curTrace,
789                              GT_4CLASS,
790                              "OMAP5430BENELLIPROC_delete",
791                              status,
792                              "Invalid NULL *handlePtr specified");
793     }
794     else {
795 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
796         handle = (Processor_Object *) (*handlePtr);
797         /* Enter critical section protection. */
798         if (handle->object != NULL) {
799             object = (OMAP5430BENELLIPROC_Object *) handle->object;
800             switch (handle->procId)
801             {
802                 case PROCTYPE_IPU0:
803                     pState = &OMAP5430IPU0PROC_state;
804                     break;
805 #ifndef SYSLINK_SYSBIOS_SMP
806                 case PROCTYPE_IPU1:
807                     pState = &OMAP5430IPU1PROC_state;
808                     break;
809 #endif
810                 case PROCTYPE_DSP:
811                     pState = (OMAP5430BENELLIPROC_ModuleObject *)&OMAP5430DSPPROC_state;
812                     break;
813             }
814         }
815 #if !defined(SYSLINK_BUILD_OPTIMIZE)
816         if (pState == NULL) {
817             GT_setFailureReason (curTrace,
818                                  GT_4CLASS,
819                                  "OMAP5430BENELLIPROC_delete",
820                                  PROCESSOR_E_INVALIDARG,
821                                  "Unsupported procType");
822             return PROCESSOR_E_INVALIDARG;
823         }
824 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
826         key = IGateProvider_enter (pState->gateHandle);
828         /* Reset handle in PwrMgr handle array. */
829         GT_assert (curTrace, IS_VALID_PROCID (handle->procId));
830         pState->procHandle = NULL;
832         /* Free memory used for the PROC object. */
833         Memory_free (NULL,
834                      handle->object,
835                      sizeof (Ptr));
836         handle->object = NULL;
838         /*
839          * Check the list of listeners to see if any are remaining
840          * and reply to them
841          */
842         OsalMutex_delete(&handle->notifiersLock);
844         while ((elem = List_dequeue(handle->registeredNotifiers)) != NULL) {
845             regElem = (Processor_RegisterElem *)elem;
847             /* Check if there is an associated timer and cancel it */
848             if (regElem->timer != -1) {
849                 struct itimerspec value ;
850                 value.it_value.tv_sec = 0;
851                 value.it_value.tv_nsec = 0;
852                 value.it_interval.tv_sec = 0;
853                 value.it_interval.tv_nsec = 0;
854                 timer_settime(regElem->timer, 0, &value, NULL);
856                 timer_delete(regElem->timer);
857                 regElem->timer = -1;
858             }
860             /* Call the callback function so it can clean up. */
861             regElem->info->cbFxn(handle->procId,
862                                  NULL,
863                                  handle->state,
864                                  handle->state,
865                                  ProcMgr_EventStatus_Canceled,
866                                  regElem->info->arg);
867             /* Free the memory */
868             Memory_free(NULL, regElem, sizeof(Processor_RegisterElem));
869         }
871         /* Delete the list of listeners */
872         List_delete(&handle->registeredNotifiers);
874         /* Free memory used for the Processor object. */
875         Memory_free (NULL, handle, sizeof (Processor_Object));
876         *handlePtr = NULL;
878         /* Leave critical section protection. */
879         IGateProvider_leave (pState->gateHandle, key);
880 #if !defined(SYSLINK_BUILD_OPTIMIZE)
881     }
882 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
884     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_delete", status);
886     /*! @retval PROCESSOR_SUCCESS Operation successful */
887     return (status);
891 /*!
892  *  @brief      Function to open a handle to an instance of this Processor. This
893  *              function is called when access to the Processor is required from
894  *              a different process.
895  *
896  *  @param      handlePtr   Handle to the Processor instance
897  *  @param      procId      Processor ID addressed by this Processor instance.
898  *
899  *  @sa         OMAP5430BENELLIPROC_close
900  */
901 Int
902 OMAP5430BENELLIPROC_open (OMAP5430BENELLIPROC_Handle * handlePtr, UInt16 procId)
904     Int                                 status  = PROCESSOR_SUCCESS;
905     OMAP5430BENELLIPROC_ModuleObject *  pState  = NULL;
907     GT_2trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_open",
908                handlePtr, procId);
910     GT_assert (curTrace, (handlePtr != NULL));
911     GT_assert (curTrace, IS_VALID_PROCID (procId));
913     switch(procId)
914     {
915         case PROCTYPE_IPU0:
916             pState = &OMAP5430IPU0PROC_state;
917             break;
918 #ifndef SYSLINK_SYSBIOS_SMP
919         case PROCTYPE_IPU1:
920             pState = &OMAP5430IPU1PROC_state;
921             break;
922 #endif
923         case PROCTYPE_DSP:
924             pState = (OMAP5430BENELLIPROC_ModuleObject *)&OMAP5430DSPPROC_state;
925             break;
926     }
928 #if !defined(SYSLINK_BUILD_OPTIMIZE)
929     if (handlePtr == NULL) {
930         /*! @retval PROCESSOR_E_HANDLE Invalid NULL handlePtr specified */
931         status = PROCESSOR_E_HANDLE;
932         GT_setFailureReason (curTrace,
933                              GT_4CLASS,
934                              "OMAP5430BENELLIPROC_open",
935                              status,
936                              "Invalid NULL handlePtr specified");
937     }
938     else if (pState == NULL) {
939         /*! @retval PROCESSOR_E_INVALIDARG Invalid procId specified */
940         status = PROCESSOR_E_INVALIDARG;
941         GT_setFailureReason (curTrace,
942                              GT_4CLASS,
943                              "OMAP5430BENELLIPROC_open",
944                              status,
945                              "Invalid procId specified");
946     }
947     else {
948 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
949         /* Initialize return parameter handle. */
950         *handlePtr = NULL;
952         /* Check if the PwrMgr exists and return the handle if found. */
953         if (pState->procHandle == NULL) {
954             /*! @retval PROCESSOR_E_NOTFOUND Specified instance not found */
955             status = PROCESSOR_E_NOTFOUND;
956             GT_setFailureReason (curTrace,
957                              GT_4CLASS,
958                              "OMAP5430BENELLIPROC_open",
959                              status,
960                              "Specified instance does not exist!");
961         }
962         else {
963             *handlePtr = pState->procHandle;
964         }
965 #if !defined(SYSLINK_BUILD_OPTIMIZE)
966     }
967 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
969     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_open", status);
971     /*! @retval PROCESSOR_SUCCESS Operation successful */
972     return status;
976 /*!
977  *  @brief      Function to close a handle to an instance of this Processor.
978  *
979  *  @param      handlePtr  Pointer to Handle to the Processor instance
980  *
981  *  @sa         OMAP5430BENELLIPROC_open
982  */
983 Int
984 OMAP5430BENELLIPROC_close (OMAP5430BENELLIPROC_Handle * handlePtr)
986     Int status = PROCESSOR_SUCCESS;
988     GT_1trace (curTrace, GT_ENTER, "OMAP5430M3VIDEOPROC_close", handlePtr);
990     GT_assert (curTrace, (handlePtr != NULL));
991     GT_assert (curTrace, ((handlePtr != NULL) && (*handlePtr != NULL)));
993 #if !defined(SYSLINK_BUILD_OPTIMIZE)
994     if (handlePtr == NULL) {
995         /*! @retval PROCESSOR_E_INVALIDARG Invalid NULL handlePtr pointer
996                                          specified*/
997         status = PROCESSOR_E_INVALIDARG;
998         GT_setFailureReason (curTrace,
999                              GT_4CLASS,
1000                              "OMAP5430BENELLIPROC_close",
1001                              status,
1002                              "Invalid NULL handlePtr pointer specified");
1003     }
1004     else if (*handlePtr == NULL) {
1005         /*! @retval PROCESSOR_E_HANDLE Invalid NULL *handlePtr specified */
1006         status = PROCESSOR_E_HANDLE;
1007         GT_setFailureReason (curTrace,
1008                              GT_4CLASS,
1009                              "OMAP5430BENELLIPROC_close",
1010                              status,
1011                              "Invalid NULL *handlePtr specified");
1012     }
1013     else {
1014 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1015         /* Nothing to be done for close. */
1016 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1017     }
1018 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1020     GT_1trace (curTrace, GT_LEAVE, "OMAP5430M3VIDEOPROC_close", status);
1022     /*! @retval PROCESSOR_SUCCESS Operation successful */
1023     return status;
1027 /* =============================================================================
1028  * APIs called by Processor module (part of function table interface)
1029  * =============================================================================
1030  */
1031 /*!
1032  *  @brief      Function to initialize the slave processor
1033  *
1034  *  @param      handle  Handle to the Processor instance
1035  *  @param      params  Attach parameters
1036  *
1037  *  @sa         OMAP5430BENELLIPROC_detach
1038  */
1039 Int
1040 OMAP5430BENELLIPROC_attach (Processor_Handle        handle,
1041                            Processor_AttachParams * params)
1044     Int                            status       = PROCESSOR_SUCCESS ;
1045     Processor_Object *             procHandle   = (Processor_Object *) handle;
1046     OMAP5430BENELLIPROC_Object *   object       = NULL;
1047     ProcMgr_AddrInfo *             me;
1048     OMAP5430BENELLIPROC_ModuleObject *      pState;
1049     OMAP5430BENELLI_HalMmuCtrlArgs_Enable   enableArgs;
1050     UInt32                      i = 0;
1051     UInt32                      index = 0;
1052     SysLink_MemEntry *          entry;
1053     SysLink_MemEntry_Block      memBlock;
1054     Char                        configProp[SYSLINK_MAX_NAMELENGTH];
1055     ProcMgr_AddrInfo *          pMemRegn        = NULL;
1056     UInt32 *                    AddrTable_count = NULL;
1058     GT_2trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_attach", handle, params);
1060     GT_assert (curTrace, (handle != NULL));
1061     GT_assert (curTrace, (params != NULL));
1063     switch(procHandle->procId)
1064     {
1065         case PROCTYPE_IPU0:
1066             pState = &OMAP5430IPU0PROC_state;
1067             pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
1068             AddrTable_count = &AddrTable_IPU_count;
1069             break;
1070 #ifndef SYSLINK_SYSBIOS_SMP
1071         case PROCTYPE_IPU1:
1072             pState = &OMAP5430IPU1PROC_state;
1073             pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
1074             AddrTable_count = &AddrTable_IPU_count;
1075             break;
1076 #endif
1077         case PROCTYPE_DSP:
1078             pState = (OMAP5430BENELLIPROC_ModuleObject *)&OMAP5430DSPPROC_state;
1079             pMemRegn = OMAP5430TESLAPROC_defaultMemRegions;
1080             AddrTable_count = &AddrTable_DSP_count;
1081             break;
1082     }
1084 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1085     if (handle == NULL) {
1086         /*! @retval PROCESSOR_E_HANDLE Invalid argument */
1087         status = PROCESSOR_E_HANDLE;
1088         GT_setFailureReason (curTrace,
1089                              GT_4CLASS,
1090                              "OMAP5430BENELLIPROC_attach",
1091                              status,
1092                              "Invalid handle specified");
1093     }
1094     else if (params == NULL) {
1095             /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
1096             status = PROCESSOR_E_INVALIDARG;
1097             GT_setFailureReason (curTrace,
1098                                  GT_4CLASS,
1099                                  "OMAP5430BENELLIPROC_attach",
1100                                  status,
1101                                  "Invalid params specified");
1102     }
1103     else {
1104 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1105         object = (OMAP5430BENELLIPROC_Object *) procHandle->object;
1106         GT_assert (curTrace, (object != NULL));
1108         /* Added for Netra Benelli core0 is cortex M3 */
1109         params->procArch = Processor_ProcArch_M3;
1110         GT_0trace (curTrace,
1111                    GT_2CLASS,
1112                    "    OMAP5430BENELLIPROC_attach: Mapping memory regions");
1114         /* check for carveout params override */
1115         if (procHandle->procId == PROCTYPE_DSP) {
1116             Cfg_prop(PARAMS_carveoutAddr0DSP, ProcMgr_sysLinkCfgParams, configProp);
1117             object->params.carveoutAddr[0] = strtoul(configProp, 0, 16);
1118             Cfg_prop(PARAMS_carveoutSize0DSP, ProcMgr_sysLinkCfgParams, configProp);
1119             object->params.carveoutSize[0] = strtoul(configProp, 0, 16);
1120         }
1121         else {
1122             Cfg_prop(PARAMS_carveoutAddr0, ProcMgr_sysLinkCfgParams, configProp);
1123             object->params.carveoutAddr[0] = strtoul(configProp, 0, 16);
1124             Cfg_prop(PARAMS_carveoutSize0, ProcMgr_sysLinkCfgParams, configProp);
1125             object->params.carveoutSize[0] = strtoul(configProp, 0, 16);
1126         }
1128         object->pmHandle = params->pmHandle;
1129         GT_0trace(curTrace, GT_1CLASS,
1130             "OMAP5430BENELLIPROC_attach: Mapping memory regions");
1132         /* search for dsp memory map */
1133         status = RscTable_process(procHandle->procId, TRUE, NumCarveouts,
1134                                   (Ptr)object->params.carveoutAddr,
1135                                   object->params.carveoutSize, TRUE,
1136                                   &memBlock.numEntries);
1137         if (status < 0 || memBlock.numEntries > SYSLINK_MAX_MEMENTRIES) {
1138             /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
1139             status = PROCESSOR_E_INVALIDARG;
1140             GT_setFailureReason (curTrace,
1141                                  GT_4CLASS,
1142                                  "OMAP5430BENELLIPROC_attach",
1143                                  status,
1144                                  "Failed to process resource table");
1145         }
1146         else {
1147             status = RscTable_getMemEntries(procHandle->procId,
1148                                             memBlock.memEntries,
1149                                             &memBlock.numEntries);
1150             if (status < 0) {
1151                 /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
1152                 status = PROCESSOR_E_INVALIDARG;
1153                 GT_setFailureReason (curTrace,
1154                                      GT_4CLASS,
1155                                      "OMAP5430BENELLIPROC_attach",
1156                                      status,
1157                                      "Failed to get resource table memEntries");
1158             }
1159         }
1161         /* update translation tables with memory map */
1162         for (i = 0; (i < memBlock.numEntries)
1163             && (memBlock.memEntries[i].isValid) && (status >= 0); i++) {
1165             entry = &memBlock.memEntries[i];
1167             if (entry->map == FALSE) {
1168                 /* update table with entries which don't require mapping */
1169                 if (*AddrTable_count != AddrTable_SIZE) {
1170                     me = &pMemRegn[*AddrTable_count];
1172                     me->addr[ProcMgr_AddrType_MasterKnlVirt] = -1u;
1173                     me->addr[ProcMgr_AddrType_MasterUsrVirt] = -1u;
1174                     me->addr[ProcMgr_AddrType_MasterPhys] =
1175                             entry->masterPhysAddr;
1176                     me->addr[ProcMgr_AddrType_SlaveVirt] = entry->slaveVirtAddr;
1177                     me->addr[ProcMgr_AddrType_SlavePhys] = -1u;
1178                     me->size = entry->size;
1179                     me->isCached = entry->isCached;
1180                     me->mapMask = entry->mapMask;
1182                     (*AddrTable_count)++;
1183                 }
1184                 else {
1185                     status = PROCESSOR_E_FAIL;
1186                     GT_setFailureReason(curTrace, GT_4CLASS,
1187                         "OMAP5430BENELLIPROC_attach", status,
1188                         "AddrTable_SIZE reached!");
1189                 }
1190             }
1191             else if (entry->map == TRUE) {
1192                 /* send these entries back to ProcMgr for mapping */
1193                 index = object->params.numMemEntries;
1195                 if (index != ProcMgr_MAX_MEMORY_REGIONS) {
1196                     me = &object->params.memEntries[index];
1198                     me->addr[ProcMgr_AddrType_MasterKnlVirt] = -1u;
1199                     me->addr[ProcMgr_AddrType_MasterUsrVirt] = -1u;
1200                     me->addr[ProcMgr_AddrType_MasterPhys] =
1201                             entry->masterPhysAddr;
1202                     me->addr[ProcMgr_AddrType_SlaveVirt] = entry->slaveVirtAddr;
1203                     me->addr[ProcMgr_AddrType_SlavePhys] = -1u;
1204                     me->size = entry->size;
1205                     me->isCached = entry->isCached;
1206                     me->mapMask = entry->mapMask;
1208                     object->params.numMemEntries++;
1209                 }
1210                 else {
1211                     status = PROCESSOR_E_FAIL;
1212                     GT_setFailureReason(curTrace, GT_4CLASS,
1213                         "OMAP5430BENELLIPROC_attach", status,
1214                         "ProcMgr_MAX_MEMORY_REGIONS reached!");
1215                 }
1216             }
1217             else {
1218                 status = PROCESSOR_E_INVALIDARG;
1219                 GT_setFailureReason(curTrace, GT_4CLASS,
1220                     "OMAP5430BENELLIPROC_attach", status,
1221                     "Memory map has entry with invalid 'map' value");
1222             }
1223         } /* for (...) */
1225         if (status >= 0) {
1226             /* populate the return params */
1227             params->numMemEntries = object->params.numMemEntries;
1228             memcpy((Ptr)params->memEntries, (Ptr)object->params.memEntries,
1229                 sizeof(ProcMgr_AddrInfo) * params->numMemEntries);
1231             status = OMAP5430BENELLI_halInit (&(object->halObject),
1232                                               &object->params,
1233                                               procHandle->procId);
1234 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1235             if (status < 0) {
1236                 GT_setFailureReason (curTrace,
1237                                      GT_4CLASS,
1238                                      "OMAP5430BENELLIPROC_attach",
1239                                      status,
1240                                      "OMAP5430BENELLI_halInit failed");
1241             }
1242             else {
1243 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1245                 if (    (procHandle->bootMode == ProcMgr_BootMode_Boot)
1246                     ||  (procHandle->bootMode == ProcMgr_BootMode_NoLoad_Pwr)) {
1248 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1249                     if (status < 0) {
1250                         GT_setFailureReason (curTrace,
1251                                              GT_4CLASS,
1252                                              "OMAP5430BENELLIPROC_attach",
1253                                              status,
1254                                          "Failed to reset the slave processor");
1255                     }
1256                     else {
1257 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1258                         GT_0trace (curTrace,
1259                                  GT_1CLASS,
1260                                  "    OMAP5430BENELLIPROC_attach: Slave is now "
1261                                  "in reset!");
1263                         if (procHandle->procId == PROCTYPE_IPU0 ||
1264                             procHandle->procId == PROCTYPE_DSP) {
1265                             /* Enable MMU */
1266                             GT_0trace (curTrace,
1267                                        GT_2CLASS,
1268                                        "OMAP5430BENELLIPROC_attach: "
1269                                        "Enabling Slave MMU ...");
1270                             enableArgs.memEntries = NULL;
1271                             enableArgs.numMemEntries = 0;
1272                             status = OMAP5430BENELLI_halMmuCtrl (
1273                                                     object->halObject,
1274                                                     Processor_MmuCtrlCmd_Enable,
1275                                                     &enableArgs);
1276 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1277                             if (status < 0) {
1278                                 GT_setFailureReason (curTrace,
1279                                               GT_4CLASS,
1280                                               "OMAP5430BENELLIPROC_attach",
1281                                               status,
1282                                               "Failed to enable the slave MMU");
1283                             }
1284                             else if (procHandle->procId == PROCTYPE_IPU0) {
1285 #endif
1286                                 status = OMAP5430BENELLI_halResetCtrl(object->halObject,
1287                                     Processor_ResetCtrlCmd_MMU_Release);
1288                                 if (status < 0) {
1289                                     /*! @retval status */
1290                                     GT_setFailureReason (curTrace,
1291                                         GT_4CLASS,
1292                                         "OMAP5430BENELLI_halResetCtrl",
1293                                         status,
1294                                         "Reset MMU_Release failed");
1295                                 }
1296 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1297                             }
1298                         }
1299                     }
1300 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1301                 }
1302             }
1303 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1304         }
1305     }
1306 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1308     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_attach",status);
1310     /*! @retval PROCESSOR_SUCCESS Operation successful */
1311     return status;
1316 /*!
1317  *  @brief      Function to detach from the Processor.
1318  *
1319  *  @param      handle  Handle to the Processor instance
1320  *
1321  *  @sa         OMAP5430BENELLIPROC_attach
1322  */
1323 Int
1324 OMAP5430BENELLIPROC_detach (Processor_Handle handle)
1326     Int                       status     = PROCESSOR_SUCCESS;
1327     Int                       tmpStatus  = PROCESSOR_SUCCESS;
1328     Processor_Object *        procHandle = (Processor_Object *) handle;
1329     OMAP5430BENELLIPROC_Object * object   = NULL;
1330     Int i                              = 0;
1331     ProcMgr_AddrInfo *    ai;
1332     ProcMgr_AddrInfo *          pMemRegn        = NULL;
1333     UInt32                    staticCount = 0;
1334     UInt32 *                  AddrTable_count = NULL;
1336     GT_1trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_detach", handle);
1338     GT_assert (curTrace, (handle != NULL));
1340     switch(procHandle->procId)
1341     {
1342         case PROCTYPE_IPU0:
1343             pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
1344             staticCount = AddrTable_IPU_STATIC_COUNT;
1345             AddrTable_count = &AddrTable_IPU_count;
1346             break;
1347 #ifndef SYSLINK_SYSBIOS_SMP
1348         case PROCTYPE_IPU1:
1349             pMemRegn = OMAP5430BENELLIPROC_defaultMemRegions;
1350             staticCount = AddrTable_IPU_STATIC_COUNT;
1351             AddrTable_count = &AddrTable_IPU_count;
1352             break;
1353 #endif
1354         case PROCTYPE_DSP:
1355             pMemRegn = OMAP5430TESLAPROC_defaultMemRegions;
1356             staticCount = AddrTable_DSP_STATIC_COUNT;
1357             AddrTable_count = &AddrTable_DSP_count;
1358             break;
1359     }
1361 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1362     if (handle == NULL) {
1363         /*! @retval PROCESSOR_E_HANDLE Invalid argument */
1364         status = PROCESSOR_E_HANDLE;
1365         GT_setFailureReason (curTrace,
1366                              GT_4CLASS,
1367                              "OMAP5430BENELLIPROC_detach",
1368                              PROCESSOR_E_HANDLE,
1369                              "Invalid handle specified");
1370     }
1371     else {
1372 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1373         object = (OMAP5430BENELLIPROC_Object *) procHandle->object;
1374         GT_assert (curTrace, (object != NULL));
1376         if (    (procHandle->bootMode == ProcMgr_BootMode_Boot)
1377             ||  (procHandle->bootMode == ProcMgr_BootMode_NoLoad_Pwr)) {
1378             if (procHandle->procId == PROCTYPE_IPU0) {
1379                 status = OMAP5430BENELLI_halResetCtrl(object->halObject,
1380                     Processor_ResetCtrlCmd_MMU_Reset);
1381                 if (status < 0) {
1382                     /*! @retval status */
1383                     GT_setFailureReason (curTrace,
1384                                  GT_4CLASS,
1385                                  "OMAP5430BENELLI_halResetCtrl",
1386                                  status,
1387                                  "Reset MMU failed");
1388                 }
1389                 else {
1390                     /* Disable MMU */
1391                     GT_0trace (curTrace,
1392                            GT_2CLASS,
1393                            "    OMAP5430BENELLIPROC_detach: "
1394                            "Disabling Slave MMU ...");
1395                     status = OMAP5430BENELLI_halMmuCtrl (object->halObject,
1396                                                    Processor_MmuCtrlCmd_Disable,
1397                                                    NULL);
1398 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1399                     if (status < 0) {
1400                         GT_setFailureReason (curTrace,
1401                                          GT_4CLASS,
1402                                          "OMAP5430BENELLIPROC_detach",
1403                                          status,
1404                                          "Failed to disable the slave MMU");
1405                     }
1406 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1407                 }
1408             }
1409             else if (procHandle->procId == PROCTYPE_DSP) {
1410                 /* Disable MMU */
1411                 GT_0trace (curTrace,
1412                        GT_2CLASS,
1413                        "    OMAP5430BENELLIPROC_detach: "
1414                        "Disabling Slave MMU ...");
1415                 status = OMAP5430BENELLI_halMmuCtrl (object->halObject,
1416                                                Processor_MmuCtrlCmd_Disable,
1417                                                NULL);
1418 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1419                 if (status < 0) {
1420                     GT_setFailureReason (curTrace,
1421                                          GT_4CLASS,
1422                                          "OMAP5430BENELLIPROC_detach",
1423                                          status,
1424                                          "Failed to disable the slave MMU");
1425                 }
1426 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1427             }
1429             /* delete all dynamically added entries */
1430             for (i = staticCount; i < *AddrTable_count; i++) {
1431                 ai = &pMemRegn[i];
1432                 ai->addr[ProcMgr_AddrType_MasterKnlVirt] = -1u;
1433                 ai->addr[ProcMgr_AddrType_MasterUsrVirt] = -1u;
1434                 ai->addr[ProcMgr_AddrType_MasterPhys] = -1u;
1435                 ai->addr[ProcMgr_AddrType_SlaveVirt] = -1u;
1436                 ai->addr[ProcMgr_AddrType_SlavePhys] = -1u;
1437                 ai->size = 0u;
1438                 ai->isCached = FALSE;
1439                 ai->mapMask = 0u;
1440                 ai->isMapped = FALSE;
1441                 ai->refCount = 0u;
1442             }
1443             object->params.numMemEntries = staticCount;
1444             *AddrTable_count = staticCount;
1446             //No need to reset.. that will be done in STOP
1447            /* tmpStatus = OMAP5430BENELLI_halResetCtrl (object->halObject,
1448                                                    Processor_ResetCtrlCmd_Reset,
1449                                                    NULL);
1450             GT_0trace (curTrace,
1451                        GT_2CLASS,
1452                        "    OMAP5430BENELLIPROC_detach: Slave processor is "
1453                        "now in reset");*/
1454 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1455             if ((tmpStatus < 0) && (status >= 0)) {
1456                 status = tmpStatus;
1457                 GT_setFailureReason (curTrace,
1458                                      GT_4CLASS,
1459                                      "OMAP5430BENELLIPROC_detach",
1460                                      status,
1461                                      "Failed to reset the slave processor");
1462             }
1463 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1464         }
1466         GT_0trace (curTrace,
1467                    GT_2CLASS,
1468                    "    OMAP5430BENELLIPROC_detach: Unmapping memory regions");
1470         tmpStatus = OMAP5430BENELLI_halExit(object->halObject, &object->params);
1471 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1472         if ((tmpStatus < 0) && (status >= 0)) {
1473             status = tmpStatus;
1474             GT_setFailureReason (curTrace,
1475                                  GT_4CLASS,
1476                                  "OMAP5430BENELLIPROC_detach",
1477                                  status,
1478                                  "Failed to finalize HAL object");
1479         }
1480     }
1481 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1483     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_detach", status);
1485     /*! @retval PROCESSOR_SUCCESS Operation successful */
1486     return status;
1490 /*!
1491  *  @brief      Function to start the slave processor
1492  *
1493  *              Start the slave processor running from its entry point.
1494  *              Depending on the boot mode, this involves configuring the boot
1495  *              address and releasing the slave from reset.
1496  *
1497  *  @param      handle    Handle to the Processor instance
1498  *
1499  *  @sa         OMAP5430BENELLIPROC_stop, OMAP5430BENELLIPROC_halBootCtrl,
1500  *              OMAP5430BENELLIPROC_halResetCtrl
1501  */
1502 Int
1503 OMAP5430BENELLIPROC_start (Processor_Handle        handle,
1504                            UInt32                  entryPt,
1505                            Processor_StartParams * params)
1507     Int                           status       = PROCESSOR_SUCCESS ;
1508     Processor_Object *            procHandle   = (Processor_Object *) handle;
1509     OMAP5430BENELLIPROC_Object  * object       = procHandle->object;
1510     Memory_MapInfo        sysCtrlMapInfo;
1511     Memory_UnmapInfo      sysCtrlUnmapInfo;
1513     GT_3trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_start",
1514                handle, entryPt, params);
1516     GT_assert (curTrace, (handle != NULL));
1517     GT_assert (curTrace, (params != NULL));
1519 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1520     if (handle == NULL) {
1521         /*! @retval PROCESSOR_E_HANDLE Invalid argument */
1522         status = PROCESSOR_E_HANDLE;
1523         GT_setFailureReason (curTrace,
1524                              GT_4CLASS,
1525                              "OMAP5430BENELLIPROC_start",
1526                              status,
1527                              "Invalid handle specified");
1528     }
1529     else if (params == NULL) {
1530             /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
1531             status = PROCESSOR_E_INVALIDARG;
1532             GT_setFailureReason (curTrace,
1533                                  GT_4CLASS,
1534                                  "OMAP5430BENELLIPROC_start",
1535                                  status,
1536                                  "Invalid params specified");
1537     }
1538     else {
1539 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1540         if (handle->procId == MultiProc_getId("DSP")) {
1541             status = OMAP5430BENELLI_halResetCtrl(object->halObject,
1542                                                  Processor_ResetCtrlCmd_MMU_Release);
1543             if (status < 0) {
1544                 /*! @retval status */
1545                 GT_setFailureReason (curTrace,
1546                                      GT_4CLASS,
1547                                      "OMAP5430BENELLI_halResetCtrl",
1548                                      status,
1549                                      "Reset MMU_Release failed");
1550             }
1551         }
1553         if (status >= 0) {
1554             if(handle->procId != MultiProc_getId("DSP")) {
1555                 status = ipu_setup(object->halObject, object->params.memEntries,
1556                                    object->params.numMemEntries);
1557             }
1558             else {
1559                 status = tesla_setup(object->halObject,
1560                                      object->params.memEntries,
1561                                      object->params.numMemEntries);
1562             }
1564             if (status < 0) {
1565                 /*! @retval status */
1566                 GT_setFailureReason (curTrace,
1567                                      GT_4CLASS,
1568                                      "OMAP5430BENELLI_halResetCtrl",
1569                                      status,
1570                                      "ipu_setup failed");
1571             }
1572             else {
1573                 if (handle->procId == MultiProc_getId("DSP")) {
1574                     /* Get the user virtual address of the PRM base */
1575                     sysCtrlMapInfo.src  = 0x4A002000;
1576                     sysCtrlMapInfo.size = 0x1000;
1577                     sysCtrlMapInfo.isCached = FALSE;
1579                     status = Memory_map (&sysCtrlMapInfo);
1580                     if (status < 0) {
1581                         status = PROCESSOR_E_FAIL;
1582                         GT_setFailureReason (curTrace,
1583                                              GT_4CLASS,
1584                                              "ProcMgr_load",
1585                                               status,
1586                                               "Memory_map failed");
1587                     }
1588                     else {
1589                         *(UInt32 *)(sysCtrlMapInfo.dst + 0x304) = entryPt;
1591                         sysCtrlUnmapInfo.addr = sysCtrlMapInfo.dst;
1592                         sysCtrlUnmapInfo.size = sysCtrlMapInfo.size;
1593                         sysCtrlUnmapInfo.isCached = FALSE;
1594                         Memory_unmap (&sysCtrlUnmapInfo);
1595                     }
1596                 }
1597                 if (status >= 0) {
1598                     status = OMAP5430BENELLI_halResetCtrl(object->halObject,
1599                                                  Processor_ResetCtrlCmd_Release);
1600                 }
1601                 if (status < 0) {
1602                     /*! @retval status */
1603                     GT_setFailureReason (curTrace,
1604                                          GT_4CLASS,
1605                                          "OMAP5430BENELLI_halResetCtrl",
1606                                          status,
1607                                          "Reset Release failed");
1608                 }
1609             }
1610         }
1611 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1612     }
1613 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1614     return status;
1618 /*!
1619  *  @brief      Function to stop the slave processor
1620  *
1621  *              Stop the execution of the slave processor. Depending on the boot
1622  *              mode, this may result in placing the slave processor in reset.
1623  *
1624  *  @param      handle    Handle to the Processor instance
1625  *
1626  *  @sa         OMAP5430BENELLIPROC_start, OMAP5430BENELLIPROC_halResetCtrl
1627  */
1628 Int
1629 OMAP5430BENELLIPROC_stop (Processor_Handle handle)
1631     Int                         status       = PROCESSOR_SUCCESS ;
1632     Processor_Object *          procHandle   = (Processor_Object *) handle;
1633     OMAP5430BENELLIPROC_Object * object      = procHandle->object;
1635     GT_1trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_stop", handle);
1637     GT_assert (curTrace, (handle != NULL));
1639 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1640     if (handle == NULL) {
1641         /*! @retval PROCESSOR_E_HANDLE Invalid argument */
1642         status = PROCESSOR_E_HANDLE;
1643         GT_setFailureReason (curTrace,
1644                              GT_4CLASS,
1645                              "OMAP5430BENELLIPROC_stop",
1646                              status,
1647                              "Invalid handle specified");
1648     }
1649     else {
1650 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1651         status = OMAP5430BENELLI_halResetCtrl(object->halObject,
1652                                              Processor_ResetCtrlCmd_Reset);
1653         if (status < 0) {
1654             /*! @retval status */
1655             GT_setFailureReason (curTrace,
1656                                  GT_4CLASS,
1657                                  "OMAP5430BENELLI_halResetCtrl",
1658                                  status,
1659                                  "Reset failed");
1660         }
1662         ipu_destroy(object->halObject);
1663         if (procHandle->procId ==  MultiProc_getId("DSP")) {
1664             status = OMAP5430BENELLI_halResetCtrl(object->halObject,
1665                                                  Processor_ResetCtrlCmd_MMU_Reset);
1666             if (status < 0) {
1667                 /*! @retval status */
1668                 GT_setFailureReason (curTrace,
1669                                      GT_4CLASS,
1670                                      "OMAP5430BENELLI_halResetCtrl",
1671                                      status,
1672                                      "Reset MMU failed");
1673             }
1674         }
1676 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1677     }
1678 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1680     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_stop", status);
1682     /*! @retval PROCESSOR_SUCCESS Operation successful */
1683     return status;
1687 /*!
1688  *  @brief      Function to read from the slave processor's memory.
1689  *
1690  *              Read from the slave processor's memory and copy into the
1691  *              provided buffer.
1692  *
1693  *  @param      handle     Handle to the Processor instance
1694  *  @param      procAddr   Address in host processor's address space of the
1695  *                         memory region to read from.
1696  *  @param      numBytes   IN/OUT parameter. As an IN-parameter, it takes in the
1697  *                         number of bytes to be read. When the function
1698  *                         returns, this parameter contains the number of bytes
1699  *                         actually read.
1700  *  @param      buffer     User-provided buffer in which the slave processor's
1701  *                         memory contents are to be copied.
1702  *
1703  *  @sa         OMAP5430BENELLIPROC_write
1704  */
1705 Int
1706 OMAP5430BENELLIPROC_read (Processor_Handle   handle,
1707                           UInt32             procAddr,
1708                           UInt32 *           numBytes,
1709                           Ptr                buffer)
1711     Int       status   = PROCESSOR_SUCCESS ;
1712     UInt8  *  procPtr8 = NULL;
1714     GT_4trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_read",
1715                handle, procAddr, numBytes, buffer);
1717     GT_assert (curTrace, (handle   != NULL));
1718     GT_assert (curTrace, (numBytes != NULL));
1719     GT_assert (curTrace, (buffer   != NULL));
1721 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1722     if (handle == NULL) {
1723         /*! @retval PROCESSOR_E_HANDLE Invalid argument */
1724         status = PROCESSOR_E_HANDLE;
1725         GT_setFailureReason (curTrace,
1726                              GT_4CLASS,
1727                              "OMAP5430BENELLIPROC_read",
1728                              status,
1729                              "Invalid handle specified");
1730     }
1731     else if (numBytes == 0) {
1732             /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
1733             status = PROCESSOR_E_INVALIDARG;
1734             GT_setFailureReason (curTrace,
1735                                  GT_4CLASS,
1736                                  "OMAP5430BENELLIPROC_read",
1737                                  status,
1738                                  "Invalid numBytes specified");
1739     }
1740     else if (buffer == NULL) {
1741             /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
1742             status = PROCESSOR_E_INVALIDARG;
1743             GT_setFailureReason (curTrace,
1744                                  GT_4CLASS,
1745                                  "OMAP5430BENELLIPROC_read",
1746                                  status,
1747                                  "Invalid buffer specified");
1748     }
1749     else {
1750 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1751         procPtr8 = (UInt8 *) procAddr ;
1752         buffer = Memory_copy (buffer, procPtr8, *numBytes);
1753         GT_assert (curTrace, (buffer != (UInt32) NULL));
1754 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1755         if (buffer == (UInt32) NULL) {
1756             /*! @retval PROCESSOR_E_FAIL Failed in Memory_copy */
1757             status = PROCESSOR_E_FAIL;
1758             GT_setFailureReason (curTrace,
1759                                  GT_4CLASS,
1760                                  "OMAP5430BENELLIPROC_read",
1761                                  status,
1762                                  "Failed in Memory_copy");
1763             *numBytes = 0;
1764         }
1765     }
1766 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1768     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_read",status);
1770     /*! @retval PROCESSOR_SUCCESS Operation successful */
1771     return status;
1775 /*!
1776  *  @brief      Function to write into the slave processor's memory.
1777  *
1778  *              Read from the provided buffer and copy into the slave
1779  *              processor's memory.
1780  *
1781  *  @param      handle     Handle to the Processor object
1782  *  @param      procAddr   Address in host processor's address space of the
1783  *                         memory region to write into.
1784  *  @param      numBytes   IN/OUT parameter. As an IN-parameter, it takes in the
1785  *                         number of bytes to be written. When the function
1786  *                         returns, this parameter contains the number of bytes
1787  *                         actually written.
1788  *  @param      buffer     User-provided buffer from which the data is to be
1789  *                         written into the slave processor's memory.
1790  *
1791  *  @sa         OMAP5430BENELLIPROC_read
1792  */
1793 Int
1794 OMAP5430BENELLIPROC_write (Processor_Handle handle,
1795                            UInt32           procAddr,
1796                            UInt32 *         numBytes,
1797                            Ptr              buffer)
1799     Int                   status       = PROCESSOR_SUCCESS ;
1800     Processor_Object *    procHandle   = (Processor_Object *) handle;
1801     OMAP5430BENELLIPROC_Object * object = NULL;
1802     UInt8  *              procPtr8     = NULL;
1803     UInt8                 temp8_1;
1804     UInt8                 temp8_2;
1805     UInt8                 temp8_3;
1806     UInt8                 temp8_4;
1807     UInt32                temp;
1809     GT_4trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_write",
1810                handle, procAddr, numBytes, buffer);
1812     GT_assert (curTrace, (handle   != NULL));
1813     GT_assert (curTrace, (numBytes != NULL));
1814     GT_assert (curTrace, (buffer   != NULL));
1816 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1817     if (handle == NULL) {
1818         /*! @retval PROCESSOR_E_HANDLE Invalid argument */
1819         status = PROCESSOR_E_HANDLE;
1820         GT_setFailureReason (curTrace,
1821                              GT_4CLASS,
1822                              "OMAP5430BENELLIPROC_write",
1823                              status,
1824                              "Invalid handle specified");
1825     }
1826     else if (numBytes == 0) {
1827             /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
1828             status = PROCESSOR_E_INVALIDARG;
1829             GT_setFailureReason (curTrace,
1830                                  GT_4CLASS,
1831                                  "OMAP5430BENELLIPROC_write",
1832                                  status,
1833                                  "Invalid numBytes specified");
1834     }
1835     else if (buffer == NULL) {
1836             /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
1837             status = PROCESSOR_E_INVALIDARG;
1838             GT_setFailureReason (curTrace,
1839                                  GT_4CLASS,
1840                                  "OMAP5430BENELLIPROC_write",
1841                                  status,
1842                                  "Invalid buffer specified");
1843     }
1844     else {
1845 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1846         object = (OMAP5430BENELLIPROC_Object *) procHandle->object;
1847         GT_assert (curTrace, (object != NULL));
1848         if (*numBytes != sizeof (UInt32)) {
1849             procPtr8 = (UInt8 *) procAddr ;
1850             procAddr = (UInt32) Memory_copy (procPtr8,
1851                                              buffer,
1852                                              *numBytes);
1853             GT_assert (curTrace, (procAddr != (UInt32) NULL));
1854 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1855             if (procAddr == (UInt32) NULL) {
1856                 /*! @retval PROCESSOR_E_FAIL Failed in Memory_copy */
1857                 status = PROCESSOR_E_FAIL;
1858                 GT_setFailureReason (curTrace,
1859                                      GT_4CLASS,
1860                                      "OMAP5430BENELLIPROC_write",
1861                                      status,
1862                                      "Failed in Memory_copy");
1863                 *numBytes = 0;
1864             }
1865 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1866         }
1867         else  {
1868              /* For 4 bytes, directly write as a UInt32 */
1869             temp8_1 = ((UInt8 *) buffer) [0];
1870             temp8_2 = ((UInt8 *) buffer) [1];
1871             temp8_3 = ((UInt8 *) buffer) [2];
1872             temp8_4 = ((UInt8 *) buffer) [3];
1873             temp = (UInt32) (    ((UInt32) temp8_4 << 24)
1874                              |   ((UInt32) temp8_3 << 16)
1875                              |   ((UInt32) temp8_2 << 8)
1876                              |   ((UInt32) temp8_1));
1877             *((UInt32*) procAddr) = temp;
1878         }
1879 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1880     }
1881 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1883     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_write", status);
1885     /*! @retval PROCESSOR_SUCCESS Operation successful */
1886     return status;
1890 /*!
1891  *  @brief      Function to perform device-dependent operations.
1892  *
1893  *              Performs device-dependent control operations as exposed by this
1894  *              implementation of the Processor module.
1895  *
1896  *  @param      handle     Handle to the Processor object
1897  *  @param      cmd        Device specific processor command
1898  *  @param      arg        Arguments specific to the type of command.
1899  *
1900  *  @sa
1901  */
1902 Int
1903 OMAP5430BENELLIPROC_control (Processor_Handle handle, Int32 cmd, Ptr arg)
1905     Int                          status       = PROCESSOR_SUCCESS ;
1906     Processor_Object *           procHandle   = (Processor_Object *) handle;
1907     OMAP5430BENELLIPROC_Object * object       = NULL;
1909     GT_3trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_control",
1910                handle, cmd, arg);
1912     GT_assert (curTrace, (handle != NULL));
1913     /* cmd and arg can be 0/NULL, so cannot check for validity. */
1915 #if !defined(SYSLINK_BUILD_OPTIMIZE)
1916     if (handle == NULL) {
1917         /*! @retval PROCESSOR_E_HANDLE Invalid argument */
1918         status = PROCESSOR_E_HANDLE;
1919         GT_setFailureReason (curTrace,
1920                              GT_4CLASS,
1921                              "OMAP5430BENELLIPROC_control",
1922                              status,
1923                              "Invalid handle specified");
1924     }
1925     else {
1926 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
1927         object = (OMAP5430BENELLIPROC_Object *) procHandle->object;
1928         GT_assert (curTrace, (object != NULL));
1929         /* No control operations currently implemented. */
1930         /*! @retval PROCESSOR_E_NOTSUPPORTED No control operations are supported
1931                                              for this device. */
1933         switch (cmd) {
1934             case Omap5430BenelliProc_CtrlCmd_Suspend:
1935                 if (procHandle->state == ProcMgr_State_Running) {
1936                     if (procHandle->procId == PROCTYPE_IPU0) {
1937                         status = save_mmu_ctxt(object->halObject,
1938                                                procHandle->procId);
1939                     }
1940                     if (status < 0) {
1941                         GT_setFailureReason(curTrace, GT_4CLASS,
1942                                             "OMAP5430BENELLIPROC_control",
1943                                             status,
1944                                             "Error while saving the MMU context");
1945                     }
1946                     else {
1947                         status = OMAP5430BENELLI_halResetCtrl(object->halObject,
1948                             Processor_ResetCtrlCmd_Reset);
1949                         if (status < 0) {
1950                             GT_setFailureReason(curTrace, GT_4CLASS,
1951                                                 "OMAP5430BENELLIPROC_control",
1952                                                 status,
1953                                                 "Error while Resetting proc");
1954                         }
1955                         else {
1956                             status = OMAP5430BENELLI_halResetCtrl(
1957                                 object->halObject,
1958                                 Processor_ResetCtrlCmd_MMU_Reset);
1959                             if (status < 0) {
1960                                 GT_setFailureReason(curTrace, GT_4CLASS,
1961                                                     "OMAP5430BENELLIPROC_control",
1962                                                     status,
1963                                                     "Error while Resetting MMU");
1964                             }
1965                             else {
1966                                 Processor_setState(handle, ProcMgr_State_Suspended);
1967                             }
1968                         }
1969                     }
1970                 }
1971                 else {
1972                     status = PROCESSOR_E_INVALIDSTATE;
1973                     GT_setFailureReason(curTrace, GT_4CLASS,
1974                                         "OMAP5430BENELLIPROC_control",
1975                                         status,
1976                                         "Processor not is correct state to Suspend");
1977                 }
1978                 break;
1979             case Omap5430BenelliProc_CtrlCmd_Resume:
1980                 if (procHandle->state == ProcMgr_State_Suspended) {
1981                     status = OMAP5430BENELLI_halResetCtrl(object->halObject,
1982                         Processor_ResetCtrlCmd_MMU_Release);
1983                     if (status < 0) {
1984                         GT_setFailureReason(curTrace, GT_4CLASS,
1985                                             "OMAP5430BENELLIPROC_control",
1986                                             status,
1987                                             "Error while releasing proc MMU reset");
1988                     }
1989                     else {
1990                         if (procHandle->procId == PROCTYPE_IPU0) {
1991                             status = restore_mmu_ctxt(object->halObject,
1992                                                       procHandle->procId);
1993                         }
1994                         if (status < 0) {
1995                             GT_setFailureReason(curTrace, GT_4CLASS,
1996                                                "OMAP5430BENELLIPROC_control",
1997                                                status,
1998                                                "Error while restoring MMU context");
1999                         }
2000                         else {
2001                             status = OMAP5430BENELLI_halResetCtrl(
2002                                 object->halObject,
2003                                 Processor_ResetCtrlCmd_Release);
2004                             if (status < 0) {
2005                                 GT_setFailureReason(curTrace, GT_4CLASS,
2006                                                     "OMAP5430BENELLIPROC_control",
2007                                                     status,
2008                                                     "Error while releasing reset");
2009                             }
2010                             else {
2011                                 Processor_setState(handle, ProcMgr_State_Running);
2012                             }
2013                         }
2014                     }
2015                 }
2016                 else {
2017                     status = PROCESSOR_E_INVALIDSTATE;
2018                     GT_setFailureReason(curTrace, GT_4CLASS,
2019                                         "OMAP5430BENELLIPROC_control",
2020                                         status,
2021                                         "Processor not is correct state to Resume");
2022                 }
2023                 break;
2024             default:
2025                 status = PROCESSOR_E_NOTSUPPORTED;
2026         }
2028 #if !defined(SYSLINK_BUILD_OPTIMIZE)
2029     }
2030 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
2031     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_control",status);
2033     /*! @retval PROCESSOR_SUCCESS Operation successful */
2034     return status;
2038 /*!
2039  *  @brief      Function to translate slave physical address to master physical
2040  *              address.
2041  *
2042  *  @param      handle     Handle to the Processor object
2043  *  @param      dstAddr    Returned: master physical address.
2044  *  @param      srcAddr    Slave physical address.
2045  *
2046  *  @sa
2047  */
2048 Int
2049 OMAP5430BENELLIPROC_translate (Processor_Handle handle,
2050                                UInt32 *         dstAddr,
2051                                UInt32           srcAddr)
2053     Int                         status       = PROCESSOR_SUCCESS ;
2054     Processor_Object *          procHandle   = (Processor_Object *) handle;
2055     OMAP5430BENELLIPROC_Object * object      = NULL;
2056     UInt32                      i;
2057     ProcMgr_AddrInfo *          ai;
2058     ProcMgr_AddrInfo *          pMemRegn     = NULL;
2059     UInt32                      nRegions     = 0;
2061     GT_3trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_translate",
2062                handle, dstAddr, srcAddr);
2064     GT_assert (curTrace, (handle  != NULL));
2065     GT_assert (curTrace, (dstAddr != NULL));
2067     GT_1trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_Params_init", handle);
2069 #if !defined(SYSLINK_BUILD_OPTIMIZE)
2070     if (handle == NULL) {
2071         /*! @retval PROCESSOR_E_HANDLE Invalid argument */
2072         status = PROCESSOR_E_HANDLE;
2073         GT_setFailureReason (curTrace,
2074                              GT_4CLASS,
2075                              "OMAP5430BENELLIPROC_translate",
2076                              status,
2077                              "Invalid handle specified");
2078     }
2079     else if (dstAddr == NULL) {
2080         /*! @retval PROCESSOR_E_INVALIDARG sglist provided as NULL */
2081         status = PROCESSOR_E_INVALIDARG;
2082         GT_setFailureReason (curTrace,
2083                              GT_4CLASS,
2084                              "OMAP5430BENELLIPROC_translate",
2085                              status,
2086                              "dstAddr provided as NULL");
2087     }
2088     else {
2089 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
2090         object = (OMAP5430BENELLIPROC_Object *) procHandle->object;
2091         GT_assert (curTrace, (object != NULL));
2093         pMemRegn = object->params.memEntries;
2094         nRegions = object->params.numMemEntries;
2096         *dstAddr = -1u;
2097         for (i = 0;i < nRegions;i++)
2098         {
2099              ai = &pMemRegn [i];
2100              if (   (srcAddr >= ai->addr [ProcMgr_AddrType_SlaveVirt])
2101                  && (srcAddr < (  ai->addr [ProcMgr_AddrType_SlaveVirt]
2102                                 + ai->size))) {
2103                  *dstAddr =   ai->addr [ProcMgr_AddrType_MasterPhys]
2104                             + (srcAddr - ai->addr [ProcMgr_AddrType_SlaveVirt]);
2105                  break;
2106              }
2107         }
2109         if (*dstAddr == -1u) {
2110             /*! @retval PROCESSOR_E_FAIL srcAddr not found in slave address
2111              *          space */
2112             status = PROCESSOR_E_INVALIDARG;
2113             GT_setFailureReason (curTrace,
2114                                  GT_4CLASS,
2115                                  "OMAP5430BENELLIPROC_translate",
2116                                  status,
2117                                  "srcAddr not found in slave address space");
2118         }
2120 #if !defined(SYSLINK_BUILD_OPTIMIZE)
2121     }
2122 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
2123     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_translate",status);
2125     /*! @retval PROCESSOR_SUCCESS Operation successful */
2126     return status;
2130 /*!
2131  *  @brief      Function to map slave address to host address space
2132  *
2133  *              Map the provided slave address to master address space. This
2134  *              function also maps the specified address to slave MMU space.
2135  *
2136  *  @param      handle      Handle to the Processor object
2137  *  @param      mapType     Type of mapping to be performed.
2138  *  @param      addrInfo    Structure containing map info.
2139  *  @param      srcAddrType Source address type.
2140  *
2141  *  @sa
2142  */
2143 Int
2144 OMAP5430BENELLIPROC_map (Processor_Handle handle,
2145                          UInt32 *         dstAddr,
2146                          UInt32           nSegs,
2147                          Memory_SGList *  sglist)
2149     Int                          status       = PROCESSOR_SUCCESS ;
2150     Processor_Object *           procHandle   = (Processor_Object *) handle;
2151     OMAP5430BENELLIPROC_Object * object       = NULL;
2152     UInt32                       i;
2153     OMAP5430BENELLI_HalMmuCtrlArgs_AddEntry addEntryArgs;
2155     GT_4trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_map",
2156                handle, dstAddr, nSegs, sglist);
2158     GT_assert (curTrace, (handle != NULL));
2159     GT_assert (curTrace, (sglist != NULL));
2160     GT_assert (curTrace, (nSegs > 0));
2162 #if !defined(SYSLINK_BUILD_OPTIMIZE)
2163     if (handle == NULL) {
2164         /*! @retval PROCESSOR_E_HANDLE Invalid argument */
2165         status = PROCESSOR_E_HANDLE;
2166         GT_setFailureReason (curTrace,
2167                              GT_4CLASS,
2168                              "OMAP5430BENELLIPROC_map",
2169                              status,
2170                              "Invalid handle specified");
2171     }
2172     else if (sglist == NULL) {
2173         /*! @retval PROCESSOR_E_INVALIDARG sglist provided as NULL */
2174         status = PROCESSOR_E_INVALIDARG;
2175         GT_setFailureReason (curTrace,
2176                              GT_4CLASS,
2177                              "OMAP5430BENELLIPROC_map",
2178                              status,
2179                              "sglist provided as NULL");
2180     }
2181     else if (nSegs == 0) {
2182         /*! @retval PROCESSOR_E_INVALIDARG Number of segments provided is 0 */
2183         status = PROCESSOR_E_INVALIDARG;
2184         GT_setFailureReason (curTrace,
2185                              GT_4CLASS,
2186                              "OMAP5430BENELLIPROC_map",
2187                              status,
2188                              "Number of segments provided is 0");
2189     }
2190     else {
2191 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
2192         object = (OMAP5430BENELLIPROC_Object *) procHandle->object;
2193         GT_assert (curTrace, (object != NULL));
2194         /* Program the mmu with the sglist */
2195         /* Program the DSP MMU also */
2196         for (i = 0; (i < nSegs) && (status >= 0); i++)
2197         {
2198             addEntryArgs.masterPhyAddr = sglist [i].paddr;
2199             addEntryArgs.size          = sglist [i].size;
2200             addEntryArgs.slaveVirtAddr = (UInt32)*dstAddr;
2201             /*TBD : elementSize, endianism, mixedSized are hard coded now,
2202              *      must be configurable later*/
2203             addEntryArgs.elementSize   = ELEM_SIZE_16BIT;
2204             addEntryArgs.endianism     = LITTLE_ENDIAN;
2205             addEntryArgs.mixedSize     = MMU_TLBES;
2206             addEntryArgs.slaveVirtAddr = get_BenelliVirtAdd(object->halObject,
2207                                                     addEntryArgs.masterPhyAddr);
2208             *(dstAddr) = addEntryArgs.slaveVirtAddr;
2209             if(addEntryArgs.slaveVirtAddr == 0) {
2210                 status = OMAP5430BENELLI_halMmuCtrl (object->halObject,
2211                                                   Processor_MmuCtrlCmd_AddEntry,
2212                                                   &addEntryArgs);
2214             }
2215 #if !defined(SYSLINK_BUILD_OPTIMIZE)
2216             if (status < 0) {
2217                 GT_setFailureReason (curTrace,
2218                                  GT_4CLASS,
2219                                  "OMAP5430BENELLIPROC_map",
2220                                  status,
2221                                  "DSP MMU configuration failed");
2222             }
2223 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
2224         }
2225 #if !defined(SYSLINK_BUILD_OPTIMIZE)
2226     }
2227 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
2228     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_map",status);
2230     /*! @retval PROCESSOR_SUCCESS Operation successful */
2231     return status;
2235 /*!
2236  *  @brief      Function to unmap slave address from host address space
2237  *
2238  *  @param      handle      Handle to the Processor object
2239  *  @param      dstAddr     Return parameter: Pointer to receive the mapped
2240  *                          address.
2241  *  @param      size        Size of the region to be mapped.
2242 s *
2243  *  @sa
2244  */
2245 Int
2246 OMAP5430BENELLIPROC_unmap (Processor_Handle handle,
2247                            UInt32           addr,
2248                            UInt32           size)
2250     Int                          status       = PROCESSOR_SUCCESS ;
2251     Processor_Object *           procHandle   = (Processor_Object *) handle;
2252     OMAP5430BENELLIPROC_Object * object       = NULL;
2253     OMAP5430BENELLI_HalMmuCtrlArgs_DeleteEntry deleteEntryArgs;
2255     GT_3trace (curTrace, GT_ENTER, "OMAP5430BENELLIPROC_unmap",
2256                handle, addr, size);
2258     GT_assert (curTrace, (handle != NULL));
2259     GT_assert (curTrace, (size   != 0));
2261 #if !defined(SYSLINK_BUILD_OPTIMIZE)
2262     if (handle == NULL) {
2263         /*! @retval PROCESSOR_E_HANDLE Invalid argument */
2264         status = PROCESSOR_E_HANDLE;
2265         GT_setFailureReason (curTrace,
2266                              GT_4CLASS,
2267                              "OMAP5430BENELLIPROC_unmap",
2268                              status,
2269                              "Invalid handle specified");
2270     }
2271     else if (size == 0) {
2272         /*! @retval  PROCESSOR_E_INVALIDARG Size provided is zero */
2273         status = PROCESSOR_E_INVALIDARG;
2274         GT_setFailureReason (curTrace,
2275                              GT_4CLASS,
2276                              "OMAP5430BENELLIPROC_unmap",
2277                              status,
2278                              "Size provided is zero");
2279     }
2280     else {
2281 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
2282         object = (OMAP5430BENELLIPROC_Object *) procHandle->object;
2283         GT_assert (curTrace, (object != NULL));
2284         /* Remove the entry from the DSP MMU also */
2286         deleteEntryArgs.size          = size;
2287         deleteEntryArgs.slaveVirtAddr = addr;
2288         /*TBD : elementSize, endianism, mixedSized are hard coded now,
2289          *        must be configurable later*/
2290         deleteEntryArgs.elementSize   = ELEM_SIZE_16BIT;
2291         deleteEntryArgs.endianism     = LITTLE_ENDIAN;
2292         deleteEntryArgs.mixedSize     = MMU_TLBES;
2294         status = OMAP5430BENELLI_halMmuCtrl(object->halObject,
2295                                             Processor_MmuCtrlCmd_DeleteEntry,
2296                                             &deleteEntryArgs);
2297 #if !defined(SYSLINK_BUILD_OPTIMIZE)
2298         if (status < 0) {
2299             GT_setFailureReason (curTrace,
2300                              GT_4CLASS,
2301                              "OMAP5430BENELLIPROC_unmap",
2302                              status,
2303                              "DSP MMU configuration failed");
2304         }
2305 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
2307 #if !defined(SYSLINK_BUILD_OPTIMIZE)
2308     }
2309 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
2310     GT_1trace (curTrace, GT_LEAVE, "OMAP5430BENELLIPROC_unmap",status);
2312     /*! @retval PROCESSOR_SUCCESS Operation successful */
2313     return status;
2316 Int
2317 OMAP5430BENELLIPROC_procInfo (Processor_Handle   handle,
2318                               ProcMgr_ProcInfo * procInfo)
2320     Processor_Object *              procHandle  = NULL;
2321     OMAP5430BENELLIPROC_Object *    object      = NULL;
2322     ProcMgr_AddrInfo *              entry       = NULL;
2323     Int                             i           = 0;
2325     procHandle = (Processor_Object *)handle;
2326     object = procHandle->object;
2327     for (i = 0; i < object->params.numMemEntries; i++) {
2328         entry = &object->params.memEntries[i];
2330         procInfo->memEntries[i].info.addr[ProcMgr_AddrType_MasterKnlVirt] =
2331             entry->addr[ProcMgr_AddrType_MasterKnlVirt];
2333         procInfo->memEntries[i].info.addr[ProcMgr_AddrType_SlaveVirt] =
2334             entry->addr[ProcMgr_AddrType_SlaveVirt];
2337     }
2338     procInfo->numMemEntries = object->params.numMemEntries;
2339     return 0;
2342 Int
2343 OMAP5430BENELLI_virtToPhys (Processor_Handle handle,
2344                             UInt32           da,
2345                             UInt32 *         mappedEntries,
2346                             UInt32           numEntries)
2348     if(!handle || !mappedEntries || !numEntries) {
2349         return -1;
2350     }
2351     return 0;
2355 #if defined (__cplusplus)
2357 #endif /* defined (__cplusplus) */