Clean up patch dir; synchronize patches with kernel-power v48
[kernel-bfs] / kernel-bfs-2.6.28 / debian / patches / dspbridge.diff
1 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h
2 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h    2011-04-17 17:32:26.000000000 +0100
3 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h 2011-05-02 22:36:48.000000000 +0100
4 @@ -3,6 +3,12 @@
5   *
6   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
7   *
8 + * Private header file defining channel manager and channel objects for
9 + * a shared memory channel driver.
10 + *
11 + * Shared between the modules implementing the shared memory channel class
12 + * library.
13 + *
14   * Copyright (C) 2005-2006 Texas Instruments, Inc.
15   *
16   * This package is free software; you can redistribute it and/or modify
17 @@ -14,50 +20,11 @@
18   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19   */
20  
21 -
22 -/*
23 - *  ======== _chnl_sm.h ========
24 - *  Description:
25 - *      Private header file defining channel manager and channel objects for
26 - *      a shared memory channel driver.
27 - *
28 - *  Public Functions:
29 - *      None.
30 - *
31 - *  Notes:
32 - *      Shared between the modules implementing the shared memory channel class
33 - *      library.
34 - *
35 - *! Revision History:
36 - *! ================
37 - *! 15-Oct-2002 kc  Removed legacy PERF code.
38 - *! 12-Jan-2002 ag  Removed unused gppReqIO & ddmaChnlId DDMA fields.
39 - *!                 Added zero-copy chnl descriptor array: zchnldesc.
40 - *! 21-Dec-2001 ag  Moved descPaGpp to private chnl obj from chnl descriptor.
41 - *! 20-May-2001 ag/jeh Removed fShmSyms field from CHNL_MGR.
42 - *! 04-Feb-2001 ag  DSP-DMA support added.
43 - *! 26-Oct-2000 jeh Added arg and resvd to SHM control structure. Added dwArg
44 - *!                 to CHNL_IRP.
45 - *! 16-Oct-2000 jeh Removed #ifdef DEBUG from around channel object's cIOCs
46 - *!                 field, added cIOReqs.
47 - *! 20-Jan-2000 ag: Incorporated code review comments.
48 - *! 05-Jan-2000 ag: Text format cleanup.
49 - *! 03-Nov-1999 ag: Added szEventName[] to CHNL object for name event support.
50 - *! 02-Nov-1999 ag: _SHM_BEG & _END Syms from COFF now used for IO and SM CLASS.
51 - *! 27-Oct-1999 jeh Define SHM structure to work for 16-bit targets.
52 - *! 25-May-1999 jg: Added target side symbol names for share memory buffer
53 - *! 03-Jan-1997 gp: Added fSharedIRQ field.
54 - *! 22-Oct-1996 gp: Made dwProcessID a handle.
55 - *! 09-Sep-1996 gp: Added dwProcessID field to CHNL_OBJECT.
56 - *! 13-Aug-1996 gp: Created.
57 - */
58 -
59  #ifndef _CHNL_SM_
60  #define _CHNL_SM_
61  
62  #include <dspbridge/wcd.h>
63  #include <dspbridge/wmd.h>
64 -#include <dspbridge/dpc.h>
65  
66  #include <dspbridge/list.h>
67  #include <dspbridge/ntfy.h>
68 @@ -78,6 +45,11 @@
69  
70  #define MAXOPPS 16
71  
72 +/* Shared memory config options */
73 +#define SHM_CURROPP    0       /* Set current OPP in SHM */
74 +#define SHM_OPPINFO    1       /* Set dsp voltage and freq table values */
75 +#define SHM_GETOPP     2       /* Get opp requested by DSP */
76 +
77  struct oppTableEntry {
78      u32 voltage;
79      u32 frequency;
80 @@ -105,12 +77,6 @@ struct loadMonStruct {
81      u32 predDspFreq;
82  };
83  
84 -       enum SHM_DESCTYPE {
85 -               SHM_CURROPP = 0,
86 -               SHM_OPPINFO = 1,
87 -               SHM_GETOPP = 2,         /* Get DSP requested OPP info */
88 -       } ;
89 -
90  /* Structure in shared between DSP and PC for communication.*/
91         struct SHM {
92                 u32 dspFreeMask;        /* Written by DSP, read by PC. */
93 @@ -177,7 +143,7 @@ struct loadMonStruct {
94                 struct SYNC_OBJECT *hSyncEvent;
95                 /* Name of Sync event */
96                 char szEventName[SYNC_MAXNAMELENGTH + 1];
97 -               u32 hProcess;   /* Process which created this channel */
98 +               u32 hProcess;   /* Process which created this channel */
99                 u32 pCBArg;     /* Argument to use with callback */
100                 struct LST_LIST *pIORequests;   /* List of IOR's to driver */
101                 s32 cIOCs;      /* Number of IOC's in queue */
102 @@ -197,7 +163,7 @@ struct loadMonStruct {
103  
104  /* I/O Request/completion packet: */
105         struct CHNL_IRP {
106 -               struct LST_ELEM link;   /* Link to next CHIRP in queue. */
107 +               struct list_head link;  /* Link to next CHIRP in queue. */
108                 /* Buffer to be filled/emptied. (User)   */
109                 u8 *pHostUserBuf;
110                 /* Buffer to be filled/emptied. (System) */
111 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/_dcd.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/_dcd.h
112 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/_dcd.h        2011-04-17 17:32:26.000000000 +0100
113 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/_dcd.h     2011-05-02 22:36:48.000000000 +0100
114 @@ -3,6 +3,9 @@
115   *
116   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
117   *
118 + * Includes the wrapper functions called directly by the
119 + * DeviceIOControl interface.
120 + *
121   * Copyright (C) 2005-2006 Texas Instruments, Inc.
122   *
123   * This package is free software; you can redistribute it and/or modify
124 @@ -14,43 +17,6 @@
125   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
126   */
127  
128 -
129 -/*
130 - *  ======== _dcd.h ========
131 - *  Description:
132 - *      Includes the wrapper functions called directly by the
133 - *      DeviceIOControl interface.
134 - *
135 - *  Public Functions:
136 - *      WCD_CallDevIOCtl
137 - *      WCD_Init
138 - *      WCD_InitComplete2
139 - *      WCD_Exit
140 - *      <MOD>WRAP_*
141 - *
142 - *  Notes:
143 - *      Compiled with CDECL calling convention.
144 - *
145 - *! Revision History:
146 - *! ================
147 - *! 19-Apr-2004 sb  Aligned DMM definitions with Symbian
148 - *! 08-Mar-2004 sb  Added the Dynamic Memory Mapping feature
149 - *! 30-Jan-2002 ag  Renamed CMMWRAP_AllocBuf to CMMWRAP_CallocBuf.
150 - *! 22-Nov-2000 kc: Added MGRWRAP_GetPerf_Data to acquire PERF stats.
151 - *! 27-Oct-2000 jeh Added NODEWRAP_AllocMsgBuf, NODEWRAP_FreeMsgBuf. Removed
152 - *!                 NODEWRAP_GetMessageStream.
153 - *! 10-Oct-2000 ag: Added user CMM wrappers.
154 - *! 04-Aug-2000 rr: MEMWRAP and UTIL_Wrap added.
155 - *! 27-Jul-2000 rr: NODEWRAP, STRMWRAP added.
156 - *! 27-Jun-2000 rr: MGRWRAP fxns added.IFDEF to build for PM or DSP/BIOS Bridge
157 - *! 03-Dec-1999 rr: WCD_InitComplete2 enabled for BRD_AutoStart.
158 - *! 09-Nov-1999 kc: Added MEMRY.
159 - *! 02-Nov-1999 ag: Added CHNL.
160 - *! 08-Oct-1999 rr: Utilwrap_Testdll fxn added
161 - *! 24-Sep-1999 rr: header changed from _wcd.h to _dcd.h
162 - *! 09-Sep-1997 gp: Created.
163 - */
164 -
165  #ifndef _WCD_
166  #define _WCD_
167  
168 @@ -130,11 +96,8 @@
169         extern u32 MGRWRAP_WaitForBridgeEvents(union Trapped_Args *args,
170                         void *pr_ctxt);
171  
172 -#ifndef RES_CLEANUP_DISABLE
173         extern u32 MGRWRAP_GetProcessResourcesInfo(union Trapped_Args *args,
174                         void *pr_ctxt);
175 -#endif
176 -
177  
178  /* CPRC (Processor) wrapper Functions */
179         extern u32 PROCWRAP_Attach(union Trapped_Args *args, void *pr_ctxt);
180 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/brddefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/brddefs.h
181 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/brddefs.h     2011-04-17 17:32:26.000000000 +0100
182 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/brddefs.h  2011-05-02 22:36:48.000000000 +0100
183 @@ -3,6 +3,8 @@
184   *
185   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
186   *
187 + * Global BRD constants and types, shared between WCD and WMD.
188 + *
189   * Copyright (C) 2005-2006 Texas Instruments, Inc.
190   *
191   * This package is free software; you can redistribute it and/or modify
192 @@ -14,22 +16,6 @@
193   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
194   */
195  
196 -
197 -/*
198 - *  ======== brddefs.h ========
199 - *  Description:
200 - *      Global BRD constants and types, shared between WSX, WCD, and WMD.
201 - *
202 - *! Revision History:
203 - *! ================
204 - *! 31-Jan-2000 rr: Comment Exec changed to Monitor
205 - *! 22-Jul-1999 jeh Added BRD_LOADED state.
206 - *! 26-Mar-1997 gp: Added BRD_SYNCINIT state.
207 - *! 11-Dec-1996 cr: Added BRD_LASTSTATE definition.
208 - *! 11-Jul-1996 gp: Added missing u32 callback argument to BRD_CALLBACK.
209 - *! 10-Jun-1996 gp: Created from board.h and brd.h.
210 - */
211 -
212  #ifndef BRDDEFS_
213  #define BRDDEFS_
214  
215 @@ -46,7 +32,6 @@
216  #define BRD_RETENTION     0x8       /* Retention mode */
217  #define BRD_DSP_HIBERNATION     0x9       /* DSP initiated hibernation */
218  #define BRD_ERROR              0xA       /* Board state is Error */
219 -       typedef u32 BRD_STATUS;
220  
221  /* BRD Object */
222         struct BRD_OBJECT;
223 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/cfg.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/cfg.h
224 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/cfg.h 2011-04-17 17:32:26.000000000 +0100
225 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/cfg.h      2011-05-02 22:36:48.000000000 +0100
226 @@ -3,6 +3,8 @@
227   *
228   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
229   *
230 + * PM Configuration module.
231 + *
232   * Copyright (C) 2005-2006 Texas Instruments, Inc.
233   *
234   * This package is free software; you can redistribute it and/or modify
235 @@ -14,54 +16,6 @@
236   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
237   */
238  
239 -
240 -/*
241 - *  ======== cfg.h ========
242 - *  Purpose:
243 - *      PM Configuration module.
244 - *
245 - *  Private Functions:
246 - *      CFG_Exit
247 - *      CFG_GetAutoStart
248 - *      CFG_GetCDVersion
249 - *      CFG_GetDevObject
250 - *      CFG_GetDSPResources
251 - *      CFG_GetExecFile
252 - *      CFG_GetHostResources
253 - *      CFG_GetObject
254 - *      CFG_GetPerfValue
255 - *      CFG_GetWMDFileName
256 - *      CFG_GetZLFile
257 - *      CFG_Init
258 - *      CFG_SetDevObject
259 - *      CFG_SetObject
260 - *
261 - *! Revision History:
262 - *! =================
263 - *! 26-Feb-2003 kc  Removed unused CFG fxns.
264 - *! 28-Aug-2001 jeh  Added CFG_GetLoaderName.
265 - *! 26-Jul-2000 rr:  Added CFG_GetDCDName to retrieve the DCD Dll name.
266 - *! 13-Jul-2000 rr:  Added CFG_GetObject & CFG_SetObject.
267 - *! 13-Jan-2000 rr:  CFG_Get/SetPrivateDword renamed to CFG_Get/SetDevObject.
268 - *!                  CFG_GetWinBRIDGEDir/Directory,CFG_GetSearchPath removed.
269 - *! 15-Jan-1998 cr:  Code review cleanup.
270 - *! 16-Aug-1997 cr:  Added explicit cdecl identifiers.
271 - *! 12-Dec-1996 gp:  Moved CFG_FindInSearchPath to CSP module.
272 - *! 13-Sep-1996 gp:  Added CFG_GetBoardName().
273 - *! 22-Jul-1996 gp:  Added CFG_GetTraceStr, to retrieve an initial GT trace.
274 - *! 26-Jun-1996 cr:  Added CFG_FindInSearchPath.
275 - *! 25-Jun-1996 cr:  Added CFG_GetWinSPOXDir.
276 - *! 17-Jun-1996 cr:  Added CFG_GetDevNode.
277 - *! 11-Jun-1996 cr:  Cleaned up for code review.
278 - *! 07-Jun-1996 cr:  Added CFG_GetExecFile and CFG_GetZLFileName functions.
279 - *! 04-Jun-1996 gp:  Added AutoStart regkey and accessor function.  Placed
280 - *!                  OUT parameters in accessor function param. lists at end.
281 - *! 29-May-1996 gp:  Moved DEV_HDEVNODE to here and renamed CFG_HDEVNODE.
282 - *! 22-May-1996 cr:  Added GetHostResources, GetDSPResources, and
283 - *!                  GetWMDFileName services.
284 - *! 18-May-1996 gp:  Created.
285 - */
286 -
287  #ifndef CFG_
288  #define CFG_
289  #include <dspbridge/host_os.h>
290 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/cfgdefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/cfgdefs.h
291 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/cfgdefs.h     2011-04-17 17:32:26.000000000 +0100
292 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/cfgdefs.h  2011-05-02 22:36:48.000000000 +0100
293 @@ -3,6 +3,8 @@
294   *
295   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
296   *
297 + * Global CFG constants and types, shared between class and mini driver.
298 + *
299   * Copyright (C) 2005-2006 Texas Instruments, Inc.
300   *
301   * This package is free software; you can redistribute it and/or modify
302 @@ -14,31 +16,6 @@
303   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
304   */
305  
306 -/*
307 - *  ======== cfgdefs.h ========
308 - *  Purpose:
309 - *      Global CFG constants and types, shared between class and mini driver.
310 - *
311 - *! Revision History:
312 - *! ================
313 - *! 24-Feb-2003 kc  Removed wIOPort* in CFG_HOSTRES.
314 - *! 06-Sep-2000 jeh Added channel info to CFG_HOSTRES.
315 - *! 09-May-2000 rr: CFG_HOSTRES now support multiple windows for PCI support.
316 - *! 31-Jan-2000 rr: Comments changed after code review.
317 - *! 06-Jan-2000 rr: Bus Type included in CFG_HOSTRES.
318 - *! 12-Nov-1999 rr: CFG_HOSTRES member names changed.
319 - *! 25-Oct-1999 rr: Modified the CFG_HOSTRES Structure
320 - *!                 PCMCIA ISR Register/Unregister fxn removed..
321 - *!                 New flag PCCARD introduced during compile time.
322 - *! 10-Sep-1999 ww: Added PCMCIA ISR Register/Unregister fxn.
323 - *! 01-Sep-1999 ag: Removed NT/95 specific fields in CFG_HOSTRES
324 - *! 27-Oct-1997 cr: Updated CFG_HOSTRES struct to support 1+ IRQs per board.
325 - *! 17-Sep-1997 gp: Tacked some NT config info to end of CFG_HOSTRES structure.
326 - *! 12-Dec-1996 cr: Cleaned up after code review.
327 - *! 14-Nov-1996 gp: Renamed from wsxcfg.h
328 - *! 19-Jun-1996 cr: Created.
329 - */
330 -
331  #ifndef CFGDEFS_
332  #define CFGDEFS_
333  
334 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/chnl.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/chnl.h
335 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/chnl.h        2011-04-17 17:32:26.000000000 +0100
336 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/chnl.h     2011-05-02 22:36:48.000000000 +0100
337 @@ -3,6 +3,11 @@
338   *
339   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
340   *
341 + * WCD channel interface: multiplexes data streams through the single
342 + * physical link managed by a mini-driver.
343 + *
344 + * See DSP API chnl.h for more details.
345 + *
346   * Copyright (C) 2005-2006 Texas Instruments, Inc.
347   *
348   * This package is free software; you can redistribute it and/or modify
349 @@ -14,46 +19,6 @@
350   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
351   */
352  
353 -
354 -/*
355 - *  ======== chnl.h ========
356 - *  Description:
357 - *      WCD channel interface: multiplexes data streams through the single
358 - *      physical link managed by a mini-driver.
359 - *
360 - *  Public Functions:
361 - *      CHNL_AddIOReq
362 - *      CHNL_AllocBuffer
363 - *      CHNL_CancelIO
364 - *      CHNL_Close
365 - *      CHNL_CloseOrphans
366 - *      CHNL_Create
367 - *      CHNL_Destroy
368 - *      CHNL_Exit
369 - *      CHNL_FlushIO
370 - *      CHNL_FreeBuffer
371 - *      CHNL_GetEventHandle
372 - *      CHNL_GetHandle
373 - *      CHNL_GetIOCompletion
374 - *      CHNL_GetId
375 - *      CHNL_GetMgr
376 - *      CHNL_GetMode
377 - *      CHNL_GetPosition
378 - *      CHNL_GetProcessHandle
379 - *      CHNL_Init
380 - *      CHNL_Open
381 - *
382 - *  Notes:
383 - *      See DSP API chnl.h for more details.
384 - *
385 - *! Revision History:
386 - *! ================
387 - *! 14-Jan-1997 gp: Updated based on code review feedback.
388 - *! 24-Oct-1996 gp: Move CloseOrphans into here from dspsys.
389 - *! 09-Sep-1996 gp: Added CHNL_GetProcessID() and CHNL_GetHandle().
390 - *! 10-Jul-1996 gp: Created.
391 - */
392 -
393  #ifndef CHNL_
394  #define CHNL_
395  
396 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/chnl_sm.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/chnl_sm.h
397 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/chnl_sm.h     2011-04-17 17:32:26.000000000 +0100
398 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/chnl_sm.h  2011-05-02 22:36:48.000000000 +0100
399 @@ -3,6 +3,14 @@
400   *
401   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
402   *
403 + * Prototypes for channel lower edge functions for a Bridge mini driver
404 + * implementing data transfer via shared memory.
405 + *
406 + * Notes:
407 + *   These lower edge functions must be implemented by the WMD writer.
408 + *   Currently, CHNLSM_Read() and CHNLSM_Write() are not called, but must
409 + *   be defined to link.
410 + *
411   * Copyright (C) 2005-2006 Texas Instruments, Inc.
412   *
413   * This package is free software; you can redistribute it and/or modify
414 @@ -14,28 +22,6 @@
415   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
416   */
417  
418 -
419 -/*
420 - *  ======== chnl_sm.h ========
421 - *  Description:
422 - *      Prototypes for channel lower edge functions for a WinBRIDGE mini driver
423 - *      implementing data transfer via shared memory.
424 - *
425 - *  Public Functions:
426 - *      CHNLSM_DisableInterrupt;
427 - *      CHNLSM_EnableInterrupt;
428 - *      CHNLSM_ISR;
429 - *      CHNLSM_Read;
430 - *      CHNLSM_UpdateSHMLength;
431 - *      CHNLSM_Write;
432 - *
433 - *  Notes:
434 - *      These lower edge functions must be implemented by the WMD writer.
435 - *      Currently, CHNLSM_Read() and CHNLSM_Write() are not called, but must
436 - *      be defined to link.
437 - *
438 - */
439 -
440  #ifndef CHNLSM_
441  #define CHNLSM_
442  
443 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/chnldefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/chnldefs.h
444 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/chnldefs.h    2011-04-17 17:32:26.000000000 +0100
445 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/chnldefs.h 2011-05-02 22:36:48.000000000 +0100
446 @@ -3,6 +3,8 @@
447   *
448   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
449   *
450 + * System-wide channel objects and constants.
451 + *
452   * Copyright (C) 2005-2006 Texas Instruments, Inc.
453   *
454   * This package is free software; you can redistribute it and/or modify
455 @@ -14,30 +16,6 @@
456   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
457   */
458  
459 -
460 -/*
461 - *  ======== chnldefs.h ========
462 - *  Purpose:
463 - *      System-wide channel objects and constants.
464 - *
465 - *! Revision History:
466 - *! ================
467 - *! 19-Jan-2002 ag  Added cBufSize to IOC.
468 - *! 05-Jan-2000 ag: Text format cleanup.
469 - *! 02-Dec-1999 ag: Added new chnl attribute pstrEventName.
470 - *! 12-Nov-1999 kc: Enabled hEvent attribute for tests.
471 - *! 01-Nov-1999 ag: hEvent attribute not supported(yet).
472 - *! 16-Jan-1997 gp: Moved private stuff into chnlpriv.h
473 - *! 14-Jan-1997 gp: Updated based on code review feedback:
474 - *!                 Removed CHNL_MODENOWAIT, CHNL_MODEDIRECT,
475 - *! 03-Jan-1997 gp: Added channel class library types.
476 - *! 14-Dec-1996 gp: Moved uChnlId field from CHNL_ATTRS to CHNL_Open().
477 - *! 10-Dec-1996 gp: Added CHNL_IsTimedOut() macro.
478 - *! 14-Nov-1996 gp: Renamed from wsxchnl.h.
479 - *! 09-Sep-1996 gp: Added hReserved2 field to CHNL_ATTRS. Updated CHNL_INFO.
480 - *! 10-Jul-1996 gp: Created from channel.h.
481 - */
482 -
483  #ifndef CHNLDEFS_
484  #define CHNLDEFS_
485  
486 @@ -67,8 +45,6 @@
487  #define CHNL_IsIOCancelled(ioc) (ioc.status & CHNL_IOCSTATCANCEL)
488  #define CHNL_IsTimedOut(ioc)    (ioc.status & CHNL_IOCSTATTIMEOUT)
489  
490 -/* CHNL types: */
491 -       typedef u32 CHNL_MODE;  /* Channel transfer mode.         */
492  
493  /* Channel attributes: */
494         struct CHNL_ATTRS {
495 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/chnlpriv.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/chnlpriv.h
496 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/chnlpriv.h    2011-04-17 17:32:26.000000000 +0100
497 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/chnlpriv.h 2011-05-02 22:36:48.000000000 +0100
498 @@ -3,6 +3,8 @@
499   *
500   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
501   *
502 + * Private channel header shared between DSPSYS, WCD and WMD modules.
503 + *
504   * Copyright (C) 2005-2006 Texas Instruments, Inc.
505   *
506   * This package is free software; you can redistribute it and/or modify
507 @@ -14,35 +16,6 @@
508   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
509   */
510  
511 -
512 -/*
513 - *  ======== chnlpriv.h ========
514 - *  Description:
515 - *      Private channel header shared between DSPSYS, WCD and WMD modules.
516 - *
517 - *  Public Functions:
518 - *      None.
519 - *
520 - *  Notes:
521 - *
522 - *! Revision History:
523 - *! ================
524 - *! 05-Jan-2002 ag  Added cChannels(total # of chnls) to CHNL_MGRINFO struct.
525 - *!                 Added private CHNL_[PCPY][ZCPY][DDMA].
526 - *! 17-Nov-2000 jeh Removed IRQ, shared memory from CHNL_MGRATTRS, since these
527 - *!                 now belong to IO_ATTRS.
528 - *! 21-Jan-2000 ag: Code review comments added.
529 - *! 05-Jan-2000 ag: Text format cleanup.
530 - *! 11-Dec-1999 ag: Added CHNL_MAXLOCKPAGES for CHNL_PrepareBuffer().
531 - *! 04-Dec-1999 ag: Added CHNL_MAXEVTNAMELEN for i/o compl named event support.
532 - *! 01-Nov-1999 ag: CHNL_MAXCHANNELS set to 16 for 16-bit DSPs.
533 - *! 27-Oct-1997 cr: Expanded CHNL_MAXIRQ from 0x0f to 0xff.
534 - *! 16-Jan-1997 gp: Moved symbols into here from chnldefs.h.
535 - *! 03-Jan-1997 gp: Added CHNL_MAXIRQ define.
536 - *! 09-Dec-1996 gp: Removed CHNL_STATEIDLE.
537 - *! 15-Jul-1996 gp: Created.
538 - */
539 -
540  #ifndef CHNLPRIV_
541  #define CHNLPRIV_
542  
543 @@ -110,7 +83,7 @@
544                 u32 cPosition;  /* Total bytes transferred.        */
545                 u32 cIOCs;      /* Number of IOCs in queue.               */
546                 u32 cIOReqs;    /* Number of IO Requests in queue.        */
547 -               u32 hProcess;   /* Process owning this channel.     */
548 +               u32 hProcess;   /* Process owning this channel.     */
549                 /*
550                  * Name of channel I/O completion event. Not required in Linux
551                  */
552 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/clk.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/clk.h
553 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/clk.h 2011-04-17 17:32:26.000000000 +0100
554 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/clk.h      2011-05-02 22:36:48.000000000 +0100
555 @@ -3,6 +3,8 @@
556   *
557   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
558   *
559 + * Provides Clock functions.
560 + *
561   * Copyright (C) 2005-2006 Texas Instruments, Inc.
562   *
563   * This package is free software; you can redistribute it and/or modify
564 @@ -14,15 +16,6 @@
565   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
566   */
567  
568 -/*
569 - *  ======== clk.h ========
570 - *  Purpose: Provides Clock functions.
571 - *
572 - *! Revision History:
573 - *! ================
574 - *! 08-May-2007 rg: Moved all clock functions from sync module.
575 - */
576 -
577  #ifndef _CLK_H
578  #define _CLK_H
579  
580 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/cmm.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/cmm.h
581 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/cmm.h 2011-04-17 17:32:26.000000000 +0100
582 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/cmm.h      2011-05-02 22:36:48.000000000 +0100
583 @@ -3,6 +3,22 @@
584   *
585   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
586   *
587 + * The Communication Memory Management(CMM) module provides shared memory
588 + * management services for DSP/BIOS Bridge data streaming and messaging.
589 + * Multiple shared memory segments can be registered with CMM. Memory is
590 + * coelesced back to the appropriate pool when a buffer is freed.
591 + *
592 + * The CMM_Xlator[xxx] functions are used for node messaging and data
593 + * streaming address translation to perform zero-copy inter-processor
594 + * data transfer(GPP<->DSP). A "translator" object is created for a node or
595 + * stream object that contains per thread virtual address information. This
596 + * translator info is used at runtime to perform SM address translation
597 + * to/from the DSP address space.
598 + *
599 + * Notes:
600 + *   CMM_XlatorAllocBuf - Used by Node and Stream modules for SM address
601 + *                       translation.
602 + *
603   * Copyright (C) 2008 Texas Instruments, Inc.
604   *
605   * This package is free software; you can redistribute it and/or modify
606 @@ -14,56 +30,6 @@
607   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
608   */
609  
610 -/*
611 - *  ======== cmm.h ========
612 - *  Purpose:
613 - *      The Communication Memory Management(CMM) module provides shared memory
614 - *      management services for DSP/BIOS Bridge data streaming and messaging.
615 - *      Multiple shared memory segments can be registered with CMM. Memory is
616 - *      coelesced back to the appropriate pool when a buffer is freed.
617 - *
618 - *      The CMM_Xlator[xxx] functions are used for node messaging and data
619 - *      streaming address translation to perform zero-copy inter-processor
620 - *      data transfer(GPP<->DSP). A "translator" object is created for a node or
621 - *      stream object that contains per thread virtual address information. This
622 - *      translator info is used at runtime to perform SM address translation
623 - *      to/from the DSP address space.
624 - *
625 - *
626 - *  Public Functions:
627 - *      CMM_CallocBuf
628 - *      CMM_Create
629 - *      CMM_Destroy
630 - *      CMM_Exit
631 - *      CMM_FreeBuf
632 - *      CMM_GetHandle
633 - *      CMM_GetInfo
634 - *      CMM_Init
635 - *      CMM_RegisterGPPSMSeg
636 - *      CMM_UnRegisterGPPSMSeg
637 - *      CMM_XlatorAllocBuf       (Note #1 below)
638 - *      CMM_XlatorCreate           "
639 - *      CMM_XlatorDelete           "
640 - *      CMM_XlatorFreeBuf          "
641 - *      CMM_XlatorTranslate        "
642 - *
643 - *
644 - *  Notes:
645 - *      #1: Used by Node and Stream modules for SM address translation.
646 - *
647 - *! Revision History:
648 - *! ================
649 - *! 30-Jan-2002 ag  Removed unused CMM_Alloc[Free]Desc & CMM_XlatorRegisterPa.
650 - *!                 Renamed CMM_AllocBuf() to CMM_CallocBuf().
651 - *! 29-Aug-2001 ag: Added dsp virt base and size to CMM_RegisterGPPSMSeg().
652 - *! 12-Aug-2001 ag: Added CMM_UnRegisterGPP[DSP}SMSeg[s]().
653 - *! 05-Dec-2000 ag: Added param to CMM_XlatorDelete() to force buf cleanup.
654 - *! 30-Oct-2000 ag: Added conversion factor to CMM_RegisterDSP[GPP]SMSeg().
655 - *! 12-Oct-2000 ag: Added CMM_Xlator[xxx] functions.
656 - *! 10-Aug-2000 ag: Created.
657 - *!
658 - */
659 -
660  #ifndef CMM_
661  #define CMM_
662  
663 @@ -194,7 +160,7 @@
664   *      hDevObject != NULL
665   *  Ensures:
666   */
667 -       extern DSP_STATUS CMM_GetHandle(DSP_HPROCESSOR hProcessor,
668 +       extern DSP_STATUS CMM_GetHandle(void *hProcessor,
669                                         OUT struct CMM_OBJECT **phCmmMgr);
670  
671  /*
672 @@ -261,7 +227,7 @@
673                                                unsigned int dwGPPBasePA,
674                                                u32 ulSize,
675                                                u32 dwDSPAddrOffset,
676 -                                              enum CMM_CNVTTYPE cFactor,
677 +                                              s8  cFactor,
678                                                unsigned int dwDSPBase,
679                                                u32 ulDSPSize,
680                                                u32 *pulSegId,
681 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/cmmdefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/cmmdefs.h
682 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/cmmdefs.h     2011-04-17 17:32:26.000000000 +0100
683 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/cmmdefs.h  2011-05-02 22:36:48.000000000 +0100
684 @@ -3,6 +3,8 @@
685   *
686   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
687   *
688 + * Global MEM constants and types.
689 + *
690   * Copyright (C) 2008 Texas Instruments, Inc.
691   *
692   * This package is free software; you can redistribute it and/or modify
693 @@ -14,24 +16,6 @@
694   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
695   */
696  
697 -
698 -/*
699 - *  ======== cmmdefs.h ========
700 - *  Purpose:
701 - *      Global MEM constants and types.
702 - *
703 - *! Revision History:
704 - *! ================
705 - *! 12-Nov-2001 ag  CMM_KERNMAPTYPE added for dsp<->device process addr map'n.
706 - *!                 This allows addr conversion from drvr process <-> DSP addr.
707 - *! 29-Aug-2001 ag  Added CMM_ALLSEGMENTS.
708 - *! 08-Dec-2000 ag  Added bus address conversion type CMM_POMAPEMIF2DSPBUS.
709 - *! 05-Dec-2000 ag  Added default CMM_DEFLTCONVFACTOR & CMM_DEFLTDSPADDROFFSET.
710 - *! 29-Oct-2000 ag  Added converstion factor for GPP DSP Pa translation.
711 - *! 15-Oct-2000 ag  Added address translator attributes and defaults.
712 - *! 12-Jul-2000 ag  Created.
713 - */
714 -
715  #ifndef CMMDEFS_
716  #define CMMDEFS_
717  
718 @@ -55,15 +39,9 @@
719   *  For typical platforms:
720   *      converted Address = PaDSP + ( cFactor * addressToConvert).
721   */
722 -       enum CMM_CNVTTYPE {
723 -               CMM_SUBFROMDSPPA = -1,
724 -               /* PreOMAP is special case: not simple offset */
725 -               CMM_POMAPEMIF2DSPBUS = 0,
726 -               CMM_ADDTODSPPA = 1
727 -       } ;
728 +#define CMM_SUBFROMDSPPA       -1
729 +#define CMM_ADDTODSPPA         1
730  
731 -#define CMM_DEFLTDSPADDROFFSET  0
732 -#define CMM_DEFLTCONVFACTOR     CMM_POMAPEMIF2DSPBUS /* PreOMAP DSPBUS<->EMIF */
733  #define CMM_ALLSEGMENTS         0xFFFFFF       /* All SegIds */
734  #define CMM_MAXGPPSEGS          1      /* Maximum # of SM segs */
735  
736 @@ -121,14 +99,6 @@
737                 CMM_DSPPA2PA = 4,       /* DSP Pa to GPP Pa */
738         } ;
739  
740 -/*
741 - *  Used to "map" between device process virt addr and dsp addr.
742 - */
743 -       enum CMM_KERNMAPTYPE {
744 -               CMM_KERNVA2DSP = 0, /* Device process context to dsp address. */
745 -               CMM_DSP2KERNVA = 1, /* Dsp address to device process context. */
746 -       } ;
747 -
748         struct CMM_OBJECT;
749         struct CMM_XLATOROBJECT;
750  
751 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/cod.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/cod.h
752 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/cod.h 2011-04-17 17:32:26.000000000 +0100
753 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/cod.h      2011-05-02 22:36:48.000000000 +0100
754 @@ -3,6 +3,10 @@
755   *
756   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
757   *
758 + * Code management module for DSPs. This module provides an interface
759 + * interface for loading both static and dynamic code objects onto DSP
760 + * systems.
761 + *
762   * Copyright (C) 2005-2006 Texas Instruments, Inc.
763   *
764   * This package is free software; you can redistribute it and/or modify
765 @@ -14,60 +18,6 @@
766   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
767   */
768  
769 -
770 -/*
771 - *  ======== cod.h ========
772 - *  Description:
773 - *      Code management module for DSPs. This module provides an interface
774 - *      interface for loading both static and dynamic code objects onto DSP
775 - *      systems.
776 - *
777 - *  Public Functions:
778 - *      COD_Close
779 - *      COD_Create
780 - *      COD_Delete
781 - *      COD_Exit
782 - *      COD_GetBaseLib
783 - *      COD_GetBaseName
784 - *      COD_GetLoader
785 - *      COD_GetSection
786 - *      COD_GetSymValue
787 - *      COD_Init
788 - *      COD_LoadBase
789 - *      COD_Open
790 - *      COD_OpenBase
791 - *      COD_ReadSection
792 - *      COD_UnloadSection
793 - *
794 - *  Note:
795 - *      Currently, only static loading is supported.
796 - *
797 - *! Revision History
798 - *! ================
799 - *! 08-Apr-2003 map: Changed DBL to DBLL
800 - *! 07-Aug-2002 jeh: Added COD_GetBaseName().
801 - *! 17-Jul-2002 jeh: Added COD_Open(), COD_Close().
802 - *! 15-Mar-2002 jeh: Added DBL_Flags param to COD_OpenBase().
803 - *! 19-Oct-2001 jeh: Added COD_GetBaseLib, COD_GetLoader, (left in
804 - *!                  COD_LoadSection(), COD_UnloadSection(), since they
805 - *!                  may be needed for BridgeLite).
806 - *! 07-Sep-2001 jeh: Added COD_LoadSection(), COD_UnloadSection().
807 - *! 11-Jan-2001 jeh: Added COD_OpenBase.
808 - *! 29-Sep-2000 kc:  Added size param to COD_ReadSection for input buffer
809 - *!                  validation.
810 - *! 02-Aug-2000 kc:  Added COD_ReadSection.
811 - *! 04-Sep-1997 gp:  Added CDECL identifier to COD_WRITEFXN (for NT)..
812 - *! 18-Aug-1997 cr:  Added explicit CDECL identifier.
813 - *! 28-Oct-1996 gp:  Added COD_GetSection.
814 - *! 30-Jul-1996 gp:  Added envp[] argument to COD_LoadBase().
815 - *! 12-Jun-1996 gp:  Moved OUT param first in _Create().  Updated _Create()
816 - *!                  call to take a ZLFileName.  Moved COD_ processor types
817 - *!                  to CFG.
818 - *! 29-May-1996 gp:  Changed WCD_STATUS to DSP_STATUS.  Removed include's.
819 - *! 07-May-1996 mg:  Created.
820 - *
821 - */
822 -
823  #ifndef COD_
824  #define COD_
825  
826 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/csl.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/csl.h
827 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/csl.h 2011-04-17 17:32:26.000000000 +0100
828 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/csl.h      1970-01-01 01:00:00.000000000 +0100
829 @@ -1,135 +0,0 @@
830 -/*
831 - * csl.h
832 - *
833 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
834 - *
835 - * Copyright (C) 2008 Texas Instruments, Inc.
836 - *
837 - * This package is free software; you can redistribute it and/or modify
838 - * it under the terms of the GNU General Public License version 2 as
839 - * published by the Free Software Foundation.
840 - *
841 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
842 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
843 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
844 - */
845 -
846 -/*
847 - *  ======== csl.h ========
848 - *  Purpose:
849 - *      Platform independent C Standard library functions.
850 - *
851 - *  Public Functions:
852 - *      CSL_AnsiToWchar
853 - *      CSL_ByteSwap
854 - *      CSL_Exit
855 - *      CSL_Init
856 - *      CSL_NumToAscii
857 - *      CSL_Strtok
858 - *      CSL_Strtokr
859 - *      CSL_WcharToAnsi
860 - *
861 - *! Revision History:
862 - *! ================
863 - *! 07-Aug-2002 jeh: Added CSL_Strtokr().
864 - *! 21-Sep-2001 jeh: Added CSL_Strncmp.
865 - *! 22-Nov-2000 map: Added CSL_Atoi and CSL_Strtok
866 - *! 19-Nov-2000 kc:  Added CSL_ByteSwap().
867 - *! 09-Nov-2000 kc:  Added CSL_Strncat.
868 - *! 29-Oct-1999 kc:  Added CSL_Wstrlen().
869 - *! 20-Sep-1999 ag:  Added CSL_Wchar2Ansi().
870 - *! 19-Jan-1998 cr:  Code review cleanup (mostly documentation fixes).
871 - *! 29-Dec-1997 cr:  Changed CSL_lowercase to CSL_Uppercase, added
872 - *!                  CSL_AnsiToWchar.
873 - *! 30-Sep-1997 cr:  Added explicit cdecl descriptors to fxn definitions.
874 - *! 25-Jun-1997 cr:  Added CSL_strcmp.
875 - *! 12-Jun-1996 gp:  Created.
876 - */
877 -
878 -#ifndef CSL_
879 -#define CSL_
880 -
881 -#include <dspbridge/host_os.h>
882 -
883 -/*
884 - *  ======== CSL_Exit ========
885 - *  Purpose:
886 - *      Discontinue usage of the CSL module.
887 - *  Parameters:
888 - *  Returns:
889 - *  Requires:
890 - *      CSL initialized.
891 - *  Ensures:
892 - *      Resources acquired in CSL_Init(void) are freed.
893 - */
894 -       extern void CSL_Exit(void);
895 -
896 -/*
897 - *  ======== CSL_Init ========
898 - *  Purpose:
899 - *      Initialize the CSL module's private state.
900 - *  Parameters:
901 - *  Returns:
902 - *      TRUE if initialized; FALSE if error occured.
903 - *  Requires:
904 - *  Ensures:
905 - *      A requirement for each of the other public CSL functions.
906 - */
907 -       extern bool CSL_Init(void);
908 -
909 -/*
910 - *  ======== CSL_NumToAscii ========
911 - *  Purpose:
912 - *      Convert a 1 or 2 digit number to a 2 digit string.
913 - *  Parameters:
914 - *      pstrNumber: Buffer to store converted string.
915 - *      dwNum:      Number to convert.
916 - *  Returns:
917 - *  Requires:
918 - *      pstrNumber must be able to hold at least three characters.
919 - *  Ensures:
920 - *      pstrNumber will be null terminated.
921 - */
922 -       extern void CSL_NumToAscii(OUT char *pstrNumber, IN u32 dwNum);
923 -
924 -
925 -/*
926 - *  ======== CSL_Strtok ========
927 - *  Purpose:
928 - *      Tokenize a NULL terminated string
929 - *  Parameters:
930 - *      ptstrSrc:       pointer to string.
931 - *      szSeparators:   pointer to a string of seperators
932 - *  Returns:
933 - *      char *
934 - *  Requires:
935 - *      CSL initialized.
936 - *      ptstrSrc is a valid string pointer.
937 - *      szSeparators is a valid string pointer.
938 - *  Ensures:
939 - */
940 -       extern char *CSL_Strtok(IN char *ptstrSrc,
941 -                               IN CONST char *szSeparators);
942 -
943 -/*
944 - *  ======== CSL_Strtokr ========
945 - *  Purpose:
946 - *      Re-entrant version of strtok.
947 - *  Parameters:
948 - *      pstrSrc:        Pointer to string. May be NULL on subsequent calls.
949 - *      szSeparators:   Pointer to a string of seperators
950 - *      ppstrCur:       Location to store start of string for next call to
951 - *                      to CSL_Strtokr.
952 - *  Returns:
953 - *      char * (the token)
954 - *  Requires:
955 - *      CSL initialized.
956 - *      szSeparators != NULL
957 - *      ppstrCur != NULL
958 - *  Ensures:
959 - */
960 -       extern char *CSL_Strtokr(IN char *pstrSrc,
961 -                                IN CONST char *szSeparators,
962 -                                OUT char **ppstrCur);
963 -
964 -#endif                         /* CSL_ */
965 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbc.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbc.h
966 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbc.h 2011-04-17 17:32:26.000000000 +0100
967 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbc.h      2011-05-02 22:36:48.000000000 +0100
968 @@ -3,6 +3,14 @@
969   *
970   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
971   *
972 + * "Design by Contract" programming macros.
973 + *
974 + * Notes:
975 + *   Requires that the GT->ERROR function has been defaulted to a valid
976 + *   error handler for the given execution environment.
977 + *
978 + *   Does not require that GT_init() be called.
979 + *
980   * Copyright (C) 2008 Texas Instruments, Inc.
981   *
982   * This package is free software; you can redistribute it and/or modify
983 @@ -14,28 +22,6 @@
984   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
985   */
986  
987 -/*
988 - *  ======== dbc.h ========
989 - *  Purpose:
990 - *      "Design by Contract" programming macros.
991 - *
992 - *  Public Functions:
993 - *      DBC_Assert
994 - *      DBC_Require
995 - *      DBC_Ensure
996 - *
997 - *  Notes:
998 - *      Requires that the GT->ERROR function has been defaulted to a valid
999 - *      error handler for the given execution environment.
1000 - *
1001 - *      Does not require that GT_init() be called.
1002 - *
1003 - *! Revision History:
1004 - *! ================
1005 - *! 11-Aug-2000 ag: Removed include <dspbridge/std.h>
1006 - *! 22-Apr-1996 gp: Created.
1007 - */
1008 -
1009  #ifndef DBC_
1010  #define DBC_
1011  
1012 @@ -48,10 +34,12 @@
1013  
1014  #include <dspbridge/gt.h>
1015  
1016 -#define DBC_Assert(exp) \
1017 -    if (!(exp)) \
1018 -       printk("%s, line %d: Assertion (" #exp ") failed.\n", \
1019 -       __FILE__, __LINE__)
1020 +#define DBC_Assert(exp)                                                       \
1021 +do {                                                                          \
1022 +       if (!(exp))                                                            \
1023 +               pr_err("%s, line %d: Assertion (" #exp ") failed.\n", \
1024 +               __FILE__, __LINE__);                                           \
1025 +} while (0)
1026  #define DBC_Require DBC_Assert /* Function Precondition.  */
1027  #define DBC_Ensure  DBC_Assert /* Function Postcondition. */
1028  
1029 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbdcd.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbdcd.h
1030 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbdcd.h       2011-04-17 17:32:26.000000000 +0100
1031 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbdcd.h    2011-05-02 22:36:48.000000000 +0100
1032 @@ -3,6 +3,8 @@
1033   *
1034   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1035   *
1036 + * Defines the DSP/BIOS Bridge Configuration Database (DCD) API.
1037 + *
1038   * Copyright (C) 2008 Texas Instruments, Inc.
1039   *
1040   * This package is free software; you can redistribute it and/or modify
1041 @@ -14,30 +16,6 @@
1042   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1043   */
1044  
1045 -/*
1046 - *  ======== dbdcd.h ========
1047 - *  Description:
1048 - *      Defines the DSP/BIOS Bridge Configuration Database (DCD) API.
1049 - *
1050 - *! Revision History
1051 - *! ================
1052 - *! 03-Dec-2003 map Changed DCD_OBJTYPE to DSP_DCDOBJTYPE
1053 - *! 24-Feb-2003 kc  Updated DCD_AutoUnregister and DCD_GetObjects to simplify
1054 - *!                 DCD implementation.
1055 - *! 05-Aug-2002 jeh Added DCD_GetObjects().
1056 - *! 11-Jul-2002 jeh Added DCD_GetDepLibs(), DCD_GetNumDepLibs().
1057 - *! 22-Apr-2002 jeh Added DCD_GetLibraryName().
1058 - *! 03-Apr-2001 sg  Changed error names to have DCD_E* format.
1059 - *! 13-Feb-2001 kc  Name changed from dcdbs.h to dbdcd.h.
1060 - *! 12-Dec-2000 kc  Added DCD_AutoUnregister.
1061 - *! 09-Nov-2000 kc  Updated usage of DCD_EnumerateObject.
1062 - *! 30-Oct-2000 kc  Added DCD_AutoRegister. Updated error DCD error codes.
1063 - *! 29-Sep-2000 kc  Incorporated code review comments. See
1064 - *!                 /src/reviews/dcd_review.txt.
1065 - *! 26-Jul-2000 kc  Created.
1066 - *!
1067 - */
1068 -
1069  #ifndef DBDCD_
1070  #define DBDCD_
1071  
1072 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbdcddef.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbdcddef.h
1073 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbdcddef.h    2011-04-17 17:32:26.000000000 +0100
1074 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbdcddef.h 2011-05-02 22:36:48.000000000 +0100
1075 @@ -3,6 +3,8 @@
1076   *
1077   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1078   *
1079 + * DCD (DSP/BIOS Bridge Configuration Database) constants and types.
1080 + *
1081   * Copyright (C) 2008 Texas Instruments, Inc.
1082   *
1083   * This package is free software; you can redistribute it and/or modify
1084 @@ -14,31 +16,6 @@
1085   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1086   */
1087  
1088 -
1089 -/*
1090 - *  ======== dbdcddef.h ========
1091 - *  Description:
1092 - *      DCD (DSP/BIOS Bridge Configuration Database) constants and types.
1093 - *
1094 - *! Revision History:
1095 - *! ================
1096 - *! 03-Dec-2003 map Moved and renamed DCD_OBJTYPE to DSP_DCDOBJTYPE in dbdefs.h
1097 - *! 05-Dec-2002 map Added DCD_CREATELIBTYPE, DCD_EXECUTELIBTYPE,
1098 - *                        DCD_DELETELIBTYPE
1099 - *! 24-Feb-2003 kc  Updated REG entry names to DspBridge.
1100 - *! 22-Nov-2002 gp  Cleaned up comments, formatting.
1101 - *! 05-Aug-2002 jeh Added DCD_REGISTERFXN.
1102 - *! 19-Apr-2002 jeh Added DCD_LIBRARYTYPE to DCD_OBJTYPE, dynamic load
1103 - *!                 properties to DCD_NODEPROPS.
1104 - *! 29-Jul-2001 ag  Added extended procObj.
1105 - *! 13-Feb-2001 kc: Named changed from dcdbsdef.h dbdcddef.h.
1106 - *! 12-Dec-2000 jeh Added DAIS iAlg name to DCD_NODEPROPS.
1107 - *! 30-Oct-2000 kc: Added #defines for DCD_AutoRegister function.
1108 - *! 05-Sep-2000 jeh Added DCD_NODEPROPS.
1109 - *! 12-Aug-2000 kc: Incoroporated the use of types defined in <dspdefs.h>.
1110 - *! 29-Jul-2000 kc: Created.
1111 - */
1112 -
1113  #ifndef DBDCDDEF_
1114  #define DBDCDDEF_
1115  
1116 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbdefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbdefs.h
1117 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbdefs.h      2011-04-17 17:32:26.000000000 +0100
1118 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbdefs.h   2011-05-02 22:36:48.000000000 +0100
1119 @@ -3,6 +3,8 @@
1120   *
1121   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1122   *
1123 + * Global definitions and constants for DSP/BIOS Bridge.
1124 + *
1125   * Copyright (C) 2005-2006 Texas Instruments, Inc.
1126   *
1127   * This package is free software; you can redistribute it and/or modify
1128 @@ -14,65 +16,14 @@
1129   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1130   */
1131  
1132 -/*
1133 - *  ======== dbdefs.h ========
1134 - *  Description:
1135 - *      Global definitions and constants for DSP/BIOS Bridge.
1136 - *
1137 - *! Revision History:
1138 - *! ================
1139 - *! 19-Apr-2004 sb  Aligned DMM definitions with Symbian
1140 - *! 08-Mar-2004 sb  Added MAPATTR & ELEM_SIZE for Dynamic Memory Mapping feature
1141 - *! 09-Feb-2004 vp  Added processor ID numbers for DSP and IVA
1142 - *! 06-Feb-2003 kc  Removed DSP_POSTMESSAGE. Updated IsValid*Event macros.
1143 - *! 22-Nov-2002 gp  Cleaned up comments, formatting.
1144 - *!                 Removed unused DSP_ENUMLASTNODE define.
1145 - *! 13-Feb-2002 jeh Added uSysStackSize to DSP_NDBPROPS.
1146 - *! 23-Jan-2002 ag  Added #define DSP_SHMSEG0.
1147 - *! 12-Dec-2001 ag  Added DSP_ESTRMMODE error code.
1148 - *! 04-Dec-2001 jeh Added DSP_ENOTCONNECTED error code.
1149 - *! 10-Dec-2001 kc: Modified macros and definitions to disable DSP_POSTMESSAGE.
1150 - *! 01-Nov-2001 jeh Added DSP_EOVERLAYMEMORY.
1151 - *! 18-Oct-2001 ag  Added DSP_STRMMODE type.
1152 - *!                 Added DSP_ENOTSHAREDMEM.
1153 - *! 21-Sep-2001 ag  Added additional error codes.
1154 - *! 07-Jun-2001 sg  Made DSPStream_AllocateBuffer fxn name plural.
1155 - *! 11-May-2001 jeh Changed DSP_NODE_MIN_PRIORITY from 0 to 1. Removed hNode
1156 - *!                 from DSP_NODEINFO.
1157 - *! 02-Apr-2001 sg  Added missing error codes, rearranged codes, switched to
1158 - *!             hex offsets, renamed some codes to match API spec.
1159 - *! 16-Jan-2001 jeh Added DSP_ESYMBOL, DSP_EUUID.
1160 - *! 13-Feb-2001 kc: DSP/BIOS Bridge name updates.
1161 - *! 05-Dec-2000 ag: Added DSP_RMSxxx user available message command codes.
1162 - *! 09-Nov-2000 rr: Added DSP_PROCEESORRESTART define; Removed DSP_PBUFFER.
1163 - *!                 Added DSP_DCD_ENOAUTOREGISTER, DSP_EUSER1-16, DSP_ESTRMFUL
1164 - *!                 Removed DSP_EDONE. Macros's modified.
1165 - *! 23-Oct-2000 jeh Replaced DSP_STREAMSTATECHANGE with DSP_STREAMDONE.
1166 - *! 09-Oct-2000 jeh Updated to version 0.9 DSP Bridge API spec.
1167 - *! 29-Sep-2000 kc  Added error codes for DCD and REG to simplify use of
1168 - *!                 these codes within the RM module.
1169 - *! 27-Sep-2000 jeh Added segid, alignment, uNumBufs to DSP_STREAMATTRIN.
1170 - *! 29-Aug-2000 jeh Added DSP_NODETYPE enum, changed DSP_EALREADYATTACHED to
1171 - *!                 DSP_EALREADYCONNECTED. Changed scStreamConnection[1]
1172 - *!                 to scStreamConnection[16] in DSP_NODEINFO structure.
1173 - *!                 Added DSP_NOTIFICATION, DSP_STRMATTR. PSTRING changed
1174 - *!                 back to TCHAR * and moved to dbtype.h.
1175 - *! 11-Aug-2000 rr: Macros to check valid events and notify masks added.
1176 - *! 09-Aug-2000 rr: Changed PSTRING to *s8
1177 - *! 07-Aug-2000 rr: PROC_IDLE/SYNCINIT/UNKNOWN state removed.
1178 - *! 20-Jul-2000 rr: Updated to version 0.8
1179 - *! 17-Jul-2000 rr: New PROC states added to the DSP_PROCSTATE.
1180 - *! 27-Jun-2000 rr: Created from dspapi.h
1181 - */
1182 -
1183  #ifndef DBDEFS_
1184  #define DBDEFS_
1185  
1186  #include <linux/types.h>
1187  
1188 -#include <dspbridge/dbtype.h>          /* GPP side type definitions           */
1189 -#include <dspbridge/std.h>             /* DSP/BIOS type definitions           */
1190 -#include <dspbridge/rms_sh.h>          /* Types shared between GPP and DSP    */
1191 +#include <dspbridge/dbtype.h>          /* GPP side type definitions */
1192 +#include <dspbridge/std.h>             /* DSP/BIOS type definitions */
1193 +#include <dspbridge/rms_sh.h>          /* Types shared between GPP and DSP */
1194  
1195  #define PG_SIZE_4K 4096
1196  #define PG_MASK(pg_size) (~((pg_size)-1))
1197 @@ -155,17 +106,12 @@
1198  
1199  #define    MAX_PROFILES     16
1200  
1201 +/* DSP chip type */
1202 +#define DSPTYPE_64     0x99
1203 +
1204  /* Types defined for 'Bridge API */
1205         typedef u32 DSP_STATUS; /* API return code type         */
1206  
1207 -       typedef HANDLE DSP_HNODE;       /* Handle to a DSP Node object  */
1208 -       typedef HANDLE DSP_HPROCESSOR;  /* Handle to a Processor object */
1209 -       typedef HANDLE DSP_HSTREAM;     /* Handle to a Stream object    */
1210 -
1211 -       typedef u32 DSP_PROCFAMILY;     /* Processor family             */
1212 -       typedef u32 DSP_PROCTYPE;       /* Processor type (w/in family) */
1213 -       typedef u32 DSP_RTOSTYPE;       /* Type of DSP RTOS             */
1214 -
1215  /* Handy Macros */
1216  #define IsValidProcEvent(x) (((x) == 0) || (((x) & (DSP_PROCESSORSTATECHANGE | \
1217                                     DSP_PROCESSORATTACH | \
1218 @@ -217,7 +163,9 @@
1219                 DSP_DCDLIBRARYTYPE,
1220                 DSP_DCDCREATELIBTYPE,
1221                 DSP_DCDEXECUTELIBTYPE,
1222 -               DSP_DCDDELETELIBTYPE
1223 +               DSP_DCDDELETELIBTYPE,
1224 +               /* DSP_DCDMAXOBJTYPE is meant to be the last DCD object type */
1225 +               DSP_DCDMAXOBJTYPE
1226         } ;
1227  
1228  /* Processor states */
1229 @@ -371,7 +319,7 @@
1230                 u32 cbStruct;
1231                 enum DSP_CONNECTTYPE lType;
1232                 u32 uThisNodeStreamIndex;
1233 -               DSP_HNODE hConnectedNode;
1234 +               void *hConnectedNode;
1235                 struct DSP_UUID uiConnectedNodeID;
1236                 u32 uConnectedNodeStreamIndex;
1237         } ;
1238 @@ -421,7 +369,7 @@
1239                 struct DSP_NDBPROPS nbNodeDatabaseProps;
1240                 u32 uExecutionPriority;
1241                 enum NODE_STATE nsExecutionState;
1242 -               DSP_HNODE hDeviceOwner;
1243 +               void *hDeviceOwner;
1244                 u32 uNumberStreams;
1245                 struct DSP_STREAMCONNECT scStreamConnection[16];
1246                 u32 uNodeEnv;
1247 @@ -450,26 +398,19 @@
1248                 u32 cbStruct;
1249                 u32 uTimeout;
1250         } ;
1251 -
1252 -       enum chipTypes {
1253 -               DSPTYPE_55 = 6,
1254 -               IVA_ARM7 = 0x97,
1255 -               DSPTYPE_64 = 0x99
1256 -       };
1257 -
1258  /*
1259   * The DSP_PROCESSORINFO structure describes basic capabilities of a
1260   * DSP processor
1261   */
1262         struct DSP_PROCESSORINFO {
1263                 u32 cbStruct;
1264 -               DSP_PROCFAMILY uProcessorFamily;
1265 -               DSP_PROCTYPE uProcessorType;
1266 +               long uProcessorFamily;
1267 +               long uProcessorType;
1268                 u32 uClockRate;
1269                 u32 ulInternalMemSize;
1270                 u32 ulExternalMemSize;
1271                 u32 uProcessorID;
1272 -               DSP_RTOSTYPE tyRunningRTOS;
1273 +               long tyRunningRTOS;
1274                 s32 nNodeMinPriority;
1275                 s32 nNodeMaxPriority;
1276         } ;
1277 @@ -580,4 +521,30 @@ bit 6 - MMU element size = 64bit (valid 
1278  #define GEM_CACHE_LINE_SIZE     128
1279  #define GEM_L1P_PREFETCH_SIZE   128
1280  
1281 +
1282 +/*
1283 + * Definitions from dbreg.h
1284 + */
1285 +
1286 +#define DSPPROCTYPE_C64                6410
1287 +#define IVAPROCTYPE_ARM7       470
1288 +
1289 +#define REG_MGR_OBJECT 1
1290 +#define REG_DRV_OBJECT 2
1291 +
1292 +/* registry */
1293 +#define DRVOBJECT      "DrvObject"
1294 +#define MGROBJECT      "MgrObject"
1295 +
1296 +/* Max registry path length. Also the max registry value length. */
1297 +#define MAXREGPATHLENGTH       255
1298 +
1299 +/* MiniDriver related definitions */
1300 +#define DEFEXEC                "DefaultExecutable"     /* Default executable */
1301 +#define AUTOSTART      "AutoStart"             /* Statically load flag */
1302 +#define CURRENTCONFIG  "CurrentConfig"         /* Current resources */
1303 +#define SHMSIZE                "SHMSize"               /* Size of SHM reservd on MPU */
1304 +#define TCWORDSWAP     "TCWordSwap"            /* Traffic Controller WordSwp */
1305 +#define DSPRESOURCES   "DspTMSResources"       /* C55 DSP resurces on OMAP */
1306 +
1307  #endif                         /* DBDEFS_ */
1308 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbg.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbg.h
1309 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbg.h 2011-04-17 17:32:26.000000000 +0100
1310 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbg.h      2011-05-02 22:36:48.000000000 +0100
1311 @@ -3,6 +3,8 @@
1312   *
1313   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1314   *
1315 + * Provide debugging services for Bridge Mini Drivers.
1316 + *
1317   * Copyright (C) 2008 Texas Instruments, Inc.
1318   *
1319   * This package is free software; you can redistribute it and/or modify
1320 @@ -14,29 +16,6 @@
1321   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1322   */
1323  
1324 -/*
1325 - *  ======== dbg.h ========
1326 - *  Purpose:
1327 - *      Provide debugging services for 'Bridge Mini Drivers.
1328 - *
1329 - *  Public Functions:
1330 - *      DBG_Exit
1331 - *      DBG_Init
1332 - *      DBG_Printf
1333 - *      DBG_Trace
1334 - *
1335 - *  Notes:
1336 - *      WMD's must not call DBG_Init or DBG_Exit.
1337 - *
1338 - *! Revision History:
1339 - *! ================
1340 - *! 03-Feb-2000 rr: DBG Levels redefined.
1341 - *! 29-Oct-1999 kc: Cleaned up for code review.
1342 - *! 10-Oct-1997 cr: Added DBG_Printf service.
1343 - *! 29-May-1996 gp: Removed WCD_ prefix.
1344 - *! 15-May-1996 gp: Created.
1345 - */
1346 -
1347  #ifndef DBG_
1348  #define DBG_
1349  #include <dspbridge/host_os.h>
1350 @@ -52,7 +31,7 @@
1351  #define DBG_LEVEL6  (u8)(0x40) /* Warn SERVICES Failures */
1352  #define DBG_LEVEL7  (u8)(0x80) /* Warn Critical Errors */
1353  
1354 -#if (defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
1355 +#if (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
1356  
1357  /*
1358   *  ======== DBG_Exit ========
1359 @@ -105,6 +84,6 @@
1360  #define DBG_Init(void) true
1361  #define DBG_Trace(bLevel, pstrFormat, args...) do {} while (0)
1362  
1363 -#endif      /* (defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE */
1364 +#endif      /* (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE */
1365  
1366  #endif                         /* DBG_ */
1367 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbl.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbl.h
1368 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbl.h 2011-04-17 17:32:26.000000000 +0100
1369 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbl.h      1970-01-01 01:00:00.000000000 +0100
1370 @@ -1,354 +0,0 @@
1371 -/*
1372 - * dbl.h
1373 - *
1374 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1375 - *
1376 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
1377 - *
1378 - * This package is free software; you can redistribute it and/or modify
1379 - * it under the terms of the GNU General Public License version 2 as
1380 - * published by the Free Software Foundation.
1381 - *
1382 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1383 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1384 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1385 - */
1386 -
1387 -
1388 -/*
1389 - *  ======== dbl.h ========
1390 - *
1391 - *! Revision History
1392 - *! ================
1393 - *! 19-Mar-2002 jeh     Pass DBL_Symbol pointer to DBL_getAddr, DBL_getCAddr
1394 - *!                     to accomodate dynamic loader library.
1395 - *! 20-Nov-2001 jeh     Removed DBL_loadArgs().
1396 - *! 24-Sep-2001 jeh     Code review changes.
1397 - *! 07-Sep-2001 jeh     Added DBL_LoadSect(), DBL_UnloadSect().
1398 - *! 05-Jun-2001 jeh     Created based on zl.h.
1399 - */
1400 -
1401 -#ifndef DBL_
1402 -#define DBL_
1403 -
1404 -#include <dspbridge/dbdefs.h>
1405 -#include <dspbridge/dbldefs.h>
1406 -
1407 -/*
1408 - *  ======== DBL_close ========
1409 - *  Close library opened with DBL_open.
1410 - *  Parameters:
1411 - *      lib             - Handle returned from DBL_open().
1412 - *  Returns:
1413 - *  Requires:
1414 - *      DBL initialized.
1415 - *      Valid lib.
1416 - *  Ensures:
1417 - */
1418 -       extern void DBL_close(struct DBL_LibraryObj *lib);
1419 -
1420 -/*
1421 - *  ======== DBL_create ========
1422 - *  Create a target object by specifying the alloc, free, and write
1423 - *  functions for the target.
1424 - *  Parameters:
1425 - *      pTarget         - Location to store target handle on output.
1426 - *      pAttrs          - Attributes.
1427 - *  Returns:
1428 - *      DSP_SOK:        Success.
1429 - *      DSP_EMEMORY:    Memory allocation failed.
1430 - *  Requires:
1431 - *      DBL initialized.
1432 - *      pAttrs != NULL.
1433 - *      pTarget != NULL;
1434 - *  Ensures:
1435 - *      Success:        *pTarget != NULL.
1436 - *      Failure:        *pTarget == NULL.
1437 - */
1438 -       extern DSP_STATUS DBL_create(struct DBL_TargetObj **pTarget,
1439 -                                    struct DBL_Attrs *pAttrs);
1440 -
1441 -/*
1442 - *  ======== DBL_delete ========
1443 - *  Delete target object and free resources for any loaded libraries.
1444 - *  Parameters:
1445 - *      target          - Handle returned from DBL_Create().
1446 - *  Returns:
1447 - *  Requires:
1448 - *      DBL initialized.
1449 - *      Valid target.
1450 - *  Ensures:
1451 - */
1452 -       extern void DBL_delete(struct DBL_TargetObj *target);
1453 -
1454 -/*
1455 - *  ======== DBL_exit ========
1456 - *  Discontinue use of DBL module.
1457 - *  Parameters:
1458 - *  Returns:
1459 - *  Requires:
1460 - *      cRefs > 0.
1461 - *  Ensures:
1462 - *      cRefs >= 0.
1463 - */
1464 -       extern void DBL_exit(void);
1465 -
1466 -/*
1467 - *  ======== DBL_getAddr ========
1468 - *  Get address of name in the specified library.
1469 - *  Parameters:
1470 - *      lib             - Handle returned from DBL_open().
1471 - *      name            - Name of symbol
1472 - *      ppSym           - Location to store symbol address on output.
1473 - *  Returns:
1474 - *      TRUE:           Success.
1475 - *      FALSE:          Symbol not found.
1476 - *  Requires:
1477 - *      DBL initialized.
1478 - *      Valid lib.
1479 - *      name != NULL.
1480 - *      pAddr != NULL.
1481 - *  Ensures:
1482 - */
1483 -       extern bool DBL_getAddr(struct DBL_LibraryObj *lib, char *name,
1484 -                               struct DBL_Symbol **ppSym);
1485 -
1486 -/*
1487 - *  ======== DBL_getAttrs ========
1488 - *  Retrieve the attributes of the target.
1489 - *  Parameters:
1490 - *      target          - Handle returned from DBL_Create().
1491 - *      pAttrs          - Location to store attributes on output.
1492 - *  Returns:
1493 - *  Requires:
1494 - *      DBL initialized.
1495 - *      Valid target.
1496 - *      pAttrs != NULL.
1497 - *  Ensures:
1498 - */
1499 -       extern void DBL_getAttrs(struct DBL_TargetObj *target,
1500 -                                struct DBL_Attrs *pAttrs);
1501 -
1502 -/*
1503 - *  ======== DBL_getCAddr ========
1504 - *  Get address of "C" name in the specified library.
1505 - *  Parameters:
1506 - *      lib             - Handle returned from DBL_open().
1507 - *      name            - Name of symbol
1508 - *      ppSym           - Location to store symbol address on output.
1509 - *  Returns:
1510 - *      TRUE:           Success.
1511 - *      FALSE:          Symbol not found.
1512 - *  Requires:
1513 - *      DBL initialized.
1514 - *      Valid lib.
1515 - *      name != NULL.
1516 - *      pAddr != NULL.
1517 - *  Ensures:
1518 - */
1519 -       extern bool DBL_getCAddr(struct DBL_LibraryObj *lib, char *name,
1520 -                                struct DBL_Symbol **ppSym);
1521 -
1522 -/*
1523 - *  ======== DBL_getEntry ========
1524 - *  Get program entry point.
1525 - *
1526 - *  Parameters:
1527 - *      lib             - Handle returned from DBL_open().
1528 - *      pEntry          - Location to store entry address on output.
1529 - *  Returns:
1530 - *      TRUE:           Success.
1531 - *      FALSE:          Failure.
1532 - *  Requires:
1533 - *      DBL initialized.
1534 - *      Valid lib.
1535 - *      pEntry != NULL.
1536 - *  Ensures:
1537 - */
1538 -       extern bool DBL_getEntry(struct DBL_LibraryObj *lib, u32 *pEntry);
1539 -
1540 -/*
1541 - *  ======== DBL_getSect ========
1542 - *  Get address and size of a named section.
1543 - *  Parameters:
1544 - *      lib             - Library handle returned from DBL_open().
1545 - *      name            - Name of section.
1546 - *      pAddr           - Location to store section address on output.
1547 - *      pSize           - Location to store section size on output.
1548 - *  Returns:
1549 - *      DSP_SOK:        Success.
1550 - *      DSP_ENOSECT:    Section not found.
1551 - *  Requires:
1552 - *      DBL initialized.
1553 - *      Valid lib.
1554 - *      name != NULL.
1555 - *      pAddr != NULL;
1556 - *      pSize != NULL.
1557 - *  Ensures:
1558 - */
1559 -       extern DSP_STATUS DBL_getSect(struct DBL_LibraryObj *lib, char *name,
1560 -                                     u32 *pAddr, u32 *pSize);
1561 -
1562 -/*
1563 - *  ======== DBL_init ========
1564 - *  Initialize DBL module.
1565 - *  Parameters:
1566 - *  Returns:
1567 - *      TRUE:           Success.
1568 - *      FALSE:          Failure.
1569 - *  Requires:
1570 - *      cRefs >= 0.
1571 - *  Ensures:
1572 - *      Success:        cRefs > 0.
1573 - *      Failure:        cRefs >= 0.
1574 - */
1575 -       extern bool DBL_init(void);
1576 -
1577 -/*
1578 - *  ======== DBL_load ========
1579 - *  Add symbols/code/data defined in file to that already present on
1580 - *  the target.
1581 - *
1582 - *  Parameters:
1583 - *      lib             - Library handle returned from DBL_open().
1584 - *      flags           - Specifies whether loading code, data, and/or symbols.
1585 - *      attrs           - May contain write, alloc, and free functions.
1586 - *      pulEntry        - Location to store program entry on output.
1587 - *  Returns:
1588 - *      DSP_SOK:        Success.
1589 - *      DSP_EFREAD:     File read failed.
1590 - *      DSP_EFWRITE:    Write to target failed.
1591 - *  Requires:
1592 - *      DBL initialized.
1593 - *      Valid lib.
1594 - *      pEntry != NULL.
1595 - *  Ensures:
1596 - */
1597 -       extern DSP_STATUS DBL_load(struct DBL_LibraryObj *lib, DBL_Flags flags,
1598 -                                  struct DBL_Attrs *attrs, u32 *pEntry);
1599 -
1600 -/*
1601 - *  ======== DBL_loadSect ========
1602 - *  Load a named section from an library (for overlay support).
1603 - *  Parameters:
1604 - *      lib             - Handle returned from DBL_open().
1605 - *      sectName        - Name of section to load.
1606 - *      attrs           - Contains write function and handle to pass to it.
1607 - *  Returns:
1608 - *      DSP_SOK:        Success.
1609 - *      DSP_ENOSECT:    Section not found.
1610 - *      DSP_EFWRITE:    Write function failed.
1611 - *  Requires:
1612 - *      Valid lib.
1613 - *      sectName != NULL.
1614 - *      attrs != NULL.
1615 - *      attrs->write != NULL.
1616 - *  Ensures:
1617 - */
1618 -       extern DSP_STATUS DBL_loadSect(struct DBL_LibraryObj *lib,
1619 -                                      char *sectName,
1620 -                                      struct DBL_Attrs *attrs);
1621 -
1622 -/*
1623 - *  ======== DBL_open ========
1624 - *  DBL_open() returns a library handle that can be used to load/unload
1625 - *  the symbols/code/data via DBL_load()/DBL_unload().
1626 - *  Parameters:
1627 - *      target          - Handle returned from DBL_create().
1628 - *      file            - Name of file to open.
1629 - *      flags           - Specifies whether to load symbols now.
1630 - *      pLib            - Location to store library handle on output.
1631 - *  Returns:
1632 - *      DSP_SOK:            Success.
1633 - *      DSP_EMEMORY:        Memory allocation failure.
1634 - *      DSP_EFOPEN:         File open failure.
1635 - *      DSP_EFREAD:         File read failure.
1636 - *      DSP_ECORRUPTFILE:   Unable to determine target type.
1637 - *  Requires:
1638 - *      DBL initialized.
1639 - *      Valid target.
1640 - *      file != NULL.
1641 - *      pLib != NULL.
1642 - *      struct DBL_Attrs fopen function non-NULL.
1643 - *  Ensures:
1644 - *      Success:        Valid *pLib.
1645 - *      Failure:        *pLib == NULL.
1646 - */
1647 -       extern DSP_STATUS DBL_open(struct DBL_TargetObj *target, char *file,
1648 -                                  DBL_Flags flags,
1649 -                                  struct DBL_LibraryObj **pLib);
1650 -
1651 -/*
1652 - *  ======== DBL_readSect ========
1653 - *  Read COFF section into a character buffer.
1654 - *  Parameters:
1655 - *      lib             - Library handle returned from DBL_open().
1656 - *      name            - Name of section.
1657 - *      pBuf            - Buffer to write section contents into.
1658 - *      size            - Buffer size
1659 - *  Returns:
1660 - *      DSP_SOK:        Success.
1661 - *      DSP_ENOSECT:    Named section does not exists.
1662 - *  Requires:
1663 - *      DBL initialized.
1664 - *      Valid lib.
1665 - *      name != NULL.
1666 - *      pBuf != NULL.
1667 - *      size != 0.
1668 - *  Ensures:
1669 - */
1670 -       extern DSP_STATUS DBL_readSect(struct DBL_LibraryObj *lib, char *name,
1671 -                                      char *pBuf, u32 size);
1672 -
1673 -/*
1674 - *  ======== DBL_setAttrs ========
1675 - *  Set the attributes of the target.
1676 - *  Parameters:
1677 - *      target          - Handle returned from DBL_create().
1678 - *      pAttrs          - New attributes.
1679 - *  Returns:
1680 - *  Requires:
1681 - *      DBL initialized.
1682 - *      Valid target.
1683 - *      pAttrs != NULL.
1684 - *  Ensures:
1685 - */
1686 -       extern void DBL_setAttrs(struct DBL_TargetObj *target,
1687 -                                struct DBL_Attrs *pAttrs);
1688 -
1689 -/*
1690 - *  ======== DBL_unload ========
1691 - *  Remove the symbols/code/data corresponding to the library lib.
1692 - *  Parameters:
1693 - *      lib             - Handle returned from DBL_open().
1694 - *      attrs           - Contains free() function and handle to pass to it.
1695 - *  Returns:
1696 - *  Requires:
1697 - *      DBL initialized.
1698 - *      Valid lib.
1699 - *  Ensures:
1700 - */
1701 -       extern void DBL_unload(struct DBL_LibraryObj *lib,
1702 -                              struct DBL_Attrs *attrs);
1703 -
1704 -/*
1705 - *  ======== DBL_unloadSect ========
1706 - *  Unload a named section from an library (for overlay support).
1707 - *  Parameters:
1708 - *      lib             - Handle returned from DBL_open().
1709 - *      sectName        - Name of section to load.
1710 - *      attrs           - Contains free() function and handle to pass to it.
1711 - *  Returns:
1712 - *      DSP_SOK:        Success.
1713 - *      DSP_ENOSECT:    Named section not found.
1714 - *  Requires:
1715 - *      DBL initialized.
1716 - *      Valid lib.
1717 - *      sectName != NULL.
1718 - *  Ensures:
1719 - */
1720 -       extern DSP_STATUS DBL_unloadSect(struct DBL_LibraryObj *lib,
1721 -                                        char *sectName,
1722 -                                        struct DBL_Attrs *attrs);
1723 -
1724 -#endif                         /* DBL_ */
1725 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbldefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbldefs.h
1726 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbldefs.h     2011-04-17 17:32:26.000000000 +0100
1727 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbldefs.h  2011-05-02 22:36:48.000000000 +0100
1728 @@ -14,16 +14,6 @@
1729   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1730   */
1731  
1732 -
1733 -/*
1734 - *  ======== dbldefs.h ========
1735 - *
1736 - *! Revision History
1737 - *! ================
1738 - *! 19-Mar-2002 jeh     Added DBL_Fxns type (to make it easier to switch
1739 - *!                     between different loaders).
1740 - *! 28-Sep-2001 jeh     Created from zl.h.
1741 - */
1742  #ifndef DBLDEFS_
1743  #define DBLDEFS_
1744  
1745 @@ -39,8 +29,6 @@
1746  
1747  #define DBL_MAXPATHLENGTH       255
1748  
1749 -
1750 -
1751  /*
1752   *  ======== DBL_Flags ========
1753   *  Specifies whether to load code, data, or symbols
1754 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbll.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbll.h
1755 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbll.h        2011-04-17 17:32:26.000000000 +0100
1756 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbll.h     2011-05-02 22:36:48.000000000 +0100
1757 @@ -3,6 +3,9 @@
1758   *
1759   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1760   *
1761 + *  DSP/BIOS Bridge Dynamic load library module interface. Function header
1762 + *  comments are in the file dblldefs.h.
1763 + *
1764   * Copyright (C) 2005-2006 Texas Instruments, Inc.
1765   *
1766   * This package is free software; you can redistribute it and/or modify
1767 @@ -14,18 +17,6 @@
1768   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1769   */
1770  
1771 -
1772 -/*
1773 - *  ======== dbll.h ========
1774 - *  DSP/BIOS Bridge Dynamic load library module interface. Function header
1775 - *  comments are in the file dblldefs.h.
1776 - *
1777 - *! Revision History
1778 - *! ================
1779 - *! 31-Jul-2002 jeh     Removed function comments (now in dblldefs.h).
1780 - *! 17-Apr-2002 jeh     Created based on zl.h.
1781 - */
1782 -
1783  #ifndef DBLL_
1784  #define DBLL_
1785  
1786 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dblldefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dblldefs.h
1787 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dblldefs.h    2011-04-17 17:32:26.000000000 +0100
1788 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dblldefs.h 2011-05-02 22:36:48.000000000 +0100
1789 @@ -14,17 +14,6 @@
1790   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1791   */
1792  
1793 -
1794 -/*
1795 - *  ======== dblldefs.h ========
1796 - *
1797 - *! Revision History
1798 - *! ================
1799 - *! 08-Apr-2003 map        Consolidated DBL into DBLL name
1800 - *! 19-Mar-2002 jeh     Added DBL_Fxns type (to make it easier to switch
1801 - *!                     between different loaders).
1802 - *! 28-Sep-2001 jeh     Created from zl.h.
1803 - */
1804  #ifndef DBLLDEFS_
1805  #define DBLLDEFS_
1806  
1807 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbof.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbof.h
1808 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbof.h        2011-04-17 17:32:26.000000000 +0100
1809 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbof.h     1970-01-01 01:00:00.000000000 +0100
1810 @@ -1,117 +0,0 @@
1811 -/*
1812 - * dbof.h
1813 - *
1814 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1815 - *
1816 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
1817 - *
1818 - * This package is free software; you can redistribute it and/or modify
1819 - * it under the terms of the GNU General Public License version 2 as
1820 - * published by the Free Software Foundation.
1821 - *
1822 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1823 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1824 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1825 - */
1826 -
1827 -
1828 -/*
1829 - *  ======== dbof.h ========
1830 - *  Description:
1831 - *      Defines and typedefs for DSP/BIOS Bridge Object File Format (DBOF).
1832 - *
1833 - *! Revision History
1834 - *! ================
1835 - *! 12-Jul-2002 jeh     Added defines for DBOF_SectHdr page.
1836 - *! 12-Oct-2001 jeh     Converted to std.h format.
1837 - *! 07-Sep-2001 jeh     Added overlay support.
1838 - *! 06-Jul-2001 jeh     Created.
1839 - */
1840 -
1841 -#ifndef DBOF_
1842 -#define DBOF_
1843 -
1844 -/* Enough to hold DCD section names: 32 digit ID + underscores */
1845 -#define DBOF_DCDSECTNAMELEN     40
1846 -
1847 -/* Values for DBOF_SectHdr page field. */
1848 -#define         DBOF_PROGRAM    0
1849 -#define         DBOF_DATA       1
1850 -#define         DBOF_CINIT      2
1851 -
1852 -/*
1853 - *  ======== DBOF_FileHdr ========
1854 - */
1855 -       struct DBOF_FileHdr {
1856 -               u32 magic;      /* COFF magic number */
1857 -               u32 entry;      /* Program entry point */
1858 -               u16 numSymbols; /* Number of bridge symbols */
1859 -               u16 numDCDSects;        /* Number of DCD sections */
1860 -               u16 numSects;   /* Number of sections to load */
1861 -               u16 numOvlySects;       /* Number of overlay sections */
1862 -               u32 symOffset;  /* Offset in file to symbols */
1863 -               u32 dcdSectOffset;      /* Offset to DCD sections */
1864 -               u32 loadSectOffset;     /* Offset to loadable sections */
1865 -               u32 ovlySectOffset;     /* Offset to overlay data */
1866 -               u16 version;    /* DBOF version number */
1867 -               u16 resvd;      /* Reserved for future use */
1868 -       } ;
1869 -
1870 -/*
1871 - *  ======== DBOF_DCDSectHdr ========
1872 - */
1873 -       struct DBOF_DCDSectHdr {
1874 -               u32 size;       /* Sect size (target MAUs) */
1875 -               char name[DBOF_DCDSECTNAMELEN]; /* DCD section name */
1876 -       } ;
1877 -
1878 -/*
1879 - *  ======== DBOF_OvlySectHdr ========
1880 - */
1881 -       struct DBOF_OvlySectHdr {
1882 -               u16 nameLen;    /* Length of section name */
1883 -               u16 numCreateSects;     /* # of sects loaded for create phase */
1884 -               u16 numDeleteSects;     /* # of sects loaded for delete phase */
1885 -               u16 numExecuteSects; /* # of sects loaded for execute phase */
1886 -
1887 -               /*
1888 -                *  Number of sections where load/unload phase is not specified.
1889 -                *  These sections will be loaded when create phase sects are
1890 -                *  loaded, and unloaded when the delete phase is unloaded.
1891 -                */
1892 -               u16 numOtherSects;
1893 -               u16 resvd;      /* Reserved for future use */
1894 -       };
1895 -
1896 -/*
1897 - *  ======== DBOF_OvlySectData ========
1898 - */
1899 -       struct DBOF_OvlySectData {
1900 -               u32 loadAddr;   /* Section load address */
1901 -               u32 runAddr;    /* Section run address */
1902 -               u32 size;       /* Section size (target MAUs) */
1903 -               u16 page;       /* Memory page number */
1904 -               u16 resvd;      /* Reserved */
1905 -       } ;
1906 -
1907 -/*
1908 - *  ======== DBOF_SectHdr ========
1909 - */
1910 -       struct DBOF_SectHdr {
1911 -               u32 addr;       /* Section address */
1912 -               u32 size;       /* Section size (target MAUs) */
1913 -               u16 page;       /* Page number */
1914 -               u16 resvd;      /* Reserved for future use */
1915 -       } ;
1916 -
1917 -/*
1918 - *  ======== DBOF_SymbolHdr ========
1919 - */
1920 -       struct DBOF_SymbolHdr {
1921 -               u32 value;      /* Symbol value */
1922 -               u16 nameLen;    /* Length of symbol name */
1923 -               u16 resvd;      /* Reserved for future use */
1924 -       } ;
1925 -
1926 -#endif                         /* DBOF_ */
1927 -
1928 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbreg.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbreg.h
1929 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbreg.h       2011-04-17 17:32:26.000000000 +0100
1930 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbreg.h    1970-01-01 01:00:00.000000000 +0100
1931 @@ -1,113 +0,0 @@
1932 -/*
1933 - * dbreg.h
1934 - *
1935 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1936 - *
1937 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
1938 - *
1939 - * This package is free software; you can redistribute it and/or modify
1940 - * it under the terms of the GNU General Public License version 2 as
1941 - * published by the Free Software Foundation.
1942 - *
1943 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1944 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1945 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1946 - */
1947 -
1948 -
1949 -/*
1950 - *  ======== dbreg.h ========
1951 - *  Purpose:
1952 - *      Registry keys for use in Linux.  This is the clearinghouse for
1953 - *      registry definitions, hopefully eliminating overlapping between
1954 - *      modules.
1955 - *
1956 - *! Revision History:
1957 - *! ================
1958 - *! 10-Apr-2003 vp:  Added macro for subkey TCWORDSWAP.
1959 - *! 21-Mar-2003 sb:  Added macro for subkey SHMSize
1960 - *! 27-Aug-2001 jeh  Added WSXREG_LOADERFILENAME.
1961 - *! 13-Feb-2001 kc:  DSP/BIOS Bridge name updates.
1962 - *! 29-Nov-2000 rr:  Added WSXREG_DSPTYPE_55 as 6.
1963 - *! 06-Sep-2000 jeh: Added WSXREG_CHNLOFFSET, WSXREG_NUMCHNLS,
1964 - *!                  WSXREG_CHNLBUFSIZE.
1965 - *! 26-Aug-2000 rr:  MEMBASE expanded to 9 entries.
1966 - *! 26-Jul-2000 rr:  Added WSXREG_DCDNAME for the DCD Dll name. It will
1967 - *!                  live under WSXREG_WINSPOXCONFIG.
1968 - *! 17-Jul-2000 rr:  REG_MGR_OBJECT and REG_DRV_OBJECT defined. They
1969 - *!                  are stored in the Registrty under WSXREG_WINSPOXCONFIG
1970 - *!                  when they are created in DSP_Init. WSXREG_DEVOBJECT
1971 - *!                  and WSXREG_MGROBJECT defined.
1972 - *! 11-Dec-1999 ag:  Renamed Isa to IsaBus due to conflict with ceddk.h.
1973 - *! 12-Nov-1999 rr:  New Registry Defnitions.
1974 - *! 15-Oct-1999 rr:  New entry for DevObject created. WSXREG_DEVOBJECT
1975 - *!                  under WSXREG_DDSPDRIVERPATH
1976 - *! 10-Nov-1997 cr:  Added WSXREG_INFPATH, WSXREG_WINDEVICEPATH,
1977 - *!                  WSXREG_WINCURVERSION
1978 - *! 21-Oct-1997 cr:  Added WSXREG_BUSTYPE.
1979 - *! 08-Sep-1997 cr:  Added WSXREG_SERVICES, WSXREG_SERVICENAME and
1980 - *!                  WSXREG_CLASSINDEX.
1981 - *! 30-Aug-1997 cr:  Added WSXREG_SOFTWAREPATHNT & WSXREG_WBCLASSGUID.
1982 - *! 24-Mar-1997 gp:  Added MAXCHIPINFOSUBKEY def.
1983 - *! 18-Feb-1997 cr:  Changed Version1.1 -> Version1.0
1984 - *! 12-Feb-1997 cr:  Changed WinSPOX -> WinBRIDGE.
1985 - *! 11-Dec-1996 gp:  Added Perf key name in WinSPOX Config.
1986 - *! 22-Jul-1996 gp:  Added Trace key name.
1987 - *! 30-May-1996 cr:  Created.
1988 - */
1989 -
1990 -#ifndef DBREG_
1991 -#define DBREG_ 1       /* Defined as "1" so InstallShield programs compile. */
1992 -
1993 -#define REG_MGR_OBJECT      1
1994 -#define REG_DRV_OBJECT      2
1995 -/* general registry definitions */
1996 -#define MAXREGPATHLENGTH    255        /* Max registry path length. Also the
1997 -                                  max registry value length. */
1998 -#define DSPTYPE_55          6  /* This is the DSP Chip type for 55 */
1999 -#define DSPTYPE_64          0x99
2000 -#define IVA_ARM7            0x97    /* This is the DSP Chip type for IVA/ARM7 */
2001 -
2002 -#define DSPPROCTYPE_C55                5510
2003 -#define DSPPROCTYPE_C64                6410
2004 -#define IVAPROCTYPE_ARM7       470
2005 -/* registry */
2006 -#define DEVNODESTRING    "DevNode"     /* u32 devnode */
2007 -#define CONFIG           "Software\\TexasInstruments\\DirectDSP\\Config"
2008 -#define DRVOBJECT        "DrvObject"
2009 -#define MGROBJECT        "MgrObject"
2010 -#define CLASS            "Device"      /*  device class */
2011 -#define TRACE            "Trace"       /* GT Trace settings.  */
2012 -#define PERFR            "Perf"        /* Enable perf bool.  */
2013 -#define ROOT             "Root"        /*  root dir */
2014 -
2015 -/* MiniDriver related definitions */
2016 -/* The following definitions are under "Drivers\\DirectDSP\\Device\\XXX "
2017 - * Where XXX is the device or board name */
2018 -
2019 -#define WMDFILENAME      "MiniDriver"  /* WMD entry name */
2020 -#define CHIPTYPE         "ChipType"    /* Chip type */
2021 -#define CHIPNUM          "NumChips"    /* Number of chips */
2022 -#define NUMPROCS         "NumOfProcessors"     /* Number of processors */
2023 -#define DEFEXEC          "DefaultExecutable"   /* Default executable */
2024 -#define AUTOSTART        "AutoStart"   /* Statically load flag */
2025 -#define IVAAUTOSTART     "IvaAutoStart"        /* Statically load flag */
2026 -#define BOARDNAME        "BoardName"   /* Name of the Board */
2027 -#define UNITNUMBER       "UnitNumber"  /* Unit # of the Board */
2028 -#define BUSTYPE          "BusType"     /* Bus type board is on */
2029 -#define BUSNUMBER        "BusNumber"   /* Bus number board is on */
2030 -#define CURRENTCONFIG    "CurrentConfig"       /* Current resources */
2031 -#define PCIVENDEVID      "VendorDeviceId"      /* The board's id */
2032 -#define INFPATH          "InfPath"     /* wmd's inf filename */
2033 -#define DEVOBJECT        "DevObject"
2034 -#define ZLFILENAME       "ZLFileName"  /* Name of ZL file */
2035 -#define WORDSIZE         "WordSize"    /* NumBytes in DSP Word */
2036 -#define SHMSIZE          "SHMSize"     /* Size of SHM reservd on MPU */
2037 -#define IVAEXTMEMSIZE    "IVAEXTMEMSize"       /* IVA External Memeory size  */
2038 -#define TCWORDSWAP       "TCWordSwap"  /* Traffic Contoller Word Swap */
2039 -#define DSPRESOURCES     "DspTMSResources"     /* C55 DSP resurces on OMAP */
2040 -#define IVA1RESOURCES    "ARM7IvaResources"    /* ARM7 IVA resurces on OMAP */
2041 -#define PHYSMEMPOOLBASE  "PhysicalMemBase"   /* Physical mem passed to driver */
2042 -#define PHYSMEMPOOLSIZE  "PhysicalMemSize"   /* Physical mem passed to driver */
2043 -
2044 -#endif                         /* DBREG_ */
2045 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbtype.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbtype.h
2046 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dbtype.h      2011-04-17 17:32:26.000000000 +0100
2047 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dbtype.h   2011-05-02 22:36:48.000000000 +0100
2048 @@ -3,6 +3,10 @@
2049   *
2050   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2051   *
2052 + * This header defines data types for DSP/BIOS Bridge APIs and device
2053 + * driver modules. It also defines the Hungarian prefix to use for each
2054 + * base type.
2055 + *
2056   * Copyright (C) 2008 Texas Instruments, Inc.
2057   *
2058   * This package is free software; you can redistribute it and/or modify
2059 @@ -14,23 +18,6 @@
2060   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2061   */
2062  
2063 -/*
2064 - *  ======== dbtype.h ========
2065 - *  Description:
2066 - *      This header defines data types for DSP/BIOS Bridge APIs and device
2067 - *      driver modules. It also defines the Hungarian
2068 - *      prefix to use for each base type.
2069 - *
2070 - *
2071 - *! Revision History:
2072 - *! =================
2073 - *! 23-Nov-2002 gp: Purpose -> Description in file header.
2074 - *! 13-Feb-2001 kc: Name changed from ddsptype.h dbtype.h.
2075 - *! 09-Oct-2000 jeh Added CHARACTER.
2076 - *! 11-Aug-2000 ag: Added 'typedef void void'.
2077 - *! 08-Apr-2000 ww: Cloned.
2078 - */
2079 -
2080  #ifndef DBTYPE_
2081  #define DBTYPE_
2082  
2083 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dehdefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dehdefs.h
2084 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dehdefs.h     2011-04-17 17:32:26.000000000 +0100
2085 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dehdefs.h  2011-05-02 22:36:48.000000000 +0100
2086 @@ -3,6 +3,8 @@
2087   *
2088   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2089   *
2090 + * Definition for mini-driver module DEH.
2091 + *
2092   * Copyright (C) 2005-2006 Texas Instruments, Inc.
2093   *
2094   * This package is free software; you can redistribute it and/or modify
2095 @@ -14,18 +16,6 @@
2096   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2097   */
2098  
2099 -/*
2100 - *  ======== dehdefs.h ========
2101 - *  Purpose:
2102 - *      Definition for mini-driver module DEH.
2103 - *
2104 - *! Revision History:
2105 - *! ================
2106 - *! 17-Dec-2001 ag: added #include <dspbridge/mbx_sh.h> for shared mailbox codes.
2107 - *! 10-Dec-2001 kc: added DEH error base value and error max value.
2108 - *! 11-Sep-2001 kc: created.
2109 - */
2110 -
2111  #ifndef DEHDEFS_
2112  #define DEHDEFS_
2113  
2114 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dev.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dev.h
2115 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dev.h 2011-04-17 17:32:26.000000000 +0100
2116 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dev.h      2011-05-02 22:36:48.000000000 +0100
2117 @@ -3,6 +3,8 @@
2118   *
2119   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2120   *
2121 + * Bridge Mini-driver device operations.
2122 + *
2123   * Copyright (C) 2005-2006 Texas Instruments, Inc.
2124   *
2125   * This package is free software; you can redistribute it and/or modify
2126 @@ -14,68 +16,6 @@
2127   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2128   */
2129  
2130 -
2131 -/*
2132 - *  ======== dev.h ========
2133 - *  Description:
2134 - *      'Bridge Mini-driver device operations.
2135 - *
2136 - *  Public Functions:
2137 - *      DEV_BrdWriteFxn
2138 - *      DEV_CreateDevice
2139 - *      DEV_Create2
2140 - *      DEV_Destroy2
2141 - *      DEV_DestroyDevice
2142 - *      DEV_GetChnlMgr
2143 - *      DEV_GetCmmMgr
2144 - *      DEV_GetCodMgr
2145 - *      DEV_GetDehMgr
2146 - *      DEV_GetDevNode
2147 - *      DEV_GetDSPWordSize
2148 - *      DEV_GetFirst
2149 - *      DEV_GetIntfFxns
2150 - *      DEV_GetIOMgr
2151 - *      DEV_GetMsgMgr
2152 - *      DEV_GetNext
2153 - *      DEV_GetNodeManager
2154 - *      DEV_GetSymbol
2155 - *      DEV_GetWMDContext
2156 - *      DEV_Exit
2157 - *      DEV_Init
2158 - *      DEV_InsertProcObject
2159 - *      DEV_IsLocked
2160 - *      DEV_NotifyClient
2161 - *      DEV_RegisterNotify
2162 - *      DEV_ReleaseCodMgr
2163 - *      DEV_RemoveDevice
2164 - *      DEV_RemoveProcObject
2165 - *      DEV_SetChnlMgr
2166 - *      DEV_SetMsgMgr
2167 - *      DEV_SetLockOwner
2168 - *      DEV_StartDevice
2169 - *
2170 - *! Revision History:
2171 - *! ================
2172 - *! 08-Mar-2004 sb  Added the Dynamic Memory Mapping feature - Dev_GetDmmMgr
2173 - *! 09-Feb-2004 vp  Added functions required for IVA
2174 - *! 25-Feb-2003 swa PMGR Code Review changes incorporated
2175 - *! 05-Nov-2001 kc: Added DEV_GetDehMgr.
2176 - *! 05-Dec-2000 jeh Added DEV_SetMsgMgr.
2177 - *! 29-Nov-2000 rr: Incorporated code review changes.
2178 - *! 17-Nov-2000 jeh Added DEV_GetMsgMgr.
2179 - *! 05-Oct-2000 rr: DEV_Create2 & DEV_Destroy2 Added.
2180 - *! 02-Oct-2000 rr: Added DEV_GetNodeManager.
2181 - *! 11-Aug-2000 ag: Added DEV_GetCmmMgr() for shared memory management.
2182 - *! 10-Aug-2000 rr: DEV_InsertProcObject/RemoveProcObject added.
2183 - *! 06-Jun-2000 jeh Added DEV_GetSymbol().
2184 - *! 05-Nov-1999 kc: Updated function prototypes.
2185 - *! 08-Oct-1997 cr: Added explicit CDECL function identifiers.
2186 - *! 07-Nov-1996 gp: Updated for code review.
2187 - *! 22-Oct-1996 gp: Added DEV_CleanupProcessState().
2188 - *! 29-May-1996 gp: Changed DEV_HDEVNODE --> CFG_HDEVNODE.
2189 - *! 18-May-1996 gp: Created.
2190 - */
2191 -
2192  #ifndef DEV_
2193  #define DEV_
2194  
2195 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/devdefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/devdefs.h
2196 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/devdefs.h     2011-04-17 17:32:26.000000000 +0100
2197 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/devdefs.h  2011-05-02 22:36:48.000000000 +0100
2198 @@ -3,6 +3,9 @@
2199   *
2200   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2201   *
2202 + * Definition of common include typedef between wmd.h and dev.h. Required
2203 + * to break circular dependency between WMD and DEV include files.
2204 + *
2205   * Copyright (C) 2008 Texas Instruments, Inc.
2206   *
2207   * This package is free software; you can redistribute it and/or modify
2208 @@ -14,18 +17,6 @@
2209   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2210   */
2211  
2212 -/*
2213 - *  ======== devdefs.h ========
2214 - *  Purpose:
2215 - *      Definition of common include typedef between wmd.h and dev.h. Required
2216 - *      to break circular dependency between WMD and DEV include files.
2217 - *
2218 - *! Revision History:
2219 - *! ================
2220 - *! 12-Nov-1996 gp: Renamed from dev1.h.
2221 - *! 30-May-1996 gp: Broke out from dev.h
2222 - */
2223 -
2224  #ifndef DEVDEFS_
2225  #define DEVDEFS_
2226  
2227 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/disp.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/disp.h
2228 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/disp.h        2011-04-17 17:32:26.000000000 +0100
2229 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/disp.h     2011-05-02 22:36:48.000000000 +0100
2230 @@ -3,6 +3,8 @@
2231   *
2232   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2233   *
2234 + * DSP/BIOS Bridge Node Dispatcher.
2235 + *
2236   * Copyright (C) 2005-2006 Texas Instruments, Inc.
2237   *
2238   * This package is free software; you can redistribute it and/or modify
2239 @@ -14,35 +16,6 @@
2240   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2241   */
2242  
2243 -
2244 -/*
2245 - *  ======== disp.h ========
2246 - *
2247 - *  Description:
2248 - *      DSP/BIOS Bridge Node Dispatcher.
2249 - *
2250 - *  Public Functions:
2251 - *      DISP_Create
2252 - *      DISP_Delete
2253 - *      DISP_Exit
2254 - *      DISP_Init
2255 - *      DISP_NodeChangePriority
2256 - *      DISP_NodeCreate
2257 - *      DISP_NodeDelete
2258 - *      DISP_NodeRun
2259 - *
2260 - *! Revision History:
2261 - *! =================
2262 - *! 28-Jan-2003 map     Removed DISP_DoCinit().
2263 - *! 15-May-2002 jeh     Added DISP_DoCinit().
2264 - *! 24-Apr-2002 jeh     Added DISP_MemWrite().
2265 - *! 07-Sep-2001 jeh     Added DISP_MemCopy().
2266 - *! 10-May-2001 jeh     Code review cleanup.
2267 - *! 08-Aug-2000 jeh     Removed DISP_NodeTerminate since it no longer uses RMS.
2268 - *! 17-Jul-2000 jeh     Updates to function headers.
2269 - *! 19-Jun-2000 jeh     Created.
2270 - */
2271 -
2272  #ifndef DISP_
2273  #define DISP_
2274  
2275 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dispdefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dispdefs.h
2276 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dispdefs.h    2011-04-17 17:32:26.000000000 +0100
2277 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dispdefs.h 2011-05-02 22:36:48.000000000 +0100
2278 @@ -3,6 +3,8 @@
2279   *
2280   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2281   *
2282 + * Global DISP constants and types, shared by PROCESSOR, NODE, and DISP.
2283 + *
2284   * Copyright (C) 2005-2006 Texas Instruments, Inc.
2285   *
2286   * This package is free software; you can redistribute it and/or modify
2287 @@ -14,18 +16,6 @@
2288   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2289   */
2290  
2291 -
2292 -/*
2293 - *  ======== dispdefs.h ========
2294 - *  Description:
2295 - *      Global DISP constants and types, shared by PROCESSOR, NODE, and DISP.
2296 - *
2297 - *! Revision History
2298 - *! ================
2299 - *! 08-Aug-2000 jeh     Added fields to DISP_ATTRS.
2300 - *! 06-Jul-2000 jeh     Created.
2301 - */
2302 -
2303  #ifndef DISPDEFS_
2304  #define DISPDEFS_
2305  
2306 @@ -36,8 +26,8 @@
2307                 u32 ulChnlOffset; /* Offset of channel ids reserved for RMS */
2308                 /* Size of buffer for sending data to RMS */
2309                 u32 ulChnlBufSize;
2310 -               DSP_PROCFAMILY procFamily;      /* eg, 5000 */
2311 -               DSP_PROCTYPE procType;  /* eg, 5510 */
2312 +               long procFamily;        /* eg, 5000 */
2313 +               long procType;          /* eg, 5510 */
2314                 HANDLE hReserved1;      /* Reserved for future use. */
2315                 u32 hReserved2; /* Reserved for future use. */
2316         } ;
2317 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dmm.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dmm.h
2318 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dmm.h 2011-04-17 17:32:26.000000000 +0100
2319 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dmm.h      2011-05-02 22:36:48.000000000 +0100
2320 @@ -3,6 +3,9 @@
2321   *
2322   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2323   *
2324 + * The Dynamic Memory Mapping(DMM) module manages the DSP Virtual address
2325 + * space that can be directly mapped to any MPU buffer or memory region.
2326 + *
2327   * Copyright (C) 2005-2006 Texas Instruments, Inc.
2328   *
2329   * This package is free software; you can redistribute it and/or modify
2330 @@ -14,21 +17,6 @@
2331   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2332   */
2333  
2334 -
2335 -/*
2336 - *  ======== dmm.h ========
2337 - *  Purpose:
2338 - *      The Dynamic Memory Mapping(DMM) module manages the DSP Virtual address
2339 - *      space that can be directly mapped to any MPU buffer or memory region
2340 - *
2341 - *  Public Functions:
2342 - *
2343 - *! Revision History:
2344 - *! ================
2345 - *! 20-Feb-2004 sb: Created.
2346 - *!
2347 - */
2348 -
2349  #ifndef DMM_
2350  #define DMM_
2351  
2352 @@ -50,7 +38,7 @@
2353   *      This is typically called from the client process.
2354   */
2355  
2356 -       extern DSP_STATUS DMM_GetHandle(DSP_HPROCESSOR hProcessor,
2357 +       extern DSP_STATUS DMM_GetHandle(void *hProcessor,
2358                                         OUT struct DMM_OBJECT **phDmmMgr);
2359  
2360         extern DSP_STATUS DMM_ReserveMemory(struct DMM_OBJECT *hDmmMgr,
2361 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dpc.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dpc.h
2362 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dpc.h 2011-04-17 17:32:26.000000000 +0100
2363 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dpc.h      1970-01-01 01:00:00.000000000 +0100
2364 @@ -1,167 +0,0 @@
2365 -/*
2366 - * dpc.h
2367 - *
2368 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2369 - *
2370 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
2371 - *
2372 - * This package is free software; you can redistribute it and/or modify
2373 - * it under the terms of the GNU General Public License version 2 as
2374 - * published by the Free Software Foundation.
2375 - *
2376 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
2377 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
2378 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2379 - */
2380 -
2381 -
2382 -/*
2383 - *  ======== dpc.h ========
2384 - *  Purpose:
2385 - *      Deferred Procedure Call(DPC) Services.
2386 - *
2387 - *  Public Functions:
2388 - *      DPC_Cancel
2389 - *      DPC_Create
2390 - *      DPC_Destroy
2391 - *      DPC_Exit
2392 - *      DPC_Init
2393 - *      DPC_Schedule
2394 - *
2395 - *! Revision History:
2396 - *! ================
2397 - *! 31-Jan-2000 rr:  DPC_Destroy ensures Suceess and DPC Object is NULL.
2398 - *! 21-Jan-2000 ag:  Updated comments per code review.
2399 - *! 06-Jan-2000 ag:  Removed DPC_[Lower|Raise]IRQL[From|To]DispatchLevel.
2400 - *! 14-Jan-1998 gp:  Added DPC_[Lower|Raise]IRQL[From|To]DispatchLevel.
2401 - *! 18-Aug-1997 cr:  Added explicit CDECL identifiers.
2402 - *! 28-Jul-1996 gp:  Created.
2403 - */
2404 -
2405 -#ifndef DPC_
2406 -#define DPC_
2407 -
2408 -       struct DPC_OBJECT;
2409 -
2410 -/*
2411 - *  ======== DPC_PROC ========
2412 - *  Purpose:
2413 - *      Deferred processing routine.  Typically scheduled from an ISR to
2414 - *      complete I/O processing.
2415 - *  Parameters:
2416 - *      pRefData:   Ptr to user data: passed in via ISR_ScheduleDPC.
2417 - *  Returns:
2418 - *  Requires:
2419 - *      The DPC should not block, or otherwise acquire resources.
2420 - *      Interrupts to the processor are enabled.
2421 - *      DPC_PROC executes in a critical section.
2422 - *  Ensures:
2423 - *      This DPC will not be reenterred on the same thread.
2424 - *      However, the DPC may take hardware interrupts during execution.
2425 - *      Interrupts to the processor are enabled.
2426 - */
2427 -       typedef void(*DPC_PROC) (void *pRefData);
2428 -
2429 -/*
2430 - *  ======== DPC_Cancel ========
2431 - *  Purpose:
2432 - *      Cancel a DPC previously scheduled by DPC_Schedule.
2433 - *  Parameters:
2434 - *      hDPC:           A DPC object handle created in DPC_Create().
2435 - *  Returns:
2436 - *      DSP_SOK:        Scheduled DPC, if any, is cancelled.
2437 - *      DSP_SFALSE:     No DPC is currently scheduled for execution.
2438 - *      DSP_EHANDLE:    Invalid hDPC.
2439 - *  Requires:
2440 - *  Ensures:
2441 - *      If the DPC has already executed, is executing, or was not yet
2442 - *      scheduled, this function will have no effect.
2443 - */
2444 -       extern DSP_STATUS DPC_Cancel(IN struct DPC_OBJECT *hDPC);
2445 -
2446 -/*
2447 - *  ======== DPC_Create ========
2448 - *  Purpose:
2449 - *      Create a DPC object, allowing a client's own DPC procedure to be
2450 - *      scheduled for a call with client reference data.
2451 - *  Parameters:
2452 - *      phDPC:          Pointer to location to store DPC object.
2453 - *      pfnDPC:         Client's DPC procedure.
2454 - *      pRefData:       Pointer to user-defined reference data.
2455 - *  Returns:
2456 - *      DSP_SOK:        DPC object created.
2457 - *      DSP_EPOINTER:   phDPC == NULL or pfnDPC == NULL.
2458 - *      DSP_EMEMORY:    Insufficient memory.
2459 - *  Requires:
2460 - *      Must not be called at interrupt time.
2461 - *  Ensures:
2462 - *      DSP_SOK: DPC object is created;
2463 - *      else: *phDPC is set to NULL.
2464 - */
2465 -       extern DSP_STATUS DPC_Create(OUT struct DPC_OBJECT **phDPC,
2466 -                                          IN DPC_PROC pfnDPC,
2467 -                                          IN void *pRefData);
2468 -
2469 -/*
2470 - *  ======== DPC_Destroy ========
2471 - *  Purpose:
2472 - *      Cancel the last scheduled DPC, and deallocate a DPC object previously
2473 - *      allocated with DPC_Create().Frees the Object only if the thread and
2474 - *      the events are terminated successfuly.
2475 - *  Parameters:
2476 - *      hDPC:           A DPC object handle created in DPC_Create().
2477 - *  Returns:
2478 - *      DSP_SOK:        Success.
2479 - *      DSP_EHANDLE:    Invalid hDPC.
2480 - *  Requires:
2481 - *      All DPC's scheduled for the DPC object must have completed their
2482 - *      processing.
2483 - *  Ensures:
2484 - *      (SUCCESS && hDPC is NULL) or DSP_EFAILED status
2485 - */
2486 -       extern DSP_STATUS DPC_Destroy(IN struct DPC_OBJECT *hDPC);
2487 -
2488 -/*
2489 - *  ======== DPC_Exit ========
2490 - *  Purpose:
2491 - *      Discontinue usage of the DPC module.
2492 - *  Parameters:
2493 - *  Returns:
2494 - *  Requires:
2495 - *      DPC_Init(void) was previously called.
2496 - *  Ensures:
2497 - *      Resources acquired in DPC_Init(void) are freed.
2498 - */
2499 -       extern void DPC_Exit(void);
2500 -
2501 -/*
2502 - *  ======== DPC_Init ========
2503 - *  Purpose:
2504 - *      Initialize the DPC module's private state.
2505 - *  Parameters:
2506 - *  Returns:
2507 - *      TRUE if initialized; FALSE if error occured.
2508 - *  Requires:
2509 - *  Ensures:
2510 - *      A requirement for each of the other public DPC functions.
2511 - */
2512 -       extern bool DPC_Init(void);
2513 -
2514 -/*
2515 - *  ======== DPC_Schedule ========
2516 - *  Purpose:
2517 - *      Schedule a deferred procedure call to be executed at a later time.
2518 - *      Latency and order of DPC execution is platform specific.
2519 - *  Parameters:
2520 - *      hDPC:           A DPC object handle created in DPC_Create().
2521 - *  Returns:
2522 - *      DSP_SOK:        An event is scheduled for deferred processing.
2523 - *      DSP_EHANDLE:    Invalid hDPC.
2524 - *  Requires:
2525 - *      See requirements for DPC_PROC.
2526 - *  Ensures:
2527 - *      DSP_SOK:        The DPC will not be called before this function returns.
2528 - */
2529 -       extern DSP_STATUS DPC_Schedule(IN struct DPC_OBJECT *hDPC);
2530 -
2531 -#endif                         /* DPC_ */
2532 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/drv.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/drv.h
2533 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/drv.h 2011-04-17 17:32:27.000000000 +0100
2534 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/drv.h      2011-05-02 22:36:48.000000000 +0100
2535 @@ -3,6 +3,10 @@
2536   *
2537   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2538   *
2539 + * DRV Resource allocation module. Driver Object gets Created
2540 + * at the time of Loading. It holds the List of Device Objects
2541 + * in the system.
2542 + *
2543   * Copyright (C) 2005-2006 Texas Instruments, Inc.
2544   *
2545   * This package is free software; you can redistribute it and/or modify
2546 @@ -14,50 +18,6 @@
2547   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2548   */
2549  
2550 -
2551 -/*
2552 - *  ======== drv.h ========
2553 - *  Purpose:
2554 - *      DRV Resource allocation module. Driver Object gets Created
2555 - *      at the time of Loading. It holds the List of Device Objects
2556 - *      in the Syste,
2557 - *
2558 - *  Public Functions:
2559 - *      DRV_Create
2560 - *      DRV_Destroy
2561 - *      DRV_Exit
2562 - *      DRV_GetDevObject
2563 - *      DRV_GetDevExtension
2564 - *      DRV_GetFirstDevObject
2565 - *      DRV_GetNextDevObject
2566 - *      DRV_GetNextDevExtension
2567 - *      DRV_Init
2568 - *      DRV_InsertDevObject
2569 - *      DRV_RemoveDevObject
2570 - *      DRV_RequestResources
2571 - *      DRV_ReleaseResources
2572 - *
2573 - *! Revision History
2574 - *! ================
2575 - *! 10-Feb-2004 vp:  Added OMAP24xx specific definitions.
2576 - *! 14-Aug-2000 rr:  Cleaned up.
2577 - *! 27-Jul-2000 rr:  DRV_RequestResources split into two(Request and Release)
2578 - *!                  Device extension created to hold the DevNodeString.
2579 - *! 17-Jul-2000 rr:  Driver Object holds the list of Device Objects.
2580 - *!                  Added DRV_Create, DRV_Destroy, DRV_GetDevObject,
2581 - *!                  DRV_GetFirst/NextDevObject, DRV_Insert/RemoveDevObject.
2582 - *! 12-Nov-1999 rr:  New Flag defines for DRV_ASSIGN and DRV_RELEASE
2583 - *! 25-Oct-1999 rr:  Resource Structure removed.
2584 - *! 15-Oct-1999 rr:  New Resource structure created.
2585 - *! 05-Oct-1999 rr:  Added DRV_RequestResources
2586 - *!                  Removed fxn'sDRV_RegisterMiniDriver(),
2587 - *!                 DRV_UnRegisterMiniDriver()
2588 - *!                  Removed Structures DSP_DRIVER & DRV_EXTENSION.
2589 - *!
2590 - *! 24-Sep-1999 rr:  Added DRV_EXTENSION and DSP_DRIVER structures.
2591 - *!
2592 - */
2593 -
2594  #ifndef DRV_
2595  #define DRV_
2596  
2597 @@ -118,13 +78,12 @@
2598  #define OMAP_PRCM_VDD1_DOMAIN 1
2599  #define OMAP_PRCM_VDD2_DOMAIN 2
2600  
2601 -#ifndef RES_CLEANUP_DISABLE
2602  
2603  /* GPP PROCESS CLEANUP Data structures */
2604  
2605  /* New structure (member of process context) abstracts NODE resource info */
2606  struct NODE_RES_OBJECT {
2607 -       DSP_HNODE       hNode;
2608 +       void *hNode;
2609         s32            nodeAllocated; /* Node status */
2610         s32            heapAllocated; /* Heap status */
2611         s32            streamsAllocated; /* Streams status */
2612 @@ -156,7 +115,7 @@ struct DSPHEAP_RES_OBJECT {
2613  /* New structure (member of process context) abstracts stream resource info */
2614  struct STRM_RES_OBJECT {
2615         s32                    streamAllocated; /* Stream status */
2616 -       DSP_HSTREAM             hStream;
2617 +       void *hStream;
2618         u32                    uNumBufs;
2619         u32                    uDir;
2620         struct STRM_RES_OBJECT         *next;
2621 @@ -173,31 +132,25 @@ struct PROCESS_CONTEXT{
2622         /* Process State */
2623         enum GPP_PROC_RES_STATE resState;
2624  
2625 -       /* Process ID (Same as UNIX process ID) */
2626 -       u32 pid;
2627 -
2628 -       /* Pointer to next process context
2629 -       * (To maintain a linked list of process contexts) */
2630 -       struct PROCESS_CONTEXT *next;
2631 -
2632 -       /* List of Processors */
2633 -       struct list_head processor_list;
2634 -       spinlock_t proc_list_lock;
2635 +       /* Handle to Processor */
2636 +       void *hProcessor;
2637  
2638         /* DSP Node resources */
2639         struct NODE_RES_OBJECT *pNodeList;
2640 +       struct mutex node_mutex;
2641  
2642         /* DMM resources */
2643         struct DMM_RES_OBJECT *pDMMList;
2644 -       spinlock_t dmm_list_lock;
2645 +       struct mutex dmm_mutex;
2646  
2647         /* DSP Heap resources */
2648         struct DSPHEAP_RES_OBJECT *pDSPHEAPList;
2649  
2650         /* Stream resources */
2651         struct STRM_RES_OBJECT *pSTRMList;
2652 +       struct mutex strm_mutex;
2653  } ;
2654 -#endif
2655 +
2656  
2657  /*
2658   *  ======== DRV_Create ========
2659 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/drvdefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/drvdefs.h
2660 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/drvdefs.h     2011-04-17 17:32:26.000000000 +0100
2661 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/drvdefs.h  2011-05-02 22:36:48.000000000 +0100
2662 @@ -3,6 +3,8 @@
2663   *
2664   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2665   *
2666 + * Definition of common struct between wmd.h and drv.h.
2667 + *
2668   * Copyright (C) 2005-2006 Texas Instruments, Inc.
2669   *
2670   * This package is free software; you can redistribute it and/or modify
2671 @@ -14,17 +16,6 @@
2672   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2673   */
2674  
2675 -
2676 -/*
2677 - *  ======== drvdefs.h ========
2678 - *  Purpose:
2679 - *      Definition of common include typedef between wmd.h and drv.h.
2680 - *
2681 - *! Revision History:
2682 - *! ================
2683 - *! 17-Jul-2000 rr: Created
2684 - */
2685 -
2686  #ifndef DRVDEFS_
2687  #define DRVDEFS_
2688  
2689 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dspdrv.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dspdrv.h
2690 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dspdrv.h      2011-04-17 17:32:26.000000000 +0100
2691 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dspdrv.h   2011-05-02 22:36:48.000000000 +0100
2692 @@ -3,6 +3,9 @@
2693   *
2694   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2695   *
2696 + * This is the Stream Interface for the DDSP Class driver.
2697 + * All Device operations are performed via DeviceIOControl.
2698 + *
2699   * Copyright (C) 2005-2006 Texas Instruments, Inc.
2700   *
2701   * This package is free software; you can redistribute it and/or modify
2702 @@ -14,36 +17,6 @@
2703   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2704   */
2705  
2706 -
2707 -/*
2708 - *  ======== dspdrv.h ========
2709 - *  Purpose:
2710 - *      This is the Stream Interface for the DDSP Class driver.
2711 - *      All Device operations are performed via DeviceIOControl.
2712 - *      Read, Seek and Write not used.
2713 - *
2714 - *  Public Functions
2715 - *      DSP_Close
2716 - *      DSP_Deinit
2717 - *      DSP_Init
2718 - *      DSP_IOControl
2719 - *      DSP_Open
2720 - *      DSP_PowerUp
2721 - *      DSP_PowerDown
2722 - *
2723 - *! Revision History
2724 - *! ================
2725 - *! 28-Jan-2000 rr: Type void changed to Void.
2726 - *! 02-Dec-1999 rr: MAX_DEV define moved from wcdce.c file.Code cleaned up.
2727 - *! 12-Nov-1999 rr: "#include<wncnxerr.h> removed.
2728 - *! 05-Oct-1999 rr  Renamed the file name to wcdce.h Removed Bus Specific
2729 - *!                 code and #defines to PCCARD.h.
2730 - *! 24-Sep-1999 rr  Changed the DSP_COMMON_WINDOW_SIZE to 0x4000(16k) for the
2731 - *!                 Memory windows.
2732 - *! 16-Jul-1999 ag  Adapted from rkw's CAC Bullet driver.
2733 - *!
2734 - */
2735 -
2736  #if !defined __DSPDRV_h__
2737  #define __DSPDRV_h__
2738  
2739 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dynamic_loader.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dynamic_loader.h
2740 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/dynamic_loader.h      2011-04-17 17:32:26.000000000 +0100
2741 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/dynamic_loader.h   2011-05-02 22:36:48.000000000 +0100
2742 @@ -14,8 +14,6 @@
2743   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2744   */
2745  
2746 -
2747 -
2748  #ifndef _DYNAMIC_LOADER_H_
2749  #define _DYNAMIC_LOADER_H_
2750  #include <linux/kernel.h>
2751 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/errbase.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/errbase.h
2752 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/errbase.h     2011-04-17 17:32:26.000000000 +0100
2753 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/errbase.h  2011-05-02 22:36:48.000000000 +0100
2754 @@ -3,6 +3,14 @@
2755   *
2756   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2757   *
2758 + * Central repository for DSP/BIOS Bridge error and status code.
2759 + *
2760 + * Error codes are of the form:
2761 + *     [<MODULE>]_E<ERRORCODE>
2762 + *
2763 + * Success codes are of the form:
2764 + *     [<MODULE>]_S<SUCCESSCODE>
2765 + *
2766   * Copyright (C) 2008 Texas Instruments, Inc.
2767   *
2768   * This package is free software; you can redistribute it and/or modify
2769 @@ -14,35 +22,6 @@
2770   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2771   */
2772  
2773 -/*
2774 - *  ======== errbase.h ========
2775 - *  Description:
2776 - *      Central repository for DSP/BIOS Bridge error and status code.
2777 - *
2778 - *  Error codes are of the form:
2779 - *      [<MODULE>]_E<ERRORCODE>
2780 - *
2781 - *  Success codes are of the form:
2782 - *      [<MODULE>]_S<SUCCESSCODE>
2783 - *
2784 - *! Revision History:
2785 - *! ================
2786 - *! 24-Jan-2003 map Added DSP_SALREADYLOADED for persistent library checking
2787 - *! 23-Nov-2002 gp: Minor comment cleanup.
2788 - *! 13-May-2002 sg  Added DSP_SALREADYASLEEP and DSP_SALREADYWAKE.
2789 - *! 18-Feb-2002 mk: Added DSP_EOVERLAYMEMORY, EFWRITE, ENOSECT.
2790 - *! 31-Jan-2002 mk: Added definitions of DSP_STRUE and DSP_SFALSE.
2791 - *! 29-Jan-2002 mk: Added definition of CFG_E_INSUFFICIENTBUFSIZE.
2792 - *! 24-Oct-2001 sp: Consolidated all the error codes into this file.
2793 - *! 24-Jul-2001 mk: Type-casted all definitions of WSX_STATUS types for
2794 - *!                 removal of compile warnings.
2795 - *! 22-Nov-1999 kc: Changes from code review.
2796 - *! 18-Aug-1999 rr: Ported From WSX.
2797 - *! 29-May-1996 gp: Removed WCD_ and WMD_ error ranges. Redefined format of
2798 - *!                 error codes.
2799 - *! 10-May-1996 gp: Created.
2800 - */
2801 -
2802  #ifndef ERRBASE_
2803  #define ERRBASE_
2804  
2805 @@ -324,21 +303,6 @@
2806  /* Insufficient buffer size */
2807  #define CFG_E_INSUFFICIENTBUFSIZE   (CFG_EBASE + 0x05)
2808  
2809 -/* FAILURE Codes : BRD */
2810 -#define BRD_EBASE                   (DSP_COMP_EBASE + 0x300)
2811 -
2812 -/* Board client does not have sufficient access rights for this operation. */
2813 -#define BRD_E_ACCESSDENIED          (BRD_EBASE + 0x00)
2814 -
2815 -/* Unable to find trace buffer symbols in the DSP executable COFF file. */
2816 -#define BRD_E_NOTRACEBUFFER         (BRD_EBASE + 0x01)
2817 -
2818 -/* Attempted to auto-start board, but no default DSP executable configured. */
2819 -#define BRD_E_NOEXEC                (BRD_EBASE + 0x02)
2820 -
2821 -/* The operation failed because it was started from a wrong state */
2822 -#define BRD_E_WRONGSTATE            (BRD_EBASE + 0x03)
2823 -
2824  /* FAILURE Codes : COD */
2825  #define COD_EBASE                   (DSP_COMP_EBASE + 0x400)
2826  
2827 @@ -479,31 +443,4 @@
2828  /* Insufficient space to hold data in registry value. */
2829  #define REG_E_MOREDATA              (REG_EBASE + 0x03)
2830  
2831 -/* FAILURE Codes : KFILE */
2832 -#define KFILE_EBASE                 (DSP_COMP_EBASE + 0x900)
2833 -
2834 -/* Invalid file handle. */
2835 -#define E_KFILE_INVALIDHANDLE       (KFILE_EBASE + 0x01)
2836 -
2837 -/* Bad file name. */
2838 -#define E_KFILE_BADFILENAME         (KFILE_EBASE + 0x02)
2839 -
2840 -/* Invalid file mode. */
2841 -#define E_KFILE_INVALIDMODE         (KFILE_EBASE + 0x03)
2842 -
2843 -/* No resources available. */
2844 -#define E_KFILE_NORESOURCES         (KFILE_EBASE + 0x04)
2845 -
2846 -/* Invalid file buffer        . */
2847 -#define E_KFILE_INVALIDBUFFER       (KFILE_EBASE + 0x05)
2848 -
2849 -/* Bad origin argument. */
2850 -#define E_KFILE_BADORIGINFLAG       (KFILE_EBASE + 0x06)
2851 -
2852 -/* Invalid file offset value. */
2853 -#define E_KFILE_INVALIDOFFSET       (KFILE_EBASE + 0x07)
2854 -
2855 -/* General KFILE error condition */
2856 -#define E_KFILE_ERROR               (KFILE_EBASE + 0x08)
2857 -
2858  #endif                         /* ERRBASE_ */
2859 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/gb.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/gb.h
2860 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/gb.h  2011-04-17 17:32:26.000000000 +0100
2861 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/gb.h       2011-05-02 22:36:48.000000000 +0100
2862 @@ -3,6 +3,8 @@
2863   *
2864   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2865   *
2866 + * Generic bitmap manager.
2867 + *
2868   * Copyright (C) 2005-2006 Texas Instruments, Inc.
2869   *
2870   * This package is free software; you can redistribute it and/or modify
2871 @@ -14,14 +16,6 @@
2872   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2873   */
2874  
2875 -/*
2876 - *  ======== gb.h ========
2877 - *  Generic bitmap manager.
2878 - *
2879 - *! Revision History
2880 - *! ================
2881 - */
2882 -
2883  #ifndef GB_
2884  #define GB_
2885  
2886 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/getsection.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/getsection.h
2887 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/getsection.h  2011-04-17 17:32:26.000000000 +0100
2888 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/getsection.h       2011-05-02 22:36:48.000000000 +0100
2889 @@ -3,6 +3,14 @@
2890   *
2891   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2892   *
2893 + * This file provides an API add-on to the dynamic loader that allows the user
2894 + * to query section information and extract section data from dynamic load
2895 + * modules.
2896 + *
2897 + * Notes:
2898 + *   Functions in this API assume that the supplied Dynamic_Loader_Stream
2899 + *   object supports the set_file_posn method.
2900 + *
2901   * Copyright (C) 2008 Texas Instruments, Inc.
2902   *
2903   * This package is free software; you can redistribute it and/or modify
2904 @@ -14,25 +22,12 @@
2905   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2906   */
2907  
2908 -
2909  #ifndef _GETSECTION_H_
2910  #define _GETSECTION_H_
2911  
2912  
2913  #include "dynamic_loader.h"
2914  
2915 -/*
2916 - * Get Section Information
2917 - *
2918 - * This file provides an API add-on to the dynamic loader that allows the user
2919 - * to query section information and extract section data from dynamic load
2920 - * modules.
2921 - *
2922 - * NOTE:
2923 - * Functions in this API assume that the supplied Dynamic_Loader_Stream object
2924 - * supports the set_file_posn method.
2925 - */
2926 -
2927         /* opaque handle for module information */
2928         typedef void *DLOAD_module_info;
2929  
2930 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/gh.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/gh.h
2931 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/gh.h  2011-04-17 17:32:26.000000000 +0100
2932 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/gh.h       2011-05-02 22:36:48.000000000 +0100
2933 @@ -14,14 +14,6 @@
2934   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2935   */
2936  
2937 -
2938 -/*
2939 - *  ======== gh.h ========
2940 - *
2941 - *! Revision History
2942 - *! ================
2943 - */
2944 -
2945  #ifndef GH_
2946  #define GH_
2947  #include <dspbridge/host_os.h>
2948 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/gs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/gs.h
2949 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/gs.h  2011-04-17 17:32:26.000000000 +0100
2950 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/gs.h       2011-05-02 22:36:49.000000000 +0100
2951 @@ -3,6 +3,11 @@
2952   *
2953   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2954   *
2955 + * Memory allocation/release wrappers.  This module allows clients to
2956 + * avoid OS spacific issues related to memory allocation.  It also provides
2957 + * simple diagnostic capabilities to assist in the detection of memory
2958 + * leaks.
2959 + *
2960   * Copyright (C) 2005-2006 Texas Instruments, Inc.
2961   *
2962   * This package is free software; you can redistribute it and/or modify
2963 @@ -14,16 +19,6 @@
2964   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2965   */
2966  
2967 -/*
2968 - *  ======== gs.h ========
2969 - *  Memory allocation/release wrappers.  This module allows clients to
2970 - *  avoid OS spacific issues related to memory allocation.  It also provides
2971 - *  simple diagnostic capabilities to assist in the detection of memory
2972 - *  leaks.
2973 - *! Revision History
2974 - *! ================
2975 - */
2976 -
2977  #ifndef GS_
2978  #define GS_
2979  
2980 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/gt.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/gt.h
2981 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/gt.h  2011-04-17 17:32:26.000000000 +0100
2982 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/gt.h       2011-05-02 22:36:49.000000000 +0100
2983 @@ -14,25 +14,16 @@
2984   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2985   */
2986  
2987 -
2988  /*
2989 - *  ======== gt.h ========
2990 - *  Purpose:
2991 - *      There are two definitions that affect which portions of trace
2992 - *      are acutally compiled into the client: GT_TRACE and GT_ASSERT. If
2993 - *      GT_TRACE is set to 0 then all trace statements (except for assertions)
2994 - *      will be compiled out of the client. If GT_ASSERT is set to 0 then
2995 - *      assertions will be compiled out of the client. GT_ASSERT can not be
2996 - *      set to 0 unless GT_TRACE is also set to 0 (i.e. GT_TRACE == 1 implies
2997 - *      GT_ASSERT == 1).
2998 - *
2999 - *! Revision History
3000 - *! ================
3001 - *! 02-Feb-2000 rr: Renamed this file to gtce.h. GT CLASS and trace definitions
3002 - *!                 are WinCE Specific.
3003 - *! 03-Jan-1997        ge      Replaced "GT_" prefix to GT_Config structure members
3004 - *!                 to eliminate preprocessor confusion with other macros.
3005 + * There are two definitions that affect which portions of trace
3006 + * are acutally compiled into the client: GT_TRACE and GT_ASSERT. If
3007 + * GT_TRACE is set to 0 then all trace statements (except for assertions)
3008 + * will be compiled out of the client. If GT_ASSERT is set to 0 then
3009 + * assertions will be compiled out of the client. GT_ASSERT can not be
3010 + * set to 0 unless GT_TRACE is also set to 0 (i.e. GT_TRACE == 1 implies
3011 + * GT_ASSERT == 1).
3012   */
3013 +
3014  #include <linux/types.h>
3015  #ifndef GT_
3016  #define GT_
3017 @@ -241,7 +232,7 @@ extern struct GT_Config _GT_params;
3018  
3019  #define GT_assert(mask, expr) \
3020         (!(expr) ? \
3021 -           printk("assertion violation: %s, line %d\n", \
3022 +           pr_err("assertion violation: %s, line %d\n", \
3023                             __FILE__, __LINE__), NULL : NULL)
3024  
3025  #define GT_config(config)     (_GT_params = *(config))
3026 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/host_os.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/host_os.h
3027 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/host_os.h     2011-04-17 17:32:26.000000000 +0100
3028 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/host_os.h  2011-05-02 22:36:49.000000000 +0100
3029 @@ -14,16 +14,6 @@
3030   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3031   */
3032  
3033 -
3034 -/*
3035 - *  ======== windows.h ========
3036 - *
3037 - *! Revision History
3038 - *! ================
3039 - *! 08-Mar-2004 sb Added cacheflush.h to support Dynamic Memory Mapping feature
3040 - *! 16-Feb-2004 sb Added headers required for consistent_alloc
3041 - */
3042 -
3043  #ifndef _HOST_OS_H_
3044  #define _HOST_OS_H_
3045  
3046 @@ -54,7 +44,7 @@
3047  #include <linux/ioport.h>
3048  #include <linux/platform_device.h>
3049  #include <dspbridge/dbtype.h>
3050 -#include <mach/clock.h>
3051 +#include <mach/clock.h>
3052  #include <linux/clk.h>
3053  #include <linux/pagemap.h>
3054  #include <asm/cacheflush.h>
3055 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/io.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/io.h
3056 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/io.h  2011-04-17 17:32:26.000000000 +0100
3057 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/io.h       2011-05-02 22:36:49.000000000 +0100
3058 @@ -3,6 +3,8 @@
3059   *
3060   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3061   *
3062 + * The io module manages IO between CHNL and MSG.
3063 + *
3064   * Copyright (C) 2005-2006 Texas Instruments, Inc.
3065   *
3066   * This package is free software; you can redistribute it and/or modify
3067 @@ -14,25 +16,6 @@
3068   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3069   */
3070  
3071 -
3072 -/*
3073 - *  ======== io.h ========
3074 - *  Description:
3075 - *      The io module manages IO between CHNL and MSG.
3076 - *
3077 - *  Public Functions:
3078 - *      IO_Create
3079 - *      IO_Destroy
3080 - *      IO_Exit
3081 - *      IO_Init
3082 - *      IO_OnLoaded
3083 - *
3084 - *
3085 - *! Revision History:
3086 - *! ================
3087 - *! 07-Nov-2000 jeh     Created.
3088 - */
3089 -
3090  #ifndef IO_
3091  #define IO_
3092  
3093 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/io_sm.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/io_sm.h
3094 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/io_sm.h       2011-04-17 17:32:26.000000000 +0100
3095 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/io_sm.h    2011-05-02 22:36:49.000000000 +0100
3096 @@ -3,6 +3,9 @@
3097   *
3098   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3099   *
3100 + * IO dispatcher for a shared memory channel driver.
3101 + * Also, includes macros to simulate SHM via port io calls.
3102 + *
3103   * Copyright (C) 2005-2006 Texas Instruments, Inc.
3104   *
3105   * This package is free software; you can redistribute it and/or modify
3106 @@ -14,41 +17,6 @@
3107   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3108   */
3109  
3110 -
3111 -/*
3112 - *  ======== io_sm.h ========
3113 - *  Description:
3114 - *      IO dispatcher for a shared memory channel driver.
3115 - *      Also, includes macros to simulate SHM via port io calls.
3116 - *
3117 - *  Public Functions:
3118 - *      IO_Dispatch
3119 - *      IO_DPC
3120 - *      IO_ISR
3121 - *      IO_RequestChnl
3122 - *
3123 - *  Notes:
3124 - *
3125 - *! Revision History:
3126 - *! ================
3127 - *! 01-Mar-2004 vp: Added IVA releated functions.
3128 - *! 23-Apr-2003 sb: Fixed mailbox deadlock
3129 - *! 06-Feb-2003 kc  Added IO_DDMAClearChnlDesc and IO_DDZCClearChnlDesc.
3130 - *! 21-Dec-2001 ag  Removed unused param in IO_DDMAInitChnlDesc().
3131 - *                  Updated comments. Removed #ifdef CHNL_NOIPCINTR.
3132 - *! 05-Nov-2001 kc  Updated IO_CALLISR macro.
3133 - *! 01-May-2001 jeh Removed IO_RequestMsg.
3134 - *! 29-Mar-2001 ag  Added #ifdef CHNL_NOIPCINTR.
3135 - *! 04-Dec-2000 jeh Added IO_RequestMsg.
3136 - *! 26-Oct-2000 jeh Added IO_GetLong, IO_SetLong, IO_ReadValueLong, and
3137 - *!                 IO_WriteValueLong, for passing arg in SHM structure.
3138 - *! 20-Jan-2000 ag: Updated header comments per code review.
3139 - *! 05-Jan-2000 ag: Text format clean-up.
3140 - *! 02-Nov-1999 ag: Updated header descriptions.
3141 - *! 25-May-1999 jg: Removed assumption of 4 bytes / word.
3142 - *! 12-Aug-1996 gp: Created.
3143 - */
3144 -
3145  #ifndef IOSM_
3146  #define IOSM_
3147  
3148 @@ -109,7 +77,7 @@
3149   *  Ensures:
3150   *      Non-preemptible (but interruptible).
3151   */
3152 -       extern void IO_DPC(IN OUT void *pRefData);
3153 +       extern void IO_DPC(IN OUT unsigned long pRefData);
3154  
3155  /*
3156   *  ======== IO_ISR ========
3157 @@ -292,9 +260,8 @@
3158   *      pArgs != NULL
3159   *  Ensures:
3160   */
3161 -       extern DSP_STATUS IO_SHMsetting(IN struct IO_MGR *hIOMgr,
3162 -                                       IN enum SHM_DESCTYPE desc,
3163 -                                       IN void *pArgs);
3164 +       extern DSP_STATUS IO_SHMsetting(struct IO_MGR *hIOMgr,
3165 +                                       u8 desc, void *pArgs);
3166  
3167  /*
3168   *  Misc functions for the CHNL_IO shared memory library:
3169 @@ -323,13 +290,13 @@
3170  
3171         extern void IO_IntrDSP2(IN struct IO_MGR *pIOMgr, IN u16 wMbVal);
3172  
3173 -       extern void IO_SM_init(void);
3174 +       extern void IO_SM_init(void);
3175  
3176  /*
3177   *  ========PrintDspTraceBuffer ========
3178   *      Print DSP tracebuffer.
3179   */
3180 -       extern DSP_STATUS PrintDspTraceBuffer(struct WMD_DEV_CONTEXT
3181 -                                               *hWmdContext);
3182 +       extern DSP_STATUS PrintDspTraceBuffer(struct WMD_DEV_CONTEXT
3183 +                                               *hWmdContext);
3184  
3185  #endif                         /* IOSM_ */
3186 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/iodefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/iodefs.h
3187 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/iodefs.h      2011-04-17 17:32:26.000000000 +0100
3188 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/iodefs.h   2011-05-02 22:36:49.000000000 +0100
3189 @@ -3,6 +3,8 @@
3190   *
3191   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3192   *
3193 + * System-wide channel objects and constants.
3194 + *
3195   * Copyright (C) 2005-2006 Texas Instruments, Inc.
3196   *
3197   * This package is free software; you can redistribute it and/or modify
3198 @@ -14,17 +16,6 @@
3199   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3200   */
3201  
3202 -
3203 -/*
3204 - *  ======== iodefs.h ========
3205 - *  Description:
3206 - *      System-wide channel objects and constants.
3207 - *
3208 - *! Revision History:
3209 - *! ================
3210 - *! 07-Nov-2000 jeh     Created.
3211 - */
3212 -
3213  #ifndef IODEFS_
3214  #define IODEFS_
3215  
3216 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/kfile.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/kfile.h
3217 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/kfile.h       2011-04-17 17:32:26.000000000 +0100
3218 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/kfile.h    1970-01-01 01:00:00.000000000 +0100
3219 @@ -1,216 +0,0 @@
3220 -/*
3221 - * kfile.h
3222 - *
3223 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3224 - *
3225 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
3226 - *
3227 - * This package is free software; you can redistribute it and/or modify
3228 - * it under the terms of the GNU General Public License version 2 as
3229 - * published by the Free Software Foundation.
3230 - *
3231 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
3232 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
3233 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3234 - */
3235 -
3236 -
3237 -/*
3238 - *  ======== kfile.h ========
3239 - *  Purpose:
3240 - *      Provide file I/O management capabilities.
3241 - *
3242 - *  Public Functions:
3243 - *      KFILE_Close
3244 - *      KFILE_Exit
3245 - *      KFILE_Init
3246 - *      KFILE_Open
3247 - *      KFILE_Read
3248 - *      KFILE_Seek
3249 - *      KFILE_Tell
3250 - *      KFILE_Write
3251 - *
3252 - *  Notes:
3253 - *      The KFILE module is not like most of the other DSP/BIOS Bridge modules
3254 - *      in that it doesn't return WSX_STATUS type values.  Rather, it's
3255 - *      prototypes are meant to match the stdio file prototypes
3256 - *      (ie, fopen, fclose, etc.).
3257 - *
3258 - *! Revision History
3259 - *! ================
3260 - *! 29-Oct-1999 kc:  Clean up for code review.
3261 - *! 07-Jan-1998 cr:  Clean up for code review.
3262 - *! 15-Aug-1997 cr:  Added E_KFILE_ERROR for general error condition.
3263 - *! 04-Aug-1997 cr:  Added explicit CDECL descriptions.
3264 - *! 11-Nov-1996 cr:  Implemented changes based on code review.
3265 - *! 05-Nov-1996 cr:  Cleaned up for code review.
3266 - *! 29-May-1996 gp:  Added requirement that size != 0 in _Write() and _Read().
3267 - *! 28-May-1996 mg:  Changed return values for Read/Write.
3268 - *! 14-Dec-1995 cr:  Created.
3269 - */
3270 -
3271 -#ifndef KFILE_
3272 -#define KFILE_
3273 -
3274 -/*
3275 - *  Constants for KFILE_Seek.  Note that these MUST be the same definitions as
3276 - *  those defined for fseek.
3277 - */
3278 -#define KFILE_SEEK_SET          0x00   /* seek from beginning of file */
3279 -#define KFILE_SEEK_CUR          0x01   /* seek from current position */
3280 -#define KFILE_SEEK_END          0x02   /* seek from end of file */
3281 -
3282 -       struct KFILE_FileObj;
3283 -
3284 -/*
3285 - *  ======== KFILE_Close ========
3286 - *  Purpose:
3287 - *      This function closes a file's stream.
3288 - *  Parameters:
3289 - *      hFile:      Handle of the file stream returned by KFILE_Open.
3290 - *  Returns:
3291 - *      E_KFILE_INVALIDHANDLE:  bad handle.
3292 - *      0:                      success.
3293 - *      E_KFILE_ERROR:          unable to close specified handle.
3294 - *  Requires:
3295 - *      KFILE initialized.
3296 - *  Ensures:
3297 - */
3298 -       extern s32 KFILE_Close(IN struct KFILE_FileObj *hFile);
3299 -
3300 -/*
3301 - *  ======== KFILE_Exit ========
3302 - *  Purpose:
3303 - *      Discontinue usage of module; free resources when reference count
3304 - *      reaches 0.
3305 - *  Parameters:
3306 - *  Returns:
3307 - *  Requires:
3308 - *      KFILE initialized.
3309 - *  Ensures:
3310 - *      Resources used by module are freed when cRef reaches zero.
3311 - */
3312 -       extern void KFILE_Exit(void);
3313 -
3314 -/*
3315 - *  ======== KFILE_Init ========
3316 - *  Purpose:
3317 - *      Initializes private state of KFILE module.
3318 - *  Parameters:
3319 - *  Returns:
3320 - *      TRUE if success, else FALSE.
3321 - *  Requires:
3322 - *  Ensures:
3323 - *      KFILE initialized.
3324 - */
3325 -       extern bool KFILE_Init(void);
3326 -
3327 -/*
3328 - *  ======== KFILE_Open ========
3329 - *  Purpose:
3330 - *      Opens a file for use.
3331 - *  Parameters:
3332 - *      pszFileName:    Full path to name of the file to open.
3333 - *      pszMode:        String containing open status.  Only the first
3334 - *                      character of the string is examined, for either
3335 - *                      "r" (read) or "w" (write) mode.
3336 - *  Returns:
3337 - *      A valid file handle if success, else NULL.
3338 - *  Requires:
3339 - *      - KFILE initialized.
3340 - *      - pszMode != NULL.
3341 - *      - pszFileName != NULL.
3342 - *  Ensures:
3343 - */
3344 -       extern struct KFILE_FileObj *KFILE_Open(IN CONST char *filename,
3345 -                                      IN CONST char *mode);
3346 -
3347 -/*
3348 - *  ======== KFILE_Read ========
3349 - *  Purpose:
3350 - *      This function reads a specified number of bytes into a buffer.
3351 - *  Parameters:
3352 - *      pBuffer:    Array to which the file data is copied.
3353 - *      cSize:      Number of characters in each object.
3354 - *      cCount:     Number of objects to read in.
3355 - *      hFile:      Handle of the file stream returned by KFILE_Open.
3356 - *  Returns:
3357 - *      E_KFILE_INVALIDHANDLE:  bad file handle.
3358 - *      E_KFILE_ERROR:          general failure.
3359 - *      > 0:                    success; # of objects read from file.
3360 - *  Requires:
3361 - *      KFILE initialized.
3362 - *      pBuffer is a valid pointer.
3363 - *  Ensures:
3364 - */
3365 -       extern s32 KFILE_Read(OUT void __user*buffer,
3366 -                             IN s32 size, IN s32 count,
3367 -                             IN struct KFILE_FileObj *hFile);
3368 -
3369 -/*
3370 - *  ======== KFILE_Seek ========
3371 - *  Purpose:
3372 - *      This function sets the file position indicator.  NOTE:  we don't
3373 - *      support seeking beyond the boundaries of a file.
3374 - *  Parameters:
3375 - *      hFile:      Handle of the file stream returned by KFILE_Open.
3376 - *      offset:     Number of bytes from the origin to move.
3377 - *      origin:     File reference point, one of the following values:
3378 - *                  KFILE_SEEK_SET:  Seek from beginning of file.
3379 - *                  KFILE_SEEK_CUR:  Seek from current position.
3380 - *                  KFILE_SEEK_END:  Seek from end of file.
3381 - *  Returns:
3382 - *      0: success.
3383 - *      E_KFILE_INVALIDHANDLE:  bad handle.
3384 - *      E_KFILE_BADORIGIN:      invalid origin paramater.
3385 - *      E_KFILE_ERROR:          general failure.
3386 - *  Requires:
3387 - *      KFILE initialized.
3388 - *  Ensures:
3389 - */
3390 -       extern s32 KFILE_Seek(IN struct KFILE_FileObj *hFile,
3391 -                             IN s32 offset, IN s32 origin);
3392 -
3393 -/*
3394 - *  ======== KFILE_Tell ========
3395 - *  Purpose:
3396 - *      This function reports the current value of the position indicator.
3397 - *  Parameters:
3398 - *      hFile:          Handle of the file stream returned by KFILE_Open.
3399 - *  Return value:
3400 - *      > 0: success; returns # of bytes the position indicator is from
3401 - *           beginning of file.
3402 - *      E_KFILE_ERROR:          general failure.
3403 - *      E_KFILE_INVALIDHANDLE:  bad file handle.
3404 - *  Requires:
3405 - *      KFILE initialized.
3406 - *  Ensures:
3407 - */
3408 -       extern s32 KFILE_Tell(IN struct KFILE_FileObj *hFile);
3409 -
3410 -/*
3411 - *  ======== KFILE_Write ========
3412 - *  Purpose:
3413 - *      This function writes a number of objects to the stream.
3414 - *  Parameters:
3415 - *      pBuffer:    Array from which the file data is written.
3416 - *      cSize:      Number of characters in each object.
3417 - *      cCount:     Number of objects to write out.
3418 - *      hFile:      Handle of the file stream returned by KFILE_Open.
3419 - *  Returns:
3420 - *      E_KFILE_INVALIDHANDLE:  bad file handle.
3421 - *      E_KFILE_ERROR:          general failure.
3422 - *      > 0:                    success; # of objects written to file.
3423 - *  Requires:
3424 - *      KFILE initialized.
3425 - *      pBuffer != NULL.
3426 - *  Postcondition:
3427 - *      The file position indicator is advanced by the number of
3428 - *      characters written.
3429 - */
3430 -       extern s32 KFILE_Write(OUT void *buffer,
3431 -                              IN s32 size,
3432 -                              IN s32 count,
3433 -                              IN struct KFILE_FileObj *hFile);
3434 -
3435 -#endif                         /* KFILE_ */
3436 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/ldr.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/ldr.h
3437 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/ldr.h 2011-04-17 17:32:26.000000000 +0100
3438 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/ldr.h      2011-05-02 22:36:49.000000000 +0100
3439 @@ -3,6 +3,12 @@
3440   *
3441   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3442   *
3443 + * Provide module loading services and symbol export services.
3444 + *
3445 + * Notes:
3446 + *   This service is meant to be used by modules of the DSP/BIOS Bridge
3447 + *   class driver.
3448 + *
3449   * Copyright (C) 2005-2006 Texas Instruments, Inc.
3450   *
3451   * This package is free software; you can redistribute it and/or modify
3452 @@ -14,34 +20,6 @@
3453   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3454   */
3455  
3456 -
3457 -/*
3458 - *  ======== ldr.h ========
3459 - *  Purpose:
3460 - *      Provide module loading services and symbol export services.
3461 - *
3462 - *  Public Functions:
3463 - *      LDR_Exit
3464 - *      LDR_FreeModule
3465 - *      LDR_GetProcAddress
3466 - *      LDR_Init
3467 - *      LDR_LoadModule
3468 - *
3469 - *  Notes:
3470 - *      This service is meant to be used by modules of the DSP/BIOS Bridge
3471 - *       class driver.
3472 - *
3473 - *! Revision History:
3474 - *! ================
3475 - *! 22-Nov-1999 kc: Changes from code review.
3476 - *! 12-Nov-1999 kc: Removed declaration of unused loader object.
3477 - *! 29-Oct-1999 kc: Cleaned up for code review.
3478 - *! 12-Jan-1998 cr: Cleaned up for code review.
3479 - *! 04-Aug-1997 cr: Added explicit CDECL identifiers.
3480 - *! 11-Nov-1996 cr: Cleaned up for code review.
3481 - *! 16-May-1996 gp: Created.
3482 - */
3483 -
3484  #ifndef LDR_
3485  #define LDR_
3486  
3487 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/list.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/list.h
3488 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/list.h        2011-04-17 17:32:26.000000000 +0100
3489 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/list.h     2011-05-02 22:36:49.000000000 +0100
3490 @@ -3,6 +3,9 @@
3491   *
3492   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3493   *
3494 + * Declarations of list management control structures and definitions
3495 + * of inline list management functions.
3496 + *
3497   * Copyright (C) 2008 Texas Instruments, Inc.
3498   *
3499   * This package is free software; you can redistribute it and/or modify
3500 @@ -14,115 +17,17 @@
3501   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3502   */
3503  
3504 -
3505 -/*
3506 - *  ======== list.h ========
3507 - *  Purpose:
3508 - *      Declarations of list management control structures and definitions
3509 - *      of inline list management functions.
3510 - *
3511 - *  Public Functions:
3512 - *      LST_Create
3513 - *      LST_Delete
3514 - *      LST_Exit
3515 - *      LST_First
3516 - *      LST_GetHead
3517 - *      LST_InitElem
3518 - *      LST_Init
3519 - *      LST_InsertBefore
3520 - *      LST_IsEmpty
3521 - *      LST_Next
3522 - *      LST_PutTail
3523 - *      LST_RemoveElem
3524 - *
3525 - *  Notes:
3526 - *
3527 - *! Revision History
3528 - *! ================
3529 - *! 10-Aug-2000 ag:  Added LST_InsertBefore().
3530 - *! 29-Oct-1999 kc:  Cleaned up for code review.
3531 - *! 16-Aug-1997 cr:  added explicit identifiers.
3532 - *! 10-Aug-1996 gp:  Acquired from SMM for WinSPOX v.1.1; renamed identifiers.
3533 - *! 21-Oct-1994 dh4: Cleaned / commented for code review.
3534 - *! 08-Jun-1994 dh4: Converted to SPM (added extern "C").
3535 - */
3536 -
3537  #ifndef LIST_
3538  #define LIST_
3539  
3540  #include <dspbridge/host_os.h>
3541 +#include <linux/list.h>
3542  
3543 -#define LST_IsEmpty(l)      (((l)->head.next == &(l)->head))
3544 +#define LST_IsEmpty(l)      list_empty(&(l)->head)
3545  
3546 -       struct LST_ELEM {
3547 -               struct LST_ELEM *next;
3548 -               struct LST_ELEM *prev;
3549 -               struct LST_ELEM *self;
3550 -       } ;
3551 -
3552 -       struct LST_LIST {
3553 -               struct LST_ELEM head;
3554 -       } ;
3555 -
3556 -/*
3557 - *  ======== LST_Create ========
3558 - *  Purpose:
3559 - *      Allocates and initializes a circular list.
3560 - *  Details:
3561 - *      Uses portable MEM_Calloc() function to allocate a list containing
3562 - *      a single element and initializes that element to indicate that it
3563 - *      is the "end of the list" (i.e., the list is empty).
3564 - *      An empty list is indicated by the "next" pointer in the element
3565 - *      at the head of the list pointing to the head of the list, itself.
3566 - *  Parameters:
3567 - *  Returns:
3568 - *      Pointer to beginning of created list (success)
3569 - *      NULL --> Allocation failed
3570 - *  Requires:
3571 - *      LST initialized.
3572 - *  Ensures:
3573 - *  Notes:
3574 - *      The created list contains a single element.  This element is the
3575 - *      "empty" element, because its "next" and "prev" pointers point at
3576 - *      the same location (the element itself).
3577 - */
3578 -       extern struct LST_LIST *LST_Create(void);
3579 -
3580 -/*
3581 - *  ======== LST_Delete ========
3582 - *  Purpose:
3583 - *      Removes a list by freeing its control structure's memory space.
3584 - *  Details:
3585 - *      Uses portable MEM_Free() function to deallocate the memory
3586 - *      block pointed at by the input parameter.
3587 - *  Parameters:
3588 - *      pList:  Pointer to list control structure of list to be deleted
3589 - *  Returns:
3590 - *      Void
3591 - *  Requires:
3592 - *      - LST initialized.
3593 - *      - pList != NULL.
3594 - *  Ensures:
3595 - *  Notes:
3596 - *      Must ONLY be used for empty lists, because it does not walk the
3597 - *      chain of list elements.  Calling this function on a non-empty list
3598 - *      will cause a memory leak.
3599 - */
3600 -       extern void LST_Delete(IN struct LST_LIST *pList);
3601 -
3602 -/*
3603 - *  ======== LST_Exit ========
3604 - *  Purpose:
3605 - *      Discontinue usage of module; free resources when reference count
3606 - *      reaches 0.
3607 - *  Parameters:
3608 - *  Returns:
3609 - *  Requires:
3610 - *      LST initialized.
3611 - *  Ensures:
3612 - *      Resources used by module are freed when cRef reaches zero.
3613 - */
3614 -       extern void LST_Exit(void);
3615 +struct LST_LIST {
3616 +       struct list_head head;
3617 +};
3618  
3619  /*
3620   *  ======== LST_First ========
3621 @@ -138,7 +43,12 @@
3622   *      - pList != NULL.
3623   *  Ensures:
3624   */
3625 -       extern struct LST_ELEM *LST_First(IN struct LST_LIST *pList);
3626 +static inline struct list_head *LST_First(struct LST_LIST *pList)
3627 +{
3628 +       if (pList && !list_empty(&pList->head))
3629 +               return pList->head.next;
3630 +       return NULL;
3631 +}
3632  
3633  /*
3634   *  ======== LST_GetHead ========
3635 @@ -160,7 +70,6 @@
3636   *      Pointer to element that was at the head of the list (success)
3637   *      NULL          No elements in list
3638   *  Requires:
3639 - *      - head.self must be correctly set to &head.
3640   *      - LST initialized.
3641   *      - pList != NULL.
3642   *  Ensures:
3643 @@ -169,20 +78,19 @@
3644   *      the head of the list, and the head of the list points backward (its
3645   *      "prev" pointer) to the tail of the list, this list is circular.
3646   */
3647 -       extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
3648 +static inline struct list_head *LST_GetHead(struct LST_LIST *pList)
3649 +{
3650 +       struct list_head *pElem;
3651 +
3652 +       if (!pList || list_empty(&pList->head))
3653 +               return NULL;
3654 +
3655 +       pElem = pList->head.next;
3656 +       pList->head.next = pElem->next;
3657 +       pElem->next->prev = &pList->head;
3658  
3659 -/*
3660 - *  ======== LST_Init ========
3661 - *  Purpose:
3662 - *      Initializes private state of LST module.
3663 - *  Parameters:
3664 - *  Returns:
3665 - *      TRUE if initialized; FALSE otherwise.
3666 - *  Requires:
3667 - *  Ensures:
3668 - *      LST initialized.
3669 - */
3670 -       extern bool LST_Init(void);
3671 +       return pElem;
3672 +}
3673  
3674  /*
3675   *  ======== LST_InitElem ========
3676 @@ -200,7 +108,13 @@
3677   *      of a list chain -- that would break the chain.
3678   *
3679   */
3680 -       extern void LST_InitElem(IN struct LST_ELEM *pListElem);
3681 +static inline void LST_InitElem(struct list_head *pElem)
3682 +{
3683 +       if (pElem) {
3684 +               pElem->next = NULL;
3685 +               pElem->prev = NULL;
3686 +       }
3687 +}
3688  
3689  /*
3690   *  ======== LST_InsertBefore ========
3691 @@ -218,9 +132,13 @@
3692   *      - pElemExisting != NULL.
3693   *  Ensures:
3694   */
3695 -       extern void LST_InsertBefore(IN struct LST_LIST *pList,
3696 -                                    IN struct LST_ELEM *pElem,
3697 -                                    IN struct LST_ELEM *pElemExisting);
3698 +static inline void LST_InsertBefore(struct LST_LIST *pList,
3699 +                                   struct list_head *pElem,
3700 +                                   struct list_head *pElemExisting)
3701 +{
3702 +       if (pList && pElem && pElemExisting)
3703 +               list_add_tail(pElem, pElemExisting);
3704 +}
3705  
3706  /*
3707   *  ======== LST_Next ========
3708 @@ -238,8 +156,14 @@
3709   *      - pCurElem != NULL.
3710   *  Ensures:
3711   */
3712 -       extern struct LST_ELEM *LST_Next(IN struct LST_LIST *pList,
3713 -                                        IN struct LST_ELEM *pCurElem);
3714 +static inline struct list_head *LST_Next(struct LST_LIST *pList,
3715 +                                        struct list_head *pCurElem)
3716 +{
3717 +       if (pList && !list_empty(&pList->head) && pCurElem &&
3718 +          (pCurElem->next != &pList->head))
3719 +               return pCurElem->next;
3720 +       return NULL;
3721 +}
3722  
3723  /*
3724   *  ======== LST_PutTail ========
3725 @@ -262,18 +186,18 @@
3726   *      Void
3727   *  Requires:
3728   *      *pElem and *pList must both exist.
3729 - *      pElem->self = pElem before pElem is passed to this function.
3730   *      LST initialized.
3731   *  Ensures:
3732   *  Notes:
3733   *      Because the tail is always "just before" the head of the list (the
3734   *      tail's "next" pointer points at the head of the list, and the head's
3735   *      "prev" pointer points at the tail of the list), the list is circular.
3736 - *  Warning: if pElem->self is not set beforehand, LST_GetHead() will
3737 - *      return an erroneous pointer when it is called for this element.
3738   */
3739 -       extern void LST_PutTail(IN struct LST_LIST *pList,
3740 -                               IN struct LST_ELEM *pListElem);
3741 +static inline void LST_PutTail(struct LST_LIST *pList, struct list_head *pElem)
3742 +{
3743 +       if (pList && pElem)
3744 +               list_add_tail(pElem, &pList->head);
3745 +}
3746  
3747  /*
3748   *  ======== LST_RemoveElem ========
3749 @@ -290,7 +214,11 @@
3750   *      - pCurElem != NULL.
3751   *  Ensures:
3752   */
3753 -extern void LST_RemoveElem(IN struct LST_LIST *pList,
3754 -                          IN struct LST_ELEM *pCurElem);
3755 +static inline void LST_RemoveElem(struct LST_LIST *pList,
3756 +                                 struct list_head *pCurElem)
3757 +{
3758 +       if (pList && !list_empty(&pList->head) && pCurElem)
3759 +               list_del_init(pCurElem);
3760 +}
3761  
3762  #endif                         /* LIST_ */
3763 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/mbx_sh.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/mbx_sh.h
3764 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/mbx_sh.h      2011-04-17 17:32:26.000000000 +0100
3765 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/mbx_sh.h   2011-05-02 22:36:49.000000000 +0100
3766 @@ -3,6 +3,9 @@
3767   *
3768   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3769   *
3770 + * Definitions for shared mailbox cmd/data values.(used on both
3771 + * the GPP and DSP sides).
3772 + *
3773   * Copyright (C) 2008 Texas Instruments, Inc.
3774   *
3775   * This package is free software; you can redistribute it and/or modify
3776 @@ -14,15 +17,10 @@
3777   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3778   */
3779  
3780 -
3781  /*
3782 - *  ======== mbx_sh.h ========
3783 - *  Definitions for shared mailbox cmd/data values.(used on both
3784 - *     the GPP and DSP sides).
3785 - *
3786   *  Bridge usage of OMAP mailbox 1 is determined by the "class" of the
3787 - *     mailbox interrupt's cmd value received. The class value are defined
3788 - *     as a bit (10 thru 15) being set.
3789 + *  mailbox interrupt's cmd value received. The class value are defined
3790 + *  as a bit (10 thru 15) being set.
3791   *
3792   *  Note: Only 16 bits of each  is used. Other 16 bit data reg available.
3793   *
3794 @@ -37,7 +35,6 @@
3795   *   |  (class)  | (module specific) |
3796   *
3797   *
3798 - *
3799   * B: DSP-DMA link driver channels (DDMA) : class = 1.
3800   *
3801   *    15         10                  0
3802 @@ -50,8 +47,6 @@
3803   *         c -> channel Id    (32 DDMA chnls max)
3804   *
3805   *
3806 - *
3807 - *
3808   * C: Proc-copy link driver channels (PCPY) : class = 2.
3809   *
3810   *    15         10                  0
3811 @@ -110,16 +105,6 @@
3812   *   where x -> not used
3813   *         c -> Power management command
3814   *
3815 - *
3816 - *
3817 - *! Revision History:
3818 - *! ================
3819 - *! 19-Sep-2002 mr  Added DEH reset const
3820 - *! 24-Apr-2002 sg  Added more PM commands.
3821 - *! 04-Mar-2002 gv  Added MBX_PM_CLASS
3822 - *! 22-Jan-2002 ag  Bug fix in MBX_SETZCPYVAL(x) macro.
3823 - *! 21-Dec-2001 ag  Added bit masks defns.
3824 - *! 17-Dec-2001 ag: created.
3825   */
3826  
3827  #ifndef _MBX_SH_H
3828 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/mem.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/mem.h
3829 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/mem.h 2011-04-17 17:32:26.000000000 +0100
3830 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/mem.h      2011-05-02 22:36:49.000000000 +0100
3831 @@ -3,6 +3,9 @@
3832   *
3833   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3834   *
3835 + * Memory management and address mapping services for the DSP/BIOS Bridge
3836 + * class driver and mini-driver.
3837 + *
3838   * Copyright (C) 2008 Texas Instruments, Inc.
3839   *
3840   * This package is free software; you can redistribute it and/or modify
3841 @@ -14,57 +17,6 @@
3842   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3843   */
3844  
3845 -
3846 -/*
3847 - *  ======== mem.h ========
3848 - *  Purpose:
3849 - *      Memory management and address mapping services for the DSP/BIOS Bridge
3850 - *      class driver and mini-driver.
3851 - *
3852 - *  Public Functions:
3853 - *      MEM_Alloc
3854 - *      MEM_AllocObject
3855 - *      MEM_AllocPhysMem
3856 - *      MEM_Calloc
3857 - *      MEM_Exit
3858 - *      MEM_FlushCache
3859 - *      MEM_Free
3860 - *      MEM_FreeObject
3861 - *      MEM_FreePhysMem
3862 - *      MEM_GetNumPages
3863 - *      MEM_Init
3864 - *      MEM_IsValidHandle
3865 - *      MEM_LinearAddress
3866 - *      MEM_PageLock
3867 - *      MEM_PageUnlock
3868 - *      MEM_UnMapLinearAddress
3869 - *      MEM_VirtualToPhysical
3870 - *
3871 - *  Notes:
3872 - *
3873 - *! Revision History:
3874 - *! ================
3875 - *! 19-Apr-2004 sb: Added Alloc/Free PhysMem, FlushCache, VirtualToPhysical
3876 - *! 01-Sep-2001 ag: Cleaned up notes for MEM_LinearAddress() does not
3877 - *!                   require phys address to be page aligned!
3878 - *! 02-Dec-1999 rr: stdwin.h included for retail build
3879 - *! 12-Nov-1999 kc: Added warning about use of MEM_LinearAddress.
3880 - *! 29-Oct-1999 kc: Cleaned up for code review.
3881 - *! 10-Aug-1999 kc: Based on wsx-c18.
3882 - *! 07-Jan-1998 gp: Added MEM_AllocUMB and MEM_UMBFree for User Mapped Buffers
3883 - *!                 used by WMD_CHNL.
3884 - *! 23-Dec-1997 cr: Code review cleanup, removed dead Ring 3 code.
3885 - *! 04-Aug-1997 cr: Added explicit CDECL identifiers.
3886 - *! 01-Nov-1996 gp: Updated based on code review.
3887 - *! 04-Sep-1996 gp: Added MEM_PageLock() and MEM_PageUnlock() services.
3888 - *! 14-Aug-1996 mg: Added MEM_GetPhysAddr() and MEM_GetNumPages()
3889 - *! 25-Jul-1996 gp: Added MEM_IsValidHandle() macro.
3890 - *! 10-May-1996 gp: Added MEM_Calloc().
3891 - *! 25-Apr-1996 gp: Added MEM_PhysicalAddress()
3892 - *! 17-Apr-1996 gp: Added MEM_Exit function; updated to latest naming standard.
3893 - *! 08-Apr-1996 gp: Created.
3894 - */
3895 -
3896  #ifndef MEM_
3897  #define MEM_
3898  
3899 @@ -108,13 +60,13 @@
3900   *  Ensures:
3901   *      A subsequent call to MEM_IsValidHandle() will succeed for this object.
3902   */
3903 -#define MEM_AllocObject(pObj, Obj, Signature)           \
3904 -{                                                       \
3905 -    pObj = MEM_Calloc(sizeof(Obj), MEM_NONPAGED);       \
3906 -    if (pObj) {                                         \
3907 -       pObj->dwSignature = Signature;                  \
3908 -    }                                                   \
3909 -}
3910 +#define MEM_AllocObject(pObj, Obj, Signature)          \
3911 +do {                                                   \
3912 +       pObj = MEM_Calloc(sizeof(Obj), MEM_NONPAGED);   \
3913 +       if (pObj) {                                     \
3914 +               pObj->dwSignature = Signature;          \
3915 +       }                                               \
3916 +} while (0)
3917  
3918  /*  ======== MEM_AllocPhysMem ========
3919   *  Purpose:
3920 @@ -252,11 +204,11 @@
3921   *  Ensures:
3922   *      A subsequent call to MEM_IsValidHandle() will fail for this object.
3923   */
3924 -#define MEM_FreeObject(pObj)    \
3925 -{                               \
3926 -    pObj->dwSignature = 0x00;   \
3927 -    MEM_Free(pObj);             \
3928 -}
3929 +#define MEM_FreeObject(pObj)           \
3930 +do {                                   \
3931 +       pObj->dwSignature = 0x00;       \
3932 +       MEM_Free(pObj);                 \
3933 +} while (0)
3934  
3935  /*
3936   *  ======== MEM_GetNumPages ========
3937 @@ -354,4 +306,9 @@
3938         extern void MEM_ExtPhysPoolInit(IN u32 poolPhysBase,
3939                                         IN u32 poolSize);
3940  
3941 +/*
3942 + *  ======== MEM_ExtPhysPoolRelease ========
3943 + */
3944 +       extern void MEM_ExtPhysPoolRelease(void);
3945 +
3946  #endif                         /* MEM_ */
3947 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/memdefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/memdefs.h
3948 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/memdefs.h     2011-04-17 17:32:26.000000000 +0100
3949 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/memdefs.h  2011-05-02 22:36:49.000000000 +0100
3950 @@ -3,6 +3,8 @@
3951   *
3952   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3953   *
3954 + * Global MEM constants and types, shared between WCD and WMD.
3955 + *
3956   * Copyright (C) 2008 Texas Instruments, Inc.
3957   *
3958   * This package is free software; you can redistribute it and/or modify
3959 @@ -14,20 +16,6 @@
3960   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3961   */
3962  
3963 -
3964 -/*
3965 - *  ======== memdefs.h ========
3966 - *  Purpose:
3967 - *      Global MEM constants and types, shared between WSX, WCD, and WMD.
3968 - *
3969 - *! Revision History:
3970 - *! ================
3971 - *! 28-Aug-2001 ag:  Added MEM_[SET][GET]VIRTUALSEGID.
3972 - *! 10-Aug-1999 kc:  Based on wsx-c18.
3973 - *! 15-Nov-1996 gp:  Renamed from wsxmem.h and moved to kwinos.
3974 - *! 21-Aug-1996 cr:  Created from mem.h.
3975 - */
3976 -
3977  #ifndef MEMDEFS_
3978  #define MEMDEFS_
3979  
3980 @@ -46,7 +34,4 @@
3981  #define MEM_GETVIRTUALSEGID     0x20000000
3982  #define MEM_MASKVIRTUALSEGID    (MEM_SETVIRTUALSEGID | MEM_GETVIRTUALSEGID)
3983  
3984 -#define TO_VIRTUAL_UNCACHED(x) x
3985 -#define INTREG_TO_VIRTUAL_UNCACHED(x) x
3986 -
3987  #endif                         /* MEMDEFS_ */
3988 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/mgr.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/mgr.h
3989 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/mgr.h 2011-04-17 17:32:26.000000000 +0100
3990 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/mgr.h      2011-05-02 22:36:49.000000000 +0100
3991 @@ -3,6 +3,8 @@
3992   *
3993   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3994   *
3995 + * This is the Class driver RM module interface.
3996 + *
3997   * Copyright (C) 2005-2006 Texas Instruments, Inc.
3998   *
3999   * This package is free software; you can redistribute it and/or modify
4000 @@ -14,36 +16,6 @@
4001   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4002   */
4003  
4004 -
4005 -/*
4006 - *  ======== mgr.h ========
4007 - *  Description:
4008 - *      This is the Class driver RM module interface.
4009 - *
4010 - *  Public Functions:
4011 - *      MGR_Create
4012 - *      MGR_Destroy
4013 - *      MGR_EnumNodeInfo
4014 - *      MGR_EnumProcessorInfo
4015 - *      MGR_Exit
4016 - *      MGR_GetDCDHandle
4017 - *      MGR_Init
4018 - *
4019 - *  Notes:
4020 - *
4021 - *! Revision History:
4022 - *! ================
4023 - *! 15-Oct-2002 kc: Removed legacy PERF definitions.
4024 - *! 11-Jul-2001 jeh Added CFG_HDEVNODE parameter to MGR_Create().
4025 - *! 22-Nov-2000 kc: Added MGR_GetPerfData for acquiring PERF stats.
4026 - *! 03-Nov-2000 rr: Added MGR_GetDCDHandle. Modified after code review.
4027 - *! 25-Sep-2000 rr: Updated to Version 0.9
4028 - *! 14-Aug-2000 rr: Cleaned up.
4029 - *! 07-Aug-2000 rr: MGR_Create does the job of Loading DCD Dll.
4030 - *! 27-Jul-2000 rr: Updated to ver 0.8 of DSPAPI(types).
4031 - *! 20-Jun-2000 rr: Created.
4032 - */
4033 -
4034  #ifndef MGR_
4035  #define MGR_
4036  
4037 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/mgrpriv.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/mgrpriv.h
4038 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/mgrpriv.h     2011-04-17 17:32:26.000000000 +0100
4039 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/mgrpriv.h  2011-05-02 22:36:49.000000000 +0100
4040 @@ -3,6 +3,8 @@
4041   *
4042   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4043   *
4044 + * Global MGR constants and types, shared by PROC, MGR, and WCD.
4045 + *
4046   * Copyright (C) 2008 Texas Instruments, Inc.
4047   *
4048   * This package is free software; you can redistribute it and/or modify
4049 @@ -14,18 +16,6 @@
4050   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4051   */
4052  
4053 -
4054 -/*
4055 - *  ======== mgrpriv.h ========
4056 - *  Description:
4057 - *      Global MGR constants and types, shared by PROC, MGR, and WCD.
4058 - *
4059 - *! Revision History:
4060 - *! ================
4061 - *! 29-July-2001 ag: added MGR_PROCESSOREXTINFO.
4062 - *! 05-July-2000 rr: Created
4063 - */
4064 -
4065  #ifndef MGRPRIV_
4066  #define MGRPRIV_
4067  
4068 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/msg.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/msg.h
4069 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/msg.h 2011-04-17 17:32:26.000000000 +0100
4070 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/msg.h      2011-05-02 22:36:49.000000000 +0100
4071 @@ -3,6 +3,8 @@
4072   *
4073   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4074   *
4075 + * DSP/BIOS Bridge MSG Module.
4076 + *
4077   * Copyright (C) 2005-2006 Texas Instruments, Inc.
4078   *
4079   * This package is free software; you can redistribute it and/or modify
4080 @@ -14,28 +16,6 @@
4081   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4082   */
4083  
4084 -
4085 -/*
4086 - *  ======== msg.h ========
4087 - *  Description:
4088 - *      DSP/BIOS Bridge MSG Module.
4089 - *
4090 - *  Public Functions:
4091 - *      MSG_Create
4092 - *      MSG_Delete
4093 - *      MSG_Exit
4094 - *      MSG_Init
4095 - *
4096 - *  Notes:
4097 - *
4098 - *! Revision History:
4099 - *! =================
4100 - *! 17-Nov-2000 jeh     Removed MSG_Get, MSG_Put, MSG_CreateQueue,
4101 - *!                     MSG_DeleteQueue, and MSG_RegisterNotify, since these
4102 - *!                     are now part of mini-driver.
4103 - *! 12-Sep-2000 jeh     Created.
4104 - */
4105 -
4106  #ifndef MSG_
4107  #define MSG_
4108  
4109 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/msgdefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/msgdefs.h
4110 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/msgdefs.h     2011-04-17 17:32:26.000000000 +0100
4111 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/msgdefs.h  2011-05-02 22:36:49.000000000 +0100
4112 @@ -3,6 +3,8 @@
4113   *
4114   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4115   *
4116 + * Global MSG constants and types.
4117 + *
4118   * Copyright (C) 2005-2006 Texas Instruments, Inc.
4119   *
4120   * This package is free software; you can redistribute it and/or modify
4121 @@ -14,19 +16,6 @@
4122   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4123   */
4124  
4125 -
4126 -/*
4127 - *  ======== msgdefs.h ========
4128 - *  Description:
4129 - *      Global MSG constants and types.
4130 - *
4131 - *! Revision History
4132 - *! ================
4133 - *! 09-May-2001 jeh Removed MSG_TODSP, MSG_FROMDSP.
4134 - *! 17-Nov-2000 jeh Added MSGMGR_SIGNATURE.
4135 - *! 12-Sep-2000 jeh Created.
4136 - */
4137 -
4138  #ifndef MSGDEFS_
4139  #define MSGDEFS_
4140  
4141 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/nldr.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/nldr.h
4142 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/nldr.h        2011-04-17 17:32:26.000000000 +0100
4143 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/nldr.h     2011-05-02 22:36:49.000000000 +0100
4144 @@ -3,6 +3,8 @@
4145   *
4146   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4147   *
4148 + * DSP/BIOS Bridge dynamic loader interface.
4149 + *
4150   * Copyright (C) 2005-2006 Texas Instruments, Inc.
4151   *
4152   * This package is free software; you can redistribute it and/or modify
4153 @@ -14,33 +16,6 @@
4154   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4155   */
4156  
4157 -
4158 -/*
4159 - *  ======== nldr.h ========
4160 - *
4161 - *  Description:
4162 - *      DSP/BIOS Bridge dynamic loader interface. See the file dldrdefs.h
4163 - *  for a description of these functions.
4164 - *
4165 - *  Public Functions:
4166 - *      NLDR_Allocate
4167 - *      NLDR_Create
4168 - *      NLDR_Delete
4169 - *      NLDR_Exit
4170 - *      NLDR_Free
4171 - *      NLDR_GetFxnAddr
4172 - *      NLDR_Init
4173 - *      NLDR_Load
4174 - *      NLDR_Unload
4175 - *
4176 - *  Notes:
4177 - *
4178 - *! Revision History
4179 - *! ================
4180 - *! 31-Jul-2002 jeh     Removed function header comments.
4181 - *! 17-Apr-2002 jeh     Created.
4182 - */
4183 -
4184  #include <dspbridge/dbdefs.h>
4185  #include <dspbridge/dbdcddef.h>
4186  #include <dspbridge/dev.h>
4187 @@ -63,7 +38,6 @@
4188  
4189         extern void NLDR_Delete(struct NLDR_OBJECT *hNldr);
4190         extern void NLDR_Exit(void);
4191 -       extern void NLDR_Free(struct NLDR_NODEOBJECT *hNldrNode);
4192  
4193         extern DSP_STATUS NLDR_GetFxnAddr(struct NLDR_NODEOBJECT *hNldrNode,
4194                                           char *pstrFxn, u32 *pulAddr);
4195 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/nldrdefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/nldrdefs.h
4196 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/nldrdefs.h    2011-04-17 17:32:26.000000000 +0100
4197 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/nldrdefs.h 2011-05-02 22:36:49.000000000 +0100
4198 @@ -3,6 +3,8 @@
4199   *
4200   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4201   *
4202 + * Global Dynamic + static/overlay Node loader (NLDR) constants and types.
4203 + *
4204   * Copyright (C) 2008 Texas Instruments, Inc.
4205   *
4206   * This package is free software; you can redistribute it and/or modify
4207 @@ -14,18 +16,6 @@
4208   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4209   */
4210  
4211 -
4212 -/*
4213 - *  ======== nldrdefs.h ========
4214 - *  Description:
4215 - *      Global Dynamic + static/overlay Node loader (NLDR) constants and types.
4216 - *
4217 - *! Revision History
4218 - *! ================
4219 - *! 07-Apr-2003 map     Consolidated dldrdefs.h into nldrdefs.h
4220 - *! 05-Aug-2002 jeh     Created.
4221 - */
4222 -
4223  #ifndef NLDRDEFS_
4224  #define NLDRDEFS_
4225  
4226 @@ -297,7 +287,6 @@
4227                 NLDR_CREATEFXN pfnCreate;
4228                 NLDR_DELETEFXN pfnDelete;
4229                 NLDR_EXITFXN pfnExit;
4230 -               NLDR_FREEFXN pfnFree;
4231                 NLDR_GETFXNADDRFXN pfnGetFxnAddr;
4232                 NLDR_INITFXN pfnInit;
4233                 NLDR_LOADFXN pfnLoad;
4234 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/node.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/node.h
4235 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/node.h        2011-04-17 17:32:26.000000000 +0100
4236 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/node.h     2011-05-02 22:36:49.000000000 +0100
4237 @@ -3,6 +3,8 @@
4238   *
4239   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4240   *
4241 + * DSP/BIOS Bridge Node Manager.
4242 + *
4243   * Copyright (C) 2005-2006 Texas Instruments, Inc.
4244   *
4245   * This package is free software; you can redistribute it and/or modify
4246 @@ -14,52 +16,6 @@
4247   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4248   */
4249  
4250 -
4251 -/*
4252 - *  ======== node.h ========
4253 - *  Description:
4254 - *      DSP/BIOS Bridge Node Manager.
4255 - *
4256 - *  Public Functions:
4257 - *      NODE_Allocate
4258 - *      NODE_AllocMsgBuf
4259 - *      NODE_ChangePriority
4260 - *      NODE_Connect
4261 - *      NODE_Create
4262 - *      NODE_CreateMgr
4263 - *      NODE_Delete
4264 - *      NODE_DeleteMgr
4265 - *      NODE_EnumNodes
4266 - *      NODE_Exit
4267 - *      NODE_FreeMsgBuf
4268 - *      NODE_GetAttr
4269 - *      NODE_GetMessage
4270 - *      NODE_GetProcessor
4271 - *      NODE_Init
4272 - *      NODE_OnExit
4273 - *      NODE_Pause
4274 - *      NODE_PutMessage
4275 - *      NODE_RegisterNotify
4276 - *      NODE_Run
4277 - *      NODE_Terminate
4278 - *
4279 - *  Notes:
4280 - *
4281 - *! Revision History:
4282 - *! =================
4283 - *! 23-Apr-2001 jeh     Updated with code review changes.
4284 - *! 16-Jan-2001 jeh     Added DSP_ESYMBOL, DSP_EUUID to return codes.
4285 - *! 17-Nov-2000 jeh     Added NODE_OnExit().
4286 - *! 27-Oct-2000 jeh     Added timeouts to NODE_GetMessage, NODE_PutMessage.
4287 - *! 12-Oct-2000 jeh     Changed NODE_EnumNodeInfo to NODE_EnumNodes. Removed
4288 - *!                     NODE_RegisterAllNodes().
4289 - *! 07-Sep-2000 jeh     Changed type HANDLE in NODE_RegisterNotify to
4290 - *!                     DSP_HNOTIFICATION. Added DSP_STRMATTR param to
4291 - *!                     NODE_Connect(). Removed NODE_GetMessageStream().
4292 - *! 17-Jul-2000 jeh     Updated function header descriptions.
4293 - *! 19-Jun-2000 jeh     Created.
4294 - */
4295 -
4296  #ifndef NODE_
4297  #define NODE_
4298  
4299 @@ -352,7 +308,7 @@
4300   *        (*puAllocated == *puNumNodes)
4301   */
4302         extern DSP_STATUS NODE_EnumNodes(struct NODE_MGR *hNodeMgr,
4303 -                                        IN DSP_HNODE *aNodeTab,
4304 +                                        void **aNodeTab,
4305                                          u32 uNodeTabSize,
4306                                          OUT u32 *puNumNodes,
4307                                          OUT u32 *puAllocated);
4308 @@ -614,7 +570,7 @@
4309   *  Parameters:
4310   *
4311   */
4312 -       extern DSP_STATUS NODE_GetUUIDProps(DSP_HPROCESSOR hProcessor,
4313 +       extern DSP_STATUS NODE_GetUUIDProps(void *hProcessor,
4314                                             IN CONST struct DSP_UUID *pNodeId,
4315                                             OUT struct DSP_NDBPROPS
4316                                             *pNodeProps);
4317 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/nodedefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/nodedefs.h
4318 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/nodedefs.h    2011-04-17 17:32:26.000000000 +0100
4319 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/nodedefs.h 2011-05-02 22:36:49.000000000 +0100
4320 @@ -3,6 +3,8 @@
4321   *
4322   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4323   *
4324 + * Global NODE constants and types, shared by PROCESSOR, NODE, and DISP.
4325 + *
4326   * Copyright (C) 2005-2006 Texas Instruments, Inc.
4327   *
4328   * This package is free software; you can redistribute it and/or modify
4329 @@ -14,20 +16,6 @@
4330   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4331   */
4332  
4333 -
4334 -/*
4335 - *  ======== nodedefs.h ========
4336 - *  Description:
4337 - *      Global NODE constants and types, shared by PROCESSOR, NODE, and DISP.
4338 - *
4339 - *! Revision History
4340 - *! ================
4341 - *! 23-Apr-2001 jeh     Removed NODE_MGRATTRS.
4342 - *! 21-Sep-2000 jeh     Removed NODE_TYPE enum.
4343 - *! 17-Jul-2000 jeh     Changed order of node types to match rms_sh.h.
4344 - *! 20-Jun-2000 jeh     Created.
4345 - */
4346 -
4347  #ifndef NODEDEFS_
4348  #define NODEDEFS_
4349  
4350 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/nodepriv.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/nodepriv.h
4351 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/nodepriv.h    2011-04-17 17:32:26.000000000 +0100
4352 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/nodepriv.h 2011-05-02 22:36:49.000000000 +0100
4353 @@ -3,6 +3,8 @@
4354   *
4355   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4356   *
4357 + * Private node header shared by NODE and DISP.
4358 + *
4359   * Copyright (C) 2005-2006 Texas Instruments, Inc.
4360   *
4361   * This package is free software; you can redistribute it and/or modify
4362 @@ -14,27 +16,6 @@
4363   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4364   */
4365  
4366 -/*
4367 - *  ======== nodepriv.h ========
4368 - *  Description:
4369 - *      Private node header shared by NODE and DISP.
4370 - *
4371 - *  Public Functions:
4372 - *      NODE_GetChannelId
4373 - *      NODE_GetStrmMgr
4374 - *      NODE_GetTimeout
4375 - *      NODE_GetType
4376 - *      NODE_GetLoadType
4377 - *
4378 - *! Revision History
4379 - *! ================
4380 - *! 19-Nov-2002 map     Added NODE_GetLoadType
4381 - *! 13-Feb-2002 jeh     Added uSysStackSize to NODE_TASKARGS.
4382 - *! 23-Apr-2001 jeh     Removed unused typedefs, defines.
4383 - *! 10-Oct-2000 jeh     Added alignment to NODE_STRMDEF.
4384 - *! 20-Jun-2000 jeh     Created.
4385 - */
4386 -
4387  #ifndef NODEPRIV_
4388  #define NODEPRIV_
4389  
4390 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/ntfy.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/ntfy.h
4391 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/ntfy.h        2011-04-17 17:32:26.000000000 +0100
4392 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/ntfy.h     2011-05-02 22:36:49.000000000 +0100
4393 @@ -3,6 +3,8 @@
4394   *
4395   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4396   *
4397 + * Manage lists of notification events.
4398 + *
4399   * Copyright (C) 2005-2006 Texas Instruments, Inc.
4400   *
4401   * This package is free software; you can redistribute it and/or modify
4402 @@ -14,26 +16,6 @@
4403   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4404   */
4405  
4406 -
4407 -/*
4408 - *  ======== ntfy.h ========
4409 - *  Purpose:
4410 - *      Manage lists of notification events.
4411 - *
4412 - *  Public Functions:
4413 - *      NTFY_Create
4414 - *      NTFY_Delete
4415 - *      NTFY_Exit
4416 - *      NTFY_Init
4417 - *      NTFY_Notify
4418 - *      NTFY_Register
4419 - *
4420 - *! Revision History:
4421 - *! =================
4422 - *! 05-Nov-2001 kc: Updated NTFY_Register.
4423 - *! 07-Sep-2000 jeh Created.
4424 - */
4425 -
4426  #ifndef NTFY_
4427  #define NTFY_
4428  
4429 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/proc.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/proc.h
4430 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/proc.h        2011-04-17 17:32:26.000000000 +0100
4431 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/proc.h     2011-05-02 22:36:49.000000000 +0100
4432 @@ -3,6 +3,8 @@
4433   *
4434   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4435   *
4436 + * This is the Class driver RM module interface.
4437 + *
4438   * Copyright (C) 2005-2006 Texas Instruments, Inc.
4439   *
4440   * This package is free software; you can redistribute it and/or modify
4441 @@ -14,51 +16,6 @@
4442   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4443   */
4444  
4445 -
4446 -/*
4447 - *  ======== proc.h ========
4448 - *  Description:
4449 - *     This is the Class driver RM module interface.
4450 - *
4451 - *  Public Functions:
4452 - *      PROC_Attach
4453 - *      PROC_Create
4454 - *      PROC_Ctrl             (OEM-function)
4455 - *      PROC_Destroy
4456 - *      PROC_Detach
4457 - *      PROC_EnumNodes
4458 - *      PROC_Exit
4459 - *      PROC_FlushMemory
4460 - *      PROC_GetDevObject       (OEM-function)
4461 - *      PROC_GetResourceInfo
4462 - *      PROC_GetState
4463 - *      PROC_GetProcessorId
4464 - *      PROC_GetTrace     (OEM-function)
4465 - *      PROC_Init
4466 - *      PROC_Load             (OEM-function)
4467 - *      PROC_Map
4468 - *      PROC_NotifyAllclients
4469 - *      PROC_NotifyClients      (OEM-function)
4470 - *      PROC_RegisterNotify
4471 - *      PROC_ReserveMemory
4472 - *      PROC_Start           (OEM-function)
4473 - *      PROC_UnMap
4474 - *      PROC_UnReserveMemory
4475 - *
4476 - *  Notes:
4477 - *
4478 - *! Revision History:
4479 - *! ================
4480 - *! 19-Apr-2004 sb  Aligned DMM definitions with Symbian
4481 - *! 08-Mar-2004 sb  Added the Dynamic Memory Mapping APIs
4482 - *! 09-Feb-2003 vp: Added PROC_GetProcessorID function
4483 - *! 29-Nov-2000 rr: Incorporated code review changes.
4484 - *! 28-Sep-2000 rr: Updated to Version 0.9.
4485 - *! 10-Aug-2000 rr: PROC_NotifyClients, PROC_GetProcessorHandle Added
4486 - *! 27-Jul-2000 rr: Updated to ver 0.8 of DSPAPI(types). GetTrace added.
4487 - *! 27-Jun-2000 rr: Created from dspapi.h
4488 - */
4489 -
4490  #ifndef PROC_
4491  #define PROC_
4492  
4493 @@ -66,29 +23,6 @@
4494  #include <dspbridge/devdefs.h>
4495  #include <dspbridge/drv.h>
4496  
4497 -/* The PROC_OBJECT structure.   */
4498 -struct PROC_OBJECT {
4499 -       struct LST_ELEM link;           /* Link to next PROC_OBJECT */
4500 -       u32 dwSignature;                /* Used for object validation */
4501 -       struct DEV_OBJECT *hDevObject;  /* Device this PROC represents */
4502 -       u32 hProcess;                   /* Process owning this Processor */
4503 -       struct MGR_OBJECT *hMgrObject;  /* Manager Object Handle */
4504 -       u32 uAttachCount;               /* Processor attach count */
4505 -       u32 uProcessor;                 /* Processor number */
4506 -       u32 uTimeout;                   /* Time out count */
4507 -       enum DSP_PROCSTATE sState;      /* Processor state */
4508 -       u32 ulUnit;                     /* DDSP unit number */
4509 -       bool bIsAlreadyAttached;        /*
4510 -                                        * True if the Device below has
4511 -                                        * GPP Client attached
4512 -                                        */
4513 -       struct NTFY_OBJECT *hNtfy;      /* Manages  notifications */
4514 -       struct WMD_DEV_CONTEXT *hWmdContext;    /* WMD Context Handle */
4515 -       struct WMD_DRV_INTERFACE *pIntfFxns;    /* Function interface to WMD */
4516 -       char *g_pszLastCoff;
4517 -       struct list_head proc_object;
4518 -};
4519 -
4520  /*
4521   *  ======== PROC_Attach ========
4522   *  Purpose:
4523 @@ -117,8 +51,7 @@ struct PROC_OBJECT {
4524   */
4525         extern DSP_STATUS PROC_Attach(u32 uProcessor,
4526                                       OPTIONAL CONST struct DSP_PROCESSORATTRIN
4527 -                                     *pAttrIn,
4528 -                                     OUT DSP_HPROCESSOR *phProcessor,
4529 +                                     *pAttrIn, void **phProcessor,
4530                                       struct PROCESS_CONTEXT *pr_ctxt);
4531  
4532  /*
4533 @@ -167,7 +100,7 @@ struct PROC_OBJECT {
4534   *  Details:
4535   *      This function Calls WMD_BRD_Ioctl.
4536   */
4537 -       extern DSP_STATUS PROC_Ctrl(DSP_HPROCESSOR hProcessor,
4538 +       extern DSP_STATUS PROC_Ctrl(void *hProcessor,
4539                                     u32 dwCmd, IN struct DSP_CBDATA *pArgs);
4540  
4541  /*
4542 @@ -176,7 +109,7 @@ struct PROC_OBJECT {
4543   *      Close a DSP processor and de-allocate all (GPP) resources reserved
4544   *      for it. The Processor Object is deleted.
4545   *  Parameters:
4546 - *      hProcessor  :   The processor handle.
4547 + *      pr_ctxt     :   The processor handle.
4548   *  Returns:
4549   *      DSP_SOK     :   Success.
4550   *      DSP_EHANDLE :   InValid Handle.
4551 @@ -186,8 +119,7 @@ struct PROC_OBJECT {
4552   *  Ensures:
4553   *      PROC Object is destroyed.
4554   */
4555 -       extern DSP_STATUS PROC_Detach(DSP_HPROCESSOR hProcessor,
4556 -                       struct PROCESS_CONTEXT *pr_ctxt);
4557 +       extern DSP_STATUS PROC_Detach(struct PROCESS_CONTEXT *pr_ctxt);
4558  
4559  /*
4560   *  ======== PROC_EnumNodes ========
4561 @@ -220,8 +152,8 @@ struct PROC_OBJECT {
4562   *  Ensures:
4563   *  Details:
4564   */
4565 -       extern DSP_STATUS PROC_EnumNodes(DSP_HPROCESSOR hProcessor,
4566 -                                        IN DSP_HNODE *aNodeTab,
4567 +       extern DSP_STATUS PROC_EnumNodes(void *hProcessor,
4568 +                                        void **aNodeTab,
4569                                          IN u32 uNodeTabSize,
4570                                          OUT u32 *puNumNodes,
4571                                          OUT u32 *puAllocated);
4572 @@ -254,7 +186,7 @@ struct PROC_OBJECT {
4573   *      This function currently returns
4574   *      DSP_ENOTIMPL, and does not write any data to the pResourceInfo struct.
4575   */
4576 -       extern DSP_STATUS PROC_GetResourceInfo(DSP_HPROCESSOR hProcessor,
4577 +       extern DSP_STATUS PROC_GetResourceInfo(void *hProcessor,
4578                                                u32 uResourceType,
4579                                                OUT struct DSP_RESOURCEINFO *
4580                                                pResourceInfo,
4581 @@ -291,7 +223,7 @@ struct PROC_OBJECT {
4582   *      DSP_SOK     :   *phDevObject is not NULL
4583   *      DSP_EFAIL   :   *phDevObject is NULL.
4584   */
4585 -       extern DSP_STATUS PROC_GetDevObject(DSP_HPROCESSOR hProcessor,
4586 +       extern DSP_STATUS PROC_GetDevObject(void *hProcessor,
4587                                             struct DEV_OBJECT **phDevObject);
4588  
4589  /*
4590 @@ -328,7 +260,7 @@ struct PROC_OBJECT {
4591   *  Ensures:
4592   *  Details:
4593   */
4594 -       extern DSP_STATUS PROC_GetState(DSP_HPROCESSOR hProcessor,
4595 +       extern DSP_STATUS PROC_GetState(void *hProcessor,
4596                                         OUT struct DSP_PROCESSORSTATE
4597                                         *pProcStatus,
4598                                         u32 uStateInfoSize);
4599 @@ -352,7 +284,7 @@ struct PROC_OBJECT {
4600   *  Ensures:
4601   *  Details:
4602   */
4603 -       extern DSP_STATUS PROC_GetProcessorId(DSP_HPROCESSOR hProcessor,
4604 +       extern DSP_STATUS PROC_GetProcessorId(void *hProcessor,
4605                                               u32 *procID);
4606  
4607  /*
4608 @@ -375,7 +307,7 @@ struct PROC_OBJECT {
4609   *  Ensures:
4610   *  Details:
4611   */
4612 -       extern DSP_STATUS PROC_GetTrace(DSP_HPROCESSOR hProcessor, u8 *pBuf,
4613 +       extern DSP_STATUS PROC_GetTrace(void *hProcessor, u8 *pBuf,
4614                                         u32 uMaxSize);
4615  
4616  /*
4617 @@ -409,7 +341,7 @@ struct PROC_OBJECT {
4618   *      Does not implement access rights to control which GPP application
4619   *      can load the processor.
4620   */
4621 -       extern DSP_STATUS PROC_Load(DSP_HPROCESSOR hProcessor,
4622 +       extern DSP_STATUS PROC_Load(void *hProcessor,
4623                                     IN CONST s32 iArgc, IN CONST char **aArgv,
4624                                     IN CONST char **aEnvp);
4625  
4626 @@ -435,7 +367,7 @@ struct PROC_OBJECT {
4627   *  Ensures:
4628   *  Details:
4629   */
4630 -       extern DSP_STATUS PROC_RegisterNotify(DSP_HPROCESSOR hProcessor,
4631 +       extern DSP_STATUS PROC_RegisterNotify(void *hProcessor,
4632                                               u32 uEventMask, u32 uNotifyType,
4633                                               struct DSP_NOTIFICATION
4634                                               *hNotification);
4635 @@ -457,7 +389,7 @@ struct PROC_OBJECT {
4636   *      PROC Initialized.
4637   *  Ensures:
4638   */
4639 -       extern DSP_STATUS PROC_NotifyClients(DSP_HPROCESSOR hProc,
4640 +       extern DSP_STATUS PROC_NotifyClients(void *hProc,
4641                                              u32 uEvents);
4642  
4643  /*
4644 @@ -480,7 +412,7 @@ struct PROC_OBJECT {
4645   *      NODE And STRM would use this function to notify their clients
4646   *      about the state changes in NODE or STRM.
4647   */
4648 -       extern DSP_STATUS PROC_NotifyAllClients(DSP_HPROCESSOR hProc,
4649 +       extern DSP_STATUS PROC_NotifyAllClients(void *hProc,
4650                                                 u32 uEvents);
4651  
4652  /*
4653 @@ -503,7 +435,7 @@ struct PROC_OBJECT {
4654   *      Success and ProcState == PROC_RUNNING or DSP_FAILED status.
4655   *  Details:
4656   */
4657 -       extern DSP_STATUS PROC_Start(DSP_HPROCESSOR hProcessor);
4658 +       extern DSP_STATUS PROC_Start(void *hProcessor);
4659  
4660  /*
4661   *  ======== PROC_Stop ========
4662 @@ -525,7 +457,7 @@ struct PROC_OBJECT {
4663   *      Success and ProcState == PROC_RUNNING or DSP_FAILED status.
4664   *  Details:
4665   */
4666 -       extern DSP_STATUS PROC_Stop(DSP_HPROCESSOR hProcessor);
4667 +       extern DSP_STATUS PROC_Stop(void *hProcessor);
4668  
4669  /*
4670   *  ======== PROC_FlushMemory ========
4671 @@ -546,7 +478,7 @@ struct PROC_OBJECT {
4672   *  Details:
4673   *      All the arguments are currently ignored.
4674   */
4675 -       extern DSP_STATUS PROC_FlushMemory(DSP_HPROCESSOR hProcessor,
4676 +       extern DSP_STATUS PROC_FlushMemory(void *hProcessor,
4677                                            void *pMpuAddr,
4678                                            u32 ulSize, u32 ulFlags);
4679  
4680 @@ -569,7 +501,7 @@ struct PROC_OBJECT {
4681   *  Details:
4682   *      All the arguments are currently ignored.
4683   */
4684 -       extern DSP_STATUS PROC_InvalidateMemory(DSP_HPROCESSOR hProcessor,
4685 +       extern DSP_STATUS PROC_InvalidateMemory(void *hProcessor,
4686                                            void *pMpuAddr,
4687                                            u32 ulSize);
4688  
4689 @@ -600,7 +532,7 @@ struct PROC_OBJECT {
4690   *  Ensures:
4691   *  Details:
4692   */
4693 -       extern DSP_STATUS PROC_Map(DSP_HPROCESSOR hProcessor,
4694 +       extern DSP_STATUS PROC_Map(void *hProcessor,
4695                                    void *pMpuAddr,
4696                                    u32 ulSize,
4697                                    void *pReqAddr,
4698 @@ -626,7 +558,7 @@ struct PROC_OBJECT {
4699   *  Ensures:
4700   *  Details:
4701   */
4702 -       extern DSP_STATUS PROC_ReserveMemory(DSP_HPROCESSOR hProcessor,
4703 +       extern DSP_STATUS PROC_ReserveMemory(void *hProcessor,
4704                                              u32 ulSize, void **ppRsvAddr);
4705  
4706  /*
4707 @@ -648,7 +580,7 @@ struct PROC_OBJECT {
4708   *  Ensures:
4709   *  Details:
4710   */
4711 -       extern DSP_STATUS PROC_UnMap(DSP_HPROCESSOR hProcessor, void *pMapAddr,
4712 +       extern DSP_STATUS PROC_UnMap(void *hProcessor, void *pMapAddr,
4713                         struct PROCESS_CONTEXT *pr_ctxt);
4714  
4715  /*
4716 @@ -670,7 +602,7 @@ struct PROC_OBJECT {
4717   *  Ensures:
4718   *  Details:
4719   */
4720 -       extern DSP_STATUS PROC_UnReserveMemory(DSP_HPROCESSOR hProcessor,
4721 +       extern DSP_STATUS PROC_UnReserveMemory(void *hProcessor,
4722                                                void *pRsvAddr);
4723  
4724  #endif                         /* PROC_ */
4725 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/procpriv.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/procpriv.h
4726 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/procpriv.h    2011-04-17 17:32:26.000000000 +0100
4727 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/procpriv.h 2011-05-02 22:36:49.000000000 +0100
4728 @@ -3,6 +3,8 @@
4729   *
4730   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4731   *
4732 + * Global PROC constants and types, shared by PROC, MGR and WCD.
4733 + *
4734   * Copyright (C) 2005-2006 Texas Instruments, Inc.
4735   *
4736   * This package is free software; you can redistribute it and/or modify
4737 @@ -14,17 +16,6 @@
4738   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4739   */
4740  
4741 -
4742 -/*
4743 - *  ======== procpriv.h ========
4744 - *  Description:
4745 - *      Global PROC constants and types, shared by PROC, MGR, and WCD.
4746 - *
4747 - *! Revision History:
4748 - *! ================
4749 - *! 05-July-2000 rr: Created
4750 - */
4751 -
4752  #ifndef PROCPRIV_
4753  #define PROCPRIV_
4754  
4755 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/pwr.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/pwr.h
4756 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/pwr.h 2011-04-17 17:32:26.000000000 +0100
4757 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/pwr.h      2011-05-02 22:36:49.000000000 +0100
4758 @@ -14,25 +14,6 @@
4759   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4760   */
4761  
4762 -
4763 -/*
4764 - *  ======== pwr.h ========
4765 - *
4766 - *  Public Functions:
4767 - *
4768 - *      PWR_SleepDSP
4769 - *      PWR_WakeDSP
4770 - *
4771 - *  Notes:
4772 - *
4773 - *! Revision History:
4774 - *! ================
4775 - *! 06-Jun-2002 sg  Replaced dspdefs.h with includes of dbdefs.h and errbase.h.
4776 - *! 13-May-2002 sg  Added DSP_SAREADYASLEEP and DSP_SALREADYAWAKE.
4777 - *! 09-May-2002 sg  Updated, added timeouts.
4778 - *! 02-May-2002 sg  Initial.
4779 - */
4780 -
4781  #ifndef PWR_
4782  #define PWR_
4783  
4784 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/pwr_sh.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/pwr_sh.h
4785 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/pwr_sh.h      2011-04-17 17:32:26.000000000 +0100
4786 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/pwr_sh.h   2011-05-02 22:36:49.000000000 +0100
4787 @@ -3,6 +3,8 @@
4788   *
4789   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4790   *
4791 + * Power Manager shared definitions (used on both GPP and DSP sides).
4792 + *
4793   * Copyright (C) 2008 Texas Instruments, Inc.
4794   *
4795   * This package is free software; you can redistribute it and/or modify
4796 @@ -14,16 +16,6 @@
4797   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4798   */
4799  
4800 -/*
4801 - *  ======== pwr_sh.h ========
4802 - *
4803 - *  Power Manager shared definitions (used on both GPP and DSP sides).
4804 - *
4805 - *! Revision History
4806 - *! ================
4807 - *! 17-Apr-2002 sg: Initial.
4808 - */
4809 -
4810  #ifndef PWR_SH_
4811  #define PWR_SH_
4812  
4813 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/reg.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/reg.h
4814 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/reg.h 2011-04-17 17:32:26.000000000 +0100
4815 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/reg.h      2011-05-02 22:36:49.000000000 +0100
4816 @@ -3,6 +3,8 @@
4817   *
4818   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4819   *
4820 + * Provides registry functions.
4821 + *
4822   * Copyright (C) 2005-2006 Texas Instruments, Inc.
4823   *
4824   * This package is free software; you can redistribute it and/or modify
4825 @@ -14,62 +16,11 @@
4826   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4827   */
4828  
4829 -
4830 -/*
4831 - *  ======== reg.h ========
4832 - *  Purpose:
4833 - *      Provide registry functions.
4834 - *
4835 - *  Public Functions:
4836 - *      REG_DeleteValue
4837 - *      REG_EnumKey
4838 - *      REG_EnumValue
4839 - *      REG_Exit
4840 - *      REG_GetValue
4841 - *      REG_Init
4842 - *      REG_SetValue
4843 - *
4844 - *! Revision History:
4845 - *! =================
4846 - *! 30-Oct-2000 kc: Updated REG_SetValue & REG_GetValue; renamed
4847 - *!                 REG_DeleteEntry to REG_DeleteValue.
4848 - *! 29-Sep-2000 kc: Updated a REG functions for code review.
4849 - *! 12-Aug-2000 kc: Renamed REG_EnumValue to REG_EnumKey. Re-implemented
4850 - *!                 REG_EnumValue.
4851 - *! 03-Feb-2000 rr: REG_EnumValue Fxn Added
4852 - *! 13-Dec-1999 rr: windows.h removed
4853 - *! 02-Dec-1999 rr: windows.h included for retail build
4854 - *! 22-Nov-1999 kc: Changes from code review.
4855 - *! 29-Dec-1997 cr: Changes from code review.
4856 - *! 27-Oct-1997 cr: Added REG_DeleteValue.
4857 - *! 20-Oct-1997 cr: Added ability to pass bValue = NULL to REG_GetValue
4858 - *!                 and return size of reg entry in pdwValueSize.
4859 - *! 29-Sep-1997 cr: Added REG_SetValue
4860 - *! 29-Aug-1997 cr: Created.
4861 - */
4862 -
4863  #ifndef _REG_H
4864  #define _REG_H
4865  
4866  #include <linux/types.h>
4867  
4868 -/*  ------------------------- Defines, Data Structures, Typedefs for Linux */
4869 -#ifndef UNDER_CE
4870 -
4871 -#ifndef REG_SZ
4872 -#define REG_SZ          1
4873 -#endif
4874 -
4875 -#ifndef REG_BINARY
4876 -#define REG_BINARY      3
4877 -#endif
4878 -
4879 -#ifndef REG_DWORD
4880 -#define REG_DWORD       4
4881 -#endif
4882 -
4883 -#endif                         /* UNDER_CE */
4884 -
4885  #define REG_MAXREGPATHLENGTH    255
4886  
4887  /*
4888 @@ -78,57 +29,18 @@
4889   *      Deletes a registry entry. NOTE: A registry entry is not the same as
4890   *      a registry key.
4891   *  Parameters:
4892 - *      phKey:      Currently reserved; must be NULL.
4893 - *      pstrSubkey: Path to key to open.
4894   *      pstrValue:  Name of entry to delete.
4895   *  Returns:
4896   *      DSP_SOK:    Success.
4897   *      DSP_EFAIL:  General failure.
4898   *  Requires:
4899   *      - REG initialized.
4900 - *      - pstrSubkey & pstrValue are non-NULL values.
4901 - *      - phKey is NULL.
4902 - *      - length of pstrSubkey < REG_MAXREGPATHLENGTH.
4903 + *      - pstrValue is non-NULL value.
4904   *      - length of pstrValue < REG_MAXREGPATHLENGTH.
4905   *  Ensures:
4906   *  Details:
4907   */
4908 -       extern DSP_STATUS REG_DeleteValue(OPTIONAL IN HANDLE *phKey,
4909 -                                         IN CONST char *pstrSubkey,
4910 -                                         IN CONST char *pstrValue);
4911 -
4912 -/*
4913 - *  ======== REG_EnumKey ========
4914 - *  Purpose:
4915 - *      Enumerates subkeys of the specified path to the  registry key
4916 - *      Retrieves the  name of the subkey(given the index) and
4917 - *      appends with the orignal path to form the full path.
4918 - *  Parameters:
4919 - *      phKey:      Currently reserved; must be NULL.
4920 - *      pstrKey     The name of the registry key to be enumerated.
4921 - *      dwIndex     Specifies the index of the subkey to retrieve.
4922 - *      pstrSubkey: Pointer to buffer that receives full path name of the
4923 - *                  specified key + the sub-key
4924 - *      pdwValueSize:   Specifies bytes of memory pstrSubkey points to on input,
4925 - *                      on output, specifies actual memory bytes written into.
4926 - *                      If there is no sub key,pdwValueSize returns NULL.
4927 - *  Returns:
4928 - *      DSP_SOK:    Success.
4929 - *      DSP_EFAIL:  General failure.
4930 - *  Requires:
4931 - *      - REG initialized.
4932 - *      - pstrKey is non-NULL value.
4933 - *      - pdwValueSize is a valid pointer.
4934 - *      - phKey is NULL.
4935 - *      - length of pstrKey < REG_MAXREGPATHLENGTH.
4936 - *  Ensures:
4937 - *      - strlen(pstrSubkey) is > strlen(pstrKey) &&
4938 - *      - strlen(pstrSubkey) is < REG_MAXREGPATHLENGTH
4939 - */
4940 -       extern DSP_STATUS REG_EnumKey(OPTIONAL IN HANDLE *phKey,
4941 -                                     IN u32 dwIndex, IN CONST char *pstrKey,
4942 -                                     IN OUT char *pstrSubkey,
4943 -                                     IN OUT u32 *pdwValueSize);
4944 +extern DSP_STATUS REG_DeleteValue(IN CONST char *pstrValue);
4945  
4946  /*
4947   *  ======== REG_EnumValue ========
4948 @@ -136,7 +48,6 @@
4949   *      Enumerates values of a specified key. Retrieves each value name and
4950   *      the data associated with the value.
4951   *  Parameters:
4952 - *      phKey:          Currently reserved; must be NULL.
4953   *      dwIndex:        Specifies the index of the value to retrieve.
4954   *      pstrKey:        The name of the registry key to be enumerated.
4955   *      pstrValue:      Pointer to buffer that receives the name of the value.
4956 @@ -152,19 +63,16 @@
4957   *      DSP_EFAIL:      General failure.
4958   *  Requires:
4959   *      REG initialized.
4960 - *      phKey is NULL.
4961   *      pstrKey is a non-NULL value.
4962   *      pstrValue, pstrData, pdwValueSize and pdwDataSize are valid pointers.
4963   *      Length of pstrKey is less than REG_MAXREGPATHLENGTH.
4964   *  Ensures:
4965   */
4966 -       extern DSP_STATUS REG_EnumValue(IN HANDLE *phKey,
4967 -                                       IN u32 dwIndex,
4968 -                                       IN CONST char *pstrKey,
4969 -                                       IN OUT char *pstrValue,
4970 -                                       IN OUT u32 *pdwValueSize,
4971 -                                       IN OUT char *pstrData,
4972 -                                       IN OUT u32 *pdwDataSize);
4973 +extern DSP_STATUS REG_EnumValue(IN u32 dwIndex, IN CONST char *pstrKey,
4974 +                               IN OUT char *pstrValue,
4975 +                               IN OUT u32 *pdwValueSize,
4976 +                               IN OUT char *pstrData,
4977 +                               IN OUT u32 *pdwDataSize);
4978  
4979  /*
4980   *  ======== REG_Exit ========
4981 @@ -185,8 +93,6 @@
4982   *  Purpose:
4983   *      Retrieve a value from the registry.
4984   *  Parameters:
4985 - *      phKey:          Currently reserved; must be NULL.
4986 - *      pstrSubkey:     Path to key to open.
4987   *      pstrEntry:      Name of entry to retrieve.
4988   *      pbValue:        Upon return, points to retrieved value.
4989   *      pdwValueSize:   Specifies bytes of memory pbValue points to on input,
4990 @@ -198,18 +104,13 @@
4991   *      DSP_EFAIL:      General failure.
4992   *  Requires:
4993   *      - REG initialized.
4994 - *      - pstrSubkey & pstrEntry are non-NULL values.
4995 + *      - pstrEntry is non-NULL value.
4996   *      - pbValue is a valid pointer.
4997 - *      - phKey is NULL.
4998 - *      - length of pstrSubkey < REG_MAXREGPATHLENGTH.
4999   *      - length of pstrEntry < REG_MAXREGPATHLENGTH.
5000   *  Ensures:
5001   */
5002 -       extern DSP_STATUS REG_GetValue(OPTIONAL IN HANDLE *phKey,
5003 -                                      IN CONST char *pstrSubkey,
5004 -                                      IN CONST char *pstrEntry,
5005 -                                      OUT u8 *pbValue,
5006 -                                      IN OUT u32 *pdwValueSize);
5007 +extern DSP_STATUS REG_GetValue(IN CONST char *pstrEntry, OUT u8 *pbValue,
5008 +                              IN OUT u32 *pdwValueSize);
5009  
5010  /*
5011   *  ======== REG_Init ========
5012 @@ -229,10 +130,7 @@
5013   *  Purpose:
5014   *      Set a value in the registry.
5015   *  Parameters:
5016 - *      phKey:          Handle to open reg key, or NULL if pSubkey is full path.
5017 - *      pstrSubkey:     Path to key to open, could be based on phKey.
5018   *      pstrEntry:      Name of entry to set.
5019 - *      dwType:         Data type of new registry value.
5020   *      pbValue:        Points to buffer containing new data.
5021   *      dwValueSize:    Specifies bytes of memory bValue points to.
5022   *  Returns:
5023 @@ -240,18 +138,13 @@
5024   *      DSP_EFAIL:      General failure.
5025   *  Requires:
5026   *      - REG initialized.
5027 - *      - pstrSubkey & pstrEntry are non-NULL values.
5028 + *      - pstrEntry is non-NULL value.
5029   *      - pbValue is a valid pointer.
5030 - *      - phKey is NULL.
5031   *      - dwValuSize > 0.
5032 - *      - length of pstrSubkey < REG_MAXREGPATHLENGTH.
5033   *      - length of pstrEntry < REG_MAXREGPATHLENGTH.
5034   *  Ensures:
5035   */
5036 -       extern DSP_STATUS REG_SetValue(OPTIONAL IN HANDLE *phKey,
5037 -                                      IN CONST char *pstrSubKey,
5038 -                                      IN CONST char *pstrEntry,
5039 -                                      IN CONST u32 dwType,
5040 -                                      IN u8 *pbValue, IN u32 dwValueSize);
5041 +extern DSP_STATUS REG_SetValue(IN CONST char *pstrEntry, IN u8 *pbValue,
5042 +                              IN u32 dwValueSize);
5043  
5044  #endif                         /* _REG_H */
5045 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h
5046 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h     2011-04-17 17:32:26.000000000 +0100
5047 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/resourcecleanup.h  2011-05-02 22:36:49.000000000 +0100
5048 @@ -14,7 +14,6 @@
5049   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5050   */
5051  
5052 -#ifndef RES_CLEANUP_DISABLE
5053  
5054  #include <dspbridge/nodepriv.h>
5055  #include <dspbridge/drv.h>
5056 @@ -30,15 +29,12 @@ extern DSP_STATUS DRV_RemoveAllDMMResEle
5057  
5058  extern DSP_STATUS DRV_RemoveAllNodeResElements(HANDLE pCtxt);
5059  
5060 -extern DSP_STATUS DRV_ProcUpdatestate(HANDLE pCtxt,
5061 -                                     enum GPP_PROC_RES_STATE resState);
5062 -
5063  extern DSP_STATUS DRV_ProcSetPID(HANDLE pCtxt, s32 hProcess);
5064  
5065  extern DSP_STATUS DRV_RemoveAllResources(HANDLE pPctxt);
5066  
5067  extern DSP_STATUS DRV_RemoveProcContext(struct DRV_OBJECT *hDRVObject,
5068 -                                    HANDLE hPCtxt);
5069 +                                    HANDLE pr_ctxt);
5070  
5071  extern DSP_STATUS DRV_GetNodeResElement(HANDLE hNode, HANDLE nodeRes,
5072                                         HANDLE pCtxt);
5073 @@ -63,8 +59,7 @@ extern DSP_STATUS DRV_GetDMMResElement(u
5074  
5075  extern DSP_STATUS DRV_RemoveDMMResElement(HANDLE dmmRes, HANDLE pCtxt);
5076  
5077 -extern DSP_STATUS DRV_ProcUpdateSTRMRes(u32 uNumBufs, HANDLE STRMRes,
5078 -                                       HANDLE pCtxt);
5079 +extern DSP_STATUS DRV_ProcUpdateSTRMRes(u32 uNumBufs, HANDLE STRMRes);
5080  
5081  extern DSP_STATUS DRV_ProcInsertSTRMResElement(HANDLE hStrm, HANDLE STRMRes,
5082                                                 HANDLE pPctxt);
5083 @@ -76,8 +71,5 @@ extern DSP_STATUS DRV_ProcRemoveSTRMResE
5084  
5085  extern DSP_STATUS DRV_RemoveAllSTRMResElements(HANDLE pCtxt);
5086  
5087 -extern DSP_STATUS DRV_ProcDisplayResInfo(u8 *pBuf, u32 *pSize);
5088 -
5089  extern enum NODE_STATE NODE_GetState(HANDLE hNode);
5090  
5091 -#endif
5092 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/rmm.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/rmm.h
5093 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/rmm.h 2011-04-17 17:32:26.000000000 +0100
5094 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/rmm.h      2011-05-02 22:36:49.000000000 +0100
5095 @@ -3,6 +3,10 @@
5096   *
5097   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5098   *
5099 + * This memory manager provides general heap management and arbitrary
5100 + * alignment for any number of memory segments, and management of overlay
5101 + * memory.
5102 + *
5103   * Copyright (C) 2005-2006 Texas Instruments, Inc.
5104   *
5105   * This package is free software; you can redistribute it and/or modify
5106 @@ -14,28 +18,6 @@
5107   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5108   */
5109  
5110 -
5111 -/*
5112 - *  ======== rmm.h ========
5113 - *
5114 - *  This memory manager provides general heap management and arbitrary
5115 - *  alignment for any number of memory segments, and management of overlay
5116 - *  memory.
5117 - *
5118 - *  Public functions:
5119 - *      RMM_alloc
5120 - *      RMM_create
5121 - *      RMM_delete
5122 - *      RMM_exit
5123 - *      RMM_free
5124 - *      RMM_init
5125 - *
5126 - *! Revision History
5127 - *! ================
5128 - *! 25-Jun-2002 jeh     Added RMM_Addr. Removed RMM_reserve, RMM_stat.
5129 - *! 15-Oct-2001 jeh     Based on rm.h in gen tree.
5130 - */
5131 -
5132  #ifndef RMM_
5133  #define RMM_
5134  
5135 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/rms_sh.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/rms_sh.h
5136 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/rms_sh.h      2011-04-17 17:32:26.000000000 +0100
5137 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/rms_sh.h   2011-05-02 22:36:49.000000000 +0100
5138 @@ -3,6 +3,9 @@
5139   *
5140   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5141   *
5142 + * DSP/BIOS Bridge Resource Manager Server shared definitions (used on both
5143 + * GPP and DSP sides).
5144 + *
5145   * Copyright (C) 2008 Texas Instruments, Inc.
5146   *
5147   * This package is free software; you can redistribute it and/or modify
5148 @@ -14,37 +17,6 @@
5149   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5150   */
5151  
5152 -
5153 -/*
5154 - *  ======== rms_sh.h ========
5155 - *
5156 - *  DSP/BIOS Bridge Resource Manager Server shared definitions (used on both
5157 - *  GPP and DSP sides).
5158 - *
5159 - *! Revision History
5160 - *! ================
5161 - *! 24-Mar-2003 vp  Merged updates required for CCS2.2 transition.
5162 - *! 24-Feb-2003 kc  Rearranged order of node types to temporarily support
5163 - *!                legacy message node code
5164 - *! 23-Nov-2002 gp  Converted tabs -> spaces, to fix formatting.
5165 - *! 13-Feb-2002 jeh Added sysstacksize element to RMS_MoreTaskArgs.
5166 - *! 11-Dec-2000 sg  Added 'misc' element to RMS_MoreTaskArgs.
5167 - *! 04-Dec-2000 ag  Added RMS_BUFDESC command code.
5168 - *!                 C/R code value changed to allow ORing of system/user codes.
5169 - *! 10-Oct-2000 sg  Added 'align' field to RMS_StrmDef.
5170 - *! 09-Oct-2000 sg  Moved pre-defined message codes here from rmsdefs.h.
5171 - *! 02-Oct-2000 sg  Changed ticks to msec.
5172 - *! 24-Aug-2000 sg  Moved definitions that will be exposed to app developers
5173 - *!                to a separate file, rmsdefs.h.
5174 - *! 10-Aug-2000 sg  Added RMS_COMMANDBUFSIZE and RMS_RESPONSEBUFSIZE; added
5175 - *!                pre-defined command/response codes; more comments.
5176 - *! 09-Aug-2000 sg  Added RMS_ETASK.
5177 - *! 08-Aug-2000 jeh Define RMS_WORD for GPP, rename DSP_MSG to RMS_DSPMSG.
5178 - *!                 Added RMS_MsgArgs, RMS_MoreTaskArgs.
5179 - *! 25-Jul-2000 sg: Changed SIO to STRM.
5180 - *! 30-Jun-2000 sg: Initial.
5181 - */
5182 -
5183  #ifndef RMS_SH_
5184  #define RMS_SH_
5185  
5186 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/rmstypes.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/rmstypes.h
5187 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/rmstypes.h    2011-04-17 17:32:26.000000000 +0100
5188 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/rmstypes.h 2011-05-02 22:36:49.000000000 +0100
5189 @@ -3,6 +3,8 @@
5190   *
5191   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5192   *
5193 + * DSP/BIOS Bridge Resource Manager Server shared data type definitions.
5194 + *
5195   * Copyright (C) 2008 Texas Instruments, Inc.
5196   *
5197   * This package is free software; you can redistribute it and/or modify
5198 @@ -14,19 +16,6 @@
5199   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5200   */
5201  
5202 -/*
5203 - *  ======== rmstypes.h ========
5204 - *
5205 - *  DSP/BIOS Bridge Resource Manager Server shared data type definitions.
5206 - *
5207 - *! Revision History
5208 - *! ================
5209 - *! 06-Oct-2000 sg  Added LgFxn type.
5210 - *! 05-Oct-2000 sg  Changed RMS_STATUS to LgUns.
5211 - *! 31-Aug-2000 sg  Added RMS_DSPMSG.
5212 - *! 25-Aug-2000 sg  Initial.
5213 - */
5214 -
5215  #ifndef RMSTYPES_
5216  #define RMSTYPES_
5217  #include <linux/types.h>
5218 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/services.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/services.h
5219 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/services.h    2011-04-17 17:32:26.000000000 +0100
5220 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/services.h 2011-05-02 22:36:49.000000000 +0100
5221 @@ -3,6 +3,8 @@
5222   *
5223   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5224   *
5225 + * Provide loading and unloading of SERVICES modules.
5226 + *
5227   * Copyright (C) 2005-2006 Texas Instruments, Inc.
5228   *
5229   * This package is free software; you can redistribute it and/or modify
5230 @@ -14,21 +16,6 @@
5231   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5232   */
5233  
5234 -
5235 -/*
5236 - *  ======== services.h ========
5237 - *  Purpose:
5238 - *      Provide loading and unloading of SERVICES modules.
5239 - *
5240 - *  Public Functions:
5241 - *      SERVICES_Exit(void)
5242 - *      SERVICES_Init(void)
5243 - *
5244 - *! Revision History:
5245 - *! ================
5246 - *! 01-Feb-2000 kc: Created.
5247 - */
5248 -
5249  #ifndef SERVICES_
5250  #define SERVICES_
5251  
5252 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/std.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/std.h
5253 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/std.h 2011-04-17 17:32:26.000000000 +0100
5254 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/std.h      2011-05-02 22:36:49.000000000 +0100
5255 @@ -14,54 +14,6 @@
5256   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5257   */
5258  
5259 -/*
5260 - *  ======== std.h ========
5261 - *
5262 - *! Revision History
5263 - *! ================
5264 - *! 16-Feb-2004 vp     GNU compiler 3.x defines inline keyword. Added
5265 - *!                    appropriate macros not to redefine inline keyword in
5266 - *!                    this file.
5267 - *! 24-Oct-2002        ashu    defined _TI_ and _FIXED_ symbols for 28x.
5268 - *! 24-Oct-2002        ashu    defined _TI_ for 24x.
5269 - *! 01-Mar-2002 kln    changed LARGE_MODEL and Arg definition for 28x
5270 - *! 01-Feb-2002 kln    added definitions for 28x
5271 - *! 08-Dec-2000 kw:    added 'ArgToInt' and 'ArgToPtr' macros
5272 - *! 30-Nov-2000 mf:    Added _64_, _6x_; removed _7d_
5273 - *! 30-May-2000 srid:  Added   __TMS320C55X__ for 55x; Arg is void * for 55 .
5274 - *! 18-Jun-1999 dr:    Added '_TI_', fixed __inline for SUN4, added inline
5275 - *! 10-Feb-1999 rt:    Added '55' support, changed 54's symbol to _TMS320C5XX
5276 - *! 29-Aug-1998 mf:    fixed typo, removed obsolete targets
5277 - *! 08-Jun-1998 mf:    _67_ is synonym for _7d_
5278 - *! 10-Oct-1997 rt;    added _7d_ for Raytheon C7DSP triggered by _TMS320C6700
5279 - *! 04-Aug-1997 cc:    added _29_ for _TMS320C2XX
5280 - *! 11-Jul-1997 dlr:   _5t_, and STD_SPOXTASK keyword for Tasking
5281 - *! 12-Jun-1997 mf:    _TMS320C60 -> _TMS320C6200
5282 - *! 13-Feb-1997 mf:    _62_, with 32-bit LgInt
5283 - *! 26-Nov-1996 kw:    merged bios-c00's and wsx-a27's <dspbridge/std.h> changes
5284 - *!                    *and* revision history
5285 - *! 12-Sep-1996 kw:    added C54x #ifdef's
5286 - *! 21-Aug-1996 mf:    removed #define main smain for _21_
5287 - *! 14-May-1996 gp:     def'd out INT, FLOAT, and COMPLEX defines for WSX.
5288 - *! 11-Apr-1996 kw:     define _W32_ based on _WIN32 (defined by MS compiler)
5289 - *! 07-Mar-1996 mg:     added Win32 support
5290 - *! 06-Sep-1995 dh:    added _77_ dynamic stack support via fxns77.h
5291 - *! 27-Jun-1995 dh:    added _77_ support
5292 - *! 16-Mar-1995 mf:    for _21_: #define main smain
5293 - *! 01-Mar-1995 mf:    set _20_ and _60_ (as well as _21_ for both)
5294 - *! 22-Feb-1995 mf:    Float is float for _SUN_ and _80_
5295 - *! 22-Dec-1994 mf:    Added _80_ definition, for PP or MP.
5296 - *! 09-Dec-1994 mf:    Added _53_ definition.
5297 - *!                    Added definitions of _30_, etc.
5298 - *! 23-Aug-1994 dh     removed _21_ special case (kw)
5299 - *! 17-Aug-1994 dh     added _51_ support
5300 - *! 03-Aug-1994 kw     updated _80_ support
5301 - *! 30-Jun-1994 kw     added _80_ support
5302 - *! 05-Apr-1994 kw:    Added _SUN_ to _FLOAT_ definition
5303 - *! 01-Mar-1994 kw:    Made Bool an int (was u16) for _56_ (more efficient).
5304 - *!                    Added _53_ support.
5305 - */
5306 -
5307  #ifndef STD_
5308  #define STD_
5309  
5310 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/strm.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/strm.h
5311 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/strm.h        2011-04-17 17:32:26.000000000 +0100
5312 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/strm.h     2011-05-02 22:36:49.000000000 +0100
5313 @@ -3,6 +3,8 @@
5314   *
5315   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5316   *
5317 + * DSPBridge Stream Manager.
5318 + *
5319   * Copyright (C) 2005-2006 Texas Instruments, Inc.
5320   *
5321   * This package is free software; you can redistribute it and/or modify
5322 @@ -14,45 +16,6 @@
5323   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5324   */
5325  
5326 -
5327 -/*
5328 - *  ======== strm.h ========
5329 - *  Description:
5330 - *      DSPBridge Stream Manager.
5331 - *
5332 - *  Public Functions:
5333 - *      STRM_AllocateBuffer
5334 - *      STRM_Close
5335 - *      STRM_Create
5336 - *      STRM_Delete
5337 - *      STRM_Exit
5338 - *      STRM_FreeBuffer
5339 - *      STRM_GetEventHandle
5340 - *      STRM_GetInfo
5341 - *      STRM_Idle
5342 - *      STRM_Init
5343 - *      STRM_Issue
5344 - *      STRM_Open
5345 - *      STRM_PrepareBuffer
5346 - *      STRM_Reclaim
5347 - *      STRM_RegisterNotify
5348 - *      STRM_Select
5349 - *      STRM_UnprepareBuffer
5350 - *
5351 - *  Notes:
5352 - *
5353 - *! Revision History:
5354 - *! =================
5355 - *! 15-Nov-2001 ag  Changed DSP_STREAMINFO to STRM_INFO in STRM_GetInfo().
5356 - *!                 Added DSP_ESIZE error to STRM_AllocateBuffer().
5357 - *! 07-Jun-2001 sg  Made DSPStream_AllocateBuffer fxn name plural.
5358 - *! 10-May-2001 jeh Code review cleanup.
5359 - *! 13-Feb-2001 kc  DSP/BIOS Bridge name updates.
5360 - *! 06-Feb-2001 kc  Updated DBC_Ensure for STRM_Select().
5361 - *! 23-Oct-2000 jeh Allow NULL STRM_ATTRS passed to STRM_Open().
5362 - *! 25-Sep-2000 jeh Created.
5363 - */
5364 -
5365  #ifndef STRM_
5366  #define STRM_
5367  
5368 @@ -104,7 +67,7 @@
5369   *  Ensures:
5370   */
5371         extern DSP_STATUS STRM_Close(struct STRM_OBJECT *hStrm,
5372 -                       struct PROCESS_CONTEXT *pr_ctxt);
5373 +                               struct PROCESS_CONTEXT *pr_ctxt);
5374  
5375  /*
5376   *  ======== STRM_Create ========
5377 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/strmdefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/strmdefs.h
5378 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/strmdefs.h    2011-04-17 17:32:26.000000000 +0100
5379 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/strmdefs.h 2011-05-02 22:36:49.000000000 +0100
5380 @@ -3,6 +3,8 @@
5381   *
5382   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5383   *
5384 + * Global STRM constants and types.
5385 + *
5386   * Copyright (C) 2005-2006 Texas Instruments, Inc.
5387   *
5388   * This package is free software; you can redistribute it and/or modify
5389 @@ -14,18 +16,6 @@
5390   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5391   */
5392  
5393 -
5394 -/*
5395 - *  ======== strmdefs.h ========
5396 - *  Purpose:
5397 - *      Global STRM constants and types.
5398 - *
5399 - *! Revision History
5400 - *! ================
5401 - *! 19-Nov-2001 ag      Added STRM_INFO..
5402 - *! 25-Sep-2000 jeh     Created.
5403 - */
5404 -
5405  #ifndef STRMDEFS_
5406  #define STRMDEFS_
5407  
5408 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/sync.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/sync.h
5409 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/sync.h        2011-04-17 17:32:26.000000000 +0100
5410 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/sync.h     2011-05-02 22:36:49.000000000 +0100
5411 @@ -3,6 +3,8 @@
5412   *
5413   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5414   *
5415 + * Provide synchronization services.
5416 + *
5417   * Copyright (C) 2005-2006 Texas Instruments, Inc.
5418   *
5419   * This package is free software; you can redistribute it and/or modify
5420 @@ -14,44 +16,6 @@
5421   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5422   */
5423  
5424 -/*
5425 - *  ======== sync.h ========
5426 - *  Purpose:
5427 - *      Provide synchronization services.
5428 - *
5429 - *  Public Functions:
5430 - *      SYNC_CloseEvent
5431 - *      SYNC_DeleteCS
5432 - *      SYNC_EnterCS
5433 - *      SYNC_Exit
5434 - *      SYNC_Init
5435 - *      SYNC_InitializeCS
5436 - *      SYNC_LeaveCS
5437 - *      SYNC_OpenEvent
5438 - *      SYNC_PostMessage
5439 - *      SYNC_ResetEvent
5440 - *      SYNC_SetEvent
5441 - *      SYNC_WaitOnEvent
5442 - *      SYNC_WaitOnMultipleEvents
5443 - *
5444 - *! Revision History:
5445 - *! ================
5446 - *! 05-Oct-2000 jeh Added SYNC_WaitOnMultipleEvents().
5447 - *! 01-Dec-1999 ag: Added #define SYNC_MAXNAMELENGTH.
5448 - *! 04-Nov-1999 kc: Added critical section functions and objects to SYNC.
5449 - *! 29-Oct-1999 kc: Cleaned up for code review.
5450 - *! 24-Sep-1999 kc: Added WinCE notes.
5451 - *! 20-Oct-1997 gp: Removed unused SYNC_ critical section and must complete fxns
5452 - *!                 Added SYNC_HOBJECT, SYNC_ATTRS, and object validation, and
5453 - *!                 merged SYNC_DestroyEvent into SYNC_CloseEvent, and merged
5454 - *!                 SYNC_CreateEvent into SYNC_OpenEvent.
5455 - *! 07-Oct-1997 gp: Added SYNC_Create/DestroyEvent (for NT testing).
5456 - *! 06-Oct-1997 gp: Added SYNC_OpenEvent.
5457 - *! 03-Jun-1997 gp: Added SYNC_{Begin|End}CritSection() functions.
5458 - *! 03-Jan-1997 gp: Added SYNC_INFINITE define.
5459 - *! 05-Aug-1996 gp: Created.
5460 - */
5461 -
5462  #ifndef _SYNC_H
5463  #define _SYNC_H
5464  
5465 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/util.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/util.h
5466 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/util.h        2011-04-17 17:32:26.000000000 +0100
5467 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/util.h     1970-01-01 01:00:00.000000000 +0100
5468 @@ -1,122 +0,0 @@
5469 -/*
5470 - * util.h
5471 - *
5472 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5473 - *
5474 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
5475 - *
5476 - * This package is free software; you can redistribute it and/or modify
5477 - * it under the terms of the GNU General Public License version 2 as
5478 - * published by the Free Software Foundation.
5479 - *
5480 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
5481 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
5482 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5483 - */
5484 -
5485 -
5486 -/*
5487 - *  ======== util.h ========
5488 - *  Purpose:
5489 - *      Provide general purpose utility functions.
5490 - *
5491 - *  Public Functions:
5492 - *      UTIL_CDTestDll
5493 - *      UTIL_CmdLineToArgs
5494 - *      UTIL_Exit
5495 - *      UTIL_GetSysInfo
5496 - *      UTIL_Init
5497 - */
5498 -
5499 -#ifndef _UTIL_H
5500 -#define _UTIL_H
5501 -
5502 -#include <linux/delay.h>
5503 -#include <linux/sched.h>
5504 -
5505 -#include <dspbridge/utildefs.h>
5506 -
5507 -/*
5508 - *  ======== UTIL_CDTestDll ========
5509 - *  Purpose:
5510 - *      Provides test entry point in class driver context.
5511 - *  Parameters:
5512 - *      cArgc:  test module command line input count.
5513 - *      ppArgv: test module command line args.
5514 - *  Returns:
5515 - *      0 if successful, a negative value otherwise.
5516 - *  Requires:
5517 - *      UTIL initialized.
5518 - *  Ensures:
5519 - */
5520 -       extern u32 UTIL_CDTestDll(IN s32 cArgc, IN char **ppArgv);
5521 -
5522 -/*
5523 - *  ======== UTIL_CmdLineToArgs ========
5524 - *  Purpose:
5525 - *      This function re-creates C-style cmd line argc & argv from WinMain()
5526 - *      cmd line args.
5527 - *  Parameters:
5528 - *      s8 *pszProgName   - The name of the program currently being executed.
5529 - *      s8 *argv[]        - The argument vector.
5530 - *      s8 *pCmdLine      - The pointer to the command line.
5531 - *      bool fHasProgName   - Indicats whether a program name is supplied.
5532 - *  Returns:
5533 - *      Returns the number of arguments found.
5534 - *  Requires:
5535 - *      UTIL initialized.
5536 - *  Ensures:
5537 - */
5538 -       extern s32 UTIL_CmdLineToArgs(IN char *pszProgName,
5539 -                                     IN char *argv[UTIL_MAXARGVS],
5540 -                                     IN char *pCmdLine, IN bool fHasProgName);
5541 -
5542 -/*
5543 - *  ======== UTIL_Exit ========
5544 - *  Purpose:
5545 - *      Discontinue usage of module; free resources when reference count
5546 - *      reaches 0.
5547 - *  Parameters:
5548 - *  Returns:
5549 - *  Requires:
5550 - *      UTIL initialized.
5551 - *  Ensures:
5552 - *      Resources used by module are freed when cRef reaches zero.
5553 - */
5554 -       extern inline void UTIL_Exit(void)
5555 -       {
5556 -       }
5557 -/*
5558 - *  ======== UTIL_GetSysInfo ========
5559 - *  Purpose:
5560 - *      This function return platform specific system information.
5561 - *
5562 - *  Parameters:
5563 - *      pSysInfo  - address to store the system information.
5564 - *  Returns:
5565 - *      DSP_SOK
5566 - *      S_FAIL
5567 - *  Requires:
5568 - *      UTIL initialized.
5569 - *      pSysInfo != NULL
5570 - *  Ensures:
5571 - */
5572 -       extern DSP_STATUS UTIL_GetSysInfo(OUT struct UTIL_SYSINFO *pSysInfo);
5573 -
5574 -/*
5575 - *  ======== UTIL_Init ========
5576 - *  Purpose:
5577 - *      Initializes private state of UTIL module.
5578 - *  Parameters:
5579 - *  Returns:
5580 - *      TRUE if success, else FALSE.
5581 - *  Requires:
5582 - *  Ensures:
5583 - *      UTIL initialized.
5584 - */
5585 -       extern inline bool UTIL_Init(void)
5586 -       {
5587 -               return true;
5588 -       }
5589 -
5590 -#endif                         /* _UTIL_H */
5591 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/utildefs.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/utildefs.h
5592 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/utildefs.h    2011-04-17 17:32:26.000000000 +0100
5593 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/utildefs.h 2011-05-02 22:36:49.000000000 +0100
5594 @@ -3,6 +3,8 @@
5595   *
5596   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5597   *
5598 + * Global UTIL constants and types, shared between WCD and DSPSYS.
5599 + *
5600   * Copyright (C) 2005-2006 Texas Instruments, Inc.
5601   *
5602   * This package is free software; you can redistribute it and/or modify
5603 @@ -14,20 +16,6 @@
5604   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5605   */
5606  
5607 -
5608 -/*
5609 - *  ======== utildefs.h ========
5610 - *  Purpose:
5611 - *      Global UTIL constants and types, shared between WCD and DSPSYS.
5612 - *
5613 - *! Revision History:
5614 - *! ================
5615 - *! 24-Feb-2003 kc  Removed wIOPort* entries from UTIL_HOSTCONFIG.
5616 - *! 12-Aug-2000 ag  Added UTIL_SYSINFO typedef.
5617 - *! 08-Oct-1999 rr  Adopted for WinCE where test fxns will be added in util.h
5618 - *! 26-Dec-1996 cr  Created.
5619 - */
5620 -
5621  #ifndef UTILDEFS_
5622  #define UTILDEFS_
5623  
5624 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/uuidutil.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/uuidutil.h
5625 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/uuidutil.h    2011-04-17 17:32:26.000000000 +0100
5626 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/uuidutil.h 2011-05-02 22:36:49.000000000 +0100
5627 @@ -3,6 +3,8 @@
5628   *
5629   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5630   *
5631 + * This file contains the specification of UUID helper functions.
5632 + *
5633   * Copyright (C) 2005-2006 Texas Instruments, Inc.
5634   *
5635   * This package is free software; you can redistribute it and/or modify
5636 @@ -14,20 +16,6 @@
5637   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5638   */
5639  
5640 -
5641 -/*
5642 - *  ======== uuidutil.h ========
5643 - *  Description:
5644 - *      This file contains the specification of UUID helper functions.
5645 - *
5646 - *! Revision History
5647 - *! ================
5648 - *! 09-Nov-2000 kc: Modified description of UUID utility functions.
5649 - *! 29-Sep-2000 kc: Appended "UUID_" prefix to UUID helper functions.
5650 - *! 10-Aug-2000 kc: Created.
5651 - *!
5652 - */
5653 -
5654  #ifndef UUIDUTIL_
5655  #define UUIDUTIL_
5656  
5657 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wcd.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wcd.h
5658 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wcd.h 2011-04-17 17:32:26.000000000 +0100
5659 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wcd.h      2011-05-02 22:36:49.000000000 +0100
5660 @@ -3,6 +3,18 @@
5661   *
5662   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5663   *
5664 + * Bridge class driver library functions, object definitions, and
5665 + * return error/status codes.  To be included by Bridge mini drivers.
5666 + *
5667 + * Notes:
5668 + *   Bridge Class Driver services exported to WMD's are initialized by the
5669 + *   WCD on behalf of the WMD.  WMD's must not call module Init/Exit
5670 + *   functions.
5671 + *
5672 + *   To ensure WMD binary compatibility across different platforms,
5673 + *   for the same processor, a WMD must restrict its usage of system
5674 + *   services to those exported by the 'Bridge class library.
5675 + *
5676   * Copyright (C) 2005-2006 Texas Instruments, Inc.
5677   *
5678   * This package is free software; you can redistribute it and/or modify
5679 @@ -14,43 +26,6 @@
5680   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5681   */
5682  
5683 -
5684 -/*
5685 - *  ======== wcd.h ========
5686 - *  Description:
5687 - *      'Bridge class driver library functions, object definitions, and
5688 - *      return error/status codes.  To be included by 'Bridge mini drivers.
5689 - *
5690 - *  Public Functions:
5691 - *      See mem.h and dbg.h.
5692 - *
5693 - *  Notes:
5694 - *      'Bridge Class Driver services exported to WMD's are initialized by the
5695 - *      WCD on behalf of the WMD.  WMD's must not call module Init/Exit
5696 - *      functions.
5697 - *
5698 - *      To ensure WMD binary compatibility across different platforms,
5699 - *      for the same processor, a WMD must restrict its usage of system
5700 - *      services to those exported by the 'Bridge class library.
5701 - *
5702 - *! Revision History:
5703 - *! ================
5704 - *! 07-Jun-2000 jeh Added dev.h
5705 - *! 01-Nov-1999 ag: #WINCE# WCD_MAJOR_VERSION=8 & WCD_MINOR_VERSION=0 to match
5706 - *!                dll stamps.
5707 - *!                 0.80 - 0.89 Alpha, 0.90 - 0.99 Beta, 1.00 - 1.10 FCS.
5708 - *! 17-Sep-1997 gp: Changed size of CFG_HOSTRES structure; and ISR_Install API;
5709 - *!                 Changed WCD_MINOR_VERSION 3 -> 4.
5710 - *! 15-Sep-1997 gp: Moved WCD_(Un)registerMinidriver to drv.
5711 - *! 25-Jul-1997 cr: Added WCD_UnregisterMinidriver.
5712 - *! 22-Jul-1997 cr: Added WCD_RegisterMinidriver, WCD_MINOR_VERSION 2 -> 3.
5713 - *! 12-Nov-1996 gp: Defined port io macros.
5714 - *! 07-Nov-1996 gp: Updated for code review.
5715 - *! 16-Jul-1996 gp: Added CHNL fxns; updated WCD lib version to 2.
5716 - *! 10-May-1996 gp: Separated WMD def.s' into wmd.h.
5717 - *! 03-May-1996 gp: Created.
5718 - */
5719 -
5720  #ifndef WCD_
5721  #define WCD_
5722  
5723 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wcdioctl.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wcdioctl.h
5724 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wcdioctl.h    2011-04-17 17:32:26.000000000 +0100
5725 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wcdioctl.h 2011-05-06 14:38:24.000000000 +0100
5726 @@ -3,6 +3,9 @@
5727   *
5728   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5729   *
5730 + * Contains structures and commands that are used for interaction
5731 + * between the DDSP API and class driver.
5732 + *
5733   * Copyright (C) 2008 Texas Instruments, Inc.
5734   *
5735   * This package is free software; you can redistribute it and/or modify
5736 @@ -14,55 +17,6 @@
5737   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5738   */
5739  
5740 -
5741 -/*
5742 - *  ======== wcdioctl.h ========
5743 - *  Purpose:
5744 - *      Contains structures and commands that are used for interaction
5745 - *      between the DDSP API and class driver.
5746 - *
5747 - *! Revision History
5748 - *! ================
5749 - *! 19-Apr-2004 sb  Aligned DMM definitions with Symbian
5750 - *! 08-Mar-2004 sb  Added the Dynamic Memory Mapping structs & offsets
5751 - *! 15-Oct-2002 kc  Updated definitions for private PERF module.
5752 - *! 16-Aug-2002 map Added ARGS_MGR_REGISTEROBJECT & ARGS_MGR_UNREGISTEROBJECT
5753 - *!             Added CMD_MGR_REGISTEROBJECT_OFFSET &
5754 - *!             CMD_MGR_UNREGISTEROBJECT_OFFSET
5755 - *! 15-Jan-2002 ag  Added actaul bufSize to ARGS_STRM_[RECLAIM][ISSUE].
5756 - *! 15-Nov-2001 ag  change to STRMINFO in ARGS_STRM_GETINFO.
5757 - *! 11-Sep-2001 ag  ARGS_CMM_GETHANDLE defn uses DSP_HPROCESSOR.
5758 - *! 23-Apr-2001 jeh Added pStatus to NODE_TERMINATE args.
5759 - *! 13-Feb-2001 kc  DSP/BIOS Bridge name updates.
5760 - *! 22-Nov-2000 kc: Added CMD_MGR_GETPERF_DATA_OFFSET for acquiring PERF stats.
5761 - *! 27-Oct-2000 jeh Added timeouts to NODE_GETMESSAGE, NODE_PUTMESSAGE args.
5762 - *!             Removed NODE_GETMESSAGESTRM args.
5763 - *! 11-Oct-2000 ag: Added SM mgr(CMM) args.
5764 - *! 27-Sep-2000 jeh Removed struct DSP_BUFFERATTR param from
5765 - *!                ARGS_STRM_ALLOCATEBUFFER.
5766 - *! 25-Sep-2000 rr: Updated to Version 0.9
5767 - *! 07-Sep-2000 jeh Changed HANDLE to DSP_HNOTIFICATION in RegisterNotify args.
5768 - *!             Added DSP_STRMATTR to DSPNode_Connect args.
5769 - *! 04-Aug-2000 rr: MEM and UTIL added to RM.
5770 - *! 27-Jul-2000 rr: NODE, MGR,STRM and PROC added
5771 - *! 27-Jun-2000 rr: Modifed to Use either PM or DSP/BIOS Bridge
5772 - *!             IFDEF to build for PM or DSP/BIOS Bridge
5773 - *! 28-Jan-2000 rr: NT_CMD_FROM_OFFSET moved out to dsptrap.h
5774 - *! 24-Jan-2000 rr: Merged with Scott's code.
5775 - *! 21-Jan-2000 sg: In ARGS_CHNL_GETMODE changed mode to be u32 to be
5776 - *!             consistent with chnldefs.h.
5777 - *! 11-Jan-2000 rr: CMD_CFG_GETCDVERSION_OFFSET added.
5778 - *! 12-Nov-1999 rr: CMD_BRD_MONITOR_OFFSET added
5779 - *! 09-Nov-1999 kc: Added MEMRY and enabled CMD_BRD_IOCTL_OFFSET.
5780 - *! 05-Nov-1999 ag: Added CHNL.
5781 - *! 02-Nov-1999 kc: Removed field from ARGS_UTIL_TESTDLL.
5782 - *! 29-Oct-1999 kc: Cleaned up for code review.
5783 - *! 08-Oct-1999 rr: Util control offsets added.
5784 - *! 13-Sep-1999 kc: Added ARGS_UTIL_TESTDLL for PM test infrastructure.
5785 - *! 19-Aug-1999 rr: Created from WSX. Minimal Implementaion of BRD_Start and BRD
5786 - *!             and BRD_Stop. IOCTL Offsets and CTRL Code.
5787 - */
5788 -
5789  #ifndef WCDIOCTL_
5790  #define WCDIOCTL_
5791  
5792 @@ -100,7 +54,7 @@ union Trapped_Args {
5793         } ARGS_MGR_UNREGISTEROBJECT;
5794  
5795         struct {
5796 -               struct DSP_NOTIFICATION  __user*__user *aNotifications;
5797 +               struct DSP_NOTIFICATION  __user *__user *aNotifications;
5798                 u32 uCount;
5799                 u32 __user *puIndex;
5800                 u32 uTimeout;
5801 @@ -110,82 +64,79 @@ union Trapped_Args {
5802         struct {
5803                 u32 uProcessor;
5804                 struct DSP_PROCESSORATTRIN __user *pAttrIn;
5805 -               DSP_HPROCESSOR __user *phProcessor;
5806 +               void *__user *phProcessor;
5807         } ARGS_PROC_ATTACH;
5808  
5809         struct {
5810 -               DSP_HPROCESSOR hProcessor;
5811 +               void *hProcessor;
5812                 u32 dwCmd;
5813                 struct DSP_CBDATA __user *pArgs;
5814         } ARGS_PROC_CTRL;
5815  
5816         struct {
5817 -               DSP_HPROCESSOR hProcessor;
5818 +               void *hProcessor;
5819         } ARGS_PROC_DETACH;
5820  
5821         struct {
5822 -               DSP_HPROCESSOR hProcessor;
5823 -               DSP_HNODE __user *aNodeTab;
5824 +               void *hProcessor;
5825 +               void *__user *aNodeTab;
5826                 u32 uNodeTabSize;
5827                 u32 __user *puNumNodes;
5828                 u32 __user *puAllocated;
5829         } ARGS_PROC_ENUMNODE_INFO;
5830  
5831         struct {
5832 -               DSP_HPROCESSOR hProcessor;
5833 +               void *hProcessor;
5834                 u32 uResourceType;
5835                 struct DSP_RESOURCEINFO *pResourceInfo;
5836                 u32 uResourceInfoSize;
5837         } ARGS_PROC_ENUMRESOURCES;
5838  
5839         struct {
5840 -               DSP_HPROCESSOR hProcessor;
5841 +               void *hProcessor;
5842                 struct DSP_PROCESSORSTATE __user *pProcStatus;
5843                 u32 uStateInfoSize;
5844         } ARGS_PROC_GETSTATE;
5845  
5846         struct {
5847 -               DSP_HPROCESSOR hProcessor;
5848 +               void *hProcessor;
5849                 u8 __user *pBuf;
5850 -
5851 -       #ifndef RES_CLEANUP_DISABLE
5852 -           u8 __user *pSize;
5853 -    #endif
5854 +               u8 __user *pSize;
5855                 u32 uMaxSize;
5856         } ARGS_PROC_GETTRACE;
5857  
5858         struct {
5859 -               DSP_HPROCESSOR hProcessor;
5860 +               void *hProcessor;
5861                 s32 iArgc;
5862 -               char __user*__user *aArgv;
5863 +               char __user *__user *aArgv;
5864                 char *__user *aEnvp;
5865         } ARGS_PROC_LOAD;
5866  
5867         struct {
5868 -               DSP_HPROCESSOR hProcessor;
5869 +               void *hProcessor;
5870                 u32 uEventMask;
5871                 u32 uNotifyType;
5872                 struct DSP_NOTIFICATION __user *hNotification;
5873         } ARGS_PROC_REGISTER_NOTIFY;
5874  
5875         struct {
5876 -               DSP_HPROCESSOR hProcessor;
5877 +               void *hProcessor;
5878         } ARGS_PROC_START;
5879  
5880         struct {
5881 -               DSP_HPROCESSOR hProcessor;
5882 +               void *hProcessor;
5883                 u32 ulSize;
5884                 void *__user *ppRsvAddr;
5885         } ARGS_PROC_RSVMEM;
5886  
5887         struct {
5888 -               DSP_HPROCESSOR hProcessor;
5889 +               void *hProcessor;
5890                 u32 ulSize;
5891                 void *pRsvAddr;
5892         } ARGS_PROC_UNRSVMEM;
5893  
5894         struct {
5895 -               DSP_HPROCESSOR hProcessor;
5896 +               void *hProcessor;
5897                 void *pMpuAddr;
5898                 u32 ulSize;
5899                 void *pReqAddr;
5900 @@ -194,24 +145,24 @@ union Trapped_Args {
5901         } ARGS_PROC_MAPMEM;
5902  
5903         struct {
5904 -               DSP_HPROCESSOR hProcessor;
5905 +               void *hProcessor;
5906                 u32 ulSize;
5907                 void *pMapAddr;
5908         } ARGS_PROC_UNMAPMEM;
5909  
5910         struct {
5911 -               DSP_HPROCESSOR hProcessor;
5912 +               void *hProcessor;
5913                 void *pMpuAddr;
5914                 u32 ulSize;
5915                 u32 ulFlags;
5916         } ARGS_PROC_FLUSHMEMORY;
5917  
5918         struct {
5919 -               DSP_HPROCESSOR hProcessor;
5920 +               void *hProcessor;
5921         } ARGS_PROC_STOP;
5922  
5923         struct {
5924 -               DSP_HPROCESSOR hProcessor;
5925 +               void *hProcessor;
5926                 void *pMpuAddr;
5927                 u32 ulSize;
5928         } ARGS_PROC_INVALIDATEMEMORY;
5929 @@ -219,88 +170,88 @@ union Trapped_Args {
5930  
5931         /* NODE Module */
5932         struct {
5933 -               DSP_HPROCESSOR hProcessor;
5934 +               void *hProcessor;
5935                 struct DSP_UUID __user *pNodeID;
5936                 struct DSP_CBDATA __user *pArgs;
5937                 struct DSP_NODEATTRIN __user *pAttrIn;
5938 -               DSP_HNODE __user *phNode;
5939 +               void *__user *phNode;
5940         } ARGS_NODE_ALLOCATE;
5941  
5942         struct {
5943 -               DSP_HNODE hNode;
5944 +               void *hNode;
5945                 u32 uSize;
5946                 struct DSP_BUFFERATTR __user *pAttr;
5947                 u8 *__user *pBuffer;
5948         } ARGS_NODE_ALLOCMSGBUF;
5949  
5950         struct {
5951 -               DSP_HNODE hNode;
5952 +               void *hNode;
5953                 s32 iPriority;
5954         } ARGS_NODE_CHANGEPRIORITY;
5955  
5956         struct {
5957 -               DSP_HNODE hNode;
5958 +               void *hNode;
5959                 u32 uStream;
5960 -               DSP_HNODE hOtherNode;
5961 +               void *hOtherNode;
5962                 u32 uOtherStream;
5963                 struct DSP_STRMATTR __user *pAttrs;
5964                 struct DSP_CBDATA __user *pConnParam;
5965         } ARGS_NODE_CONNECT;
5966  
5967         struct {
5968 -               DSP_HNODE hNode;
5969 +               void *hNode;
5970         } ARGS_NODE_CREATE;
5971  
5972         struct {
5973 -               DSP_HNODE hNode;
5974 +               void *hNode;
5975         } ARGS_NODE_DELETE;
5976  
5977         struct {
5978 -               DSP_HNODE hNode;
5979 +               void *hNode;
5980                 struct DSP_BUFFERATTR __user *pAttr;
5981                 u8 *pBuffer;
5982         } ARGS_NODE_FREEMSGBUF;
5983  
5984         struct {
5985 -               DSP_HNODE hNode;
5986 +               void *hNode;
5987                 struct DSP_NODEATTR __user *pAttr;
5988                 u32 uAttrSize;
5989         } ARGS_NODE_GETATTR;
5990  
5991         struct {
5992 -               DSP_HNODE hNode;
5993 +               void *hNode;
5994                 struct DSP_MSG __user *pMessage;
5995                 u32 uTimeout;
5996         } ARGS_NODE_GETMESSAGE;
5997  
5998         struct {
5999 -               DSP_HNODE hNode;
6000 +               void *hNode;
6001         } ARGS_NODE_PAUSE;
6002  
6003         struct {
6004 -               DSP_HNODE hNode;
6005 +               void *hNode;
6006                 struct DSP_MSG __user *pMessage;
6007                 u32 uTimeout;
6008         } ARGS_NODE_PUTMESSAGE;
6009  
6010         struct {
6011 -               DSP_HNODE hNode;
6012 +               void *hNode;
6013                 u32 uEventMask;
6014                 u32 uNotifyType;
6015                 struct DSP_NOTIFICATION __user *hNotification;
6016         } ARGS_NODE_REGISTERNOTIFY;
6017  
6018         struct {
6019 -               DSP_HNODE hNode;
6020 +               void *hNode;
6021         } ARGS_NODE_RUN;
6022  
6023         struct {
6024 -               DSP_HNODE hNode;
6025 +               void *hNode;
6026                 DSP_STATUS __user *pStatus;
6027         } ARGS_NODE_TERMINATE;
6028  
6029         struct {
6030 -               DSP_HPROCESSOR hProcessor;
6031 +               void *hProcessor;
6032                 struct DSP_UUID __user *pNodeID;
6033                 struct DSP_NDBPROPS __user *pNodeProps;
6034         } ARGS_NODE_GETUUIDPROPS;
6035 @@ -308,40 +259,40 @@ union Trapped_Args {
6036         /* STRM module */
6037  
6038         struct {
6039 -               DSP_HSTREAM hStream;
6040 +               void *hStream;
6041                 u32 uSize;
6042                 u8 *__user *apBuffer;
6043                 u32 uNumBufs;
6044         } ARGS_STRM_ALLOCATEBUFFER;
6045  
6046         struct {
6047 -               DSP_HSTREAM hStream;
6048 +               void *hStream;
6049         } ARGS_STRM_CLOSE;
6050  
6051         struct {
6052 -               DSP_HSTREAM hStream;
6053 +               void *hStream;
6054                 u8 *__user *apBuffer;
6055                 u32 uNumBufs;
6056         } ARGS_STRM_FREEBUFFER;
6057  
6058         struct {
6059 -               DSP_HSTREAM hStream;
6060 +               void *hStream;
6061                 HANDLE *phEvent;
6062         } ARGS_STRM_GETEVENTHANDLE;
6063  
6064         struct {
6065 -               DSP_HSTREAM hStream;
6066 +               void *hStream;
6067                 struct STRM_INFO __user *pStreamInfo;
6068                 u32 uStreamInfoSize;
6069         } ARGS_STRM_GETINFO;
6070  
6071         struct {
6072 -               DSP_HSTREAM hStream;
6073 +               void *hStream;
6074                 bool bFlush;
6075         } ARGS_STRM_IDLE;
6076  
6077         struct {
6078 -               DSP_HSTREAM hStream;
6079 +               void *hStream;
6080                 u8 *pBuffer;
6081                 u32 dwBytes;
6082                 u32 dwBufSize;
6083 @@ -349,15 +300,15 @@ union Trapped_Args {
6084         } ARGS_STRM_ISSUE;
6085  
6086         struct {
6087 -               DSP_HNODE hNode;
6088 +               void *hNode;
6089                 u32 uDirection;
6090                 u32 uIndex;
6091                 struct STRM_ATTR __user *pAttrIn;
6092 -               DSP_HSTREAM __user *phStream;
6093 +               void *__user *phStream;
6094         } ARGS_STRM_OPEN;
6095  
6096         struct {
6097 -               DSP_HSTREAM hStream;
6098 +               void *hStream;
6099                 u8 *__user *pBufPtr;
6100                 u32 __user *pBytes;
6101                 u32 __user *pBufSize;
6102 @@ -365,14 +316,14 @@ union Trapped_Args {
6103         } ARGS_STRM_RECLAIM;
6104  
6105         struct {
6106 -               DSP_HSTREAM hStream;
6107 +               void *hStream;
6108                 u32 uEventMask;
6109                 u32 uNotifyType;
6110                 struct DSP_NOTIFICATION __user *hNotification;
6111         } ARGS_STRM_REGISTERNOTIFY;
6112  
6113         struct {
6114 -               DSP_HSTREAM __user *aStreamTab;
6115 +               void *__user *aStreamTab;
6116                 u32 nStreams;
6117                 u32 __user *pMask;
6118                 u32 uTimeout;
6119 @@ -393,7 +344,7 @@ union Trapped_Args {
6120         } ARGS_CMM_FREEBUF;
6121  
6122         struct {
6123 -               DSP_HPROCESSOR hProcessor;
6124 +               void *hProcessor;
6125                 struct CMM_OBJECT *__user *phCmmMgr;
6126         } ARGS_CMM_GETHANDLE;
6127  
6128 @@ -437,83 +388,159 @@ union Trapped_Args {
6129         } ARGS_UTIL_TESTDLL;
6130  } ;
6131  
6132 -#define CMD_BASE                   1
6133 +/*
6134 + * Dspbridge Ioctl numbering scheme
6135 + *
6136 + *    7                           0
6137 + *  ---------------------------------
6138 + *  |  Module   |   Ioctl Number    |
6139 + *  ---------------------------------
6140 + *  | x | x | x | 0 | 0 | 0 | 0 | 0 |
6141 + *  ---------------------------------
6142 + */
6143 +
6144 +/* Ioctl driver identifier */
6145 +#define DB             0xDB
6146 +#ifdef CONFIG_BRIDGE_NEW_API
6147 +/*
6148 + * Following are used to distinguish between module ioctls, this is needed
6149 + * in case new ioctls are introduced.
6150 + */
6151 +#define DB_MODULE_MASK         0xE0
6152 +#define DB_IOC_MASK            0x1F
6153  
6154 -/* MGR module offsets */
6155 -#define CMD_MGR_BASE_OFFSET         CMD_BASE
6156 -#define CMD_MGR_ENUMNODE_INFO_OFFSET    (CMD_MGR_BASE_OFFSET + 0)
6157 -#define CMD_MGR_ENUMPROC_INFO_OFFSET    (CMD_MGR_BASE_OFFSET + 1)
6158 -#define CMD_MGR_REGISTEROBJECT_OFFSET   (CMD_MGR_BASE_OFFSET + 2)
6159 -#define CMD_MGR_UNREGISTEROBJECT_OFFSET (CMD_MGR_BASE_OFFSET + 3)
6160 -#define CMD_MGR_WAIT_OFFSET         (CMD_MGR_BASE_OFFSET + 4)
6161 -
6162 -#ifndef RES_CLEANUP_DISABLE
6163 -#define CMD_MGR_RESOUCES_OFFSET         (CMD_MGR_BASE_OFFSET + 5)
6164 -#define CMD_MGR_END_OFFSET           CMD_MGR_RESOUCES_OFFSET
6165 -#else
6166 -#define CMD_MGR_END_OFFSET           CMD_MGR_WAIT_OFFSET
6167 -#endif
6168 -
6169 -#define CMD_PROC_BASE_OFFSET       (CMD_MGR_END_OFFSET + 1)
6170 -#define CMD_PROC_ATTACH_OFFSET   (CMD_PROC_BASE_OFFSET + 0)
6171 -#define CMD_PROC_CTRL_OFFSET       (CMD_PROC_BASE_OFFSET + 1)
6172 -#define CMD_PROC_DETACH_OFFSET   (CMD_PROC_BASE_OFFSET + 2)
6173 -#define CMD_PROC_ENUMNODE_OFFSET       (CMD_PROC_BASE_OFFSET + 3)
6174 -#define CMD_PROC_ENUMRESOURCES_OFFSET   (CMD_PROC_BASE_OFFSET + 4)
6175 -#define CMD_PROC_GETSTATE_OFFSET       (CMD_PROC_BASE_OFFSET + 5)
6176 -#define CMD_PROC_GETTRACE_OFFSET       (CMD_PROC_BASE_OFFSET + 6)
6177 -#define CMD_PROC_LOAD_OFFSET       (CMD_PROC_BASE_OFFSET + 7)
6178 -#define CMD_PROC_REGISTERNOTIFY_OFFSET  (CMD_PROC_BASE_OFFSET + 8)
6179 -#define CMD_PROC_START_OFFSET     (CMD_PROC_BASE_OFFSET + 9)
6180 -#define CMD_PROC_RSVMEM_OFFSET   (CMD_PROC_BASE_OFFSET + 10)
6181 -#define CMD_PROC_UNRSVMEM_OFFSET       (CMD_PROC_BASE_OFFSET + 11)
6182 -#define CMD_PROC_MAPMEM_OFFSET   (CMD_PROC_BASE_OFFSET + 12)
6183 -#define CMD_PROC_UNMAPMEM_OFFSET       (CMD_PROC_BASE_OFFSET + 13)
6184 -#define CMD_PROC_FLUSHMEMORY_OFFSET      (CMD_PROC_BASE_OFFSET + 14)
6185 -#define CMD_PROC_STOP_OFFSET       (CMD_PROC_BASE_OFFSET + 15)
6186 -#define CMD_PROC_INVALIDATEMEMORY_OFFSET (CMD_PROC_BASE_OFFSET + 16)
6187 -#define CMD_PROC_END_OFFSET         CMD_PROC_INVALIDATEMEMORY_OFFSET
6188 -
6189 -
6190 -#define CMD_NODE_BASE_OFFSET       (CMD_PROC_END_OFFSET + 1)
6191 -#define CMD_NODE_ALLOCATE_OFFSET       (CMD_NODE_BASE_OFFSET + 0)
6192 -#define CMD_NODE_ALLOCMSGBUF_OFFSET     (CMD_NODE_BASE_OFFSET + 1)
6193 -#define CMD_NODE_CHANGEPRIORITY_OFFSET  (CMD_NODE_BASE_OFFSET + 2)
6194 -#define CMD_NODE_CONNECT_OFFSET         (CMD_NODE_BASE_OFFSET + 3)
6195 -#define CMD_NODE_CREATE_OFFSET   (CMD_NODE_BASE_OFFSET + 4)
6196 -#define CMD_NODE_DELETE_OFFSET   (CMD_NODE_BASE_OFFSET + 5)
6197 -#define CMD_NODE_FREEMSGBUF_OFFSET      (CMD_NODE_BASE_OFFSET + 6)
6198 -#define CMD_NODE_GETATTR_OFFSET         (CMD_NODE_BASE_OFFSET + 7)
6199 -#define CMD_NODE_GETMESSAGE_OFFSET      (CMD_NODE_BASE_OFFSET + 8)
6200 -#define CMD_NODE_PAUSE_OFFSET     (CMD_NODE_BASE_OFFSET + 9)
6201 -#define CMD_NODE_PUTMESSAGE_OFFSET      (CMD_NODE_BASE_OFFSET + 10)
6202 -#define CMD_NODE_REGISTERNOTIFY_OFFSET  (CMD_NODE_BASE_OFFSET + 11)
6203 -#define CMD_NODE_RUN_OFFSET         (CMD_NODE_BASE_OFFSET + 12)
6204 -#define CMD_NODE_TERMINATE_OFFSET       (CMD_NODE_BASE_OFFSET + 13)
6205 -#define CMD_NODE_GETUUIDPROPS_OFFSET    (CMD_NODE_BASE_OFFSET + 14)
6206 -#define CMD_NODE_END_OFFSET         CMD_NODE_GETUUIDPROPS_OFFSET
6207 -
6208 -#define CMD_STRM_BASE_OFFSET       (CMD_NODE_END_OFFSET + 1)
6209 -#define CMD_STRM_ALLOCATEBUFFER_OFFSET  (CMD_STRM_BASE_OFFSET + 0)
6210 -#define CMD_STRM_CLOSE_OFFSET     (CMD_STRM_BASE_OFFSET + 1)
6211 -#define CMD_STRM_FREEBUFFER_OFFSET      (CMD_STRM_BASE_OFFSET + 2)
6212 -#define CMD_STRM_GETEVENTHANDLE_OFFSET  (CMD_STRM_BASE_OFFSET + 3)
6213 -#define CMD_STRM_GETINFO_OFFSET         (CMD_STRM_BASE_OFFSET + 4)
6214 -#define CMD_STRM_IDLE_OFFSET       (CMD_STRM_BASE_OFFSET + 5)
6215 -#define CMD_STRM_ISSUE_OFFSET     (CMD_STRM_BASE_OFFSET + 6)
6216 -#define CMD_STRM_OPEN_OFFSET       (CMD_STRM_BASE_OFFSET + 7)
6217 -#define CMD_STRM_RECLAIM_OFFSET         (CMD_STRM_BASE_OFFSET + 8)
6218 -#define CMD_STRM_REGISTERNOTIFY_OFFSET  (CMD_STRM_BASE_OFFSET + 9)
6219 -#define CMD_STRM_SELECT_OFFSET   (CMD_STRM_BASE_OFFSET + 10)
6220 -#define CMD_STRM_END_OFFSET         CMD_STRM_SELECT_OFFSET
6221 -
6222 -/* Communication Memory Manager (UCMM) */
6223 -#define CMD_CMM_BASE_OFFSET         (CMD_STRM_END_OFFSET + 1)
6224 -#define CMD_CMM_ALLOCBUF_OFFSET         (CMD_CMM_BASE_OFFSET + 0)
6225 -#define CMD_CMM_FREEBUF_OFFSET   (CMD_CMM_BASE_OFFSET + 1)
6226 -#define CMD_CMM_GETHANDLE_OFFSET       (CMD_CMM_BASE_OFFSET + 2)
6227 -#define CMD_CMM_GETINFO_OFFSET   (CMD_CMM_BASE_OFFSET + 3)
6228 -#define CMD_CMM_END_OFFSET           CMD_CMM_GETINFO_OFFSET
6229 +/* Ioctl module masks */
6230 +#define DB_MGR         0x0
6231 +#define DB_PROC                0x20
6232 +#define DB_NODE                0x40
6233 +#define DB_STRM                0x60
6234 +#define DB_CMM         0x80
6235 +
6236 +#define DB_MODULE_SHIFT                5
6237 +
6238 +/* Used to calculate the ioctl per dspbridge module */
6239 +#define DB_IOC(module, num) \
6240 +                       (((module) & DB_MODULE_MASK) | ((num) & DB_IOC_MASK))
6241 +/* Used to get dspbridge ioctl module */
6242 +#define DB_GET_MODULE(cmd)     ((cmd) & DB_MODULE_MASK)
6243 +/* Used to get dspbridge ioctl number */
6244 +#define DB_GET_IOC(cmd)                ((cmd) & DB_IOC_MASK)
6245 +
6246 +#else /* NEW_API */
6247 +
6248 +#define DB_MGR  1
6249 +#define DB_PROC 7
6250 +#define DB_NODE 24
6251 +#define DB_STRM 39
6252 +#define DB_CMM  50
6253 +
6254 +#define DB_IOC(module, num)    ((module) + (num))
6255 +
6256 +/* Used to get dspbridge ioctl module */
6257 +static int DB_GET_MODULE(int cmd)
6258 +{
6259 +    if(cmd<DB_PROC)
6260 +       return DB_MGR;
6261 +    else if(cmd<DB_NODE)
6262 +       return DB_PROC;
6263 +    else if(cmd<DB_STRM)
6264 +       return DB_NODE;
6265 +    else if(cmd<DB_CMM)
6266 +       return DB_STRM;
6267 +    else
6268 +       return DB_CMM;
6269 +}
6270 +
6271 +/* Used to get dspbridge ioctl number */
6272 +static int DB_GET_IOC(int cmd)
6273 +{
6274 +    if(cmd<DB_PROC)
6275 +       return (cmd-DB_MGR);
6276 +    else if(cmd<DB_NODE)
6277 +       return (cmd-DB_PROC);
6278 +    else if(cmd<DB_STRM)
6279 +       return (cmd-DB_NODE);
6280 +    else if(cmd<DB_CMM)
6281 +       return (cmd-DB_STRM);
6282 +    else
6283 +       return (cmd-DB_CMM);
6284 +}
6285 +
6286 +#undef _IOR
6287 +#undef _IOW
6288 +#undef _IOWR
6289 +
6290 +#define _IOR(type, nr, size)   (nr)
6291 +#define _IOW(type, nr, size)   (nr)
6292 +#define _IOWR(type, nr, size)  (nr)
6293 +#endif /* NEW_API */
6294 +
6295 +
6296 +/* TODO: Remove deprecated and not implemented */
6297 +
6298 +/* MGR Module */
6299 +#define MGR_ENUMNODE_INFO      _IOWR(DB, DB_IOC(DB_MGR, 0), unsigned long)
6300 +#define MGR_ENUMPROC_INFO      _IOWR(DB, DB_IOC(DB_MGR, 1), unsigned long)
6301 +#define MGR_REGISTEROBJECT     _IOWR(DB, DB_IOC(DB_MGR, 2), unsigned long)
6302 +#define MGR_UNREGISTEROBJECT   _IOWR(DB, DB_IOC(DB_MGR, 3), unsigned long)
6303 +#define MGR_WAIT               _IOWR(DB, DB_IOC(DB_MGR, 4), unsigned long)
6304 +/* MGR_GET_PROC_RES Deprecated */
6305 +#define MGR_GET_PROC_RES       _IOR(DB, DB_IOC(DB_MGR, 5), unsigned long)
6306 +
6307 +/* PROC Module */
6308 +#define PROC_ATTACH            _IOWR(DB, DB_IOC(DB_PROC, 0), unsigned long)
6309 +#define PROC_CTRL              _IOR(DB, DB_IOC(DB_PROC, 1), unsigned long)
6310 +/* PROC_DETACH Deprecated */
6311 +#define PROC_DETACH            _IOR(DB, DB_IOC(DB_PROC, 2), unsigned long)
6312 +#define PROC_ENUMNODE          _IOWR(DB, DB_IOC(DB_PROC, 3), unsigned long)
6313 +#define PROC_ENUMRESOURCES     _IOWR(DB, DB_IOC(DB_PROC, 4), unsigned long)
6314 +#define PROC_GET_STATE         _IOWR(DB, DB_IOC(DB_PROC, 5), unsigned long)
6315 +#define PROC_GET_TRACE         _IOWR(DB, DB_IOC(DB_PROC, 6), unsigned long)
6316 +#define PROC_LOAD              _IOW(DB, DB_IOC(DB_PROC, 7), unsigned long)
6317 +#define PROC_REGISTERNOTIFY    _IOWR(DB, DB_IOC(DB_PROC, 8), unsigned long)
6318 +#define PROC_START             _IOW(DB, DB_IOC(DB_PROC, 9), unsigned long)
6319 +#define PROC_RSVMEM            _IOWR(DB, DB_IOC(DB_PROC, 10), unsigned long)
6320 +#define PROC_UNRSVMEM          _IOW(DB, DB_IOC(DB_PROC, 11), unsigned long)
6321 +#define PROC_MAPMEM            _IOWR(DB, DB_IOC(DB_PROC, 12), unsigned long)
6322 +#define PROC_UNMAPMEM          _IOR(DB, DB_IOC(DB_PROC, 13), unsigned long)
6323 +#define PROC_FLUSHMEMORY       _IOW(DB, DB_IOC(DB_PROC, 14), unsigned long)
6324 +#define PROC_STOP              _IOWR(DB, DB_IOC(DB_PROC, 15), unsigned long)
6325 +#define PROC_INVALIDATEMEMORY  _IOW(DB, DB_IOC(DB_PROC, 16), unsigned long)
6326 +
6327 +/* NODE Module */
6328 +#define NODE_ALLOCATE          _IOWR(DB, DB_IOC(DB_NODE, 0), unsigned long)
6329 +#define NODE_ALLOCMSGBUF       _IOWR(DB, DB_IOC(DB_NODE, 1), unsigned long)
6330 +#define NODE_CHANGEPRIORITY    _IOW(DB, DB_IOC(DB_NODE, 2), unsigned long)
6331 +#define NODE_CONNECT           _IOW(DB, DB_IOC(DB_NODE, 3), unsigned long)
6332 +#define NODE_CREATE            _IOW(DB, DB_IOC(DB_NODE, 4), unsigned long)
6333 +#define NODE_DELETE            _IOW(DB, DB_IOC(DB_NODE, 5), unsigned long)
6334 +#define NODE_FREEMSGBUF                _IOW(DB, DB_IOC(DB_NODE, 6), unsigned long)
6335 +#define NODE_GETATTR           _IOWR(DB, DB_IOC(DB_NODE, 7), unsigned long)
6336 +#define NODE_GETMESSAGE                _IOWR(DB, DB_IOC(DB_NODE, 8), unsigned long)
6337 +#define NODE_PAUSE             _IOW(DB, DB_IOC(DB_NODE, 9), unsigned long)
6338 +#define NODE_PUTMESSAGE                _IOW(DB, DB_IOC(DB_NODE, 10), unsigned long)
6339 +#define NODE_REGISTERNOTIFY    _IOWR(DB, DB_IOC(DB_NODE, 11), unsigned long)
6340 +#define NODE_RUN               _IOW(DB, DB_IOC(DB_NODE, 12), unsigned long)
6341 +#define NODE_TERMINATE         _IOWR(DB, DB_IOC(DB_NODE, 13), unsigned long)
6342 +#define NODE_GETUUIDPROPS      _IOWR(DB, DB_IOC(DB_NODE, 14), unsigned long)
6343 +
6344 +/* STRM Module */
6345 +#define STRM_ALLOCATEBUFFER    _IOWR(DB, DB_IOC(DB_STRM, 0), unsigned long)
6346 +#define STRM_CLOSE             _IOW(DB, DB_IOC(DB_STRM, 1), unsigned long)
6347 +#define STRM_FREEBUFFER                _IOWR(DB, DB_IOC(DB_STRM, 2), unsigned long)
6348 +#define STRM_GETEVENTHANDLE    _IO(DB, DB_IOC(DB_STRM, 3))     /* Not Impl'd */
6349 +#define STRM_GETINFO           _IOWR(DB, DB_IOC(DB_STRM, 4), unsigned long)
6350 +#define STRM_IDLE              _IOW(DB, DB_IOC(DB_STRM, 5), unsigned long)
6351 +#define STRM_ISSUE             _IOW(DB, DB_IOC(DB_STRM, 6), unsigned long)
6352 +#define STRM_OPEN              _IOWR(DB, DB_IOC(DB_STRM, 7), unsigned long)
6353 +#define STRM_RECLAIM           _IOWR(DB, DB_IOC(DB_STRM, 8), unsigned long)
6354 +#define STRM_REGISTERNOTIFY    _IOWR(DB, DB_IOC(DB_STRM, 9), unsigned long)
6355 +#define STRM_SELECT            _IOWR(DB, DB_IOC(DB_STRM, 10), unsigned long)
6356 +
6357 +/* CMM Module */
6358 +#define CMM_ALLOCBUF           _IO(DB, DB_IOC(DB_CMM, 0))      /* Not Impl'd */
6359 +#define CMM_FREEBUF            _IO(DB, DB_IOC(DB_CMM, 1))      /* Not Impl'd */
6360 +#define CMM_GETHANDLE          _IOR(DB, DB_IOC(DB_CMM, 2), unsigned long)
6361 +#define CMM_GETINFO            _IOR(DB, DB_IOC(DB_CMM, 3), unsigned long)
6362  
6363 -#define CMD_BASE_END_OFFSET    CMD_CMM_END_OFFSET
6364  #endif                         /* WCDIOCTL_ */
6365 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmd.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmd.h
6366 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmd.h 2011-04-17 17:32:26.000000000 +0100
6367 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmd.h      2011-05-02 22:36:49.000000000 +0100
6368 @@ -3,6 +3,18 @@
6369   *
6370   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6371   *
6372 + * Bridge mini driver entry point and interface function declarations.
6373 + *
6374 + * Notes:
6375 + *   The Bridge class driver obtains it's function interface to
6376 + *   the Bridge mini driver via a call to WMD_DRV_Entry().
6377 + *
6378 + *   Bridge Class Driver services exported to WMD's are initialized by the
6379 + *   WCD on behalf of the WMD.
6380 + *
6381 + *   WMD function DBC Requires and Ensures are also made by the WCD on
6382 + *   behalf of the WMD, to simplify the WMD code.
6383 + *
6384   * Copyright (C) 2005-2006 Texas Instruments, Inc.
6385   *
6386   * This package is free software; you can redistribute it and/or modify
6387 @@ -14,51 +26,6 @@
6388   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6389   */
6390  
6391 -
6392 -/*
6393 - *  ======== wmd.h ========
6394 - *  Purpose:
6395 - *      'Bridge mini driver entry point and interface function declarations.
6396 - *
6397 - *  Public Functions:
6398 - *      WMD_DRV_Entry
6399 - *
6400 - *  Notes:
6401 - *      The 'Bridge class driver obtains it's function interface to
6402 - *      the 'Bridge mini driver via a call to WMD_DRV_Entry().
6403 - *
6404 - *      'Bridge Class Driver services exported to WMD's are initialized by the
6405 - *      WCD on behalf of the WMD.
6406 - *
6407 - *      WMD function DBC Requires and Ensures are also made by the WCD on
6408 - *      behalf of the WMD, to simplify the WMD code.
6409 - *
6410 - *! Revision History:
6411 - *! ================
6412 - *! 19-Apr-2004 sb  Aligned DMM definitions with Symbian
6413 - *! 08-Mar-2004 sb  Added the Dynamic Memory Mapping APIs - WMD_BRD_MemMap/UnMap
6414 - *! 01-Mar-2004 vp  Added filename argument to WMD_DRV_Entry function.
6415 - *! 29-Aug-2002 map Added WMD_BRD_MemWrite()
6416 - *! 26-Aug-2002 map Added WMD_BRD_MemCopy()
6417 - *! 07-Jan-2002 ag  Added cBufSize to WMD_CHNL_AddIOReq().
6418 - *! 05-Nov-2001 kc: Added error handling DEH functions.
6419 - *! 06-Dec-2000 jeh Added uEventMask to WMD_MSG_RegisterNotify().
6420 - *! 17-Nov-2000 jeh Added WMD_MSG and WMD_IO definitions.
6421 - *! 01-Nov-2000 jeh Added more error codes to WMD_CHNL_RegisterNotify().
6422 - *! 13-Oct-2000 jeh Added dwArg to WMD_CHNL_AddIOReq(), added WMD_CHNL_IDLE
6423 - *!                 and WMD_CHNL_RegisterNotify for DSPStream support.
6424 - *! 17-Jan-2000 rr: WMD_BRD_SETSTATE Added.
6425 - *! 30-Jul-1997 gp: Split wmd IOCTL space into reserved and private.
6426 - *! 07-Nov-1996 gp: Updated for code review.
6427 - *! 18-Oct-1996 gp: Added WMD_E_HARDWARE return code from WMD_BRD_Monitor.
6428 - *! 09-Sep-1996 gp: Subtly altered the semantics of WMD_CHNL_GetInfo().
6429 - *! 02-Aug-1996 gp: Ensured on BRD_Start that interrupts to the PC are enabled.
6430 - *! 11-Jul-1996 gp: Added CHNL interface. Note stronger DBC_Require conditions.
6431 - *! 29-May-1996 gp: Removed WCD_ prefix from functions imported from WCD.LIB.
6432 - *! 29-May-1996 gp: Made OUT param first in WMD_DEV_Create().
6433 - *! 09-May-1996 gp: Created.
6434 - */
6435 -
6436  #ifndef WMD_
6437  #define WMD_
6438  
6439 @@ -277,7 +244,7 @@
6440   */
6441         typedef DSP_STATUS(*
6442                            WMD_BRD_STATUS) (struct WMD_DEV_CONTEXT *hDevContext,
6443 -                                           OUT BRD_STATUS * pdwState);
6444 +                                           int *pdwState);
6445  
6446  /*
6447   *  ======== WMD_BRD_Read ========
6448 @@ -451,7 +418,7 @@ typedef DSP_STATUS(*WMD_BRD_WRITE)(struc
6449         typedef DSP_STATUS(*WMD_CHNL_OPEN) (OUT struct CHNL_OBJECT
6450                                                    **phChnl,
6451                                                    struct CHNL_MGR *hChnlMgr,
6452 -                                                  CHNL_MODE uMode,
6453 +                                                  short int uMode,
6454                                                    u32 uChnlId,
6455                                                    CONST IN OPTIONAL struct
6456                                                    CHNL_ATTRS *pAttrs);
6457 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmdchnl.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmdchnl.h
6458 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmdchnl.h     2011-04-17 17:32:26.000000000 +0100
6459 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmdchnl.h  2011-05-02 22:36:49.000000000 +0100
6460 @@ -3,6 +3,13 @@
6461   *
6462   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6463   *
6464 + * Declares the upper edge channel class library functions required by
6465 + * all WMD / WCD driver interface tables.  These functions are implemented
6466 + * by every class of WMD channel library.
6467 + *
6468 + * Notes:
6469 + *   The function comment headers reside in wmd.h.
6470 + *
6471   * Copyright (C) 2005-2006 Texas Instruments, Inc.
6472   *
6473   * This package is free software; you can redistribute it and/or modify
6474 @@ -14,28 +21,6 @@
6475   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6476   */
6477  
6478 -
6479 -/*
6480 - *  ======== wmdchnl.h ========
6481 - *  Description:
6482 - *      Declares the upper edge channel class library functions required by
6483 - *      all WMD / WCD driver interface tables.  These functions are implemented
6484 - *      by every class of WMD channel library.
6485 - *
6486 - *  Public Functions:
6487 - *
6488 - *  Notes:
6489 - *      The function comment headers reside with the function typedefs in wmd.h.
6490 - *
6491 - *! Revision History:
6492 - *! ================
6493 - *! 07-Jan-2002 ag  Added cBufSize to WMD_CHNL_AddIOReq().
6494 - *! 13-Oct-2000 jeh Added dwArg parameter to WMD_CHNL_AddIOReq(), added
6495 - *!                 WMD_CHNL_Idle and WMD_CHNL_RegisterNotify for DSPStream
6496 - *!                 support.
6497 - *! 11-Jul-1996 gp: Created.
6498 - */
6499 -
6500  #ifndef WMDCHNL_
6501  #define WMDCHNL_
6502  
6503 @@ -48,7 +33,7 @@
6504  
6505         extern DSP_STATUS WMD_CHNL_Open(OUT struct CHNL_OBJECT **phChnl,
6506                                         struct CHNL_MGR *hChnlMgr,
6507 -                                       CHNL_MODE uMode,
6508 +                                       short int uMode,
6509                                         u32 uChnlId,
6510                                         CONST IN OPTIONAL struct CHNL_ATTRS
6511                                         *pAttrs);
6512 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmddeh.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmddeh.h
6513 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmddeh.h      2011-04-17 17:32:26.000000000 +0100
6514 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmddeh.h   2011-05-02 22:36:49.000000000 +0100
6515 @@ -3,6 +3,12 @@
6516   *
6517   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6518   *
6519 + * Defines upper edge DEH functions required by all WMD/WCD driver
6520 + * interface tables.
6521 + *
6522 + * Notes:
6523 + *   Function comment headers reside with the function typedefs in wmd.h.
6524 + *
6525   * Copyright (C) 2005-2006 Texas Instruments, Inc.
6526   *
6527   * This package is free software; you can redistribute it and/or modify
6528 @@ -14,30 +20,6 @@
6529   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6530   */
6531  
6532 -
6533 -/*
6534 - *  ======== wmddeh.h ========
6535 - *  Description:
6536 - *      Defines upper edge DEH functions required by all WMD/WCD driver
6537 - *      interface tables.
6538 - *
6539 - *  Public Functions:
6540 - *      WMD_DEH_Create
6541 - *      IVA_DEH_Create
6542 - *      WMD_DEH_Destroy
6543 - *      WMD_DEH_GetInfo
6544 - *      WMD_DEH_RegisterNotify
6545 - *      WMD_DEH_Notify
6546 - *
6547 - *  Notes:
6548 - *      Function comment headers reside with the function typedefs in wmd.h.
6549 - *
6550 - *! Revision History:
6551 - *! ================
6552 - *! 26-Dec-2004 hn: added IVA_DEH_Create.
6553 - *! 13-Sep-2001 kc: created.
6554 - */
6555 -
6556  #ifndef WMDDEH_
6557  #define WMDDEH_
6558  
6559 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmdio.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmdio.h
6560 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmdio.h       2011-04-17 17:32:26.000000000 +0100
6561 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmdio.h    2011-05-02 22:36:49.000000000 +0100
6562 @@ -3,6 +3,12 @@
6563   *
6564   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6565   *
6566 + * Declares the upper edge IO functions required by all WMD / WCD
6567 + * driver interface tables.
6568 + *
6569 + * Notes:
6570 + *   Function comment headers reside in wmd.h.
6571 + *
6572   * Copyright (C) 2005-2006 Texas Instruments, Inc.
6573   *
6574   * This package is free software; you can redistribute it and/or modify
6575 @@ -14,24 +20,6 @@
6576   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6577   */
6578  
6579 -
6580 -/*
6581 - *  ======== wmdio.h ========
6582 - *  Description:
6583 - *      Declares the upper edge IO  functions required by
6584 - *      all WMD / WCD driver interface tables.
6585 - *
6586 - *  Public Functions:
6587 - *
6588 - *  Notes:
6589 - *      Function comment headers reside with the function typedefs in wmd.h.
6590 - *
6591 - *! Revision History:
6592 - *! ================
6593 - *! 27-Feb-2004 vp             Added IVA releated function.
6594 - *! 06-Nov-2000 jeh     Created.
6595 - */
6596 -
6597  #ifndef WMDIO_
6598  #define WMDIO_
6599  
6600 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmdioctl.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmdioctl.h
6601 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmdioctl.h    2011-04-17 17:32:26.000000000 +0100
6602 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmdioctl.h 2011-05-02 22:36:49.000000000 +0100
6603 @@ -3,6 +3,8 @@
6604   *
6605   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6606   *
6607 + * BRIDGE Minidriver BRD_IOCtl reserved command definitions.
6608 + *
6609   * Copyright (C) 2005-2006 Texas Instruments, Inc.
6610   *
6611   * This package is free software; you can redistribute it and/or modify
6612 @@ -14,30 +16,6 @@
6613   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6614   */
6615  
6616 -
6617 -/*
6618 - *  ======== wmdioctl.h ========
6619 - *  Description:
6620 - *    BRIDGE Minidriver BRD_IOCtl reserved command definitions.
6621 - *
6622 - *! Revision History
6623 - *! ================
6624 - *! 19-Apr-2004 sb   Updated HW typedefs
6625 - *! 16-Feb-2004 vp   Added MMU endianness attributes to WMDIOCTL_EXTPROC
6626 - *! 21-Mar-2003 sb   Changed WMDIOCTL_NUMOFMMUTLB from 7 to 32
6627 - *! 14-May-2001 sg   Added codes for PWR.
6628 - *! 10-Aug-2001 ag   Added _SETMMUCONFIG ioctl used for DSP-MMU init.
6629 - *! 16-Nov-1999 rajesh ?
6630 - *! 18-Jun-1998 ag   Moved EMIF, SDRAM_C, & CE space init to ENBLEXTMEM ioctl.
6631 - *!                  Added ENBLEXTMEM, RESETDSP, UNRESETDSP & ASSERTSIG ioctls.
6632 - *! 07-Jun-1998 ag   Added JTAG_SELECT, MAP_TBC, GET_CONFIGURATION ioctls.
6633 - *! 26-Jan-1998 jeh: Added START, RECV, and SEND ioctls.
6634 - *! 07-Nov-1997 nn:  Added command to interrupt DSP for interrupt test.
6635 - *! 20-Oct-1997 nn:  Added commands for getting and resetting interrupt count.
6636 - *! 17-Oct-1997 gp:  Moved to src/wmd. Standardized prefix.
6637 - *! 08-Oct-1997 nn:  Created.
6638 - */
6639 -
6640  #ifndef WMDIOCTL_
6641  #define WMDIOCTL_
6642  
6643 diff -rupN kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmdmsg.h kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmdmsg.h
6644 --- kernel-power-2.6.28.orig/arch/arm/plat-omap/include/dspbridge/wmdmsg.h      2011-04-17 17:32:26.000000000 +0100
6645 +++ kernel-power-2.6.28/arch/arm/plat-omap/include/dspbridge/wmdmsg.h   2011-05-02 22:36:49.000000000 +0100
6646 @@ -3,6 +3,13 @@
6647   *
6648   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6649   *
6650 + * Declares the upper edge message class library functions required by
6651 + * all WMD / WCD driver interface tables.  These functions are
6652 + * implemented by every class of WMD channel library.
6653 + *
6654 + * Notes:
6655 + *   Function comment headers reside in wmd.h.
6656 + *
6657   * Copyright (C) 2005-2006 Texas Instruments, Inc.
6658   *
6659   * This package is free software; you can redistribute it and/or modify
6660 @@ -14,26 +21,6 @@
6661   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6662   */
6663  
6664 -
6665 -/*
6666 - *  ======== wmdmsg.h ========
6667 - *  Description:
6668 - *      Declares the upper edge message class library functions required by
6669 - *      all WMD / WCD driver interface tables.  These functions are
6670 - *      implemented by every class of WMD channel library.
6671 - *
6672 - *  Public Functions:
6673 - *
6674 - *  Notes:
6675 - *      Function comment headers reside with the function typedefs in wmd.h.
6676 - *
6677 - *! Revision History:
6678 - *! ================
6679 - *! 06-Dec-2000 jeh     Added uEventMask to WMD_MSG_RegisterNotify(). Added
6680 - *!                     WMD_MSG_SetQueueId().
6681 - *! 17-Nov-2000 jeh     Created.
6682 - */
6683 -
6684  #ifndef WMDMSG_
6685  #define WMDMSG_
6686  
6687 diff -rupN kernel-power-2.6.28.orig/arch/arm/configs/rx51_defconfig kernel-power-2.6.28/arch/arm/configs/rx51_defconfig
6688 --- kernel-power-2.6.28.orig/arch/arm/configs/rx51_defconfig    2011-04-17 17:32:12.000000000 +0100
6689 +++ kernel-power-2.6.28/arch/arm/configs/rx51_defconfig 2011-05-06 14:16:04.000000000 +0100
6690 @@ -1512,7 +1512,7 @@ CONFIG_FB_CFB_IMAGEBLIT=y
6691  CONFIG_FB_OMAP_BOOTLOADER_INIT=y
6692  CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE=14
6693  CONFIG_OMAP2_DSS=y
6694 -CONFIG_OMAP2_DSS_VRAM_SIZE=0
6695 +CONFIG_OMAP2_DSS_VRAM_SIZE=6
6696  # CONFIG_OMAP2_DSS_DEBUG_SUPPORT is not set
6697  # CONFIG_OMAP2_DSS_RFBI is not set
6698  CONFIG_OMAP2_DSS_VENC=y
6699 @@ -1943,9 +1943,9 @@ CONFIG_REGULATOR_TWL4030=y
6700  # CONFIG_CBUS is not set
6701  CONFIG_MPU_BRIDGE=m
6702  CONFIG_BRIDGE_DVFS=y
6703 -CONFIG_BRIDGE_MEMPOOL_SIZE=0x412800
6704 +CONFIG_BRIDGE_MEMPOOL_SIZE=0x600000
6705  # CONFIG_BRIDGE_DEBUG is not set
6706 -
6707 +# CONFIG_BRIDGE_NTFY_PWRERR is not set
6708  #
6709  # File systems
6710  #
6711 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/Kbuild kernel-power-2.6.28/drivers/dsp/bridge/Kbuild
6712 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/Kbuild  2011-04-17 17:32:26.000000000 +0100
6713 +++ kernel-power-2.6.28/drivers/dsp/bridge/Kbuild       1970-01-01 01:00:00.000000000 +0100
6714 @@ -1,39 +0,0 @@
6715 -obj-$(CONFIG_MPU_BRIDGE)       += bridgedriver.o
6716 -
6717 -libgen = gen/gb.o gen/gt.o gen/gs.o gen/gh.o gen/_gt_para.o gen/uuidutil.o
6718 -libservices = services/csl.o services/mem.o services/list.o services/dpc.o \
6719 -               services/kfile.o services/sync.o \
6720 -               services/clk.o services/cfg.o services/reg.o \
6721 -               services/regsup.o services/ntfy.o \
6722 -               services/dbg.o services/services.o
6723 -libwmd = wmd/chnl_sm.o wmd/msg_sm.o wmd/io_sm.o wmd/tiomap3430.o \
6724 -               wmd/tiomap3430_pwr.o wmd/tiomap_sm.o wmd/tiomap_io.o \
6725 -               wmd/mmu_fault.o wmd/ue_deh.o
6726 -libpmgr = pmgr/chnl.o pmgr/io.o pmgr/msg.o pmgr/cod.o pmgr/dev.o pmgr/wcd.o \
6727 -               pmgr/dmm.o pmgr/cmm.o pmgr/dbll.o
6728 -librmgr = rmgr/dbdcd.o rmgr/disp.o rmgr/drv.o rmgr/mgr.o rmgr/node.o \
6729 -               rmgr/proc.o rmgr/pwr.o rmgr/rmm.o rmgr/strm.o rmgr/dspdrv.o \
6730 -               rmgr/nldr.o rmgr/drv_interface.o
6731 -libdload = dynload/cload.o dynload/getsection.o dynload/reloc.o
6732 -libhw = hw/hw_prcm.o hw/hw_dspssC64P.o hw/hw_mmu.o hw/hw_mbox.o
6733 -
6734 -bridgedriver-objs = $(libgen) $(libservices) $(libwmd) $(libpmgr) $(librmgr) \
6735 -                       $(libdload) $(libhw)
6736 -
6737 -# Debug
6738 -ifeq ($(CONFIG_BRIDGE_DEBUG),y)
6739 -ccflags-y += -DGT_TRACE -DDEBUG
6740 -endif
6741 -
6742 -#Machine dependent
6743 -ccflags-y += -D_TI_ -D_DB_TIOMAP -DTMS32060 \
6744 -               -DTICFG_PROC_VER -DTICFG_EVM_TYPE -DCHNL_SMCLASS \
6745 -               -DCHNL_MESSAGES -DUSE_LEVEL_1_MACROS
6746 -
6747 -#Header files
6748 -ccflags-y += -Idrivers/dsp/bridge/services
6749 -ccflags-y += -Idrivers/dsp/bridge/wmd
6750 -ccflags-y += -Idrivers/dsp/bridge/pmgr
6751 -ccflags-y += -Idrivers/dsp/bridge/rmgr
6752 -ccflags-y += -Idrivers/dsp/bridge/hw
6753 -ccflags-y += -Iarch/arm
6754 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/Kconfig kernel-power-2.6.28/drivers/dsp/bridge/Kconfig
6755 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/Kconfig 2011-04-17 17:32:26.000000000 +0100
6756 +++ kernel-power-2.6.28/drivers/dsp/bridge/Kconfig      2011-05-02 22:36:49.000000000 +0100
6757 @@ -34,3 +34,14 @@ config BRIDGE_DEBUG
6758         depends on MPU_BRIDGE
6759         help
6760           Say Y to enable Bridge debugging capabilities
6761 +
6762 +comment "Bridge Notifications"
6763 +       depends on MPU_BRIDGE
6764 +
6765 +config BRIDGE_NTFY_PWRERR
6766 +       bool "Notify DSP Power Error"
6767 +       depends on MPU_BRIDGE
6768 +       help
6769 +         Enable notifications to registered clients on the event of power errror
6770 +         trying to suspend bridge driver. Say Y, to signal this event as a fatal
6771 +         error, this will require a bridge restart to recover.
6772 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/Makefile kernel-power-2.6.28/drivers/dsp/bridge/Makefile
6773 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/Makefile        1970-01-01 01:00:00.000000000 +0100
6774 +++ kernel-power-2.6.28/drivers/dsp/bridge/Makefile     2011-05-02 22:36:49.000000000 +0100
6775 @@ -0,0 +1,39 @@
6776 +obj-$(CONFIG_MPU_BRIDGE)       += bridgedriver.o
6777 +
6778 +libgen = gen/gb.o gen/gt.o gen/gs.o gen/gh.o gen/_gt_para.o gen/uuidutil.o
6779 +libservices = services/mem.o services/sync.o \
6780 +               services/clk.o services/cfg.o services/reg.o \
6781 +               services/regsup.o services/ntfy.o \
6782 +               services/dbg.o services/services.o
6783 +libwmd = wmd/chnl_sm.o wmd/msg_sm.o wmd/io_sm.o wmd/tiomap3430.o \
6784 +               wmd/tiomap3430_pwr.o wmd/tiomap_sm.o wmd/tiomap_io.o \
6785 +               wmd/mmu_fault.o wmd/ue_deh.o
6786 +libpmgr = pmgr/chnl.o pmgr/io.o pmgr/msg.o pmgr/cod.o pmgr/dev.o pmgr/wcd.o \
6787 +               pmgr/dmm.o pmgr/cmm.o pmgr/dbll.o
6788 +librmgr = rmgr/dbdcd.o rmgr/disp.o rmgr/drv.o rmgr/mgr.o rmgr/node.o \
6789 +               rmgr/proc.o rmgr/pwr.o rmgr/rmm.o rmgr/strm.o rmgr/dspdrv.o \
6790 +               rmgr/nldr.o rmgr/drv_interface.o
6791 +libdload = dynload/cload.o dynload/getsection.o dynload/reloc.o \
6792 +                dynload/tramp.o
6793 +libhw = hw/hw_prcm.o hw/hw_dspssC64P.o hw/hw_mmu.o hw/hw_mbox.o
6794 +
6795 +bridgedriver-objs = $(libgen) $(libservices) $(libwmd) $(libpmgr) $(librmgr) \
6796 +                       $(libdload) $(libhw)
6797 +
6798 +# Debug
6799 +ifeq ($(CONFIG_BRIDGE_DEBUG),y)
6800 +ccflags-y += -DGT_TRACE
6801 +endif
6802 +
6803 +#Machine dependent
6804 +ccflags-y += -D_TI_ -D_DB_TIOMAP -DTMS32060 \
6805 +               -DTICFG_PROC_VER -DTICFG_EVM_TYPE -DCHNL_SMCLASS \
6806 +               -DCHNL_MESSAGES -DUSE_LEVEL_1_MACROS
6807 +
6808 +#Header files
6809 +ccflags-y += -Idrivers/dsp/bridge/services
6810 +ccflags-y += -Idrivers/dsp/bridge/wmd
6811 +ccflags-y += -Idrivers/dsp/bridge/pmgr
6812 +ccflags-y += -Idrivers/dsp/bridge/rmgr
6813 +ccflags-y += -Idrivers/dsp/bridge/hw
6814 +ccflags-y += -Iarch/arm
6815 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/cload.c kernel-power-2.6.28/drivers/dsp/bridge/dynload/cload.c
6816 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/cload.c 2011-04-17 17:32:26.000000000 +0100
6817 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/cload.c      2011-05-02 22:36:49.000000000 +0100
6818 @@ -191,6 +191,8 @@ int Dynamic_Load_Module(struct Dynamic_L
6819                 symbol_table_free(&dl_state);
6820                 section_table_free(&dl_state);
6821                 string_table_free(&dl_state);
6822 +               dload_tramp_cleanup(&dl_state);
6823 +
6824  
6825                 if (dl_state.dload_errcount) {
6826                         Dynamic_Unload_Module(dl_state.myhandle, syms, alloc,
6827 @@ -489,10 +491,14 @@ static void allocate_sections(struct dlo
6828                 DL_ERROR("Arg 3 (alloc) required but NULL", 0);
6829                 return;
6830         }
6831 -       /* allocate space for the module handle, which we will
6832 -        *      keep for unload purposes */
6833 -       siz = dlthis->dfile_hdr.df_target_scns *
6834 -             sizeof(struct LDR_SECTION_INFO) + MY_HANDLE_SIZE;
6835 +       /*
6836 +        * allocate space for the module handle, which we will keep for unload
6837 +        * purposes include an additional section store for an auto-generated
6838 +        * trampoline section in case we need it.
6839 +        */
6840 +       siz = (dlthis->dfile_hdr.df_target_scns + 1) *
6841 +               sizeof(struct LDR_SECTION_INFO) + MY_HANDLE_SIZE;
6842 +
6843         hndl = (struct my_handle *)dlthis->mysym->Allocate(dlthis->mysym, siz);
6844         if (!hndl) {            /* not enough storage */
6845                 DL_ERROR(E_ALLOC, siz);
6846 @@ -587,7 +593,7 @@ static void section_table_free(struct dl
6847   * big unsorted array.  We just read that array into memory in bulk.
6848   ************************************************************************/
6849  static const char S_STRINGTBL[] = { "string table" };
6850 -void dload_strings(struct dload_state *dlthis, boolean sec_names_only)
6851 +void dload_strings(struct dload_state *dlthis, bool sec_names_only)
6852  {
6853         u32 ssiz;
6854         char *strbuf;
6855 @@ -707,11 +713,16 @@ static void dload_symbols(struct dload_s
6856         if (s_count == 0)
6857                 return;
6858  
6859 -       /* We keep a local symbol table for all of the symbols in the input.
6860 +       /*
6861 +        * We keep a local symbol table for all of the symbols in the input.
6862          * This table contains only section & value info, as we do not have
6863          * to do any name processing for locals.  We reuse this storage
6864          * as a temporary for .dllview record construction.
6865 -        * Allocate storage for the whole table.*/
6866 +        * Allocate storage for the whole table.  Add 1 to the section count
6867 +        * in case a trampoline section is auto-generated as well as the
6868 +        * size of the trampoline section name so DLLView doens't get lost.
6869 +        */
6870 +
6871         siz = s_count * sizeof(struct Local_Symbol);
6872         dsiz = DBG_HDR_SIZE +
6873                 (sizeof(struct dll_sect) * dlthis->allocated_secn_count) +
6874 @@ -790,6 +801,12 @@ static void dload_symbols(struct dload_s
6875                                         goto loop_cont;
6876                                 }
6877                                 val = delta = symp->value;
6878 +#ifdef ENABLE_TRAMP_DEBUG
6879 +                               dload_syms_error(dlthis->mysym,
6880 +                                               "===> ext sym [%s] at %x",
6881 +                                               sname, val);
6882 +#endif
6883 +
6884                                 goto loop_cont;
6885                         }
6886                         /* symbol defined by this module */
6887 @@ -1045,9 +1062,11 @@ loopexit:
6888  #define MY_RELOC_BUF_SIZ 8
6889  /* careful! exists at the same time as the image buffer*/
6890  static int relocate_packet(struct dload_state *dlthis,
6891 -                          struct image_packet_t *ipacket, u32 *checks)
6892 +                               struct image_packet_t *ipacket,
6893 +                               u32 *checks, bool *tramps_generated)
6894  {
6895         u32 rnum;
6896 +       *tramps_generated = false;
6897  
6898         rnum = ipacket->i_num_relocs;
6899         do {                    /* all relocs */
6900 @@ -1068,11 +1087,21 @@ static int relocate_packet(struct dload_
6901                 *checks += dload_checksum(rp, siz);
6902                 do {
6903                         /* perform the relocation operation */
6904 -                       dload_relocate(dlthis, (TgtAU_t *) ipacket->i_bits, rp);
6905 +                       dload_relocate(dlthis, (TgtAU_t *) ipacket->i_bits, rp,
6906 +                                       tramps_generated, false);
6907                         rp += 1;
6908                         rnum -= 1;
6909                 } while ((rinbuf -= 1) > 0);
6910         } while (rnum > 0);     /* all relocs */
6911 +       /* If trampoline(s) were generated, we need to do an update of the
6912 +        * trampoline copy of the packet since a 2nd phase relo will be done
6913 +        * later.  */
6914 +       if (*tramps_generated == true) {
6915 +               dload_tramp_pkt_udpate(dlthis,
6916 +                               (dlthis->image_secn - dlthis->ldr_sections),
6917 +                               dlthis->image_offset, ipacket);
6918 +       }
6919 +
6920         return 1;
6921  }                              /* dload_read_reloc */
6922  
6923 @@ -1097,7 +1126,7 @@ static void dload_data(struct dload_stat
6924         struct doff_scnhdr_t *sptr = dlthis->sect_hdrs;
6925         struct LDR_SECTION_INFO *lptr = dlthis->ldr_sections;
6926  #ifdef OPT_ZERO_COPY_LOADER
6927 -       boolean bZeroCopy = false;
6928 +       bool bZeroCopy = false;
6929  #endif
6930         u8 *pDest;
6931  
6932 @@ -1107,7 +1136,7 @@ static void dload_data(struct dload_stat
6933         } ibuf;
6934  
6935         /* Indicates whether CINIT processing has occurred */
6936 -       boolean cinit_processed = false;
6937 +       bool cinit_processed = false;
6938  
6939         /* Loop through the sections and load them one at a time.
6940          */
6941 @@ -1132,6 +1161,8 @@ static void dload_data(struct dload_stat
6942  
6943                                 s32 ipsize;
6944                                 u32 checks;
6945 +                               bool  tramp_generated = false;
6946 +
6947                                 /* get the fixed header bits */
6948                                 if (dlthis->strm->read_buffer(dlthis->strm,
6949                                     &ibuf.ipacket, IPH_SIZE) != IPH_SIZE) {
6950 @@ -1203,33 +1234,44 @@ static void dload_data(struct dload_stat
6951                                 if (ibuf.ipacket.i_num_relocs) {
6952                                         dlthis->image_offset = image_offset;
6953                                         if (!relocate_packet(dlthis,
6954 -                                           &ibuf.ipacket, &checks))
6955 +                                           &ibuf.ipacket, &checks,
6956 +                                           &tramp_generated))
6957                                                 return; /* serious error */
6958                                 }
6959                                 if (~checks)
6960                                         DL_ERROR(E_CHECKSUM, IMAGEPAK);
6961 -                               /* stuff the result into target memory */
6962 -                               if (DLOAD_SECT_TYPE(sptr) == DLOAD_CINIT) {
6963 -                                       cload_cinit(dlthis, &ibuf.ipacket);
6964 -                                       cinit_processed = true;
6965 -                               } else {
6966 +                               /* Only write the result to the target if no
6967 +                                 * trampoline was generated.  Otherwise it
6968 +                                 *will be done during trampoline finalize.  */
6969 +
6970 +                               if (tramp_generated == false) {
6971 +
6972 +                                       /* stuff the result into target
6973 +                                        * memory */
6974 +                                       if (DLOAD_SECT_TYPE(sptr) ==
6975 +                                           DLOAD_CINIT) {
6976 +                                               cload_cinit(dlthis,
6977 +                                                       &ibuf.ipacket);
6978 +                                               cinit_processed = true;
6979 +                                       } else {
6980  #ifdef OPT_ZERO_COPY_LOADER
6981 -                                   if (!bZeroCopy) {
6982 +                                               if (!bZeroCopy) {
6983  #endif
6984 -
6985 -                                       if (!dlthis->myio->writemem
6986 -                                          (dlthis->myio, ibuf.bufr,
6987 -                                          lptr->load_addr + image_offset, lptr,
6988 -                                          BYTE_TO_HOST
6989 -                                          (ibuf.ipacket.i_packet_size))) {
6990 -                                               DL_ERROR(
6991 -                                               "Write to " FMT_UI32 " failed",
6992 -                                               lptr->load_addr + image_offset);
6993 -                                       }
6994 +                                               if (!dlthis->myio->writemem
6995 +                                               (dlthis->myio, ibuf.bufr,
6996 +                                               lptr->load_addr + image_offset,
6997 +                                               lptr, BYTE_TO_HOST
6998 +                                               (ibuf.ipacket.i_packet_size))) {
6999 +                                                       DL_ERROR(
7000 +                                                       "Write to " FMT_UI32
7001 +                                                       " failed",
7002 +                                                       lptr->load_addr +
7003 +                                                       image_offset);
7004 +                                               }
7005  #ifdef OPT_ZERO_COPY_LOADER
7006 -                               }
7007 +                                       }
7008  #endif
7009 -
7010 +                                       }
7011                                 }
7012                                 image_offset +=
7013                                       BYTE_TO_TADDR(ibuf.ipacket.i_packet_size);
7014 @@ -1281,6 +1323,12 @@ loop_cont:
7015                 sptr += 1;
7016                 lptr += 1;
7017         }                       /* load sections */
7018 +
7019 +       /*  Finalize any trampolines that were created during the load  */
7020 +       if (dload_tramp_finalize(dlthis) == 0) {
7021 +               DL_ERROR("Finalization of auto-trampolines (size = " FMT_UI32
7022 +                       ") failed", dlthis->tramp.tramp_sect_next_addr);
7023 +    }
7024  }                              /* dload_data */
7025  
7026  /*************************************************************************
7027 @@ -1475,10 +1523,6 @@ static char *copy_tgt_strings(void *dstp
7028  #if TARGET_AU_BITS <= BITS_PER_AU
7029                 /* byte-swapping issues may exist for strings on target */
7030                 *dst++ = *src++;
7031 -#elif TARGET_ENDIANNESS_DIFFERS(TARGET_BIG_ENDIAN)
7032 -               register TgtAU_t tmp;
7033 -               tmp = *src++;
7034 -               *dst++ = SWAP16BY8(tmp);  /* right for TARGET_AU_BITS == 16 */
7035  #else
7036                 *dst++ = *src++;
7037  #endif
7038 @@ -1486,8 +1530,6 @@ static char *copy_tgt_strings(void *dstp
7039         /*apply force to make sure that the string table has null terminator */
7040  #if (BITS_PER_AU == BITS_PER_BYTE) && (TARGET_AU_BITS == BITS_PER_BYTE)
7041         dst[-1] = 0;
7042 -#elif TARGET_BIG_ENDIAN
7043 -       dst[-1] &= ~BYTE_MASK;  /*  big-endian */
7044  #else
7045         dst[-1] &= (1 << (BITS_PER_AU - BITS_PER_BYTE)) - 1; /* little endian */
7046  #endif
7047 @@ -1532,6 +1574,16 @@ static void init_module_handle(struct dl
7048         hndl = dlthis->myhandle;
7049         if (!hndl)
7050                 return;         /* must be errors detected, so forget it */
7051 +
7052 +       /*  Store the section count  */
7053 +       hndl->secn_count = dlthis->allocated_secn_count;
7054 +
7055 +       /*  If a trampoline section was created, add it in  */
7056 +       if (dlthis->tramp.tramp_sect_next_addr != 0)
7057 +               hndl->secn_count += 1;
7058 +
7059 +       hndl->secn_count = hndl->secn_count << 1;
7060 +
7061         hndl->secn_count = dlthis->allocated_secn_count << 1;
7062  #ifndef TARGET_ENDIANNESS
7063         if (dlthis->big_e_target)
7064 @@ -1609,10 +1661,30 @@ static void init_module_handle(struct dl
7065                 dbsec += 1;
7066                 asecs += 1;
7067         }
7068 +
7069 +       /*  If a trampoline section was created go ahead and add its info  */
7070 +       if (dlthis->tramp.tramp_sect_next_addr != 0) {
7071 +               dbmod->num_sects++;
7072 +               dbsec->sect_load_adr = asecs->load_addr;
7073 +               dbsec->sect_run_adr = asecs->run_addr;
7074 +               dbsec++;
7075 +               asecs++;
7076 +       }
7077 +
7078         /* now cram in the names */
7079         cp = copy_tgt_strings(dbsec, dlthis->str_head,
7080                               dlthis->debug_string_size);
7081  
7082 +
7083 +       /* If a trampoline section was created, add its name so DLLView
7084 +        * can show the user the section info.  */
7085 +       if (dlthis->tramp.tramp_sect_next_addr != 0) {
7086 +               cp = copy_tgt_strings(cp,
7087 +                       dlthis->tramp.final_string_table,
7088 +                       strlen(dlthis->tramp.final_string_table) + 1);
7089 +       }
7090 +
7091 +
7092         /* round off the size of the debug record, and remember same */
7093         hndl->dm.dbsiz = HOST_TO_TDATA_ROUND(cp - (char *)dbmod);
7094         *cp = 0;                /* strictly to make our test harness happy */
7095 @@ -1719,7 +1791,9 @@ int Dynamic_Unload_Module(DLOAD_mhandle 
7096         if (!syms)
7097                 return 1;
7098         syms->Purge_Symbol_Table(syms, (unsigned) hndl);
7099 -        /* Deallocate target memory for sections */
7100 +        /* Deallocate target memory for sections
7101 +         * NOTE: The trampoline section, if created, gets deleted here, too */
7102 +
7103         asecs = hndl->secns;
7104         if (alloc)
7105                 for (curr_sect = (hndl->secn_count >> 1); curr_sect > 0;
7106 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/dlclasses_hdr.h kernel-power-2.6.28/drivers/dsp/bridge/dynload/dlclasses_hdr.h
7107 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/dlclasses_hdr.h 2011-04-17 17:32:26.000000000 +0100
7108 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/dlclasses_hdr.h      1970-01-01 01:00:00.000000000 +0100
7109 @@ -1,41 +0,0 @@
7110 -/*
7111 - * dlclasses_hdr.h
7112 - *
7113 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
7114 - *
7115 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
7116 - *
7117 - * This package is free software; you can redistribute it and/or modify
7118 - * it under the terms of the GNU General Public License version 2 as
7119 - * published by the Free Software Foundation.
7120 - *
7121 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
7122 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
7123 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7124 - */
7125 -
7126 -
7127 -
7128 -#ifndef _DLCLASSES_HDR_H
7129 -#define _DLCLASSES_HDR_H
7130 -
7131 -/*****************************************************************************
7132 - *****************************************************************************
7133 - *
7134 - *                          DLCLASSES_HDR.H
7135 - *
7136 - * Sample classes in support of the dynamic loader
7137 - *
7138 - * These are just concrete derivations of the virtual ones in dynamic_loader.h
7139 - * with a few additional interfaces for init, etc.
7140 - *****************************************************************************
7141 - *****************************************************************************/
7142 -
7143 -#include <dspbridge/dynamic_loader.h>
7144 -
7145 -#include "DLstream.h"
7146 -#include "DLsymtab.h"
7147 -#include "DLalloc.h"
7148 -#include "DLinit.h"
7149 -
7150 -#endif                         /* _DLCLASSES_HDR_H */
7151 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/dload_internal.h kernel-power-2.6.28/drivers/dsp/bridge/dynload/dload_internal.h
7152 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/dload_internal.h        2011-04-17 17:32:26.000000000 +0100
7153 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/dload_internal.h     2011-05-02 22:36:49.000000000 +0100
7154 @@ -14,8 +14,6 @@
7155   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7156   */
7157  
7158 -
7159 -
7160  #ifndef __DLOAD_INTERNAL__
7161  #define __DLOAD_INTERNAL__
7162  
7163 @@ -120,7 +118,103 @@ struct Local_Symbol {
7164         s32 delta;      /* Original value in input file */
7165         s16 secnn;              /* section number */
7166         s16 sclass;             /* symbol class */
7167 -} ;
7168 +};
7169 +
7170 +
7171 +/*
7172 + * Trampoline data structures
7173 + */
7174 +#define TRAMP_NO_GEN_AVAIL              65535
7175 +#define TRAMP_SYM_PREFIX                "__$dbTR__"
7176 +#define TRAMP_SECT_NAME                 ".dbTR"
7177 +#define TRAMP_SYM_PREFIX_LEN            9  /*  MUST MATCH THE LENGTH ABOVE!! */
7178 +#define TRAMP_SYM_HEX_ASCII_LEN         9  /*  Includes NULL termination  */
7179 +
7180 +#define GET_CONTAINER(ptr, type, field) ((type *)((unsigned long)ptr -\
7181 +                               (unsigned long)(&((type *)0)->field)))
7182 +#ifndef FIELD_OFFSET
7183 +#define FIELD_OFFSET(type, field)       ((unsigned long)(&((type *)0)->field))
7184 +#endif
7185 +
7186 +
7187 +/*
7188 +    The trampoline code for the target is located in a table called
7189 +    "tramp_gen_info" with is indexed by looking up the index in the table
7190 +    "tramp_map".  The tramp_map index is acquired using the target
7191 +    HASH_FUNC on the relocation type that caused the trampoline.  Each
7192 +    trampoline code table entry MUST follow this format:
7193 +
7194 +    |----------------------------------------------|
7195 +    |  tramp_gen_code_hdr                          |
7196 +    |----------------------------------------------|
7197 +    |  Trampoline image code                       |
7198 +    |  (the raw instruction code for the target)   |
7199 +    |----------------------------------------------|
7200 +    |  Relocation entries for the image code       |
7201 +    |----------------------------------------------|
7202 +
7203 +    This is very similar to how image data is laid out in the DOFF file
7204 +    itself.
7205 +*/
7206 +struct tramp_gen_code_hdr {
7207 +       u32             tramp_code_size;    /*  in BYTES  */
7208 +       u32             num_relos;
7209 +       u32             relo_offset;   /*  in BYTES  */
7210 +};
7211 +
7212 +struct tramp_img_pkt {
7213 +       struct tramp_img_pkt    *next;    /*  MUST BE FIRST  */
7214 +       u32             base;
7215 +       struct tramp_gen_code_hdr       hdr;
7216 +       u8              payload[VARIABLE_SIZE];
7217 +};
7218 +
7219 +struct tramp_img_dup_relo {
7220 +       struct tramp_img_dup_relo       *next;
7221 +       struct reloc_record_t   relo;
7222 +};
7223 +
7224 +struct tramp_img_dup_pkt {
7225 +       struct tramp_img_dup_pkt  *next;    /*  MUST BE FIRST  */
7226 +       s16             secnn;
7227 +       u32             offset;
7228 +       struct image_packet_t                img_pkt;
7229 +       struct tramp_img_dup_relo            *relo_chain;
7230 +
7231 +       /*  PAYLOAD OF IMG PKT FOLLOWS  */
7232 +};
7233 +
7234 +struct tramp_sym {
7235 +       struct tramp_sym        *next;    /*  MUST BE FIRST  */
7236 +       u32             index;
7237 +       u32             str_index;
7238 +       struct Local_Symbol sym_info;
7239 +};
7240 +
7241 +struct tramp_string {
7242 +       struct tramp_string     *next;    /*  MUST BE FIRST  */
7243 +       u32     index;
7244 +       char    str[VARIABLE_SIZE];    /*  NULL terminated  */
7245 +};
7246 +
7247 +struct tramp_info {
7248 +       u32             tramp_sect_next_addr;
7249 +       struct LDR_SECTION_INFO sect_info;
7250 +
7251 +       struct tramp_sym                *symbol_head;
7252 +       struct tramp_sym                *symbol_tail;
7253 +       u32             tramp_sym_next_index;
7254 +       struct  Local_Symbol            *final_sym_table;
7255 +
7256 +       struct tramp_string                *string_head;
7257 +       struct tramp_string                *string_tail;
7258 +       u32             tramp_string_next_index;
7259 +       u32             tramp_string_size;
7260 +       char            *final_string_table;
7261 +
7262 +       struct tramp_img_pkt            *tramp_pkts;
7263 +       struct tramp_img_dup_pkt        *dup_pkts;
7264 +};
7265  
7266  /*
7267   * States of the .cinit state machine
7268 @@ -187,6 +281,8 @@ struct dload_state {
7269         struct doff_filehdr_t dfile_hdr;        /* DOFF file header structure */
7270         struct doff_verify_rec_t verify;        /* Verify record */
7271  
7272 +       struct tramp_info tramp;        /* Trampoline data, if needed  */
7273 +
7274         int relstkidx;          /* index into relocation value stack */
7275         /* relocation value stack used in relexp.c */
7276         RVALUE relstk[STATIC_EXPR_STK_SIZE];
7277 @@ -206,7 +302,7 @@ extern void dload_error(struct dload_sta
7278  extern void dload_syms_error(struct Dynamic_Loader_Sym *syms,
7279                              const char *errtxt, ...);
7280  extern void dload_headers(struct dload_state *dlthis);
7281 -extern void dload_strings(struct dload_state *dlthis, boolean sec_names_only);
7282 +extern void dload_strings(struct dload_state *dlthis, bool sec_names_only);
7283  extern void dload_sections(struct dload_state *dlthis);
7284  extern void dload_reorder(void *data, int dsiz, u32 map);
7285  extern u32 dload_checksum(void *data, unsigned siz);
7286 @@ -226,7 +322,8 @@ extern uint32_t dload_reverse_checksum_1
7287   * exported by reloc.c
7288   */
7289  extern void dload_relocate(struct dload_state *dlthis, TgtAU_t *data,
7290 -                          struct reloc_record_t *rp);
7291 +                       struct reloc_record_t *rp, bool *tramps_generated,
7292 +                       bool second_pass);
7293  
7294  extern RVALUE dload_unpack(struct dload_state *dlthis, TgtAU_t *data,
7295                            int fieldsz, int offset, unsigned sgn);
7296 @@ -234,4 +331,24 @@ extern RVALUE dload_unpack(struct dload_
7297  extern int dload_repack(struct dload_state *dlthis, RVALUE val, TgtAU_t *data,
7298                         int fieldsz, int offset, unsigned sgn);
7299  
7300 +
7301 +/*
7302 + * exported by tramp.c
7303 + */
7304 +extern bool dload_tramp_avail(struct dload_state *dlthis,
7305 +                       struct reloc_record_t *rp);
7306 +
7307 +int dload_tramp_generate(struct dload_state *dlthis, s16 secnn,
7308 +                       u32 image_offset, struct image_packet_t *ipacket,
7309 +                       struct reloc_record_t *rp);
7310 +
7311 +extern int dload_tramp_pkt_udpate(struct dload_state *dlthis,
7312 +                       s16 secnn, u32 image_offset,
7313 +                       struct image_packet_t *ipacket);
7314 +
7315 +extern int dload_tramp_finalize(struct dload_state *dlthis);
7316 +
7317 +extern void dload_tramp_cleanup(struct dload_state *dlthis);
7318 +
7319 +
7320  #endif                         /* __DLOAD_INTERNAL__ */
7321 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/doff.h kernel-power-2.6.28/drivers/dsp/bridge/dynload/doff.h
7322 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/doff.h  2011-04-17 17:32:26.000000000 +0100
7323 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/doff.h       2011-05-02 22:36:49.000000000 +0100
7324 @@ -3,6 +3,13 @@
7325   *
7326   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
7327   *
7328 + * Structures & definitions used for dynamically loaded modules file format.
7329 + * This format is a reformatted version of COFF. It optimizes the layout for
7330 + * the dynamic loader.
7331 + *
7332 + * .dof files, when viewed as a sequence of 32-bit integers, look the same
7333 + * on big-endian and little-endian machines.
7334 + *
7335   * Copyright (C) 2005-2006 Texas Instruments, Inc.
7336   *
7337   * This package is free software; you can redistribute it and/or modify
7338 @@ -14,16 +21,6 @@
7339   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7340   */
7341  
7342 -
7343 -/*****************************************************************************/
7344 -/*  DOFF.H - Structures & definitions used for dynamically                   */
7345 -/*           loaded modules file format.  This format is a reformatted       */
7346 -/*           version of COFF.(see coff.h for details)  It optimizes the      */
7347 -/*           layout for the dynamic loader.                                  */
7348 -/*                                                                           */
7349 -/*  .dof files, when viewed as a sequence of 32-bit integers, look the same  */
7350 -/*  on big-endian and little-endian machines.                                */
7351 -/*****************************************************************************/
7352  #ifndef _DOFF_H
7353  #define _DOFF_H
7354  
7355 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/getsection.c kernel-power-2.6.28/drivers/dsp/bridge/dynload/getsection.c
7356 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/getsection.c    2011-04-17 17:32:26.000000000 +0100
7357 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/getsection.c 2011-05-02 22:36:49.000000000 +0100
7358 @@ -14,8 +14,6 @@
7359   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7360   */
7361  
7362 -
7363 -
7364  #include <dspbridge/getsection.h>
7365  #include "header.h"
7366  
7367 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/header.h kernel-power-2.6.28/drivers/dsp/bridge/dynload/header.h
7368 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/header.h        2011-04-17 17:32:26.000000000 +0100
7369 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/header.h     2011-05-02 22:36:49.000000000 +0100
7370 @@ -14,8 +14,6 @@
7371   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7372   */
7373  
7374 -
7375 -
7376  #define TRUE 1
7377  #define FALSE 0
7378  #ifndef NULL
7379 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/module_list.h kernel-power-2.6.28/drivers/dsp/bridge/dynload/module_list.h
7380 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/module_list.h   2011-04-17 17:32:26.000000000 +0100
7381 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/module_list.h        2011-05-02 22:36:49.000000000 +0100
7382 @@ -14,50 +14,44 @@
7383   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7384   */
7385  
7386 -/*============================================================================
7387 - Filename:     module_list.h
7388 -
7389 - Copyright (C) 2002 Texas Instruments Incorporated
7390 -
7391 -
7392 - This C header file gives the layout of the data structure created by the
7393 - dynamic loader to describe the set of modules loaded into the DSP.
7394 -
7395 - Linked List Structure:
7396 - ----------------------
7397 - The data structure defined here is a singly-linked list.  The list
7398 - represents the set of modules which are currently loaded in the DSP memory.
7399 - The first entry in the list is a header record which contains a flag
7400 - representing the state of the list.  The rest of the entries in the list
7401 - are module records.
7402 -
7403 - Global symbol  _DLModules designates the first record in the list (i.e. the
7404 - header record).  This symbol must be defined in any program that wishes to
7405 - use DLLview plug-in.
7406 -
7407 - String Representation:
7408 - ----------------------
7409 - The string names of the module and its sections are stored in a block of
7410 - memory which follows the module record itself.  The strings are ordered:
7411 - module name first, followed by section names in order from the first
7412 - section to the last.  String names are tightly packed arrays of 8-bit
7413 - characters (two characters per 16-bit word on the C55x).  Strings are
7414 - zero-byte-terminated.
7415 -
7416 - Creating and updating the list:
7417 --------------------------------
7418 - Upon loading a new module into the DSP memory the dynamic loader inserts a
7419 -new module record as the first module record in the list.  The fields of
7420 - this module record are initialized to reflect the properties of the module.
7421 - The dynamic loader does NOT increment the flag/counter in the list's header
7422 - record.
7423 -
7424 - Upon unloading a module from the DSP memory the dynamic loader removes the
7425 -module's record from this list.  The dynamic loader also increments the
7426 - flag/counter in the list's header record to indicate that the list has been
7427 - changed.
7428 -
7429 -============================================================================*/
7430 +/*
7431 + * This C header file gives the layout of the data structure created by the
7432 + * dynamic loader to describe the set of modules loaded into the DSP.
7433 + *
7434 + * Linked List Structure:
7435 + * ----------------------
7436 + * The data structure defined here is a singly-linked list.  The list
7437 + * represents the set of modules which are currently loaded in the DSP memory.
7438 + * The first entry in the list is a header record which contains a flag
7439 + * representing the state of the list.  The rest of the entries in the list
7440 + * are module records.
7441 + *
7442 + * Global symbol  _DLModules designates the first record in the list (i.e. the
7443 + * header record).  This symbol must be defined in any program that wishes to
7444 + * use DLLview plug-in.
7445 + *
7446 + * String Representation:
7447 + * ----------------------
7448 + * The string names of the module and its sections are stored in a block of
7449 + * memory which follows the module record itself.  The strings are ordered:
7450 + * module name first, followed by section names in order from the first
7451 + * section to the last.  String names are tightly packed arrays of 8-bit
7452 + * characters (two characters per 16-bit word on the C55x).  Strings are
7453 + * zero-byte-terminated.
7454 + *
7455 + * Creating and updating the list:
7456 + * -------------------------------
7457 + * Upon loading a new module into the DSP memory the dynamic loader inserts a
7458 + * new module record as the first module record in the list.  The fields of
7459 + * this module record are initialized to reflect the properties of the module.
7460 + * The dynamic loader does NOT increment the flag/counter in the list's header
7461 + * record.
7462 + *
7463 + * Upon unloading a module from the DSP memory the dynamic loader removes the
7464 + * module's record from this list.  The dynamic loader also increments the
7465 + * flag/counter in the list's header record to indicate that the list has been
7466 + * changed.
7467 + */
7468  
7469  #ifndef _MODULE_LIST_H_
7470  #define _MODULE_LIST_H_
7471 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/params.h kernel-power-2.6.28/drivers/dsp/bridge/dynload/params.h
7472 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/params.h        2011-04-17 17:32:26.000000000 +0100
7473 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/params.h     2011-05-02 22:36:49.000000000 +0100
7474 @@ -3,6 +3,15 @@
7475   *
7476   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
7477   *
7478 + * This file defines host and target properties for all machines
7479 + * supported by the dynamic loader.  To be tedious...
7480 + *
7481 + * host: the machine on which the dynamic loader runs
7482 + * target: the machine that the dynamic loader is loading
7483 + *
7484 + * Host and target may or may not be the same, depending upon the particular
7485 + * use.
7486 + *
7487   * Copyright (C) 2005-2006 Texas Instruments, Inc.
7488   *
7489   * This package is free software; you can redistribute it and/or modify
7490 @@ -14,26 +23,9 @@
7491   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7492   */
7493  
7494 -
7495 -
7496 -/******************************************************************************
7497 - *
7498 - * This file defines host and target properties for all machines
7499 - * supported by the dynamic loader.  To be tedious...
7500 - *
7501 - *             host == the machine on which the dynamic loader runs
7502 - *             target == the machine that the dynamic loader is loading
7503 - *
7504 - * Host and target may or may not be the same, depending upon the particular
7505 - * use.
7506 - *****************************************************************************/
7507 -
7508 -/******************************************************************************
7509 - *
7510 - *                                                     Host Properties
7511 - *
7512 - *****************************************************************************/
7513 -
7514 +/*
7515 + * Host Properties
7516 + */
7517  #define BITS_PER_BYTE 8                /* bits in the standard PC/SUN byte */
7518  #define LOG_BITS_PER_BYTE 3    /* log base 2 of same */
7519  #define BYTE_MASK ((1U<<BITS_PER_BYTE)-1)
7520 @@ -57,12 +49,9 @@
7521  
7522  /* !! don't be tempted to insert type definitions here; use <stdint.h> !! */
7523  
7524 -/******************************************************************************
7525 - *
7526 - *                                                     Target Properties
7527 - *
7528 - *****************************************************************************/
7529 -
7530 +/*
7531 + * Target Properties
7532 + */
7533  
7534  /*--------------------------------------------------------------------------*/
7535  /* TMS320C6x Target Specific Parameters (byte-addressable)                  */
7536 @@ -122,9 +111,7 @@
7537  #endif
7538  
7539  /*
7540 - *
7541   * Useful properties and conversions derived from the above
7542 - *
7543   */
7544  
7545  /*
7546 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/reloc.c kernel-power-2.6.28/drivers/dsp/bridge/dynload/reloc.c
7547 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/reloc.c 2011-04-17 17:32:26.000000000 +0100
7548 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/reloc.c      2011-05-02 22:36:49.000000000 +0100
7549 @@ -163,10 +163,10 @@ static const u8 C60_Scale[SCALE_MASK+1] 
7550   *     Performs the specified relocation operation
7551   **************************************************************************/
7552  void dload_relocate(struct dload_state *dlthis, TgtAU_t *data,
7553 -                   struct reloc_record_t *rp)
7554 +                       struct reloc_record_t *rp, bool *tramps_genereted,
7555 +                       bool second_pass)
7556  {
7557 -       RVALUE val = 0;
7558 -       RVALUE reloc_amt = 0;
7559 +       RVALUE val, reloc_amt, orig_val = 0;
7560         unsigned int fieldsz = 0;
7561         unsigned int offset = 0;
7562         unsigned int reloc_info = 0;
7563 @@ -178,26 +178,39 @@ void dload_relocate(struct dload_state *
7564  #ifdef RFV_SCALE
7565         unsigned int scale = 0;
7566  #endif
7567 +       struct image_packet_t *img_pkt = NULL;
7568 +
7569 +       /* The image packet data struct is only used during first pass
7570 +         * relocation in the event that a trampoline is needed.  2nd pass
7571 +         * relocation doesn't guarantee that data is coming from an
7572 +         * image_packet_t structure. See cload.c, dload_data for how i_bits is
7573 +         * set. If that changes this needs to be updated!!!  */
7574 +       if (second_pass == false)
7575 +               img_pkt = (struct image_packet_t *)((u8 *)data -
7576 +                               sizeof(struct image_packet_t));
7577 +
7578  
7579         rx = HASH_FUNC(rp->r_type);
7580         while (rop_map1[rx] != rp->r_type) {
7581                 rx = HASH_L(rop_map2[rx]);
7582                 if (rx < 0) {
7583  #if TMS32060
7584 -               switch (rp->r_type) {
7585 -               case R_C60ALIGN:
7586 -               case R_C60NOCMP:
7587 -               case R_C60FPHEAD:
7588 -                   /* Ignore these reloc types and return */
7589 -                   break;
7590 -               default:
7591 -                   /* Unknown reloc type, print error and return */
7592 -                   dload_error(dlthis, "Bad coff operator 0x%x", rp->r_type);
7593 -           }
7594 +                       switch (rp->r_type) {
7595 +                       case R_C60ALIGN:
7596 +                       case R_C60NOCMP:
7597 +                       case R_C60FPHEAD:
7598 +                               /* Ignore these reloc types and return */
7599 +                               break;
7600 +                       default:
7601 +                               /* Unknown reloc type, print error and return */
7602 +                               dload_error(dlthis, "Bad coff operator 0x%x",
7603 +                                               rp->r_type);
7604 +                       }
7605  #else
7606 -           dload_error(dlthis, "Bad coff operator 0x%x", rp->r_type);
7607 +                       dload_error(dlthis, "Bad coff operator 0x%x",
7608 +                                       rp->r_type);
7609  #endif
7610 -           return;
7611 +                       return;
7612                 }
7613         }
7614         rx = HASH_I(rop_map2[rx]);
7615 @@ -205,22 +218,29 @@ void dload_relocate(struct dload_state *
7616            && (rx < (sizeof(rop_info)/sizeof(uint_least16_t))) && (rx > 0)) {
7617                 reloc_action = rop_action[rx]; reloc_info = rop_info[rx];
7618         } else {
7619 -           dload_error(dlthis, "Buffer Overflow - Array Index Out of Bounds");
7620 +               dload_error(dlthis, "Buffer Overflow - Array Index Out "
7621 +                               "of Bounds");
7622         }
7623  
7624         /* Compute the relocation amount for the referenced symbol, if any */
7625         reloc_amt = rp->r_uval;
7626         if (RFV_SYM(reloc_info)) {      /* relocation uses a symbol reference */
7627 -               if ((u32)rp->r_symndx < dlthis->dfile_hdr.df_no_syms) {
7628 -                       /* real symbol reference */
7629 -                       svp = &dlthis->local_symtab[rp->r_symndx];
7630 -                       reloc_amt = (RFV_SYM(reloc_info) == ROP_SYMD) ?
7631 -                                   svp->delta : svp->value;
7632 +               /* If this is first pass, use the module local symbol table,
7633 +                 * else use the trampoline symbol table.  */
7634 +              if (second_pass == false) {
7635 +                       if ((u32)rp->r_symndx < dlthis->dfile_hdr.df_no_syms) {
7636 +                               /* real symbol reference */
7637 +                               svp = &dlthis->local_symtab[rp->r_symndx];
7638 +                               reloc_amt = (RFV_SYM(reloc_info) == ROP_SYMD) ?
7639 +                                           svp->delta : svp->value;
7640 +                       }
7641 +                       /* reloc references current section */
7642 +                       else if (rp->r_symndx == -1) {
7643 +                               reloc_amt = (RFV_SYM(reloc_info) == ROP_SYMD) ?
7644 +                               dlthis->delta_runaddr :
7645 +                               dlthis->image_secn->run_addr;
7646 +                       }
7647                 }
7648 -               /* reloc references current section */
7649 -               else if (rp->r_symndx == -1)
7650 -                       reloc_amt = (RFV_SYM(reloc_info) == ROP_SYMD) ?
7651 -                         dlthis->delta_runaddr : dlthis->image_secn->run_addr;
7652         }       /* relocation uses a symbol reference */
7653         /* Handle stack adjustment */
7654         val = 0;
7655 @@ -277,6 +297,10 @@ void dload_relocate(struct dload_state *
7656         if (reloc_info & ROP_R) {    /* relocation reads current image value */
7657                 val = dload_unpack(dlthis, data, fieldsz, offset,
7658                       RFV_SIGN(reloc_info));
7659 +       /* Save off the original value in case the relo overflows and
7660 +         * we can trampoline it.  */
7661 +       orig_val = val;
7662 +
7663  #ifdef RFV_SCALE
7664                 val <<= scale;
7665  #endif
7666 @@ -414,10 +438,38 @@ void dload_relocate(struct dload_state *
7667  #endif
7668                 if (dload_repack(dlthis, val, data, fieldsz, offset,
7669                    RFV_SIGN(reloc_info))) {
7670 -                       dload_error(dlthis, "Relocation value " FMT_UI32
7671 -                           " overflows %d bits in %s offset " FMT_UI32, val,
7672 -                           fieldsz, dlthis->image_secn->name,
7673 -                           dlthis->image_offset + rp->r_vaddr);
7674 +                       /* Check to see if this relo can be trampolined,
7675 +                         * but only in first phase relocation.  2nd phase
7676 +                         * relocation cannot trampoline.  */
7677 +                       if ((second_pass == false) &&
7678 +                               (dload_tramp_avail(dlthis, rp) == true)) {
7679 +
7680 +                               /* Before generating the trampoline, restore
7681 +                                 * the value to its original so the 2nd pass
7682 +                                 *  relo will work.  */
7683 +                               dload_repack(dlthis, orig_val, data, fieldsz,
7684 +                                       offset, RFV_SIGN(reloc_info));
7685 +                               if (!dload_tramp_generate(dlthis,
7686 +                                       (dlthis->image_secn - dlthis->
7687 +                                       ldr_sections), dlthis->image_offset,
7688 +                                       img_pkt, rp)) {
7689 +                                       dload_error(dlthis, "Failed to "
7690 +                                            "generate trampoline for bit "
7691 +                                            "overflow");
7692 +                                       dload_error(dlthis, "Relocation value "
7693 +                                          FMT_UI32 " overflows %d bits in %s "
7694 +                                          "offset " FMT_UI32, val, fieldsz,
7695 +                                          dlthis->image_secn->name,
7696 +                                          dlthis->image_offset + rp->r_vaddr);
7697 +                               } else
7698 +                                       *tramps_genereted = true;
7699 +                       } else {
7700 +                               dload_error(dlthis, "Relocation value "
7701 +                                       FMT_UI32 " overflows %d bits in %s"
7702 +                                       " offset " FMT_UI32, val, fieldsz,
7703 +                                       dlthis->image_secn->name,
7704 +                                       dlthis->image_offset + rp->r_vaddr);
7705 +                       }
7706                 }
7707         } else if (top)
7708                 *stackp = val;
7709 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/reloc_table.h kernel-power-2.6.28/drivers/dsp/bridge/dynload/reloc_table.h
7710 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/reloc_table.h   2011-04-17 17:32:26.000000000 +0100
7711 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/reloc_table.h        2011-05-02 22:36:49.000000000 +0100
7712 @@ -14,8 +14,6 @@
7713   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7714   */
7715  
7716 -
7717 -
7718  #ifndef __RELOC_TABLE_H__
7719  #define __RELOC_TABLE_H__
7720  /*
7721 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/reloc_table_c6000.c kernel-power-2.6.28/drivers/dsp/bridge/dynload/reloc_table_c6000.c
7722 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/reloc_table_c6000.c     2011-04-17 17:32:26.000000000 +0100
7723 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/reloc_table_c6000.c  2011-04-17 20:03:04.000000000 +0100
7724 @@ -14,7 +14,6 @@
7725   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7726   */
7727  
7728 -
7729  /* Tables generated for c6000 */
7730  
7731  #define HASH_FUNC(zz) (((((zz) + 1) * UINT32_C(1845)) >> 11) & 63)
7732 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/tramp.c kernel-power-2.6.28/drivers/dsp/bridge/dynload/tramp.c
7733 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/tramp.c 1970-01-01 01:00:00.000000000 +0100
7734 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/tramp.c      2011-05-02 22:36:49.000000000 +0100
7735 @@ -0,0 +1,1118 @@
7736 +/*
7737 + * tramp.c
7738 + *
7739 + * DSP-BIOS Bridge driver support functions for TI OMAP processors.
7740 + *
7741 + * Copyright (C) 2009 Texas Instruments, Inc.
7742 + *
7743 + * This package is free software; you can redistribute it and/or modify
7744 + * it under the terms of the GNU General Public License version 2 as
7745 + * published by the Free Software Foundation.
7746 + *
7747 + * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
7748 + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
7749 + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7750 + */
7751 +
7752 +#include "header.h"
7753 +
7754 +#if TMS32060
7755 +#include "tramp_table_c6000.c"
7756 +#endif
7757 +
7758 +#define MAX_RELOS_PER_PASS     4
7759 +
7760 +/*
7761 + * Function:   priv_tramp_sect_tgt_alloc
7762 + * Description: Allocate target memory for the trampoline section.  The
7763 + *       target mem size is easily obtained as the next available address.
7764 + */
7765 +static int priv_tramp_sect_tgt_alloc(struct dload_state *dlthis)
7766 +{
7767 +       int ret_val = 0;
7768 +       struct LDR_SECTION_INFO *sect_info;
7769 +
7770 +       /*  Populate the trampoline loader section and allocate it on the
7771 +        * target.  The section name is ALWAYS the first string in the final
7772 +        * string table for trampolines.  The trampoline section is always
7773 +        * 1 beyond the total number of allocated sections.  */
7774 +       sect_info = &dlthis->ldr_sections[dlthis->allocated_secn_count];
7775 +
7776 +       sect_info->name = dlthis->tramp.final_string_table;
7777 +       sect_info->size = dlthis->tramp.tramp_sect_next_addr;
7778 +       sect_info->context = 0;
7779 +       sect_info->type =
7780 +               (4 << 8) | DLOAD_TEXT | DS_ALLOCATE_MASK | DS_DOWNLOAD_MASK;
7781 +       sect_info->page = 0;
7782 +       sect_info->run_addr = 0;
7783 +       sect_info->load_addr = 0;
7784 +       ret_val = dlthis->myalloc->Allocate(dlthis->myalloc,
7785 +                       sect_info, DS_ALIGNMENT(sect_info->type));
7786 +
7787 +       if (ret_val == 0)
7788 +               dload_error(dlthis, "Failed to allocate target memory for"
7789 +                                                       " trampoline");
7790 +
7791 +       return ret_val;
7792 +}
7793 +
7794 +/*
7795 + * Function:   priv_h2a
7796 + * Description: Helper function to convert a hex value to its ASCII
7797 + *       representation.  Used for trampoline symbol name generation.
7798 + */
7799 +static u8 priv_h2a(u8 value)
7800 +{
7801 +       if (value > 0xF)
7802 +               return 0xFF;
7803 +
7804 +       if (value <= 9)
7805 +               value += 0x30;
7806 +       else
7807 +               value += 0x37;
7808 +
7809 +       return value;
7810 +}
7811 +
7812 +/*
7813 + * Function:   priv_tramp_sym_gen_name
7814 + * Description: Generate a trampoline symbol name (ASCII) using the value
7815 + *       of the symbol.  This places the new name into the user buffer.
7816 + *       The name is fixed in length and of the form: __$dbTR__xxxxxxxx
7817 + *       (where "xxxxxxxx" is the hex value.
7818 + */
7819 +static void priv_tramp_sym_gen_name(u32 value, char *dst)
7820 +{
7821 +       u32 i;
7822 +       volatile char *prefix = TRAMP_SYM_PREFIX;
7823 +       volatile char *dst_local = dst;
7824 +       u8 tmp;
7825 +
7826 +       /*  Clear out the destination, including the ending NULL  */
7827 +       for (i = 0; i < (TRAMP_SYM_PREFIX_LEN + TRAMP_SYM_HEX_ASCII_LEN); i++)
7828 +               *(dst_local + i) = 0;
7829 +
7830 +       /*  Copy the prefix to start  */
7831 +       for (i = 0; i < strlen(TRAMP_SYM_PREFIX); i++) {
7832 +               *dst_local = *(prefix + i);
7833 +               dst_local++;
7834 +       }
7835 +
7836 +       /*  Now convert the value passed in to a string equiv of the hex  */
7837 +       for (i = 0; i < sizeof(value); i++) {
7838 +#ifndef _BIG_ENDIAN
7839 +               tmp = *(((u8 *)&value) + (sizeof(value) - 1) - i);
7840 +               *dst_local = priv_h2a((tmp & 0xF0) >> 4);
7841 +               dst_local++;
7842 +               *dst_local = priv_h2a(tmp & 0x0F);
7843 +               dst_local++;
7844 +#else
7845 +               tmp = *(((u8 *)&value) + i);
7846 +               *dst_local = priv_h2a((tmp & 0xF0) >> 4);
7847 +               dst_local++;
7848 +               *dst_local = priv_h2a(tmp & 0x0F);
7849 +               dst_local++;
7850 +#endif
7851 +       }
7852 +
7853 +       /*  NULL terminate  */
7854 +       *dst_local = 0;
7855 +}
7856 +
7857 +/*
7858 + * Function:   priv_tramp_string_create
7859 + * Description: Create a new string specific to the trampoline loading and add
7860 + *       it to the trampoline string list.  This list contains the
7861 + *       trampoline section name and trampoline point symbols.
7862 + */
7863 +static struct tramp_string *priv_tramp_string_create(struct dload_state *dlthis,
7864 +         u32 str_len, char *str)
7865 +{
7866 +       struct tramp_string *new_string = NULL;
7867 +       u32 i;
7868 +
7869 +       /*  Create a new string object with the specified size.  */
7870 +       new_string = (struct tramp_string *)dlthis->mysym->Allocate(
7871 +               dlthis->mysym, (sizeof(struct tramp_string) + str_len + 1));
7872 +       if (new_string != NULL) {
7873 +               /*  Clear the string first.  This ensures the ending NULL is
7874 +                * present and the optimizer won't touch it.  */
7875 +               for (i = 0; i < (sizeof(struct tramp_string) + str_len + 1);
7876 +                               i++)
7877 +                       *((u8 *)new_string + i) = 0;
7878 +
7879 +               /*  Add this string to our virtual table by assigning it the
7880 +                * next index and pushing it to the tail of the list.  */
7881 +               new_string->index = dlthis->tramp.tramp_string_next_index;
7882 +               dlthis->tramp.tramp_string_next_index++;
7883 +               dlthis->tramp.tramp_string_size += str_len + 1;
7884 +
7885 +               new_string->next = NULL;
7886 +               if (dlthis->tramp.string_head == NULL)
7887 +                       dlthis->tramp.string_head = new_string;
7888 +               else
7889 +                       dlthis->tramp.string_tail->next = new_string;
7890 +
7891 +               dlthis->tramp.string_tail = new_string;
7892 +
7893 +               /*  Copy the string over to the new object  */
7894 +               for (i = 0; i < str_len; i++)
7895 +                       new_string->str[i] = str[i];
7896 +       }
7897 +
7898 +       return new_string;
7899 +}
7900 +
7901 +/*
7902 + * Function:   priv_tramp_string_find
7903 + * Description: Walk the trampoline string list and find a match for the
7904 + *       provided string.  If not match is found, NULL is returned.
7905 + */
7906 +static struct tramp_string *priv_tramp_string_find(struct dload_state *dlthis,
7907 +                                                               char *str)
7908 +{
7909 +       struct tramp_string *cur_str = NULL;
7910 +       struct tramp_string *ret_val = NULL;
7911 +       u32 i;
7912 +       u32 str_len = strlen(str);
7913 +
7914 +       for (cur_str = dlthis->tramp.string_head;
7915 +                (ret_val == NULL) && (cur_str != NULL);
7916 +                cur_str = cur_str->next) {
7917 +               /*  If the string lengths aren't equal, don't bother
7918 +                * comparing  */
7919 +               if (str_len != strlen(cur_str->str))
7920 +                       continue;
7921 +
7922 +               /*  Walk the strings until one of them ends  */
7923 +               for (i = 0; i < str_len; i++) {
7924 +                       /*  If they don't match in the current position then
7925 +                        * break out now, no sense in continuing to look at
7926 +                        * this string.  */
7927 +                       if (str[i] != cur_str->str[i])
7928 +                               break;
7929 +               }
7930 +
7931 +               if (i == str_len)
7932 +                       ret_val = cur_str;
7933 +       }
7934 +
7935 +       return ret_val;
7936 +}
7937 +
7938 +/*
7939 + * Function:   priv_string_tbl_finalize
7940 + * Description: Flatten the trampoline string list into a table of NULL
7941 + *       terminated strings.  This is the same format of string table
7942 + *       as used by the COFF/DOFF file.
7943 + */
7944 +static int priv_string_tbl_finalize(struct dload_state *dlthis)
7945 +{
7946 +       int ret_val = 0;
7947 +       struct tramp_string *cur_string;
7948 +       char *cur_loc;
7949 +       char *tmp;
7950 +
7951 +       /*  Allocate enough space for all strings that have been created.  The
7952 +        * table is simply all strings concatenated together will NULL
7953 +        * endings.  */
7954 +       dlthis->tramp.final_string_table =
7955 +               (char *)dlthis->mysym->Allocate(dlthis->mysym,
7956 +                                       dlthis->tramp.tramp_string_size);
7957 +       if (dlthis->tramp.final_string_table != NULL) {
7958 +               /*  We got our buffer, walk the list and release the nodes as*
7959 +                * we go  */
7960 +               cur_loc = dlthis->tramp.final_string_table;
7961 +               cur_string = dlthis->tramp.string_head;
7962 +               while (cur_string != NULL) {
7963 +                       /*  Move the head/tail pointers  */
7964 +                       dlthis->tramp.string_head = cur_string->next;
7965 +                       if (dlthis->tramp.string_tail == cur_string)
7966 +                               dlthis->tramp.string_tail = NULL;
7967 +
7968 +                       /*  Copy the string contents  */
7969 +                       for (tmp = cur_string->str;
7970 +                                *tmp != '\0';
7971 +                                tmp++, cur_loc++)
7972 +                               *cur_loc = *tmp;
7973 +
7974 +                       /*  Pick up the NULL termination since it was missed by
7975 +                        * breaking using it to end the above loop.  */
7976 +                       *cur_loc = '\0';
7977 +                       cur_loc++;
7978 +
7979 +                       /*  Free the string node, we don't need it any more. */
7980 +                       dlthis->mysym->Deallocate(dlthis->mysym, cur_string);
7981 +
7982 +                       /*  Move our pointer to the next one  */
7983 +                       cur_string = dlthis->tramp.string_head;
7984 +               }
7985 +
7986 +               /*  Update our return value to success  */
7987 +               ret_val = 1;
7988 +       } else
7989 +               dload_error(dlthis, "Failed to allocate trampoline "
7990 +                                               "string table");
7991 +
7992 +       return ret_val;
7993 +}
7994 +
7995 +/*
7996 + * Function:   priv_tramp_sect_alloc
7997 + * Description: Virtually allocate space from the trampoline section.  This
7998 + *       function returns the next offset within the trampoline section
7999 + *       that is available and moved the next available offset by the
8000 + *       requested size.  NO TARGET ALLOCATION IS DONE AT THIS TIME.
8001 + */
8002 +static u32 priv_tramp_sect_alloc(struct dload_state *dlthis, u32 tramp_size)
8003 +{
8004 +       u32 ret_val;
8005 +
8006 +       /*  If the next available address is 0, this is our first allocation.
8007 +        * Create a section name string to go into the string table .  */
8008 +       if (dlthis->tramp.tramp_sect_next_addr == 0) {
8009 +               dload_syms_error(dlthis->mysym, "*** WARNING ***  created "
8010 +                       "dynamic TRAMPOLINE section for module %s",
8011 +                       dlthis->str_head);
8012 +       }
8013 +
8014 +       /*  Reserve space for the new trampoline  */
8015 +       ret_val = dlthis->tramp.tramp_sect_next_addr;
8016 +       dlthis->tramp.tramp_sect_next_addr += tramp_size;
8017 +       return ret_val;
8018 +}
8019 +
8020 +/*
8021 + * Function:   priv_tramp_sym_create
8022 + * Description: Allocate and create a new trampoline specific symbol and add
8023 + *       it to the trampoline symbol list.  These symbols will include
8024 + *       trampoline points as well as the external symbols they
8025 + *       reference.
8026 + */
8027 +static struct tramp_sym *priv_tramp_sym_create(struct dload_state *dlthis,
8028 +                       u32 str_index, struct Local_Symbol *tmp_sym)
8029 +{
8030 +       struct tramp_sym        *new_sym = NULL;
8031 +       u32 i;
8032 +
8033 +       /*  Allocate new space for the symbol in the symbol table.  */
8034 +       new_sym = (struct tramp_sym *)dlthis->mysym->Allocate(dlthis->mysym,
8035 +                                                  sizeof(struct tramp_sym));
8036 +       if (new_sym != NULL) {
8037 +               for (i = 0; i != sizeof(struct tramp_sym); i++)
8038 +                       *((char *)new_sym + i) = 0;
8039 +
8040 +               /*  Assign this symbol the next symbol index for easier
8041 +                * reference later during relocation.  */
8042 +               new_sym->index = dlthis->tramp.tramp_sym_next_index;
8043 +               dlthis->tramp.tramp_sym_next_index++;
8044 +
8045 +               /*  Populate the symbol information.  At this point any
8046 +                * trampoline symbols will be the offset location, not the
8047 +                * final.  Copy over the symbol info to start, then be sure to
8048 +                * get the string index from the trampoline string table.  */
8049 +               new_sym->sym_info = *tmp_sym;
8050 +               new_sym->str_index = str_index;
8051 +
8052 +               /*  Push the new symbol to the tail of the symbol table list  */
8053 +               new_sym->next = NULL;
8054 +               if (dlthis->tramp.symbol_head == NULL)
8055 +                       dlthis->tramp.symbol_head = new_sym;
8056 +               else
8057 +                       dlthis->tramp.symbol_tail->next = new_sym;
8058 +
8059 +               dlthis->tramp.symbol_tail = new_sym;
8060 +       }
8061 +
8062 +       return new_sym;
8063 +}
8064 +
8065 +/*
8066 + * Function:   priv_tramp_sym_get
8067 + * Description: Search for the symbol with the matching string index (from
8068 + *       the trampoline string table) and return the trampoline
8069 + *       symbol object, if found.  Otherwise return NULL.
8070 + */
8071 +static struct tramp_sym *priv_tramp_sym_get(struct dload_state *dlthis,
8072 +                                                u32 string_index)
8073 +{
8074 +       struct tramp_sym *sym_found = NULL;
8075 +
8076 +       /*  Walk the symbol table list and search vs. the string index  */
8077 +       for (sym_found = dlthis->tramp.symbol_head;
8078 +                sym_found != NULL;
8079 +                sym_found = sym_found->next) {
8080 +               if (sym_found->str_index == string_index)
8081 +                       break;
8082 +       }
8083 +
8084 +       return sym_found;
8085 +}
8086 +
8087 +/*
8088 + * Function:   priv_tramp_sym_find
8089 + * Description: Search for a trampoline symbol based on the string name of
8090 + *       the symbol.  Return the symbol object, if found, otherwise
8091 + *       return NULL.
8092 + */
8093 +static struct tramp_sym *priv_tramp_sym_find(struct dload_state *dlthis,
8094 +                                                       char *string)
8095 +{
8096 +       struct tramp_sym *sym_found = NULL;
8097 +       struct tramp_string *str_found = NULL;
8098 +
8099 +       /*  First, search for the string, then search for the sym based on the
8100 +               string index.  */
8101 +       str_found = priv_tramp_string_find(dlthis, string);
8102 +       if (str_found != NULL)
8103 +               sym_found = priv_tramp_sym_get(dlthis, str_found->index);
8104 +
8105 +       return sym_found;
8106 +}
8107 +
8108 +/*
8109 + * Function:   priv_tramp_sym_finalize
8110 + * Description: Allocate a flat symbol table for the trampoline section,
8111 + *       put each trampoline symbol into the table, adjust the
8112 + *       symbol value based on the section address on the target and
8113 + *       free the trampoline symbol list nodes.
8114 + */
8115 +static int priv_tramp_sym_finalize(struct dload_state *dlthis)
8116 +{
8117 +       int ret_val = 0;
8118 +       struct tramp_sym *cur_sym;
8119 +       struct LDR_SECTION_INFO *tramp_sect =
8120 +               &dlthis->ldr_sections[dlthis->allocated_secn_count];
8121 +       struct Local_Symbol *new_sym;
8122 +
8123 +       /*  Allocate a table to hold a flattened version of all symbols
8124 +        * created.  */
8125 +       dlthis->tramp.final_sym_table =
8126 +               (struct Local_Symbol *)dlthis->mysym->Allocate(
8127 +                       dlthis->mysym, (sizeof(struct Local_Symbol) *
8128 +                       dlthis->tramp.tramp_sym_next_index));
8129 +       if (dlthis->tramp.final_sym_table != NULL) {
8130 +               /*  Walk the list of all symbols, copy it over to the flattened
8131 +                * table. After it has been copied, the node can be freed as
8132 +                * it is no longer needed.  */
8133 +               new_sym = dlthis->tramp.final_sym_table;
8134 +               cur_sym = dlthis->tramp.symbol_head;
8135 +               while (cur_sym != NULL) {
8136 +                       /*  Pop it off the list  */
8137 +                       dlthis->tramp.symbol_head = cur_sym->next;
8138 +                       if (cur_sym == dlthis->tramp.symbol_tail)
8139 +                               dlthis->tramp.symbol_tail = NULL;
8140 +
8141 +                       /*  Copy the symbol contents into the flat table  */
8142 +                       *new_sym = cur_sym->sym_info;
8143 +
8144 +                       /*  Now finaize the symbol.  If it is in the tramp
8145 +                        * section, we need to adjust for the section start.
8146 +                        * If it is external then we don't need to adjust at
8147 +                        * all.
8148 +                        * NOTE: THIS CODE ASSUMES THAT THE TRAMPOLINE IS
8149 +                        * REFERENCED LIKE A CALL TO AN EXTERNAL SO VALUE AND
8150 +                        * DELTA ARE THE SAME.  SEE THE FUNCTION dload_symbols
8151 +                        * WHERE DN_UNDEF IS HANDLED FOR MORE REFERENCE.  */
8152 +                       if (new_sym->secnn < 0) {
8153 +                               new_sym->value += tramp_sect->load_addr;
8154 +                               new_sym->delta = new_sym->value;
8155 +                       }
8156 +
8157 +                       /*  Let go of the symbol node  */
8158 +                       dlthis->mysym->Deallocate(dlthis->mysym, cur_sym);
8159 +
8160 +                       /*  Move to the next node  */
8161 +                       cur_sym = dlthis->tramp.symbol_head;
8162 +                       new_sym++;
8163 +               }
8164 +
8165 +               ret_val = 1;
8166 +       } else
8167 +               dload_error(dlthis, "Failed to alloc trampoline sym table");
8168 +
8169 +       return ret_val;
8170 +}
8171 +
8172 +/*
8173 + * Function:   priv_tgt_img_gen
8174 + * Description: Allocate storage for and copy the target specific image data
8175 + *     and fix up its relocations for the new external symbol.  If
8176 + *     a trampoline image packet was successfully created it is added
8177 + *     to the trampoline list.
8178 + */
8179 +static int priv_tgt_img_gen(struct dload_state *dlthis, u32 base,
8180 +               u32 gen_index, struct tramp_sym *new_ext_sym)
8181 +{
8182 +       struct tramp_img_pkt *new_img_pkt = NULL;
8183 +       u32 i;
8184 +       u32 pkt_size = tramp_img_pkt_size_get();
8185 +       u8 *gen_tbl_entry;
8186 +       u8 *pkt_data;
8187 +       struct reloc_record_t *cur_relo;
8188 +       int ret_val = 0;
8189 +
8190 +       /*  Allocate a new image packet and set it up.  */
8191 +       new_img_pkt =
8192 +               (struct tramp_img_pkt *)dlthis->mysym->Allocate(dlthis->mysym,
8193 +                                                                pkt_size);
8194 +       if (new_img_pkt != NULL) {
8195 +               /*  Save the base, this is where it goes in the section  */
8196 +               new_img_pkt->base = base;
8197 +
8198 +               /*  Copy over the image data and relos from the target table */
8199 +               pkt_data = (u8 *)&new_img_pkt->hdr;
8200 +               gen_tbl_entry = (u8 *)&tramp_gen_info[gen_index];
8201 +               for (i = 0; i < pkt_size; i++) {
8202 +                       *pkt_data = *gen_tbl_entry;
8203 +                       pkt_data++;
8204 +                       gen_tbl_entry++;
8205 +               }
8206 +
8207 +               /*  Update the relocations to point to the external symbol  */
8208 +               cur_relo =
8209 +                       (struct reloc_record_t *)((u8 *)&new_img_pkt->hdr +
8210 +                                          new_img_pkt->hdr.relo_offset);
8211 +               for (i = 0; i < new_img_pkt->hdr.num_relos; i++)
8212 +                       cur_relo[i].r_symndx = new_ext_sym->index;
8213 +
8214 +               /*  Add it to the trampoline list.  */
8215 +               new_img_pkt->next = dlthis->tramp.tramp_pkts;
8216 +               dlthis->tramp.tramp_pkts = new_img_pkt;
8217 +
8218 +               ret_val = 1;
8219 +       }
8220 +
8221 +       return ret_val;
8222 +}
8223 +
8224 +/*
8225 + * Function:   priv_pkt_relo
8226 + * Description: Take the provided image data and the collection of relocations
8227 + *       for it and perform the relocations.  Note that all relocations
8228 + *       at this stage are considered SECOND PASS since the original
8229 + *       image has already been processed in the first pass.  This means
8230 + *       TRAMPOLINES ARE TREATED AS 2ND PASS even though this is really
8231 + *       the first (and only) relocation that will be performed on them.
8232 + */
8233 +static int priv_pkt_relo(struct dload_state *dlthis, TgtAU_t *data,
8234 +                        struct reloc_record_t *rp[], u32 relo_count)
8235 +{
8236 +       int ret_val = 1;
8237 +       u32 i;
8238 +       bool tmp;
8239 +
8240 +       /*  Walk through all of the relos and process them.  This function is
8241 +        * the equivalent of relocate_packet() from cload.c, but specialized
8242 +        * for trampolines and 2nd phase relocations.  */
8243 +       for (i = 0; i < relo_count; i++)
8244 +               dload_relocate(dlthis, data, rp[i], &tmp, true);
8245 +
8246 +       return ret_val;
8247 +}
8248 +
8249 +/*
8250 + * Function:   priv_tramp_pkt_finalize
8251 + * Description: Walk the list of all trampoline packets and finalize them.
8252 + *       Each trampoline image packet will be relocated now that the
8253 + *       trampoline section has been allocated on the target.  Once
8254 + *       all of the relocations are done the trampoline image data
8255 + *       is written into target memory and the trampoline packet
8256 + *       is freed: it is no longer needed after this point.
8257 + */
8258 +static int priv_tramp_pkt_finalize(struct dload_state *dlthis)
8259 +{
8260 +       int ret_val = 1;
8261 +       struct tramp_img_pkt *cur_pkt = NULL;
8262 +       struct reloc_record_t *relos[MAX_RELOS_PER_PASS];
8263 +       u32 relos_done;
8264 +       u32 i;
8265 +       struct reloc_record_t *cur_relo;
8266 +       struct LDR_SECTION_INFO *sect_info =
8267 +               &dlthis->ldr_sections[dlthis->allocated_secn_count];
8268 +
8269 +       /*  Walk the list of trampoline packets and relocate each packet.  This
8270 +        * function is the trampoline equivalent of dload_data() from
8271 +        * cload.c.  */
8272 +       cur_pkt = dlthis->tramp.tramp_pkts;
8273 +       while ((ret_val != 0) && (cur_pkt != NULL)) {
8274 +               /*  Remove the pkt from the list  */
8275 +               dlthis->tramp.tramp_pkts = cur_pkt->next;
8276 +
8277 +               /*  Setup section and image offset information for the relo  */
8278 +               dlthis->image_secn = sect_info;
8279 +               dlthis->image_offset = cur_pkt->base;
8280 +               dlthis->delta_runaddr = sect_info->run_addr;
8281 +
8282 +               /*  Walk through all relos for the packet  */
8283 +               relos_done = 0;
8284 +               cur_relo = (struct reloc_record_t *)((u8 *)&cur_pkt->hdr +
8285 +                                                 cur_pkt->hdr.relo_offset);
8286 +               while (relos_done < cur_pkt->hdr.num_relos) {
8287 +#ifdef ENABLE_TRAMP_DEBUG
8288 +                       dload_syms_error(dlthis->mysym,
8289 +                                "===> Trampoline %x branches to %x",
8290 +                                sect_info->run_addr + dlthis->image_offset,
8291 +                                dlthis->tramp.
8292 +                                final_sym_table[cur_relo->r_symndx].value);
8293 +#endif
8294 +
8295 +                       for (i = 0;
8296 +                                ((i < MAX_RELOS_PER_PASS) &&
8297 +                                 ((i + relos_done) < cur_pkt->hdr.num_relos));
8298 +                                i++)
8299 +                               relos[i] = cur_relo + i;
8300 +
8301 +                       /*  Do the actual relo  */
8302 +                       ret_val = priv_pkt_relo(dlthis,
8303 +                                               (TgtAU_t *)&cur_pkt->payload,
8304 +                                               relos, i);
8305 +                       if (ret_val == 0) {
8306 +                               dload_error(dlthis,
8307 +                               "Relocation of trampoline pkt at %x failed",
8308 +                               cur_pkt->base + sect_info->run_addr);
8309 +                               break;
8310 +                       }
8311 +
8312 +                       relos_done += i;
8313 +                       cur_relo += i;
8314 +               }
8315 +
8316 +               /*  Make sure we didn't hit a problem  */
8317 +               if (ret_val != 0) {
8318 +                       /*  Relos are done for the packet, write it to the
8319 +                        * target  */
8320 +                       ret_val = dlthis->myio->writemem(dlthis->myio,
8321 +                                          &cur_pkt->payload,
8322 +                                          sect_info->load_addr + cur_pkt->base
8323 +                                          , sect_info, BYTE_TO_HOST(
8324 +                                          cur_pkt->hdr.tramp_code_size));
8325 +                       if (ret_val == 0) {
8326 +                               dload_error(dlthis,
8327 +                                       "Write to " FMT_UI32 " failed",
8328 +                                       sect_info->load_addr + cur_pkt->base);
8329 +                       }
8330 +
8331 +                       /*  Done with the pkt, let it go  */
8332 +                       dlthis->mysym->Deallocate(dlthis->mysym, cur_pkt);
8333 +
8334 +                       /*  Get the next packet to process  */
8335 +                       cur_pkt = dlthis->tramp.tramp_pkts;
8336 +               }
8337 +       }
8338 +
8339 +       return ret_val;
8340 +}
8341 +
8342 +/*
8343 + * Function:   priv_dup_pkt_finalize
8344 + * Description: Walk the list of duplicate image packets and finalize them.
8345 + *       Each duplicate packet will be relocated again for the
8346 + *       relocations that previously failed and have been adjusted
8347 + *       to point at a trampoline.  Once all relocations for a packet
8348 + *       have been done, write the packet into target memory.  The
8349 + *       duplicate packet and its relocation chain are all freed
8350 + *       after use here as they are no longer needed after this.
8351 + */
8352 +static int priv_dup_pkt_finalize(struct dload_state *dlthis)
8353 +{
8354 +       int ret_val = 1;
8355 +       struct tramp_img_dup_pkt *cur_pkt;
8356 +       struct tramp_img_dup_relo *cur_relo;
8357 +       struct reloc_record_t *relos[MAX_RELOS_PER_PASS];
8358 +       struct doff_scnhdr_t *sect_hdr = NULL;
8359 +       s32 i;
8360 +
8361 +       /* Similar to the trampoline pkt finalize, this function walks each dup
8362 +        * pkt that was generated and performs all relocations that were
8363 +        * deferred to a 2nd pass.  This is the equivalent of dload_data() from
8364 +        * cload.c, but does not need the additional reorder and checksum
8365 +        * processing as it has already been done.  */
8366 +       cur_pkt = dlthis->tramp.dup_pkts;
8367 +       while ((ret_val != 0) && (cur_pkt != NULL)) {
8368 +               /*  Remove the node from the list, we'll be freeing it
8369 +                * shortly  */
8370 +               dlthis->tramp.dup_pkts = cur_pkt->next;
8371 +
8372 +               /*  Setup the section and image offset for relocation  */
8373 +               dlthis->image_secn = &dlthis->ldr_sections[cur_pkt->secnn];
8374 +               dlthis->image_offset = cur_pkt->offset;
8375 +
8376 +               /*  In order to get the delta run address, we need to reference
8377 +                * the original section header.  It's a bit ugly, but needed
8378 +                * for relo.  */
8379 +               i = (s32)(dlthis->image_secn - dlthis->ldr_sections);
8380 +               sect_hdr = dlthis->sect_hdrs + i;
8381 +               dlthis->delta_runaddr = sect_hdr->ds_paddr;
8382 +
8383 +               /*  Walk all relos in the chain and process each.  */
8384 +               cur_relo = cur_pkt->relo_chain;
8385 +               while (cur_relo != NULL) {
8386 +                       /*  Process them a chunk at a time to be efficient  */
8387 +                       for (i = 0; (i < MAX_RELOS_PER_PASS)
8388 +                                && (cur_relo != NULL);
8389 +                                i++, cur_relo = cur_relo->next) {
8390 +                               relos[i] = &cur_relo->relo;
8391 +                               cur_pkt->relo_chain = cur_relo->next;
8392 +                       }
8393 +
8394 +                       /*  Do the actual relo  */
8395 +                       ret_val = priv_pkt_relo(dlthis,
8396 +                               cur_pkt->img_pkt.i_bits,
8397 +                               relos, i);
8398 +                       if (ret_val == 0) {
8399 +                               dload_error(dlthis,
8400 +                                       "Relocation of dup pkt at %x failed",
8401 +                                       cur_pkt->offset + dlthis->image_secn->
8402 +                                       run_addr);
8403 +                               break;
8404 +                       }
8405 +
8406 +                       /*  Release all of these relos, we're done with them */
8407 +                       while (i > 0) {
8408 +                               dlthis->mysym->Deallocate(dlthis->mysym,
8409 +                                         GET_CONTAINER(relos[i - 1],
8410 +                                       struct tramp_img_dup_relo, relo));
8411 +                               i--;
8412 +                       }
8413 +
8414 +                       /*  DO NOT ADVANCE cur_relo, IT IS ALREADY READY TO
8415 +                        * GO!  */
8416 +               }
8417 +
8418 +               /* Done with all relos.  Make sure we didn't have a problem and
8419 +                * write it out to the target  */
8420 +               if (ret_val != 0) {
8421 +                       ret_val = dlthis->myio->writemem(dlthis->myio,
8422 +                                  cur_pkt->img_pkt.i_bits,
8423 +                                  dlthis->image_secn->load_addr +
8424 +                                  cur_pkt->offset, dlthis->image_secn,
8425 +                                  BYTE_TO_HOST(cur_pkt->
8426 +                                  img_pkt.i_packet_size));
8427 +                       if (ret_val == 0) {
8428 +                               dload_error(dlthis,
8429 +                                       "Write to " FMT_UI32 " failed",
8430 +                                       dlthis->image_secn->load_addr +
8431 +                                       cur_pkt->offset);
8432 +                       }
8433 +
8434 +                       dlthis->mysym->Deallocate(dlthis->mysym, cur_pkt);
8435 +
8436 +                       /*  Advance to the next packet  */
8437 +                       cur_pkt = dlthis->tramp.dup_pkts;
8438 +               }
8439 +       }
8440 +
8441 +       return ret_val;
8442 +}
8443 +
8444 +/*
8445 + * Function:   priv_dup_find
8446 + * Description: Walk the list of existing duplicate packets and find a
8447 + *       match based on the section number and image offset.  Return
8448 + *       the duplicate packet if found, otherwise NULL.
8449 + */
8450 +static struct tramp_img_dup_pkt *priv_dup_find(struct dload_state *dlthis,
8451 +                                       s16 secnn, u32 image_offset)
8452 +{
8453 +       struct tramp_img_dup_pkt *cur_pkt = NULL;
8454 +
8455 +       for (cur_pkt = dlthis->tramp.dup_pkts;
8456 +                cur_pkt != NULL;
8457 +                cur_pkt = cur_pkt->next) {
8458 +               if ((cur_pkt->secnn == secnn) &&
8459 +                       (cur_pkt->offset == image_offset)) {
8460 +                       /*  Found a match, break out  */
8461 +                       break;
8462 +               }
8463 +       }
8464 +
8465 +       return cur_pkt;
8466 +}
8467 +
8468 +/*
8469 + * Function:   priv_img_pkt_dup
8470 + * Description: Duplicate the original image packet.  If this is the first
8471 + *       time this image packet has been seen (based on section number
8472 + *       and image offset), create a new duplicate packet and add it
8473 + *       to the dup packet list.  If not, just get the existing one and
8474 + *       update it with the current packet contents (since relocation
8475 + *       on the packet is still ongoing in first pass.)  Create a
8476 + *       duplicate of the provided relocation, but update it to point
8477 + *       to the new trampoline symbol.  Add the new relocation dup to
8478 + *       the dup packet's relo chain for 2nd pass relocation later.
8479 + */
8480 +static int priv_img_pkt_dup(struct dload_state *dlthis,
8481 +       s16 secnn, u32 image_offset, struct image_packet_t *ipacket,
8482 +       struct reloc_record_t *rp, struct tramp_sym *new_tramp_sym)
8483 +{
8484 +       struct tramp_img_dup_pkt *dup_pkt = NULL;
8485 +       u32 new_dup_size;
8486 +       s32 i;
8487 +       int ret_val = 0;
8488 +       struct tramp_img_dup_relo *dup_relo = NULL;
8489 +
8490 +       /*  Determinne if this image packet is already being tracked in the
8491 +               dup list for other trampolines.  */
8492 +       dup_pkt = priv_dup_find(dlthis, secnn, image_offset);
8493 +
8494 +       if (dup_pkt == NULL) {
8495 +               /*  This image packet does not exist in our tracking, so create
8496 +                * a new one and add it to the head of the list.  */
8497 +               new_dup_size = sizeof(struct tramp_img_dup_pkt) +
8498 +                                               ipacket->i_packet_size;
8499 +
8500 +               dup_pkt = (struct tramp_img_dup_pkt *)
8501 +                       dlthis->mysym->Allocate(dlthis->mysym, new_dup_size);
8502 +               if (dup_pkt != NULL) {
8503 +                       /*  Save off the section and offset information  */
8504 +                       dup_pkt->secnn = secnn;
8505 +                       dup_pkt->offset = image_offset;
8506 +                       dup_pkt->relo_chain = NULL;
8507 +
8508 +                       /*  Copy the original packet content  */
8509 +                       dup_pkt->img_pkt = *ipacket;
8510 +                       dup_pkt->img_pkt.i_bits = (u8 *)(dup_pkt + 1);
8511 +                       for (i = 0; i < ipacket->i_packet_size; i++)
8512 +                               *(dup_pkt->img_pkt.i_bits + i) =
8513 +                                       *(ipacket->i_bits + i);
8514 +
8515 +                       /*  Add the packet to the dup list  */
8516 +                       dup_pkt->next = dlthis->tramp.dup_pkts;
8517 +                       dlthis->tramp.dup_pkts = dup_pkt;
8518 +               } else
8519 +                       dload_error(dlthis, "Failed to create dup packet!");
8520 +       } else {
8521 +               /*  The image packet contents could have changed since
8522 +                * trampoline detection happens during relocation of the image
8523 +                * packets.  So, we need to update the image packet contents
8524 +                * before adding relo information.  */
8525 +               for (i = 0; i < dup_pkt->img_pkt.i_packet_size; i++)
8526 +                       *(dup_pkt->img_pkt.i_bits + i) =
8527 +                               *(ipacket->i_bits + i);
8528 +       }
8529 +
8530 +       /*  Since the previous code may have allocated a new dup packet for us,
8531 +               double check that we actually have one.  */
8532 +       if (dup_pkt != NULL) {
8533 +               /*  Allocate a new node for the relo chain.  Each image packet
8534 +                * can potentially have multiple relocations that cause a
8535 +                * trampoline to be generated.  So, we keep them in a chain,
8536 +                * order is not important.  */
8537 +               dup_relo = dlthis->mysym->Allocate(dlthis->mysym,
8538 +                                          sizeof(struct tramp_img_dup_relo));
8539 +               if (dup_relo != NULL) {
8540 +                       /*  Copy the relo contents, adjust for the new
8541 +                        * trampoline and add it to the list.  */
8542 +                       dup_relo->relo = *rp;
8543 +                       dup_relo->relo.r_symndx = new_tramp_sym->index;
8544 +
8545 +                       dup_relo->next = dup_pkt->relo_chain;
8546 +                       dup_pkt->relo_chain = dup_relo;
8547 +
8548 +                       /*  That's it, we're done.  Make sure we update our
8549 +                        * return value to be success since everything finished
8550 +                        * ok  */
8551 +                       ret_val = 1;
8552 +               } else
8553 +                       dload_error(dlthis, "Unable to alloc dup relo");
8554 +       }
8555 +
8556 +       return ret_val;
8557 +}
8558 +
8559 +/*
8560 + * Function:   dload_tramp_avail
8561 + * Description: Check to see if the target supports a trampoline for this type
8562 + *       of relocation.  Return true if it does, otherwise false.
8563 + */
8564 +bool dload_tramp_avail(struct dload_state *dlthis, struct reloc_record_t *rp)
8565 +{
8566 +       bool ret_val = false;
8567 +       u16 map_index;
8568 +       u16 gen_index;
8569 +
8570 +       /*  Check type hash vs. target tramp table  */
8571 +       map_index = HASH_FUNC(rp->r_type);
8572 +       gen_index = tramp_map[map_index];
8573 +       if (gen_index != TRAMP_NO_GEN_AVAIL)
8574 +               ret_val = true;
8575 +
8576 +       return ret_val;
8577 +}
8578 +
8579 +/*
8580 + * Function:   dload_tramp_generate
8581 + * Description: Create a new trampoline for the provided image packet and
8582 + *       relocation causing problems.  This will create the trampoline
8583 + *       as well as duplicate/update the image packet and relocation
8584 + *       causing the problem, which will be relo'd again during
8585 + *       finalization.
8586 + */
8587 +int dload_tramp_generate(struct dload_state *dlthis, s16 secnn,
8588 +       u32 image_offset, struct image_packet_t *ipacket,
8589 +       struct reloc_record_t *rp)
8590 +{
8591 +       u16 map_index;
8592 +       u16 gen_index;
8593 +       int ret_val = 1;
8594 +       char tramp_sym_str[TRAMP_SYM_PREFIX_LEN + TRAMP_SYM_HEX_ASCII_LEN];
8595 +       struct Local_Symbol *ref_sym;
8596 +       struct tramp_sym        *new_tramp_sym;
8597 +       struct tramp_sym        *new_ext_sym;
8598 +       struct tramp_string *new_tramp_str;
8599 +       u32 new_tramp_base;
8600 +       struct Local_Symbol tmp_sym;
8601 +       struct Local_Symbol ext_tmp_sym;
8602 +
8603 +       /*  Hash the relo type to get our generator information  */
8604 +       map_index = HASH_FUNC(rp->r_type);
8605 +       gen_index = tramp_map[map_index];
8606 +       if (gen_index != TRAMP_NO_GEN_AVAIL) {
8607 +               /*  If this is the first trampoline, create the section name in
8608 +                * our string table for debug help later.  */
8609 +               if (dlthis->tramp.string_head == NULL) {
8610 +                       priv_tramp_string_create(dlthis,
8611 +                                strlen(TRAMP_SECT_NAME), TRAMP_SECT_NAME);
8612 +               }
8613 +
8614 +#ifdef ENABLE_TRAMP_DEBUG
8615 +               dload_syms_error(dlthis->mysym,
8616 +                        "Trampoline at img loc %x, references %x",
8617 +                        dlthis->ldr_sections[secnn].run_addr + image_offset +
8618 +                        rp->r_vaddr,
8619 +                        dlthis->local_symtab[rp->r_symndx].value);
8620 +#endif
8621 +
8622 +               /*  Generate the trampoline string, check if already defined.
8623 +                * If the relo symbol index is -1, it means we need the section
8624 +                * info for relo later.  To do this we'll dummy up a symbol
8625 +                * with the section delta and run addresses.  */
8626 +               if (rp->r_symndx == -1) {
8627 +                       ext_tmp_sym.value =
8628 +                               dlthis->ldr_sections[secnn].run_addr;
8629 +                       ext_tmp_sym.delta = dlthis->sect_hdrs[secnn].ds_paddr;
8630 +                       ref_sym = &ext_tmp_sym;
8631 +               } else
8632 +                       ref_sym = &(dlthis->local_symtab[rp->r_symndx]);
8633 +
8634 +               priv_tramp_sym_gen_name(ref_sym->value, tramp_sym_str);
8635 +               new_tramp_sym = priv_tramp_sym_find(dlthis, tramp_sym_str);
8636 +               if (new_tramp_sym == NULL) {
8637 +                       /*  If tramp string not defined, create it and a new
8638 +                        * string, and symbol for it as well as the original
8639 +                        * symbol which caused the trampoline.  */
8640 +                       new_tramp_str = priv_tramp_string_create(dlthis,
8641 +                                strlen(tramp_sym_str), tramp_sym_str);
8642 +                       if (new_tramp_str == NULL) {
8643 +                               dload_error(dlthis, "Failed to create new "
8644 +                                       "trampoline string\n");
8645 +                               ret_val = 0;
8646 +                       } else {
8647 +                               /*  Allocate tramp section space for the new
8648 +                                * tramp from the target  */
8649 +                               new_tramp_base = priv_tramp_sect_alloc(dlthis,
8650 +                                                          tramp_size_get());
8651 +
8652 +                               /*  We have a string, create the new symbol and
8653 +                                * duplicate the external.  */
8654 +                               tmp_sym.value = new_tramp_base;
8655 +                               tmp_sym.delta = 0;
8656 +                               tmp_sym.secnn = -1;
8657 +                               tmp_sym.sclass = 0;
8658 +                               new_tramp_sym = priv_tramp_sym_create(dlthis,
8659 +                                         new_tramp_str->index, &tmp_sym);
8660 +
8661 +                               new_ext_sym = priv_tramp_sym_create(dlthis,
8662 +                                                               -1, ref_sym);
8663 +
8664 +                               if ((new_tramp_sym != NULL) &&
8665 +                                       (new_ext_sym != NULL)) {
8666 +                                       /*  Call the image generator to get the
8667 +                                        * new image data and fix up its
8668 +                                        * relocations for the external
8669 +                                        * symbol.  */
8670 +                                       ret_val = priv_tgt_img_gen(dlthis,
8671 +                                          new_tramp_base, gen_index,
8672 +                                          new_ext_sym);
8673 +
8674 +                                       /*  Add generated image data to tramp
8675 +                                        * image list  */
8676 +                                       if (ret_val != 1) {
8677 +                                               dload_error(dlthis, "Failed to"
8678 +                                                  " create image packet for "
8679 +                                                  "trampoline\n");
8680 +                                       }
8681 +                               } else {
8682 +                                       dload_error(dlthis, "Failed to create "
8683 +                                          "new tramp syms (%8.8X, %8.8X)\n",
8684 +                                          new_tramp_sym, new_ext_sym);
8685 +                                       ret_val = 0;
8686 +                               }
8687 +                       }
8688 +               }
8689 +
8690 +               /*  Duplicate the image data and relo record that caused the
8691 +                * tramp, including update the relo data to point to the tramp
8692 +                * symbol.  */
8693 +               if (ret_val == 1) {
8694 +                       ret_val = priv_img_pkt_dup(dlthis, secnn, image_offset,
8695 +                                  ipacket, rp, new_tramp_sym);
8696 +                       if (ret_val != 1) {
8697 +                               dload_error(dlthis, "Failed to create dup of "
8698 +                                       "original img pkt\n");
8699 +                       }
8700 +               }
8701 +       }
8702 +
8703 +       return ret_val;
8704 +}
8705 +
8706 +/*
8707 + * Function:   dload_tramp_pkt_update
8708 + * Description: Update the duplicate copy of this image packet, which the
8709 + *       trampoline layer is already tracking.  This is call is critical
8710 + *       to make if trampolines were generated anywhere within the
8711 + *       packet and first pass relo continued on the remainder.  The
8712 + *       trampoline layer needs the updates image data so when 2nd
8713 + *       pass relo is done during finalize the image packet can be
8714 + *       written to the target since all relo is done.
8715 + */
8716 +int dload_tramp_pkt_udpate(struct dload_state *dlthis, s16 secnn,
8717 +          u32 image_offset, struct image_packet_t *ipacket)
8718 +{
8719 +       struct tramp_img_dup_pkt *dup_pkt = NULL;
8720 +       s32 i;
8721 +       int ret_val = 0;
8722 +
8723 +       /*  Find the image packet in question, the caller needs us to update it
8724 +               since a trampoline was previously generated.  */
8725 +       dup_pkt = priv_dup_find(dlthis, secnn, image_offset);
8726 +       if (dup_pkt != NULL) {
8727 +               for (i = 0; i < dup_pkt->img_pkt.i_packet_size; i++)
8728 +                       *(dup_pkt->img_pkt.i_bits + i) = *(ipacket->i_bits + i);
8729 +
8730 +               ret_val = 1;
8731 +       } else {
8732 +               dload_error(dlthis,
8733 +                       "Unable to find existing DUP pkt for %x, offset %x",
8734 +                       secnn, image_offset);
8735 +
8736 +       }
8737 +
8738 +       return ret_val;
8739 +}
8740 +
8741 +/*
8742 + * Function:   dload_tramp_finalize
8743 + * Description: If any trampolines were created, finalize everything on the
8744 + *       target by allocating the trampoline section on the target,
8745 + *       finalizing the trampoline symbols, finalizing the trampoline
8746 + *       packets (write the new section to target memory) and finalize
8747 + *       the duplicate packets by doing 2nd pass relo over them.
8748 + */
8749 +int dload_tramp_finalize(struct dload_state *dlthis)
8750 +{
8751 +       int ret_val = 1;
8752 +
8753 +       if (dlthis->tramp.tramp_sect_next_addr != 0) {
8754 +               /*  Finalize strings into a flat table.  This is needed so it
8755 +                * can be added to the debug string table later.  */
8756 +               ret_val = priv_string_tbl_finalize(dlthis);
8757 +
8758 +               /*  Do target allocation for section BEFORE finalizing
8759 +                * symbols.  */
8760 +               if (ret_val != 0)
8761 +                       ret_val = priv_tramp_sect_tgt_alloc(dlthis);
8762 +
8763 +               /*  Finalize symbols with their correct target information and
8764 +                * flatten  */
8765 +               if (ret_val != 0)
8766 +                       ret_val = priv_tramp_sym_finalize(dlthis);
8767 +
8768 +               /*  Finalize all trampoline packets.  This performs the
8769 +                * relocation on the packets as well as writing them to target
8770 +                * memory.  */
8771 +               if (ret_val != 0)
8772 +                       ret_val = priv_tramp_pkt_finalize(dlthis);
8773 +
8774 +               /*  Perform a 2nd pass relocation on the dup list.  */
8775 +               if (ret_val != 0)
8776 +                       ret_val = priv_dup_pkt_finalize(dlthis);
8777 +       }
8778 +
8779 +       return ret_val;
8780 +}
8781 +
8782 +/*
8783 + * Function:   dload_tramp_cleanup
8784 + * Description: Release all temporary resources used in the trampoline layer.
8785 + *       Note that the target memory which may have been allocated and
8786 + *       written to store the trampolines is NOT RELEASED HERE since it
8787 + *       is potentially still in use.  It is automatically released
8788 + *       when the module is unloaded.
8789 + */
8790 +void dload_tramp_cleanup(struct dload_state *dlthis)
8791 +{
8792 +       struct tramp_info *tramp = &dlthis->tramp;
8793 +       struct tramp_sym *cur_sym;
8794 +       struct tramp_string *cur_string;
8795 +       struct tramp_img_pkt *cur_tramp_pkt;
8796 +       struct tramp_img_dup_pkt *cur_dup_pkt;
8797 +       struct tramp_img_dup_relo *cur_dup_relo;
8798 +
8799 +       /*  If there were no tramps generated, just return  */
8800 +       if (tramp->tramp_sect_next_addr == 0)
8801 +               return;
8802 +
8803 +       /*  Destroy all tramp information  */
8804 +       for (cur_sym = tramp->symbol_head;
8805 +                cur_sym != NULL;
8806 +                cur_sym = tramp->symbol_head) {
8807 +               tramp->symbol_head = cur_sym->next;
8808 +               if (tramp->symbol_tail == cur_sym)
8809 +                       tramp->symbol_tail = NULL;
8810 +
8811 +               dlthis->mysym->Deallocate(dlthis->mysym, cur_sym);
8812 +       }
8813 +
8814 +       if (tramp->final_sym_table != NULL)
8815 +               dlthis->mysym->Deallocate(dlthis->mysym,
8816 +                       tramp->final_sym_table);
8817 +
8818 +       for (cur_string = tramp->string_head;
8819 +                cur_string != NULL;
8820 +                cur_string = tramp->string_head) {
8821 +               tramp->string_head = cur_string->next;
8822 +               if (tramp->string_tail == cur_string)
8823 +                       tramp->string_tail = NULL;
8824 +
8825 +               dlthis->mysym->Deallocate(dlthis->mysym, cur_string);
8826 +       }
8827 +
8828 +       if (tramp->final_string_table != NULL)
8829 +               dlthis->mysym->Deallocate(dlthis->mysym,
8830 +                       tramp->final_string_table);
8831 +
8832 +       for (cur_tramp_pkt = tramp->tramp_pkts;
8833 +                cur_tramp_pkt != NULL;
8834 +                cur_tramp_pkt = tramp->tramp_pkts) {
8835 +               tramp->tramp_pkts = cur_tramp_pkt->next;
8836 +               dlthis->mysym->Deallocate(dlthis->mysym, cur_tramp_pkt);
8837 +       }
8838 +
8839 +       for (cur_dup_pkt = tramp->dup_pkts;
8840 +                cur_dup_pkt != NULL;
8841 +                cur_dup_pkt = tramp->dup_pkts) {
8842 +               tramp->dup_pkts = cur_dup_pkt->next;
8843 +
8844 +               for (cur_dup_relo = cur_dup_pkt->relo_chain;
8845 +                        cur_dup_relo != NULL;
8846 +                        cur_dup_relo = cur_dup_pkt->relo_chain) {
8847 +                       cur_dup_pkt->relo_chain = cur_dup_relo->next;
8848 +                       dlthis->mysym->Deallocate(dlthis->mysym, cur_dup_relo);
8849 +               }
8850 +
8851 +               dlthis->mysym->Deallocate(dlthis->mysym, cur_dup_pkt);
8852 +       }
8853 +}
8854 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/tramp_table_c6000.c kernel-power-2.6.28/drivers/dsp/bridge/dynload/tramp_table_c6000.c
8855 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/dynload/tramp_table_c6000.c     1970-01-01 01:00:00.000000000 +0100
8856 +++ kernel-power-2.6.28/drivers/dsp/bridge/dynload/tramp_table_c6000.c  2011-05-02 22:36:49.000000000 +0100
8857 @@ -0,0 +1,172 @@
8858 +/*
8859 + * tramp_table_c6000.c
8860 + *
8861 + * DSP-BIOS Bridge driver support functions for TI OMAP processors.
8862 + *
8863 + * Copyright (C) 2005-2006 Texas Instruments, Inc.
8864 + *
8865 + * This package is free software; you can redistribute it and/or modify
8866 + * it under the terms of the GNU General Public License version 2 as
8867 + * published by the Free Software Foundation.
8868 + *
8869 + * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
8870 + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
8871 + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
8872 + */
8873 +
8874 +#include "dload_internal.h"
8875 +
8876 +/*  These are defined in coff.h, but may not be available on all platforms
8877 +       so we'll go ahead and define them here.  */
8878 +#ifndef R_C60LO16
8879 +#define R_C60LO16        0x54     /* C60: MVK Low Half Register          */
8880 +#define R_C60HI16        0x55     /* C60: MVKH/MVKLH High Half Register  */
8881 +#endif
8882 +
8883 +#define C6X_TRAMP_WORD_COUNT                   8
8884 +#define C6X_TRAMP_MAX_RELOS                     8
8885 +
8886 +/*  THIS HASH FUNCTION MUST MATCH THE ONE IN reloc_table_c6000.c  */
8887 +#define HASH_FUNC(zz) (((((zz) + 1) * UINT32_C(1845)) >> 11) & 63)
8888 +
8889 +
8890 +/*  THIS MUST MATCH reloc_record_t FOR A SYMBOL BASED RELO  */
8891 +struct c6000_relo_record {
8892 +       s32 r_vaddr;
8893 +       s32 symndx;
8894 +#ifndef _BIG_ENDIAN
8895 +       u16 disp;
8896 +       u16 type;
8897 +#else
8898 +       u16 type;
8899 +       u16 disp;
8900 +#endif
8901 +};
8902 +
8903 +struct c6000_gen_code {
8904 +       struct tramp_gen_code_hdr       hdr;
8905 +       u32 tramp_instrs[C6X_TRAMP_WORD_COUNT];
8906 +       struct c6000_relo_record relos[C6X_TRAMP_MAX_RELOS];
8907 +};
8908 +
8909 +
8910 +/*  Hash mapping for relos that can cause trampolines.  */
8911 +static const u16 tramp_map[] =
8912 +{
8913 +       65535,
8914 +       65535,
8915 +       65535,
8916 +       65535,
8917 +       65535,
8918 +       65535,
8919 +       65535,
8920 +       65535,
8921 +       65535,
8922 +       65535,
8923 +       0,
8924 +       65535,
8925 +       65535,
8926 +       65535,
8927 +       65535,
8928 +       65535,
8929 +       65535,
8930 +       65535,
8931 +       65535,
8932 +       65535,
8933 +       65535,
8934 +       65535,
8935 +       65535,
8936 +       65535,
8937 +       65535,
8938 +       65535,
8939 +       65535,
8940 +       65535,
8941 +       65535,
8942 +       65535,
8943 +       65535,
8944 +       65535,
8945 +       65535,
8946 +       65535,
8947 +       65535,
8948 +       65535,
8949 +       65535,
8950 +       65535,
8951 +       65535,
8952 +       65535,
8953 +       65535,
8954 +       65535,
8955 +       65535,
8956 +       65535,
8957 +       65535,
8958 +       65535,
8959 +       65535,
8960 +       65535,
8961 +       65535,
8962 +       65535,
8963 +       65535,
8964 +       65535,
8965 +       65535,
8966 +       65535,
8967 +       65535,
8968 +       65535,
8969 +       65535,
8970 +       65535,
8971 +       65535,
8972 +       65535,
8973 +       65535,
8974 +       65535,
8975 +       65535,
8976 +       65535
8977 +};
8978 +
8979 +
8980 +static const struct c6000_gen_code   tramp_gen_info[] =
8981 +{
8982 +       /*  Tramp caused by R_C60PCR21  */
8983 +       {
8984 +               /*  Header - 8 instructions, 2 relos  */
8985 +               {
8986 +                       sizeof(u32) * C6X_TRAMP_WORD_COUNT,
8987 +                       2,
8988 +                       FIELD_OFFSET(struct c6000_gen_code, relos)
8989 +               },
8990 +
8991 +               /*  Trampoline instructions  */
8992 +               {
8993 +                       0x053C54F7,     /*       STW.D2T2  B10, *sp--[2]  */
8994 +                       0x0500002A,     /*  || MVK.S2   <blank>, B10   */
8995 +                       0x0500006A,     /*       MVKH.S2   <blank>, B10   */
8996 +                       0x00280362,     /*       B.S2     B10           */
8997 +                       0x053C52E6,     /*       LDW.D2T2  *++sp[2], B10  */
8998 +                       0x00006000,     /*       NOP       4            */
8999 +                       0x00000000,     /*       NOP                    */
9000 +                       0x00000000      /*       NOP                    */
9001 +               },
9002 +
9003 +               /*  Relocations  */
9004 +               {
9005 +                       { 4, 0, 0, R_C60LO16 },
9006 +                       { 8, 0, 0, R_C60HI16 },
9007 +                       { 0, 0, 0, 0x0000 },
9008 +                       { 0, 0, 0, 0x0000 },
9009 +                       { 0, 0, 0, 0x0000 },
9010 +                       { 0, 0, 0, 0x0000 },
9011 +                       { 0, 0, 0, 0x0000 },
9012 +                       { 0, 0, 0, 0x0000 }
9013 +               }
9014 +       }
9015 +};
9016 +
9017 +
9018 +
9019 +/*  TARGET SPECIFIC FUNCTIONS THAT MUST BE DEFINED  */
9020 +static u32 tramp_size_get(void)
9021 +{
9022 +       return sizeof(u32) * C6X_TRAMP_WORD_COUNT;
9023 +}
9024 +
9025 +
9026 +static u32 tramp_img_pkt_size_get(void)
9027 +{
9028 +       return sizeof(struct c6000_gen_code);
9029 +}
9030 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/_gt_para.c kernel-power-2.6.28/drivers/dsp/bridge/gen/_gt_para.c
9031 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/_gt_para.c  2011-04-17 17:32:26.000000000 +0100
9032 +++ kernel-power-2.6.28/drivers/dsp/bridge/gen/_gt_para.c       2011-05-02 22:36:49.000000000 +0100
9033 @@ -14,24 +14,12 @@
9034   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9035   */
9036  
9037 -
9038  /*
9039 - *  ======== _gt_para.c ========
9040 - *  Description:
9041 - *      Configuration parameters for GT.  This file is separated from
9042 - *      gt.c so that GT_assert() can reference the error function without
9043 - *      forcing the linker to include all the code for GT_set(), GT_init(),
9044 - *      etc. into a fully bound image.  Thus, GT_assert() can be retained in
9045 - *      a program for which GT_?trace() has been compiled out.
9046 - *
9047 - *! Revision History:
9048 - *! ================
9049 - *! 24-Feb-2003 vp: Code Review Updates.
9050 - *! 18-Oct-2002 sb: Ported to Linux platform.
9051 - *! 03-Jul-2001 rr: Removed kfuncs.h because of build errors.
9052 - *! 07-Dec-1999 ag: Fxn error now causes a WinCE DebugBreak;
9053 - *! 30-Aug-1999 ag: Now uses GP_printf for printf and error.
9054 - *!
9055 + * Configuration parameters for GT.  This file is separated from
9056 + * gt.c so that GT_assert() can reference the error function without
9057 + * forcing the linker to include all the code for GT_set(), GT_init(),
9058 + * etc. into a fully bound image.  Thus, GT_assert() can be retained in
9059 + * a program for which GT_?trace() has been compiled out.
9060   */
9061  
9062  /*  ----------------------------------- Host OS */
9063 @@ -89,10 +77,10 @@ static void error(char *fmt, ...)
9064  
9065         va_end(va);
9066  
9067 -       printk("ERROR: ");
9068 +       pr_err("ERROR: ");
9069         printk(fmt, arg1, arg2, arg3, arg4, arg5, arg6);
9070  
9071 -#if defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)
9072 +#if defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)
9073         if (in_interrupt()) {
9074                 printk(KERN_INFO "Not stopping after error since ISR/DPC "
9075                         "are disabled\n");
9076 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/gb.c kernel-power-2.6.28/drivers/dsp/bridge/gen/gb.c
9077 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/gb.c        2011-04-17 17:32:26.000000000 +0100
9078 +++ kernel-power-2.6.28/drivers/dsp/bridge/gen/gb.c     2011-05-02 22:36:49.000000000 +0100
9079 @@ -3,6 +3,8 @@
9080   *
9081   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
9082   *
9083 + * Generic bitmap operations.
9084 + *
9085   * Copyright (C) 2005-2006 Texas Instruments, Inc.
9086   *
9087   * This package is free software; you can redistribute it and/or modify
9088 @@ -14,21 +16,6 @@
9089   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9090   */
9091  
9092 -
9093 -/*
9094 - *  ======== gb.c ========
9095 - *  Description: Generic bitmap operations.
9096 - *
9097 - *! Revision History
9098 - *! ================
9099 - *! 24-Feb-2003 vp  Code review updates.
9100 - *! 17-Dec-2002 map Fixed GB_minset(), GB_empty(), and GB_full(),
9101 - *!                 to ensure only 'len' bits are considered in the map
9102 - *! 18-Oct-2002 sb  Ported to Linux platform.
9103 - *! 06-Dec-2001 jeh Fixed bug in GB_minclear().
9104 - *!
9105 - */
9106 -
9107  /*  ----------------------------------- DSP/BIOS Bridge */
9108  #include <dspbridge/std.h>
9109  #include <linux/types.h>
9110 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/gh.c kernel-power-2.6.28/drivers/dsp/bridge/gen/gh.c
9111 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/gh.c        2011-04-17 17:32:26.000000000 +0100
9112 +++ kernel-power-2.6.28/drivers/dsp/bridge/gen/gh.c     2011-05-02 22:36:49.000000000 +0100
9113 @@ -14,11 +14,6 @@
9114   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9115   */
9116  
9117 -
9118 -/*
9119 - *  ======== gh.c ========
9120 - */
9121 -
9122  #include <dspbridge/std.h>
9123  
9124  #include <dspbridge/host_os.h>
9125 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/gs.c kernel-power-2.6.28/drivers/dsp/bridge/gen/gs.c
9126 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/gs.c        2011-04-17 17:32:26.000000000 +0100
9127 +++ kernel-power-2.6.28/drivers/dsp/bridge/gen/gs.c     2011-05-02 22:36:49.000000000 +0100
9128 @@ -3,6 +3,8 @@
9129   *
9130   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
9131   *
9132 + * General storage memory allocator services.
9133 + *
9134   * Copyright (C) 2005-2006 Texas Instruments, Inc.
9135   *
9136   * This package is free software; you can redistribute it and/or modify
9137 @@ -14,21 +16,6 @@
9138   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9139   */
9140  
9141 -
9142 -/*
9143 - *  ======== gs.c ========
9144 - *  Description:
9145 - *      General storage memory allocator services.
9146 - *
9147 - *! Revision History
9148 - *! ================
9149 - *! 29-Sep-1999 ag:  Un-commented MEM_Init in GS_init().
9150 - *! 14-May-1997 mg:  Modified to use new GS API for GS_free() and GS_frees().
9151 - *! 06-Nov-1996 gp:  Re-commented MEM_Init in GS_init(). GS needs GS_Exit().
9152 - *! 21-Oct-1996 db:  Un-commented MEM_Init in GS_init().
9153 - *! 21-May-1996 mg:  Created from original stdlib implementation.
9154 - */
9155 -
9156  /*  ----------------------------------- DSP/BIOS Bridge */
9157  #include <dspbridge/std.h>
9158  #include <dspbridge/dbdefs.h>
9159 @@ -65,7 +52,7 @@ void *GS_alloc(u32 size)
9160   */
9161  void GS_exit(void)
9162  {
9163 -       MEM_Exit();
9164 +       /* Do nothing */
9165  }
9166  
9167  /*
9168 @@ -98,9 +85,5 @@ void GS_frees(void *ptr, u32 size)
9169   */
9170  void GS_init(void)
9171  {
9172 -       static bool curInit;
9173 -
9174 -       if (curInit == false) {
9175 -               curInit = MEM_Init(); /* which can't fail currently. */
9176 -       }
9177 +       /* Do nothing */
9178  }
9179 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/gt.c kernel-power-2.6.28/drivers/dsp/bridge/gen/gt.c
9180 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/gt.c        2011-04-17 17:32:26.000000000 +0100
9181 +++ kernel-power-2.6.28/drivers/dsp/bridge/gen/gt.c     2011-05-02 22:36:49.000000000 +0100
9182 @@ -3,6 +3,8 @@
9183   *
9184   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
9185   *
9186 + * This module implements the trace mechanism for bridge.
9187 + *
9188   * Copyright (C) 2005-2006 Texas Instruments, Inc.
9189   *
9190   * This package is free software; you can redistribute it and/or modify
9191 @@ -14,20 +16,6 @@
9192   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9193   */
9194  
9195 -
9196 -/*
9197 - * ======== gt.c ========
9198 - * Description: This module implements the trace mechanism for bridge.
9199 - *
9200 - *! Revision History
9201 - *! ================
9202 - *! 16-May-1997 dr     Changed GT_Config member names to conform to coding
9203 - *!                    standards.
9204 - *! 23-Apr-1997 ge     Check for GT->TIDFXN for NULL before calling it.
9205 - *! 03-Jan-1997        ge      Changed GT_Config structure member names to eliminate
9206 - *!                    preprocessor confusion with other macros.
9207 - */
9208 -
9209  /*  ----------------------------------- DSP/BIOS Bridge */
9210  #include <dspbridge/std.h>
9211  
9212 @@ -238,7 +226,7 @@ s32 _GT_trace(struct GT_Mask *mask, char
9213         arg6 = va_arg(va, s32);
9214  
9215         va_end(va);
9216 -#ifdef DEBUG
9217 +#ifdef CONFIG_BRIDGE_DEBUG
9218         if (GT->PIDFXN == NULL) {
9219                 printk(GT_1format, mask->modName, GT->TIDFXN ?
9220                 (*GT->TIDFXN)() : 0);
9221 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/uuidutil.c kernel-power-2.6.28/drivers/dsp/bridge/gen/uuidutil.c
9222 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/gen/uuidutil.c  2011-04-17 17:32:26.000000000 +0100
9223 +++ kernel-power-2.6.28/drivers/dsp/bridge/gen/uuidutil.c       2011-05-02 22:36:49.000000000 +0100
9224 @@ -3,6 +3,8 @@
9225   *
9226   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
9227   *
9228 + * This file contains the implementation of UUID helper functions.
9229 + *
9230   * Copyright (C) 2005-2006 Texas Instruments, Inc.
9231   *
9232   * This package is free software; you can redistribute it and/or modify
9233 @@ -14,24 +16,6 @@
9234   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9235   */
9236  
9237 -
9238 -/*
9239 - *  ======== uuidutil.c ========
9240 - *  Description:
9241 - *  This file contains the implementation of UUID helper functions.
9242 - *
9243 - *! Revision History
9244 - *! ================
9245 - *! 23-Feb-2003 vp: Code review updates.
9246 - *! 18-Oct-2003 vp: Ported to Linux platform.
9247 - *! 31-Aug-2000 rr: UUID_UuidFromString bug fixed.
9248 - *! 29-Aug-2000 rr: Modified UUID_UuidFromString.
9249 - *! 09-Nov-2000 kc: Modified UUID_UuidFromString to simplify implementation.
9250 - *! 30-Oct-2000 kc: Modified UUID utility module function prefix.
9251 - *! 10-Aug-2000 kc: Created.
9252 - *!
9253 - */
9254 -
9255  /*  ----------------------------------- Host OS  */
9256  #include <dspbridge/host_os.h>
9257  
9258 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/GlobalTypes.h kernel-power-2.6.28/drivers/dsp/bridge/hw/GlobalTypes.h
9259 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/GlobalTypes.h        2011-04-17 17:32:26.000000000 +0100
9260 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/GlobalTypes.h     2011-05-02 22:36:49.000000000 +0100
9261 @@ -3,6 +3,8 @@
9262   *
9263   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
9264   *
9265 + * Global HW definitions
9266 + *
9267   * Copyright (C) 2007 Texas Instruments, Inc.
9268   *
9269   * This package is free software; you can redistribute it and/or modify
9270 @@ -14,16 +16,6 @@
9271   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9272   */
9273  
9274 -
9275 -/*
9276 - *  ======== GlobalTypes.h ========
9277 - *  Description:
9278 - *      Global HW definitions
9279 - *
9280 - *! Revision History:
9281 - *! ================
9282 - *! 16 Feb 2003 sb: Initial version
9283 - */
9284  #ifndef __GLOBALTYPES_H
9285  #define __GLOBALTYPES_H
9286  
9287 @@ -109,7 +101,7 @@
9288   * DESCRIPTION: Returns a 32 bit value given a 16 bit lower value and a 16
9289   *             bit upper value
9290   */
9291 -#define RETURN_32BITS_FROM_16LOWER_AND_16UPPER(lower16Bits,upper16Bits)\
9292 +#define RETURN_32BITS_FROM_16LOWER_AND_16UPPER(lower16Bits, upper16Bits)\
9293      (((((u32)lower16Bits)  & LOWER_16BIT_MASK)) | \
9294       (((((u32)upper16Bits) & LOWER_16BIT_MASK) << UPPER_16BIT_SHIFT)))
9295  
9296 @@ -119,7 +111,7 @@
9297   * DESCRIPTION:  Returns a 16 bit value given a 8 bit lower value and a 8
9298   *            bit upper value
9299   */
9300 -#define RETURN_16BITS_FROM_8LOWER_AND_8UPPER(lower8Bits,upper8Bits)\
9301 +#define RETURN_16BITS_FROM_8LOWER_AND_8UPPER(lower8Bits, upper8Bits)\
9302      (((((u32)lower8Bits)  & LOWER_8BIT_MASK)) | \
9303       (((((u32)upper8Bits) & LOWER_8BIT_MASK) << UPPER_8BIT_OF16_SHIFT)))
9304  
9305 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/IPIAccInt.h kernel-power-2.6.28/drivers/dsp/bridge/hw/IPIAccInt.h
9306 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/IPIAccInt.h  2011-04-17 17:32:26.000000000 +0100
9307 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/IPIAccInt.h       2011-05-02 22:36:49.000000000 +0100
9308 @@ -22,20 +22,5 @@
9309  #define SYSC_IVA2BOOTADDR_OFFSET                0x400
9310  #define SYSC_IVA2BOOTADDR_MASK                 0xfffffc00
9311  
9312 -
9313 -/* The following represent the enumerated values for each bitfield */
9314 -
9315 -enum IPIIPI_SYSCONFIGAutoIdleE {
9316 -       IPIIPI_SYSCONFIGAutoIdleclkfree = 0x0000,
9317 -       IPIIPI_SYSCONFIGAutoIdleautoclkgate = 0x0001
9318 -} ;
9319 -
9320 -enum IPIIPI_ENTRYElemSizeValueE {
9321 -       IPIIPI_ENTRYElemSizeValueElemSz8b = 0x0000,
9322 -       IPIIPI_ENTRYElemSizeValueElemSz16b = 0x0001,
9323 -       IPIIPI_ENTRYElemSizeValueElemSz32b = 0x0002,
9324 -       IPIIPI_ENTRYElemSizeValueReserved = 0x0003
9325 -} ;
9326 -
9327  #endif                         /* _IPI_ACC_INT_H */
9328  /* EOF */
9329 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/IVA2RegAcM.h kernel-power-2.6.28/drivers/dsp/bridge/hw/IVA2RegAcM.h
9330 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/IVA2RegAcM.h 2011-04-17 17:32:26.000000000 +0100
9331 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/IVA2RegAcM.h      2011-05-02 22:36:49.000000000 +0100
9332 @@ -14,8 +14,6 @@
9333   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9334   */
9335  
9336 -
9337 -
9338  #ifndef _IVA2_REG_ACM_H
9339  #define _IVA2_REG_ACM_H
9340  
9341 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/MLBAccInt.h kernel-power-2.6.28/drivers/dsp/bridge/hw/MLBAccInt.h
9342 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/MLBAccInt.h  2011-04-17 17:32:26.000000000 +0100
9343 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/MLBAccInt.h       2011-05-02 22:36:49.000000000 +0100
9344 @@ -14,7 +14,6 @@
9345   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9346   */
9347  
9348 -
9349  #ifndef _MLB_ACC_INT_H
9350  #define _MLB_ACC_INT_H
9351  
9352 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/MLBRegAcM.h kernel-power-2.6.28/drivers/dsp/bridge/hw/MLBRegAcM.h
9353 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/MLBRegAcM.h  2011-04-17 17:32:26.000000000 +0100
9354 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/MLBRegAcM.h       2011-05-02 22:36:49.000000000 +0100
9355 @@ -24,177 +24,158 @@
9356  
9357  #if defined(USE_LEVEL_1_MACROS)
9358  
9359 -#define MLBMAILBOX_SYSCONFIGReadRegister32(baseAddress)\
9360 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGReadRegister32),\
9361 -      __raw_readl(((baseAddress))+ \
9362 -      MLB_MAILBOX_SYSCONFIG_OFFSET))
9363 -
9364 -
9365 -#define MLBMAILBOX_SYSCONFIGWriteRegister32(baseAddress, value)\
9366 -{\
9367 -    const u32 offset = MLB_MAILBOX_SYSCONFIG_OFFSET;\
9368 -    register u32 newValue = ((u32)(value));\
9369 -    _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGWriteRegister32);\
9370 -    __raw_writel(newValue, ((baseAddress))+offset);\
9371 -}
9372 -
9373 -
9374 -#define MLBMAILBOX_SYSCONFIGSIdleModeRead32(baseAddress)\
9375 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGSIdleModeRead32),\
9376 -      (((__raw_readl((((u32)(baseAddress))+\
9377 -      (MLB_MAILBOX_SYSCONFIG_OFFSET)))) &\
9378 -      MLB_MAILBOX_SYSCONFIG_SIdleMode_MASK) >>\
9379 -      MLB_MAILBOX_SYSCONFIG_SIdleMode_OFFSET))
9380 -
9381 -
9382 -#define MLBMAILBOX_SYSCONFIGSIdleModeWrite32(baseAddress, value)\
9383 -{\
9384 -    const u32 offset = MLB_MAILBOX_SYSCONFIG_OFFSET;\
9385 -    register u32 data = __raw_readl(((u32)(baseAddress)) +\
9386 -                           offset);\
9387 -    register u32 newValue = ((u32)(value));\
9388 -    _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGSIdleModeWrite32);\
9389 -    data &= ~(MLB_MAILBOX_SYSCONFIG_SIdleMode_MASK);\
9390 -    newValue <<= MLB_MAILBOX_SYSCONFIG_SIdleMode_OFFSET;\
9391 -    newValue &= MLB_MAILBOX_SYSCONFIG_SIdleMode_MASK;\
9392 -    newValue |= data;\
9393 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
9394 -}
9395 -
9396 -
9397 -#define MLBMAILBOX_SYSCONFIGSoftResetWrite32(baseAddress, value)\
9398 -{\
9399 -    const u32 offset = MLB_MAILBOX_SYSCONFIG_OFFSET;\
9400 -    register u32 data =\
9401 -    __raw_readl(((u32)(baseAddress))+offset);\
9402 -    register u32 newValue = ((u32)(value));\
9403 -    _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGSoftResetWrite32);\
9404 -    data &= ~(MLB_MAILBOX_SYSCONFIG_SoftReset_MASK);\
9405 -    newValue <<= MLB_MAILBOX_SYSCONFIG_SoftReset_OFFSET;\
9406 -    newValue &= MLB_MAILBOX_SYSCONFIG_SoftReset_MASK;\
9407 -    newValue |= data;\
9408 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
9409 -}
9410 -
9411 -
9412 -#define MLBMAILBOX_SYSCONFIGAutoIdleRead32(baseAddress)\
9413 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGAutoIdleRead32),\
9414 -      (((__raw_readl((((u32)(baseAddress))+\
9415 -      (MLB_MAILBOX_SYSCONFIG_OFFSET)))) &\
9416 -      MLB_MAILBOX_SYSCONFIG_AutoIdle_MASK) >>\
9417 -      MLB_MAILBOX_SYSCONFIG_AutoIdle_OFFSET))
9418 -
9419 -
9420 -#define MLBMAILBOX_SYSCONFIGAutoIdleWrite32(baseAddress, value)\
9421 -{\
9422 -    const u32 offset = MLB_MAILBOX_SYSCONFIG_OFFSET;\
9423 -    register u32 data =\
9424 -    __raw_readl(((u32)(baseAddress))+offset);\
9425 -    register u32 newValue = ((u32)(value));\
9426 -    _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGAutoIdleWrite32);\
9427 -    data &= ~(MLB_MAILBOX_SYSCONFIG_AutoIdle_MASK);\
9428 -    newValue <<= MLB_MAILBOX_SYSCONFIG_AutoIdle_OFFSET;\
9429 -    newValue &= MLB_MAILBOX_SYSCONFIG_AutoIdle_MASK;\
9430 -    newValue |= data;\
9431 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
9432 -}
9433 -
9434 +#define MLBMAILBOX_SYSCONFIGReadRegister32(baseAddress)                         \
9435 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGReadRegister32), \
9436 +       __raw_readl(((baseAddress)) + MLB_MAILBOX_SYSCONFIG_OFFSET))
9437 +
9438 +
9439 +#define MLBMAILBOX_SYSCONFIGWriteRegister32(baseAddress, value)                \
9440 +do {                                                                   \
9441 +       const u32 offset = MLB_MAILBOX_SYSCONFIG_OFFSET;                \
9442 +       register u32 newValue = ((u32)(value));                         \
9443 +       _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGWriteRegister32);\
9444 +       __raw_writel(newValue, ((baseAddress)) + offset);               \
9445 +} while (0)
9446 +
9447 +#define MLBMAILBOX_SYSCONFIGSIdleModeRead32(baseAddress)                 \
9448 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGSIdleModeRead32), \
9449 +       (((__raw_readl((((u32)(baseAddress)) +                            \
9450 +       (MLB_MAILBOX_SYSCONFIG_OFFSET)))) &                               \
9451 +       MLB_MAILBOX_SYSCONFIG_SIdleMode_MASK) >>                          \
9452 +       MLB_MAILBOX_SYSCONFIG_SIdleMode_OFFSET))
9453 +
9454 +#define MLBMAILBOX_SYSCONFIGSIdleModeWrite32(baseAddress, value)         \
9455 +do {                                                                     \
9456 +       const u32 offset = MLB_MAILBOX_SYSCONFIG_OFFSET;                  \
9457 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset);   \
9458 +       register u32 newValue = ((u32)(value));                           \
9459 +       _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGSIdleModeWrite32); \
9460 +       data &= ~(MLB_MAILBOX_SYSCONFIG_SIdleMode_MASK);                  \
9461 +       newValue <<= MLB_MAILBOX_SYSCONFIG_SIdleMode_OFFSET;              \
9462 +       newValue &= MLB_MAILBOX_SYSCONFIG_SIdleMode_MASK;                 \
9463 +       newValue |= data;                                                 \
9464 +       __raw_writel(newValue, (u32)(baseAddress) + offset);              \
9465 +} while (0)
9466 +
9467 +#define MLBMAILBOX_SYSCONFIGSoftResetWrite32(baseAddress, value)           \
9468 +do {                                                                       \
9469 +       const u32 offset = MLB_MAILBOX_SYSCONFIG_OFFSET;                    \
9470 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset);     \
9471 +       register u32 newValue = ((u32)(value));                             \
9472 +       _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGSoftResetWrite32);   \
9473 +       data &= ~(MLB_MAILBOX_SYSCONFIG_SoftReset_MASK);                    \
9474 +       newValue <<= MLB_MAILBOX_SYSCONFIG_SoftReset_OFFSET;                \
9475 +       newValue &= MLB_MAILBOX_SYSCONFIG_SoftReset_MASK;                   \
9476 +       newValue |= data;                                                   \
9477 +       __raw_writel(newValue, (u32)(baseAddress) + offset);                \
9478 +} while (0)
9479 +
9480 +#define MLBMAILBOX_SYSCONFIGAutoIdleRead32(baseAddress)                         \
9481 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGAutoIdleRead32), \
9482 +       (((__raw_readl((((u32)(baseAddress)) +                           \
9483 +       (MLB_MAILBOX_SYSCONFIG_OFFSET)))) &                              \
9484 +       MLB_MAILBOX_SYSCONFIG_AutoIdle_MASK) >>                          \
9485 +       MLB_MAILBOX_SYSCONFIG_AutoIdle_OFFSET))
9486 +
9487 +#define MLBMAILBOX_SYSCONFIGAutoIdleWrite32(baseAddress, value)                 \
9488 +do {                                                                    \
9489 +       const u32 offset = MLB_MAILBOX_SYSCONFIG_OFFSET;                 \
9490 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset);  \
9491 +       register u32 newValue = ((u32)(value));                          \
9492 +       _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGAutoIdleWrite32); \
9493 +       data &= ~(MLB_MAILBOX_SYSCONFIG_AutoIdle_MASK);                  \
9494 +       newValue <<= MLB_MAILBOX_SYSCONFIG_AutoIdle_OFFSET;              \
9495 +       newValue &= MLB_MAILBOX_SYSCONFIG_AutoIdle_MASK;                 \
9496 +       newValue |= data;                                                \
9497 +       __raw_writel(newValue, (u32)(baseAddress)+offset);               \
9498 +} while (0)
9499  
9500  #define MLBMAILBOX_SYSSTATUSResetDoneRead32(baseAddress)\
9501 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSSTATUSResetDoneRead32),\
9502 -      (((__raw_readl((((u32)(baseAddress))+\
9503 -      (MLB_MAILBOX_SYSSTATUS_OFFSET)))) &\
9504 -      MLB_MAILBOX_SYSSTATUS_ResetDone_MASK) >>\
9505 -      MLB_MAILBOX_SYSSTATUS_ResetDone_OFFSET))
9506 -
9507 -
9508 -#define MLBMAILBOX_MESSAGE___0_15ReadRegister32(baseAddress, bank)\
9509 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_MESSAGE___0_15ReadRegister32),\
9510 -      __raw_readl(((baseAddress))+\
9511 -      (MLB_MAILBOX_MESSAGE___REGSET_0_15_OFFSET +\
9512 -      MLB_MAILBOX_MESSAGE___0_15_OFFSET+(\
9513 -      (bank)*MLB_MAILBOX_MESSAGE___REGSET_0_15_STEP))))
9514 -
9515 -
9516 -#define MLBMAILBOX_MESSAGE___0_15WriteRegister32(baseAddress, bank, value)\
9517 -{\
9518 -    const u32 offset = MLB_MAILBOX_MESSAGE___REGSET_0_15_OFFSET +\
9519 -    MLB_MAILBOX_MESSAGE___0_15_OFFSET +\
9520 -    ((bank)*MLB_MAILBOX_MESSAGE___REGSET_0_15_STEP);\
9521 -    register u32 newValue = ((u32)(value));\
9522 -    _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_MESSAGE___0_15WriteRegister32);\
9523 -    __raw_writel(newValue, ((baseAddress))+offset);\
9524 -}
9525 -
9526 -
9527 -#define MLBMAILBOX_FIFOSTATUS___0_15ReadRegister32(baseAddress, bank)\
9528 -    (_DEBUG_LEVEL_1_EASI(\
9529 -      EASIL1_MLBMAILBOX_FIFOSTATUS___0_15ReadRegister32),\
9530 -      __raw_readl(((u32)(baseAddress))+\
9531 -      (MLB_MAILBOX_FIFOSTATUS___REGSET_0_15_OFFSET +\
9532 -      MLB_MAILBOX_FIFOSTATUS___0_15_OFFSET+\
9533 -      ((bank)*MLB_MAILBOX_FIFOSTATUS___REGSET_0_15_STEP))))
9534 -
9535 -
9536 -#define MLBMAILBOX_FIFOSTATUS___0_15FifoFullMBmRead32(baseAddress, bank)\
9537 -    (_DEBUG_LEVEL_1_EASI(\
9538 -      EASIL1_MLBMAILBOX_FIFOSTATUS___0_15FifoFullMBmRead32),\
9539 -      (((__raw_readl(((baseAddress))+\
9540 -      (MLB_MAILBOX_FIFOSTATUS___REGSET_0_15_OFFSET +\
9541 -      MLB_MAILBOX_FIFOSTATUS___0_15_OFFSET+\
9542 -      ((bank)*MLB_MAILBOX_FIFOSTATUS___REGSET_0_15_STEP)))) &\
9543 -      MLB_MAILBOX_FIFOSTATUS___0_15_FifoFullMBm_MASK) >>\
9544 -      MLB_MAILBOX_FIFOSTATUS___0_15_FifoFullMBm_OFFSET))
9545 -
9546 -
9547 -#define MLBMAILBOX_MSGSTATUS___0_15NbOfMsgMBmRead32(baseAddress, bank)\
9548 -    (_DEBUG_LEVEL_1_EASI(\
9549 -      EASIL1_MLBMAILBOX_MSGSTATUS___0_15NbOfMsgMBmRead32),\
9550 -      (((__raw_readl(((baseAddress))+\
9551 -      (MLB_MAILBOX_MSGSTATUS___REGSET_0_15_OFFSET +\
9552 -      MLB_MAILBOX_MSGSTATUS___0_15_OFFSET+\
9553 -      ((bank)*MLB_MAILBOX_MSGSTATUS___REGSET_0_15_STEP)))) &\
9554 -      MLB_MAILBOX_MSGSTATUS___0_15_NbOfMsgMBm_MASK) >>\
9555 -      MLB_MAILBOX_MSGSTATUS___0_15_NbOfMsgMBm_OFFSET))
9556 -
9557 -
9558 -#define MLBMAILBOX_IRQSTATUS___0_3ReadRegister32(baseAddress, bank)\
9559 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_IRQSTATUS___0_3ReadRegister32),\
9560 -      __raw_readl(((baseAddress))+\
9561 -      (MLB_MAILBOX_IRQSTATUS___REGSET_0_3_OFFSET +\
9562 -      MLB_MAILBOX_IRQSTATUS___0_3_OFFSET+\
9563 -      ((bank)*MLB_MAILBOX_IRQSTATUS___REGSET_0_3_STEP))))
9564 -
9565 -
9566 -#define MLBMAILBOX_IRQSTATUS___0_3WriteRegister32(baseAddress, bank, value)\
9567 -{\
9568 -    const u32 offset = MLB_MAILBOX_IRQSTATUS___REGSET_0_3_OFFSET +\
9569 -    MLB_MAILBOX_IRQSTATUS___0_3_OFFSET +\
9570 -    ((bank)*MLB_MAILBOX_IRQSTATUS___REGSET_0_3_STEP);\
9571 -    register u32 newValue = ((u32)(value));\
9572 -    _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_IRQSTATUS___0_3WriteRegister32);\
9573 -    __raw_writel(newValue, ((baseAddress))+offset);\
9574 -}
9575 -
9576 -
9577 -#define MLBMAILBOX_IRQENABLE___0_3ReadRegister32(baseAddress, bank)\
9578 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_IRQENABLE___0_3ReadRegister32),\
9579 -      __raw_readl(((baseAddress))+\
9580 -      (MLB_MAILBOX_IRQENABLE___REGSET_0_3_OFFSET +\
9581 -      MLB_MAILBOX_IRQENABLE___0_3_OFFSET+\
9582 -       ((bank)*MLB_MAILBOX_IRQENABLE___REGSET_0_3_STEP))))
9583 -
9584 -
9585 -#define MLBMAILBOX_IRQENABLE___0_3WriteRegister32(baseAddress, bank, value)\
9586 -{\
9587 -    const u32 offset = MLB_MAILBOX_IRQENABLE___REGSET_0_3_OFFSET +\
9588 -      MLB_MAILBOX_IRQENABLE___0_3_OFFSET +\
9589 -      ((bank)*MLB_MAILBOX_IRQENABLE___REGSET_0_3_STEP);\
9590 -    register u32 newValue = ((u32)(value));\
9591 -    _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_IRQENABLE___0_3WriteRegister32);\
9592 -    __raw_writel(newValue, ((baseAddress))+offset);\
9593 -}
9594 -
9595 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSSTATUSResetDoneRead32), \
9596 +       (((__raw_readl((((u32)(baseAddress)) +                            \
9597 +       (MLB_MAILBOX_SYSSTATUS_OFFSET)))) &                               \
9598 +       MLB_MAILBOX_SYSSTATUS_ResetDone_MASK) >>                          \
9599 +       MLB_MAILBOX_SYSSTATUS_ResetDone_OFFSET))
9600 +
9601 +#define MLBMAILBOX_MESSAGE___0_15ReadRegister32(baseAddress, bank)           \
9602 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_MESSAGE___0_15ReadRegister32), \
9603 +       __raw_readl(((baseAddress)) +                                         \
9604 +       (MLB_MAILBOX_MESSAGE___REGSET_0_15_OFFSET +                           \
9605 +       MLB_MAILBOX_MESSAGE___0_15_OFFSET +                                   \
9606 +       ((bank) * MLB_MAILBOX_MESSAGE___REGSET_0_15_STEP))))
9607 +
9608 +#define MLBMAILBOX_MESSAGE___0_15WriteRegister32(baseAddress, bank, value)    \
9609 +do {                                                                         \
9610 +       const u32 offset = MLB_MAILBOX_MESSAGE___REGSET_0_15_OFFSET +         \
9611 +       MLB_MAILBOX_MESSAGE___0_15_OFFSET +                                   \
9612 +       ((bank) * MLB_MAILBOX_MESSAGE___REGSET_0_15_STEP);                    \
9613 +       register u32 newValue = ((u32)(value));                               \
9614 +       _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_MESSAGE___0_15WriteRegister32); \
9615 +       __raw_writel(newValue, ((baseAddress)) + offset);                     \
9616 +} while (0)
9617 +
9618 +#define MLBMAILBOX_FIFOSTATUS___0_15ReadRegister32(baseAddress, bank)  \
9619 +       (_DEBUG_LEVEL_1_EASI                                            \
9620 +       (EASIL1_MLBMAILBOX_FIFOSTATUS___0_15ReadRegister32),            \
9621 +       __raw_readl(((u32)(baseAddress)) +                              \
9622 +       (MLB_MAILBOX_FIFOSTATUS___REGSET_0_15_OFFSET +                  \
9623 +       MLB_MAILBOX_FIFOSTATUS___0_15_OFFSET +                          \
9624 +       ((bank) * MLB_MAILBOX_FIFOSTATUS___REGSET_0_15_STEP))))
9625 +
9626 +#define MLBMAILBOX_FIFOSTATUS___0_15FifoFullMBmRead32(baseAddress, bank) \
9627 +       (_DEBUG_LEVEL_1_EASI(                                            \
9628 +       EASIL1_MLBMAILBOX_FIFOSTATUS___0_15FifoFullMBmRead32),           \
9629 +       (((__raw_readl(((baseAddress)) +                                 \
9630 +       (MLB_MAILBOX_FIFOSTATUS___REGSET_0_15_OFFSET +                   \
9631 +       MLB_MAILBOX_FIFOSTATUS___0_15_OFFSET +                           \
9632 +       ((bank) * MLB_MAILBOX_FIFOSTATUS___REGSET_0_15_STEP)))) &        \
9633 +       MLB_MAILBOX_FIFOSTATUS___0_15_FifoFullMBm_MASK) >>               \
9634 +       MLB_MAILBOX_FIFOSTATUS___0_15_FifoFullMBm_OFFSET))
9635 +
9636 +#define MLBMAILBOX_MSGSTATUS___0_15NbOfMsgMBmRead32(baseAddress, bank) \
9637 +       (_DEBUG_LEVEL_1_EASI(                                           \
9638 +       EASIL1_MLBMAILBOX_MSGSTATUS___0_15NbOfMsgMBmRead32),            \
9639 +       (((__raw_readl(((baseAddress)) +                                \
9640 +       (MLB_MAILBOX_MSGSTATUS___REGSET_0_15_OFFSET +                   \
9641 +       MLB_MAILBOX_MSGSTATUS___0_15_OFFSET +                           \
9642 +       ((bank) * MLB_MAILBOX_MSGSTATUS___REGSET_0_15_STEP)))) &        \
9643 +       MLB_MAILBOX_MSGSTATUS___0_15_NbOfMsgMBm_MASK) >>                \
9644 +       MLB_MAILBOX_MSGSTATUS___0_15_NbOfMsgMBm_OFFSET))
9645 +
9646 +#define MLBMAILBOX_IRQSTATUS___0_3ReadRegister32(baseAddress, bank)           \
9647 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_IRQSTATUS___0_3ReadRegister32), \
9648 +       __raw_readl(((baseAddress)) +                                          \
9649 +       (MLB_MAILBOX_IRQSTATUS___REGSET_0_3_OFFSET +                           \
9650 +       MLB_MAILBOX_IRQSTATUS___0_3_OFFSET +                                   \
9651 +       ((bank) * MLB_MAILBOX_IRQSTATUS___REGSET_0_3_STEP))))
9652 +
9653 +#define MLBMAILBOX_IRQSTATUS___0_3WriteRegister32(baseAddress, bank, value)    \
9654 +do {                                                                          \
9655 +       const u32 offset = MLB_MAILBOX_IRQSTATUS___REGSET_0_3_OFFSET +         \
9656 +       MLB_MAILBOX_IRQSTATUS___0_3_OFFSET +                                   \
9657 +       ((bank) * MLB_MAILBOX_IRQSTATUS___REGSET_0_3_STEP);                    \
9658 +       register u32 newValue = ((u32)(value));                                \
9659 +       _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_IRQSTATUS___0_3WriteRegister32); \
9660 +       __raw_writel(newValue, ((baseAddress)) + offset);                      \
9661 +} while (0)
9662 +
9663 +#define MLBMAILBOX_IRQENABLE___0_3ReadRegister32(baseAddress, bank)           \
9664 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_IRQENABLE___0_3ReadRegister32), \
9665 +       __raw_readl(((baseAddress)) +                                          \
9666 +       (MLB_MAILBOX_IRQENABLE___REGSET_0_3_OFFSET +                           \
9667 +       MLB_MAILBOX_IRQENABLE___0_3_OFFSET +                                   \
9668 +       ((bank) * MLB_MAILBOX_IRQENABLE___REGSET_0_3_STEP))))
9669 +
9670 +
9671 +#define MLBMAILBOX_IRQENABLE___0_3WriteRegister32(baseAddress, bank, value)    \
9672 +do {                                                                          \
9673 +       const u32 offset = MLB_MAILBOX_IRQENABLE___REGSET_0_3_OFFSET +         \
9674 +       MLB_MAILBOX_IRQENABLE___0_3_OFFSET +                                   \
9675 +       ((bank)*MLB_MAILBOX_IRQENABLE___REGSET_0_3_STEP);                      \
9676 +       register u32 newValue = ((u32)(value));                                \
9677 +       _DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_IRQENABLE___0_3WriteRegister32); \
9678 +       __raw_writel(newValue, ((baseAddress)) + offset);                      \
9679 +} while (0)
9680  
9681  #endif /* USE_LEVEL_1_MACROS */
9682  
9683 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/MMURegAcM.h kernel-power-2.6.28/drivers/dsp/bridge/hw/MMURegAcM.h
9684 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/MMURegAcM.h  2011-04-17 17:32:26.000000000 +0100
9685 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/MMURegAcM.h       2011-05-02 22:36:49.000000000 +0100
9686 @@ -14,7 +14,6 @@
9687   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9688   */
9689  
9690 -
9691  #ifndef _MMU_REG_ACM_H
9692  #define _MMU_REG_ACM_H
9693  
9694 @@ -26,227 +25,200 @@
9695  
9696  #if defined(USE_LEVEL_1_MACROS)
9697  
9698 -
9699 -#define MMUMMU_SYSCONFIGReadRegister32(baseAddress)\
9700 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_SYSCONFIGReadRegister32),\
9701 -      __raw_readl((baseAddress)+MMU_MMU_SYSCONFIG_OFFSET))
9702 -
9703 -
9704 -#define MMUMMU_SYSCONFIGIdleModeWrite32(baseAddress, value)\
9705 -{\
9706 -    const u32 offset = MMU_MMU_SYSCONFIG_OFFSET;\
9707 -    register u32 data = __raw_readl((baseAddress)+offset);\
9708 -    register u32 newValue = (value);\
9709 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_SYSCONFIGIdleModeWrite32);\
9710 -    data &= ~(MMU_MMU_SYSCONFIG_IdleMode_MASK);\
9711 -    newValue <<= MMU_MMU_SYSCONFIG_IdleMode_OFFSET;\
9712 -    newValue &= MMU_MMU_SYSCONFIG_IdleMode_MASK;\
9713 -    newValue |= data;\
9714 -    __raw_writel(newValue, baseAddress+offset);\
9715 -}
9716 -
9717 -
9718 -#define MMUMMU_SYSCONFIGAutoIdleWrite32(baseAddress, value)\
9719 -{\
9720 -    const u32 offset = MMU_MMU_SYSCONFIG_OFFSET;\
9721 -    register u32 data = __raw_readl((baseAddress)+offset);\
9722 -    register u32 newValue = (value);\
9723 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_SYSCONFIGAutoIdleWrite32);\
9724 -    data &= ~(MMU_MMU_SYSCONFIG_AutoIdle_MASK);\
9725 -    newValue <<= MMU_MMU_SYSCONFIG_AutoIdle_OFFSET;\
9726 -    newValue &= MMU_MMU_SYSCONFIG_AutoIdle_MASK;\
9727 -    newValue |= data;\
9728 -    __raw_writel(newValue, baseAddress+offset);\
9729 -}
9730 -
9731 -
9732 -#define MMUMMU_IRQSTATUSReadRegister32(baseAddress)\
9733 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQSTATUSReadRegister32),\
9734 -      __raw_readl((baseAddress)+MMU_MMU_IRQSTATUS_OFFSET))
9735 -
9736 -
9737 -#define MMUMMU_IRQSTATUSWriteRegister32(baseAddress, value)\
9738 -{\
9739 -    const u32 offset = MMU_MMU_IRQSTATUS_OFFSET;\
9740 -    register u32 newValue = (value);\
9741 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQSTATUSWriteRegister32);\
9742 -    __raw_writel(newValue, (baseAddress)+offset);\
9743 -}
9744 -
9745 -
9746 -#define MMUMMU_IRQENABLEReadRegister32(baseAddress)\
9747 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQENABLEReadRegister32),\
9748 -      __raw_readl((baseAddress)+MMU_MMU_IRQENABLE_OFFSET))
9749 -
9750 -
9751 -#define MMUMMU_IRQENABLEWriteRegister32(baseAddress, value)\
9752 -{\
9753 -    const u32 offset = MMU_MMU_IRQENABLE_OFFSET;\
9754 -    register u32 newValue = (value);\
9755 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQENABLEWriteRegister32);\
9756 -    __raw_writel(newValue, (baseAddress)+offset);\
9757 -}
9758 -
9759 -
9760 -#define MMUMMU_WALKING_STTWLRunningRead32(baseAddress)\
9761 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_WALKING_STTWLRunningRead32),\
9762 -      (((__raw_readl(((baseAddress)+(MMU_MMU_WALKING_ST_OFFSET))))\
9763 -      & MMU_MMU_WALKING_ST_TWLRunning_MASK) >>\
9764 -      MMU_MMU_WALKING_ST_TWLRunning_OFFSET))
9765 -
9766 -
9767 -#define MMUMMU_CNTLTWLEnableRead32(baseAddress)\
9768 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_CNTLTWLEnableRead32),\
9769 -      (((__raw_readl(((baseAddress)+(MMU_MMU_CNTL_OFFSET)))) &\
9770 -      MMU_MMU_CNTL_TWLEnable_MASK) >>\
9771 -      MMU_MMU_CNTL_TWLEnable_OFFSET))
9772 -
9773 -
9774 -#define MMUMMU_CNTLTWLEnableWrite32(baseAddress, value)\
9775 -{\
9776 -    const u32 offset = MMU_MMU_CNTL_OFFSET;\
9777 -    register u32 data = __raw_readl((baseAddress)+offset);\
9778 -    register u32 newValue = (value);\
9779 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_CNTLTWLEnableWrite32);\
9780 -    data &= ~(MMU_MMU_CNTL_TWLEnable_MASK);\
9781 -    newValue <<= MMU_MMU_CNTL_TWLEnable_OFFSET;\
9782 -    newValue &= MMU_MMU_CNTL_TWLEnable_MASK;\
9783 -    newValue |= data;\
9784 -    __raw_writel(newValue, baseAddress+offset);\
9785 -}
9786 -
9787 -
9788 -#define MMUMMU_CNTLMMUEnableWrite32(baseAddress, value)\
9789 -{\
9790 -    const u32 offset = MMU_MMU_CNTL_OFFSET;\
9791 -    register u32 data = __raw_readl((baseAddress)+offset);\
9792 -    register u32 newValue = (value);\
9793 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_CNTLMMUEnableWrite32);\
9794 -    data &= ~(MMU_MMU_CNTL_MMUEnable_MASK);\
9795 -    newValue <<= MMU_MMU_CNTL_MMUEnable_OFFSET;\
9796 -    newValue &= MMU_MMU_CNTL_MMUEnable_MASK;\
9797 -    newValue |= data;\
9798 -    __raw_writel(newValue, baseAddress+offset);\
9799 -}
9800 -
9801 -
9802 -#define MMUMMU_FAULT_ADReadRegister32(baseAddress)\
9803 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_FAULT_ADReadRegister32),\
9804 -      __raw_readl((baseAddress)+MMU_MMU_FAULT_AD_OFFSET))
9805 -
9806 -
9807 -#define MMUMMU_TTBWriteRegister32(baseAddress, value)\
9808 -{\
9809 -    const u32 offset = MMU_MMU_TTB_OFFSET;\
9810 -    register u32 newValue = (value);\
9811 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_TTBWriteRegister32);\
9812 -    __raw_writel(newValue, (baseAddress)+offset);\
9813 -}
9814 -
9815 -
9816 -#define MMUMMU_LOCKReadRegister32(baseAddress)\
9817 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKReadRegister32),\
9818 -      __raw_readl((baseAddress)+MMU_MMU_LOCK_OFFSET))
9819 -
9820 -
9821 -#define MMUMMU_LOCKWriteRegister32(baseAddress, value)\
9822 -{\
9823 -    const u32 offset = MMU_MMU_LOCK_OFFSET;\
9824 -    register u32 newValue = (value);\
9825 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKWriteRegister32);\
9826 -    __raw_writel(newValue, (baseAddress)+offset);\
9827 -}
9828 -
9829 -
9830 -#define MMUMMU_LOCKBaseValueRead32(baseAddress)\
9831 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKBaseValueRead32),\
9832 -      (((__raw_readl(((baseAddress)+(MMU_MMU_LOCK_OFFSET)))) &\
9833 -      MMU_MMU_LOCK_BaseValue_MASK) >>\
9834 -      MMU_MMU_LOCK_BaseValue_OFFSET))
9835 -
9836 -
9837 -#define MMUMMU_LOCKBaseValueWrite32(baseAddress, value)\
9838 -{\
9839 -    const u32 offset = MMU_MMU_LOCK_OFFSET;\
9840 -    register u32 data = __raw_readl((baseAddress)+offset);\
9841 -    register u32 newValue = (value);\
9842 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKBaseValueWrite32);\
9843 -    data &= ~(MMU_MMU_LOCK_BaseValue_MASK);\
9844 -    newValue <<= MMU_MMU_LOCK_BaseValue_OFFSET;\
9845 -    newValue &= MMU_MMU_LOCK_BaseValue_MASK;\
9846 -    newValue |= data;\
9847 -    __raw_writel(newValue, baseAddress+offset);\
9848 -}
9849 -
9850 -
9851 -#define MMUMMU_LOCKCurrentVictimRead32(baseAddress)\
9852 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKCurrentVictimRead32),\
9853 -      (((__raw_readl(((baseAddress)+(MMU_MMU_LOCK_OFFSET)))) &\
9854 -      MMU_MMU_LOCK_CurrentVictim_MASK) >>\
9855 -      MMU_MMU_LOCK_CurrentVictim_OFFSET))
9856 -
9857 -
9858 -#define MMUMMU_LOCKCurrentVictimWrite32(baseAddress, value)\
9859 -{\
9860 -    const u32 offset = MMU_MMU_LOCK_OFFSET;\
9861 -    register u32 data = __raw_readl((baseAddress)+offset);\
9862 -    register u32 newValue = (value);\
9863 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKCurrentVictimWrite32);\
9864 -    data &= ~(MMU_MMU_LOCK_CurrentVictim_MASK);\
9865 -    newValue <<= MMU_MMU_LOCK_CurrentVictim_OFFSET;\
9866 -    newValue &= MMU_MMU_LOCK_CurrentVictim_MASK;\
9867 -    newValue |= data;\
9868 -    __raw_writel(newValue, baseAddress+offset);\
9869 -}
9870 -
9871 -
9872 -#define MMUMMU_LOCKCurrentVictimSet32(var, value)\
9873 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKCurrentVictimSet32),\
9874 -      (((var) & ~(MMU_MMU_LOCK_CurrentVictim_MASK)) |\
9875 -      (((value) << MMU_MMU_LOCK_CurrentVictim_OFFSET) &\
9876 -      MMU_MMU_LOCK_CurrentVictim_MASK)))
9877 -
9878 -
9879 -#define MMUMMU_LD_TLBReadRegister32(baseAddress)\
9880 -    (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LD_TLBReadRegister32),\
9881 -      __raw_readl((baseAddress)+MMU_MMU_LD_TLB_OFFSET))
9882 -
9883 -
9884 -#define MMUMMU_LD_TLBWriteRegister32(baseAddress, value)\
9885 -{\
9886 -    const u32 offset = MMU_MMU_LD_TLB_OFFSET;\
9887 -    register u32 newValue = (value);\
9888 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LD_TLBWriteRegister32);\
9889 -    __raw_writel(newValue, (baseAddress)+offset);\
9890 -}
9891 -
9892 -
9893 -#define MMUMMU_CAMWriteRegister32(baseAddress, value)\
9894 -{\
9895 -    const u32 offset = MMU_MMU_CAM_OFFSET;\
9896 -    register u32 newValue = (value);\
9897 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_CAMWriteRegister32);\
9898 -    __raw_writel(newValue, (baseAddress)+offset);\
9899 -}
9900 -
9901 -
9902 -#define MMUMMU_RAMWriteRegister32(baseAddress, value)\
9903 -{\
9904 -    const u32 offset = MMU_MMU_RAM_OFFSET;\
9905 -    register u32 newValue = (value);\
9906 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_RAMWriteRegister32);\
9907 -    __raw_writel(newValue, (baseAddress)+offset);\
9908 -}
9909 -
9910 -
9911 -#define MMUMMU_FLUSH_ENTRYWriteRegister32(baseAddress, value)\
9912 -{\
9913 -    const u32 offset = MMU_MMU_FLUSH_ENTRY_OFFSET;\
9914 -    register u32 newValue = (value);\
9915 -    _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_FLUSH_ENTRYWriteRegister32);\
9916 -    __raw_writel(newValue, (baseAddress)+offset);\
9917 -}
9918 -
9919 +#define MMUMMU_SYSCONFIGReadRegister32(baseAddress)                    \
9920 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_SYSCONFIGReadRegister32),    \
9921 +       __raw_readl((baseAddress) + MMU_MMU_SYSCONFIG_OFFSET))
9922 +
9923 +#define MMUMMU_SYSCONFIGIdleModeWrite32(baseAddress, value)            \
9924 +do {                                                                   \
9925 +       const u32 offset = MMU_MMU_SYSCONFIG_OFFSET;                    \
9926 +       register u32 data = __raw_readl((baseAddress) + offset);        \
9927 +       register u32 newValue = (value);                                \
9928 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_SYSCONFIGIdleModeWrite32);    \
9929 +       data &= ~(MMU_MMU_SYSCONFIG_IdleMode_MASK);                     \
9930 +       newValue <<= MMU_MMU_SYSCONFIG_IdleMode_OFFSET;                 \
9931 +       newValue &= MMU_MMU_SYSCONFIG_IdleMode_MASK;                    \
9932 +       newValue |= data;                                               \
9933 +       __raw_writel(newValue, baseAddress + offset);                   \
9934 +} while (0)
9935 +
9936 +#define MMUMMU_SYSCONFIGAutoIdleWrite32(baseAddress, value)            \
9937 +do {                                                                   \
9938 +       const u32 offset = MMU_MMU_SYSCONFIG_OFFSET;                    \
9939 +       register u32 data = __raw_readl((baseAddress) + offset);        \
9940 +       register u32 newValue = (value);                                \
9941 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_SYSCONFIGAutoIdleWrite32);    \
9942 +       data &= ~(MMU_MMU_SYSCONFIG_AutoIdle_MASK);                     \
9943 +       newValue <<= MMU_MMU_SYSCONFIG_AutoIdle_OFFSET;                 \
9944 +       newValue &= MMU_MMU_SYSCONFIG_AutoIdle_MASK;                    \
9945 +       newValue |= data;                                               \
9946 +       __raw_writel(newValue, baseAddress + offset);                   \
9947 +} while (0)
9948 +
9949 +#define MMUMMU_IRQSTATUSReadRegister32(baseAddress)                    \
9950 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQSTATUSReadRegister32),    \
9951 +       __raw_readl((baseAddress) + MMU_MMU_IRQSTATUS_OFFSET))
9952 +
9953 +#define MMUMMU_IRQSTATUSWriteRegister32(baseAddress, value)            \
9954 +do {                                                                   \
9955 +       const u32 offset = MMU_MMU_IRQSTATUS_OFFSET;                    \
9956 +       register u32 newValue = (value);                                \
9957 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQSTATUSWriteRegister32);    \
9958 +       __raw_writel(newValue, (baseAddress) + offset);                 \
9959 +} while (0)
9960 +
9961 +#define MMUMMU_IRQENABLEReadRegister32(baseAddress)                    \
9962 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQENABLEReadRegister32),    \
9963 +       __raw_readl((baseAddress) + MMU_MMU_IRQENABLE_OFFSET))
9964 +
9965 +#define MMUMMU_IRQENABLEWriteRegister32(baseAddress, value)            \
9966 +do {                                                                   \
9967 +       const u32 offset = MMU_MMU_IRQENABLE_OFFSET;                    \
9968 +       register u32 newValue = (value);                                \
9969 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQENABLEWriteRegister32);    \
9970 +       __raw_writel(newValue, (baseAddress) + offset);                 \
9971 +} while (0)
9972 +
9973 +#define MMUMMU_WALKING_STTWLRunningRead32(baseAddress)                 \
9974 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_WALKING_STTWLRunningRead32), \
9975 +       (((__raw_readl(((baseAddress) + (MMU_MMU_WALKING_ST_OFFSET))))  \
9976 +       & MMU_MMU_WALKING_ST_TWLRunning_MASK) >>                        \
9977 +       MMU_MMU_WALKING_ST_TWLRunning_OFFSET))
9978 +
9979 +#define MMUMMU_CNTLTWLEnableRead32(baseAddress)                                \
9980 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_CNTLTWLEnableRead32),        \
9981 +       (((__raw_readl(((baseAddress)+(MMU_MMU_CNTL_OFFSET)))) &        \
9982 +       MMU_MMU_CNTL_TWLEnable_MASK) >>                                 \
9983 +       MMU_MMU_CNTL_TWLEnable_OFFSET))
9984 +
9985 +#define MMUMMU_CNTLTWLEnableWrite32(baseAddress, value)                        \
9986 +do {                                                                   \
9987 +       const u32 offset = MMU_MMU_CNTL_OFFSET;                         \
9988 +       register u32 data = __raw_readl((baseAddress) + offset);        \
9989 +       register u32 newValue = (value);                                \
9990 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_CNTLTWLEnableWrite32);        \
9991 +       data &= ~(MMU_MMU_CNTL_TWLEnable_MASK);                         \
9992 +       newValue <<= MMU_MMU_CNTL_TWLEnable_OFFSET;                     \
9993 +       newValue &= MMU_MMU_CNTL_TWLEnable_MASK;                        \
9994 +       newValue |= data;                                               \
9995 +       __raw_writel(newValue, baseAddress+offset);                     \
9996 +} while (0)
9997 +
9998 +#define MMUMMU_CNTLMMUEnableWrite32(baseAddress, value)                        \
9999 +do {                                                                   \
10000 +       const u32 offset = MMU_MMU_CNTL_OFFSET;                         \
10001 +       register u32 data = __raw_readl((baseAddress) + offset);        \
10002 +       register u32 newValue = (value);                                \
10003 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_CNTLMMUEnableWrite32);        \
10004 +       data &= ~(MMU_MMU_CNTL_MMUEnable_MASK);                         \
10005 +       newValue <<= MMU_MMU_CNTL_MMUEnable_OFFSET;                     \
10006 +       newValue &= MMU_MMU_CNTL_MMUEnable_MASK;                        \
10007 +       newValue |= data;                                               \
10008 +       __raw_writel(newValue, baseAddress + offset);                   \
10009 +} while (0)
10010 +
10011 +#define MMUMMU_FAULT_ADReadRegister32(baseAddress)                     \
10012 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_FAULT_ADReadRegister32),     \
10013 +       __raw_readl((baseAddress) + MMU_MMU_FAULT_AD_OFFSET))
10014 +
10015 +#define MMUMMU_TTBWriteRegister32(baseAddress, value)                  \
10016 +do {                                                                   \
10017 +       const u32 offset = MMU_MMU_TTB_OFFSET;                          \
10018 +       register u32 newValue = (value);                                \
10019 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_TTBWriteRegister32);          \
10020 +       __raw_writel(newValue, (baseAddress) + offset);                 \
10021 +} while (0)
10022 +
10023 +#define MMUMMU_LOCKReadRegister32(baseAddress)                         \
10024 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKReadRegister32),         \
10025 +       __raw_readl((baseAddress) + MMU_MMU_LOCK_OFFSET))
10026 +
10027 +#define MMUMMU_LOCKWriteRegister32(baseAddress, value)                 \
10028 +do {                                                                   \
10029 +       const u32 offset = MMU_MMU_LOCK_OFFSET;                         \
10030 +       register u32 newValue = (value);                                \
10031 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKWriteRegister32);         \
10032 +       __raw_writel(newValue, (baseAddress) + offset);                 \
10033 +} while (0)
10034 +
10035 +#define MMUMMU_LOCKBaseValueRead32(baseAddress)                                \
10036 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKBaseValueRead32),        \
10037 +       (((__raw_readl(((baseAddress) + (MMU_MMU_LOCK_OFFSET)))) &      \
10038 +       MMU_MMU_LOCK_BaseValue_MASK) >> MMU_MMU_LOCK_BaseValue_OFFSET)) \
10039 +
10040 +#define MMUMMU_LOCKBaseValueWrite32(baseAddress, value)                        \
10041 +do {                                                                   \
10042 +       const u32 offset = MMU_MMU_LOCK_OFFSET;                         \
10043 +       register u32 data = __raw_readl((baseAddress) + offset);        \
10044 +       register u32 newValue = (value);                                \
10045 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKBaseValueWrite32);        \
10046 +       data &= ~(MMU_MMU_LOCK_BaseValue_MASK);                         \
10047 +       newValue <<= MMU_MMU_LOCK_BaseValue_OFFSET;                     \
10048 +       newValue &= MMU_MMU_LOCK_BaseValue_MASK;                        \
10049 +       newValue |= data;                                               \
10050 +       __raw_writel(newValue, baseAddress+offset);                     \
10051 +} while (0)
10052 +
10053 +#define MMUMMU_LOCKCurrentVictimRead32(baseAddress)                    \
10054 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKCurrentVictimRead32),    \
10055 +       (((__raw_readl(((baseAddress) + (MMU_MMU_LOCK_OFFSET)))) &      \
10056 +       MMU_MMU_LOCK_CurrentVictim_MASK) >>                             \
10057 +       MMU_MMU_LOCK_CurrentVictim_OFFSET))
10058 +
10059 +#define MMUMMU_LOCKCurrentVictimWrite32(baseAddress, value)            \
10060 +do {                                                                   \
10061 +       const u32 offset = MMU_MMU_LOCK_OFFSET;                         \
10062 +       register u32 data = __raw_readl((baseAddress) + offset);        \
10063 +       register u32 newValue = (value);                                \
10064 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKCurrentVictimWrite32);    \
10065 +       data &= ~(MMU_MMU_LOCK_CurrentVictim_MASK);                     \
10066 +       newValue <<= MMU_MMU_LOCK_CurrentVictim_OFFSET;                 \
10067 +       newValue &= MMU_MMU_LOCK_CurrentVictim_MASK;                    \
10068 +       newValue |= data;                                               \
10069 +       __raw_writel(newValue, baseAddress + offset);                   \
10070 +} while (0)
10071 +
10072 +#define MMUMMU_LOCKCurrentVictimSet32(var, value)                      \
10073 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKCurrentVictimSet32),     \
10074 +       (((var) & ~(MMU_MMU_LOCK_CurrentVictim_MASK)) |                 \
10075 +       (((value) << MMU_MMU_LOCK_CurrentVictim_OFFSET) &               \
10076 +       MMU_MMU_LOCK_CurrentVictim_MASK)))
10077 +
10078 +#define MMUMMU_LD_TLBReadRegister32(baseAddress)                       \
10079 +       (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LD_TLBReadRegister32),       \
10080 +       __raw_readl((baseAddress) + MMU_MMU_LD_TLB_OFFSET))
10081 +
10082 +#define MMUMMU_LD_TLBWriteRegister32(baseAddress, value)               \
10083 +do {                                                                   \
10084 +       const u32 offset = MMU_MMU_LD_TLB_OFFSET;                       \
10085 +       register u32 newValue = (value);                                \
10086 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LD_TLBWriteRegister32);       \
10087 +       __raw_writel(newValue, (baseAddress) + offset);                 \
10088 +} while (0)
10089 +
10090 +#define MMUMMU_CAMWriteRegister32(baseAddress, value)                  \
10091 +do {                                                                   \
10092 +       const u32 offset = MMU_MMU_CAM_OFFSET;                          \
10093 +       register u32 newValue = (value);                                \
10094 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_CAMWriteRegister32);          \
10095 +       __raw_writel(newValue, (baseAddress) + offset);                 \
10096 +} while (0)
10097 +
10098 +#define MMUMMU_RAMWriteRegister32(baseAddress, value)                  \
10099 +do {                                                                   \
10100 +       const u32 offset = MMU_MMU_RAM_OFFSET;                          \
10101 +       register u32 newValue = (value);                                \
10102 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_RAMWriteRegister32);          \
10103 +       __raw_writel(newValue, (baseAddress) + offset);                 \
10104 +} while (0)
10105 +
10106 +#define MMUMMU_FLUSH_ENTRYWriteRegister32(baseAddress, value)          \
10107 +do {                                                                   \
10108 +       const u32 offset = MMU_MMU_FLUSH_ENTRY_OFFSET;                  \
10109 +       register u32 newValue = (value);                                \
10110 +       _DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_FLUSH_ENTRYWriteRegister32);  \
10111 +       __raw_writel(newValue, (baseAddress) + offset);                 \
10112 +} while (0)
10113  
10114  #endif /* USE_LEVEL_1_MACROS */
10115  
10116 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/PRCMRegAcM.h kernel-power-2.6.28/drivers/dsp/bridge/hw/PRCMRegAcM.h
10117 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/PRCMRegAcM.h 2011-04-17 17:32:26.000000000 +0100
10118 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/PRCMRegAcM.h      2011-05-02 22:36:49.000000000 +0100
10119 @@ -26,644 +26,575 @@
10120  
10121  #if defined(USE_LEVEL_1_MACROS)
10122  
10123 -#define PRCMPRCM_CLKCFG_CTRLValid_configWriteClk_valid32(baseAddress)\
10124 -{\
10125 -    const u32 offset = PRCM_PRCM_CLKCFG_CTRL_OFFSET;\
10126 -    const u32 newValue = \
10127 -       (u32)PRCMPRCM_CLKCFG_CTRLValid_configClk_valid <<\
10128 -      PRCM_PRCM_CLKCFG_CTRL_Valid_config_OFFSET;\
10129 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10130 -    _DEBUG_LEVEL_1_EASI(\
10131 -      EASIL1_PRCMPRCM_CLKCFG_CTRLValid_configWriteClk_valid32);\
10132 -    data &= ~(PRCM_PRCM_CLKCFG_CTRL_Valid_config_MASK);\
10133 -    data |= newValue;\
10134 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10135 -}
10136 -
10137 -
10138 -#define CM_FCLKEN_PERReadRegister32(baseAddress)\
10139 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32),\
10140 -      __raw_readl(((u32)(baseAddress))+CM_FCLKEN_PER_OFFSET))
10141 -
10142 -
10143 -#define CM_ICLKEN_PERReadRegister32(baseAddress)\
10144 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32),\
10145 -      __raw_readl(((u32)(baseAddress))+CM_ICLKEN_PER_OFFSET))
10146 -
10147 -
10148 -#define CM_FCLKEN_PER_GPT5WriteRegister32(baseAddress,value)\
10149 -{\
10150 -    const u32 offset = CM_FCLKEN_PER_OFFSET;\
10151 -    register u32 data = \
10152 -       __raw_readl(((u32)(baseAddress))+offset);\
10153 -    register u32 newValue = ((u32)(value));\
10154 -    _DEBUG_LEVEL_1_EASI(EASIL1_CM_FCLKEN_PER_GPT5WriteRegister32);\
10155 -   data &= ~(CM_FCLKEN_PER_GPT5_MASK);\
10156 -   newValue <<= CM_FCLKEN_PER_GPT5_OFFSET;\
10157 -   newValue &= CM_FCLKEN_PER_GPT5_MASK;\
10158 -   newValue |= data;\
10159 -    __raw_writel(newValue, ((u32)(baseAddress))+offset);\
10160 -}
10161 -
10162 -
10163 -#define CM_FCLKEN_PER_GPT6WriteRegister32(baseAddress,value)\
10164 -{\
10165 -    const u32 offset = CM_FCLKEN_PER_OFFSET;\
10166 -    register u32 data =\
10167 -       __raw_readl(((u32)(baseAddress))+offset);\
10168 -    register u32 newValue = ((u32)(value));\
10169 -    _DEBUG_LEVEL_1_EASI(EASIL1_CM_FCLKEN_PER_GPT5WriteRegister32);\
10170 -   data &= ~(CM_FCLKEN_PER_GPT6_MASK);\
10171 -   newValue <<= CM_FCLKEN_PER_GPT6_OFFSET;\
10172 -   newValue &= CM_FCLKEN_PER_GPT6_MASK;\
10173 -   newValue |= data;\
10174 -    __raw_writel(newValue, ((u32)(baseAddress))+offset);\
10175 -}
10176 -
10177 -
10178 -#define CM_ICLKEN_PER_GPT5WriteRegister32(baseAddress,value)\
10179 -{\
10180 -    const u32 offset = CM_ICLKEN_PER_OFFSET;\
10181 -    register u32 data = \
10182 -       __raw_readl(((u32)(baseAddress))+offset);\
10183 -    register u32 newValue = ((u32)(value));\
10184 -    _DEBUG_LEVEL_1_EASI(EASIL1_CM_ICLKEN_PER_GPT5WriteRegister32);\
10185 -   data &= ~(CM_ICLKEN_PER_GPT5_MASK);\
10186 -   newValue <<= CM_ICLKEN_PER_GPT5_OFFSET;\
10187 -   newValue &= CM_ICLKEN_PER_GPT5_MASK;\
10188 -   newValue |= data;\
10189 -    __raw_writel(newValue, ((u32)(baseAddress))+offset);\
10190 -}
10191 -
10192 -
10193 -#define CM_ICLKEN_PER_GPT6WriteRegister32(baseAddress,value)\
10194 -{\
10195 -    const u32 offset = CM_ICLKEN_PER_OFFSET;\
10196 -    register u32 data = \
10197 -       __raw_readl(((u32)(baseAddress))+offset);\
10198 -    register u32 newValue = ((u32)(value));\
10199 -    _DEBUG_LEVEL_1_EASI(EASIL1_CM_ICLKEN_PER_GPT5WriteRegister32);\
10200 -   data &= ~(CM_ICLKEN_PER_GPT6_MASK);\
10201 -   newValue <<= CM_ICLKEN_PER_GPT6_OFFSET;\
10202 -   newValue &= CM_ICLKEN_PER_GPT6_MASK;\
10203 -   newValue |= data;\
10204 -    __raw_writel(newValue, ((u32)(baseAddress))+offset);\
10205 -}
10206 -
10207 -
10208 -#define CM_FCLKEN1_COREReadRegister32(baseAddress)\
10209 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32),\
10210 -      __raw_readl(((u32)(baseAddress))+CM_FCLKEN1_CORE_OFFSET))
10211 -
10212 -
10213 -#define PRCMCM_FCLKEN1_COREEN_GPT8Write32(baseAddress,value)\
10214 -{\
10215 -    const u32 offset = PRCM_CM_FCLKEN1_CORE_OFFSET;\
10216 -    register u32 data = \
10217 -       __raw_readl(((u32)(baseAddress))+offset);\
10218 -    register u32 newValue = ((u32)(value));\
10219 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREEN_GPT8Write32);\
10220 -    data &= ~(PRCM_CM_FCLKEN1_CORE_EN_GPT8_MASK);\
10221 -    newValue <<= PRCM_CM_FCLKEN1_CORE_EN_GPT8_OFFSET;\
10222 -    newValue &= PRCM_CM_FCLKEN1_CORE_EN_GPT8_MASK;\
10223 -    newValue |= data;\
10224 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10225 -}
10226 -
10227 -
10228 -#define PRCMCM_FCLKEN1_COREEN_GPT7Write32(baseAddress,value)\
10229 -{\
10230 -    const u32 offset = PRCM_CM_FCLKEN1_CORE_OFFSET;\
10231 -    register u32 data = \
10232 -       __raw_readl(((u32)(baseAddress))+offset);\
10233 -    register u32 newValue = ((u32)(value));\
10234 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREEN_GPT7Write32);\
10235 -    data &= ~(PRCM_CM_FCLKEN1_CORE_EN_GPT7_MASK);\
10236 -    newValue <<= PRCM_CM_FCLKEN1_CORE_EN_GPT7_OFFSET;\
10237 -    newValue &= PRCM_CM_FCLKEN1_CORE_EN_GPT7_MASK;\
10238 -    newValue |= data;\
10239 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10240 -}
10241 -
10242 -
10243 -#define CM_ICLKEN1_COREReadRegister32(baseAddress)\
10244 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN1_COREReadRegister32),\
10245 -      __raw_readl(((u32)(baseAddress))+CM_ICLKEN1_CORE_OFFSET))
10246 -
10247 -
10248 -#define  CM_ICLKEN1_COREEN_MAILBOXESWrite32(baseAddress, value)\
10249 -{\
10250 -    const u32 offset = CM_ICLKEN1_CORE_OFFSET;\
10251 -    register u32 data = \
10252 -       __raw_readl(((u32)(baseAddress))+offset);\
10253 -    register u32 newValue = ((u32)(value));\
10254 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN1_COREEN_MAILBOXESWrite32);\
10255 -    data &= ~(CM_ICLKEN1_CORE_EN_MAILBOXES_MASK);\
10256 -    newValue <<= CM_ICLKEN1_CORE_EN_MAILBOXES_OFFSET;\
10257 -    newValue &= CM_ICLKEN1_CORE_EN_MAILBOXES_MASK;\
10258 -    newValue |= data;\
10259 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10260 -}
10261 -
10262 -
10263 -#define PRCMCM_ICLKEN1_COREEN_GPT8Write32(baseAddress, value)\
10264 -{\
10265 -    const u32 offset = PRCM_CM_ICLKEN1_CORE_OFFSET;\
10266 -    register u32 data = \
10267 -       __raw_readl(((u32)(baseAddress))+offset);\
10268 -    register u32 newValue = ((u32)(value));\
10269 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN1_COREEN_GPT8Write32);\
10270 -    data &= ~(PRCM_CM_ICLKEN1_CORE_EN_GPT8_MASK);\
10271 -    newValue <<= PRCM_CM_ICLKEN1_CORE_EN_GPT8_OFFSET;\
10272 -    newValue &= PRCM_CM_ICLKEN1_CORE_EN_GPT8_MASK;\
10273 -    newValue |= data;\
10274 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10275 -}
10276 -
10277 -
10278 -#define PRCMCM_ICLKEN1_COREEN_GPT7Write32(baseAddress, value)\
10279 -{\
10280 -    const u32 offset = PRCM_CM_ICLKEN1_CORE_OFFSET;\
10281 -    register u32 data =\
10282 -       __raw_readl(((u32)(baseAddress))+offset);\
10283 -    register u32 newValue = ((u32)(value));\
10284 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN1_COREEN_GPT7Write32);\
10285 -    data &= ~(PRCM_CM_ICLKEN1_CORE_EN_GPT7_MASK);\
10286 -    newValue <<= PRCM_CM_ICLKEN1_CORE_EN_GPT7_OFFSET;\
10287 -    newValue &= PRCM_CM_ICLKEN1_CORE_EN_GPT7_MASK;\
10288 -    newValue |= data;\
10289 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10290 -}
10291 -
10292 -
10293 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8Write32k32(baseAddress)\
10294 -{\
10295 -    const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;\
10296 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT832k <<\
10297 -      PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_OFFSET;\
10298 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10299 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT8Write32k32);\
10300 -    data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_MASK);\
10301 -    data |= newValue;\
10302 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10303 -}
10304 -
10305 -
10306 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteSys32(baseAddress)\
10307 -{\
10308 -    const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;\
10309 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT8Sys <<\
10310 -      PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_OFFSET;\
10311 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10312 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteSys32);\
10313 -    data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_MASK);\
10314 -    data |= newValue;\
10315 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10316 -}
10317 -
10318 -
10319 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteExt32(baseAddress)\
10320 -{\
10321 -    const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;\
10322 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT8Ext <<\
10323 -      PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_OFFSET;\
10324 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10325 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteExt32);\
10326 -    data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_MASK);\
10327 -    data |= newValue;\
10328 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10329 -}
10330 -
10331 -
10332 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7Write32k32(baseAddress)\
10333 -{\
10334 -    const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;\
10335 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT732k <<\
10336 -      PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_OFFSET;\
10337 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10338 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT7Write32k32);\
10339 -    data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_MASK);\
10340 -    data |= newValue;\
10341 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10342 -}
10343 -
10344 -
10345 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteSys32(baseAddress)\
10346 -{\
10347 -    const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;\
10348 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT7Sys <<\
10349 -      PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_OFFSET;\
10350 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10351 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteSys32);\
10352 -    data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_MASK);\
10353 -    data |= newValue;\
10354 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10355 -}
10356 -
10357 -
10358 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteExt32(baseAddress)\
10359 -{\
10360 -    const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;\
10361 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT7Ext <<\
10362 -      PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_OFFSET;\
10363 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10364 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteExt32);\
10365 -    data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_MASK);\
10366 -    data |= newValue;\
10367 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10368 -}
10369 -
10370 -
10371 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteSys32(baseAddress)\
10372 -{\
10373 -    const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;\
10374 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT6Sys <<\
10375 -      PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT6_OFFSET;\
10376 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10377 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteSys32);\
10378 -    data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT6_MASK);\
10379 -    data |= newValue;\
10380 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10381 -}
10382 -
10383 -
10384 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteExt32(baseAddress)\
10385 -{\
10386 -    const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;\
10387 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT6Ext <<\
10388 -      PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT6_OFFSET;\
10389 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10390 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteExt32);\
10391 -    data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT6_MASK);\
10392 -    data |= newValue;\
10393 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10394 -}
10395 -
10396 -
10397 -#define CM_CLKSEL_PER_GPT5Write32k32(baseAddress)\
10398 -{\
10399 -    const u32 offset = CM_CLKSEL_PER_OFFSET;\
10400 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT532k <<\
10401 -      CM_CLKSEL_PER_GPT5_OFFSET;\
10402 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10403 -    _DEBUG_LEVEL_1_EASI(EASIL1_CM_CLKSEL_PER_GPT5Write32k32);\
10404 -    data &= ~(CM_CLKSEL_PER_GPT5_MASK);\
10405 -    data |= newValue;\
10406 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10407 -}
10408 -
10409 -
10410 -#define CM_CLKSEL_PER_GPT6Write32k32(baseAddress)\
10411 -{\
10412 -    const u32 offset = CM_CLKSEL_PER_OFFSET;\
10413 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT532k <<\
10414 -      CM_CLKSEL_PER_GPT6_OFFSET;\
10415 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10416 -    _DEBUG_LEVEL_1_EASI(EASIL1_CM_CLKSEL_PER_GPT6Write32k32);\
10417 -    data &= ~(CM_CLKSEL_PER_GPT6_MASK);\
10418 -    data |= newValue;\
10419 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10420 -}
10421 -
10422 -
10423 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteSys32(baseAddress)\
10424 -{\
10425 -    const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;\
10426 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT5Sys <<\
10427 -      PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT5_OFFSET;\
10428 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10429 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteSys32);\
10430 -    data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT5_MASK);\
10431 -    data |= newValue;\
10432 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10433 -}
10434 -
10435 -
10436 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteExt32(baseAddress)\
10437 -{\
10438 -    const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;\
10439 -    const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT5Ext <<\
10440 -      PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT5_OFFSET;\
10441 -    register u32 data = __raw_readl((u32)(baseAddress)+offset);\
10442 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteExt32);\
10443 -    data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT5_MASK);\
10444 -    data |= newValue;\
10445 -    __raw_writel(data, (u32)(baseAddress)+offset);\
10446 -}
10447 -
10448 -
10449 -#define PRCMCM_CLKSEL1_PLLAPLLs_ClkinRead32(baseAddress)\
10450 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL1_PLLAPLLs_ClkinRead32),\
10451 -      (((__raw_readl((((u32)(baseAddress))+\
10452 -       (PRCM_CM_CLKSEL1_PLL_OFFSET)))) &\
10453 -      PRCM_CM_CLKSEL1_PLL_APLLs_Clkin_MASK) >>\
10454 -      PRCM_CM_CLKSEL1_PLL_APLLs_Clkin_OFFSET))
10455 -
10456 -
10457 -#define CM_FCLKEN_IVA2EN_DSPWrite32(baseAddress,value)\
10458 -{\
10459 -    const u32 offset = CM_FCLKEN_IVA2_OFFSET;\
10460 -    register u32 data = \
10461 -       __raw_readl(((u32)(baseAddress))+offset);\
10462 -    register u32 newValue = ((u32)(value));\
10463 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN_DSPEN_DSPWrite32);\
10464 -    data &= ~(CM_FCLKEN_IVA2_EN_MASK);\
10465 -    newValue <<= CM_FCLKEN_IVA2_EN_OFFSET;\
10466 -    newValue &= CM_FCLKEN_IVA2_EN_MASK;\
10467 -    newValue |= data;\
10468 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10469 -}
10470 -
10471 -
10472 -#define PRCMCM_ICLKEN_DSPEN_DSP_IPIWrite32(baseAddress, value)\
10473 -{\
10474 -    const u32 offset = PRCM_CM_ICLKEN_DSP_OFFSET;\
10475 -    register u32 data = \
10476 -      __raw_readl(((u32)(baseAddress))+offset);\
10477 -    register u32 newValue = ((u32)(value));\
10478 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN_DSPEN_DSP_IPIWrite32);\
10479 -    data &= ~(PRCM_CM_ICLKEN_DSP_EN_DSP_IPI_MASK);\
10480 -    newValue <<= PRCM_CM_ICLKEN_DSP_EN_DSP_IPI_OFFSET;\
10481 -    newValue &= PRCM_CM_ICLKEN_DSP_EN_DSP_IPI_MASK;\
10482 -    newValue |= data;\
10483 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10484 -}
10485 -
10486 -
10487 -#define PRCMCM_IDLEST_DSPReadRegister32(baseAddress)\
10488 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_IDLEST_DSPReadRegister32),\
10489 -      __raw_readl(((u32)(baseAddress))+PRCM_CM_IDLEST_DSP_OFFSET))
10490 -
10491 -
10492 -#define PRCMCM_IDLEST_DSPST_IPIRead32(baseAddress)\
10493 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_IDLEST_DSPST_IPIRead32),\
10494 -      (((__raw_readl((((u32)(baseAddress))+\
10495 -       (PRCM_CM_IDLEST_DSP_OFFSET)))) &\
10496 -      PRCM_CM_IDLEST_DSP_ST_IPI_MASK) >>\
10497 -      PRCM_CM_IDLEST_DSP_ST_IPI_OFFSET))
10498 +#define PRCMPRCM_CLKCFG_CTRLValid_configWriteClk_valid32(baseAddress)         \
10499 +do {                                                                          \
10500 +       const u32 offset = PRCM_PRCM_CLKCFG_CTRL_OFFSET;                       \
10501 +       const u32 newValue = (u32)PRCMPRCM_CLKCFG_CTRLValid_configClk_valid << \
10502 +                       PRCM_PRCM_CLKCFG_CTRL_Valid_config_OFFSET;             \
10503 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);          \
10504 +       _DEBUG_LEVEL_1_EASI(                                                   \
10505 +               EASIL1_PRCMPRCM_CLKCFG_CTRLValid_configWriteClk_valid32);      \
10506 +       data &= ~(PRCM_PRCM_CLKCFG_CTRL_Valid_config_MASK);                    \
10507 +       data |= newValue;                                                      \
10508 +       __raw_writel(data, (u32)(baseAddress) + offset);                       \
10509 +} while (0)
10510 +
10511 +#define CM_FCLKEN_PERReadRegister32(baseAddress)                       \
10512 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32), \
10513 +       __raw_readl(((u32)(baseAddress)) + CM_FCLKEN_PER_OFFSET))
10514 +
10515 +#define CM_ICLKEN_PERReadRegister32(baseAddress)                       \
10516 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32), \
10517 +       __raw_readl(((u32)(baseAddress)) + CM_ICLKEN_PER_OFFSET))
10518 +
10519 +#define CM_FCLKEN_PER_GPT5WriteRegister32(baseAddress, value)          \
10520 +do {                                                                   \
10521 +       const u32 offset = CM_FCLKEN_PER_OFFSET;                        \
10522 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset); \
10523 +       register u32 newValue = ((u32)(value));                         \
10524 +       _DEBUG_LEVEL_1_EASI(EASIL1_CM_FCLKEN_PER_GPT5WriteRegister32);  \
10525 +       data &= ~(CM_FCLKEN_PER_GPT5_MASK);                             \
10526 +       newValue <<= CM_FCLKEN_PER_GPT5_OFFSET;                         \
10527 +       newValue &= CM_FCLKEN_PER_GPT5_MASK;                            \
10528 +       newValue |= data;                                               \
10529 +       __raw_writel(newValue, ((u32)(baseAddress)) + offset);          \
10530 +} while (0)
10531 +
10532 +#define CM_FCLKEN_PER_GPT6WriteRegister32(baseAddress, value)          \
10533 +do {                                                                   \
10534 +       const u32 offset = CM_FCLKEN_PER_OFFSET;                        \
10535 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset); \
10536 +       register u32 newValue = ((u32)(value));                         \
10537 +       _DEBUG_LEVEL_1_EASI(EASIL1_CM_FCLKEN_PER_GPT5WriteRegister32);  \
10538 +       data &= ~(CM_FCLKEN_PER_GPT6_MASK);                             \
10539 +       newValue <<= CM_FCLKEN_PER_GPT6_OFFSET;                         \
10540 +       newValue &= CM_FCLKEN_PER_GPT6_MASK;                            \
10541 +       newValue |= data;                                               \
10542 +       __raw_writel(newValue, ((u32)(baseAddress)) + offset);          \
10543 +} while (0)
10544 +
10545 +#define CM_ICLKEN_PER_GPT5WriteRegister32(baseAddress, value)          \
10546 +do {                                                                   \
10547 +       const u32 offset = CM_ICLKEN_PER_OFFSET;                        \
10548 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset); \
10549 +       register u32 newValue = ((u32)(value));                         \
10550 +       _DEBUG_LEVEL_1_EASI(EASIL1_CM_ICLKEN_PER_GPT5WriteRegister32);  \
10551 +       data &= ~(CM_ICLKEN_PER_GPT5_MASK);                             \
10552 +       newValue <<= CM_ICLKEN_PER_GPT5_OFFSET;                         \
10553 +       newValue &= CM_ICLKEN_PER_GPT5_MASK;                            \
10554 +       newValue |= data;                                               \
10555 +       __raw_writel(newValue, ((u32)(baseAddress)) + offset);          \
10556 +} while (0)
10557 +
10558 +#define CM_ICLKEN_PER_GPT6WriteRegister32(baseAddress, value)          \
10559 +do {                                                                   \
10560 +       const u32 offset = CM_ICLKEN_PER_OFFSET;                        \
10561 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset); \
10562 +       register u32 newValue = ((u32)(value));                         \
10563 +       _DEBUG_LEVEL_1_EASI(EASIL1_CM_ICLKEN_PER_GPT5WriteRegister32);  \
10564 +       data &= ~(CM_ICLKEN_PER_GPT6_MASK);                             \
10565 +       newValue <<= CM_ICLKEN_PER_GPT6_OFFSET;                         \
10566 +       newValue &= CM_ICLKEN_PER_GPT6_MASK;                            \
10567 +       newValue |= data;                                               \
10568 +       __raw_writel(newValue, ((u32)(baseAddress)) + offset);          \
10569 +} while (0)
10570 +
10571 +#define CM_FCLKEN1_COREReadRegister32(baseAddress)                     \
10572 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32), \
10573 +       __raw_readl(((u32)(baseAddress)) + CM_FCLKEN1_CORE_OFFSET))
10574 +
10575 +
10576 +#define PRCMCM_FCLKEN1_COREEN_GPT8Write32(baseAddress, value)          \
10577 +do {                                                                   \
10578 +       const u32 offset = PRCM_CM_FCLKEN1_CORE_OFFSET;                 \
10579 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset); \
10580 +       register u32 newValue = ((u32)(value));                         \
10581 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREEN_GPT8Write32);  \
10582 +       data &= ~(PRCM_CM_FCLKEN1_CORE_EN_GPT8_MASK);                   \
10583 +       newValue <<= PRCM_CM_FCLKEN1_CORE_EN_GPT8_OFFSET;               \
10584 +       newValue &= PRCM_CM_FCLKEN1_CORE_EN_GPT8_MASK;                  \
10585 +       newValue |= data;                                               \
10586 +       __raw_writel(newValue, (u32)(baseAddress) + offset);            \
10587 +} while (0)
10588 +
10589 +#define PRCMCM_FCLKEN1_COREEN_GPT7Write32(baseAddress, value)          \
10590 +do {                                                                   \
10591 +       const u32 offset = PRCM_CM_FCLKEN1_CORE_OFFSET;                 \
10592 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset); \
10593 +       register u32 newValue = ((u32)(value));                         \
10594 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREEN_GPT7Write32);  \
10595 +       data &= ~(PRCM_CM_FCLKEN1_CORE_EN_GPT7_MASK);                   \
10596 +       newValue <<= PRCM_CM_FCLKEN1_CORE_EN_GPT7_OFFSET;               \
10597 +       newValue &= PRCM_CM_FCLKEN1_CORE_EN_GPT7_MASK;                  \
10598 +       newValue |= data;                                               \
10599 +       __raw_writel(newValue, (u32)(baseAddress) + offset);            \
10600 +} while (0)
10601 +
10602 +#define CM_ICLKEN1_COREReadRegister32(baseAddress)                     \
10603 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN1_COREReadRegister32), \
10604 +       __raw_readl(((u32)(baseAddress)) + CM_ICLKEN1_CORE_OFFSET))
10605 +
10606 +#define CM_ICLKEN1_COREEN_MAILBOXESWrite32(baseAddress, value)             \
10607 +do {                                                                       \
10608 +       const u32 offset = CM_ICLKEN1_CORE_OFFSET;                          \
10609 +       register u32 data =                                                 \
10610 +       __raw_readl(((u32)(baseAddress)) + offset);                         \
10611 +       register u32 newValue = ((u32)(value));                             \
10612 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN1_COREEN_MAILBOXESWrite32); \
10613 +       data &= ~(CM_ICLKEN1_CORE_EN_MAILBOXES_MASK);                       \
10614 +       newValue <<= CM_ICLKEN1_CORE_EN_MAILBOXES_OFFSET;                   \
10615 +       newValue &= CM_ICLKEN1_CORE_EN_MAILBOXES_MASK;                      \
10616 +       newValue |= data;                                                   \
10617 +       __raw_writel(newValue, (u32)(baseAddress) + offset);                \
10618 +} while (0)
10619 +
10620 +#define PRCMCM_ICLKEN1_COREEN_GPT8Write32(baseAddress, value)          \
10621 +do {                                                                   \
10622 +       const u32 offset = PRCM_CM_ICLKEN1_CORE_OFFSET;                 \
10623 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset); \
10624 +       register u32 newValue = ((u32)(value));                         \
10625 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN1_COREEN_GPT8Write32);  \
10626 +       data &= ~(PRCM_CM_ICLKEN1_CORE_EN_GPT8_MASK);                   \
10627 +       newValue <<= PRCM_CM_ICLKEN1_CORE_EN_GPT8_OFFSET;               \
10628 +       newValue &= PRCM_CM_ICLKEN1_CORE_EN_GPT8_MASK;                  \
10629 +       newValue |= data;                                               \
10630 +       __raw_writel(newValue, (u32)(baseAddress) + offset);            \
10631 +} while (0)
10632 +
10633 +#define PRCMCM_ICLKEN1_COREEN_GPT7Write32(baseAddress, value)          \
10634 +do {                                                                   \
10635 +       const u32 offset = PRCM_CM_ICLKEN1_CORE_OFFSET;                 \
10636 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset); \
10637 +       register u32 newValue = ((u32)(value));                         \
10638 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN1_COREEN_GPT7Write32);  \
10639 +       data &= ~(PRCM_CM_ICLKEN1_CORE_EN_GPT7_MASK);                   \
10640 +       newValue <<= PRCM_CM_ICLKEN1_CORE_EN_GPT7_OFFSET;               \
10641 +       newValue &= PRCM_CM_ICLKEN1_CORE_EN_GPT7_MASK;                  \
10642 +       newValue |= data;                                               \
10643 +       __raw_writel(newValue, (u32)(baseAddress) + offset);            \
10644 +} while (0)
10645 +
10646 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8Write32k32(baseAddress)                \
10647 +do {                                                                         \
10648 +       const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;                       \
10649 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT832k <<        \
10650 +               PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_OFFSET;                      \
10651 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);         \
10652 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT8Write32k32); \
10653 +       data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_MASK);                     \
10654 +       data |= newValue;                                                     \
10655 +       __raw_writel(data, (u32)(baseAddress) + offset);                      \
10656 +} while (0)
10657 +
10658 +
10659 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteSys32(baseAddress)                \
10660 +do {                                                                         \
10661 +       const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;                       \
10662 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT8Sys <<        \
10663 +               PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_OFFSET;                      \
10664 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);         \
10665 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteSys32); \
10666 +       data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_MASK);                     \
10667 +       data |= newValue;                                                     \
10668 +       __raw_writel(data, (u32)(baseAddress) + offset);                      \
10669 +} while (0)
10670 +
10671 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteExt32(baseAddress)                \
10672 +do {                                                                         \
10673 +       const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;                       \
10674 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT8Ext <<        \
10675 +               PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_OFFSET;                      \
10676 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);         \
10677 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteExt32); \
10678 +       data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT8_MASK);                     \
10679 +       data |= newValue;                                                     \
10680 +       __raw_writel(data, (u32)(baseAddress) + offset);                      \
10681 +} while (0)
10682 +
10683 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7Write32k32(baseAddress)                \
10684 +do {                                                                         \
10685 +       const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;                       \
10686 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT732k <<        \
10687 +               PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_OFFSET;                      \
10688 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);         \
10689 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT7Write32k32); \
10690 +       data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_MASK);                     \
10691 +       data |= newValue;                                                     \
10692 +       __raw_writel(data, (u32)(baseAddress) + offset);                      \
10693 +} while (0)
10694 +
10695 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteSys32(baseAddress)                \
10696 +do {                                                                         \
10697 +       const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;                       \
10698 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT7Sys <<        \
10699 +               PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_OFFSET;                      \
10700 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);         \
10701 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteSys32); \
10702 +       data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_MASK);                     \
10703 +       data |= newValue;                                                     \
10704 +       __raw_writel(data, (u32)(baseAddress) + offset);                      \
10705 +} while (0)
10706 +
10707 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteExt32(baseAddress)                 \
10708 +do {                                                                          \
10709 +       const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;                        \
10710 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT7Ext <<         \
10711 +               PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_OFFSET;                       \
10712 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);          \
10713 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteExt32);  \
10714 +       data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT7_MASK);                      \
10715 +       data |= newValue;                                                      \
10716 +       __raw_writel(data, (u32)(baseAddress) + offset);                       \
10717 +} while (0)
10718 +
10719 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteSys32(baseAddress)                 \
10720 +do {                                                                          \
10721 +       const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;                        \
10722 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT6Sys <<         \
10723 +               PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT6_OFFSET;                       \
10724 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);          \
10725 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteSys32);  \
10726 +       data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT6_MASK);                      \
10727 +       data |= newValue;                                                      \
10728 +       __raw_writel(data, (u32)(baseAddress) + offset);                       \
10729 +} while (0)
10730 +
10731 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteExt32(baseAddress)                 \
10732 +do {                                                                          \
10733 +       const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;                        \
10734 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT6Ext <<         \
10735 +               PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT6_OFFSET;                       \
10736 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);          \
10737 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteExt32);  \
10738 +       data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT6_MASK);                      \
10739 +       data |= newValue;                                                      \
10740 +       __raw_writel(data, (u32)(baseAddress) + offset);                       \
10741 +} while (0)
10742 +
10743 +#define CM_CLKSEL_PER_GPT5Write32k32(baseAddress)                             \
10744 +do {                                                                          \
10745 +       const u32 offset = CM_CLKSEL_PER_OFFSET;                               \
10746 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT532k <<         \
10747 +               CM_CLKSEL_PER_GPT5_OFFSET;                                     \
10748 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);          \
10749 +       _DEBUG_LEVEL_1_EASI(EASIL1_CM_CLKSEL_PER_GPT5Write32k32);              \
10750 +       data &= ~(CM_CLKSEL_PER_GPT5_MASK);                                    \
10751 +       data |= newValue;                                                      \
10752 +       __raw_writel(data, (u32)(baseAddress) + offset);                       \
10753 +} while (0)
10754 +
10755 +#define CM_CLKSEL_PER_GPT6Write32k32(baseAddress)                             \
10756 +do {                                                                          \
10757 +       const u32 offset = CM_CLKSEL_PER_OFFSET;                               \
10758 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT532k <<         \
10759 +               CM_CLKSEL_PER_GPT6_OFFSET;                                     \
10760 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);          \
10761 +       _DEBUG_LEVEL_1_EASI(EASIL1_CM_CLKSEL_PER_GPT6Write32k32);              \
10762 +       data &= ~(CM_CLKSEL_PER_GPT6_MASK);                                    \
10763 +       data |= newValue;                                                      \
10764 +       __raw_writel(data, (u32)(baseAddress) + offset);                       \
10765 +} while (0)
10766 +
10767 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteSys32(baseAddress)                 \
10768 +do {                                                                          \
10769 +       const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;                        \
10770 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT5Sys <<         \
10771 +               PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT5_OFFSET;                       \
10772 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);          \
10773 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteSys32);  \
10774 +       data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT5_MASK);                      \
10775 +       data |= newValue;                                                      \
10776 +       __raw_writel(data, (u32)(baseAddress) + offset);                       \
10777 +} while (0);
10778 +
10779 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteExt32(baseAddress)                 \
10780 +do {                                                                          \
10781 +       const u32 offset = PRCM_CM_CLKSEL2_CORE_OFFSET;                        \
10782 +       const u32 newValue = (u32)PRCMCM_CLKSEL2_CORECLKSEL_GPT5Ext <<         \
10783 +               PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT5_OFFSET;                       \
10784 +       register u32 data = __raw_readl((u32)(baseAddress) + offset);          \
10785 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteExt32);  \
10786 +       data &= ~(PRCM_CM_CLKSEL2_CORE_CLKSEL_GPT5_MASK);                      \
10787 +       data |= newValue;                                                      \
10788 +       __raw_writel(data, (u32)(baseAddress) + offset);                       \
10789 +} while (0)
10790 +
10791 +#define PRCMCM_CLKSEL1_PLLAPLLs_ClkinRead32(baseAddress)                      \
10792 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL1_PLLAPLLs_ClkinRead32),      \
10793 +       (((__raw_readl((((u32)(baseAddress)) +                                 \
10794 +       (PRCM_CM_CLKSEL1_PLL_OFFSET)))) &                                      \
10795 +       PRCM_CM_CLKSEL1_PLL_APLLs_Clkin_MASK) >>                               \
10796 +       PRCM_CM_CLKSEL1_PLL_APLLs_Clkin_OFFSET))
10797 +
10798 +#define CM_FCLKEN_IVA2EN_DSPWrite32(baseAddress, value)                               \
10799 +do {                                                                          \
10800 +       const u32 offset = CM_FCLKEN_IVA2_OFFSET;                              \
10801 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset);        \
10802 +       register u32 newValue = ((u32)(value));                                \
10803 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN_DSPEN_DSPWrite32);            \
10804 +       data &= ~(CM_FCLKEN_IVA2_EN_MASK);                                     \
10805 +       newValue <<= CM_FCLKEN_IVA2_EN_OFFSET;                                 \
10806 +       newValue &= CM_FCLKEN_IVA2_EN_MASK;                                    \
10807 +       newValue |= data;                                                      \
10808 +       __raw_writel(newValue, (u32)(baseAddress) + offset);                   \
10809 +} while (0)
10810 +
10811 +#define PRCMCM_ICLKEN_DSPEN_DSP_IPIWrite32(baseAddress, value)                \
10812 +do {                                                                          \
10813 +       const u32 offset = PRCM_CM_ICLKEN_DSP_OFFSET;                          \
10814 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset);        \
10815 +       register u32 newValue = ((u32)(value));                                \
10816 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN_DSPEN_DSP_IPIWrite32);        \
10817 +       data &= ~(PRCM_CM_ICLKEN_DSP_EN_DSP_IPI_MASK);                         \
10818 +       newValue <<= PRCM_CM_ICLKEN_DSP_EN_DSP_IPI_OFFSET;                     \
10819 +       newValue &= PRCM_CM_ICLKEN_DSP_EN_DSP_IPI_MASK;                        \
10820 +       newValue |= data;                                                      \
10821 +       __raw_writel(newValue, (u32)(baseAddress) + offset);                   \
10822 +} while (0)
10823 +
10824 +#define PRCMCM_IDLEST_DSPReadRegister32(baseAddress)                   \
10825 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_IDLEST_DSPReadRegister32),   \
10826 +       __raw_readl(((u32)(baseAddress)) + PRCM_CM_IDLEST_DSP_OFFSET))
10827 +
10828 +
10829 +#define PRCMCM_IDLEST_DSPST_IPIRead32(baseAddress)                     \
10830 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_IDLEST_DSPST_IPIRead32),     \
10831 +       (((__raw_readl((((u32)(baseAddress)) +                          \
10832 +       (PRCM_CM_IDLEST_DSP_OFFSET)))) &                                \
10833 +       PRCM_CM_IDLEST_DSP_ST_IPI_MASK) >>                              \
10834 +       PRCM_CM_IDLEST_DSP_ST_IPI_OFFSET))
10835  
10836  
10837  #define PRM_IDLEST_IVA2ST_IVA2Read32(baseAddress)\
10838 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_IDLEST_DSPST_DSPRead32),\
10839 -      (((__raw_readl((((u32)(baseAddress))+\
10840 -         (CM_IDLEST_IVA2_OFFSET)))) &\
10841 -      CM_IDLEST_IVA2_ST_IVA2_MASK) >>\
10842 -      CM_IDLEST_IVA2_ST_IVA2_OFFSET))
10843 -
10844 -
10845 -#define PRCMCM_AUTOIDLE_DSPAUTO_DSP_IPIWrite32(baseAddress, value)\
10846 -{\
10847 -    const u32 offset = PRCM_CM_AUTOIDLE_DSP_OFFSET;\
10848 -    register u32 data =\
10849 -      __raw_readl(((u32)(baseAddress))+offset);\
10850 -    register u32 newValue = ((u32)(value));\
10851 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_AUTOIDLE_DSPAUTO_DSP_IPIWrite32);\
10852 -    data &= ~(PRCM_CM_AUTOIDLE_DSP_AUTO_DSP_IPI_MASK);\
10853 -    newValue <<= PRCM_CM_AUTOIDLE_DSP_AUTO_DSP_IPI_OFFSET;\
10854 -    newValue &= PRCM_CM_AUTOIDLE_DSP_AUTO_DSP_IPI_MASK;\
10855 -    newValue |= data;\
10856 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10857 -}
10858 -
10859 -
10860 -#define PRCMCM_CLKSEL_DSPSYNC_DSPWrite32(baseAddress,value)\
10861 -{\
10862 -    const u32 offset = PRCM_CM_CLKSEL_DSP_OFFSET;\
10863 -    register u32 data = \
10864 -       __raw_readl(((u32)(baseAddress))+offset);\
10865 -    register u32 newValue = ((u32)(value));\
10866 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL_DSPSYNC_DSPWrite32);\
10867 -    data &= ~(PRCM_CM_CLKSEL_DSP_SYNC_DSP_MASK);\
10868 -    newValue <<= PRCM_CM_CLKSEL_DSP_SYNC_DSP_OFFSET;\
10869 -    newValue &= PRCM_CM_CLKSEL_DSP_SYNC_DSP_MASK;\
10870 -    newValue |= data;\
10871 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10872 -}
10873 -
10874 -
10875 -#define PRCMCM_CLKSEL_DSPCLKSEL_DSP_IFWrite32(baseAddress, value)\
10876 -{\
10877 -    const u32 offset = PRCM_CM_CLKSEL_DSP_OFFSET;\
10878 -    register u32 data = \
10879 -      __raw_readl(((u32)(baseAddress))+offset);\
10880 -    register u32 newValue = ((u32)(value));\
10881 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL_DSPCLKSEL_DSP_IFWrite32);\
10882 -    data &= ~(PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_IF_MASK);\
10883 -    newValue <<= PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_IF_OFFSET;\
10884 -    newValue &= PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_IF_MASK;\
10885 -    newValue |= data;\
10886 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10887 -}
10888 -
10889 -
10890 -#define PRCMCM_CLKSEL_DSPCLKSEL_DSPWrite32(baseAddress, value)\
10891 -{\
10892 -    const u32 offset = PRCM_CM_CLKSEL_DSP_OFFSET;\
10893 -    register u32 data = \
10894 -      __raw_readl(((u32)(baseAddress))+offset);\
10895 -    register u32 newValue = ((u32)(value));\
10896 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL_DSPCLKSEL_DSPWrite32);\
10897 -    data &= ~(PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_MASK);\
10898 -    newValue <<= PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_OFFSET;\
10899 -    newValue &= PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_MASK;\
10900 -    newValue |= data;\
10901 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10902 -}
10903 -
10904 -
10905 -#define PRCMCM_CLKSTCTRL_IVA2WriteRegister32(baseAddress, value)\
10906 -{\
10907 -    const u32 offset = PRCM_CM_CLKSTCTRL_IVA2_OFFSET;\
10908 -    register u32 data = \
10909 -      __raw_readl(((baseAddress))+offset);\
10910 -    register u32 newValue = ((u32)(value));\
10911 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSTCTRL_IVA2WriteRegister32);\
10912 -    data &= ~(CM_CLKSTCTRL_IVA2_MASK);\
10913 -    newValue <<= CM_CLKSTCTRL_IVA2_OFFSET;\
10914 -    newValue &= CM_CLKSTCTRL_IVA2_MASK;\
10915 -    newValue |= data;\
10916 -    __raw_writel(newValue, (baseAddress)+offset);\
10917 -}
10918 -
10919 -
10920 -#define PRCMCM_CLKSTCTRL_DSPAutostate_DSPRead32(baseAddress)\
10921 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSTCTRL_DSPAutostate_DSPRead32),\
10922 -      (((__raw_readl((((u32)(baseAddress))+\
10923 -       (PRCM_CM_CLKSTCTRL_DSP_OFFSET)))) &\
10924 -      PRCM_CM_CLKSTCTRL_DSP_Autostate_DSP_MASK) >>\
10925 -      PRCM_CM_CLKSTCTRL_DSP_Autostate_DSP_OFFSET))
10926 -
10927 -
10928 -#define PRCMCM_CLKSTCTRL_DSPAutostate_DSPWrite32(baseAddress, value)\
10929 -{\
10930 -    const u32 offset = PRCM_CM_CLKSTCTRL_DSP_OFFSET;\
10931 -    register u32 data = \
10932 -       __raw_readl(((u32)(baseAddress))+offset);\
10933 -    register u32 newValue = ((u32)(value));\
10934 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSTCTRL_DSPAutostate_DSPWrite32);\
10935 -    data &= ~(PRCM_CM_CLKSTCTRL_DSP_Autostate_DSP_MASK);\
10936 -    newValue <<= PRCM_CM_CLKSTCTRL_DSP_Autostate_DSP_OFFSET;\
10937 -    newValue &= PRCM_CM_CLKSTCTRL_DSP_Autostate_DSP_MASK;\
10938 -    newValue |= data;\
10939 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
10940 -}
10941 -
10942 -
10943 -#define PRCMRM_RSTCTRL_DSPReadRegister32(baseAddress)\
10944 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTCTRL_DSPReadRegister32),\
10945 -      __raw_readl(((baseAddress))+PRCM_RM_RSTCTRL_DSP_OFFSET))
10946 -
10947 -
10948 -#define PRM_RSTCTRL_IVA2RST1_DSPWrite32(baseAddress,value)\
10949 -{\
10950 -    const u32 offset = PRM_RSTCTRL_IVA2_OFFSET;\
10951 -    register u32 data =\
10952 -    __raw_readl(((baseAddress))+offset);\
10953 -    register u32 newValue = ((u32)(value));\
10954 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTCTRL_DSPRST1_DSPWrite32);\
10955 -    data &= ~(PRM_RSTCTRL_IVA2_RST1_MASK);\
10956 -    newValue <<= PRM_RSTCTRL_IVA2_RST1_OFFSET;\
10957 -    newValue &= PRM_RSTCTRL_IVA2_RST1_MASK;\
10958 -    newValue |= data;\
10959 -    __raw_writel(newValue, (baseAddress)+offset);\
10960 -}
10961 -
10962 -
10963 -#define PRM_RSTCTRL_IVA2RST2_DSPWrite32(baseAddress,value)\
10964 -{\
10965 -    const u32 offset = PRM_RSTCTRL_IVA2_OFFSET;\
10966 -    register u32 data =\
10967 -       __raw_readl(((baseAddress))+offset);\
10968 -    register u32 newValue = ((u32)(value));\
10969 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTCTRL_DSPRST1_DSPWrite32);\
10970 -    data &= ~(PRM_RSTCTRL_IVA2_RST2_MASK);\
10971 -    newValue <<= PRM_RSTCTRL_IVA2_RST2_OFFSET;\
10972 -    newValue &= PRM_RSTCTRL_IVA2_RST2_MASK;\
10973 -    newValue |= data;\
10974 -    __raw_writel(newValue, (baseAddress)+offset);\
10975 -}
10976 -
10977 -
10978 -#define PRM_RSTCTRL_IVA2RST3_DSPWrite32(baseAddress,value)\
10979 -{\
10980 -    const u32 offset = PRM_RSTCTRL_IVA2_OFFSET;\
10981 -    register u32 data =\
10982 -      __raw_readl(((baseAddress))+offset);\
10983 -    register u32 newValue = ((u32)(value));\
10984 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTCTRL_DSPRST1_DSPWrite32);\
10985 -    data &= ~(PRM_RSTCTRL_IVA2_RST3_MASK);\
10986 -    newValue <<= PRM_RSTCTRL_IVA2_RST3_OFFSET;\
10987 -    newValue &= PRM_RSTCTRL_IVA2_RST3_MASK;\
10988 -    newValue |= data;\
10989 -    __raw_writel(newValue, (baseAddress)+offset);\
10990 -}
10991 -
10992 -
10993 -#define PRCMRM_RSTST_DSPReadRegister32(baseAddress)\
10994 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTST_DSPReadRegister32),\
10995 -      __raw_readl(((baseAddress))+PRCM_RM_RSTST_DSP_OFFSET))
10996 -
10997 -
10998 -#define PRCMRM_RSTST_DSPWriteRegister32(baseAddress,value)\
10999 -{\
11000 -    const u32 offset = PRCM_RM_RSTST_DSP_OFFSET;\
11001 -    register u32 newValue = ((u32)(value));\
11002 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTST_DSPWriteRegister32);\
11003 -    __raw_writel(newValue, ((u32)(baseAddress))+offset);\
11004 -}
11005 -
11006 -
11007 -#define PRCMPM_PWSTCTRL_DSPForceStateWrite32(baseAddress, value)\
11008 -{\
11009 -    const u32 offset = PRCM_PM_PWSTCTRL_DSP_OFFSET;\
11010 -    register u32 data = \
11011 -       __raw_readl(((u32)(baseAddress))+offset);\
11012 -    register u32 newValue = ((u32)(value));\
11013 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTCTRL_DSPForceStateWrite32);\
11014 -    data &= ~(PRCM_PM_PWSTCTRL_DSP_ForceState_MASK);\
11015 -    newValue <<= PRCM_PM_PWSTCTRL_DSP_ForceState_OFFSET;\
11016 -    newValue &= PRCM_PM_PWSTCTRL_DSP_ForceState_MASK;\
11017 -    newValue |= data;\
11018 -    __raw_writel(newValue, (u32)(baseAddress)+offset);\
11019 -}
11020 -
11021 -
11022 -#define PRCMPM_PWSTCTRL_IVA2PowerStateWriteON32(baseAddress)\
11023 -{\
11024 -    const u32 offset = PRCM_PM_PWSTCTRL_IVA2_OFFSET;\
11025 -    const u32 newValue = (u32)PRCMPM_PWSTCTRL_IVA2PowerStateON <<\
11026 -      PRCM_PM_PWSTCTRL_IVA2_PowerState_OFFSET;\
11027 -    register u32 data = __raw_readl((baseAddress)+offset);\
11028 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTCTRL_IVA2PowerStateWriteON32);\
11029 -    data &= ~(PRCM_PM_PWSTCTRL_IVA2_PowerState_MASK);\
11030 -    data |= newValue;\
11031 -    __raw_writel(data, (baseAddress)+offset);\
11032 -}
11033 -
11034 -
11035 -#define PRCMPM_PWSTCTRL_IVA2PowerStateWriteOFF32(baseAddress)\
11036 -{\
11037 -    const u32 offset = PRCM_PM_PWSTCTRL_IVA2_OFFSET;\
11038 -    const u32 newValue = (u32)PRCMPM_PWSTCTRL_IVA2PowerStateOFF <<\
11039 -      PRCM_PM_PWSTCTRL_IVA2_PowerState_OFFSET;\
11040 -    register u32 data = __raw_readl((baseAddress)+offset);\
11041 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTCTRL_IVA2PowerStateWriteOFF32);\
11042 -    data &= ~(PRCM_PM_PWSTCTRL_IVA2_PowerState_MASK);\
11043 -    data |= newValue;\
11044 -    __raw_writel(data, (baseAddress)+offset);\
11045 -}
11046 -
11047 -
11048 -#define PRCMPM_PWSTCTRL_DSPPowerStateWriteRET32(baseAddress)\
11049 -{\
11050 -    const u32 offset = PRCM_PM_PWSTCTRL_DSP_OFFSET;\
11051 -    const u32 newValue = (u32)PRCMPM_PWSTCTRL_DSPPowerStateRET <<\
11052 -      PRCM_PM_PWSTCTRL_DSP_PowerState_OFFSET;\
11053 -    register u32 data = __raw_readl((baseAddress)+offset);\
11054 -    _DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTCTRL_DSPPowerStateWriteRET32);\
11055 -    data &= ~(PRCM_PM_PWSTCTRL_DSP_PowerState_MASK);\
11056 -    data |= newValue;\
11057 -    __raw_writel(data, (baseAddress)+offset);\
11058 -}
11059 -
11060 -
11061 -#define PRCMPM_PWSTST_DSPReadRegister32(baseAddress)\
11062 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_DSPReadRegister32),\
11063 -      __raw_readl(((u32)(baseAddress))+PRCM_PM_PWSTST_DSP_OFFSET))
11064 -
11065 -
11066 -#define PRCMPM_PWSTST_IVA2ReadRegister32(baseAddress)\
11067 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_IVA2ReadRegister32),\
11068 -      __raw_readl((baseAddress) + PRCM_PM_PWSTST_IVA2_OFFSET))
11069 -
11070 -
11071 -#define PRCMPM_PWSTST_DSPInTransitionRead32(baseAddress)\
11072 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_DSPInTransitionRead32),\
11073 -      (((__raw_readl((((u32)(baseAddress))+\
11074 -       (PRCM_PM_PWSTST_DSP_OFFSET)))) &\
11075 -      PRCM_PM_PWSTST_DSP_InTransition_MASK) >>\
11076 -      PRCM_PM_PWSTST_DSP_InTransition_OFFSET))
11077 -
11078 -
11079 -#define PRCMPM_PWSTST_IVA2InTransitionRead32(baseAddress)\
11080 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_IVA2InTransitionRead32),\
11081 -      (((__raw_readl((((baseAddress))+\
11082 -       (PRCM_PM_PWSTST_IVA2_OFFSET)))) &\
11083 -      PRCM_PM_PWSTST_IVA2_InTransition_MASK) >>\
11084 -      PRCM_PM_PWSTST_IVA2_InTransition_OFFSET))
11085 -
11086 -
11087 -#define PRCMPM_PWSTST_DSPPowerStateStGet32(var)\
11088 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_DSPPowerStateStGet32),\
11089 -      (u32)((((u32)(var)) & PRCM_PM_PWSTST_DSP_PowerStateSt_MASK) >>\
11090 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_IDLEST_DSPST_DSPRead32),            \
11091 +       (((__raw_readl((((u32)(baseAddress)) + (CM_IDLEST_IVA2_OFFSET)))) &    \
11092 +       CM_IDLEST_IVA2_ST_IVA2_MASK) >> CM_IDLEST_IVA2_ST_IVA2_OFFSET))
11093 +
11094 +#define PRCMCM_AUTOIDLE_DSPAUTO_DSP_IPIWrite32(baseAddress, value)            \
11095 +do {                                                                          \
11096 +       const u32 offset = PRCM_CM_AUTOIDLE_DSP_OFFSET;                        \
11097 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset);        \
11098 +       register u32 newValue = ((u32)(value));                                \
11099 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_AUTOIDLE_DSPAUTO_DSP_IPIWrite32);    \
11100 +       data &= ~(PRCM_CM_AUTOIDLE_DSP_AUTO_DSP_IPI_MASK);                     \
11101 +       newValue <<= PRCM_CM_AUTOIDLE_DSP_AUTO_DSP_IPI_OFFSET;                 \
11102 +       newValue &= PRCM_CM_AUTOIDLE_DSP_AUTO_DSP_IPI_MASK;                    \
11103 +       newValue |= data;                                                      \
11104 +       __raw_writel(newValue, (u32)(baseAddress) + offset);                   \
11105 +} while (0)
11106 +
11107 +
11108 +#define PRCMCM_CLKSEL_DSPSYNC_DSPWrite32(baseAddress, value)                  \
11109 +do {                                                                          \
11110 +       const u32 offset = PRCM_CM_CLKSEL_DSP_OFFSET;                          \
11111 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset);        \
11112 +       register u32 newValue = ((u32)(value));                                \
11113 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL_DSPSYNC_DSPWrite32);          \
11114 +       data &= ~(PRCM_CM_CLKSEL_DSP_SYNC_DSP_MASK);                           \
11115 +       newValue <<= PRCM_CM_CLKSEL_DSP_SYNC_DSP_OFFSET;                       \
11116 +       newValue &= PRCM_CM_CLKSEL_DSP_SYNC_DSP_MASK;                          \
11117 +       newValue |= data;                                                      \
11118 +       __raw_writel(newValue, (u32)(baseAddress) + offset);                   \
11119 +} while (0)
11120 +
11121 +
11122 +#define PRCMCM_CLKSEL_DSPCLKSEL_DSP_IFWrite32(baseAddress, value)             \
11123 +do {                                                                          \
11124 +       const u32 offset = PRCM_CM_CLKSEL_DSP_OFFSET;                          \
11125 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset);        \
11126 +       register u32 newValue = ((u32)(value));                                \
11127 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL_DSPCLKSEL_DSP_IFWrite32);     \
11128 +       data &= ~(PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_IF_MASK);                      \
11129 +       newValue <<= PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_IF_OFFSET;                  \
11130 +       newValue &= PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_IF_MASK;                     \
11131 +       newValue |= data;                                                      \
11132 +       __raw_writel(newValue, (u32)(baseAddress) + offset);                   \
11133 +} while (0)
11134 +
11135 +#define PRCMCM_CLKSEL_DSPCLKSEL_DSPWrite32(baseAddress, value)                \
11136 +do {                                                                          \
11137 +       const u32 offset = PRCM_CM_CLKSEL_DSP_OFFSET;                          \
11138 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset);        \
11139 +       register u32 newValue = ((u32)(value));                                \
11140 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSEL_DSPCLKSEL_DSPWrite32);        \
11141 +       data &= ~(PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_MASK);                         \
11142 +       newValue <<= PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_OFFSET;                     \
11143 +       newValue &= PRCM_CM_CLKSEL_DSP_CLKSEL_DSP_MASK;                        \
11144 +       newValue |= data;                                                      \
11145 +       __raw_writel(newValue, (u32)(baseAddress) + offset);                   \
11146 +} while (0)
11147 +
11148 +#define PRCMCM_CLKSTCTRL_IVA2WriteRegister32(baseAddress, value)              \
11149 +do {                                                                          \
11150 +       const u32 offset = PRCM_CM_CLKSTCTRL_IVA2_OFFSET;                      \
11151 +       register u32 data = __raw_readl(((baseAddress)) + offset);             \
11152 +       register u32 newValue = ((u32)(value));                                \
11153 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSTCTRL_IVA2WriteRegister32);      \
11154 +       data &= ~(CM_CLKSTCTRL_IVA2_MASK);                                     \
11155 +       newValue <<= CM_CLKSTCTRL_IVA2_OFFSET;                                 \
11156 +       newValue &= CM_CLKSTCTRL_IVA2_MASK;                                    \
11157 +       newValue |= data;                                                      \
11158 +       __raw_writel(newValue, (baseAddress) + offset);                        \
11159 +} while (0)
11160 +
11161 +
11162 +#define PRCMCM_CLKSTCTRL_DSPAutostate_DSPRead32(baseAddress)                  \
11163 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSTCTRL_DSPAutostate_DSPRead32),  \
11164 +       (((__raw_readl((((u32)(baseAddress)) +                                 \
11165 +       (PRCM_CM_CLKSTCTRL_DSP_OFFSET)))) &                                    \
11166 +       PRCM_CM_CLKSTCTRL_DSP_Autostate_DSP_MASK) >>                           \
11167 +       PRCM_CM_CLKSTCTRL_DSP_Autostate_DSP_OFFSET))
11168 +
11169 +#define PRCMCM_CLKSTCTRL_DSPAutostate_DSPWrite32(baseAddress, value)          \
11170 +do {                                                                          \
11171 +       const u32 offset = PRCM_CM_CLKSTCTRL_DSP_OFFSET;                       \
11172 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset);        \
11173 +       register u32 newValue = ((u32)(value));                                \
11174 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_CLKSTCTRL_DSPAutostate_DSPWrite32);  \
11175 +       data &= ~(PRCM_CM_CLKSTCTRL_DSP_Autostate_DSP_MASK);                   \
11176 +       newValue <<= PRCM_CM_CLKSTCTRL_DSP_Autostate_DSP_OFFSET;               \
11177 +       newValue &= PRCM_CM_CLKSTCTRL_DSP_Autostate_DSP_MASK;                  \
11178 +       newValue |= data;                                                      \
11179 +       __raw_writel(newValue, (u32)(baseAddress) + offset);                   \
11180 +} while (0)
11181 +
11182 +#define PRCMRM_RSTCTRL_DSPReadRegister32(baseAddress)                  \
11183 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTCTRL_DSPReadRegister32),  \
11184 +       __raw_readl(((baseAddress)) + PRCM_RM_RSTCTRL_DSP_OFFSET))
11185 +
11186 +#define PRM_RSTCTRL_IVA2RST1_DSPWrite32(baseAddress, value)                   \
11187 +do {                                                                          \
11188 +       const u32 offset = PRM_RSTCTRL_IVA2_OFFSET;                            \
11189 +       register u32 data = __raw_readl(((baseAddress)) + offset);             \
11190 +       register u32 newValue = ((u32)(value));                                \
11191 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTCTRL_DSPRST1_DSPWrite32);         \
11192 +       data &= ~(PRM_RSTCTRL_IVA2_RST1_MASK);                                 \
11193 +       newValue <<= PRM_RSTCTRL_IVA2_RST1_OFFSET;                             \
11194 +       newValue &= PRM_RSTCTRL_IVA2_RST1_MASK;                                \
11195 +       newValue |= data;                                                      \
11196 +       __raw_writel(newValue, (baseAddress) + offset);                        \
11197 +} while (0)
11198 +
11199 +#define PRM_RSTCTRL_IVA2RST2_DSPWrite32(baseAddress, value)            \
11200 +do {                                                                   \
11201 +       const u32 offset = PRM_RSTCTRL_IVA2_OFFSET;                     \
11202 +       register u32 data = __raw_readl(((baseAddress)) + offset);      \
11203 +       register u32 newValue = ((u32)(value));                         \
11204 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTCTRL_DSPRST1_DSPWrite32);  \
11205 +       data &= ~(PRM_RSTCTRL_IVA2_RST2_MASK);                          \
11206 +       newValue <<= PRM_RSTCTRL_IVA2_RST2_OFFSET;                      \
11207 +       newValue &= PRM_RSTCTRL_IVA2_RST2_MASK;                         \
11208 +       newValue |= data;                                               \
11209 +       __raw_writel(newValue, (baseAddress) + offset);                 \
11210 +} while (0)
11211 +
11212 +#define PRM_RSTCTRL_IVA2RST3_DSPWrite32(baseAddress, value)            \
11213 +do {                                                                   \
11214 +       const u32 offset = PRM_RSTCTRL_IVA2_OFFSET;                     \
11215 +       register u32 data = __raw_readl(((baseAddress)) + offset);      \
11216 +       register u32 newValue = ((u32)(value));                         \
11217 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTCTRL_DSPRST1_DSPWrite32);  \
11218 +       data &= ~(PRM_RSTCTRL_IVA2_RST3_MASK);                          \
11219 +       newValue <<= PRM_RSTCTRL_IVA2_RST3_OFFSET;                      \
11220 +       newValue &= PRM_RSTCTRL_IVA2_RST3_MASK;                         \
11221 +       newValue |= data;                                               \
11222 +       __raw_writel(newValue, (baseAddress) + offset);                 \
11223 +} while (0)
11224 +
11225 +#define PRCMRM_RSTST_DSPReadRegister32(baseAddress)                    \
11226 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTST_DSPReadRegister32),    \
11227 +       __raw_readl(((baseAddress)) + PRCM_RM_RSTST_DSP_OFFSET))
11228 +
11229 +#define PRCMRM_RSTST_DSPWriteRegister32(baseAddress, value)            \
11230 +do {                                                                   \
11231 +       const u32 offset = PRCM_RM_RSTST_DSP_OFFSET;                    \
11232 +       register u32 newValue = ((u32)(value));                         \
11233 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTST_DSPWriteRegister32);    \
11234 +       __raw_writel(newValue, ((u32)(baseAddress)) + offset);          \
11235 +} while (0)
11236 +
11237 +#define PRCMPM_PWSTCTRL_DSPForceStateWrite32(baseAddress, value)         \
11238 +do {                                                                     \
11239 +       const u32 offset = PRCM_PM_PWSTCTRL_DSP_OFFSET;                   \
11240 +       register u32 data = __raw_readl(((u32)(baseAddress)) + offset);   \
11241 +       register u32 newValue = ((u32)(value));                           \
11242 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTCTRL_DSPForceStateWrite32); \
11243 +       data &= ~(PRCM_PM_PWSTCTRL_DSP_ForceState_MASK);                  \
11244 +       newValue <<= PRCM_PM_PWSTCTRL_DSP_ForceState_OFFSET;              \
11245 +       newValue &= PRCM_PM_PWSTCTRL_DSP_ForceState_MASK;                 \
11246 +       newValue |= data;                                                 \
11247 +       __raw_writel(newValue, (u32)(baseAddress) + offset);              \
11248 +} while (0)
11249 +
11250 +#define PRCMPM_PWSTCTRL_IVA2PowerStateWriteON32(baseAddress)                  \
11251 +do {                                                                          \
11252 +       const u32 offset = PRCM_PM_PWSTCTRL_IVA2_OFFSET;                       \
11253 +       const u32 newValue = (u32)PRCMPM_PWSTCTRL_IVA2PowerStateON <<          \
11254 +               PRCM_PM_PWSTCTRL_IVA2_PowerState_OFFSET;                       \
11255 +       register u32 data = __raw_readl((baseAddress) + offset);               \
11256 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTCTRL_IVA2PowerStateWriteON32);   \
11257 +       data &= ~(PRCM_PM_PWSTCTRL_IVA2_PowerState_MASK);                      \
11258 +       data |= newValue;                                                      \
11259 +       __raw_writel(data, (baseAddress) + offset);                            \
11260 +} while (0)
11261 +
11262 +#define PRCMPM_PWSTCTRL_IVA2PowerStateWriteOFF32(baseAddress)                 \
11263 +do {                                                                          \
11264 +       const u32 offset = PRCM_PM_PWSTCTRL_IVA2_OFFSET;                       \
11265 +       const u32 newValue = (u32)PRCMPM_PWSTCTRL_IVA2PowerStateOFF <<         \
11266 +               PRCM_PM_PWSTCTRL_IVA2_PowerState_OFFSET;                       \
11267 +       register u32 data = __raw_readl((baseAddress) + offset);               \
11268 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTCTRL_IVA2PowerStateWriteOFF32);  \
11269 +       data &= ~(PRCM_PM_PWSTCTRL_IVA2_PowerState_MASK);                      \
11270 +       data |= newValue;                                                      \
11271 +       __raw_writel(data, (baseAddress) + offset);                            \
11272 +} while (0)
11273 +
11274 +#define PRCMPM_PWSTCTRL_DSPPowerStateWriteRET32(baseAddress)                  \
11275 +do {                                                                          \
11276 +       const u32 offset = PRCM_PM_PWSTCTRL_DSP_OFFSET;                        \
11277 +       const u32 newValue = (u32)PRCMPM_PWSTCTRL_DSPPowerStateRET <<          \
11278 +               PRCM_PM_PWSTCTRL_DSP_PowerState_OFFSET;                        \
11279 +       register u32 data = __raw_readl((baseAddress) + offset);               \
11280 +       _DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTCTRL_DSPPowerStateWriteRET32);   \
11281 +       data &= ~(PRCM_PM_PWSTCTRL_DSP_PowerState_MASK);                       \
11282 +       data |= newValue;                                                      \
11283 +       __raw_writel(data, (baseAddress) + offset);                            \
11284 +} while (0)
11285 +
11286 +#define PRCMPM_PWSTST_DSPReadRegister32(baseAddress)                   \
11287 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_DSPReadRegister32),   \
11288 +       __raw_readl(((u32)(baseAddress)) + PRCM_PM_PWSTST_DSP_OFFSET))
11289 +
11290 +
11291 +#define PRCMPM_PWSTST_IVA2ReadRegister32(baseAddress)                  \
11292 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_IVA2ReadRegister32),  \
11293 +       __raw_readl((baseAddress) + PRCM_PM_PWSTST_IVA2_OFFSET))
11294 +
11295 +
11296 +#define PRCMPM_PWSTST_DSPInTransitionRead32(baseAddress)                      \
11297 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_DSPInTransitionRead32),      \
11298 +       (((__raw_readl((((u32)(baseAddress)) +                                 \
11299 +       (PRCM_PM_PWSTST_DSP_OFFSET)))) &                                       \
11300 +       PRCM_PM_PWSTST_DSP_InTransition_MASK) >>                               \
11301 +       PRCM_PM_PWSTST_DSP_InTransition_OFFSET))
11302 +
11303 +#define PRCMPM_PWSTST_IVA2InTransitionRead32(baseAddress)                     \
11304 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_IVA2InTransitionRead32),     \
11305 +       (((__raw_readl((((baseAddress)) +                                      \
11306 +       (PRCM_PM_PWSTST_IVA2_OFFSET)))) &                                      \
11307 +       PRCM_PM_PWSTST_IVA2_InTransition_MASK) >>                              \
11308 +       PRCM_PM_PWSTST_IVA2_InTransition_OFFSET))
11309 +
11310 +#define PRCMPM_PWSTST_DSPPowerStateStGet32(var)                                       \
11311 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_DSPPowerStateStGet32),       \
11312 +       (u32)((((u32)(var)) & PRCM_PM_PWSTST_DSP_PowerStateSt_MASK) >>         \
11313         PRCM_PM_PWSTST_DSP_PowerStateSt_OFFSET))
11314  
11315 -
11316 -#define PRCMPM_PWSTST_IVA2PowerStateStGet32(var)\
11317 -    (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_IVA2PowerStateStGet32),\
11318 -      (u32)((((u32)(var)) & PRCM_PM_PWSTST_IVA2_PowerStateSt_MASK) >>\
11319 -      PRCM_PM_PWSTST_IVA2_PowerStateSt_OFFSET))
11320 -
11321 +#define PRCMPM_PWSTST_IVA2PowerStateStGet32(var)                              \
11322 +       (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_IVA2PowerStateStGet32),      \
11323 +       (u32)((((u32)(var)) & PRCM_PM_PWSTST_IVA2_PowerStateSt_MASK) >>        \
11324 +       PRCM_PM_PWSTST_IVA2_PowerStateSt_OFFSET))
11325  
11326  #endif  /* USE_LEVEL_1_MACROS */
11327  
11328 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_defs.h kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_defs.h
11329 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_defs.h    2011-04-17 17:32:26.000000000 +0100
11330 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_defs.h 2011-05-02 22:36:49.000000000 +0100
11331 @@ -3,6 +3,8 @@
11332   *
11333   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11334   *
11335 + * Global HW definitions
11336 + *
11337   * Copyright (C) 2007 Texas Instruments, Inc.
11338   *
11339   * This package is free software; you can redistribute it and/or modify
11340 @@ -14,17 +16,6 @@
11341   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11342   */
11343  
11344 -
11345 -/*
11346 - *  ======== hw_defs.h ========
11347 - *  Description:
11348 - *      Global HW definitions
11349 - *
11350 - *! Revision History:
11351 - *! ================
11352 - *! 19 Apr 2004 sb: Added generic page size, endianness and element size defns
11353 - *! 16 Feb 2003 sb: Initial version
11354 - */
11355  #ifndef __HW_DEFS_H
11356  #define __HW_DEFS_H
11357  
11358 @@ -39,11 +30,9 @@
11359  /* HW_STATUS:  return type for HW API */
11360  typedef long HW_STATUS;
11361  
11362 -/* HW_SetClear_t:  Enumerated Type used to set and clear any bit */
11363 -enum HW_SetClear_t {
11364 -    HW_CLEAR,
11365 -    HW_SET
11366 -} ;
11367 +/*  Macro used to set and clear any bit */
11368 +#define HW_CLEAR       0
11369 +#define HW_SET         1
11370  
11371  /* HW_Endianism_t:  Enumerated Type used to specify the endianism
11372   *             Do NOT change these values. They are used as bit fields. */
11373 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_dspssC64P.c kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_dspssC64P.c
11374 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_dspssC64P.c       2011-04-17 17:32:26.000000000 +0100
11375 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_dspssC64P.c    2011-05-02 22:36:49.000000000 +0100
11376 @@ -3,6 +3,8 @@
11377   *
11378   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11379   *
11380 + * API definitions to configure DSP Subsystem modules like IPI
11381 + *
11382   * Copyright (C) 2005-2006 Texas Instruments, Inc.
11383   *
11384   * This package is free software; you can redistribute it and/or modify
11385 @@ -14,17 +16,6 @@
11386   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11387   */
11388  
11389 -/*
11390 - *  ======== hw_dspss64P.c ========
11391 - *  Description:
11392 - *      API definitions to configure DSP Subsystem modules like IPI
11393 - *
11394 - *! Revision History:
11395 - *! ================
11396 - *! 19 Apr 2004 sb: Implemented HW_DSPSS_IPIEndianismSet
11397 - *! 16 Feb 2003 sb: Initial version
11398 - */
11399 -
11400  /* PROJECT SPECIFIC INCLUDE FILES */
11401  #include <GlobalTypes.h>
11402  #include <linux/io.h>
11403 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_dspssC64P.h kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_dspssC64P.h
11404 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_dspssC64P.h       2011-04-17 17:32:26.000000000 +0100
11405 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_dspssC64P.h    2011-05-02 22:36:49.000000000 +0100
11406 @@ -3,6 +3,8 @@
11407   *
11408   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11409   *
11410 + * DSP Subsystem API declarations
11411 + *
11412   * Copyright (C) 2005-2006 Texas Instruments, Inc.
11413   *
11414   * This package is free software; you can redistribute it and/or modify
11415 @@ -14,19 +16,6 @@
11416   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11417   */
11418  
11419 -
11420 -/*
11421 - *  ======== hw_dspss.h ========
11422 - *  Description:
11423 - *      DSP Subsystem API declarations
11424 - *
11425 - *! Revision History:
11426 - *! ================
11427 - *! 19-Apr-2004 sb: Removed redundant argument from HW_DSPSS_IPIEndianismSet
11428 - *!                Moved endianness and element size to generic hw_defs.h
11429 - *! 16 Feb 2003 sb: Initial version
11430 - */
11431 -
11432  #ifndef __HW_DSPSS_H
11433  #define __HW_DSPSS_H
11434  #include <linux/types.h>
11435 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_mbox.c kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_mbox.c
11436 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_mbox.c    2011-04-17 17:32:26.000000000 +0100
11437 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_mbox.c 2011-05-02 22:36:49.000000000 +0100
11438 @@ -3,6 +3,8 @@
11439   *
11440   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11441   *
11442 + * Mailbox messaging & configuration API definitions
11443 + *
11444   * Copyright (C) 2007 Texas Instruments, Inc.
11445   *
11446   * This package is free software; you can redistribute it and/or modify
11447 @@ -14,17 +16,6 @@
11448   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11449   */
11450  
11451 -
11452 -/*
11453 - *  ======== hw_mbox.c ========
11454 - *  Description:
11455 - *      Mailbox messaging & configuration API definitions
11456 - *
11457 - *! Revision History:
11458 - *! ================
11459 - *! 16 Feb 2003 sb: Initial version
11460 - */
11461 -
11462  #include <GlobalTypes.h>
11463  #include "MLBRegAcM.h"
11464  #include <hw_defs.h>
11465 @@ -33,10 +24,20 @@
11466  /* width in bits of MBOX Id */
11467  #define HW_MBOX_ID_WIDTH          2
11468  
11469 +/* SYSCONFIG: register bit definition */
11470 +#define AUTOIDLE       (1 << 0)
11471 +#define SMARTIDLE      (2 << 3)
11472 +
11473  struct MAILBOX_CONTEXT mboxsetting = {
11474 -       .sysconfig = 2 << 3 | 1, /* SMART/AUTO-IDLE */
11475 +       .sysconfig = SMARTIDLE | AUTOIDLE,
11476  };
11477  
11478 +HW_STATUS HW_MBOX_initSettings(void __iomem *baseAddress)
11479 +{
11480 +       MLBMAILBOX_SYSCONFIGWriteRegister32(baseAddress, SMARTIDLE | AUTOIDLE);
11481 +       return RET_OK;
11482 +}
11483 +
11484  /* Saves the mailbox context */
11485  HW_STATUS HW_MBOX_saveSettings(void __iomem *baseAddress)
11486  {
11487 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_mbox.h kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_mbox.h
11488 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_mbox.h    2011-04-17 17:32:26.000000000 +0100
11489 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_mbox.h 2011-05-02 22:36:49.000000000 +0100
11490 @@ -3,6 +3,8 @@
11491   *
11492   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11493   *
11494 + * HW Mailbox API and types definitions
11495 + *
11496   * Copyright (C) 2007 Texas Instruments, Inc.
11497   *
11498   * This package is free software; you can redistribute it and/or modify
11499 @@ -14,15 +16,6 @@
11500   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11501   */
11502  
11503 -/*
11504 - *  ======== hw_mbox.h ========
11505 - *  Description:
11506 - *      HW Mailbox API and types definitions
11507 - *
11508 - *! Revision History:
11509 - *! ================
11510 - *! 16 Feb 2003 sb: Initial version
11511 - */
11512  #ifndef __MBOX_H
11513  #define __MBOX_H
11514  
11515 @@ -123,11 +116,8 @@ extern HW_STATUS HW_MBOX_MsgRead(const v
11516  * PURPOSE:      : this function writes a u32 from the sub module message
11517  *               box Specified.
11518  */
11519 -extern HW_STATUS HW_MBOX_MsgWrite(
11520 -                     const void __iomem *baseAddress,
11521 -                     const HW_MBOX_Id_t   mailBoxId,
11522 -                     const u32  writeValue
11523 -                 );
11524 +extern HW_STATUS HW_MBOX_MsgWrite(const void __iomem *baseAddress,
11525 +                       const HW_MBOX_Id_t mailBoxId, const u32 writeValue);
11526  
11527  /*
11528  * FUNCTION      : HW_MBOX_NumMsgGet
11529 @@ -157,11 +147,8 @@ extern HW_STATUS HW_MBOX_MsgWrite(
11530  *
11531  * PURPOSE:      : this function gets number of messages in a specified mailbox.
11532  */
11533 -extern HW_STATUS HW_MBOX_NumMsgGet(
11534 -                     const void         __iomem *baseAddress,
11535 -                     const HW_MBOX_Id_t   mailBoxId,
11536 -                     u32 *const        pNumMsg
11537 -                 );
11538 +extern HW_STATUS HW_MBOX_NumMsgGet(const void __iomem *baseAddress,
11539 +                       const HW_MBOX_Id_t mailBoxId, u32 *const pNumMsg);
11540  
11541  /*
11542  * FUNCTION      : HW_MBOX_EventEnable
11543 @@ -193,12 +180,10 @@ extern HW_STATUS HW_MBOX_NumMsgGet(
11544  *
11545  * PURPOSE:      : this function enables the specified IRQ.
11546  */
11547 -extern HW_STATUS HW_MBOX_EventEnable(
11548 -                     const void __iomem *baseAddress,
11549 -                     const HW_MBOX_Id_t       mailBoxId,
11550 -                     const HW_MBOX_UserId_t   userId,
11551 -                     const u32      events
11552 -                 );
11553 +extern HW_STATUS HW_MBOX_EventEnable(const void __iomem *baseAddress,
11554 +                       const HW_MBOX_Id_t mailBoxId,
11555 +                       const HW_MBOX_UserId_t userId,
11556 +                       const u32 events);
11557  
11558  /*
11559  * FUNCTION      : HW_MBOX_EventDisable
11560 @@ -230,12 +215,10 @@ extern HW_STATUS HW_MBOX_EventEnable(
11561  *
11562  * PURPOSE:      : this function disables the specified IRQ.
11563  */
11564 -extern HW_STATUS HW_MBOX_EventDisable(
11565 -                     const void __iomem *baseAddress,
11566 -                     const HW_MBOX_Id_t       mailBoxId,
11567 -                     const HW_MBOX_UserId_t   userId,
11568 -                     const u32      events
11569 -                 );
11570 +extern HW_STATUS HW_MBOX_EventDisable(const void __iomem *baseAddress,
11571 +               const HW_MBOX_Id_t mailBoxId,
11572 +               const HW_MBOX_UserId_t userId,
11573 +               const u32 events);
11574  
11575  /*
11576  * FUNCTION      : HW_MBOX_EventAck
11577 @@ -269,12 +252,32 @@ extern HW_STATUS HW_MBOX_EventDisable(
11578  *
11579  * PURPOSE:      : this function sets the status of the specified IRQ.
11580  */
11581 -extern HW_STATUS HW_MBOX_EventAck(
11582 -                     const void        __iomem *baseAddress,
11583 -                     const HW_MBOX_Id_t        mailBoxId,
11584 -                     const HW_MBOX_UserId_t    userId,
11585 -                     const u32       event
11586 -                 );
11587 +extern HW_STATUS HW_MBOX_EventAck(const void __iomem *baseAddress,
11588 +                       const HW_MBOX_Id_t mailBoxId,
11589 +                       const HW_MBOX_UserId_t userId,
11590 +                       const u32 event);
11591 +
11592 +/*
11593 +* FUNCTION      : HW_MBOX_initSettings
11594 +*
11595 +* INPUTS:
11596 +*
11597 +*   Identifier  : baseAddress
11598 +*   Type       : const u32
11599 +*   Description : Base Address of instance of Mailbox module
11600 +*
11601 +*
11602 +* RETURNS:
11603 +*
11604 +*   Type       : ReturnCode_t
11605 +*   Description : RET_OK             No errors occured
11606 +*               RET_BAD_NULL_PARAM  Address/pointer Paramater was set to 0/NULL
11607 +*               RET_INVALID_ID      Invalid Id used
11608 +*               RET_EMPTY         Mailbox empty
11609 +*
11610 +* PURPOSE:      : This function initialize the mailbox configuration.
11611 +*/
11612 +extern HW_STATUS HW_MBOX_initSettings(void __iomem *baseAddres);
11613  
11614  /*
11615  * FUNCTION      : HW_MBOX_saveSettings
11616 @@ -320,9 +323,4 @@ extern HW_STATUS HW_MBOX_saveSettings(vo
11617  */
11618  extern HW_STATUS HW_MBOX_restoreSettings(void __iomem *baseAddres);
11619  
11620 -static inline void HW_MBOX_initSettings(void __iomem *baseAddres)
11621 -{
11622 -       HW_MBOX_restoreSettings(baseAddres);
11623 -}
11624 -
11625  #endif  /* __MBOX_H */
11626 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_mmu.c kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_mmu.c
11627 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_mmu.c     2011-04-17 17:32:26.000000000 +0100
11628 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_mmu.c  2011-05-02 22:36:49.000000000 +0100
11629 @@ -3,6 +3,8 @@
11630   *
11631   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11632   *
11633 + * API definitions to setup MMU TLB and PTE
11634 + *
11635   * Copyright (C) 2007 Texas Instruments, Inc.
11636   *
11637   * This package is free software; you can redistribute it and/or modify
11638 @@ -14,21 +16,6 @@
11639   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11640   */
11641  
11642 -/*
11643 - *  ======== hw_mmu.c ========
11644 - *  Description:
11645 - *      API definitions to setup MMU TLB and PTE
11646 - *
11647 - *! Revision History:
11648 - *! ================
11649 - *! 19-Apr-2004 sb  TLBAdd and TLBFlush input the page size in bytes instead
11650 -                   of an enum. TLBAdd inputs mapping attributes struct instead
11651 -                   of individual arguments.
11652 -                   Removed MMU.h and other cosmetic updates.
11653 - *! 08-Mar-2004 sb  Added the Page Table Management APIs
11654 - *! 16 Feb 2003 sb: Initial version
11655 - */
11656 -
11657  #include <GlobalTypes.h>
11658  #include <linux/io.h>
11659  #include "MMURegAcM.h"
11660 @@ -350,8 +337,7 @@ HW_STATUS HW_MMU_TLBAdd(const void __iom
11661                            u32        pageSize,
11662                            u32        entryNum,
11663                            struct HW_MMUMapAttrs_t    *mapAttrs,
11664 -                          enum HW_SetClear_t       preservedBit,
11665 -                          enum HW_SetClear_t       validBit)
11666 +                          s8 preservedBit, s8 validBit)
11667  {
11668      HW_STATUS  status = RET_OK;
11669      u32 lockReg;
11670 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_mmu.h kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_mmu.h
11671 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_mmu.h     2011-04-17 17:32:26.000000000 +0100
11672 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_mmu.h  2011-05-02 22:36:49.000000000 +0100
11673 @@ -3,6 +3,8 @@
11674   *
11675   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11676   *
11677 + * MMU types and API declarations
11678 + *
11679   * Copyright (C) 2007 Texas Instruments, Inc.
11680   *
11681   * This package is free software; you can redistribute it and/or modify
11682 @@ -14,19 +16,6 @@
11683   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11684   */
11685  
11686 -
11687 -/*
11688 - *  ======== hw_mmu.h ========
11689 - *  Description:
11690 - *      MMU types and API declarations
11691 - *
11692 - *! Revision History:
11693 - *! ================
11694 - *! 19-Apr-2004 sb  Moved & renamed endianness, page size, element size
11695 -                   TLBAdd takes in MMUMapAttrs instead of separate arguments
11696 - *! 08-Mar-2004 sb  Added the Page Table management APIs
11697 - *! 16 Feb 2003 sb: Initial version
11698 - */
11699  #ifndef __HW_MMU_H
11700  #define __HW_MMU_H
11701  
11702 @@ -98,8 +87,7 @@ extern HW_STATUS HW_MMU_TLBAdd(const voi
11703                                   u32      pageSize,
11704                                   u32       entryNum,
11705                                   struct HW_MMUMapAttrs_t *mapAttrs,
11706 -                                 enum HW_SetClear_t    preservedBit,
11707 -                                 enum HW_SetClear_t    validBit);
11708 +                                 s8 preservedBit, s8 validBit);
11709  
11710  
11711  /* For PTEs */
11712 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_prcm.c kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_prcm.c
11713 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_prcm.c    2011-04-17 17:32:26.000000000 +0100
11714 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_prcm.c 2011-05-02 22:36:49.000000000 +0100
11715 @@ -3,6 +3,8 @@
11716   *
11717   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11718   *
11719 + * API definitions to configure PRCM (Power, Reset & Clocks Manager)
11720 + *
11721   * Copyright (C) 2007 Texas Instruments, Inc.
11722   *
11723   * This package is free software; you can redistribute it and/or modify
11724 @@ -14,24 +16,13 @@
11725   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11726   */
11727  
11728 -/*
11729 - *  ======== hw_prcm.c ========
11730 - *  Description:
11731 - *      API definitions to configure PRCM (Power, Reset & Clocks Manager)
11732 - *
11733 - *! Revision History:
11734 - *! ================
11735 - *! 16 Feb 2003 sb: Initial version
11736 - */
11737 -
11738  #include <GlobalTypes.h>
11739  #include "PRCMRegAcM.h"
11740  #include <hw_defs.h>
11741  #include <hw_prcm.h>
11742  
11743  static HW_STATUS HW_RST_WriteVal(const void __iomem *baseAddress,
11744 -                                   enum HW_RstModule_t r,
11745 -                                   enum HW_SetClear_t val);
11746 +                                   enum HW_RstModule_t r, s8 val);
11747  
11748  HW_STATUS HW_RST_Reset(const void __iomem *baseAddress, enum HW_RstModule_t r)
11749  {
11750 @@ -44,8 +35,7 @@ HW_STATUS HW_RST_UnReset(const void __io
11751  }
11752  
11753  static HW_STATUS HW_RST_WriteVal(const void __iomem *baseAddress,
11754 -                                   enum HW_RstModule_t r,
11755 -                                   enum HW_SetClear_t val)
11756 +                                   enum HW_RstModule_t r, s8 val)
11757  {
11758         HW_STATUS status = RET_OK;
11759  
11760 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_prcm.h kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_prcm.h
11761 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/hw/hw_prcm.h    2011-04-17 17:32:26.000000000 +0100
11762 +++ kernel-power-2.6.28/drivers/dsp/bridge/hw/hw_prcm.h 2011-05-02 22:36:49.000000000 +0100
11763 @@ -3,6 +3,8 @@
11764   *
11765   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11766   *
11767 + * PRCM types and API declarations
11768 + *
11769   * Copyright (C) 2007 Texas Instruments, Inc.
11770   *
11771   * This package is free software; you can redistribute it and/or modify
11772 @@ -14,16 +16,6 @@
11773   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11774   */
11775  
11776 -/*
11777 - *  ======== hw_prcm.h ========
11778 - *  Description:
11779 - *      PRCM types and API declarations
11780 - *
11781 - *! Revision History:
11782 - *! ================
11783 - *! 16 Feb 2003 sb: Initial version
11784 - */
11785 -
11786  #ifndef __HW_PRCM_H
11787  #define __HW_PRCM_H
11788  
11789 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/chnl.c kernel-power-2.6.28/drivers/dsp/bridge/pmgr/chnl.c
11790 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/chnl.c     2011-04-17 17:32:26.000000000 +0100
11791 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/chnl.c  2011-05-02 22:36:49.000000000 +0100
11792 @@ -3,6 +3,9 @@
11793   *
11794   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11795   *
11796 + * WCD channel interface: multiplexes data streams through the single
11797 + * physical link managed by a Bridge mini-driver.
11798 + *
11799   * Copyright (C) 2005-2006 Texas Instruments, Inc.
11800   *
11801   * This package is free software; you can redistribute it and/or modify
11802 @@ -14,54 +17,6 @@
11803   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11804   */
11805  
11806 -
11807 -/*
11808 - *  ======== chnl.c ========
11809 - *  Description:
11810 - *      WCD channel interface: multiplexes data streams through the single
11811 - *      physical link managed by a 'Bridge mini-driver.
11812 - *
11813 - *  Public Functions:
11814 - *      CHNL_Close
11815 - *      CHNL_CloseOrphans
11816 - *      CHNL_Create
11817 - *      CHNL_Destroy
11818 - *      CHNL_Exit
11819 - *      CHNL_GetHandle
11820 - *      CHNL_GetProcessHandle
11821 - *      CHNL_Init
11822 - *      CHNL_Open
11823 - *
11824 - *  Notes:
11825 - *      This interface is basically a pass through to the WMD CHNL functions,
11826 - *      except for the CHNL_Get() accessor functions which call
11827 - *      WMD_CHNL_GetInfo().
11828 - *
11829 - *! Revision History:
11830 - *! ================
11831 - *! 24-Feb-2003 swa PMGR Code review comments incorporated.
11832 - *! 07-Jan-2002 ag  CHNL_CloseOrphans() now closes supported # of channels.
11833 - *! 17-Nov-2000 jeh Removed IRQ, shared memory stuff from CHNL_Create.
11834 - *! 28-Feb-2000 rr: New GT USage Implementation
11835 - *! 03-Feb-2000 rr: GT and Module init/exit Changes.(Done up front from
11836 - *!                SERVICES)
11837 - *! 21-Jan-2000 ag: Added code review comments.
11838 - *! 13-Jan-2000 rr: CFG_Get/SetPrivateDword renamed to CFG_Get/SetDevObject.
11839 - *! 08-Dec-1999 ag: CHNL_[Alloc|Free]Buffer bufs taken from client process heap.
11840 - *! 02-Dec-1999 ag: Implemented CHNL_GetEventHandle().
11841 - *! 17-Nov-1999 ag: CHNL_AllocBuffer() allocs extra word for process mapping.
11842 - *! 28-Oct-1999 ag: WinCE port. Search for "WinCE" for changes(TBR).
11843 - *! 07-Jan-1998 gp: CHNL_[Alloc|Free]Buffer now call MEM_UMB functions.
11844 - *! 22-Oct-1997 gp: Removed requirement in CHNL_Open that hReserved1 != NULL.
11845 - *! 30-Aug-1997 cr: Renamed cfg.h wbwcd.h b/c of WINNT file name collision.
11846 - *! 10-Mar-1997 gp: Added GT trace.
11847 - *! 14-Jan-1997 gp: Updated based on code review feedback.
11848 - *! 03-Jan-1997 gp: Moved CHNL_AllocBuffer/CHNL_FreeBuffer code from udspsys.
11849 - *! 14-Dec-1996 gp: Added uChnlId parameter to CHNL_Open().
11850 - *! 09-Sep-1996 gp: Added CHNL_GetProcessHandle().
11851 - *! 15-Jul-1996 gp: Created.
11852 - */
11853 -
11854  /*  ----------------------------------- Host OS */
11855  #include <dspbridge/host_os.h>
11856  
11857 @@ -76,9 +31,6 @@
11858  
11859  /*  ----------------------------------- OS Adaptation Layer */
11860  #include <dspbridge/cfg.h>
11861 -#include <dspbridge/csl.h>
11862 -#include <dspbridge/dpc.h>
11863 -#include <dspbridge/list.h>
11864  #include <dspbridge/mem.h>
11865  #include <dspbridge/sync.h>
11866  
11867 @@ -153,10 +105,12 @@ DSP_STATUS CHNL_Create(OUT struct CHNL_M
11868  
11869         if (DSP_SUCCEEDED(status)) {
11870                 struct WMD_DRV_INTERFACE *pIntfFxns;
11871 -               DEV_GetIntfFxns(hDevObject, &pIntfFxns);
11872 -               /* Let WMD channel module finish the create: */
11873 -               status = (*pIntfFxns->pfnChnlCreate)(&hChnlMgr, hDevObject,
11874 -                         pMgrAttrs);
11875 +               status = DEV_GetIntfFxns(hDevObject, &pIntfFxns);
11876 +               if (pIntfFxns) {
11877 +                       /* Let WMD channel module finish the create */
11878 +                       status = (*pIntfFxns->pfnChnlCreate)(&hChnlMgr,
11879 +                                               hDevObject, pMgrAttrs);
11880 +               }
11881                 if (DSP_SUCCEEDED(status)) {
11882                         /* Fill in WCD channel module's fields of the
11883                          * CHNL_MGR structure */
11884 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/chnlobj.h kernel-power-2.6.28/drivers/dsp/bridge/pmgr/chnlobj.h
11885 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/chnlobj.h  2011-04-17 17:32:26.000000000 +0100
11886 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/chnlobj.h       2011-05-02 22:36:49.000000000 +0100
11887 @@ -3,6 +3,9 @@
11888   *
11889   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11890   *
11891 + * Structure subcomponents of channel class library channel objects which
11892 + * are exposed to class driver from mini-driver.
11893 + *
11894   * Copyright (C) 2005-2006 Texas Instruments, Inc.
11895   *
11896   * This package is free software; you can redistribute it and/or modify
11897 @@ -14,24 +17,6 @@
11898   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11899   */
11900  
11901 -
11902 -/*
11903 - *  ======== chnlobj.h ========
11904 - *  Description:
11905 - *      Structure subcomponents of channel class library channel objects which
11906 - *      are exposed to class driver from mini-driver.
11907 - *
11908 - *  Public Functions:
11909 - *      None.
11910 - *
11911 - *! Revision History:
11912 - *! ================
11913 - *! 24-Feb-2003 swa    PMGR Code review comments incorporated.
11914 - *! 17-Nov-2000 jeh     Removed some fields from CHNL_MGR_ to match CHNL_MGR
11915 - *!                     structure defined in _chnl_sm.h.
11916 - *! 16-Jan-1997 gp:     Created from chnlpriv.h
11917 - */
11918 -
11919  #ifndef CHNLOBJ_
11920  #define CHNLOBJ_
11921  
11922 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/cmm.c kernel-power-2.6.28/drivers/dsp/bridge/pmgr/cmm.c
11923 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/cmm.c      2011-04-17 17:32:26.000000000 +0100
11924 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/cmm.c   2011-05-02 22:36:49.000000000 +0100
11925 @@ -3,6 +3,22 @@
11926   *
11927   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11928   *
11929 + * The Communication(Shared) Memory Management(CMM) module provides
11930 + * shared memory management services for DSP/BIOS Bridge data streaming
11931 + * and messaging.
11932 + *
11933 + * Multiple shared memory segments can be registered with CMM.
11934 + * Each registered SM segment is represented by a SM "allocator" that
11935 + * describes a block of physically contiguous shared memory used for
11936 + * future allocations by CMM.
11937 + *
11938 + * Memory is coelesced back to the appropriate heap when a buffer is
11939 + * freed.
11940 + *
11941 + * Notes:
11942 + *   Va: Virtual address.
11943 + *   Pa: Physical or kernel system address.
11944 + *
11945   * Copyright (C) 2005-2006 Texas Instruments, Inc.
11946   *
11947   * This package is free software; you can redistribute it and/or modify
11948 @@ -14,85 +30,6 @@
11949   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11950   */
11951  
11952 -
11953 -/*
11954 - *  ======== cmm.c ========
11955 - *  Purpose:
11956 - *      The Communication(Shared) Memory Management(CMM) module provides
11957 - *      shared memory management services for DSP/BIOS Bridge data streaming
11958 - *      and messaging.
11959 - *
11960 - *      Multiple shared memory segments can be registered with CMM.
11961 - *      Each registered SM segment is represented by a SM "allocator" that
11962 - *      describes a block of physically contiguous shared memory used for
11963 - *      future allocations by CMM.
11964 - *
11965 - *      Memory is coelesced back to the appropriate heap when a buffer is
11966 - *      freed.
11967 - *
11968 - *  Public Functions:
11969 - *      CMM_CallocBuf
11970 - *      CMM_Create
11971 - *      CMM_Destroy
11972 - *      CMM_Exit
11973 - *      CMM_FreeBuf
11974 - *      CMM_GetHandle
11975 - *      CMM_GetInfo
11976 - *      CMM_Init
11977 - *      CMM_RegisterGPPSMSeg
11978 - *      CMM_UnRegisterGPPSMSeg
11979 - *
11980 - *      The CMM_Xlator[xxx] routines below are used by Node and Stream
11981 - *      to perform SM address translation to the client process address space.
11982 - *      A "translator" object is created by a node/stream for each SM seg used.
11983 - *
11984 - *  Translator Routines:
11985 - *      CMM_XlatorAllocBuf
11986 - *      CMM_XlatorCreate
11987 - *      CMM_XlatorDelete
11988 - *      CMM_XlatorFreeBuf
11989 - *      CMM_XlatorInfo
11990 - *      CMM_XlatorTranslate
11991 - *
11992 - *  Private Functions:
11993 - *      AddToFreeList
11994 - *      GetAllocator
11995 - *      GetFreeBlock
11996 - *      GetNode
11997 - *      GetSlot
11998 - *      UnRegisterGPPSMSeg
11999 - *
12000 - *  Notes:
12001 - *      Va: Virtual address.
12002 - *      Pa: Physical or kernel system address.
12003 - *
12004 - *! Revision History:
12005 - *! ================
12006 - *! 24-Feb-2003 swa PMGR Code review comments incorporated.
12007 - *! 16-Feb-2002 ag  Code review cleanup.
12008 - *!                 PreOMAP address translation no longner supported.
12009 - *! 30-Jan-2002 ag  Updates to CMM_XlatorTranslate() per TII, ANSI C++
12010 - *!                 warnings.
12011 - *! 27-Jan-2002 ag  Removed unused CMM_[Alloc][Free]Desc() & #ifdef USELOOKUP,
12012 - *!                 & unused VALIDATECMM and VaPaConvert().
12013 - *!                 Removed bFastXlate from CMM_XLATOR. Always fast lookup.
12014 - *! 03-Jan-2002 ag  Clear SM in CMM_AllocBuf(). Renamed to CMM_CallocBuf().
12015 - *! 13-Nov-2001 ag  Now delete pNodeFreeListHead and nodes in CMM_Destroy().
12016 - *! 28-Aug-2001 ag  CMM_GetHandle() returns CMM Mgr hndle given HPROCESSOR.
12017 - *!                 Removed unused CMM_[Un]RegisterDSPSMSeg() &
12018 - *                  CMM_[Un}ReserveVirtSpace fxns. Some cleanup.
12019 - *! 12-Aug-2001 ag  Exposed CMM_UnRegisterGPP[DSP]SMSeg.
12020 - *! 13-Feb-2001 kc  DSP/BIOS Bridge name update.
12021 - *! 21-Dec-2000 rr  GetFreeBlock checks for pAllocator.
12022 - *! 09-Dec-2000 ag  Added GPPPA2DSPPA, DSPPA2GPPPA macros.
12023 - *! 05-Dec-2000 ag  CMM_XlatorDelete() optionally frees SM bufs and descriptors.
12024 - *! 30-Oct-2000 ag  Buf size bug fixed in CMM_AllocBuf() causing leak.
12025 - *!                 Revamped XlatorTranslate() routine.
12026 - *! 10-Oct-2000 ag  Added CMM_Xlator[xxx] functions.
12027 - *! 02-Aug-2000 ag  Created.
12028 - *!
12029 - */
12030 -
12031  /*  ----------------------------------- DSP/BIOS Bridge */
12032  #include <dspbridge/std.h>
12033  #include <dspbridge/dbdefs.h>
12034 @@ -107,7 +44,7 @@
12035  #include <dspbridge/list.h>
12036  #include <dspbridge/mem.h>
12037  #include <dspbridge/sync.h>
12038 -#include <dspbridge/util.h>
12039 +#include <dspbridge/utildefs.h>
12040  
12041  /*  ----------------------------------- Platform Manager */
12042  #include <dspbridge/dev.h>
12043 @@ -142,8 +79,7 @@ struct CMM_ALLOCATOR {       /* sma */
12044                                  * context for 'sma') */
12045         u32 dwDSPPhysAddrOffset;        /* DSP PA to GPP PA offset for this
12046                                          * SM space */
12047 -       /* CMM_ADDTO[SUBFROM]DSPPA, _POMAPEMIF2DSPBUS */
12048 -       enum CMM_CNVTTYPE cFactor;
12049 +       s8 cFactor;                     /* DSPPa to GPPPa Conversion Factor */
12050         unsigned int dwDSPBase; /* DSP virt base byte address */
12051         u32 ulDSPSize;  /* DSP seg size in bytes */
12052         struct CMM_OBJECT *hCmmMgr;     /* back ref to parent mgr */
12053 @@ -199,7 +135,7 @@ static struct CMM_XLATORATTRS CMM_DFLTXL
12054  
12055  /* SM node representing a block of memory. */
12056  struct CMM_MNODE {
12057 -       struct LST_ELEM link;           /* must be 1st element */
12058 +       struct list_head link;          /* must be 1st element */
12059         u32 dwPA;               /* Phys addr */
12060         u32 dwVA;               /* Virtual address in device process context */
12061         u32 ulSize;             /* SM block size in bytes */
12062 @@ -275,8 +211,10 @@ void *CMM_CallocBuf(struct CMM_OBJECT *h
12063                                 pNewNode = GetNode(pCmmMgr, pNode->dwPA + uSize,
12064                                            pNode->dwVA + uSize,
12065                                            (u32)uDeltaSize);
12066 -                               /* leftovers go free */
12067 -                               AddToFreeList(pAllocator, pNewNode);
12068 +                               if (pNewNode) {
12069 +                                       /* leftovers go free */
12070 +                                       AddToFreeList(pAllocator, pNewNode);
12071 +                               }
12072                                 /* adjust our node's size */
12073                                 pNode->ulSize = uSize;
12074                         }
12075 @@ -289,7 +227,7 @@ void *CMM_CallocBuf(struct CMM_OBJECT *h
12076  
12077                         /* put our node on InUse list */
12078                         LST_PutTail(pAllocator->pInUseListHead,
12079 -                                  (struct LST_ELEM *)pNode);
12080 +                                  (struct list_head *)pNode);
12081                         pBufPA = (void *)pNode->dwPA;   /* physical address */
12082                         /* clear mem */
12083                         pByte = (u8 *)pNode->dwVA;
12084 @@ -359,12 +297,15 @@ DSP_STATUS CMM_Create(OUT struct CMM_OBJ
12085                  * MEM_AllocObject */
12086                 if (DSP_SUCCEEDED(status)) {
12087                         /* create node free list */
12088 -                       pCmmObject->pNodeFreeListHead = LST_Create();
12089 +                       pCmmObject->pNodeFreeListHead = MEM_Calloc(sizeof(struct
12090 +                               LST_LIST), MEM_NONPAGED);
12091                         if (pCmmObject->pNodeFreeListHead == NULL) {
12092                                 GT_0trace(CMM_debugMask, GT_7CLASS,
12093 -                                         "CMM_Create: LST_Create() "
12094 -                                         "failed \n");
12095 +                                         "CMM_Create: Out of memory\n");
12096                                 status = DSP_EMEMORY;
12097 +                       } else {
12098 +                               INIT_LIST_HEAD(&pCmmObject->pNodeFreeListHead->
12099 +                                       head);
12100                         }
12101                 }
12102                 if (DSP_SUCCEEDED(status))
12103 @@ -428,14 +369,12 @@ DSP_STATUS CMM_Destroy(struct CMM_OBJECT
12104         if (pCmmMgr->pNodeFreeListHead != NULL) {
12105                 /* Free the free nodes */
12106                 while (!LST_IsEmpty(pCmmMgr->pNodeFreeListHead)) {
12107 -                       /* (struct LST_ELEM*) pNode =
12108 -                        * LST_GetHead(pCmmMgr->pNodeFreeListHead);*/
12109                         pNode = (struct CMM_MNODE *)LST_GetHead(pCmmMgr->
12110                                  pNodeFreeListHead);
12111                         MEM_Free(pNode);
12112                 }
12113                 /* delete NodeFreeList list */
12114 -               LST_Delete(pCmmMgr->pNodeFreeListHead);
12115 +               MEM_Free(pCmmMgr->pNodeFreeListHead);
12116         }
12117         SYNC_LeaveCS(pCmmMgr->hCmmLock);
12118         if (DSP_SUCCEEDED(status)) {
12119 @@ -496,7 +435,7 @@ DSP_STATUS CMM_FreeBuf(struct CMM_OBJECT
12120                         if ((u32)pBufPA == pCurNode->dwPA) {
12121                                 /* Found it */
12122                                 LST_RemoveElem(pAllocator->pInUseListHead,
12123 -                                             (struct LST_ELEM *)pCurNode);
12124 +                                             (struct list_head *)pCurNode);
12125                                 /* back to freelist */
12126                                 AddToFreeList(pAllocator, pCurNode);
12127                                 status = DSP_SOK;       /* all right! */
12128 @@ -504,7 +443,8 @@ DSP_STATUS CMM_FreeBuf(struct CMM_OBJECT
12129                         }
12130                         /* next node. */
12131                         pCurNode = (struct CMM_MNODE *)LST_Next(pAllocator->
12132 -                                  pInUseListHead, (struct LST_ELEM *)pCurNode);
12133 +                                       pInUseListHead,
12134 +                                       (struct list_head *)pCurNode);
12135                 }
12136                 SYNC_LeaveCS(pCmmMgr->hCmmLock);
12137         }
12138 @@ -517,7 +457,7 @@ DSP_STATUS CMM_FreeBuf(struct CMM_OBJECT
12139   *      Return the communication memory manager object for this device.
12140   *      This is typically called from the client process.
12141   */
12142 -DSP_STATUS CMM_GetHandle(DSP_HPROCESSOR hProcessor,
12143 +DSP_STATUS CMM_GetHandle(void *hProcessor,
12144                         OUT struct CMM_OBJECT **phCmmMgr)
12145  {
12146         DSP_STATUS status = DSP_SOK;
12147 @@ -590,7 +530,7 @@ DSP_STATUS CMM_GetInfo(struct CMM_OBJECT
12148                                 /* next node. */
12149                                 pCurNode = (struct CMM_MNODE *)LST_Next(pAltr->
12150                                         pInUseListHead,
12151 -                                       (struct LST_ELEM *)pCurNode);
12152 +                                       (struct list_head *)pCurNode);
12153                         }
12154                 }
12155         }               /* end for */
12156 @@ -632,7 +572,7 @@ bool CMM_Init(void)
12157   */
12158  DSP_STATUS CMM_RegisterGPPSMSeg(struct CMM_OBJECT *hCmmMgr, u32 dwGPPBasePA,
12159                                 u32 ulSize, u32 dwDSPAddrOffset,
12160 -                               enum CMM_CNVTTYPE cFactor, u32 dwDSPBase,
12161 +                               s8 cFactor, u32 dwDSPBase,
12162                                 u32 ulDSPSize, u32 *pulSegId,
12163                                 u32 dwGPPBaseVA)
12164  {
12165 @@ -699,25 +639,29 @@ DSP_STATUS CMM_RegisterGPPSMSeg(struct C
12166                         /* return the actual segment identifier */
12167                         *pulSegId = (u32) nSlot + 1;
12168                         /* create memory free list */
12169 -                       pSMA->pFreeListHead = LST_Create();
12170 +                       pSMA->pFreeListHead = MEM_Calloc(sizeof(struct
12171 +                               LST_LIST), MEM_NONPAGED);
12172                         if (pSMA->pFreeListHead == NULL) {
12173                                 GT_0trace(CMM_debugMask, GT_7CLASS,
12174                                           "CMM_RegisterGPPSMSeg: "
12175 -                                         "Out Of Memory \n");
12176 +                                         "Out Of Memory 1\n");
12177                                 status = DSP_EMEMORY;
12178                                 goto func_end;
12179                         }
12180 +                       INIT_LIST_HEAD(&pSMA->pFreeListHead->head);
12181                 }
12182                 if (DSP_SUCCEEDED(status)) {
12183                         /* create memory in-use list */
12184 -                       pSMA->pInUseListHead = LST_Create();
12185 +                       pSMA->pInUseListHead = MEM_Calloc(sizeof(struct
12186 +                               LST_LIST), MEM_NONPAGED);
12187                         if (pSMA->pInUseListHead == NULL) {
12188                                 GT_0trace(CMM_debugMask, GT_7CLASS,
12189                                           "CMM_RegisterGPPSMSeg: "
12190 -                                         "LST_Create failed\n");
12191 +                                         "Out of memory 2\n");
12192                                 status = DSP_EMEMORY;
12193                                 goto func_end;
12194                         }
12195 +                       INIT_LIST_HEAD(&pSMA->pInUseListHead->head);
12196                 }
12197                 if (DSP_SUCCEEDED(status)) {
12198                         /* Get a mem node for this hunk-o-memory */
12199 @@ -726,7 +670,7 @@ DSP_STATUS CMM_RegisterGPPSMSeg(struct C
12200                         /* Place node on the SM allocator's free list */
12201                         if (pNewNode) {
12202                                 LST_PutTail(pSMA->pFreeListHead,
12203 -                                          (struct LST_ELEM *)pNewNode);
12204 +                                          (struct list_head *)pNewNode);
12205                         } else {
12206                                 status = DSP_EMEMORY;
12207                                 goto func_end;
12208 @@ -820,27 +764,27 @@ static void UnRegisterGPPSMSeg(struct CM
12209                 while (pCurNode) {
12210                         pNextNode = (struct CMM_MNODE *)LST_Next(pSMA->
12211                                      pFreeListHead,
12212 -                                   (struct LST_ELEM *)pCurNode);
12213 +                                   (struct list_head *)pCurNode);
12214                         LST_RemoveElem(pSMA->pFreeListHead,
12215 -                                     (struct LST_ELEM *)pCurNode);
12216 +                                     (struct list_head *)pCurNode);
12217                         MEM_Free((void *) pCurNode);
12218                         /* next node. */
12219                         pCurNode = pNextNode;
12220                 }
12221 -               LST_Delete(pSMA->pFreeListHead);        /* delete freelist */
12222 +               MEM_Free(pSMA->pFreeListHead);          /* delete freelist */
12223                 /* free nodes on InUse list */
12224                 pCurNode = (struct CMM_MNODE *)LST_First(pSMA->pInUseListHead);
12225                 while (pCurNode) {
12226                         pNextNode = (struct CMM_MNODE *)LST_Next(pSMA->
12227                                     pInUseListHead,
12228 -                                   (struct LST_ELEM *)pCurNode);
12229 +                                   (struct list_head *)pCurNode);
12230                         LST_RemoveElem(pSMA->pInUseListHead,
12231 -                                     (struct LST_ELEM *)pCurNode);
12232 +                                     (struct list_head *)pCurNode);
12233                         MEM_Free((void *) pCurNode);
12234                         /* next node. */
12235                         pCurNode = pNextNode;
12236                 }
12237 -               LST_Delete(pSMA->pInUseListHead);       /* delete InUse list */
12238 +               MEM_Free(pSMA->pInUseListHead);         /* delete InUse list */
12239         }
12240         if ((void *) pSMA->dwVmBase != NULL)
12241                 MEM_UnmapLinearAddress((void *) pSMA->dwVmBase);
12242 @@ -893,15 +837,13 @@ static struct CMM_MNODE *GetNode(struct 
12243                         MEM_PAGED);
12244         } else {
12245                 /* surely a valid element */
12246 -               /* (struct LST_ELEM*) pNode = LST_GetHead(pCmmMgr->
12247 -                * pNodeFreeListHead);*/
12248                 pNode = (struct CMM_MNODE *)LST_GetHead(pCmmMgr->
12249                         pNodeFreeListHead);
12250         }
12251         if (pNode == NULL) {
12252                 GT_0trace(CMM_debugMask, GT_7CLASS, "GetNode: Out Of Memory\n");
12253         } else {
12254 -               LST_InitElem((struct LST_ELEM *) pNode);        /* set self */
12255 +               LST_InitElem((struct list_head *) pNode);       /* set self */
12256                 pNode->dwPA = dwPA;     /* Physical addr of start of block */
12257                 pNode->dwVA = dwVA;     /* Virtual   "            "        */
12258                 pNode->ulSize = ulSize; /* Size of block */
12259 @@ -918,8 +860,8 @@ static struct CMM_MNODE *GetNode(struct 
12260  static void DeleteNode(struct CMM_OBJECT *pCmmMgr, struct CMM_MNODE *pNode)
12261  {
12262         DBC_Require(pNode != NULL);
12263 -       LST_InitElem((struct LST_ELEM *) pNode);        /* init .self ptr */
12264 -       LST_PutTail(pCmmMgr->pNodeFreeListHead, (struct LST_ELEM *) pNode);
12265 +       LST_InitElem((struct list_head *) pNode);       /* init .self ptr */
12266 +       LST_PutTail(pCmmMgr->pNodeFreeListHead, (struct list_head *) pNode);
12267  }
12268  
12269  /*
12270 @@ -937,12 +879,13 @@ static struct CMM_MNODE *GetFreeBlock(st
12271                 while (pCurNode) {
12272                         if (uSize <= (u32) pCurNode->ulSize) {
12273                                 LST_RemoveElem(pAllocator->pFreeListHead,
12274 -                                             (struct LST_ELEM *)pCurNode);
12275 +                                             (struct list_head *)pCurNode);
12276                                 return pCurNode;
12277                         }
12278                         /* next node. */
12279                         pCurNode = (struct CMM_MNODE *)LST_Next(pAllocator->
12280 -                                   pFreeListHead, (struct LST_ELEM *)pCurNode);
12281 +                                       pFreeListHead,
12282 +                                       (struct list_head *)pCurNode);
12283                 }
12284         }
12285         return NULL;
12286 @@ -977,7 +920,8 @@ static void AddToFreeList(struct CMM_ALL
12287                 if ((pNodePrev == NULL) || (pNodeNext == NULL)) {
12288                         /* next node. */
12289                         pCurNode = (struct CMM_MNODE *)LST_Next(pAllocator->
12290 -                                   pFreeListHead, (struct LST_ELEM *)pCurNode);
12291 +                                       pFreeListHead,
12292 +                                       (struct list_head *)pCurNode);
12293                 } else {
12294                         /* got 'em */
12295                         break;
12296 @@ -986,7 +930,7 @@ static void AddToFreeList(struct CMM_ALL
12297         if (pNodePrev != NULL) {
12298                 /* combine with previous block */
12299                 LST_RemoveElem(pAllocator->pFreeListHead,
12300 -                             (struct LST_ELEM *)pNodePrev);
12301 +                             (struct list_head *)pNodePrev);
12302                 /* grow node to hold both */
12303                 pNode->ulSize += pNodePrev->ulSize;
12304                 pNode->dwPA = pNodePrev->dwPA;
12305 @@ -997,7 +941,7 @@ static void AddToFreeList(struct CMM_ALL
12306         if (pNodeNext != NULL) {
12307                 /* combine with next block */
12308                 LST_RemoveElem(pAllocator->pFreeListHead,
12309 -                             (struct LST_ELEM *)pNodeNext);
12310 +                             (struct list_head *)pNodeNext);
12311                 /* grow da node */
12312                 pNode->ulSize += pNodeNext->ulSize;
12313                 /* place node on mgr nodeFreeList */
12314 @@ -1011,17 +955,17 @@ static void AddToFreeList(struct CMM_ALL
12315  
12316                 /* next node. */
12317                 pCurNode = (struct CMM_MNODE *)LST_Next(pAllocator->
12318 -                          pFreeListHead, (struct LST_ELEM *)pCurNode);
12319 +                          pFreeListHead, (struct list_head *)pCurNode);
12320         }
12321         /* if pCurNode is NULL then add our pNode to the end of the freelist */
12322         if (pCurNode == NULL) {
12323                 LST_PutTail(pAllocator->pFreeListHead,
12324 -                          (struct LST_ELEM *)pNode);
12325 +                          (struct list_head *)pNode);
12326         } else {
12327                 /* insert our node before the current traversed node */
12328                 LST_InsertBefore(pAllocator->pFreeListHead,
12329 -                               (struct LST_ELEM *)pNode,
12330 -                               (struct LST_ELEM *)pCurNode);
12331 +                               (struct list_head *)pNode,
12332 +                               (struct list_head *)pCurNode);
12333         }
12334  }
12335  
12336 @@ -1050,6 +994,12 @@ static struct CMM_ALLOCATOR *GetAllocato
12337  }
12338  
12339  /*
12340 + *  The CMM_Xlator[xxx] routines below are used by Node and Stream
12341 + *  to perform SM address translation to the client process address space.
12342 + *  A "translator" object is created by a node/stream for each SM seg used.
12343 + */
12344 +
12345 +/*
12346   *  ======== CMM_XlatorCreate ========
12347   *  Purpose:
12348   *      Create an address translator object.
12349 @@ -1101,11 +1051,10 @@ DSP_STATUS CMM_XlatorDelete(struct CMM_X
12350  
12351         DBC_Require(cRefs > 0);
12352  
12353 -       if (MEM_IsValidHandle(pXlator, CMMXLATESIGNATURE)) {
12354 +       if (MEM_IsValidHandle(pXlator, CMMXLATESIGNATURE))
12355                 MEM_FreeObject(pXlator);
12356 -       } else {
12357 +       else
12358                 status = DSP_EHANDLE;
12359 -       }
12360  
12361         return status;
12362  }
12363 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/cod.c kernel-power-2.6.28/drivers/dsp/bridge/pmgr/cod.c
12364 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/cod.c      2011-04-17 17:32:26.000000000 +0100
12365 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/cod.c   2011-05-02 22:36:49.000000000 +0100
12366 @@ -3,6 +3,12 @@
12367   *
12368   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
12369   *
12370 + * This module implements DSP code management for the DSP/BIOS Bridge
12371 + * environment. It is mostly a thin wrapper.
12372 + *
12373 + * This module provides an interface for loading both static and
12374 + * dynamic code objects onto DSP systems.
12375 + *
12376   * Copyright (C) 2005-2006 Texas Instruments, Inc.
12377   *
12378   * This package is free software; you can redistribute it and/or modify
12379 @@ -14,49 +20,10 @@
12380   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12381   */
12382  
12383 -
12384 -/*
12385 - *  ======== cod.c ========
12386 - *  This module implements DSP code management for the DSP/BIOS Bridge
12387 - *  environment. It is mostly a thin wrapper.
12388 - *
12389 - *  This module provides an interface for loading both static and
12390 - *  dynamic code objects onto DSP systems.
12391 - *
12392 - *! Revision History
12393 - *! ================
12394 - *! 08-Apr-2003 map: Consolidated DBL to DBLL loader name
12395 - *! 24-Feb-2003 swa: PMGR Code review comments incorporated.
12396 - *! 18-Apr-2002 jeh: Added DBL function tables.
12397 - *! 20-Nov-2001 jeh: Removed call to ZL_loadArgs function.
12398 - *! 19-Oct-2001 jeh: Access DBL as a static library. Added COD_GetBaseLib,
12399 - *!              COD_GetLoader, removed COD_LoadSection, COD_UnloadSection.
12400 - *! 07-Sep-2001 jeh: Added COD_LoadSection(), COD_UnloadSection().
12401 - *! 07-Aug-2001 rr:  hMgr->baseLib is updated after zlopen in COD_LoadBase.
12402 - *! 18-Apr-2001 jeh: Check for fLoaded flag before ZL_unload, to allow
12403 - *!              COD_OpenBase to be used.
12404 - *! 11-Jan-2001 jeh: Added COD_OpenBase (not used yet, since there is an
12405 - *!              occasional crash).
12406 - *! 02-Aug-2000 kc:  Added COD_ReadSection to COD module. Incorporates use
12407 - *!              of ZL_readSect (new function in ZL module).
12408 - *! 28-Feb-2000 rr:  New GT Usage Implementation
12409 - *! 08-Dec-1999 ag:  Removed x86 specific __asm int 3.
12410 - *! 02-Oct-1999 ag:  Added #ifdef DEBUGINT3COD for debug.
12411 - *! 20-Sep-1999 ag:  Removed call to GT_set().
12412 - *! 04-Jun-1997 cr:  Added validation of argc/argv pair in COD_LoadBase, as it
12413 - *!                 is a requirement to ZL_loadArgs.
12414 - *! 31-May-1997 cr:  Changed COD_LoadBase argc value from u32 to int, added
12415 - *!           DSP_ENOTIMPL return value to COD_Create when attrs != NULL.
12416 - *! 29-May-1997 cr:  Added debugging support.
12417 - *! 24-Oct-1996 gp:  Added COD_GetSection().
12418 - *! 18-Jun-1996 gp:  Updated GetSymValue() to check for lib; updated E_ codes.
12419 - *! 12-Jun-1996 gp:  Imported CSL_ services for strcpyn(); Added ref counting.
12420 - *! 20-May-1996 mg:  Adapted for new MEM and LDR modules.
12421 - *! 08-May-1996 mg:  Created.
12422 - */
12423 -
12424  /*  ----------------------------------- Host OS */
12425  #include <dspbridge/host_os.h>
12426 +#include <linux/fs.h>
12427 +#include <linux/uaccess.h>
12428  
12429  /*  ----------------------------------- DSP/BIOS Bridge */
12430  #include <dspbridge/std.h>
12431 @@ -68,8 +35,6 @@
12432  #include <dspbridge/gt.h>
12433  
12434  /*  ----------------------------------- OS Adaptation Layer */
12435 -#include <dspbridge/csl.h>
12436 -#include <dspbridge/kfile.h>
12437  #include <dspbridge/ldr.h>
12438  #include <dspbridge/mem.h>
12439  
12440 @@ -137,6 +102,101 @@ static struct DBLL_Fxns dbllFxns = {
12441  static bool NoOp(void);
12442  
12443  /*
12444 + * File operations (originally were under kfile.c)
12445 + */
12446 +static s32 COD_fClose(struct file *hFile)
12447 +{
12448 +       /* Check for valid handle */
12449 +       if (!hFile)
12450 +               return DSP_EHANDLE;
12451 +
12452 +       filp_close(hFile, NULL);
12453 +
12454 +       /* we can't use DSP_SOK here */
12455 +       return 0;
12456 +}
12457 +
12458 +static struct file *COD_fOpen(CONST char *pszFileName, CONST char *pszMode)
12459 +{
12460 +       mm_segment_t fs;
12461 +       struct file *hFile;
12462 +
12463 +       fs = get_fs();
12464 +       set_fs(get_ds());
12465 +
12466 +       /* ignore given mode and open file as read-only */
12467 +       hFile = filp_open(pszFileName, O_RDONLY, 0);
12468 +
12469 +       if (IS_ERR(hFile))
12470 +               hFile = NULL;
12471 +
12472 +       set_fs(fs);
12473 +
12474 +       return hFile;
12475 +}
12476 +
12477 +static s32 COD_fRead(void __user *pBuffer, s32 cSize, s32 cCount,
12478 +                    struct file *hFile)
12479 +{
12480 +       /* check for valid file handle */
12481 +       if (!hFile)
12482 +               return DSP_EHANDLE;
12483 +
12484 +       if ((cSize > 0) && (cCount > 0) && pBuffer) {
12485 +               u32 dwBytesRead;
12486 +               mm_segment_t fs;
12487 +
12488 +               /* read from file */
12489 +               fs = get_fs();
12490 +               set_fs(get_ds());
12491 +               dwBytesRead = hFile->f_op->read(hFile, pBuffer, cSize * cCount,
12492 +                                               &(hFile->f_pos));
12493 +               set_fs(fs);
12494 +
12495 +               if (!dwBytesRead)
12496 +                       return DSP_EFREAD;
12497 +
12498 +               return dwBytesRead / cSize;
12499 +       }
12500 +
12501 +       return DSP_EINVALIDARG;
12502 +}
12503 +
12504 +static s32 COD_fSeek(struct file *hFile, s32 lOffset, s32 cOrigin)
12505 +{
12506 +       loff_t dwCurPos;
12507 +
12508 +       /* check for valid file handle */
12509 +       if (!hFile)
12510 +               return DSP_EHANDLE;
12511 +
12512 +       /* based on the origin flag, move the internal pointer */
12513 +       dwCurPos = hFile->f_op->llseek(hFile, lOffset, cOrigin);
12514 +
12515 +       if ((s32)dwCurPos < 0)
12516 +               return DSP_EFAIL;
12517 +
12518 +       /* we can't use DSP_SOK here */
12519 +       return 0;
12520 +}
12521 +
12522 +static s32 COD_fTell(struct file *hFile)
12523 +{
12524 +       loff_t dwCurPos;
12525 +
12526 +       if (!hFile)
12527 +               return DSP_EHANDLE;
12528 +
12529 +       /* Get current position */
12530 +       dwCurPos = hFile->f_op->llseek(hFile, 0, SEEK_CUR);
12531 +
12532 +       if ((s32)dwCurPos < 0)
12533 +               return DSP_EFAIL;
12534 +
12535 +       return dwCurPos;
12536 +}
12537 +
12538 +/*
12539   *  ======== COD_Close ========
12540   */
12541  void COD_Close(struct COD_LIBRARYOBJ *lib)
12542 @@ -200,11 +260,11 @@ DSP_STATUS COD_Create(OUT struct COD_MAN
12543  
12544         zlAttrs.alloc = (DBLL_AllocFxn)NoOp;
12545         zlAttrs.free = (DBLL_FreeFxn)NoOp;
12546 -       zlAttrs.fread = (DBLL_ReadFxn)KFILE_Read;
12547 -       zlAttrs.fseek = (DBLL_SeekFxn)KFILE_Seek;
12548 -       zlAttrs.ftell = (DBLL_TellFxn)KFILE_Tell;
12549 -       zlAttrs.fclose = (DBLL_FCloseFxn)KFILE_Close;
12550 -       zlAttrs.fopen = (DBLL_FOpenFxn)KFILE_Open;
12551 +       zlAttrs.fread = (DBLL_ReadFxn)COD_fRead;
12552 +       zlAttrs.fseek = (DBLL_SeekFxn)COD_fSeek;
12553 +       zlAttrs.ftell = (DBLL_TellFxn)COD_fTell;
12554 +       zlAttrs.fclose = (DBLL_FCloseFxn)COD_fClose;
12555 +       zlAttrs.fopen = (DBLL_FOpenFxn)COD_fOpen;
12556         zlAttrs.symLookup = NULL;
12557         zlAttrs.baseImage = true;
12558         zlAttrs.logWrite = NULL;
12559 @@ -308,7 +368,7 @@ DSP_STATUS COD_GetBaseName(struct COD_MA
12560         DBC_Require(pszName != NULL);
12561  
12562         if (uSize <= COD_MAXPATHLENGTH)
12563 -               strncpy(pszName, hManager->szZLFile, uSize);
12564 +               strncpy(pszName, hManager->szZLFile, uSize);
12565         else
12566                 status = DSP_EFAIL;
12567  
12568 @@ -341,7 +401,7 @@ DSP_STATUS COD_GetEntry(struct COD_MANAG
12569   *      Get handle to the DBLL loader.
12570   */
12571  DSP_STATUS COD_GetLoader(struct COD_MANAGER *hManager,
12572 -                              struct DBLL_TarObj **phLoader)
12573 +                               struct DBLL_TarObj **phLoader)
12574  {
12575         DSP_STATUS status = DSP_SOK;
12576  
12577 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/dbl.c kernel-power-2.6.28/drivers/dsp/bridge/pmgr/dbl.c
12578 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/dbl.c      2011-04-17 17:32:26.000000000 +0100
12579 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/dbl.c   1970-01-01 01:00:00.000000000 +0100
12580 @@ -1,1385 +0,0 @@
12581 -/*
12582 - * dbl.c
12583 - *
12584 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
12585 - *
12586 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
12587 - *
12588 - * This package is free software; you can redistribute it and/or modify
12589 - * it under the terms of the GNU General Public License version 2 as
12590 - * published by the Free Software Foundation.
12591 - *
12592 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
12593 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12594 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12595 - */
12596 -
12597 -
12598 -/*
12599 - *  ======== dbl.c ========
12600 - *  Dynamic BOF Loader library. Contains functions related to
12601 - *  loading and unloading symbols/code/data on DSP.
12602 - *  Also contains other support functions.
12603 - *
12604 - *! Revision History
12605 - *! ================
12606 - *! 24-Feb-2003 swa    PMGR Code review comments incorporated.
12607 - *! 24-May-2002 jeh     Free DCD sects in DBL_close().
12608 - *! 19-Mar-2002 jeh     Changes made to match dynamic loader (dbll.c): Pass
12609 - *!                 DBL_Library to DBL_getAddr() instead of DBL_Target,
12610 - *!                 eliminate scope param, use DBL_Symbol. Pass attrs to
12611 - *!                 DBL_load(), DBL_unload().
12612 - *! 20-Nov-2001 jeh     Removed DBL_loadArgs().
12613 - *! 07-Sep-2001 jeh     Added overlay support.
12614 - *! 31-Jul-2001 jeh     Include windows.h.
12615 - *! 06-Jun-2001 jeh     Created.
12616 - */
12617 -
12618 -/*  ----------------------------------- Host OS */
12619 -#include <dspbridge/host_os.h>
12620 -
12621 -/*  ----------------------------------- DSP/BIOS Bridge */
12622 -#include <dspbridge/std.h>
12623 -#include <dspbridge/dbdefs.h>
12624 -#include <dspbridge/errbase.h>
12625 -
12626 -/*  ----------------------------------- Trace & Debug */
12627 -#include <dspbridge/dbc.h>
12628 -#include <dspbridge/gt.h>
12629 -
12630 -/*  ----------------------------------- OS Adaptation Layer */
12631 -#include <dspbridge/csl.h>
12632 -#include <dspbridge/mem.h>
12633 -#include <dspbridge/kfile.h>
12634 -
12635 -/*  ----------------------------------- This */
12636 -#include <dspbridge/dbof.h>
12637 -#include <dspbridge/dbl.h>
12638 -
12639 -#define DBL_TARGSIGNATURE      0x544c4244      /* "TLBD" */
12640 -#define DBL_LIBSIGNATURE       0x4c4c4244      /* "LLBD" */
12641 -
12642 -#define C54TARG         0
12643 -#define C55TARG         1
12644 -#define NUMTARGS       2
12645 -
12646 -#define C54MAGIC       0x98    /* Magic number for TI C54 COF  */
12647 -#define C55MAGIC       0x9c    /* Magic number for LEAD3 (C55) COF  */
12648 -
12649 -/* Three task phases */
12650 -#define CREATEPHASE 0
12651 -#define DELETEPHASE 1
12652 -#define EXECUTEPHASE 2
12653 -#define NONE 3         /* For overlay section with phase not specified */
12654 -
12655 -/* Default load buffer size */
12656 -#define LOADBUFSIZE     0x800
12657 -
12658 -#define SWAPLONG(x) ((((x) << 24) & 0xFF000000) | (((x) << 8) & 0xFF0000L) | \
12659 -                     (((x) >> 8) & 0xFF00L) | (((x) >> 24) & 0xFF))
12660 -
12661 -#define SWAPWORD(x) ((((x) << 8) & 0xFF00) | (((x) >> 8) & 0xFF))
12662 -
12663 -/*
12664 - *  Macros for accessing the following types of overlay data within a
12665 - *  structure of type OvlyData:
12666 - *      - Overlay data not associated with a particular phase
12667 - *      - Create phase overlay data
12668 - *      - Delete phase overlay data
12669 - *      - Execute phase overlay data
12670 - */
12671 -#define numOtherSects(pOvlyData)    ((pOvlyData)->hdr.dbofHdr.numOtherSects)
12672 -#define numCreateSects(pOvlyData)   ((pOvlyData)->hdr.dbofHdr.numCreateSects)
12673 -#define numDeleteSects(pOvlyData)   ((pOvlyData)->hdr.dbofHdr.numDeleteSects)
12674 -#define numExecuteSects(pOvlyData)  ((pOvlyData)->hdr.dbofHdr.numExecuteSects)
12675 -#define otherOffset(pOvlyData)      0
12676 -#define createOffset(pOvlyData)     ((pOvlyData)->hdr.dbofHdr.numOtherSects)
12677 -#define deleteOffset(pOvlyData)     (createOffset(pOvlyData) + \
12678 -                                    (pOvlyData->hdr.dbofHdr.numCreateSects))
12679 -#define executeOffset(pOvlyData)    (deleteOffset(pOvlyData) + \
12680 -                                    (pOvlyData->hdr.dbofHdr.numDeleteSects))
12681 -/*
12682 - *  ======== OvlyHdr ========
12683 - */
12684 -struct OvlyHdr {
12685 -       struct DBOF_OvlySectHdr dbofHdr;
12686 -       char *pName;            /* Name of overlay section */
12687 -       u16 createRef;  /* Reference count for create phase */
12688 -       u16 deleteRef;  /* Reference count for delete phase */
12689 -       u16 executeRef;         /* Execute phase ref count */
12690 -       u16 otherRef;           /* Unspecified phase ref count */
12691 -} ;
12692 -
12693 -/*
12694 - *  ======== OvlyData ========
12695 - */
12696 -struct OvlyData {
12697 -       struct OvlyHdr hdr;
12698 -       struct DBOF_OvlySectData data[1];
12699 -} ;
12700 -
12701 -/*
12702 - *  ======== Symbol ========
12703 - */
12704 -struct Symbol {
12705 -       struct DBL_Symbol sym;
12706 -       char *pSymName;
12707 -};
12708 -
12709 -/*
12710 - *  ======== DCDSect ========
12711 - */
12712 -struct DCDSect {
12713 -       struct DBOF_DCDSectHdr sectHdr;
12714 -       char *pData;
12715 -} ;
12716 -
12717 -/*
12718 - *  ======== DBL_TargetObj ========
12719 - */
12720 -struct DBL_TargetObj {
12721 -       u32 dwSignature;        /* For object validation */
12722 -       struct DBL_Attrs dblAttrs;      /* file read, write, etc. functions */
12723 -       char *pBuf;             /* Load buffer */
12724 -};
12725 -
12726 -/*
12727 - *  ======== TargetInfo ========
12728 - */
12729 -struct TargetInfo {
12730 -       u16 dspType;            /* eg, C54TARG, C55TARG */
12731 -       u32 magic;              /* COFF magic number, identifies target type */
12732 -       u16 wordSize;   /* Size of a DSP word */
12733 -       u16 mauSize;            /* Size of minimum addressable unit */
12734 -       u16 charSize;   /* For C55x, mausize = 1, but charsize = 2 */
12735 -} ;
12736 -
12737 -/*
12738 - *  ======== DBL_LibraryObj ========
12739 - *  Represents a library loaded on a target.
12740 - */
12741 -struct DBL_LibraryObj {
12742 -       u32 dwSignature;        /* For object validation */
12743 -       struct DBL_TargetObj *pTarget;  /* Target for this library */
12744 -       struct KFILE_FileObj *file;     /* DBOF file handle */
12745 -       bool byteSwapped;       /* Are bytes swapped? */
12746 -       struct DBOF_FileHdr fileHdr;    /* Header of DBOF file */
12747 -       u16 nSymbols;           /* Number of DSP/Bridge symbols */
12748 -       struct Symbol *symbols;         /* Table of DSP/Bridge symbols */
12749 -       u16 nDCDSects;  /* Number of DCD sections */
12750 -       u16 nOvlySects;         /* Number of overlay nodes */
12751 -       struct DCDSect *dcdSects;       /* DCD section data */
12752 -       struct OvlyData **ppOvlyData;   /* Array of overlay section data */
12753 -       struct TargetInfo *pTargetInfo;         /* Entry in targetTab[] below */
12754 -} ;
12755 -
12756 -#if GT_TRACE
12757 -static struct GT_Mask DBL_debugMask = { NULL, NULL };  /* GT trace variable */
12758 -#endif
12759 -
12760 -static u32 cRefs;              /* module reference count */
12761 -
12762 -static u32 magicTab[NUMTARGS] = { C54MAGIC, C55MAGIC };
12763 -
12764 -static struct TargetInfo targetTab[] = {
12765 -       /* targ     magic       wordsize    mausize    charsize */
12766 -       {C54TARG, C54MAGIC, 2, 2, 2},   /* C54  */
12767 -       {C55TARG, C55MAGIC, 2, 1, 2},   /* C55  */
12768 -};
12769 -
12770 -static void freeSects(struct DBL_TargetObj *dbl, struct OvlyData *pOvlyData,
12771 -                    s32 offset, s32 nSects);
12772 -static DSP_STATUS loadSect(struct DBL_TargetObj *dbl,
12773 -                         struct DBL_LibraryObj *pdblLib);
12774 -static DSP_STATUS readDCDSects(struct DBL_TargetObj *dbl,
12775 -                             struct DBL_LibraryObj *pdblLib);
12776 -static DSP_STATUS readHeader(struct DBL_TargetObj *dbl,
12777 -                           struct DBL_LibraryObj *pdblLib);
12778 -static DSP_STATUS readOvlySects(struct DBL_TargetObj *dbl,
12779 -                               struct DBL_LibraryObj *pdblLib);
12780 -static DSP_STATUS readSymbols(struct DBL_TargetObj *dbl,
12781 -                            struct DBL_LibraryObj *pdblLib);
12782 -
12783 -/*
12784 - *  ======== DBL_close ========
12785 - *  Purpose:
12786 - *     Close library opened with DBL_open.
12787 - */
12788 -void DBL_close(struct DBL_LibraryObj *lib)
12789 -{
12790 -       struct DBL_LibraryObj *pdblLib = (struct DBL_LibraryObj *)lib;
12791 -       u16 i;
12792 -
12793 -       DBC_Require(cRefs > 0);
12794 -       DBC_Require(MEM_IsValidHandle(pdblLib, DBL_LIBSIGNATURE));
12795 -
12796 -       GT_1trace(DBL_debugMask, GT_ENTER, "DBL_close: lib: 0x%x\n", lib);
12797 -
12798 -       /* Free symbols */
12799 -       if (pdblLib->symbols) {
12800 -               for (i = 0; i < pdblLib->nSymbols; i++) {
12801 -                       if (pdblLib->symbols[i].pSymName)
12802 -                               MEM_Free(pdblLib->symbols[i].pSymName);
12803 -
12804 -               }
12805 -               MEM_Free(pdblLib->symbols);
12806 -       }
12807 -
12808 -       /* Free DCD sects */
12809 -       if (pdblLib->dcdSects) {
12810 -               for (i = 0; i < pdblLib->nDCDSects; i++) {
12811 -                       if (pdblLib->dcdSects[i].pData)
12812 -                               MEM_Free(pdblLib->dcdSects[i].pData);
12813 -
12814 -               }
12815 -               MEM_Free(pdblLib->dcdSects);
12816 -       }
12817 -
12818 -       /* Free overlay sects */
12819 -       if (pdblLib->ppOvlyData) {
12820 -               for (i = 0;  i < pdblLib->nOvlySects;  i++) {
12821 -                       if (pdblLib->ppOvlyData[i]) {
12822 -                               if (pdblLib->ppOvlyData[i]->hdr.pName) {
12823 -                                       MEM_Free(pdblLib->ppOvlyData[i]->
12824 -                                               hdr.pName);
12825 -                               }
12826 -                               MEM_Free(pdblLib->ppOvlyData[i]);
12827 -                       }
12828 -               }
12829 -               MEM_Free(pdblLib->ppOvlyData);
12830 -       }
12831 -
12832 -       /* Close the file */
12833 -       if (pdblLib->file)
12834 -               (*pdblLib->pTarget->dblAttrs.fclose) (pdblLib->file);
12835 -
12836 -
12837 -       MEM_FreeObject(pdblLib);
12838 -}
12839 -
12840 -/*
12841 - *  ======== DBL_create ========
12842 - *  Purpose:
12843 - *     Create a target object by specifying the alloc, free, and
12844 - *     write functions for the target.
12845 - */
12846 -DSP_STATUS DBL_create(struct DBL_TargetObj **pTarget, struct DBL_Attrs *pAttrs)
12847 -{
12848 -       struct DBL_TargetObj *pdblTarget = NULL;
12849 -       DSP_STATUS status = DSP_SOK;
12850 -
12851 -       DBC_Require(cRefs > 0);
12852 -       DBC_Require(pAttrs != NULL);
12853 -       DBC_Require(pTarget != NULL);
12854 -
12855 -       GT_2trace(DBL_debugMask, GT_ENTER,
12856 -                "DBL_create: pTarget: 0x%x pAttrs: 0x%x\n",
12857 -                pTarget, pAttrs);
12858 -       /* Allocate DBL target object */
12859 -       MEM_AllocObject(pdblTarget, struct DBL_TargetObj, DBL_TARGSIGNATURE);
12860 -       if (pdblTarget == NULL) {
12861 -               GT_0trace(DBL_debugMask, GT_6CLASS,
12862 -                        "DBL_create: Memory allocation failed\n");
12863 -               status = DSP_EMEMORY;
12864 -       } else {
12865 -               pdblTarget->dblAttrs = *pAttrs;
12866 -               /* Allocate buffer for loading target */
12867 -               pdblTarget->pBuf = MEM_Calloc(LOADBUFSIZE, MEM_PAGED);
12868 -               if (pdblTarget->pBuf == NULL)
12869 -                       status = DSP_EMEMORY;
12870 -
12871 -       }
12872 -       if (DSP_SUCCEEDED(status)) {
12873 -               *pTarget = pdblTarget;
12874 -       } else {
12875 -               *pTarget = NULL;
12876 -               if (pdblTarget)
12877 -                       DBL_delete(pdblTarget);
12878 -
12879 -       }
12880 -       DBC_Ensure(DSP_SUCCEEDED(status) &&
12881 -                 ((MEM_IsValidHandle((*pTarget), DBL_TARGSIGNATURE)) ||
12882 -                 (DSP_FAILED(status) && *pTarget == NULL)));
12883 -       return status;
12884 -}
12885 -
12886 -/*
12887 - *  ======== DBL_delete ========
12888 - *  Purpose:
12889 - *     Delete target object and free resources for any loaded libraries.
12890 - */
12891 -void DBL_delete(struct DBL_TargetObj *target)
12892 -{
12893 -       DBC_Require(cRefs > 0);
12894 -       DBC_Require(MEM_IsValidHandle(target, DBL_TARGSIGNATURE));
12895 -
12896 -       GT_1trace(DBL_debugMask, GT_ENTER,
12897 -                "DBL_delete: target: 0x%x\n", target);
12898 -
12899 -       if (target->pBuf)
12900 -               MEM_Free(target->pBuf);
12901 -
12902 -       MEM_FreeObject(target);
12903 -}
12904 -
12905 -/*
12906 - *  ======== DBL_exit ========
12907 - *  Purpose
12908 - *     Discontinue usage of DBL module.
12909 - */
12910 -void DBL_exit()
12911 -{
12912 -       DBC_Require(cRefs > 0);
12913 -       cRefs--;
12914 -       GT_1trace(DBL_debugMask, GT_5CLASS,
12915 -                "DBL_exit() ref count: 0x%x\n", cRefs);
12916 -       DBC_Ensure(cRefs >= 0);
12917 -}
12918 -
12919 -/*
12920 - *  ======== DBL_getAddr ========
12921 - *  Purpose:
12922 - *     Get address of name in the specified library.
12923 - */
12924 -bool DBL_getAddr(struct DBL_LibraryObj *lib, char *name,
12925 -               struct DBL_Symbol **ppSym)
12926 -{
12927 -       bool retVal = false;
12928 -       struct Symbol *symbol;
12929 -       u16 i;
12930 -
12931 -       DBC_Require(cRefs > 0);
12932 -       DBC_Require(MEM_IsValidHandle(lib, DBL_LIBSIGNATURE));
12933 -       DBC_Require(name != NULL);
12934 -       DBC_Require(ppSym != NULL);
12935 -
12936 -       GT_3trace(DBL_debugMask, GT_ENTER,
12937 -                "DBL_getAddr: libt: 0x%x name: %s pAddr: "
12938 -                "0x%x\n", lib, name, ppSym);
12939 -       for (i = 0; i < lib->nSymbols; i++) {
12940 -               symbol = &lib->symbols[i];
12941 -               if (CSL_Strcmp(name, symbol->pSymName) == 0) {
12942 -                       /* Found it */
12943 -                       *ppSym = &lib->symbols[i].sym;
12944 -                       retVal = true;
12945 -                       break;
12946 -               }
12947 -       }
12948 -       return retVal;
12949 -}
12950 -
12951 -/*
12952 - *  ======== DBL_getAttrs ========
12953 - *  Purpose:
12954 - *     Retrieve the attributes of the target.
12955 - */
12956 -void DBL_getAttrs(struct DBL_TargetObj *target, struct DBL_Attrs *pAttrs)
12957 -{
12958 -       DBC_Require(cRefs > 0);
12959 -       DBC_Require(MEM_IsValidHandle(target, DBL_TARGSIGNATURE));
12960 -       DBC_Require(pAttrs != NULL);
12961 -       GT_2trace(DBL_debugMask, GT_ENTER, "DBL_getAttrs: target: 0x%x pAttrs: "
12962 -                 "0x%x\n", target, pAttrs);
12963 -       *pAttrs = target->dblAttrs;
12964 -}
12965 -
12966 -/*
12967 - *  ======== DBL_getCAddr ========
12968 - *  Purpose:
12969 - *     Get address of "C" name in the specified library.
12970 - */
12971 -bool DBL_getCAddr(struct DBL_LibraryObj *lib, char *name,
12972 -                struct DBL_Symbol **ppSym)
12973 -{
12974 -       bool retVal = false;
12975 -       struct Symbol *symbol;
12976 -       u16 i;
12977 -
12978 -       DBC_Require(cRefs > 0);
12979 -       DBC_Require(MEM_IsValidHandle(lib, DBL_LIBSIGNATURE));
12980 -       DBC_Require(name != NULL);
12981 -       DBC_Require(ppSym != NULL);
12982 -
12983 -       GT_3trace(DBL_debugMask, GT_ENTER,
12984 -                "DBL_getCAddr: target: 0x%x name:%s pAddr:"
12985 -                " 0x%x\n", lib, name, ppSym);
12986 -       for (i = 0;  i < lib->nSymbols;  i++) {
12987 -               symbol = &lib->symbols[i];
12988 -               if ((CSL_Strcmp(name, symbol->pSymName) == 0) ||
12989 -                   (CSL_Strcmp(name, symbol->pSymName + 1) == 0 &&
12990 -                    symbol->pSymName[0] == '_')) {
12991 -                       /* Found it */
12992 -                       *ppSym = &lib->symbols[i].sym;
12993 -                       retVal = true;
12994 -                       break;
12995 -               }
12996 -       }
12997 -       return retVal;
12998 -}
12999 -
13000 -/*
13001 - *  ======== DBL_getEntry ========
13002 - *  Purpose:
13003 - *     Get program entry point.
13004 - *
13005 - */
13006 -bool DBL_getEntry(struct DBL_LibraryObj *lib, u32 *pEntry)
13007 -{
13008 -       struct DBL_LibraryObj *pdblLib = (struct DBL_LibraryObj *)lib;
13009 -
13010 -       DBC_Require(cRefs > 0);
13011 -       DBC_Require(MEM_IsValidHandle(pdblLib, DBL_LIBSIGNATURE));
13012 -       DBC_Require(pEntry != NULL);
13013 -
13014 -       GT_2trace(DBL_debugMask, GT_ENTER,
13015 -                "DBL_getEntry: lib: 0x%x pEntry: 0x%x\n", lib, pEntry);
13016 -       *pEntry = pdblLib->fileHdr.entry;
13017 -
13018 -       return true;
13019 -}
13020 -
13021 -/*
13022 - *  ======== DBL_getSect ========
13023 - *  Purpose:
13024 - *     Get address and size of a named section.
13025 - */
13026 -DSP_STATUS DBL_getSect(struct DBL_LibraryObj *lib, char *name, u32 *pAddr,
13027 -                     u32 *pSize)
13028 -{
13029 -       struct DBL_LibraryObj *pdblLib = (struct DBL_LibraryObj *)lib;
13030 -       u16 i;
13031 -       DSP_STATUS status = DSP_ENOSECT;
13032 -
13033 -       DBC_Require(cRefs > 0);
13034 -       DBC_Require(name != NULL);
13035 -       DBC_Require(pAddr != NULL);
13036 -       DBC_Require(pSize != NULL);
13037 -       DBC_Require(MEM_IsValidHandle(pdblLib, DBL_LIBSIGNATURE));
13038 -
13039 -       GT_4trace(DBL_debugMask, GT_ENTER,
13040 -                "DBL_getSect: lib: 0x%x name: %s pAddr:"
13041 -                " 0x%x pSize: 0x%x\n", lib, name, pAddr, pSize);
13042 -
13043 -       /*
13044 -        *  Check for DCD and overlay sections. Overlay loader uses DBL_getSect
13045 -        *  to determine whether or not a node has overlay sections.
13046 -        *  DCD section names begin with '.'
13047 -        */
13048 -       if (name[0] == '.') {
13049 -               /* Get DCD section size (address is 0, since it's a NOLOAD). */
13050 -               for (i = 0; i < pdblLib->nDCDSects; i++) {
13051 -                       if (CSL_Strcmp(pdblLib->dcdSects[i].sectHdr.name,
13052 -                          name) == 0) {
13053 -                               *pAddr = 0;
13054 -                               *pSize = pdblLib->dcdSects[i].sectHdr.size *
13055 -                                        pdblLib->pTargetInfo->mauSize;
13056 -                               status = DSP_SOK;
13057 -                               break;
13058 -                       }
13059 -               }
13060 -       } else {
13061 -               /* Check for overlay section */
13062 -               for (i = 0;  i < pdblLib->nOvlySects;  i++) {
13063 -                       if (CSL_Strcmp(pdblLib->ppOvlyData[i]->hdr.pName,
13064 -                          name) == 0) {
13065 -                               /* Address and size are meaningless */
13066 -                               *pAddr = 0;
13067 -                               *pSize = 0;
13068 -                               status = DSP_SOK;
13069 -                               break;
13070 -                       }
13071 -               }
13072 -       }
13073 -
13074 -       return status;
13075 -}
13076 -
13077 -/*
13078 - *  ======== DBL_init ========
13079 - *  Purpose:
13080 - *     Initialize DBL module.
13081 - */
13082 -bool DBL_init(void)
13083 -{
13084 -       bool retVal = true;
13085 -
13086 -       DBC_Require(cRefs >= 0);
13087 -
13088 -       if (cRefs == 0) {
13089 -               DBC_Assert(!DBL_debugMask.flags);
13090 -               GT_create(&DBL_debugMask, "BL");        /* "BL" for dBL */
13091 -
13092 -       }
13093 -
13094 -       if (retVal)
13095 -               cRefs++;
13096 -
13097 -
13098 -       GT_1trace(DBL_debugMask, GT_5CLASS, "DBL_init(), ref count:  0x%x\n",
13099 -                 cRefs);
13100 -
13101 -       DBC_Ensure((retVal && (cRefs > 0)) || (!retVal && (cRefs >= 0)));
13102 -
13103 -       return retVal;
13104 -}
13105 -
13106 -/*
13107 - *  ======== DBL_load ========
13108 - *  Purpose:
13109 - *     Add symbols/code/data defined in file to that already present
13110 - *     on the target.
13111 - */
13112 -DSP_STATUS DBL_load(struct DBL_LibraryObj *lib, DBL_Flags flags,
13113 -                  struct DBL_Attrs *attrs, u32 *pEntry)
13114 -{
13115 -       struct DBL_LibraryObj *pdblLib = (struct DBL_LibraryObj *)lib;
13116 -       struct DBL_TargetObj *dbl;
13117 -       u16 i;
13118 -       u16 nSects;
13119 -       DSP_STATUS status = DSP_EFAIL;
13120 -
13121 -       DBC_Require(cRefs > 0);
13122 -       DBC_Require(MEM_IsValidHandle(pdblLib, DBL_LIBSIGNATURE));
13123 -       DBC_Require(pEntry != NULL);
13124 -       DBC_Require(attrs != NULL);
13125 -
13126 -       GT_4trace(DBL_debugMask, GT_ENTER, "DBL_load: lib: 0x%x flags: "
13127 -                "0x%x attrs: 0x%x pEntry: 0x%x\n", lib, flags, attrs, pEntry);
13128 -
13129 -       dbl = pdblLib->pTarget;
13130 -       *pEntry = pdblLib->fileHdr.entry;
13131 -       nSects = pdblLib->fileHdr.numSects;
13132 -       dbl->dblAttrs = *attrs;
13133 -
13134 -       for (i = 0; i < nSects; i++) {
13135 -               /* Load the section at the current file offset */
13136 -               status = loadSect(dbl, lib);
13137 -               if (DSP_FAILED(status))
13138 -                       break;
13139 -
13140 -       }
13141 -
13142 -       /* Done with file, we can close it */
13143 -       if (pdblLib->file) {
13144 -               (*pdblLib->pTarget->dblAttrs.fclose) (pdblLib->file);
13145 -               pdblLib->file = NULL;
13146 -       }
13147 -       return status;
13148 -}
13149 -
13150 -/*
13151 - *  ======== DBL_loadSect ========
13152 - *  Purpose:
13153 - *     Load a named section from an library (for overlay support).
13154 - */
13155 -DSP_STATUS DBL_loadSect(struct DBL_LibraryObj *lib, char *sectName,
13156 -                       struct DBL_Attrs *attrs)
13157 -{
13158 -       struct DBL_TargetObj *dbl;
13159 -       s32 i;
13160 -       s32 phase;
13161 -       s32 offset = -1;
13162 -       s32 nSects = -1;
13163 -       s32 allocdSects = 0;
13164 -       u32 loadAddr;
13165 -       u32 runAddr;
13166 -       u32 size;
13167 -       u32 space;
13168 -       u32 ulBytes;
13169 -       u16 mauSize;
13170 -       u16 wordSize;
13171 -       u16 *phaseRef = NULL;
13172 -       u16 *otherRef = NULL;
13173 -       char *name = NULL;
13174 -       struct OvlyData *pOvlyData;
13175 -       DSP_STATUS status = DSP_ENOSECT;
13176 -
13177 -       DBC_Require(cRefs > 0);
13178 -       DBC_Require(MEM_IsValidHandle(lib, DBL_LIBSIGNATURE));
13179 -       DBC_Require(sectName != NULL);
13180 -       DBC_Require(attrs != NULL);
13181 -       DBC_Require(attrs->write != NULL);
13182 -       GT_3trace(DBL_debugMask, GT_ENTER,
13183 -                "DBL_loadSect: lib: 0x%x sectName: %s "
13184 -                "attrs: 0x%x\n", lib, sectName, attrs);
13185 -       dbl = lib->pTarget;
13186 -       mauSize = lib->pTargetInfo->mauSize;
13187 -       wordSize = lib->pTargetInfo->wordSize;
13188 -       /* Check for match of sect name in overlay table */
13189 -       for (i = 0; i < lib->nOvlySects; i++) {
13190 -               name = lib->ppOvlyData[i]->hdr.pName;
13191 -               if (!CSL_Strncmp(name, sectName, CSL_Strlen(name))) {
13192 -                       /* Match found */
13193 -                       status = DSP_SOK;
13194 -                       break;
13195 -               }
13196 -       }
13197 -       if (DSP_SUCCEEDED(status)) {
13198 -               DBC_Assert(i < lib->nOvlySects);
13199 -               pOvlyData = lib->ppOvlyData[i];
13200 -               /*
13201 -                *  If node overlay, phase will be encoded in name. If not node
13202 -                *  overlay, set phase to NONE.
13203 -                */
13204 -               phase = (CSL_Strcmp(name, sectName)) ?
13205 -                       CSL_Atoi(sectName + CSL_Strlen(sectName) - 1) : NONE;
13206 -                /*  Get reference count of node phase to be loaded, offset into
13207 -                *  overlay data array, and number of sections to overlay.  */
13208 -               switch (phase) {
13209 -               case NONE:
13210 -                       /* Not a node overlay */
13211 -                       phaseRef = &pOvlyData->hdr.otherRef;
13212 -                       nSects = numOtherSects(pOvlyData);
13213 -                       offset = otherOffset(pOvlyData);
13214 -                       break;
13215 -               case CREATEPHASE:
13216 -                       phaseRef = &pOvlyData->hdr.createRef;
13217 -                       otherRef = &pOvlyData->hdr.otherRef;
13218 -                       if (*otherRef) {
13219 -                               /* The overlay sections where node phase was
13220 -                                * not specified, have already been loaded.  */
13221 -                               nSects = numCreateSects(pOvlyData);
13222 -                               offset = createOffset(pOvlyData);
13223 -                       } else {
13224 -                               /* Overlay sections where node phase was not
13225 -                                * specified get loaded at create time, along
13226 -                                * with create sects.  */
13227 -                               nSects = numCreateSects(pOvlyData) +
13228 -                                        numOtherSects(pOvlyData);
13229 -                               offset = otherOffset(pOvlyData);
13230 -                       }
13231 -                       break;
13232 -               case DELETEPHASE:
13233 -                       phaseRef = &pOvlyData->hdr.deleteRef;
13234 -                       nSects = numDeleteSects(pOvlyData);
13235 -                       offset = deleteOffset(pOvlyData);
13236 -                       break;
13237 -               case EXECUTEPHASE:
13238 -                       phaseRef = &pOvlyData->hdr.executeRef;
13239 -                       nSects = numExecuteSects(pOvlyData);
13240 -                       offset = executeOffset(pOvlyData);
13241 -                       break;
13242 -               default:
13243 -                       /* ERROR */
13244 -                       DBC_Assert(false);
13245 -                       break;
13246 -               }
13247 -               /* Do overlay if reference count is 0 */
13248 -               if (!(*phaseRef)) {
13249 -                       /* "Allocate" all sections */
13250 -                       for (i = 0; i < nSects; i++) {
13251 -                               runAddr = pOvlyData->data[offset + i].runAddr;
13252 -                               size = pOvlyData->data[offset + i].size;
13253 -                               space = pOvlyData->data[offset + i].page;
13254 -                               status = (dbl->dblAttrs.alloc)(dbl->dblAttrs.
13255 -                                        rmmHandle, space, size, 0,
13256 -                                        &runAddr, true);
13257 -                               if (DSP_FAILED(status))
13258 -                                       break;
13259 -
13260 -                               allocdSects++;
13261 -                       }
13262 -                       if (DSP_SUCCEEDED(status)) {
13263 -                               /* Load sections */
13264 -                               for (i = 0; i < nSects; i++) {
13265 -                                       loadAddr = pOvlyData->data[offset + i].
13266 -                                                  loadAddr;
13267 -                                       runAddr = pOvlyData->data[offset + i].
13268 -                                                 runAddr;
13269 -                                       size = pOvlyData->data[offset + i].
13270 -                                               size;
13271 -                                       space = pOvlyData->data[offset + i].
13272 -                                               page;
13273 -                                       /* Convert to word address, call
13274 -                                        * write function */
13275 -                                       loadAddr /= (wordSize / mauSize);
13276 -                                       runAddr /= (wordSize / mauSize);
13277 -                                       ulBytes = size * mauSize;
13278 -                                       if ((*attrs->write)(attrs->wHandle,
13279 -                                          runAddr, (void *)loadAddr, ulBytes,
13280 -                                          space) != ulBytes) {
13281 -                                               GT_0trace(DBL_debugMask,
13282 -                                                       GT_6CLASS,
13283 -                                                       "DBL_loadSect: write"
13284 -                                                       " failed\n");
13285 -                                               status = DSP_EFWRITE;
13286 -                                               break;
13287 -                                       }
13288 -                               }
13289 -                       }
13290 -                       /* Free sections on failure */
13291 -                       if (DSP_FAILED(status))
13292 -                               freeSects(dbl, pOvlyData, offset, allocdSects);
13293 -
13294 -               }
13295 -       }
13296 -       if (DSP_SUCCEEDED(status)) {
13297 -               /* Increment reference counts */
13298 -               if (otherRef)
13299 -                       *otherRef = *otherRef + 1;
13300 -
13301 -               *phaseRef = *phaseRef + 1;
13302 -       }
13303 -       return status;
13304 -}
13305 -
13306 -/*
13307 - *  ======== DBL_open ========
13308 - *  Purpose:
13309 - *     DBL_open() returns a library handle that can be used to
13310 - *     load/unload the symbols/code/data via DBL_load()/DBL_unload().
13311 - */
13312 -DSP_STATUS DBL_open(struct DBL_TargetObj *target, char *file, DBL_Flags flags,
13313 -                  struct DBL_LibraryObj **pLib)
13314 -{
13315 -       struct DBL_LibraryObj *pdblLib = NULL;
13316 -       u16 nSymbols;
13317 -       u16 nDCDSects;
13318 -       DSP_STATUS status = DSP_SOK;
13319 -       DBC_Require(cRefs > 0);
13320 -       DBC_Require(MEM_IsValidHandle(target, DBL_TARGSIGNATURE));
13321 -       DBC_Require(target->dblAttrs.fopen != NULL);
13322 -       DBC_Require(file != NULL);
13323 -       DBC_Require(pLib != NULL);
13324 -
13325 -       GT_3trace(DBL_debugMask, GT_ENTER, "DBL_open: target: 0x%x file: %s "
13326 -                "pLib: 0x%x\n", target, file, pLib);
13327 -       /* Allocate DBL library object */
13328 -       MEM_AllocObject(pdblLib, struct DBL_LibraryObj, DBL_LIBSIGNATURE);
13329 -       if (pdblLib == NULL)
13330 -               status = DSP_EMEMORY;
13331 -
13332 -       /* Open the file */
13333 -       if (DSP_SUCCEEDED(status)) {
13334 -               pdblLib->pTarget = target;
13335 -               pdblLib->file = (*target->dblAttrs.fopen)(file, "rb");
13336 -               if (pdblLib->file == NULL)
13337 -                       status = DSP_EFOPEN;
13338 -
13339 -       }
13340 -       /* Read file header */
13341 -       if (DSP_SUCCEEDED(status)) {
13342 -               status = readHeader(target, pdblLib);
13343 -               if (DSP_FAILED(status)) {
13344 -                       GT_0trace(DBL_debugMask, GT_6CLASS,
13345 -                                "DBL_open(): Failed to read file header\n");
13346 -               }
13347 -       }
13348 -       /* Allocate symbol table */
13349 -       if (DSP_SUCCEEDED(status)) {
13350 -               nSymbols = pdblLib->nSymbols = pdblLib->fileHdr.numSymbols;
13351 -               pdblLib->symbols = MEM_Calloc(nSymbols * sizeof(struct Symbol),
13352 -                                            MEM_PAGED);
13353 -               if (pdblLib->symbols == NULL)
13354 -                       status = DSP_EMEMORY;
13355 -
13356 -       }
13357 -       /* Read all the symbols */
13358 -       if (DSP_SUCCEEDED(status)) {
13359 -               status = readSymbols(target, pdblLib);
13360 -               if (DSP_FAILED(status)) {
13361 -                       GT_0trace(DBL_debugMask, GT_6CLASS,
13362 -                                "DBL_open(): Failed to read symbols\n");
13363 -               }
13364 -       }
13365 -       /* Allocate DCD sect table */
13366 -       if (DSP_SUCCEEDED(status)) {
13367 -               nDCDSects = pdblLib->nDCDSects = pdblLib->fileHdr.numDCDSects;
13368 -               pdblLib->dcdSects = MEM_Calloc(nDCDSects *
13369 -                                        sizeof(struct DCDSect), MEM_PAGED);
13370 -               if (pdblLib->dcdSects == NULL)
13371 -                       status = DSP_EMEMORY;
13372 -
13373 -       }
13374 -       /* Read DCD sections */
13375 -       if (DSP_SUCCEEDED(status)) {
13376 -               status = readDCDSects(target, pdblLib);
13377 -               if (DSP_FAILED(status)) {
13378 -                       GT_0trace(DBL_debugMask, GT_6CLASS,
13379 -                                "DBL_open(): Failed to read DCD sections\n");
13380 -               }
13381 -       }
13382 -       /* Read overlay sections */
13383 -       if (DSP_SUCCEEDED(status)) {
13384 -               status = readOvlySects(target, pdblLib);
13385 -               if (DSP_FAILED(status)) {
13386 -                       GT_0trace(DBL_debugMask, GT_6CLASS,
13387 -                                "DBL_open(): Failed to read "
13388 -                                "overlay sections\n");
13389 -               }
13390 -       }
13391 -       if (DSP_FAILED(status)) {
13392 -               *pLib = NULL;
13393 -               if (pdblLib != NULL)
13394 -                       DBL_close((struct DBL_LibraryObj *) pdblLib);
13395 -
13396 -       } else {
13397 -               *pLib = pdblLib;
13398 -       }
13399 -       DBC_Ensure((DSP_SUCCEEDED(status) &&
13400 -                 (MEM_IsValidHandle((*pLib), DBL_LIBSIGNATURE))) ||
13401 -                 (DSP_FAILED(status) && *pLib == NULL));
13402 -       return status;
13403 -}
13404 -
13405 -/*
13406 - *  ======== DBL_readSect ========
13407 - *  Purpose:
13408 - *     Read COFF section into a character buffer.
13409 - */
13410 -DSP_STATUS DBL_readSect(struct DBL_LibraryObj *lib, char *name, char *pContent,
13411 -                       u32 size)
13412 -{
13413 -       struct DBL_LibraryObj *pdblLib = (struct DBL_LibraryObj *)lib;
13414 -       u16 i;
13415 -       u32 mauSize;
13416 -       u32 max;
13417 -       DSP_STATUS status = DSP_ENOSECT;
13418 -
13419 -       DBC_Require(cRefs > 0);
13420 -       DBC_Require(MEM_IsValidHandle(pdblLib, DBL_LIBSIGNATURE));
13421 -       DBC_Require(name != NULL);
13422 -       DBC_Require(pContent != NULL);
13423 -       DBC_Require(size != 0);
13424 -       GT_4trace(DBL_debugMask, GT_ENTER, "DBL_readSect: lib: 0x%x name: %s "
13425 -                "pContent: 0x%x size: 0x%x\n", lib, name, pContent, size);
13426 -
13427 -       mauSize = pdblLib->pTargetInfo->mauSize;
13428 -
13429 -       /* Attempt to find match with DCD section names. */
13430 -       for (i = 0; i < pdblLib->nDCDSects; i++) {
13431 -               if (CSL_Strcmp(pdblLib->dcdSects[i].sectHdr.name, name) == 0) {
13432 -                       /* Match found */
13433 -                       max = pdblLib->dcdSects[i].sectHdr.size * mauSize;
13434 -                       max = (max > size) ? size : max;
13435 -                       memcpy(pContent, pdblLib->dcdSects[i].pData, max);
13436 -                       status = DSP_SOK;
13437 -                       break;
13438 -               }
13439 -       }
13440 -
13441 -       return status;
13442 -}
13443 -
13444 -/*
13445 - *  ======== DBL_setAttrs ========
13446 - *  Purpose:
13447 - *     Set the attributes of the target.
13448 - */
13449 -void DBL_setAttrs(struct DBL_TargetObj *target, struct DBL_Attrs *pAttrs)
13450 -{
13451 -       DBC_Require(cRefs > 0);
13452 -       DBC_Require(MEM_IsValidHandle(target, DBL_TARGSIGNATURE));
13453 -       DBC_Require(pAttrs != NULL);
13454 -
13455 -       GT_2trace(DBL_debugMask, GT_ENTER, "DBL_setAttrs: target: 0x%x pAttrs: "
13456 -                "0x%x\n", target, pAttrs);
13457 -
13458 -       target->dblAttrs = *pAttrs;
13459 -}
13460 -
13461 -/*
13462 - *  ======== DBL_unload ========
13463 - *  Purpose:
13464 - *     Remove the symbols/code/data corresponding to the library lib.
13465 - */
13466 -void DBL_unload(struct DBL_LibraryObj *lib, struct DBL_Attrs *attrs)
13467 -{
13468 -       DBC_Require(cRefs > 0);
13469 -       DBC_Require(MEM_IsValidHandle(lib, DBL_LIBSIGNATURE));
13470 -
13471 -       GT_1trace(DBL_debugMask, GT_ENTER, "DBL_unload: lib: 0x%x\n", lib);
13472 -
13473 -       /* Nothing to do for static loading */
13474 -}
13475 -
13476 -/*
13477 - *  ======== DBL_unloadSect ========
13478 - *  Purpose:
13479 - *     Unload a named section from an library (for overlay support).
13480 - */
13481 -DSP_STATUS DBL_unloadSect(struct DBL_LibraryObj *lib, char *sectName,
13482 -                         struct DBL_Attrs *attrs)
13483 -{
13484 -       struct DBL_TargetObj *dbl;
13485 -       s32 i;
13486 -       s32 phase;
13487 -       s32 offset = -1;
13488 -       s32 nSects = -1;
13489 -       u16 *phaseRef = NULL;
13490 -       u16 *otherRef = NULL;
13491 -       char *pName = NULL;
13492 -       struct OvlyData *pOvlyData;
13493 -       DSP_STATUS status = DSP_ENOSECT;
13494 -
13495 -       DBC_Require(cRefs > 0);
13496 -       DBC_Require(MEM_IsValidHandle(lib, DBL_LIBSIGNATURE));
13497 -       DBC_Require(sectName != NULL);
13498 -
13499 -       GT_2trace(DBL_debugMask, GT_ENTER,
13500 -                "DBL_unloadSect: lib: 0x%x sectName: %s\n", lib, sectName);
13501 -       dbl = lib->pTarget;
13502 -       /* Check for match of sect name in overlay table */
13503 -       for (i = 0; i < lib->nOvlySects; i++) {
13504 -               pName = lib->ppOvlyData[i]->hdr.pName;
13505 -               if (!CSL_Strncmp(pName, sectName, CSL_Strlen(pName))) {
13506 -                       /* Match found */
13507 -                       status = DSP_SOK;
13508 -                       break;
13509 -               }
13510 -       }
13511 -       if (DSP_SUCCEEDED(status)) {
13512 -               DBC_Assert(i < lib->nOvlySects);
13513 -               pOvlyData = lib->ppOvlyData[i];
13514 -               /* If node overlay, phase will be encoded in name. */
13515 -               phase = (CSL_Strcmp(pName, sectName)) ?
13516 -                       CSL_Atoi(sectName + CSL_Strlen(sectName) - 1) : NONE;
13517 -               switch (phase) {
13518 -               case NONE:
13519 -                       nSects = numOtherSects(pOvlyData);
13520 -                       phaseRef = &pOvlyData->hdr.otherRef;
13521 -                       offset = otherOffset(pOvlyData);
13522 -                       break;
13523 -               case CREATEPHASE:
13524 -                       nSects = numCreateSects(pOvlyData);
13525 -                       offset = createOffset(pOvlyData);
13526 -                       phaseRef = &pOvlyData->hdr.createRef;
13527 -                       break;
13528 -               case DELETEPHASE:
13529 -                       nSects = numDeleteSects(pOvlyData);
13530 -                       offset = deleteOffset(pOvlyData);
13531 -                       phaseRef = &pOvlyData->hdr.deleteRef;
13532 -                       otherRef = &pOvlyData->hdr.otherRef;
13533 -                       break;
13534 -               case EXECUTEPHASE:
13535 -                       nSects = numExecuteSects(pOvlyData);
13536 -                       offset = executeOffset(pOvlyData);
13537 -                       phaseRef = &pOvlyData->hdr.executeRef;
13538 -                       break;
13539 -               default:
13540 -                       /* ERROR */
13541 -                       DBC_Assert(false);
13542 -                       break;
13543 -               }
13544 -               if (*phaseRef) {
13545 -                       *phaseRef = *phaseRef - 1;
13546 -                       if (*phaseRef == 0) {
13547 -                               /* Unload overlay sections for phase */
13548 -                               freeSects(dbl, pOvlyData, offset, nSects);
13549 -                       }
13550 -                       if (phase == DELETEPHASE) {
13551 -                               DBC_Assert(*otherRef);
13552 -                               *otherRef = *otherRef - 1;
13553 -                               if (*otherRef == 0) {
13554 -                                       /* Unload other overlay sections */
13555 -                                       nSects = numOtherSects(pOvlyData);
13556 -                                       offset = otherOffset(pOvlyData);
13557 -                                       freeSects(dbl, pOvlyData, offset,
13558 -                                                nSects);
13559 -                               }
13560 -                       }
13561 -               }
13562 -       }
13563 -
13564 -       return status;
13565 -}
13566 -
13567 -/*
13568 - *  ======== freeSects ========
13569 - *  Purpose:
13570 - *     Free section
13571 - */
13572 -static void freeSects(struct DBL_TargetObj *dbl, struct OvlyData *pOvlyData,
13573 -                    s32 offset, s32 nSects)
13574 -{
13575 -       u32 runAddr;
13576 -       u32 size;
13577 -       u32 space;
13578 -       s32 i;
13579 -
13580 -       for (i = 0; i < nSects; i++) {
13581 -               runAddr = pOvlyData->data[offset + i].runAddr;
13582 -               size = pOvlyData->data[offset + i].size;
13583 -               space = pOvlyData->data[offset + i].page;
13584 -               if (!(dbl->dblAttrs.free)
13585 -                   (dbl->dblAttrs.rmmHandle, space, runAddr, size, true)) {
13586 -                       /*
13587 -                        *  Free function will not fail for overlay, unless
13588 -                        *  address passed in is bad.
13589 -                        */
13590 -                       DBC_Assert(false);
13591 -               }
13592 -       }
13593 -}
13594 -
13595 -/*
13596 - *  ======== loadSect ========
13597 - *  Purpose:
13598 - *     Load section to target
13599 - */
13600 -static DSP_STATUS loadSect(struct DBL_TargetObj *dbl,
13601 -                         struct DBL_LibraryObj *pdblLib)
13602 -{
13603 -       struct DBOF_SectHdr sectHdr;
13604 -       char *pBuf;
13605 -       struct KFILE_FileObj *file;
13606 -       u32 space;
13607 -       u32 addr;
13608 -       u32 total;
13609 -       u32 nWords = 0;
13610 -       u32 nBytes = 0;
13611 -       u16 mauSize;
13612 -       u32 bufSize;
13613 -       DSP_STATUS status = DSP_SOK;
13614 -
13615 -       file = pdblLib->file;
13616 -       mauSize = pdblLib->pTargetInfo->mauSize;
13617 -       bufSize = LOADBUFSIZE / mauSize;
13618 -       pBuf = dbl->pBuf;
13619 -
13620 -       /* Read the section header */
13621 -       if ((*dbl->dblAttrs.fread)(&sectHdr, sizeof(struct DBOF_SectHdr),
13622 -          1, file) != 1) {
13623 -               GT_0trace(DBL_debugMask, GT_6CLASS,
13624 -                        "Failed to read DCD sect header\n");
13625 -               status = DSP_EFREAD;
13626 -       } else {
13627 -               if (pdblLib->byteSwapped) {
13628 -                       sectHdr.size = SWAPLONG(sectHdr.size);
13629 -                       sectHdr.addr = SWAPLONG(sectHdr.addr);
13630 -                       sectHdr.page = SWAPWORD(sectHdr.page);
13631 -               }
13632 -       }
13633 -       if (DSP_SUCCEEDED(status)) {
13634 -               addr = sectHdr.addr;
13635 -               space = sectHdr.page;
13636 -               for (total = sectHdr.size; total > 0; total -= nWords) {
13637 -                       nWords = min(total, bufSize);
13638 -                       nBytes = nWords * mauSize;
13639 -                       /* Read section data */
13640 -                       if ((*dbl->dblAttrs.fread)(pBuf, nBytes, 1,
13641 -                          file) != 1) {
13642 -                               GT_0trace(DBL_debugMask, GT_6CLASS,
13643 -                                        "Failed to read DCD sect header\n");
13644 -                               status = DSP_EFREAD;
13645 -                               break;
13646 -                       }
13647 -                       /* Write section to target */
13648 -                       if (!(*dbl->dblAttrs.write)(dbl->dblAttrs.wHandle,
13649 -                          addr, pBuf, nBytes, space)) {
13650 -                               GT_0trace(DBL_debugMask, GT_6CLASS,
13651 -                                        "Failed to write section data\n");
13652 -                               status = DSP_EFWRITE;
13653 -                               break;
13654 -                       }
13655 -                       addr += nWords;
13656 -               }
13657 -       }
13658 -       return status;
13659 -}
13660 -
13661 -/*
13662 - *  ======== readDCDSects ========
13663 - *  Purpose:
13664 - *     Read DCD sections.
13665 - */
13666 -static DSP_STATUS readDCDSects(struct DBL_TargetObj *dbl,
13667 -                             struct DBL_LibraryObj *pdblLib)
13668 -{
13669 -       struct DBOF_DCDSectHdr *pSectHdr;
13670 -       struct DCDSect *pSect;
13671 -       struct KFILE_FileObj *file;
13672 -       u16 nSects;
13673 -       u16 i;
13674 -       u16 mauSize;
13675 -       DSP_STATUS status = DSP_SOK;
13676 -
13677 -       file = pdblLib->file;
13678 -       mauSize = pdblLib->pTargetInfo->mauSize;
13679 -       nSects = pdblLib->fileHdr.numDCDSects;
13680 -       for (i = 0; i < nSects; i++) {
13681 -               pSect = &pdblLib->dcdSects[i];
13682 -               pSectHdr = &pdblLib->dcdSects[i].sectHdr;
13683 -               /* Read sect header */
13684 -               if ((*dbl->dblAttrs.fread)(pSectHdr,
13685 -                  sizeof(struct DBOF_DCDSectHdr), 1, file) != 1) {
13686 -                       GT_0trace(DBL_debugMask, GT_6CLASS,
13687 -                                "Failed to read DCD sect header\n");
13688 -                       status = DSP_EFREAD;
13689 -                       break;
13690 -               }
13691 -               if (pdblLib->byteSwapped)
13692 -                       pSectHdr->size = SWAPLONG(pSectHdr->size);
13693 -
13694 -               pSect->pData = (char *)MEM_Calloc(pSectHdr->size *
13695 -                               mauSize, MEM_PAGED);
13696 -               if (pSect->pData == NULL) {
13697 -                       GT_2trace(DBL_debugMask, GT_6CLASS,
13698 -                                "Memory allocation for sect %s "
13699 -                                "data failed: Size: 0x%lx\n", pSectHdr->name,
13700 -                                pSectHdr->size);
13701 -                       status = DSP_EMEMORY;
13702 -                       break;
13703 -               }
13704 -               /* Read DCD sect data */
13705 -               if ((*dbl->dblAttrs.fread)(pSect->pData, mauSize,
13706 -                  pSectHdr->size, file) != pSectHdr->size) {
13707 -                       GT_0trace(DBL_debugMask, GT_6CLASS,
13708 -                                 "Failed to read DCD sect data\n");
13709 -                       status = DSP_EFREAD;
13710 -                       break;
13711 -               }
13712 -       }
13713 -
13714 -       return status;
13715 -}
13716 -
13717 -/*
13718 - *  ======== readHeader ========
13719 - *  Purpose:
13720 - *     Read Header.
13721 - */
13722 -static DSP_STATUS readHeader(struct DBL_TargetObj *dbl,
13723 -                           struct DBL_LibraryObj *pdblLib)
13724 -{
13725 -       struct KFILE_FileObj *file;
13726 -       s32 i;
13727 -       struct DBOF_FileHdr *pHdr;
13728 -       u32 swapMagic;
13729 -       DSP_STATUS status = DSP_SOK;
13730 -
13731 -       pdblLib->byteSwapped = false;
13732 -       file = pdblLib->file;
13733 -       pHdr = &pdblLib->fileHdr;
13734 -       if ((*dbl->dblAttrs.fread)(pHdr, sizeof(struct DBOF_FileHdr), 1,
13735 -          file) != 1) {
13736 -               GT_0trace(DBL_debugMask, GT_6CLASS,
13737 -                        "readHeader: Failed to read file header\n");
13738 -               status = DSP_EFREAD;
13739 -       }
13740 -
13741 -       if (DSP_SUCCEEDED(status)) {
13742 -               /* Determine if byte swapped */
13743 -               for (i = 0; i < NUMTARGS; i++) {
13744 -                       swapMagic = SWAPLONG(pHdr->magic);
13745 -                       if (pHdr->magic == magicTab[i] || swapMagic ==
13746 -                          magicTab[i]) {
13747 -                               if (swapMagic == magicTab[i]) {
13748 -                                       pdblLib->byteSwapped = true;
13749 -                                       pHdr->magic = SWAPLONG(pHdr->magic);
13750 -                                       pHdr->entry = SWAPLONG(pHdr->entry);
13751 -                                       pHdr->symOffset = SWAPLONG(pHdr->
13752 -                                                               symOffset);
13753 -                                       pHdr->dcdSectOffset = SWAPLONG(pHdr->
13754 -                                                               dcdSectOffset);
13755 -                                       pHdr->loadSectOffset = SWAPLONG(pHdr->
13756 -                                                               loadSectOffset);
13757 -                                       pHdr->ovlySectOffset = SWAPLONG(pHdr->
13758 -                                                               ovlySectOffset);
13759 -                                       pHdr->numSymbols = SWAPWORD(pHdr->
13760 -                                                               numSymbols);
13761 -                                       pHdr->numDCDSects = SWAPWORD(pHdr->
13762 -                                                               numDCDSects);
13763 -                                       pHdr->numSects = SWAPWORD(pHdr->
13764 -                                                               numSects);
13765 -                                       pHdr->numOvlySects = SWAPWORD(pHdr->
13766 -                                                               numOvlySects);
13767 -                               }
13768 -                               break;
13769 -                       }
13770 -               }
13771 -               if (i == NUMTARGS) {
13772 -                       GT_0trace(DBL_debugMask, GT_6CLASS,
13773 -                                "readHeader: Failed to determine"
13774 -                                " target type\n");
13775 -                       status = DSP_ECORRUPTFILE;
13776 -               } else {
13777 -                       pdblLib->pTargetInfo = &targetTab[i];
13778 -                       GT_1trace(DBL_debugMask, GT_ENTER,
13779 -                                "COF type: 0x%lx\n", pHdr->magic);
13780 -                       GT_1trace(DBL_debugMask, GT_ENTER,
13781 -                                "Entry point:0x%lx\n", pHdr->entry);
13782 -               }
13783 -       }
13784 -       return status;
13785 -}
13786 -
13787 -/*
13788 - *  ======== readOvlySects ========
13789 - *  Purpose:
13790 - *     Read Overlay Sections
13791 - */
13792 -static DSP_STATUS readOvlySects(struct DBL_TargetObj *dbl,
13793 -                               struct DBL_LibraryObj *pdblLib)
13794 -{
13795 -       struct DBOF_OvlySectHdr hdr;
13796 -       struct DBOF_OvlySectData *pData;
13797 -       struct OvlyData *pOvlyData;
13798 -       char *pName;
13799 -       struct KFILE_FileObj *file;
13800 -       u16 i, j;
13801 -       u16 nSects;
13802 -       u16 n;
13803 -       DSP_STATUS status = DSP_SOK;
13804 -
13805 -       pdblLib->nOvlySects = nSects = pdblLib->fileHdr.numOvlySects;
13806 -       file = pdblLib->file;
13807 -       if (nSects > 0) {
13808 -               pdblLib->ppOvlyData = MEM_Calloc(nSects * sizeof(OvlyData *),
13809 -                                                MEM_PAGED);
13810 -               if (pdblLib->ppOvlyData == NULL) {
13811 -                       GT_0trace(DBL_debugMask, GT_7CLASS,
13812 -                                "Failed to allocatate overlay "
13813 -                                "data memory\n");
13814 -                       status = DSP_EMEMORY;
13815 -               }
13816 -       }
13817 -       if (DSP_SUCCEEDED(status)) {
13818 -               /* Read overlay data for each node */
13819 -               for (i = 0; i < nSects; i++) {
13820 -                       /* Read overlay section header */
13821 -                       if ((*dbl->dblAttrs.fread)(&hdr,
13822 -                          sizeof(struct DBOF_OvlySectHdr), 1, file) != 1) {
13823 -                               GT_0trace(DBL_debugMask, GT_6CLASS,
13824 -                                        "Failed to read overlay sect"
13825 -                                        " header\n");
13826 -                               status = DSP_EFREAD;
13827 -                               break;
13828 -                       }
13829 -                       if (pdblLib->byteSwapped) {
13830 -                               hdr.nameLen = SWAPWORD(hdr.nameLen);
13831 -                               hdr.numCreateSects =
13832 -                                               SWAPWORD(hdr.numCreateSects);
13833 -                               hdr.numDeleteSects =
13834 -                                               SWAPWORD(hdr.numDeleteSects);
13835 -                               hdr.numExecuteSects =
13836 -                                               SWAPWORD(hdr.numExecuteSects);
13837 -                               hdr.numOtherSects =
13838 -                                               SWAPWORD(hdr.numOtherSects);
13839 -                               hdr.resvd = SWAPWORD(hdr.resvd);
13840 -                       }
13841 -                       n = hdr.numCreateSects + hdr.numDeleteSects +
13842 -                           hdr.numExecuteSects + hdr.numOtherSects;
13843 -
13844 -                       /* Allocate memory for node's overlay data */
13845 -                       pOvlyData = (struct OvlyData *)MEM_Calloc
13846 -                                   (sizeof(struct OvlyHdr) +
13847 -                                   n * sizeof(struct DBOF_OvlySectData),
13848 -                                   MEM_PAGED);
13849 -                       if (pOvlyData == NULL) {
13850 -                               GT_0trace(DBL_debugMask, GT_7CLASS,
13851 -                                        "Failed to allocatate ovlyay"
13852 -                                        " data memory\n");
13853 -                               status = DSP_EMEMORY;
13854 -                               break;
13855 -                       }
13856 -                       pOvlyData->hdr.dbofHdr = hdr;
13857 -                       pdblLib->ppOvlyData[i] = pOvlyData;
13858 -                       /* Allocate memory for section name */
13859 -                       pName = (char *)MEM_Calloc(hdr.nameLen + 1, MEM_PAGED);
13860 -                       if (pName == NULL) {
13861 -                               GT_0trace(DBL_debugMask, GT_7CLASS,
13862 -                                        "Failed to allocatate ovlyay"
13863 -                                        " section name\n");
13864 -                               status = DSP_EMEMORY;
13865 -                               break;
13866 -                       }
13867 -                       pOvlyData->hdr.pName = pName;
13868 -                       /* Read the overlay section name */
13869 -                       if ((*dbl->dblAttrs.fread)(pName, sizeof(char),
13870 -                          hdr.nameLen, file) != hdr.nameLen) {
13871 -                               GT_0trace(DBL_debugMask, GT_7CLASS,
13872 -                                        "readOvlySects: Unable to "
13873 -                                        "read overlay name.\n");
13874 -                               status = DSP_EFREAD;
13875 -                               break;
13876 -                       }
13877 -                       /* Read the overlay section data */
13878 -                       pData = pOvlyData->data;
13879 -                       if ((*dbl->dblAttrs.fread)(pData,
13880 -                          sizeof(struct DBOF_OvlySectData), n, file) != n) {
13881 -                               GT_0trace(DBL_debugMask, GT_7CLASS,
13882 -                                        "readOvlySects: Unable to "
13883 -                                        "read overlay data.\n");
13884 -                               status = DSP_EFREAD;
13885 -                               break;
13886 -                       }
13887 -                       /* Swap overlay data, if necessary */
13888 -                       if (pdblLib->byteSwapped) {
13889 -                               for (j = 0; j < n; j++) {
13890 -                                       pData[j].loadAddr =
13891 -                                                SWAPLONG(pData[j].loadAddr);
13892 -                                       pData[j].runAddr =
13893 -                                                SWAPLONG(pData[j].runAddr);
13894 -                                       pData[j].size =
13895 -                                                SWAPLONG(pData[j].size);
13896 -                                       pData[j].page =
13897 -                                                SWAPWORD(pData[j].page);
13898 -                               }
13899 -                       }
13900 -               }
13901 -       }
13902 -       return status;
13903 -}
13904 -
13905 -/*
13906 - *  ======== readSymbols ========
13907 - *  Purpose:
13908 - *     Read Symbols
13909 - */
13910 -static DSP_STATUS readSymbols(struct DBL_TargetObj *dbl,
13911 -                            struct DBL_LibraryObj *pdblLib)
13912 -{
13913 -       struct DBOF_SymbolHdr symHdr;
13914 -       struct KFILE_FileObj *file;
13915 -       u16 i;
13916 -       u16 nSymbols;
13917 -       u16 len;
13918 -       char *pName = NULL;
13919 -       DSP_STATUS status = DSP_SOK;
13920 -
13921 -       file = pdblLib->file;
13922 -
13923 -       nSymbols = pdblLib->fileHdr.numSymbols;
13924 -
13925 -       for (i = 0; i < nSymbols; i++) {
13926 -               /* Read symbol value */
13927 -               if ((*dbl->dblAttrs.fread)(&symHdr,
13928 -                  sizeof(struct DBOF_SymbolHdr), 1, file) != 1) {
13929 -                       GT_0trace(DBL_debugMask, GT_6CLASS,
13930 -                                "Failed to read symbol value\n");
13931 -                       status = DSP_EFREAD;
13932 -                       break;
13933 -               }
13934 -               if (pdblLib->byteSwapped) {
13935 -                       symHdr.nameLen = SWAPWORD(symHdr.nameLen);
13936 -                       symHdr.value = SWAPLONG(symHdr.value);
13937 -               }
13938 -               /* Allocate buffer for symbol name */
13939 -               len = symHdr.nameLen;
13940 -               pName = (char *)MEM_Calloc(len + 1, MEM_PAGED);
13941 -               if (pName == NULL) {
13942 -                       GT_0trace(DBL_debugMask, GT_6CLASS,
13943 -                                "Memory allocation failed\n");
13944 -                       status = DSP_EMEMORY;
13945 -                       break;
13946 -               }
13947 -               pdblLib->symbols[i].pSymName = pName;
13948 -               pdblLib->symbols[i].sym.value = symHdr.value;
13949 -               /* Read symbol name */
13950 -               if ((*dbl->dblAttrs.fread) (pName, sizeof(char), len, file) !=
13951 -                  len) {
13952 -                       GT_0trace(DBL_debugMask, GT_6CLASS,
13953 -                                "Failed to read symbol value\n");
13954 -                       status = DSP_EFREAD;
13955 -                       break;
13956 -               } else {
13957 -                       pName[len] = '\0';
13958 -                       GT_2trace(DBL_debugMask, GT_ENTER,
13959 -                                "Symbol: %s  Value: 0x%lx\n",
13960 -                                pName, symHdr.value);
13961 -               }
13962 -       }
13963 -       return status;
13964 -}
13965 -
13966 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/dbll.c kernel-power-2.6.28/drivers/dsp/bridge/pmgr/dbll.c
13967 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/dbll.c     2011-04-17 17:32:26.000000000 +0100
13968 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/dbll.c  2011-05-02 22:36:49.000000000 +0100
13969 @@ -14,26 +14,6 @@
13970   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13971   */
13972  
13973 -/*
13974 - *  ======== dbll.c ========
13975 - *
13976 - *! Revision History
13977 - *! ================
13978 - *! 25-Apr-2030 map:    Fixed symbol redefinition bug + unload and return error
13979 - *! 08-Apr-2003 map:   Consolidated DBL with DBLL loader name
13980 - *! 24-Mar-2003 map:    Updated findSymbol to support dllview update
13981 - *! 23-Jan-2003 map:    Updated rmmAlloc to support memory granularity
13982 - *! 21-Nov-2002 map:    Combine fopen and DLOAD_module_open to increase
13983 - *!         performance on start.
13984 - *! 04-Oct-2002 map:    Integrated new TIP dynamic loader w/ DOF api.
13985 - *! 27-Sep-2002 map:    Changed handle passed to RemoteFree, instead of
13986 - *!         RMM_free;  added GT_trace to rmmDealloc
13987 - *! 20-Sep-2002 map:    Updated from Code Review
13988 - *! 08-Aug-2002 jeh:    Updated to support overlays.
13989 - *! 25-Jun-2002 jeh:    Pass RMM_Addr object to alloc function in rmmAlloc().
13990 - *! 20-Mar-2002 jeh:    Created.
13991 - */
13992 -
13993  /*  ----------------------------------- Host OS */
13994  #include <dspbridge/host_os.h>
13995  
13996 @@ -48,7 +28,6 @@
13997  #include <dspbridge/gh.h>
13998  
13999  /*  ----------------------------------- OS Adaptation Layer */
14000 -#include <dspbridge/csl.h>
14001  #include <dspbridge/mem.h>
14002  
14003  /* Dynamic loader library interface */
14004 @@ -338,8 +317,6 @@ void DBLL_exit(void)
14005                   cRefs);
14006  
14007         if (cRefs == 0) {
14008 -               MEM_Exit();
14009 -               CSL_Exit();
14010                 GH_exit();
14011  #if GT_TRACE
14012                 DBLL_debugMask.flags = NULL;
14013 @@ -490,31 +467,20 @@ DSP_STATUS DBLL_getSect(struct DBLL_Libr
14014   */
14015  bool DBLL_init(void)
14016  {
14017 -       bool retVal = true;
14018 -
14019         DBC_Require(cRefs >= 0);
14020  
14021         if (cRefs == 0) {
14022                 DBC_Assert(!DBLL_debugMask.flags);
14023                 GT_create(&DBLL_debugMask, "DL");       /* "DL" for dbDL */
14024                 GH_init();
14025 -               CSL_Init();
14026 -               retVal = MEM_Init();
14027 -               if (!retVal)
14028 -                       MEM_Exit();
14029 -
14030         }
14031  
14032 -       if (retVal)
14033 -               cRefs++;
14034 -
14035 +       cRefs++;
14036  
14037         GT_1trace(DBLL_debugMask, GT_5CLASS, "DBLL_init(), ref count:  0x%x\n",
14038                  cRefs);
14039  
14040 -       DBC_Ensure((retVal && (cRefs > 0)) || (!retVal && (cRefs >= 0)));
14041 -
14042 -       return retVal;
14043 +       return true;
14044  }
14045  
14046  /*
14047 @@ -671,7 +637,7 @@ DSP_STATUS DBLL_open(struct DBLL_TarObj 
14048                  " 0x%x\n", target, file, pLib);
14049         zlLib = zlTarget->head;
14050         while (zlLib != NULL) {
14051 -               if (strcmp(zlLib->fileName, file) == 0) {
14052 +               if (strcmp(zlLib->fileName, file) == 0) {
14053                         /* Library is already opened */
14054                         zlLib->openRef++;
14055                         break;
14056 @@ -693,7 +659,7 @@ DSP_STATUS DBLL_open(struct DBLL_TarObj 
14057                         zlLib->openRef++;
14058                         zlLib->pTarget = zlTarget;
14059                         /* Keep a copy of the file name */
14060 -                       zlLib->fileName = MEM_Calloc(strlen(file) + 1,
14061 +                       zlLib->fileName = MEM_Calloc(strlen(file) + 1,
14062                                                         MEM_PAGED);
14063                         if (zlLib->fileName == NULL) {
14064                                 GT_0trace(DBLL_debugMask, GT_6CLASS,
14065 @@ -701,8 +667,8 @@ DSP_STATUS DBLL_open(struct DBLL_TarObj 
14066                                          "allocation failed\n");
14067                                 status = DSP_EMEMORY;
14068                         } else {
14069 -                               strncpy(zlLib->fileName, file,
14070 -                                          strlen(file) + 1);
14071 +                               strncpy(zlLib->fileName, file,
14072 +                                       strlen(file) + 1);
14073                         }
14074                         zlLib->symTab = NULL;
14075                 }
14076 @@ -909,26 +875,23 @@ void DBLL_unload(struct DBLL_LibraryObj 
14077                 goto func_end;
14078  
14079         zlLib->pTarget->attrs = *attrs;
14080 -       if (zlLib != NULL) {
14081 -               if (zlLib->mHandle) {
14082 -                       err = Dynamic_Unload_Module(zlLib->mHandle,
14083 -                               &zlLib->symbol.dlSymbol,
14084 -                               &zlLib->allocate.dlAlloc, &zlLib->init.dlInit);
14085 -                       if (err != 0) {
14086 -                               GT_1trace(DBLL_debugMask, GT_5CLASS,
14087 -                                        "Dynamic_Unload_Module "
14088 -                                        "failed: 0x%x\n", err);
14089 -                       }
14090 -               }
14091 -               /* remove symbols from symbol table */
14092 -               if (zlLib->symTab != NULL) {
14093 -                       GH_delete(zlLib->symTab);
14094 -                       zlLib->symTab = NULL;
14095 +       if (zlLib->mHandle) {
14096 +               err = Dynamic_Unload_Module(zlLib->mHandle,
14097 +                       &zlLib->symbol.dlSymbol,
14098 +                       &zlLib->allocate.dlAlloc, &zlLib->init.dlInit);
14099 +               if (err != 0) {
14100 +                       GT_1trace(DBLL_debugMask, GT_5CLASS,
14101 +                                "Dynamic_Unload_Module failed: 0x%x\n", err);
14102                 }
14103 -               /* delete DOFF desc since it holds *lots* of host OS
14104 -                * resources */
14105 -               dofClose(zlLib);
14106         }
14107 +       /* remove symbols from symbol table */
14108 +       if (zlLib->symTab != NULL) {
14109 +               GH_delete(zlLib->symTab);
14110 +               zlLib->symTab = NULL;
14111 +       }
14112 +       /* delete DOFF desc since it holds *lots* of host OS
14113 +        * resources */
14114 +       dofClose(zlLib);
14115  func_end:
14116         DBC_Ensure(zlLib->loadRef >= 0);
14117  }
14118 @@ -1024,7 +987,7 @@ static bool nameMatch(void *key, void *v
14119         DBC_Require(value != NULL);
14120  
14121         if ((key != NULL) && (value != NULL)) {
14122 -               if (strcmp((char *)key, ((struct Symbol *)value)->name) == 0)
14123 +               if (strcmp((char *)key, ((struct Symbol *)value)->name) == 0)
14124                         return true;
14125         }
14126         return false;
14127 @@ -1183,7 +1146,7 @@ static struct dynload_symbol *addToSymbo
14128         struct dynload_symbol *retVal;
14129  
14130         DBC_Require(this != NULL);
14131 -       DBC_Require(name);
14132 +       DBC_Require(name);
14133         lib = pSymbol->lib;
14134         DBC_Require(MEM_IsValidHandle(lib, DBLL_LIBSIGNATURE));
14135  
14136 @@ -1201,15 +1164,15 @@ static struct dynload_symbol *addToSymbo
14137                 }
14138         }
14139         /* Allocate string to copy symbol name */
14140 -       symbol.name = (char *)MEM_Calloc(strlen((char *const)name) + 1,
14141 +       symbol.name = (char *)MEM_Calloc(strlen((char *const)name) + 1,
14142                                                         MEM_PAGED);
14143         if (symbol.name == NULL)
14144                 return NULL;
14145  
14146         if (symbol.name != NULL) {
14147                 /* Just copy name (value will be filled in by dynamic loader) */
14148 -               strncpy(symbol.name, (char *const)name,
14149 -                          strlen((char *const)name) + 1);
14150 +               strncpy(symbol.name, (char *const)name,
14151 +                       strlen((char *const)name) + 1);
14152  
14153                 /* Add symbol to symbol table */
14154                 symPtr = (struct Symbol *)GH_insert(lib->symTab, (void *)name,
14155 @@ -1316,6 +1279,7 @@ static int rmmAlloc(struct Dynamic_Loade
14156         s32 req = -1;
14157         s32 count = 0;
14158         u32 allocSize = 0;
14159 +       u32 runAddrFlag = 0;
14160  
14161         DBC_Require(this != NULL);
14162         lib = pAlloc->lib;
14163 @@ -1326,8 +1290,8 @@ static int rmmAlloc(struct Dynamic_Loade
14164  
14165         /* Attempt to extract the segment ID and requirement information from
14166          the name of the section */
14167 -       DBC_Require(info->name);
14168 -       tokenLen = strlen((char *)(info->name)) + 1;
14169 +       DBC_Require(info->name);
14170 +       tokenLen = strlen((char *)(info->name)) + 1;
14171  
14172         szSectName = MEM_Calloc(tokenLen, MEM_PAGED);
14173         szLastToken = MEM_Calloc(tokenLen, MEM_PAGED);
14174 @@ -1338,11 +1302,11 @@ static int rmmAlloc(struct Dynamic_Loade
14175                 status = DSP_EMEMORY;
14176                 goto func_cont;
14177         }
14178 -       strncpy(szSectName, (char *)(info->name), tokenLen);
14179 +       strncpy(szSectName, (char *)(info->name), tokenLen);
14180         pszCur = szSectName;
14181         while ((pToken = strsep(&pszCur, ":")) && *pToken != '\0') {
14182 -               strncpy(szSecLastToken, szLastToken, strlen(szLastToken) + 1);
14183 -               strncpy(szLastToken, pToken, strlen(pToken) + 1);
14184 +               strncpy(szSecLastToken, szLastToken, strlen(szLastToken) + 1);
14185 +               strncpy(szLastToken, pToken, strlen(pToken) + 1);
14186                 pToken = strsep(&pszCur, ":");
14187                 count++;        /* optimizes processing*/
14188         }
14189 @@ -1351,19 +1315,18 @@ static int rmmAlloc(struct Dynamic_Loade
14190          within the section name - only process if there are at least three
14191          tokens within the section name (just a minor optimization)*/
14192         if (count >= 3)
14193 -               strict_strtol(szLastToken, 10, (long *)&req);
14194 +               strict_strtol(szLastToken, 10, (long *)&req);
14195  
14196         if ((req == 0) || (req == 1)) {
14197 -               if (strcmp(szSecLastToken, "DYN_DARAM") == 0) {
14198 +               if (strcmp(szSecLastToken, "DYN_DARAM") == 0) {
14199                         segId = 0;
14200                 } else {
14201 -                       if (strcmp(szSecLastToken, "DYN_SARAM") == 0) {
14202 +                       if (strcmp(szSecLastToken, "DYN_SARAM") == 0) {
14203                                 segId = 1;
14204                         } else {
14205 -                               if (strcmp(szSecLastToken,
14206 -                                  "DYN_EXTERNAL") == 0) {
14207 +                               if (strcmp(szSecLastToken,
14208 +                                  "DYN_EXTERNAL") == 0)
14209                                         segId = 2;
14210 -                               }
14211                         }
14212                 }
14213                 if (segId != -1) {
14214 @@ -1373,17 +1336,23 @@ static int rmmAlloc(struct Dynamic_Loade
14215                                  req, segId);
14216                 }
14217         }
14218 +func_cont:
14219         MEM_Free(szSectName);
14220         szSectName = NULL;
14221         MEM_Free(szLastToken);
14222         szLastToken = NULL;
14223         MEM_Free(szSecLastToken);
14224         szSecLastToken = NULL;
14225 -func_cont:
14226 +
14227         if (memType == DBLL_CODE)
14228                 allocSize = info->size + GEM_L1P_PREFETCH_SIZE;
14229         else
14230                 allocSize = info->size;
14231 +       GT_2trace(DBLL_debugMask, GT_5CLASS,
14232 +                        "Beg info->run_addr = 0x%x, info->load_addr= 0x%x\n",
14233 +                        info->run_addr, info->load_addr);
14234 +       if (info->load_addr != info->run_addr)
14235 +               runAddrFlag = 1;
14236         /* TODO - ideally, we can pass the alignment requirement also
14237          * from here */
14238         if (lib != NULL) {
14239 @@ -1396,12 +1365,16 @@ func_cont:
14240         } else {
14241                 /* RMM gives word address. Need to convert to byte address */
14242                 info->load_addr = rmmAddr.addr * DSPWORDSIZE;
14243 -               info->run_addr = info->load_addr;
14244 +               if (!runAddrFlag)
14245 +                       info->run_addr = info->load_addr;
14246                 info->context = (u32)rmmAddr.segid;
14247                 GT_3trace(DBLL_debugMask, GT_5CLASS,
14248                          "Remote alloc: %s  base = 0x%lx len"
14249                          "= 0x%lx\n", info->name, info->load_addr / DSPWORDSIZE,
14250                          info->size / DSPWORDSIZE);
14251 +               GT_2trace(DBLL_debugMask, GT_5CLASS,
14252 +                        "info->run_addr = 0x%x, info->load_addr= 0x%x\n",
14253 +                        info->run_addr, info->load_addr);
14254         }
14255         return retVal;
14256  }
14257 @@ -1410,7 +1383,7 @@ func_cont:
14258   *  ======== rmmDealloc ========
14259   */
14260  static void rmmDealloc(struct Dynamic_Loader_Allocate *this,
14261 -                      struct LDR_SECTION_INFO *info)
14262 +                       struct LDR_SECTION_INFO *info)
14263  {
14264         struct DBLLAlloc *pAlloc = (struct DBLLAlloc *)this;
14265         struct DBLL_LibraryObj *lib;
14266 @@ -1488,13 +1461,14 @@ static int writeMem(struct Dynamic_Loade
14267  
14268         DBC_Require(this != NULL);
14269         lib = pInit->lib;
14270 -       DBC_Require(MEM_IsValidHandle(lib, DBLL_LIBSIGNATURE));
14271 +       if (!MEM_IsValidHandle(lib, DBLL_LIBSIGNATURE))
14272 +               return false;
14273 +
14274 +       pTarget = lib->pTarget;
14275  
14276         memType = (DLOAD_SECTION_TYPE(info->type) == DLOAD_TEXT) ? DBLL_CODE :
14277                   DBLL_DATA;
14278 -       if ((lib != NULL) &&
14279 -           ((pTarget = lib->pTarget) != NULL) &&
14280 -           (pTarget->attrs.write != NULL)) {
14281 +       if (pTarget && pTarget->attrs.write) {
14282                 retVal = (*pTarget->attrs.write)(pTarget->attrs.wHandle,
14283                                                  addr, buf, nBytes, memType);
14284  
14285 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/dev.c kernel-power-2.6.28/drivers/dsp/bridge/pmgr/dev.c
14286 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/dev.c      2011-04-17 17:32:26.000000000 +0100
14287 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/dev.c   2011-05-02 22:36:49.000000000 +0100
14288 @@ -3,6 +3,8 @@
14289   *
14290   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14291   *
14292 + * Implementation of Bridge Mini-driver device operations.
14293 + *
14294   * Copyright (C) 2005-2006 Texas Instruments, Inc.
14295   *
14296   * This package is free software; you can redistribute it and/or modify
14297 @@ -14,104 +16,6 @@
14298   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14299   */
14300  
14301 -
14302 -/*
14303 - *  ======== dev.c ========
14304 - *  Description:
14305 - *      Implementation of 'Bridge Mini-driver device operations.
14306 - *
14307 - *  Public Functions:
14308 - *      DEV_BrdWriteFxn
14309 - *      DEV_CreateDevice
14310 - *      DEV_Create2
14311 - *      DEV_Destroy2
14312 - *      DEV_DestroyDevice
14313 - *      DEV_GetChnlMgr
14314 - *      DEV_GetCmmMgr
14315 - *      DEV_GetCodMgr
14316 - *      DEV_GetDehMgr
14317 - *      DEV_GetDevNode
14318 - *      DEV_GetDSPWordSize
14319 - *      DEV_GetFirst
14320 - *      DEV_GetIntfFxns
14321 - *      DEV_GetIOMgr
14322 - *      DEV_GetNext
14323 - *      DEV_GetNodeManager
14324 - *      DEV_GetSymbol
14325 - *      DEV_GetWMDContext
14326 - *      DEV_Exit
14327 - *      DEV_Init
14328 - *      DEV_InsertProcObject
14329 - *      DEV_IsLocked
14330 - *      DEV_NotifyClient
14331 - *      DEV_RegisterNotify
14332 - *      DEV_ReleaseCodMgr
14333 - *      DEV_RemoveDevice
14334 - *      DEV_RemoveProcObject
14335 - *      DEV_SetChnlMgr
14336 - *      DEV_SetMsgMgr
14337 - *      DEV_SetLockOwner
14338 - *      DEV_StartDevice
14339 - *
14340 - *  Private Functions:
14341 - *      FxnNotImplemented
14342 - *      InitCodMgr
14343 - *      InsertDevObject
14344 - *      IsValidHandle
14345 - *      RemoveDevObject
14346 - *      StoreInterfaceFxns
14347 - *
14348 - *! Revision History:
14349 - *! ================
14350 - *! 03-Jan-2005 hn  Support for IVA DEH
14351 - *! 08-Mar-2004 sb  Added the Dynamic Memory Mapping feature
14352 - *! 09-Feb-2004 vp     Updated to support IVA.
14353 - *! 24-Feb-2003 swa PMGR Code review comments incorporated.
14354 - *! 29-Nov-2001 jeh Check for DSP_ENOTIMPL status of DEH create function.
14355 - *! 05-Nov-2001 kc  Added support for DEH module.
14356 - *! 05-Aug-2001 ag  Shared memory registration moved to WMD_IO_OnLoaded().
14357 - *! 11-Jul-2001 jeh Moved MGR_Create() from DSP_Init() to DEV_StartDevice().
14358 - *! 11-Apr-2001 rr: Removed CMM_RegisterGPPSMSeg.
14359 - *! 02-Apr-2001 rr: CHNL_Create failure is printed out.
14360 - *! 15-Jan-2001 jeh Removed call to IO_OnLoaded() from DEV_Create2().
14361 - *! 13-Feb-2001 kc: DSP/BIOS Bridge name update.
14362 - *! 15-Dec-2000 rr: Dev_Create2 returns error if NODE_CreateMgr fails.
14363 - *! 05-Dec-2000 jeh Moved IO_OnLoaded() to PROC_Load. Added DEV_SetMsgMgr.
14364 - *! 05-Dev-2000 ag  SM Heap for messaging registered via CMM_RegisterGPPSMSeg().
14365 - *!                 SM heap base and size currently taken from registry.
14366 - *! 29-Nov-2000 rr: Incorporated code review changes.
14367 - *! 17-Nov-2000 jeh Added calls to get IO manager (IO_Create), IO_OnLoaded().
14368 - *! 06-Oct-2000 rr: DEV_Destroy2 and DEV_Create2 added.
14369 - *! 02-Oct-2000 rr: DEV_GetNodeManager added.
14370 - *! 11-Aug-2000 ag: Added DEV_GetCmmMgr(), CMM_Init() & CMM_Exit().
14371 - *!                 Removed <dspbridge/std.h> & <stdwin.h>, added <dspbridge/dbtype.h>
14372 - *! 10-Aug-2000 rr: DEV_InsertProcObject/RemoveProcObject added.
14373 - *!                 DEV_Cleanup calls PROC_Detach if it is a matching process.
14374 - *! 27-Jul-2000 rr: DEV is in new directoy DEV and produces devlib.lib
14375 - *! 17-Jul-2000 rr: DRV Object holds the list of Dev Objects. DEV gets
14376 - *!                 the List and Next devices through DRV.
14377 - *!                 DEV object has a back pointer to DRV Object.
14378 - *! 06-Jun-2000 jeh Added DEV_GetSymbol().
14379 - *! 09-May-2000 rr: dwMemBase has index for multiple windows need.
14380 - *! 28-Feb-2000 rr: New GT Usage implemented.
14381 - *! 03-Feb-2000 rr: GT and Module init/exit Changes.(Done up front from
14382 - *!                SERVICES)
14383 - *! 31-Jan-2000 rr: Comments changed after code review.
14384 - *! 21-Jan-2000 rr: windows.h, tchar.h, HMODULE removed. FreeLibrary replaced
14385 - *!                 with LDR_FreeModule
14386 - *! 17-Jan-2000 rr: CFG_Get/SetPrivateDword renamed to CFG_Get/SetDevObject.
14387 - *!                 StoreInterfaceFxns stores the new fxn WMD_BRD_SETSTATE.
14388 - *! 20-Nov-1999 ag: Actual uSMLength =  total - monitor offset.
14389 - *! 12-Nov-1999 rr: bIRQ and IRQAttrib taken from the struct CFG_HOSTRES.
14390 - *!                dMemBase is added with offset for monitor taken from
14391 - *!                registry.
14392 - *! 31-Oct-1999 ag: Added CHNL support.
14393 - *! 10-Sep-1999 rr: GT Enabled. DEV_Create will Load the Mini Driver and will
14394 - *!                 find its fxn table. Right now lot of things are hardcoded
14395 - *!                 as the REG is not ready.
14396 - *! 10-Jun-1996 rr: Created from WSX
14397 - */
14398 -
14399  /*  ----------------------------------- Host OS */
14400  #include <dspbridge/host_os.h>
14401  
14402 @@ -130,7 +34,6 @@
14403  #include <dspbridge/ldr.h>
14404  #include <dspbridge/list.h>
14405  #include <dspbridge/mem.h>
14406 -#include <dspbridge/util.h>
14407  
14408  /*  ----------------------------------- Platform Manager */
14409  #include <dspbridge/cod.h>
14410 @@ -143,7 +46,6 @@
14411  #include <dspbridge/node.h>
14412  
14413  /*  ----------------------------------- Others */
14414 -#include <dspbridge/dbreg.h>
14415  #include <dspbridge/wcd.h>             /* WCD version info. */
14416  
14417  #include <dspbridge/chnl.h>
14418 @@ -163,7 +65,7 @@
14419  /* The WMD device object: */
14420  struct DEV_OBJECT {
14421         /* LST requires "link" to be first field!                        */
14422 -       struct LST_ELEM link;           /* Link to next DEV_OBJECT.      */
14423 +       struct list_head link;          /* Link to next DEV_OBJECT.      */
14424         u32 devType;            /* Device Type */
14425         u32 dwSignature;        /* Used for object validation.   */
14426         struct CFG_DEVNODE *hDevNode;   /* Platform specific device id   */
14427 @@ -375,11 +277,14 @@ DSP_STATUS DEV_CreateDevice(OUT struct D
14428         }
14429         /* Create the Processor List */
14430         if (DSP_SUCCEEDED(status)) {
14431 -               pDevObject->procList = LST_Create();
14432 +               pDevObject->procList = MEM_Calloc(sizeof(struct LST_LIST),
14433 +                       MEM_NONPAGED);
14434                 if (!(pDevObject->procList)) {
14435                         status = DSP_EFAIL;
14436                         GT_0trace(debugMask, GT_7CLASS, "DEV_Create: "
14437                                  "Failed to Create Proc List");
14438 +               } else {
14439 +                       INIT_LIST_HEAD(&pDevObject->procList->head);
14440                 }
14441         }
14442          /*  If all went well, return a handle to the dev object;
14443 @@ -391,7 +296,7 @@ DSP_STATUS DEV_CreateDevice(OUT struct D
14444                          "0x%x\n", pDevObject);
14445         } else {
14446                 if (pDevObject && pDevObject->procList)
14447 -                       LST_Delete(pDevObject->procList);
14448 +                       MEM_Free(pDevObject->procList);
14449  
14450                 if (pDevObject && pDevObject->hCodMgr)
14451                         COD_Delete(pDevObject->hCodMgr);
14452 @@ -497,11 +402,15 @@ DSP_STATUS DEV_DestroyDevice(struct DEV_
14453         GT_1trace(debugMask, GT_ENTER, "Entered DEV_DestroyDevice, hDevObject: "
14454                  "0x%x\n", hDevObject);
14455         if (IsValidHandle(hDevObject)) {
14456 -               if (pDevObject->hCodMgr)
14457 +               if (pDevObject->hCodMgr) {
14458                         COD_Delete(pDevObject->hCodMgr);
14459 +                       pDevObject->hCodMgr = NULL;
14460 +               }
14461  
14462 -               if (pDevObject->hNodeMgr)
14463 +               if (pDevObject->hNodeMgr) {
14464                         NODE_DeleteMgr(pDevObject->hNodeMgr);
14465 +                       pDevObject->hNodeMgr = NULL;
14466 +               }
14467  
14468                 /* Free the io, channel, and message managers for this board: */
14469                 if (pDevObject->hIOMgr) {
14470 @@ -512,28 +421,40 @@ DSP_STATUS DEV_DestroyDevice(struct DEV_
14471                         CHNL_Destroy(pDevObject->hChnlMgr);
14472                         pDevObject->hChnlMgr = NULL;
14473                 }
14474 -               if (pDevObject->hMsgMgr)
14475 +               if (pDevObject->hMsgMgr) {
14476                         MSG_Delete(pDevObject->hMsgMgr);
14477 +                       pDevObject->hMsgMgr = NULL;
14478 +               }
14479  
14480                 if (pDevObject->hDehMgr) {
14481                         /* Uninitialize DEH module. */
14482                         (*pDevObject->intfFxns.pfnDehDestroy)
14483                         (pDevObject->hDehMgr);
14484 +                       pDevObject->hDehMgr = NULL;
14485                 }
14486 -               if (pDevObject->hCmmMgr)
14487 +               if (pDevObject->hCmmMgr) {
14488                         CMM_Destroy(pDevObject->hCmmMgr, true);
14489 +                       pDevObject->hCmmMgr = NULL;
14490 +               }
14491  
14492 -               if (pDevObject->hDmmMgr)
14493 +               if (pDevObject->hDmmMgr) {
14494                         DMM_Destroy(pDevObject->hDmmMgr);
14495 +                       pDevObject->hDmmMgr = NULL;
14496 +               }
14497  
14498                 /* Call the driver's WMD_DEV_Destroy() function: */
14499                 /* Require of DevDestroy */
14500 -               DBC_Assert(pDevObject->hWmdContext != NULL);
14501 -               status = (*pDevObject->intfFxns.pfnDevDestroy)
14502 -                        (pDevObject->hWmdContext);
14503 +               if (pDevObject->hWmdContext) {
14504 +                       status = (*pDevObject->intfFxns.pfnDevDestroy)
14505 +                               (pDevObject->hWmdContext);
14506 +                       pDevObject->hWmdContext = NULL;
14507 +               } else
14508 +                       status = DSP_EFAIL;
14509                 if (DSP_SUCCEEDED(status)) {
14510 -                       if (pDevObject->procList)
14511 -                               LST_Delete(pDevObject->procList);
14512 +                       if (pDevObject->procList) {
14513 +                               MEM_Free(pDevObject->procList);
14514 +                               pDevObject->procList = NULL;
14515 +                       }
14516  
14517                         /* Remove this DEV_Object from the global list: */
14518                         DRV_RemoveDevObject(pDevObject->hDrvObject, pDevObject);
14519 @@ -541,6 +462,7 @@ DSP_STATUS DEV_DestroyDevice(struct DEV_
14520                          * (pDevObject->hModule);*/
14521                         /* Free this dev object: */
14522                         MEM_FreeObject(pDevObject);
14523 +                       pDevObject = NULL;
14524                 }
14525         } else {
14526                 GT_0trace(debugMask, GT_7CLASS, "DEV_Destroy: Invlaid handle");
14527 @@ -1021,15 +943,15 @@ DSP_STATUS DEV_NotifyClients(struct DEV_
14528         DSP_STATUS status = DSP_SOK;
14529  
14530         struct DEV_OBJECT *pDevObject = hDevObject;
14531 -       DSP_HPROCESSOR hProcObject;
14532 +       void *hProcObject;
14533  
14534         GT_2trace(debugMask, GT_ENTER,
14535                  "Entered DEV_NotifyClients, hDevObject: 0x%x\n"
14536                  "\t\tulStatus: 0x%x\n", hDevObject, ulStatus);
14537 -       for (hProcObject = (DSP_HPROCESSOR)LST_First(pDevObject->procList);
14538 +       for (hProcObject = (void *)LST_First(pDevObject->procList);
14539                 hProcObject != NULL;
14540 -               hProcObject = (DSP_HPROCESSOR)LST_Next(pDevObject->procList,
14541 -                                               (struct LST_ELEM *)hProcObject))
14542 +               hProcObject = (void *)LST_Next(pDevObject->procList,
14543 +                                       (struct list_head *)hProcObject))
14544                 PROC_NotifyClients(hProcObject, (u32) ulStatus);
14545  
14546         return status;
14547 @@ -1286,7 +1208,7 @@ DSP_STATUS DEV_InsertProcObject(struct D
14548                 *pbAlreadyAttached = true;
14549  
14550         /* Add DevObject to tail. */
14551 -       LST_PutTail(pDevObject->procList, (struct LST_ELEM *)hProcObject);
14552 +       LST_PutTail(pDevObject->procList, (struct list_head *)hProcObject);
14553  
14554         GT_1trace(debugMask, GT_ENTER,
14555                  "Exiting DEV_InsetProcObject status 0x%x\n", status);
14556 @@ -1317,7 +1239,7 @@ DSP_STATUS DEV_RemoveProcObject(struct D
14557                                      u32 hProcObject)
14558  {
14559         DSP_STATUS status = DSP_EFAIL;
14560 -       struct LST_ELEM *pCurElem;
14561 +       struct list_head *pCurElem;
14562         struct DEV_OBJECT *pDevObject = (struct DEV_OBJECT *)hDevObject;
14563  
14564         DBC_Require(IsValidHandle(pDevObject));
14565 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/dmm.c kernel-power-2.6.28/drivers/dsp/bridge/pmgr/dmm.c
14566 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/dmm.c      2011-04-17 17:32:26.000000000 +0100
14567 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/dmm.c   2011-05-02 22:36:49.000000000 +0100
14568 @@ -3,6 +3,13 @@
14569   *
14570   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14571   *
14572 + * The Dynamic Memory Manager (DMM) module manages the DSP Virtual address
14573 + * space that can be directly mapped to any MPU buffer or memory region
14574 + *
14575 + * Notes:
14576 + *   Region: Generic memory entitiy having a start address and a size
14577 + *   Chunk:  Reserved region
14578 + *
14579   * Copyright (C) 2005-2006 Texas Instruments, Inc.
14580   *
14581   * This package is free software; you can redistribute it and/or modify
14582 @@ -14,46 +21,6 @@
14583   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14584   */
14585  
14586 -/*
14587 - *  ======== dmm.c ========
14588 - *  Purpose:
14589 - *      The Dynamic Memory Manager (DMM) module manages the DSP Virtual address
14590 - *      space that can be directly mapped to any MPU buffer or memory region
14591 - *
14592 - *  Public Functions:
14593 - *      DMM_CreateTables
14594 - *      DMM_Create
14595 - *      DMM_Destroy
14596 - *      DMM_Exit
14597 - *      DMM_Init
14598 - *      DMM_MapMemory
14599 - *      DMM_Reset
14600 - *      DMM_ReserveMemory
14601 - *      DMM_UnMapMemory
14602 - *      DMM_UnReserveMemory
14603 - *
14604 - *  Private Functions:
14605 - *      AddRegion
14606 - *      CreateRegion
14607 - *      GetRegion
14608 - *     GetFreeRegion
14609 - *     GetMappedRegion
14610 - *
14611 - *  Notes:
14612 - *      Region: Generic memory entitiy having a start address and a size
14613 - *      Chunk:  Reserved region
14614 - *
14615 - *
14616 - *! Revision History:
14617 - *! ================
14618 - *! 04-Jun-2008 Hari K : Optimized DMM implementation. Removed linked list
14619 - *!                                and instead used Table approach.
14620 - *! 19-Apr-2004 sb: Integrated Alan's code review updates.
14621 - *! 17-Mar-2004 ap: Fixed GetRegion for size=0 using tighter bound.
14622 - *! 20-Feb-2004 sb: Created.
14623 - *!
14624 - */
14625 -
14626  /*  ----------------------------------- Host OS */
14627  #include <dspbridge/host_os.h>
14628  
14629 @@ -67,7 +34,6 @@
14630  #include <dspbridge/gt.h>
14631  
14632  /*  ----------------------------------- OS Adaptation Layer */
14633 -#include <dspbridge/list.h>
14634  #include <dspbridge/mem.h>
14635  #include <dspbridge/sync.h>
14636  
14637 @@ -290,7 +256,7 @@ void DMM_Exit(void)
14638   *      Return the dynamic memory manager object for this device.
14639   *      This is typically called from the client process.
14640   */
14641 -DSP_STATUS DMM_GetHandle(DSP_HPROCESSOR hProcessor,
14642 +DSP_STATUS DMM_GetHandle(void *hProcessor,
14643                         OUT struct DMM_OBJECT **phDmmMgr)
14644  {
14645         DSP_STATUS status = DSP_SOK;
14646 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/io.c kernel-power-2.6.28/drivers/dsp/bridge/pmgr/io.c
14647 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/io.c       2011-04-17 17:32:26.000000000 +0100
14648 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/io.c    2011-05-02 22:36:49.000000000 +0100
14649 @@ -3,6 +3,8 @@
14650   *
14651   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14652   *
14653 + * IO manager interface: Manages IO between CHNL and MSG.
14654 + *
14655   * Copyright (C) 2005-2006 Texas Instruments, Inc.
14656   *
14657   * This package is free software; you can redistribute it and/or modify
14658 @@ -14,29 +16,6 @@
14659   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14660   */
14661  
14662 -
14663 -/*
14664 - *  ======== io.c ========
14665 - *  Description:
14666 - *      IO manager interface: Manages IO between CHNL and MSG.
14667 - *
14668 - *  Public Functions:
14669 - *      IO_Create
14670 - *      IO_Destroy
14671 - *      IO_Exit
14672 - *      IO_Init
14673 - *      IO_OnLoaded
14674 - *
14675 - *  Notes:
14676 - *      This interface is basically a pass through to the WMD IO functions.
14677 - *
14678 - *! Revision History:
14679 - *! ================
14680 - *! 24-Feb-2003 swa    PMGR Code review comments incorporated.
14681 - *! 04-Apr-2001 rr      WSX_STATUS initialized in IO_Create.
14682 - *! 07-Nov-2000 jeh     Created.
14683 - */
14684 -
14685  /*  ----------------------------------- Host OS */
14686  #include <dspbridge/host_os.h>
14687  
14688 @@ -106,11 +85,13 @@ DSP_STATUS IO_Create(OUT struct IO_MGR *
14689         }
14690  
14691         if (DSP_SUCCEEDED(status)) {
14692 -               DEV_GetIntfFxns(hDevObject, &pIntfFxns);
14693 +               status = DEV_GetIntfFxns(hDevObject, &pIntfFxns);
14694  
14695 -               /* Let WMD channel module finish the create: */
14696 -               status = (*pIntfFxns->pfnIOCreate)(&hIOMgr, hDevObject,
14697 -                        pMgrAttrs);
14698 +               if (pIntfFxns) {
14699 +                       /* Let WMD channel module finish the create */
14700 +                       status = (*pIntfFxns->pfnIOCreate)(&hIOMgr, hDevObject,
14701 +                                       pMgrAttrs);
14702 +               }
14703  
14704                 if (DSP_SUCCEEDED(status)) {
14705                         pIOMgr = (struct IO_MGR_ *) hIOMgr;
14706 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/ioobj.h kernel-power-2.6.28/drivers/dsp/bridge/pmgr/ioobj.h
14707 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/ioobj.h    2011-04-17 17:32:26.000000000 +0100
14708 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/ioobj.h 2011-05-02 22:36:49.000000000 +0100
14709 @@ -3,6 +3,9 @@
14710   *
14711   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14712   *
14713 + * Structure subcomponents of channel class library IO objects which
14714 + * are exposed to class driver from mini-driver.
14715 + *
14716   * Copyright (C) 2005-2006 Texas Instruments, Inc.
14717   *
14718   * This package is free software; you can redistribute it and/or modify
14719 @@ -14,22 +17,6 @@
14720   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14721   */
14722  
14723 -
14724 -/*
14725 - *  ======== ioobj.h ========
14726 - *  Description:
14727 - *      Structure subcomponents of channel class library IO objects which
14728 - *      are exposed to class driver from mini-driver.
14729 - *
14730 - *  Public Functions:
14731 - *      None.
14732 - *
14733 - *! Revision History:
14734 - *! ================
14735 - *! 24-Feb-2003 swa PMGR Code review comments incorporated.
14736 - *! 01/16/97 gp: Created from chnlpriv.h
14737 - */
14738 -
14739  #ifndef IOOBJ_
14740  #define IOOBJ_
14741  
14742 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/msg.c kernel-power-2.6.28/drivers/dsp/bridge/pmgr/msg.c
14743 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/msg.c      2011-04-17 17:32:26.000000000 +0100
14744 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/msg.c   2011-05-02 22:36:49.000000000 +0100
14745 @@ -3,6 +3,8 @@
14746   *
14747   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14748   *
14749 + * DSP/BIOS Bridge MSG Module.
14750 + *
14751   * Copyright (C) 2005-2006 Texas Instruments, Inc.
14752   *
14753   * This package is free software; you can redistribute it and/or modify
14754 @@ -14,27 +16,6 @@
14755   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14756   */
14757  
14758 -
14759 -/*
14760 - *  ======== msg.c ========
14761 - *  Description:
14762 - *      DSP/BIOS Bridge MSG Module.
14763 - *
14764 - *  Public Functions:
14765 - *      MSG_Create
14766 - *      MSG_Delete
14767 - *      MSG_Exit
14768 - *      MSG_Init
14769 - *
14770 - *! Revision History:
14771 - *! =================
14772 - *! 24-Feb-2003 swa    PMGR Code review comments incorporated.
14773 - *! 15-May-2001 ag      Changed SUCCEEDED to DSP_SUCCEEDED.
14774 - *! 16-Feb-2001 jeh     Fixed some comments.
14775 - *! 15-Dec-2000 rr      MSG_Create returns DSP_EFAIL if pfnMsgCreate fails.
14776 - *! 12-Sep-2000 jeh     Created.
14777 - */
14778 -
14779  /*  ----------------------------------- Host OS */
14780  #include <dspbridge/host_os.h>
14781  
14782 @@ -48,7 +29,6 @@
14783  #include <dspbridge/gt.h>
14784  
14785  /*  ----------------------------------- OS Adaptation Layer */
14786 -#include <dspbridge/list.h>
14787  #include <dspbridge/mem.h>
14788  
14789  /*  ----------------------------------- Mini Driver */
14790 @@ -92,10 +72,13 @@ DSP_STATUS MSG_Create(OUT struct MSG_MGR
14791  
14792         *phMsgMgr = NULL;
14793  
14794 -       DEV_GetIntfFxns(hDevObject, &pIntfFxns);
14795 +       status = DEV_GetIntfFxns(hDevObject, &pIntfFxns);
14796  
14797 -       /* Let WMD message module finish the create: */
14798 -       status = (*pIntfFxns->pfnMsgCreate)(&hMsgMgr, hDevObject, msgCallback);
14799 +       if (pIntfFxns) {
14800 +               /* Let WMD message module finish the create */
14801 +               status = (*pIntfFxns->pfnMsgCreate)(&hMsgMgr,
14802 +                               hDevObject, msgCallback);
14803 +       }
14804  
14805         if (DSP_SUCCEEDED(status)) {
14806                 /* Fill in WCD message module's fields of the MSG_MGR
14807 @@ -134,7 +117,9 @@ void MSG_Delete(struct MSG_MGR *hMsgMgr)
14808         /* Let WMD message module destroy the MSG_MGR: */
14809         (*pIntfFxns->pfnMsgDelete)(hMsgMgr);
14810  
14811 -       DBC_Ensure(!MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE));
14812 +       if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE))
14813 +               GT_1trace(MSG_debugMask, GT_7CLASS, "MSG_Delete: Error hMsgMgr "
14814 +                                       "Valid Handle: 0x%x\n", hMsgMgr);
14815  }
14816  
14817  /*
14818 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/msgobj.h kernel-power-2.6.28/drivers/dsp/bridge/pmgr/msgobj.h
14819 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/msgobj.h   2011-04-17 17:32:26.000000000 +0100
14820 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/msgobj.h        2011-05-02 22:36:49.000000000 +0100
14821 @@ -3,6 +3,9 @@
14822   *
14823   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14824   *
14825 + * Structure subcomponents of channel class library MSG objects which
14826 + * are exposed to class driver from mini-driver.
14827 + *
14828   * Copyright (C) 2005-2006 Texas Instruments, Inc.
14829   *
14830   * This package is free software; you can redistribute it and/or modify
14831 @@ -14,22 +17,6 @@
14832   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14833   */
14834  
14835 -
14836 -/*
14837 - *  ======== msgobj.h ========
14838 - *  Description:
14839 - *      Structure subcomponents of channel class library MSG objects which
14840 - *      are exposed to class driver from mini-driver.
14841 - *
14842 - *  Public Functions:
14843 - *      None.
14844 - *
14845 - *! Revision History:
14846 - *! ================
14847 - *! 24-Feb-2003 swa    PMGR Code review comments incorporated.
14848 - *! 17-Nov-2000 jeh     Created.
14849 - */
14850 -
14851  #ifndef MSGOBJ_
14852  #define MSGOBJ_
14853  
14854 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/wcd.c kernel-power-2.6.28/drivers/dsp/bridge/pmgr/wcd.c
14855 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/pmgr/wcd.c      2011-04-17 17:32:26.000000000 +0100
14856 +++ kernel-power-2.6.28/drivers/dsp/bridge/pmgr/wcd.c   2011-05-06 14:38:05.000000000 +0100
14857 @@ -3,6 +3,9 @@
14858   *
14859   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14860   *
14861 + * Common WCD functions, also includes the wrapper
14862 + * functions called directly by the DeviceIOControl interface.
14863 + *
14864   * Copyright (C) 2005-2006 Texas Instruments, Inc.
14865   *
14866   * This package is free software; you can redistribute it and/or modify
14867 @@ -14,83 +17,6 @@
14868   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14869   */
14870  
14871 -/*
14872 - *  ======== wcd.c ========
14873 - *  Description:
14874 - *      Common WCD functions, also includes the wrapper
14875 - *      functions called directly by the DeviceIOControl interface.
14876 - *
14877 - *  Public Functions:
14878 - *      WCD_CallDevIOCtl
14879 - *      WCD_Init
14880 - *      WCD_InitComplete2
14881 - *      WCD_Exit
14882 - *      <MOD>WRAP_*
14883 - *
14884 - *! Revision History:
14885 - *! ================
14886 - *! 29-Apr-2004 hp  Call PROC_AutoStart only for DSP device
14887 - *! 19-Apr-2004 sb  Aligned DMM definitions with Symbian
14888 - *! 08-Mar-2004 sb  Added the Dynamic Memory Mapping APIs
14889 - *! 03-Apr-2003 sb  Process environment pointer in PROCWRAP_Load
14890 - *! 24-Feb-2003 swa PMGR Code review comments incorporated.
14891 - *! 30-Jan-2002 ag  CMMWRAP_AllocBuf name changed to CMMWRAP_CallocBuf
14892 - *! 15-Jan-2002 ag  Added actual bufSize param to STRMWRAP_Reclaim[issue].
14893 - *! 14-Dec-2001 rr  ARGS_NODE_CONNECT maps the pAttr.
14894 - *! 03-Oct-2001 rr  ARGS_NODE_ALLOCMSGBUF/FREEMSGBUF maps the pAttr.
14895 - *! 10-Sep-2001 ag  Added CMD_CMM_GETHANDLE.
14896 - *! 23-Apr-2001 jeh Pass pStatus to NODE_Terminate.
14897 - *! 11-Apr-2001 jeh STRMWRAP_Reclaim embedded pointer is mapped and unmapped.
14898 - *! 13-Feb-2001 kc: DSP/BIOS Bridge name updates.
14899 - *! 06-Dec-2000 jeh WRAP_MAP2CALLER pointers in RegisterNotify calls.
14900 - *! 05-Dec-2000 ag: Removed MAP2CALLER in NODEWRAP_FreeMsgBuf().
14901 - *! 22-Nov-2000 kc: Added MGRWRAP_GetPerf_Data().
14902 - *! 20-Nov-2000 jeh Added MSG_Init()/MSG_Exit(), IO_Init()/IO_Exit().
14903 - *!             WRAP pointers to handles for PROC_Attach, NODE_Allocate.
14904 - *! 27-Oct-2000 jeh Added NODEWRAP_AllocMsgBuf, NODEWRAP_FreeMsgBuf. Removed
14905 - *!             NODEWRAP_GetMessageStream.
14906 - *! 12-Oct-2000 ag: Added user CMM wrappers.
14907 - *! 05-Oct-2000 rr: WcdInitComplete2 will fail even if one BRD or PROC
14908 - *!             AutoStart fails.
14909 - *! 25-Sep-2000 rr: Updated to Version 0.9
14910 - *! 13-Sep-2000 jeh Pass ARGS_NODE_CONNECT.pAttrs to NODE_Connect().
14911 - *! 11-Aug-2000 rr: Part of node enabled.
14912 - *! 31-Jul-2000 rr: UTIL_Wrap and MEM_Wrap added to RM.
14913 - *! 27-Jul-2000 rr: PROCWRAP, NODEWRAP and STRMWRAP implemented.
14914 - *!             STRM and some NODE Wrappers are not implemented.
14915 - *! 27-Jun-2000 rr: MGRWRAP fxns added.IFDEF to build for PM or DSP/BIOS Bridge
14916 - *! 08-Feb-2000 rr  File name changed to wcd.c
14917 - *! 03-Feb-2000 rr: Module initialization are done by SERVICES init. GT Class
14918 - *!             changes for module init/exit fxns.
14919 - *! 24-Jan-2000 rr: Merged with Scott's code.
14920 - *! 21-Jan-1999 sg: Changed ARGS_CHNL_GETMODE field name from pdwMode to pMode.
14921 - *! 17-Jan-2000 rr: BRD_GetStatus does WRAP_MAP2CALLER for state.
14922 - *! 14-Dec-1999 ag: Removed _MAP2CALLER in CHNL_GetMgr().
14923 - *! 13-Dec-1999 rr: BRDWRAP_GetSymbol, BRDWRAP_GetTrace uses WRAP_MAP2CALLER
14924 - *!             macros.BRDWRAP_Load maps and unmaps embedded pointers.
14925 - *! 10-Dec-1999 ag: User CHNL bufs mapped in _AddIOReq & _GetIOCompletion.
14926 - *! 09-Dec-1999 rr: BRDWRAP_Open and CHNLWRAP_GetMgr does not map
14927 - *!             pointer as there was a change in config.c
14928 - *! 06-Dec-1999 rr: BRD_Read and Write Maps the buf pointers.
14929 - *! 03-Dec-1999 rr: CHNLWRAP_GetMgr and BRDWRAP_Open maps  hDevNode pointer.
14930 - *!             WCD_InitComplete2 Included for BRD_AutoStart.
14931 - *! 16-Nov-1999 ag: Map buf to process in CHNLWRAP_AllocBuffer().
14932 - *!             CHNL_GetMgr() Mapping Fix.
14933 - *! 10-Nov-1999 ag: Removed unnecessary calls to WRAP_MAP2CALLER.
14934 - *! 08-Nov-1999 kc: Added MEMRY & enabled BRD_IOCtl for tests.
14935 - *! 29-Oct-1999 ag: Added CHNL.
14936 - *! 29-Oct-1999 kc: Added trace statements; added ptr mapping; updated
14937 - *!             use of UTIL module API.
14938 - *! 29-Oct-1999 rr: Wrapper functions does the Mapping of the Pointers.
14939 - *!             in WinCE all the explicit pointers will be converted
14940 - *!             by the OS during interprocess but not the embedded pointers.
14941 - *! 16-Oct-1999 kc: Code review cleanup.
14942 - *! 07-Oct-1999 kc: Added UTILWRAP_TestDll() to run PM test harness. See
14943 - *!             /src/doc/pmtest.doc for more detail.
14944 - *! 09-Sep-1999 rr: After exactly two years(!). Adopted for WinCE. GT Enabled.
14945 - *! 09-Sep-1997 gp: Created.
14946 - */
14947 -
14948  /*  ----------------------------------- Host OS */
14949  #include <dspbridge/host_os.h>
14950  
14951 @@ -108,7 +34,6 @@
14952  #include <dspbridge/mem.h>
14953  #include <dspbridge/ntfy.h>
14954  #include <dspbridge/services.h>
14955 -#include <dspbridge/util.h>
14956  
14957  /*  ----------------------------------- Platform Manager */
14958  #include <dspbridge/chnl.h>
14959 @@ -134,9 +59,7 @@
14960  #include <dspbridge/_dcd.h>
14961  #include <dspbridge/dbdcd.h>
14962  
14963 -#ifndef RES_CLEANUP_DISABLE
14964  #include <dspbridge/resourcecleanup.h>
14965 -#endif
14966  
14967  /*  ----------------------------------- Defines, Data Structures, Typedefs */
14968  #define MAX_TRACEBUFLEN 255
14969 @@ -145,6 +68,30 @@
14970  #define MAX_STREAMS     16
14971  #define MAX_BUFS       64
14972  
14973 +#ifdef CONFIG_BRIDGE_NEW_API
14974 +
14975 +/* Used to get dspbridge ioctl table */
14976 +#define DB_GET_IOC_TABLE(cmd)  (DB_GET_MODULE(cmd) >> DB_MODULE_SHIFT)
14977 +
14978 +#else /* CONFIG_BRIDGE_NEW_API */
14979 +/* Used to get dspbridge ioctl table */
14980 +static int DB_GET_IOC_TABLE(int cmd)
14981 +{
14982 +    if(cmd<DB_PROC)
14983 +       return 0;
14984 +    else if(cmd<DB_NODE)
14985 +       return 1;
14986 +    else if(cmd<DB_STRM)
14987 +       return 2;
14988 +    else if(cmd<DB_CMM)
14989 +       return 3;
14990 +    else
14991 +       return 4;
14992 +}
14993 +#undef _IOC_TYPE
14994 +#define _IOC_TYPE(cmd) DB
14995 +
14996 +#endif
14997  /* Device IOCtl function pointer */
14998  struct WCD_Cmd {
14999         u32(*fxn)(union Trapped_Args *args, void *pr_ctxt);
15000 @@ -157,6 +104,95 @@ static struct GT_Mask WCD_debugMask = { 
15001  #endif
15002  static u32 WCD_cRefs;
15003  
15004 +/*
15005 + *  Function tables.
15006 + *  The order of these functions MUST be the same as the order of the command
15007 + *  numbers defined in wcdioctl.h  This is how an IOCTL number in user mode
15008 + *  turns into a function call in kernel mode.
15009 + */
15010 +
15011 +/* MGR wrapper functions */
15012 +static struct WCD_Cmd mgr_cmd[] = {
15013 +       {MGRWRAP_EnumNode_Info},                /* MGR_ENUMNODE_INFO */
15014 +       {MGRWRAP_EnumProc_Info},                /* MGR_ENUMPROC_INFO */
15015 +       {MGRWRAP_RegisterObject},               /* MGR_REGISTEROBJECT */
15016 +       {MGRWRAP_UnregisterObject},             /* MGR_UNREGISTEROBJECT */
15017 +       {MGRWRAP_WaitForBridgeEvents},          /* MGR_WAIT */
15018 +       {MGRWRAP_GetProcessResourcesInfo},      /* MGR_GET_PROC_RES */
15019 +};
15020 +
15021 +/* PROC wrapper functions */
15022 +static struct WCD_Cmd proc_cmd[] = {
15023 +       {PROCWRAP_Attach},                      /* PROC_ATTACH */
15024 +       {PROCWRAP_Ctrl},                        /* PROC_CTRL */
15025 +       {PROCWRAP_Detach},                      /* PROC_DETACH */
15026 +       {PROCWRAP_EnumNode_Info},               /* PROC_ENUMNODE */
15027 +       {PROCWRAP_EnumResources},               /* PROC_ENUMRESOURCES */
15028 +       {PROCWRAP_GetState},                    /* PROC_GET_STATE */
15029 +       {PROCWRAP_GetTrace},                    /* PROC_GET_TRACE */
15030 +       {PROCWRAP_Load},                        /* PROC_LOAD */
15031 +       {PROCWRAP_RegisterNotify},              /* PROC_REGISTERNOTIFY */
15032 +       {PROCWRAP_Start},                       /* PROC_START */
15033 +       {PROCWRAP_ReserveMemory},               /* PROC_RSVMEM */
15034 +       {PROCWRAP_UnReserveMemory},             /* PROC_UNRSVMEM */
15035 +       {PROCWRAP_Map},                         /* PROC_MAPMEM */
15036 +       {PROCWRAP_UnMap},                       /* PROC_UNMAPMEM */
15037 +       {PROCWRAP_FlushMemory},                 /* PROC_FLUSHMEMORY */
15038 +       {PROCWRAP_Stop},                        /* PROC_STOP */
15039 +       {PROCWRAP_InvalidateMemory},            /* PROC_INVALIDATEMEMORY */
15040 +};
15041 +
15042 +/* NODE wrapper functions */
15043 +static struct WCD_Cmd node_cmd[] = {
15044 +       {NODEWRAP_Allocate},                    /* NODE_ALLOCATE */
15045 +       {NODEWRAP_AllocMsgBuf},                 /* NODE_ALLOCMSGBUF */
15046 +       {NODEWRAP_ChangePriority},              /* NODE_CHANGEPRIORITY */
15047 +       {NODEWRAP_Connect},                     /* NODE_CONNECT */
15048 +       {NODEWRAP_Create},                      /* NODE_CREATE */
15049 +       {NODEWRAP_Delete},                      /* NODE_DELETE */
15050 +       {NODEWRAP_FreeMsgBuf},                  /* NODE_FREEMSGBUF */
15051 +       {NODEWRAP_GetAttr},                     /* NODE_GETATTR */
15052 +       {NODEWRAP_GetMessage},                  /* NODE_GETMESSAGE */
15053 +       {NODEWRAP_Pause},                       /* NODE_PAUSE */
15054 +       {NODEWRAP_PutMessage},                  /* NODE_PUTMESSAGE */
15055 +       {NODEWRAP_RegisterNotify},              /* NODE_REGISTERNOTIFY */
15056 +       {NODEWRAP_Run},                         /* NODE_RUN */
15057 +       {NODEWRAP_Terminate},                   /* NODE_TERMINATE */
15058 +       {NODEWRAP_GetUUIDProps},                /* NODE_GETUUIDPROPS */
15059 +};
15060 +
15061 +/* STRM wrapper functions */
15062 +static struct WCD_Cmd strm_cmd[] = {
15063 +       {STRMWRAP_AllocateBuffer},              /* STRM_ALLOCATEBUFFER */
15064 +       {STRMWRAP_Close},                       /* STRM_CLOSE */
15065 +       {STRMWRAP_FreeBuffer},                  /* STRM_FREEBUFFER */
15066 +       {STRMWRAP_GetEventHandle},              /* STRM_GETEVENTHANDLE */
15067 +       {STRMWRAP_GetInfo},                     /* STRM_GETINFO */
15068 +       {STRMWRAP_Idle},                        /* STRM_IDLE */
15069 +       {STRMWRAP_Issue},                       /* STRM_ISSUE */
15070 +       {STRMWRAP_Open},                        /* STRM_OPEN */
15071 +       {STRMWRAP_Reclaim},                     /* STRM_RECLAIM */
15072 +       {STRMWRAP_RegisterNotify},              /* STRM_REGISTERNOTIFY */
15073 +       {STRMWRAP_Select},                      /* STRM_SELECT */
15074 +};
15075 +
15076 +/* CMM wrapper functions */
15077 +static struct WCD_Cmd cmm_cmd[] = {
15078 +       {CMMWRAP_CallocBuf},                    /* CMM_ALLOCBUF */
15079 +       {CMMWRAP_FreeBuf},                      /* CMM_FREEBUF */
15080 +       {CMMWRAP_GetHandle},                    /* CMM_GETHANDLE */
15081 +       {CMMWRAP_GetInfo},                      /* CMM_GETINFO */
15082 +};
15083 +
15084 +/* Array used to store ioctl table sizes. It can hold up to 8 entries */
15085 +static u8 size_cmd[] = {
15086 +       ARRAY_SIZE(mgr_cmd),
15087 +       ARRAY_SIZE(proc_cmd),
15088 +       ARRAY_SIZE(node_cmd),
15089 +       ARRAY_SIZE(strm_cmd),
15090 +       ARRAY_SIZE(cmm_cmd),
15091 +};
15092 +
15093  static inline void __cp_fm_usr(void *to, const void __user *from,
15094                                DSP_STATUS *err, unsigned long bytes)
15095  {
15096 @@ -198,89 +234,63 @@ static inline void __cp_to_usr(void __us
15097         __cp_to_usr(to, from, &(err), (n) * sizeof(*(from)))
15098  
15099  /*
15100 - *  Function table.
15101 - *  The order of these functions MUST be the same as the order of the command
15102 - *  numbers defined in wcdioctl.h  This is how an IOCTL number in user mode
15103 - *  turns into a function call in kernel mode.
15104 - */
15105 -static struct WCD_Cmd WCD_cmdTable[] = {
15106 -       /* MGR module */
15107 -       {MGRWRAP_EnumNode_Info, CMD_MGR_ENUMNODE_INFO_OFFSET},
15108 -       {MGRWRAP_EnumProc_Info, CMD_MGR_ENUMPROC_INFO_OFFSET},
15109 -       {MGRWRAP_RegisterObject, CMD_MGR_REGISTEROBJECT_OFFSET},
15110 -       {MGRWRAP_UnregisterObject, CMD_MGR_UNREGISTEROBJECT_OFFSET},
15111 -       {MGRWRAP_WaitForBridgeEvents, CMD_MGR_WAIT_OFFSET},
15112 -#ifndef RES_CLEANUP_DISABLE
15113 -       {MGRWRAP_GetProcessResourcesInfo, CMD_MGR_RESOUCES_OFFSET},
15114 -#endif
15115 -       /* PROC Module */
15116 -       {PROCWRAP_Attach, CMD_PROC_ATTACH_OFFSET},
15117 -       {PROCWRAP_Ctrl, CMD_PROC_CTRL_OFFSET},
15118 -       {PROCWRAP_Detach, CMD_PROC_DETACH_OFFSET},
15119 -       {PROCWRAP_EnumNode_Info, CMD_PROC_ENUMNODE_OFFSET},
15120 -       {PROCWRAP_EnumResources, CMD_PROC_ENUMRESOURCES_OFFSET},
15121 -       {PROCWRAP_GetState, CMD_PROC_GETSTATE_OFFSET},
15122 -       {PROCWRAP_GetTrace, CMD_PROC_GETTRACE_OFFSET},
15123 -       {PROCWRAP_Load, CMD_PROC_LOAD_OFFSET},
15124 -       {PROCWRAP_RegisterNotify, CMD_PROC_REGISTERNOTIFY_OFFSET},
15125 -       {PROCWRAP_Start, CMD_PROC_START_OFFSET},
15126 -       {PROCWRAP_ReserveMemory, CMD_PROC_RSVMEM_OFFSET},
15127 -       {PROCWRAP_UnReserveMemory, CMD_PROC_UNRSVMEM_OFFSET},
15128 -       {PROCWRAP_Map, CMD_PROC_MAPMEM_OFFSET},
15129 -       {PROCWRAP_UnMap, CMD_PROC_UNMAPMEM_OFFSET},
15130 -       {PROCWRAP_FlushMemory, CMD_PROC_FLUSHMEMORY_OFFSET},
15131 -       {PROCWRAP_Stop, CMD_PROC_STOP_OFFSET},
15132 -       {PROCWRAP_InvalidateMemory, CMD_PROC_INVALIDATEMEMORY_OFFSET},
15133 -       /* NODE Module */
15134 -       {NODEWRAP_Allocate, CMD_NODE_ALLOCATE_OFFSET},
15135 -       {NODEWRAP_AllocMsgBuf, CMD_NODE_ALLOCMSGBUF_OFFSET},
15136 -       {NODEWRAP_ChangePriority, CMD_NODE_CHANGEPRIORITY_OFFSET},
15137 -       {NODEWRAP_Connect, CMD_NODE_CONNECT_OFFSET},
15138 -       {NODEWRAP_Create, CMD_NODE_CREATE_OFFSET},
15139 -       {NODEWRAP_Delete, CMD_NODE_DELETE_OFFSET},
15140 -       {NODEWRAP_FreeMsgBuf, CMD_NODE_FREEMSGBUF_OFFSET},
15141 -       {NODEWRAP_GetAttr, CMD_NODE_GETATTR_OFFSET},
15142 -       {NODEWRAP_GetMessage, CMD_NODE_GETMESSAGE_OFFSET},
15143 -       {NODEWRAP_Pause, CMD_NODE_PAUSE_OFFSET},
15144 -       {NODEWRAP_PutMessage, CMD_NODE_PUTMESSAGE_OFFSET},
15145 -       {NODEWRAP_RegisterNotify, CMD_NODE_REGISTERNOTIFY_OFFSET},
15146 -       {NODEWRAP_Run, CMD_NODE_RUN_OFFSET},
15147 -       {NODEWRAP_Terminate, CMD_NODE_TERMINATE_OFFSET},
15148 -       {NODEWRAP_GetUUIDProps, CMD_NODE_GETUUIDPROPS_OFFSET},
15149 -       /* STRM wrapper functions */
15150 -       {STRMWRAP_AllocateBuffer, CMD_STRM_ALLOCATEBUFFER_OFFSET},
15151 -       {STRMWRAP_Close, CMD_STRM_CLOSE_OFFSET},
15152 -       {STRMWRAP_FreeBuffer, CMD_STRM_FREEBUFFER_OFFSET},
15153 -       {STRMWRAP_GetEventHandle, CMD_STRM_GETEVENTHANDLE_OFFSET},
15154 -       {STRMWRAP_GetInfo, CMD_STRM_GETINFO_OFFSET},
15155 -       {STRMWRAP_Idle, CMD_STRM_IDLE_OFFSET},
15156 -       {STRMWRAP_Issue, CMD_STRM_ISSUE_OFFSET},
15157 -       {STRMWRAP_Open, CMD_STRM_OPEN_OFFSET},
15158 -       {STRMWRAP_Reclaim, CMD_STRM_RECLAIM_OFFSET},
15159 -       {STRMWRAP_RegisterNotify, CMD_STRM_REGISTERNOTIFY_OFFSET},
15160 -       {STRMWRAP_Select, CMD_STRM_SELECT_OFFSET},
15161 -       /* CMM module */
15162 -       {CMMWRAP_CallocBuf, CMD_CMM_ALLOCBUF_OFFSET},
15163 -       {CMMWRAP_FreeBuf, CMD_CMM_FREEBUF_OFFSET},
15164 -       {CMMWRAP_GetHandle, CMD_CMM_GETHANDLE_OFFSET},
15165 -       {CMMWRAP_GetInfo, CMD_CMM_GETINFO_OFFSET}
15166 -};
15167 -
15168 -/*
15169   *  ======== WCD_CallDevIOCtl ========
15170   *  Purpose:
15171   *      Call the (wrapper) function for the corresponding WCD IOCTL.
15172   */
15173  inline DSP_STATUS WCD_CallDevIOCtl(u32 cmd, union Trapped_Args *args,
15174 -                                   u32 *pResult, void *pr_ctxt)
15175 +                                   u32 *result, void *pr_ctxt)
15176  {
15177 -       if ((cmd < (sizeof(WCD_cmdTable) / sizeof(struct WCD_Cmd)))) {
15178 -               /* make the fxn call via the cmd table */
15179 -               *pResult = (*WCD_cmdTable[cmd].fxn) (args, pr_ctxt);
15180 -               return DSP_SOK;
15181 +       u32 (*ioctl_cmd)(union Trapped_Args *args, void *pr_ctxt) = NULL;
15182 +       int i;
15183 +
15184 +       if (_IOC_TYPE(cmd) != DB) {
15185 +               pr_err("%s: Incompatible dspbridge ioctl number\n", __func__);
15186 +               goto err;
15187 +       }
15188 +
15189 +       if (DB_GET_IOC_TABLE(cmd) > ARRAY_SIZE(size_cmd)) {
15190 +               pr_err("%s: undefined ioctl module\n", __func__);
15191 +               goto err;
15192 +       }
15193 +
15194 +       /* Check the size of the required cmd table */
15195 +       i = DB_GET_IOC(cmd);
15196 +       if (i > size_cmd[DB_GET_IOC_TABLE(cmd)]) {
15197 +               pr_err("%s: requested ioctl %d out of bounds for table %d\n",
15198 +                                       __func__, i, DB_GET_IOC_TABLE(cmd));
15199 +               goto err;
15200 +       }
15201 +
15202 +       switch (DB_GET_MODULE(cmd)) {
15203 +       case DB_MGR:
15204 +               ioctl_cmd = mgr_cmd[i].fxn;
15205 +               break;
15206 +       case DB_PROC:
15207 +               ioctl_cmd = proc_cmd[i].fxn;
15208 +               break;
15209 +       case DB_NODE:
15210 +               ioctl_cmd = node_cmd[i].fxn;
15211 +               break;
15212 +       case DB_STRM:
15213 +               ioctl_cmd = strm_cmd[i].fxn;
15214 +               break;
15215 +       case DB_CMM:
15216 +               ioctl_cmd = cmm_cmd[i].fxn;
15217 +               break;
15218 +       }
15219 +
15220 +       if (!ioctl_cmd) {
15221 +               pr_err("%s: requested ioctl not defined\n", __func__);
15222 +               goto err;
15223         } else {
15224 -               return DSP_EINVALIDARG;
15225 +               *result = (*ioctl_cmd)(args, pr_ctxt);
15226         }
15227 +
15228 +       return DSP_SOK;
15229 +
15230 +err:
15231 +       return -EINVAL;
15232  }
15233  
15234  /*
15235 @@ -300,14 +310,12 @@ void WCD_Exit(void)
15236                 MSG_Exit();
15237                 IO_Exit();
15238                 STRM_Exit();
15239 -               NTFY_Exit();
15240                 DISP_Exit();
15241                 NODE_Exit();
15242                 PROC_Exit();
15243                 MGR_Exit();
15244                 RMM_exit();
15245                 DRV_Exit();
15246 -               SERVICES_Exit();
15247         }
15248         DBC_Ensure(WCD_cRefs >= 0);
15249  }
15250 @@ -320,18 +328,10 @@ void WCD_Exit(void)
15251  bool WCD_Init(void)
15252  {
15253         bool fInit = true;
15254 -       bool fDRV, fDEV, fCOD, fSERVICES, fCHNL, fMSG, fIO;
15255 -       bool fMGR, fPROC, fNODE, fDISP, fNTFY, fSTRM, fRMM;
15256 -#ifdef DEBUG
15257 -       /* runtime check of Device IOCtl array. */
15258 -       u32 i;
15259 -       for (i = 1; i < (sizeof(WCD_cmdTable) / sizeof(struct WCD_Cmd)); i++)
15260 -               DBC_Assert(WCD_cmdTable[i - 1].dwIndex == i);
15261 +       bool fDRV, fDEV, fCOD, fCHNL, fMSG, fIO;
15262 +       bool fMGR, fPROC, fNODE, fDISP, fSTRM, fRMM;
15263  
15264 -#endif
15265         if (WCD_cRefs == 0) {
15266 -               /* initialize all SERVICES modules */
15267 -               fSERVICES = SERVICES_Init();
15268                 /* initialize debugging module */
15269                 DBC_Assert(!WCD_debugMask.flags);
15270                 GT_create(&WCD_debugMask, "CD");    /* CD for class driver */
15271 @@ -341,7 +341,6 @@ bool WCD_Init(void)
15272                 fPROC = PROC_Init();
15273                 fNODE = NODE_Init();
15274                 fDISP = DISP_Init();
15275 -               fNTFY = NTFY_Init();
15276                 fSTRM = STRM_Init();
15277                 fRMM = RMM_init();
15278                 fCHNL = CHNL_Init();
15279 @@ -349,13 +348,10 @@ bool WCD_Init(void)
15280                 fIO = IO_Init();
15281                 fDEV = DEV_Init();
15282                 fCOD = COD_Init();
15283 -               fInit = fSERVICES && fDRV && fDEV && fCHNL && fCOD &&
15284 +               fInit = fDRV && fDEV && fCHNL && fCOD &&
15285                         fMSG && fIO;
15286                 fInit = fInit && fMGR && fPROC && fRMM;
15287                 if (!fInit) {
15288 -                       if (fSERVICES)
15289 -                               SERVICES_Exit();
15290 -
15291                         if (fDRV)
15292                                 DRV_Exit();
15293  
15294 @@ -374,9 +370,6 @@ bool WCD_Init(void)
15295                         if (fDISP)
15296                                 DISP_Exit();
15297  
15298 -                       if (fNTFY)
15299 -                               NTFY_Exit();
15300 -
15301                         if (fCHNL)
15302                                 CHNL_Exit();
15303  
15304 @@ -457,6 +450,8 @@ DSP_STATUS WCD_InitComplete2(void)
15305         return status;
15306  }
15307  
15308 +/* TODO: Remove deprecated and not implemented ioctl wrappers */
15309 +
15310  /*
15311   * ======== MGRWRAP_EnumNode_Info ========
15312   */
15313 @@ -474,6 +469,10 @@ u32 MGRWRAP_EnumNode_Info(union Trapped_
15314                  args->ARGS_MGR_ENUMNODE_INFO.pNDBProps,
15315                  args->ARGS_MGR_ENUMNODE_INFO.uNDBPropsSize,
15316                  args->ARGS_MGR_ENUMNODE_INFO.puNumNodes);
15317 +
15318 +       if (size < sizeof(struct DSP_NDBPROPS))
15319 +               return DSP_ESIZE;
15320 +
15321         pNDBProps = MEM_Alloc(size, MEM_NONPAGED);
15322         if (pNDBProps == NULL)
15323                 status = DSP_EMEMORY;
15324 @@ -511,6 +510,10 @@ u32 MGRWRAP_EnumProc_Info(union Trapped_
15325                  args->ARGS_MGR_ENUMPROC_INFO.pProcessorInfo,
15326                  args->ARGS_MGR_ENUMPROC_INFO.uProcessorInfoSize,
15327                  args->ARGS_MGR_ENUMPROC_INFO.puNumProcs);
15328 +
15329 +       if (size < sizeof(struct DSP_PROCESSORINFO))
15330 +               return DSP_ESIZE;
15331 +
15332         pProcessorInfo = MEM_Alloc(size, MEM_NONPAGED);
15333         if (pProcessorInfo == NULL)
15334                 status = DSP_EMEMORY;
15335 @@ -543,6 +546,11 @@ u32 MGRWRAP_RegisterObject(union Trapped
15336         char *pszPathName = NULL;
15337         DSP_STATUS status = DSP_SOK;
15338  
15339 +
15340 +       GT_1trace(WCD_debugMask, GT_ENTER,
15341 +                "MGRWRAP_RegisterObject: entered "
15342 +                "0x%x\n", args->ARGS_MGR_REGISTEROBJECT.pUuid);
15343 +
15344         cp_fm_usr(&pUuid, args->ARGS_MGR_REGISTEROBJECT.pUuid, status, 1);
15345         if (DSP_FAILED(status))
15346                 goto func_end;
15347 @@ -560,9 +568,9 @@ u32 MGRWRAP_RegisterObject(union Trapped
15348                 goto func_end;
15349         }
15350  
15351 -       GT_1trace(WCD_debugMask, GT_ENTER,
15352 -                "MGRWRAP_RegisterObject: entered pg2hMsg "
15353 -                "0x%x\n", args->ARGS_MGR_REGISTEROBJECT.pUuid);
15354 +       if (args->ARGS_MGR_REGISTEROBJECT.objType >= DSP_DCDMAXOBJTYPE)
15355 +               return DSP_EINVALIDARG;
15356 +
15357         status = DCD_RegisterObject(&pUuid,
15358                                 args->ARGS_MGR_REGISTEROBJECT.objType,
15359                                 (char *)pszPathName);
15360 @@ -631,28 +639,15 @@ u32 MGRWRAP_WaitForBridgeEvents(union Tr
15361  }
15362  
15363  
15364 -#ifndef RES_CLEANUP_DISABLE
15365  /*
15366   * ======== MGRWRAP_GetProcessResourceInfo ========
15367   */
15368 -u32 MGRWRAP_GetProcessResourcesInfo(union Trapped_Args *args, void *pr_ctxt)
15369 +u32 __deprecated MGRWRAP_GetProcessResourcesInfo(union Trapped_Args *args,
15370 +                                               void *pr_ctxt)
15371  {
15372 -    DSP_STATUS status = DSP_SOK;
15373 -    u32 uSize = 0;
15374 -    u8 *pBuf = MEM_Alloc(8092, MEM_NONPAGED);
15375 -    status = DRV_ProcDisplayResInfo(pBuf, &uSize);
15376 -    GT_1trace(WCD_debugMask, GT_ENTER,
15377 -            "MGRWRAP_GetProcessResourcesInfo:uSize=%d :\n", uSize);
15378 -    cp_to_usr(args->ARGS_PROC_GETTRACE.pBuf, pBuf, status, uSize);
15379 -    GT_0trace(WCD_debugMask, GT_ENTER, "\n***********"
15380 -            "123MGRWRAP_GetProcessResourcesInfo:**************\n");
15381 -    GT_0trace(WCD_debugMask, GT_ENTER, "\n***********"
15382 -            "456MGRWRAP_GetProcessResourcesInfo:**************\n");
15383 -    cp_to_usr(args->ARGS_PROC_GETTRACE.pSize, &uSize, status, 1);
15384 -    MEM_Free(pBuf);
15385 -    return status;
15386 +       pr_err("%s: deprecated dspbridge ioctl\n", __func__);
15387 +       return DSP_SOK;
15388  }
15389 -#endif
15390  
15391  
15392  /*
15393 @@ -660,7 +655,7 @@ u32 MGRWRAP_GetProcessResourcesInfo(unio
15394   */
15395  u32 PROCWRAP_Attach(union Trapped_Args *args, void *pr_ctxt)
15396  {
15397 -       DSP_HPROCESSOR processor;
15398 +       void *processor;
15399         DSP_STATUS status = DSP_SOK;
15400         struct DSP_PROCESSORATTRIN attrIn, *pAttrIn = NULL;
15401  
15402 @@ -696,6 +691,7 @@ u32 PROCWRAP_Ctrl(union Trapped_Args *ar
15403                         args->ARGS_PROC_CTRL.pArgs;
15404         u8 *pArgs = NULL;
15405         DSP_STATUS status = DSP_SOK;
15406 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15407  
15408         GT_3trace(WCD_debugMask, GT_ENTER,
15409                  "PROCWRAP_Ctrl: entered args:\n 0x%x"
15410 @@ -703,6 +699,10 @@ u32 PROCWRAP_Ctrl(union Trapped_Args *ar
15411                  args->ARGS_PROC_CTRL.hProcessor,
15412                  args->ARGS_PROC_CTRL.dwCmd,
15413                  args->ARGS_PROC_CTRL.pArgs);
15414 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor) {
15415 +               status = DSP_EHANDLE;
15416 +               goto func_end;
15417 +       }
15418         if (pSize) {
15419                 if (get_user(cbDataSize, pSize)) {
15420                         status = DSP_EFAIL;
15421 @@ -734,16 +734,11 @@ func_end:
15422  /*
15423   * ======== PROCWRAP_Detach ========
15424   */
15425 -u32 PROCWRAP_Detach(union Trapped_Args *args, void *pr_ctxt)
15426 +u32 __deprecated PROCWRAP_Detach(union Trapped_Args *args, void *pr_ctxt)
15427  {
15428 -       u32 retVal;
15429 -
15430 -       GT_1trace(WCD_debugMask, GT_ENTER,
15431 -                "PROCWRAP_Detach: entered args\n0x%x "
15432 -                "hProceesor \n", args->ARGS_PROC_DETACH.hProcessor);
15433 -       retVal = PROC_Detach(args->ARGS_PROC_DETACH.hProcessor, pr_ctxt);
15434 -
15435 -       return retVal;
15436 +       /* PROC_Detach called at bridge_release only */
15437 +       pr_err("%s: deprecated dspbridge ioctl\n", __func__);
15438 +       return DSP_SOK;
15439  }
15440  
15441  /*
15442 @@ -752,9 +747,10 @@ u32 PROCWRAP_Detach(union Trapped_Args *
15443  u32 PROCWRAP_EnumNode_Info(union Trapped_Args *args, void *pr_ctxt)
15444  {
15445         DSP_STATUS status;
15446 -       DSP_HNODE aNodeTab[MAX_NODES];
15447 +       void *aNodeTab[MAX_NODES];
15448         u32 uNumNodes;
15449         u32 uAllocated;
15450 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15451  
15452         GT_5trace(WCD_debugMask, GT_ENTER,
15453                  "PROCWRAP_EnumNode_Info:entered args:\n0x"
15454 @@ -765,7 +761,13 @@ u32 PROCWRAP_EnumNode_Info(union Trapped
15455                  args->ARGS_PROC_ENUMNODE_INFO.uNodeTabSize,
15456                  args->ARGS_PROC_ENUMNODE_INFO.puNumNodes,
15457                  args->ARGS_PROC_ENUMNODE_INFO.puAllocated);
15458 -       DBC_Require(args->ARGS_PROC_ENUMNODE_INFO.uNodeTabSize <= MAX_NODES);
15459 +
15460 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15461 +               return DSP_EHANDLE;
15462 +
15463 +       if (!args->ARGS_PROC_ENUMNODE_INFO.uNodeTabSize)
15464 +               return DSP_ESIZE;
15465 +
15466         status = PROC_EnumNodes(args->ARGS_PROC_ENUMNODE_INFO.hProcessor,
15467                                 aNodeTab,
15468                                 args->ARGS_PROC_ENUMNODE_INFO.uNodeTabSize,
15469 @@ -785,9 +787,17 @@ u32 PROCWRAP_EnumNode_Info(union Trapped
15470  u32 PROCWRAP_FlushMemory(union Trapped_Args *args, void *pr_ctxt)
15471  {
15472         DSP_STATUS status;
15473 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15474  
15475         GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_FlushMemory: entered\n");
15476  
15477 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15478 +               return DSP_EHANDLE;
15479 +
15480 +       if (args->ARGS_PROC_FLUSHMEMORY.ulFlags >
15481 +                                        PROC_WRITEBACK_INVALIDATE_MEM)
15482 +               return DSP_EINVALIDARG;
15483 +
15484         status = PROC_FlushMemory(args->ARGS_PROC_FLUSHMEMORY.hProcessor,
15485                                  args->ARGS_PROC_FLUSHMEMORY.pMpuAddr,
15486                                  args->ARGS_PROC_FLUSHMEMORY.ulSize,
15487 @@ -802,10 +812,14 @@ u32 PROCWRAP_FlushMemory(union Trapped_A
15488  u32 PROCWRAP_InvalidateMemory(union Trapped_Args *args, void *pr_ctxt)
15489  {
15490         DSP_STATUS status;
15491 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15492  
15493         GT_0trace(WCD_debugMask, GT_ENTER,
15494                  "PROCWRAP_InvalidateMemory:entered\n");
15495  
15496 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15497 +               return DSP_EHANDLE;
15498 +
15499         status = PROC_InvalidateMemory(
15500                                   args->ARGS_PROC_INVALIDATEMEMORY.hProcessor,
15501                                   args->ARGS_PROC_INVALIDATEMEMORY.pMpuAddr,
15502 @@ -821,9 +835,7 @@ u32 PROCWRAP_EnumResources(union Trapped
15503  {
15504         DSP_STATUS status = DSP_SOK;
15505         struct DSP_RESOURCEINFO pResourceInfo;
15506 -
15507 -       if (DSP_FAILED(status))
15508 -               goto func_end;
15509 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15510  
15511         GT_4trace(WCD_debugMask, GT_ENTER,
15512                  "PROCWRAP_EnumResources: entered args:\n"
15513 @@ -833,15 +845,22 @@ u32 PROCWRAP_EnumResources(union Trapped
15514                  args->ARGS_PROC_ENUMRESOURCES.uResourceType,
15515                  args->ARGS_PROC_ENUMRESOURCES.pResourceInfo,
15516                  args->ARGS_PROC_ENUMRESOURCES.uResourceInfoSize);
15517 +
15518 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15519 +               return DSP_EHANDLE;
15520 +
15521 +       if (args->ARGS_PROC_ENUMRESOURCES.uResourceInfoSize <
15522 +               sizeof(struct DSP_RESOURCEINFO))
15523 +               return DSP_ESIZE;
15524 +
15525         status = PROC_GetResourceInfo(args->ARGS_PROC_ENUMRESOURCES.hProcessor,
15526                         args->ARGS_PROC_ENUMRESOURCES.uResourceType,
15527                         &pResourceInfo,
15528                         args->ARGS_PROC_ENUMRESOURCES.uResourceInfoSize);
15529 -       if (DSP_FAILED(status))
15530 -               goto func_end;
15531 +
15532         cp_to_usr(args->ARGS_PROC_ENUMRESOURCES.pResourceInfo, &pResourceInfo,
15533                                                 status, 1);
15534 -func_end:
15535 +
15536         return status;
15537  
15538  }
15539 @@ -853,7 +872,17 @@ u32 PROCWRAP_GetState(union Trapped_Args
15540  {
15541         DSP_STATUS status;
15542         struct DSP_PROCESSORSTATE procStatus;
15543 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15544 +
15545         GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_GetState: entered\n");
15546 +
15547 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15548 +               return DSP_EHANDLE;
15549 +
15550 +       if (args->ARGS_PROC_GETSTATE.uStateInfoSize <
15551 +               sizeof(struct DSP_PROCESSORSTATE))
15552 +               return DSP_ESIZE;
15553 +
15554         status = PROC_GetState(args->ARGS_PROC_GETSTATE.hProcessor, &procStatus,
15555                               args->ARGS_PROC_GETSTATE.uStateInfoSize);
15556         cp_to_usr(args->ARGS_PROC_GETSTATE.pProcStatus, &procStatus, status, 1);
15557 @@ -868,10 +897,15 @@ u32 PROCWRAP_GetTrace(union Trapped_Args
15558  {
15559         DSP_STATUS status;
15560         u8 *pBuf;
15561 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15562  
15563         GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_GetTrace: entered\n");
15564  
15565 -       DBC_Require(args->ARGS_PROC_GETTRACE.uMaxSize <= MAX_TRACEBUFLEN);
15566 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15567 +               return DSP_EHANDLE;
15568 +
15569 +       if (args->ARGS_PROC_GETTRACE.uMaxSize > MAX_TRACEBUFLEN)
15570 +               return DSP_ESIZE;
15571  
15572         pBuf = MEM_Calloc(args->ARGS_PROC_GETTRACE.uMaxSize, MEM_NONPAGED);
15573         if (pBuf != NULL) {
15574 @@ -897,10 +931,18 @@ u32 PROCWRAP_Load(union Trapped_Args *ar
15575         DSP_STATUS status = DSP_SOK;
15576         char *temp;
15577         s32 count = args->ARGS_PROC_LOAD.iArgc;
15578 -       u8 **argv, **envp = NULL;
15579 +       u8 **argv = NULL, **envp = NULL;
15580 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15581 +
15582 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor) {
15583 +               status = DSP_EHANDLE;
15584 +               goto func_cont;
15585 +       }
15586  
15587 -       DBC_Require(count > 0);
15588 -       DBC_Require(count <= MAX_LOADARGS);
15589 +       if (count <= 0 || count > MAX_LOADARGS) {
15590 +               status = DSP_EINVALIDARG;
15591 +               goto func_cont;
15592 +       }
15593  
15594         argv = MEM_Alloc(count * sizeof(u8 *), MEM_NONPAGED);
15595         if (!argv) {
15596 @@ -1014,16 +1056,27 @@ u32 PROCWRAP_Map(union Trapped_Args *arg
15597  {
15598         DSP_STATUS status;
15599         void *pMapAddr;
15600 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15601  
15602         GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_Map: entered\n");
15603 +
15604 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15605 +               return DSP_EHANDLE;
15606 +
15607 +       if (!args->ARGS_PROC_MAPMEM.ulSize)
15608 +               return DSP_ESIZE;
15609 +
15610         status = PROC_Map(args->ARGS_PROC_MAPMEM.hProcessor,
15611                          args->ARGS_PROC_MAPMEM.pMpuAddr,
15612                          args->ARGS_PROC_MAPMEM.ulSize,
15613                          args->ARGS_PROC_MAPMEM.pReqAddr, &pMapAddr,
15614                          args->ARGS_PROC_MAPMEM.ulMapAttr, pr_ctxt);
15615         if (DSP_SUCCEEDED(status)) {
15616 -               if (put_user(pMapAddr, args->ARGS_PROC_MAPMEM.ppMapAddr))
15617 +               if (put_user(pMapAddr, args->ARGS_PROC_MAPMEM.ppMapAddr)) {
15618                         status = DSP_EINVALIDARG;
15619 +                       PROC_UnMap(args->ARGS_PROC_MAPMEM.hProcessor,
15620 +                               pMapAddr, pr_ctxt);
15621 +               }
15622  
15623         }
15624         return status;
15625 @@ -1036,10 +1089,14 @@ u32 PROCWRAP_RegisterNotify(union Trappe
15626  {
15627         DSP_STATUS status;
15628         struct DSP_NOTIFICATION notification;
15629 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15630  
15631         GT_0trace(WCD_debugMask, GT_ENTER,
15632                  "PROCWRAP_RegisterNotify: entered\n");
15633  
15634 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15635 +               return DSP_EHANDLE;
15636 +
15637         /* Initialize the notification data structure  */
15638         notification.psName = NULL;
15639         notification.handle = NULL;
15640 @@ -1060,13 +1117,26 @@ u32 PROCWRAP_ReserveMemory(union Trapped
15641  {
15642         DSP_STATUS status;
15643         void *pRsvAddr;
15644 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15645  
15646         GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_ReserveMemory: entered\n");
15647 +
15648 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15649 +               return DSP_EHANDLE;
15650 +
15651 +       if ((args->ARGS_PROC_RSVMEM.ulSize <= 0) ||
15652 +               (args->ARGS_PROC_RSVMEM.ulSize & (PG_SIZE_4K - 1)) != 0)
15653 +               return DSP_ESIZE;
15654 +
15655         status = PROC_ReserveMemory(args->ARGS_PROC_RSVMEM.hProcessor,
15656                                    args->ARGS_PROC_RSVMEM.ulSize, &pRsvAddr);
15657 -       if (put_user(pRsvAddr, args->ARGS_PROC_RSVMEM.ppRsvAddr))
15658 -               status = DSP_EINVALIDARG;
15659 -
15660 +       if (DSP_SUCCEEDED(status)) {
15661 +               if (put_user(pRsvAddr, args->ARGS_PROC_RSVMEM.ppRsvAddr)) {
15662 +                       status = DSP_EINVALIDARG;
15663 +                       PROC_UnReserveMemory(args->ARGS_PROC_RSVMEM.hProcessor,
15664 +                               pRsvAddr);
15665 +               }
15666 +       }
15667         return status;
15668  }
15669  
15670 @@ -1076,8 +1146,13 @@ u32 PROCWRAP_ReserveMemory(union Trapped
15671  u32 PROCWRAP_Start(union Trapped_Args *args, void *pr_ctxt)
15672  {
15673         u32 retVal;
15674 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15675  
15676         GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_Start: entered\n");
15677 +
15678 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15679 +               return DSP_EHANDLE;
15680 +
15681         retVal = PROC_Start(args->ARGS_PROC_START.hProcessor);
15682         return retVal;
15683  }
15684 @@ -1088,8 +1163,13 @@ u32 PROCWRAP_Start(union Trapped_Args *a
15685  u32 PROCWRAP_UnMap(union Trapped_Args *args, void *pr_ctxt)
15686  {
15687         DSP_STATUS status;
15688 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15689  
15690         GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_UnMap: entered\n");
15691 +
15692 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15693 +               return DSP_EHANDLE;
15694 +
15695         status = PROC_UnMap(args->ARGS_PROC_UNMAPMEM.hProcessor,
15696                            args->ARGS_PROC_UNMAPMEM.pMapAddr, pr_ctxt);
15697         return status;
15698 @@ -1101,9 +1181,14 @@ u32 PROCWRAP_UnMap(union Trapped_Args *a
15699  u32 PROCWRAP_UnReserveMemory(union Trapped_Args *args, void *pr_ctxt)
15700  {
15701         DSP_STATUS status;
15702 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15703  
15704         GT_0trace(WCD_debugMask, GT_ENTER,
15705                  "PROCWRAP_UnReserveMemory: entered\n");
15706 +
15707 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15708 +               return DSP_EHANDLE;
15709 +
15710         status = PROC_UnReserveMemory(args->ARGS_PROC_UNRSVMEM.hProcessor,
15711                                      args->ARGS_PROC_UNRSVMEM.pRsvAddr);
15712         return status;
15713 @@ -1115,13 +1200,41 @@ u32 PROCWRAP_UnReserveMemory(union Trapp
15714  u32 PROCWRAP_Stop(union Trapped_Args *args, void *pr_ctxt)
15715  {
15716         u32 retVal;
15717 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15718  
15719         GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_Stop: entered\n");
15720 +
15721 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15722 +               return DSP_EHANDLE;
15723 +
15724         retVal = PROC_Stop(args->ARGS_PROC_STOP.hProcessor);
15725  
15726         return retVal;
15727  }
15728  
15729 +bool validate_node_handle(struct NODE_OBJECT *hNode, void *pr_ctxt)
15730 +{
15731 +       bool retVal = false;
15732 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15733 +       struct NODE_RES_OBJECT *pNode = pCtxt->pNodeList;
15734 +
15735 +       if (hNode == (struct NODE_OBJECT *) DSP_HGPPNODE)
15736 +               retVal = true;
15737 +
15738 +       if (mutex_lock_interruptible(&pCtxt->node_mutex))
15739 +               return DSP_EFAIL;
15740 +
15741 +       while (pNode && !retVal) {
15742 +               if (hNode == pNode->hNode)
15743 +                       retVal = true;
15744 +               pNode = pNode->next;
15745 +       }
15746 +
15747 +       mutex_unlock(&pCtxt->node_mutex);
15748 +
15749 +       return retVal;
15750 +}
15751 +
15752  /*
15753   * ======== NODEWRAP_Allocate ========
15754   */
15755 @@ -1134,9 +1247,15 @@ u32 NODEWRAP_Allocate(union Trapped_Args
15756         u8 *pArgs = NULL;
15757         struct DSP_NODEATTRIN attrIn, *pAttrIn = NULL;
15758         struct NODE_OBJECT *hNode;
15759 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15760  
15761         GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Allocate: entered\n");
15762  
15763 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor) {
15764 +               status =  DSP_EHANDLE;
15765 +               goto func_cont;
15766 +       }
15767 +
15768         /* Optional argument */
15769         if (pSize) {
15770                 if (get_user(cbDataSize, pSize))
15771 @@ -1169,7 +1288,13 @@ u32 NODEWRAP_Allocate(union Trapped_Args
15772                                       &nodeId, (struct DSP_CBDATA *)pArgs,
15773                                       pAttrIn, &hNode, pr_ctxt);
15774         }
15775 -       cp_to_usr(args->ARGS_NODE_ALLOCATE.phNode, &hNode, status, 1);
15776 +       if (DSP_SUCCEEDED(status)) {
15777 +               cp_to_usr(args->ARGS_NODE_ALLOCATE.phNode, &hNode, status, 1);
15778 +               if (DSP_FAILED(status)) {
15779 +                       status = DSP_EPOINTER;
15780 +                       NODE_Delete(hNode, pr_ctxt);
15781 +               }
15782 +       }
15783  func_cont:
15784         if (pArgs)
15785                 MEM_Free(pArgs);
15786 @@ -1187,6 +1312,13 @@ u32 NODEWRAP_AllocMsgBuf(union Trapped_A
15787         struct DSP_BUFFERATTR attr;
15788         u8 *pBuffer = NULL;
15789  
15790 +       if (!args->ARGS_NODE_ALLOCMSGBUF.uSize)
15791 +               return DSP_ESIZE;
15792 +
15793 +       if (!validate_node_handle(args->ARGS_NODE_ALLOCMSGBUF.hNode,
15794 +               pr_ctxt))
15795 +               return DSP_EHANDLE;
15796 +
15797         if (args->ARGS_NODE_ALLOCMSGBUF.pAttr) {        /* Optional argument */
15798                 cp_fm_usr(&attr, args->ARGS_NODE_ALLOCMSGBUF.pAttr, status, 1);
15799                 if (DSP_SUCCEEDED(status))
15800 @@ -1195,6 +1327,7 @@ u32 NODEWRAP_AllocMsgBuf(union Trapped_A
15801         }
15802         /* IN OUT argument */
15803         cp_fm_usr(&pBuffer, args->ARGS_NODE_ALLOCMSGBUF.pBuffer, status, 1);
15804 +
15805         if (DSP_SUCCEEDED(status)) {
15806                 status = NODE_AllocMsgBuf(args->ARGS_NODE_ALLOCMSGBUF.hNode,
15807                                          args->ARGS_NODE_ALLOCMSGBUF.uSize,
15808 @@ -1213,6 +1346,11 @@ u32 NODEWRAP_ChangePriority(union Trappe
15809  
15810         GT_0trace(WCD_debugMask, GT_ENTER,
15811                  "NODEWRAP_ChangePriority: entered\n");
15812 +
15813 +       if (!validate_node_handle(args->ARGS_NODE_CHANGEPRIORITY.hNode,
15814 +               pr_ctxt))
15815 +               return DSP_EHANDLE;
15816 +
15817         retVal = NODE_ChangePriority(args->ARGS_NODE_CHANGEPRIORITY.hNode,
15818                         args->ARGS_NODE_CHANGEPRIORITY.iPriority);
15819  
15820 @@ -1233,6 +1371,13 @@ u32 NODEWRAP_Connect(union Trapped_Args 
15821  
15822         GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Connect: entered\n");
15823  
15824 +       if (!validate_node_handle(args->ARGS_NODE_CONNECT.hNode,
15825 +               pr_ctxt) ||
15826 +               !validate_node_handle(args->ARGS_NODE_CONNECT.hOtherNode,
15827 +               pr_ctxt)) {
15828 +               status = DSP_EHANDLE;
15829 +               goto func_cont;
15830 +       }
15831         /* Optional argument */
15832         if (pSize) {
15833                 if (get_user(cbDataSize, pSize))
15834 @@ -1258,6 +1403,7 @@ u32 NODEWRAP_Connect(union Trapped_Args 
15835                         pAttrs = &attrs;
15836  
15837         }
15838 +
15839         if (DSP_SUCCEEDED(status)) {
15840                 status = NODE_Connect(args->ARGS_NODE_CONNECT.hNode,
15841                                      args->ARGS_NODE_CONNECT.uStream,
15842 @@ -1280,6 +1426,11 @@ u32 NODEWRAP_Create(union Trapped_Args *
15843         u32 retVal;
15844  
15845         GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Create: entered\n");
15846 +
15847 +       if (!validate_node_handle(args->ARGS_NODE_CREATE.hNode,
15848 +               pr_ctxt))
15849 +               return DSP_EHANDLE;
15850 +
15851         retVal = NODE_Create(args->ARGS_NODE_CREATE.hNode);
15852  
15853         return retVal;
15854 @@ -1293,6 +1444,11 @@ u32 NODEWRAP_Delete(union Trapped_Args *
15855         u32 retVal;
15856  
15857         GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Delete: entered\n");
15858 +
15859 +       if (!validate_node_handle(args->ARGS_NODE_DELETE.hNode,
15860 +               pr_ctxt))
15861 +               return DSP_EHANDLE;
15862 +
15863         retVal = NODE_Delete(args->ARGS_NODE_DELETE.hNode, pr_ctxt);
15864  
15865         return retVal;
15866 @@ -1306,12 +1462,21 @@ u32 NODEWRAP_FreeMsgBuf(union Trapped_Ar
15867         DSP_STATUS status = DSP_SOK;
15868         struct DSP_BUFFERATTR *pAttr = NULL;
15869         struct DSP_BUFFERATTR attr;
15870 +
15871 +       if (!args->ARGS_NODE_FREEMSGBUF.pBuffer)
15872 +               return DSP_EPOINTER;
15873 +
15874 +       if (!validate_node_handle(args->ARGS_NODE_FREEMSGBUF.hNode,
15875 +               pr_ctxt))
15876 +               return DSP_EHANDLE;
15877 +
15878         if (args->ARGS_NODE_FREEMSGBUF.pAttr) { /* Optional argument */
15879                 cp_fm_usr(&attr, args->ARGS_NODE_FREEMSGBUF.pAttr, status, 1);
15880                 if (DSP_SUCCEEDED(status))
15881                         pAttr = &attr;
15882  
15883         }
15884 +
15885         if (DSP_SUCCEEDED(status)) {
15886                 status = NODE_FreeMsgBuf(args->ARGS_NODE_FREEMSGBUF.hNode,
15887                                         args->ARGS_NODE_FREEMSGBUF.pBuffer,
15888 @@ -1331,6 +1496,10 @@ u32 NODEWRAP_GetAttr(union Trapped_Args 
15889  
15890         GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_GetAttr: entered\n");
15891  
15892 +       if (!validate_node_handle(args->ARGS_NODE_GETATTR.hNode,
15893 +               pr_ctxt))
15894 +               return DSP_EHANDLE;
15895 +
15896         status = NODE_GetAttr(args->ARGS_NODE_GETATTR.hNode, &attr,
15897                              args->ARGS_NODE_GETATTR.uAttrSize);
15898         cp_to_usr(args->ARGS_NODE_GETATTR.pAttr, &attr, status, 1);
15899 @@ -1348,6 +1517,10 @@ u32 NODEWRAP_GetMessage(union Trapped_Ar
15900  
15901         GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_GetMessage: entered\n");
15902  
15903 +       if (!validate_node_handle(args->ARGS_NODE_GETMESSAGE.hNode,
15904 +               pr_ctxt))
15905 +               return DSP_EHANDLE;
15906 +
15907         status = NODE_GetMessage(args->ARGS_NODE_GETMESSAGE.hNode, &msg,
15908                                 args->ARGS_NODE_GETMESSAGE.uTimeout);
15909  
15910 @@ -1364,6 +1537,11 @@ u32 NODEWRAP_Pause(union Trapped_Args *a
15911         u32 retVal;
15912  
15913         GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Pause: entered\n");
15914 +
15915 +       if (!validate_node_handle(args->ARGS_NODE_PAUSE.hNode,
15916 +               pr_ctxt))
15917 +               return DSP_EHANDLE;
15918 +
15919         retVal = NODE_Pause(args->ARGS_NODE_PAUSE.hNode);
15920  
15921         return retVal;
15922 @@ -1379,6 +1557,10 @@ u32 NODEWRAP_PutMessage(union Trapped_Ar
15923  
15924         GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_PutMessage: entered\n");
15925  
15926 +       if (!validate_node_handle(args->ARGS_NODE_PUTMESSAGE.hNode,
15927 +               pr_ctxt))
15928 +               status = DSP_EHANDLE;
15929 +
15930         cp_fm_usr(&msg, args->ARGS_NODE_PUTMESSAGE.pMessage, status, 1);
15931  
15932         if (DSP_SUCCEEDED(status)) {
15933 @@ -1404,6 +1586,15 @@ u32 NODEWRAP_RegisterNotify(union Trappe
15934         notification.psName = NULL;
15935         notification.handle = NULL;
15936  
15937 +       if (!validate_node_handle(args->ARGS_NODE_REGISTERNOTIFY.hNode,
15938 +               pr_ctxt))
15939 +               return DSP_EHANDLE;
15940 +
15941 +       if (!args->ARGS_PROC_REGISTER_NOTIFY.uEventMask)
15942 +               cp_fm_usr(&notification,
15943 +                       args->ARGS_PROC_REGISTER_NOTIFY.hNotification,
15944 +                       status, 1);
15945 +
15946         status = NODE_RegisterNotify(args->ARGS_NODE_REGISTERNOTIFY.hNode,
15947                                     args->ARGS_NODE_REGISTERNOTIFY.uEventMask,
15948                                     args->ARGS_NODE_REGISTERNOTIFY.uNotifyType,
15949 @@ -1421,6 +1612,11 @@ u32 NODEWRAP_Run(union Trapped_Args *arg
15950         u32 retVal;
15951  
15952         GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Run: entered\n");
15953 +
15954 +       if (!validate_node_handle(args->ARGS_NODE_RUN.hNode,
15955 +               pr_ctxt))
15956 +               return DSP_EHANDLE;
15957 +
15958         retVal = NODE_Run(args->ARGS_NODE_RUN.hNode);
15959  
15960         return retVal;
15961 @@ -1436,6 +1632,10 @@ u32 NODEWRAP_Terminate(union Trapped_Arg
15962  
15963         GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Terminate: entered\n");
15964  
15965 +       if (!validate_node_handle(args->ARGS_NODE_TERMINATE.hNode,
15966 +               pr_ctxt))
15967 +               return DSP_EHANDLE;
15968 +
15969         status = NODE_Terminate(args->ARGS_NODE_TERMINATE.hNode, &tempstatus);
15970  
15971         cp_to_usr(args->ARGS_NODE_TERMINATE.pStatus, &tempstatus, status, 1);
15972 @@ -1452,10 +1652,13 @@ u32 NODEWRAP_GetUUIDProps(union Trapped_
15973         DSP_STATUS status = DSP_SOK;
15974         struct DSP_UUID nodeId;
15975         struct DSP_NDBPROPS    *pnodeProps = NULL;
15976 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15977  
15978         GT_0trace(WCD_debugMask, GT_ENTER,
15979                  "NODEWRAP_GetUUIDPropste: entered\n");
15980  
15981 +       if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15982 +               return DSP_EHANDLE;
15983  
15984         cp_fm_usr(&nodeId, args->ARGS_NODE_GETUUIDPROPS.pNodeID, status, 1);
15985         if (DSP_FAILED(status))
15986 @@ -1475,6 +1678,27 @@ func_cont:
15987         return status;
15988  }
15989  
15990 +
15991 +bool validate_strm_handle(struct STRM_OBJECT *hStrm, void *pr_ctxt)
15992 +{
15993 +       bool retVal = false;
15994 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15995 +       struct STRM_RES_OBJECT *pStrm = pCtxt->pSTRMList;
15996 +
15997 +       if (mutex_lock_interruptible(&pCtxt->strm_mutex))
15998 +               return DSP_EFAIL;
15999 +
16000 +       while (pStrm && !retVal) {
16001 +               if (hStrm == pStrm->hStream)
16002 +                       retVal = true;
16003 +               pStrm = pStrm->next;
16004 +       }
16005 +
16006 +       mutex_unlock(&pCtxt->strm_mutex);
16007 +
16008 +       return retVal;
16009 +}
16010 +
16011  /*
16012   * ======== STRMWRAP_AllocateBuffer ========
16013   */
16014 @@ -1484,15 +1708,28 @@ u32 STRMWRAP_AllocateBuffer(union Trappe
16015         u8 **apBuffer = NULL;
16016         u32 uNumBufs = args->ARGS_STRM_ALLOCATEBUFFER.uNumBufs;
16017  
16018 -       DBC_Require(uNumBufs <= MAX_BUFS);
16019 +       if (!validate_strm_handle(args->ARGS_STRM_ALLOCATEBUFFER.hStream,
16020 +               pr_ctxt))
16021 +               return DSP_EHANDLE;
16022 +
16023 +       if (uNumBufs > MAX_BUFS)
16024 +               return DSP_EINVALIDARG;
16025  
16026         apBuffer = MEM_Alloc((uNumBufs * sizeof(u8 *)), MEM_NONPAGED);
16027  
16028         status = STRM_AllocateBuffer(args->ARGS_STRM_ALLOCATEBUFFER.hStream,
16029                                      args->ARGS_STRM_ALLOCATEBUFFER.uSize,
16030                                      apBuffer, uNumBufs, pr_ctxt);
16031 -       cp_to_usr(args->ARGS_STRM_ALLOCATEBUFFER.apBuffer, apBuffer, status,
16032 -                uNumBufs);
16033 +       if (DSP_SUCCEEDED(status)) {
16034 +               cp_to_usr(args->ARGS_STRM_ALLOCATEBUFFER.apBuffer, apBuffer,
16035 +                       status, uNumBufs);
16036 +               if (DSP_FAILED(status)) {
16037 +                       status = DSP_EPOINTER;
16038 +                       STRM_FreeBuffer(
16039 +                               args->ARGS_STRM_ALLOCATEBUFFER.hStream,
16040 +                               apBuffer, uNumBufs, pr_ctxt);
16041 +               }
16042 +       }
16043         if (apBuffer)
16044                 MEM_Free(apBuffer);
16045  
16046 @@ -1504,6 +1741,9 @@ u32 STRMWRAP_AllocateBuffer(union Trappe
16047   */
16048  u32 STRMWRAP_Close(union Trapped_Args *args, void *pr_ctxt)
16049  {
16050 +       if (!validate_strm_handle(args->ARGS_STRM_CLOSE.hStream, pr_ctxt))
16051 +               return DSP_EHANDLE;
16052 +
16053         return STRM_Close(args->ARGS_STRM_CLOSE.hStream, pr_ctxt);
16054  }
16055  
16056 @@ -1516,7 +1756,11 @@ u32 STRMWRAP_FreeBuffer(union Trapped_Ar
16057         u8 **apBuffer = NULL;
16058         u32 uNumBufs = args->ARGS_STRM_FREEBUFFER.uNumBufs;
16059  
16060 -       DBC_Require(uNumBufs <= MAX_BUFS);
16061 +       if (!validate_strm_handle(args->ARGS_STRM_FREEBUFFER.hStream, pr_ctxt))
16062 +               return DSP_EHANDLE;
16063 +
16064 +       if (uNumBufs > MAX_BUFS)
16065 +               return DSP_EINVALIDARG;
16066  
16067         apBuffer = MEM_Alloc((uNumBufs * sizeof(u8 *)), MEM_NONPAGED);
16068  
16069 @@ -1538,8 +1782,10 @@ u32 STRMWRAP_FreeBuffer(union Trapped_Ar
16070  /*
16071   * ======== STRMWRAP_GetEventHandle ========
16072   */
16073 -u32 STRMWRAP_GetEventHandle(union Trapped_Args *args, void *pr_ctxt)
16074 +u32 __deprecated STRMWRAP_GetEventHandle(union Trapped_Args *args,
16075 +                                       void *pr_ctxt)
16076  {
16077 +       pr_err("%s: deprecated dspbridge ioctl\n", __func__);
16078         return DSP_ENOTIMPL;
16079  }
16080  
16081 @@ -1553,6 +1799,9 @@ u32 STRMWRAP_GetInfo(union Trapped_Args 
16082         struct DSP_STREAMINFO user;
16083         struct DSP_STREAMINFO *temp;
16084  
16085 +       if (!validate_strm_handle(args->ARGS_STRM_GETINFO.hStream, pr_ctxt))
16086 +               return DSP_EHANDLE;
16087 +
16088         cp_fm_usr(&strmInfo, args->ARGS_STRM_GETINFO.pStreamInfo, status, 1);
16089         temp = strmInfo.pUser;
16090  
16091 @@ -1575,6 +1824,9 @@ u32 STRMWRAP_Idle(union Trapped_Args *ar
16092  {
16093         u32 retVal;
16094  
16095 +       if (!validate_strm_handle(args->ARGS_STRM_IDLE.hStream, pr_ctxt))
16096 +               return DSP_EHANDLE;
16097 +
16098         retVal = STRM_Idle(args->ARGS_STRM_IDLE.hStream,
16099                         args->ARGS_STRM_IDLE.bFlush);
16100  
16101 @@ -1587,6 +1839,13 @@ u32 STRMWRAP_Idle(union Trapped_Args *ar
16102  u32 STRMWRAP_Issue(union Trapped_Args *args, void *pr_ctxt)
16103  {
16104         DSP_STATUS status = DSP_SOK;
16105 +
16106 +       if (!validate_strm_handle(args->ARGS_STRM_ISSUE.hStream, pr_ctxt))
16107 +               return DSP_EHANDLE;
16108 +
16109 +       if (!args->ARGS_STRM_ISSUE.pBuffer)
16110 +               return DSP_EPOINTER;
16111 +
16112         /* No need of doing cp_fm_usr for the user buffer (pBuffer)
16113         as this is done in Bridge internal function WMD_CHNL_AddIOReq
16114         in chnl_sm.c */
16115 @@ -1609,12 +1868,19 @@ u32 STRMWRAP_Open(union Trapped_Args *ar
16116         struct STRM_OBJECT *pStrm;
16117         struct DSP_STREAMATTRIN strmAttrIn;
16118  
16119 +       if (!validate_node_handle(args->ARGS_NODE_ALLOCMSGBUF.hNode,
16120 +               pr_ctxt))
16121 +               status = DSP_EHANDLE;
16122 +
16123         cp_fm_usr(&attr, args->ARGS_STRM_OPEN.pAttrIn, status, 1);
16124  
16125         if (attr.pStreamAttrIn != NULL) {       /* Optional argument */
16126                 cp_fm_usr(&strmAttrIn, attr.pStreamAttrIn, status, 1);
16127 -               if (DSP_SUCCEEDED(status))
16128 +               if (DSP_SUCCEEDED(status)) {
16129                         attr.pStreamAttrIn = &strmAttrIn;
16130 +                       if (attr.pStreamAttrIn->lMode == STRMMODE_LDMA)
16131 +                               return DSP_ENOTIMPL;
16132 +               }
16133  
16134         }
16135         status = STRM_Open(args->ARGS_STRM_OPEN.hNode,
16136 @@ -1636,6 +1902,9 @@ u32 STRMWRAP_Reclaim(union Trapped_Args 
16137         u32 dwArg;
16138         u32 ulBufSize;
16139  
16140 +       if (!validate_strm_handle(args->ARGS_STRM_RECLAIM.hStream, pr_ctxt))
16141 +               return DSP_EHANDLE;
16142 +
16143         status = STRM_Reclaim(args->ARGS_STRM_RECLAIM.hStream, &pBufPtr,
16144                              &ulBytes, &ulBufSize, &dwArg);
16145         cp_to_usr(args->ARGS_STRM_RECLAIM.pBufPtr, &pBufPtr, status, 1);
16146 @@ -1661,6 +1930,10 @@ u32 STRMWRAP_RegisterNotify(union Trappe
16147         GT_0trace(WCD_debugMask, GT_ENTER,
16148                  "NODEWRAP_RegisterNotify: entered\n");
16149  
16150 +       if (!validate_strm_handle(args->ARGS_STRM_REGISTERNOTIFY.hStream,
16151 +               pr_ctxt))
16152 +               return DSP_EHANDLE;
16153 +
16154         /* Initialize the notification data structure  */
16155         notification.psName = NULL;
16156         notification.handle = NULL;
16157 @@ -1684,7 +1957,8 @@ u32 STRMWRAP_Select(union Trapped_Args *
16158         struct STRM_OBJECT *aStrmTab[MAX_STREAMS];
16159         DSP_STATUS status = DSP_SOK;
16160  
16161 -       DBC_Require(args->ARGS_STRM_SELECT.nStreams <= MAX_STREAMS);
16162 +       if (args->ARGS_STRM_SELECT.nStreams > MAX_STREAMS)
16163 +               return DSP_EINVALIDARG;
16164  
16165         cp_fm_usr(aStrmTab, args->ARGS_STRM_SELECT.aStreamTab, status,
16166                  args->ARGS_STRM_SELECT.nStreams);
16167 @@ -1701,18 +1975,20 @@ u32 STRMWRAP_Select(union Trapped_Args *
16168  /*
16169   * ======== CMMWRAP_CallocBuf ========
16170   */
16171 -u32 CMMWRAP_CallocBuf(union Trapped_Args *args, void *pr_ctxt)
16172 +u32 __deprecated CMMWRAP_CallocBuf(union Trapped_Args *args, void *pr_ctxt)
16173  {
16174         /* This operation is done in kernel */
16175 +       pr_err("%s: deprecated dspbridge ioctl\n", __func__);
16176         return DSP_ENOTIMPL;
16177  }
16178  
16179  /*
16180   * ======== CMMWRAP_FreeBuf ========
16181   */
16182 -u32 CMMWRAP_FreeBuf(union Trapped_Args *args, void *pr_ctxt)
16183 +u32 __deprecated CMMWRAP_FreeBuf(union Trapped_Args *args, void *pr_ctxt)
16184  {
16185         /* This operation is done in kernel */
16186 +       pr_err("%s: deprecated dspbridge ioctl\n", __func__);
16187         return DSP_ENOTIMPL;
16188  }
16189  
16190 @@ -1723,6 +1999,11 @@ u32 CMMWRAP_GetHandle(union Trapped_Args
16191  {
16192         DSP_STATUS status = DSP_SOK;
16193         struct CMM_OBJECT *hCmmMgr;
16194 +       struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
16195 +
16196 +       if (args->ARGS_PROC_CTRL.hProcessor &&
16197 +               args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
16198 +               return DSP_EHANDLE;
16199  
16200         status = CMM_GetHandle(args->ARGS_CMM_GETHANDLE.hProcessor, &hCmmMgr);
16201  
16202 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/dbdcd.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/dbdcd.c
16203 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/dbdcd.c    2011-04-17 17:32:26.000000000 +0100
16204 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/dbdcd.c 2011-05-02 22:36:50.000000000 +0100
16205 @@ -3,6 +3,15 @@
16206   *
16207   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
16208   *
16209 + * This file contains the implementation of the DSP/BIOS Bridge
16210 + * Configuration Database (DCD).
16211 + *
16212 + * Notes:
16213 + *   The fxn DCD_GetObjects can apply a callback fxn to each DCD object
16214 + *   that is located in a specified COFF file.  At the moment,
16215 + *   DCD_AutoRegister, DCD_AutoUnregister, and NLDR module all use
16216 + *   DCD_GetObjects.
16217 + *
16218   * Copyright (C) 2005-2006 Texas Instruments, Inc.
16219   *
16220   * This package is free software; you can redistribute it and/or modify
16221 @@ -14,53 +23,6 @@
16222   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16223   */
16224  
16225 -
16226 -/*
16227 - *  ======== dbdcd.c ========
16228 - *  Description:
16229 - *      This file contains the implementation of the DSP/BIOS Bridge
16230 - *      Configuration Database (DCD).
16231 - *
16232 - *  Notes:
16233 - *      The fxn DCD_GetObjects can apply a callback fxn to each DCD object
16234 - *      that is located in a specified COFF file.  At the moment,
16235 - *      DCD_AutoRegister, DCD_AutoUnregister, and NLDR module all use
16236 - *      DCD_GetObjects.
16237 - *
16238 - *! Revision History
16239 - *! ================
16240 - *! 03-Dec-2003 map Changed DCD_OBJTYPE to DSP_DCDOBJTYPE
16241 - *! 17-Dec-2002 map Modified DCD_GetDepLibs, DCD_GetNumDepLibs, GetDepLibInfo
16242 - *!                 to include phase information
16243 - *! 02-Dec-2002 map Modified DCD_GetLibraryName for phases in different
16244 - *!                 libraries
16245 - *! 26-Feb-2003 kc  Updated DCD_AutoUnregister and DCD_GetObjects to simplify
16246 - *!                 DCD implementation.
16247 - *! 17-Jul-2002 jeh Call COD_Open() instead of COD_OpenBase(), call COD_Close()
16248 - *! 11-Jul-2002 jeh Added DCD_GetDepLibs(), DCD_GetNumDepLibs().
16249 - *! 18-Feb-2003 vp  Code review updates
16250 - *! 18-Oct-2002 vp  Ported to Linux platform
16251 - *! 15-Mar-2002 jeh Read dynamic loading memory requirements into node object
16252 - *!                 data. Added DCD_GetLibraryName().
16253 - *! 13-Feb-2002 jeh Get system stack size in GetAttrsFromBuf().
16254 - *! 01-Aug-2001 ag: Added check for PROC "extended" attributes used for
16255 - *!                    DSP-MMU setup. These are private attributes.
16256 - *! 18-Apr-2001 jeh Use COD_OpenBase instead of COD_LoadBase.
16257 - *! 03-Apr-2001 sg: Changed error names to DSP_EDCD* format.
16258 - *! 11-Jan-2001 jeh Changes to DCD_GetObjectDef to match node.cdb, proc.cdb.
16259 - *! 12-Dec-2000 kc: Added DCD_AutoUnregister. MSGNODE, DAISNODE added in
16260 - *!                 GetAttrsFromBuf
16261 - *! 22-Nov-2000 kc: Replaced sprintf() calls with strncat.
16262 - *! 09-Nov-2000 kc: Optimized DCD module.
16263 - *! 30-Oct-2000 kc: Added DCD_AutoRegister function; changed local var. names.
16264 - *! 29-Sep-2000 kc: Added code review changes (src/reviews/dcd_reviews.txt).
16265 - *! 06-Sep-2000 jeh Get message segid, message notification type. Added Atoi()
16266 - *!                 to replace atoi(), until cdb generation can output in
16267 - *!                 decimal format.
16268 - *! 26-Jul-2000 kc: Created.
16269 - *!
16270 - */
16271 -
16272  /*  ----------------------------------- Host OS */
16273  #include <dspbridge/host_os.h>
16274  
16275 @@ -73,7 +35,6 @@
16276  #include <dspbridge/gt.h>
16277  
16278  /*  ----------------------------------- OS Adaptation Layer */
16279 -#include <dspbridge/csl.h>
16280  #include <dspbridge/mem.h>
16281  #include <dspbridge/reg.h>
16282  
16283 @@ -89,12 +50,12 @@
16284  /*  ----------------------------------- Global defines. */
16285  #define SIGNATURE       0x5f444344     /* "DCD_" (in reverse). */
16286  
16287 -#define IsValidHandle(h)    (((h) != NULL) && (h->dwSignature == SIGNATURE))
16288 +#define IsValidHandle(h)       (((h) != NULL) && (h->dwSignature == SIGNATURE))
16289  
16290  #define MAX_INT2CHAR_LENGTH     16   /* Maximum int2char len of 32 bit int. */
16291  
16292  /* Name of section containing dependent libraries */
16293 -#define DEPLIBSECT              ".dspbridge_deplibs"
16294 +#define DEPLIBSECT             ".dspbridge_deplibs"
16295  
16296  /* DCD specific structures. */
16297  struct DCD_MANAGER {
16298 @@ -108,17 +69,13 @@ static u32 cEnumRefs;
16299  
16300  extern struct GT_Mask curTrace;
16301  
16302 -/* helper function prototypes. */
16303 +/* Helper function prototypes. */
16304  static s32 Atoi(char *pszBuf);
16305 -
16306  static DSP_STATUS GetAttrsFromBuf(char *pszBuf, u32 ulBufSize,
16307                                   enum DSP_DCDOBJTYPE objType,
16308                                   struct DCD_GENERICOBJ *pGenObj);
16309 -
16310  static void CompressBuf(char *pszBuf, u32 ulBufSize, s32 cCharSize);
16311 -
16312  static char DspChar2GppChar(char *pWord, s32 cDspCharSize);
16313 -
16314  static DSP_STATUS GetDepLibInfo(IN struct DCD_MANAGER *hDcdMgr,
16315                                 IN struct DSP_UUID *pUuid,
16316                                 IN OUT u16 *pNumLibs,
16317 @@ -132,9 +89,8 @@ static DSP_STATUS GetDepLibInfo(IN struc
16318   *  Purpose:
16319   *      Parses the supplied image and resigsters with DCD.
16320   */
16321 -
16322  DSP_STATUS DCD_AutoRegister(IN struct DCD_MANAGER *hDcdMgr,
16323 -                           IN char *pszCoffPath)
16324 +                               IN char *pszCoffPath)
16325  {
16326         DSP_STATUS status = DSP_SOK;
16327  
16328 @@ -162,7 +118,7 @@ DSP_STATUS DCD_AutoRegister(IN struct DC
16329   *      Parses the supplied DSP image and unresiters from DCD.
16330   */
16331  DSP_STATUS DCD_AutoUnregister(IN struct DCD_MANAGER *hDcdMgr,
16332 -                            IN char *pszCoffPath)
16333 +                               IN char *pszCoffPath)
16334  {
16335         DSP_STATUS status = DSP_SOK;
16336  
16337 @@ -173,8 +129,7 @@ DSP_STATUS DCD_AutoUnregister(IN struct 
16338  
16339         if (IsValidHandle(hDcdMgr)) {
16340                 status = DCD_GetObjects(hDcdMgr, pszCoffPath,
16341 -                                      (DCD_REGISTERFXN)DCD_RegisterObject,
16342 -                                      NULL);
16343 +                               (DCD_REGISTERFXN)DCD_RegisterObject, NULL);
16344         } else {
16345                 status = DSP_EHANDLE;
16346                 GT_0trace(curTrace, GT_6CLASS,
16347 @@ -191,9 +146,9 @@ DSP_STATUS DCD_AutoUnregister(IN struct 
16348   *      Creates DCD manager.
16349   */
16350  DSP_STATUS DCD_CreateManager(IN char *pszZlDllName,
16351 -                           OUT struct DCD_MANAGER **phDcdMgr)
16352 +                               OUT struct DCD_MANAGER **phDcdMgr)
16353  {
16354 -       struct COD_MANAGER *hCodMgr;    /* COD manager handle */
16355 +       struct COD_MANAGER *hCodMgr;            /* COD manager handle */
16356         struct DCD_MANAGER *pDcdMgr = NULL;     /* DCD Manager pointer */
16357         DSP_STATUS status = DSP_SOK;
16358  
16359 @@ -204,43 +159,43 @@ DSP_STATUS DCD_CreateManager(IN char *ps
16360                  phDcdMgr);
16361  
16362         status = COD_Create(&hCodMgr, pszZlDllName, NULL);
16363 -       if (DSP_SUCCEEDED(status)) {
16364 -
16365 -               /* Create a DCD object. */
16366 -               MEM_AllocObject(pDcdMgr, struct DCD_MANAGER, SIGNATURE);
16367 -               if (pDcdMgr != NULL) {
16368 -
16369 -                       /* Fill out the object. */
16370 -                       pDcdMgr->hCodMgr = hCodMgr;
16371 -
16372 -                       /* Return handle to this DCD interface. */
16373 -                       *phDcdMgr = pDcdMgr;
16374 -
16375 -                       GT_2trace(curTrace, GT_5CLASS,
16376 -                                "DCD_CreateManager: pDcdMgr 0x%x, "
16377 -                                " hCodMgr 0x%x", pDcdMgr, hCodMgr);
16378 -               } else {
16379 -                       status = DSP_EMEMORY;
16380  
16381 -                       /*
16382 -                        * If allocation of DcdManager object failed, delete the
16383 -                        * COD manager.
16384 -                        */
16385 -                       COD_Delete(hCodMgr);
16386 +       if (DSP_FAILED(status)) {
16387 +               GT_0trace(curTrace, GT_6CLASS,
16388 +                        "DCD_CreateManager: COD_Create failed\n");
16389 +               goto func_end;
16390 +       }
16391  
16392 -                       GT_0trace(curTrace, GT_6CLASS,
16393 -                                "DCD_CreateManager: MEM_AllocObject failed\n");
16394 -               }
16395 +       /* Create a DCD object. */
16396 +       MEM_AllocObject(pDcdMgr, struct DCD_MANAGER, SIGNATURE);
16397 +       if (pDcdMgr != NULL) {
16398 +               /* Fill out the object. */
16399 +               pDcdMgr->hCodMgr = hCodMgr;
16400 +
16401 +               /* Return handle to this DCD interface. */
16402 +               *phDcdMgr = pDcdMgr;
16403 +
16404 +               GT_2trace(curTrace, GT_5CLASS,
16405 +                        "DCD_CreateManager: pDcdMgr 0x%x, "
16406 +                        " hCodMgr 0x%x", pDcdMgr, hCodMgr);
16407         } else {
16408 -               status = DSP_EFAIL;
16409 +               status = DSP_EMEMORY;
16410 +
16411 +               /*
16412 +                * If allocation of DcdManager object failed, delete the
16413 +                * COD manager.
16414 +                */
16415 +               COD_Delete(hCodMgr);
16416 +
16417                 GT_0trace(curTrace, GT_6CLASS,
16418 -                        "DCD_CreateManager: COD_Create failed\n");
16419 +                        "DCD_CreateManager: MEM_AllocObject failed\n");
16420         }
16421  
16422         DBC_Ensure((DSP_SUCCEEDED(status)) || ((hCodMgr == NULL) &&
16423 -                 (status == DSP_EFAIL)) || ((pDcdMgr == NULL) &&
16424 -                 (status == DSP_EMEMORY)));
16425 +                       (status == DSP_EFAIL)) || ((pDcdMgr == NULL) &&
16426 +                       (status == DSP_EMEMORY)));
16427  
16428 +func_end:
16429         return status;
16430  }
16431  
16432 @@ -260,7 +215,6 @@ DSP_STATUS DCD_DestroyManager(IN struct 
16433                  hDcdMgr);
16434  
16435         if (IsValidHandle(hDcdMgr)) {
16436 -
16437                 /* Delete the COD manager. */
16438                 COD_Delete(pDcdMgr->hCodMgr);
16439  
16440 @@ -318,15 +272,15 @@ DSP_STATUS DCD_EnumerateObject(IN s32 cI
16441                  * Pre-determine final key length. It's length of DCD_REGKEY +
16442                  *  "_\0" + length of szObjType string + terminating NULL.
16443                  */
16444 -               dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16445 +               dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16446                 DBC_Assert(dwKeyLen < REG_MAXREGPATHLENGTH);
16447  
16448                 /* Create proper REG key; concatenate DCD_REGKEY with
16449                  * objType. */
16450 -               strncpy(szRegKey, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
16451 -               if ((strlen(szRegKey) + strlen("_\0")) <
16452 +               strncpy(szRegKey, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
16453 +               if ((strlen(szRegKey) + strlen("_\0")) <
16454                    REG_MAXREGPATHLENGTH) {
16455 -                       strncat(szRegKey, "_\0", 2);
16456 +                       strncat(szRegKey, "_\0", 2);
16457                 } else {
16458                         status = DSP_EFAIL;
16459                 }
16460 @@ -340,19 +294,18 @@ DSP_STATUS DCD_EnumerateObject(IN s32 cI
16461                         status = DSP_EFAIL;
16462                 } else {
16463                         status = DSP_SOK;
16464 -                       if ((strlen(szRegKey) + strlen(szObjType)) <
16465 +                       if ((strlen(szRegKey) + strlen(szObjType)) <
16466                            REG_MAXREGPATHLENGTH) {
16467 -                               strncat(szRegKey, szObjType,
16468 -                                          strlen(szObjType) + 1);
16469 +                               strncat(szRegKey, szObjType,
16470 +                                       strlen(szObjType) + 1);
16471                         } else {
16472                                 status = DSP_EFAIL;
16473                         }
16474                 }
16475  
16476                 if (DSP_SUCCEEDED(status)) {
16477 -                       status = REG_EnumValue(NULL, cIndex, szRegKey, szValue,
16478 -                                             &dwValueSize, szData,
16479 -                                             &dwDataSize);
16480 +                       status = REG_EnumValue(cIndex, szRegKey, szValue,
16481 +                                       &dwValueSize, szData, &dwDataSize);
16482                 }
16483  
16484                 if (DSP_SUCCEEDED(status)) {
16485 @@ -397,9 +350,7 @@ void DCD_Exit(void)
16486  
16487         cRefs--;
16488         if (cRefs == 0) {
16489 -               REG_Exit();
16490                 COD_Exit();
16491 -               MEM_Exit();
16492         }
16493  
16494         DBC_Ensure(cRefs >= 0);
16495 @@ -449,7 +400,7 @@ DSP_STATUS DCD_GetNumDepLibs(IN struct D
16496                  hDcdMgr);
16497  
16498         status = GetDepLibInfo(hDcdMgr, pUuid, pNumLibs, pNumPersLibs,
16499 -                             NULL, NULL, phase);
16500 +                               NULL, NULL, phase);
16501  
16502         return status;
16503  }
16504 @@ -461,9 +412,9 @@ DSP_STATUS DCD_GetNumDepLibs(IN struct D
16505   *      object type.
16506   */
16507  DSP_STATUS DCD_GetObjectDef(IN struct DCD_MANAGER *hDcdMgr,
16508 -                          IN struct DSP_UUID *pObjUuid,
16509 -                          IN enum DSP_DCDOBJTYPE objType,
16510 -                          OUT struct DCD_GENERICOBJ *pObjDef)
16511 +                       IN struct DSP_UUID *pObjUuid,
16512 +                       IN enum DSP_DCDOBJTYPE objType,
16513 +                       OUT struct DCD_GENERICOBJ *pObjDef)
16514  {
16515         struct DCD_MANAGER *pDcdMgr = hDcdMgr;  /* pointer to DCD manager */
16516         struct COD_LIBRARYOBJ *lib = NULL;
16517 @@ -488,8 +439,10 @@ DSP_STATUS DCD_GetObjectDef(IN struct DC
16518                  " 0x%x, objType 0x%x, pObjDef 0x%x\n", hDcdMgr, pObjUuid,
16519                  objType, pObjDef);
16520         szUuid = (char *)MEM_Calloc(MAXUUIDLEN, MEM_PAGED);
16521 -       if (!szUuid)
16522 -               return status = DSP_EMEMORY;
16523 +       if (!szUuid) {
16524 +               status = DSP_EMEMORY;
16525 +               goto func_end;
16526 +       }
16527  
16528         if (!IsValidHandle(hDcdMgr)) {
16529                 status = DSP_EHANDLE;
16530 @@ -497,15 +450,17 @@ DSP_STATUS DCD_GetObjectDef(IN struct DC
16531                          "DCD manager handle.\n");
16532                 goto func_end;
16533         }
16534 -        /* Pre-determine final key length. It's length of DCD_REGKEY +
16535 +
16536 +       /* Pre-determine final key length. It's length of DCD_REGKEY +
16537          *  "_\0" + length of szObjType string + terminating NULL */
16538 -       dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16539 +       dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16540         DBC_Assert(dwKeyLen < REG_MAXREGPATHLENGTH);
16541 +
16542         /* Create proper REG key; concatenate DCD_REGKEY with objType. */
16543 -       strncpy(szRegKey, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
16544 +       strncpy(szRegKey, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
16545  
16546 -       if ((strlen(szRegKey) + strlen("_\0")) < REG_MAXREGPATHLENGTH)
16547 -               strncat(szRegKey, "_\0", 2);
16548 +       if ((strlen(szRegKey) + strlen("_\0")) < REG_MAXREGPATHLENGTH)
16549 +               strncat(szRegKey, "_\0", 2);
16550         else
16551                 status = DSP_EFAIL;
16552  
16553 @@ -515,33 +470,34 @@ DSP_STATUS DCD_GetObjectDef(IN struct DC
16554         } else {
16555                 status = DSP_SOK;
16556  
16557 -               if ((strlen(szRegKey) + strlen(szObjType)) <
16558 +               if ((strlen(szRegKey) + strlen(szObjType)) <
16559                    REG_MAXREGPATHLENGTH) {
16560 -                       strncat(szRegKey, szObjType, strlen(szObjType) + 1);
16561 +                       strncat(szRegKey, szObjType, strlen(szObjType) + 1);
16562                 } else {
16563                         status = DSP_EFAIL;
16564                 }
16565 +
16566                 /* Create UUID value to set in registry. */
16567                 UUID_UuidToString(pObjUuid, szUuid, MAXUUIDLEN);
16568  
16569 -               if ((strlen(szRegKey) + MAXUUIDLEN) < REG_MAXREGPATHLENGTH)
16570 -                       strncat(szRegKey, szUuid, MAXUUIDLEN);
16571 -               else
16572 +               if ((strlen(szRegKey) + MAXUUIDLEN) < REG_MAXREGPATHLENGTH)
16573 +                       strncat(szRegKey, szUuid, MAXUUIDLEN);
16574 +               else
16575                         status = DSP_EFAIL;
16576  
16577                 /* Retrieve paths from the registry based on struct DSP_UUID */
16578                 dwBufSize = REG_MAXREGPATHLENGTH;
16579         }
16580 -       if (DSP_SUCCEEDED(status)) {
16581 -               status = REG_GetValue(NULL, szRegKey, szRegKey, (u8 *)szRegData,
16582 -                                    &dwBufSize);
16583 -       }
16584 +       if (DSP_SUCCEEDED(status))
16585 +               status = REG_GetValue(szRegKey, (u8 *)szRegData, &dwBufSize);
16586 +
16587         if (DSP_FAILED(status)) {
16588                 status = DSP_EUUID;
16589                 GT_0trace(curTrace, GT_6CLASS, "DCD_GetObjectDef: "
16590                          "REG_GetValue() failed\n");
16591                 goto func_end;
16592         }
16593 +
16594         /* Open COFF file. */
16595         status = COD_Open(pDcdMgr->hCodMgr, szRegData, COD_NOLOAD, &lib);
16596         if (DSP_FAILED(status)) {
16597 @@ -550,13 +506,16 @@ DSP_STATUS DCD_GetObjectDef(IN struct DC
16598                          "COD_OpenBase() failed\n");
16599                 goto func_end;
16600         }
16601 +
16602         /* Ensure szUuid + 1 is not greater than sizeof szSectName. */
16603 -       DBC_Assert((strlen(szUuid) + 1) < sizeof(szSectName));
16604 +       DBC_Assert((strlen(szUuid) + 1) < sizeof(szSectName));
16605 +
16606         /* Create section name based on node UUID. A period is
16607          * pre-pended to the UUID string to form the section name.
16608          * I.e. ".24BC8D90_BB45_11d4_B756_006008BDB66F" */
16609 -       strncpy(szSectName, ".", 2);
16610 -       strncat(szSectName, szUuid, strlen(szUuid));
16611 +       strncpy(szSectName, ".", 2);
16612 +       strncat(szSectName, szUuid, strlen(szUuid));
16613 +
16614         /* Get section information. */
16615         status = COD_GetSection(lib, szSectName, &ulAddr, &ulLen);
16616         if (DSP_FAILED(status)) {
16617 @@ -565,10 +524,11 @@ DSP_STATUS DCD_GetObjectDef(IN struct DC
16618                          " COD_GetSection() failed\n");
16619                 goto func_end;
16620         }
16621 +
16622         /* Allocate zeroed buffer. */
16623         pszCoffBuf = MEM_Calloc(ulLen + 4, MEM_PAGED);
16624  #ifdef _DB_TIOMAP
16625 -       if (strstr(szRegData, "iva") == NULL) {
16626 +       if (strstr(szRegData, "iva") == NULL) {
16627                 /* Locate section by objectID and read its content. */
16628                 status = COD_ReadSection(lib, szSectName, pszCoffBuf, ulLen);
16629         } else {
16630 @@ -581,13 +541,14 @@ DSP_STATUS DCD_GetObjectDef(IN struct DC
16631  #endif
16632         if (DSP_SUCCEEDED(status)) {
16633                 /* Compres DSP buffer to conform to PC format. */
16634 -               if (strstr(szRegData, "iva") == NULL) {
16635 +               if (strstr(szRegData, "iva") == NULL) {
16636                         CompressBuf(pszCoffBuf, ulLen, DSPWORDSIZE);
16637                 } else {
16638                         CompressBuf(pszCoffBuf, ulLen, 1);
16639                         GT_0trace(curTrace, GT_4CLASS, "Compressing IVA "
16640                                  "COFF buffer by 1 for IVA !!\n");
16641                 }
16642 +
16643                 /* Parse the content of the COFF buffer. */
16644                 status = GetAttrsFromBuf(pszCoffBuf, ulLen, objType, pObjDef);
16645                 if (DSP_FAILED(status)) {
16646 @@ -600,6 +561,7 @@ DSP_STATUS DCD_GetObjectDef(IN struct DC
16647                 GT_0trace(curTrace, GT_6CLASS, "DCD_GetObjectDef: "
16648                          "COD_ReadSection() failed\n");
16649         }
16650 +
16651         /* Free the previously allocated dynamic buffer. */
16652         MEM_Free(pszCoffBuf);
16653  func_end:
16654 @@ -608,6 +570,7 @@ func_end:
16655  
16656         if (szUuid)
16657                 MEM_Free(szUuid);
16658 +
16659         return status;
16660  }
16661  
16662 @@ -638,6 +601,7 @@ DSP_STATUS DCD_GetObjects(IN struct DCD_
16663                          "DCD_GetObjects: invalid DCD manager handle.\n");
16664                 goto func_end;
16665         }
16666 +
16667         /* Open DSP coff file, don't load symbols. */
16668         status = COD_Open(pDcdMgr->hCodMgr, pszCoffPath, COD_NOLOAD, &lib);
16669         if (DSP_FAILED(status)) {
16670 @@ -646,6 +610,7 @@ DSP_STATUS DCD_GetObjects(IN struct DCD_
16671                          "DCD_AutoRegister: COD_Open() failed\n");
16672                 goto func_cont;
16673         }
16674 +
16675         /* Get DCD_RESIGER_SECTION section information. */
16676         status = COD_GetSection(lib, DCD_REGISTER_SECTION, &ulAddr, &ulLen);
16677         if (DSP_FAILED(status) ||  !(ulLen > 0)) {
16678 @@ -655,6 +620,7 @@ DSP_STATUS DCD_GetObjects(IN struct DCD_
16679                          "- no auto register section\n");
16680                 goto func_cont;
16681         }
16682 +
16683         /* Allocate zeroed buffer. */
16684         pszCoffBuf = MEM_Calloc(ulLen + 4, MEM_PAGED);
16685  #ifdef _DB_TIOMAP
16686 @@ -681,15 +647,19 @@ DSP_STATUS DCD_GetObjects(IN struct DCD_
16687                         GT_0trace(curTrace, GT_4CLASS, "Compress COFF buffer "
16688                                  "with 1 word for IVA !!\n");
16689                 }
16690 +
16691                 /* Read from buffer and register object in buffer. */
16692                 pszCur = pszCoffBuf;
16693                 while ((pToken = strsep(&pszCur, seps)) && *pToken != '\0') {
16694                         /*  Retrieve UUID string. */
16695                         UUID_UuidFromString(pToken, &dspUuid);
16696 +
16697                         /*  Retrieve object type */
16698                         pToken = strsep(&pszCur, seps);
16699 +
16700                         /*  Retrieve object type */
16701                         cObjectType = Atoi(pToken);
16702 +
16703                         /*
16704                          *  Apply registerFxn to the found DCD object.
16705                          *  Possible actions include:
16706 @@ -718,6 +688,7 @@ DSP_STATUS DCD_GetObjects(IN struct DCD_
16707                 GT_0trace(curTrace, GT_6CLASS, "DCD_GetObjects: "
16708                          "COD_ReadSection() failed\n");
16709         }
16710 +
16711         /* Free the previously allocated dynamic buffer. */
16712         MEM_Free(pszCoffBuf);
16713  func_cont:
16714 @@ -735,9 +706,9 @@ func_end:
16715   *
16716   */
16717  DSP_STATUS DCD_GetLibraryName(IN struct DCD_MANAGER *hDcdMgr,
16718 -                            IN struct DSP_UUID *pUuid,
16719 -                            IN OUT char *pstrLibName, IN OUT u32 *pdwSize,
16720 -                            enum NLDR_PHASE phase, OUT bool *fPhaseSplit)
16721 +                       IN struct DSP_UUID *pUuid,
16722 +                       IN OUT char *pstrLibName, IN OUT u32 *pdwSize,
16723 +                       enum NLDR_PHASE phase, OUT bool *fPhaseSplit)
16724  {
16725         char szRegKey[REG_MAXREGPATHLENGTH];
16726         char szUuid[MAXUUIDLEN];
16727 @@ -754,16 +725,18 @@ DSP_STATUS DCD_GetLibraryName(IN struct 
16728                  "DCD_GetLibraryName: hDcdMgr 0x%x, pUuid 0x%x, "
16729                  " pstrLibName 0x%x, pdwSize 0x%x\n", hDcdMgr, pUuid,
16730                  pstrLibName, pdwSize);
16731 +
16732         /*
16733          *  Pre-determine final key length. It's length of DCD_REGKEY +
16734          *  "_\0" + length of szObjType string + terminating NULL.
16735          */
16736 -       dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16737 +       dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16738         DBC_Assert(dwKeyLen < REG_MAXREGPATHLENGTH);
16739 +
16740         /* Create proper REG key; concatenate DCD_REGKEY with objType. */
16741 -       strncpy(szRegKey, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
16742 -       if ((strlen(szRegKey) + strlen("_\0")) < REG_MAXREGPATHLENGTH)
16743 -               strncat(szRegKey, "_\0", 2);
16744 +       strncpy(szRegKey, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
16745 +       if ((strlen(szRegKey) + strlen("_\0")) < REG_MAXREGPATHLENGTH)
16746 +               strncat(szRegKey, "_\0", 2);
16747         else
16748                 status = DSP_EFAIL;
16749  
16750 @@ -785,60 +758,56 @@ DSP_STATUS DCD_GetLibraryName(IN struct 
16751                 sprintf(szObjType, "%d", DSP_DCDLIBRARYTYPE);
16752                 break;
16753         default:
16754 -               status = -1;
16755 +               status = DSP_EINVALIDARG;
16756                 DBC_Assert(false);
16757         }
16758 -       if (status == -1) {
16759 -               status = DSP_EFAIL;
16760 -       } else {
16761 -               status = DSP_SOK;
16762 -               if ((strlen(szRegKey) + strlen(szObjType))
16763 -                  < REG_MAXREGPATHLENGTH) {
16764 -                       strncat(szRegKey, szObjType, strlen(szObjType) + 1);
16765 +       if (DSP_SUCCEEDED(status)) {
16766 +               if ((strlen(szRegKey) + strlen(szObjType)) <
16767 +                  REG_MAXREGPATHLENGTH) {
16768 +                       strncat(szRegKey, szObjType, strlen(szObjType) + 1);
16769                 } else {
16770                         status = DSP_EFAIL;
16771                 }
16772                 /* Create UUID value to find match in registry. */
16773                 UUID_UuidToString(pUuid, szUuid, MAXUUIDLEN);
16774 -               if ((strlen(szRegKey) + MAXUUIDLEN) <
16775 +               if ((strlen(szRegKey) + MAXUUIDLEN) <
16776                    REG_MAXREGPATHLENGTH) {
16777 -                       strncat(szRegKey, szUuid, MAXUUIDLEN);
16778 +                       strncat(szRegKey, szUuid, MAXUUIDLEN);
16779                 } else {
16780                         status = DSP_EFAIL;
16781                 }
16782         }
16783         if (DSP_SUCCEEDED(status)) {
16784                 /* Retrieve path from the registry based on DSP_UUID */
16785 -               status = REG_GetValue(NULL, szRegKey, szRegKey,
16786 -                                       (u8 *)pstrLibName, pdwSize);
16787 +               status = REG_GetValue(szRegKey, (u8 *)pstrLibName, pdwSize);
16788         }
16789 +
16790         /* If can't find, phases might be registered as generic LIBRARYTYPE */
16791         if (DSP_FAILED(status) && phase != NLDR_NOPHASE) {
16792                 if (fPhaseSplit)
16793                         *fPhaseSplit = false;
16794  
16795 -               strncpy(szRegKey, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
16796 -               if ((strlen(szRegKey) + strlen("_\0")) <
16797 +               strncpy(szRegKey, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
16798 +               if ((strlen(szRegKey) + strlen("_\0")) <
16799                    REG_MAXREGPATHLENGTH) {
16800 -                       strncat(szRegKey, "_\0", 2);
16801 +                       strncat(szRegKey, "_\0", 2);
16802                 } else {
16803                         status = DSP_EFAIL;
16804                 }
16805                 sprintf(szObjType, "%d", DSP_DCDLIBRARYTYPE);
16806 -               if ((strlen(szRegKey) + strlen(szObjType))
16807 +               if ((strlen(szRegKey) + strlen(szObjType))
16808                    < REG_MAXREGPATHLENGTH) {
16809 -                       strncat(szRegKey, szObjType, strlen(szObjType) + 1);
16810 +                       strncat(szRegKey, szObjType, strlen(szObjType) + 1);
16811                 } else {
16812                         status = DSP_EFAIL;
16813                 }
16814                 UUID_UuidToString(pUuid, szUuid, MAXUUIDLEN);
16815 -               if ((strlen(szRegKey) + MAXUUIDLEN) < REG_MAXREGPATHLENGTH)
16816 -                       strncat(szRegKey, szUuid, MAXUUIDLEN);
16817 -               else
16818 +               if ((strlen(szRegKey) + MAXUUIDLEN) < REG_MAXREGPATHLENGTH)
16819 +                       strncat(szRegKey, szUuid, MAXUUIDLEN);
16820 +               else
16821                         status = DSP_EFAIL;
16822  
16823 -               status = REG_GetValue(NULL, szRegKey, szRegKey,
16824 -                                       (u8 *)pstrLibName, pdwSize);
16825 +               status = REG_GetValue(szRegKey, (u8 *)pstrLibName, pdwSize);
16826         }
16827  
16828         return status;
16829 @@ -851,8 +820,6 @@ DSP_STATUS DCD_GetLibraryName(IN struct 
16830   */
16831  bool DCD_Init(void)
16832  {
16833 -       bool fInitMEM;
16834 -       bool fInitREG;
16835         bool fInitCOD;
16836         bool fInit = true;
16837  
16838 @@ -862,24 +829,15 @@ bool DCD_Init(void)
16839                  cRefs);
16840  
16841         if (cRefs == 0) {
16842 -
16843                 /* Initialize required modules. */
16844 -               fInitMEM = MEM_Init();
16845                 fInitCOD = COD_Init();
16846 -               fInitREG = REG_Init();
16847 -               if (!fInitMEM || !fInitCOD || !fInitREG) {
16848 +
16849 +               if (!fInitCOD) {
16850                         fInit = false;
16851                         GT_0trace(curTrace, GT_6CLASS, "DCD_Init failed\n");
16852                         /* Exit initialized modules. */
16853 -                       if (fInitMEM)
16854 -                               MEM_Exit();
16855 -
16856                         if (fInitCOD)
16857                                 COD_Exit();
16858 -
16859 -                       if (fInitREG)
16860 -                               REG_Exit();
16861 -
16862                 }
16863         }
16864  
16865 @@ -902,92 +860,89 @@ bool DCD_Init(void)
16866   *      If pszPathName == NULL, unregister the specified DCD object.
16867   */
16868  DSP_STATUS DCD_RegisterObject(IN struct DSP_UUID *pUuid,
16869 -                            IN enum DSP_DCDOBJTYPE objType,
16870 -                            IN char *pszPathName)
16871 +                       IN enum DSP_DCDOBJTYPE objType,
16872 +                       IN char *pszPathName)
16873  {
16874         DSP_STATUS status = DSP_SOK;
16875         char szRegKey[REG_MAXREGPATHLENGTH];
16876         char szUuid[MAXUUIDLEN + 1];
16877         u32 dwPathSize = 0;
16878 -       u32 dwKeyLen;           /* Len of REG key. */
16879 +       u32 dwKeyLen;                           /* Len of REG key. */
16880         char szObjType[MAX_INT2CHAR_LENGTH];    /* str. rep. of objType. */
16881  
16882         DBC_Require(cRefs > 0);
16883         DBC_Require(pUuid != NULL);
16884         DBC_Require((objType == DSP_DCDNODETYPE) ||
16885 -                  (objType == DSP_DCDPROCESSORTYPE) ||
16886 -                  (objType == DSP_DCDLIBRARYTYPE) ||
16887 -                  (objType == DSP_DCDCREATELIBTYPE) ||
16888 -                  (objType == DSP_DCDEXECUTELIBTYPE) ||
16889 -                  (objType == DSP_DCDDELETELIBTYPE));
16890 +                       (objType == DSP_DCDPROCESSORTYPE) ||
16891 +                       (objType == DSP_DCDLIBRARYTYPE) ||
16892 +                       (objType == DSP_DCDCREATELIBTYPE) ||
16893 +                       (objType == DSP_DCDEXECUTELIBTYPE) ||
16894 +                       (objType == DSP_DCDDELETELIBTYPE));
16895  
16896         GT_3trace(curTrace, GT_ENTER, "DCD_RegisterObject: object UUID 0x%x, "
16897                  "objType %d, szPathName %s\n", pUuid, objType, pszPathName);
16898 +
16899         /*
16900          * Pre-determine final key length. It's length of DCD_REGKEY +
16901          *  "_\0" + length of szObjType string + terminating NULL.
16902          */
16903 -       dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16904 +       dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16905         DBC_Assert(dwKeyLen < REG_MAXREGPATHLENGTH);
16906 +
16907         /* Create proper REG key; concatenate DCD_REGKEY with objType. */
16908 -       strncpy(szRegKey, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
16909 -       if ((strlen(szRegKey) + strlen("_\0")) < REG_MAXREGPATHLENGTH)
16910 -               strncat(szRegKey, "_\0", 2);
16911 -       else
16912 +       strncpy(szRegKey, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
16913 +       if ((strlen(szRegKey) + strlen("_\0")) < REG_MAXREGPATHLENGTH)
16914 +               strncat(szRegKey, "_\0", 2);
16915 +       else {
16916                 status = DSP_EFAIL;
16917 +               goto func_end;
16918 +       }
16919  
16920         status = snprintf(szObjType, MAX_INT2CHAR_LENGTH, "%d", objType);
16921         if (status == -1) {
16922                 status = DSP_EFAIL;
16923         } else {
16924                 status = DSP_SOK;
16925 -               if ((strlen(szRegKey) + strlen(szObjType)) <
16926 +               if ((strlen(szRegKey) + strlen(szObjType)) <
16927                    REG_MAXREGPATHLENGTH) {
16928 -                       strncat(szRegKey, szObjType, strlen(szObjType) + 1);
16929 -               } else {
16930 +                       strncat(szRegKey, szObjType, strlen(szObjType) + 1);
16931 +               } else
16932                         status = DSP_EFAIL;
16933 -               }
16934 +
16935                 /* Create UUID value to set in registry. */
16936                 UUID_UuidToString(pUuid, szUuid, MAXUUIDLEN);
16937 -               if ((strlen(szRegKey) + MAXUUIDLEN) < REG_MAXREGPATHLENGTH)
16938 -                       strncat(szRegKey, szUuid, MAXUUIDLEN);
16939 -               else
16940 +               if ((strlen(szRegKey) + MAXUUIDLEN) < REG_MAXREGPATHLENGTH)
16941 +                       strncat(szRegKey, szUuid, MAXUUIDLEN);
16942 +               else
16943                         status = DSP_EFAIL;
16944 -
16945         }
16946  
16947 -       if (DSP_SUCCEEDED(status)) {
16948 -               /*
16949 -                * If pszPathName != NULL, perform registration, otherwise,
16950 -                * perform unregistration.
16951 -                */
16952 -               if (pszPathName) {
16953 -                       /* Add new reg value (UUID+objType) with COFF path
16954 -                        * info. */
16955 -                       dwPathSize = strlen(pszPathName) + 1;
16956 -                       status = REG_SetValue(NULL, szRegKey, szRegKey, REG_SZ,
16957 -                                            (u8 *)pszPathName, dwPathSize);
16958 -                       GT_3trace(curTrace, GT_6CLASS,
16959 -                                "REG_SetValue  REG_SZ=%d, "
16960 -                                "(u8 *)pszPathName=%s, dwPathSize=%d\n",
16961 -                                REG_SZ, pszPathName, dwPathSize);
16962 -                       if (DSP_FAILED(status)) {
16963 -                               status = DSP_EFAIL;
16964 -                               GT_0trace(curTrace, GT_6CLASS,
16965 -                                 "DCD_RegisterObject: REG_SetValue failed!\n");
16966 -                       }
16967 -               } else {
16968 -                       /* Deregister an existing object. */
16969 -                       status = REG_DeleteValue(NULL, szRegKey, szRegKey);
16970 -                       if (DSP_FAILED(status)) {
16971 -                               status = DSP_EFAIL;
16972 -                               GT_0trace(curTrace, GT_6CLASS,
16973 -                                       "DCD_UnregisterObject: "
16974 -                                       "REG_DeleteValue failed!\n");
16975 -                       }
16976 -               }
16977 +       if (DSP_FAILED(status))
16978 +               goto func_end;
16979 +
16980 +       /*
16981 +        * If pszPathName != NULL, perform registration, otherwise,
16982 +        * perform unregistration.
16983 +        */
16984 +       if (pszPathName) {
16985 +               /* Add new reg value (UUID+objType) with COFF path info */
16986 +               dwPathSize = strlen(pszPathName) + 1;
16987 +               status = REG_SetValue(szRegKey, (u8 *)pszPathName, dwPathSize);
16988 +               GT_2trace(curTrace, GT_6CLASS, "REG_SetValue  "
16989 +                         "(u8 *)pszPathName=%s, dwPathSize=%d\n",
16990 +                         pszPathName, dwPathSize);
16991 +               if (DSP_FAILED(status))
16992 +                       GT_0trace(curTrace, GT_6CLASS,
16993 +                               "DCD_RegisterObject: REG_SetValue failed!\n");
16994 +       } else {
16995 +               /* Deregister an existing object */
16996 +               status = REG_DeleteValue(szRegKey);
16997 +               if (DSP_FAILED(status))
16998 +                       GT_0trace(curTrace, GT_6CLASS, "DCD_UnregisterObject: "
16999 +                               "REG_DeleteValue failed!\n");
17000         }
17001  
17002 +
17003         if (DSP_SUCCEEDED(status)) {
17004                 /*
17005                  *  Because the node database has been updated through a
17006 @@ -996,10 +951,9 @@ DSP_STATUS DCD_RegisterObject(IN struct 
17007                  *  current enumerations to reflect this update in the node
17008                  *  database.
17009                  */
17010 -
17011                 cEnumRefs = 0;
17012         }
17013 -
17014 +func_end:
17015         return status;
17016  }
17017  
17018 @@ -1086,7 +1040,6 @@ static s32 Atoi(char *pszBuf)
17019                                 c = c - 'a' + 10;
17020                         else
17021                                 c -= '0';
17022 -
17023                 }
17024                 result += c;
17025                 ++pch;
17026 @@ -1122,7 +1075,6 @@ static DSP_STATUS GetAttrsFromBuf(char *
17027                     || (objType == DSP_DCDPROCESSORTYPE));
17028         DBC_Require(pGenObj != NULL);
17029  
17030 -
17031         switch (objType) {
17032         case DSP_DCDNODETYPE:
17033                 /*
17034 @@ -1143,12 +1095,12 @@ static DSP_STATUS GetAttrsFromBuf(char *
17035                 token = strsep(&pszCur, seps);
17036  
17037                 /* acName */
17038 -               DBC_Require(token);
17039 +               DBC_Require(token);
17040                 cLen = strlen(token);
17041                 if (cLen > DSP_MAXNAMELEN - 1)
17042                         cLen = DSP_MAXNAMELEN - 1;
17043  
17044 -               strncpy(pGenObj->objData.nodeObj.ndbProps.acName,
17045 +               strncpy(pGenObj->objData.nodeObj.ndbProps.acName,
17046                            token, cLen);
17047                 pGenObj->objData.nodeObj.ndbProps.acName[cLen] = '\0';
17048                 token = strsep(&pszCur, seps);
17049 @@ -1226,31 +1178,43 @@ static DSP_STATUS GetAttrsFromBuf(char *
17050                         Atoi(token);
17051                 token = strsep(&pszCur, seps);
17052  
17053 -               /* char * pstrCreatePhaseFxn */
17054 -               DBC_Require(token);
17055 +               /* char *pstrCreatePhaseFxn */
17056 +               DBC_Require(token);
17057                 cLen = strlen(token);
17058                 pGenObj->objData.nodeObj.pstrCreatePhaseFxn =
17059                         MEM_Calloc(cLen + 1, MEM_PAGED);
17060 +               if (!pGenObj->objData.nodeObj.pstrCreatePhaseFxn) {
17061 +                       status = DSP_EMEMORY;
17062 +                       break;
17063 +               }
17064                 strncpy(pGenObj->objData.nodeObj.pstrCreatePhaseFxn,
17065                         token, cLen);
17066                 pGenObj->objData.nodeObj.pstrCreatePhaseFxn[cLen] = '\0';
17067                 token = strsep(&pszCur, seps);
17068  
17069 -               /* char * pstrExecutePhaseFxn */
17070 -               DBC_Require(token);
17071 +               /* char *pstrExecutePhaseFxn */
17072 +               DBC_Require(token);
17073                 cLen = strlen(token);
17074                 pGenObj->objData.nodeObj.pstrExecutePhaseFxn =
17075                          MEM_Calloc(cLen + 1, MEM_PAGED);
17076 +               if (!pGenObj->objData.nodeObj.pstrExecutePhaseFxn) {
17077 +                       status = DSP_EMEMORY;
17078 +                       break;
17079 +               }
17080                 strncpy(pGenObj->objData.nodeObj.pstrExecutePhaseFxn,
17081                         token, cLen);
17082                 pGenObj->objData.nodeObj.pstrExecutePhaseFxn[cLen] = '\0';
17083                 token = strsep(&pszCur, seps);
17084  
17085 -               /* char * pstrDeletePhaseFxn */
17086 -               DBC_Require(token);
17087 +               /* char *pstrDeletePhaseFxn */
17088 +               DBC_Require(token);
17089                 cLen = strlen(token);
17090                 pGenObj->objData.nodeObj.pstrDeletePhaseFxn =
17091                         MEM_Calloc(cLen + 1, MEM_PAGED);
17092 +               if (!pGenObj->objData.nodeObj.pstrDeletePhaseFxn) {
17093 +                       status = DSP_EMEMORY;
17094 +                       break;
17095 +               }
17096                 strncpy(pGenObj->objData.nodeObj.pstrDeletePhaseFxn,
17097                         token, cLen);
17098                 pGenObj->objData.nodeObj.pstrDeletePhaseFxn[cLen] = '\0';
17099 @@ -1264,11 +1228,15 @@ static DSP_STATUS GetAttrsFromBuf(char *
17100                 pGenObj->objData.nodeObj.uMsgNotifyType = Atoi(token);
17101                 token = strsep(&pszCur, seps);
17102  
17103 -               /* char * pstrIAlgName */
17104 +               /* char *pstrIAlgName */
17105                 if (token) {
17106                         cLen = strlen(token);
17107                         pGenObj->objData.nodeObj.pstrIAlgName =
17108                                 MEM_Calloc(cLen + 1, MEM_PAGED);
17109 +                       if (!pGenObj->objData.nodeObj.pstrIAlgName) {
17110 +                               status = DSP_EMEMORY;
17111 +                               break;
17112 +                       }
17113                         strncpy(pGenObj->objData.nodeObj.pstrIAlgName,
17114                                 token, cLen);
17115                         pGenObj->objData.nodeObj.pstrIAlgName[cLen] = '\0';
17116 @@ -1375,6 +1343,13 @@ static DSP_STATUS GetAttrsFromBuf(char *
17117                 break;
17118         }
17119  
17120 +       /* Check for Memory leak */
17121 +       if (status == DSP_EMEMORY) {
17122 +               MEM_Free(pGenObj->objData.nodeObj.pstrCreatePhaseFxn);
17123 +               MEM_Free(pGenObj->objData.nodeObj.pstrExecutePhaseFxn);
17124 +               MEM_Free(pGenObj->objData.nodeObj.pstrDeletePhaseFxn);
17125 +       }
17126 +
17127         return status;
17128  }
17129  
17130 @@ -1394,7 +1369,6 @@ static void CompressBuf(char *pszBuf, u3
17131                 return;
17132  
17133         for (q = pszBuf; q < (pszBuf + ulBufSize);) {
17134 -
17135                 ch = DspChar2GppChar(q, cCharSize);
17136                 if (ch == '\\') {
17137                         q += cCharSize;
17138 @@ -1430,7 +1404,6 @@ static void CompressBuf(char *pszBuf, u3
17139         /* NULL out remainder of buffer. */
17140         while (p < q)
17141                 *p++ = '\0';
17142 -
17143  }
17144  
17145  /*
17146 @@ -1466,8 +1439,8 @@ static DSP_STATUS GetDepLibInfo(IN struc
17147         char *pszCur;
17148         char *pszFileName = NULL;
17149         struct COD_LIBRARYOBJ *lib = NULL;
17150 -       u32 ulAddr = 0; /* Used by COD_GetSection */
17151 -       u32 ulLen = 0;  /* Used by COD_GetSection */
17152 +       u32 ulAddr = 0;                         /* Used by COD_GetSection */
17153 +       u32 ulLen = 0;                          /* Used by COD_GetSection */
17154         u32 dwDataSize = COD_MAXPATHLENGTH;
17155         char seps[] = ", ";
17156         char *pToken = NULL;
17157 @@ -1500,6 +1473,7 @@ static DSP_STATUS GetDepLibInfo(IN struc
17158                 status = DCD_GetLibraryName(hDcdMgr, pUuid, pszFileName,
17159                          &dwDataSize, phase, NULL);
17160         }
17161 +
17162         /* Open the library */
17163         if (DSP_SUCCEEDED(status)) {
17164                 status = COD_Open(pDcdMgr->hCodMgr, pszFileName,
17165 @@ -1520,7 +1494,7 @@ static DSP_STATUS GetDepLibInfo(IN struc
17166                 goto func_cont;
17167  
17168         /* Allocate zeroed buffer. */
17169 -       pszCoffBuf = MEM_Calloc(ulLen, MEM_PAGED);
17170 +       pszCoffBuf = MEM_Calloc(ulLen + 4, MEM_PAGED);
17171         if (pszCoffBuf == NULL)
17172                 status = DSP_EMEMORY;
17173  
17174 @@ -1531,6 +1505,7 @@ static DSP_STATUS GetDepLibInfo(IN struc
17175  
17176         /* Compress and format DSP buffer to conform to PC format. */
17177         CompressBuf(pszCoffBuf, ulLen, DSPWORDSIZE);
17178 +
17179         /* Read from buffer */
17180         pszCur = pszCoffBuf;
17181         while ((pToken = strsep(&pszCur, seps)) && *pToken != '\0') {
17182 @@ -1570,4 +1545,3 @@ func_cont:
17183  
17184         return status;
17185  }
17186 -
17187 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/disp.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/disp.c
17188 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/disp.c     2011-04-17 17:32:26.000000000 +0100
17189 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/disp.c  2011-05-02 22:36:50.000000000 +0100
17190 @@ -3,6 +3,9 @@
17191   *
17192   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
17193   *
17194 + * Node Dispatcher interface. Communicates with Resource Manager Server
17195 + * (RMS) on DSP. Access to RMS is synchronized in NODE.
17196 + *
17197   * Copyright (C) 2005-2006 Texas Instruments, Inc.
17198   *
17199   * This package is free software;  you can redistribute it and/or modify
17200 @@ -14,38 +17,6 @@
17201   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17202   */
17203  
17204 -
17205 -/*
17206 - *  ======== disp.c ========
17207 - *
17208 - *  Description:
17209 - *      Node Dispatcher interface. Communicates with Resource Manager Server
17210 - *      (RMS) on DSP. Access to RMS is synchronized in NODE.
17211 - *
17212 - *  Public Functions:
17213 - *      DISP_Create
17214 - *      DISP_Delete
17215 - *      DISP_Exit
17216 - *      DISP_Init
17217 - *      DISP_NodeChangePriority
17218 - *      DISP_NodeCreate
17219 - *      DISP_NodeDelete
17220 - *      DISP_NodePause
17221 - *      DISP_NodeRun
17222 - *
17223 - *! Revision History:
17224 - *! =================
17225 - *! 18-Feb-2003 vp      Code review updates
17226 - *! 18-Oct-2002 vp      Ported to Linux platform
17227 - *! 16-May-2002 jeh     Added DISP_DoCinit().
17228 - *! 24-Apr-2002 jeh     Added DISP_MemWrite().
17229 - *! 13-Feb-2002 jeh     Pass system stack size to RMS.
17230 - *! 16-Jan-2002  ag     Added bufsize param to _ChnlAddIOReq() fxn
17231 - *! 10-May-2001 jeh     Code Review cleanup.
17232 - *! 26-Sep-2000 jeh     Fixed status values in SendMessage().
17233 - *! 19-Jun-2000 jeh     Created.
17234 - */
17235 -
17236  /*  ----------------------------------- Host OS */
17237  #include <dspbridge/host_os.h>
17238  
17239 @@ -59,10 +30,8 @@
17240  #include <dspbridge/dbc.h>
17241  
17242  /*  ----------------------------------- OS Adaptation Layer */
17243 -#include <dspbridge/dev.h>
17244  #include <dspbridge/mem.h>
17245  #include <dspbridge/sync.h>
17246 -#include <dspbridge/csl.h>
17247  
17248  /*  ----------------------------------- Link Driver */
17249  #include <dspbridge/wmd.h>
17250 @@ -164,7 +133,7 @@ DSP_STATUS DISP_Create(OUT struct DISP_O
17251         if (DSP_SUCCEEDED(status)) {
17252                 status = DEV_GetChnlMgr(hDevObject, &(pDisp->hChnlMgr));
17253                 if (DSP_SUCCEEDED(status)) {
17254 -                       (void) DEV_GetIntfFxns(hDevObject, &pIntfFxns);
17255 +                       status = DEV_GetIntfFxns(hDevObject, &pIntfFxns);
17256                         pDisp->pIntfFxns = pIntfFxns;
17257                 } else {
17258                         GT_1trace(DISP_DebugMask, GT_6CLASS,
17259 @@ -191,23 +160,22 @@ DSP_STATUS DISP_Create(OUT struct DISP_O
17260                 status = DSP_EFAIL;
17261                 goto func_cont;
17262         }
17263 -       if (DSP_SUCCEEDED(status)) {
17264 -               pDisp->uCharSize = DSPWORDSIZE;
17265 -               pDisp->uWordSize = DSPWORDSIZE;
17266 -               pDisp->uDataMauSize = DSPWORDSIZE;
17267 -               /* Open channels for communicating with the RMS */
17268 -               chnlAttrs.uIOReqs = CHNLIOREQS;
17269 -               chnlAttrs.hEvent = NULL;
17270 -               ulChnlId = pDispAttrs->ulChnlOffset + CHNLTORMSOFFSET;
17271 -               status = (*pIntfFxns->pfnChnlOpen)(&(pDisp->hChnlToDsp),
17272 -                        pDisp->hChnlMgr, CHNL_MODETODSP, ulChnlId, &chnlAttrs);
17273 -               if (DSP_FAILED(status)) {
17274 -                       GT_2trace(DISP_DebugMask, GT_6CLASS,
17275 -                                "DISP_Create:  Channel to RMS "
17276 -                                "open failed, chnl id = %d, status = 0x%x\n",
17277 -                                ulChnlId, status);
17278 -               }
17279 -       }
17280 +
17281 +       pDisp->uCharSize = DSPWORDSIZE;
17282 +       pDisp->uWordSize = DSPWORDSIZE;
17283 +       pDisp->uDataMauSize = DSPWORDSIZE;
17284 +       /* Open channels for communicating with the RMS */
17285 +       chnlAttrs.uIOReqs = CHNLIOREQS;
17286 +       chnlAttrs.hEvent = NULL;
17287 +       ulChnlId = pDispAttrs->ulChnlOffset + CHNLTORMSOFFSET;
17288 +       status = (*pIntfFxns->pfnChnlOpen)(&(pDisp->hChnlToDsp),
17289 +                pDisp->hChnlMgr, CHNL_MODETODSP, ulChnlId, &chnlAttrs);
17290 +       if (DSP_FAILED(status))
17291 +               GT_2trace(DISP_DebugMask, GT_6CLASS,
17292 +                        "DISP_Create:  Channel to RMS "
17293 +                        "open failed, chnl id = %d, status = 0x%x\n",
17294 +                        ulChnlId, status);
17295 +
17296         if (DSP_SUCCEEDED(status)) {
17297                 ulChnlId = pDispAttrs->ulChnlOffset + CHNLFROMRMSOFFSET;
17298                 status = (*pIntfFxns->pfnChnlOpen)(&(pDisp->hChnlFromDsp),
17299 @@ -797,8 +765,8 @@ static DSP_STATUS FillStreamDef(RMS_WORD
17300                  *  1 from total.
17301                  */
17302                 total += sizeof(struct RMS_StrmDef) / sizeof(RMS_WORD) - 1;
17303 -               DBC_Require(strmDef.szDevice);
17304 -               dwLength = strlen(strmDef.szDevice) + 1;
17305 +               DBC_Require(strmDef.szDevice);
17306 +               dwLength = strlen(strmDef.szDevice) + 1;
17307  
17308                 /* Number of RMS_WORDS needed to hold device name */
17309                 uNameLen = (dwLength + uCharsInRMSWord - 1) / uCharsInRMSWord;
17310 @@ -850,7 +818,7 @@ static DSP_STATUS SendMessage(struct DIS
17311                 GT_1trace(DISP_DebugMask, GT_6CLASS,
17312                          "SendMessage: Channel AddIOReq to"
17313                          " RMS failed! Status = 0x%x\n", status);
17314 -               goto func_cont;
17315 +               goto func_end;
17316         }
17317         status = (*pIntfFxns->pfnChnlGetIOC) (hChnl, dwTimeout, &chnlIOC);
17318         if (DSP_SUCCEEDED(status)) {
17319 @@ -870,7 +838,6 @@ static DSP_STATUS SendMessage(struct DIS
17320                          "SendMessage: Channel GetIOC to"
17321                          " RMS failed! Status = 0x%x\n", status);
17322         }
17323 -func_cont:
17324         /* Get the reply */
17325         if (DSP_FAILED(status))
17326                 goto func_end;
17327 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/drv.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/drv.c
17328 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/drv.c      2011-04-17 17:32:28.000000000 +0100
17329 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/drv.c   2011-05-02 22:36:50.000000000 +0100
17330 @@ -3,6 +3,8 @@
17331   *
17332   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
17333   *
17334 + * DSP/BIOS Bridge resource allocation module.
17335 + *
17336   * Copyright (C) 2005-2006 Texas Instruments, Inc.
17337   *
17338   * This package is free software; you can redistribute it and/or modify
17339 @@ -14,82 +16,6 @@
17340   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17341   */
17342  
17343 -
17344 -/*
17345 - *  ======== drv.c ========
17346 - *  Description:
17347 - *      DSP/BIOS Bridge resource allocation module.
17348 - *
17349 - *  Public Functions:
17350 - *      DRV_Create
17351 - *      DRV_Destroy
17352 - *      DRV_Exit
17353 - *      DRV_GetDevObject
17354 - *      DRV_GetDevExtension
17355 - *      DRV_GetFirstDevObject
17356 - *      DRV_GetNextDevObject
17357 - *      DRV_GetNextDevExtension
17358 - *      DRV_Init
17359 - *      DRV_InsertDevObject
17360 - *      DRV_RemoveDevObject
17361 - *      DRV_RequestResources
17362 - *      DRV_ReleaseResources
17363 - *
17364 - *! Revision History
17365 - *! ======== ========
17366 - *! 19-Apr-2004 sb: Replaced OS specific APIs with MEM_AllocPhysMem and
17367 -                   MEM_FreePhysMem. Fixed warnings. Cosmetic updates.
17368 - *! 12-Apr-2004 hp: IVA clean up during bridge-uninstall
17369 - *! 05-Jan-2004 vp: Updated for 24xx platform
17370 - *! 21-Mar-2003 sb: Get SHM size from registry
17371 - *! 10-Feb-2003 vp: Code review updates
17372 - *! 18-Oct-2002 vp: Ported to Linux platform
17373 - *! 30-Oct-2000 kc: Modified usage of REG_SetValue.
17374 - *! 06-Sep-2000 jeh Read channel info into struct CFG_HOSTRES in
17375 - *!                                    RequestISAResources()
17376 - *! 21-Sep-2000 rr: numwindows is calculated instead of default value in
17377 - *!             RequestISAResources.
17378 - *! 07-Aug-2000 rr: static list of dev objects removed.
17379 - *! 27-Jul-2000 rr: RequestResources split into two(Request and Release)
17380 - *!             Device extension created to hold the DevNodeString.
17381 - *! 17-Jul-2000 rr: Driver Object holds the list of Device Objects.
17382 - *!             Added DRV_Create, DRV_Destroy, DRV_GetDevObject,
17383 - *!             DRV_GetFirst/NextDevObject, DRV_Insert/RemoveDevObject.
17384 - *! 09-May-2000 rr: PCI Support is not L301 specific.Use of MEM_Calloc
17385 - *!             instead of MEM_Alloc.
17386 - *! 28-Mar-2000 rr: PCI Support added. L301 Specific. TBD.
17387 - *! 03-Feb-2000 rr: GT and Module Init/exit Changes. Merged with kc.
17388 - *! 19-Jan-2000 rr: DBC_Ensure in RequestPCMCIA moved within PCCARD ifdef
17389 - *! 29-Dec-1999 rr: PCCard support for any slot.Bus type stored in the
17390 - *!             struct CFG_HOSTRES Structure.
17391 - *! 17-Dec-1999 rr: if PCCARD_Init fails we return DSP_EFAIL.
17392 - *!             DBC_Ensure checks for sucess and pDevice != NULL
17393 - *! 11-Dec-1999 ag: #define "Isa" renamed to "IsaBus".
17394 - *! 09-Dec-1999 rr: windows.h included to remove warnings.
17395 - *! 02-Dec-1999 rr: struct GT_Mask is with in if DEBUG. Request resources checks
17396 - *!             status while making call to Reg functions.
17397 - *! 23-Nov-1999 rr: windows.h included
17398 - *! 19-Nov-1999 rr: DRV_RELEASE bug while setting the registry to zero.
17399 - *!             fixed.
17400 - *! 12-Nov-1999 rr: RequestResources() reads values from the registry.
17401 - *!             Hardcoded bIRQRegister define removed.
17402 - *! 05-Nov-1999 rr: Added hardcoded device interrupt.
17403 - *! 25-Oct-1999 rr: Resource structure removed. Now it uses the Host
17404 - *!             Resource structure directly.
17405 - *! 15-Oct-1999 rr: Resource Structure modified. See drv.h
17406 - *!             dwBusType taken from the registry.Hard coded
17407 - *!             registry entries removed.
17408 - *! 05-Oct-1999 rr: Calling DEV_StartDevice moved to wcdce.c. DRV_Register
17409 - *!             MiniDriver has been renamed to DRV_RequestResources.
17410 - *!             DRV_UnRegisterMiniDriver fxn removed.
17411 - *! 24-Sep-1999 rr: Significant changes to the RegisterMiniDriver fxns.
17412 - *!             Now it is simpler. IT stores the dev node in the
17413 - *!             registry, assign resources and calls the DEV_Start.
17414 - *! 10-Sep-1999 rr: Register Minidriver modified.
17415 - *!             - Resource structure follows the NT model
17416 - *! 08-Aug-1999 rr: Adopted for WinCE. Exports Fxns removed. Hull Created.
17417 - */
17418 -
17419  /*  ----------------------------------- Host OS */
17420  #include <dspbridge/host_os.h>
17421  
17422 @@ -104,26 +30,20 @@
17423  
17424  /*  ----------------------------------- OS Adaptation Layer */
17425  #include <dspbridge/cfg.h>
17426 -#include <dspbridge/csl.h>
17427  #include <dspbridge/list.h>
17428  #include <dspbridge/mem.h>
17429  #include <dspbridge/reg.h>
17430  
17431 -/*  ----------------------------------- Others */
17432 -#include <dspbridge/dbreg.h>
17433 -
17434  /*  ----------------------------------- This */
17435  #include <dspbridge/drv.h>
17436  #include <dspbridge/dev.h>
17437  
17438 -#ifndef RES_CLEANUP_DISABLE
17439  #include <dspbridge/node.h>
17440  #include <dspbridge/proc.h>
17441  #include <dspbridge/strm.h>
17442  #include <dspbridge/nodepriv.h>
17443  #include <dspbridge/wmdchnl.h>
17444  #include <dspbridge/resourcecleanup.h>
17445 -#endif
17446  
17447  /*  ----------------------------------- Defines, Data Structures, Typedefs */
17448  #define SIGNATURE   0x5f52474d /* "DRV_" (in reverse) */
17449 @@ -132,9 +52,6 @@ struct DRV_OBJECT {
17450         u32 dwSignature;
17451         struct LST_LIST *devList;
17452         struct LST_LIST *devNodeString;
17453 -#ifndef RES_CLEANUP_DISABLE
17454 -       struct PROCESS_CONTEXT  *procCtxtList;
17455 -#endif
17456  };
17457  
17458  /*
17459 @@ -142,7 +59,7 @@ struct DRV_OBJECT {
17460   *  DRV_ since it is living in this module
17461   */
17462  struct DRV_EXT {
17463 -       struct LST_ELEM link;
17464 +       struct list_head link;
17465         char szString[MAXREGPATHLENGTH];
17466  };
17467  
17468 @@ -157,151 +74,12 @@ extern struct GT_Mask curTrace;
17469  static DSP_STATUS RequestBridgeResources(u32 dwContext, s32 fRequest);
17470  static DSP_STATUS RequestBridgeResourcesDSP(u32 dwContext, s32 fRequest);
17471  
17472 -#ifndef RES_CLEANUP_DISABLE
17473  /* GPP PROCESS CLEANUP CODE */
17474  
17475 -static DSP_STATUS PrintProcessInformation(void);
17476  static DSP_STATUS DRV_ProcFreeNodeRes(HANDLE hPCtxt);
17477  static DSP_STATUS  DRV_ProcFreeSTRMRes(HANDLE hPCtxt);
17478  extern enum NODE_STATE NODE_GetState(HANDLE hNode);
17479  
17480 -/* Get the process context list from driver object */
17481 -
17482 -/* Set the Process ID */
17483 -DSP_STATUS DRV_ProcSetPID(HANDLE hPCtxt, s32 hProcess)
17484 -{
17485 -       struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
17486 -       DSP_STATUS status = DSP_SOK;
17487 -
17488 -       DBC_Assert(hPCtxt != NULL);
17489 -
17490 -       pCtxt->pid = hProcess;
17491 -       return status;
17492 -}
17493 -
17494 -
17495 -/* Getting the head of the process context list */
17496 -DSP_STATUS DRV_GetProcCtxtList(struct PROCESS_CONTEXT **pPctxt,
17497 -                               struct DRV_OBJECT *hDrvObject)
17498 -{
17499 -       DSP_STATUS status = DSP_SOK;
17500 -       struct DRV_OBJECT *pDrvObject = (struct DRV_OBJECT *)hDrvObject;
17501 -
17502 -       DBC_Assert(hDrvObject != NULL);
17503 -       GT_2trace(curTrace, GT_ENTER,
17504 -               "DRV_GetProcCtxtList: 2 *pPctxt:%x, pDrvObject"
17505 -               ":%x", *pPctxt, pDrvObject);
17506 -       *pPctxt = pDrvObject->procCtxtList;
17507 -       GT_2trace(curTrace, GT_ENTER,
17508 -               "DRV_GetProcCtxtList: 3 *pPctxt:%x, pDrvObject"
17509 -               ":%x", *pPctxt, pDrvObject);
17510 -       return status;
17511 -}
17512 -
17513 -/* Add a new process context to process context list */
17514 -DSP_STATUS DRV_InsertProcContext(struct DRV_OBJECT *hDrVObject, HANDLE hPCtxt)
17515 -{
17516 -       struct PROCESS_CONTEXT **pCtxt = (struct PROCESS_CONTEXT **)hPCtxt;
17517 -       DSP_STATUS status = DSP_SOK;
17518 -       struct PROCESS_CONTEXT *pCtxtList = NULL;
17519 -       struct DRV_OBJECT            *hDRVObject;
17520 -
17521 -       GT_0trace(curTrace, GT_ENTER, "\n In DRV_InsertProcContext\n");
17522 -
17523 -       status = CFG_GetObject((u32 *)&hDRVObject, REG_DRV_OBJECT);
17524 -       DBC_Assert(hDRVObject != NULL);
17525 -
17526 -       *pCtxt = MEM_Calloc(1 * sizeof(struct PROCESS_CONTEXT), MEM_PAGED);
17527 -       if (!*pCtxt) {
17528 -               pr_err("DSP: MEM_Calloc failed in DRV_InsertProcContext\n");
17529 -               return DSP_EMEMORY;
17530 -       }
17531 -
17532 -       spin_lock_init(&(*pCtxt)->proc_list_lock);
17533 -       INIT_LIST_HEAD(&(*pCtxt)->processor_list);
17534 -
17535 -       spin_lock_init(&(*pCtxt)->dmm_list_lock);
17536 -
17537 -       GT_0trace(curTrace, GT_ENTER,
17538 -                "\n In DRV_InsertProcContext Calling "
17539 -                "DRV_GetProcCtxtList\n");
17540 -       DRV_GetProcCtxtList(&pCtxtList, hDRVObject);
17541 -       GT_0trace(curTrace, GT_ENTER,
17542 -                "\n In DRV_InsertProcContext After Calling "
17543 -                "DRV_GetProcCtxtList\n");
17544 -       if (pCtxtList != NULL) {
17545 -               GT_0trace(curTrace, GT_ENTER,
17546 -                        "\n In DRV_InsertProcContext and pCtxt is "
17547 -                        "not Null\n");
17548 -               while (pCtxtList->next != NULL)
17549 -                       pCtxtList = pCtxtList->next;
17550 -
17551 -               pCtxtList->next = *pCtxt;
17552 -       } else {
17553 -               GT_0trace(curTrace, GT_ENTER,
17554 -                        "\n In DRV_InsertProcContext and "
17555 -                        "pCtxt is Null\n");
17556 -               hDRVObject->procCtxtList = *pCtxt;
17557 -       }
17558 -       return status;
17559 -}
17560 -
17561 -/* Delete a process context from process resource context list */
17562 -DSP_STATUS DRV_RemoveProcContext(struct DRV_OBJECT *hDRVObject,
17563 -               HANDLE pr_ctxt)
17564 -{
17565 -       DSP_STATUS status = DSP_SOK;
17566 -       struct PROCESS_CONTEXT *pr_ctxt_list = NULL;
17567 -       struct PROCESS_CONTEXT *uninitialized_var(ptr_prev);
17568 -
17569 -       DBC_Assert(hDRVObject != NULL);
17570 -
17571 -       GT_0trace(curTrace, GT_ENTER, "DRV_RemoveProcContext: 12");
17572 -       DRV_GetProcCtxtList(&pr_ctxt_list, hDRVObject);
17573 -
17574 -       /* Special condition */
17575 -       if (pr_ctxt_list == pr_ctxt) {
17576 -               hDRVObject->procCtxtList = NULL;
17577 -               goto func_cont;
17578 -       }
17579 -
17580 -       GT_0trace(curTrace, GT_ENTER, "DRV_RemoveProcContext: 13");
17581 -       while (pr_ctxt_list && (pr_ctxt_list != pr_ctxt)) {
17582 -               ptr_prev = pr_ctxt_list;
17583 -               pr_ctxt_list = pr_ctxt_list->next;
17584 -               GT_0trace(curTrace, GT_ENTER,
17585 -                        "DRV_RemoveProcContext: 2");
17586 -       }
17587 -
17588 -       GT_0trace(curTrace, GT_ENTER, "DRV_RemoveProcContext: 3");
17589 -
17590 -       if (!pr_ctxt_list)
17591 -               return DSP_ENOTFOUND;
17592 -       else
17593 -               ptr_prev->next = pr_ctxt_list->next;
17594 -
17595 -func_cont:
17596 -       MEM_Free(pr_ctxt);
17597 -       GT_0trace(curTrace, GT_ENTER, "DRV_RemoveProcContext: 7");
17598 -
17599 -       return status;
17600 -}
17601 -
17602 -/* Update the state of process context */
17603 -DSP_STATUS DRV_ProcUpdatestate(HANDLE hPCtxt, enum GPP_PROC_RES_STATE status)
17604 -{
17605 -       struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
17606 -       DSP_STATUS status1 = DSP_SOK;
17607 -       if (pCtxt != NULL) {
17608 -               pCtxt->resState = status;
17609 -       } else {
17610 -               GT_0trace(curTrace, GT_ENTER,
17611 -                        "DRV_ProcUpdatestate: Failed to update "
17612 -                        "process state");
17613 -       }
17614 -       return status1;
17615 -}
17616 -
17617  /* Allocate and add a node resource element
17618  * This function is called from .Node_Allocate.  */
17619  DSP_STATUS DRV_InsertNodeResElement(HANDLE hNode, HANDLE hNodeRes,
17620 @@ -314,12 +92,13 @@ DSP_STATUS DRV_InsertNodeResElement(HAND
17621         GT_0trace(curTrace, GT_ENTER, "DRV_InsertNodeResElement: 1");
17622         *pNodeRes = (struct NODE_RES_OBJECT *)MEM_Calloc
17623                     (1 * sizeof(struct NODE_RES_OBJECT), MEM_PAGED);
17624 -       DBC_Assert(hPCtxt != NULL);
17625 -       if ((*pNodeRes == NULL) || (hPCtxt == NULL)) {
17626 +       if (*pNodeRes == NULL) {
17627                 GT_0trace(curTrace, GT_ENTER, "DRV_InsertNodeResElement: 12");
17628                 status = DSP_EHANDLE;
17629         }
17630         if (DSP_SUCCEEDED(status)) {
17631 +               if (mutex_lock_interruptible(&pCtxt->node_mutex))
17632 +                       return DSP_EFAIL;
17633                 (*pNodeRes)->hNode = hNode;
17634                 if (pCtxt->pNodeList != NULL) {
17635                         pTempNodeRes = pCtxt->pNodeList;
17636 @@ -334,6 +113,7 @@ DSP_STATUS DRV_InsertNodeResElement(HAND
17637                         GT_0trace(curTrace, GT_ENTER,
17638                                  "DRV_InsertNodeResElement: 3");
17639                 }
17640 +               mutex_unlock(&pCtxt->node_mutex);
17641         }
17642         GT_0trace(curTrace, GT_ENTER, "DRV_InsertNodeResElement: 4");
17643         return status;
17644 @@ -345,25 +125,24 @@ DSP_STATUS DRV_RemoveNodeResElement(HAND
17645  {
17646         struct NODE_RES_OBJECT *pNodeRes = (struct NODE_RES_OBJECT *)hNodeRes;
17647         struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
17648 -       DSP_STATUS      status = DSP_SOK;
17649 -       struct NODE_RES_OBJECT *pTempNode2 = pCtxt->pNodeList;
17650 -       struct NODE_RES_OBJECT *pTempNode = pCtxt->pNodeList;
17651 +       struct NODE_RES_OBJECT *pTempNode;
17652 +       DSP_STATUS status = DSP_SOK;
17653  
17654 -       DBC_Assert(hPCtxt != NULL);
17655 -       GT_0trace(curTrace, GT_ENTER, "\nDRV_RemoveNodeResElement: 1\n");
17656 -       while ((pTempNode != NULL) && (pTempNode != pNodeRes)) {
17657 -               pTempNode2 = pTempNode;
17658 -               pTempNode = pTempNode->next;
17659 -       }
17660 -       if (pCtxt->pNodeList == pNodeRes)
17661 +       if (mutex_lock_interruptible(&pCtxt->node_mutex))
17662 +               return DSP_EFAIL;
17663 +       pTempNode = pCtxt->pNodeList;
17664 +       if (pTempNode == pNodeRes) {
17665                 pCtxt->pNodeList = pNodeRes->next;
17666 -
17667 -       if (pTempNode == NULL)
17668 -               return DSP_ENOTFOUND;
17669 -       else if (pTempNode2->next != NULL)
17670 -               pTempNode2->next = pTempNode2->next->next;
17671 -
17672 -       MEM_Free(pTempNode);
17673 +       } else {
17674 +               while (pTempNode && pTempNode->next != pNodeRes)
17675 +                       pTempNode = pTempNode->next;
17676 +               if (!pTempNode)
17677 +                       status = DSP_ENOTFOUND;
17678 +               else
17679 +                       pTempNode->next = pNodeRes->next;
17680 +       }
17681 +       mutex_unlock(&pCtxt->node_mutex);
17682 +       MEM_Free(pNodeRes);
17683         return status;
17684  }
17685  
17686 @@ -376,7 +155,6 @@ static DSP_STATUS DRV_ProcFreeNodeRes(HA
17687         struct NODE_RES_OBJECT *pNodeRes = NULL;
17688         u32  nState;
17689  
17690 -       DBC_Assert(hPCtxt != NULL);
17691         pNodeList = pCtxt->pNodeList;
17692         while (pNodeList != NULL) {
17693                 GT_0trace(curTrace, GT_ENTER, "DRV_ProcFreeNodeRes: 1");
17694 @@ -424,13 +202,15 @@ DSP_STATUS DRV_InsertDMMResElement(HANDL
17695  
17696         *pDMMRes = (struct DMM_RES_OBJECT *)
17697                     MEM_Calloc(1 * sizeof(struct DMM_RES_OBJECT), MEM_PAGED);
17698 -       DBC_Assert(hPCtxt != NULL);
17699         GT_0trace(curTrace, GT_ENTER, "DRV_InsertDMMResElement: 1");
17700 -       if ((*pDMMRes == NULL) || (hPCtxt == NULL)) {
17701 +       if (*pDMMRes == NULL) {
17702                 GT_0trace(curTrace, GT_5CLASS, "DRV_InsertDMMResElement: 2");
17703                 status = DSP_EHANDLE;
17704         }
17705         if (DSP_SUCCEEDED(status)) {
17706 +               if (mutex_lock_interruptible(&pCtxt->dmm_mutex))
17707 +                       return DSP_EFAIL;
17708 +
17709                 if (pCtxt->pDMMList != NULL) {
17710                         GT_0trace(curTrace, GT_5CLASS,
17711                                  "DRV_InsertDMMResElement: 3");
17712 @@ -444,43 +224,36 @@ DSP_STATUS DRV_InsertDMMResElement(HANDL
17713                         GT_0trace(curTrace, GT_5CLASS,
17714                                  "DRV_InsertDMMResElement: 4");
17715                 }
17716 +               mutex_unlock(&pCtxt->dmm_mutex);
17717         }
17718         GT_0trace(curTrace, GT_ENTER, "DRV_InsertDMMResElement: 5");
17719         return status;
17720  }
17721  
17722 -
17723 -
17724  /* Release DMM resource element context
17725  * This is called from Proc_UnMap. after the actual resource is freed */
17726  DSP_STATUS DRV_RemoveDMMResElement(HANDLE hDMMRes, HANDLE hPCtxt)
17727  {
17728         struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
17729         struct DMM_RES_OBJECT *pDMMRes = (struct DMM_RES_OBJECT *)hDMMRes;
17730 -       DSP_STATUS status = DSP_SOK;
17731 -       struct DMM_RES_OBJECT *pTempDMMRes2 = NULL;
17732         struct DMM_RES_OBJECT *pTempDMMRes = NULL;
17733 +       DSP_STATUS status = DSP_SOK;
17734  
17735 -       DBC_Assert(hPCtxt != NULL);
17736 -       pTempDMMRes2 = pCtxt->pDMMList;
17737 +       if (mutex_lock_interruptible(&pCtxt->dmm_mutex))
17738 +               return DSP_EFAIL;
17739         pTempDMMRes = pCtxt->pDMMList;
17740 -       GT_0trace(curTrace, GT_ENTER, "DRV_RemoveDMMResElement: 1");
17741 -       while ((pTempDMMRes != NULL) && (pTempDMMRes != pDMMRes)) {
17742 -               GT_0trace(curTrace, GT_ENTER, "DRV_RemoveDMMResElement: 2");
17743 -               pTempDMMRes2 = pTempDMMRes;
17744 -               pTempDMMRes = pTempDMMRes->next;
17745 +       if (pCtxt->pDMMList == pDMMRes) {
17746 +               pCtxt->pDMMList = pDMMRes->next;
17747 +       } else {
17748 +               while (pTempDMMRes && pTempDMMRes->next != pDMMRes)
17749 +                       pTempDMMRes = pTempDMMRes->next;
17750 +               if (!pTempDMMRes)
17751 +                       status = DSP_ENOTFOUND;
17752 +               else
17753 +                       pTempDMMRes->next = pDMMRes->next;
17754         }
17755 -       GT_0trace(curTrace, GT_ENTER, "DRV_RemoveDMMResElement: 3");
17756 -       if (pCtxt->pDMMList == pTempDMMRes)
17757 -               pCtxt->pDMMList = pTempDMMRes->next;
17758 -
17759 -       if (pTempDMMRes == NULL)
17760 -               return DSP_ENOTFOUND;
17761 -       else if (pTempDMMRes2->next != NULL)
17762 -               pTempDMMRes2->next = pTempDMMRes2->next->next;
17763 -
17764 +       mutex_unlock(&pCtxt->dmm_mutex);
17765         MEM_Free(pDMMRes);
17766 -       GT_0trace(curTrace, GT_ENTER, "DRV_RemoveDMMResElement: 4");
17767         return status;
17768  }
17769  
17770 @@ -504,31 +277,34 @@ DSP_STATUS DRV_UpdateDMMResElement(HANDL
17771  }
17772  
17773  /* Actual DMM De-Allocation */
17774 -DSP_STATUS DRV_ProcFreeDMMRes(HANDLE hPCtxt)
17775 +DSP_STATUS  DRV_ProcFreeDMMRes(HANDLE hPCtxt)
17776  {
17777         struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
17778         DSP_STATUS status = DSP_SOK;
17779         struct DMM_RES_OBJECT *pDMMList = pCtxt->pDMMList;
17780         struct DMM_RES_OBJECT *pDMMRes = NULL;
17781  
17782 -       DBC_Assert(hPCtxt != NULL);
17783         GT_0trace(curTrace, GT_ENTER, "\nDRV_ProcFreeDMMRes: 1\n");
17784         while (pDMMList != NULL) {
17785                 pDMMRes = pDMMList;
17786                 pDMMList = pDMMList->next;
17787                 if (pDMMRes->dmmAllocated) {
17788 -                       /* PROC_UnMap frees pDMMRes */
17789 -                       void *processor = pDMMRes->hProcessor;
17790 -                       void *map_addr = (void*)pDMMRes->ulDSPAddr;
17791 -                       void *rsv_addr = (void*)pDMMRes->ulDSPResAddr;
17792 -                       status = PROC_UnMap(processor, map_addr, pCtxt);
17793 -                       status = PROC_UnReserveMemory(processor, rsv_addr);
17794 +                       status = PROC_UnMap(pDMMRes->hProcessor,
17795 +                                (void *)pDMMRes->ulDSPResAddr, pCtxt);
17796 +                       if (DSP_FAILED(status))
17797 +                               pr_debug("%s: PROC_UnMap failed! status ="
17798 +                                               " 0x%xn", __func__, status);
17799 +                       status = PROC_UnReserveMemory(pDMMRes->hProcessor,
17800 +                                (void *)pDMMRes->ulDSPResAddr);
17801 +                       if (DSP_FAILED(status))
17802 +                               pr_debug("%s: PROC_UnReserveMemory failed!"
17803 +                                       " status = 0x%xn", __func__, status);
17804 +                       pDMMRes->dmmAllocated = 0;
17805                 }
17806         }
17807         return status;
17808  }
17809  
17810 -
17811  /* Release all DMM resources and its context
17812  * This is called from .bridge_release. */
17813  DSP_STATUS DRV_RemoveAllDMMResElements(HANDLE hPCtxt)
17814 @@ -538,7 +314,6 @@ DSP_STATUS DRV_RemoveAllDMMResElements(H
17815         struct DMM_RES_OBJECT *pTempDMMRes2 = NULL;
17816         struct DMM_RES_OBJECT *pTempDMMRes = NULL;
17817  
17818 -       DBC_Assert(pCtxt != NULL);
17819         DRV_ProcFreeDMMRes(pCtxt);
17820         pTempDMMRes = pCtxt->pDMMList;
17821         while (pTempDMMRes != NULL) {
17822 @@ -555,19 +330,22 @@ DSP_STATUS DRV_GetDMMResElement(u32 pMap
17823         struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
17824         struct DMM_RES_OBJECT **pDMMRes = (struct DMM_RES_OBJECT **)hDMMRes;
17825         DSP_STATUS status = DSP_SOK;
17826 -       struct DMM_RES_OBJECT *pTempDMM2 = NULL;
17827         struct DMM_RES_OBJECT *pTempDMM = NULL;
17828  
17829 -       DBC_Assert(hPCtxt != NULL);
17830 +       if (mutex_lock_interruptible(&pCtxt->dmm_mutex))
17831 +               return DSP_EFAIL;
17832 +
17833         pTempDMM = pCtxt->pDMMList;
17834         while ((pTempDMM != NULL) && (pTempDMM->ulDSPAddr != pMapAddr)) {
17835                 GT_3trace(curTrace, GT_ENTER,
17836                          "DRV_GetDMMResElement: 2 pTempDMM:%x "
17837                          "pTempDMM->ulDSPAddr:%x pMapAddr:%x\n", pTempDMM,
17838                          pTempDMM->ulDSPAddr, pMapAddr);
17839 -               pTempDMM2 = pTempDMM;
17840                 pTempDMM = pTempDMM->next;
17841         }
17842 +
17843 +       mutex_unlock(&pCtxt->dmm_mutex);
17844 +
17845         if (pTempDMM != NULL) {
17846                 GT_0trace(curTrace, GT_ENTER, "DRV_GetDMMResElement: 3");
17847                 *pDMMRes = pTempDMM;
17848 @@ -603,7 +381,6 @@ DSP_STATUS  DRV_RemoveAllNodeResElements
17849         struct NODE_RES_OBJECT *pTempNode2 = NULL;
17850         struct NODE_RES_OBJECT *pTempNode = NULL;
17851  
17852 -       DBC_Assert(hPCtxt != NULL);
17853         DRV_ProcFreeNodeRes(pCtxt);
17854         pTempNode = pCtxt->pNodeList;
17855         while (pTempNode != NULL) {
17856 @@ -616,7 +393,6 @@ DSP_STATUS  DRV_RemoveAllNodeResElements
17857  }
17858  
17859  /* Getting the node resource element */
17860 -
17861  DSP_STATUS DRV_GetNodeResElement(HANDLE hNode, HANDLE hNodeRes, HANDLE hPCtxt)
17862  {
17863         struct NODE_RES_OBJECT **nodeRes = (struct NODE_RES_OBJECT **)hNodeRes;
17864 @@ -625,13 +401,18 @@ DSP_STATUS DRV_GetNodeResElement(HANDLE 
17865         struct NODE_RES_OBJECT *pTempNode2 = NULL;
17866         struct NODE_RES_OBJECT *pTempNode = NULL;
17867  
17868 -       DBC_Assert(hPCtxt != NULL);
17869 +       if (mutex_lock_interruptible(&pCtxt->node_mutex))
17870 +               return DSP_EFAIL;
17871 +
17872         pTempNode = pCtxt->pNodeList;
17873         GT_0trace(curTrace, GT_ENTER, "DRV_GetNodeResElement: 1");
17874         while ((pTempNode != NULL) && (pTempNode->hNode != hNode)) {
17875                 pTempNode2 = pTempNode;
17876                 pTempNode = pTempNode->next;
17877         }
17878 +
17879 +       mutex_unlock(&pCtxt->node_mutex);
17880 +
17881         if (pTempNode != NULL)
17882                 *nodeRes = pTempNode;
17883         else
17884 @@ -640,8 +421,6 @@ DSP_STATUS DRV_GetNodeResElement(HANDLE 
17885         return status;
17886  }
17887  
17888 -
17889 -
17890  /* Allocate the STRM resource element
17891  * This is called after the actual resource is allocated
17892  */
17893 @@ -652,15 +431,16 @@ DSP_STATUS DRV_ProcInsertSTRMResElement(
17894         struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
17895         DSP_STATUS status = DSP_SOK;
17896         struct STRM_RES_OBJECT *pTempSTRMRes = NULL;
17897 -       DBC_Assert(hPCtxt != NULL);
17898  
17899         *pSTRMRes = (struct STRM_RES_OBJECT *)
17900                     MEM_Calloc(1 * sizeof(struct STRM_RES_OBJECT), MEM_PAGED);
17901 -       if ((*pSTRMRes == NULL) || (hPCtxt == NULL)) {
17902 +       if (*pSTRMRes == NULL) {
17903                 GT_0trace(curTrace, GT_ENTER, "DRV_InsertSTRMResElement: 2");
17904                 status = DSP_EHANDLE;
17905         }
17906         if (DSP_SUCCEEDED(status)) {
17907 +               if (mutex_lock_interruptible(&pCtxt->strm_mutex))
17908 +                       return DSP_EFAIL;
17909                 (*pSTRMRes)->hStream = hStreamHandle;
17910                 if (pCtxt->pSTRMList != NULL) {
17911                         GT_0trace(curTrace, GT_ENTER,
17912 @@ -675,12 +455,11 @@ DSP_STATUS DRV_ProcInsertSTRMResElement(
17913                         GT_0trace(curTrace, GT_ENTER,
17914                                  "DRV_InsertSTRMResElement: 4");
17915                 }
17916 +               mutex_unlock(&pCtxt->strm_mutex);
17917         }
17918         return status;
17919  }
17920  
17921 -
17922 -
17923  /* Release Stream resource element context
17924  * This function called after the actual resource is freed
17925  */
17926 @@ -688,69 +467,62 @@ DSP_STATUS        DRV_ProcRemoveSTRMResElement
17927  {
17928         struct STRM_RES_OBJECT *pSTRMRes = (struct STRM_RES_OBJECT *)hSTRMRes;
17929         struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
17930 +       struct STRM_RES_OBJECT *pTempSTRMRes;
17931         DSP_STATUS status = DSP_SOK;
17932 -       struct STRM_RES_OBJECT *pTempSTRMRes2 = pCtxt->pSTRMList;
17933 -       struct STRM_RES_OBJECT *pTempSTRMRes = pCtxt->pSTRMList;
17934 -
17935 -       DBC_Assert(hPCtxt != NULL);
17936 -       while ((pTempSTRMRes != NULL) && (pTempSTRMRes != pSTRMRes)) {
17937 -               pTempSTRMRes2 = pTempSTRMRes;
17938 -               pTempSTRMRes = pTempSTRMRes->next;
17939 -       }
17940 -       if (pCtxt->pSTRMList == pTempSTRMRes)
17941 -               pCtxt->pSTRMList = pTempSTRMRes->next;
17942  
17943 -       if (pTempSTRMRes == NULL)
17944 -               status = DSP_ENOTFOUND;
17945 -       else if (pTempSTRMRes2->next != NULL)
17946 -               pTempSTRMRes2->next = pTempSTRMRes2->next->next;
17947 +       if (mutex_lock_interruptible(&pCtxt->strm_mutex))
17948 +               return DSP_EFAIL;
17949 +       pTempSTRMRes = pCtxt->pSTRMList;
17950  
17951 +       if (pCtxt->pSTRMList == pSTRMRes) {
17952 +               pCtxt->pSTRMList = pSTRMRes->next;
17953 +       } else {
17954 +               while (pTempSTRMRes && pTempSTRMRes->next != pSTRMRes)
17955 +                       pTempSTRMRes = pTempSTRMRes->next;
17956 +               if (pTempSTRMRes == NULL)
17957 +                       status = DSP_ENOTFOUND;
17958 +               else
17959 +                       pTempSTRMRes->next = pSTRMRes->next;
17960 +       }
17961 +       mutex_unlock(&pCtxt->strm_mutex);
17962         MEM_Free(pSTRMRes);
17963         return status;
17964  }
17965  
17966 -
17967  /* Actual Stream De-Allocation */
17968  static DSP_STATUS  DRV_ProcFreeSTRMRes(HANDLE hPCtxt)
17969  {
17970         struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
17971         DSP_STATUS status = DSP_SOK;
17972 -       DSP_STATUS status1 = DSP_SOK;
17973         u8 **apBuffer = NULL;
17974 -       struct STRM_RES_OBJECT *pSTRMList = NULL;
17975         struct STRM_RES_OBJECT *pSTRMRes = NULL;
17976 +       struct STRM_INFO strm_info;
17977 +       struct DSP_STREAMINFO user;
17978         u8 *pBufPtr;
17979         u32 ulBytes;
17980         u32 dwArg;
17981         s32 ulBufSize;
17982  
17983 -
17984 -       DBC_Assert(hPCtxt != NULL);
17985 -       pSTRMList = pCtxt->pSTRMList;
17986 -       while (pSTRMList != NULL) {
17987 -               pSTRMRes = pSTRMList;
17988 -               pSTRMList = pSTRMList->next;
17989 -               if (pSTRMRes->uNumBufs != 0) {
17990 -                       apBuffer = MEM_Alloc((pSTRMRes->uNumBufs *
17991 -                                           sizeof(u8 *)), MEM_NONPAGED);
17992 +       pSTRMRes = pCtxt->pSTRMList;
17993 +       while (pSTRMRes) {
17994 +               if (pSTRMRes->uNumBufs) {
17995 +                       apBuffer = MEM_Alloc(pSTRMRes->uNumBufs *
17996 +                                           sizeof(u8 *), MEM_NONPAGED);
17997 +                       if (!apBuffer)
17998 +                               return DSP_EMEMORY;
17999                         status = STRM_FreeBuffer(pSTRMRes->hStream, apBuffer,
18000                                                 pSTRMRes->uNumBufs, pCtxt);
18001                         MEM_Free(apBuffer);
18002                 }
18003 -               status = STRM_Close(pSTRMRes->hStream, pCtxt);
18004 -               if (DSP_FAILED(status)) {
18005 -                       if (status == DSP_EPENDING) {
18006 -                               status = STRM_Reclaim(pSTRMRes->hStream,
18007 -                                                    &pBufPtr, &ulBytes,
18008 -                                                    (u32 *)&ulBufSize, &dwArg);
18009 -                               if (DSP_SUCCEEDED(status))
18010 -                                       status = STRM_Close(pSTRMRes->hStream,
18011 -                                                       pCtxt);
18012 +               strm_info.pUser = &user;
18013 +               user.uNumberBufsInStream = 0;
18014 +               STRM_GetInfo(pSTRMRes->hStream, &strm_info, sizeof(strm_info));
18015 +               while (strm_info.pUser->uNumberBufsInStream--)
18016 +                       STRM_Reclaim(pSTRMRes->hStream, &pBufPtr, &ulBytes,
18017 +                                            (u32 *)&ulBufSize, &dwArg);
18018  
18019 -                       }
18020 -               }
18021         }
18022 -       return status1;
18023 +       return status;
18024  }
18025  
18026  /* Release all Stream resources and its context
18027 @@ -763,7 +535,6 @@ DSP_STATUS  DRV_RemoveAllSTRMResElements(
18028         struct STRM_RES_OBJECT *pTempSTRMRes2 = NULL;
18029         struct STRM_RES_OBJECT *pTempSTRMRes = NULL;
18030  
18031 -       DBC_Assert(hPCtxt != NULL);
18032         DRV_ProcFreeSTRMRes(pCtxt);
18033         pTempSTRMRes = pCtxt->pSTRMList;
18034         while (pTempSTRMRes != NULL) {
18035 @@ -775,7 +546,6 @@ DSP_STATUS  DRV_RemoveAllSTRMResElements(
18036         return status;
18037  }
18038  
18039 -
18040  /* Getting the stream resource element */
18041  DSP_STATUS DRV_GetSTRMResElement(HANDLE hStrm, HANDLE hSTRMRes, HANDLE hPCtxt)
18042  {
18043 @@ -783,14 +553,20 @@ DSP_STATUS DRV_GetSTRMResElement(HANDLE 
18044         struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
18045         DSP_STATUS status = DSP_SOK;
18046         struct STRM_RES_OBJECT *pTempSTRM2 = NULL;
18047 -       struct STRM_RES_OBJECT *pTempSTRM = pCtxt->pSTRMList;
18048 +       struct STRM_RES_OBJECT *pTempSTRM;
18049 +
18050 +       if (mutex_lock_interruptible(&pCtxt->strm_mutex))
18051 +               return DSP_EFAIL;
18052  
18053 -       DBC_Assert(hPCtxt != NULL);
18054 +       pTempSTRM = pCtxt->pSTRMList;
18055         while ((pTempSTRM != NULL) && (pTempSTRM->hStream != hStrm)) {
18056                 GT_0trace(curTrace, GT_ENTER, "DRV_GetSTRMResElement: 2");
18057                 pTempSTRM2 = pTempSTRM;
18058                 pTempSTRM = pTempSTRM->next;
18059         }
18060 +
18061 +       mutex_unlock(&pCtxt->strm_mutex);
18062 +
18063         if (pTempSTRM != NULL) {
18064                 GT_0trace(curTrace, GT_ENTER, "DRV_GetSTRMResElement: 3");
18065                 *STRMRes = pTempSTRM;
18066 @@ -803,282 +579,16 @@ DSP_STATUS DRV_GetSTRMResElement(HANDLE 
18067  }
18068  
18069  /* Updating the stream resource element */
18070 -DSP_STATUS DRV_ProcUpdateSTRMRes(u32 uNumBufs, HANDLE hSTRMRes, HANDLE hPCtxt)
18071 +DSP_STATUS DRV_ProcUpdateSTRMRes(u32 uNumBufs, HANDLE hSTRMRes)
18072  {
18073         DSP_STATUS status = DSP_SOK;
18074         struct STRM_RES_OBJECT **STRMRes = (struct STRM_RES_OBJECT **)hSTRMRes;
18075  
18076 -       DBC_Assert(hPCtxt != NULL);
18077         (*STRMRes)->uNumBufs = uNumBufs;
18078         return status;
18079  }
18080  
18081 -/* Displaying the resources allocated by a process */
18082 -DSP_STATUS DRV_ProcDisplayResInfo(u8 *pBuf1, u32 *pSize)
18083 -{
18084 -       struct PROCESS_CONTEXT *pCtxt = NULL;
18085 -       struct NODE_RES_OBJECT *pNodeRes = NULL;
18086 -       struct DMM_RES_OBJECT *pDMMRes = NULL;
18087 -       struct STRM_RES_OBJECT *pSTRMRes = NULL;
18088 -       struct DSPHEAP_RES_OBJECT *pDSPHEAPRes = NULL;
18089 -       u32 tempCount = 1;
18090 -       HANDLE hDrvObject = NULL;
18091 -       void *pBuf = pBuf1;
18092 -       u8 pTempBuf[250];
18093 -       u32 tempStrLen = 0, tempStrLen2 = 0;
18094 -       DSP_STATUS status = DSP_SOK;
18095 -
18096 -       CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
18097 -       DRV_GetProcCtxtList(&pCtxt, (struct DRV_OBJECT *)hDrvObject);
18098 -       GT_0trace(curTrace, GT_ENTER, "*********************"
18099 -                "DRV_ProcDisplayResourceInfo:*\n");
18100 -       while (pCtxt != NULL) {
18101 -               tempStrLen2 = sprintf((char *)pTempBuf,
18102 -                                    "-------------------------------------"
18103 -                                    "-----------------------------------\n");
18104 -               tempStrLen2 += 2;
18105 -               memmove(pBuf+tempStrLen, pTempBuf, tempStrLen2);
18106 -               tempStrLen += tempStrLen2;
18107 -               if (pCtxt->resState == PROC_RES_ALLOCATED) {
18108 -                       tempStrLen2 = sprintf((char *)pTempBuf,
18109 -                                       "GPP Process Resource State: "
18110 -                                       "pCtxt->resState = PROC_RES_ALLOCATED, "
18111 -                                       " Process ID: %d\n", pCtxt->pid);
18112 -                       tempStrLen2 += 2;
18113 -                       memmove(pBuf+tempStrLen, pTempBuf, tempStrLen2);
18114 -                       tempStrLen += tempStrLen2;
18115 -               } else {
18116 -                       tempStrLen2 = sprintf((char *)pTempBuf,
18117 -                               "GPP Resource State: pCtxt->resState"
18118 -                               " = PROC_RES_DEALLOCATED, Process ID:%d\n",
18119 -                               pCtxt->pid);
18120 -                       tempStrLen2 += 2;
18121 -                       memmove(pBuf+tempStrLen, pTempBuf, tempStrLen2);
18122 -                       tempStrLen += tempStrLen2;
18123 -               }
18124 -               pNodeRes = pCtxt->pNodeList;
18125 -               tempCount = 1;
18126 -               while (pNodeRes != NULL) {
18127 -                       GT_2trace(curTrace, GT_ENTER,
18128 -                                "DRV_ProcDisplayResourceInfo: #:%d "
18129 -                                "pCtxt->pNodeList->hNode:%x\n",
18130 -                                tempCount, pNodeRes->hNode);
18131 -                       tempStrLen2 = sprintf((char *)pTempBuf,
18132 -                                       "Node Resource Information: Node #"
18133 -                                       " %d Node Handle hNode:0X%x\n",
18134 -                                       tempCount, (u32)pNodeRes->hNode);
18135 -                       pNodeRes = pNodeRes->next;
18136 -                       tempStrLen2 += 2;
18137 -                       memmove(pBuf+tempStrLen, pTempBuf, tempStrLen2);
18138 -                       tempStrLen += tempStrLen2;
18139 -                       tempCount++;
18140 -               }
18141 -               tempCount = 1;
18142 -               pDSPHEAPRes = pCtxt->pDSPHEAPList;
18143 -               while (pDSPHEAPRes != NULL) {
18144 -                       GT_2trace(curTrace, GT_ENTER,
18145 -                                "DRV_ProcDisplayResourceInfo: #:%d "
18146 -                                "pCtxt->pDSPHEAPRList->ulMpuAddr:%x\n",
18147 -                                tempCount, pDSPHEAPRes->ulMpuAddr);
18148 -                       tempStrLen2 = sprintf((char *)pTempBuf,
18149 -                                "DSP Heap Resource Info: HEAP # %d"
18150 -                                " Mapped GPP Address: 0x%x, size: 0x%x\n",
18151 -                                tempCount, (u32)pDSPHEAPRes->ulMpuAddr,
18152 -                                (u32)pDSPHEAPRes->heapSize);
18153 -                       pDSPHEAPRes = pDSPHEAPRes->next;
18154 -                       tempStrLen2 += 2;
18155 -                       memmove(pBuf+tempStrLen, pTempBuf, tempStrLen2);
18156 -                       tempStrLen += tempStrLen2;
18157 -                       tempCount++;
18158 -               }
18159 -               tempCount = 1;
18160 -               pDMMRes = pCtxt->pDMMList;
18161 -               while (pDMMRes != NULL) {
18162 -                       GT_2trace(curTrace, GT_ENTER,
18163 -                                       "DRV_ProcDisplayResourceInfo: #:%d "
18164 -                                       " pCtxt->pDMMList->ulMpuAddr:%x\n",
18165 -                                       tempCount,
18166 -                                       pDMMRes->ulMpuAddr);
18167 -                       tempStrLen2 = sprintf((char *)pTempBuf,
18168 -                                        "DMM Resource Info: DMM # %d Mapped"
18169 -                                        " GPP Address: 0x%x, size: 0x%x\n",
18170 -                                        tempCount, (u32)pDMMRes->ulMpuAddr,
18171 -                                        (u32)pDMMRes->dmmSize);
18172 -                       pDMMRes = pDMMRes->next;
18173 -                       tempStrLen2 += 2;
18174 -                       memmove(pBuf+tempStrLen, pTempBuf, tempStrLen2);
18175 -                       tempStrLen += tempStrLen2;
18176 -                       tempCount++;
18177 -               }
18178 -               tempCount = 1;
18179 -               pSTRMRes = pCtxt->pSTRMList;
18180 -               while (pSTRMRes != NULL) {
18181 -                       GT_2trace(curTrace, GT_ENTER,
18182 -                                "DRV_ProcDisplayResourceInfo: #:%d "
18183 -                                "pCtxt->pSTRMList->hStream:%x\n", tempCount,
18184 -                                pSTRMRes->hStream);
18185 -                       tempStrLen2 = sprintf((char *)pTempBuf,
18186 -                                            "Stream Resource info: STRM # %d "
18187 -                                            "Stream Handle: 0x%x \n",
18188 -                                            tempCount, (u32)pSTRMRes->hStream);
18189 -                       pSTRMRes = pSTRMRes->next;
18190 -                       tempStrLen2 += 2;
18191 -                       memmove(pBuf+tempStrLen, pTempBuf, tempStrLen2);
18192 -                       tempStrLen += tempStrLen2;
18193 -                       tempCount++;
18194 -               }
18195 -               pCtxt = pCtxt->next;
18196 -       }
18197 -       *pSize = tempStrLen;
18198 -       status = PrintProcessInformation();
18199 -       GT_0trace(curTrace, GT_ENTER, "*********************"
18200 -               "DRV_ProcDisplayResourceInfo:**\n");
18201 -       return status;
18202 -}
18203 -
18204 -/*
18205 - *  ======== PrintProcessInformation ========
18206 - *  Purpose:
18207 - *      This function prints the Process's information stored in
18208 - *      the process context list. Some of the information that
18209 - *      it displays is Process's state, Node, Stream, DMM, and
18210 - *      Heap information.
18211 - */
18212 -static DSP_STATUS PrintProcessInformation(void)
18213 -{
18214 -       struct DRV_OBJECT *hDrvObject = NULL;
18215 -       struct PROCESS_CONTEXT *pCtxtList = NULL;
18216 -       struct NODE_RES_OBJECT *pNodeRes = NULL;
18217 -       struct DMM_RES_OBJECT *pDMMRes = NULL;
18218 -       struct STRM_RES_OBJECT *pSTRMRes = NULL;
18219 -       struct DSPHEAP_RES_OBJECT *pDSPHEAPRes = NULL;
18220 -       struct PROC_OBJECT *proc_obj_ptr;
18221 -       DSP_STATUS status = DSP_SOK;
18222 -       u32 tempCount;
18223 -       u32  procID;
18224 -
18225 -       /* Get the Process context list */
18226 -       CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
18227 -       DRV_GetProcCtxtList(&pCtxtList, hDrvObject);
18228 -       GT_0trace(curTrace, GT_4CLASS, "\n### Debug information"
18229 -                       " for DSP bridge ##\n");
18230 -       GT_0trace(curTrace, GT_4CLASS, " \n ###The  processes"
18231 -                       " information is as follows ### \n") ;
18232 -       GT_0trace(curTrace, GT_4CLASS, "  ====================="
18233 -                       "============ \n");
18234 -       /* Go through the entries in the Process context list */
18235 -       while (pCtxtList  != NULL) {
18236 -               GT_1trace(curTrace, GT_4CLASS, "\nThe process"
18237 -                               " id is %d\n", pCtxtList->pid);
18238 -               GT_0trace(curTrace, GT_4CLASS, " -------------------"
18239 -                               "---------\n");
18240 -               if (pCtxtList->resState == PROC_RES_ALLOCATED) {
18241 -                       GT_0trace(curTrace, GT_4CLASS, " \nThe Process"
18242 -                                       " is in Allocated state\n");
18243 -               } else {
18244 -                       GT_0trace(curTrace, GT_4CLASS, "\nThe Process"
18245 -                                       " is in DeAllocated state\n");
18246 -               }
18247 -
18248 -               spin_lock(&pCtxtList->proc_list_lock);
18249 -               list_for_each_entry(proc_obj_ptr, &pCtxtList->processor_list,
18250 -                               proc_object) {
18251 -                       PROC_GetProcessorId(proc_obj_ptr, &procID);
18252 -                       if (procID == DSP_UNIT) {
18253 -                               GT_0trace(curTrace, GT_4CLASS,
18254 -                                       "\nProcess connected to"
18255 -                                       " DSP Processor\n");
18256 -                       } else if (procID == IVA_UNIT) {
18257 -                               GT_0trace(curTrace, GT_4CLASS,
18258 -                                       "\nProcess connected to"
18259 -                                       " IVA Processor\n");
18260 -                       } else {
18261 -                               GT_0trace(curTrace, GT_7CLASS,
18262 -                                       "\n***ERROR:Invalid Processor Id***\n");
18263 -                       }
18264 -               }
18265 -               spin_unlock(&pCtxtList->proc_list_lock);
18266 -
18267 -               pNodeRes = pCtxtList->pNodeList;
18268 -               tempCount = 1;
18269 -               while (pNodeRes != NULL) {
18270 -                       if (tempCount == 1)
18271 -                               GT_0trace(curTrace, GT_4CLASS,
18272 -                                       "\n***The Nodes allocated by"
18273 -                                       " this Process are***\n");
18274 -                       GT_2trace(curTrace, GT_4CLASS,
18275 -                                       "Node # %d Node Handle hNode:0x%x\n",
18276 -                                       tempCount, (u32)pNodeRes->hNode);
18277 -                       pNodeRes = pNodeRes->next;
18278 -                       tempCount++;
18279 -               }
18280 -               if (tempCount == 1)
18281 -                       GT_0trace(curTrace, GT_4CLASS,
18282 -                                       "\n ***There are no Nodes"
18283 -                                       " allocated by this Process***\n");
18284 -               tempCount = 1;
18285 -               pDSPHEAPRes = pCtxtList->pDSPHEAPList;
18286 -               while (pDSPHEAPRes != NULL) {
18287 -                       if (tempCount == 1)
18288 -                               GT_0trace(curTrace, GT_4CLASS,
18289 -                                               "\n***The Heaps allocated by"
18290 -                                               " this Process are***\n");
18291 -                       GT_3trace(curTrace, GT_4CLASS,
18292 -                               "DSP Heap Resource Info: HEAP # %d "
18293 -                               "Mapped GPP Address:0x%x, Size: 0x%lx\n",
18294 -                               tempCount, (u32)pDSPHEAPRes->ulMpuAddr,
18295 -                               pDSPHEAPRes->heapSize);
18296 -                       pDSPHEAPRes = pDSPHEAPRes->next;
18297 -                       tempCount++;
18298 -               }
18299 -               if (tempCount == 1)
18300 -                       GT_0trace(curTrace, GT_4CLASS,
18301 -                               "\n ***There are no Heaps allocated"
18302 -                               " by this Process***\n");
18303 -               tempCount = 1;
18304 -               pDMMRes = pCtxtList->pDMMList;
18305 -               while (pDMMRes != NULL) {
18306 -                       if (tempCount == 1)
18307 -                               GT_0trace(curTrace, GT_4CLASS,
18308 -                                       "\n ***The DMM resources allocated by"
18309 -                                       " this Process are***\n");
18310 -                       GT_3trace(curTrace, GT_4CLASS,
18311 -                               "DMM Resource Info: DMM # %d "
18312 -                               "Mapped GPP Address:0X%lx, Size: 0X%lx\n",
18313 -                               tempCount, pDMMRes->ulMpuAddr,
18314 -                               pDMMRes->dmmSize);
18315 -                       pDMMRes = pDMMRes->next;
18316 -                       tempCount++;
18317 -               }
18318 -               if (tempCount == 1)
18319 -                       GT_0trace(curTrace, GT_4CLASS,
18320 -                               "\n ***There are no DMM resources"
18321 -                               " allocated by this Process***\n");
18322 -               tempCount = 1;
18323 -               pSTRMRes = pCtxtList->pSTRMList;
18324 -               while (pSTRMRes != NULL) {
18325 -                       if (tempCount == 1)
18326 -                               GT_0trace(curTrace, GT_4CLASS,
18327 -                                       "\n***The Stream resources allocated by"
18328 -                                       " this Process are***\n");
18329 -                       GT_2trace(curTrace, GT_4CLASS,
18330 -                               "Stream Resource info: STRM # %d"
18331 -                               "Stream Handle:0X%x\n", tempCount,
18332 -                               (u32)pSTRMRes->hStream);
18333 -                       pSTRMRes = pSTRMRes->next;
18334 -                       tempCount++;
18335 -               }
18336 -               if (tempCount == 1)
18337 -                       GT_0trace(curTrace, GT_4CLASS,
18338 -                               "\n ***There are no Stream resources"
18339 -                               "allocated by this Process***\n");
18340 -               pCtxtList = pCtxtList->next;
18341 -       }
18342 -       return status;
18343 -}
18344 -
18345  /* GPP PROCESS CLEANUP CODE END */
18346 -#endif
18347  
18348  /*
18349   *  ======== = DRV_Create ======== =
18350 @@ -1097,43 +607,48 @@ DSP_STATUS DRV_Create(OUT struct DRV_OBJ
18351         MEM_AllocObject(pDRVObject, struct DRV_OBJECT, SIGNATURE);
18352         if (pDRVObject) {
18353                 /* Create and Initialize List of device objects */
18354 -               pDRVObject->devList = LST_Create();
18355 +               pDRVObject->devList = MEM_Calloc(sizeof(struct LST_LIST),
18356 +                       MEM_NONPAGED);
18357                 if (pDRVObject->devList) {
18358                         /* Create and Initialize List of device Extension */
18359 -                       pDRVObject->devNodeString = LST_Create();
18360 +                       pDRVObject->devNodeString = MEM_Calloc(sizeof(struct
18361 +                               LST_LIST), MEM_NONPAGED);
18362                         if (!(pDRVObject->devNodeString)) {
18363                                 status = DSP_EFAIL;
18364                                 GT_0trace(curTrace, GT_7CLASS,
18365                                          "Failed to Create DRV_EXT list ");
18366 -                               MEM_FreeObject(pDRVObject);
18367 +                       } else {
18368 +                               INIT_LIST_HEAD(&pDRVObject->devNodeString->
18369 +                                       head);
18370 +                               INIT_LIST_HEAD(&pDRVObject->devList->head);
18371                         }
18372                 } else {
18373 -                       status = DSP_EFAIL;
18374 +                       status = DSP_EMEMORY;
18375                         GT_0trace(curTrace, GT_7CLASS,
18376                                  "Failed to Create Dev List ");
18377 -                       MEM_FreeObject(pDRVObject);
18378                 }
18379         } else {
18380 -               status = DSP_EFAIL;
18381 +               status = DSP_EMEMORY;
18382                 GT_0trace(curTrace, GT_7CLASS,
18383                          "Failed to Allocate Memory for DRV Obj");
18384         }
18385 +       /* Store the DRV Object in the Registry */
18386 +       if (DSP_SUCCEEDED(status))
18387 +               status = CFG_SetObject((u32) pDRVObject, REG_DRV_OBJECT);
18388         if (DSP_SUCCEEDED(status)) {
18389 -               /* Store the DRV Object in the Registry */
18390 -               if (DSP_SUCCEEDED
18391 -                   (CFG_SetObject((u32) pDRVObject, REG_DRV_OBJECT))) {
18392 -                       GT_1trace(curTrace, GT_1CLASS,
18393 -                                "DRV Obj Created pDrvObject 0x%x\n ",
18394 -                                pDRVObject);
18395 -                       *phDRVObject = pDRVObject;
18396 -               } else {
18397 -                       /* Free the DRV Object */
18398 -                       status = DSP_EFAIL;
18399 -                       MEM_Free(pDRVObject);
18400 -                       GT_0trace(curTrace, GT_7CLASS,
18401 -                                "Failed to update the Registry with "
18402 +               GT_1trace(curTrace, GT_1CLASS,
18403 +                        "DRV Obj Created pDrvObject 0x%x\n ",
18404 +                        pDRVObject);
18405 +               *phDRVObject = pDRVObject;
18406 +       } else {
18407 +               MEM_Free(pDRVObject->devList);
18408 +               MEM_Free(pDRVObject->devNodeString);
18409 +               /* Free the DRV Object */
18410 +               MEM_Free(pDRVObject);
18411 +               GT_0trace(curTrace, GT_7CLASS,
18412 +                        "Failed to update the Registry with "
18413                                  "DRV Object ");
18414 -               }
18415 +
18416         }
18417         GT_2trace(curTrace, GT_ENTER,
18418                  "Exiting DRV_Create: phDRVObject: 0x%x\tstatus:"
18419 @@ -1181,11 +696,11 @@ DSP_STATUS DRV_Destroy(struct DRV_OBJECT
18420          */
18421         if (pDRVObject->devList) {
18422                 /* Could assert if the list is not empty  */
18423 -               LST_Delete(pDRVObject->devList);
18424 +               MEM_Free(pDRVObject->devList);
18425         }
18426         if (pDRVObject->devNodeString) {
18427                 /* Could assert if the list is not empty */
18428 -               LST_Delete(pDRVObject->devNodeString);
18429 +               MEM_Free(pDRVObject->devNodeString);
18430         }
18431         MEM_FreeObject(pDRVObject);
18432         /* Update the DRV Object in Registry to be 0 */
18433 @@ -1227,7 +742,6 @@ DSP_STATUS DRV_GetDevObject(u32 uIndex, 
18434         }
18435         if (pDevObject) {
18436                 *phDevObject = (struct DEV_OBJECT *) pDevObject;
18437 -               status = DSP_SOK;
18438         } else {
18439                 *phDevObject = NULL;
18440                 status = DSP_EFAIL;
18441 @@ -1305,7 +819,7 @@ u32 DRV_GetNextDevObject(u32 hDevObject)
18442                 if ((pDrvObject->devList != NULL) &&
18443                    !LST_IsEmpty(pDrvObject->devList)) {
18444                         dwNextDevObject = (u32)LST_Next(pDrvObject->devList,
18445 -                                         (struct LST_ELEM *)hDevObject);
18446 +                                         (struct list_head *)hDevObject);
18447                 }
18448         }
18449         return dwNextDevObject;
18450 @@ -1332,7 +846,7 @@ u32 DRV_GetNextDevExtension(u32 hDevExte
18451                    !LST_IsEmpty(pDrvObject->devNodeString)) {
18452                         dwDevExtension = (u32)LST_Next(pDrvObject->
18453                                 devNodeString,
18454 -                               (struct LST_ELEM *)hDevExtension);
18455 +                               (struct list_head *)hDevExtension);
18456                 }
18457         }
18458  
18459 @@ -1367,7 +881,7 @@ DSP_STATUS DRV_Init(void)
18460   *      Insert a DevObject into the list of Manager object.
18461   */
18462  DSP_STATUS DRV_InsertDevObject(struct DRV_OBJECT *hDRVObject,
18463 -                              struct DEV_OBJECT *hDevObject)
18464 +                               struct DEV_OBJECT *hDevObject)
18465  {
18466         DSP_STATUS status = DSP_SOK;
18467         struct DRV_OBJECT *pDRVObject = (struct DRV_OBJECT *)hDRVObject;
18468 @@ -1381,7 +895,7 @@ DSP_STATUS DRV_InsertDevObject(struct DR
18469                  "Entering DRV_InsertProcObject hDRVObject "
18470                  "0x%x\n, hDevObject 0x%x\n", hDRVObject, hDevObject);
18471  
18472 -       LST_PutTail(pDRVObject->devList, (struct LST_ELEM *)hDevObject);
18473 +       LST_PutTail(pDRVObject->devList, (struct list_head *)hDevObject);
18474  
18475         GT_1trace(curTrace, GT_ENTER,
18476                  "Exiting InsertDevObject status 0x%x\n", status);
18477 @@ -1398,11 +912,11 @@ DSP_STATUS DRV_InsertDevObject(struct DR
18478   *      objects.
18479   */
18480  DSP_STATUS DRV_RemoveDevObject(struct DRV_OBJECT *hDRVObject,
18481 -                              struct DEV_OBJECT *hDevObject)
18482 +                               struct DEV_OBJECT *hDevObject)
18483  {
18484         DSP_STATUS status = DSP_EFAIL;
18485         struct DRV_OBJECT *pDRVObject = (struct DRV_OBJECT *)hDRVObject;
18486 -       struct LST_ELEM *pCurElem;
18487 +       struct list_head *pCurElem;
18488  
18489         DBC_Require(cRefs > 0);
18490         DBC_Require(MEM_IsValidHandle(pDRVObject, SIGNATURE));
18491 @@ -1426,7 +940,7 @@ DSP_STATUS DRV_RemoveDevObject(struct DR
18492         }
18493         /* Remove list if empty. */
18494         if (LST_IsEmpty(pDRVObject->devList)) {
18495 -               LST_Delete(pDRVObject->devList);
18496 +               MEM_Free(pDRVObject->devList);
18497                 pDRVObject->devList = NULL;
18498         }
18499         DBC_Ensure((pDRVObject->devList == NULL) ||
18500 @@ -1455,8 +969,9 @@ DSP_STATUS DRV_RequestResources(u32 dwCo
18501          *  it is freed in the Release resources. Update the driver object
18502          *  list.
18503          */
18504 -       if (DSP_SUCCEEDED(CFG_GetObject((u32 *)&pDRVObject,
18505 -          REG_DRV_OBJECT))) {
18506 +
18507 +       status = CFG_GetObject((u32 *)&pDRVObject, REG_DRV_OBJECT);
18508 +       if (DSP_SUCCEEDED(status)) {
18509                 pszdevNode = MEM_Calloc(sizeof(struct DRV_EXT), MEM_NONPAGED);
18510                 if (pszdevNode) {
18511                         LST_InitElem(&pszdevNode->link);
18512 @@ -1466,21 +981,20 @@ DSP_STATUS DRV_RequestResources(u32 dwCo
18513                         /* Update the Driver Object List */
18514                         *pDevNodeString = (u32)pszdevNode->szString;
18515                         LST_PutTail(pDRVObject->devNodeString,
18516 -                               (struct LST_ELEM *)pszdevNode);
18517 +                                       (struct list_head *)pszdevNode);
18518                 } else {
18519                         GT_0trace(curTrace, GT_7CLASS,
18520                                 "Failed to Allocate Memory devNodeString ");
18521 -                       status = DSP_EFAIL;
18522 +                       status = DSP_EMEMORY;
18523                         *pDevNodeString = 0;
18524                 }
18525         } else {
18526 -               status = DSP_EFAIL;
18527                 GT_0trace(curTrace, GT_7CLASS,
18528                          "Failed to get Driver Object from Registry");
18529                 *pDevNodeString = 0;
18530         }
18531  
18532 -       if (!(strcmp((char *) dwContext, "TIOMAP1510"))) {
18533 +       if (!(strcmp((char *) dwContext, "TIOMAP1510"))) {
18534                 GT_0trace(curTrace, GT_1CLASS,
18535                           " Allocating resources for UMA \n");
18536                 status = RequestBridgeResourcesDSP(dwContext, DRV_ASSIGN);
18537 @@ -1513,7 +1027,7 @@ DSP_STATUS DRV_ReleaseResources(u32 dwCo
18538  
18539         GT_0trace(curTrace, GT_ENTER, "Entering DRV_Release Resources\n");
18540  
18541 -       if (!(strcmp((char *)((struct DRV_EXT *)dwContext)->szString,
18542 +       if (!(strcmp((char *)((struct DRV_EXT *)dwContext)->szString,
18543            "TIOMAP1510"))) {
18544                 GT_0trace(curTrace, GT_1CLASS,
18545                          " Releasing DSP-Bridge resources \n");
18546 @@ -1522,10 +1036,9 @@ DSP_STATUS DRV_ReleaseResources(u32 dwCo
18547                 GT_0trace(curTrace, GT_1CLASS, " Unknown device\n");
18548         }
18549  
18550 -       if (DSP_SUCCEEDED(status)) {
18551 +       if (DSP_FAILED(status))
18552                 GT_0trace(curTrace, GT_1CLASS,
18553                          "Failed to relese bridge resources\n");
18554 -       }
18555  
18556         /*
18557          *  Irrespective of the status go ahead and clean it
18558 @@ -1534,17 +1047,21 @@ DSP_STATUS DRV_ReleaseResources(u32 dwCo
18559         for (pszdevNode = (struct DRV_EXT *)DRV_GetFirstDevExtension();
18560             pszdevNode != NULL; pszdevNode = (struct DRV_EXT *)
18561             DRV_GetNextDevExtension((u32)pszdevNode)) {
18562 +               if (!pDRVObject->devNodeString) {
18563 +                       /* When this could happen? */
18564 +                       continue;
18565 +               }
18566                 if ((u32)pszdevNode == dwContext) {
18567                         /* Found it */
18568                         /* Delete from the Driver object list */
18569                         LST_RemoveElem(pDRVObject->devNodeString,
18570 -                                     (struct LST_ELEM *)pszdevNode);
18571 +                                     (struct list_head *)pszdevNode);
18572                         MEM_Free((void *) pszdevNode);
18573                         break;
18574                 }
18575                 /* Delete the List if it is empty */
18576                 if (LST_IsEmpty(pDRVObject->devNodeString)) {
18577 -                       LST_Delete(pDRVObject->devNodeString);
18578 +                       MEM_Free(pDRVObject->devNodeString);
18579                         pDRVObject->devNodeString = NULL;
18580                 }
18581         }
18582 @@ -1574,20 +1091,20 @@ static DSP_STATUS RequestBridgeResources
18583                 /* Releasing resources by deleting the registry key  */
18584                 dwBuffSize = sizeof(struct CFG_HOSTRES);
18585                 pResources = MEM_Calloc(dwBuffSize, MEM_NONPAGED);
18586 -               if (DSP_FAILED(REG_GetValue(NULL, (char *)driverExt->szString,
18587 -                  CURRENTCONFIG, (u8 *)pResources, &dwBuffSize))) {
18588 -                       status = CFG_E_RESOURCENOTAVAIL;
18589 -                       GT_0trace(curTrace, GT_1CLASS,
18590 -                                "REG_GetValue Failed \n");
18591 -               } else {
18592 -                       GT_0trace(curTrace, GT_1CLASS,
18593 -                                "REG_GetValue Succeeded \n");
18594 -               }
18595 -
18596                 if (pResources != NULL) {
18597 +                       if (DSP_FAILED(REG_GetValue(CURRENTCONFIG,
18598 +                                       (u8 *)pResources, &dwBuffSize))) {
18599 +                               status = CFG_E_RESOURCENOTAVAIL;
18600 +                               GT_0trace(curTrace, GT_1CLASS,
18601 +                                        "REG_GetValue Failed \n");
18602 +                       } else {
18603 +                               GT_0trace(curTrace, GT_1CLASS,
18604 +                                        "REG_GetValue Succeeded \n");
18605 +                       }
18606 +
18607                         dwBuffSize = sizeof(shm_size);
18608 -                       status = REG_GetValue(NULL, CURRENTCONFIG, SHMSIZE,
18609 -                               (u8 *)&shm_size, &dwBuffSize);
18610 +                       status = REG_GetValue(SHMSIZE, (u8 *)&shm_size,
18611 +                                             &dwBuffSize);
18612                         if (DSP_SUCCEEDED(status)) {
18613                                 if ((pResources->dwMemBase[1]) &&
18614                                    (pResources->dwMemPhys[1])) {
18615 @@ -1624,15 +1141,13 @@ static DSP_STATUS RequestBridgeResources
18616                                 iounmap(pResources->dwDmmuBase);
18617                         if (pResources->dwPerBase)
18618                                 iounmap(pResources->dwPerBase);
18619 -                       if (pResources->dwPerPmBase)
18620 -                               iounmap((void *)pResources->dwPerPmBase);
18621 -                       if (pResources->dwCorePmBase)
18622 -                               iounmap((void *)pResources->dwCorePmBase);
18623 -                       if (pResources->dwSysCtrlBase) {
18624 +                       if (pResources->dwPerPmBase)
18625 +                               iounmap((void *)pResources->dwPerPmBase);
18626 +                       if (pResources->dwCorePmBase)
18627 +                               iounmap((void *)pResources->dwCorePmBase);
18628 +                       if (pResources->dwSysCtrlBase)
18629                                 iounmap(pResources->dwSysCtrlBase);
18630 -                               /* don't set pResources->dwSysCtrlBase to null
18631 -                                * as it is used in BOARD_Stop */
18632 -                       }
18633 +
18634                         pResources->dwPrmBase = NULL;
18635                         pResources->dwCmBase = NULL;
18636                         pResources->dwMboxBase = NULL;
18637 @@ -1642,13 +1157,15 @@ static DSP_STATUS RequestBridgeResources
18638                         pResources->dwMemBase[4] = (u32) NULL;
18639                         pResources->dwWdTimerDspBase = NULL;
18640                         pResources->dwDmmuBase = NULL;
18641 +                       pResources->dwSysCtrlBase = NULL;
18642  
18643                         dwBuffSize = sizeof(struct CFG_HOSTRES);
18644 -                       status = REG_SetValue(NULL, (char *)driverExt->szString,
18645 -                                CURRENTCONFIG, REG_BINARY, (u8 *)pResources,
18646 +                       status = REG_SetValue(CURRENTCONFIG, (u8 *)pResources,
18647                                  (u32)dwBuffSize);
18648                         /*  Set all the other entries to NULL */
18649                         MEM_Free(pResources);
18650 +               } else {
18651 +                       status = DSP_EMEMORY;
18652                 }
18653                 GT_0trace(curTrace, GT_ENTER, " <- RequestBridgeResources \n");
18654                 return status;
18655 @@ -1686,29 +1203,26 @@ static DSP_STATUS RequestBridgeResources
18656                 /* for 24xx base port is not mapping the mamory for DSP
18657                  * internal memory TODO Do a ioremap here */
18658                 /* Second window is for DSP external memory shared with MPU */
18659 +
18660 +               /* for Linux, these are hard-coded values */
18661 +               pResources->bIRQRegisters = 0;
18662 +               pResources->bIRQAttrib = 0;
18663 +               pResources->dwOffsetForMonitor = 0;
18664 +               pResources->dwChnlOffset = 0;
18665 +               /* CHNL_MAXCHANNELS */
18666 +               pResources->dwNumChnls = CHNL_MAXCHANNELS;
18667 +               pResources->dwChnlBufSize = 0x400;
18668 +               dwBuffSize = sizeof(struct CFG_HOSTRES);
18669 +               status = REG_SetValue(CURRENTCONFIG, (u8 *)pResources,
18670 +                                               sizeof(struct CFG_HOSTRES));
18671                 if (DSP_SUCCEEDED(status)) {
18672 -                       /* for Linux, these are hard-coded values */
18673 -                       pResources->bIRQRegisters = 0;
18674 -                       pResources->bIRQAttrib = 0;
18675 -                       pResources->dwOffsetForMonitor = 0;
18676 -                       pResources->dwChnlOffset = 0;
18677 -                       /* CHNL_MAXCHANNELS */
18678 -                       pResources->dwNumChnls = CHNL_MAXCHANNELS;
18679 -                       pResources->dwChnlBufSize = 0x400;
18680 -                       dwBuffSize = sizeof(struct CFG_HOSTRES);
18681 -                       status = REG_SetValue(NULL, (char *) dwContext,
18682 -                                            CURRENTCONFIG, REG_BINARY,
18683 -                                            (u8 *)pResources,
18684 -                                            sizeof(struct CFG_HOSTRES));
18685 -                       if (DSP_SUCCEEDED(status)) {
18686 -                               GT_0trace(curTrace, GT_1CLASS,
18687 -                                        " Successfully set the registry "
18688 -                                        "value for CURRENTCONFIG\n");
18689 -                       } else {
18690 -                               GT_0trace(curTrace, GT_7CLASS,
18691 -                                        " Failed to set the registry "
18692 -                                        "value for CURRENTCONFIG\n");
18693 -                       }
18694 +                       GT_0trace(curTrace, GT_1CLASS,
18695 +                                " Successfully set the registry "
18696 +                                "value for CURRENTCONFIG\n");
18697 +               } else {
18698 +                       GT_0trace(curTrace, GT_7CLASS,
18699 +                                " Failed to set the registry "
18700 +                                "value for CURRENTCONFIG\n");
18701                 }
18702                 MEM_Free(pResources);
18703         }
18704 @@ -1760,10 +1274,10 @@ static DSP_STATUS RequestBridgeResources
18705                                                         OMAP_DSP_MEM3_SIZE);
18706                 pResources->dwPerBase = ioremap(OMAP_PER_CM_BASE,
18707                                                         OMAP_PER_CM_SIZE);
18708 -               pResources->dwPerPmBase = (u32)ioremap(OMAP_PER_PRM_BASE,
18709 -                                                       OMAP_PER_PRM_SIZE);
18710 -               pResources->dwCorePmBase = (u32)ioremap(OMAP_CORE_PRM_BASE,
18711 -                                                       OMAP_CORE_PRM_SIZE);
18712 +               pResources->dwPerPmBase = (u32)ioremap(OMAP_PER_PRM_BASE,
18713 +                                                       OMAP_PER_PRM_SIZE);
18714 +               pResources->dwCorePmBase = (u32)ioremap(OMAP_CORE_PRM_BASE,
18715 +                                                       OMAP_CORE_PRM_SIZE);
18716                 pResources->dwDmmuBase = ioremap(OMAP_DMMU_BASE,
18717                                                         OMAP_DMMU_SIZE);
18718                 pResources->dwWdTimerDspBase = NULL;
18719 @@ -1789,8 +1303,7 @@ static DSP_STATUS RequestBridgeResources
18720                 GT_1trace(curTrace, GT_2CLASS, "dwDmmuBase 0x%x\n",
18721                                                 pResources->dwDmmuBase);
18722                 dwBuffSize = sizeof(shm_size);
18723 -               status = REG_GetValue(NULL, CURRENTCONFIG, SHMSIZE,
18724 -                                    (u8 *)&shm_size, &dwBuffSize);
18725 +               status = REG_GetValue(SHMSIZE, (u8 *)&shm_size, &dwBuffSize);
18726                 if (DSP_SUCCEEDED(status)) {
18727                         /* Allocate Physically contiguous,
18728                          * non-cacheable  memory */
18729 @@ -1822,9 +1335,7 @@ static DSP_STATUS RequestBridgeResources
18730                         pResources->dwNumChnls = CHNL_MAXCHANNELS;
18731                         pResources->dwChnlBufSize = 0x400;
18732                         dwBuffSize = sizeof(struct CFG_HOSTRES);
18733 -                       status = REG_SetValue(NULL, (char *)dwContext,
18734 -                                            CURRENTCONFIG, REG_BINARY,
18735 -                                            (u8 *)pResources,
18736 +                       status = REG_SetValue(CURRENTCONFIG, (u8 *)pResources,
18737                                              sizeof(struct CFG_HOSTRES));
18738                         if (DSP_SUCCEEDED(status)) {
18739                                 GT_0trace(curTrace, GT_1CLASS,
18740 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/drv_interface.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/drv_interface.c
18741 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/drv_interface.c    2011-04-17 17:32:26.000000000 +0100
18742 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/drv_interface.c 2011-05-06 15:29:59.000000000 +0100
18743 @@ -3,6 +3,8 @@
18744   *
18745   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
18746   *
18747 + * DSP/BIOS Bridge driver interface.
18748 + *
18749   * Copyright (C) 2005-2006 Texas Instruments, Inc.
18750   *
18751   * This package is free software; you can redistribute it and/or modify
18752 @@ -14,36 +16,6 @@
18753   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18754   */
18755  
18756 -/*
18757 - *  ======== linux_driver.c ========
18758 - *  Description:
18759 - *      DSP/BIOS Bridge driver interface.
18760 - *
18761 - *  Public Functions:
18762 - *      driver_init
18763 - *      driver_exit
18764 - *      driver_open
18765 - *      driver_release
18766 - *      driver_ioctl
18767 - *      driver_mmap
18768 - *
18769 - *! Revision History
18770 - *! ================
18771 - *! 21-Apr-2004 map   Deprecated use of MODULE_PARM for kernel versions
18772 - *!               greater than 2.5, use module_param.
18773 - *! 08-Mar-2004 sb    Added the dsp_debug argument, which keeps the DSP in self
18774 - *!               loop after image load and waits in a loop for DSP to start
18775 - *! 16-Feb-2004 vp    Deprecated the usage of MOD_INC_USE_COUNT and
18776 - *!                                            MOD_DEC_USE_COUNT
18777 - *!               for kernel versions greater than 2.5
18778 - *! 20-May-2003 vp    Added unregister functions for the DPM.
18779 - *! 24-Mar-2003 sb    Pass pid instead of driverContext to DSP_Close
18780 - *! 24-Mar-2003 vp    Added Power Management support.
18781 - *! 21-Mar-2003 sb    Configure SHM size using insmod argument shm_size
18782 - *! 10-Feb-2003 vp    Updated based on code review comments
18783 - *! 18-Oct-2002 sb    Created initial version
18784 - */
18785 -
18786  /*  ----------------------------------- Host OS */
18787  
18788  #include <dspbridge/host_os.h>
18789 @@ -59,8 +31,6 @@
18790  #include <linux/moduleparam.h>
18791  #include <linux/cdev.h>
18792  
18793 -#include <mach/board-3430sdp.h>
18794 -
18795  /*  ----------------------------------- DSP/BIOS Bridge */
18796  #include <dspbridge/std.h>
18797  #include <dspbridge/dbdefs.h>
18798 @@ -74,13 +44,11 @@
18799  #include <dspbridge/services.h>
18800  #include <dspbridge/sync.h>
18801  #include <dspbridge/reg.h>
18802 -#include <dspbridge/csl.h>
18803  
18804  /*  ----------------------------------- Platform Manager */
18805  #include <dspbridge/wcdioctl.h>
18806  #include <dspbridge/_dcd.h>
18807  #include <dspbridge/dspdrv.h>
18808 -#include <dspbridge/dbreg.h>
18809  
18810  /*  ----------------------------------- Resource Manager */
18811  #include <dspbridge/pwr.h>
18812 @@ -88,30 +56,28 @@
18813  /*  ----------------------------------- This */
18814  #include <drv_interface.h>
18815  
18816 -#ifndef RES_CLEANUP_DISABLE
18817  #include <dspbridge/cfg.h>
18818  #include <dspbridge/resourcecleanup.h>
18819  #include <dspbridge/chnl.h>
18820  #include <dspbridge/proc.h>
18821 -#include <dspbridge/cfg.h>
18822  #include <dspbridge/dev.h>
18823  #include <dspbridge/drvdefs.h>
18824  #include <dspbridge/drv.h>
18825 -#include <dspbridge/dbreg.h>
18826 -#endif
18827  
18828 -#include <mach/omap-pm.h>
18829 +#ifdef CONFIG_BRIDGE_DVFS
18830  #include <mach-omap2/omap3-opp.h>
18831 +#endif
18832  
18833  #define BRIDGE_NAME "C6410"
18834  /*  ----------------------------------- Globals */
18835  #define DRIVER_NAME  "DspBridge"
18836 -#define DRIVER_MAJOR 0         /* Linux assigns our Major device number */
18837 -#define DRIVER_MINOR 0         /* Linux assigns our Major device number */
18838 +#define DSPBRIDGE_VERSION      "0.1"
18839  s32 dsp_debug;
18840  
18841  struct platform_device *omap_dspbridge_dev;
18842  
18843 +/* This is a test variable used by Bridge to test different sleep states */
18844 +s32 dsp_test_sleepstate;
18845  struct bridge_dev {
18846         struct cdev cdev;
18847  };
18848 @@ -124,19 +90,17 @@ static u32 driverContext;
18849  #ifdef CONFIG_BRIDGE_DEBUG
18850  static char *GT_str;
18851  #endif /* CONFIG_BRIDGE_DEBUG */
18852 -static s32 driver_major = DRIVER_MAJOR;
18853 -static s32 driver_minor = DRIVER_MINOR;
18854 +static s32 driver_major;
18855 +static s32 driver_minor;
18856  static char *base_img;
18857  char *iva_img;
18858 -static char *num_procs = "C55=1";
18859 -static s32 shm_size = 0x400000;        /* 4 MB */
18860 +static s32 _shm_size = 0x500000;       /* 5 MB */
18861 +static s32 shm_size = 0;
18862 +
18863  static u32 phys_mempool_base;
18864  static u32 phys_mempool_size;
18865  static int tc_wordswapon;      /* Default value is always false */
18866  
18867 -/* Minimum ACTIVE VDD1 OPP level for reliable DSP operation */
18868 -unsigned short min_active_opp = 3;
18869 -
18870  #ifdef CONFIG_PM
18871  struct omap34xx_bridge_suspend_data {
18872         int suspended;
18873 @@ -155,10 +119,9 @@ static int omap34xxbridge_suspend_lockou
18874         }
18875         return 0;
18876  }
18877 -
18878  #endif
18879  
18880 -#ifdef DEBUG
18881 +#ifdef CONFIG_BRIDGE_DEBUG
18882  module_param(GT_str, charp, 0);
18883  MODULE_PARM_DESC(GT_str, "GT string, default = NULL");
18884  
18885 @@ -166,11 +129,8 @@ module_param(dsp_debug, int, 0);
18886  MODULE_PARM_DESC(dsp_debug, "Wait after loading DSP image. default = false");
18887  #endif
18888  
18889 -module_param(driver_major, int, 0);    /* Driver's major number */
18890 -MODULE_PARM_DESC(driver_major, "Major device number, default = 0 (auto)");
18891 -
18892 -module_param(driver_minor, int, 0);    /* Driver's major number */
18893 -MODULE_PARM_DESC(driver_minor, "Minor device number, default = 0 (auto)");
18894 +module_param(dsp_test_sleepstate, int, 0);
18895 +MODULE_PARM_DESC(dsp_test_sleepstate, "DSP Sleep state = 0");
18896  
18897  module_param(base_img, charp, 0);
18898  MODULE_PARM_DESC(base_img, "DSP base image, default = NULL");
18899 @@ -188,11 +148,9 @@ MODULE_PARM_DESC(phys_mempool_size,
18900  module_param(tc_wordswapon, int, 0);
18901  MODULE_PARM_DESC(tc_wordswapon, "TC Word Swap Option. default = 0");
18902  
18903 -module_param(min_active_opp, ushort, S_IRUSR | S_IWUSR);
18904 -MODULE_PARM_DESC(min_active_opp, "Minimum ACTIVE VDD1 OPP Level, default = 3");
18905 -
18906  MODULE_AUTHOR("Texas Instruments");
18907  MODULE_LICENSE("GPL");
18908 +MODULE_VERSION(DSPBRIDGE_VERSION);
18909  
18910  static char *driver_name = DRIVER_NAME;
18911  
18912 @@ -200,7 +158,7 @@ static char *driver_name = DRIVER_NAME;
18913  static struct GT_Mask driverTrace;
18914  #endif /* CONFIG_BRIDGE_DEBUG */
18915  
18916 -static struct file_operations bridge_fops = {
18917 +static const struct file_operations bridge_fops = {
18918         .open           = bridge_open,
18919         .release        = bridge_release,
18920         .unlocked_ioctl = bridge_ioctl,
18921 @@ -278,38 +236,29 @@ static int __devinit omap34xx_bridge_pro
18922         omap_dspbridge_dev = pdev;
18923  
18924         /* use 2.6 device model */
18925 -       if (driver_major) {
18926 -               dev = MKDEV(driver_major, driver_minor);
18927 -               result = register_chrdev_region(dev, 1, driver_name);
18928 -       } else {
18929 -               result = alloc_chrdev_region(&dev, driver_minor, 1,
18930 -                                           driver_name);
18931 -               driver_major = MAJOR(dev);
18932 -       }
18933 -
18934 +       result = alloc_chrdev_region(&dev, driver_minor, 1, driver_name);
18935         if (result < 0) {
18936                 GT_1trace(driverTrace, GT_7CLASS, "bridge_init: "
18937                                 "Can't get Major %d \n", driver_major);
18938 -               return result;
18939 +               goto err1;
18940         }
18941  
18942 -       bridge_device = kmalloc(sizeof(struct bridge_dev), GFP_KERNEL);
18943 +       driver_major = MAJOR(dev);
18944 +
18945 +       bridge_device = kzalloc(sizeof(struct bridge_dev), GFP_KERNEL);
18946         if (!bridge_device) {
18947                 result = -ENOMEM;
18948 -               unregister_chrdev_region(dev, 1);
18949 -               return result;
18950 +               goto err2;
18951         }
18952 -       memset(bridge_device, 0, sizeof(struct bridge_dev));
18953         cdev_init(&bridge_device->cdev, &bridge_fops);
18954         bridge_device->cdev.owner = THIS_MODULE;
18955         bridge_device->cdev.ops = &bridge_fops;
18956  
18957         status = cdev_add(&bridge_device->cdev, dev, 1);
18958 -
18959         if (status) {
18960                 GT_0trace(driverTrace, GT_7CLASS,
18961                                 "Failed to add the bridge device \n");
18962 -               return status;
18963 +               goto err3;
18964         }
18965  
18966         /* udev support */
18967 @@ -325,7 +274,7 @@ static int __devinit omap34xx_bridge_pro
18968         GT_init();
18969         GT_create(&driverTrace, "LD");
18970  
18971 -#ifdef DEBUG
18972 +#ifdef CONFIG_BRIDGE_DEBUG
18973         if (GT_str)
18974                 GT_set(GT_str);
18975  #elif defined(DDSP_DEBUG_PRODUCT) && GT_TRACE
18976 @@ -349,22 +298,17 @@ static int __devinit omap34xx_bridge_pro
18977  
18978         if (base_img) {
18979                 temp = true;
18980 -               REG_SetValue(NULL, NULL, AUTOSTART, REG_DWORD, (u8 *)&temp,
18981 -                           sizeof(temp));
18982 -               REG_SetValue(NULL, NULL, DEFEXEC, REG_SZ, (u8 *)base_img,
18983 -                                               strlen(base_img) + 1);
18984 +               REG_SetValue(AUTOSTART, (u8 *)&temp, sizeof(temp));
18985 +               REG_SetValue(DEFEXEC, (u8 *)base_img, strlen(base_img) + 1);
18986         } else {
18987                 temp = false;
18988 -               REG_SetValue(NULL, NULL, AUTOSTART, REG_DWORD, (u8 *)&temp,
18989 -                           sizeof(temp));
18990 -               REG_SetValue(NULL, NULL, DEFEXEC, REG_SZ, (u8 *) "\0", (u32)2);
18991 -       }
18992 -       REG_SetValue(NULL, NULL, NUMPROCS, REG_SZ, (u8 *) num_procs,
18993 -                                               strlen(num_procs) + 1);
18994 -
18995 -       if (shm_size >= 0x10000) {      /* 64 KB */
18996 -               initStatus = REG_SetValue(NULL, NULL, SHMSIZE, REG_DWORD,
18997 -                                         (u8 *)&shm_size, sizeof(shm_size));
18998 +               REG_SetValue(AUTOSTART, (u8 *)&temp, sizeof(temp));
18999 +               REG_SetValue(DEFEXEC, (u8 *) "\0", (u32)2);
19000 +       }
19001 +
19002 +       if (_shm_size >= 0x10000) {     /* 64 KB */
19003 +               initStatus = REG_SetValue(SHMSIZE, (u8 *)&_shm_size,
19004 +                                         sizeof(_shm_size));
19005         } else {
19006                 initStatus = DSP_EINVALIDARG;
19007                 status = -1;
19008 @@ -372,38 +316,27 @@ static int __devinit omap34xx_bridge_pro
19009                           "SHM size must be at least 64 KB\n");
19010         }
19011         GT_1trace(driverTrace, GT_7CLASS,
19012 -                "requested shm_size = 0x%x\n", shm_size);
19013 +                "requested shm_size = 0x%x\n", _shm_size);
19014  
19015         if (pdata->phys_mempool_base && pdata->phys_mempool_size) {
19016                 phys_mempool_base = pdata->phys_mempool_base;
19017                 phys_mempool_size = pdata->phys_mempool_size;
19018         }
19019  
19020 -       if (phys_mempool_base > 0x0) {
19021 -               initStatus = REG_SetValue(NULL, NULL, PHYSMEMPOOLBASE,
19022 -                                        REG_DWORD, (u8 *)&phys_mempool_base,
19023 -                                        sizeof(phys_mempool_base));
19024 -       }
19025         GT_1trace(driverTrace, GT_7CLASS, "phys_mempool_base = 0x%x \n",
19026                  phys_mempool_base);
19027  
19028 -       if (phys_mempool_size > 0x0) {
19029 -               initStatus = REG_SetValue(NULL, NULL, PHYSMEMPOOLSIZE,
19030 -                                        REG_DWORD, (u8 *)&phys_mempool_size,
19031 -                                        sizeof(phys_mempool_size));
19032 -       }
19033         GT_1trace(driverTrace, GT_7CLASS, "phys_mempool_size = 0x%x\n",
19034                  phys_mempool_base);
19035         if ((phys_mempool_base > 0x0) && (phys_mempool_size > 0x0))
19036                 MEM_ExtPhysPoolInit(phys_mempool_base, phys_mempool_size);
19037         if (tc_wordswapon) {
19038                 GT_0trace(driverTrace, GT_7CLASS, "TC Word Swap is enabled\n");
19039 -               REG_SetValue(NULL, NULL, TCWORDSWAP, REG_DWORD,
19040 -                           (u8 *)&tc_wordswapon, sizeof(tc_wordswapon));
19041 +               REG_SetValue(TCWORDSWAP, (u8 *)&tc_wordswapon,
19042 +                           sizeof(tc_wordswapon));
19043         } else {
19044                 GT_0trace(driverTrace, GT_7CLASS, "TC Word Swap is disabled\n");
19045 -               REG_SetValue(NULL, NULL, TCWORDSWAP,
19046 -                           REG_DWORD, (u8 *)&tc_wordswapon,
19047 +               REG_SetValue(TCWORDSWAP, (u8 *)&tc_wordswapon,
19048                             sizeof(tc_wordswapon));
19049         }
19050         if (DSP_SUCCEEDED(initStatus)) {
19051 @@ -426,13 +359,6 @@ static int __devinit omap34xx_bridge_pro
19052                         GT_0trace(driverTrace, GT_7CLASS,
19053                         "clk_notifier_register FAIL for iva2_ck \n");
19054                 }
19055 -
19056 -               /*
19057 -                * When Smartreflex is ON, DSP requires at least OPP level 3
19058 -                * to operate reliably. So boost lower OPP levels to OPP3.
19059 -                */
19060 -               if (pdata->dsp_set_min_opp)
19061 -                       (*pdata->dsp_set_min_opp)(min_active_opp);
19062  #endif
19063                 driverContext = DSP_Init(&initStatus);
19064                 if (DSP_FAILED(initStatus)) {
19065 @@ -448,7 +374,17 @@ static int __devinit omap34xx_bridge_pro
19066         DBC_Assert(status == 0);
19067         DBC_Assert(DSP_SUCCEEDED(initStatus));
19068         GT_0trace(driverTrace, GT_ENTER, " <- driver_init\n");
19069 -       return status;
19070 +
19071 +       return 0;
19072 +
19073 +err3:
19074 +       kfree(bridge_device);
19075 +
19076 +err2:
19077 +       unregister_chrdev_region(dev, 1);
19078 +
19079 +err1:
19080 +       return result;
19081  }
19082  
19083  static int __devexit omap34xx_bridge_remove(struct platform_device *pdev)
19084 @@ -456,10 +392,7 @@ static int __devexit omap34xx_bridge_rem
19085         dev_t devno;
19086         bool ret;
19087         DSP_STATUS dsp_status = DSP_SOK;
19088 -       HANDLE       hDrvObject = NULL;
19089 -       struct PROCESS_CONTEXT  *pTmp = NULL;
19090 -       struct PROCESS_CONTEXT    *pCtxtclosed = NULL;
19091 -       struct PROC_OBJECT *proc_obj_ptr, *temp;
19092 +       HANDLE hDrvObject = NULL;
19093  
19094         GT_0trace(driverTrace, GT_ENTER, "-> driver_exit\n");
19095  
19096 @@ -477,21 +410,6 @@ static int __devexit omap34xx_bridge_rem
19097         }
19098  #endif /* #ifdef CONFIG_BRIDGE_DVFS */
19099  
19100 -       DRV_GetProcCtxtList(&pCtxtclosed, (struct DRV_OBJECT *)hDrvObject);
19101 -       while (pCtxtclosed != NULL) {
19102 -               GT_1trace(driverTrace, GT_5CLASS, "***Cleanup of "
19103 -                        "process***%d\n", pCtxtclosed->pid);
19104 -               DRV_RemoveAllResources(pCtxtclosed);
19105 -               list_for_each_entry_safe(proc_obj_ptr, temp,
19106 -                               &pCtxtclosed->processor_list, proc_object) {
19107 -                       PROC_Detach(proc_obj_ptr, pCtxtclosed);
19108 -               }
19109 -               pTmp = pCtxtclosed->next;
19110 -               DRV_RemoveProcContext((struct DRV_OBJECT *)hDrvObject,
19111 -                               pCtxtclosed);
19112 -               pCtxtclosed = pTmp;
19113 -       }
19114 -
19115         if (driverContext) {
19116                 /* Put the DSP in reset state */
19117                 ret = DSP_Deinit(driverContext);
19118 @@ -499,10 +417,14 @@ static int __devexit omap34xx_bridge_rem
19119                 DBC_Assert(ret == true);
19120         }
19121  
19122 +#ifdef CONFIG_BRIDGE_DVFS
19123         clk_put(clk_handle);
19124         clk_handle = NULL;
19125 +#endif /* #ifdef CONFIG_BRIDGE_DVFS */
19126  
19127  func_cont:
19128 +       MEM_ExtPhysPoolRelease();
19129 +
19130         SERVICES_Exit();
19131         GT_exit();
19132  
19133 @@ -580,27 +502,22 @@ static void __exit bridge_exit(void)
19134  static int bridge_open(struct inode *ip, struct file *filp)
19135  {
19136         int status = 0;
19137 -       DSP_STATUS dsp_status;
19138 -       HANDLE hDrvObject;
19139         struct PROCESS_CONTEXT *pr_ctxt = NULL;
19140  
19141         GT_0trace(driverTrace, GT_ENTER, "-> bridge_open\n");
19142  
19143 -       dsp_status = CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
19144 -       if (DSP_SUCCEEDED(dsp_status)) {
19145 -               /*
19146 -                * Allocate a new process context and insert it into global
19147 -                * process context list.
19148 -                */
19149 -               DRV_InsertProcContext(hDrvObject, &pr_ctxt);
19150 -               if (pr_ctxt) {
19151 -                       DRV_ProcUpdatestate(pr_ctxt, PROC_RES_ALLOCATED);
19152 -                       DRV_ProcSetPID(pr_ctxt, current->tgid);
19153 -               } else {
19154 -                       status = -ENOMEM;
19155 -               }
19156 +       /*
19157 +        * Allocate a new process context and insert it into global
19158 +        * process context list.
19159 +        */
19160 +       pr_ctxt = MEM_Calloc(sizeof(struct PROCESS_CONTEXT), MEM_PAGED);
19161 +       if (pr_ctxt) {
19162 +               pr_ctxt->resState = PROC_RES_ALLOCATED;
19163 +               mutex_init(&pr_ctxt->dmm_mutex);
19164 +               mutex_init(&pr_ctxt->node_mutex);
19165 +               mutex_init(&pr_ctxt->strm_mutex);
19166         } else {
19167 -               status = -EIO;
19168 +               status = -ENOMEM;
19169         }
19170  
19171         filp->private_data = pr_ctxt;
19172 @@ -616,34 +533,25 @@ static int bridge_open(struct inode *ip,
19173  static int bridge_release(struct inode *ip, struct file *filp)
19174  {
19175         int status = 0;
19176 -       DSP_STATUS dsp_status;
19177 -       HANDLE hDrvObject;
19178         struct PROCESS_CONTEXT *pr_ctxt;
19179 -       struct PROC_OBJECT *proc_obj_ptr, *temp;
19180  
19181         GT_0trace(driverTrace, GT_ENTER, "-> bridge_release\n");
19182  
19183         if (!filp->private_data) {
19184                 status = -EIO;
19185 -       } else {
19186 -               pr_ctxt = filp->private_data;
19187 -               dsp_status = CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
19188 -               if (DSP_SUCCEEDED(dsp_status)) {
19189 -                       flush_signals(current);
19190 -                       DRV_RemoveAllResources(pr_ctxt);
19191 -                       list_for_each_entry_safe(proc_obj_ptr, temp,
19192 -                                       &pr_ctxt->processor_list,
19193 -                                       proc_object) {
19194 -                               PROC_Detach(proc_obj_ptr, pr_ctxt);
19195 -                       }
19196 -                       DRV_RemoveProcContext((struct DRV_OBJECT *)hDrvObject,
19197 -                                       pr_ctxt);
19198 -               } else {
19199 -                       status = -EIO;
19200 -               }
19201 -               filp->private_data = NULL;
19202 +               goto err;
19203         }
19204  
19205 +       pr_ctxt = filp->private_data;
19206 +       flush_signals(current);
19207 +       DRV_RemoveAllResources(pr_ctxt);
19208 +       if (pr_ctxt->hProcessor)
19209 +               PROC_Detach(pr_ctxt);
19210 +       MEM_Free(pr_ctxt);
19211 +
19212 +       filp->private_data = NULL;
19213 +
19214 +err:
19215         GT_0trace(driverTrace, GT_ENTER, "<- bridge_release\n");
19216         return status;
19217  }
19218 @@ -665,13 +573,15 @@ static long bridge_ioctl(struct file *fi
19219  
19220         GT_0trace(driverTrace, GT_ENTER, " -> driver_ioctl\n");
19221  
19222 -       /* Deduct one for the CMD_BASE. */
19223 -       code = (code - 1);
19224 +       if (!filp->private_data) {
19225 +               status = -EIO;
19226 +               goto err;
19227 +       }
19228  
19229         status = copy_from_user(&pBufIn, (union Trapped_Args *)args,
19230                                 sizeof(union Trapped_Args));
19231  
19232 -       if (status >= 0) {
19233 +       if (!status) {
19234                 status = WCD_CallDevIOCtl(code, &pBufIn, &retval,
19235                                 filp->private_data);
19236  
19237 @@ -685,8 +595,8 @@ static long bridge_ioctl(struct file *fi
19238  
19239         }
19240  
19241 +err:
19242         GT_0trace(driverTrace, GT_ENTER, " <- driver_ioctl\n");
19243 -
19244         return status;
19245  }
19246  
19247 @@ -716,22 +626,18 @@ static int bridge_mmap(struct file *filp
19248         return status;
19249  }
19250  
19251 -#ifndef RES_CLEANUP_DISABLE
19252  /* To remove all process resources before removing the process from the
19253   * process context list*/
19254  DSP_STATUS DRV_RemoveAllResources(HANDLE hPCtxt)
19255  {
19256         DSP_STATUS status = DSP_SOK;
19257         struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
19258 -       if (pCtxt != NULL) {
19259 -               DRV_RemoveAllSTRMResElements(pCtxt);
19260 -               DRV_RemoveAllNodeResElements(pCtxt);
19261 -               DRV_RemoveAllDMMResElements(pCtxt);
19262 -               DRV_ProcUpdatestate(pCtxt, PROC_RES_FREED);
19263 -       }
19264 +       DRV_RemoveAllSTRMResElements(pCtxt);
19265 +       DRV_RemoveAllNodeResElements(pCtxt);
19266 +       DRV_RemoveAllDMMResElements(pCtxt);
19267 +       pCtxt->resState = PROC_RES_FREED;
19268         return status;
19269  }
19270 -#endif
19271  
19272  /* Bridge driver initialization and de-initialization functions */
19273  module_init(bridge_init);
19274 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/drv_interface.h kernel-power-2.6.28/drivers/dsp/bridge/rmgr/drv_interface.h
19275 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/drv_interface.h    2011-04-17 17:32:26.000000000 +0100
19276 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/drv_interface.h 2011-05-02 22:36:50.000000000 +0100
19277 @@ -14,18 +14,6 @@
19278   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19279   */
19280  
19281 -
19282 -/*
19283 - *  ======== drv_interface.h ========
19284 - *
19285 - *! Revision History
19286 - *! ================
19287 - *! 24-Mar-2003 vp  Added hooks for Power Management Test
19288 - *! 18-Feb-2003 vp  Code review updates
19289 - *! 18-Oct-2002 sb  Created initial version
19290 -
19291 - */
19292 -
19293  #ifndef        _DRV_INTERFACE_H_
19294  #define _DRV_INTERFACE_H_
19295  
19296 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/dspdrv.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/dspdrv.c
19297 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/dspdrv.c   2011-04-17 17:32:26.000000000 +0100
19298 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/dspdrv.c        2011-05-02 22:36:50.000000000 +0100
19299 @@ -3,6 +3,8 @@
19300   *
19301   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
19302   *
19303 + * Interface to allocate and free bridge resources.
19304 + *
19305   * Copyright (C) 2005-2006 Texas Instruments, Inc.
19306   *
19307   * This package is free software; you can redistribute it and/or modify
19308 @@ -14,83 +16,6 @@
19309   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19310   */
19311  
19312 -
19313 -/*
19314 - *  ======== dspdrv.c ========
19315 - *  Description:
19316 - *      Interface to allocate and free bridge resources.
19317 - *
19318 - *! Revision History
19319 - *! ================
19320 - *! 12-Apr-2004 hp: Compile IVA only for 24xx.
19321 - *! 09-Feb-2004 vp: Updated to support IVA.
19322 - *! 10-Feb-2003 vp: Code review updates.
19323 - *! 18-oct-2002 vp: Ported to the Linux platform.
19324 - *! 03-Mar-2002 rr: DSP_Deinit bug fixed (gets the Mgrhandle from registry
19325 - *!                        before calling MGR_Destroy.
19326 - *! 11-Jul-2001 jeh Moved MGR_Create() from DSP_Init() to DEV_StartDevice().
19327 - *! 02-Apr-2001 rr: WCD_InitComplete2 return value is not checked thus
19328 - *!                 sllowing the class driver to load irrespective of
19329 - *!                 the image load.
19330 - *! 30-Oct-2000 kc: Made changes w.r.t. usage of REG_SetValue.
19331 - *! 05-Oct-2000 rr: WCD_InitComplete2 return value checked for RM.
19332 - *!                 Failure in WCD_InitComplete2 will cause the
19333 - *!                 DSP_Init to fail.
19334 - *! 12-Aug-2000 kc: Changed REG_EnumValue to REG_EnumKey.
19335 - *! 07-Aug-2000 rr: MGR_Create does the job of loading the DCD Dll.
19336 - *! 26-Jul-2000 rr: Driver Object holds the DevNodeStrings for each
19337 - *!                 DevObjects. Static variables removed. Returns
19338 - *!                 the Driver Object in DSP_Init.
19339 - *! 17-Jul-2000 rr: Driver Object is created in DSP_Init and that holds
19340 - *!                 the list of Device objects.
19341 - *! 07-Jul-2000 rr: RM implementaion started.
19342 - *! 24-May-2000 ag: Cleaned up debug msgs.
19343 - *! 02-May-2000 rr: DSP_Open returns GetCallerProcess as dwOpenContext.
19344 - *! 03-Feb-2000 rr: GT Changes.
19345 - *! 28-Jan-2000 rr: Code Cleaned up.Type void changed to void.
19346 - *!                 DSP_Deinit checks return values.dwCode in
19347 - *!                 DSP_IO_CONTROL is decoded(not hard coded)
19348 - *! 27-Jan-2000 rr: REG_EnumValue Used .EnumerateKey fxn removed.
19349 - *! 13-Jan-2000 rr: CFG_GetPrivateDword renamed to CFG_GetDevObject.
19350 - *! 29-Dec-1999 rr: Code Cleaned up
19351 - *! 09-Dec-1999 rr: EnumerateKey changed for retail build.
19352 - *! 06-Dec-1999 rr: ArrayofInstalledNode, index and  ArrayofInstalledDev
19353 - *!                 is Global.DevObject stores this pointer as hDevNode.
19354 - *! 02-Dec-1999 rr: DBG_SetGT and RetailMSG conditionally included.
19355 - *!                 Comments changed.Deinit handled.Code cleaned up.
19356 - *!                 DSP_IOControl, Close, Deinit returns bool values.
19357 - *!                 Calls WCD_InitComplete2 for Board AutoStart.
19358 - *! 29-Nov-1999 rr: DSP_IOControl returns the result through pBufOut.
19359 - *!                 Global Arrays keeps track of installed devices.
19360 - *! 19-Nov-1999 rr: DSP_Init handles multiple drivers.
19361 - *! 12-Nov-1999 rr: GetDriverKey and EnumerateKey functions added.
19362 - *!                 for multiple mini driver support.PCCARD flag
19363 - *!                 checking to include PCMCIA related stuff.
19364 - *! 25-Oct-1999 rr: GT_Init is called within the Process Attach.
19365 - *!                 return value initalized to S_OK upfront in the
19366 - *!                 Process Attach.
19367 - *! 15-Oct-1999 rr: DSP_DeInit handles the return values
19368 - *! 05-Oct-1999 rr: All the PCMCIA related functions are now in PCCARD.c
19369 - *!                 DRV_Request Resources is used instead of the
19370 - *!                 RegisterMiniDriver as it sounds close to what we are doing.
19371 - *! 24-Sep-1999 rr: DRV_RegisterMiniDriver is being called from here. Only
19372 - *!                 neccessaryPCMCIA fxns are here. Soon they will move out
19373 - *!                  either to a seperate file for bus specific inits.
19374 - *! 10-Sep-1999 rr: GT Enabled. Considerably changed the  driver structure as
19375 - *!                 - This is the Class driver. After successfully initialized
19376 - *!                   the Class driver will attempt to load the Mini driver.
19377 - *!                 - Need to seperate the PCMCIA stuff based on bus type.
19378 - *!                 - Changed the name of the file to wcdce.c
19379 - *!                 - Made the Media Handle as Global again
19380 - *!
19381 - *! 19-Aug-1999 rr: Removed the Global hbhMediaHandle. Included the MemTest.
19382 - *!                 Modified the DSP_Init, now three windows are opened.
19383 - *!                 Split the driver into PDD so that hardware dependent
19384 - *!                 functions will reside in PDD.
19385 - *! 16-Jul-1999 ag  Adapted from rkw's CAC Bullet card driver.
19386 - *!
19387 - */
19388 -
19389  /*  ----------------------------------- Host OS */
19390  #include <dspbridge/host_os.h>
19391  
19392 @@ -105,7 +30,6 @@
19393  
19394  /*  ----------------------------------- OS Adaptation Layer */
19395  #include <dspbridge/cfg.h>
19396 -#include <dspbridge/csl.h>
19397  #include <dspbridge/mem.h>
19398  #include <dspbridge/reg.h>
19399  
19400 @@ -117,9 +41,6 @@
19401  /*  ----------------------------------- Resource Manager */
19402  #include <dspbridge/mgr.h>
19403  
19404 -/*  ----------------------------------- Others */
19405 -#include <dspbridge/dbreg.h>
19406 -
19407  /*  ----------------------------------- This */
19408  #include <dspbridge/dspdrv.h>
19409  
19410 @@ -135,7 +56,6 @@ u32 DSP_Init(OUT u32 *initStatus)
19411         char devNode[MAXREGPATHLENGTH] = "TIOMAP1510";
19412         DSP_STATUS status = DSP_EFAIL;
19413         struct DRV_OBJECT *drvObject = NULL;
19414 -       u32 index = 0;
19415         u32 deviceNode;
19416         u32 deviceNodeString;
19417  
19418 @@ -143,11 +63,12 @@ u32 DSP_Init(OUT u32 *initStatus)
19419  
19420         GT_0trace(curTrace, GT_ENTER, "Entering DSP_Init \r\n");
19421  
19422 -       if (DSP_FAILED(WCD_Init())) {
19423 +       if (!WCD_Init()) {
19424                 GT_0trace(curTrace, GT_7CLASS, "DSP_Init Failed \n");
19425                 goto func_cont;
19426         }                       /* End WCD_Exit */
19427 -       if (DSP_FAILED(DRV_Create(&drvObject))) {
19428 +       status = DRV_Create(&drvObject);
19429 +       if (DSP_FAILED(status)) {
19430                 GT_0trace(curTrace, GT_7CLASS, "DSP_Init:DRV_Create Failed \n");
19431                 WCD_Exit();
19432                 goto func_cont;
19433 @@ -155,29 +76,27 @@ u32 DSP_Init(OUT u32 *initStatus)
19434         GT_0trace(curTrace, GT_5CLASS, "DSP_Init:DRV Created \r\n");
19435  
19436         /* Request Resources */
19437 -       if (DSP_SUCCEEDED(DRV_RequestResources((u32)&devNode,
19438 -          &deviceNodeString))) {
19439 +       status = DRV_RequestResources((u32)&devNode, &deviceNodeString);
19440 +       if (DSP_SUCCEEDED(status)) {
19441                 /* Attempt to Start the Device */
19442 -               if (DSP_SUCCEEDED(DEV_StartDevice(
19443 -                  (struct CFG_DEVNODE *)deviceNodeString))) {
19444 +               status = DEV_StartDevice((struct CFG_DEVNODE *)
19445 +                                                       deviceNodeString);
19446 +               if (DSP_SUCCEEDED(status)) {
19447                         /* Retreive the DevObject from the Registry */
19448 -                       GT_2trace(curTrace, GT_1CLASS,
19449 -                                "DSP_Init Succeeded for Device1:"
19450 -                                "%d: value: %x\n", index, deviceNodeString);
19451 -                       status = DSP_SOK;
19452 +                       GT_1trace(curTrace, GT_1CLASS,
19453 +                                "DSP_Init Succeeded for Device1 value: %x\n",
19454 +                                deviceNodeString);
19455                 } else {
19456                         GT_0trace(curTrace, GT_7CLASS,
19457                                  "DSP_Init:DEV_StartDevice Failed\n");
19458                         (void)DRV_ReleaseResources
19459                                 ((u32) deviceNodeString, drvObject);
19460 -                       status = DSP_EFAIL;
19461                 }
19462         } else {
19463                 GT_0trace(curTrace, GT_7CLASS,
19464                          "DSP_Init:DRV_RequestResources Failed \r\n");
19465                 status = DSP_EFAIL;
19466 -       }       /* DRV_RequestResources */
19467 -       index++;
19468 +       }
19469  
19470         /* Unwind whatever was loaded */
19471         if (DSP_FAILED(status)) {
19472 @@ -185,7 +104,6 @@ u32 DSP_Init(OUT u32 *initStatus)
19473                  * unloading. Get the Driver Object iterate through and remove.
19474                  * Reset the status to E_FAIL to avoid going through
19475                  * WCD_InitComplete2. */
19476 -               status = DSP_EFAIL;
19477                 for (deviceNode = DRV_GetFirstDevExtension(); deviceNode != 0;
19478                     deviceNode = DRV_GetNextDevExtension(deviceNode)) {
19479                         (void)DEV_RemoveDevice
19480 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/mgr.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/mgr.c
19481 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/mgr.c      2011-04-17 17:32:26.000000000 +0100
19482 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/mgr.c   2011-05-02 22:36:50.000000000 +0100
19483 @@ -3,6 +3,10 @@
19484   *
19485   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
19486   *
19487 + * Implementation of Manager interface to the device object at the
19488 + * driver level. This queries the NDB data base and retrieves the
19489 + * data about Node and Processor.
19490 + *
19491   * Copyright (C) 2005-2006 Texas Instruments, Inc.
19492   *
19493   * This package is free software; you can redistribute it and/or modify
19494 @@ -14,32 +18,6 @@
19495   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19496   */
19497  
19498 -
19499 -/*
19500 - *  ======== mgr.c ========
19501 - *  Description:
19502 - *      Implementation of Manager interface to the device object at the
19503 - *      driver level. This queries the NDB data base and retrieves the
19504 - *      data about Node and Processor.
19505 - *
19506 - *
19507 - *! Revision History:
19508 - *! ================
19509 - *! 12-Feb-2003 vp: Code review updates.
19510 - *! 18-Oct-2002 vp: Ported to Linux platform
19511 - *! 01-Aug-2001 ag: Added extended info for DSP-MMU setup support.
19512 - *! 13-Feb-2001 kc: DSP/BIOS Bridge name updates.
19513 - *! 22-Nov-2000 kc: Added MGR_GetPerfData.
19514 - *! 03-Nov-2000 rr: Updated after code review.
19515 - *! 25-Sep-2000 rr: Updated to Version 0.9
19516 - *! 10-Aug-2000 rr: dwSignature is not specifically inserted in MGR Obj
19517 - *!                 as it is taken care by MEM_AllocObject. stdwin.h added
19518 - *!                 for retail build to succeed.
19519 - *! 07-Aug-2000 rr: MGR_Create does the job of Loading DCD Dll.
19520 - *! 26-Jul-2000 rr: MGR_Destroy releases the hNDBDll.
19521 - *! 20-Jun-2000 rr: Created.
19522 - */
19523 -
19524  /*  ----------------------------------- DSP/BIOS Bridge */
19525  #include <dspbridge/std.h>
19526  #include <dspbridge/dbdefs.h>
19527 @@ -56,7 +34,6 @@
19528  
19529  /*  ----------------------------------- Others */
19530  #include <dspbridge/dbdcd.h>
19531 -#include <dspbridge/dbreg.h>
19532  #include <dspbridge/drv.h>
19533  #include <dspbridge/dev.h>
19534  
19535 @@ -97,16 +74,16 @@ DSP_STATUS MGR_Create(OUT struct MGR_OBJ
19536                  phMgrObject);
19537         MEM_AllocObject(pMgrObject, struct MGR_OBJECT, SIGNATURE);
19538         if (pMgrObject) {
19539 -               if (DSP_SUCCEEDED(DCD_CreateManager(ZLDLLNAME,
19540 -                  &pMgrObject->hDcdMgr))) {
19541 +               status = DCD_CreateManager(ZLDLLNAME, &pMgrObject->hDcdMgr);
19542 +               if (DSP_SUCCEEDED(status)) {
19543                         /* If succeeded store the handle in the MGR Object */
19544 -                       if (DSP_SUCCEEDED(CFG_SetObject((u32)pMgrObject,
19545 -                          REG_MGR_OBJECT))) {
19546 +                       status = CFG_SetObject((u32)pMgrObject,
19547 +                                                       REG_MGR_OBJECT);
19548 +                       if (DSP_SUCCEEDED(status)) {
19549                                 *phMgrObject = pMgrObject;
19550                                 GT_0trace(MGR_DebugMask, GT_1CLASS,
19551                                          "MGR_Create:MGR Created\r\n");
19552                         } else {
19553 -                               status = DSP_EFAIL;
19554                                 GT_0trace(MGR_DebugMask, GT_7CLASS,
19555                                          "MGR_Create:CFG_SetObject "
19556                                          "Failed\r\n");
19557 @@ -115,7 +92,6 @@ DSP_STATUS MGR_Create(OUT struct MGR_OBJ
19558                         }
19559                 } else {
19560                         /* failed to Create DCD Manager */
19561 -                       status = DSP_EFAIL;
19562                         GT_0trace(MGR_DebugMask, GT_7CLASS,
19563                                  "MGR_Create:DCD_ManagerCreate Failed\r\n");
19564                         MEM_FreeObject(pMgrObject);
19565 @@ -174,7 +150,6 @@ DSP_STATUS MGR_EnumNodeInfo(u32 uNode, O
19566                            u32 uNDBPropsSize, OUT u32 *puNumNodes)
19567  {
19568         DSP_STATUS status = DSP_SOK;
19569 -       DSP_STATUS status1 = DSP_SOK;
19570         struct DSP_UUID Uuid, uTempUuid;
19571         u32 uTempIndex = 0;
19572         u32 uNodeIndex = 0;
19573 @@ -192,8 +167,8 @@ DSP_STATUS MGR_EnumNodeInfo(u32 uNode, O
19574                  uNDBPropsSize, puNumNodes);
19575         *puNumNodes = 0;
19576         /* Get The Manager Object from the Registry */
19577 -       if (DSP_FAILED(CFG_GetObject((u32 *)&pMgrObject,
19578 -          REG_MGR_OBJECT))) {
19579 +       status = CFG_GetObject((u32 *)&pMgrObject, REG_MGR_OBJECT);
19580 +       if (DSP_FAILED(status)) {
19581                 GT_0trace(MGR_DebugMask, GT_7CLASS,
19582                          "Manager_EnumNodeInfo:Failed To Get"
19583                          " MGR Object from Registry\r\n");
19584 @@ -219,26 +194,23 @@ DSP_STATUS MGR_EnumNodeInfo(u32 uNode, O
19585                                  "Manager_EnumNodeInfo: uNode"
19586                                  " is Invalid \r\n");
19587                 } else {
19588 -                       status1 = DCD_GetObjectDef(pMgrObject->hDcdMgr,
19589 +                       status = DCD_GetObjectDef(pMgrObject->hDcdMgr,
19590                                                 (struct DSP_UUID *)&Uuid,
19591                                                 DSP_DCDNODETYPE, &GenObj);
19592 -                       if (DSP_SUCCEEDED(status1)) {
19593 +                       if (DSP_SUCCEEDED(status)) {
19594                                 /* Get the Obj def */
19595                                 *pNDBProps = GenObj.objData.nodeObj.ndbProps;
19596                                 *puNumNodes = uNodeIndex;
19597 -                               status = DSP_SOK;
19598                         } else {
19599                                 GT_0trace(MGR_DebugMask, GT_7CLASS,
19600                                          "Manager_EnumNodeInfo: "
19601                                          "Failed to Get Node Info \r\n");
19602 -                               status = DSP_EFAIL;
19603                         }
19604                 }
19605         } else {
19606                 /* This could be changed during enum, EFAIL ... */
19607                 GT_0trace(MGR_DebugMask, GT_7CLASS, "Manager_EnumNodeInfo: "
19608                          "Enumeration failure\r\n");
19609 -               status = DSP_EFAIL;
19610         }
19611  func_cont:
19612         GT_4trace(MGR_DebugMask, GT_ENTER,
19613 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/nldr.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/nldr.c
19614 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/nldr.c     2011-04-17 17:32:26.000000000 +0100
19615 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/nldr.c  2011-05-02 22:36:50.000000000 +0100
19616 @@ -3,6 +3,8 @@
19617   *
19618   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
19619   *
19620 + * DSP/BIOS Bridge dynamic + overlay Node loader.
19621 + *
19622   * Copyright (C) 2005-2006 Texas Instruments, Inc.
19623   *
19624   * This package is free software; you can redistribute it and/or modify
19625 @@ -14,42 +16,6 @@
19626   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19627   */
19628  
19629 -
19630 -/*
19631 - *  ======== nldr.c ========
19632 - *  Description:
19633 - *      DSP/BIOS Bridge dynamic + overlay Node loader.
19634 - *
19635 - *  Public Functions:
19636 - *      NLDR_Allocate
19637 - *      NLDR_Create
19638 - *      NLDR_Delete
19639 - *      NLDR_Exit
19640 - *      NLDR_Free
19641 - *      NLDR_GetFxnAddr
19642 - *      NLDR_Init
19643 - *      NLDR_Load
19644 - *      NLDR_Unload
19645 - *
19646 - *  Notes:
19647 - *
19648 - *! Revision History
19649 - *! ================
19650 - *! 07-Apr-2003 map Removed references to dead DLDR module
19651 - *! 23-Jan-2003 map Updated RemoteAlloc to support memory granularity
19652 - *! 20-Jan-2003 map Updated to maintain persistent dependent libraries
19653 - *! 15-Jan-2003 map Adapted for use with multiple dynamic phase libraries
19654 - *! 19-Dec-2002 map Fixed overlay bug in AddOvlySect for overlay
19655 - *!             sections > 1024 bytes.
19656 - *! 13-Dec-2002 map Fixed NLDR_GetFxnAddr bug by searching dependent
19657 - *!             libs for symbols
19658 - *! 27-Sep-2002 map Added RemoteFree to convert size to words for
19659 - *!             correct deallocation
19660 - *! 16-Sep-2002 map Code Review Cleanup(from dldr.c)
19661 - *! 29-Aug-2002 map Adjusted for ARM-side overlay copy
19662 - *! 05-Aug-2002 jeh Created.
19663 - */
19664 -
19665  #include <dspbridge/host_os.h>
19666  
19667  #include <dspbridge/std.h>
19668 @@ -58,12 +24,11 @@
19669  
19670  #include <dspbridge/dbc.h>
19671  #include <dspbridge/gt.h>
19672 -#ifdef DEBUG
19673 +#ifdef CONFIG_BRIDGE_DEBUG
19674  #include <dspbridge/dbg.h>
19675  #endif
19676  
19677  /* OS adaptation layer */
19678 -#include <dspbridge/csl.h>
19679  #include <dspbridge/mem.h>
19680  
19681  /* Platform manager */
19682 @@ -128,15 +93,15 @@
19683  #define FLAGBIT         7      /* 7th bit is pref./req. flag */
19684  #define SEGMASK         0x3f   /* Bits 0 - 5 */
19685  
19686 -#define CREATEBIT       0      /* Create segid starts at bit 0 */
19687 -#define DELETEBIT       8      /* Delete segid starts at bit 8 */
19688 +#define CREATEBIT      0       /* Create segid starts at bit 0 */
19689 +#define DELETEBIT      8       /* Delete segid starts at bit 8 */
19690  #define EXECUTEBIT      16     /* Execute segid starts at bit 16 */
19691  
19692  /*
19693   *  Masks that define memory type.  Must match defines in dynm.cdb.
19694   */
19695 -#define DYNM_CODE       0x2
19696 -#define DYNM_DATA       0x4
19697 +#define DYNM_CODE      0x2
19698 +#define DYNM_DATA      0x4
19699  #define DYNM_CODEDATA   (DYNM_CODE | DYNM_DATA)
19700  #define DYNM_INTERNAL   0x8
19701  #define DYNM_EXTERNAL   0x10
19702 @@ -186,7 +151,7 @@
19703         ((uuid1).usData3 == (uuid2).usData3) && \
19704         ((uuid1).ucData4 == (uuid2).ucData4) && \
19705         ((uuid1).ucData5 == (uuid2).ucData5) && \
19706 -       (strncmp((void *)(uuid1).ucData6, (void *)(uuid2).ucData6, 6)) == 0)
19707 +       (strncmp((void *)(uuid1).ucData6, (void *)(uuid2).ucData6, 6)) == 0)
19708  
19709      /*
19710       *  ======== MemInfo ========
19711 @@ -470,7 +435,7 @@ DSP_STATUS NLDR_Allocate(struct NLDR_OBJ
19712         }
19713         /* Cleanup on failure */
19714         if (DSP_FAILED(status) && pNldrNode)
19715 -               NLDR_Free((struct NLDR_NODEOBJECT *) pNldrNode);
19716 +               MEM_FreeObject(pNldrNode);
19717  
19718         DBC_Ensure((DSP_SUCCEEDED(status) &&
19719                   MEM_IsValidHandle(((struct NLDR_NODEOBJECT *)(*phNldrNode)),
19720 @@ -513,17 +478,12 @@ DSP_STATUS NLDR_Create(OUT struct NLDR_O
19721         MEM_AllocObject(pNldr, struct NLDR_OBJECT, NLDR_SIGNATURE);
19722         if (pNldr) {
19723                 pNldr->hDevObject = hDevObject;
19724 -               /* warning, lazy status checking alert! */
19725                 status = DEV_GetCodMgr(hDevObject, &hCodMgr);
19726 -               DBC_Assert(DSP_SUCCEEDED(status));
19727 -               status = COD_GetLoader(hCodMgr, &pNldr->dbll);
19728 -               DBC_Assert(DSP_SUCCEEDED(status));
19729 -               status = COD_GetBaseLib(hCodMgr, &pNldr->baseLib);
19730 -               DBC_Assert(DSP_SUCCEEDED(status));
19731 -               status = COD_GetBaseName(hCodMgr, szZLFile, COD_MAXPATHLENGTH);
19732 -               DBC_Assert(DSP_SUCCEEDED(status));
19733 -               status = DSP_SOK;
19734 -               /* end lazy status checking */
19735 +               if (hCodMgr) {
19736 +                       COD_GetLoader(hCodMgr, &pNldr->dbll);
19737 +                       COD_GetBaseLib(hCodMgr, &pNldr->baseLib);
19738 +                       COD_GetBaseName(hCodMgr, szZLFile, COD_MAXPATHLENGTH);
19739 +               }
19740                 pNldr->usDSPMauSize = pAttrs->usDSPMauSize;
19741                 pNldr->usDSPWordSize = pAttrs->usDSPWordSize;
19742                 pNldr->dbllFxns = dbllFxns;
19743 @@ -598,7 +558,7 @@ DSP_STATUS NLDR_Create(OUT struct NLDR_O
19744                                 rmmSegs[i].length = (pMemInfo + i)->len;
19745                                 rmmSegs[i].space = 0;
19746                                 pNldr->segTable[i] = (pMemInfo + i)->type;
19747 -#ifdef DEBUG
19748 +#ifdef CONFIG_BRIDGE_DEBUG
19749                                 DBG_Trace(DBG_LEVEL7,
19750                                     "** (proc) DLL MEMSEGMENT: %d, Base: 0x%x, "
19751                                     "Length: 0x%x\n", i, rmmSegs[i].base,
19752 @@ -753,19 +713,6 @@ void NLDR_Exit(void)
19753  }
19754  
19755  /*
19756 - *  ======== NLDR_Free ========
19757 - */
19758 -void NLDR_Free(struct NLDR_NODEOBJECT *hNldrNode)
19759 -{
19760 -       DBC_Require(cRefs > 0);
19761 -       DBC_Require(MEM_IsValidHandle(hNldrNode, NLDR_NODESIGNATURE));
19762 -
19763 -       GT_1trace(NLDR_debugMask, GT_ENTER, "NLDR_Free(0x%x)\n", hNldrNode);
19764 -
19765 -       MEM_FreeObject(hNldrNode);
19766 -}
19767 -
19768 -/*
19769   *  ======== NLDR_GetFxnAddr ========
19770   */
19771  DSP_STATUS NLDR_GetFxnAddr(struct NLDR_NODEOBJECT *hNldrNode, char *pstrFxn,
19772 @@ -1008,7 +955,8 @@ DSP_STATUS NLDR_Unload(struct NLDR_NODEO
19773                                 /* Unload main library */
19774                                 pRootLib = &hNldrNode->root;
19775                         }
19776 -                       UnloadLib(hNldrNode, pRootLib);
19777 +                       if (pRootLib)
19778 +                               UnloadLib(hNldrNode, pRootLib);
19779                 } else {
19780                         if (hNldrNode->fOverlay)
19781                                 UnloadOvly(hNldrNode, phase);
19782 @@ -1040,9 +988,9 @@ static DSP_STATUS AddOvlyInfo(void *hand
19783         /* Find the node it belongs to */
19784         for (i = 0; i < hNldr->nOvlyNodes; i++) {
19785                 pNodeName = hNldr->ovlyTable[i].pNodeName;
19786 -               DBC_Require(pNodeName);
19787 -               if (strncmp(pNodeName, pSectName + 1,
19788 -                               strlen(pNodeName)) == 0) {
19789 +               DBC_Require(pNodeName);
19790 +               if (strncmp(pNodeName, pSectName + 1,
19791 +                               strlen(pNodeName)) == 0) {
19792                                 /* Found the node */
19793                                 break;
19794                 }
19795 @@ -1052,18 +1000,18 @@ static DSP_STATUS AddOvlyInfo(void *hand
19796  
19797         /* Determine which phase this section belongs to */
19798         for (pch = pSectName + 1; *pch && *pch != seps; pch++)
19799 -               ;;
19800 +               ;
19801  
19802         if (*pch) {
19803                 pch++;  /* Skip over the ':' */
19804 -               if (strncmp(pch, PCREATE, strlen(PCREATE)) == 0) {
19805 +               if (strncmp(pch, PCREATE, strlen(PCREATE)) == 0) {
19806                         status = AddOvlySect(hNldr, &hNldr->ovlyTable[i].
19807                                 pCreateSects, sectInfo, &fExists, addr, nBytes);
19808                         if (DSP_SUCCEEDED(status) && !fExists)
19809                                 hNldr->ovlyTable[i].nCreateSects++;
19810  
19811                 } else
19812 -               if (strncmp(pch, PDELETE, strlen(PDELETE)) == 0) {
19813 +               if (strncmp(pch, PDELETE, strlen(PDELETE)) == 0) {
19814                         status = AddOvlySect(hNldr, &hNldr->ovlyTable[i].
19815                                             pDeleteSects, sectInfo, &fExists,
19816                                             addr, nBytes);
19817 @@ -1071,7 +1019,7 @@ static DSP_STATUS AddOvlyInfo(void *hand
19818                                 hNldr->ovlyTable[i].nDeleteSects++;
19819  
19820                 } else
19821 -               if (strncmp(pch, PEXECUTE, strlen(PEXECUTE)) == 0) {
19822 +               if (strncmp(pch, PEXECUTE, strlen(PEXECUTE)) == 0) {
19823                         status = AddOvlySect(hNldr, &hNldr->ovlyTable[i].
19824                                             pExecuteSects, sectInfo, &fExists,
19825                                             addr, nBytes);
19826 @@ -1121,14 +1069,14 @@ static DSP_STATUS AddOvlyNode(struct DSP
19827                 } else {
19828                         /* Add node to table */
19829                         hNldr->ovlyTable[hNldr->nNode].uuid = *pUuid;
19830 -                       DBC_Require(objDef.objData.nodeObj.ndbProps.acName);
19831 -                       uLen = strlen(objDef.objData.nodeObj.ndbProps.acName);
19832 +                       DBC_Require(objDef.objData.nodeObj.ndbProps.acName);
19833 +                       uLen = strlen(objDef.objData.nodeObj.ndbProps.acName);
19834                         pNodeName = objDef.objData.nodeObj.ndbProps.acName;
19835                         pBuf = MEM_Calloc(uLen + 1, MEM_PAGED);
19836                         if (pBuf == NULL) {
19837                                 status = DSP_EMEMORY;
19838                         } else {
19839 -                               strncpy(pBuf, pNodeName, uLen);
19840 +                               strncpy(pBuf, pNodeName, uLen);
19841                                 hNldr->ovlyTable[hNldr->nNode].pNodeName = pBuf;
19842                                 hNldr->nNode++;
19843                         }
19844 @@ -1432,7 +1380,7 @@ static DSP_STATUS LoadLib(struct NLDR_NO
19845         /*
19846          *  Recursively load dependent libraries.
19847          */
19848 -       if (DSP_SUCCEEDED(status) && persistentDepLibs) {
19849 +       if (DSP_SUCCEEDED(status)) {
19850                 for (i = 0; i < nLibs; i++) {
19851                         /* If root library is NOT persistent, and dep library
19852                          * is, then record it.  If root library IS persistent,
19853 @@ -1456,15 +1404,11 @@ static DSP_STATUS LoadLib(struct NLDR_NO
19854                                 pDepLib = &root->pDepLibs[nLoaded];
19855                         }
19856  
19857 -                       if (depLibUUIDs) {
19858 -                               status = LoadLib(hNldrNode, pDepLib,
19859 +                       status = LoadLib(hNldrNode, pDepLib,
19860                                                 depLibUUIDs[i],
19861                                                 persistentDepLibs[i], libPath,
19862                                                 phase,
19863                                                 depth);
19864 -                       } else {
19865 -                               status = DSP_EMEMORY;
19866 -                       }
19867  
19868                         if (DSP_SUCCEEDED(status)) {
19869                                 if ((status != DSP_SALREADYLOADED) &&
19870 @@ -1560,6 +1504,12 @@ static DSP_STATUS LoadOvly(struct NLDR_N
19871         }
19872  
19873         DBC_Assert(i < hNldr->nOvlyNodes);
19874 +
19875 +       if (!pONode) {
19876 +               status = DSP_ENOTFOUND;
19877 +               goto func_end;
19878 +       }
19879 +
19880         switch (phase) {
19881         case NLDR_CREATE:
19882                 pRefCount = &(pONode->createRef);
19883 @@ -1583,10 +1533,6 @@ static DSP_STATUS LoadOvly(struct NLDR_N
19884                 break;
19885         }
19886  
19887 -       DBC_Assert(pRefCount != NULL);
19888 -       if (DSP_FAILED(status))
19889 -               goto func_end;
19890 -
19891         if (pRefCount == NULL)
19892                 goto func_end;
19893  
19894 @@ -1865,7 +1811,6 @@ static void UnloadOvly(struct NLDR_NODEO
19895         u16 nOtherAlloc = 0;
19896         u16 *pRefCount = NULL;
19897         u16 *pOtherRef = NULL;
19898 -       DSP_STATUS status = DSP_SOK;
19899  
19900         /* Find the node in the table */
19901         for (i = 0; i < hNldr->nOvlyNodes; i++) {
19902 @@ -1877,6 +1822,11 @@ static void UnloadOvly(struct NLDR_NODEO
19903         }
19904  
19905         DBC_Assert(i < hNldr->nOvlyNodes);
19906 +
19907 +       if (!pONode)
19908 +               /* TODO: Should we print warning here? */
19909 +               return;
19910 +
19911         switch (phase) {
19912         case NLDR_CREATE:
19913                 pRefCount = &(pONode->createRef);
19914 @@ -1901,23 +1851,21 @@ static void UnloadOvly(struct NLDR_NODEO
19915                 DBC_Assert(false);
19916                 break;
19917         }
19918 -       if (DSP_SUCCEEDED(status)) {
19919 -               DBC_Assert(pRefCount && (*pRefCount > 0));
19920 -                if (pRefCount && (*pRefCount > 0)) {
19921 -                       *pRefCount -= 1;
19922 -                       if (pOtherRef) {
19923 -                               DBC_Assert(*pOtherRef > 0);
19924 -                               *pOtherRef -= 1;
19925 -                       }
19926 +       DBC_Assert(pRefCount && (*pRefCount > 0));
19927 +        if (pRefCount && (*pRefCount > 0)) {
19928 +               *pRefCount -= 1;
19929 +               if (pOtherRef) {
19930 +                       DBC_Assert(*pOtherRef > 0);
19931 +                       *pOtherRef -= 1;
19932                 }
19933         }
19934 -       if (pRefCount && (*pRefCount == 0)) {
19935 +
19936 +       if (pRefCount && *pRefCount == 0) {
19937                 /* 'Deallocate' memory */
19938                 FreeSects(hNldr, pPhaseSects, nAlloc);
19939         }
19940         if (pOtherRef && *pOtherRef == 0)
19941                 FreeSects(hNldr, pOtherSects, nOtherAlloc);
19942 -
19943  }
19944  
19945  /*
19946 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/node.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/node.c
19947 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/node.c     2011-04-17 17:32:26.000000000 +0100
19948 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/node.c  2011-05-02 22:36:50.000000000 +0100
19949 @@ -3,6 +3,8 @@
19950   *
19951   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
19952   *
19953 + * DSP/BIOS Bridge Node Manager.
19954 + *
19955   * Copyright (C) 2005-2006 Texas Instruments, Inc.
19956   *
19957   * This package is free software; you can redistribute it and/or modify
19958 @@ -14,84 +16,6 @@
19959   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19960   */
19961  
19962 -/*
19963 - *  ======== node.c ========
19964 - *
19965 - *  Description:
19966 - *      DSP/BIOS Bridge Node Manager.
19967 - *
19968 - *  Public Functions:
19969 - *      NODE_Allocate
19970 - *      NODE_AllocMsgBuf
19971 - *      NODE_ChangePriority
19972 - *      NODE_Connect
19973 - *      NODE_Create
19974 - *      NODE_CreateMgr
19975 - *      NODE_Delete
19976 - *      NODE_DeleteMgr
19977 - *      NODE_EnumNodes
19978 - *      NODE_Exit
19979 - *      NODE_FreeMsgBuf
19980 - *      NODE_GetAttr
19981 - *      NODE_GetChannelId
19982 - *      NODE_GetMessage
19983 - *      NODE_GetStrmMgr
19984 - *      NODE_Init
19985 - *      NODE_OnExit
19986 - *      NODE_Pause
19987 - *      NODE_PutMessage
19988 - *      NODE_RegisterNotify
19989 - *      NODE_Run
19990 - *      NODE_Terminate
19991 - *
19992 - *! Revision History:
19993 - *! =================
19994 - *! 12-Apr-2004 hp  Compile IVA only for 24xx
19995 - *! 09-Feb-2004 vp  Updated to support IVA.
19996 - *! 07-Apr-2003 map        Eliminated references to old DLDR
19997 - *! 26-Mar-2003 vp  Commented the call to DSP deep sleep in Node_Delete
19998 - *!                function.
19999 - *! 18-Feb-2003 vp  Code review updates.
20000 - *! 06-Feb-2003 kc      Fixed FreeStream to release streams correctly.
20001 - *! 23-Jan-2003 map     Removed call to DISP_DoCinit within Write()
20002 - *! 03-Jan-2003 map     Only unload code after phase has executed if
20003 - *!                 overlay or split dynload phases
20004 - *! 18-Oct-2002 vp  Ported to Linux platform.
20005 - *! 06-Nov-2002 map     Fixed NODE_Run on NODE_PAUSED bug
20006 - *! 12-Oct-2002 map     Fixed DeleteNode bug in NODE_Create
20007 - *! 11-Sep-2002 rr      DeleteNode frees the memory for strmConnect and dcd obj
20008 - *! 29-Aug-2002 map     Modified Ovly and Write to use ARM-side copy
20009 - *! 22-May-2002 sg      Changed use of cbData for PWR calls.
20010 - *! 17-May-2002 jeh     Removed LoadLoaderFxns(). Get address of RMS_cinit()
20011 - *!                 function. Call DISP_DoCinit() from Write(), if .cinit.
20012 - *! 13-May-2002 sg      Added timeout to wake/sleep calls.
20013 - *! 02-May-2002 sg      Added wake/sleep of DSP to support "nap" mode.
20014 - *! 18-Apr-2002 jeh     Use dynamic loader if compile flag is set.
20015 - *! 13-Feb-2002 jeh     Get uSysStackSize from DSP_NDBPROPS.
20016 - *! 07-Jan-2002 ag      STRMMODE_ZEROCOPY(shared memory buffer swap) enabled.
20017 - *! 17-Dec-2001 ag      STRMMODE_RDMA(DDMA) enabled.
20018 - *! 12-Dec-2001 ag      Check for valid stream mode in NODE_Connect().
20019 - *! 04-Dec-2001 jeh     Check for node sufficiently connected in NODE_Create().
20020 - *! 15-Nov-2001 jeh     Removed DBC_Require(pNode->hXlator != NULL) from
20021 - *!                 NODE_AllocMsgBuf(), and check node type != NODE_DEVICE.
20022 - *! 11-Sep-2001 ag      Zero-copy messaging support.
20023 - *! 28-Aug-2001 jeh     Overlay/dynamic loader infrastructure added. Removed
20024 - *!                 NODE_GetDispatcher, excess node states.
20025 - *! 07-Aug-2001 jeh     Removed critical section for dispatcher.
20026 - *! 26-Jul-2001 jeh     Get ZL dll name through CFG.
20027 - *! 05-Jun-2001 jeh     Assume DSP_STRMATTRS.uBufsize in GPP bytes.
20028 - *! 11-May-2001 jeh     Some code review cleanup.
20029 - *! 13-Feb-2001 kc:     DSP/BIOS Bridge name updates.
20030 - *! 15-Dec-2000 sg      Convert IALG_Fxn address from byte addr to word addr.
20031 - *! 04-Dec-2000 jeh     Call MSG Get and Put functions.
20032 - *! 04-Dec-2000 ag      Added SM support for node messaging.
20033 - *! 10-Nov-2000 rr:     NODE_MIN/MAX Priority is defined in dspdefs.h.
20034 - *! 27-Oct-2000 jeh     Added NODE_AllocMsgBuf(), NODE_FreeMsgBuf().
20035 - *! 11-Oct-2000 jeh     Changed NODE_EnumNodeInfo to NODE_EnumNodes. Added
20036 - *!                 NODE_CloseOrphans(). Remove NODE_RegisterNotifyAllNodes
20037 - *! 19-Jun-2000 jeh     Created.
20038 - */
20039 -
20040  /*  ----------------------------------- Host OS */
20041  #include <dspbridge/host_os.h>
20042  
20043 @@ -106,7 +30,6 @@
20044  
20045  /*  ----------------------------------- OS Adaptation Layer */
20046  #include <dspbridge/cfg.h>
20047 -#include <dspbridge/csl.h>
20048  #include <dspbridge/list.h>
20049  #include <dspbridge/mem.h>
20050  #include <dspbridge/proc.h>
20051 @@ -131,7 +54,7 @@
20052  
20053  /*  ----------------------------------- Others */
20054  #include <dspbridge/gb.h>
20055 -#ifdef DEBUG
20056 +#ifdef CONFIG_BRIDGE_DEBUG
20057  #include <dspbridge/uuidutil.h>
20058  #include <dspbridge/dbg.h>
20059  #endif
20060 @@ -144,12 +67,9 @@
20061  #include <dspbridge/dbll.h>
20062  #include <dspbridge/nldr.h>
20063  
20064 -#ifndef RES_CLEANUP_DISABLE
20065  #include <dspbridge/drv.h>
20066  #include <dspbridge/drvdefs.h>
20067 -#include <dspbridge/dbreg.h>
20068  #include <dspbridge/resourcecleanup.h>
20069 -#endif
20070  
20071  
20072  #define NODE_SIGNATURE      0x45444f4e /* "EDON" */
20073 @@ -230,8 +150,8 @@ struct NODE_MGR {
20074         u32 ulNumChnls; /* Total number of channels */
20075         u32 ulChnlOffset;       /* Offset of chnl ids rsvd for RMS */
20076         u32 ulChnlBufSize;      /* Buffer size for data to RMS */
20077 -       DSP_PROCFAMILY procFamily;      /* eg, 5000 */
20078 -       DSP_PROCTYPE procType;  /* eg, 5510 */
20079 +       long procFamily;        /* eg, 5000 */
20080 +       long procType;  /* eg, 5510 */
20081         u32 uDSPWordSize;       /* Size of DSP word on host bytes */
20082         u32 uDSPDataMauSize;    /* Size of DSP data MAU */
20083         u32 uDSPMauSize;        /* Size of MAU */
20084 @@ -268,7 +188,7 @@ struct STREAM {
20085   *  ======== NODE_OBJECT ========
20086   */
20087  struct NODE_OBJECT {
20088 -       struct LST_ELEM listElem;
20089 +       struct list_head listElem;
20090         u32 dwSignature;        /* For object validation */
20091         struct NODE_MGR *hNodeMgr;      /* The manager of this node */
20092         struct PROC_OBJECT *hProcessor; /* Back pointer to processor */
20093 @@ -296,7 +216,7 @@ struct NODE_OBJECT {
20094         s32 nExitStatus;        /* execute function return status */
20095  
20096         /* Information needed for NODE_GetAttr() */
20097 -       DSP_HNODE hDeviceOwner; /* If dev node, task that owns it */
20098 +       void *hDeviceOwner;     /* If dev node, task that owns it */
20099         u32 uNumGPPInputs;      /* Current # of from GPP streams */
20100         u32 uNumGPPOutputs;     /* Current # of to GPP streams */
20101         /* Current stream connections */
20102 @@ -335,9 +255,9 @@ static void FreeStream(struct NODE_MGR *
20103  static DSP_STATUS GetFxnAddress(struct NODE_OBJECT *hNode, u32 *pulFxnAddr,
20104                                 u32 uPhase);
20105  static DSP_STATUS GetNodeProps(struct DCD_MANAGER *hDcdMgr,
20106 -                              struct NODE_OBJECT *hNode,
20107 -                              CONST struct DSP_UUID *pNodeId,
20108 -                              struct DCD_GENERICOBJ *pdcdProps);
20109 +                               struct NODE_OBJECT *hNode,
20110 +                               CONST struct DSP_UUID *pNodeId,
20111 +                               struct DCD_GENERICOBJ *pdcdProps);
20112  static DSP_STATUS GetProcProps(struct NODE_MGR *hNodeMgr,
20113                               struct DEV_OBJECT *hDevObject);
20114  static DSP_STATUS GetRMSFxns(struct NODE_MGR *hNodeMgr);
20115 @@ -362,7 +282,6 @@ static struct NLDR_FXNS nldrFxns = {
20116         NLDR_Create,
20117         NLDR_Delete,
20118         NLDR_Exit,
20119 -       NLDR_Free,
20120         NLDR_GetFxnAddr,
20121         NLDR_Init,
20122         NLDR_Load,
20123 @@ -371,14 +290,13 @@ static struct NLDR_FXNS nldrFxns = {
20124  
20125  enum NODE_STATE NODE_GetState(HANDLE hNode)
20126  {
20127 -       struct NODE_OBJECT *pNode = (struct NODE_OBJECT *)hNode;
20128 -       if (!MEM_IsValidHandle(pNode, NODE_SIGNATURE)) {
20129 -               GT_1trace(NODE_debugMask, GT_5CLASS,
20130 -                "NODE_GetState:hNode 0x%x\n", pNode);
20131 -               return  -1;
20132 -       } else
20133 -               return pNode->nState;
20134 -
20135 +       struct NODE_OBJECT *pNode = (struct NODE_OBJECT *)hNode;
20136 +       if (!MEM_IsValidHandle(pNode, NODE_SIGNATURE)) {
20137 +               GT_1trace(NODE_debugMask, GT_5CLASS,
20138 +                               "NODE_GetState:hNode 0x%x\n", pNode);
20139 +               return  -1;
20140 +       } else
20141 +               return pNode->nState;
20142  }
20143  
20144  /*
20145 @@ -404,7 +322,6 @@ DSP_STATUS NODE_Allocate(struct PROC_OBJ
20146         DSP_STATUS status = DSP_SOK;
20147         struct CMM_OBJECT *hCmmMgr = NULL; /* Shared memory manager hndl */
20148         u32 procId;
20149 -       char *label;
20150         u32 pulValue;
20151         u32 dynextBase;
20152         u32 offSet = 0;
20153 @@ -419,9 +336,7 @@ DSP_STATUS NODE_Allocate(struct PROC_OBJ
20154         struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
20155  #endif
20156  
20157 -#ifndef RES_CLEANUP_DISABLE
20158 -       HANDLE       nodeRes;
20159 -#endif
20160 +       HANDLE nodeRes;
20161  
20162         DBC_Require(cRefs > 0);
20163         DBC_Require(hProcessor != NULL);
20164 @@ -437,6 +352,9 @@ DSP_STATUS NODE_Allocate(struct PROC_OBJ
20165  
20166         status = PROC_GetProcessorId(hProcessor, &procId);
20167  
20168 +       if (procId != DSP_UNIT)
20169 +               goto func_end;
20170 +
20171         status = PROC_GetDevObject(hProcessor, &hDevObject);
20172         if (DSP_SUCCEEDED(status)) {
20173                 status = DEV_GetNodeManager(hDevObject, &hNodeMgr);
20174 @@ -444,11 +362,9 @@ DSP_STATUS NODE_Allocate(struct PROC_OBJ
20175                         status = DSP_EFAIL;
20176  
20177         }
20178 -       if (procId != DSP_UNIT)
20179 -               goto func_cont;
20180  
20181         if (DSP_FAILED(status))
20182 -               goto func_cont;
20183 +               goto func_end;
20184  
20185         status = PROC_GetState(hProcessor, &procStatus,
20186                         sizeof(struct DSP_PROCESSORSTATE));
20187 @@ -479,27 +395,27 @@ DSP_STATUS NODE_Allocate(struct PROC_OBJ
20188                                 status = DSP_ERANGE;
20189                 }
20190         }
20191 -func_cont:
20192         /* Allocate node object and fill in */
20193         if (DSP_FAILED(status))
20194 -               goto func_cont2;
20195 +               goto func_end;
20196  
20197         MEM_AllocObject(pNode, struct NODE_OBJECT, NODE_SIGNATURE);
20198         if (pNode == NULL) {
20199                 status = DSP_EMEMORY;
20200 -               goto func_cont1;
20201 +               goto func_end;
20202         }
20203         pNode->hNodeMgr = hNodeMgr;
20204         /* This critical section protects GetNodeProps */
20205         status = SYNC_EnterCS(hNodeMgr->hSync);
20206 -       if (procId != DSP_UNIT)
20207 -               goto func_cont3;
20208 +
20209 +       if (DSP_FAILED(status))
20210 +               goto func_end;
20211  
20212         /* Get DSP_NDBPROPS from node database */
20213         status = GetNodeProps(hNodeMgr->hDcdMgr, pNode, pNodeId,
20214                              &(pNode->dcdProps));
20215         if (DSP_FAILED(status))
20216 -               goto func_cont3;
20217 +               goto func_cont;
20218  
20219         pNode->nodeId = *pNodeId;
20220         pNode->hProcessor = hProcessor;
20221 @@ -514,11 +430,11 @@ func_cont:
20222         pNode->createArgs.asa.taskArgs.uDSPHeapResAddr = 0;
20223         pNode->createArgs.asa.taskArgs.uGPPHeapAddr = 0;
20224         if (!pAttrIn)
20225 -               goto func_cont3;
20226 +               goto func_cont;
20227  
20228         /* Check if we have a user allocated node heap */
20229         if (!(pAttrIn->pGPPVirtAddr))
20230 -               goto func_cont3;
20231 +               goto func_cont;
20232  
20233         /* check for page aligned Heap size */
20234         if (((pAttrIn->uHeapSize) & (PG_SIZE_4K - 1))) {
20235 @@ -533,7 +449,7 @@ func_cont:
20236                                                  (u32)pAttrIn->pGPPVirtAddr;
20237         }
20238         if (DSP_FAILED(status))
20239 -               goto func_cont3;
20240 +               goto func_cont;
20241  
20242         status = PROC_ReserveMemory(hProcessor,
20243                         pNode->createArgs.asa.taskArgs.uHeapSize + PAGE_SIZE,
20244 @@ -543,18 +459,16 @@ func_cont:
20245                 GT_1trace(NODE_debugMask, GT_5CLASS,
20246                          "NODE_Allocate:Failed to reserve "
20247                          "memory for Heap: 0x%x\n", status);
20248 -       } else {
20249 -               GT_1trace(NODE_debugMask, GT_5CLASS,
20250 -                        "NODE_Allocate: DSPProcessor_Reserve"
20251 -                        " Memory successful: 0x%x\n", status);
20252 +
20253 +               goto func_cont;
20254         }
20255  #ifdef DSP_DMM_DEBUG
20256         status = DMM_GetHandle(pProcObject, &hDmmMgr);
20257 -       if (DSP_SUCCEEDED(status))
20258 -               DMM_MemMapDump(hDmmMgr);
20259 -#endif
20260         if (DSP_FAILED(status))
20261 -               goto func_cont3;
20262 +               goto func_cont;
20263 +
20264 +       DMM_MemMapDump(hDmmMgr);
20265 +#endif
20266  
20267         mapAttrs |= DSP_MAPLITTLEENDIAN;
20268         mapAttrs |= DSP_MAPELEMSIZE32;
20269 @@ -575,15 +489,13 @@ func_cont:
20270                          " successful: 0x%x\n", status);
20271         }
20272  
20273 -func_cont3:
20274 +func_cont:
20275         (void)SYNC_LeaveCS(hNodeMgr->hSync);
20276 -func_cont1:
20277         if (pAttrIn != NULL) {
20278                 /* Overrides of NBD properties */
20279                 pNode->uTimeout = pAttrIn->uTimeout;
20280                 pNode->nPriority = pAttrIn->iPriority;
20281         }
20282 -func_cont2:
20283         /* Create object to manage notifications */
20284         if (DSP_SUCCEEDED(status))
20285                 status = NTFY_Create(&pNode->hNtfy);
20286 @@ -595,8 +507,8 @@ func_cont2:
20287                 if (nodeType != NODE_MESSAGE) {
20288                         uNumStreams = MaxInputs(pNode) + MaxOutputs(pNode);
20289                         pNode->streamConnect = MEM_Calloc(uNumStreams *
20290 -                                              sizeof(struct DSP_STREAMCONNECT),
20291 -                                              MEM_PAGED);
20292 +                                       sizeof(struct DSP_STREAMCONNECT),
20293 +                                       MEM_PAGED);
20294                         if (uNumStreams > 0 && pNode->streamConnect == NULL)
20295                                 status = DSP_EMEMORY;
20296  
20297 @@ -644,9 +556,9 @@ func_cont2:
20298                                          hCmmMgr, NULL);
20299                                 if (DSP_FAILED(status)) {
20300                                         GT_1trace(NODE_debugMask, GT_5CLASS,
20301 -                                           "NODE_Allocate: Failed"
20302 -                                           " to create SM translator: 0x%x\n",
20303 -                                           status);
20304 +                                               "NODE_Allocate: Failed to "
20305 +                                               "create SM translator: 0x%x\n",
20306 +                                               status);
20307                                 }
20308                         }
20309                 }
20310 @@ -661,7 +573,7 @@ func_cont2:
20311                                 } else {
20312                                         pmsgArgs->uArgLength = pArgs->cbData;
20313                                         memcpy(pmsgArgs->pData, pArgs->cData,
20314 -                                             pArgs->cbData);
20315 +                                               pArgs->cbData);
20316                                 }
20317                         }
20318                 }
20319 @@ -691,18 +603,16 @@ func_cont2:
20320                 }
20321         }
20322  
20323 -       /* Comapare value read from Node Properties and check if it is same as
20324 +       /* Compare value read from Node Properties and check if it is same as
20325          * STACKSEGLABEL, if yes read the Address of STACKSEGLABEL, calculate
20326          * GPP Address, Read the value in that address and override the
20327          * uStackSeg value in task args */
20328         if (DSP_SUCCEEDED(status) &&
20329            (char *)pNode->dcdProps.objData.nodeObj.ndbProps.uStackSegName !=
20330            NULL) {
20331 -               label = MEM_Calloc(sizeof(STACKSEGLABEL)+1, MEM_PAGED);
20332 -               strncpy(label, STACKSEGLABEL, sizeof(STACKSEGLABEL)+1);
20333 -
20334 -               if (strcmp((char *)pNode->dcdProps.objData.nodeObj.
20335 -                                    ndbProps.uStackSegName, label) == 0) {
20336 +               if (strcmp((char *)
20337 +                   pNode->dcdProps.objData.nodeObj.ndbProps.uStackSegName,
20338 +                   STACKSEGLABEL) == 0) {
20339                         status = hNodeMgr->nldrFxns.pfnGetFxnAddr(pNode->
20340                                  hNldrNode, "DYNEXT_BEG", &dynextBase);
20341                         if (DSP_FAILED(status)) {
20342 @@ -727,6 +637,7 @@ func_cont2:
20343                                 GT_1trace(NODE_debugMask, GT_5CLASS,
20344                                 "NODE_Allocate: Failed to get host resource "
20345                                 "0x%x\n", status);
20346 +                               goto func_end;
20347                         }
20348  
20349                         ulGppMemBase = (u32)hostRes.dwMemBase[1];
20350 @@ -744,24 +655,20 @@ func_cont2:
20351                                 ulStackSegVal;
20352  
20353                 }
20354 -
20355 -               if (label)
20356 -                       MEM_Free(label);
20357 -
20358         }
20359  
20360  
20361         if (DSP_SUCCEEDED(status)) {
20362                 /* Add the node to the node manager's list of allocated
20363                  * nodes. */
20364 -               LST_InitElem((struct LST_ELEM *)pNode);
20365 +               LST_InitElem((struct list_head *)pNode);
20366                 NODE_SetState(pNode, NODE_ALLOCATED);
20367  
20368                 status = SYNC_EnterCS(hNodeMgr->hSync);
20369  
20370                 if (DSP_SUCCEEDED(status)) {
20371                         LST_PutTail(hNodeMgr->nodeList,
20372 -                       (struct LST_ELEM *) pNode);
20373 +                                       (struct list_head *) pNode);
20374                         ++(hNodeMgr->uNumNodes);
20375                 }
20376  
20377 @@ -785,13 +692,11 @@ func_cont2:
20378  
20379         }
20380  
20381 -#ifndef RES_CLEANUP_DISABLE
20382         if (DSP_SUCCEEDED(status)) {
20383                 DRV_InsertNodeResElement(*phNode, &nodeRes, pr_ctxt);
20384                 DRV_ProcNodeUpdateHeapStatus(nodeRes, true);
20385                 DRV_ProcNodeUpdateStatus(nodeRes, true);
20386         }
20387 -#endif
20388         DBC_Ensure((DSP_FAILED(status) && (*phNode == NULL)) ||
20389                   (DSP_SUCCEEDED(status)
20390                     && MEM_IsValidHandle((*phNode), NODE_SIGNATURE)));
20391 @@ -805,8 +710,8 @@ func_end:
20392   *      Allocates buffer for zero copy messaging.
20393   */
20394  DBAPI NODE_AllocMsgBuf(struct NODE_OBJECT *hNode, u32 uSize,
20395 -                      OPTIONAL IN OUT struct DSP_BUFFERATTR *pAttr,
20396 -                      OUT u8 **pBuffer)
20397 +                       OPTIONAL IN OUT struct DSP_BUFFERATTR *pAttr,
20398 +                       OUT u8 **pBuffer)
20399  {
20400         struct NODE_OBJECT *pNode = (struct NODE_OBJECT *)hNode;
20401         DSP_STATUS status = DSP_SOK;
20402 @@ -824,9 +729,7 @@ DBAPI NODE_AllocMsgBuf(struct NODE_OBJEC
20403                  " 0x%x\tpAttr: 0x%x\tpBuffer: %d\n", pNode, uSize, pAttr,
20404                  pBuffer);
20405  
20406 -       if (!MEM_IsValidHandle(pNode, NODE_SIGNATURE))
20407 -               status = DSP_EHANDLE;
20408 -       else if (NODE_GetType(pNode) == NODE_DEVICE)
20409 +       if (NODE_GetType(pNode) == NODE_DEVICE)
20410                 status = DSP_ENODETYPE;
20411  
20412         if (DSP_FAILED(status))
20413 @@ -915,7 +818,7 @@ DSP_STATUS NODE_ChangePriority(struct NO
20414         GT_2trace(NODE_debugMask, GT_ENTER, "NODE_ChangePriority: "
20415                  "hNode: 0x%x\tnPriority: %d\n", hNode, nPriority);
20416  
20417 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20418 +       if (!hNode->hNodeMgr) {
20419                 GT_1trace(NODE_debugMask, GT_7CLASS,
20420                          "Invalid NODE Handle: 0x%x\n", hNode);
20421                 status = DSP_EHANDLE;
20422 @@ -934,7 +837,7 @@ DSP_STATUS NODE_ChangePriority(struct NO
20423         /* Enter critical section */
20424         status = SYNC_EnterCS(hNodeMgr->hSync);
20425         if (DSP_FAILED(status))
20426 -               goto func_cont;
20427 +               goto func_end;
20428  
20429         state = NODE_GetState(hNode);
20430         if (state == NODE_ALLOCATED || state == NODE_PAUSED) {
20431 @@ -944,19 +847,16 @@ DSP_STATUS NODE_ChangePriority(struct NO
20432                         status = DSP_EWRONGSTATE;
20433                         goto func_cont;
20434                 }
20435 -               if (DSP_SUCCEEDED(status)) {
20436 -                       status = PROC_GetProcessorId(pNode->hProcessor,
20437 -                                                   &procId);
20438 -                       if (procId == DSP_UNIT) {
20439 -                               status = DISP_NodeChangePriority(hNodeMgr->
20440 -                                   hDisp, hNode,
20441 -                                   hNodeMgr->ulFxnAddrs[RMSCHANGENODEPRIORITY],
20442 -                                   hNode->nodeEnv, nPriority);
20443 -                       }
20444 -                       if (DSP_SUCCEEDED(status))
20445 -                               NODE_SetPriority(hNode, nPriority);
20446 -
20447 +               status = PROC_GetProcessorId(pNode->hProcessor, &procId);
20448 +               if (procId == DSP_UNIT) {
20449 +                       status = DISP_NodeChangePriority(hNodeMgr->
20450 +                           hDisp, hNode,
20451 +                           hNodeMgr->ulFxnAddrs[RMSCHANGENODEPRIORITY],
20452 +                           hNode->nodeEnv, nPriority);
20453                 }
20454 +               if (DSP_SUCCEEDED(status))
20455 +                       NODE_SetPriority(hNode, nPriority);
20456 +
20457         }
20458  func_cont:
20459                 /* Leave critical section */
20460 @@ -987,7 +887,7 @@ DSP_STATUS NODE_Connect(struct NODE_OBJE
20461         struct STREAM *pStream;
20462         GB_BitNum pipeId = GB_NOBITS;
20463         GB_BitNum chnlId = GB_NOBITS;
20464 -       CHNL_MODE uMode;
20465 +       short int uMode;
20466         u32 dwLength;
20467         DSP_STATUS status = DSP_SOK;
20468         DBC_Require(cRefs > 0);
20469 @@ -995,13 +895,13 @@ DSP_STATUS NODE_Connect(struct NODE_OBJE
20470                  "NODE_Connect: hNode1: 0x%x\tuStream1:"
20471                  " %d\thNode2: 0x%x\tuStream2: %d\tpAttrs: 0x%x\n", hNode1,
20472                  uStream1, hNode2, uStream2, pAttrs);
20473 -       if (DSP_SUCCEEDED(status)) {
20474 -               if ((hNode1 != (struct NODE_OBJECT *) DSP_HGPPNODE &&
20475 -                  !MEM_IsValidHandle(hNode1, NODE_SIGNATURE)) ||
20476 -                  (hNode2 != (struct NODE_OBJECT *) DSP_HGPPNODE &&
20477 -                  !MEM_IsValidHandle(hNode2, NODE_SIGNATURE)))
20478 -                       status = DSP_EHANDLE;
20479 -       }
20480 +
20481 +       if ((hNode1 != (struct NODE_OBJECT *) DSP_HGPPNODE &&
20482 +                       !MEM_IsValidHandle(hNode1, NODE_SIGNATURE)) ||
20483 +                       (hNode2 != (struct NODE_OBJECT *) DSP_HGPPNODE &&
20484 +                       !MEM_IsValidHandle(hNode2, NODE_SIGNATURE)))
20485 +               status = DSP_EHANDLE;
20486 +
20487         if (DSP_SUCCEEDED(status)) {
20488                 /* The two nodes must be on the same processor */
20489                 if (hNode1 != (struct NODE_OBJECT *)DSP_HGPPNODE &&
20490 @@ -1215,7 +1115,7 @@ func_cont2:
20491                 }
20492                 /* Set up create args */
20493                 pStream->type = DEVICECONNECT;
20494 -               dwLength = strlen(hDevNode->pstrDevName);
20495 +               dwLength = strlen(hDevNode->pstrDevName);
20496                 if (pConnParam != NULL) {
20497                         pstrmDef->szDevice = MEM_Calloc(dwLength + 1 +
20498                                                 (u32) pConnParam->cbData,
20499 @@ -1228,12 +1128,12 @@ func_cont2:
20500                         status = DSP_EMEMORY;
20501                 } else {
20502                         /* Copy device name */
20503 -                       strncpy(pstrmDef->szDevice, hDevNode->pstrDevName,
20504 -                                  dwLength);
20505 +                       strncpy(pstrmDef->szDevice, hDevNode->pstrDevName,
20506 +                               dwLength);
20507                         if (pConnParam != NULL) {
20508 -                               strncat(pstrmDef->szDevice,
20509 -                                       (char *)pConnParam->cData,
20510 -                                       (u32)pConnParam->cbData);
20511 +                               strncat(pstrmDef->szDevice,
20512 +                                       (char *)pConnParam->cData,
20513 +                                       (u32)pConnParam->cbData);
20514                         }
20515                         hDevNode->hDeviceOwner = hNode;
20516                 }
20517 @@ -1285,7 +1185,6 @@ DSP_STATUS NODE_Create(struct NODE_OBJEC
20518         enum NODE_TYPE nodeType;
20519         DSP_STATUS status = DSP_SOK;
20520         DSP_STATUS status1 = DSP_SOK;
20521 -       bool bJustWokeDSP = false;
20522         struct DSP_CBDATA cbData;
20523         u32 procId = 255;
20524         struct DSP_PROCESSORSTATE procStatus;
20525 @@ -1298,10 +1197,7 @@ DSP_STATUS NODE_Create(struct NODE_OBJEC
20526         DBC_Require(cRefs > 0);
20527         GT_1trace(NODE_debugMask, GT_ENTER, "NODE_Create: hNode: 0x%x\n",
20528                  hNode);
20529 -       if (!MEM_IsValidHandle(pNode, NODE_SIGNATURE)) {
20530 -               status = DSP_EHANDLE;
20531 -               goto func_end;
20532 -       }
20533 +
20534         hProcessor = hNode->hProcessor;
20535         status = PROC_GetState(hProcessor, &procStatus,
20536                                         sizeof(struct DSP_PROCESSORSTATE));
20537 @@ -1323,7 +1219,7 @@ DSP_STATUS NODE_Create(struct NODE_OBJEC
20538         /* Get access to node dispatcher */
20539         status = SYNC_EnterCS(hNodeMgr->hSync);
20540         if (DSP_FAILED(status))
20541 -               goto func_cont;
20542 +               goto func_end;
20543  
20544         /* Check node state */
20545         if (NODE_GetState(hNode) != NODE_ALLOCATED)
20546 @@ -1436,22 +1332,6 @@ func_cont2:
20547                 /* Put back in NODE_ALLOCATED state if error occurred */
20548                 NODE_SetState(hNode, NODE_ALLOCATED);
20549         }
20550 -       if (procId == DSP_UNIT) {
20551 -               /* If node create failed, see if should sleep DSP now */
20552 -               if (bJustWokeDSP == true) {
20553 -                       /* Check to see if partial create happened on DSP */
20554 -                       if (hNode->nodeEnv == (u32)NULL) {
20555 -                               /* No environment allocated on DSP, re-sleep
20556 -                                * DSP now */
20557 -                               PROC_Ctrl(hNode->hProcessor, WMDIOCTL_DEEPSLEEP,
20558 -                                        &cbData);
20559 -                       } else {
20560 -                               /* Increment count, sleep later when node fully
20561 -                                * deleted */
20562 -                               hNodeMgr->uNumCreated++;
20563 -                       }
20564 -               }
20565 -       }
20566  func_cont:
20567                 /* Free access to node dispatcher */
20568                 (void)SYNC_LeaveCS(hNodeMgr->hSync);
20569 @@ -1489,7 +1369,8 @@ DSP_STATUS NODE_CreateMgr(OUT struct NOD
20570         MEM_AllocObject(pNodeMgr, struct NODE_MGR, NODEMGR_SIGNATURE);
20571         if (pNodeMgr) {
20572                 pNodeMgr->hDevObject = hDevObject;
20573 -               pNodeMgr->nodeList = LST_Create();
20574 +               pNodeMgr->nodeList = MEM_Calloc(sizeof(struct LST_LIST),
20575 +                                               MEM_NONPAGED);
20576                 pNodeMgr->pipeMap = GB_create(MAXPIPES);
20577                 pNodeMgr->pipeDoneMap = GB_create(MAXPIPES);
20578                 if (pNodeMgr->nodeList == NULL || pNodeMgr->pipeMap == NULL ||
20579 @@ -1499,6 +1380,7 @@ DSP_STATUS NODE_CreateMgr(OUT struct NOD
20580                                  "NODE_CreateMgr: Memory "
20581                                  "allocation failed\n");
20582                 } else {
20583 +                       INIT_LIST_HEAD(&pNodeMgr->nodeList->head);
20584                         status = NTFY_Create(&pNodeMgr->hNtfy);
20585                 }
20586                 pNodeMgr->uNumCreated = 0;
20587 @@ -1535,8 +1417,6 @@ DSP_STATUS NODE_CreateMgr(OUT struct NOD
20588                 /* Get MSG queue manager */
20589                 DEV_GetMsgMgr(hDevObject, &pNodeMgr->hMsg);
20590                 status = SYNC_InitializeCS(&pNodeMgr->hSync);
20591 -               if (DSP_FAILED(status))
20592 -                       status = DSP_EMEMORY;
20593         }
20594         if (DSP_SUCCEEDED(status)) {
20595                 pNodeMgr->chnlMap = GB_create(pNodeMgr->ulNumChnls);
20596 @@ -1625,17 +1505,12 @@ DSP_STATUS NODE_Delete(struct NODE_OBJEC
20597         u32 procId;
20598         struct WMD_DRV_INTERFACE *pIntfFxns;
20599  
20600 -#ifndef RES_CLEANUP_DISABLE
20601         HANDLE          nodeRes;
20602 -#endif
20603 +
20604         struct DSP_PROCESSORSTATE procStatus;
20605         DBC_Require(cRefs > 0);
20606         GT_1trace(NODE_debugMask, GT_ENTER, "NODE_Delete: hNode: 0x%x\n",
20607                   hNode);
20608 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20609 -               status = DSP_EHANDLE;
20610 -               goto func_end;
20611 -       }
20612         /* create struct DSP_CBDATA struct for PWR call */
20613         cbData.cbData = PWR_TIMEOUT;
20614         hNodeMgr = hNode->hNodeMgr;
20615 @@ -1743,7 +1618,7 @@ func_cont1:
20616         }
20617         /* Free host side resources even if a failure occurred */
20618         /* Remove node from hNodeMgr->nodeList */
20619 -       LST_RemoveElem(hNodeMgr->nodeList, (struct LST_ELEM *) hNode);
20620 +       LST_RemoveElem(hNodeMgr->nodeList, (struct list_head *) hNode);
20621         hNodeMgr->uNumNodes--;
20622         /* Decrement count of nodes created on DSP */
20623         if ((state != NODE_ALLOCATED) || ((state == NODE_ALLOCATED) &&
20624 @@ -1751,22 +1626,15 @@ func_cont1:
20625                 hNodeMgr->uNumCreated--;
20626          /*  Free host-side resources allocated by NODE_Create()
20627          *  DeleteNode() fails if SM buffers not freed by client!  */
20628 -#ifndef RES_CLEANUP_DISABLE
20629 -       if (!pr_ctxt)
20630 -               goto func_cont;
20631         if (DRV_GetNodeResElement(hNode, &nodeRes, pr_ctxt) != DSP_ENOTFOUND) {
20632                 GT_0trace(NODE_debugMask, GT_5CLASS, "\nNODE_Delete12:\n");
20633                 DRV_ProcNodeUpdateStatus(nodeRes, false);
20634         }
20635 -#endif
20636 -func_cont:
20637         GT_0trace(NODE_debugMask, GT_ENTER, "\nNODE_Delete13:\n ");
20638         DeleteNode(hNode, pr_ctxt);
20639 -#ifndef RES_CLEANUP_DISABLE
20640 +
20641         GT_0trace(NODE_debugMask, GT_5CLASS, "\nNODE_Delete2:\n ");
20642 -       if (pr_ctxt)
20643 -               DRV_RemoveNodeResElement(nodeRes, pr_ctxt);
20644 -#endif
20645 +       DRV_RemoveNodeResElement(nodeRes, pr_ctxt);
20646         GT_0trace(NODE_debugMask, GT_ENTER, "\nNODE_Delete3:\n ");
20647         /* Exit critical section */
20648         (void)SYNC_LeaveCS(hNodeMgr->hSync);
20649 @@ -1785,11 +1653,13 @@ DSP_STATUS NODE_DeleteMgr(struct NODE_MG
20650         DSP_STATUS status = DSP_SOK;
20651  
20652         DBC_Require(cRefs > 0);
20653 -       DBC_Require(MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE));
20654  
20655         GT_1trace(NODE_debugMask, GT_ENTER, "NODE_DeleteMgr: hNodeMgr: 0x%x\n",
20656                  hNodeMgr);
20657 -       DeleteNodeMgr(hNodeMgr);
20658 +       if (MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE))
20659 +               DeleteNodeMgr(hNodeMgr);
20660 +       else
20661 +               status = DSP_EHANDLE;
20662  
20663         return status;
20664  }
20665 @@ -1799,7 +1669,7 @@ DSP_STATUS NODE_DeleteMgr(struct NODE_MG
20666   *  Purpose:
20667   *      Enumerate currently allocated nodes.
20668   */
20669 -DSP_STATUS NODE_EnumNodes(struct NODE_MGR *hNodeMgr, IN DSP_HNODE *aNodeTab,
20670 +DSP_STATUS NODE_EnumNodes(struct NODE_MGR *hNodeMgr, void **aNodeTab,
20671                          u32 uNodeTabSize, OUT u32 *puNumNodes,
20672                          OUT u32 *puAllocated)
20673  {
20674 @@ -1807,7 +1677,6 @@ DSP_STATUS NODE_EnumNodes(struct NODE_MG
20675         u32 i;
20676         DSP_STATUS status = DSP_SOK;
20677         DBC_Require(cRefs > 0);
20678 -       DBC_Require(MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE));
20679         DBC_Require(aNodeTab != NULL || uNodeTabSize == 0);
20680         DBC_Require(puNumNodes != NULL);
20681         DBC_Require(puAllocated != NULL);
20682 @@ -1815,6 +1684,10 @@ DSP_STATUS NODE_EnumNodes(struct NODE_MG
20683                  "aNodeTab: %d\tuNodeTabSize: 0x%x\tpuNumNodes: 0x%x\t"
20684                  "puAllocated\n", hNodeMgr, aNodeTab, uNodeTabSize, puNumNodes,
20685                  puAllocated);
20686 +       if (!MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE)) {
20687 +               status = DSP_EHANDLE;
20688 +               goto func_end;
20689 +       }
20690         /* Enter critical section */
20691         status = SYNC_EnterCS(hNodeMgr->hSync);
20692         if (DSP_SUCCEEDED(status)) {
20693 @@ -1831,7 +1704,7 @@ DSP_STATUS NODE_EnumNodes(struct NODE_MG
20694                                 aNodeTab[i] = hNode;
20695                                 hNode = (struct NODE_OBJECT *)LST_Next
20696                                         (hNodeMgr->nodeList,
20697 -                                       (struct LST_ELEM *)hNode);
20698 +                                       (struct list_head *)hNode);
20699                         }
20700                         *puAllocated = *puNumNodes = hNodeMgr->uNumNodes;
20701                 }
20702 @@ -1839,6 +1712,7 @@ DSP_STATUS NODE_EnumNodes(struct NODE_MG
20703         /* end of SYNC_EnterCS */
20704         /* Exit critical section */
20705         (void)SYNC_LeaveCS(hNodeMgr->hSync);
20706 +func_end:
20707         return status;
20708  }
20709  
20710 @@ -1876,10 +1750,6 @@ DSP_STATUS NODE_FreeMsgBuf(struct NODE_O
20711         DBC_Require(pNode->hXlator != NULL);
20712         GT_3trace(NODE_debugMask, GT_ENTER, "NODE_FreeMsgBuf: hNode: 0x%x\t"
20713                  "pBuffer: 0x%x\tpAttr: 0x%x\n", hNode, pBuffer, pAttr);
20714 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20715 -               status = DSP_EHANDLE;
20716 -               goto func_end;
20717 -       }
20718         status = PROC_GetProcessorId(pNode->hProcessor, &procId);
20719         if (procId == DSP_UNIT) {
20720                 if (DSP_SUCCEEDED(status)) {
20721 @@ -1893,16 +1763,11 @@ DSP_STATUS NODE_FreeMsgBuf(struct NODE_O
20722  
20723                         /* pBuffer is clients Va. */
20724                         status = CMM_XlatorFreeBuf(pNode->hXlator, pBuffer);
20725 -                       if (DSP_FAILED(status))
20726 -                               status = DSP_EFAIL;
20727 -                       else
20728 -                               status = DSP_SOK;
20729 -
20730                 }
20731         } else {
20732                 DBC_Assert(NULL);       /* BUG */
20733         }
20734 -func_end:
20735 +
20736         return status;
20737  }
20738  
20739 @@ -1923,34 +1788,32 @@ DSP_STATUS NODE_GetAttr(struct NODE_OBJE
20740         GT_3trace(NODE_debugMask, GT_ENTER, "NODE_GetAttr: hNode: "
20741                  "0x%x\tpAttr: 0x%x \tuAttrSize: 0x%x\n", hNode, pAttr,
20742                  uAttrSize);
20743 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20744 -               status = DSP_EHANDLE;
20745 -       } else {
20746 -               hNodeMgr = hNode->hNodeMgr;
20747 -                /* Enter hNodeMgr critical section (since we're accessing
20748 -                 * data that could be changed by NODE_ChangePriority() and
20749 -                 * NODE_Connect().  */
20750 -               status = SYNC_EnterCS(hNodeMgr->hSync);
20751 -               if (DSP_SUCCEEDED(status)) {
20752 -                       pAttr->cbStruct = sizeof(struct DSP_NODEATTR);
20753 -                       /* DSP_NODEATTRIN */
20754 -                       pAttr->inNodeAttrIn.cbStruct =
20755 -                                        sizeof(struct DSP_NODEATTRIN);
20756 -                       pAttr->inNodeAttrIn.iPriority = hNode->nPriority;
20757 -                       pAttr->inNodeAttrIn.uTimeout = hNode->uTimeout;
20758 -                       pAttr->inNodeAttrIn.uHeapSize =
20759 -                               hNode->createArgs.asa.taskArgs.uHeapSize;
20760 -                       pAttr->inNodeAttrIn.pGPPVirtAddr = (void *)
20761 -                               hNode->createArgs.asa.taskArgs.uGPPHeapAddr;
20762 -                       pAttr->uInputs = hNode->uNumGPPInputs;
20763 -                       pAttr->uOutputs = hNode->uNumGPPOutputs;
20764 -                       /* DSP_NODEINFO */
20765 -                       GetNodeInfo(hNode, &(pAttr->iNodeInfo));
20766 -               }
20767 -               /* end of SYNC_EnterCS */
20768 -               /* Exit critical section */
20769 -               (void)SYNC_LeaveCS(hNodeMgr->hSync);
20770 +
20771 +       hNodeMgr = hNode->hNodeMgr;
20772 +        /* Enter hNodeMgr critical section (since we're accessing
20773 +         * data that could be changed by NODE_ChangePriority() and
20774 +         * NODE_Connect().  */
20775 +       status = SYNC_EnterCS(hNodeMgr->hSync);
20776 +       if (DSP_SUCCEEDED(status)) {
20777 +               pAttr->cbStruct = sizeof(struct DSP_NODEATTR);
20778 +               /* DSP_NODEATTRIN */
20779 +               pAttr->inNodeAttrIn.cbStruct =
20780 +                                sizeof(struct DSP_NODEATTRIN);
20781 +               pAttr->inNodeAttrIn.iPriority = hNode->nPriority;
20782 +               pAttr->inNodeAttrIn.uTimeout = hNode->uTimeout;
20783 +               pAttr->inNodeAttrIn.uHeapSize =
20784 +                       hNode->createArgs.asa.taskArgs.uHeapSize;
20785 +               pAttr->inNodeAttrIn.pGPPVirtAddr = (void *)
20786 +                       hNode->createArgs.asa.taskArgs.uGPPHeapAddr;
20787 +               pAttr->uInputs = hNode->uNumGPPInputs;
20788 +               pAttr->uOutputs = hNode->uNumGPPOutputs;
20789 +               /* DSP_NODEINFO */
20790 +               GetNodeInfo(hNode, &(pAttr->iNodeInfo));
20791         }
20792 +       /* end of SYNC_EnterCS */
20793 +       /* Exit critical section */
20794 +       (void)SYNC_LeaveCS(hNodeMgr->hSync);
20795 +
20796         return status;
20797  }
20798  
20799 @@ -1971,10 +1834,6 @@ DSP_STATUS NODE_GetChannelId(struct NODE
20800         GT_4trace(NODE_debugMask, GT_ENTER, "NODE_GetChannelId: hNode: "
20801                  "0x%x\tuDir: %d\tuIndex: %d\tpulId: 0x%x\n", hNode, uDir,
20802                  uIndex, pulId);
20803 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20804 -               status = DSP_EHANDLE;
20805 -               return status;
20806 -       }
20807         nodeType = NODE_GetType(hNode);
20808         if (nodeType != NODE_TASK && nodeType != NODE_DAISSOCKET) {
20809                 status = DSP_ENODETYPE;
20810 @@ -2020,10 +1879,7 @@ DSP_STATUS NODE_GetMessage(struct NODE_O
20811         GT_3trace(NODE_debugMask, GT_ENTER,
20812                  "NODE_GetMessage: hNode: 0x%x\tpMsg: "
20813                  "0x%x\tuTimeout: 0x%x\n", hNode, pMsg, uTimeout);
20814 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20815 -               status = DSP_EHANDLE;
20816 -               goto func_end;
20817 -       }
20818 +
20819         hProcessor = hNode->hProcessor;
20820         status = PROC_GetState(hProcessor, &procStatus,
20821                                         sizeof(struct DSP_PROCESSORSTATE));
20822 @@ -2118,10 +1974,7 @@ DSP_STATUS NODE_GetStrmMgr(struct NODE_O
20823  
20824         DBC_Require(cRefs > 0);
20825  
20826 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE))
20827 -               status = DSP_EHANDLE;
20828 -       else
20829 -               *phStrmMgr = hNode->hNodeMgr->hStrmMgr;
20830 +       *phStrmMgr = hNode->hNodeMgr->hStrmMgr;
20831  
20832         return status;
20833  }
20834 @@ -2131,16 +1984,10 @@ DSP_STATUS NODE_GetStrmMgr(struct NODE_O
20835   */
20836  enum NLDR_LOADTYPE NODE_GetLoadType(struct NODE_OBJECT *hNode)
20837  {
20838 -
20839         DBC_Require(cRefs > 0);
20840         DBC_Require(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
20841 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20842 -               GT_1trace(NODE_debugMask, GT_5CLASS,
20843 -                        "NODE_GetLoadType: Failed. hNode:"
20844 -                         " 0x%x\n", hNode);
20845 -               return -1;
20846 -       } else
20847 -               return hNode->dcdProps.objData.nodeObj.usLoadType;
20848 +
20849 +       return hNode->dcdProps.objData.nodeObj.usLoadType;
20850  }
20851  
20852  /*
20853 @@ -2152,13 +1999,8 @@ u32 NODE_GetTimeout(struct NODE_OBJECT *
20854  {
20855         DBC_Require(cRefs > 0);
20856         DBC_Require(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
20857 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20858 -               GT_1trace(NODE_debugMask, GT_5CLASS,
20859 -                        "NODE_GetTimeout: Failed. hNode:"
20860 -                         " 0x%x\n", hNode);
20861 -               return 0;
20862 -       } else
20863 -               return hNode->uTimeout;
20864 +
20865 +       return hNode->uTimeout;
20866  }
20867  
20868  /*
20869 @@ -2172,12 +2014,8 @@ enum NODE_TYPE NODE_GetType(struct NODE_
20870  
20871         if (hNode == (struct NODE_OBJECT *) DSP_HGPPNODE)
20872                 nodeType = NODE_GPP;
20873 -       else {
20874 -                if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE))
20875 -                        nodeType = -1;
20876 -                else
20877 -                        nodeType = hNode->nType;
20878 -       }
20879 +       else
20880 +               nodeType = hNode->nType;
20881         return nodeType;
20882  }
20883  
20884 @@ -2188,8 +2026,6 @@ enum NODE_TYPE NODE_GetType(struct NODE_
20885   */
20886  bool NODE_Init(void)
20887  {
20888 -       bool fRetVal = true;
20889 -
20890         DBC_Require(cRefs >= 0);
20891  
20892         if (cRefs == 0) {
20893 @@ -2197,14 +2033,12 @@ bool NODE_Init(void)
20894                 GT_create(&NODE_debugMask, "NO");       /* "NO" for NOde */
20895         }
20896  
20897 -       if (fRetVal)
20898 -               cRefs++;
20899 +       cRefs++;
20900  
20901         GT_1trace(NODE_debugMask, GT_5CLASS, "NODE_Init(), ref count: 0x%x\n",
20902                  cRefs);
20903  
20904 -       DBC_Ensure((fRetVal && (cRefs > 0)) || (!fRetVal && (cRefs >= 0)));
20905 -       return fRetVal;
20906 +       return true;
20907  }
20908  
20909  /*
20910 @@ -2214,7 +2048,9 @@ bool NODE_Init(void)
20911   */
20912  void NODE_OnExit(struct NODE_OBJECT *hNode, s32 nStatus)
20913  {
20914 -       DBC_Assert(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
20915 +       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE))
20916 +               return;
20917 +
20918         /* Set node state to done */
20919         NODE_SetState(hNode, NODE_DONE);
20920         hNode->nExitStatus = nStatus;
20921 @@ -2250,14 +2086,10 @@ DSP_STATUS NODE_Pause(struct NODE_OBJECT
20922  
20923         GT_1trace(NODE_debugMask, GT_ENTER, "NODE_Pause: hNode: 0x%x\n", hNode);
20924  
20925 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20926 -               status = DSP_EHANDLE;
20927 -               goto func_end;
20928 -       } else {
20929 -               nodeType = NODE_GetType(hNode);
20930 -               if (nodeType != NODE_TASK && nodeType != NODE_DAISSOCKET)
20931 -                       status = DSP_ENODETYPE;
20932 -       }
20933 +       nodeType = NODE_GetType(hNode);
20934 +       if (nodeType != NODE_TASK && nodeType != NODE_DAISSOCKET)
20935 +               status = DSP_ENODETYPE;
20936 +
20937         if (DSP_FAILED(status))
20938                 goto func_end;
20939  
20940 @@ -2278,11 +2110,13 @@ DSP_STATUS NODE_Pause(struct NODE_OBJECT
20941                         if (state != NODE_RUNNING)
20942                                 status = DSP_EWRONGSTATE;
20943  
20944 +                       if (DSP_FAILED(status))
20945 +                               goto func_cont;
20946                         hProcessor = hNode->hProcessor;
20947                         status = PROC_GetState(hProcessor, &procStatus,
20948                                         sizeof(struct DSP_PROCESSORSTATE));
20949                         if (DSP_FAILED(status))
20950 -                               goto func_end;
20951 +                               goto func_cont;
20952                         /* If processor is in error state then don't attempt
20953                             to send the message */
20954                         if (procStatus.iState == PROC_ERROR) {
20955 @@ -2290,7 +2124,7 @@ DSP_STATUS NODE_Pause(struct NODE_OBJECT
20956                                         "NODE_Pause: proc Status 0x%x\n",
20957                                         procStatus.iState);
20958                                 status = DSP_EFAIL;
20959 -                               goto func_end;
20960 +                               goto func_cont;
20961                         }
20962                         if (DSP_SUCCEEDED(status)) {
20963                                 status = DISP_NodeChangePriority(hNodeMgr->
20964 @@ -2308,6 +2142,7 @@ DSP_STATUS NODE_Pause(struct NODE_OBJECT
20965                                          " 0x%x\n", hNode);
20966                         }
20967                 }
20968 +func_cont:
20969                 /* End of SYNC_EnterCS */
20970                 /* Leave critical section */
20971                 (void)SYNC_LeaveCS(hNodeMgr->hSync);
20972 @@ -2346,10 +2181,7 @@ DSP_STATUS NODE_PutMessage(struct NODE_O
20973         GT_3trace(NODE_debugMask, GT_ENTER,
20974                  "NODE_PutMessage: hNode: 0x%x\tpMsg: "
20975                  "0x%x\tuTimeout: 0x%x\n", hNode, pMsg, uTimeout);
20976 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20977 -               status = DSP_EHANDLE;
20978 -               goto func_end;
20979 -       }
20980 +
20981         hProcessor = hNode->hProcessor;
20982         status = PROC_GetState(hProcessor, &procStatus,
20983                                         sizeof(struct DSP_PROCESSORSTATE));
20984 @@ -2433,8 +2265,8 @@ func_end:
20985   *      Register to be notified on specific events for this node.
20986   */
20987  DSP_STATUS NODE_RegisterNotify(struct NODE_OBJECT *hNode, u32 uEventMask,
20988 -                              u32 uNotifyType,
20989 -                              struct DSP_NOTIFICATION *hNotification)
20990 +                               u32 uNotifyType,
20991 +                               struct DSP_NOTIFICATION *hNotification)
20992  {
20993         struct WMD_DRV_INTERFACE *pIntfFxns;
20994         DSP_STATUS status = DSP_SOK;
20995 @@ -2447,24 +2279,21 @@ DSP_STATUS NODE_RegisterNotify(struct NO
20996                  "uEventMask: 0x%x\tuNotifyType: 0x%x\thNotification: 0x%x\n",
20997                  hNode, uEventMask, uNotifyType, hNotification);
20998  
20999 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
21000 -               status = DSP_EHANDLE;
21001 -       } else {
21002 -               /* Check if event mask is a valid node related event */
21003 -               if (uEventMask & ~(DSP_NODESTATECHANGE |
21004 -                  DSP_NODEMESSAGEREADY))
21005 -                       status = DSP_EVALUE;
21006 -
21007 -               /* Check if notify type is valid */
21008 -               if (uNotifyType != DSP_SIGNALEVENT)
21009 -                       status = DSP_EVALUE;
21010 +       /* Check if event mask is a valid node related event */
21011 +       if (uEventMask & ~(DSP_NODESTATECHANGE |
21012 +          DSP_NODEMESSAGEREADY))
21013 +               status = DSP_EVALUE;
21014 +
21015 +       /* Check if notify type is valid */
21016 +       if (uNotifyType != DSP_SIGNALEVENT)
21017 +               status = DSP_EVALUE;
21018 +
21019 +       /* Only one Notification can be registered at a
21020 +        * time - Limitation */
21021 +       if (uEventMask == (DSP_NODESTATECHANGE |
21022 +          DSP_NODEMESSAGEREADY))
21023 +               status = DSP_EVALUE;
21024  
21025 -               /* Only one Notification can be registered at a
21026 -                * time - Limitation */
21027 -               if (uEventMask == (DSP_NODESTATECHANGE |
21028 -                  DSP_NODEMESSAGEREADY))
21029 -                       status = DSP_EVALUE;
21030 -       }
21031         if (DSP_SUCCEEDED(status)) {
21032                 if (uEventMask == DSP_NODESTATECHANGE) {
21033                         status = NTFY_Register(hNode->hNtfy, hNotification,
21034 @@ -2505,10 +2334,7 @@ DSP_STATUS NODE_Run(struct NODE_OBJECT *
21035  
21036         DBC_Require(cRefs > 0);
21037         GT_1trace(NODE_debugMask, GT_ENTER, "NODE_Run: hNode: 0x%x\n", hNode);
21038 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
21039 -               status = DSP_EHANDLE;
21040 -               goto func_end;
21041 -       }
21042 +
21043         hProcessor = hNode->hProcessor;
21044         status = PROC_GetState(hProcessor, &procStatus,
21045                                         sizeof(struct DSP_PROCESSORSTATE));
21046 @@ -2528,6 +2354,10 @@ DSP_STATUS NODE_Run(struct NODE_OBJECT *
21047                 goto func_end;
21048  
21049         hNodeMgr = hNode->hNodeMgr;
21050 +       if (!MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE)) {
21051 +               status = DSP_EHANDLE;
21052 +               goto func_end;
21053 +       }
21054         pIntfFxns = hNodeMgr->pIntfFxns;
21055         /* Enter critical section */
21056         status = SYNC_EnterCS(hNodeMgr->hSync);
21057 @@ -2626,7 +2456,7 @@ DSP_STATUS NODE_Terminate(struct NODE_OB
21058  
21059         GT_1trace(NODE_debugMask, GT_ENTER,
21060                  "NODE_Terminate: hNode: 0x%x\n", hNode);
21061 -       if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
21062 +       if (!hNode->hNodeMgr) {
21063                 status = DSP_EHANDLE;
21064                 goto func_end;
21065         }
21066 @@ -2778,10 +2608,10 @@ static void DeleteNode(struct NODE_OBJEC
21067                         (struct PROC_OBJECT *)hNode->hProcessor;
21068  #endif
21069         DSP_STATUS status;
21070 -       DBC_Require(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
21071 +
21072         hNodeMgr = hNode->hNodeMgr;
21073 -       if (!MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE))
21074 -               return;
21075 +       if (!MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE))
21076 +               goto func_end;
21077         hXlator = hNode->hXlator;
21078         nodeType = NODE_GetType(hNode);
21079         if (nodeType != NODE_DEVICE) {
21080 @@ -2793,8 +2623,7 @@ static void DeleteNode(struct NODE_OBJEC
21081                 if (hNode->hMsgQueue) {
21082                         pIntfFxns = hNodeMgr->pIntfFxns;
21083                         (*pIntfFxns->pfnMsgDeleteQueue) (hNode->hMsgQueue);
21084 -                       hNode->hMsgQueue = NULL;
21085 -
21086 +                       hNode->hMsgQueue = NULL;
21087                 }
21088                 if (hNode->hSyncDone)
21089                         (void) SYNC_CloseEvent(hNode->hSyncDone);
21090 @@ -2806,7 +2635,7 @@ static void DeleteNode(struct NODE_OBJEC
21091                                 FreeStream(hNodeMgr, stream);
21092                         }
21093                         MEM_Free(hNode->inputs);
21094 -                       hNode->inputs = NULL;
21095 +                       hNode->inputs = NULL;
21096                 }
21097                 if (hNode->outputs) {
21098                         for (i = 0; i < MaxOutputs(hNode); i++) {
21099 @@ -2814,7 +2643,7 @@ static void DeleteNode(struct NODE_OBJEC
21100                                 FreeStream(hNodeMgr, stream);
21101                         }
21102                         MEM_Free(hNode->outputs);
21103 -                       hNode->outputs = NULL;
21104 +                       hNode->outputs = NULL;
21105                 }
21106                 taskArgs = hNode->createArgs.asa.taskArgs;
21107                 if (taskArgs.strmInDef) {
21108 @@ -2822,7 +2651,7 @@ static void DeleteNode(struct NODE_OBJEC
21109                                 if (taskArgs.strmInDef[i].szDevice) {
21110                                         MEM_Free(taskArgs.strmInDef[i].
21111                                                 szDevice);
21112 -                                       taskArgs.strmInDef[i].szDevice = NULL;
21113 +                                       taskArgs.strmInDef[i].szDevice = NULL;
21114                                 }
21115                         }
21116                         MEM_Free(taskArgs.strmInDef);
21117 @@ -2833,7 +2662,7 @@ static void DeleteNode(struct NODE_OBJEC
21118                                 if (taskArgs.strmOutDef[i].szDevice) {
21119                                         MEM_Free(taskArgs.strmOutDef[i].
21120                                                 szDevice);
21121 -                                       taskArgs.strmOutDef[i].szDevice = NULL;
21122 +                                       taskArgs.strmOutDef[i].szDevice = NULL;
21123                                 }
21124                         }
21125                         MEM_Free(taskArgs.strmOutDef);
21126 @@ -2841,8 +2670,8 @@ static void DeleteNode(struct NODE_OBJEC
21127                 }
21128                 if (taskArgs.uDSPHeapResAddr) {
21129                         status = PROC_UnMap(hNode->hProcessor,
21130 -                                       (void *)taskArgs.uDSPHeapAddr,
21131 -                                       pr_ctxt);
21132 +                                          (void *)taskArgs.uDSPHeapAddr,
21133 +                                          pr_ctxt);
21134                         if (DSP_SUCCEEDED(status)) {
21135                                 GT_0trace(NODE_debugMask, GT_5CLASS,
21136                                          "DSPProcessor_UnMap succeeded.\n");
21137 @@ -2871,55 +2700,57 @@ static void DeleteNode(struct NODE_OBJEC
21138                 }
21139         }
21140         if (nodeType != NODE_MESSAGE) {
21141 -               if (hNode->streamConnect) {
21142 +               if (hNode->streamConnect) {
21143                         MEM_Free(hNode->streamConnect);
21144 -                       hNode->streamConnect = NULL;
21145 -               }
21146 +                       hNode->streamConnect = NULL;
21147 +               }
21148         }
21149 -       if (hNode->pstrDevName) {
21150 +       if (hNode->pstrDevName) {
21151                 MEM_Free(hNode->pstrDevName);
21152 -               hNode->pstrDevName = NULL;
21153 -       }
21154 +               hNode->pstrDevName = NULL;
21155 +       }
21156  
21157 -       if (hNode->hNtfy) {
21158 +       if (hNode->hNtfy) {
21159                 NTFY_Delete(hNode->hNtfy);
21160 -               hNode->hNtfy = NULL;
21161 -       }
21162 +               hNode->hNtfy = NULL;
21163 +       }
21164  
21165         /* These were allocated in DCD_GetObjectDef (via NODE_Allocate) */
21166 -       if (hNode->dcdProps.objData.nodeObj.pstrCreatePhaseFxn) {
21167 +       if (hNode->dcdProps.objData.nodeObj.pstrCreatePhaseFxn) {
21168                 MEM_Free(hNode->dcdProps.objData.nodeObj.pstrCreatePhaseFxn);
21169 -               hNode->dcdProps.objData.nodeObj.pstrCreatePhaseFxn = NULL;
21170 -       }
21171 +               hNode->dcdProps.objData.nodeObj.pstrCreatePhaseFxn = NULL;
21172 +       }
21173  
21174 -       if (hNode->dcdProps.objData.nodeObj.pstrExecutePhaseFxn) {
21175 +       if (hNode->dcdProps.objData.nodeObj.pstrExecutePhaseFxn) {
21176                 MEM_Free(hNode->dcdProps.objData.nodeObj.pstrExecutePhaseFxn);
21177 -               hNode->dcdProps.objData.nodeObj.pstrExecutePhaseFxn = NULL;
21178 -       }
21179 +               hNode->dcdProps.objData.nodeObj.pstrExecutePhaseFxn = NULL;
21180 +       }
21181  
21182 -       if (hNode->dcdProps.objData.nodeObj.pstrDeletePhaseFxn) {
21183 +       if (hNode->dcdProps.objData.nodeObj.pstrDeletePhaseFxn) {
21184                 MEM_Free(hNode->dcdProps.objData.nodeObj.pstrDeletePhaseFxn);
21185 -               hNode->dcdProps.objData.nodeObj.pstrDeletePhaseFxn = NULL;
21186 -       }
21187 +               hNode->dcdProps.objData.nodeObj.pstrDeletePhaseFxn = NULL;
21188 +       }
21189  
21190 -       if (hNode->dcdProps.objData.nodeObj.pstrIAlgName) {
21191 +       if (hNode->dcdProps.objData.nodeObj.pstrIAlgName) {
21192                 MEM_Free(hNode->dcdProps.objData.nodeObj.pstrIAlgName);
21193 -               hNode->dcdProps.objData.nodeObj.pstrIAlgName = NULL;
21194 -       }
21195 +               hNode->dcdProps.objData.nodeObj.pstrIAlgName = NULL;
21196 +       }
21197  
21198         /* Free all SM address translator resources */
21199 -       if (hXlator) {
21200 +       if (hXlator) {
21201                 (void) CMM_XlatorDelete(hXlator, TRUE); /* force free */
21202 -               hXlator = NULL;
21203 -       }
21204 -
21205 -       if (hNode->hNldrNode) {
21206 -               hNodeMgr->nldrFxns.pfnFree(hNode->hNldrNode);
21207 -               hNode->hNldrNode = NULL;
21208 -       }
21209 +               hXlator = NULL;
21210 +       }
21211  
21212 +       if (hNode->hNldrNode) {
21213 +               MEM_Free(hNode->hNldrNode);
21214 +               hNode->hNldrNode = NULL;
21215 +       }
21216 +       hNode->hNodeMgr = NULL;
21217         MEM_FreeObject(hNode);
21218 -       hNode = NULL;
21219 +       hNode = NULL;
21220 +func_end:
21221 +       return;
21222  }
21223  
21224  /*
21225 @@ -2944,7 +2775,7 @@ static void DeleteNodeMgr(struct NODE_MG
21226                                         DeleteNode(hNode, NULL);
21227  
21228                         DBC_Assert(LST_IsEmpty(hNodeMgr->nodeList));
21229 -                       LST_Delete(hNodeMgr->nodeList);
21230 +                       MEM_Free(hNodeMgr->nodeList);
21231                 }
21232                 if (hNodeMgr->hNtfy)
21233                         NTFY_Delete(hNodeMgr->hNtfy);
21234 @@ -2990,8 +2821,8 @@ static void DeleteNodeMgr(struct NODE_MG
21235   *      Fills stream information.
21236   */
21237  static void FillStreamConnect(struct NODE_OBJECT *hNode1,
21238 -                            struct NODE_OBJECT *hNode2,
21239 -                            u32 uStream1, u32 uStream2)
21240 +                               struct NODE_OBJECT *hNode2,
21241 +                               u32 uStream1, u32 uStream2)
21242  {
21243         u32 uStrmIndex;
21244         struct DSP_STREAMCONNECT *pStrm1 = NULL;
21245 @@ -3005,7 +2836,7 @@ static void FillStreamConnect(struct NOD
21246  
21247                 if (node1Type != NODE_DEVICE) {
21248                         uStrmIndex = hNode1->uNumInputs +
21249 -                                    hNode1->uNumOutputs - 1;
21250 +                                       hNode1->uNumOutputs - 1;
21251                         pStrm1 = &(hNode1->streamConnect[uStrmIndex]);
21252                         pStrm1->cbStruct = sizeof(struct DSP_STREAMCONNECT);
21253                         pStrm1->uThisNodeStreamIndex = uStream1;
21254 @@ -3065,7 +2896,7 @@ static void FillStreamDef(struct NODE_OB
21255         } else {
21256                 pstrmDef->uNumBufs = DEFAULTNBUFS;
21257                 pstrmDef->uBufsize = DEFAULTBUFSIZE / hNodeMgr->
21258 -                                                     uDSPDataMauSize;
21259 +                                                       uDSPDataMauSize;
21260                 pstrmDef->uSegid = DEFAULTSEGID;
21261                 pstrmDef->uAlignment = DEFAULTALIGNMENT;
21262                 pstrmDef->uTimeout = DEFAULTTIMEOUT;
21263 @@ -3122,15 +2953,15 @@ static DSP_STATUS GetFxnAddress(struct N
21264         switch (uPhase) {
21265         case CREATEPHASE:
21266                 pstrFxnName = hNode->dcdProps.objData.nodeObj.
21267 -                             pstrCreatePhaseFxn;
21268 +                               pstrCreatePhaseFxn;
21269                 break;
21270         case EXECUTEPHASE:
21271                 pstrFxnName = hNode->dcdProps.objData.nodeObj.
21272 -                             pstrExecutePhaseFxn;
21273 +                               pstrExecutePhaseFxn;
21274                 break;
21275         case DELETEPHASE:
21276                 pstrFxnName = hNode->dcdProps.objData.nodeObj.
21277 -                             pstrDeletePhaseFxn;
21278 +                               pstrDeletePhaseFxn;
21279                 break;
21280         default:
21281                 /* Should never get here */
21282 @@ -3153,7 +2984,6 @@ void GetNodeInfo(struct NODE_OBJECT *hNo
21283  {
21284         u32 i;
21285  
21286 -       DBC_Require(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
21287         DBC_Require(pNodeInfo != NULL);
21288  
21289         pNodeInfo->cbStruct = sizeof(struct DSP_NODEINFO);
21290 @@ -3178,9 +3008,9 @@ void GetNodeInfo(struct NODE_OBJECT *hNo
21291   *      Retrieve node properties.
21292   */
21293  static DSP_STATUS GetNodeProps(struct DCD_MANAGER *hDcdMgr,
21294 -                             struct NODE_OBJECT *hNode,
21295 -                             CONST struct DSP_UUID *pNodeId,
21296 -                             struct DCD_GENERICOBJ *pdcdProps)
21297 +                               struct NODE_OBJECT *hNode,
21298 +                               CONST struct DSP_UUID *pNodeId,
21299 +                               struct DCD_GENERICOBJ *pdcdProps)
21300  {
21301         u32 uLen;
21302         struct NODE_MSGARGS *pMsgArgs;
21303 @@ -3188,7 +3018,7 @@ static DSP_STATUS GetNodeProps(struct DC
21304         enum NODE_TYPE nodeType = NODE_TASK;
21305         struct DSP_NDBPROPS *pndbProps = &(pdcdProps->objData.nodeObj.ndbProps);
21306         DSP_STATUS status = DSP_SOK;
21307 -#ifdef DEBUG
21308 +#ifdef CONFIG_BRIDGE_DEBUG
21309         char szUuid[MAXUUIDLEN];
21310  #endif
21311  
21312 @@ -3198,7 +3028,7 @@ static DSP_STATUS GetNodeProps(struct DC
21313         if (DSP_SUCCEEDED(status)) {
21314                 hNode->nType = nodeType = pndbProps->uNodeType;
21315  
21316 -#ifdef DEBUG
21317 +#ifdef CONFIG_BRIDGE_DEBUG
21318                 /* Create UUID value to set in registry. */
21319                 UUID_UuidToString((struct DSP_UUID *)pNodeId, szUuid,
21320                                  MAXUUIDLEN);
21321 @@ -3212,22 +3042,22 @@ static DSP_STATUS GetNodeProps(struct DC
21322                         pMsgArgs->uNotifyType = pdcdProps->objData.nodeObj.
21323                                                 uMsgNotifyType;
21324                         pMsgArgs->uMaxMessages = pndbProps->uMessageDepth;
21325 -#ifdef DEBUG
21326 +#ifdef CONFIG_BRIDGE_DEBUG
21327                         DBG_Trace(DBG_LEVEL7,
21328                                  "** (node) Max Number of Messages: 0x%x\n",
21329                                  pMsgArgs->uMaxMessages);
21330  #endif
21331                 } else {
21332                         /* Copy device name */
21333 -                       DBC_Require(pndbProps->acName);
21334 -                       uLen = strlen(pndbProps->acName);
21335 +                       DBC_Require(pndbProps->acName);
21336 +                       uLen = strlen(pndbProps->acName);
21337                         DBC_Assert(uLen < MAXDEVNAMELEN);
21338                         hNode->pstrDevName = MEM_Calloc(uLen + 1, MEM_PAGED);
21339                         if (hNode->pstrDevName == NULL) {
21340                                 status = DSP_EMEMORY;
21341                         } else {
21342 -                               strncpy(hNode->pstrDevName,
21343 -                                          pndbProps->acName, uLen);
21344 +                               strncpy(hNode->pstrDevName,
21345 +                                       pndbProps->acName, uLen);
21346                         }
21347                 }
21348         }
21349 @@ -3239,17 +3069,17 @@ static DSP_STATUS GetNodeProps(struct DC
21350                         pTaskArgs->uStackSize = pndbProps->uStackSize;
21351                         pTaskArgs->uSysStackSize = pndbProps->uSysStackSize;
21352                         pTaskArgs->uStackSeg = pndbProps->uStackSeg;
21353 -#ifdef DEBUG
21354 +#ifdef CONFIG_BRIDGE_DEBUG
21355                         DBG_Trace(DBG_LEVEL7,
21356 -                                "** (node) Priority: 0x%x\n" "** (node) Stack"
21357 -                                " Size: 0x%x words\n" "** (node) System Stack"
21358 -                                " Size: 0x%x words\n" "** (node) Stack"
21359 -                                " Segment: 0x%x\n\n",
21360 -                                 "** (node) profile count : 0x%x \n \n",
21361 -                                 pTaskArgs->nPriority, pTaskArgs->uStackSize,
21362 -                                 pTaskArgs->uSysStackSize,
21363 -                                 pTaskArgs->uStackSeg,
21364 -                                 pndbProps->uCountProfiles);
21365 +                               "** (node) Priority: 0x%x\n" "** (node) Stack"
21366 +                               " Size: 0x%x words\n" "** (node) System Stack"
21367 +                               " Size: 0x%x words\n" "** (node) Stack"
21368 +                               " Segment: 0x%x\n\n",
21369 +                               "** (node) profile count : 0x%x \n \n",
21370 +                               pTaskArgs->nPriority, pTaskArgs->uStackSize,
21371 +                               pTaskArgs->uSysStackSize,
21372 +                               pTaskArgs->uStackSeg,
21373 +                               pndbProps->uCountProfiles);
21374  #endif
21375                 }
21376         }
21377 @@ -3302,14 +3132,14 @@ static DSP_STATUS GetProcProps(struct NO
21378   *  Purpose:
21379   *      Fetch Node UUID properties from DCD/DOF file.
21380   */
21381 -DSP_STATUS NODE_GetUUIDProps(DSP_HPROCESSOR hProcessor,
21382 +DSP_STATUS NODE_GetUUIDProps(void *hProcessor,
21383                             IN CONST struct DSP_UUID *pNodeId,
21384                             OUT struct DSP_NDBPROPS *pNodeProps)
21385  {
21386         struct NODE_MGR *hNodeMgr = NULL;
21387         struct DEV_OBJECT *hDevObject;
21388         DSP_STATUS status = DSP_SOK;
21389 -       struct DCD_NODEPROPS   dcdNodeProps;
21390 +       struct DCD_NODEPROPS dcdNodeProps;
21391         struct DSP_PROCESSORSTATE procStatus;
21392  
21393         DBC_Require(cRefs > 0);
21394 @@ -3340,12 +3170,12 @@ DSP_STATUS NODE_GetUUIDProps(DSP_HPROCES
21395                  pNodeId, pNodeProps);
21396  
21397         status = PROC_GetDevObject(hProcessor, &hDevObject);
21398 -       if (DSP_SUCCEEDED(status) && hDevObject != NULL) {
21399 +       if (hDevObject != NULL)
21400                 status = DEV_GetNodeManager(hDevObject, &hNodeMgr);
21401 -               if (hNodeMgr == NULL) {
21402 -                       status = DSP_EHANDLE;
21403 -                       goto func_end;
21404 -               }
21405 +
21406 +       if (hNodeMgr == NULL) {
21407 +               status = DSP_EHANDLE;
21408 +               goto func_end;
21409         }
21410  
21411         /*
21412 @@ -3452,8 +3282,6 @@ static u32 Ovly(void *pPrivRef, u32 ulDs
21413         struct WMD_DEV_CONTEXT *hWmdContext;
21414         struct WMD_DRV_INTERFACE *pIntfFxns;    /* Function interface to WMD */
21415  
21416 -       DBC_Require(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
21417 -
21418         hNodeMgr = hNode->hNodeMgr;
21419  
21420         ulSize = ulNumBytes / hNodeMgr->uDSPWordSize;
21421 @@ -3462,11 +3290,18 @@ static u32 Ovly(void *pPrivRef, u32 ulDs
21422         /* Call new MemCopy function */
21423         pIntfFxns = hNodeMgr->pIntfFxns;
21424         status = DEV_GetWMDContext(hNodeMgr->hDevObject, &hWmdContext);
21425 -       status = (*pIntfFxns->pfnBrdMemCopy)(hWmdContext, ulDspRunAddr,
21426 -                ulDspLoadAddr, ulNumBytes, (u32) nMemSpace);
21427 -
21428 -       if (DSP_SUCCEEDED(status))
21429 -               ulBytes = ulNumBytes;
21430 +       if (DSP_SUCCEEDED(status)) {
21431 +               status = (*pIntfFxns->pfnBrdMemCopy)(hWmdContext, ulDspRunAddr,
21432 +                        ulDspLoadAddr, ulNumBytes, (u32) nMemSpace);
21433 +               if (DSP_SUCCEEDED(status))
21434 +                       ulBytes = ulNumBytes;
21435 +               else
21436 +                       pr_debug("%s: failed to copy brd memory, status 0x%x\n"
21437 +                                               , __func__, status);
21438 +       } else {
21439 +               pr_debug("%s: failed to get WMD context, status 0x%x\n",
21440 +                                                       __func__, status);
21441 +       }
21442  
21443         return ulBytes;
21444  }
21445 @@ -3485,7 +3320,6 @@ static u32 Write(void *pPrivRef, u32 ulD
21446         struct WMD_DEV_CONTEXT *hWmdContext;
21447         struct WMD_DRV_INTERFACE *pIntfFxns;    /* Function interface to WMD */
21448  
21449 -       DBC_Require(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
21450         DBC_Require(nMemSpace & DBLL_CODE || nMemSpace & DBLL_DATA);
21451  
21452         hNodeMgr = hNode->hNodeMgr;
21453 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/proc.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/proc.c
21454 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/proc.c     2011-04-17 17:32:28.000000000 +0100
21455 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/proc.c  2011-05-02 22:36:50.000000000 +0100
21456 @@ -3,6 +3,8 @@
21457   *
21458   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
21459   *
21460 + * Processor interface at the driver level.
21461 + *
21462   * Copyright (C) 2005-2006 Texas Instruments, Inc.
21463   *
21464   * This package is free software; you can redistribute it and/or modify
21465 @@ -14,92 +16,6 @@
21466   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21467   */
21468  
21469 -
21470 -/*
21471 - *  ======== proc.c ========
21472 - *  Description:
21473 - *      Processor interface at the driver level.
21474 - *
21475 - *  Public Functions:
21476 - *      PROC_Attach
21477 - *      PROC_Ctrl
21478 - *      PROC_Detach
21479 - *      PROC_EnumNodes
21480 - *      PROC_GetResourceInfo
21481 - *      PROC_Exit
21482 - *      PROC_FlushMemory
21483 - *      PROC_GetState
21484 - *      PROC_GetProcessorId
21485 - *      PROC_GetTrace
21486 - *      PROC_Init
21487 - *      PROC_Load
21488 - *      PROC_Map
21489 - *      PROC_NotifyClients
21490 - *      PROC_RegisterNotify
21491 - *      PROC_ReserveMemory
21492 - *      PROC_Start
21493 - *      PROC_UnMap
21494 - *      PROC_UnReserveMemory
21495 - *      PROC_InvalidateMemory
21496 -
21497 - *! Revision History
21498 - *! ======== ========
21499 - *! 04-Apr-2007 sh  Added PROC_InvalidateMemory API
21500 - *! 19-Apr-2004 sb  Aligned DMM definitions with Symbian
21501 - *!             Used MEM_FlushCache instead of OS specific API
21502 - *!             Integrated Alan's code review updates
21503 - *! 08-Mar-2004 sb  Added the Dynamic Memory Mapping feature
21504 - *! 08-Mar-2004 vp  Added g_pszLastCoff member to PROC_OBJECT.
21505 - *!             This is required for multiprocessor environment.
21506 - *! 09-Feb-2004 vp  Added PROC_GetProcessorID function
21507 - *! 22-Apr-2003 vp  Fixed issue with the string that stores coff file name
21508 - *! 03-Apr-2003 sb  Fix DEH deregistering bug
21509 - *! 26-Mar-2003 vp  Commented the call to DSP deep sleep in PROC_Start function.
21510 - *! 18-Feb-2003 vp  Code review updates.
21511 - *! 18-Oct-2002 vp  Ported to Linux platform.
21512 - *! 22-May-2002 sg  Do IOCTL-to-PWR translation before calling PWR_SleepDSP.
21513 - *! 14-May-2002 sg  Use CSL_Atoi() instead of atoi().
21514 - *! 13-May-2002 sg  Propagate PWR return codes upwards.
21515 - *! 07-May-2002 sg  Added check for, and call to PWR functions in PROC_Ctrl.
21516 - *! 02-May-2002 sg  Added "nap" mode: put DSP to sleep once booted.
21517 - *! 01-Apr-2002 jeh Assume word addresses in PROC_GetTrace().
21518 - *! 29-Nov-2001 jeh Don't call DEH function if hDehMgr == NULL.
21519 - *! 05-Nov-2001 kc: Updated PROC_RegisterNotify and PROC_GetState to support
21520 - *!             DEH module.
21521 - *! 09-Oct-2001 jeh Fix number of bytes calculated in PROC_GetTrace().
21522 - *! 11-Sep-2001 jeh Delete MSG manager in PROC_Monitor() to fix memory leak.
21523 - *! 29-Aug-2001 rr: DCD_AutoRegister and IOOnLoaded moved before COD_LoadBase
21524 - *!             to facilitate the external loading.
21525 - *! 14-Aug-2001 ag  DCD_AutoRegister() now called before IOOnLoaded() fxn.
21526 - *! 21-Jun-2001 rr: MSG_Create is done only the first time.
21527 - *! 02-May-2001 jeh Return failure in PROC_Load if IOOnLoaded function returns
21528 - *!             error other than E_NOTIMPL.
21529 - *! 03-Apr-2001 sg: Changed DSP_DCD_ENOAUTOREGISTER to DSP_EDCDNOAUTOREGISTER.
21530 - *! 13-Feb-2001 kc: DSP/BIOS Bridge name updates.
21531 - *! 05-Jan-2001 rr: PROC_LOAD MSG_Create error is checked.
21532 - *! 15-Dec-2000 rr: IoOnLoaded is checked for WSX_STATUS. We fail to load
21533 - *!             if DEV_Create2 fails; ie, no non-RMS targets can be
21534 - *!             loaded.
21535 - *! 12-Dec-2000 rr: PROC_Start's DEV_Create2 is checked for WSX_STATUS.
21536 - *! 28-Nov-2000 jeh Added call to IO OnLoaded function to PROC_Load().
21537 - *! 29-Nov-2000 rr: Incorporated code review changes.
21538 - *! 03-Nov-2000 rr: Auto_Register happens after PROC_Load.
21539 - *! 06-Oct-2000 rr: Updated to ver 0.9. PROC_Start calls DEV_Create2 and
21540 - *!             WMD_BRD_STOP is always followed by DEV_Destroy2.
21541 - *! 05-Sep-2000 rr: PROC_GetTrace calculates the Trace symbol for 55 in a
21542 - *!             different way.
21543 - *! 10-Aug-2000 rr: PROC_NotifyClients, PROC_GetProcessorHandle Added
21544 - *! 07-Aug-2000 rr: PROC_IDLE/SYNCINIT/UNKNOWN state removed.
21545 - *!             WMD fxns are checked for WSX_STATUS.
21546 - *!             PROC_Attach does not alter the state of the BRD.
21547 - *!             PROC_Run removed.
21548 - *! 04-Aug-2000 rr: All the functions return DSP_EHANDLE if proc handle is
21549 - *!             invalid
21550 - *! 27-Jul-2000 rr: PROC_GetTrace and PROC_Load implemented. Updated to
21551 - *!             ver 0.8 API.
21552 - *! 06-Jul-2000 rr: Created.
21553 - */
21554 -
21555  /* ------------------------------------ Host OS */
21556  #include <dspbridge/host_os.h>
21557  
21558 @@ -114,7 +30,6 @@
21559  
21560  /*  ----------------------------------- OS Adaptation Layer */
21561  #include <dspbridge/cfg.h>
21562 -#include <dspbridge/csl.h>
21563  #include <dspbridge/list.h>
21564  #include <dspbridge/mem.h>
21565  #include <dspbridge/ntfy.h>
21566 @@ -125,7 +40,6 @@
21567  /*  ----------------------------------- Platform Manager */
21568  #include <dspbridge/cod.h>
21569  #include <dspbridge/dev.h>
21570 -#include <dspbridge/drv.h>
21571  #include <dspbridge/procpriv.h>
21572  #include <dspbridge/dmm.h>
21573  
21574 @@ -137,7 +51,6 @@
21575  
21576  /*  ----------------------------------- Others */
21577  #include <dspbridge/dbdcd.h>
21578 -#include <dspbridge/dbreg.h>
21579  #include <dspbridge/msg.h>
21580  #include <dspbridge/wmdioctl.h>
21581  #include <dspbridge/drv.h>
21582 @@ -145,11 +58,8 @@
21583  /*  ----------------------------------- This */
21584  #include <dspbridge/proc.h>
21585  #include <dspbridge/pwr.h>
21586 -#include <mach-omap2/omap3-opp.h>
21587  
21588 -#ifndef RES_CLEANUP_DISABLE
21589  #include <dspbridge/resourcecleanup.h>
21590 -#endif
21591  /*  ----------------------------------- Defines, Data Structures, Typedefs */
21592  #define PROC_SIGNATURE    0x434F5250   /* "PROC" (in reverse). */
21593  #define MAXCMDLINELEN       255
21594 @@ -159,8 +69,6 @@
21595  #define PWR_TIMEOUT     500    /* Sleep/wake timout in msec */
21596  #define EXTEND       "_EXT_END"        /* Extmem end addr in DSP binary */
21597  
21598 -#define DSP_CACHE_LINE 128
21599 -
21600  extern char *iva_img;
21601  
21602  /*  ----------------------------------- Globals */
21603 @@ -168,6 +76,29 @@ extern char *iva_img;
21604  static struct GT_Mask PROC_DebugMask = { NULL, NULL }; /* WCD MGR Mask */
21605  #endif
21606  
21607 +/* The PROC_OBJECT structure.   */
21608 +struct PROC_OBJECT {
21609 +       struct list_head link;          /* Link to next PROC_OBJECT */
21610 +       u32 dwSignature;                /* Used for object validation */
21611 +       struct DEV_OBJECT *hDevObject;  /* Device this PROC represents */
21612 +       u32 hProcess;                   /* Process owning this Processor */
21613 +       struct MGR_OBJECT *hMgrObject;  /* Manager Object Handle */
21614 +       u32 uAttachCount;               /* Processor attach count */
21615 +       u32 uProcessor;                 /* Processor number */
21616 +       u32 uTimeout;                   /* Time out count */
21617 +       enum DSP_PROCSTATE sState;      /* Processor state */
21618 +       u32 ulUnit;                     /* DDSP unit number */
21619 +       bool bIsAlreadyAttached;        /*
21620 +                                        * True if the Device below has
21621 +                                        * GPP Client attached
21622 +                                        */
21623 +       struct NTFY_OBJECT *hNtfy;      /* Manages  notifications */
21624 +       struct WMD_DEV_CONTEXT *hWmdContext;    /* WMD Context Handle */
21625 +       struct WMD_DRV_INTERFACE *pIntfFxns;    /* Function interface to WMD */
21626 +       char *g_pszLastCoff;
21627 +       struct list_head proc_object;
21628 +};
21629 +
21630  static u32 cRefs;
21631  
21632  struct SYNC_CSOBJECT *hProcLock;       /* For critical sections */
21633 @@ -179,47 +110,6 @@ static char **PrependEnvp(char **newEnvp
21634                          char *szVar);
21635  
21636  /*
21637 - *  ======== PROC_CleanupAllResources =====
21638 - *  Purpose:
21639 - *      Funtion to clean the process resources.
21640 - *      This function is intended to be called when the
21641 - *       processor is in error state
21642 - */
21643 -DSP_STATUS PROC_CleanupAllResources(void)
21644 -{
21645 -       DSP_STATUS dsp_status = DSP_SOK;
21646 -       HANDLE hDrvObject = NULL;
21647 -       struct PROCESS_CONTEXT *pCtxtclosed = NULL;
21648 -       struct PROC_OBJECT *proc_obj_ptr, *temp;
21649 -
21650 -       GT_0trace(PROC_DebugMask, GT_ENTER, "PROC_CleanupAllResources\n");
21651 -
21652 -       dsp_status = CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
21653 -       if (DSP_FAILED(dsp_status))
21654 -               goto func_end;
21655 -
21656 -       DRV_GetProcCtxtList(&pCtxtclosed, (struct DRV_OBJECT *)hDrvObject);
21657 -
21658 -       while (pCtxtclosed != NULL) {
21659 -               if (current->tgid != pCtxtclosed->pid) {
21660 -                       GT_1trace(PROC_DebugMask, GT_5CLASS,
21661 -                                "***Cleanup of "
21662 -                                "process***%d\n", pCtxtclosed->pid);
21663 -                       list_for_each_entry_safe(proc_obj_ptr, temp,
21664 -                                       &pCtxtclosed->processor_list,
21665 -                                       proc_object) {
21666 -                               PROC_Detach(proc_obj_ptr, pCtxtclosed);
21667 -                       }
21668 -               }
21669 -               pCtxtclosed = pCtxtclosed->next;
21670 -       }
21671 -
21672 -       WMD_DEH_ReleaseDummyMem();
21673 -func_end:
21674 -       return dsp_status;
21675 -}
21676 -
21677 -/*
21678   *  ======== PROC_Attach ========
21679   *  Purpose:
21680   *      Prepare for communication with a particular DSP processor, and return
21681 @@ -227,7 +117,7 @@ func_end:
21682   */
21683  DSP_STATUS
21684  PROC_Attach(u32 uProcessor, OPTIONAL CONST struct DSP_PROCESSORATTRIN *pAttrIn,
21685 -       OUT DSP_HPROCESSOR *phProcessor, struct PROCESS_CONTEXT *pr_ctxt)
21686 +       void **phProcessor, struct PROCESS_CONTEXT *pr_ctxt)
21687  {
21688         DSP_STATUS status = DSP_SOK;
21689         struct DEV_OBJECT *hDevObject;
21690 @@ -243,6 +133,11 @@ PROC_Attach(u32 uProcessor, OPTIONAL CON
21691                  "uProcessor:  0x%x\n\tpAttrIn:  0x%x\n\tphProcessor:"
21692                  "0x%x\n", uProcessor, pAttrIn, phProcessor);
21693  
21694 +       if (pr_ctxt->hProcessor) {
21695 +               *phProcessor = pr_ctxt->hProcessor;
21696 +               return status;
21697 +       }
21698 +
21699         /* Get the Driver and Manager Object Handles */
21700         status = CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
21701         if (DSP_SUCCEEDED(status)) {
21702 @@ -285,13 +180,13 @@ PROC_Attach(u32 uProcessor, OPTIONAL CON
21703         if (pProcObject == NULL) {
21704                 GT_0trace(PROC_DebugMask, GT_7CLASS,
21705                          "PROC_Attach:Out of memeory \n");
21706 -               status = DSP_EFAIL;
21707 +               status = DSP_EMEMORY;
21708                 goto func_end;
21709         }
21710         pProcObject->hDevObject = hDevObject;
21711         pProcObject->hMgrObject = hMgrObject;
21712         pProcObject->uProcessor = devType;
21713 -       /* Store TGID of Caller Process */
21714 +       /* Store TGID instead of process handle */
21715         pProcObject->hProcess = current->tgid;
21716  
21717         INIT_LIST_HEAD(&pProcObject->proc_object);
21718 @@ -351,7 +246,8 @@ PROC_Attach(u32 uProcessor, OPTIONAL CON
21719                                  "Proc Object into DEV, 0x%x!\n", status);
21720                 }
21721                 if (DSP_SUCCEEDED(status)) {
21722 -                       *phProcessor = (DSP_HPROCESSOR)pProcObject;
21723 +                       *phProcessor = (void *)pProcObject;
21724 +                       pr_ctxt->hProcessor = *phProcessor;
21725                         (void)PROC_NotifyClients(pProcObject,
21726                                                  DSP_PROCESSORATTACH);
21727                         GT_0trace(PROC_DebugMask, GT_1CLASS,
21728 @@ -365,11 +261,6 @@ PROC_Attach(u32 uProcessor, OPTIONAL CON
21729                          "storage for notification \n");
21730                 MEM_FreeObject(pProcObject);
21731         }
21732 -#ifndef RES_CLEANUP_DISABLE
21733 -       spin_lock(&pr_ctxt->proc_list_lock);
21734 -       list_add(&pProcObject->proc_object, &pr_ctxt->processor_list);
21735 -       spin_unlock(&pr_ctxt->proc_list_lock);
21736 -#endif
21737  func_end:
21738         DBC_Ensure((status == DSP_EFAIL && *phProcessor == NULL) ||
21739                   (DSP_SUCCEEDED(status) &&
21740 @@ -394,8 +285,8 @@ static DSP_STATUS GetExecFile(struct CFG
21741                 return CFG_GetExecFile(hDevNode, size, execFile);
21742         } else if (devType == IVA_UNIT) {
21743                 if (iva_img) {
21744 -                       len = strlen(iva_img);
21745 -                       strncpy(execFile, iva_img, len + 1);
21746 +                       len = strlen(iva_img);
21747 +                       strncpy(execFile, iva_img, len + 1);
21748                         return DSP_SOK;
21749                 }
21750         }
21751 @@ -436,8 +327,8 @@ DSP_STATUS PROC_AutoStart(struct CFG_DEV
21752                  "Entered PROC_AutoStart, args:\n\t"
21753                  "hDevNode: 0x%x\thDevObject: 0x%x\n", hDevNode, hDevObject);
21754         /* Create a Dummy PROC Object */
21755 -       if (DSP_FAILED(CFG_GetObject((u32 *)&hMgrObject,
21756 -          REG_MGR_OBJECT))) {
21757 +       status = CFG_GetObject((u32 *)&hMgrObject, REG_MGR_OBJECT);
21758 +       if (DSP_FAILED(status)) {
21759                 GT_0trace(PROC_DebugMask, GT_7CLASS,
21760                          "PROC_AutoStart: DSP_FAILED to "
21761                          "Get MGR Object\n");
21762 @@ -448,18 +339,18 @@ DSP_STATUS PROC_AutoStart(struct CFG_DEV
21763                 GT_0trace(PROC_DebugMask, GT_7CLASS,
21764                          "PROC_AutoStart: DSP_FAILED "
21765                          "to Create a dummy Processor\n");
21766 +               status = DSP_EMEMORY;
21767                 goto func_end;
21768         }
21769         GT_0trace(PROC_DebugMask, GT_1CLASS, "NTFY Created \n");
21770         pProcObject->hDevObject = hDevObject;
21771         pProcObject->hMgrObject = hMgrObject;
21772         hProcObject = pProcObject;
21773 -       if (DSP_SUCCEEDED(DEV_GetIntfFxns(hDevObject,
21774 -          &pProcObject->pIntfFxns))) {
21775 -               if (DSP_SUCCEEDED(DEV_GetWMDContext(hDevObject,
21776 -                                &pProcObject->hWmdContext))) {
21777 -                       status = DSP_SOK;
21778 -               } else {
21779 +       status = DEV_GetIntfFxns(hDevObject, &pProcObject->pIntfFxns);
21780 +       if (DSP_SUCCEEDED(status)) {
21781 +               status = DEV_GetWMDContext(hDevObject,
21782 +                                       &pProcObject->hWmdContext);
21783 +               if (DSP_FAILED(status)) {
21784                         MEM_FreeObject(hProcObject);
21785                         GT_0trace(PROC_DebugMask, GT_7CLASS,
21786                                  "PROC_AutoStart: Failed "
21787 @@ -472,12 +363,16 @@ DSP_STATUS PROC_AutoStart(struct CFG_DEV
21788                          "get IntFxns \n");
21789         }
21790         if (DSP_FAILED(status))
21791 -               goto func_end;
21792 +               goto func_cont;
21793  
21794         /* Stop the Device, put it into standby mode */
21795         status = PROC_Stop(hProcObject);
21796 -       if (DSP_FAILED(CFG_GetAutoStart(hDevNode, &dwAutoStart)) ||
21797 -                          !dwAutoStart) {
21798 +
21799 +       if (DSP_FAILED(status))
21800 +               goto func_cont;
21801 +
21802 +       status = CFG_GetAutoStart(hDevNode, &dwAutoStart);
21803 +       if (DSP_FAILED(status) || !dwAutoStart) {
21804                 status = DSP_EFAIL;
21805                 /* DSP_FAILED to Get s32 Fxn or Wmd Context */
21806                 GT_0trace(PROC_DebugMask, GT_1CLASS, "PROC_AutoStart: "
21807 @@ -487,8 +382,9 @@ DSP_STATUS PROC_AutoStart(struct CFG_DEV
21808         /* Get the default executable for this board... */
21809         DEV_GetDevType(hDevObject, (u32 *)&devType);
21810         pProcObject->uProcessor = devType;
21811 -       if (DSP_SUCCEEDED(GetExecFile(hDevNode, hDevObject,
21812 -                        sizeof(szExecFile), szExecFile))) {
21813 +       status = GetExecFile(hDevNode, hDevObject, sizeof(szExecFile),
21814 +                                                       szExecFile);
21815 +       if (DSP_SUCCEEDED(status)) {
21816                 argv[0] = szExecFile;
21817                 argv[1] = NULL;
21818                 /* ...and try to load it: */
21819 @@ -509,7 +405,6 @@ DSP_STATUS PROC_AutoStart(struct CFG_DEV
21820                                   "PROC_AutoStart: DSP_FAILED to Load\n");
21821                 }
21822         } else {
21823 -               status = DSP_EFILE;
21824                 GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_AutoStart: "
21825                          "No Exec file found \n");
21826         }
21827 @@ -532,7 +427,7 @@ func_end:
21828   *      Call the WMD_ICOTL Fxn with the Argument This is a Synchronous
21829   *      Operation. arg can be null.
21830   */
21831 -DSP_STATUS PROC_Ctrl(DSP_HPROCESSOR hProcessor, u32 dwCmd,
21832 +DSP_STATUS PROC_Ctrl(void *hProcessor, u32 dwCmd,
21833                     IN struct DSP_CBDATA *arg)
21834  {
21835         DSP_STATUS status = DSP_SOK;
21836 @@ -544,42 +439,38 @@ DSP_STATUS PROC_Ctrl(DSP_HPROCESSOR hPro
21837                  "Entered PROC_Ctrl, args:\n\thProcessor:"
21838                  " 0x%x\n\tdwCmd: 0x%x\n\targ: 0x%x\n", hProcessor, dwCmd, arg);
21839  
21840 -       if (MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
21841 -               /* intercept PWR deep sleep command */
21842 -               if (dwCmd == WMDIOCTL_DEEPSLEEP) {
21843 -                       timeout = arg->cbData;
21844 -                       status = PWR_SleepDSP(PWR_DEEPSLEEP, timeout);
21845 -               }
21846 -               /* intercept PWR emergency sleep command */
21847 -               else if (dwCmd == WMDIOCTL_EMERGENCYSLEEP) {
21848 -                       timeout = arg->cbData;
21849 -                       status = PWR_SleepDSP(PWR_EMERGENCYDEEPSLEEP, timeout);
21850 -               } else if (dwCmd == PWR_DEEPSLEEP) {
21851 -                       /* timeout = arg->cbData; */
21852 -                       status = PWR_SleepDSP(PWR_DEEPSLEEP, timeout);
21853 -               }
21854 -               /* intercept PWR wake commands */
21855 -               else if (dwCmd == WMDIOCTL_WAKEUP) {
21856 -                       timeout = arg->cbData;
21857 -                       status = PWR_WakeDSP(timeout);
21858 -               } else if (dwCmd == PWR_WAKEUP) {
21859 -                       /* timeout = arg->cbData; */
21860 -                       status = PWR_WakeDSP(timeout);
21861 -               } else
21862 -                   if (DSP_SUCCEEDED
21863 -                       ((*pProcObject->pIntfFxns->pfnDevCntrl)
21864 -                               (pProcObject->hWmdContext, dwCmd, arg))) {
21865 -                       status = DSP_SOK;
21866 -               } else {
21867 -                       status = DSP_EFAIL;
21868 -                       GT_0trace(PROC_DebugMask, GT_7CLASS,
21869 -                                "PROC_Ctrl: Failed \n");
21870 -               }
21871 +
21872 +       /* intercept PWR deep sleep command */
21873 +       if (dwCmd == WMDIOCTL_DEEPSLEEP) {
21874 +               timeout = arg->cbData;
21875 +               status = PWR_SleepDSP(PWR_DEEPSLEEP, timeout);
21876 +       }
21877 +       /* intercept PWR emergency sleep command */
21878 +       else if (dwCmd == WMDIOCTL_EMERGENCYSLEEP) {
21879 +               timeout = arg->cbData;
21880 +               status = PWR_SleepDSP(PWR_EMERGENCYDEEPSLEEP, timeout);
21881 +       } else if (dwCmd == PWR_DEEPSLEEP) {
21882 +               /* timeout = arg->cbData; */
21883 +               status = PWR_SleepDSP(PWR_DEEPSLEEP, timeout);
21884 +       }
21885 +       /* intercept PWR wake commands */
21886 +       else if (dwCmd == WMDIOCTL_WAKEUP) {
21887 +               timeout = arg->cbData;
21888 +               status = PWR_WakeDSP(timeout);
21889 +       } else if (dwCmd == PWR_WAKEUP) {
21890 +               /* timeout = arg->cbData; */
21891 +               status = PWR_WakeDSP(timeout);
21892 +       } else
21893 +           if (DSP_SUCCEEDED
21894 +               ((*pProcObject->pIntfFxns->pfnDevCntrl)
21895 +                       (pProcObject->hWmdContext, dwCmd, arg))) {
21896 +               status = DSP_SOK;
21897         } else {
21898 -               status = DSP_EHANDLE;
21899 +               status = DSP_EFAIL;
21900                 GT_0trace(PROC_DebugMask, GT_7CLASS,
21901 -                        "PROC_Ctrl: InValid Processor Handle \n");
21902 +                        "PROC_Ctrl: Failed \n");
21903         }
21904 +
21905         GT_1trace(PROC_DebugMask, GT_ENTER, "Exiting PROC_Ctrl, 0x%x\n",
21906                  status);
21907         return status;
21908 @@ -591,29 +482,23 @@ DSP_STATUS PROC_Ctrl(DSP_HPROCESSOR hPro
21909   *      Destroys the  Processor Object. Removes the notification from the Dev
21910   *      List.
21911   */
21912 -DSP_STATUS PROC_Detach(DSP_HPROCESSOR hProcessor,
21913 -               struct PROCESS_CONTEXT *pr_ctxt)
21914 +DSP_STATUS PROC_Detach(struct PROCESS_CONTEXT *pr_ctxt)
21915  {
21916         DSP_STATUS status = DSP_SOK;
21917 -       struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
21918 +       struct PROC_OBJECT *pProcObject = NULL;
21919 +
21920         DBC_Require(cRefs > 0);
21921 -       GT_1trace(PROC_DebugMask, GT_ENTER, "Entered PROC_Detach, args:\n\t"
21922 -                "hProcessor:  0x%x\n", hProcessor);
21923 +       GT_0trace(PROC_DebugMask, GT_ENTER, "Entered PROC_Detach\n");
21924 +
21925 +       pProcObject = (struct PROC_OBJECT *)pr_ctxt->hProcessor;
21926  
21927         if (MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
21928 -#ifndef RES_CLEANUP_DISABLE
21929 -               if (pr_ctxt) {
21930 -                       spin_lock(&pr_ctxt->proc_list_lock);
21931 -                       list_del(&pProcObject->proc_object);
21932 -                       spin_unlock(&pr_ctxt->proc_list_lock);
21933 -               }
21934 -#endif
21935 -               /* Notify the Client */
21936 -               NTFY_Notify(pProcObject->hNtfy, DSP_PROCESSORDETACH);
21937 -               /* Remove the notification memory */
21938 -               if (pProcObject->hNtfy)
21939 +               if (pProcObject->hNtfy) {
21940 +                       /* Notify the Client */
21941 +                       NTFY_Notify(pProcObject->hNtfy, DSP_PROCESSORDETACH);
21942 +                       /* Remove the notification memory */
21943                         NTFY_Delete(pProcObject->hNtfy);
21944 -
21945 +               }
21946                 if (pProcObject->g_pszLastCoff) {
21947                         MEM_Free(pProcObject->g_pszLastCoff);
21948                         pProcObject->g_pszLastCoff = NULL;
21949 @@ -623,11 +508,13 @@ DSP_STATUS PROC_Detach(DSP_HPROCESSOR hP
21950                         (u32)pProcObject);
21951                 /* Free the Processor Object */
21952                 MEM_FreeObject(pProcObject);
21953 +               pr_ctxt->hProcessor = NULL;
21954         } else {
21955                 status = DSP_EHANDLE;
21956                 GT_0trace(PROC_DebugMask, GT_7CLASS,
21957                          "PROC_Detach: InValid Processor Handle \n");
21958         }
21959 +
21960         GT_1trace(PROC_DebugMask, GT_ENTER, "Exiting PROC_Detach, 0x%x\n",
21961                  status);
21962         return status;
21963 @@ -639,9 +526,9 @@ DSP_STATUS PROC_Detach(DSP_HPROCESSOR hP
21964   *      Enumerate and get configuration information about nodes allocated
21965   *      on a DSP processor.
21966   */
21967 -DSP_STATUS PROC_EnumNodes(DSP_HPROCESSOR hProcessor, OUT DSP_HNODE *aNodeTab,
21968 -               IN u32 uNodeTabSize, OUT u32 *puNumNodes,
21969 -               OUT u32 *puAllocated)
21970 +DSP_STATUS PROC_EnumNodes(void *hProcessor, void **aNodeTab,
21971 +               IN u32 uNodeTabSize, OUT u32 *puNumNodes,
21972 +               OUT u32 *puAllocated)
21973  {
21974         DSP_STATUS status = DSP_EFAIL;
21975         struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
21976 @@ -657,21 +544,17 @@ DSP_STATUS PROC_EnumNodes(DSP_HPROCESSOR
21977                         " 0x%x\n\t puNumNodes 0x%x\n\t puAllocated: 0x%x\n",
21978                         hProcessor, aNodeTab, uNodeTabSize, puNumNodes,
21979                         puAllocated);
21980 -       if (MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
21981 -               if (DSP_SUCCEEDED(DEV_GetNodeManager(pProcObject->hDevObject,
21982 -                                &hNodeMgr))) {
21983 -                       if (hNodeMgr) {
21984 -                               status = NODE_EnumNodes(hNodeMgr, aNodeTab,
21985 -                                                       uNodeTabSize,
21986 -                                                       puNumNodes,
21987 -                                                       puAllocated);
21988 -                       }
21989 +
21990 +       if (DSP_SUCCEEDED(DEV_GetNodeManager(pProcObject->hDevObject,
21991 +                        &hNodeMgr))) {
21992 +               if (hNodeMgr) {
21993 +                       status = NODE_EnumNodes(hNodeMgr, aNodeTab,
21994 +                                               uNodeTabSize,
21995 +                                               puNumNodes,
21996 +                                               puAllocated);
21997                 }
21998 -       } else {
21999 -               status = DSP_EHANDLE;
22000 -               GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_EnumNodes: "
22001 -                        "InValid Processor Handle \n");
22002         }
22003 +
22004         GT_6trace(PROC_DebugMask, GT_ENTER, "Exit PROC_EnumNodes, args:\n\t"
22005                         "hProcessor:  0x%x\n\taNodeTab:  0x%x\n\tuNodeTabSize: "
22006                         " 0x%x\n\t puNumNodes 0x%x\n\t puAllocated: 0x%x\n\t "
22007 @@ -690,11 +573,6 @@ static int memory_sync_page(struct vm_ar
22008         unsigned long offset;
22009         ssize_t rest;
22010  
22011 -#ifdef CHECK_DSP_CACHE_LINE
22012 -       if ((start & DSP_CACHE_LINE) || (len & DSP_CACHE_LINE))
22013 -               pr_warning("%s: not aligned: %08lx(%d)\n", __func__,
22014 -                          start, len);
22015 -#endif
22016         while (len) {
22017                 page = follow_page(vma, start, FOLL_GET);
22018                 if (!page) {
22019 @@ -750,7 +628,6 @@ static int memory_sync_vma(unsigned long
22020                         break;
22021  
22022                 start = vma->vm_end;
22023 -               len -= size;
22024         }
22025  
22026         if (!vma)
22027 @@ -759,13 +636,12 @@ static int memory_sync_vma(unsigned long
22028         return err;
22029  }
22030  
22031 -static DSP_STATUS proc_memory_sync(DSP_HPROCESSOR hProcessor, void *pMpuAddr,
22032 +static DSP_STATUS proc_memory_sync(void *hProcessor, void *pMpuAddr,
22033                                    u32 ulSize, u32 ulFlags,
22034                                    enum DSP_FLUSHTYPE FlushMemType)
22035  {
22036         /* Keep STATUS here for future additions to this function */
22037         DSP_STATUS status = DSP_SOK;
22038 -       struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
22039  
22040         DBC_Require(cRefs > 0);
22041         GT_5trace(PROC_DebugMask, GT_ENTER,
22042 @@ -773,13 +649,6 @@ static DSP_STATUS proc_memory_sync(DSP_H
22043                   "hProcessor: 0x%x pMpuAddr: 0x%x ulSize 0x%x, ulFlags 0x%x\n",
22044                   __func__, hProcessor, pMpuAddr, ulSize, ulFlags);
22045  
22046 -       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22047 -               GT_1trace(PROC_DebugMask, GT_7CLASS,
22048 -                         "%s: InValid Processor Handle\n", __func__);
22049 -               status = DSP_EHANDLE;
22050 -               goto err_out;
22051 -       }
22052 -
22053         down_read(&current->mm->mmap_sem);
22054  
22055         if (memory_sync_vma((u32)pMpuAddr, ulSize, FlushMemType)) {
22056 @@ -789,7 +658,7 @@ static DSP_STATUS proc_memory_sync(DSP_H
22057         }
22058  
22059         up_read(&current->mm->mmap_sem);
22060 -err_out:
22061 +
22062         GT_2trace(PROC_DebugMask, GT_ENTER,
22063                   "Leaving %s [0x%x]", __func__, status);
22064  
22065 @@ -801,14 +670,11 @@ err_out:
22066   *  Purpose:
22067   *     Flush cache
22068   */
22069 -DSP_STATUS PROC_FlushMemory(DSP_HPROCESSOR hProcessor, void *pMpuAddr,
22070 +DSP_STATUS PROC_FlushMemory(void *hProcessor, void *pMpuAddr,
22071                             u32 ulSize, u32 ulFlags)
22072  {
22073         enum DSP_FLUSHTYPE mtype = PROC_WRITEBACK_INVALIDATE_MEM;
22074  
22075 -       if (ulFlags & 1)
22076 -               mtype = PROC_WRITEBACK_MEM;
22077 -
22078         return proc_memory_sync(hProcessor, pMpuAddr, ulSize, ulFlags, mtype);
22079  }
22080  
22081 @@ -817,7 +683,7 @@ DSP_STATUS PROC_FlushMemory(DSP_HPROCESS
22082   *  Purpose:
22083   *     Invalidates the memory specified
22084   */
22085 -DSP_STATUS PROC_InvalidateMemory(DSP_HPROCESSOR hProcessor, void *pMpuAddr,
22086 +DSP_STATUS PROC_InvalidateMemory(void *hProcessor, void *pMpuAddr,
22087                                  u32 ulSize)
22088  {
22089         enum DSP_FLUSHTYPE mtype = PROC_INVALIDATE_MEM;
22090 @@ -830,7 +696,7 @@ DSP_STATUS PROC_InvalidateMemory(DSP_HPR
22091   *  Purpose:
22092   *      Enumerate the resources currently available on a processor.
22093   */
22094 -DSP_STATUS PROC_GetResourceInfo(DSP_HPROCESSOR hProcessor, u32 uResourceType,
22095 +DSP_STATUS PROC_GetResourceInfo(void *hProcessor, u32 uResourceType,
22096                                 OUT struct DSP_RESOURCEINFO *pResourceInfo,
22097                                 u32 uResourceInfoSize)
22098  {
22099 @@ -849,43 +715,39 @@ DSP_STATUS PROC_GetResourceInfo(DSP_HPRO
22100                  "hProcessor:  0x%x\n\tuResourceType:  0x%x\n\tpResourceInfo:"
22101                  " 0x%x\n\t uResourceInfoSize 0x%x\n", hProcessor,
22102                  uResourceType, pResourceInfo, uResourceInfoSize);
22103 -       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22104 -               status = DSP_EHANDLE;
22105 -               GT_0trace(PROC_DebugMask, GT_7CLASS,
22106 -                        "PROC_GetResourceInfo: InValid "
22107 -                        "Processor Handle \n");
22108 -               goto func_end;
22109 -       }
22110 +
22111         switch (uResourceType) {
22112         case DSP_RESOURCE_DYNDARAM:
22113         case DSP_RESOURCE_DYNSARAM:
22114         case DSP_RESOURCE_DYNEXTERNAL:
22115         case DSP_RESOURCE_DYNSRAM:
22116 -               if (DSP_FAILED(DEV_GetNodeManager(pProcObject->hDevObject,
22117 -                  &hNodeMgr)))
22118 +               status = DEV_GetNodeManager(pProcObject->hDevObject,
22119 +                                                               &hNodeMgr);
22120 +               if (DSP_FAILED(status))
22121                         goto func_end;
22122  
22123 -               if (DSP_SUCCEEDED(NODE_GetNldrObj(hNodeMgr, &hNldr))) {
22124 -                       if (DSP_SUCCEEDED(NLDR_GetRmmManager(hNldr, &rmm))) {
22125 +               status = NODE_GetNldrObj(hNodeMgr, &hNldr);
22126 +               if (DSP_SUCCEEDED(status)) {
22127 +                       status = NLDR_GetRmmManager(hNldr, &rmm);
22128 +                       if (DSP_SUCCEEDED(status)) {
22129                                 DBC_Assert(rmm != NULL);
22130 -                               status = DSP_EVALUE;
22131 -                               if (RMM_stat(rmm,
22132 +                               if (!RMM_stat(rmm,
22133                                    (enum DSP_MEMTYPE)uResourceType,
22134                                    (struct DSP_MEMSTAT *)&(pResourceInfo->
22135                                    result.memStat)))
22136 -                                       status = DSP_SOK;
22137 +                                       status = DSP_EVALUE;
22138                         }
22139                 }
22140                 break;
22141         case DSP_RESOURCE_PROCLOAD:
22142                 status = DEV_GetIOMgr(pProcObject->hDevObject, &hIOMgr);
22143 -               status = pProcObject->pIntfFxns->pfnIOGetProcLoad(hIOMgr,
22144 -                        (struct DSP_PROCLOADSTAT *)&(pResourceInfo->
22145 -                        result.procLoadStat));
22146 -               if (DSP_FAILED(status)) {
22147 +               if (DSP_SUCCEEDED(status))
22148 +                       status = pProcObject->pIntfFxns->pfnIOGetProcLoad(
22149 +                               hIOMgr, (struct DSP_PROCLOADSTAT *)&
22150 +                               (pResourceInfo->result.procLoadStat));
22151 +               if (DSP_FAILED(status))
22152                         GT_1trace(PROC_DebugMask, GT_7CLASS,
22153                         "Error in procLoadStat function 0x%x\n", status);
22154 -               }
22155                 break;
22156         default:
22157                 status = DSP_EFAIL;
22158 @@ -923,7 +785,7 @@ void PROC_Exit(void)
22159   *      Return the Dev Object handle for a given Processor.
22160   *
22161   */
22162 -DSP_STATUS PROC_GetDevObject(DSP_HPROCESSOR hProcessor,
22163 +DSP_STATUS PROC_GetDevObject(void *hProcessor,
22164                              struct DEV_OBJECT **phDevObject)
22165  {
22166         DSP_STATUS status = DSP_EFAIL;
22167 @@ -932,13 +794,8 @@ DSP_STATUS PROC_GetDevObject(DSP_HPROCES
22168         DBC_Require(cRefs > 0);
22169         DBC_Require(phDevObject != NULL);
22170  
22171 -       if (MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22172 -               *phDevObject = pProcObject->hDevObject;
22173 -               status = DSP_SOK;
22174 -       } else {
22175 -               *phDevObject = NULL;
22176 -               status = DSP_EHANDLE;
22177 -       }
22178 +       *phDevObject = pProcObject->hDevObject;
22179 +       status = DSP_SOK;
22180  
22181         DBC_Ensure((DSP_SUCCEEDED(status) && *phDevObject != NULL) ||
22182                    (DSP_FAILED(status) && *phDevObject == NULL));
22183 @@ -951,13 +808,13 @@ DSP_STATUS PROC_GetDevObject(DSP_HPROCES
22184   *  Purpose:
22185   *      Report the state of the specified DSP processor.
22186   */
22187 -DSP_STATUS PROC_GetState(DSP_HPROCESSOR hProcessor,
22188 +DSP_STATUS PROC_GetState(void *hProcessor,
22189                         OUT struct DSP_PROCESSORSTATE *pProcStatus,
22190                         u32 uStateInfoSize)
22191  {
22192         DSP_STATUS status = DSP_SOK;
22193         struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
22194 -       BRD_STATUS brdStatus;
22195 +       int brdStatus;
22196         struct DEH_MGR *hDehMgr;
22197  
22198         DBC_Require(cRefs > 0);
22199 @@ -967,37 +824,38 @@ DSP_STATUS PROC_GetState(DSP_HPROCESSOR 
22200         GT_3trace(PROC_DebugMask, GT_ENTER, "Entering PROC_GetState, args:\n\t"
22201                  "pProcStatus: 0x%x\n\thProcessor: 0x%x\n\t uStateInfoSize"
22202                  " 0x%x\n", pProcStatus, hProcessor, uStateInfoSize);
22203 -       if (MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22204 -               /* First, retrieve BRD state information */
22205 -               if (DSP_SUCCEEDED((*pProcObject->pIntfFxns->pfnBrdStatus)
22206 -                  (pProcObject->hWmdContext, &brdStatus))) {
22207 -                       switch (brdStatus) {
22208 -                       case BRD_STOPPED:
22209 -                               pProcStatus->iState = PROC_STOPPED;
22210 -                               break;
22211 -                       case BRD_DSP_HIBERNATION:
22212 -                               /* Fall through */
22213 -                       case BRD_RUNNING:
22214 -                               pProcStatus->iState = PROC_RUNNING;
22215 -                               break;
22216 -                       case BRD_LOADED:
22217 -                               pProcStatus->iState = PROC_LOADED;
22218 -                               break;
22219 -                       case BRD_ERROR:
22220 -                               pProcStatus->iState = PROC_ERROR;
22221 -                               break;
22222 -                       default:
22223 -                               pProcStatus->iState = 0xFF;
22224 -                               status = DSP_EFAIL;
22225 -                               break;
22226 -                       }
22227 -               } else {
22228 +
22229 +       /* First, retrieve BRD state information */
22230 +       status = (*pProcObject->pIntfFxns->pfnBrdStatus)
22231 +                          (pProcObject->hWmdContext, &brdStatus);
22232 +       if (DSP_SUCCEEDED(status)) {
22233 +               switch (brdStatus) {
22234 +               case BRD_STOPPED:
22235 +                       pProcStatus->iState = PROC_STOPPED;
22236 +                       break;
22237 +               case BRD_SLEEP_TRANSITION:
22238 +               case BRD_DSP_HIBERNATION:
22239 +                       /* Fall through */
22240 +               case BRD_RUNNING:
22241 +                       pProcStatus->iState = PROC_RUNNING;
22242 +                       break;
22243 +               case BRD_LOADED:
22244 +                       pProcStatus->iState = PROC_LOADED;
22245 +                       break;
22246 +               case BRD_ERROR:
22247 +                       pProcStatus->iState = PROC_ERROR;
22248 +                       break;
22249 +               default:
22250 +                       pProcStatus->iState = 0xFF;
22251                         status = DSP_EFAIL;
22252 -                       GT_0trace(PROC_DebugMask, GT_7CLASS,
22253 -                                "PROC_GetState: General Failure"
22254 -                                " to read the PROC Status \n");
22255                 }
22256 -               /* Next, retrieve error information, if any */
22257 +       } else {
22258 +               GT_0trace(PROC_DebugMask, GT_7CLASS,
22259 +                        "PROC_GetState: General Failure"
22260 +                        " to read the PROC Status \n");
22261 +       }
22262 +       /* Next, retrieve error information, if any */
22263 +       if (DSP_SUCCEEDED(status)) {
22264                 status = DEV_GetDehMgr(pProcObject->hDevObject, &hDehMgr);
22265                 if (DSP_SUCCEEDED(status) && hDehMgr) {
22266                         status = (*pProcObject->pIntfFxns->pfnDehGetInfo)
22267 @@ -1008,15 +866,10 @@ DSP_STATUS PROC_GetState(DSP_HPROCESSOR 
22268                                          "retrieve exception info.\n");
22269                         }
22270                 } else {
22271 -                       status = DSP_EFAIL;
22272                         GT_0trace(PROC_DebugMask, GT_7CLASS,
22273                                  "PROC_GetState: Failed to "
22274                                  "retrieve DEH handle.\n");
22275                 }
22276 -       } else {
22277 -               status = DSP_EHANDLE;
22278 -               GT_0trace(PROC_DebugMask, GT_7CLASS,
22279 -                        "PROC_GetState:InValid Processor Handle \n");
22280         }
22281         GT_2trace(PROC_DebugMask, GT_ENTER,
22282                  "Exiting PROC_GetState, results:\n\t"
22283 @@ -1037,7 +890,7 @@ DSP_STATUS PROC_GetState(DSP_HPROCESSOR 
22284   *      This call is destructive, meaning the processor is placed in the monitor
22285   *      state as a result of this function.
22286   */
22287 -DSP_STATUS PROC_GetTrace(DSP_HPROCESSOR hProcessor, u8 *pBuf, u32 uMaxSize)
22288 +DSP_STATUS PROC_GetTrace(void *hProcessor, u8 *pBuf, u32 uMaxSize)
22289  {
22290         DSP_STATUS status;
22291         status = DSP_ENOTIMPL;
22292 @@ -1080,7 +933,7 @@ bool PROC_Init(void)
22293   *      This will be an OEM-only function, and not part of the DSP/BIOS Bridge
22294   *      application developer's API.
22295   */
22296 -DSP_STATUS PROC_Load(DSP_HPROCESSOR hProcessor, IN CONST s32 iArgc,
22297 +DSP_STATUS PROC_Load(void *hProcessor, IN CONST s32 iArgc,
22298                     IN CONST char **aArgv, IN CONST char **aEnvp)
22299  {
22300         DSP_STATUS status = DSP_SOK;
22301 @@ -1098,32 +951,31 @@ DSP_STATUS PROC_Load(DSP_HPROCESSOR hPro
22302         struct DMM_OBJECT *hDmmMgr;
22303         u32 dwExtEnd;
22304         u32 uProcId;
22305 -#ifdef DEBUG
22306 -       BRD_STATUS uBrdState;
22307 +#ifdef CONFIG_BRIDGE_DEBUG
22308 +       int uBrdState;
22309  #endif
22310 +
22311  #ifdef OPT_LOAD_TIME_INSTRUMENTATION
22312         struct timeval tv1;
22313         struct timeval tv2;
22314  #endif
22315 +
22316 +#if defined(CONFIG_BRIDGE_DVFS) && !defined(CONFIG_CPU_FREQ)
22317 +       struct dspbridge_platform_data *pdata =
22318 +                               omap_dspbridge_dev->dev.platform_data;
22319 +#endif
22320 +
22321         DBC_Require(cRefs > 0);
22322         DBC_Require(iArgc > 0);
22323         DBC_Require(aArgv != NULL);
22324 +
22325  #ifdef OPT_LOAD_TIME_INSTRUMENTATION
22326         do_gettimeofday(&tv1);
22327  #endif
22328 -#if defined(CONFIG_BRIDGE_DVFS) && !defined(CONFIG_CPU_FREQ)
22329 -       struct dspbridge_platform_data *pdata =
22330 -                               omap_dspbridge_dev->dev.platform_data;
22331 -#endif
22332         GT_2trace(PROC_DebugMask, GT_ENTER, "Entered PROC_Load, args:\n\t"
22333                  "hProcessor:  0x%x\taArgv: 0x%x\n", hProcessor, aArgv[0]);
22334         /* Call the WMD_BRD_Load Fxn */
22335 -       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22336 -               status = DSP_EHANDLE;
22337 -               GT_0trace(PROC_DebugMask, GT_1CLASS,
22338 -                        "PROC_Load: Invalid Processor Handle..\n");
22339 -               goto func_end;
22340 -       }
22341 +
22342         if (pProcObject->bIsAlreadyAttached) {
22343                 GT_0trace(PROC_DebugMask, GT_7CLASS,
22344                          "PROC_Load GPP "
22345 @@ -1229,13 +1081,13 @@ DSP_STATUS PROC_Load(DSP_HPROCESSOR hPro
22346                                 DBC_Assert(pProcObject->g_pszLastCoff == NULL);
22347                                 /* Allocate memory for pszLastCoff */
22348                                 pProcObject->g_pszLastCoff = MEM_Calloc(
22349 -                                       (strlen((char *)aArgv[0]) + 1),
22350 +                                       (strlen((char *)aArgv[0]) + 1),
22351                                         MEM_PAGED);
22352                                 /* If memory allocated, save COFF file name*/
22353                                 if (pProcObject->g_pszLastCoff) {
22354 -                                       strncpy(pProcObject->g_pszLastCoff,
22355 +                                       strncpy(pProcObject->g_pszLastCoff,
22356                                                 (char *)aArgv[0],
22357 -                                       (strlen((char *)aArgv[0]) + 1));
22358 +                                               (strlen((char *)aArgv[0]) + 1));
22359                                 }
22360                         }
22361                 }
22362 @@ -1251,30 +1103,19 @@ DSP_STATUS PROC_Load(DSP_HPROCESSOR hPro
22363                         DBC_Assert(DSP_SUCCEEDED(status));
22364                         DEV_SetMsgMgr(pProcObject->hDevObject, hMsgMgr);
22365                 }
22366 -               if (status == DSP_ENOTIMPL) {
22367 -                       /* It's OK not to have a message manager */
22368 -                       status = DSP_SOK;
22369 -               }
22370         }
22371         if (DSP_SUCCEEDED(status)) {
22372                 /* Set the Device object's message manager */
22373                 status = DEV_GetIOMgr(pProcObject->hDevObject, &hIOMgr);
22374                 DBC_Assert(DSP_SUCCEEDED(status));
22375                 status = (*pProcObject->pIntfFxns->pfnIOOnLoaded)(hIOMgr);
22376 -               if (status == DSP_ENOTIMPL) {
22377 -                       /* Ok not to implement this function */
22378 -                       status = DSP_SOK;
22379 -               } else {
22380 -                       if (DSP_FAILED(status)) {
22381 -                               GT_1trace(PROC_DebugMask, GT_7CLASS,
22382 -                                         "PROC_Load: Failed to get shared "
22383 -                                         "memory or message buffer address "
22384 -                                         "from COFF status 0x%x\n", status);
22385 -                               status = DSP_EFAIL;
22386 -                       }
22387 -               }
22388 +               if (DSP_FAILED(status))
22389 +                       GT_1trace(PROC_DebugMask, GT_7CLASS,
22390 +                                 "PROC_Load: Failed to get shared "
22391 +                                 "memory or message buffer address "
22392 +                                 "from COFF status 0x%x\n", status);
22393 +
22394         } else {
22395 -               status = DSP_EFAIL;
22396                 GT_1trace(PROC_DebugMask, GT_7CLASS,
22397                           "PROC_Load: DSP_FAILED in "
22398                           "MSG_Create status 0x%x\n", status);
22399 @@ -1317,15 +1158,13 @@ DSP_STATUS PROC_Load(DSP_HPROCESSOR hPro
22400                          (pProcObject->hWmdContext, BRD_LOADED);
22401                 if (DSP_SUCCEEDED(status)) {
22402                         pProcObject->sState = PROC_LOADED;
22403 -                       if (pProcObject->hNtfy) {
22404 +                       if (pProcObject->hNtfy)
22405                                 PROC_NotifyClients(pProcObject,
22406                                                  DSP_PROCESSORSTATECHANGE);
22407 -                       }
22408                 } else {
22409                         GT_1trace(PROC_DebugMask, GT_7CLASS,
22410                                  "PROC_Load, pfnBrdSetState "
22411                                  "failed: 0x%x\n", status);
22412 -                       status = DSP_EFAIL;
22413                 }
22414         }
22415         if (DSP_SUCCEEDED(status)) {
22416 @@ -1361,7 +1200,7 @@ DSP_STATUS PROC_Load(DSP_HPROCESSOR hPro
22417         /* Restore the original argv[0] */
22418         MEM_Free(newEnvp);
22419         aArgv[0] = pargv0;
22420 -#ifdef DEBUG
22421 +#ifdef CONFIG_BRIDGE_DEBUG
22422         if (DSP_SUCCEEDED(status)) {
22423                 if (DSP_SUCCEEDED((*pProcObject->pIntfFxns->pfnBrdStatus)
22424                    (pProcObject->hWmdContext, &uBrdState))) {
22425 @@ -1372,7 +1211,7 @@ DSP_STATUS PROC_Load(DSP_HPROCESSOR hPro
22426         }
22427  #endif
22428  func_end:
22429 -#ifdef DEBUG
22430 +#ifdef CONFIG_BRIDGE_DEBUG
22431         if (DSP_FAILED(status)) {
22432                 GT_0trace(PROC_DebugMask, GT_1CLASS, "PROC_Load: "
22433                          "Processor Load Failed.\n");
22434 @@ -1401,7 +1240,7 @@ func_end:
22435   *  Purpose:
22436   *      Maps a MPU buffer to DSP address space.
22437   */
22438 -DSP_STATUS PROC_Map(DSP_HPROCESSOR hProcessor, void *pMpuAddr, u32 ulSize,
22439 +DSP_STATUS PROC_Map(void *hProcessor, void *pMpuAddr, u32 ulSize,
22440                    void *pReqAddr, void **ppMapAddr, u32 ulMapAttr,
22441                    struct PROCESS_CONTEXT *pr_ctxt)
22442  {
22443 @@ -1412,9 +1251,7 @@ DSP_STATUS PROC_Map(DSP_HPROCESSOR hProc
22444         DSP_STATUS status = DSP_SOK;
22445         struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
22446  
22447 -#ifndef RES_CLEANUP_DISABLE
22448         HANDLE        dmmRes;
22449 -#endif
22450  
22451         GT_6trace(PROC_DebugMask, GT_ENTER, "Entered PROC_Map, args:\n\t"
22452                  "hProcessor %x, pMpuAddr %x, ulSize %x, pReqAddr %x, "
22453 @@ -1429,12 +1266,6 @@ DSP_STATUS PROC_Map(DSP_HPROCESSOR hProc
22454         GT_3trace(PROC_DebugMask, GT_ENTER, "PROC_Map: vaAlign %x, paAlign %x, "
22455                  "sizeAlign %x\n", vaAlign, paAlign, sizeAlign);
22456  
22457 -       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22458 -               status = DSP_EHANDLE;
22459 -               GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_Map: "
22460 -                        "InValid Processor Handle \n");
22461 -               goto func_end;
22462 -       }
22463         /* Critical section */
22464         (void)SYNC_EnterCS(hProcLock);
22465         status = DMM_GetHandle(pProcObject, &hDmmMgr);
22466 @@ -1461,18 +1292,11 @@ DSP_STATUS PROC_Map(DSP_HPROCESSOR hProc
22467         }
22468         (void)SYNC_LeaveCS(hProcLock);
22469  
22470 -#ifndef RES_CLEANUP_DISABLE
22471         if (DSP_SUCCEEDED(status)) {
22472 -               spin_lock(&pr_ctxt->dmm_list_lock);
22473 -
22474                 DRV_InsertDMMResElement(&dmmRes, pr_ctxt);
22475                 DRV_UpdateDMMResElement(dmmRes, (u32)pMpuAddr, ulSize,
22476                                 (u32)pReqAddr, (u32)*ppMapAddr, hProcessor);
22477 -
22478 -               spin_unlock(&pr_ctxt->dmm_list_lock);
22479         }
22480 -#endif
22481 -func_end:
22482         GT_1trace(PROC_DebugMask, GT_ENTER, "Leaving PROC_Map [0x%x]", status);
22483         return status;
22484  }
22485 @@ -1482,7 +1306,7 @@ func_end:
22486   *  Purpose:
22487   *      Register to be notified of specific processor events.
22488   */
22489 -DSP_STATUS PROC_RegisterNotify(DSP_HPROCESSOR hProcessor, u32 uEventMask,
22490 +DSP_STATUS PROC_RegisterNotify(void *hProcessor, u32 uEventMask,
22491                               u32 uNotifyType, struct DSP_NOTIFICATION
22492                               *hNotification)
22493  {
22494 @@ -1499,14 +1323,6 @@ DSP_STATUS PROC_RegisterNotify(DSP_HPROC
22495                  " 0x%x\n\t hNotification 0x%x\n", hProcessor, uEventMask,
22496                  uNotifyType, hNotification);
22497  
22498 -       /* Check processor handle */
22499 -       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22500 -               status = DSP_EHANDLE;
22501 -               GT_1trace(PROC_DebugMask, GT_7CLASS,
22502 -                        "PROC_RegsiterNotify Invalid "
22503 -                        "ProcessorHandle 0x%x\n", hProcessor);
22504 -               goto func_end;
22505 -       }
22506         /* Check if event mask is a valid processor related event */
22507         if (uEventMask & ~(DSP_PROCESSORSTATECHANGE | DSP_PROCESSORATTACH |
22508            DSP_PROCESSORDETACH | DSP_PROCESSORRESTART | DSP_MMUFAULT |
22509 @@ -1551,12 +1367,9 @@ DSP_STATUS PROC_RegisterNotify(DSP_HPROC
22510                         status = (*pProcObject->pIntfFxns->pfnDehRegisterNotify)
22511                                  (hDehMgr, uEventMask, uNotifyType,
22512                                  hNotification);
22513 -                       if (DSP_FAILED(status))
22514 -                               status = DSP_EFAIL;
22515  
22516                 }
22517         }
22518 -func_end:
22519         return status;
22520  }
22521  
22522 @@ -1565,7 +1378,7 @@ func_end:
22523   *  Purpose:
22524   *      Reserve a virtually contiguous region of DSP address space.
22525   */
22526 -DSP_STATUS PROC_ReserveMemory(DSP_HPROCESSOR hProcessor, u32 ulSize,
22527 +DSP_STATUS PROC_ReserveMemory(void *hProcessor, u32 ulSize,
22528                              void **ppRsvAddr)
22529  {
22530         struct DMM_OBJECT *hDmmMgr;
22531 @@ -1576,12 +1389,7 @@ DSP_STATUS PROC_ReserveMemory(DSP_HPROCE
22532                  "Entered PROC_ReserveMemory, args:\n\t"
22533                  "hProcessor: 0x%x ulSize: 0x%x ppRsvAddr: 0x%x\n", hProcessor,
22534                  ulSize, ppRsvAddr);
22535 -       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22536 -               status = DSP_EHANDLE;
22537 -               GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_Map: "
22538 -                        "InValid Processor Handle \n");
22539 -               goto func_end;
22540 -       }
22541 +
22542         status = DMM_GetHandle(pProcObject, &hDmmMgr);
22543         if (DSP_FAILED(status)) {
22544                 GT_1trace(PROC_DebugMask, GT_7CLASS, "PROC_ReserveMemory: "
22545 @@ -1591,7 +1399,6 @@ DSP_STATUS PROC_ReserveMemory(DSP_HPROCE
22546  
22547         GT_1trace(PROC_DebugMask, GT_ENTER, "Leaving PROC_ReserveMemory [0x%x]",
22548                  status);
22549 -func_end:
22550         return status;
22551  }
22552  
22553 @@ -1600,24 +1407,19 @@ func_end:
22554   *  Purpose:
22555   *      Start a processor running.
22556   */
22557 -DSP_STATUS PROC_Start(DSP_HPROCESSOR hProcessor)
22558 +DSP_STATUS PROC_Start(void *hProcessor)
22559  {
22560         DSP_STATUS status = DSP_SOK;
22561         struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
22562         struct COD_MANAGER *hCodMgr;    /* Code manager handle    */
22563         u32 dwDspAddr;  /* Loaded code's entry point.    */
22564 -#ifdef DEBUG
22565 -       BRD_STATUS uBrdState;
22566 +#ifdef CONFIG_BRIDGE_DEBUG
22567 +       int uBrdState;
22568  #endif
22569         DBC_Require(cRefs > 0);
22570         GT_1trace(PROC_DebugMask, GT_ENTER, "Entered PROC_Start, args:\n\t"
22571                  "hProcessor:  0x%x\n", hProcessor);
22572 -       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22573 -               status = DSP_EHANDLE;
22574 -               GT_0trace(PROC_DebugMask, GT_7CLASS,
22575 -                        "PROC_Start :InValid Handle \n");
22576 -               goto func_end;
22577 -       }
22578 +
22579         /* Call the WMD_BRD_Start */
22580         if (pProcObject->sState != PROC_LOADED) {
22581                 GT_0trace(PROC_DebugMask, GT_7CLASS,
22582 @@ -1627,7 +1429,6 @@ DSP_STATUS PROC_Start(DSP_HPROCESSOR hPr
22583         }
22584         status = DEV_GetCodMgr(pProcObject->hDevObject, &hCodMgr);
22585         if (DSP_FAILED(status)) {
22586 -               status = DSP_EFAIL;
22587                 GT_1trace(PROC_DebugMask, GT_7CLASS,
22588                          "Processor Start DSP_FAILED "
22589                          "in Getting DEV_GetCodMgr status 0x%x\n", status);
22590 @@ -1635,7 +1436,6 @@ DSP_STATUS PROC_Start(DSP_HPROCESSOR hPr
22591         }
22592         status = COD_GetEntry(hCodMgr, &dwDspAddr);
22593         if (DSP_FAILED(status)) {
22594 -               status = DSP_EFAIL;
22595                 GT_1trace(PROC_DebugMask, GT_7CLASS,
22596                          "Processor Start  DSP_FAILED in "
22597                          "Getting COD_GetEntry status 0x%x\n", status);
22598 @@ -1644,7 +1444,6 @@ DSP_STATUS PROC_Start(DSP_HPROCESSOR hPr
22599         status = (*pProcObject->pIntfFxns->pfnBrdStart)
22600                  (pProcObject->hWmdContext, dwDspAddr);
22601         if (DSP_FAILED(status)) {
22602 -               status = DSP_EFAIL;
22603                 GT_0trace(PROC_DebugMask, GT_7CLASS,
22604                          "PROC_Start Failed to Start the board\n");
22605                 goto func_cont;
22606 @@ -1668,13 +1467,12 @@ DSP_STATUS PROC_Start(DSP_HPROCESSOR hPr
22607                  * Stop the Processor from running. Put it in STOPPED State */
22608                 (void)(*pProcObject->pIntfFxns->pfnBrdStop)(pProcObject->
22609                         hWmdContext);
22610 -               status = DSP_EFAIL;
22611                 pProcObject->sState = PROC_STOPPED;
22612                 GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_Start "
22613                          "Failed to Create the Node Manager\n");
22614         }
22615  func_cont:
22616 -#ifdef DEBUG
22617 +#ifdef CONFIG_BRIDGE_DEBUG
22618         if (DSP_SUCCEEDED(status)) {
22619                 if (DSP_SUCCEEDED((*pProcObject->pIntfFxns->pfnBrdStatus)
22620                    (pProcObject->hWmdContext, &uBrdState))) {
22621 @@ -1697,33 +1495,26 @@ func_end:
22622   *  Purpose:
22623   *      Stop a processor running.
22624   */
22625 -DSP_STATUS PROC_Stop(DSP_HPROCESSOR hProcessor)
22626 +DSP_STATUS PROC_Stop(void *hProcessor)
22627  {
22628         DSP_STATUS status = DSP_SOK;
22629         struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
22630         struct MSG_MGR *hMsgMgr;
22631         struct NODE_MGR *hNodeMgr;
22632 -       DSP_HNODE hNode;
22633 +       void *hNode;
22634         u32 uNodeTabSize = 1;
22635         u32 uNumNodes = 0;
22636         u32 uNodesAllocated = 0;
22637 -       BRD_STATUS uBrdState;
22638 +       int uBrdState;
22639  
22640         DBC_Require(cRefs > 0);
22641         GT_1trace(PROC_DebugMask, GT_ENTER, "Entered PROC_Stop, args:\n\t"
22642                  "hProcessor:  0x%x\n", hProcessor);
22643 -       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22644 -               status = DSP_EHANDLE;
22645 -               GT_0trace(PROC_DebugMask, GT_7CLASS,
22646 -                        "PROC_Stop :InValid Handle \n");
22647 -               goto func_end;
22648 -       }
22649 +
22650         if (DSP_SUCCEEDED((*pProcObject->pIntfFxns->pfnBrdStatus)
22651            (pProcObject->hWmdContext, &uBrdState))) {
22652 -               /* Clean up all the resources except the current running
22653 -                * process resources */
22654                 if (uBrdState == BRD_ERROR)
22655 -                       PROC_CleanupAllResources();
22656 +                       WMD_DEH_ReleaseDummyMem();
22657         }
22658         /* check if there are any running nodes */
22659         status = DEV_GetNodeManager(pProcObject->hDevObject, &hNodeMgr);
22660 @@ -1754,7 +1545,7 @@ DSP_STATUS PROC_Stop(DSP_HPROCESSOR hPro
22661                                 MSG_Delete(hMsgMgr);
22662                                 DEV_SetMsgMgr(pProcObject->hDevObject, NULL);
22663                         }
22664 -#ifdef DEBUG
22665 +#ifdef CONFIG_BRIDGE_DEBUG
22666                         if (DSP_SUCCEEDED((*pProcObject->pIntfFxns->
22667                            pfnBrdStatus)(pProcObject->hWmdContext,
22668                            &uBrdState))) {
22669 @@ -1771,7 +1562,7 @@ DSP_STATUS PROC_Stop(DSP_HPROCESSOR hPro
22670                 GT_0trace(PROC_DebugMask, GT_7CLASS,
22671                          "PROC_Stop Failed to Stop the processor/device \n");
22672         }
22673 -func_end:
22674 +
22675         GT_1trace(PROC_DebugMask, GT_ENTER, "Exiting PROC_Stop, status  0x%x\n",
22676                  status);
22677  
22678 @@ -1783,7 +1574,7 @@ func_end:
22679   *  Purpose:
22680   *      Removes a MPU buffer mapping from the DSP address space.
22681   */
22682 -DSP_STATUS PROC_UnMap(DSP_HPROCESSOR hProcessor, void *pMapAddr,
22683 +DSP_STATUS PROC_UnMap(void *hProcessor, void *pMapAddr,
22684                 struct PROCESS_CONTEXT *pr_ctxt)
22685  {
22686         DSP_STATUS status = DSP_SOK;
22687 @@ -1791,59 +1582,44 @@ DSP_STATUS PROC_UnMap(DSP_HPROCESSOR hPr
22688         struct DMM_OBJECT *hDmmMgr;
22689         u32 vaAlign;
22690         u32 sizeAlign;
22691 -#ifndef RES_CLEANUP_DISABLE
22692 +
22693         HANDLE        dmmRes;
22694 -#endif
22695 +
22696         GT_2trace(PROC_DebugMask, GT_ENTER,
22697                  "Entered PROC_UnMap, args:\n\thProcessor:"
22698                  "0x%x pMapAddr: 0x%x\n", hProcessor, pMapAddr);
22699  
22700         vaAlign = PG_ALIGN_LOW((u32) pMapAddr, PG_SIZE_4K);
22701 -       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22702 -               status = DSP_EHANDLE;
22703 -               GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_UnMap: "
22704 -                        "InValid Processor Handle \n");
22705 -               goto func_end;
22706 -       }
22707  
22708         status = DMM_GetHandle(hProcessor, &hDmmMgr);
22709 -       if (DSP_FAILED(status))
22710 -               goto func_end;
22711 -       /* Critical section */
22712 -       (void)SYNC_EnterCS(hProcLock);
22713         if (DSP_FAILED(status)) {
22714                 GT_1trace(PROC_DebugMask, GT_7CLASS, "PROC_UnMap: "
22715 -                        "Failed to get DMM Mgr handle: 0x%x\n", status);
22716 -       } else {
22717 -               /* Update DMM structures. Get the size to unmap.
22718 -                This function returns error if the VA is not mapped */
22719 -               status = DMM_UnMapMemory(hDmmMgr, (u32) vaAlign, &sizeAlign);
22720 +                       "Failed to get DMM Mgr handle: 0x%x\n", status);
22721 +               goto func_end;
22722         }
22723 +
22724 +       /* Critical section */
22725 +       (void)SYNC_EnterCS(hProcLock);
22726 +       /*
22727 +        * Update DMM structures. Get the size to unmap.
22728 +        * This function returns error if the VA is not mapped
22729 +        */
22730 +       status = DMM_UnMapMemory(hDmmMgr, (u32) vaAlign, &sizeAlign);
22731         /* Remove mapping from the page tables. */
22732         if (DSP_SUCCEEDED(status)) {
22733                 status = (*pProcObject->pIntfFxns->pfnBrdMemUnMap)
22734                          (pProcObject->hWmdContext, vaAlign, sizeAlign);
22735         }
22736         (void)SYNC_LeaveCS(hProcLock);
22737 -#ifndef RES_CLEANUP_DISABLE
22738         GT_1trace(PROC_DebugMask, GT_ENTER,
22739                    "PROC_UnMap DRV_GetDMMResElement "
22740                    "pMapAddr:[0x%x]", pMapAddr);
22741         if (DSP_FAILED(status))
22742                 goto func_end;
22743  
22744 -       if (pr_ctxt) {
22745 -               DSP_STATUS rc;
22746 -
22747 -               spin_lock(&pr_ctxt->dmm_list_lock);
22748 -
22749 -               rc = DRV_GetDMMResElement((u32)pMapAddr, &dmmRes, pr_ctxt);
22750 -               if (rc != DSP_ENOTFOUND)
22751 -                       DRV_RemoveDMMResElement(dmmRes, pr_ctxt);
22752 -
22753 -               spin_unlock(&pr_ctxt->dmm_list_lock);
22754 -       }
22755 -#endif
22756 +       if (DRV_GetDMMResElement((u32)pMapAddr, &dmmRes, pr_ctxt)
22757 +                                                       != DSP_ENOTFOUND)
22758 +               DRV_RemoveDMMResElement(dmmRes, pr_ctxt);
22759  func_end:
22760         GT_1trace(PROC_DebugMask, GT_ENTER,
22761                  "Leaving PROC_UnMap [0x%x]", status);
22762 @@ -1855,7 +1631,7 @@ func_end:
22763   *  Purpose:
22764   *      Frees a previously reserved region of DSP address space.
22765   */
22766 -DSP_STATUS PROC_UnReserveMemory(DSP_HPROCESSOR hProcessor, void *pRsvAddr)
22767 +DSP_STATUS PROC_UnReserveMemory(void *hProcessor, void *pRsvAddr)
22768  {
22769         struct DMM_OBJECT *hDmmMgr;
22770         DSP_STATUS status = DSP_SOK;
22771 @@ -1864,12 +1640,7 @@ DSP_STATUS PROC_UnReserveMemory(DSP_HPRO
22772         GT_2trace(PROC_DebugMask, GT_ENTER,
22773                  "Entered PROC_UnReserveMemory, args:\n\t"
22774                  "hProcessor: 0x%x pRsvAddr: 0x%x\n", hProcessor, pRsvAddr);
22775 -       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22776 -               status = DSP_EHANDLE;
22777 -               GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_UnMap: "
22778 -                        "InValid Processor Handle \n");
22779 -               goto func_end;
22780 -       }
22781 +
22782         status = DMM_GetHandle(pProcObject, &hDmmMgr);
22783         if (DSP_FAILED(status))
22784                 GT_1trace(PROC_DebugMask, GT_7CLASS,
22785 @@ -1881,7 +1652,7 @@ DSP_STATUS PROC_UnReserveMemory(DSP_HPRO
22786         GT_1trace(PROC_DebugMask, GT_ENTER,
22787                  "Leaving PROC_UnReserveMemory [0x%x]",
22788                  status);
22789 -func_end:
22790 +
22791         return status;
22792  }
22793  
22794 @@ -1907,12 +1678,11 @@ static DSP_STATUS PROC_Monitor(struct PR
22795         DSP_STATUS status = DSP_EFAIL;
22796         struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcObject;
22797         struct MSG_MGR *hMsgMgr;
22798 -#ifdef DEBUG
22799 -       BRD_STATUS uBrdState;
22800 +#ifdef CONFIG_BRIDGE_DEBUG
22801 +       int uBrdState;
22802  #endif
22803  
22804         DBC_Require(cRefs > 0);
22805 -       DBC_Require(MEM_IsValidHandle(pProcObject, PROC_SIGNATURE));
22806  
22807         GT_1trace(PROC_DebugMask, GT_ENTER, "Entered PROC_Monitor, args:\n\t"
22808                  "hProcessor: 0x%x\n", hProcObject);
22809 @@ -1931,7 +1701,7 @@ static DSP_STATUS PROC_Monitor(struct PR
22810         if (DSP_SUCCEEDED((*pProcObject->pIntfFxns->pfnBrdMonitor)
22811            (pProcObject->hWmdContext))) {
22812                 status = DSP_SOK;
22813 -#ifdef DEBUG
22814 +#ifdef CONFIG_BRIDGE_DEBUG
22815                 if (DSP_SUCCEEDED((*pProcObject->pIntfFxns->pfnBrdStatus)
22816                    (pProcObject->hWmdContext, &uBrdState))) {
22817                         GT_0trace(PROC_DebugMask, GT_1CLASS,
22818 @@ -1949,7 +1719,7 @@ static DSP_STATUS PROC_Monitor(struct PR
22819         GT_1trace(PROC_DebugMask, GT_ENTER,
22820                  "Exiting PROC_Monitor, status  0x%x\n",
22821                  status);
22822 -#ifdef DEBUG
22823 +#ifdef CONFIG_BRIDGE_DEBUG
22824         DBC_Ensure((DSP_SUCCEEDED(status) && uBrdState == BRD_IDLE) ||
22825                   DSP_FAILED(status));
22826  #endif
22827 @@ -2007,25 +1777,18 @@ static char **PrependEnvp(char **newEnvp
22828   *  Purpose:
22829   *      Notify the processor the events.
22830   */
22831 -DSP_STATUS PROC_NotifyClients(DSP_HPROCESSOR hProc, u32 uEvents)
22832 +DSP_STATUS PROC_NotifyClients(void *hProc, u32 uEvents)
22833  {
22834         DSP_STATUS status = DSP_SOK;
22835         struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProc;
22836  
22837 -       DBC_Require(MEM_IsValidHandle(pProcObject, PROC_SIGNATURE));
22838         DBC_Require(IsValidProcEvent(uEvents));
22839         DBC_Require(cRefs > 0);
22840 -       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22841 -               status = DSP_EHANDLE;
22842 -               GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_NotifyClients: "
22843 -                        "InValid Processor Handle \n");
22844 -               goto func_end;
22845 -       }
22846  
22847         NTFY_Notify(pProcObject->hNtfy, uEvents);
22848         GT_0trace(PROC_DebugMask, GT_1CLASS,
22849                  "PROC_NotifyClients :Signaled. \n");
22850 -func_end:
22851 +
22852         return status;
22853  }
22854  
22855 @@ -2035,20 +1798,26 @@ func_end:
22856   *      Notify the processor the events. This includes notifying all clients
22857   *      attached to a particulat DSP.
22858   */
22859 -DSP_STATUS PROC_NotifyAllClients(DSP_HPROCESSOR hProc, u32 uEvents)
22860 +DSP_STATUS PROC_NotifyAllClients(void *hProc, u32 uEvents)
22861  {
22862         DSP_STATUS status = DSP_SOK;
22863         struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProc;
22864  
22865 -       DBC_Require(MEM_IsValidHandle(pProcObject, PROC_SIGNATURE));
22866         DBC_Require(IsValidProcEvent(uEvents));
22867         DBC_Require(cRefs > 0);
22868  
22869 +       if (!MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22870 +               status = DSP_EHANDLE;
22871 +               GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_NotifyAllClients: "
22872 +                        "InValid Processor Handle \n");
22873 +               goto func_end;
22874 +       }
22875 +
22876         DEV_NotifyClients(pProcObject->hDevObject, uEvents);
22877  
22878         GT_0trace(PROC_DebugMask, GT_1CLASS,
22879                  "PROC_NotifyAllClients :Signaled. \n");
22880 -
22881 +func_end:
22882         return status;
22883  }
22884  
22885 @@ -2057,7 +1826,7 @@ DSP_STATUS PROC_NotifyAllClients(DSP_HPR
22886   *  Purpose:
22887   *      Retrieves the processor ID.
22888   */
22889 -DSP_STATUS PROC_GetProcessorId(DSP_HPROCESSOR hProc, u32 *procID)
22890 +DSP_STATUS PROC_GetProcessorId(void *hProc, u32 *procID)
22891  {
22892         DSP_STATUS status = DSP_SOK;
22893         struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProc;
22894 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/pwr.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/pwr.c
22895 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/pwr.c      2011-04-17 17:32:26.000000000 +0100
22896 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/pwr.c   2011-05-02 22:36:50.000000000 +0100
22897 @@ -3,6 +3,8 @@
22898   *
22899   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
22900   *
22901 + * PWR API for controlling DSP power states.
22902 + *
22903   * Copyright (C) 2005-2006 Texas Instruments, Inc.
22904   *
22905   * This package is free software; you can redistribute it and/or modify
22906 @@ -14,23 +16,6 @@
22907   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22908   */
22909  
22910 -
22911 -/*
22912 - *  ======== PWR.c ========
22913 - *  PWR API for controlling DSP power states.
22914 - *
22915 - *  Public Functions:
22916 - *      PWR_SleepDSP
22917 - *      PWR_WakeDSP
22918 - *
22919 - *! Revision History
22920 - *! ================
22921 - *! 18-Feb-2003 vp  Code review updates.
22922 - *! 18-Oct-2002 vp  Ported to Linux platform.
22923 - *! 22-May-2002 sg  Do PWR-to-IOCTL code mapping in PWR_SleepDSP.
22924 - *! 29-Apr-2002 sg  Initial.
22925 - */
22926 -
22927  /*  ----------------------------------- Host OS */
22928  #include <dspbridge/host_os.h>
22929  
22930 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/rmm.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/rmm.c
22931 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/rmm.c      2011-04-17 17:32:26.000000000 +0100
22932 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/rmm.c   2011-05-02 22:36:50.000000000 +0100
22933 @@ -14,11 +14,7 @@
22934   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22935   */
22936  
22937 -
22938  /*
22939 - *  ======== rmm.c ========
22940 - *  Description:
22941 - *
22942   *  This memory manager provides general heap management and arbitrary
22943   *  alignment for any number of memory segments.
22944   *
22945 @@ -39,16 +35,6 @@
22946   *  it through RMM_free. The memory manager prevents DSP code/data that is
22947   *  overlayed from being overwritten as long as the memory it runs at has
22948   *  been allocated, and not yet freed.
22949 - *
22950 - *! Revision History
22951 - *! ================
22952 - *! 18-Feb-2003 vp  Code review updates.
22953 - *! 18-Oct-2002 vp  Ported to Linux Platform.
22954 - *! 24-Sep-2002 map Updated from Code Review
22955 - *! 25-Jun-2002 jeh     Free from segid passed to RMM_free().
22956 - *! 24-Apr-2002 jeh     Determine segid based on address in RMM_free(). (No way
22957 - *!                     to keep track of segid with dynamic loader library.)
22958 - *! 16-Oct-2001 jeh     Based on gen tree rm.c. Added support for overlays.
22959   */
22960  
22961  /*  ----------------------------------- DSP/BIOS Bridge */
22962 @@ -84,7 +70,7 @@ struct RMM_Header {
22963   *  Keeps track of memory occupied by overlay section.
22964   */
22965  struct RMM_OvlySect {
22966 -       struct LST_ELEM listElem;
22967 +       struct list_head listElem;
22968         u32 addr;               /* Start of memory section */
22969         u32 size;               /* Length (target MAUs) of section */
22970         s32 page;               /* Memory page */
22971 @@ -161,7 +147,7 @@ DSP_STATUS RMM_alloc(struct RMM_TargetOb
22972                 }
22973                 prevSect = sect;
22974                 sect = (struct RMM_OvlySect *)LST_Next(target->ovlyList,
22975 -                       (struct LST_ELEM *)sect);
22976 +                       (struct list_head *)sect);
22977         }
22978         if (DSP_SUCCEEDED(status)) {
22979                 /* No overlap - allocate list element for new section. */
22980 @@ -169,19 +155,19 @@ DSP_STATUS RMM_alloc(struct RMM_TargetOb
22981                 if (newSect == NULL) {
22982                         status = DSP_EMEMORY;
22983                 } else {
22984 -                       LST_InitElem((struct LST_ELEM *)newSect);
22985 +                       LST_InitElem((struct list_head *)newSect);
22986                         newSect->addr = addr;
22987                         newSect->size = size;
22988                         newSect->page = segid;
22989                         if (sect == NULL) {
22990                                 /* Put new section at the end of the list */
22991                                 LST_PutTail(target->ovlyList,
22992 -                                          (struct LST_ELEM *)newSect);
22993 +                                          (struct list_head *)newSect);
22994                         } else {
22995                                 /* Put new section just before sect */
22996                                 LST_InsertBefore(target->ovlyList,
22997 -                                               (struct LST_ELEM *)newSect,
22998 -                                               (struct LST_ELEM *)sect);
22999 +                                               (struct list_head *)newSect,
23000 +                                               (struct list_head *)sect);
23001                         }
23002                 }
23003         }
23004 @@ -268,11 +254,14 @@ DSP_STATUS RMM_create(struct RMM_TargetO
23005  func_cont:
23006         /* Initialize overlay memory list */
23007         if (DSP_SUCCEEDED(status)) {
23008 -               target->ovlyList = LST_Create();
23009 +               target->ovlyList = MEM_Calloc(sizeof(struct LST_LIST),
23010 +                       MEM_NONPAGED);
23011                 if (target->ovlyList == NULL) {
23012                         GT_0trace(RMM_debugMask, GT_6CLASS,
23013                                  "RMM_create: Memory allocation failed\n");
23014                         status = DSP_EMEMORY;
23015 +               } else {
23016 +                       INIT_LIST_HEAD(&target->ovlyList->head);
23017                 }
23018         }
23019  
23020 @@ -315,7 +304,7 @@ void RMM_delete(struct RMM_TargetObj *ta
23021                         MEM_Free(pSect);
23022                 }
23023                 DBC_Assert(LST_IsEmpty(target->ovlyList));
23024 -               LST_Delete(target->ovlyList);
23025 +               MEM_Free(target->ovlyList);
23026         }
23027  
23028         if (target->freeList != NULL) {
23029 @@ -346,9 +335,6 @@ void RMM_exit(void)
23030         GT_1trace(RMM_debugMask, GT_5CLASS, "RMM_exit() ref count: 0x%x\n",
23031                  cRefs);
23032  
23033 -       if (cRefs == 0)
23034 -               MEM_Exit();
23035 -
23036         DBC_Ensure(cRefs >= 0);
23037  }
23038  
23039 @@ -388,12 +374,12 @@ bool RMM_free(struct RMM_TargetObj *targ
23040                                 DBC_Assert(size == sect->size);
23041                                 /* Remove from list */
23042                                 LST_RemoveElem(target->ovlyList,
23043 -                                             (struct LST_ELEM *)sect);
23044 +                                             (struct list_head *)sect);
23045                                 MEM_Free(sect);
23046                                 break;
23047                         }
23048                         sect = (struct RMM_OvlySect *)LST_Next(target->ovlyList,
23049 -                              (struct LST_ELEM *)sect);
23050 +                              (struct list_head *)sect);
23051                 }
23052                 if (sect == NULL)
23053                         retVal = false;
23054 @@ -407,31 +393,21 @@ bool RMM_free(struct RMM_TargetObj *targ
23055   */
23056  bool RMM_init(void)
23057  {
23058 -       bool retVal = true;
23059 -
23060         DBC_Require(cRefs >= 0);
23061  
23062         if (cRefs == 0) {
23063                 DBC_Assert(!RMM_debugMask.flags);
23064                 GT_create(&RMM_debugMask, "RM");        /* "RM" for RMm */
23065  
23066 -               retVal = MEM_Init();
23067 -
23068 -               if (!retVal)
23069 -                       MEM_Exit();
23070 -
23071         }
23072  
23073 -       if (retVal)
23074 -               cRefs++;
23075 +       cRefs++;
23076  
23077         GT_1trace(RMM_debugMask, GT_5CLASS,
23078                  "RMM_init(), ref count:  0x%x\n",
23079                  cRefs);
23080  
23081 -       DBC_Ensure((retVal && (cRefs > 0)) || (!retVal && (cRefs >= 0)));
23082 -
23083 -       return retVal;
23084 +       return true;
23085  }
23086  
23087  /*
23088 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/strm.c kernel-power-2.6.28/drivers/dsp/bridge/rmgr/strm.c
23089 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/rmgr/strm.c     2011-04-17 17:32:26.000000000 +0100
23090 +++ kernel-power-2.6.28/drivers/dsp/bridge/rmgr/strm.c  2011-05-02 22:36:50.000000000 +0100
23091 @@ -3,6 +3,8 @@
23092   *
23093   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
23094   *
23095 + * DSP/BIOS Bridge Stream Manager.
23096 + *
23097   * Copyright (C) 2005-2006 Texas Instruments, Inc.
23098   *
23099   * This package is free software; you can redistribute it and/or modify
23100 @@ -14,53 +16,6 @@
23101   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23102   */
23103  
23104 -
23105 -/*
23106 - *  ======== strm.c ========
23107 - *  Description:
23108 - *      DSP/BIOS Bridge Stream Manager.
23109 - *
23110 - *  Public Functions:
23111 - *      STRM_AllocateBuffer
23112 - *      STRM_Close
23113 - *      STRM_Create
23114 - *      STRM_Delete
23115 - *      STRM_Exit
23116 - *      STRM_FreeBuffer
23117 - *      STRM_GetEventHandle
23118 - *      STRM_GetInfo
23119 - *      STRM_Idle
23120 - *      STRM_Init
23121 - *      STRM_Issue
23122 - *      STRM_Open
23123 - *      STRM_PrepareBuffer
23124 - *      STRM_Reclaim
23125 - *      STRM_RegisterNotify
23126 - *      STRM_Select
23127 - *      STRM_UnprepareBuffer
23128 - *
23129 - *  Notes:
23130 - *
23131 - *! Revision History:
23132 - *! =================
23133 - *! 18-Feb-2003 vp  Code review updates.
23134 - *! 18-Oct-2002 vp  Ported to Linux platform.
23135 - *! 13-Mar-2002 map    pStrm init'd to NULL in STRM_Open to prevent error
23136 - *! 12-Mar-2002 map Changed return var to WSX "wStatus" instead of "status"
23137 - *!                in DEV and CMM function calls to avoid confusion.
23138 - *!                Return DSP_SOK instead of S_OK from API fxns.
23139 - *! 12-Mar-2002 map    Changed FAILED(..) to DSP_FAILED(..)
23140 - *! 25-Jan-2002 ag  Allow neg seg ids(e.g. DSP_SHMSEG0) to denote SM.
23141 - *! 15-Nov-2001 ag  Added STRMMODE & SM for DMA/ZCopy streaming.
23142 - *!             Changed DSP_STREAMINFO to STRM_INFO in STRM_GetInfo().
23143 - *!             Use strm timeout value for dma flush timeout.
23144 - *! 09-May-2001 jeh Code review cleanup.
23145 - *! 06-Feb-2001 kc  Updated DBC_Ensure in STRM_Select to check timeout.
23146 - *! 23-Oct-2000 jeh Allow NULL STRM_ATTRS passed to STRM_Open() for DLL
23147 - *!             tests to pass.
23148 - *! 25-Sep-2000 jeh Created.
23149 - */
23150 -
23151  /*  ----------------------------------- Host OS */
23152  #include <dspbridge/host_os.h>
23153  
23154 @@ -89,11 +44,8 @@
23155  /*  ----------------------------------- This */
23156  #include <dspbridge/strm.h>
23157  
23158 -#ifndef RES_CLEANUP_DISABLE
23159  #include <dspbridge/cfg.h>
23160 -#include <dspbridge/dbreg.h>
23161  #include <dspbridge/resourcecleanup.h>
23162 -#endif
23163  
23164  /*  ----------------------------------- Defines, Data Structures, Typedefs */
23165  #define STRM_SIGNATURE      0x4d525453 /* "MRTS" */
23166 @@ -160,27 +112,24 @@ DSP_STATUS STRM_AllocateBuffer(struct ST
23167         DSP_STATUS status = DSP_SOK;
23168         u32 uAllocated = 0;
23169         u32 i;
23170 -#ifndef RES_CLEANUP_DISABLE
23171 +
23172         HANDLE hSTRMRes;
23173 -#endif
23174 +
23175         DBC_Require(cRefs > 0);
23176         DBC_Require(apBuffer != NULL);
23177  
23178         GT_4trace(STRM_debugMask, GT_ENTER, "STRM_AllocateBuffer: hStrm: 0x%x\t"
23179                  "uSize: 0x%x\tapBuffer: 0x%x\tuNumBufs: 0x%x\n",
23180                  hStrm, uSize, apBuffer, uNumBufs);
23181 -       if (MEM_IsValidHandle(hStrm, STRM_SIGNATURE)) {
23182 -               /*
23183 -                * Allocate from segment specified at time of stream open.
23184 -                */
23185 -               if (uSize == 0)
23186 -                       status = DSP_ESIZE;
23187 +       /*
23188 +        * Allocate from segment specified at time of stream open.
23189 +        */
23190 +       if (uSize == 0)
23191 +               status = DSP_ESIZE;
23192  
23193 -       }
23194 -       if (DSP_FAILED(status)) {
23195 -               status = DSP_EHANDLE;
23196 +       if (DSP_FAILED(status))
23197                 goto func_end;
23198 -       }
23199 +
23200         for (i = 0; i < uNumBufs; i++) {
23201                 DBC_Assert(hStrm->hXlator != NULL);
23202                 (void)CMM_XlatorAllocBuf(hStrm->hXlator, &apBuffer[i], uSize);
23203 @@ -196,15 +145,13 @@ DSP_STATUS STRM_AllocateBuffer(struct ST
23204         if (DSP_FAILED(status))
23205                 STRM_FreeBuffer(hStrm, apBuffer, uAllocated, pr_ctxt);
23206  
23207 -#ifndef RES_CLEANUP_DISABLE
23208         if (DSP_FAILED(status))
23209                 goto func_end;
23210  
23211         if (DRV_GetSTRMResElement(hStrm, &hSTRMRes, pr_ctxt) !=
23212 -                       DSP_ENOTFOUND) {
23213 -               DRV_ProcUpdateSTRMRes(uNumBufs, hSTRMRes, pr_ctxt);
23214 -       }
23215 -#endif
23216 +                       DSP_ENOTFOUND)
23217 +               DRV_ProcUpdateSTRMRes(uNumBufs, hSTRMRes);
23218 +
23219  func_end:
23220         return status;
23221  }
23222 @@ -221,48 +168,31 @@ DSP_STATUS STRM_Close(struct STRM_OBJECT
23223         struct CHNL_INFO chnlInfo;
23224         DSP_STATUS status = DSP_SOK;
23225  
23226 -#ifndef RES_CLEANUP_DISABLE
23227 -    HANDLE           hSTRMRes;
23228 -#endif
23229 +       HANDLE        hSTRMRes;
23230  
23231         DBC_Require(cRefs > 0);
23232  
23233         GT_1trace(STRM_debugMask, GT_ENTER, "STRM_Close: hStrm: 0x%x\n", hStrm);
23234  
23235 -       if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE)) {
23236 -               status = DSP_EHANDLE;
23237 -       } else {
23238 -               /* Have all buffers been reclaimed? If not, return
23239 -                * DSP_EPENDING */
23240 -               pIntfFxns = hStrm->hStrmMgr->pIntfFxns;
23241 -               status = (*pIntfFxns->pfnChnlGetInfo) (hStrm->hChnl, &chnlInfo);
23242 -               DBC_Assert(DSP_SUCCEEDED(status));
23243 -
23244 -               if (chnlInfo.cIOCs > 0 || chnlInfo.cIOReqs > 0) {
23245 -                       status = DSP_EPENDING;
23246 -               } else {
23247  
23248 -                       status = DeleteStrm(hStrm);
23249 +       /* Have all buffers been reclaimed? If not, return
23250 +        * DSP_EPENDING */
23251 +       pIntfFxns = hStrm->hStrmMgr->pIntfFxns;
23252 +       status = (*pIntfFxns->pfnChnlGetInfo) (hStrm->hChnl, &chnlInfo);
23253 +       DBC_Assert(DSP_SUCCEEDED(status));
23254  
23255 -                       if (DSP_FAILED(status)) {
23256 -                               /* we already validated the handle. */
23257 -                               DBC_Assert(status != DSP_EHANDLE);
23258 +       if (chnlInfo.cIOCs > 0 || chnlInfo.cIOReqs > 0)
23259 +               status = DSP_EPENDING;
23260 +       else
23261 +               status = DeleteStrm(hStrm);
23262  
23263 -                               /* make sure we return a documented result */
23264 -                               status = DSP_EFAIL;
23265 -                       }
23266 -               }
23267 -       }
23268 -#ifndef RES_CLEANUP_DISABLE
23269         if (DSP_FAILED(status))
23270                 goto func_end;
23271  
23272         if (DRV_GetSTRMResElement(hStrm, &hSTRMRes, pr_ctxt) !=
23273 -                       DSP_ENOTFOUND) {
23274 +                       DSP_ENOTFOUND)
23275                 DRV_ProcRemoveSTRMResElement(hSTRMRes, pr_ctxt);
23276 -       }
23277  func_end:
23278 -#endif
23279         DBC_Ensure(status == DSP_SOK || status == DSP_EHANDLE ||
23280                   status == DSP_EPENDING || status == DSP_EFAIL);
23281  
23282 @@ -368,37 +298,31 @@ DSP_STATUS STRM_FreeBuffer(struct STRM_O
23283         DSP_STATUS status = DSP_SOK;
23284         u32 i = 0;
23285  
23286 -#ifndef RES_CLEANUP_DISABLE
23287         HANDLE hSTRMRes = NULL;
23288 -#endif
23289 +
23290         DBC_Require(cRefs > 0);
23291         DBC_Require(apBuffer != NULL);
23292  
23293         GT_3trace(STRM_debugMask, GT_ENTER, "STRM_FreeBuffer: hStrm: 0x%x\t"
23294                  "apBuffer: 0x%x\tuNumBufs: 0x%x\n", hStrm, apBuffer, uNumBufs);
23295  
23296 -       if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE))
23297 -               status = DSP_EHANDLE;
23298 -
23299 -       if (DSP_SUCCEEDED(status)) {
23300 -               for (i = 0; i < uNumBufs; i++) {
23301 -                       DBC_Assert(hStrm->hXlator != NULL);
23302 -                       status = CMM_XlatorFreeBuf(hStrm->hXlator, apBuffer[i]);
23303 -                       if (DSP_FAILED(status)) {
23304 -                               GT_0trace(STRM_debugMask, GT_7CLASS,
23305 -                                        "STRM_FreeBuffer: DSP_FAILED"
23306 -                                        " to free shared memory.\n");
23307 -                               break;
23308 -                       }
23309 -                       apBuffer[i] = NULL;
23310 +       for (i = 0; i < uNumBufs; i++) {
23311 +               DBC_Assert(hStrm->hXlator != NULL);
23312 +               status = CMM_XlatorFreeBuf(hStrm->hXlator, apBuffer[i]);
23313 +               if (DSP_FAILED(status)) {
23314 +                       GT_0trace(STRM_debugMask, GT_7CLASS,
23315 +                                "STRM_FreeBuffer: DSP_FAILED"
23316 +                                " to free shared memory.\n");
23317 +                       break;
23318                 }
23319 +               apBuffer[i] = NULL;
23320         }
23321 -#ifndef RES_CLEANUP_DISABLE
23322 -       if (DRV_GetSTRMResElement(hStrm, hSTRMRes, pr_ctxt) !=
23323 -                       DSP_ENOTFOUND) {
23324 -               DRV_ProcUpdateSTRMRes(uNumBufs-i, hSTRMRes, pr_ctxt);
23325 +
23326 +       if (DSP_SUCCEEDED(status)) {
23327 +               if (DRV_GetSTRMResElement(hStrm, hSTRMRes, pr_ctxt) !=
23328 +                               DSP_ENOTFOUND)
23329 +                       DRV_ProcUpdateSTRMRes(uNumBufs-i, hSTRMRes);
23330         }
23331 -#endif
23332         return status;
23333  }
23334  
23335 @@ -423,14 +347,12 @@ DSP_STATUS STRM_GetInfo(struct STRM_OBJE
23336         GT_3trace(STRM_debugMask, GT_ENTER, "STRM_GetInfo: hStrm: 0x%x\t"
23337                  "pStreamInfo: 0x%x\tuStreamInfoSize: 0x%x\n", hStrm,
23338                  pStreamInfo, uStreamInfoSize);
23339 -       if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE)) {
23340 -               status = DSP_EHANDLE;
23341 -       } else {
23342 -               if (uStreamInfoSize < sizeof(struct STRM_INFO)) {
23343 -                       /* size of users info */
23344 -                       status = DSP_ESIZE;
23345 -               }
23346 +
23347 +       if (uStreamInfoSize < sizeof(struct STRM_INFO)) {
23348 +               /* size of users info */
23349 +               status = DSP_ESIZE;
23350         }
23351 +
23352         if (DSP_FAILED(status))
23353                 goto func_end;
23354  
23355 @@ -485,14 +407,11 @@ DSP_STATUS STRM_Idle(struct STRM_OBJECT 
23356         GT_2trace(STRM_debugMask, GT_ENTER, "STRM_Idle: hStrm: 0x%x\t"
23357                  "fFlush: 0x%x\n", hStrm, fFlush);
23358  
23359 -       if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE)) {
23360 -               status = DSP_EHANDLE;
23361 -       } else {
23362 -               pIntfFxns = hStrm->hStrmMgr->pIntfFxns;
23363 +       pIntfFxns = hStrm->hStrmMgr->pIntfFxns;
23364 +
23365 +       status = (*pIntfFxns->pfnChnlIdle) (hStrm->hChnl,
23366 +                hStrm->uTimeout, fFlush);
23367  
23368 -               status = (*pIntfFxns->pfnChnlIdle) (hStrm->hChnl,
23369 -                        hStrm->uTimeout, fFlush);
23370 -       }
23371         return status;
23372  }
23373  
23374 @@ -543,31 +462,24 @@ DSP_STATUS STRM_Issue(struct STRM_OBJECT
23375         GT_4trace(STRM_debugMask, GT_ENTER, "STRM_Issue: hStrm: 0x%x\tpBuf: "
23376                  "0x%x\tulBytes: 0x%x\tdwArg: 0x%x\n", hStrm, pBuf, ulBytes,
23377                  dwArg);
23378 -       if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE)) {
23379 -               status = DSP_EHANDLE;
23380 -       } else {
23381 -               pIntfFxns = hStrm->hStrmMgr->pIntfFxns;
23382  
23383 -               if (hStrm->uSegment != 0) {
23384 -                       pTmpBuf = CMM_XlatorTranslate(hStrm->hXlator,
23385 -                                       (void *)pBuf, CMM_VA2DSPPA);
23386 -                       if (pTmpBuf == NULL)
23387 -                               status = DSP_ETRANSLATE;
23388 +       pIntfFxns = hStrm->hStrmMgr->pIntfFxns;
23389  
23390 -               }
23391 -               if (DSP_SUCCEEDED(status)) {
23392 -                       status = (*pIntfFxns->pfnChnlAddIOReq)
23393 -                                (hStrm->hChnl, pBuf, ulBytes, ulBufSize,
23394 -                                (u32) pTmpBuf, dwArg);
23395 -               }
23396 -               if (DSP_FAILED(status)) {
23397 -                       if (status == CHNL_E_NOIORPS)
23398 -                               status = DSP_ESTREAMFULL;
23399 -                       else
23400 -                               status = DSP_EFAIL;
23401 +       if (hStrm->uSegment != 0) {
23402 +               pTmpBuf = CMM_XlatorTranslate(hStrm->hXlator,
23403 +                               (void *)pBuf, CMM_VA2DSPPA);
23404 +               if (pTmpBuf == NULL)
23405 +                       status = DSP_ETRANSLATE;
23406  
23407 -               }
23408         }
23409 +       if (DSP_SUCCEEDED(status)) {
23410 +               status = (*pIntfFxns->pfnChnlAddIOReq)
23411 +                        (hStrm->hChnl, pBuf, ulBytes, ulBufSize,
23412 +                        (u32) pTmpBuf, dwArg);
23413 +       }
23414 +       if (status == CHNL_E_NOIORPS)
23415 +               status = DSP_ESTREAMFULL;
23416 +
23417         return status;
23418  }
23419  
23420 @@ -578,22 +490,20 @@ DSP_STATUS STRM_Issue(struct STRM_OBJECT
23421   *      XDAIS socket node on the DSP.
23422   */
23423  DSP_STATUS STRM_Open(struct NODE_OBJECT *hNode, u32 uDir, u32 uIndex,
23424 -                   IN struct STRM_ATTR *pAttr,
23425 -                   OUT struct STRM_OBJECT **phStrm,
23426 -                   struct PROCESS_CONTEXT *pr_ctxt)
23427 +               IN struct STRM_ATTR *pAttr,
23428 +               OUT struct STRM_OBJECT **phStrm,
23429 +               struct PROCESS_CONTEXT *pr_ctxt)
23430  {
23431         struct STRM_MGR *hStrmMgr;
23432         struct WMD_DRV_INTERFACE *pIntfFxns;
23433         u32 ulChnlId;
23434         struct STRM_OBJECT *pStrm = NULL;
23435 -       CHNL_MODE uMode;
23436 +       short int uMode;
23437         struct CHNL_ATTRS chnlAttrs;
23438         DSP_STATUS status = DSP_SOK;
23439         struct CMM_OBJECT *hCmmMgr = NULL;      /* Shared memory manager hndl */
23440  
23441 -#ifndef RES_CLEANUP_DISABLE
23442 -       HANDLE              hSTRMRes;
23443 -#endif
23444 +       HANDLE hSTRMRes;
23445  
23446         DBC_Require(cRefs > 0);
23447         DBC_Require(phStrm != NULL);
23448 @@ -724,14 +634,12 @@ func_cont:
23449                                   status);
23450                 }
23451         }
23452 -       if (DSP_SUCCEEDED(status))
23453 +       if (DSP_SUCCEEDED(status)) {
23454                 *phStrm = pStrm;
23455 -       else
23456 +               DRV_ProcInsertSTRMResElement(*phStrm, &hSTRMRes, pr_ctxt);
23457 +       } else {
23458                 (void)DeleteStrm(pStrm);
23459 -
23460 -#ifndef RES_CLEANUP_DISABLE
23461 -       DRV_ProcInsertSTRMResElement(*phStrm, &hSTRMRes, pr_ctxt);
23462 -#endif
23463 +       }
23464  
23465          /* ensure we return a documented error code */
23466         DBC_Ensure((DSP_SUCCEEDED(status) &&
23467 @@ -765,10 +673,6 @@ DSP_STATUS STRM_Reclaim(struct STRM_OBJE
23468                  "\tpulBytes: 0x%x\tpdwArg: 0x%x\n", hStrm, pBufPtr, pulBytes,
23469                  pdwArg);
23470  
23471 -       if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE)) {
23472 -               status = DSP_EHANDLE;
23473 -               goto func_end;
23474 -       }
23475         pIntfFxns = hStrm->hStrmMgr->pIntfFxns;
23476  
23477         status = (*pIntfFxns->pfnChnlGetIOC)(hStrm->hChnl, hStrm->uTimeout,
23478 @@ -820,7 +724,6 @@ DSP_STATUS STRM_Reclaim(struct STRM_OBJE
23479                 }
23480                 *pBufPtr = chnlIOC.pBuf;
23481         }
23482 -func_end:
23483         /* ensure we return a documented return code */
23484         DBC_Ensure(DSP_SUCCEEDED(status) || status == DSP_EHANDLE ||
23485                   status == DSP_ETIMEOUT || status == DSP_ETRANSLATE ||
23486 @@ -847,9 +750,8 @@ DSP_STATUS STRM_RegisterNotify(struct ST
23487                  "STRM_RegisterNotify: hStrm: 0x%x\t"
23488                  "uEventMask: 0x%x\tuNotifyType: 0x%x\thNotification: 0x%x\n",
23489                  hStrm, uEventMask, uNotifyType, hNotification);
23490 -       if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE)) {
23491 -               status = DSP_EHANDLE;
23492 -       } else if ((uEventMask & ~((DSP_STREAMIOCOMPLETION) |
23493 +
23494 +       if ((uEventMask & ~((DSP_STREAMIOCOMPLETION) |
23495                  DSP_STREAMDONE)) != 0) {
23496                 status = DSP_EVALUE;
23497         } else {
23498 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/cfg.c kernel-power-2.6.28/drivers/dsp/bridge/services/cfg.c
23499 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/cfg.c  2011-04-17 17:32:26.000000000 +0100
23500 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/cfg.c       2011-05-02 22:36:50.000000000 +0100
23501 @@ -3,6 +3,8 @@
23502   *
23503   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
23504   *
23505 + * Implementation of platform specific config services.
23506 + *
23507   * Copyright (C) 2005-2006 Texas Instruments, Inc.
23508   *
23509   * This package is free software; you can redistribute it and/or modify
23510 @@ -14,64 +16,6 @@
23511   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23512   */
23513  
23514 -
23515 -/*
23516 - *  ======== cfgce.c ========
23517 - *  Purpose:
23518 - *      Implementation of platform specific config services.
23519 - *
23520 - *  Private Functions:
23521 - *      CFG_Exit
23522 - *      CFG_GetAutoStart
23523 - *      CFG_GetDevObject
23524 - *      CFG_GetDSPResources
23525 - *      CFG_GetExecFile
23526 - *      CFG_GetHostResources
23527 - *      CFG_GetObject
23528 - *      CFG_Init
23529 - *      CFG_SetDevObject
23530 - *      CFG_SetObject
23531 - *
23532 - *
23533 - *! Revision History:
23534 - *! ================
23535 - *! 26-Arp-2004 hp  Support for handling more than one Device.
23536 - *! 26-Feb-2003 kc  Removed unused CFG fxns.
23537 - *! 10-Nov-2000 rr: CFG_GetBoardName local var initialized.
23538 - *! 30-Oct-2000 kc: Changed local var. names to use Hungarian notation.
23539 - *! 10-Aug-2000 rr: Cosmetic changes.
23540 - *! 26-Jul-2000 rr: Added CFG_GetDCDName. CFG_Get/SetObject(based on a flag)
23541 - *!                  replaces CFG_GetMgrObject & CFG_SetMgrObject.
23542 - *! 17-Jul-2000 rr: Added CFG_GetMgrObject & CFG_SetMgrObject.
23543 - *! 03-Feb-2000 rr: Module init/exit is handled by SERVICES Init/Exit.
23544 - *!                GT Changes.
23545 - *! 31-Jan-2000 rr: Comments and bugfixes:  modified after code review
23546 - *! 07-Jan-2000 rr: CFG_GetBoardName Ensure class checks strlen of the
23547 - *!                 read value from the registry against the passed in BufSize;
23548 - *!                 CFG_GetZLFile,CFG_GetWMDFileName and
23549 - *!                 CFG_GetExecFile also modified same way.
23550 - *! 06-Jan-2000 rr: CFG_GetSearchPath & CFG_GetWinBRIDGEDir removed.
23551 - *! 09-Dec-1999 rr: CFG_SetDevObject stores the DevNodeString pointer.
23552 - *! 03-Dec-1999 rr: CFG_GetDevObject reads stored DevObject from Registry.
23553 - *!                 CFG_GetDevNode reads the Devnodestring from the registry.
23554 - *!                 CFG_SetDevObject stores the registry path as
23555 - *!                 DevNodestring in the registry.
23556 - *! 02-Dec-1999 rr: CFG_debugMask is declared static now. stdwin.h included
23557 - *! 22-Nov-1999 kc: Added windows.h to remove warnings.
23558 - *! 25-Oct-1999 rr: CFG_GetHostResources reads the HostResource structure
23559 - *!                 from the registry which was set by the DRV Request
23560 - *!                 Resources.
23561 - *! 15-Oct-1999 rr: Changes in CFG_SetPrivateDword & HostResources reflecting
23562 - *!                 changes for  drv.h resource structure and wsxreg.h new
23563 - *!                 entry(DevObject) Hard coded entries removed for those items
23564 - *! 08-Oct-1999 rr: CFG_SetPrivateDword modified. it sets devobject into the
23565 - *!                 registry. CFG_Get HostResources modified for opening up
23566 - *!                 two mem winodws.
23567 - *! 24-Sep-1999 rr: CFG_GetHostResources uses hardcoded Registry calls,uses NT
23568 - *!                 type of Resource Structure.
23569 - *! 19-Jul-1999 a0216266: Stubbed from cfgnt.c.
23570 - */
23571 -
23572  /*  ----------------------------------- DSP/BIOS Bridge */
23573  #include <dspbridge/std.h>
23574  #include <dspbridge/dbdefs.h>
23575 @@ -82,18 +26,13 @@
23576  #include <dspbridge/gt.h>
23577  
23578  /*  ----------------------------------- OS Adaptation Layer */
23579 -#include <dspbridge/csl.h>
23580  #include <dspbridge/reg.h>
23581  
23582 -/*  ----------------------------------- Others */
23583 -#include <dspbridge/dbreg.h>
23584 -
23585  /*  ----------------------------------- This */
23586  #include <dspbridge/cfg.h>
23587 -#include <dspbridge/list.h>
23588  
23589  struct DRV_EXT {
23590 -       struct LST_ELEM link;
23591 +       struct list_head link;
23592         char szString[MAXREGPATHLENGTH];
23593  };
23594  
23595 @@ -131,12 +70,12 @@ DSP_STATUS CFG_GetAutoStart(struct CFG_D
23596         if (!pdwAutoStart)
23597                 status = CFG_E_INVALIDPOINTER;
23598         if (DSP_SUCCEEDED(status)) {
23599 -               status = REG_GetValue(NULL, (char *)hDevNode, AUTOSTART,
23600 -                                    (u8 *)pdwAutoStart, &dwBufSize);
23601 +               status = REG_GetValue(AUTOSTART, (u8 *)pdwAutoStart,
23602 +                                     &dwBufSize);
23603                 if (DSP_FAILED(status))
23604                         status = CFG_E_RESOURCENOTAVAIL;
23605         }
23606 -#ifdef DEBUG
23607 +#ifdef CONFIG_BRIDGE_DEBUG
23608         if (DSP_SUCCEEDED(status)) {
23609                 GT_0trace(CFG_debugMask, GT_1CLASS,
23610                          "CFG_GetAutoStart SUCCESS \n");
23611 @@ -173,20 +112,19 @@ DSP_STATUS CFG_GetDevObject(struct CFG_D
23612         if (DSP_SUCCEEDED(status)) {
23613  
23614                 /* check the device string and then call the REG_SetValue*/
23615 -               if (!(strcmp((char *)((struct DRV_EXT *)hDevNode)->szString,
23616 +               if (!(strcmp((char *)((struct DRV_EXT *)hDevNode)->szString,
23617                                                         "TIOMAP1510"))) {
23618                         GT_0trace(CFG_debugMask, GT_1CLASS,
23619                                   "Fetching DSP Device from "
23620                                   "Registry \n");
23621 -                       status = REG_GetValue(NULL, (char *)hDevNode,
23622 -                                             "DEVICE_DSP",
23623 -                                             (u8 *)pdwValue, &dwBufSize);
23624 +                       status = REG_GetValue("DEVICE_DSP", (u8 *)pdwValue,
23625 +                                             &dwBufSize);
23626                 } else {
23627                         GT_0trace(CFG_debugMask, GT_6CLASS,
23628                                   "Failed to Identify the Device to Fetch \n");
23629                 }
23630         }
23631 -#ifdef DEBUG
23632 +#ifdef CONFIG_BRIDGE_DEBUG
23633         if (DSP_SUCCEEDED(status)) {
23634                 GT_1trace(CFG_debugMask, GT_1CLASS,
23635                           "CFG_GetDevObject SUCCESS DevObject"
23636 @@ -213,15 +151,13 @@ DSP_STATUS CFG_GetDSPResources(struct CF
23637                   "Entered CFG_GetDSPResources, args: "
23638                   "\n\thDevNode:  0x%x\n\tpDSPResTable:  0x%x\n",
23639                   hDevNode, pDSPResTable);
23640 -       if (!hDevNode) {
23641 +       if (!hDevNode)
23642                 status = CFG_E_INVALIDHDEVNODE;
23643 -       } else if (!pDSPResTable) {
23644 +       else if (!pDSPResTable)
23645                 status = CFG_E_INVALIDPOINTER;
23646 -       } else {
23647 -               status = REG_GetValue(NULL, CONFIG, DSPRESOURCES,
23648 -                                    (u8 *)pDSPResTable,
23649 -                                    &dwResSize);
23650 -       }
23651 +       else
23652 +               status = REG_GetValue(DSPRESOURCES, (u8 *)pDSPResTable,
23653 +                                       &dwResSize);
23654         if (DSP_SUCCEEDED(status)) {
23655                 GT_0trace(CFG_debugMask, GT_1CLASS,
23656                           "CFG_GetDSPResources SUCCESS\n");
23657 @@ -230,7 +166,7 @@ DSP_STATUS CFG_GetDSPResources(struct CF
23658                 GT_0trace(CFG_debugMask, GT_6CLASS,
23659                           "CFG_GetDSPResources Failed \n");
23660         }
23661 -#ifdef DEBUG
23662 +#ifdef CONFIG_BRIDGE_DEBUG
23663         /* assert that resource values are reasonable */
23664         DBC_Assert(pDSPResTable->uChipType < 256);
23665         DBC_Assert(pDSPResTable->uWordSize > 0);
23666 @@ -257,20 +193,18 @@ DSP_STATUS CFG_GetExecFile(struct CFG_DE
23667                   ulBufSize, pstrExecFile);
23668         if (!hDevNode)
23669                 status = CFG_E_INVALIDHDEVNODE;
23670 -
23671 -       if (!pstrExecFile)
23672 +       else if (!pstrExecFile)
23673                 status = CFG_E_INVALIDPOINTER;
23674  
23675         if (DSP_SUCCEEDED(status)) {
23676 -               status = REG_GetValue(NULL, (char *)hDevNode, DEFEXEC,
23677 -                                    (u8 *)pstrExecFile, &cExecSize);
23678 +               status = REG_GetValue(DEFEXEC, (u8 *)pstrExecFile, &cExecSize);
23679                 if (DSP_FAILED(status))
23680                         status = CFG_E_RESOURCENOTAVAIL;
23681                 else if (cExecSize > ulBufSize)
23682                         status = DSP_ESIZE;
23683  
23684         }
23685 -#ifdef DEBUG
23686 +#ifdef CONFIG_BRIDGE_DEBUG
23687         if (DSP_SUCCEEDED(status)) {
23688                 GT_1trace(CFG_debugMask, GT_1CLASS,
23689                           "CFG_GetExecFile SUCCESS Exec File"
23690 @@ -281,7 +215,7 @@ DSP_STATUS CFG_GetExecFile(struct CFG_DE
23691         }
23692  #endif
23693         DBC_Ensure(((status == DSP_SOK) &&
23694 -                 (strlen(pstrExecFile) <= ulBufSize)) || (status != DSP_SOK));
23695 +               (strlen(pstrExecFile) <= ulBufSize)) || (status != DSP_SOK));
23696         return status;
23697  }
23698  
23699 @@ -307,13 +241,12 @@ DSP_STATUS CFG_GetHostResources(struct C
23700  
23701         if (DSP_SUCCEEDED(status)) {
23702                 dwBufSize = sizeof(struct CFG_HOSTRES);
23703 -               if (DSP_FAILED(REG_GetValue(NULL, (char *)hDevNode,
23704 -                              CURRENTCONFIG,
23705 -                             (u8 *)pHostResTable, &dwBufSize))) {
23706 +               if (DSP_FAILED(REG_GetValue(CURRENTCONFIG, (u8 *)pHostResTable,
23707 +                                           &dwBufSize))) {
23708                         status = CFG_E_RESOURCENOTAVAIL;
23709                 }
23710         }
23711 -#ifdef DEBUG
23712 +#ifdef CONFIG_BRIDGE_DEBUG
23713         if (DSP_SUCCEEDED(status)) {
23714                 GT_0trace(CFG_debugMask, GT_1CLASS,
23715                           "CFG_GetHostResources SUCCESS \n");
23716 @@ -341,14 +274,14 @@ DSP_STATUS CFG_GetObject(OUT u32 *pdwVal
23717         dwBufSize = sizeof(pdwValue);
23718         switch (dwType) {
23719         case (REG_DRV_OBJECT):
23720 -               status = REG_GetValue(NULL, CONFIG, DRVOBJECT,
23721 -                                    (u8 *)pdwValue,
23722 -                                    &dwBufSize);
23723 +               status = REG_GetValue(DRVOBJECT, (u8 *)pdwValue, &dwBufSize);
23724 +               if (DSP_FAILED(status))
23725 +                       status = CFG_E_RESOURCENOTAVAIL;
23726                 break;
23727         case (REG_MGR_OBJECT):
23728 -               status = REG_GetValue(NULL, CONFIG, MGROBJECT,
23729 -                                    (u8 *)pdwValue,
23730 -                                    &dwBufSize);
23731 +               status = REG_GetValue(MGROBJECT, (u8 *)pdwValue, &dwBufSize);
23732 +               if (DSP_FAILED(status))
23733 +                       status = CFG_E_RESOURCENOTAVAIL;
23734                 break;
23735         default:
23736                 break;
23737 @@ -358,7 +291,6 @@ DSP_STATUS CFG_GetObject(OUT u32 *pdwVal
23738                           "CFG_GetObject SUCCESS DrvObject: "
23739                           "0x%x\n ", *pdwValue);
23740         } else {
23741 -               status = CFG_E_RESOURCENOTAVAIL;
23742                 *pdwValue = 0;
23743                 GT_0trace(CFG_debugMask, GT_6CLASS, "CFG_GetObject Failed \n");
23744         }
23745 @@ -386,8 +318,8 @@ bool CFG_Init(void)
23746         dspResources.aMemDesc[0].uMemType = 0;
23747         dspResources.aMemDesc[0].ulMin = 0;
23748         dspResources.aMemDesc[0].ulMax = 0;
23749 -       if (DSP_SUCCEEDED(REG_SetValue(NULL, CONFIG, DSPRESOURCES, REG_BINARY,
23750 -                        (u8 *)&dspResources, sizeof(struct CFG_DSPRES)))) {
23751 +       if (DSP_SUCCEEDED(REG_SetValue(DSPRESOURCES, (u8 *)&dspResources,
23752 +                                      sizeof(struct CFG_DSPRES)))) {
23753                 GT_0trace(CFG_debugMask, GT_5CLASS,
23754                           "Initialized DSP resources in "
23755                           "Registry \n");
23756 @@ -417,25 +349,17 @@ DSP_STATUS CFG_SetDevObject(struct CFG_D
23757         if (DSP_SUCCEEDED(status)) {
23758                 /* Store the WCD device object in the Registry */
23759  
23760 -               if (!(strcmp((char *)hDevNode, "TIOMAP1510"))) {
23761 +               if (!(strcmp((char *)hDevNode, "TIOMAP1510"))) {
23762                         GT_0trace(CFG_debugMask, GT_1CLASS,
23763                                   "Registering the DSP Device \n");
23764 -                       status = REG_SetValue(NULL, (char *)hDevNode,
23765 -                                 "DEVICE_DSP", REG_DWORD,\
23766 -                                 (u8 *)&dwValue, dwBuffSize);
23767 -                       if (DSP_SUCCEEDED(status)) {
23768 -                               dwBuffSize = sizeof(hDevNode);
23769 -                               status = REG_SetValue(NULL,
23770 -                                         (char *)hDevNode, "DEVNODESTRING_DSP",
23771 -                                         REG_DWORD, (u8 *)&hDevNode,
23772 -                                         dwBuffSize);
23773 -                       }
23774 +                       status = REG_SetValue("DEVICE_DSP", (u8 *)&dwValue,
23775 +                                               dwBuffSize);
23776                 } else {
23777                         GT_0trace(CFG_debugMask, GT_6CLASS,
23778                                   "Failed to Register Device \n");
23779                 }
23780         }
23781 -#ifdef DEBUG
23782 +#ifdef CONFIG_BRIDGE_DEBUG
23783         if (DSP_SUCCEEDED(status)) {
23784                 GT_0trace(CFG_debugMask, GT_1CLASS,
23785                           "CFG_SetDevObject SUCCESS \n");
23786 @@ -462,17 +386,15 @@ DSP_STATUS CFG_SetObject(u32 dwValue, u3
23787         dwBuffSize = sizeof(dwValue);
23788         switch (dwType) {
23789         case (REG_DRV_OBJECT):
23790 -               status = REG_SetValue(NULL, CONFIG, DRVOBJECT, REG_DWORD,
23791 -                        (u8 *)&dwValue, dwBuffSize);
23792 +               status = REG_SetValue(DRVOBJECT, (u8 *)&dwValue, dwBuffSize);
23793                 break;
23794         case (REG_MGR_OBJECT):
23795 -               status = REG_SetValue(NULL, CONFIG, MGROBJECT, REG_DWORD,
23796 -                        (u8 *) &dwValue, dwBuffSize);
23797 +               status = REG_SetValue(MGROBJECT, (u8 *) &dwValue, dwBuffSize);
23798                 break;
23799         default:
23800                 break;
23801         }
23802 -#ifdef DEBUG
23803 +#ifdef CONFIG_BRIDGE_DEBUG
23804         if (DSP_SUCCEEDED(status))
23805                 GT_0trace(CFG_debugMask, GT_1CLASS, "CFG_SetObject SUCCESS \n");
23806         else
23807 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/clk.c kernel-power-2.6.28/drivers/dsp/bridge/services/clk.c
23808 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/clk.c  2011-04-17 17:32:26.000000000 +0100
23809 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/clk.c       2011-05-02 22:36:50.000000000 +0100
23810 @@ -3,6 +3,8 @@
23811   *
23812   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
23813   *
23814 + * Clock and Timer services.
23815 + *
23816   * Copyright (C) 2005-2006 Texas Instruments, Inc.
23817   *
23818   * This package is free software; you can redistribute it and/or modify
23819 @@ -14,24 +16,6 @@
23820   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23821   */
23822  
23823 -/*
23824 - *  ======== clk.c ========
23825 - *  Purpose:
23826 - *      Clock and Timer services.
23827 - *
23828 - *  Public Functions:
23829 - *      CLK_Exit
23830 - *      CLK_Init
23831 - *     CLK_Enable
23832 - *     CLK_Disable
23833 - *     CLK_GetRate
23834 - *     CLK_Set_32KHz
23835 - *! Revision History:
23836 - *! ================
23837 - *! 08-May-2007 rg: moved all clock functions from sync module.
23838 - *                 And added CLK_Set_32KHz, CLK_Set_SysClk.
23839 - */
23840 -
23841  /*  ----------------------------------- Host OS */
23842  #include <dspbridge/host_os.h>
23843  
23844 @@ -45,22 +29,22 @@
23845  #include <dspbridge/gt.h>
23846  
23847  /*  ----------------------------------- OS Adaptation Layer */
23848 -#include <dspbridge/csl.h>
23849  #include <dspbridge/mem.h>
23850  
23851  /*  ----------------------------------- This */
23852  #include <dspbridge/clk.h>
23853 -#include <dspbridge/util.h>
23854 -
23855  
23856  /*  ----------------------------------- Defines, Data Structures, Typedefs */
23857  
23858  typedef volatile unsigned long  REG_UWORD32;
23859  
23860 -#define SSI_Base        0x48058000
23861 -
23862 -#define SSI_BASE                     IO_ADDRESS(SSI_Base)
23863 -
23864 +#define OMAP_SSI_OFFSET                        0x58000
23865 +#define OMAP_SSI_SIZE                  0x1000
23866 +#define OMAP_SSI_SYSCONFIG_OFFSET      0x10
23867 +
23868 +#define SSI_AUTOIDLE                   (1 << 0)
23869 +#define SSI_SIDLE_SMARTIDLE            (2 << 3)
23870 +#define SSI_MIDLE_NOIDLE               (1 << 12)
23871  
23872  struct SERVICES_Clk_t {
23873         struct clk *clk_handle;
23874 @@ -194,9 +178,7 @@ DSP_STATUS CLK_Enable(IN enum SERVICES_C
23875  
23876         pClk = SERVICES_Clks[clk_id].clk_handle;
23877         if (pClk) {
23878 -               if (clk_enable(pClk) == 0x0) {
23879 -                       /* Success ? */
23880 -               } else {
23881 +               if (clk_enable(pClk)) {
23882                         pr_err("CLK_Enable: failed to Enable CLK %s, "
23883                                         "CLK dev id = %d\n",
23884                                         SERVICES_Clks[clk_id].clk_name,
23885 @@ -230,8 +212,7 @@ DSP_STATUS CLK_Set_32KHz(IN enum SERVICE
23886         DSP_STATUS status = DSP_SOK;
23887         struct clk *pClk;
23888         struct clk *pClkParent;
23889 -       enum SERVICES_ClkId sys_32k_id = SERVICESCLK_sys_32k_ck;
23890 -       pClkParent =  SERVICES_Clks[sys_32k_id].clk_handle;
23891 +       pClkParent =  SERVICES_Clks[SERVICESCLK_sys_32k_ck].clk_handle;
23892  
23893         DBC_Require(clk_id < SERVICESCLK_NOT_DEFINED);
23894         GT_2trace(CLK_debugMask, GT_6CLASS, "CLK_Set_32KHz: CLK %s, "
23895 @@ -241,8 +222,8 @@ DSP_STATUS CLK_Set_32KHz(IN enum SERVICE
23896         pClk = SERVICES_Clks[clk_id].clk_handle;
23897         if (pClk) {
23898                 if (!(clk_set_parent(pClk, pClkParent) == 0x0)) {
23899 -                      GT_2trace(CLK_debugMask, GT_7CLASS, "CLK_Set_32KHz: "
23900 -                               "Failed to set to 32KHz %s, CLK dev id = %d\n",
23901 +                       GT_2trace(CLK_debugMask, GT_7CLASS, "CLK_Set_32KHz: "
23902 +                               "Failed to set to 32KHz %s, CLK dev id = %s\n",
23903                                 SERVICES_Clks[clk_id].clk_name,
23904                                 SERVICES_Clks[clk_id].id);
23905                         status = DSP_EFAIL;
23906 @@ -344,7 +325,8 @@ s32 CLK_Get_UseCnt(IN enum SERVICES_ClkI
23907         pClk = SERVICES_Clks[clk_id].clk_handle;
23908  
23909         if (pClk) {
23910 -               useCount =  pClk->usecount; /* FIXME: usecount shouldn't be used */
23911 +               /* FIXME: usecount shouldn't be used */
23912 +               useCount = pClk->usecount;
23913         } else {
23914                 GT_2trace(CLK_debugMask, GT_7CLASS,
23915                          "CLK_GetRate: failed to get CLK %s, "
23916 @@ -357,19 +339,27 @@ s32 CLK_Get_UseCnt(IN enum SERVICES_ClkI
23917  
23918  void SSI_Clk_Prepare(bool FLAG)
23919  {
23920 -       u32 ssi_sysconfig;
23921 -       ssi_sysconfig = __raw_readl((SSI_BASE) + 0x10);
23922 +       void __iomem *ssi_base;
23923 +       unsigned int value;
23924 +
23925 +       ssi_base = ioremap(L4_34XX_BASE + OMAP_SSI_OFFSET, OMAP_SSI_SIZE);
23926 +       if (!ssi_base) {
23927 +               pr_err("%s: error, SSI not configured\n", __func__);
23928 +               return;
23929 +       }
23930  
23931         if (FLAG) {
23932                 /* Set Autoidle, SIDLEMode to smart idle, and MIDLEmode to
23933                  * no idle
23934                  */
23935 -               ssi_sysconfig = 0x1011;
23936 +               value = SSI_AUTOIDLE | SSI_SIDLE_SMARTIDLE | SSI_MIDLE_NOIDLE;
23937         } else {
23938                 /* Set Autoidle, SIDLEMode to forced idle, and MIDLEmode to
23939                  * forced idle
23940                  */
23941 -               ssi_sysconfig = 0x1;
23942 +               value = SSI_AUTOIDLE;
23943         }
23944 -       __raw_writel((u32)ssi_sysconfig, SSI_BASE + 0x10);
23945 +
23946 +       __raw_writel(value, ssi_base + OMAP_SSI_SYSCONFIG_OFFSET);
23947 +       iounmap(ssi_base);
23948  }
23949 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/csl.c kernel-power-2.6.28/drivers/dsp/bridge/services/csl.c
23950 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/csl.c  2011-04-17 17:32:26.000000000 +0100
23951 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/csl.c       1970-01-01 01:00:00.000000000 +0100
23952 @@ -1,173 +0,0 @@
23953 -/*
23954 - * csl.c
23955 - *
23956 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
23957 - *
23958 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
23959 - *
23960 - * This package is free software; you can redistribute it and/or modify
23961 - * it under the terms of the GNU General Public License version 2 as
23962 - * published by the Free Software Foundation.
23963 - *
23964 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
23965 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
23966 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23967 - */
23968 -
23969 -
23970 -/*
23971 - *  ======== cslce.c ========
23972 - *  Purpose:
23973 - *      Provides platform independent C Standard library functions.
23974 - *
23975 - *  Public Functions:
23976 - *      CSL_Atoi
23977 - *      CSL_Exit
23978 - *      CSL_Init
23979 - *      CSL_NumToAscii
23980 - *      CSL_Strtokr
23981 - *
23982 - *! Revision History:
23983 - *! ================
23984 - *! 07-Aug-2002 jeh: Added CSL_Strtokr().
23985 - *! 21-Sep-2001 jeh: Added CSL_Strncmp(). Alphabetized functions.
23986 - *! 22-Nov-2000 map: Added CSL_Atoi and CSL_Strtok
23987 - *! 19-Nov-2000 kc: Added CSL_ByteSwap.
23988 - *! 09-Nov-2000 kc: Added CSL_Strncat.
23989 - *! 03-Feb-2000 rr: Module init/exit is handled by SERVICES Init/Exit.
23990 - *!             GT Changes.
23991 - *! 15-Dec-1999 ag: Removed incorrect assertion CSL_NumToAscii()
23992 - *! 29-Oct-1999 kc: Added CSL_Wstrlen for UNICODE strings.
23993 - *! 30-Sep-1999 ag: Removed DBC assertion (!CSL_DebugMask.flags) in
23994 - *               CSP_Init().
23995 - *! 20-Sep-1999 ag: Added CSL_WcharToAnsi().
23996 - *!             Removed call to GT_set().
23997 - *! 19-Jan-1998 cr: Code review cleanup.
23998 - *! 29-Dec-1997 cr: Made platform independant, using MS CRT code, and
23999 - *!             combined csl32.c csl95.c and cslnt.c into csl.c.  Also
24000 - *!             changed CSL_lowercase to CSL_Uppercase.
24001 - *! 21-Aug-1997 gp: Fix to CSL_strcpyn to initialize Source string, the NT way.
24002 - *! 25-Jun-1997 cr: Created from csl95, added CSL_strcmp.
24003 - */
24004 -
24005 -/* ----------------------------------- Host OS */
24006 -#include <dspbridge/host_os.h>
24007 -
24008 -/*  ----------------------------------- DSP/BIOS Bridge */
24009 -#include <dspbridge/std.h>
24010 -#include <dspbridge/dbdefs.h>
24011 -
24012 -/*  ----------------------------------- Trace & Debug */
24013 -#include <dspbridge/dbc.h>
24014 -#include <dspbridge/gt.h>
24015 -
24016 -/*  ----------------------------------- This */
24017 -#include <dspbridge/csl.h>
24018 -
24019 -/* Is character c in the string pstrDelim? */
24020 -#define IsDelimiter(c, pstrDelim) ((c != '\0') && \
24021 -                                  (strchr(pstrDelim, c) != NULL))
24022 -
24023 -/*  ----------------------------------- Globals */
24024 -#if GT_TRACE
24025 -static struct GT_Mask CSL_DebugMask = { NULL, NULL };  /* GT trace var. */
24026 -#endif
24027 -
24028 -/*
24029 - *  ======== CSL_Exit ========
24030 - *  Purpose:
24031 - *      Discontinue usage of the CSL module.
24032 - */
24033 -void CSL_Exit(void)
24034 -{
24035 -       GT_0trace(CSL_DebugMask, GT_5CLASS, "CSL_Exit\n");
24036 -}
24037 -
24038 -/*
24039 - *  ======== CSL_Init ========
24040 - *  Purpose:
24041 - *      Initialize the CSL module's private state.
24042 - */
24043 -bool CSL_Init(void)
24044 -{
24045 -       GT_create(&CSL_DebugMask, "CS");
24046 -
24047 -       GT_0trace(CSL_DebugMask, GT_5CLASS, "CSL_Init\n");
24048 -
24049 -       return true;
24050 -}
24051 -
24052 -/*
24053 - *  ======== CSL_NumToAscii ========
24054 - *  Purpose:
24055 - *      Convert a 1 or 2 digit number to a 2 digit string.
24056 - */
24057 -void CSL_NumToAscii(OUT char *pstrNumber, u32 dwNum)
24058 -{
24059 -       char tens;
24060 -
24061 -       DBC_Require(dwNum < 100);
24062 -
24063 -       if (dwNum < 100) {
24064 -               tens = (char) dwNum / 10;
24065 -               dwNum = dwNum % 10;
24066 -
24067 -               if (tens) {
24068 -                       pstrNumber[0] = tens + '0';
24069 -                       pstrNumber[1] = (char) dwNum + '0';
24070 -                       pstrNumber[2] = '\0';
24071 -               } else {
24072 -                       pstrNumber[0] = (char) dwNum + '0';
24073 -                       pstrNumber[1] = '\0';
24074 -               }
24075 -       } else {
24076 -               pstrNumber[0] = '\0';
24077 -       }
24078 -}
24079 -
24080 -
24081 -
24082 -
24083 -/*
24084 - *  ======= CSL_Strtokr =======
24085 - *  Purpose:
24086 - *      Re-entrant version of strtok.
24087 - */
24088 -char *CSL_Strtokr(IN char *pstrSrc, IN CONST char *szSeparators,
24089 -                 OUT char **ppstrLast)
24090 -{
24091 -       char *pstrTemp;
24092 -       char *pstrToken;
24093 -
24094 -       DBC_Require(szSeparators != NULL);
24095 -       DBC_Require(ppstrLast != NULL);
24096 -       DBC_Require(pstrSrc != NULL || *ppstrLast != NULL);
24097 -
24098 -       /*
24099 -        *  Set string location to beginning (pstrSrc != NULL) or to the
24100 -        *  beginning of the next token.
24101 -        */
24102 -       pstrTemp = (pstrSrc != NULL) ? pstrSrc : *ppstrLast;
24103 -       if (*pstrTemp == '\0') {
24104 -               pstrToken = NULL;
24105 -       } else {
24106 -               pstrToken = pstrTemp;
24107 -               while (*pstrTemp != '\0' && !IsDelimiter(*pstrTemp,
24108 -                     szSeparators)) {
24109 -                       pstrTemp++;
24110 -               }
24111 -               if (*pstrTemp != '\0') {
24112 -                       while (IsDelimiter(*pstrTemp, szSeparators)) {
24113 -                               /* TODO: Shouldn't we do this for
24114 -                                * only 1 char?? */
24115 -                               *pstrTemp = '\0';
24116 -                               pstrTemp++;
24117 -                       }
24118 -               }
24119 -
24120 -               /* Location in string for next call */
24121 -               *ppstrLast = pstrTemp;
24122 -       }
24123 -
24124 -       return pstrToken;
24125 -}
24126 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/dbg.c kernel-power-2.6.28/drivers/dsp/bridge/services/dbg.c
24127 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/dbg.c  2011-04-17 17:32:26.000000000 +0100
24128 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/dbg.c       2011-05-02 22:36:50.000000000 +0100
24129 @@ -3,6 +3,8 @@
24130   *
24131   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
24132   *
24133 + * Provide debugging services for DSP/BIOS Bridge Mini Driver.
24134 + *
24135   * Copyright (C) 2005-2006 Texas Instruments, Inc.
24136   *
24137   * This package is free software; you can redistribute it and/or modify
24138 @@ -14,37 +16,6 @@
24139   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24140   */
24141  
24142 -
24143 -/*
24144 - *  ======== dbgce.c ========
24145 - *  Purpose:
24146 - *      Provide debugging services for DSP/BIOS Bridge Mini Drivers.
24147 - *
24148 - *  Public Functions:
24149 - *      DBG_Exit
24150 - *      DBG_Init
24151 - *      DBG_Trace
24152 - *
24153 - *  Notes:
24154 - *      Requires gt.h.
24155 - *
24156 - *      This implementation does not create GT masks on a per WMD basis.
24157 - *      There is currently no facility for a WMD to alter the GT mask.
24158 - *
24159 - *! Revision History:
24160 - *! ================
24161 - *! 15-Feb-2000 rr: DBG_Trace prints based on the DebugZones.
24162 - *! 03-Feb-2000 rr: Module init/exit is handled by SERVICES Init/Exit.
24163 - *!             GT Changes.
24164 - *! 29-Oct-1999 kc: Cleaned up for code review.
24165 - *! 10-Oct-1997 cr: Added DBG_Printf service.
24166 - *! 28-May-1997 cr: Added reference counting.
24167 - *! 23-May-1997 cr: Updated DBG_Trace to new gt interface.
24168 - *! 29-May-1996 gp: Removed WCD_ prefix.
24169 - *! 20-May-1996 gp: Remove DEBUG conditional compilation.
24170 - *! 15-May-1996 gp: Created.
24171 - */
24172 -
24173  /*  ----------------------------------- DSP/BIOS Bridge */
24174  #include <dspbridge/std.h>
24175  #include <dspbridge/dbdefs.h>
24176 @@ -62,7 +33,7 @@
24177  static struct GT_Mask DBG_debugMask = { NULL, NULL };  /* GT trace var. */
24178  #endif
24179  
24180 -#if (defined(DEBUG) || defined (DDSP_DEBUG_PRODUCT)) && GT_TRACE
24181 +#if (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
24182  
24183  /*
24184   *  ======== DBG_Init ========
24185 @@ -116,4 +87,4 @@ void DBG_Exit(void)
24186         GT_0trace(DBG_debugMask, GT_5CLASS, "DBG_Exit\n");
24187  }
24188  
24189 -#endif /* (defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE */
24190 +#endif /* (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE */
24191 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/dpc.c kernel-power-2.6.28/drivers/dsp/bridge/services/dpc.c
24192 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/dpc.c  2011-04-17 17:32:26.000000000 +0100
24193 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/dpc.c       1970-01-01 01:00:00.000000000 +0100
24194 @@ -1,274 +0,0 @@
24195 -/*
24196 - * dpc.c
24197 - *
24198 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
24199 - *
24200 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
24201 - *
24202 - * This package is free software; you can redistribute it and/or modify
24203 - * it under the terms of the GNU General Public License version 2 as
24204 - * published by the Free Software Foundation.
24205 - *
24206 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
24207 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
24208 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24209 - */
24210 -
24211 -
24212 -/*
24213 - *  ======== dpcce.c ========
24214 - *  Purpose:
24215 - *      Deferred Procedure Call(DPC) Services.
24216 - *
24217 - *
24218 - *  Public Functions:
24219 - *      DPC_Create
24220 - *      DPC_Destroy
24221 - *      DPC_Exit
24222 - *      DPC_Init
24223 - *      DPC_Schedule
24224 - *
24225 - *! Revision History:
24226 - *! ================
24227 - *! 28-Mar-2001 ag: Added #ifdef CHNL_NOIPCINTR to set DPC thread priority
24228 - *!                     to THREAD_PRIORITY_IDLE for polling IPC.
24229 - *! 03-Feb-2000 rr: Module init/exit is handled by SERVICES Init/Exit.
24230 - *!             GT Changes.
24231 - *! 31-Jan-2000 rr: Changes after code review.Terminate thread,handle
24232 - *!                 modified.DPC_Destroy frees the DPC_Object only on
24233 - *!                 Successful termination of the thread and the handle.
24234 - *! 06-Jan-1999 ag: Format cleanup for code review.
24235 - *!                 Removed DPC_[Lower|Raise]IRQL[From|To]DispatchLevel.
24236 - *! 10-Dec-1999 ag: Added SetProcPermissions in DPC_DeferredProcedure().
24237 - *!                 (Needed to access client(s) CHNL buffers).
24238 - *! 19-Sep-1999 a0216266: Stubbed from dpcnt.c.
24239 - */
24240 -
24241 -/*  ----------------------------------- Host OS */
24242 -#include <dspbridge/host_os.h>
24243 -
24244 -/*  ----------------------------------- DSP/BIOS Bridge */
24245 -#include <dspbridge/std.h>
24246 -#include <dspbridge/dbdefs.h>
24247 -#include <dspbridge/errbase.h>
24248 -
24249 -/*  ----------------------------------- Trace & Debug */
24250 -#include <dspbridge/dbc.h>
24251 -#include <dspbridge/gt.h>
24252 -
24253 -/*  ----------------------------------- OS Adaptation Layer */
24254 -#include <dspbridge/mem.h>
24255 -
24256 -/*  ----------------------------------- This */
24257 -#include <dspbridge/dpc.h>
24258 -
24259 -/*  ----------------------------------- Defines, Data Structures, Typedefs */
24260 -#define SIGNATURE       0x5f435044     /* "DPC_" (in reverse). */
24261 -
24262 -/* The DPC object, passed to our priority event callback routine: */
24263 -struct DPC_OBJECT {
24264 -       u32 dwSignature;        /* Used for object validation.   */
24265 -       void *pRefData;         /* Argument for client's DPC.    */
24266 -       DPC_PROC pfnDPC;        /* Client's DPC.                 */
24267 -       u32 numRequested;       /* Number of requested DPC's.      */
24268 -       u32 numScheduled;       /* Number of executed DPC's.      */
24269 -       struct tasklet_struct dpc_tasklet;
24270 -
24271 -#ifdef DEBUG
24272 -       u32 cEntryCount;        /* Number of times DPC reentered. */
24273 -       u32 numRequestedMax;    /* Keep track of max pending DPC's. */
24274 -#endif
24275 -
24276 -       spinlock_t dpc_lock;
24277 -};
24278 -
24279 -/*  ----------------------------------- Globals */
24280 -#if GT_TRACE
24281 -static struct GT_Mask DPC_DebugMask = { NULL, NULL };  /* DPC Debug Mask */
24282 -#endif
24283 -
24284 -/*  ----------------------------------- Function Prototypes */
24285 -static void DPC_DeferredProcedure(IN unsigned long pDeferredContext);
24286 -
24287 -/*
24288 - *  ======== DPC_Create ========
24289 - *  Purpose:
24290 - *      Create a DPC object, allowing a client's own DPC procedure to be
24291 - *      scheduled for a call with client reference data.
24292 - */
24293 -DSP_STATUS DPC_Create(OUT struct DPC_OBJECT **phDPC, DPC_PROC pfnDPC,
24294 -                     void *pRefData)
24295 -{
24296 -       DSP_STATUS status = DSP_SOK;
24297 -       struct DPC_OBJECT *pDPCObject = NULL;
24298 -
24299 -       if ((phDPC != NULL) && (pfnDPC != NULL)) {
24300 -               /*
24301 -                *  Allocate a DPC object to store information allowing our DPC
24302 -                *  callback to dispatch to the client's DPC.
24303 -                */
24304 -               MEM_AllocObject(pDPCObject, struct DPC_OBJECT, SIGNATURE);
24305 -               if (pDPCObject != NULL) {
24306 -                       tasklet_init(&pDPCObject->dpc_tasklet,
24307 -                                    DPC_DeferredProcedure,
24308 -                                    (u32) pDPCObject);
24309 -                       /* Fill out our DPC Object: */
24310 -                       pDPCObject->pRefData = pRefData;
24311 -                       pDPCObject->pfnDPC = pfnDPC;
24312 -                       pDPCObject->numRequested = 0;
24313 -                       pDPCObject->numScheduled = 0;
24314 -#ifdef DEBUG
24315 -                       pDPCObject->numRequestedMax = 0;
24316 -                       pDPCObject->cEntryCount = 0;
24317 -#endif
24318 -                       spin_lock_init(&pDPCObject->dpc_lock);
24319 -                       *phDPC = pDPCObject;
24320 -               } else {
24321 -                       GT_0trace(DPC_DebugMask, GT_6CLASS,
24322 -                                 "DPC_Create: DSP_EMEMORY\n");
24323 -                       status = DSP_EMEMORY;
24324 -               }
24325 -       } else {
24326 -               GT_0trace(DPC_DebugMask, GT_6CLASS,
24327 -                         "DPC_Create: DSP_EPOINTER\n");
24328 -               status = DSP_EPOINTER;
24329 -       }
24330 -       DBC_Ensure((DSP_FAILED(status) && (!phDPC || (phDPC && *phDPC == NULL)))
24331 -                  || DSP_SUCCEEDED(status));
24332 -       return status;
24333 -}
24334 -
24335 -/*
24336 - *  ======== DPC_Destroy ========
24337 - *  Purpose:
24338 - *      Cancel the last scheduled DPC, and deallocate a DPC object previously
24339 - *      allocated with DPC_Create(). Frees the Object only if the thread
24340 - *      and the event terminated successfuly.
24341 - */
24342 -DSP_STATUS DPC_Destroy(struct DPC_OBJECT *hDPC)
24343 -{
24344 -       DSP_STATUS status = DSP_SOK;
24345 -       struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)hDPC;
24346 -
24347 -       if (MEM_IsValidHandle(hDPC, SIGNATURE)) {
24348 -
24349 -               /* Free our DPC object: */
24350 -               if (DSP_SUCCEEDED(status)) {
24351 -                       tasklet_kill(&pDPCObject->dpc_tasklet);
24352 -                       MEM_FreeObject(pDPCObject);
24353 -                       pDPCObject = NULL;
24354 -                       GT_0trace(DPC_DebugMask, GT_2CLASS,
24355 -                                 "DPC_Destroy: SUCCESS\n");
24356 -               }
24357 -       } else {
24358 -               GT_0trace(DPC_DebugMask, GT_6CLASS,
24359 -                         "DPC_Destroy: DSP_EHANDLE\n");
24360 -               status = DSP_EHANDLE;
24361 -       }
24362 -       DBC_Ensure((DSP_SUCCEEDED(status) && pDPCObject == NULL)
24363 -                  || DSP_FAILED(status));
24364 -       return status;
24365 -}
24366 -
24367 -/*
24368 - *  ======== DPC_Exit ========
24369 - *  Purpose:
24370 - *      Discontinue usage of the DPC module.
24371 - */
24372 -void DPC_Exit(void)
24373 -{
24374 -       GT_0trace(DPC_DebugMask, GT_5CLASS, "Entered DPC_Exit\n");
24375 -}
24376 -
24377 -/*
24378 - *  ======== DPC_Init ========
24379 - *  Purpose:
24380 - *      Initialize the DPC module's private state.
24381 - */
24382 -bool DPC_Init(void)
24383 -{
24384 -       GT_create(&DPC_DebugMask, "DP");
24385 -
24386 -       GT_0trace(DPC_DebugMask, GT_5CLASS, "Entered DPC_Init\n");
24387 -
24388 -       return true;
24389 -}
24390 -
24391 -/*
24392 - *  ======== DPC_Schedule ========
24393 - *  Purpose:
24394 - *      Schedule a deferred procedure call to be executed at a later time.
24395 - *      Latency and order of DPC execution is platform specific.
24396 - */
24397 -DSP_STATUS DPC_Schedule(struct DPC_OBJECT *hDPC)
24398 -{
24399 -       DSP_STATUS status = DSP_SOK;
24400 -       struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)hDPC;
24401 -       unsigned long flags;
24402 -
24403 -       GT_1trace(DPC_DebugMask, GT_ENTER, "DPC_Schedule hDPC %x\n", hDPC);
24404 -       if (MEM_IsValidHandle(hDPC, SIGNATURE)) {
24405 -               /* Increment count of DPC's pending. Needs to be protected
24406 -                * from ISRs since this function is called from process
24407 -                * context also. */
24408 -               spin_lock_irqsave(&hDPC->dpc_lock, flags);
24409 -               pDPCObject->numRequested++;
24410 -               spin_unlock_irqrestore(&hDPC->dpc_lock, flags);
24411 -               tasklet_schedule(&(hDPC->dpc_tasklet));
24412 -#ifdef DEBUG
24413 -               if (pDPCObject->numRequested > pDPCObject->numScheduled +
24414 -                                               pDPCObject->numRequestedMax) {
24415 -                       pDPCObject->numRequestedMax = pDPCObject->numRequested -
24416 -                                               pDPCObject->numScheduled;
24417 -               }
24418 -#endif
24419 -       /*  If an interrupt occurs between incrementing numRequested and the
24420 -        *  assertion below, then DPC will get executed while returning from
24421 -        *  ISR, which will complete all requests and make numRequested equal
24422 -        * to numScheduled, firing this assertion. This happens only when
24423 -        * DPC is being scheduled in process context */
24424 -       } else {
24425 -               GT_0trace(DPC_DebugMask, GT_6CLASS,
24426 -                         "DPC_Schedule: DSP_EHANDLE\n");
24427 -               status = DSP_EHANDLE;
24428 -       }
24429 -       GT_1trace(DPC_DebugMask, GT_ENTER, "DPC_Schedule status %x\n", status);
24430 -       return status;
24431 -}
24432 -
24433 -/*
24434 - *  ======== DeferredProcedure ========
24435 - *  Purpose:
24436 - *      Main DPC routine.  This is called by host OS DPC callback
24437 - *      mechanism with interrupts enabled.
24438 - */
24439 -static void DPC_DeferredProcedure(IN unsigned long pDeferredContext)
24440 -{
24441 -       struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)pDeferredContext;
24442 -       /* read numRequested in local variable */
24443 -       u32 requested;
24444 -       u32 serviced;
24445 -
24446 -       DBC_Require(pDPCObject != NULL);
24447 -       requested = pDPCObject->numRequested;
24448 -       serviced = pDPCObject->numScheduled;
24449 -
24450 -       GT_1trace(DPC_DebugMask, GT_ENTER, "> DPC_DeferredProcedure "
24451 -                 "pDeferredContext=%x\n", pDeferredContext);
24452 -       /* Rollover taken care of using != instead of < */
24453 -       if (serviced != requested) {
24454 -               if (pDPCObject->pfnDPC != NULL) {
24455 -                       /* Process pending DPC's: */
24456 -                       do {
24457 -                               /* Call client's DPC: */
24458 -                               (*(pDPCObject->pfnDPC))(pDPCObject->pRefData);
24459 -                               serviced++;
24460 -                       } while (serviced != requested);
24461 -               }
24462 -               pDPCObject->numScheduled = requested;
24463 -       }
24464 -       GT_2trace(DPC_DebugMask, GT_ENTER,
24465 -                 "< DPC_DeferredProcedure requested %d"
24466 -                 " serviced %d\n", requested, serviced);
24467 -}
24468 -
24469 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/kfile.c kernel-power-2.6.28/drivers/dsp/bridge/services/kfile.c
24470 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/kfile.c        2011-04-17 17:32:26.000000000 +0100
24471 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/kfile.c     1970-01-01 01:00:00.000000000 +0100
24472 @@ -1,335 +0,0 @@
24473 -/*
24474 - * kfile.c
24475 - *
24476 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
24477 - *
24478 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
24479 - *
24480 - * This package is free software; you can redistribute it and/or modify
24481 - * it under the terms of the GNU General Public License version 2 as
24482 - * published by the Free Software Foundation.
24483 - *
24484 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
24485 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
24486 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24487 - */
24488 -
24489 -
24490 -/*
24491 - *  ======== kfilece.c ========
24492 - *  Purpose:
24493 - *      This module provides file i/o services.
24494 - *
24495 - *  Public Functions:
24496 - *      KFILE_Close
24497 - *      KFILE_Exit
24498 - *      KFILE_Init
24499 - *      KFILE_Open
24500 - *      KFILE_Read
24501 - *      KFILE_Seek
24502 - *      KFILE_Tell
24503 - *
24504 - *! Revision History
24505 - *! ================
24506 - *! 03-Feb-2000 rr: Module init/exit is handled by SERVICES Init/Exit.
24507 - *!             GT Changes.
24508 - *! 22-Nov-1999 kc: Added changes from code review.
24509 - *! 12-Nov-1999 kc: Enabled CSL for UNICODE/ANSI string conversions.
24510 - *! 30-Sep-1999 ag: Changed KFILE_Read() GT level from _ENTER to _4CLASS.
24511 - *!                 Removed GT_set().
24512 - *! 25-Aug-1999 ag: Changed MEM_Calloc allocation type to MEM_PAGED.
24513 - *! 13-Jul-1999 a0216266(ww - TID): Stubbed from kfilent.c.
24514 - */
24515 -
24516 -/*  ----------------------------------- Host OS */
24517 -#include <dspbridge/host_os.h>
24518 -
24519 -/*  ----------------------------------- DSP/BIOS Bridge */
24520 -#include <dspbridge/std.h>
24521 -#include <dspbridge/dbdefs.h>
24522 -#include <dspbridge/errbase.h>
24523 -
24524 -/*  ----------------------------------- Trace & Debug */
24525 -#include <dspbridge/dbc.h>
24526 -#include <dspbridge/gt.h>
24527 -
24528 -/*  ----------------------------------- OS Adaptation Layer */
24529 -#include <dspbridge/csl.h>
24530 -#include <dspbridge/mem.h>
24531 -
24532 -/*  ----------------------------------- This */
24533 -#include <dspbridge/kfile.h>
24534 -
24535 -/*  ----------------------------------- Defines, Data Structures, Typedefs */
24536 -#define SIGNATURE           0x4c49464b /* hex code of KFIL (reversed) */
24537 -#define MAXFILENAMELENGTH   256
24538 -#define GENERAL_FAILURE     0xffffffff /* SetFilePointer error */
24539 -
24540 -/* The KFILE_FileObj abstracts the true file handle from a KFILE handle. */
24541 -struct KFILE_FileObj {
24542 -    u32 dwSignature;
24543 -    __kernel_pid_t owner_pid;  /* PID of process that opened this file */
24544 -    char       *fileName  ;
24545 -    bool          isOpen    ;
24546 -    u32        size      ;
24547 -    u32        curPos    ;
24548 -    long         hInternal;            /* internal handle of file */
24549 -    struct file *fileDesc;
24550 -
24551 -};
24552 -
24553 -/*  ----------------------------------- Globals */
24554 -#if GT_TRACE
24555 -static struct GT_Mask KFILE_debugMask = { NULL, NULL };        /* Debug mask */
24556 -#endif
24557 -
24558 -/*
24559 - *  ======== KFILE_Close ========
24560 - *  Purpose:
24561 - *      This function closes a file's stream.
24562 - */
24563 -s32 KFILE_Close(struct KFILE_FileObj *hFile)
24564 -{
24565 -       s32 cRetVal = 0;        /* 0 indicates success */
24566 -       s32 fRetVal = 0;
24567 -
24568 -       GT_1trace(KFILE_debugMask, GT_ENTER, "KFILE_Close: hFile 0x%x\n",
24569 -                 hFile);
24570 -
24571 -       /* Check for valid handle */
24572 -       if (MEM_IsValidHandle(hFile, SIGNATURE)) {
24573 -               /* Close file only if opened by the same process (id). Otherwise
24574 -                * Linux closes all open file handles when process exits.*/
24575 -               fRetVal = filp_close(hFile->fileDesc, NULL) ;
24576 -               if (fRetVal) {
24577 -                       cRetVal = E_KFILE_ERROR;
24578 -                       GT_1trace(KFILE_debugMask, GT_6CLASS,
24579 -                                 "KFILE_Close: sys_close "
24580 -                                 "returned %d\n", fRetVal);
24581 -               }
24582 -               MEM_FreeObject(hFile);
24583 -       } else {
24584 -               cRetVal = E_KFILE_INVALIDHANDLE;
24585 -               GT_0trace(KFILE_debugMask, GT_6CLASS, "KFILE_Close: "
24586 -                         "invalid file handle\n");
24587 -       }
24588 -       return cRetVal;
24589 -}
24590 -
24591 -/*
24592 - *  ======== KFILE_Exit ========
24593 - *  Purpose:
24594 - *      Decrement reference count, and free resources when reference count
24595 - *      is 0.
24596 - */
24597 -void KFILE_Exit(void)
24598 -{
24599 -       GT_0trace(KFILE_debugMask, GT_5CLASS, "KFILE_Exit\n");
24600 -}
24601 -
24602 -/*
24603 - *  ======== KFILE_Init ========
24604 - */
24605 -bool KFILE_Init(void)
24606 -{
24607 -       GT_create(&KFILE_debugMask, "KF");      /* "KF" for KFile */
24608 -
24609 -       GT_0trace(KFILE_debugMask, GT_5CLASS, "KFILE_Init\n");
24610 -
24611 -       return true;
24612 -}
24613 -
24614 -/*
24615 - *  ======== KFILE_Open ========
24616 - *  Purpose:
24617 - *      Open a file for reading ONLY
24618 - */
24619 -struct KFILE_FileObj *KFILE_Open(CONST char *pszFileName, CONST char *pszMode)
24620 -{
24621 -       struct KFILE_FileObj *hFile;    /* file handle */
24622 -       DSP_STATUS status;
24623 -       mm_segment_t fs;
24624 -
24625 -       struct file*fileDesc = NULL;
24626 -       DBC_Require(pszMode != NULL);
24627 -       DBC_Require(pszFileName != NULL);
24628 -
24629 -       GT_2trace(KFILE_debugMask, GT_ENTER,
24630 -                 "KFILE_Open: pszFileName %s, pszMode "
24631 -                 "%s\n", pszFileName, pszMode);
24632 -
24633 -       /* create a KFILE object */
24634 -       MEM_AllocObject(hFile, struct KFILE_FileObj, SIGNATURE);
24635 -
24636 -       if (hFile) {
24637 -               fs = get_fs();
24638 -               set_fs(get_ds());
24639 -       /* Third argument is mode (permissions). Ignored unless creating file */
24640 -               fileDesc = filp_open(pszFileName, O_RDONLY, 0);
24641 -               if ((IS_ERR(fileDesc)) || (fileDesc == NULL) ||
24642 -                    (fileDesc->f_op == NULL) || (fileDesc->f_op->read == NULL)
24643 -                    || (fileDesc->f_op->llseek == NULL)) {
24644 -                       status = DSP_EFILE;
24645 -               } else {
24646 -                       hFile->fileDesc = fileDesc;
24647 -                       hFile->fileName = (char *)pszFileName;
24648 -                       hFile->isOpen      = true;
24649 -                       hFile->curPos   = 0;
24650 -                       hFile->size = fileDesc->f_op->llseek(fileDesc, 0,
24651 -                                                           SEEK_END);
24652 -                       fileDesc->f_op->llseek(fileDesc, 0, SEEK_SET);
24653 -                       /* Return TGID instead of process handle */
24654 -                       hFile->owner_pid = current->tgid;
24655 -
24656 -                       status = DSP_SOK;
24657 -               }
24658 -               set_fs(fs);
24659 -               if (DSP_FAILED(status)) {
24660 -                       /* free memory, and clear handle */
24661 -                       MEM_FreeObject(hFile);
24662 -                       hFile = NULL;
24663 -               }
24664 -       } else {
24665 -                       GT_0trace(KFILE_debugMask, GT_6CLASS,
24666 -                                 "KFILE_Open: MEM_AllocObject failed\n");
24667 -                       status = DSP_EMEMORY;
24668 -       }
24669 -       return hFile;
24670 -}
24671 -
24672 -/*
24673 - *  ======== KFILE_Read ========
24674 - *  Purpose:
24675 - *      Reads a specified number of bytes into a buffer.
24676 - */
24677 -s32
24678 -KFILE_Read(void __user*pBuffer, s32 cSize, s32 cCount,
24679 -                       struct KFILE_FileObj *hFile)
24680 -{
24681 -       u32 dwBytesRead = 0;
24682 -       s32 cRetVal = 0;
24683 -       mm_segment_t fs;
24684 -
24685 -       DBC_Require(pBuffer != NULL);
24686 -
24687 -       GT_4trace(KFILE_debugMask, GT_4CLASS,
24688 -                 "KFILE_Read: buffer 0x%x, cSize 0x%x,"
24689 -                 "cCount 0x%x, hFile 0x%x\n", pBuffer, cSize, cCount, hFile);
24690 -
24691 -       /* check for valid file handle */
24692 -       if (MEM_IsValidHandle(hFile, SIGNATURE)) {
24693 -               if ((cSize > 0) && (cCount > 0) && pBuffer) {
24694 -                       /* read from file */
24695 -                       fs = get_fs();
24696 -                       set_fs(get_ds());
24697 -                       dwBytesRead = hFile->fileDesc->f_op->read(hFile->
24698 -                                     fileDesc, pBuffer, cSize *cCount,
24699 -                                     &(hFile->fileDesc->f_pos));
24700 -                       set_fs(fs);
24701 -                       if (dwBytesRead) {
24702 -                               cRetVal = dwBytesRead / cSize;
24703 -                               hFile->curPos += dwBytesRead;
24704 -                               DBC_Assert((dwBytesRead / cSize) <= \
24705 -                                         (u32)cCount);
24706 -                       } else {
24707 -                               cRetVal = E_KFILE_ERROR;
24708 -                               GT_0trace(KFILE_debugMask, GT_6CLASS,
24709 -                                         "KFILE_Read: sys_read() failed\n");
24710 -                       }
24711 -               } else {
24712 -                       cRetVal = DSP_EINVALIDARG;
24713 -                       GT_0trace(KFILE_debugMask, GT_6CLASS,
24714 -                                 "KFILE_Read: Invalid argument(s)\n");
24715 -               }
24716 -       } else {
24717 -               cRetVal = E_KFILE_INVALIDHANDLE;
24718 -               GT_0trace(KFILE_debugMask, GT_6CLASS,
24719 -                         "KFILE_Read: invalid file handle\n");
24720 -       }
24721 -
24722 -       return cRetVal;
24723 -}
24724 -
24725 -/*
24726 - *  ======== KFILE_Seek ========
24727 - *  Purpose:
24728 - *      Sets the file position indicator. NOTE:  we don't support seeking
24729 - *      beyond the boundaries of a file.
24730 - */
24731 -s32 KFILE_Seek(struct KFILE_FileObj *hFile, s32 lOffset, s32 cOrigin)
24732 -{
24733 -       s32 cRetVal = 0;        /* 0 for success */
24734 -       loff_t dwCurPos = 0;
24735 -
24736 -       struct file *fileDesc = NULL;
24737 -
24738 -       GT_3trace(KFILE_debugMask, GT_ENTER, "KFILE_Seek: hFile 0x%x, "
24739 -                 "lOffset 0x%x, cOrigin 0x%x\n",
24740 -                 hFile, lOffset, cOrigin);
24741 -
24742 -       /* check for valid file handle */
24743 -       if (MEM_IsValidHandle(hFile, SIGNATURE)) {
24744 -               /* based on the origin flag, move the internal pointer */
24745 -
24746 -       fileDesc = hFile->fileDesc;
24747 -               switch (cOrigin) {
24748 -               case KFILE_SEEK_SET:
24749 -                       dwCurPos = hFile->fileDesc->f_op->llseek(hFile->
24750 -                                  fileDesc, lOffset, SEEK_SET);
24751 -                       cRetVal = ((dwCurPos >= 0) ? 0 : E_KFILE_ERROR);
24752 -                       break;
24753 -
24754 -               case KFILE_SEEK_CUR:
24755 -                       dwCurPos = hFile->fileDesc->f_op->llseek(hFile->
24756 -                                  fileDesc, lOffset, SEEK_CUR);
24757 -                       cRetVal = ((dwCurPos >= 0) ? 0 : E_KFILE_ERROR);
24758 -                       break;
24759 -               case KFILE_SEEK_END:
24760 -                       dwCurPos = hFile->fileDesc->f_op->llseek(hFile->
24761 -                                  fileDesc, lOffset, SEEK_END);
24762 -                       cRetVal = ((dwCurPos >= 0) ? 0 : E_KFILE_ERROR);
24763 -                       break;
24764 -               default:
24765 -                       cRetVal = E_KFILE_BADORIGINFLAG;
24766 -                       GT_0trace(KFILE_debugMask, GT_6CLASS,
24767 -                                 "KFILE_Seek:bad origin flag\n");
24768 -                       break;
24769 -               }
24770 -       } else {
24771 -               cRetVal = E_KFILE_INVALIDHANDLE;
24772 -               GT_0trace(KFILE_debugMask, GT_6CLASS,
24773 -                         "KFILE_Seek:invalid file handle\n");
24774 -       }
24775 -       return cRetVal;
24776 -}
24777 -
24778 -/*
24779 - *  ======== KFILE_Tell ========
24780 - *  Purpose:
24781 - *      Reports the current value of the position indicator. We did not
24782 - *         consider 64 bit long file size, which implies a 4GB file limit
24783 - *      (2 to 32 power).
24784 - */
24785 -s32 KFILE_Tell(struct KFILE_FileObj *hFile)
24786 -{
24787 -       loff_t dwCurPos = 0;
24788 -       s32 lRetVal = E_KFILE_ERROR;
24789 -
24790 -       GT_1trace(KFILE_debugMask, GT_ENTER, "KFILE_Tell: hFile 0x%x\n", hFile);
24791 -
24792 -       if (MEM_IsValidHandle(hFile, SIGNATURE)) {
24793 -
24794 -               /* Get current position. */
24795 -               dwCurPos = hFile->fileDesc->f_op->llseek(hFile->fileDesc, 0,
24796 -                          SEEK_CUR);
24797 -               if (dwCurPos >= 0)
24798 -                       lRetVal = dwCurPos;
24799 -
24800 -       } else {
24801 -               lRetVal = E_KFILE_INVALIDHANDLE;
24802 -               GT_0trace(KFILE_debugMask, GT_6CLASS,
24803 -                         "KFILE_Seek:invalid file handle\n");
24804 -       }
24805 -       return lRetVal;
24806 -}
24807 -
24808 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/list.c kernel-power-2.6.28/drivers/dsp/bridge/services/list.c
24809 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/list.c 2011-04-17 17:32:26.000000000 +0100
24810 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/list.c      1970-01-01 01:00:00.000000000 +0100
24811 @@ -1,285 +0,0 @@
24812 -/*
24813 - * list.c
24814 - *
24815 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
24816 - *
24817 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
24818 - *
24819 - * This package is free software; you can redistribute it and/or modify
24820 - * it under the terms of the GNU General Public License version 2 as
24821 - * published by the Free Software Foundation.
24822 - *
24823 - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
24824 - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
24825 - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24826 - */
24827 -
24828 -
24829 -/*
24830 - *  ======== listce.c ========
24831 - *  Purpose
24832 - *      Provides standard circular list handling functions.
24833 - *
24834 - *  Public Functions:
24835 - *      LST_Create
24836 - *      LST_Delete
24837 - *      LST_Exit
24838 - *      LST_First
24839 - *      LST_GetHead
24840 - *      LST_Init
24841 - *      LST_InitElem
24842 - *      LST_InsertBefore
24843 - *      LST_Next
24844 - *      LST_PutTail
24845 - *      LST_RemoveElem
24846 - *
24847 - *! Revision History
24848 - *! ================
24849 - *! 06-Mar-2002 jeh Don't set element self to NULL in LST_RemoveElem().
24850 - *! 10-Aug-2000 ag: Added LST_InsertBefore().
24851 - *! 03-Feb-2000 rr: Module init/exit is handled by SERVICES Init/Exit.
24852 - *!             GT Changes.
24853 - *! 22-Nov-1999 kc: Added changes from code review.
24854 - *! 10-Aug-1999 kc: Based on wsx-c18.
24855 - *! 16-Jun-1997 gp: Removed unnecessary enabling/disabling of interrupts around
24856 - *!                 list manipulation code.
24857 - *! 22-Oct-1996 gp: Added LST_RemoveElem, and LST_First/LST_Next iterators.
24858 - *! 10-Aug-1996 gp: Acquired from SMM for WinSPOX v. 1.1; renamed identifiers.
24859 - */
24860 -
24861 -/*  ----------------------------------- DSP/BIOS Bridge */
24862 -#include <dspbridge/std.h>
24863 -#include <dspbridge/dbdefs.h>
24864 -
24865 -/*  ----------------------------------- Trace & Debug */
24866 -#include <dspbridge/dbc.h>
24867 -#include <dspbridge/gt.h>
24868 -
24869 -/*  ----------------------------------- OS Adaptation Layer */
24870 -#include <dspbridge/mem.h>
24871 -
24872 -/*  ----------------------------------- This */
24873 -#include <dspbridge/list.h>
24874 -
24875 -/*  ----------------------------------- Globals */
24876 -#if GT_TRACE
24877 -static struct GT_Mask LST_debugMask = { NULL, NULL };  /* GT trace var. */
24878 -#endif
24879 -
24880 -/*
24881 - *  ======== LST_Create ========
24882 - *  Purpose:
24883 - *      Allocates and initializes a circular list.
24884 - */
24885 -struct LST_LIST *LST_Create(void)
24886 -{
24887 -       struct LST_LIST *pList;
24888 -
24889 -       GT_0trace(LST_debugMask, GT_ENTER, "LST_Create: entered\n");
24890 -
24891 -       pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
24892 -               MEM_NONPAGED);
24893 -       if (pList != NULL) {
24894 -               pList->head.next = &pList->head;
24895 -               pList->head.prev = &pList->head;
24896 -               pList->head.self = NULL;
24897 -       }
24898 -
24899 -       return pList;
24900 -}
24901 -
24902 -/*
24903 - *  ======== LST_Delete ========
24904 - *  Purpose:
24905 - *      Removes a list by freeing its control structure's memory space.
24906 - */
24907 -void LST_Delete(struct LST_LIST *pList)
24908 -{
24909 -       DBC_Require(pList != NULL);
24910 -
24911 -       GT_1trace(LST_debugMask, GT_ENTER, "LST_Delete: pList 0x%x\n", pList);
24912 -
24913 -       MEM_Free(pList);
24914 -}
24915 -
24916 -/*
24917 - *  ======== LST_Exit ========
24918 - *  Purpose:
24919 - *      Discontinue usage of the LST module.
24920 - */
24921 -void LST_Exit(void)
24922 -{
24923 -       GT_0trace(LST_debugMask, GT_5CLASS, "LST_Exit\n");
24924 -}
24925 -
24926 -/*
24927 - *  ======== LST_First ========
24928 - *  Purpose:
24929 - *      Returns a pointer to the first element of the list, or NULL if the
24930 - *      list is empty.
24931 - */
24932 -struct LST_ELEM *LST_First(struct LST_LIST *pList)
24933 -{
24934 -       struct LST_ELEM *pElem = NULL;
24935 -
24936 -       DBC_Require(pList != NULL);
24937 -
24938 -       GT_1trace(LST_debugMask, GT_ENTER, "LST_First: pList 0x%x\n", pList);
24939 -
24940 -       if (!LST_IsEmpty(pList))
24941 -               pElem = pList->head.next;
24942 -
24943 -       return pElem;
24944 -}
24945 -
24946 -/*
24947 - *  ======== LST_GetHead ========
24948 - *  Purpose:
24949 - *      "Pops" the head off the list and returns a pointer to it.
24950 - */
24951 -struct LST_ELEM *LST_GetHead(struct LST_LIST *pList)
24952 -{
24953 -       struct LST_ELEM *pElem;
24954 -
24955 -       DBC_Require(pList != NULL);
24956 -
24957 -       GT_1trace(LST_debugMask, GT_ENTER, "LST_GetHead: pList 0x%x\n", pList);
24958 -
24959 -       if (LST_IsEmpty(pList))
24960 -               return NULL;
24961 -
24962 -       /* pElem is always valid because the list cannot be empty
24963 -        * at this point */
24964 -       pElem = pList->head.next;
24965 -       pList->head.next = pElem->next;
24966 -       pElem->next->prev = &pList->head;
24967 -
24968 -       return pElem->self;
24969 -}
24970 -
24971 -/*
24972 - *  ======== LST_Init ========
24973 - *  Purpose:
24974 - *      Initialize LST module private state.
24975 - */
24976 -bool LST_Init(void)
24977 -{
24978 -       GT_create(&LST_debugMask, "LS");        /* LS for LSt module */
24979 -
24980 -       GT_0trace(LST_debugMask, GT_5CLASS, "LST_Init\n");
24981 -
24982 -       return true;
24983 -}
24984 -
24985 -/*
24986 - *  ======== LST_InitElem ========
24987 - *  Purpose:
24988 - *      Initializes a list element to default (cleared) values
24989 - */
24990 -void LST_InitElem(struct LST_ELEM *pElem)
24991 -{
24992 -       DBC_Require(pElem != NULL);
24993 -
24994 -       GT_1trace(LST_debugMask, GT_ENTER, "LST_InitElem: pElem 0x%x\n", pElem);
24995 -
24996 -       if (pElem) {
24997 -               pElem->next = NULL;
24998 -               pElem->prev = NULL;
24999 -               pElem->self = pElem;
25000 -       }
25001 -}
25002 -
25003 -/*
25004 - *  ======== LST_InsertBefore ========
25005 - *  Purpose:
25006 - *      Insert the element before the existing element.
25007 - */
25008 -void LST_InsertBefore(struct LST_LIST *pList, struct LST_ELEM *pElem,
25009 -                     struct LST_ELEM *pElemExisting)
25010 -{
25011 -       DBC_Require(pList != NULL);
25012 -       DBC_Require(pElem != NULL);
25013 -       DBC_Require(pElemExisting != NULL);
25014 -
25015 -       GT_3trace(LST_debugMask, GT_ENTER, "LST_InsertBefore: pList 0x%x, "
25016 -                 "pElem 0x%x pElemExisting 0x%x\n", pList, pElem,
25017 -                 pElemExisting);
25018 -
25019 -       pElemExisting->prev->next = pElem;
25020 -       pElem->prev = pElemExisting->prev;
25021 -       pElem->next = pElemExisting;
25022 -       pElemExisting->prev = pElem;
25023 -}
25024 -
25025 -/*
25026 - *  ======== LST_Next ========
25027 - *  Purpose:
25028 - *      Returns a pointer to the next element of the list, or NULL if the
25029 - *      next element is the head of the list or the list is empty.
25030 - */
25031 -struct LST_ELEM *LST_Next(struct LST_LIST *pList, struct LST_ELEM *pCurElem)
25032 -{
25033 -       struct LST_ELEM *pNextElem = NULL;
25034 -
25035 -       DBC_Require(pList != NULL);
25036 -       DBC_Require(pCurElem != NULL);
25037 -
25038 -       GT_2trace(LST_debugMask, GT_ENTER,
25039 -                 "LST_Next: pList 0x%x, pCurElem 0x%x\n",
25040 -                 pList, pCurElem);
25041 -
25042 -       if (!LST_IsEmpty(pList)) {
25043 -               if (pCurElem->next != &pList->head)
25044 -                       pNextElem = pCurElem->next;
25045 -       }
25046 -
25047 -       return pNextElem;
25048 -}
25049 -
25050 -/*
25051 - *  ======== LST_PutTail ========
25052 - *  Purpose:
25053 - *      Adds the specified element to the tail of the list
25054 - */
25055 -void LST_PutTail(struct LST_LIST *pList, struct LST_ELEM *pElem)
25056 -{
25057 -       DBC_Require(pList != NULL);
25058 -       DBC_Require(pElem != NULL);
25059 -
25060 -       GT_2trace(LST_debugMask, GT_ENTER,
25061 -                 "LST_PutTail: pList 0x%x, pElem 0x%x\n",
25062 -                 pList, pElem);
25063 -
25064 -       pElem->prev = pList->head.prev;
25065 -       pElem->next = &pList->head;
25066 -       pList->head.prev = pElem;
25067 -       pElem->prev->next = pElem;
25068 -
25069 -       DBC_Ensure(!LST_IsEmpty(pList));
25070 -}
25071 -
25072 -/*
25073 - *  ======== LST_RemoveElem ========
25074 - *  Purpose:
25075 - *      Removes (unlinks) the given element from the list, if the list is not
25076 - *      empty.  Does not free the list element.
25077 - */
25078 -void LST_RemoveElem(struct LST_LIST *pList, struct LST_ELEM *pCurElem)
25079 -{
25080 -       DBC_Require(pList != NULL);
25081 -       DBC_Require(pCurElem != NULL);
25082 -
25083 -       GT_2trace(LST_debugMask, GT_ENTER,
25084 -                 "LST_RemoveElem: pList 0x%x, pCurElem "
25085 -                 "0x%x\n", pList, pCurElem);
25086 -
25087 -       if (!LST_IsEmpty(pList)) {
25088 -               pCurElem->prev->next = pCurElem->next;
25089 -               pCurElem->next->prev = pCurElem->prev;
25090 -
25091 -               /* set elem fields to NULL to prevent illegal references */
25092 -               pCurElem->next = NULL;
25093 -               pCurElem->prev = NULL;
25094 -       }
25095 -}
25096 -
25097 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/mem.c kernel-power-2.6.28/drivers/dsp/bridge/services/mem.c
25098 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/mem.c  2011-04-17 17:32:26.000000000 +0100
25099 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/mem.c       2011-05-02 22:36:50.000000000 +0100
25100 @@ -3,6 +3,8 @@
25101   *
25102   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
25103   *
25104 + * Implementation of platform specific memory services.
25105 + *
25106   * Copyright (C) 2005-2006 Texas Instruments, Inc.
25107   *
25108   * This package is free software; you can redistribute it and/or modify
25109 @@ -14,43 +16,6 @@
25110   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25111   */
25112  
25113 -
25114 -/*
25115 - *  ======== mem.c ========
25116 - *  Purpose:
25117 - *      Implementation of platform specific memory services.
25118 - *
25119 - *  Public Functions:
25120 - *      MEM_Alloc
25121 - *      MEM_AllocPhysMem
25122 - *      MEM_Calloc
25123 - *      MEM_Exit
25124 - *      MEM_FlushCache
25125 - *      MEM_Free
25126 - *      MEM_FreePhysMem
25127 - *      MEM_Init
25128 - *      MEM_ExtPhysPoolInit
25129 - *
25130 - *! Revision History:
25131 - *! =================
25132 - *! 18-Jan-2004 hp: Added support for External physical memory pool
25133 - *! 19-Apr-2004 sb: Added Alloc/Free PhysMem, FlushCache, VirtualToPhysical
25134 - *! 01-Sep-2001 ag: Code cleanup.
25135 - *! 02-May-2001 ag: MEM_[UnMap]LinearAddress revamped to align Phys to Virt.
25136 - *!             Set PAGE_PHYSICAL if phy addr <= 512MB. Opposite uSoft doc!
25137 - *! 29-Aug-2000 rr: MEM_LinearAddress does not check for 512MB for non-x86.
25138 - *! 28-Mar-2000 rr: MEM_LinearAddress changed.Handles address larger than 512MB
25139 - *! 03-Feb-2000 rr: Module init/exit is handled by SERVICES Init/Exit.
25140 - *!             GT Changes.
25141 - *! 22-Nov-1999 kc: Added changes from code review.
25142 - *! 16-Aug-1999 kc: modified for WinCE.
25143 - *! 20-Mar-1999 ag: SP 4 fix in MEM_UMBCalloc().
25144 - *!             Mdl offset now ORed not added to userBuf.
25145 - *! 23-Dec-1997 cr: Code review changes.
25146 - *! 08-Dec-1997 cr: Prepared for code review.
25147 - *! 24-Jun-1997 cr: Created.
25148 - */
25149 -
25150  /*  ----------------------------------- Host OS */
25151  #include <dspbridge/host_os.h>
25152  
25153 @@ -71,7 +36,7 @@
25154  #define MEM_512MB   0x1fffffff
25155  #define memInfoSign 0x464E494D /* "MINF" (in reverse). */
25156  
25157 -#ifdef DEBUG
25158 +#ifdef CONFIG_BRIDGE_DEBUG
25159  #define MEM_CHECK              /* Use to detect source of memory leaks */
25160  #endif
25161  
25162 @@ -80,8 +45,6 @@
25163  static struct GT_Mask MEM_debugMask = { NULL, NULL };  /* GT trace variable */
25164  #endif
25165  
25166 -static u32 cRefs;              /* module reference count */
25167 -
25168  static bool extPhysMemPoolEnabled;
25169  
25170  struct extPhysMemPool {
25171 @@ -95,7 +58,7 @@ static struct extPhysMemPool extMemPool;
25172  
25173  /*  Information about each element allocated on heap */
25174  struct memInfo {
25175 -       struct LST_ELEM link;           /* Must be first */
25176 +       struct list_head link;          /* Must be first */
25177         size_t size;
25178         void *caller;
25179         u32 dwSignature;        /* Should be last */
25180 @@ -119,17 +82,16 @@ static struct memMan mMan;
25181   *  These functions are similar to LST_PutTail and LST_RemoveElem and are
25182   *  duplicated here to make MEM independent of LST
25183   */
25184 -static inline void MLST_PutTail(struct LST_LIST *pList, struct LST_ELEM *pElem)
25185 +static inline void MLST_PutTail(struct LST_LIST *pList, struct list_head *pElem)
25186  {
25187         pElem->prev = pList->head.prev;
25188         pElem->next = &pList->head;
25189         pList->head.prev = pElem;
25190         pElem->prev->next = pElem;
25191 -       pElem->self = pElem;
25192  }
25193  
25194  static inline void MLST_RemoveElem(struct LST_LIST *pList,
25195 -                                  struct LST_ELEM *pCurElem)
25196 +                                  struct list_head *pCurElem)
25197  {
25198         pCurElem->prev->next = pCurElem->next;
25199         pCurElem->next->prev = pCurElem->prev;
25200 @@ -140,8 +102,8 @@ static inline void MLST_RemoveElem(struc
25201  static void MEM_Check(void)
25202  {
25203         struct memInfo *pMem;
25204 -       struct LST_ELEM *last = &mMan.lst.head;
25205 -       struct LST_ELEM *curr = mMan.lst.head.next;
25206 +       struct list_head *last = &mMan.lst.head;
25207 +       struct list_head *curr = last->next;
25208  
25209         if (!LST_IsEmpty(&mMan.lst)) {
25210                 GT_0trace(MEM_debugMask, GT_7CLASS, "*** MEMORY LEAK ***\n");
25211 @@ -157,7 +119,7 @@ static void MEM_Check(void)
25212                                         (u32) pMem + sizeof(struct memInfo),
25213                                         pMem->size, pMem->caller);
25214                                 MLST_RemoveElem(&mMan.lst,
25215 -                                               (struct LST_ELEM *) pMem);
25216 +                                               (struct list_head *)pMem);
25217                                 kfree(pMem);
25218                         } else {
25219                                 GT_1trace(MEM_debugMask, GT_7CLASS,
25220 @@ -199,7 +161,7 @@ void MEM_ExtPhysPoolInit(u32 poolPhysBas
25221         }
25222  }
25223  
25224 -static void MEM_ExtPhysPoolRelease(void)
25225 +void MEM_ExtPhysPoolRelease(void)
25226  {
25227         GT_0trace(MEM_debugMask, GT_1CLASS,
25228                   "Releasing External memory pool \n");
25229 @@ -293,7 +255,7 @@ void *MEM_Alloc(u32 cBytes, enum MEM_POO
25230  
25231                                 spin_lock(&mMan.lock);
25232                                 MLST_PutTail(&mMan.lst,
25233 -                                           (struct LST_ELEM *)pMem);
25234 +                                           (struct list_head *)pMem);
25235                                 spin_unlock(&mMan.lock);
25236  
25237                                 pMem = (void *)((u32)pMem +
25238 @@ -313,7 +275,7 @@ void *MEM_Alloc(u32 cBytes, enum MEM_POO
25239  
25240                                 spin_lock(&mMan.lock);
25241                                 MLST_PutTail(&mMan.lst,
25242 -                                           (struct LST_ELEM *) pMem);
25243 +                                           (struct list_head *)pMem);
25244                                 spin_unlock(&mMan.lock);
25245  
25246                                 pMem = (void *)((u32)pMem +
25247 @@ -343,8 +305,6 @@ void *MEM_AllocPhysMem(u32 cBytes, u32 u
25248         void *pVaMem = NULL;
25249         dma_addr_t paMem;
25250  
25251 -       DBC_Require(cRefs > 0);
25252 -
25253         GT_2trace(MEM_debugMask, GT_ENTER,
25254                   "MEM_AllocPhysMem: cBytes 0x%x\tulAlign"
25255                   "0x%x\n", cBytes, ulAlign);
25256 @@ -403,7 +363,7 @@ void *MEM_Calloc(u32 cBytes, enum MEM_PO
25257                                 pMem->dwSignature = memInfoSign;
25258                                 spin_lock(&mMan.lock);
25259                                 MLST_PutTail(&mMan.lst,
25260 -                                       (struct LST_ELEM *) pMem);
25261 +                                       (struct list_head *)pMem);
25262                                 spin_unlock(&mMan.lock);
25263                                 pMem = (void *)((u32)pMem +
25264                                         sizeof(struct memInfo));
25265 @@ -424,8 +384,8 @@ void *MEM_Calloc(u32 cBytes, enum MEM_PO
25266                                 pMem->caller = __builtin_return_address(0);
25267                                 pMem->dwSignature = memInfoSign;
25268                                 spin_lock(&mMan.lock);
25269 -                               MLST_PutTail(&mMan.lst, (struct LST_ELEM *)
25270 -                                       pMem);
25271 +                               MLST_PutTail(&mMan.lst,
25272 +                                               (struct list_head *)pMem);
25273                                 spin_unlock(&mMan.lock);
25274                                 pMem = (void *)((u32)pMem +
25275                                         sizeof(struct memInfo));
25276 @@ -450,18 +410,9 @@ void *MEM_Calloc(u32 cBytes, enum MEM_PO
25277   */
25278  void MEM_Exit(void)
25279  {
25280 -       DBC_Require(cRefs > 0);
25281 -
25282 -       GT_1trace(MEM_debugMask, GT_5CLASS, "MEM_Exit: cRefs 0x%x\n", cRefs);
25283 -
25284 -       cRefs--;
25285  #ifdef MEM_CHECK
25286 -       if (cRefs == 0)
25287 -               MEM_Check();
25288 -
25289 +       MEM_Check();
25290  #endif
25291 -       MEM_ExtPhysPoolRelease();
25292 -       DBC_Ensure(cRefs >= 0);
25293  }
25294  
25295  /*
25296 @@ -471,7 +422,8 @@ void MEM_Exit(void)
25297   */
25298  void MEM_FlushCache(void *pMemBuf, u32 cBytes, s32 FlushType)
25299  {
25300 -       DBC_Require(cRefs > 0);
25301 +       if (!pMemBuf)
25302 +               return;
25303  
25304         switch (FlushType) {
25305         /* invalidate only */
25306 @@ -492,10 +444,6 @@ void MEM_FlushCache(void *pMemBuf, u32 c
25307                 outer_flush_range(__pa((u32)pMemBuf), __pa((u32)pMemBuf +
25308                                   cBytes));
25309         break;
25310 -       default:
25311 -               GT_1trace(MEM_debugMask, GT_6CLASS, "MEM_FlushCache: invalid "
25312 -                         "FlushMemType 0x%x\n", FlushType);
25313 -       break;
25314         }
25315  
25316  }
25317 @@ -524,7 +472,7 @@ void MEM_VFree(IN void *pMemBuf)
25318                         if (pMem->dwSignature == memInfoSign) {
25319                                 spin_lock(&mMan.lock);
25320                                 MLST_RemoveElem(&mMan.lst,
25321 -                                               (struct LST_ELEM *) pMem);
25322 +                                               (struct list_head *)pMem);
25323                                 spin_unlock(&mMan.lock);
25324                                 pMem->dwSignature = 0;
25325                                 vfree(pMem);
25326 @@ -563,7 +511,7 @@ void MEM_Free(IN void *pMemBuf)
25327                         if (pMem->dwSignature == memInfoSign) {
25328                                 spin_lock(&mMan.lock);
25329                                 MLST_RemoveElem(&mMan.lst,
25330 -                                               (struct LST_ELEM *) pMem);
25331 +                                               (struct list_head *)pMem);
25332                                 spin_unlock(&mMan.lock);
25333                                 pMem->dwSignature = 0;
25334                                 kfree(pMem);
25335 @@ -586,7 +534,6 @@ void MEM_Free(IN void *pMemBuf)
25336  void MEM_FreePhysMem(void *pVirtualAddress, u32 pPhysicalAddress,
25337                      u32 cBytes)
25338  {
25339 -       DBC_Require(cRefs > 0);
25340         DBC_Require(pVirtualAddress != NULL);
25341  
25342         GT_1trace(MEM_debugMask, GT_ENTER, "MEM_FreePhysMem: pVirtualAddress "
25343 @@ -604,25 +551,13 @@ void MEM_FreePhysMem(void *pVirtualAddre
25344   */
25345  bool MEM_Init(void)
25346  {
25347 -       DBC_Require(cRefs >= 0);
25348 -
25349 -       if (cRefs == 0) {
25350 -               GT_create(&MEM_debugMask, "MM");        /* MM for MeM module */
25351 +       GT_create(&MEM_debugMask, "MM");        /* MM for MeM module */
25352  
25353  #ifdef MEM_CHECK
25354 -               mMan.lst.head.next = &mMan.lst.head;
25355 -               mMan.lst.head.prev = &mMan.lst.head;
25356 -               mMan.lst.head.self = NULL;
25357 -               spin_lock_init(&mMan.lock);
25358 +       mMan.lst.head.next = &mMan.lst.head;
25359 +       mMan.lst.head.prev = &mMan.lst.head;
25360 +       spin_lock_init(&mMan.lock);
25361  #endif
25362  
25363 -       }
25364 -
25365 -       cRefs++;
25366 -
25367 -       GT_1trace(MEM_debugMask, GT_5CLASS, "MEM_Init: cRefs 0x%x\n", cRefs);
25368 -
25369 -       DBC_Ensure(cRefs > 0);
25370 -
25371         return true;
25372  }
25373 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/ntfy.c kernel-power-2.6.28/drivers/dsp/bridge/services/ntfy.c
25374 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/ntfy.c 2011-04-17 17:32:26.000000000 +0100
25375 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/ntfy.c      2011-05-02 22:36:50.000000000 +0100
25376 @@ -3,6 +3,8 @@
25377   *
25378   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
25379   *
25380 + * Manage lists of notification events.
25381 + *
25382   * Copyright (C) 2005-2006 Texas Instruments, Inc.
25383   *
25384   * This package is free software; you can redistribute it and/or modify
25385 @@ -14,31 +16,6 @@
25386   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25387   */
25388  
25389 -
25390 -/*
25391 - *  ======== ntfyce.c ========
25392 - *  Purpose:
25393 - *      Manage lists of notification events.
25394 - *
25395 - *  Public Functions:
25396 - *      NTFY_Create
25397 - *      NTFY_Delete
25398 - *      NTFY_Exit
25399 - *      NTFY_Init
25400 - *      NTFY_Notify
25401 - *      NTFY_Register
25402 - *
25403 - *! Revision History:
25404 - *! =================
25405 - *! 06-Feb-2003 kc      Removed DSP_POSTMESSAGE related code.
25406 - *! 05-Nov-2001 kc      Updated DSP_HNOTIFICATION structure.
25407 - *! 10-May-2001 jeh     Removed SERVICES module init/exit from NTFY_Init/Exit.
25408 - *!                     NTFY_Register() returns DSP_ENOTIMPL for all but
25409 - *!                     DSP_SIGNALEVENT.
25410 - *! 12-Oct-2000 jeh     Use MEM_IsValidHandle().
25411 - *! 07-Sep-2000 jeh     Created.
25412 - */
25413 -
25414  /*  ----------------------------------- Host OS */
25415  #include <dspbridge/host_os.h>
25416  
25417 @@ -52,7 +29,6 @@
25418  #include <dspbridge/gt.h>
25419  
25420  /*  ----------------------------------- OS Adaptation Layer */
25421 -#include <dspbridge/csl.h>
25422  #include <dspbridge/list.h>
25423  #include <dspbridge/mem.h>
25424  #include <dspbridge/sync.h>
25425 @@ -77,7 +53,7 @@ struct NTFY_OBJECT {
25426   *  This object will be created when a client registers for events.
25427   */
25428  struct NOTIFICATION {
25429 -       struct LST_ELEM listElem;
25430 +       struct list_head listElem;
25431         u32 uEventMask; /* Events to be notified about */
25432         u32 uNotifyType;        /* Type of notification to be sent */
25433  
25434 @@ -117,12 +93,14 @@ DSP_STATUS NTFY_Create(struct NTFY_OBJEC
25435  
25436                 status = SYNC_InitializeDPCCS(&pNtfy->hSync);
25437                 if (DSP_SUCCEEDED(status)) {
25438 -                       pNtfy->notifyList = LST_Create();
25439 +                       pNtfy->notifyList = MEM_Calloc(sizeof(struct LST_LIST),
25440 +                                                       MEM_NONPAGED);
25441                         if (pNtfy->notifyList == NULL) {
25442                                 (void) SYNC_DeleteCS(pNtfy->hSync);
25443                                 MEM_FreeObject(pNtfy);
25444                                 status = DSP_EMEMORY;
25445                         } else {
25446 +                               INIT_LIST_HEAD(&pNtfy->notifyList->head);
25447                                 *phNtfy = pNtfy;
25448                         }
25449                 }
25450 @@ -155,7 +133,7 @@ void NTFY_Delete(struct NTFY_OBJECT *hNt
25451                         DeleteNotify(pNotify);
25452                 }
25453                 DBC_Assert(LST_IsEmpty(hNtfy->notifyList));
25454 -               LST_Delete(hNtfy->notifyList);
25455 +               MEM_Free(hNtfy->notifyList);
25456         }
25457         if (hNtfy->hSync)
25458                 (void)SYNC_DeleteCS(hNtfy->hSync);
25459 @@ -216,7 +194,7 @@ void NTFY_Notify(struct NTFY_OBJECT *hNt
25460  
25461                 }
25462                 pNotify = (struct NOTIFICATION *)LST_Next(hNtfy->notifyList,
25463 -                         (struct LST_ELEM *)pNotify);
25464 +                         (struct list_head *)pNotify);
25465         }
25466  
25467         (void) SYNC_LeaveCS(hNtfy->hSync);
25468 @@ -265,7 +243,7 @@ DSP_STATUS NTFY_Register(struct NTFY_OBJ
25469                         break;
25470                 }
25471                 pNotify = (struct NOTIFICATION *)LST_Next(hNtfy->notifyList,
25472 -                         (struct LST_ELEM *)pNotify);
25473 +                         (struct list_head *)pNotify);
25474         }
25475         if (pNotify == NULL) {
25476                 /* Not registered */
25477 @@ -280,7 +258,7 @@ DSP_STATUS NTFY_Register(struct NTFY_OBJ
25478  
25479                 }
25480                 if (DSP_SUCCEEDED(status)) {
25481 -                       LST_InitElem((struct LST_ELEM *) pNotify);
25482 +                       LST_InitElem((struct list_head *)pNotify);
25483                          /* If there is more than one notification type, each
25484                          * type may require its own handler code. */
25485                         status = SYNC_OpenEvent(&pNotify->hSync, &syncAttrs);
25486 @@ -290,7 +268,7 @@ DSP_STATUS NTFY_Register(struct NTFY_OBJ
25487                                 pNotify->uEventMask = uEventMask;
25488                                 pNotify->uNotifyType = uNotifyType;
25489                                 LST_PutTail(hNtfy->notifyList,
25490 -                                          (struct LST_ELEM *)pNotify);
25491 +                                          (struct list_head *)pNotify);
25492                         } else {
25493                                 DeleteNotify(pNotify);
25494                         }
25495 @@ -300,7 +278,7 @@ DSP_STATUS NTFY_Register(struct NTFY_OBJ
25496                 if (uEventMask == 0) {
25497                         /* Remove from list and free */
25498                         LST_RemoveElem(hNtfy->notifyList,
25499 -                                     (struct LST_ELEM *)pNotify);
25500 +                                     (struct list_head *)pNotify);
25501                         DeleteNotify(pNotify);
25502                 } else {
25503                         /* Update notification mask (type shouldn't change) */
25504 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/reg.c kernel-power-2.6.28/drivers/dsp/bridge/services/reg.c
25505 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/reg.c  2011-04-17 17:32:26.000000000 +0100
25506 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/reg.c       2011-05-02 22:36:50.000000000 +0100
25507 @@ -3,6 +3,8 @@
25508   *
25509   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
25510   *
25511 + * Provide registry functions.
25512 + *
25513   * Copyright (C) 2005-2006 Texas Instruments, Inc.
25514   *
25515   * This package is free software; you can redistribute it and/or modify
25516 @@ -14,25 +16,6 @@
25517   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25518   */
25519  
25520 -
25521 -/*
25522 - *  ======== regce.c ========
25523 - *  Purpose:
25524 - *      Provide registry functions.
25525 - *
25526 - *  Public Functions:
25527 - *      REG_DeleteValue
25528 - *      REG_EnumValue
25529 - *      REG_Exit
25530 - *      REG_GetValue
25531 - *      REG_Init
25532 - *      REG_SetValue
25533 - *
25534 - *! Revision History:
25535 - *! ================
25536 - *
25537 - */
25538 -
25539  /*  ----------------------------------- Host OS */
25540  #include <dspbridge/host_os.h>
25541  
25542 @@ -46,12 +29,8 @@
25543  #include <dspbridge/gt.h>
25544  
25545  /*  ----------------------------------- OS Adaptation Layer */
25546 -#include <dspbridge/csl.h>
25547  #include <dspbridge/mem.h>
25548  
25549 -/*  ----------------------------------- Others */
25550 -#include <dspbridge/dbreg.h>
25551 -
25552  /*  ----------------------------------- This */
25553  #include <dspbridge/reg.h>
25554  #include <regsup.h>
25555 @@ -65,22 +44,14 @@ struct GT_Mask REG_debugMask = { NULL, N
25556   *  Deletes a registry entry value.  NOTE:  A registry entry value is not the
25557   *  same as *  a registry key.
25558   */
25559 -DSP_STATUS REG_DeleteValue(OPTIONAL IN HANDLE *phKey, IN CONST char *pstrSubkey,
25560 -                          IN CONST char *pstrValue)
25561 +DSP_STATUS REG_DeleteValue(IN CONST char *pstrValue)
25562  {
25563         DSP_STATUS status;
25564 -       DBC_Require(pstrSubkey && pstrValue);
25565 -       DBC_Require(phKey == NULL);
25566 -       DBC_Require(strlen(pstrSubkey) < REG_MAXREGPATHLENGTH);
25567 -       DBC_Require(strlen(pstrValue) < REG_MAXREGPATHLENGTH);
25568 +       DBC_Require(strlen(pstrValue) < REG_MAXREGPATHLENGTH);
25569  
25570         GT_0trace(REG_debugMask, GT_ENTER, "REG_DeleteValue: entered\n");
25571  
25572 -       /*  Note that we don't use phKey */
25573 -       if (regsupDeleteValue(pstrSubkey, pstrValue) == DSP_SOK)
25574 -               status = DSP_SOK;
25575 -       else
25576 -               status = DSP_EFAIL;
25577 +       status = regsupDeleteValue(pstrValue);
25578  
25579         return status;
25580  }
25581 @@ -91,7 +62,7 @@ DSP_STATUS REG_DeleteValue(OPTIONAL IN H
25582   *  We will assume the input pdwValueSize is smaller than
25583   *  REG_MAXREGPATHLENGTH for implementation purposes.
25584   */
25585 -DSP_STATUS REG_EnumValue(IN HANDLE *phKey, IN u32 dwIndex,
25586 +DSP_STATUS REG_EnumValue(IN u32 dwIndex,
25587                          IN CONST char *pstrKey, IN OUT char *pstrValue,
25588                          IN OUT u32 *pdwValueSize, IN OUT char *pstrData,
25589                          IN OUT u32 *pdwDataSize)
25590 @@ -101,7 +72,6 @@ DSP_STATUS REG_EnumValue(IN HANDLE *phKe
25591         DBC_Require(pstrKey && pstrValue && pdwValueSize && pstrData &&
25592                     pdwDataSize);
25593         DBC_Require(*pdwValueSize <= REG_MAXREGPATHLENGTH);
25594 -       DBC_Require(phKey == NULL);
25595         DBC_Require(strlen(pstrKey) < REG_MAXREGPATHLENGTH);
25596  
25597         GT_0trace(REG_debugMask, GT_ENTER, "REG_EnumValue: entered\n");
25598 @@ -127,15 +97,12 @@ void REG_Exit(void)
25599   *  ======== REG_GetValue ========
25600   *  Retrieve a value from the registry.
25601   */
25602 -DSP_STATUS REG_GetValue(OPTIONAL IN HANDLE *phKey, IN CONST char *pstrSubkey,
25603 -                       IN CONST char *pstrValue, OUT u8 *pbData,
25604 +DSP_STATUS REG_GetValue(IN CONST char *pstrValue, OUT u8 *pbData,
25605                         IN OUT u32 *pdwDataSize)
25606  {
25607         DSP_STATUS status;
25608  
25609 -       DBC_Require(pstrSubkey && pstrValue && pbData);
25610 -       DBC_Require(phKey == NULL);
25611 -       DBC_Require(strlen(pstrSubkey) < REG_MAXREGPATHLENGTH);
25612 +       DBC_Require(pstrValue && pbData);
25613         DBC_Require(strlen(pstrValue) < REG_MAXREGPATHLENGTH);
25614  
25615         GT_0trace(REG_debugMask, GT_ENTER, "REG_GetValue: entered\n");
25616 @@ -172,24 +139,21 @@ bool REG_Init(void)
25617   *  ======== REG_SetValue ========
25618   *  Set a value in the registry.
25619   */
25620 -DSP_STATUS REG_SetValue(OPTIONAL IN HANDLE *phKey, IN CONST char *pstrSubkey,
25621 -                       IN CONST char *pstrValue, IN CONST u32 dwType,
25622 -                       IN u8 *pbData, IN u32 dwDataSize)
25623 +DSP_STATUS REG_SetValue(IN CONST char *pstrValue, IN u8 *pbData,
25624 +                       IN u32 dwDataSize)
25625  {
25626         DSP_STATUS status;
25627  
25628         DBC_Require(pstrValue && pbData);
25629 -       DBC_Require(phKey == NULL);
25630         DBC_Require(dwDataSize > 0);
25631 -       DBC_Require(strlen(pstrValue) < REG_MAXREGPATHLENGTH);
25632 +       DBC_Require(strlen(pstrValue) < REG_MAXREGPATHLENGTH);
25633  
25634 -       /*  We need to use regsup calls...  */
25635 -       /*  ...for now we don't need the key handle or  */
25636 -       /*  the subkey, all we need is the value to lookup.  */
25637 -       if (regsupSetValue((char *)pstrValue, pbData, dwDataSize) == DSP_SOK)
25638 -               status = DSP_SOK;
25639 -       else
25640 -               status = DSP_EFAIL;
25641 +       /*
25642 +        * We need to use regsup calls
25643 +        * for now we don't need the key handle or
25644 +        * the subkey, all we need is the value to lookup.
25645 +        */
25646 +       status = regsupSetValue((char *)pstrValue, pbData, dwDataSize);
25647  
25648         return status;
25649  }
25650 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/regsup.c kernel-power-2.6.28/drivers/dsp/bridge/services/regsup.c
25651 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/regsup.c       2011-04-17 17:32:26.000000000 +0100
25652 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/regsup.c    2011-05-02 22:36:50.000000000 +0100
25653 @@ -3,6 +3,8 @@
25654   *
25655   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
25656   *
25657 + * Provide registry support functions.
25658 + *
25659   * Copyright (C) 2005-2006 Texas Instruments, Inc.
25660   *
25661   * This package is free software; you can redistribute it and/or modify
25662 @@ -14,20 +16,6 @@
25663   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25664   */
25665  
25666 -
25667 -/*
25668 - *  ======== regsup.c ========
25669 - *  Purpose:
25670 - *      Provide registry support functions.
25671 - *
25672 - *! Revision History:
25673 - *! ================
25674 - *! 28-May-2002  map: Integrated PSI's dspimage update mechanism
25675 - *! 11-May-2002  gp:  Turned PERF "on".
25676 - *! 21-May-2002  map: Fixed bug in SetValue - if resizing datasize, set
25677 - *!                  new size too
25678 - */
25679 -
25680  /*  ----------------------------------- Host OS */
25681  #include <dspbridge/host_os.h>
25682  
25683 @@ -35,7 +23,6 @@
25684  #include <dspbridge/std.h>
25685  #include <dspbridge/dbdefs.h>
25686  #include <dspbridge/errbase.h>
25687 -#include <dspbridge/dbreg.h>
25688  
25689  /*  ----------------------------------- Trace & Debug */
25690  #include <dspbridge/dbc.h>
25691 @@ -43,50 +30,23 @@
25692  
25693  /*  ----------------------------------- OS Adaptation Layer */
25694  #include <dspbridge/mem.h>
25695 -#include <dspbridge/csl.h>
25696 +#include <dspbridge/list.h>
25697  
25698  /*  ----------------------------------- This */
25699  #include <regsup.h>
25700  
25701 -struct RegValueStruct {
25702 -       char name[BRIDGE_MAX_NAME_SIZE];   /*  Name of a given value entry  */
25703 +struct RegValue {
25704 +       struct list_head link;  /* Make it linked to a list */
25705 +       char name[MAXREGPATHLENGTH];   /*  Name of a given value entry  */
25706         u32 dataSize;           /*  Size of the data  */
25707         void *pData;            /*  Pointer to the actual data  */
25708  };
25709  
25710 -struct RegKeyStruct {
25711 -       /*The current number of value entries this key has*/
25712 -       u32 numValueEntries;
25713 -       /* Array of value entries */
25714 -       struct RegValueStruct values[BRIDGE_MAX_NUM_REG_ENTRIES];
25715 -};
25716 -
25717 -
25718  /*  Pointer to the registry support key  */
25719 -static struct RegKeyStruct *pRegKey;
25720 +static struct LST_LIST regKey, *pRegKey = &regKey;
25721  
25722  #if GT_TRACE
25723  extern struct GT_Mask REG_debugMask;   /* GT trace var. */
25724 -/*
25725 - *  ======== printS ========
25726 - *  Purpose:
25727 - *      Displays printable characters in pBuf, if any.
25728 - */
25729 -static inline void printS(void *pBuf)
25730 -{
25731 -       int pos = 0;
25732 -       if (*(REG_debugMask).flags & (GT_2CLASS)) {
25733 -               while (*(u8 *)((pBuf)+pos) >= ' ' &&
25734 -                      *(u8 *)((pBuf)+pos) <= '~') {
25735 -                       GT_1trace(REG_debugMask, GT_2CLASS, "%c",
25736 -                                       *(u8 *)((pBuf) + pos++));
25737 -               }
25738 -
25739 -               GT_0trace(REG_debugMask, GT_2CLASS, "\n");
25740 -       }
25741 -}
25742 -#else
25743 -#define printS(pBuf)
25744  #endif
25745  
25746  /*
25747 @@ -96,14 +56,7 @@ static inline void printS(void *pBuf)
25748   */
25749  bool regsupInit(void)
25750  {
25751 -       if (pRegKey != NULL)
25752 -               return true;
25753 -
25754 -       /*  Need to allocate and setup our registry.  */
25755 -       pRegKey = MEM_Calloc(sizeof(struct RegKeyStruct), MEM_NONPAGED);
25756 -       if (pRegKey == NULL)
25757 -               return false;
25758 -
25759 +       INIT_LIST_HEAD(&pRegKey->head);
25760         return true;
25761  }
25762  
25763 @@ -114,41 +67,14 @@ bool regsupInit(void)
25764   */
25765  void regsupExit(void)
25766  {
25767 -       u32 i;
25768 -
25769 -       /*  Make sure data has actually been allocated.  */
25770 -       if (pRegKey == NULL) {
25771 -               /*  Nothing initialized.return!  */
25772 -               return;
25773 -       }
25774 -
25775 -       GT_1trace(REG_debugMask, GT_2CLASS, "pRegKey->numValueEntries %d\n",
25776 -                 pRegKey->numValueEntries);
25777 -
25778 +       struct RegValue *rv;
25779         /*  Now go through each entry and free all resources.  */
25780 -       for (i = 0; ((i < BRIDGE_MAX_NUM_REG_ENTRIES) &&
25781 -           (i < pRegKey->numValueEntries)); i++) {
25782 -               if (pRegKey->values[i].name[0] != '\0') {
25783 -                       /*  We have a valid entry.free it up!  */
25784 -                       if (pRegKey->values[i].pData != NULL) {
25785 -                               GT_3trace(REG_debugMask, GT_2CLASS,
25786 -                                         "E %d\t %s DATA %x ", i,
25787 -                                         pRegKey->values[i].name,
25788 -                                         *(u32 *)pRegKey->values[i].pData);
25789 -                               printS((u8 *)(pRegKey->values[i].pData));
25790 -                               MEM_Free(pRegKey->values[i].pData);
25791 -                       }
25792 -                       pRegKey->values[i].pData = NULL;
25793 -                       pRegKey->values[i].dataSize = 0;
25794 -                       pRegKey->values[i].name[0] = '\0';
25795 -               }
25796 -       }
25797 -
25798 -       /*  Now that all of the resources are freed up, free the main one!  */
25799 -       MEM_Free(pRegKey);
25800 +       while (!LST_IsEmpty(pRegKey)) {
25801 +               rv = (struct RegValue *) LST_GetHead(pRegKey);
25802  
25803 -       /*  Don't forget to NULL out the global entry!  */
25804 -       pRegKey = NULL;
25805 +               MEM_Free(rv->pData);
25806 +               MEM_Free(rv);
25807 +       }
25808  }
25809  
25810  /*
25811 @@ -159,31 +85,29 @@ void regsupExit(void)
25812  DSP_STATUS regsupGetValue(char *valName, void *pBuf, u32 *dataSize)
25813  {
25814         DSP_STATUS retVal = DSP_EFAIL;
25815 -       u32 i;
25816 +       struct RegValue *rv = (struct RegValue *) LST_First(pRegKey);
25817  
25818         /*  Need to search through the entries looking for the right one.  */
25819 -       for (i = 0; i < pRegKey->numValueEntries; i++) {
25820 +       while (rv) {
25821                 /*  See if the name matches.  */
25822 -               if (strncmp(pRegKey->values[i].name, valName,
25823 -                   BRIDGE_MAX_NAME_SIZE) == 0) {
25824 -
25825 +               if (strncmp(rv->name, valName, MAXREGPATHLENGTH) == 0) {
25826                         /*  We have a match!  Copy out the data.  */
25827 -                       memcpy(pBuf, pRegKey->values[i].pData,
25828 -                              pRegKey->values[i].dataSize);
25829 +                       memcpy(pBuf, rv->pData, rv->dataSize);
25830  
25831                         /*  Get the size for the caller.  */
25832 -                       *dataSize = pRegKey->values[i].dataSize;
25833 +                       *dataSize = rv->dataSize;
25834  
25835                         /*  Set our status to good and exit.  */
25836                         retVal = DSP_SOK;
25837                         break;
25838                 }
25839 +               rv = (struct RegValue *) LST_Next(pRegKey,
25840 +                                               (struct list_head *) rv);
25841         }
25842  
25843         if (DSP_SUCCEEDED(retVal)) {
25844                 GT_2trace(REG_debugMask, GT_2CLASS, "G %s DATA %x ", valName,
25845                           *(u32 *)pBuf);
25846 -               printS((u8 *)pBuf);
25847         } else {
25848                 GT_1trace(REG_debugMask, GT_3CLASS, "G %s FAILED\n", valName);
25849         }
25850 @@ -199,65 +123,51 @@ DSP_STATUS regsupGetValue(char *valName,
25851  DSP_STATUS regsupSetValue(char *valName, void *pBuf, u32 dataSize)
25852  {
25853         DSP_STATUS retVal = DSP_EFAIL;
25854 -       u32 i;
25855 +       struct RegValue *rv = (struct RegValue *) LST_First(pRegKey);
25856  
25857         GT_2trace(REG_debugMask, GT_2CLASS, "S %s DATA %x ", valName,
25858                   *(u32 *)pBuf);
25859 -       printS((u8 *)pBuf);
25860  
25861         /*  Need to search through the entries looking for the right one.  */
25862 -       for (i = 0; i < pRegKey->numValueEntries; i++) {
25863 +       while (rv) {
25864                 /*  See if the name matches.  */
25865 -               if (strncmp(pRegKey->values[i].name, valName,
25866 -                   BRIDGE_MAX_NAME_SIZE) == 0) {
25867 +               if (strncmp(rv->name, valName, MAXREGPATHLENGTH) == 0) {
25868                         /*  Make sure the new data size is the same.  */
25869 -                       if (dataSize != pRegKey->values[i].dataSize) {
25870 +                       if (dataSize != rv->dataSize) {
25871                                 /*  The caller needs a different data size!  */
25872 -                               MEM_Free(pRegKey->values[i].pData);
25873 -                               pRegKey->values[i].pData = MEM_Alloc(dataSize,
25874 -                                                          MEM_NONPAGED);
25875 -                               if (pRegKey->values[i].pData == NULL)
25876 +                               MEM_Free(rv->pData);
25877 +                               rv->pData = MEM_Alloc(dataSize, MEM_NONPAGED);
25878 +                               if (rv->pData == NULL)
25879                                         break;
25880 -
25881                         }
25882  
25883                         /*  We have a match!  Copy out the data.  */
25884 -                       memcpy(pRegKey->values[i].pData, pBuf, dataSize);
25885 +                       memcpy(rv->pData, pBuf, dataSize);
25886  
25887                         /* Reset datasize - overwrite if new or same */
25888 -                       pRegKey->values[i].dataSize = dataSize;
25889 +                       rv->dataSize = dataSize;
25890  
25891                         /*  Set our status to good and exit.  */
25892                         retVal = DSP_SOK;
25893                         break;
25894                 }
25895 +              rv = (struct RegValue *) LST_Next(pRegKey,
25896 +                                       (struct list_head *) rv);
25897         }
25898  
25899         /*  See if we found a match or if this is a new entry  */
25900 -       if (i == pRegKey->numValueEntries) {
25901 +       if (!rv) {
25902                 /*  No match, need to make a new entry  */
25903 -               /*  First check to see if we can make any more entries.  */
25904 -               if (pRegKey->numValueEntries < BRIDGE_MAX_NUM_REG_ENTRIES) {
25905 -                       char *tmp_name =
25906 -                               pRegKey->values[pRegKey->numValueEntries].name;
25907 -                       strncpy(tmp_name, valName, BRIDGE_MAX_NAME_SIZE - 1);
25908 -                       tmp_name[BRIDGE_MAX_NAME_SIZE - 1] = '\0';
25909 -                       pRegKey->values[pRegKey->numValueEntries].pData =
25910 -                                       MEM_Alloc(dataSize, MEM_NONPAGED);
25911 -                       if (pRegKey->values[pRegKey->numValueEntries].pData !=
25912 -                                                                       NULL) {
25913 -                               memcpy(pRegKey->
25914 -                                       values[pRegKey->numValueEntries].pData,
25915 -                                       pBuf, dataSize);
25916 -                               pRegKey->
25917 -                                   values[pRegKey->numValueEntries].dataSize =
25918 -                                   dataSize;
25919 -                               pRegKey->numValueEntries++;
25920 -                               retVal = DSP_SOK;
25921 -                       }
25922 -               } else {
25923 -                       GT_0trace(REG_debugMask, GT_7CLASS,
25924 -                                 "MAX NUM REG ENTRIES REACHED\n");
25925 +               struct RegValue *new = MEM_Calloc(sizeof(struct RegValue),
25926 +                                               MEM_NONPAGED);
25927 +
25928 +               strncat(new->name, valName, MAXREGPATHLENGTH - 1);
25929 +               new->pData = MEM_Alloc(dataSize, MEM_NONPAGED);
25930 +               if (new->pData != NULL) {
25931 +                       memcpy(new->pData, pBuf, dataSize);
25932 +                       new->dataSize = dataSize;
25933 +                       LST_PutTail(pRegKey, (struct list_head *) new);
25934 +                       retVal = DSP_SOK;
25935                 }
25936         }
25937  
25938 @@ -274,7 +184,7 @@ DSP_STATUS regsupEnumValue(IN u32 dwInde
25939                            IN OUT char *pstrData, IN OUT u32 *pdwDataSize)
25940  {
25941         DSP_STATUS retVal = REG_E_INVALIDSUBKEY;
25942 -       u32 i;
25943 +       struct RegValue *rv = (struct RegValue *) LST_First(pRegKey);
25944         u32 dwKeyLen;
25945         u32 count = 0;
25946  
25947 @@ -282,28 +192,26 @@ DSP_STATUS regsupEnumValue(IN u32 dwInde
25948         dwKeyLen = strlen(pstrKey);
25949  
25950         /*  Need to search through the entries looking for the right one.  */
25951 -       for (i = 0; i < pRegKey->numValueEntries; i++) {
25952 +       while (rv) {
25953                 /*  See if the name matches.  */
25954 -               if ((strncmp(pRegKey->values[i].name, pstrKey,
25955 -                   dwKeyLen) == 0) && count++ == dwIndex) {
25956 +               if (strncmp(rv->name, pstrKey, dwKeyLen) == 0 &&
25957 +                       count++ == dwIndex) {
25958                         /*  We have a match!  Copy out the data.  */
25959 -                       memcpy(pstrData, pRegKey->values[i].pData,
25960 -                               pRegKey->values[i].dataSize);
25961 +                       memcpy(pstrData, rv->pData, rv->dataSize);
25962                         /*  Get the size for the caller.  */
25963 -                       *pdwDataSize = pRegKey->values[i].dataSize;
25964 -                       *pdwValueSize = strlen(&(pRegKey->
25965 -                                               values[i].name[dwKeyLen]));
25966 -                       strncpy(pstrValue,
25967 -                                   &(pRegKey->values[i].name[dwKeyLen]),
25968 +                       *pdwDataSize = rv->dataSize;
25969 +                       *pdwValueSize = strlen(&(rv->name[dwKeyLen]));
25970 +                       strncpy(pstrValue, &(rv->name[dwKeyLen]),
25971                                     *pdwValueSize + 1);
25972                         GT_3trace(REG_debugMask, GT_2CLASS,
25973                                   "E Key %s, Value %s, Data %x ",
25974                                   pstrKey, pstrValue, *(u32 *)pstrData);
25975 -                       printS((u8 *)pstrData);
25976                         /*  Set our status to good and exit.  */
25977                         retVal = DSP_SOK;
25978                         break;
25979                 }
25980 +              rv = (struct RegValue *) LST_Next(pRegKey,
25981 +                                               (struct list_head *) rv);
25982         }
25983  
25984         if (count && DSP_FAILED(retVal))
25985 @@ -315,54 +223,30 @@ DSP_STATUS regsupEnumValue(IN u32 dwInde
25986  /*
25987   *  ======== regsupDeleteValue ========
25988   */
25989 -DSP_STATUS regsupDeleteValue(IN CONST char *pstrSubkey,
25990 -                           IN CONST char *pstrValue)
25991 +DSP_STATUS regsupDeleteValue(IN CONST char *pstrValue)
25992  {
25993         DSP_STATUS retVal = DSP_EFAIL;
25994 -       u32 i;
25995 +       struct RegValue *rv = (struct RegValue *) LST_First(pRegKey);
25996  
25997 -       for (i = 0; ((i < BRIDGE_MAX_NUM_REG_ENTRIES) &&
25998 -           (i < pRegKey->numValueEntries)); i++) {
25999 -               /*  See if the name matches...  */
26000 -               if (strncmp(pRegKey->values[i].name, pstrValue,
26001 -                   BRIDGE_MAX_NAME_SIZE) == 0) {
26002 +       while (rv) {
26003 +               /*  See if the name matches.  */
26004 +               if (strncmp(rv->name, pstrValue, MAXREGPATHLENGTH) == 0) {
26005                         /* We have a match!  Delete this key.  To delete a
26006                          * key, we free all resources associated with this
26007                          * key and, if we're not already the last entry in
26008                          * the array, we copy that entry into this deleted
26009                          * key.
26010                          */
26011 -                       MEM_Free(pRegKey->values[i].pData);
26012 -                       if ((pRegKey->numValueEntries - 1) == i) {
26013 -                               /* we're deleting the last one */
26014 -                               pRegKey->values[i].name[0] = '\0';
26015 -                               pRegKey->values[i].dataSize = 0;
26016 -                               pRegKey->values[i].pData = NULL;
26017 -                       } else {
26018 -                               /* move the last one here */
26019 -                               strncpy(pRegKey->values[i].name, pRegKey->
26020 -                                   values[pRegKey->numValueEntries - 1].name,
26021 -                                   BRIDGE_MAX_NAME_SIZE);
26022 -                               pRegKey->values[i].dataSize =
26023 -                                   pRegKey->
26024 -                                   values[pRegKey->numValueEntries-1].dataSize;
26025 -                               pRegKey->values[i].pData =
26026 -                                   pRegKey->
26027 -                                   values[pRegKey->numValueEntries-1].pData;
26028 -                               /* don't have to do this, but for
26029 -                                * the paranoid... */
26030 -                               pRegKey->
26031 -                                   values[pRegKey->numValueEntries-1].name[0] =
26032 -                                   '\0';
26033 -                       }
26034 -
26035 -                       /* another one bites the dust. */
26036 -                       pRegKey->numValueEntries--;
26037 +                       LST_RemoveElem(pRegKey, (struct list_head *)rv);
26038 +                       MEM_Free(rv->pData);
26039 +                       MEM_Free(rv);
26040  
26041                         /*  Set our status to good and exit...  */
26042                         retVal = DSP_SOK;
26043                         break;
26044                 }
26045 +               rv = (struct RegValue *)LST_Next(pRegKey,
26046 +                               (struct list_head *)rv);
26047         }
26048         return retVal;
26049  
26050 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/regsup.h kernel-power-2.6.28/drivers/dsp/bridge/services/regsup.h
26051 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/regsup.h       2011-04-17 17:32:26.000000000 +0100
26052 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/regsup.h    2011-05-02 22:36:50.000000000 +0100
26053 @@ -14,20 +14,9 @@
26054   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26055   */
26056  
26057 -
26058 -/*
26059 - *  ======== regsup.h ========
26060 - *
26061 - *! Revision History
26062 - *! ================
26063 - */
26064 -
26065  #ifndef _REGSUP_H_
26066  #define _REGSUP_H_
26067  
26068 -#define BRIDGE_MAX_NAME_SIZE                     MAXREGPATHLENGTH
26069 -#define BRIDGE_MAX_NUM_REG_ENTRIES               52
26070 -
26071  /*  Init function. MUST be called BEFORE any calls are  */
26072  /*  made into this psuedo-registry!!!  Returns TRUE/FALSE for SUCCESS/ERROR  */
26073  extern bool regsupInit(void);
26074 @@ -38,8 +27,8 @@ extern void regsupExit(void);
26075  /*
26076   *  ======== regsupDeleteValue ========
26077   */
26078 -extern DSP_STATUS regsupDeleteValue(IN CONST char *pstrSubkey,
26079 -                                   IN CONST char *pstrValue);
26080 +extern DSP_STATUS regsupDeleteValue(IN CONST char *pstrValue);
26081 +
26082  /*  Get the value of the entry having the given name.  Returns DSP_SOK  */
26083  /*  if an entry was found and the value retrieved.  Returns DSP_EFAIL
26084   *  otherwise.*/
26085 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/services.c kernel-power-2.6.28/drivers/dsp/bridge/services/services.c
26086 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/services.c     2011-04-17 17:32:26.000000000 +0100
26087 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/services.c  2011-05-02 22:36:50.000000000 +0100
26088 @@ -3,6 +3,8 @@
26089   *
26090   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26091   *
26092 + * Provide SERVICES loading.
26093 + *
26094   * Copyright (C) 2005-2006 Texas Instruments, Inc.
26095   *
26096   * This package is free software; you can redistribute it and/or modify
26097 @@ -14,24 +16,6 @@
26098   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26099   */
26100  
26101 -
26102 -/*
26103 - *  ======== services.c ========
26104 - *  Purpose:
26105 - *      Provide SERVICES loading.
26106 - *
26107 - *  Public Functions:
26108 - *      SERVICES_Exit
26109 - *      SERVICES_Init
26110 - *
26111 - *
26112 - *! Revision History
26113 - *! ================
26114 - *! 20-Nov-2000 rr: NTFY_Init/Exit added.
26115 - *! 06-Jul-2000 rr: PROC prefix changed to PRCS to accomodate RM.
26116 - *! 01-Feb-2000 kc: Created.
26117 - */
26118 -
26119  #include <dspbridge/host_os.h>
26120  
26121  /*  ----------------------------------- DSP/BIOS Bridge */
26122 @@ -44,17 +28,12 @@
26123  
26124  /*  ----------------------------------- OS Adaptation Layer */
26125  #include <dspbridge/cfg.h>
26126 -#include <dspbridge/csl.h>
26127  #include <dspbridge/dbg.h>
26128 -#include <dspbridge/dpc.h>
26129 -#include <dspbridge/kfile.h>
26130 -#include <dspbridge/list.h>
26131  #include <dspbridge/mem.h>
26132  #include <dspbridge/ntfy.h>
26133  #include <dspbridge/reg.h>
26134  #include <dspbridge/sync.h>
26135  #include <dspbridge/clk.h>
26136 -#include <dspbridge/util.h>
26137  
26138  /*  ----------------------------------- This */
26139  #include <dspbridge/services.h>
26140 @@ -64,8 +43,6 @@
26141  static struct GT_Mask SERVICES_debugMask = { NULL, NULL };  /* GT trace var. */
26142  #endif
26143  
26144 -static u32 cRefs;              /* SERVICES module reference count */
26145 -
26146  /*
26147   *  ======== SERVICES_Exit ========
26148   *  Purpose:
26149 @@ -74,31 +51,16 @@ static u32 cRefs;           /* SERVICES module re
26150   */
26151  void SERVICES_Exit(void)
26152  {
26153 -       DBC_Require(cRefs > 0);
26154 +       /* Uninitialize all SERVICES modules here */
26155 +       NTFY_Exit();
26156 +       SYNC_Exit();
26157 +       CLK_Exit();
26158 +       REG_Exit();
26159 +       DBG_Exit();
26160 +       CFG_Exit();
26161 +       MEM_Exit();
26162  
26163 -       GT_1trace(SERVICES_debugMask, GT_5CLASS, "SERVICES_Exit: cRefs 0x%x\n",
26164 -                cRefs);
26165 -
26166 -       cRefs--;
26167 -       if (cRefs == 0) {
26168 -               /* Uninitialize all SERVICES modules here */
26169 -               NTFY_Exit();
26170 -               UTIL_Exit();
26171 -               SYNC_Exit();
26172 -               CLK_Exit();
26173 -               REG_Exit();
26174 -               LST_Exit();
26175 -               KFILE_Exit();
26176 -               DPC_Exit();
26177 -               DBG_Exit();
26178 -               CSL_Exit();
26179 -               CFG_Exit();
26180 -               MEM_Exit();
26181 -
26182 -               GT_exit();
26183 -       }
26184 -
26185 -       DBC_Ensure(cRefs >= 0);
26186 +       GT_exit();
26187  }
26188  
26189  /*
26190 @@ -109,84 +71,49 @@ void SERVICES_Exit(void)
26191  bool SERVICES_Init(void)
26192  {
26193         bool fInit = true;
26194 -       bool fCFG, fCSL, fDBG, fDPC, fKFILE, fLST, fMEM;
26195 -       bool fREG, fSYNC, fCLK, fUTIL, fNTFY;
26196 -
26197 -       DBC_Require(cRefs >= 0);
26198 +       bool fCFG, fDBG, fMEM;
26199 +       bool fREG, fSYNC, fCLK, fNTFY;
26200  
26201 -       if (cRefs == 0) {
26202 +       GT_init();
26203 +       GT_create(&SERVICES_debugMask, "OS");   /* OS for OSal */
26204  
26205 -               GT_init();
26206 -               GT_create(&SERVICES_debugMask, "OS");   /* OS for OSal */
26207 -
26208 -               GT_0trace(SERVICES_debugMask, GT_ENTER,
26209 +       GT_0trace(SERVICES_debugMask, GT_ENTER,
26210                          "SERVICES_Init: entered\n");
26211  
26212 -               /* Perform required initialization of SERVICES modules. */
26213 -               fMEM = MEM_Init();
26214 -               fREG = REG_Init();
26215 -               fCFG = CFG_Init();
26216 -               fCSL = CSL_Init();
26217 -               fDBG = DBG_Init();
26218 -               fDPC = DPC_Init();
26219 -               fKFILE = KFILE_Init();
26220 -               fLST = LST_Init();
26221 -               /* fREG = REG_Init(); */
26222 -               fSYNC = SYNC_Init();
26223 -               fCLK  = CLK_Init();
26224 -               fUTIL = UTIL_Init();
26225 -               fNTFY = NTFY_Init();
26226 -
26227 -               fInit = fCFG && fCSL && fDBG && fDPC && fKFILE &&
26228 -                       fLST && fMEM && fREG && fSYNC && fCLK && fUTIL;
26229 -
26230 -               if (!fInit) {
26231 -                       if (fNTFY)
26232 -                               NTFY_Exit();
26233 -
26234 -                       if (fUTIL)
26235 -                               UTIL_Exit();
26236 -
26237 -                       if (fSYNC)
26238 -                               SYNC_Exit();
26239 -
26240 -                       if (fCLK)
26241 -                               CLK_Exit();
26242 -
26243 -                       if (fREG)
26244 -                               REG_Exit();
26245 -
26246 -                       if (fLST)
26247 -                               LST_Exit();
26248 -
26249 -                       if (fKFILE)
26250 -                               KFILE_Exit();
26251 -
26252 -                       if (fDPC)
26253 -                               DPC_Exit();
26254 -
26255 -                       if (fDBG)
26256 -                               DBG_Exit();
26257 -
26258 -                       if (fCSL)
26259 -                               CSL_Exit();
26260 -
26261 -                       if (fCFG)
26262 -                               CFG_Exit();
26263 +       /* Perform required initialization of SERVICES modules. */
26264 +       fMEM = MEM_Init();
26265 +       fREG = REG_Init();
26266 +       fCFG = CFG_Init();
26267 +       fDBG = DBG_Init();
26268 +       fSYNC = SYNC_Init();
26269 +       fCLK  = CLK_Init();
26270 +       fNTFY = NTFY_Init();
26271 +
26272 +       fInit = fCFG && fDBG && fMEM && fREG && fSYNC && fCLK;
26273 +
26274 +       if (!fInit) {
26275 +               if (fNTFY)
26276 +                       NTFY_Exit();
26277 +
26278 +               if (fSYNC)
26279 +                       SYNC_Exit();
26280 +
26281 +               if (fCLK)
26282 +                       CLK_Exit();
26283 +
26284 +               if (fREG)
26285 +                       REG_Exit();
26286  
26287 -                       if (fMEM)
26288 -                               MEM_Exit();
26289 +               if (fDBG)
26290 +                       DBG_Exit();
26291  
26292 -               }
26293 -       }
26294 +               if (fCFG)
26295 +                       CFG_Exit();
26296  
26297 -       if (fInit)
26298 -               cRefs++;
26299 +               if (fMEM)
26300 +                       MEM_Exit();
26301  
26302 -       GT_1trace(SERVICES_debugMask, GT_5CLASS, "SERVICES_Init: cRefs 0x%x\n",
26303 -                cRefs);
26304 -
26305 -       DBC_Ensure((fInit && (cRefs > 0)) || (!fInit && (cRefs >= 0)));
26306 +       }
26307  
26308         return fInit;
26309  }
26310 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/services/sync.c kernel-power-2.6.28/drivers/dsp/bridge/services/sync.c
26311 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/services/sync.c 2011-04-17 17:32:26.000000000 +0100
26312 +++ kernel-power-2.6.28/drivers/dsp/bridge/services/sync.c      2011-05-02 22:36:50.000000000 +0100
26313 @@ -3,6 +3,8 @@
26314   *
26315   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26316   *
26317 + * Synchronization services.
26318 + *
26319   * Copyright (C) 2005-2006 Texas Instruments, Inc.
26320   *
26321   * This package is free software; you can redistribute it and/or modify
26322 @@ -14,39 +16,6 @@
26323   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26324   */
26325  
26326 -/*
26327 - *  ======== sync.c ========
26328 - *  Purpose:
26329 - *      Synchronization services.
26330 - *
26331 - *  Public Functions:
26332 - *      SYNC_CloseEvent
26333 - *      SYNC_DeleteCS
26334 - *      SYNC_EnterCS
26335 - *      SYNC_Exit
26336 - *      SYNC_Init
26337 - *      SYNC_InitializeCS
26338 - *      SYNC_LeaveCS
26339 - *      SYNC_OpenEvent
26340 - *      SYNC_ResetEvent
26341 - *      SYNC_SetEvent
26342 - *      SYNC_WaitOnEvent
26343 - *      SYNC_WaitOnMultipleEvents
26344 - *
26345 - *! Revision History:
26346 - *! ================
26347 - *! 05-Nov-2001 kc: Minor cosmetic changes.
26348 - *! 05-Oct-2000 jeh Added SYNC_WaitOnMultipleEvents().
26349 - *! 10-Aug-2000 rr: SYNC_PostMessage added.
26350 - *! 10-Jul-2000 jeh Modified SYNC_OpenEvent() to handle NULL attrs.
26351 - *! 03-Feb-2000 rr: Module init/exit is handled by SERVICES Init/Exit.
26352 - *!             GT Changes.
26353 - *! 01-Dec-1999 ag: Added optional named event creation in SYNC_OpenEvent().
26354 - *! 22-Nov-1999 kc: Added changes from code review.
26355 - *! 22-Sep-1999 kc: Modified from sync95.c.
26356 - *! 05-Aug-1996 gp: Created.
26357 - */
26358 -
26359  /*  ----------------------------------- Host OS */
26360  #include <dspbridge/host_os.h>
26361  
26362 @@ -60,7 +29,6 @@
26363  #include <dspbridge/gt.h>
26364  
26365  /*  ----------------------------------- OS Adaptation Layer */
26366 -#include <dspbridge/csl.h>
26367  #include <dspbridge/mem.h>
26368  
26369  /*  ----------------------------------- This */
26370 @@ -219,7 +187,6 @@ DSP_STATUS SYNC_ResetEvent(struct SYNC_O
26371  
26372         if (MEM_IsValidHandle(hEvent, SIGNATURE)) {
26373                 pEvent->state = so_reset;
26374 -               status = DSP_SOK;
26375         } else {
26376                 status = DSP_EHANDLE;
26377                 GT_1trace(SYNC_debugMask, GT_6CLASS,
26378 @@ -362,7 +329,7 @@ DSP_STATUS SYNC_WaitOnMultipleEvents(str
26379         if (Wp->state != wo_signalled && dwTimeout > 0) {
26380                 struct timer_list timeout;
26381                 if (dwTimeout != SYNC_INFINITE) {
26382 -                       init_timer(&timeout);
26383 +                       init_timer_on_stack(&timeout);
26384                         timeout.function = timeout_callback;
26385                         timeout.data = (unsigned long)Wp;
26386                         timeout.expires = jiffies + dwTimeout * HZ / 1000;
26387 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_cmm.h kernel-power-2.6.28/drivers/dsp/bridge/wmd/_cmm.h
26388 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_cmm.h      2011-04-17 17:32:26.000000000 +0100
26389 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/_cmm.h   2011-05-02 22:36:50.000000000 +0100
26390 @@ -3,6 +3,10 @@
26391   *
26392   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26393   *
26394 + * Private header file defining CMM manager objects and defines needed
26395 + * by IO manager to register shared memory regions when DSP base image
26396 + * is loaded(WMD_IO_OnLoaded).
26397 + *
26398   * Copyright (C) 2005-2006 Texas Instruments, Inc.
26399   *
26400   * This package is free software; you can redistribute it and/or modify
26401 @@ -14,24 +18,6 @@
26402   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26403   */
26404  
26405 -
26406 -/*
26407 - *  ======== _cmm.h ========
26408 - *  Description:
26409 - *      Private header file defining CMM manager objects and defines needed
26410 - *      by IO manager to register shared memory regions when DSP base image
26411 - *      is loaded(WMD_IO_OnLoaded).
26412 - *
26413 - *  Public Functions:
26414 - *      None.
26415 - *
26416 - *  Notes:
26417 - *
26418 - *! Revision History:
26419 - *! ================
26420 - *! 24-Aug-2001 ag     Created.
26421 - */
26422 -
26423  #ifndef _CMM_
26424  #define _CMM_
26425  
26426 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_deh.h kernel-power-2.6.28/drivers/dsp/bridge/wmd/_deh.h
26427 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_deh.h      2011-04-17 17:32:26.000000000 +0100
26428 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/_deh.h   2011-05-02 22:36:50.000000000 +0100
26429 @@ -3,6 +3,8 @@
26430   *
26431   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26432   *
26433 + * Private header for DEH module.
26434 + *
26435   * Copyright (C) 2005-2006 Texas Instruments, Inc.
26436   *
26437   * This package is free software; you can redistribute it and/or modify
26438 @@ -14,21 +16,9 @@
26439   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26440   */
26441  
26442 -
26443 -/*
26444 - *  ======== _deh.h ========
26445 - *  Description:
26446 - *      Private header for DEH module.
26447 - *
26448 - *! Revision History:
26449 - *! ================
26450 - *! 21-Sep-2001 kc: created.
26451 - */
26452 -
26453  #ifndef _DEH_
26454  #define _DEH_
26455  
26456 -#include <dspbridge/dpc.h>
26457  #include <dspbridge/ntfy.h>
26458  #include <dspbridge/wmd.h>
26459  
26460 @@ -39,8 +29,10 @@ struct DEH_MGR {
26461         u32 dwSignature;        /* Used for object validation.  */
26462         struct WMD_DEV_CONTEXT *hWmdContext;    /* WMD device context. */
26463         struct NTFY_OBJECT *hNtfy;      /* NTFY object                  */
26464 -       struct DPC_OBJECT *hMmuFaultDpc;        /* DPC object handle.  */
26465         struct DSP_ERRORINFO errInfo;   /* DSP exception info.          */
26466 +
26467 +       /* MMU Fault DPC */
26468 +       struct tasklet_struct dpc_tasklet;
26469  } ;
26470  
26471  #endif                         /* _DEH_ */
26472 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_msg_sm.h kernel-power-2.6.28/drivers/dsp/bridge/wmd/_msg_sm.h
26473 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_msg_sm.h   2011-04-17 17:32:26.000000000 +0100
26474 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/_msg_sm.h        2011-05-02 22:36:50.000000000 +0100
26475 @@ -3,6 +3,9 @@
26476   *
26477   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26478   *
26479 + * Private header file defining MSG manager objects and defines needed
26480 + * by IO manager.
26481 + *
26482   * Copyright (C) 2005-2006 Texas Instruments, Inc.
26483   *
26484   * This package is free software; you can redistribute it and/or modify
26485 @@ -14,24 +17,6 @@
26486   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26487   */
26488  
26489 -
26490 -/*
26491 - *  ======== _msg_sm.h ========
26492 - *  Description:
26493 - *      Private header file defining MSG manager objects and defines needed
26494 - *      by IO manager.
26495 - *
26496 - *  Public Functions:
26497 - *      None.
26498 - *
26499 - *  Notes:
26500 - *
26501 - *! Revision History:
26502 - *! ================
26503 - *! 09-May-2001 jeh     Code Review cleanup.
26504 - *! 08-Nov-2000 jeh     Created.
26505 - */
26506 -
26507  #ifndef _MSG_SM_
26508  #define _MSG_SM_
26509  
26510 @@ -121,7 +106,7 @@ struct MSG_MGR {
26511   *  The MSG_QUEUE's hSynEvent gets posted when a message is ready.
26512   */
26513  struct MSG_QUEUE {
26514 -       struct LST_ELEM listElem;
26515 +       struct list_head listElem;
26516         u32 dwSignature;
26517         struct MSG_MGR *hMsgMgr;
26518         u32 uMaxMsgs;   /* Node message depth */
26519 @@ -150,7 +135,7 @@ struct MSG_DSPMSG {
26520   *  ======== MSG_FRAME ========
26521   */
26522  struct MSG_FRAME {
26523 -       struct LST_ELEM listElem;
26524 +       struct list_head listElem;
26525         struct MSG_DSPMSG msgData;
26526  } ;
26527  
26528 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_tiomap.h kernel-power-2.6.28/drivers/dsp/bridge/wmd/_tiomap.h
26529 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_tiomap.h   2011-04-17 17:32:26.000000000 +0100
26530 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/_tiomap.h        2011-05-02 22:36:50.000000000 +0100
26531 @@ -3,6 +3,8 @@
26532   *
26533   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26534   *
26535 + * Definitions and types private to this WMD.
26536 + *
26537   * Copyright (C) 2005-2006 Texas Instruments, Inc.
26538   *
26539   * This package is free software; you can redistribute it and/or modify
26540 @@ -14,13 +16,6 @@
26541   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26542   */
26543  
26544 -/*
26545 - *  ======== _tiomap.h ========
26546 - *  Description:
26547 - *      Definitions and types private to this WMD.
26548 - *
26549 - */
26550 -
26551  #ifndef _TIOMAP_
26552  #define _TIOMAP_
26553  
26554 @@ -214,12 +209,8 @@ static const struct MAP_L4PERIPHERAL L4P
26555  #define MBX_PM_MAX_RESOURCES 11
26556  
26557  /*  Power Management Commands */
26558 -enum BPWR_ExtClockCmd {
26559 -       BPWR_DisableClock = 0,
26560 -       BPWR_EnableClock,
26561 -       BPWR_DisableAutoIdle,
26562 -       BPWR_EnableAutoIdle
26563 -} ;
26564 +#define BPWR_DisableClock      0
26565 +#define BPWR_EnableClock       1
26566  
26567  /* OMAP242x specific resources */
26568  enum BPWR_ExtClockId {
26569 @@ -275,21 +266,6 @@ static const struct BPWR_Clk_t BPWR_Clks
26570  #define INTH_MASK_IT_REG_OFFSET         0x04   /* Mask Interrupt reg offset  */
26571  
26572  #define   DSP_MAILBOX1_INT              10
26573 -
26574 -/*
26575 - *  INTH_InterruptKind_t
26576 - *  Identify the kind of interrupt: either FIQ/IRQ
26577 - */
26578 -enum INTH_InterruptKind_t {
26579 -       INTH_IRQ = 0,
26580 -       INTH_FIQ = 1
26581 -} ;
26582 -
26583 -enum INTH_SensitiveEdge_t {
26584 -       FALLING_EDGE_SENSITIVE = 0,
26585 -       LOW_LEVEL_SENSITIVE = 1
26586 -} ;
26587 -
26588  /*
26589   *  Bit definition of  Interrupt  Level  Registers
26590   */
26591 @@ -322,9 +298,9 @@ enum INTH_SensitiveEdge_t {
26592  #define ClearBit(reg, mask)             (reg &= ~mask)
26593  #define SetBit(reg, mask)               (reg |= mask)
26594  
26595 -#define SetGroupBits16(reg, position, width, value) \
26596 -       do {\
26597 -               reg &= ~((0xFFFF >> (16 - (width))) << (position)) ; \
26598 +#define SetGroupBits16(reg, position, width, value)                         \
26599 +       do {                                                                 \
26600 +               reg &= ~((0xFFFF >> (16 - (width))) << (position));          \
26601                 reg |= ((value & (0xFFFF >> (16 - (width)))) << (position)); \
26602         } while (0);
26603  
26604 @@ -333,24 +309,24 @@ enum INTH_SensitiveEdge_t {
26605  /* This mini driver's device context: */
26606  struct WMD_DEV_CONTEXT {
26607         struct DEV_OBJECT *hDevObject;  /* Handle to WCD device object. */
26608 -       u32 dwDspBaseAddr;      /* Arm's API to DSP virtual base addr */
26609 +       u32 dwDspBaseAddr;              /* Arm's API to DSP virt base addr */
26610         /*
26611          * DSP External memory prog address as seen virtually by the OS on
26612          * the host side.
26613          */
26614 -       u32 dwDspExtBaseAddr;   /* See the comment above        */
26615 -       u32 dwAPIRegBase;       /* API memory mapped registers  */
26616 -       void __iomem *dwDSPMmuBase;     /* DSP MMU Mapped registers     */
26617 -       u32 dwMailBoxBase;      /* Mail box mapped registers    */
26618 -       u32 dwAPIClkBase;       /* CLK Registers                */
26619 -       u32 dwDSPClkM2Base;     /* DSP Clock Module m2          */
26620 -       u32 dwPublicRhea;       /* Pub Rhea                     */
26621 -       u32 dwIntAddr;  /* MB INTR reg                  */
26622 -       u32 dwTCEndianism;      /* TC Endianism register        */
26623 -       u32 dwTestBase; /* DSP MMU Mapped registers     */
26624 -       u32 dwSelfLoop; /* Pointer to the selfloop      */
26625 -       u32 dwDSPStartAdd;      /* API Boot vector              */
26626 -       u32 dwInternalSize;     /* Internal memory size         */
26627 +       u32 dwDspExtBaseAddr;           /* See the comment above */
26628 +       u32 dwAPIRegBase;               /* API mem map'd registers */
26629 +       void __iomem *dwDSPMmuBase;     /* DSP MMU Mapped registers */
26630 +       u32 dwMailBoxBase;              /* Mail box mapped registers */
26631 +       u32 dwAPIClkBase;               /* CLK Registers */
26632 +       u32 dwDSPClkM2Base;             /* DSP Clock Module m2 */
26633 +       u32 dwPublicRhea;               /* Pub Rhea */
26634 +       u32 dwIntAddr;                  /* MB INTR reg */
26635 +       u32 dwTCEndianism;              /* TC Endianism register */
26636 +       u32 dwTestBase;                 /* DSP MMU Mapped registers */
26637 +       u32 dwSelfLoop;                 /* Pointer to the selfloop */
26638 +       u32 dwDSPStartAdd;              /* API Boot vector */
26639 +       u32 dwInternalSize;             /* Internal memory size */
26640  
26641         /*
26642          * Processor specific info is set when prog loaded and read from DCD.
26643 @@ -358,14 +334,14 @@ struct WMD_DEV_CONTEXT {
26644          */
26645         /* DMMU TLB entries */
26646         struct WMDIOCTL_EXTPROC aTLBEntry[WMDIOCTL_NUMOFMMUTLB];
26647 -       u32 dwBrdState; /* Last known board state.      */
26648 -       u32 ulIntMask;  /* int mask                     */
26649 -       u16 ioBase;     /* Board I/O base               */
26650 -       u32 numTLBEntries;      /* DSP MMU TLB entry counter    */
26651 -       u32 fixedTLBEntries;    /* Fixed DSPMMU TLB entry count */
26652 +       u32 dwBrdState;                 /* Last known board state. */
26653 +       u32 ulIntMask;                  /* int mask */
26654 +       u16 ioBase;                     /* Board I/O base */
26655 +       u32 numTLBEntries;              /* DSP MMU TLB entry counter */
26656 +       u32 fixedTLBEntries;            /* Fixed DSPMMU TLB entry count */
26657  
26658         /* TC Settings */
26659 -       bool tcWordSwapOn;      /* Traffic Controller Word Swap */
26660 +       bool tcWordSwapOn;              /* Traffic Controller Word Swap */
26661         struct PgTableAttrs *pPtAttrs;
26662         u32 uDspPerClks;
26663  } ;
26664 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_tiomap_mmu.h kernel-power-2.6.28/drivers/dsp/bridge/wmd/_tiomap_mmu.h
26665 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_tiomap_mmu.h       2011-04-17 17:32:26.000000000 +0100
26666 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/_tiomap_mmu.h    2011-05-02 22:36:50.000000000 +0100
26667 @@ -3,6 +3,8 @@
26668   *
26669   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26670   *
26671 + * Definitions and types for the DSP MMU modules.
26672 + *
26673   * Copyright (C) 2005-2006 Texas Instruments, Inc.
26674   *
26675   * This package is free software; you can redistribute it and/or modify
26676 @@ -14,20 +16,6 @@
26677   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26678   */
26679  
26680 -
26681 -/*
26682 - *  ======== _tiomap_mmu.h ========
26683 - *  Description:
26684 - *      Definitions and types for the DSP MMU modules
26685 - *
26686 - *! Revision History
26687 - *! ================
26688 - *! 19-Apr-2004 sb:  Renamed HW types. Removed dspMmuTlbEntry
26689 - *! 05-Jan-2004 vp:  Moved the file to a platform specific folder from common.
26690 - *! 21-Mar-2003 sb:  Added macro definition TIHEL_LARGEPAGESIZE
26691 - *! 08-Oct-2002 rr:  Created.
26692 - */
26693 -
26694  #ifndef _TIOMAP_MMU_
26695  #define _TIOMAP_MMU_
26696  
26697 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_tiomap_pwr.h kernel-power-2.6.28/drivers/dsp/bridge/wmd/_tiomap_pwr.h
26698 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_tiomap_pwr.h       2011-04-17 17:32:26.000000000 +0100
26699 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/_tiomap_pwr.h    2011-05-02 22:36:50.000000000 +0100
26700 @@ -3,6 +3,8 @@
26701   *
26702   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26703   *
26704 + * Definitions and types for the DSP wake/sleep routines.
26705 + *
26706   * Copyright (C) 2005-2006 Texas Instruments, Inc.
26707   *
26708   * This package is free software; you can redistribute it and/or modify
26709 @@ -14,17 +16,6 @@
26710   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26711   */
26712  
26713 -
26714 -/*
26715 - *  ======== _tiomap_pwr.h ========
26716 - *  Description:
26717 - *      Definitions and types for the DSP wake/sleep routines.
26718 - *
26719 - *! Revision History
26720 - *! ================
26721 - *! 08-Oct-2002 rr:  Created.
26722 - */
26723 -
26724  #ifndef _TIOMAP_PWR_
26725  #define _TIOMAP_PWR_
26726  
26727 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_tiomap_util.h kernel-power-2.6.28/drivers/dsp/bridge/wmd/_tiomap_util.h
26728 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/_tiomap_util.h      2011-04-17 17:32:26.000000000 +0100
26729 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/_tiomap_util.h   2011-05-02 22:36:50.000000000 +0100
26730 @@ -3,6 +3,8 @@
26731   *
26732   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26733   *
26734 + * Definitions and types for the utility routines.
26735 + *
26736   * Copyright (C) 2005-2006 Texas Instruments, Inc.
26737   *
26738   * This package is free software; you can redistribute it and/or modify
26739 @@ -14,23 +16,18 @@
26740   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26741   */
26742  
26743 -
26744 -/*
26745 - *  ======== _tiomap_util.h ========
26746 - *  Description:
26747 - *      Definitions and types for the utility routines.
26748 - *
26749 - *! Revision History
26750 - *! ================
26751 - *! 08-Oct-2002 rr:  Created.
26752 - */
26753 -
26754  #ifndef _TIOMAP_UTIL_
26755  #define _TIOMAP_UTIL_
26756  
26757  /* Time out Values in uSeconds*/
26758  #define TIHELEN_ACKTIMEOUT  10000
26759  
26760 +/*
26761 + * Time out for power state transition (in msecs), due to system
26762 + * latencies and HZ resolution this timer can vary.
26763 + */
26764 +#define PWRSTST_TIMEOUT                200
26765 +
26766  /*  Time delay for HOM->SAM transition. */
26767  #define  WAIT_SAM   1000000    /* in usec (1000 millisec) */
26768  
26769 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/chnl_sm.c kernel-power-2.6.28/drivers/dsp/bridge/wmd/chnl_sm.c
26770 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/chnl_sm.c   2011-04-17 17:32:26.000000000 +0100
26771 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/chnl_sm.c        2011-05-02 22:36:51.000000000 +0100
26772 @@ -3,6 +3,8 @@
26773   *
26774   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26775   *
26776 + * Implements upper edge functions for WMD channel module.
26777 + *
26778   * Copyright (C) 2005-2006 Texas Instruments, Inc.
26779   *
26780   * This package is free software; you can redistribute it and/or modify
26781 @@ -14,26 +16,7 @@
26782   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26783   */
26784  
26785 -
26786  /*
26787 - *  ======== chnl_sm.c ========
26788 - *  Description:
26789 - *      Implements upper edge functions for WMD channel module.
26790 - *
26791 - *  Public Functions:
26792 - *      WMD_CHNL_AddIOReq
26793 - *      WMD_CHNL_CancelIO
26794 - *      WMD_CHNL_Close
26795 - *      WMD_CHNL_Create
26796 - *      WMD_CHNL_Destroy
26797 - *      WMD_CHNL_FlushIO
26798 - *      WMD_CHNL_GetInfo
26799 - *      WMD_CHNL_GetIOC
26800 - *      WMD_CHNL_GetMgrInfo
26801 - *      WMD_CHNL_Idle
26802 - *      WMD_CHNL_Open
26803 - *
26804 - *  Notes:
26805   *      The lower edge functions must be implemented by the WMD writer, and
26806   *      are declared in chnl_sm.h.
26807   *
26808 @@ -57,60 +40,6 @@
26809   *          LST_Empty(pChnl->pIOCompletions) ==> pChnl->hSyncEvent is reset
26810   *      and
26811   *          !LST_Empty(pChnl->pIOCompletions) ==> pChnl->hSyncEvent is set.
26812 - *
26813 - *! Revision History:
26814 - *! ================
26815 - *! 10-Feb-2004 sb: Consolidated the MAILBOX_IRQ macro at the top of the file.
26816 - *! 05-Jan-2004 vp: Updated for 2.6 kernel on 24xx platform.
26817 - *! 23-Apr-2003 sb: Fixed mailbox deadlock
26818 - *! 24-Feb-2003 vp: Code Review Updates.
26819 - *! 18-Oct-2002 vp: Ported to Linux platform
26820 - *! 29-Aug-2002 rr  Changed the SYNC error code return to DSP error code return
26821 - *            in WMD_CHNL_GetIOC.
26822 - *! 22-Jan-2002 ag  Zero-copy support added.
26823 - *!                 CMM_CallocBuf() used for SM allocations.
26824 - *! 04-Feb-2001 ag  DSP-DMA support added.
26825 - *! 22-Nov-2000 kc: Updated usage of PERF_RegisterStat.
26826 - *! 06-Nov-2000 jeh Move ISR_Install, DPC_Create from CHNL_Create to IO_Create.
26827 - *! 13-Oct-2000 jeh Added dwArg parameter to WMD_CHNL_AddIOReq(), added
26828 - *!                 WMD_CHNL_Idle and WMD_CHNL_RegisterNotify for DSPStream.
26829 - *!                 Remove #ifdef DEBUG from around channel cIOCs field.
26830 - *! 21-Sep-2000 rr: PreOMAP chnl class library acts like a IO class library.
26831 - *! 25-Sep-2000 ag: MEM_[Unmap]LinearAddress added for #ifdef CHNL_PREOMAP.
26832 - *! 07-Sep-2000 rr: Added new channel class for PreOMAP.
26833 - *! 11-Jul-2000 jeh Allow NULL user event in WMD_CHNL_Open().
26834 - *! 06-Jul-2000 rr: Changed prefix PROC to PRCS for process module calls.
26835 - *! 20-Jan-2000 ag: Incorporated code review comments.
26836 - *! 05-Jan-2000 ag: Text format cleanup.
26837 - *! 07-Dec-1999 ag: Now setting ChnlMgr fSharedIRQ flag before ISR_Install().
26838 - *! 01-Dec-1999 ag: WMD_CHNL_Open() now accepts named sync event.
26839 - *! 14-Nov-1999 ag: DPC_Schedule() uncommented.
26840 - *! 28-Oct-1999 ag: CHNL Attrs userEvent not supported.
26841 - *!                 SM addrs taken from COFF(IO) or host resource(SM).
26842 - *! 25-May-1999 jg: CHNL_IOCLASS boards now get their shared memory buffer
26843 - *!                 address and length from symbols defined in the currently
26844 - *!                 loaded COFF file. See _chn_sm.h.
26845 - *! 18-Jun-1997 gp: Moved waiting back to ring 0 to improve performance.
26846 - *! 22-Jan-1998 gp: Update User's pIOC struct in GetIOC at lower IRQL (NT).
26847 - *! 16-Jan-1998 gp: Commented out PERF stuff, since it is not all there in NT.
26848 - *! 13-Jan-1998 gp: Protect IOCTLs from IO_DPC by raising IRQL to DIRQL (NT).
26849 - *! 22-Oct-1997 gp: Call SYNC_OpenEvent in CHNL_Open, for NT support.
26850 - *! 18-Jun-1997 gp: Moved waiting back to ring 0 to improve performance.
26851 - *! 16-Jun-1997 gp: Added call into lower edge CHNL function to allow override
26852 - *!                 of the SHM window length reported by Windows CM.
26853 - *! 05-Jun-1997 gp: Removed unnecessary critical sections.
26854 - *! 18-Mar-1997 gp: Ensured CHNL_FlushIO on input leaves channel in READY state.
26855 - *! 06-Jan-1997 gp: ifdefed to support the IO variant of SHM channel class lib.
26856 - *! 21-Jan-1997 gp: CHNL_Close: set pChnl = NULL for DBC_Ensure().
26857 - *! 14-Jan-1997 gp: Updated based on code review feedback.
26858 - *! 03-Jan-1997 gp: Added CHNL_E_WAITTIMEOUT error return code to CHNL_FlushIO()
26859 - *! 23-Oct-1996 gp: Tag channel with ring 0 process handle.
26860 - *! 13-Sep-1996 gp: Added performance statistics for channel.
26861 - *! 09-Sep-1996 gp: Added WMD_CHNL_GetMgrInfo().
26862 - *! 04-Sep-1996 gp: Removed shared memory control struct offset: made zero.
26863 - *! 01-Aug-1996 gp: Implemented basic channel manager and channel create/delete.
26864 - *! 17-Jul-1996 gp: Started pseudo coding.
26865 - *! 11-Jul-1996 gp: Stubbed out.
26866   */
26867  
26868  /*  ----------------------------------- OS */
26869 @@ -128,7 +57,6 @@
26870  /*  ----------------------------------- OS Adaptation Layer */
26871  #include <dspbridge/mem.h>
26872  #include <dspbridge/cfg.h>
26873 -#include <dspbridge/csl.h>
26874  #include <dspbridge/sync.h>
26875  
26876  /*  ----------------------------------- Mini-Driver */
26877 @@ -183,6 +111,31 @@ DSP_STATUS WMD_CHNL_AddIOReq(struct CHNL
26878  
26879         fIsEOS = (cBytes == 0) ? true : false;
26880  
26881 +       /* Validate args:  */
26882 +       if (pHostBuf == NULL) {
26883 +               status = DSP_EPOINTER;
26884 +       } else if (!MEM_IsValidHandle(pChnl, CHNL_SIGNATURE)) {
26885 +               status = DSP_EHANDLE;
26886 +       } else if (fIsEOS && CHNL_IsInput(pChnl->uMode)) {
26887 +               status = CHNL_E_NOEOS;
26888 +       } else {
26889 +               /* Check the channel state: only queue chirp if channel state
26890 +                * allows */
26891 +               dwState = pChnl->dwState;
26892 +               if (dwState != CHNL_STATEREADY) {
26893 +                       if (dwState & CHNL_STATECANCEL)
26894 +                               status = CHNL_E_CANCELLED;
26895 +                       else if ((dwState & CHNL_STATEEOS)
26896 +                                  && CHNL_IsOutput(pChnl->uMode))
26897 +                               status = CHNL_E_EOS;
26898 +                       else
26899 +                               /* No other possible states left: */
26900 +                               DBC_Assert(0);
26901 +               }
26902 +       }
26903 +       if (DSP_FAILED(status))
26904 +               goto func_end;
26905 +
26906         if (pChnl->uChnlType == CHNL_PCPY && pChnl->uId > 1 && pHostBuf) {
26907                 if (!(pHostBuf < (void *)USERMODE_ADDR)) {
26908                         pHostSysBuf = pHostBuf;
26909 @@ -194,7 +147,7 @@ DSP_STATUS WMD_CHNL_AddIOReq(struct CHNL
26910                         status = DSP_EMEMORY;
26911                         DBG_Trace(DBG_LEVEL7,
26912                                  "No memory to allocate kernel buffer\n");
26913 -                       goto func_cont;
26914 +                       goto func_end;
26915                 }
26916                 if (CHNL_IsOutput(pChnl->uMode)) {
26917                         status = copy_from_user(pHostSysBuf, pHostBuf,
26918 @@ -207,33 +160,11 @@ DSP_STATUS WMD_CHNL_AddIOReq(struct CHNL
26919                                 MEM_Free(pHostSysBuf);
26920                                 pHostSysBuf = NULL;
26921                                 status = DSP_EPOINTER;
26922 +                               goto func_end;
26923                         }
26924                 }
26925         }
26926  func_cont:
26927 -       /* Validate args:  */
26928 -       if (pHostBuf == NULL) {
26929 -               status = DSP_EPOINTER;
26930 -       } else if (!MEM_IsValidHandle(pChnl, CHNL_SIGNATURE)) {
26931 -               status = DSP_EHANDLE;
26932 -       } else if (fIsEOS && CHNL_IsInput(pChnl->uMode)) {
26933 -               status = CHNL_E_NOEOS;
26934 -       } else {
26935 -               /* Check the channel state: only queue chirp if channel state
26936 -                * allows */
26937 -               dwState = pChnl->dwState;
26938 -               if (dwState != CHNL_STATEREADY) {
26939 -                       if (dwState & CHNL_STATECANCEL) {
26940 -                               status = CHNL_E_CANCELLED;
26941 -                       } else if ((dwState & CHNL_STATEEOS)
26942 -                                  && CHNL_IsOutput(pChnl->uMode)) {
26943 -                               status = CHNL_E_EOS;
26944 -                       } else {
26945 -                               /* No other possible states left: */
26946 -                               DBC_Assert(0);
26947 -                       }
26948 -               }
26949 -       }
26950         /* Mailbox IRQ is disabled to avoid race condition with DMA/ZCPY
26951          * channels. DPCCS is held to avoid race conditions with PCPY channels.
26952          * If DPC is scheduled in process context (IO_Schedule) and any
26953 @@ -263,47 +194,47 @@ func_cont:
26954                 if (pChnl->uChnlType == CHNL_PCPY && pChnl->uId > 1)
26955                         pChirp->pHostSysBuf = pHostSysBuf;
26956  
26957 -               if (DSP_SUCCEEDED(status)) {
26958 -                       /* Note: for dma chans dwDspAddr contains dsp address
26959 -                        * of SM buffer.*/
26960 -                       DBC_Assert(pChnlMgr->uWordSize != 0);
26961 -                       /* DSP address */
26962 -                       pChirp->uDspAddr = dwDspAddr / pChnlMgr->uWordSize;
26963 -                       pChirp->cBytes = cBytes;
26964 -                       pChirp->cBufSize = cBufSize;
26965 -                       /* Only valid for output channel */
26966 -                       pChirp->dwArg = dwArg;
26967 -                       pChirp->status = (fIsEOS ? CHNL_IOCSTATEOS :
26968 -                                        CHNL_IOCSTATCOMPLETE);
26969 -                       LST_PutTail(pChnl->pIORequests, (struct LST_ELEM *)
26970 -                                  pChirp);
26971 -                       pChnl->cIOReqs++;
26972 -                       DBC_Assert(pChnl->cIOReqs <= pChnl->cChirps);
26973 -                       /* If end of stream, update the channel state to prevent
26974 -                        * more IOR's: */
26975 -                       if (fIsEOS)
26976 -                               pChnl->dwState |= CHNL_STATEEOS;
26977 +               /*
26978 +                * Note: for dma chans dwDspAddr contains dsp address
26979 +                * of SM buffer.
26980 +                */
26981 +               DBC_Assert(pChnlMgr->uWordSize != 0);
26982 +               /* DSP address */
26983 +               pChirp->uDspAddr = dwDspAddr / pChnlMgr->uWordSize;
26984 +               pChirp->cBytes = cBytes;
26985 +               pChirp->cBufSize = cBufSize;
26986 +               /* Only valid for output channel */
26987 +               pChirp->dwArg = dwArg;
26988 +               pChirp->status = (fIsEOS ? CHNL_IOCSTATEOS :
26989 +                                               CHNL_IOCSTATCOMPLETE);
26990 +               LST_PutTail(pChnl->pIORequests, (struct list_head *)pChirp);
26991 +               pChnl->cIOReqs++;
26992 +               DBC_Assert(pChnl->cIOReqs <= pChnl->cChirps);
26993 +               /* If end of stream, update the channel state to prevent
26994 +                * more IOR's: */
26995 +               if (fIsEOS)
26996 +                       pChnl->dwState |= CHNL_STATEEOS;
26997 +
26998 +               /* Legacy DSM Processor-Copy */
26999 +               DBC_Assert(pChnl->uChnlType == CHNL_PCPY);
27000 +               /* Request IO from the DSP */
27001 +               IO_RequestChnl(pChnlMgr->hIOMgr, pChnl,
27002 +                       (CHNL_IsInput(pChnl->uMode) ? IO_INPUT : IO_OUTPUT),
27003 +                                                               &wMbVal);
27004 +               fSchedDPC = true;
27005 +
27006  
27007 -                       {
27008 -                               /* Legacy DSM Processor-Copy */
27009 -                               DBC_Assert(pChnl->uChnlType == CHNL_PCPY);
27010 -                               /* Request IO from the DSP */
27011 -                               IO_RequestChnl(pChnlMgr->hIOMgr, pChnl,
27012 -                                       (CHNL_IsInput(pChnl->uMode) ?
27013 -                                       IO_INPUT : IO_OUTPUT), &wMbVal);
27014 -                               fSchedDPC = true;
27015 -                       }
27016 -               }
27017         }
27018         enable_irq(MAILBOX_IRQ);
27019         SYNC_LeaveCS(pChnlMgr->hCSObj);
27020         if (wMbVal != 0)
27021                 IO_IntrDSP2(pChnlMgr->hIOMgr, wMbVal);
27022  
27023 -       if (fSchedDPC == true) {
27024 -               /* Schedule a DPC, to do the actual data transfer: */
27025 +       /* Schedule a DPC, to do the actual data transfer: */
27026 +       if (fSchedDPC)
27027                 IO_Schedule(pChnlMgr->hIOMgr);
27028 -       }
27029 +
27030 +func_end:
27031         DBG_Trace(DBG_ENTER, "< WMD_CHNL_AddIOReq pChnl %p\n", pChnl);
27032         return status;
27033  }
27034 @@ -322,12 +253,12 @@ DSP_STATUS WMD_CHNL_CancelIO(struct CHNL
27035         DSP_STATUS status = DSP_SOK;
27036         struct CHNL_OBJECT *pChnl = (struct CHNL_OBJECT *)hChnl;
27037         u32 iChnl = -1;
27038 -       CHNL_MODE uMode;
27039 +       short int uMode;
27040         struct CHNL_IRP *pChirp;
27041         struct CHNL_MGR *pChnlMgr = NULL;
27042  
27043         /* Check args: */
27044 -       if (MEM_IsValidHandle(pChnl, CHNL_SIGNATURE)) {
27045 +       if (MEM_IsValidHandle(pChnl, CHNL_SIGNATURE) && pChnl->pChnlMgr) {
27046                 iChnl = pChnl->uId;
27047                 uMode = pChnl->uMode;
27048                 pChnlMgr = pChnl->pChnlMgr;
27049 @@ -361,7 +292,7 @@ DSP_STATUS WMD_CHNL_CancelIO(struct CHNL
27050                         pChirp->cBytes = 0;
27051                         pChirp->status |= CHNL_IOCSTATCANCEL;
27052                         LST_PutTail(pChnl->pIOCompletions,
27053 -                                  (struct LST_ELEM *)pChirp);
27054 +                                  (struct list_head *)pChirp);
27055                         pChnl->cIOCs++;
27056                         pChnl->cIOReqs--;
27057                         DBC_Assert(pChnl->cIOReqs >= 0);
27058 @@ -454,58 +385,48 @@ DSP_STATUS WMD_CHNL_Create(OUT struct CH
27059         DSP_STATUS status = DSP_SOK;
27060         struct CHNL_MGR *pChnlMgr = NULL;
27061         s32 cChannels;
27062 -#ifdef DEBUG
27063 -       struct CHNL_MGR *hChnlMgr;
27064 -#endif
27065 +
27066         /* Check DBC requirements:  */
27067         DBC_Require(phChnlMgr != NULL);
27068         DBC_Require(pMgrAttrs != NULL);
27069         DBC_Require(pMgrAttrs->cChannels > 0);
27070         DBC_Require(pMgrAttrs->cChannels <= CHNL_MAXCHANNELS);
27071         DBC_Require(pMgrAttrs->uWordSize != 0);
27072 -#ifdef DEBUG
27073 -       /* This for the purposes of DBC_Require: */
27074 -       status = DEV_GetChnlMgr(hDevObject, &hChnlMgr);
27075 -       DBC_Require(status != DSP_EHANDLE);
27076 -       DBC_Require(hChnlMgr == NULL);
27077 -#endif
27078 -       if (DSP_SUCCEEDED(status)) {
27079 -               /* Allocate channel manager object: */
27080 -               MEM_AllocObject(pChnlMgr, struct CHNL_MGR, CHNL_MGRSIGNATURE);
27081 -               if (pChnlMgr) {
27082 -                       /* The cChannels attr must equal the # of supported
27083 -                        * chnls for each transport(# chnls for PCPY = DDMA =
27084 -                        * ZCPY): i.e. pMgrAttrs->cChannels = CHNL_MAXCHANNELS =
27085 -                        * DDMA_MAXDDMACHNLS = DDMA_MAXZCPYCHNLS.  */
27086 -                       DBC_Assert(pMgrAttrs->cChannels == CHNL_MAXCHANNELS);
27087 -                       cChannels = (CHNL_MAXCHANNELS + (CHNL_MAXCHANNELS *
27088 -                                   CHNL_PCPY));
27089 -                       /* Create array of channels: */
27090 -                       pChnlMgr->apChannel = MEM_Calloc(
27091 -                                               sizeof(struct CHNL_OBJECT *) *
27092 -                                               cChannels, MEM_NONPAGED);
27093 -                       if (pChnlMgr->apChannel) {
27094 -                               /* Initialize CHNL_MGR object: */
27095 -                               /* Shared memory driver. */
27096 -                               pChnlMgr->dwType = CHNL_TYPESM;
27097 -                               pChnlMgr->uWordSize = pMgrAttrs->uWordSize;
27098 -                               /* total # chnls supported */
27099 -                               pChnlMgr->cChannels = cChannels;
27100 -                               pChnlMgr->cOpenChannels = 0;
27101 -                               pChnlMgr->dwOutputMask = 0;
27102 -                               pChnlMgr->dwLastOutput = 0;
27103 -                               pChnlMgr->hDevObject = hDevObject;
27104 -                               if (DSP_SUCCEEDED(status)) {
27105 -                                       status = SYNC_InitializeDPCCS
27106 -                                               (&pChnlMgr->hCSObj);
27107 -                               }
27108 -                       } else {
27109 -                               status = DSP_EMEMORY;
27110 -                       }
27111 +
27112 +       /* Allocate channel manager object: */
27113 +       MEM_AllocObject(pChnlMgr, struct CHNL_MGR, CHNL_MGRSIGNATURE);
27114 +       if (pChnlMgr) {
27115 +               /* The cChannels attr must equal the # of supported
27116 +                * chnls for each transport(# chnls for PCPY = DDMA =
27117 +                * ZCPY): i.e. pMgrAttrs->cChannels = CHNL_MAXCHANNELS =
27118 +                * DDMA_MAXDDMACHNLS = DDMA_MAXZCPYCHNLS.  */
27119 +               DBC_Assert(pMgrAttrs->cChannels == CHNL_MAXCHANNELS);
27120 +               cChannels = CHNL_MAXCHANNELS + CHNL_MAXCHANNELS * CHNL_PCPY;
27121 +               /* Create array of channels: */
27122 +               pChnlMgr->apChannel = MEM_Calloc(
27123 +                               sizeof(struct CHNL_OBJECT *) *
27124 +                               cChannels, MEM_NONPAGED);
27125 +               if (pChnlMgr->apChannel) {
27126 +                       /* Initialize CHNL_MGR object: */
27127 +                       /* Shared memory driver. */
27128 +                       pChnlMgr->dwType = CHNL_TYPESM;
27129 +                       pChnlMgr->uWordSize = pMgrAttrs->uWordSize;
27130 +                       /* total # chnls supported */
27131 +                       pChnlMgr->cChannels = cChannels;
27132 +                       pChnlMgr->cOpenChannels = 0;
27133 +                       pChnlMgr->dwOutputMask = 0;
27134 +                       pChnlMgr->dwLastOutput = 0;
27135 +                       pChnlMgr->hDevObject = hDevObject;
27136 +                       if (DSP_SUCCEEDED(status))
27137 +                               status = SYNC_InitializeDPCCS(
27138 +                                                       &pChnlMgr->hCSObj);
27139                 } else {
27140                         status = DSP_EMEMORY;
27141                 }
27142 +       } else {
27143 +               status = DSP_EMEMORY;
27144         }
27145 +
27146         if (DSP_FAILED(status)) {
27147                 WMD_CHNL_Destroy(pChnlMgr);
27148                 *phChnlMgr = NULL;
27149 @@ -530,10 +451,10 @@ DSP_STATUS WMD_CHNL_Destroy(struct CHNL_
27150         if (MEM_IsValidHandle(hChnlMgr, CHNL_MGRSIGNATURE)) {
27151                 /* Close all open channels: */
27152                 for (iChnl = 0; iChnl < pChnlMgr->cChannels; iChnl++) {
27153 -                       if (DSP_SUCCEEDED
27154 -                           (WMD_CHNL_Close(pChnlMgr->apChannel[iChnl]))) {
27155 -                               DBC_Assert(pChnlMgr->apChannel[iChnl] == NULL);
27156 -                       }
27157 +                       status = WMD_CHNL_Close(pChnlMgr->apChannel[iChnl]);
27158 +                       if (DSP_FAILED(status))
27159 +                               DBG_Trace(DBG_LEVEL7, "Error in CHNL_Close "
27160 +                                               "status 0x%x\n", status);
27161                 }
27162                 /* release critical section */
27163                 if (pChnlMgr->hCSObj)
27164 @@ -562,7 +483,7 @@ DSP_STATUS WMD_CHNL_FlushIO(struct CHNL_
27165  {
27166         DSP_STATUS status = DSP_SOK;
27167         struct CHNL_OBJECT *pChnl = (struct CHNL_OBJECT *)hChnl;
27168 -       CHNL_MODE uMode = -1;
27169 +       short int uMode = -1;
27170         struct CHNL_MGR *pChnlMgr;
27171         struct CHNL_IOC chnlIOC;
27172         /* Check args:  */
27173 @@ -715,8 +636,8 @@ DSP_STATUS WMD_CHNL_GetIOC(struct CHNL_O
27174                         ioc.dwArg = pChirp->dwArg;
27175                         ioc.status |= pChirp->status;
27176                         /* Place the used chirp on the free list: */
27177 -                       LST_PutTail(pChnl->pFreeList, (struct LST_ELEM *)
27178 -                                  pChirp);
27179 +                       LST_PutTail(pChnl->pFreeList,
27180 +                                       (struct list_head *)pChirp);
27181                 } else {
27182                         ioc.pBuf = NULL;
27183                         ioc.cBytes = 0;
27184 @@ -763,7 +684,6 @@ DSP_STATUS WMD_CHNL_GetIOC(struct CHNL_O
27185  
27186                 /*pHostUserBuf */
27187                 status = copy_to_user(ioc.pBuf, pHostSysBuf, ioc.cBytes);
27188 -#ifndef RES_CLEANUP_DISABLE
27189                 if (status) {
27190                         if (current->flags & PF_EXITING) {
27191                                 DBG_Trace(DBG_LEVEL7,
27192 @@ -778,7 +698,6 @@ DSP_STATUS WMD_CHNL_GetIOC(struct CHNL_O
27193                                          current->flags);
27194                         }
27195                 }
27196 -#endif
27197                 if (status) {
27198                         DBG_Trace(DBG_LEVEL7,
27199                                  "Error copying kernel buffer to user, %d"
27200 @@ -837,7 +756,7 @@ DSP_STATUS WMD_CHNL_GetMgrInfo(struct CH
27201  DSP_STATUS WMD_CHNL_Idle(struct CHNL_OBJECT *hChnl, u32 dwTimeOut,
27202                          bool fFlush)
27203  {
27204 -       CHNL_MODE uMode;
27205 +       short int uMode;
27206         struct CHNL_MGR *pChnlMgr;
27207         DSP_STATUS status = DSP_SOK;
27208  
27209 @@ -865,7 +784,7 @@ DSP_STATUS WMD_CHNL_Idle(struct CHNL_OBJ
27210   *      Open a new half-duplex channel to the DSP board.
27211   */
27212  DSP_STATUS WMD_CHNL_Open(OUT struct CHNL_OBJECT **phChnl,
27213 -                        struct CHNL_MGR *hChnlMgr, CHNL_MODE uMode,
27214 +                        struct CHNL_MGR *hChnlMgr, short int uMode,
27215                          u32 uChnlId, CONST IN struct CHNL_ATTRS *pAttrs)
27216  {
27217         DSP_STATUS status = DSP_SOK;
27218 @@ -876,6 +795,7 @@ DSP_STATUS WMD_CHNL_Open(OUT struct CHNL
27219         /* Ensure DBC requirements:  */
27220         DBC_Require(phChnl != NULL);
27221         DBC_Require(pAttrs != NULL);
27222 +       DBC_Require(hChnlMgr != NULL);
27223         *phChnl = NULL;
27224         /* Validate Args:  */
27225         if (pAttrs->uIOReqs == 0) {
27226 @@ -885,12 +805,11 @@ DSP_STATUS WMD_CHNL_Open(OUT struct CHNL
27227                         status = DSP_EHANDLE;
27228                 } else {
27229                         if (uChnlId != CHNL_PICKFREE) {
27230 -                               if (uChnlId >= pChnlMgr->cChannels) {
27231 +                               if (uChnlId >= pChnlMgr->cChannels)
27232                                         status = CHNL_E_BADCHANID;
27233 -                               } else if (pChnlMgr->apChannel[uChnlId] !=
27234 -                                         NULL) {
27235 +                               else if (pChnlMgr->apChannel[uChnlId] !=
27236 +                                         NULL)
27237                                         status = CHNL_E_CHANBUSY;
27238 -                               }
27239                         } else {
27240                                 /* Check for free channel */
27241                                 status = SearchFreeChannel(pChnlMgr, &uChnlId);
27242 @@ -905,7 +824,7 @@ DSP_STATUS WMD_CHNL_Open(OUT struct CHNL
27243         MEM_AllocObject(pChnl, struct CHNL_OBJECT, 0x0000);
27244         if (!pChnl) {
27245                 status = DSP_EMEMORY;
27246 -               goto func_cont;
27247 +               goto func_end;
27248         }
27249         /* Protect queues from IO_DPC: */
27250         pChnl->dwState = CHNL_STATECANCEL;
27251 @@ -917,13 +836,9 @@ DSP_STATUS WMD_CHNL_Open(OUT struct CHNL
27252         pChnl->cIOCs = 0;
27253         pChnl->cIOReqs = 0;
27254         status = SYNC_OpenEvent(&hSyncEvent, pSyncAttrs);
27255 -       if (DSP_SUCCEEDED(status)) {
27256 +       if (DSP_SUCCEEDED(status))
27257                 status = NTFY_Create(&pChnl->hNtfy);
27258 -               if (DSP_FAILED(status)) {
27259 -                       /* The only failure that could have occurred */
27260 -                       status = DSP_EMEMORY;
27261 -               }
27262 -       }
27263 +
27264         if (DSP_SUCCEEDED(status)) {
27265                 if (pChnl->pIOCompletions && pChnl->pIORequests &&
27266                    pChnl->pFreeList) {
27267 @@ -933,7 +848,7 @@ DSP_STATUS WMD_CHNL_Open(OUT struct CHNL
27268                         pChnl->uMode = uMode;
27269                         pChnl->hUserEvent = hSyncEvent; /* for Linux */
27270                         pChnl->hSyncEvent = hSyncEvent;
27271 -                       /* Return TGID instead of process handle */
27272 +                       /* Get the process handle */
27273                         pChnl->hProcess = current->tgid;
27274                         pChnl->pCBArg = 0;
27275                         pChnl->cBytesMoved = 0;
27276 @@ -942,9 +857,8 @@ DSP_STATUS WMD_CHNL_Open(OUT struct CHNL
27277                 } else {
27278                         status = DSP_EMEMORY;
27279                 }
27280 -       } else {
27281 -               status = DSP_EINVALIDARG;
27282         }
27283 +
27284         if (DSP_FAILED(status)) {
27285                 /* Free memory */
27286                 if (pChnl->pIOCompletions) {
27287 @@ -969,9 +883,7 @@ DSP_STATUS WMD_CHNL_Open(OUT struct CHNL
27288                         pChnl->hNtfy = NULL;
27289                 }
27290                 MEM_FreeObject(pChnl);
27291 -       }
27292 -func_cont:
27293 -       if (DSP_SUCCEEDED(status)) {
27294 +       } else {
27295                 /* Insert channel object in channel manager: */
27296                 pChnlMgr->apChannel[pChnl->uId] = pChnl;
27297                 SYNC_EnterCS(pChnlMgr->hCSObj);
27298 @@ -1024,13 +936,14 @@ static struct LST_LIST *CreateChirpList(
27299         struct CHNL_IRP *pChirp;
27300         u32 i;
27301  
27302 -       pChirpList = LST_Create();
27303 +       pChirpList = MEM_Calloc(sizeof(struct LST_LIST), MEM_NONPAGED);
27304  
27305         if (pChirpList) {
27306 +               INIT_LIST_HEAD(&pChirpList->head);
27307                 /* Make N chirps and place on queue. */
27308                 for (i = 0; (i < uChirps) && ((pChirp = MakeNewChirp()) !=
27309                     NULL); i++) {
27310 -                       LST_PutTail(pChirpList, (struct LST_ELEM *)pChirp);
27311 +                       LST_PutTail(pChirpList, (struct list_head *)pChirp);
27312                 }
27313  
27314                 /* If we couldn't allocate all chirps, free those allocated: */
27315 @@ -1055,7 +968,7 @@ static void FreeChirpList(struct LST_LIS
27316         while (!LST_IsEmpty(pChirpList))
27317                 MEM_Free(LST_GetHead(pChirpList));
27318  
27319 -       LST_Delete(pChirpList);
27320 +       MEM_Free(pChirpList);
27321  }
27322  
27323  /*
27324 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/io_sm.c kernel-power-2.6.28/drivers/dsp/bridge/wmd/io_sm.c
27325 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/io_sm.c     2011-04-17 17:32:26.000000000 +0100
27326 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/io_sm.c  2011-05-02 22:36:51.000000000 +0100
27327 @@ -3,6 +3,8 @@
27328   *
27329   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
27330   *
27331 + * IO dispatcher for a shared memory channel driver.
27332 + *
27333   * Copyright (C) 2005-2006 Texas Instruments, Inc.
27334   *
27335   * This package is free software; you can redistribute it and/or modify
27336 @@ -15,37 +17,14 @@
27337   */
27338  
27339  /*
27340 - *  ======== io_sm.c ========
27341 - *  Description:
27342 - *      IO dispatcher for a shared memory channel driver.
27343 - *
27344 - *  Public Functions:
27345 - *      WMD_IO_Create
27346 - *      WMD_IO_Destroy
27347 - *      WMD_IO_OnLoaded
27348 - *      IO_AndSetValue
27349 - *      IO_BufSize
27350 - *      IO_CancelChnl
27351 - *      IO_DPC
27352 - *      IO_ISR
27353 - *      IO_IVAISR
27354 - *      IO_OrSetValue
27355 - *      IO_ReadValue
27356 - *      IO_ReadValueLong
27357 - *      IO_RequestChnl
27358 - *      IO_Schedule
27359 - *      IO_WriteValue
27360 - *      IO_WriteValueLong
27361 - *
27362 - *  Channel Invariant:
27363 - *      There is an important invariant condition which must be maintained per
27364 - *      channel outside of WMD_CHNL_GetIOC() and IO_Dispatch(), violation of
27365 - *      which may cause timeouts and/or failure of the WIN32_WaitSingleObject
27366 - *      function (SYNC_WaitOnEvent).
27367 - *
27368 + * Channel Invariant:
27369 + * There is an important invariant condition which must be maintained per
27370 + * channel outside of WMD_CHNL_GetIOC() and IO_Dispatch(), violation of
27371 + * which may cause timeouts and/or failure of the SYNC_WaitOnEvent
27372 + * function.
27373   */
27374  
27375 -/*  ----------------------------------- Host OS */
27376 +/* Host OS */
27377  #include <dspbridge/host_os.h>
27378  #include <linux/workqueue.h>
27379  
27380 @@ -54,51 +33,48 @@
27381  #include <dspbridge/dbdefs.h>
27382  #include <dspbridge/errbase.h>
27383  
27384 -/*  ----------------------------------- Trace & Debug */
27385 +/* Trace & Debug */
27386  #include <dspbridge/dbc.h>
27387  #include <dspbridge/dbg.h>
27388  
27389 -/*  ----------------------------------- OS Adaptation Layer */
27390 +/* Services Layer */
27391  #include <dspbridge/cfg.h>
27392 -#include <dspbridge/dpc.h>
27393  #include <dspbridge/mem.h>
27394  #include <dspbridge/ntfy.h>
27395  #include <dspbridge/sync.h>
27396  #include <dspbridge/reg.h>
27397  
27398 -/* ------------------------------------ Hardware Abstraction Layer */
27399 +/* Hardware Abstraction Layer */
27400  #include <hw_defs.h>
27401  #include <hw_mmu.h>
27402  
27403 -/*  ----------------------------------- Mini Driver */
27404 +/* Mini Driver */
27405  #include <dspbridge/wmddeh.h>
27406  #include <dspbridge/wmdio.h>
27407  #include <dspbridge/wmdioctl.h>
27408  #include <_tiomap.h>
27409  #include <tiomap_io.h>
27410  #include <_tiomap_pwr.h>
27411 -#include <tiomap_io.h>
27412  
27413 -/*  ----------------------------------- Platform Manager */
27414 +/* Platform Manager */
27415  #include <dspbridge/cod.h>
27416  #include <dspbridge/dev.h>
27417  #include <dspbridge/chnl_sm.h>
27418 -#include <dspbridge/dbreg.h>
27419  
27420 -/*  ----------------------------------- Others */
27421 +/* Others */
27422  #include <dspbridge/rms_sh.h>
27423  #include <dspbridge/mgr.h>
27424  #include <dspbridge/drv.h>
27425  #include "_cmm.h"
27426  
27427 -/*  ----------------------------------- This */
27428 +/* This */
27429  #include <dspbridge/io_sm.h>
27430  #include "_msg_sm.h"
27431  #include <dspbridge/gt.h>
27432  
27433 -/*  ----------------------------------- Defines, Data Structures, Typedefs */
27434 +/* Defines, Data Structures, Typedefs */
27435  #define OUTPUTNOTREADY  0xffff
27436 -#define NOTENABLED      0xffff /* channel(s) not enabled */
27437 +#define NOTENABLED      0xffff /* Channel(s) not enabled */
27438  
27439  #define EXTEND      "_EXT_END"
27440  
27441 @@ -107,34 +83,33 @@
27442  
27443  #define MAX_PM_REQS 32
27444  
27445 -/* IO Manager: only one created per board: */
27446 +/* IO Manager: only one created per board */
27447  struct IO_MGR {
27448 -       /* These four fields must be the first fields in a IO_MGR_ struct: */
27449 -       u32 dwSignature;        /* Used for object validation   */
27450 -       struct WMD_DEV_CONTEXT *hWmdContext;    /* WMD device context  */
27451 +       /* These four fields must be the first fields in a IO_MGR_ struct */
27452 +       u32 dwSignature;        /* Used for object validation */
27453 +       struct WMD_DEV_CONTEXT *hWmdContext;    /* WMD device context */
27454         struct WMD_DRV_INTERFACE *pIntfFxns;    /* Function interface to WMD */
27455         struct DEV_OBJECT *hDevObject;  /* Device this board represents */
27456  
27457 -       /* These fields initialized in WMD_IO_Create():    */
27458 +       /* These fields initialized in WMD_IO_Create() */
27459         struct CHNL_MGR *hChnlMgr;
27460 -       struct SHM *pSharedMem;         /* Shared Memory control        */
27461 -       u8 *pInput;             /* Address of input channel     */
27462 -       u8 *pOutput;            /* Address of output channel    */
27463 +       struct SHM *pSharedMem;         /* Shared Memory control */
27464 +       u8 *pInput;             /* Address of input channel */
27465 +       u8 *pOutput;            /* Address of output channel */
27466         struct MSG_MGR *hMsgMgr;        /* Message manager */
27467         struct MSG *pMsgInputCtrl;      /* Msg control for from DSP messages */
27468         struct MSG *pMsgOutputCtrl;     /* Msg control for to DSP messages */
27469 -       u8 *pMsgInput;  /* Address of input messages    */
27470 -       u8 *pMsgOutput;         /* Address of output messages   */
27471 +       u8 *pMsgInput;  /* Address of input messages */
27472 +       u8 *pMsgOutput;         /* Address of output messages */
27473         u32 uSMBufSize;         /* Size of a shared memory I/O channel */
27474 -       bool fSharedIRQ;        /* Is this IRQ shared?    */
27475 -       struct DPC_OBJECT *hDPC;        /* DPC object handle        */
27476 +       bool fSharedIRQ;        /* Is this IRQ shared? */
27477         struct SYNC_CSOBJECT *hCSObj;   /* Critical section object handle */
27478 -       u32 uWordSize;  /* Size in bytes of DSP word    */
27479 -       u16 wIntrVal;           /* interrupt value            */
27480 -       /* private extnd proc info; mmu setup */
27481 +       u32 uWordSize;  /* Size in bytes of DSP word */
27482 +       u16 wIntrVal;           /* Interrupt value */
27483 +       /* Private extnd proc info; mmu setup */
27484         struct MGR_PROCESSOREXTINFO extProcInfo;
27485 -       struct CMM_OBJECT *hCmmMgr;     /* Shared Mem Mngr            */
27486 -       struct work_struct io_workq;     /*workqueue */
27487 +       struct CMM_OBJECT *hCmmMgr;     /* Shared Mem Mngr */
27488 +       struct work_struct io_workq;     /* workqueue */
27489         u32 dQuePowerMbxVal[MAX_PM_REQS];
27490         u32 iQuePowerHead;
27491         u32 iQuePowerTail;
27492 @@ -147,9 +122,15 @@ struct IO_MGR {
27493         u32 ulGppVa;
27494         u32 ulDspVa;
27495  #endif
27496 +       /* IO Dpc */
27497 +       u32 dpc_req;                            /* Number of requested DPC's. */
27498 +       u32 dpc_sched;                          /* Number of executed DPC's. */
27499 +       struct tasklet_struct dpc_tasklet;
27500 +       spinlock_t dpc_lock;
27501 +
27502  } ;
27503  
27504 -/*  ----------------------------------- Function Prototypes */
27505 +/* Function Prototypes */
27506  static void IO_DispatchChnl(IN struct IO_MGR *pIOMgr,
27507                            IN OUT struct CHNL_OBJECT *pChnl, u32 iMode);
27508  static void IO_DispatchMsg(IN struct IO_MGR *pIOMgr, struct MSG_MGR *hMsgMgr);
27509 @@ -173,7 +154,7 @@ static struct workqueue_struct *bridge_w
27510  void PrintDSPDebugTrace(struct IO_MGR *hIOMgr);
27511  #endif
27512  
27513 -/* Bus Addr (cached kernel)*/
27514 +/* Bus Addr (cached kernel) */
27515  static DSP_STATUS registerSHMSegs(struct IO_MGR *hIOMgr,
27516                                   struct COD_MANAGER *hCodMan,
27517                                   u32 dwGPPBasePA);
27518 @@ -206,22 +187,26 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_M
27519         struct CHNL_MGR *hChnlMgr;
27520         static int ref_count;
27521         u32 devType;
27522 -       /* Check DBC requirements:  */
27523 -       DBC_Require(phIOMgr != NULL);
27524 -       DBC_Require(pMgrAttrs != NULL);
27525 -       DBC_Require(pMgrAttrs->uWordSize != 0);
27526 -       /* This for the purposes of DBC_Require: */
27527 -       status = DEV_GetChnlMgr(hDevObject, &hChnlMgr);
27528 -       DBC_Require(status != DSP_EHANDLE);
27529 -       DBC_Require(hChnlMgr != NULL);
27530 -       DBC_Require(hChnlMgr->hIOMgr == NULL);
27531 +       /* Check requirements */
27532 +       if (!phIOMgr || !pMgrAttrs || pMgrAttrs->uWordSize == 0) {
27533 +               status = DSP_EHANDLE;
27534 +               goto func_end;
27535 +       }
27536 +       DEV_GetChnlMgr(hDevObject, &hChnlMgr);
27537 +       if (!hChnlMgr || hChnlMgr->hIOMgr) {
27538 +               status = DSP_EHANDLE;
27539 +               goto func_end;
27540 +       }
27541         /*
27542          * Message manager will be created when a file is loaded, since
27543          * size of message buffer in shared memory is configurable in
27544          * the base image.
27545          */
27546         DEV_GetWMDContext(hDevObject, &hWmdContext);
27547 -       DBC_Assert(hWmdContext);
27548 +       if (!hWmdContext) {
27549 +               status = DSP_EHANDLE;
27550 +               goto func_end;
27551 +       }
27552         DEV_GetDevType(hDevObject, &devType);
27553         /*
27554          * DSP shared memory area will get set properly when
27555 @@ -230,31 +215,30 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_M
27556          * a valid address than 0.
27557          */
27558         pSharedMem = (struct SHM *) -1;
27559 -       if (DSP_FAILED(status))
27560 -               goto func_cont;
27561  
27562         /* Create a Single Threaded Work Queue */
27563         if (ref_count == 0)
27564                 bridge_workqueue = create_workqueue("bridge_work-queue");
27565  
27566 -       if (!bridge_workqueue)
27567 -               DBG_Trace(DBG_LEVEL1, "Workqueue creation failed!\n");
27568 +       if (bridge_workqueue <= 0)
27569 +               DBG_Trace(DBG_LEVEL1, "Workque Create failed 0x%d \n",
27570 +                                               bridge_workqueue);
27571  
27572 -       /* Allocate IO manager object: */
27573 +       /* Allocate IO manager object */
27574         MEM_AllocObject(pIOMgr, struct IO_MGR, IO_MGRSIGNATURE);
27575         if (pIOMgr == NULL) {
27576                 status = DSP_EMEMORY;
27577 -               goto func_cont;
27578 +               goto func_end;
27579         }
27580 -
27581         /* Intializing Work Element */
27582         if (ref_count == 0) {
27583                 INIT_WORK(&pIOMgr->io_workq, (void *)IO_DispatchPM);
27584                 ref_count = 1;
27585 -       } else
27586 +       } else {
27587                 PREPARE_WORK(&pIOMgr->io_workq, (void *)IO_DispatchPM);
27588 +       }
27589  
27590 -       /* Initialize CHNL_MGR object:    */
27591 +       /* Initialize CHNL_MGR object */
27592  #ifndef DSP_TRACEBUF_DISABLED
27593         pIOMgr->pMsg = NULL;
27594  #endif
27595 @@ -265,8 +249,15 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_M
27596                 status = SYNC_InitializeCS(&pIOMgr->hCSObj);
27597  
27598         if (devType == DSP_UNIT) {
27599 -               /* Create a DPC object: */
27600 -               status = DPC_Create(&pIOMgr->hDPC, IO_DPC, (void *)pIOMgr);
27601 +               /* Create an IO DPC */
27602 +               tasklet_init(&pIOMgr->dpc_tasklet, IO_DPC, (u32)pIOMgr);
27603 +
27604 +               /* Initialize DPC counters */
27605 +               pIOMgr->dpc_req = 0;
27606 +               pIOMgr->dpc_sched = 0;
27607 +
27608 +               spin_lock_init(&pIOMgr->dpc_lock);
27609 +
27610                 if (DSP_SUCCEEDED(status))
27611                         status = DEV_GetDevNode(hDevObject, &hDevNode);
27612  
27613 @@ -283,25 +274,23 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_M
27614                 IO_DisableInterrupt(hWmdContext);
27615                 if (devType == DSP_UNIT) {
27616                         HW_MBOX_initSettings(hostRes.dwMboxBase);
27617 -                       /* Plug the channel ISR:. */
27618 +                       /* Plug the channel ISR */
27619                         if ((request_irq(INT_MAIL_MPU_IRQ, IO_ISR, 0,
27620 -                               "DspBridge\tmailbox", (void *)pIOMgr)) == 0)
27621 -                               status = DSP_SOK;
27622 +                         "DspBridge\tmailbox", (void *)pIOMgr)) == 0)
27623 +                               DBG_Trace(DBG_LEVEL1, "ISR_IRQ Object 0x%x \n",
27624 +                                               pIOMgr);
27625                         else
27626 -                               status = DSP_EFAIL;
27627 +                               status = CHNL_E_ISR;
27628                 }
27629 -               if (DSP_SUCCEEDED(status))
27630 -                       DBG_Trace(DBG_LEVEL1, "ISR_IRQ Object 0x%x \n",
27631 -                                       pIOMgr);
27632 -               else
27633 -                       status = CHNL_E_ISR;
27634 -       } else
27635 +       } else {
27636                 status = CHNL_E_ISR;
27637 -func_cont:
27638 +       }
27639 +func_end:
27640         if (DSP_FAILED(status)) {
27641 -               /* Cleanup: */
27642 +               /* Cleanup */
27643                 WMD_IO_Destroy(pIOMgr);
27644 -               *phIOMgr = NULL;
27645 +               if (phIOMgr)
27646 +                       *phIOMgr = NULL;
27647         } else {
27648                 /* Return IO manager object to caller... */
27649                 hChnlMgr->hIOMgr = pIOMgr;
27650 @@ -320,25 +309,29 @@ DSP_STATUS WMD_IO_Destroy(struct IO_MGR 
27651         DSP_STATUS status = DSP_SOK;
27652         struct WMD_DEV_CONTEXT *hWmdContext;
27653         if (MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE)) {
27654 -               /* Unplug IRQ:    */
27655 -               /* Disable interrupts from the board:  */
27656 -               if (DSP_SUCCEEDED(DEV_GetWMDContext(hIOMgr->hDevObject,
27657 -                      &hWmdContext)))
27658 -                               DBC_Assert(hWmdContext);
27659 -               (void)CHNLSM_DisableInterrupt(hWmdContext);
27660 -               destroy_workqueue(bridge_workqueue);
27661 -               /* Linux function to uninstall ISR */
27662 -               free_irq(INT_MAIL_MPU_IRQ, (void *)hIOMgr);
27663 -               (void)DPC_Destroy(hIOMgr->hDPC);
27664 +               /* Disable interrupts from the board */
27665 +               status = DEV_GetWMDContext(hIOMgr->hDevObject, &hWmdContext);
27666 +               if (DSP_SUCCEEDED(status))
27667 +                       (void)CHNLSM_DisableInterrupt(hWmdContext);
27668 +
27669 +               destroy_workqueue(bridge_workqueue);
27670 +               /* Linux function to uninstall ISR */
27671 +               free_irq(INT_MAIL_MPU_IRQ, (void *)hIOMgr);
27672 +
27673 +               /* Free IO DPC object */
27674 +               tasklet_kill(&hIOMgr->dpc_tasklet);
27675 +               DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
27676 +
27677  #ifndef DSP_TRACEBUF_DISABLED
27678                 if (hIOMgr->pMsg)
27679                         MEM_Free(hIOMgr->pMsg);
27680  #endif
27681                 SYNC_DeleteCS(hIOMgr->hCSObj);  /* Leak Fix. */
27682 -               /* Free this IO manager object: */
27683 +               /* Free this IO manager object */
27684                 MEM_FreeObject(hIOMgr);
27685 -       } else
27686 +       } else {
27687                 status = DSP_EHANDLE;
27688 +       }
27689  
27690         return status;
27691  }
27692 @@ -389,13 +382,17 @@ DSP_STATUS WMD_IO_OnLoaded(struct IO_MGR
27693                            HW_PAGE_SIZE_64KB, HW_PAGE_SIZE_4KB };
27694  
27695         status = DEV_GetCodMgr(hIOMgr->hDevObject, &hCodMan);
27696 -       DBC_Assert(DSP_SUCCEEDED(status));
27697 +       if (DSP_FAILED(status))
27698 +               goto func_end;
27699         hChnlMgr = hIOMgr->hChnlMgr;
27700 -        /*  The message manager is destroyed when the board is stopped.  */
27701 +       /* The message manager is destroyed when the board is stopped. */
27702         DEV_GetMsgMgr(hIOMgr->hDevObject, &hIOMgr->hMsgMgr);
27703         hMsgMgr = hIOMgr->hMsgMgr;
27704 -       DBC_Assert(MEM_IsValidHandle(hChnlMgr, CHNL_MGRSIGNATURE));
27705 -       DBC_Assert(MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE));
27706 +       if (!MEM_IsValidHandle(hChnlMgr, CHNL_MGRSIGNATURE) ||
27707 +          !MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE)) {
27708 +               status = DSP_EHANDLE;
27709 +               goto func_end;
27710 +       }
27711         if (hIOMgr->pSharedMem)
27712                 hIOMgr->pSharedMem = NULL;
27713  
27714 @@ -404,25 +401,25 @@ DSP_STATUS WMD_IO_OnLoaded(struct IO_MGR
27715                                  &ulShmBase);
27716         if (DSP_FAILED(status)) {
27717                 status = CHNL_E_NOMEMMAP;
27718 -               goto func_cont1;
27719 +               goto func_end;
27720         }
27721         status = COD_GetSymValue(hCodMan, CHNL_SHARED_BUFFER_LIMIT_SYM,
27722                                 &ulShmLimit);
27723         if (DSP_FAILED(status)) {
27724                 status = CHNL_E_NOMEMMAP;
27725 -               goto func_cont1;
27726 +               goto func_end;
27727         }
27728         if (ulShmLimit <= ulShmBase) {
27729                 status = CHNL_E_INVALIDMEMBASE;
27730 -       } else {
27731 -               /* get total length in bytes */
27732 -               ulShmLength = (ulShmLimit - ulShmBase + 1) * hIOMgr->uWordSize;
27733 -               /* Calculate size of a PROCCOPY shared memory region */
27734 -               DBG_Trace(DBG_LEVEL7,
27735 -                        "**(proc)PROCCOPY SHMMEM SIZE: 0x%x bytes\n",
27736 -                         (ulShmLength - sizeof(struct SHM)));
27737 +               goto func_end;
27738         }
27739 -func_cont1:
27740 +       /* Get total length in bytes */
27741 +       ulShmLength = (ulShmLimit - ulShmBase + 1) * hIOMgr->uWordSize;
27742 +       /* Calculate size of a PROCCOPY shared memory region */
27743 +       DBG_Trace(DBG_LEVEL7,
27744 +                "**(proc)PROCCOPY SHMMEM SIZE: 0x%x bytes\n",
27745 +                 (ulShmLength - sizeof(struct SHM)));
27746 +
27747         if (DSP_SUCCEEDED(status)) {
27748                 /* Get start and length of message part of shared memory */
27749                 status = COD_GetSymValue(hCodMan, MSG_SHARED_BUFFER_BASE_SYM,
27750 @@ -435,17 +432,23 @@ func_cont1:
27751                         if (ulMsgLimit <= ulMsgBase) {
27752                                 status = CHNL_E_INVALIDMEMBASE;
27753                         } else {
27754 -                               /* Length (bytes) of messaging part of shared
27755 -                                * memory */
27756 +                               /*
27757 +                                * Length (bytes) of messaging part of shared
27758 +                                * memory.
27759 +                                */
27760                                 ulMsgLength = (ulMsgLimit - ulMsgBase + 1) *
27761                                               hIOMgr->uWordSize;
27762 -                               /* Total length (bytes) of shared memory:
27763 -                                * chnl + msg */
27764 +                               /*
27765 +                                * Total length (bytes) of shared memory:
27766 +                                * chnl + msg.
27767 +                                */
27768                                 ulMemLength = ulShmLength + ulMsgLength;
27769                         }
27770                 } else {
27771                         status = CHNL_E_NOMEMMAP;
27772                 }
27773 +       } else {
27774 +               status = CHNL_E_NOMEMMAP;
27775         }
27776         if (DSP_SUCCEEDED(status)) {
27777  #ifndef DSP_TRACEBUF_DISABLED
27778 @@ -459,19 +462,16 @@ func_cont1:
27779  #endif
27780                 if (DSP_FAILED(status))
27781                         status = CHNL_E_NOMEMMAP;
27782 -
27783         }
27784         if (DSP_SUCCEEDED(status)) {
27785                 status = COD_GetSymValue(hCodMan, DYNEXTBASE, &ulDynExtBase);
27786                 if (DSP_FAILED(status))
27787                         status = CHNL_E_NOMEMMAP;
27788 -
27789         }
27790         if (DSP_SUCCEEDED(status)) {
27791                 status = COD_GetSymValue(hCodMan, EXTEND, &ulExtEnd);
27792                 if (DSP_FAILED(status))
27793                         status = CHNL_E_NOMEMMAP;
27794 -
27795         }
27796         if (DSP_SUCCEEDED(status)) {
27797                 /* Get memory reserved in host resources */
27798 @@ -485,7 +485,7 @@ func_cont1:
27799                 ndx = 0;
27800                 ulGppPa = hostRes.dwMemPhys[1];
27801                 ulGppVa = hostRes.dwMemBase[1];
27802 -               /* THIS IS THE VIRTUAL UNCACHED IOREMAPPED ADDRESS !!! */
27803 +               /* This is the virtual uncached ioremapped address!!! */
27804                 /* Why can't we directly take the DSPVA from the symbols? */
27805                 ulDspVa = hIOMgr->extProcInfo.tyTlb[0].ulDspVirt;
27806                 ulSegSize = (ulShm0End - ulDspVa) * hIOMgr->uWordSize;
27807 @@ -517,7 +517,7 @@ func_cont1:
27808                 }
27809         }
27810         if (DSP_FAILED(status))
27811 -               goto func_cont;
27812 +               goto func_end;
27813  
27814         paCurr = ulGppPa;
27815         vaCurr = ulDynExtBase * hIOMgr->uWordSize;
27816 @@ -536,9 +536,11 @@ func_cont1:
27817         mapAttrs |= DSP_MAPELEMSIZE32;
27818         mapAttrs |= DSP_MAPDONOTLOCK;
27819  
27820 -       while (numBytes && DSP_SUCCEEDED(status)) {
27821 -               /* To find the max. page size with which both PA & VA are
27822 -                * aligned */
27823 +       while (numBytes) {
27824 +               /*
27825 +                * To find the max. page size with which both PA & VA are
27826 +                * aligned.
27827 +                */
27828                 allBits = paCurr | vaCurr;
27829                 DBG_Trace(DBG_LEVEL1, "allBits %x, paCurr %x, vaCurr %x, "
27830                          "numBytes %x\n", allBits, paCurr, vaCurr, numBytes);
27831 @@ -548,14 +550,17 @@ func_cont1:
27832                                 status = hIOMgr->pIntfFxns->pfnBrdMemMap
27833                                         (hIOMgr->hWmdContext, paCurr, vaCurr,
27834                                         pgSize[i], mapAttrs);
27835 -                               DBC_Assert(DSP_SUCCEEDED(status));
27836 +                               if (DSP_FAILED(status))
27837 +                                       goto func_end;
27838                                 paCurr += pgSize[i];
27839                                 vaCurr += pgSize[i];
27840                                 gppVaCurr += pgSize[i];
27841                                 numBytes -= pgSize[i];
27842 -                               /* Don't try smaller sizes. Hopefully we have
27843 +                               /*
27844 +                                * Don't try smaller sizes. Hopefully we have
27845                                  * reached an address aligned to a bigger page
27846 -                                * size*/
27847 +                                * size.
27848 +                                */
27849                                 break;
27850                         }
27851                 }
27852 @@ -564,13 +569,14 @@ func_cont1:
27853         vaCurr += ulPadSize;
27854         gppVaCurr += ulPadSize;
27855  
27856 -       /* configure the TLB entries for the next cacheable segment */
27857 +       /* Configure the TLB entries for the next cacheable segment */
27858         numBytes = ulSegSize;
27859         vaCurr = ulDspVa * hIOMgr->uWordSize;
27860 -       allBits = 0x0;
27861 -       while (numBytes && DSP_SUCCEEDED(status)) {
27862 -               /* To find the max. page size with which both PA & VA are
27863 -                * aligned*/
27864 +       while (numBytes ) {
27865 +               /*
27866 +                * To find the max. page size with which both PA & VA are
27867 +                * aligned.
27868 +                */
27869                 allBits = paCurr | vaCurr;
27870                 DBG_Trace(DBG_LEVEL1, "allBits for Seg1 %x, paCurr %x, "
27871                          "vaCurr %x, numBytes %x\n", allBits, paCurr, vaCurr,
27872 @@ -580,11 +586,15 @@ func_cont1:
27873                            !((allBits & (pgSize[i]-1)) == 0))
27874                                 continue;
27875                         if (ndx < MAX_LOCK_TLB_ENTRIES) {
27876 -                               /* This is the physical address written to
27877 -                                * DSP MMU */
27878 +                               /*
27879 +                                * This is the physical address written to
27880 +                                * DSP MMU.
27881 +                                */
27882                                 aEProc[ndx].ulGppPa = paCurr;
27883 -                               /* THIS IS THE VIRTUAL UNCACHED IOREMAPPED
27884 -                                * ADDRESS!!! */
27885 +                               /*
27886 +                                * This is the virtual uncached ioremapped
27887 +                                * address!!!
27888 +                                */
27889                                 aEProc[ndx].ulGppVa = gppVaCurr;
27890                                 aEProc[ndx].ulDspVa = vaCurr / hIOMgr->
27891                                                       uWordSize;
27892 @@ -609,22 +619,26 @@ func_cont1:
27893                                          aEProc[ndx].ulGppVa,
27894                                          aEProc[ndx].ulDspVa *
27895                                          hIOMgr->uWordSize, pgSize[i]);
27896 -                               DBC_Assert(DSP_SUCCEEDED(status));
27897 +                               if (DSP_FAILED(status))
27898 +                                       goto func_end;
27899                         }
27900                         paCurr += pgSize[i];
27901                         vaCurr += pgSize[i];
27902                         gppVaCurr += pgSize[i];
27903                         numBytes -= pgSize[i];
27904 -                       /* Don't try smaller sizes. Hopefully we have reached
27905 -                        an address aligned to a bigger page size*/
27906 +                       /*
27907 +                        * Don't try smaller sizes. Hopefully we have reached
27908 +                        * an address aligned to a bigger page size.
27909 +                        */
27910                         break;
27911                 }
27912         }
27913  
27914 -        /* Copy remaining entries from CDB. All entries are 1 MB and should not
27915 -        * conflict with SHM entries on MPU or DSP side */
27916 -       for (i = 3; i < 7 && ndx < WMDIOCTL_NUMOFMMUTLB &&
27917 -           DSP_SUCCEEDED(status); i++) {
27918 +       /*
27919 +        * Copy remaining entries from CDB. All entries are 1 MB and
27920 +        * should not conflict with SHM entries on MPU or DSP side.
27921 +        */
27922 +       for (i = 3; i < 7 && ndx < WMDIOCTL_NUMOFMMUTLB; i++) {
27923                 if (hIOMgr->extProcInfo.tyTlb[i].ulGppPhys == 0)
27924                         continue;
27925  
27926 @@ -649,8 +663,8 @@ func_cont1:
27927                                 aEProc[ndx].ulGppPa = hIOMgr->extProcInfo.
27928                                         tyTlb[i].ulGppPhys;
27929                                 aEProc[ndx].ulGppVa = 0;
27930 -                               /* Can't convert, so set to zero*/
27931 -                               aEProc[ndx].ulSize = 0x100000;  /* 1 MB*/
27932 +                               /* Can't convert, so set to zero */
27933 +                               aEProc[ndx].ulSize = 0x100000;  /* 1 MB */
27934                                 DBG_Trace(DBG_LEVEL1, "SHM MMU entry PA %x "
27935                                          "DSP_VA 0x%x\n", aEProc[ndx].ulGppPa,
27936                                         aEProc[ndx].ulDspVa);
27937 @@ -663,12 +677,10 @@ func_cont1:
27938                                         0x100000, mapAttrs);
27939                         }
27940                 }
27941 +               if (DSP_FAILED(status))
27942 +                       goto func_end;
27943         }
27944 -       if (i < 7 && DSP_SUCCEEDED(status)) {
27945 -               /* All CDB entries could not be made*/
27946 -               status = DSP_EFAIL;
27947 -       }
27948 -func_cont:
27949 +
27950         mapAttrs = 0x00000000;
27951         mapAttrs = DSP_MAPLITTLEENDIAN;
27952         mapAttrs |= DSP_MAPPHYSICALADDR;
27953 @@ -677,154 +689,148 @@ func_cont:
27954  
27955         /* Map the L4 peripherals */
27956         i = 0;
27957 -       while (L4PeripheralTable[i].physAddr && DSP_SUCCEEDED(status)) {
27958 +       while (L4PeripheralTable[i].physAddr) {
27959                 status = hIOMgr->pIntfFxns->pfnBrdMemMap
27960                         (hIOMgr->hWmdContext, L4PeripheralTable[i].physAddr,
27961                         L4PeripheralTable[i].dspVirtAddr, HW_PAGE_SIZE_4KB,
27962                         mapAttrs);
27963                 if (DSP_FAILED(status))
27964 -                       break;
27965 +                       goto func_end;
27966                 i++;
27967         }
27968  
27969 -       if (DSP_SUCCEEDED(status)) {
27970 -               for (i = ndx; i < WMDIOCTL_NUMOFMMUTLB; i++) {
27971 -                       aEProc[i].ulDspVa = 0;
27972 -                       aEProc[i].ulGppPa = 0;
27973 -                       aEProc[i].ulGppVa = 0;
27974 -                       aEProc[i].ulSize = 0;
27975 -               }
27976 -               /* Set the SHM physical address entry (grayed out in CDB file)
27977 -                * to the virtual uncached ioremapped address of SHM reserved
27978 -                * on MPU */
27979 -               hIOMgr->extProcInfo.tyTlb[0].ulGppPhys = (ulGppVa + ulSeg1Size +
27980 -                                                        ulPadSize);
27981 -               DBG_Trace(DBG_LEVEL1, "*********extProcInfo *********%x \n",
27982 -                         hIOMgr->extProcInfo.tyTlb[0].ulGppPhys);
27983 -               /* Need SHM Phys addr. IO supports only one DSP for now:
27984 -                * uNumProcs=1 */
27985 -               if ((hIOMgr->extProcInfo.tyTlb[0].ulGppPhys == 0) ||
27986 -                  (uNumProcs != 1)) {
27987 -                       status = CHNL_E_NOMEMMAP;
27988 -                       DBC_Assert(false);
27989 -               } else {
27990 -                       DBC_Assert(aEProc[0].ulDspVa <= ulShmBase);
27991 -                       /* ulShmBase may not be at ulDspVa address */
27992 -                       ulShmBaseOffset = (ulShmBase - aEProc[0].ulDspVa) *
27993 -                           hIOMgr->uWordSize;
27994 -                        /* WMD_BRD_Ctrl() will set dev context dsp-mmu info. In
27995 -                        *   _BRD_Start() the MMU will be re-programed with MMU
27996 -                        *   DSPVa-GPPPa pair info while DSP is in a known
27997 -                        *   (reset) state.  */
27998 -                       DBC_Assert(hIOMgr->pIntfFxns != NULL);
27999 -                       DBC_Assert(hIOMgr->hWmdContext != NULL);
28000 -                       status = hIOMgr->pIntfFxns->pfnDevCntrl(hIOMgr->
28001 -                                hWmdContext, WMDIOCTL_SETMMUCONFIG, aEProc);
28002 -                       ulShmBase = hIOMgr->extProcInfo.tyTlb[0].ulGppPhys;
28003 -                       DBG_Trace(DBG_LEVEL1, "extProcInfo.tyTlb[0].ulGppPhys "
28004 -                                "%x \n ", hIOMgr->extProcInfo.tyTlb[0].
28005 -                                ulGppPhys);
28006 -                       ulShmBase += ulShmBaseOffset;
28007 -                       ulShmBase = (u32)MEM_LinearAddress((void *)ulShmBase,
28008 -                                   ulMemLength);
28009 -                       DBC_Assert(ulShmBase != 0);
28010 -                       if (DSP_SUCCEEDED(status)) {
28011 -                               status = registerSHMSegs(hIOMgr, hCodMan,
28012 -                                        aEProc[0].ulGppPa);
28013 -                               /* Register SM */
28014 -                       }
28015 -               }
28016 -       }
28017 -       if (DSP_SUCCEEDED(status)) {
28018 -               hIOMgr->pSharedMem = (struct SHM *)ulShmBase;
28019 -               hIOMgr->pInput = (u8 *)hIOMgr->pSharedMem +
28020 -                                sizeof(struct SHM);
28021 -               hIOMgr->pOutput = hIOMgr->pInput + (ulShmLength -
28022 -                                 sizeof(struct SHM))/2;
28023 -               hIOMgr->uSMBufSize = hIOMgr->pOutput - hIOMgr->pInput;
28024 -               DBG_Trace(DBG_LEVEL3,
28025 -                        "hIOMgr: pInput %p pOutput %p ulShmLength %x\n",
28026 -                        hIOMgr->pInput, hIOMgr->pOutput, ulShmLength);
28027 -               DBG_Trace(DBG_LEVEL3,
28028 -                        "pSharedMem %p uSMBufSize %x sizeof(SHM) %x\n",
28029 -                        hIOMgr->pSharedMem, hIOMgr->uSMBufSize,
28030 -                        sizeof(struct SHM));
28031 -                /*  Set up Shared memory addresses for messaging. */
28032 -               hIOMgr->pMsgInputCtrl = (struct MSG *)((u8 *)
28033 -                                       hIOMgr->pSharedMem +
28034 -                                       ulShmLength);
28035 -               hIOMgr->pMsgInput = (u8 *)hIOMgr->pMsgInputCtrl +
28036 -                                   sizeof(struct MSG);
28037 -               hIOMgr->pMsgOutputCtrl = (struct MSG *)((u8 *)hIOMgr->
28038 -                                        pMsgInputCtrl + ulMsgLength / 2);
28039 -               hIOMgr->pMsgOutput = (u8 *)hIOMgr->pMsgOutputCtrl +
28040 -                                    sizeof(struct MSG);
28041 -               hMsgMgr->uMaxMsgs = ((u8 *)hIOMgr->pMsgOutputCtrl -
28042 -                                   hIOMgr->pMsgInput) /
28043 -                                   sizeof(struct MSG_DSPMSG);
28044 -               DBG_Trace(DBG_LEVEL7, "IO MGR SHM details : pSharedMem 0x%x, "
28045 -                        "pInput 0x%x, pOutput 0x%x, pMsgInputCtrl 0x%x, "
28046 -                        "pMsgInput 0x%x, pMsgOutputCtrl 0x%x, pMsgOutput "
28047 -                        "0x%x \n", (u8 *)hIOMgr->pSharedMem,
28048 -                        (u8 *)hIOMgr->pInput, (u8 *)hIOMgr->pOutput,
28049 -                        (u8 *)hIOMgr->pMsgInputCtrl,
28050 -                        (u8 *)hIOMgr->pMsgInput,
28051 -                        (u8 *)hIOMgr->pMsgOutputCtrl,
28052 -                        (u8 *)hIOMgr->pMsgOutput);
28053 -               DBG_Trace(DBG_LEVEL7, "** (proc) MAX MSGS IN SHARED MEMORY: "
28054 -                        "0x%x\n", hMsgMgr->uMaxMsgs);
28055 -               memset((void *) hIOMgr->pSharedMem, 0, sizeof(struct SHM));
28056 +
28057 +       for (i = ndx; i < WMDIOCTL_NUMOFMMUTLB; i++) {
28058 +               aEProc[i].ulDspVa = 0;
28059 +               aEProc[i].ulGppPa = 0;
28060 +               aEProc[i].ulGppVa = 0;
28061 +               aEProc[i].ulSize = 0;
28062         }
28063 +       /*
28064 +        * Set the SHM physical address entry (grayed out in CDB file)
28065 +        * to the virtual uncached ioremapped address of SHM reserved
28066 +        * on MPU.
28067 +        */
28068 +       hIOMgr->extProcInfo.tyTlb[0].ulGppPhys = (ulGppVa + ulSeg1Size +
28069 +                                                ulPadSize);
28070 +       DBG_Trace(DBG_LEVEL1, "*********extProcInfo *********%x \n",
28071 +                 hIOMgr->extProcInfo.tyTlb[0].ulGppPhys);
28072 +       /*
28073 +        * Need SHM Phys addr. IO supports only one DSP for now:
28074 +        * uNumProcs = 1.
28075 +        */
28076 +       if (!hIOMgr->extProcInfo.tyTlb[0].ulGppPhys || uNumProcs != 1) {
28077 +               status = CHNL_E_NOMEMMAP;
28078 +               goto func_end;
28079 +       } else {
28080 +               if (aEProc[0].ulDspVa > ulShmBase) {
28081 +                       status = DSP_EFAIL;
28082 +                       goto func_end;
28083 +               }
28084 +               /* ulShmBase may not be at ulDspVa address */
28085 +               ulShmBaseOffset = (ulShmBase - aEProc[0].ulDspVa) *
28086 +                               hIOMgr->uWordSize;
28087 +               /*
28088 +                * WMD_BRD_Ctrl() will set dev context dsp-mmu info. In
28089 +                * _BRD_Start() the MMU will be re-programed with MMU
28090 +                * DSPVa-GPPPa pair info while DSP is in a known
28091 +                * (reset) state.
28092 +                */
28093 +
28094 +               status = hIOMgr->pIntfFxns->pfnDevCntrl(hIOMgr->hWmdContext,
28095 +                                               WMDIOCTL_SETMMUCONFIG, aEProc);
28096 +               if (DSP_FAILED(status))
28097 +                       goto func_end;
28098 +               ulShmBase = hIOMgr->extProcInfo.tyTlb[0].ulGppPhys;
28099 +               DBG_Trace(DBG_LEVEL1, "extProcInfo.tyTlb[0].ulGppPhys %x \n ",
28100 +                               hIOMgr->extProcInfo.tyTlb[0].ulGppPhys);
28101 +               ulShmBase += ulShmBaseOffset;
28102 +               ulShmBase = (u32)MEM_LinearAddress((void *)ulShmBase,
28103 +                                   ulMemLength);
28104 +               if (ulShmBase == 0) {
28105 +                       status = DSP_EPOINTER;
28106 +                       goto func_end;
28107 +               }
28108 +               /* Register SM */
28109 +               status = registerSHMSegs(hIOMgr, hCodMan, aEProc[0].ulGppPa);
28110 +       }
28111 +
28112 +       hIOMgr->pSharedMem = (struct SHM *)ulShmBase;
28113 +       hIOMgr->pInput = (u8 *)hIOMgr->pSharedMem + sizeof(struct SHM);
28114 +       hIOMgr->pOutput = hIOMgr->pInput + (ulShmLength -
28115 +                                               sizeof(struct SHM)) / 2;
28116 +       hIOMgr->uSMBufSize = hIOMgr->pOutput - hIOMgr->pInput;
28117 +       DBG_Trace(DBG_LEVEL3, "hIOMgr: pInput %p pOutput %p ulShmLength %x\n",
28118 +                                hIOMgr->pInput, hIOMgr->pOutput, ulShmLength);
28119 +       DBG_Trace(DBG_LEVEL3, "pSharedMem %p uSMBufSize %x sizeof(SHM) %x\n",
28120 +                hIOMgr->pSharedMem, hIOMgr->uSMBufSize, sizeof(struct SHM));
28121 +        /*  Set up Shared memory addresses for messaging. */
28122 +       hIOMgr->pMsgInputCtrl = (struct MSG *)((u8 *)hIOMgr->pSharedMem
28123 +                                                       + ulShmLength);
28124 +       hIOMgr->pMsgInput = (u8 *)hIOMgr->pMsgInputCtrl + sizeof(struct MSG);
28125 +       hIOMgr->pMsgOutputCtrl = (struct MSG *)((u8 *)hIOMgr->pMsgInputCtrl
28126 +                                                       + ulMsgLength / 2);
28127 +       hIOMgr->pMsgOutput = (u8 *)hIOMgr->pMsgOutputCtrl + sizeof(struct MSG);
28128 +       hMsgMgr->uMaxMsgs = ((u8 *)hIOMgr->pMsgOutputCtrl - hIOMgr->pMsgInput)
28129 +                                               / sizeof(struct MSG_DSPMSG);
28130 +       DBG_Trace(DBG_LEVEL7, "IO MGR SHM details : pSharedMem 0x%x, "
28131 +               "pInput 0x%x, pOutput 0x%x, pMsgInputCtrl 0x%x, "
28132 +               "pMsgInput 0x%x, pMsgOutputCtrl 0x%x, pMsgOutput "
28133 +               "0x%x \n", (u8 *)hIOMgr->pSharedMem, (u8 *)hIOMgr->pInput,
28134 +               (u8 *)hIOMgr->pOutput, (u8 *)hIOMgr->pMsgInputCtrl,
28135 +               (u8 *)hIOMgr->pMsgInput, (u8 *)hIOMgr->pMsgOutputCtrl,
28136 +               (u8 *)hIOMgr->pMsgOutput);
28137 +       DBG_Trace(DBG_LEVEL7, "** (proc) MAX MSGS IN SHARED MEMORY: "
28138 +                                       "0x%x\n", hMsgMgr->uMaxMsgs);
28139 +       memset((void *) hIOMgr->pSharedMem, 0, sizeof(struct SHM));
28140 +
28141  #ifndef DSP_TRACEBUF_DISABLED
28142 -       if (DSP_SUCCEEDED(status)) {
28143 -               /* Get the start address of trace buffer */
28144 -               if (DSP_SUCCEEDED(status)) {
28145 -                       status = COD_GetSymValue(hCodMan, SYS_PUTCBEG,
28146 +       /* Get the start address of trace buffer */
28147 +       status = COD_GetSymValue(hCodMan, SYS_PUTCBEG,
28148                                  &hIOMgr->ulTraceBufferBegin);
28149 -                       if (DSP_FAILED(status))
28150 -                               status = CHNL_E_NOMEMMAP;
28151 +       if (DSP_FAILED(status)) {
28152 +               status = CHNL_E_NOMEMMAP;
28153 +               goto func_end;
28154 +       }
28155  
28156 -               }
28157 -               hIOMgr->ulGPPReadPointer = hIOMgr->ulTraceBufferBegin =
28158 -                       (ulGppVa + ulSeg1Size + ulPadSize) +
28159 -                       (hIOMgr->ulTraceBufferBegin - ulDspVa);
28160 -               /* Get the end address of trace buffer */
28161 -               if (DSP_SUCCEEDED(status)) {
28162 -                       status = COD_GetSymValue(hCodMan, SYS_PUTCEND,
28163 -                                &hIOMgr->ulTraceBufferEnd);
28164 -                       if (DSP_FAILED(status))
28165 -                               status = CHNL_E_NOMEMMAP;
28166 +       hIOMgr->ulGPPReadPointer = hIOMgr->ulTraceBufferBegin =
28167 +               (ulGppVa + ulSeg1Size + ulPadSize) +
28168 +               (hIOMgr->ulTraceBufferBegin - ulDspVa);
28169 +       /* Get the end address of trace buffer */
28170  
28171 -               }
28172 -               hIOMgr->ulTraceBufferEnd = (ulGppVa + ulSeg1Size + ulPadSize) +
28173 -                                          (hIOMgr->ulTraceBufferEnd - ulDspVa);
28174 -               /* Get the current address of DSP write pointer */
28175 -               if (DSP_SUCCEEDED(status)) {
28176 -                       status = COD_GetSymValue(hCodMan,
28177 -                                BRIDGE_SYS_PUTC_current,
28178 -                                &hIOMgr->ulTraceBufferCurrent);
28179 -                       if (DSP_FAILED(status))
28180 -                               status = CHNL_E_NOMEMMAP;
28181 +       status = COD_GetSymValue(hCodMan, SYS_PUTCEND,
28182 +                                               &hIOMgr->ulTraceBufferEnd);
28183 +       if (DSP_FAILED(status)) {
28184 +               status = CHNL_E_NOMEMMAP;
28185 +               goto func_end;
28186 +       }
28187 +       hIOMgr->ulTraceBufferEnd = (ulGppVa + ulSeg1Size + ulPadSize) +
28188 +                                  (hIOMgr->ulTraceBufferEnd - ulDspVa);
28189 +       /* Get the current address of DSP write pointer */
28190 +       status = COD_GetSymValue(hCodMan, BRIDGE_SYS_PUTC_current,
28191 +                                        &hIOMgr->ulTraceBufferCurrent);
28192 +       if (DSP_FAILED(status)) {
28193 +               status = CHNL_E_NOMEMMAP;
28194 +               goto func_end;
28195 +       }
28196 +       hIOMgr->ulTraceBufferCurrent = (ulGppVa + ulSeg1Size + ulPadSize) +
28197 +                               (hIOMgr->ulTraceBufferCurrent - ulDspVa);
28198 +       /* Calculate the size of trace buffer */
28199 +       if (hIOMgr->pMsg)
28200 +               MEM_Free(hIOMgr->pMsg);
28201 +       hIOMgr->pMsg = MEM_Alloc(((hIOMgr->ulTraceBufferEnd -
28202 +                               hIOMgr->ulTraceBufferBegin) *
28203 +                               hIOMgr->uWordSize) + 2, MEM_NONPAGED);
28204 +       if (!hIOMgr->pMsg)
28205 +               status = DSP_EMEMORY;
28206  
28207 -               }
28208 -               hIOMgr->ulTraceBufferCurrent = (ulGppVa + ulSeg1Size +
28209 -                                               ulPadSize) + (hIOMgr->
28210 -                                               ulTraceBufferCurrent - ulDspVa);
28211 -               /* Calculate the size of trace buffer */
28212 -               if (hIOMgr->pMsg)
28213 -                       MEM_Free(hIOMgr->pMsg);
28214 -               hIOMgr->pMsg = MEM_Alloc(((hIOMgr->ulTraceBufferEnd -
28215 -                                       hIOMgr->ulTraceBufferBegin) *
28216 -                                       hIOMgr->uWordSize) + 2, MEM_NONPAGED);
28217 -               if (!hIOMgr->pMsg)
28218 -                       status = DSP_EMEMORY;
28219 +       DBG_Trace(DBG_LEVEL1, "** hIOMgr->pMsg: 0x%x\n", hIOMgr->pMsg);
28220 +       hIOMgr->ulDspVa = ulDspVa;
28221 +       hIOMgr->ulGppVa = (ulGppVa + ulSeg1Size + ulPadSize);
28222  
28223 -               DBG_Trace(DBG_LEVEL1, "** hIOMgr->pMsg: 0x%x\n", hIOMgr->pMsg);
28224 -               hIOMgr->ulDspVa = ulDspVa;
28225 -               hIOMgr->ulGppVa = (ulGppVa + ulSeg1Size + ulPadSize);
28226 -    }
28227  #endif
28228         IO_EnableInterrupt(hIOMgr->hWmdContext);
28229 +func_end:
28230         return status;
28231  }
28232  
28233 @@ -834,9 +840,10 @@ func_cont:
28234   */
28235  u32 IO_BufSize(struct IO_MGR *hIOMgr)
28236  {
28237 -       DBC_Require(MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE));
28238 -
28239 -       return hIOMgr->uSMBufSize;
28240 +       if (MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE))
28241 +               return hIOMgr->uSMBufSize;
28242 +       else
28243 +               return 0;
28244  }
28245  
28246  /*
28247 @@ -848,14 +855,17 @@ void IO_CancelChnl(struct IO_MGR *hIOMgr
28248         struct IO_MGR *pIOMgr = (struct IO_MGR *)hIOMgr;
28249         struct SHM *sm;
28250  
28251 -       DBC_Require(MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE));
28252 +       if (!MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE))
28253 +               goto func_end;
28254         sm = hIOMgr->pSharedMem;
28255  
28256 -       /* Inform DSP that we have no more buffers on this channel:  */
28257 +       /* Inform DSP that we have no more buffers on this channel */
28258         IO_AndValue(pIOMgr->hWmdContext, struct SHM, sm, hostFreeMask,
28259                    (~(1 << ulChnl)));
28260  
28261         CHNLSM_InterruptDSP2(pIOMgr->hWmdContext, MBX_PCPY_CLASS);
28262 +func_end:
28263 +       return;
28264  }
28265  
28266  /*
28267 @@ -865,16 +875,20 @@ void IO_CancelChnl(struct IO_MGR *hIOMgr
28268  static void IO_DispatchChnl(IN struct IO_MGR *pIOMgr,
28269                            IN OUT struct CHNL_OBJECT *pChnl, u32 iMode)
28270  {
28271 -       DBC_Require(MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE));
28272 +       if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
28273 +               goto func_end;
28274  
28275         DBG_Trace(DBG_LEVEL3, "Entering IO_DispatchChnl \n");
28276  
28277 -       /* See if there is any data available for transfer: */
28278 -       DBC_Assert(iMode == IO_SERVICE);
28279 +       /* See if there is any data available for transfer */
28280 +       if (iMode != IO_SERVICE)
28281 +               goto func_end;
28282  
28283 -       /* Any channel will do for this mode: */
28284 +       /* Any channel will do for this mode */
28285         InputChnl(pIOMgr, pChnl, iMode);
28286         OutputChnl(pIOMgr, pChnl, iMode);
28287 +func_end:
28288 +       return;
28289  }
28290  
28291  /*
28292 @@ -883,13 +897,16 @@ static void IO_DispatchChnl(IN struct IO
28293   */
28294  static void IO_DispatchMsg(IN struct IO_MGR *pIOMgr, struct MSG_MGR *hMsgMgr)
28295  {
28296 -       DBC_Require(MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE));
28297 +       if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
28298 +               goto func_end;
28299  
28300         DBG_Trace(DBG_LEVEL3, "Entering IO_DispatchMsg \n");
28301  
28302 -       /*  We are performing both input and output processing. */
28303 +       /* We are performing both input and output processing. */
28304         InputMsg(pIOMgr, hMsgMgr);
28305         OutputMsg(pIOMgr, hMsgMgr);
28306 +func_end:
28307 +       return;
28308  }
28309  
28310  /*
28311 @@ -898,16 +915,13 @@ static void IO_DispatchMsg(IN struct IO_
28312   */
28313  static void IO_DispatchPM(struct work_struct *work)
28314  {
28315 -       struct IO_MGR *pIOMgr =
28316 -                               container_of(work, struct IO_MGR, io_workq);
28317 +       struct IO_MGR *pIOMgr = container_of(work, struct IO_MGR, io_workq);
28318         DSP_STATUS status;
28319         u32 pArg[2];
28320  
28321 -       /*DBC_Require(MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE));*/
28322 -
28323         DBG_Trace(DBG_LEVEL7, "IO_DispatchPM: Entering IO_DispatchPM : \n");
28324  
28325 -       /*  Perform Power message processing here  */
28326 +       /* Perform Power message processing here */
28327         while (pIOMgr->iQuePowerHead != pIOMgr->iQuePowerTail) {
28328                 pArg[0] = *(u32 *)&(pIOMgr->dQuePowerMbxVal[pIOMgr->
28329                           iQuePowerTail]);
28330 @@ -947,13 +961,11 @@ static void IO_DispatchPM(struct work_st
28331                                          *pArg);
28332                         }
28333                 }
28334 -               /* increment the tail count here */
28335 +               /* Increment the tail count here */
28336                 pIOMgr->iQuePowerTail++;
28337                 if (pIOMgr->iQuePowerTail >= MAX_PM_REQS)
28338                         pIOMgr->iQuePowerTail = 0;
28339 -
28340         }
28341 -
28342  }
28343  
28344  /*
28345 @@ -962,47 +974,58 @@ static void IO_DispatchPM(struct work_st
28346   *      out the dispatch of I/O as a non-preemptible event.It can only be
28347   *      pre-empted      by an ISR.
28348   */
28349 -void IO_DPC(IN OUT void *pRefData)
28350 +void IO_DPC(IN OUT unsigned long pRefData)
28351  {
28352         struct IO_MGR *pIOMgr = (struct IO_MGR *)pRefData;
28353         struct CHNL_MGR *pChnlMgr;
28354         struct MSG_MGR *pMsgMgr;
28355         struct DEH_MGR *hDehMgr;
28356 +       u32 requested;
28357 +       u32 serviced;
28358  
28359 -       DBC_Require(MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE));
28360 +       if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
28361 +               goto func_end;
28362         pChnlMgr = pIOMgr->hChnlMgr;
28363         DEV_GetMsgMgr(pIOMgr->hDevObject, &pMsgMgr);
28364         DEV_GetDehMgr(pIOMgr->hDevObject, &hDehMgr);
28365 -       DBC_Require(MEM_IsValidHandle(pChnlMgr, CHNL_MGRSIGNATURE));
28366 +       if (!MEM_IsValidHandle(pChnlMgr, CHNL_MGRSIGNATURE))
28367 +               goto func_end;
28368         DBG_Trace(DBG_LEVEL7, "Entering IO_DPC(0x%x)\n", pRefData);
28369 -       /* Check value of interrupt register to ensure it is a valid error */
28370 -       if ((pIOMgr->wIntrVal > DEH_BASE) && (pIOMgr->wIntrVal < DEH_LIMIT)) {
28371 -               /* notify DSP/BIOS exception */
28372 -               if (hDehMgr)
28373 -                       WMD_DEH_Notify(hDehMgr, DSP_SYSERROR, pIOMgr->wIntrVal);
28374  
28375 -       }
28376 -       IO_DispatchChnl(pIOMgr, NULL, IO_SERVICE);
28377 +       requested = pIOMgr->dpc_req;
28378 +       serviced = pIOMgr->dpc_sched;
28379 +
28380 +       if (serviced == requested)
28381 +               goto func_end;
28382 +
28383 +       /* Process pending DPC's */
28384 +       do {
28385 +               /* Check value of interrupt reg to ensure it's a valid error */
28386 +               if ((pIOMgr->wIntrVal > DEH_BASE) &&
28387 +                  (pIOMgr->wIntrVal < DEH_LIMIT)) {
28388 +                       /* Notify DSP/BIOS exception */
28389 +                       if (hDehMgr)
28390 +                               WMD_DEH_Notify(hDehMgr, DSP_SYSERROR,
28391 +                                               pIOMgr->wIntrVal);
28392 +               }
28393 +               IO_DispatchChnl(pIOMgr, NULL, IO_SERVICE);
28394  #ifdef CHNL_MESSAGES
28395 -       if (pMsgMgr) {
28396 -               DBC_Require(MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE));
28397 -               IO_DispatchMsg(pIOMgr, pMsgMgr);
28398 -       }
28399 +               if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE))
28400 +                       IO_DispatchMsg(pIOMgr, pMsgMgr);
28401  #endif
28402  #ifndef DSP_TRACEBUF_DISABLED
28403 -       if (pIOMgr->wIntrVal & MBX_DBG_CLASS) {
28404 -               /* notify DSP Trace message */
28405 -               if (pIOMgr->wIntrVal & MBX_DBG_SYSPRINTF)
28406 -                       PrintDSPDebugTrace(pIOMgr);
28407 +       if (pIOMgr->wIntrVal & MBX_DBG_SYSPRINTF) {
28408 +               /* Notify DSP Trace message */
28409 +               PrintDSPDebugTrace(pIOMgr);
28410         }
28411  #endif
28412 -
28413 -#ifndef DSP_TRACEBUF_DISABLED
28414 -       PrintDSPDebugTrace(pIOMgr);
28415 -#endif
28416 +               serviced++;
28417 +       } while (serviced != requested);
28418 +       pIOMgr->dpc_sched = requested;
28419 +func_end:
28420 +       return;
28421  }
28422  
28423 -
28424  /*
28425   *  ======== IO_ISR ========
28426   *      Main interrupt handler for the shared memory IO manager.
28427 @@ -1013,35 +1036,46 @@ irqreturn_t IO_ISR(int irq, IN void *pRe
28428  {
28429         struct IO_MGR *hIOMgr = (struct IO_MGR *)pRefData;
28430         bool fSchedDPC;
28431 -       DBC_Require(irq == INT_MAIL_MPU_IRQ);
28432 -       DBC_Require(MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE));
28433 +       unsigned long flags;
28434 +
28435 +       if (irq != INT_MAIL_MPU_IRQ ||
28436 +          !MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE))
28437 +               return IRQ_NONE;
28438         DBG_Trace(DBG_LEVEL3, "Entering IO_ISR(0x%x)\n", pRefData);
28439  
28440         /* Call WMD's CHNLSM_ISR() to see if interrupt is ours, and process. */
28441         if (IO_CALLISR(hIOMgr->hWmdContext, &fSchedDPC, &hIOMgr->wIntrVal)) {
28442 -               {
28443 -                       DBG_Trace(DBG_LEVEL3, "IO_ISR %x\n", hIOMgr->wIntrVal);
28444 -                       if (hIOMgr->wIntrVal & MBX_PM_CLASS) {
28445 -                               hIOMgr->dQuePowerMbxVal[hIOMgr->iQuePowerHead] =
28446 -                                       hIOMgr->wIntrVal;
28447 -                               hIOMgr->iQuePowerHead++;
28448 -                               if (hIOMgr->iQuePowerHead >= MAX_PM_REQS)
28449 -                                       hIOMgr->iQuePowerHead = 0;
28450 +               DBG_Trace(DBG_LEVEL3, "IO_ISR %x\n", hIOMgr->wIntrVal);
28451 +               if (hIOMgr->wIntrVal & MBX_PM_CLASS) {
28452 +                       hIOMgr->dQuePowerMbxVal[hIOMgr->iQuePowerHead] =
28453 +                               hIOMgr->wIntrVal;
28454 +                       hIOMgr->iQuePowerHead++;
28455 +                       if (hIOMgr->iQuePowerHead >= MAX_PM_REQS)
28456 +                               hIOMgr->iQuePowerHead = 0;
28457 +
28458 +                       queue_work(bridge_workqueue, &hIOMgr->io_workq);
28459 +               }
28460 +               if (hIOMgr->wIntrVal == MBX_DEH_RESET) {
28461 +                       DBG_Trace(DBG_LEVEL6, "*** DSP RESET ***\n");
28462 +                       hIOMgr->wIntrVal = 0;
28463 +               } else if (fSchedDPC) {
28464 +                       /*
28465 +                        * PROC-COPY defer i/o.
28466 +                        * Increment count of DPC's pending.
28467 +                        */
28468 +                       spin_lock_irqsave(&hIOMgr->dpc_lock, flags);
28469 +                       hIOMgr->dpc_req++;
28470 +                       spin_unlock_irqrestore(&hIOMgr->dpc_lock, flags);
28471  
28472 -                               queue_work(bridge_workqueue, &hIOMgr->io_workq);
28473 -                       }
28474 -                       if (hIOMgr->wIntrVal == MBX_DEH_RESET) {
28475 -                               DBG_Trace(DBG_LEVEL6, "*** DSP RESET ***\n");
28476 -                               hIOMgr->wIntrVal = 0;
28477 -                       } else if (fSchedDPC) {
28478 -                               /* PROC-COPY defer i/o  */
28479 -                               DPC_Schedule(hIOMgr->hDPC);
28480 -                       }
28481 +                       /* Schedule DPC */
28482 +                       tasklet_schedule(&hIOMgr->dpc_tasklet);
28483                 }
28484 -       } else
28485 +       } else {
28486                 /* Ensure that, if WMD didn't claim it, the IRQ is shared. */
28487                 DBC_Ensure(hIOMgr->fSharedIRQ);
28488 -       return IRQ_HANDLED;
28489 +       }
28490 +
28491 +       return IRQ_HANDLED;
28492  }
28493  
28494  /*
28495 @@ -1055,30 +1089,39 @@ void IO_RequestChnl(struct IO_MGR *pIOMg
28496  {
28497         struct CHNL_MGR *pChnlMgr;
28498         struct SHM *sm;
28499 -       DBC_Require(pChnl != NULL);
28500 -       DBC_Require(pwMbVal != NULL);
28501 +
28502 +       if (!pChnl || !pwMbVal)
28503 +               goto func_end;
28504         pChnlMgr = pIOMgr->hChnlMgr;
28505         sm = pIOMgr->pSharedMem;
28506         if (iMode == IO_INPUT) {
28507 -               /*  Assertion fires if CHNL_AddIOReq() called on a stream
28508 -                * which was cancelled, or attached to a dead board: */
28509 +               /*
28510 +                * Assertion fires if CHNL_AddIOReq() called on a stream
28511 +                * which was cancelled, or attached to a dead board.
28512 +                */
28513                 DBC_Assert((pChnl->dwState == CHNL_STATEREADY) ||
28514                           (pChnl->dwState == CHNL_STATEEOS));
28515 -               /* Indicate to the DSP we have a buffer available for input: */
28516 +               /* Indicate to the DSP we have a buffer available for input */
28517                 IO_OrValue(pIOMgr->hWmdContext, struct SHM, sm, hostFreeMask,
28518                           (1 << pChnl->uId));
28519                 *pwMbVal = MBX_PCPY_CLASS;
28520         } else if (iMode == IO_OUTPUT) {
28521 -               /*  This assertion fails if CHNL_AddIOReq() was called on a
28522 -                * stream which was cancelled, or attached to a dead board: */
28523 +               /*
28524 +                * This assertion fails if CHNL_AddIOReq() was called on a
28525 +                * stream which was cancelled, or attached to a dead board.
28526 +                */
28527                 DBC_Assert((pChnl->dwState & ~CHNL_STATEEOS) ==
28528                           CHNL_STATEREADY);
28529 -               /* Record the fact that we have a buffer available for
28530 -                * output: */
28531 +               /*
28532 +                * Record the fact that we have a buffer available for
28533 +                * output.
28534 +                */
28535                 pChnlMgr->dwOutputMask |= (1 << pChnl->uId);
28536         } else {
28537                 DBC_Assert(iMode);      /* Shouldn't get here. */
28538         }
28539 +func_end:
28540 +       return;
28541  }
28542  
28543  /*
28544 @@ -1087,9 +1130,18 @@ void IO_RequestChnl(struct IO_MGR *pIOMg
28545   */
28546  void IO_Schedule(struct IO_MGR *pIOMgr)
28547  {
28548 -       DBC_Require(MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE));
28549 +       unsigned long flags;
28550 +
28551 +       if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
28552 +               return;
28553 +
28554 +       /* Increment count of DPC's pending. */
28555 +       spin_lock_irqsave(&pIOMgr->dpc_lock, flags);
28556 +       pIOMgr->dpc_req++;
28557 +       spin_unlock_irqrestore(&pIOMgr->dpc_lock, flags);
28558  
28559 -       DPC_Schedule(pIOMgr->hDPC);
28560 +       /* Schedule DPC */
28561 +       tasklet_schedule(&pIOMgr->dpc_tasklet);
28562  }
28563  
28564  /*
28565 @@ -1108,7 +1160,8 @@ static u32 FindReadyOutput(struct CHNL_M
28566  
28567         id = (pChnl != NULL ? pChnl->uId : (pChnlMgr->dwLastOutput + 1));
28568         id = ((id == CHNL_MAXCHANNELS) ? 0 : id);
28569 -       DBC_Assert(id < CHNL_MAXCHANNELS);
28570 +       if (id >= CHNL_MAXCHANNELS)
28571 +               goto func_end;
28572         if (dwMask) {
28573                 shift = (1 << id);
28574                 startId = id;
28575 @@ -1117,7 +1170,6 @@ static u32 FindReadyOutput(struct CHNL_M
28576                                 uRetval = id;
28577                                 if (pChnl == NULL)
28578                                         pChnlMgr->dwLastOutput = id;
28579 -
28580                                 break;
28581                         }
28582                         id = id + 1;
28583 @@ -1125,7 +1177,7 @@ static u32 FindReadyOutput(struct CHNL_M
28584                         shift = (1 << id);
28585                 } while (id != startId);
28586         }
28587 -       DBC_Ensure((uRetval == OUTPUTNOTREADY) || (uRetval < CHNL_MAXCHANNELS));
28588 +func_end:
28589         return uRetval;
28590  }
28591  
28592 @@ -1150,7 +1202,7 @@ static void InputChnl(struct IO_MGR *pIO
28593  
28594         DBG_Trace(DBG_LEVEL3, "> InputChnl\n");
28595  
28596 -       /* Attempt to perform input.... */
28597 +       /* Attempt to perform input */
28598         if (!IO_GetValue(pIOMgr->hWmdContext, struct SHM, sm, inputFull))
28599                 goto func_end;
28600  
28601 @@ -1166,18 +1218,21 @@ static void InputChnl(struct IO_MGR *pIO
28602         pChnl = pChnlMgr->apChannel[chnlId];
28603         if ((pChnl != NULL) && CHNL_IsInput(pChnl->uMode)) {
28604                 if ((pChnl->dwState & ~CHNL_STATEEOS) == CHNL_STATEREADY) {
28605 -                       if (!pChnl->pIORequests)
28606 -                               goto func_end;
28607 -                       /* Get the I/O request, and attempt a transfer:  */
28608 +                       if (!pChnl->pIORequests)
28609 +                               goto func_end;
28610 +                       /* Get the I/O request, and attempt a transfer */
28611                         pChirp = (struct CHNL_IRP *)LST_GetHead(pChnl->
28612                                  pIORequests);
28613                         if (pChirp) {
28614                                 pChnl->cIOReqs--;
28615 -                               DBC_Assert(pChnl->cIOReqs >= 0);
28616 -                               /* Ensure we don't overflow the client's
28617 -                                * buffer: */
28618 +                               if (pChnl->cIOReqs < 0)
28619 +                                       goto func_end;
28620 +                               /*
28621 +                                * Ensure we don't overflow the client's
28622 +                                * buffer.
28623 +                                */
28624                                 uBytes = min(uBytes, pChirp->cBytes);
28625 -                               /* Transfer buffer from DSP side: */
28626 +                               /* Transfer buffer from DSP side */
28627                                 uBytes = ReadData(pIOMgr->hWmdContext,
28628                                                 pChirp->pHostSysBuf,
28629                                                 pIOMgr->pInput, uBytes);
28630 @@ -1189,26 +1244,32 @@ static void InputChnl(struct IO_MGR *pIO
28631                                          "\n", *((RMS_WORD *)(pChirp->
28632                                          pHostSysBuf)));
28633                                 if (uBytes == 0) {
28634 -                                       /* This assertion fails if the DSP
28635 +                                       /*
28636 +                                        * This assertion fails if the DSP
28637                                          * sends EOS more than once on this
28638 -                                        * channel: */
28639 -                                       DBC_Assert(!(pChnl->dwState &
28640 -                                                 CHNL_STATEEOS));
28641 -                                        /* Zero bytes indicates EOS. Update
28642 -                                         * IOC status for this chirp, and also
28643 -                                         * the channel state: */
28644 +                                        * channel.
28645 +                                        */
28646 +                                       if (pChnl->dwState & CHNL_STATEEOS)
28647 +                                               goto func_end;
28648 +                                       /*
28649 +                                        * Zero bytes indicates EOS. Update
28650 +                                        * IOC status for this chirp, and also
28651 +                                        * the channel state.
28652 +                                        */
28653                                         pChirp->status |= CHNL_IOCSTATEOS;
28654                                         pChnl->dwState |= CHNL_STATEEOS;
28655 -                                       /* Notify that end of stream has
28656 -                                        * occurred */
28657 +                                       /*
28658 +                                        * Notify that end of stream has
28659 +                                        * occurred.
28660 +                                        */
28661                                         NTFY_Notify(pChnl->hNtfy,
28662                                                    DSP_STREAMDONE);
28663                                         DBG_Trace(DBG_LEVEL7, "Input Chnl NTFY "
28664                                                  "chnl = 0x%x\n", pChnl);
28665                                 }
28666 -                               /* Tell DSP if no more I/O buffers available: */
28667 -                               if (!pChnl->pIORequests)
28668 -                                       goto func_end;
28669 +                               /* Tell DSP if no more I/O buffers available */
28670 +                               if (!pChnl->pIORequests)
28671 +                                       goto func_end;
28672                                 if (LST_IsEmpty(pChnl->pIORequests)) {
28673                                         IO_AndValue(pIOMgr->hWmdContext,
28674                                                    struct SHM, sm, hostFreeMask,
28675 @@ -1217,27 +1278,29 @@ static void InputChnl(struct IO_MGR *pIO
28676                                 fClearChnl = true;
28677                                 fNotifyClient = true;
28678                         } else {
28679 -                               /* Input full for this channel, but we have no
28680 +                               /*
28681 +                                * Input full for this channel, but we have no
28682                                  * buffers available.  The channel must be
28683                                  * "idling". Clear out the physical input
28684 -                                * channel.  */
28685 +                                * channel.
28686 +                                */
28687                                 fClearChnl = true;
28688                         }
28689                 } else {
28690 -                       /* Input channel cancelled:  clear input channel.  */
28691 +                       /* Input channel cancelled: clear input channel */
28692                         fClearChnl = true;
28693                 }
28694         } else {
28695 -               /* DPC fired after host closed channel: clear input channel. */
28696 +               /* DPC fired after host closed channel: clear input channel */
28697                 fClearChnl = true;
28698         }
28699         if (fClearChnl) {
28700 -               /* Indicate to the DSP we have read the input: */
28701 +               /* Indicate to the DSP we have read the input */
28702                 IO_SetValue(pIOMgr->hWmdContext, struct SHM, sm, inputFull, 0);
28703                 CHNLSM_InterruptDSP2(pIOMgr->hWmdContext, MBX_PCPY_CLASS);
28704         }
28705         if (fNotifyClient) {
28706 -               /* Notify client with IO completion record:  */
28707 +               /* Notify client with IO completion record */
28708                 NotifyChnlComplete(pChnl, pChirp);
28709         }
28710  func_end:
28711 @@ -1261,12 +1324,12 @@ static void InputMsg(struct IO_MGR *pIOM
28712         u32 addr;
28713  
28714         pCtrl = pIOMgr->pMsgInputCtrl;
28715 -       /* Get the number of input messages to be read. */
28716 +       /* Get the number of input messages to be read */
28717         fInputEmpty = IO_GetValue(pIOMgr->hWmdContext, struct MSG, pCtrl,
28718                                  bufEmpty);
28719         uMsgs = IO_GetValue(pIOMgr->hWmdContext, struct MSG, pCtrl, size);
28720 -       if (fInputEmpty || uMsgs >= hMsgMgr->uMaxMsgs)
28721 -               return;
28722 +       if (fInputEmpty)
28723 +               goto func_end;
28724  
28725         pMsgInput = pIOMgr->pMsgInput;
28726         for (i = 0; i < uMsgs; i++) {
28727 @@ -1280,49 +1343,53 @@ static void InputMsg(struct IO_MGR *pIOM
28728                 addr = (u32)&(((struct MSG_DSPMSG *)pMsgInput)->dwId);
28729                 msg.dwId = ReadExt32BitDspData(pIOMgr->hWmdContext, addr);
28730                 pMsgInput += sizeof(struct MSG_DSPMSG);
28731 -               if (!hMsgMgr->queueList)
28732 -                       goto func_end;
28733 +               if (!hMsgMgr->queueList)
28734 +                       goto func_end;
28735  
28736                 /* Determine which queue to put the message in */
28737                 hMsgQueue = (struct MSG_QUEUE *)LST_First(hMsgMgr->queueList);
28738                 DBG_Trace(DBG_LEVEL7, "InputMsg RECVD: dwCmd=0x%x dwArg1=0x%x "
28739                          "dwArg2=0x%x dwId=0x%x \n", msg.msg.dwCmd,
28740                          msg.msg.dwArg1, msg.msg.dwArg2, msg.dwId);
28741 -                /*  Interrupt may occur before shared memory and message
28742 -                *  input locations have been set up. If all nodes were
28743 -                *  cleaned up, hMsgMgr->uMaxMsgs should be 0.  */
28744 -               if (hMsgQueue && uMsgs > hMsgMgr->uMaxMsgs)
28745 -                       goto func_end;
28746 -
28747 +               /*
28748 +                * Interrupt may occur before shared memory and message
28749 +                * input locations have been set up. If all nodes were
28750 +                * cleaned up, hMsgMgr->uMaxMsgs should be 0.
28751 +                */
28752                 while (hMsgQueue != NULL) {
28753                         if (msg.dwId == hMsgQueue->dwId) {
28754                                 /* Found it */
28755                                 if (msg.msg.dwCmd == RMS_EXITACK) {
28756 -                                       /* The exit message does not get
28757 -                                        * queued */
28758 -                                       /* Call the node exit notification */
28759 -                                       /* Node handle */ /* status */
28760 +                                       /*
28761 +                                        * Call the node exit notification.
28762 +                                        * The exit message does not get
28763 +                                        * queued.
28764 +                                        */
28765                                         (*hMsgMgr->onExit)((HANDLE)hMsgQueue->
28766                                                 hArg, msg.msg.dwArg1);
28767                                 } else {
28768 -                                       /* Not an exit acknowledgement, queue
28769 -                                        * the message */
28770 -                                       if (!hMsgQueue->msgFreeList)
28771 -                                               goto func_end;
28772 +                                       /*
28773 +                                        * Not an exit acknowledgement, queue
28774 +                                        * the message.
28775 +                                        */
28776 +                                       if (!hMsgQueue->msgFreeList)
28777 +                                               goto func_end;
28778                                         pMsg = (struct MSG_FRAME *)LST_GetHead
28779                                                 (hMsgQueue->msgFreeList);
28780 -                                       if (hMsgQueue->msgUsedList && pMsg) {
28781 +                                       if (hMsgQueue->msgUsedList && pMsg) {
28782                                                 pMsg->msgData = msg;
28783                                                 LST_PutTail(hMsgQueue->
28784 -                                                     msgUsedList,
28785 -                                                     (struct LST_ELEM *)pMsg);
28786 +                                                   msgUsedList,
28787 +                                                   (struct list_head *)pMsg);
28788                                                 NTFY_Notify(hMsgQueue->hNtfy,
28789                                                         DSP_NODEMESSAGEREADY);
28790                                                 SYNC_SetEvent(hMsgQueue->
28791                                                         hSyncEvent);
28792                                         } else {
28793 -                                               /* No free frame to copy the
28794 -                                                * message into */
28795 +                                               /*
28796 +                                                * No free frame to copy the
28797 +                                                * message into.
28798 +                                                */
28799                                                 DBG_Trace(DBG_LEVEL7, "NO FREE "
28800                                                         "MSG FRAMES, DISCARDING"
28801                                                         " MESSAGE\n");
28802 @@ -1331,10 +1398,10 @@ static void InputMsg(struct IO_MGR *pIOM
28803                                 break;
28804                         }
28805  
28806 -                       if (!hMsgMgr->queueList || !hMsgQueue)
28807 -                               goto func_end;
28808 +                       if (!hMsgMgr->queueList || !hMsgQueue)
28809 +                               goto func_end;
28810                         hMsgQueue = (struct MSG_QUEUE *)LST_Next(hMsgMgr->
28811 -                                   queueList, (struct LST_ELEM *)hMsgQueue);
28812 +                                   queueList, (struct list_head *)hMsgQueue);
28813                 }
28814         }
28815         /* Set the post SWI flag */
28816 @@ -1347,8 +1414,7 @@ static void InputMsg(struct IO_MGR *pIOM
28817                 CHNLSM_InterruptDSP2(pIOMgr->hWmdContext, MBX_PCPY_CLASS);
28818         }
28819  func_end:
28820 -       return;
28821 -
28822 +       return;
28823  }
28824  
28825  /*
28826 @@ -1361,23 +1427,31 @@ static void NotifyChnlComplete(struct CH
28827  {
28828         bool fSignalEvent;
28829  
28830 -       DBC_Require(MEM_IsValidHandle(pChnl, CHNL_SIGNATURE));
28831 -       DBC_Require(pChnl->hSyncEvent != NULL);
28832 -        /*  Note: we signal the channel event only if the queue of IO
28833 -         *  completions is empty.  If it is not empty, the event is sure to be
28834 -         *  signalled by the only IO completion list consumer:
28835 -         *  WMD_CHNL_GetIOC().  */
28836 +       if (!MEM_IsValidHandle(pChnl, CHNL_SIGNATURE) || !pChnl->hSyncEvent ||
28837 +          !pChnl->pIOCompletions || !pChirp)
28838 +               goto func_end;
28839 +
28840 +       /*
28841 +        * Note: we signal the channel event only if the queue of IO
28842 +        * completions is empty.  If it is not empty, the event is sure to be
28843 +        * signalled by the only IO completion list consumer:
28844 +        * WMD_CHNL_GetIOC().
28845 +        */
28846         fSignalEvent = LST_IsEmpty(pChnl->pIOCompletions);
28847 -       /* Enqueue the IO completion info for the client: */
28848 -       LST_PutTail(pChnl->pIOCompletions, (struct LST_ELEM *) pChirp);
28849 +       /* Enqueue the IO completion info for the client */
28850 +       LST_PutTail(pChnl->pIOCompletions, (struct list_head *)pChirp);
28851         pChnl->cIOCs++;
28852 -       DBC_Assert(pChnl->cIOCs <= pChnl->cChirps);
28853 -       /* Signal the channel event (if not already set) that IO is complete: */
28854 +
28855 +       if (pChnl->cIOCs > pChnl->cChirps)
28856 +               goto func_end;
28857 +       /* Signal the channel event (if not already set) that IO is complete */
28858         if (fSignalEvent)
28859                 SYNC_SetEvent(pChnl->hSyncEvent);
28860  
28861         /* Notify that IO is complete */
28862         NTFY_Notify(pChnl->hNtfy, DSP_STREAMIOCOMPLETION);
28863 +func_end:
28864 +       return;
28865  }
28866  
28867  /*
28868 @@ -1397,14 +1471,14 @@ static void OutputChnl(struct IO_MGR *pI
28869         pChnlMgr = pIOMgr->hChnlMgr;
28870         sm = pIOMgr->pSharedMem;
28871         DBG_Trace(DBG_LEVEL3, "> OutputChnl\n");
28872 -       /* Attempt to perform output: */
28873 +       /* Attempt to perform output */
28874         if (IO_GetValue(pIOMgr->hWmdContext, struct SHM, sm, outputFull))
28875                 goto func_end;
28876  
28877         if (pChnl && !((pChnl->dwState & ~CHNL_STATEEOS) == CHNL_STATEREADY))
28878                 goto func_end;
28879  
28880 -       /* Look to see if both a PC and DSP output channel are ready: */
28881 +       /* Look to see if both a PC and DSP output channel are ready */
28882         dwDspFMask = IO_GetValue(pIOMgr->hWmdContext, struct SHM, sm,
28883                                  dspFreeMask);
28884         chnlId = FindReadyOutput(pChnlMgr, pChnl, (pChnlMgr->dwOutputMask &
28885 @@ -1413,24 +1487,24 @@ static void OutputChnl(struct IO_MGR *pI
28886                 goto func_end;
28887  
28888         pChnl = pChnlMgr->apChannel[chnlId];
28889 -       if (!pChnl || !pChnl->pIORequests) {
28890 -               /* Shouldn't get here: */
28891 +       if (!pChnl || !pChnl->pIORequests) {
28892 +               /* Shouldn't get here */
28893                 goto func_end;
28894         }
28895 -       /* Get the I/O request, and attempt a transfer:  */
28896 +       /* Get the I/O request, and attempt a transfer */
28897         pChirp = (struct CHNL_IRP *)LST_GetHead(pChnl->pIORequests);
28898         if (!pChirp)
28899                 goto func_end;
28900  
28901         pChnl->cIOReqs--;
28902 -       if (pChnl->cIOReqs < 0 || !pChnl->pIORequests)
28903 -               goto func_end;
28904 +       if (pChnl->cIOReqs < 0 || !pChnl->pIORequests)
28905 +               goto func_end;
28906  
28907 -       /* Record fact that no more I/O buffers available:  */
28908 +       /* Record fact that no more I/O buffers available */
28909         if (LST_IsEmpty(pChnl->pIORequests))
28910                 pChnlMgr->dwOutputMask &= ~(1 << chnlId);
28911  
28912 -       /* Transfer buffer to DSP side: */
28913 +       /* Transfer buffer to DSP side */
28914         pChirp->cBytes = WriteData(pIOMgr->hWmdContext, pIOMgr->pOutput,
28915                         pChirp->pHostSysBuf, min(pIOMgr->uSMBufSize, pChirp->
28916                         cBytes));
28917 @@ -1450,7 +1524,7 @@ static void OutputChnl(struct IO_MGR *pI
28918                    uWordSize);
28919  #endif
28920         IO_SetValue(pIOMgr->hWmdContext, struct SHM, sm, outputFull, 1);
28921 -       /* Indicate to the DSP we have written the output: */
28922 +       /* Indicate to the DSP we have written the output */
28923         CHNLSM_InterruptDSP2(pIOMgr->hWmdContext, MBX_PCPY_CLASS);
28924         /* Notify client with IO completion record (keep EOS) */
28925         pChirp->status &= CHNL_IOCSTATEOS;
28926 @@ -1488,13 +1562,14 @@ static void OutputMsg(struct IO_MGR *pIO
28927                 pMsgOutput = pIOMgr->pMsgOutput;
28928                 /* Copy uMsgs messages into shared memory */
28929                 for (i = 0; i < uMsgs; i++) {
28930 -                       if (!hMsgMgr->msgUsedList) {
28931 -                               DBG_Trace(DBG_LEVEL3, "msgUsedList is NULL\n");
28932 -                               pMsg = NULL;
28933 -                               goto func_end;
28934 -                       } else
28935 -                               pMsg = (struct MSG_FRAME *)LST_GetHead(
28936 -                                       hMsgMgr->msgUsedList);
28937 +                       if (!hMsgMgr->msgUsedList) {
28938 +                               DBG_Trace(DBG_LEVEL3, "msgUsedList is NULL\n");
28939 +                               pMsg = NULL;
28940 +                               goto func_end;
28941 +                       } else {
28942 +                               pMsg = (struct MSG_FRAME *)LST_GetHead(
28943 +                                       hMsgMgr->msgUsedList);
28944 +                       }
28945                         if (pMsg != NULL) {
28946                                 val = (pMsg->msgData).dwId;
28947                                 addr = (u32)&(((struct MSG_DSPMSG *)
28948 @@ -1519,10 +1594,10 @@ static void OutputMsg(struct IO_MGR *pIO
28949                                 WriteExt32BitDspData(pIOMgr->hWmdContext, addr,
28950                                                     val);
28951                                 pMsgOutput += sizeof(struct MSG_DSPMSG);
28952 -                               if (!hMsgMgr->msgFreeList)
28953 -                                       goto func_end;
28954 +                               if (!hMsgMgr->msgFreeList)
28955 +                                       goto func_end;
28956                                 LST_PutTail(hMsgMgr->msgFreeList,
28957 -                                          (struct LST_ELEM *) pMsg);
28958 +                                          (struct list_head *)pMsg);
28959                                 SYNC_SetEvent(hMsgMgr->hSyncEvent);
28960                         } else {
28961                                 DBG_Trace(DBG_LEVEL3, "pMsg is NULL\n");
28962 @@ -1544,12 +1619,12 @@ static void OutputMsg(struct IO_MGR *pIO
28963                         IO_SetValue(pIOMgr->hWmdContext, struct MSG, pCtrl,
28964                                    postSWI, true);
28965                         /* Tell the DSP we have written the output. */
28966 -                       CHNLSM_InterruptDSP2(pIOMgr->hWmdContext, MBX_PCPY_CLASS);
28967 +                       CHNLSM_InterruptDSP2(pIOMgr->hWmdContext,
28968 +                                               MBX_PCPY_CLASS);
28969                 }
28970         }
28971  func_end:
28972 -       return;
28973 -
28974 +       return;
28975  }
28976  
28977  /*
28978 @@ -1571,25 +1646,36 @@ static DSP_STATUS registerSHMSegs(struct
28979         u32 ulShmSegId0 = 0;
28980         u32 dwOffset, dwGPPBaseVA, ulDSPSize;
28981  
28982 -       /* Read address and size info for first SM region.*/
28983 -       /* Get start of 1st SM Heap region */
28984 +       /*
28985 +        * Read address and size info for first SM region.
28986 +        * Get start of 1st SM Heap region.
28987 +        */
28988         status = COD_GetSymValue(hCodMan, SHM0_SHARED_BASE_SYM, &ulShm0_Base);
28989 -       DBC_Assert(ulShm0_Base != 0);
28990 +       if (ulShm0_Base == 0) {
28991 +               status = DSP_EFAIL;
28992 +               goto func_end;
28993 +       }
28994         /* Get end of 1st SM Heap region */
28995         if (DSP_SUCCEEDED(status)) {
28996                 /* Get start and length of message part of shared memory */
28997                 status = COD_GetSymValue(hCodMan, SHM0_SHARED_END_SYM,
28998                                          &ulShm0_End);
28999 -               DBC_Assert(ulShm0_End != 0);
29000 +               if (ulShm0_End == 0) {
29001 +                       status = DSP_EFAIL;
29002 +                       goto func_end;
29003 +               }
29004         }
29005 -       /* start of Gpp reserved region */
29006 +       /* Start of Gpp reserved region */
29007         if (DSP_SUCCEEDED(status)) {
29008                 /* Get start and length of message part of shared memory */
29009                 status = COD_GetSymValue(hCodMan, SHM0_SHARED_RESERVED_BASE_SYM,
29010                                         &ulShm0_RsrvdStart);
29011                 DBG_Trace(DBG_LEVEL1, "***ulShm0_RsrvdStart  0x%x \n",
29012                          ulShm0_RsrvdStart);
29013 -               DBC_Assert(ulShm0_RsrvdStart != 0);
29014 +               if (ulShm0_RsrvdStart == 0) {
29015 +                       status = DSP_EFAIL;
29016 +                       goto func_end;
29017 +               }
29018         }
29019         /* Register with CMM */
29020         if (DSP_SUCCEEDED(status)) {
29021 @@ -1608,36 +1694,51 @@ static DSP_STATUS registerSHMSegs(struct
29022         }
29023         /* Register new SM region(s) */
29024         if (DSP_SUCCEEDED(status) && (ulShm0_End - ulShm0_Base) > 0) {
29025 -               /* calc size (bytes) of SM the GPP can alloc from */
29026 +               /* Calc size (bytes) of SM the GPP can alloc from */
29027                 ulRsrvdSize = (ulShm0_End - ulShm0_RsrvdStart + 1) * hIOMgr->
29028                               uWordSize;
29029 -               DBC_Assert(ulRsrvdSize > 0);
29030 -               /* calc size of SM DSP can alloc from */
29031 +               if (ulRsrvdSize <= 0) {
29032 +                       status = DSP_EFAIL;
29033 +                       goto func_end;
29034 +               }
29035 +               /* Calc size of SM DSP can alloc from */
29036                 ulDSPSize = (ulShm0_RsrvdStart - ulShm0_Base) * hIOMgr->
29037                         uWordSize;
29038 -               DBC_Assert(ulDSPSize > 0);
29039 -               /*  First TLB entry reserved for Bridge SM use.*/
29040 +               if (ulDSPSize <= 0) {
29041 +                       status = DSP_EFAIL;
29042 +                       goto func_end;
29043 +               }
29044 +               /* First TLB entry reserved for Bridge SM use.*/
29045                 ulGppPhys = hIOMgr->extProcInfo.tyTlb[0].ulGppPhys;
29046 -               /* get size in bytes */
29047 +               /* Get size in bytes */
29048                 ulDspVirt = hIOMgr->extProcInfo.tyTlb[0].ulDspVirt * hIOMgr->
29049                         uWordSize;
29050 -                /* Calc byte offset used to convert GPP phys <-> DSP byte
29051 -                 * address.*/
29052 +               /*
29053 +                * Calc byte offset used to convert GPP phys <-> DSP byte
29054 +                * address.
29055 +                */
29056                 if (dwGPPBasePA > ulDspVirt)
29057                         dwOffset = dwGPPBasePA - ulDspVirt;
29058                 else
29059                         dwOffset = ulDspVirt - dwGPPBasePA;
29060  
29061 -               DBC_Assert(ulShm0_RsrvdStart * hIOMgr->uWordSize >= ulDspVirt);
29062 -               /* calc Gpp phys base of SM region */
29063 -               /* Linux - this is actually uncached kernel virtual address*/
29064 +               if (ulShm0_RsrvdStart * hIOMgr->uWordSize < ulDspVirt) {
29065 +                       status = DSP_EFAIL;
29066 +                       goto func_end;
29067 +               }
29068 +               /*
29069 +                * Calc Gpp phys base of SM region.
29070 +                * This is actually uncached kernel virtual address.
29071 +                */
29072                 dwGPPBaseVA = ulGppPhys + ulShm0_RsrvdStart * hIOMgr->uWordSize
29073                                 - ulDspVirt;
29074 -               /* calc Gpp phys base of SM region */
29075 -               /* Linux - this is the physical address*/
29076 +               /*
29077 +                * Calc Gpp phys base of SM region.
29078 +                * This is the physical address.
29079 +                */
29080                 dwGPPBasePA = dwGPPBasePA + ulShm0_RsrvdStart * hIOMgr->
29081                               uWordSize - ulDspVirt;
29082 -                /* Register SM Segment 0.*/
29083 +               /* Register SM Segment 0.*/
29084                 status = CMM_RegisterGPPSMSeg(hIOMgr->hCmmMgr, dwGPPBasePA,
29085                          ulRsrvdSize, dwOffset, (dwGPPBasePA > ulDspVirt) ?
29086                          CMM_ADDTODSPPA : CMM_SUBFROMDSPPA,
29087 @@ -1647,9 +1748,11 @@ static DSP_STATUS registerSHMSegs(struct
29088                         DBG_Trace(DBG_LEVEL7, "ERROR - Failed to register SM "
29089                                  "Seg 0 \n");
29090                 }
29091 -               /* first SM region is segId = 1 */
29092 -               DBC_Assert(ulShmSegId0 == 1);
29093 +               /* First SM region is segId = 1 */
29094 +               if (ulShmSegId0 != 1)
29095 +                       status = DSP_EFAIL;
29096         }
29097 +func_end:
29098         return status;
29099  }
29100  
29101 @@ -1669,7 +1772,7 @@ static u32 ReadData(struct WMD_DEV_CONTE
29102   *      Copies buffers from the host side buffer to the shared memory.
29103   */
29104  static u32 WriteData(struct WMD_DEV_CONTEXT *hDevContext, void *pDest,
29105 -                      void *pSrc, u32 uSize)
29106 +                       void *pSrc, u32 uSize)
29107  {
29108         memcpy(pDest, pSrc, uSize);
29109         return uSize;
29110 @@ -1685,8 +1788,7 @@ void IO_IntrDSP2(IN struct IO_MGR *pIOMg
29111   *  ======== IO_SHMcontrol ========
29112   *      Sets the requested SHM setting.
29113   */
29114 -DSP_STATUS IO_SHMsetting(IN struct IO_MGR *hIOMgr, IN enum SHM_DESCTYPE desc,
29115 -                        IN void *pArgs)
29116 +DSP_STATUS IO_SHMsetting(struct IO_MGR *hIOMgr, u8 desc, void *pArgs)
29117  {
29118  #ifdef CONFIG_BRIDGE_DVFS
29119         u32 i;
29120 @@ -1703,8 +1805,10 @@ DSP_STATUS IO_SHMsetting(IN struct IO_MG
29121                         return DSP_EFAIL;
29122                 break;
29123         case SHM_OPPINFO:
29124 -               /* Update the shared memory with the voltage, frequency,
29125 -                                  min and max frequency values for an OPP */
29126 +               /*
29127 +                * Update the shared memory with the voltage, frequency,
29128 +                * min and max frequency values for an OPP.
29129 +                */
29130                 for (i = 0; i <= dsp_max_opps; i++) {
29131                         hIOMgr->pSharedMem->oppTableStruct.oppPoint[i].voltage =
29132                                 vdd1_dsp_freq[i][0];
29133 @@ -1772,7 +1876,7 @@ void PrintDSPDebugTrace(struct IO_MGR *h
29134  {
29135         u32 ulNewMessageLength = 0, ulGPPCurPointer;
29136  
29137 -       GT_0trace(dsp_trace_mask, GT_ENTER, "Entering PrintDSPDebugTrace\n");
29138 +       GT_0trace(dsp_trace_mask, GT_ENTER, "Entering PrintDSPDebugTrace\n");
29139  
29140         while (true) {
29141                 /* Get the DSP current pointer */
29142 @@ -1781,25 +1885,25 @@ void PrintDSPDebugTrace(struct IO_MGR *h
29143                                   hIOMgr->ulDspVa);
29144  
29145                 /* No new debug messages available yet */
29146 -               if (ulGPPCurPointer == hIOMgr->ulGPPReadPointer)
29147 +               if (ulGPPCurPointer == hIOMgr->ulGPPReadPointer) {
29148                         break;
29149 -
29150 -               /* Continuous data */
29151 -               else if (ulGPPCurPointer > hIOMgr->ulGPPReadPointer) {
29152 +               } else if (ulGPPCurPointer > hIOMgr->ulGPPReadPointer) {
29153 +                       /* Continuous data */
29154                         ulNewMessageLength = ulGPPCurPointer - hIOMgr->
29155                                              ulGPPReadPointer;
29156  
29157                         memcpy(hIOMgr->pMsg, (char *)hIOMgr->ulGPPReadPointer,
29158 -                              ulNewMessageLength);
29159 +                               ulNewMessageLength);
29160                         hIOMgr->pMsg[ulNewMessageLength] = '\0';
29161 -                       /* Advance the GPP trace pointer to DSP current
29162 -                        * pointer */
29163 +                       /*
29164 +                        * Advance the GPP trace pointer to DSP current
29165 +                        * pointer.
29166 +                        */
29167                         hIOMgr->ulGPPReadPointer += ulNewMessageLength;
29168                         /* Print the trace messages */
29169 -                       GT_0trace(dsp_trace_mask, GT_1CLASS, hIOMgr->pMsg);
29170 -               }
29171 +                       pr_info("DSPTrace:%s", hIOMgr->pMsg);
29172 +               } else if (ulGPPCurPointer < hIOMgr->ulGPPReadPointer) {
29173                 /* Handle trace buffer wraparound */
29174 -               else if (ulGPPCurPointer < hIOMgr->ulGPPReadPointer) {
29175                         memcpy(hIOMgr->pMsg, (char *)hIOMgr->ulGPPReadPointer,
29176                                 hIOMgr->ulTraceBufferEnd -
29177                                 hIOMgr->ulGPPReadPointer);
29178 @@ -1812,12 +1916,14 @@ void PrintDSPDebugTrace(struct IO_MGR *h
29179                         hIOMgr->pMsg[hIOMgr->ulTraceBufferEnd -
29180                                 hIOMgr->ulGPPReadPointer +
29181                                 ulNewMessageLength] = '\0';
29182 -                       /* Advance the GPP trace pointer to DSP current
29183 -                        * pointer */
29184 +                       /*
29185 +                        * Advance the GPP trace pointer to DSP current
29186 +                        * pointer.
29187 +                        */
29188                         hIOMgr->ulGPPReadPointer = hIOMgr->ulTraceBufferBegin +
29189                                                    ulNewMessageLength;
29190                         /* Print the trace messages */
29191 -                       GT_0trace(dsp_trace_mask, GT_1CLASS, hIOMgr->pMsg);
29192 +                       pr_info("DSPTrace:%s", hIOMgr->pMsg);
29193                 }
29194         }
29195  }
29196 @@ -1842,53 +1948,55 @@ void PrintDSPDebugTrace(struct IO_MGR *h
29197   *      There are no more than ulNumWords extra characters needed (the number of
29198   *      linefeeds minus the number of NULLS in the input buffer).
29199   */
29200 -#if (defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
29201 +#if (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
29202  static DSP_STATUS PackTraceBuffer(char *lpBuf, u32 nBytes, u32 ulNumWords)
29203  {
29204 -       DSP_STATUS status = DSP_SOK;
29205 -       char *lpTmpBuf;
29206 -       char *lpBufStart;
29207 -       char *lpTmpStart;
29208 -       u32 nCnt;
29209 -       char thisChar;
29210 -
29211 -       /* tmp workspace, 1 KB longer than input buf */
29212 -       lpTmpBuf = MEM_Calloc((nBytes + ulNumWords), MEM_PAGED);
29213 -       if (lpTmpBuf == NULL) {
29214 -               DBG_Trace(DBG_LEVEL7, "PackTrace buffer:OutofMemory \n");
29215 -               status = DSP_EMEMORY;
29216 -       }
29217 -
29218 -       if (DSP_SUCCEEDED(status)) {
29219 -               lpBufStart = lpBuf;
29220 -               lpTmpStart = lpTmpBuf;
29221 -               for (nCnt = nBytes; nCnt > 0; nCnt--) {
29222 -                       thisChar = *lpBuf++;
29223 -                       switch (thisChar) {
29224 -                       case '\0':      /* Skip null bytes */
29225 -                       break;
29226 -                       case '\n':      /* Convert \n to \r\n */
29227 -                       /* NOTE: do not reverse order; Some OS */
29228 -                       /* editors control doesn't understand "\n\r" */
29229 -                       *lpTmpBuf++ = '\r';
29230 -                       *lpTmpBuf++ = '\n';
29231 -                       break;
29232 -                       default:        /* Copy in the actual ascii byte */
29233 -                       *lpTmpBuf++ = thisChar;
29234 -                       break;
29235 -                       }
29236 -               }
29237 -               *lpTmpBuf = '\0';    /* Make sure tmp buf is null terminated */
29238 -               /* Cut output down to input buf size */
29239 -               strncpy(lpBufStart, lpTmpStart, nBytes);
29240 -               /*Make sure output is null terminated */
29241 -               lpBufStart[nBytes - 1] = '\0';
29242 -               MEM_Free(lpTmpStart);
29243 -       }
29244 +       DSP_STATUS status = DSP_SOK;
29245 +       char *lpTmpBuf;
29246 +       char *lpBufStart;
29247 +       char *lpTmpStart;
29248 +       u32 nCnt;
29249 +       char thisChar;
29250 +
29251 +       /* Tmp workspace, 1 KB longer than input buf */
29252 +       lpTmpBuf = MEM_Calloc((nBytes + ulNumWords), MEM_PAGED);
29253 +       if (lpTmpBuf == NULL) {
29254 +               DBG_Trace(DBG_LEVEL7, "PackTrace buffer:OutofMemory \n");
29255 +               status = DSP_EMEMORY;
29256 +       }
29257  
29258 -       return status;
29259 +       if (DSP_SUCCEEDED(status)) {
29260 +               lpBufStart = lpBuf;
29261 +               lpTmpStart = lpTmpBuf;
29262 +               for (nCnt = nBytes; nCnt > 0; nCnt--) {
29263 +                       thisChar = *lpBuf++;
29264 +                       switch (thisChar) {
29265 +                       case '\0':      /* Skip null bytes */
29266 +                               break;
29267 +                       case '\n':      /* Convert \n to \r\n */
29268 +                               /*
29269 +                                * NOTE: do not reverse order; Some OS
29270 +                                * editors control doesn't understand "\n\r"
29271 +                                */
29272 +                               *lpTmpBuf++ = '\r';
29273 +                               *lpTmpBuf++ = '\n';
29274 +                               break;
29275 +                       default:         /* Copy in the actual ascii byte */
29276 +                               *lpTmpBuf++ = thisChar;
29277 +                               break;
29278 +                       }
29279 +               }
29280 +               *lpTmpBuf = '\0';    /* Make sure tmp buf is null terminated */
29281 +               /* Cut output down to input buf size */
29282 +               strncpy(lpBufStart, lpTmpStart, nBytes);
29283 +               /* Make sure output is null terminated */
29284 +               lpBufStart[nBytes - 1] = '\0';
29285 +               MEM_Free(lpTmpStart);
29286 +       }
29287 +
29288 +       return status;
29289  }
29290 -#endif    /* (defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE */
29291 +#endif    /* (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE */
29292  
29293  /*
29294   *  ======== PrintDspTraceBuffer ========
29295 @@ -1904,106 +2012,106 @@ static DSP_STATUS PackTraceBuffer(char *
29296   */
29297  DSP_STATUS PrintDspTraceBuffer(struct WMD_DEV_CONTEXT *hWmdContext)
29298  {
29299 -       DSP_STATUS status = DSP_SOK;
29300 +       DSP_STATUS status = DSP_SOK;
29301 +
29302 +#if (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
29303 +       struct COD_MANAGER *hCodMgr;
29304 +       u32 ulTraceEnd;
29305 +       u32 ulTraceBegin;
29306 +       u32 ulNumBytes = 0;
29307 +       u32 ulNumWords = 0;
29308 +       u32 ulWordSize = 2;
29309 +       CONST u32 uMaxSize = 512;
29310 +       char *pszBuf;
29311 +       u16 *lpszBuf;
29312 +
29313 +       struct WMD_DEV_CONTEXT *pWmdContext = (struct WMD_DEV_CONTEXT *)
29314 +                                                    hWmdContext;
29315 +       struct WMD_DRV_INTERFACE *pIntfFxns;
29316 +       struct DEV_OBJECT *pDevObject = (struct DEV_OBJECT *)
29317 +                                           pWmdContext->hDevObject;
29318 +
29319 +       status = DEV_GetCodMgr(pDevObject, &hCodMgr);
29320 +       if (DSP_FAILED(status))
29321 +               GT_0trace(dsp_trace_mask, GT_2CLASS,
29322 +                       "PrintDspTraceBuffer: Failed on DEV_GetCodMgr.\n");
29323 +
29324 +       if (DSP_SUCCEEDED(status)) {
29325 +               /* Look for SYS_PUTCBEG/SYS_PUTCEND */
29326 +               status = COD_GetSymValue(hCodMgr, COD_TRACEBEG, &ulTraceBegin);
29327 +               GT_1trace(dsp_trace_mask, GT_2CLASS,
29328 +                       "PrintDspTraceBuffer: ulTraceBegin Value 0x%x\n",
29329 +                       ulTraceBegin);
29330 +               if (DSP_FAILED(status))
29331 +                       GT_0trace(dsp_trace_mask, GT_2CLASS,
29332 +                               "PrintDspTraceBuffer: Failed on "
29333 +                               "COD_GetSymValue.\n");
29334 +       }
29335 +       if (DSP_SUCCEEDED(status)) {
29336 +               status = COD_GetSymValue(hCodMgr, COD_TRACEEND, &ulTraceEnd);
29337 +               GT_1trace(dsp_trace_mask, GT_2CLASS,
29338 +                       "PrintDspTraceBuffer: ulTraceEnd Value 0x%x\n",
29339 +                       ulTraceEnd);
29340 +                if (DSP_FAILED(status))
29341 +                       GT_0trace(dsp_trace_mask, GT_2CLASS,
29342 +                               "PrintDspTraceBuffer: Failed on "
29343 +                               "COD_GetSymValue.\n");
29344 +       }
29345 +       if (DSP_SUCCEEDED(status)) {
29346 +               ulNumBytes = (ulTraceEnd - ulTraceBegin) * ulWordSize;
29347 +               /*
29348 +                * If the chip type is 55 then the addresses will be
29349 +                * byte addresses; convert them to word addresses.
29350 +                */
29351 +               if (ulNumBytes > uMaxSize)
29352 +                       ulNumBytes = uMaxSize;
29353 +
29354 +               /* Make sure the data we request fits evenly */
29355 +               ulNumBytes = (ulNumBytes / ulWordSize) * ulWordSize;
29356 +               GT_1trace(dsp_trace_mask, GT_2CLASS, "PrintDspTraceBuffer: "
29357 +                       "ulNumBytes 0x%x\n", ulNumBytes);
29358 +               ulNumWords = ulNumBytes * ulWordSize;
29359 +               GT_1trace(dsp_trace_mask, GT_2CLASS, "PrintDspTraceBuffer: "
29360 +                       "ulNumWords 0x%x\n", ulNumWords);
29361 +               status = DEV_GetIntfFxns(pDevObject, &pIntfFxns);
29362 +       }
29363  
29364 -#if (defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
29365 -       struct COD_MANAGER *hCodMgr;
29366 -       u32 ulTraceEnd;
29367 -       u32 ulTraceBegin;
29368 -       u32 ulNumBytes = 0;
29369 -       u32 ulNumWords = 0;
29370 -       u32 ulWordSize = 2;
29371 -       CONST u32 uMaxSize = 512;
29372 -       char *pszBuf;
29373 -       u16 *lpszBuf;
29374 -
29375 -       struct WMD_DEV_CONTEXT *pWmdContext = (struct WMD_DEV_CONTEXT *)
29376 -                                               hWmdContext;
29377 -       struct WMD_DRV_INTERFACE *pIntfFxns;
29378 -       struct DEV_OBJECT *pDevObject = (struct DEV_OBJECT *)
29379 -                                       pWmdContext->hDevObject;
29380 -
29381 -       status = DEV_GetCodMgr(pDevObject, &hCodMgr);
29382 -       if (DSP_FAILED(status))
29383 -               GT_0trace(dsp_trace_mask, GT_2CLASS,
29384 -               "PrintDspTraceBuffer: Failed on DEV_GetCodMgr.\n");
29385 -
29386 -       if (DSP_SUCCEEDED(status)) {
29387 -               /* Look for SYS_PUTCBEG/SYS_PUTCEND: */
29388 -               status = COD_GetSymValue(hCodMgr, COD_TRACEBEG, &ulTraceBegin);
29389 -               GT_1trace(dsp_trace_mask, GT_2CLASS,
29390 -                       "PrintDspTraceBuffer: ulTraceBegin Value 0x%x\n",
29391 -                       ulTraceBegin);
29392 -               if (DSP_FAILED(status))
29393 -                       GT_0trace(dsp_trace_mask, GT_2CLASS,
29394 -                               "PrintDspTraceBuffer: Failed on "
29395 -                               "COD_GetSymValue.\n");
29396 -       }
29397 -       if (DSP_SUCCEEDED(status)) {
29398 -               status = COD_GetSymValue(hCodMgr, COD_TRACEEND, &ulTraceEnd);
29399 -               GT_1trace(dsp_trace_mask, GT_2CLASS,
29400 -                       "PrintDspTraceBuffer: ulTraceEnd Value 0x%x\n",
29401 -                       ulTraceEnd);
29402 -               if (DSP_FAILED(status))
29403 -                       GT_0trace(dsp_trace_mask, GT_2CLASS,
29404 -                               "PrintDspTraceBuffer: Failed on "
29405 -                               "COD_GetSymValue.\n");
29406 -       }
29407 -       if (DSP_SUCCEEDED(status)) {
29408 -               ulNumBytes = (ulTraceEnd - ulTraceBegin) * ulWordSize;
29409 -               /*  If the chip type is 55 then the addresses will be
29410 -               *  byte addresses; convert them to word addresses.  */
29411 -               if (ulNumBytes > uMaxSize)
29412 -                       ulNumBytes = uMaxSize;
29413 -
29414 -               /* make sure the data we request fits evenly */
29415 -               ulNumBytes = (ulNumBytes / ulWordSize) * ulWordSize;
29416 -               GT_1trace(dsp_trace_mask, GT_2CLASS, "PrintDspTraceBuffer: "
29417 -                       "ulNumBytes 0x%x\n", ulNumBytes);
29418 -               ulNumWords = ulNumBytes * ulWordSize;
29419 -               GT_1trace(dsp_trace_mask, GT_2CLASS, "PrintDspTraceBuffer: "
29420 -                       "ulNumWords 0x%x\n", ulNumWords);
29421 -               status = DEV_GetIntfFxns(pDevObject, &pIntfFxns);
29422 -       }
29423 -
29424 -       if (DSP_SUCCEEDED(status)) {
29425 -               pszBuf = MEM_Calloc(uMaxSize, MEM_NONPAGED);
29426 -               lpszBuf = MEM_Calloc(ulNumBytes * 2, MEM_NONPAGED);
29427 -               if (pszBuf != NULL) {
29428 -                       /* Read bytes from the DSP trace buffer... */
29429 -                       status = (*pIntfFxns->pfnBrdRead)(hWmdContext,
29430 -                               (u8 *)pszBuf, (u32)ulTraceBegin,
29431 -                               ulNumBytes, 0);
29432 -                       if (DSP_FAILED(status))
29433 -                               GT_0trace(dsp_trace_mask, GT_2CLASS,
29434 -                                       "PrintDspTraceBuffer: "
29435 -                                       "Failed to Read Trace Buffer.\n");
29436 -
29437 -                       if (DSP_SUCCEEDED(status)) {
29438 -                               /* Pack and do newline conversion */
29439 -                               GT_0trace(dsp_trace_mask, GT_2CLASS,
29440 -                                       "PrintDspTraceBuffer: "
29441 -                                       "before pack and unpack.\n");
29442 -                               PackTraceBuffer(pszBuf, ulNumBytes, ulNumWords);
29443 -                               GT_1trace(dsp_trace_mask, GT_1CLASS,
29444 -                                       "DSP Trace Buffer:\n%s\n", pszBuf);
29445 -                       }
29446 -                       MEM_Free(pszBuf);
29447 -                       MEM_Free(lpszBuf);
29448 -               } else {
29449 -                       GT_0trace(dsp_trace_mask, GT_2CLASS,
29450 -                               "PrintDspTraceBuffer: Failed to "
29451 -                               "allocate trace buffer.\n");
29452 -                       status = DSP_EMEMORY;
29453 -               }
29454 -       }
29455 +       if (DSP_SUCCEEDED(status)) {
29456 +               pszBuf = MEM_Calloc(uMaxSize, MEM_NONPAGED);
29457 +               lpszBuf = MEM_Calloc(ulNumBytes * 2, MEM_NONPAGED);
29458 +               if (pszBuf != NULL) {
29459 +                       /* Read bytes from the DSP trace buffer... */
29460 +                       status = (*pIntfFxns->pfnBrdRead)(hWmdContext,
29461 +                               (u8 *)pszBuf, (u32)ulTraceBegin,
29462 +                               ulNumBytes, 0);
29463 +                       if (DSP_FAILED(status))
29464 +                               GT_0trace(dsp_trace_mask, GT_2CLASS,
29465 +                                       "PrintDspTraceBuffer: "
29466 +                                       "Failed to Read Trace Buffer.\n");
29467 +
29468 +                       if (DSP_SUCCEEDED(status)) {
29469 +                               /* Pack and do newline conversion */
29470 +                               GT_0trace(dsp_trace_mask, GT_2CLASS,
29471 +                                       "PrintDspTraceBuffer: "
29472 +                                       "before pack and unpack.\n");
29473 +                               PackTraceBuffer(pszBuf, ulNumBytes, ulNumWords);
29474 +                               GT_1trace(dsp_trace_mask, GT_1CLASS,
29475 +                                       "DSP Trace Buffer:\n%s\n", pszBuf);
29476 +                       }
29477 +                       MEM_Free(pszBuf);
29478 +                       MEM_Free(lpszBuf);
29479 +               } else {
29480 +                         GT_0trace(dsp_trace_mask, GT_2CLASS,
29481 +                               "PrintDspTraceBuffer: Failed to "
29482 +                               "allocate trace buffer.\n");
29483 +                         status = DSP_EMEMORY;
29484 +               }
29485 +       }
29486  #endif
29487 -       return status;
29488 +       return status;
29489  }
29490  
29491  void IO_SM_init(void)
29492  {
29493 -
29494 -       GT_create(&dsp_trace_mask, "DT"); /* DSP Trace Mask */
29495 -
29496 +       GT_create(&dsp_trace_mask, "DT"); /* DSP Trace Mask */
29497  }
29498 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/mmu_fault.c kernel-power-2.6.28/drivers/dsp/bridge/wmd/mmu_fault.c
29499 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/mmu_fault.c 2011-04-17 17:32:26.000000000 +0100
29500 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/mmu_fault.c      2011-05-02 22:36:51.000000000 +0100
29501 @@ -3,6 +3,8 @@
29502   *
29503   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
29504   *
29505 + * Implements DSP MMU fault handling functions.
29506 + *
29507   * Copyright (C) 2005-2006 Texas Instruments, Inc.
29508   *
29509   * This package is free software; you can redistribute it and/or modify
29510 @@ -14,23 +16,6 @@
29511   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29512   */
29513  
29514 -/*
29515 - *  ======== mmu_fault.c ========
29516 - *  Description:
29517 - *      Implements DSP MMU fault handling functions.
29518 - *
29519 - *! Revision History:
29520 - *! ================
29521 - *! 26-Dec-2004 hn: Support for IVA MMU exception.
29522 - *! 06-Mar-2003 sb: Print MMU fault address. Cosmetic changes.
29523 - *! 16-Feb-2003 vp: Fixed warning in MMU_FaultIsr
29524 - *! 05-Jan-2004 vp: Updated support for 24xx silicon
29525 - *! 19-Feb-2003 vp: Code review updates.
29526 - *!                 - Cosmetic changes.
29527 - *! 18-Oct-2002 sb: Ported to Linux platform.
29528 - *! 10-Sep-2001 kc: created.
29529 - */
29530 -
29531  /*  ----------------------------------- DSP/BIOS Bridge */
29532  #include <dspbridge/std.h>
29533  #include <dspbridge/dbdefs.h>
29534 @@ -42,7 +27,6 @@
29535  #include <dspbridge/dbg.h>
29536  
29537  /*  ----------------------------------- OS Adaptation Layer */
29538 -#include <dspbridge/dpc.h>
29539  #include <dspbridge/mem.h>
29540  #include <dspbridge/drv.h>
29541  
29542 @@ -69,14 +53,13 @@ static bool MMU_CheckIfFault(struct WMD_
29543   *  ======== MMU_FaultDpc ========
29544   *      Deferred procedure call to handle DSP MMU fault.
29545   */
29546 -void MMU_FaultDpc(IN void *pRefData)
29547 +void MMU_FaultDpc(IN unsigned long pRefData)
29548  {
29549         struct DEH_MGR *hDehMgr = (struct DEH_MGR *)pRefData;
29550 -       struct DEH_MGR *pDehMgr = (struct DEH_MGR *)hDehMgr;
29551  
29552         DBG_Trace(DBG_LEVEL1, "MMU_FaultDpc Enter: 0x%x\n", pRefData);
29553  
29554 -       if (pDehMgr)
29555 +       if (hDehMgr)
29556                 WMD_DEH_Notify(hDehMgr, DSP_MMUFAULT, 0L);
29557  
29558         DBG_Trace(DBG_LEVEL1, "MMU_FaultDpc Exit: 0x%x\n", pRefData);
29559 @@ -93,9 +76,8 @@ irqreturn_t  MMU_FaultIsr(int irq, IN vo
29560         struct CFG_HOSTRES resources;
29561         DSP_STATUS status = DSP_SOK;
29562  
29563 -
29564         DBG_Trace(DBG_LEVEL1, "Entering DEH_DspMmuIsr: 0x%x\n", pRefData);
29565 -       DBC_Require(irq == INT_DSP_MMU_IRQ);
29566 +       DBC_Require(irq == INT_DSP_MMU_IRQ);
29567         DBC_Require(MEM_IsValidHandle(pDehMgr, SIGNATURE));
29568  
29569         if (MEM_IsValidHandle(pDehMgr, SIGNATURE)) {
29570 @@ -113,14 +95,13 @@ irqreturn_t  MMU_FaultIsr(int irq, IN vo
29571                                 "0x%x\n", dmmuEventMask);
29572                         printk(KERN_INFO "***** DSPMMU FAULT ***** faultAddr "
29573                                 "0x%x\n", faultAddr);
29574 -                       /* Disable the MMU events, else once we clear it will
29575 -                        * start to raise INTs again */
29576                         /*
29577                          * Schedule a DPC directly. In the future, it may be
29578                          * necessary to check if DSP MMU fault is intended for
29579                          * Bridge.
29580                          */
29581 -                       DPC_Schedule(pDehMgr->hMmuFaultDpc);
29582 +                       tasklet_schedule(&pDehMgr->dpc_tasklet);
29583 +
29584                         /* Reset errInfo structure before use. */
29585                         pDehMgr->errInfo.dwErrMask = DSP_MMUFAULT;
29586                         pDehMgr->errInfo.dwVal1 = faultAddr >> 16;
29587 @@ -138,7 +119,7 @@ irqreturn_t  MMU_FaultIsr(int irq, IN vo
29588                                             HW_MMU_ALL_INTERRUPTS);
29589                 }
29590         }
29591 -       return IRQ_HANDLED;
29592 +       return IRQ_HANDLED;
29593  }
29594  
29595  
29596 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/mmu_fault.h kernel-power-2.6.28/drivers/dsp/bridge/wmd/mmu_fault.h
29597 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/mmu_fault.h 2011-04-17 17:32:26.000000000 +0100
29598 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/mmu_fault.h      2011-05-02 22:36:51.000000000 +0100
29599 @@ -3,6 +3,8 @@
29600   *
29601   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
29602   *
29603 + * Defines DSP MMU fault handling functions.
29604 + *
29605   * Copyright (C) 2005-2006 Texas Instruments, Inc.
29606   *
29607   * This package is free software; you can redistribute it and/or modify
29608 @@ -14,18 +16,6 @@
29609   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29610   */
29611  
29612 -
29613 -/*
29614 - *  ======== mmu_fault.h ========
29615 - *  Description:
29616 - *      Defines DSP MMU fault handling functions.
29617 - *
29618 - *! Revision History:
29619 - *! ================
29620 - *! 26-Dec-2004 hn: IVA MMU handlers.
29621 - *! 10-Sep-2001 kc: created.
29622 - */
29623 -
29624  #ifndef MMU_FAULT_
29625  #define MMU_FAULT_
29626  
29627 @@ -33,7 +23,7 @@
29628   *  ======== MMU_FaultDpc ========
29629   *      Deferred procedure call to handle DSP MMU fault.
29630   */
29631 -       void MMU_FaultDpc(IN void *pRefData);
29632 +       void MMU_FaultDpc(IN unsigned long pRefData);
29633  
29634  /*
29635   *  ======== MMU_FaultIsr ========
29636 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/msg_sm.c kernel-power-2.6.28/drivers/dsp/bridge/wmd/msg_sm.c
29637 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/msg_sm.c    2011-04-17 17:32:26.000000000 +0100
29638 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/msg_sm.c 2011-05-02 22:36:51.000000000 +0100
29639 @@ -3,6 +3,8 @@
29640   *
29641   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
29642   *
29643 + * Implements upper edge functions for WMD message module.
29644 + *
29645   * Copyright (C) 2005-2006 Texas Instruments, Inc.
29646   *
29647   * This package is free software; you can redistribute it and/or modify
29648 @@ -14,34 +16,6 @@
29649   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29650   */
29651  
29652 -
29653 -/*
29654 - *  ======== msg_sm.c ========
29655 - *  Description:
29656 - *      Implements upper edge functions for WMD message module.
29657 - *
29658 - *  Public Functions:
29659 - *      WMD_MSG_Create
29660 - *      WMD_MSG_CreateQueue
29661 - *      WMD_MSG_Delete
29662 - *      WMD_MSG_DeleteQueue
29663 - *      WMD_MSG_Get
29664 - *      WMD_MSG_Put
29665 - *      WMD_MSG_RegisterNotify
29666 - *      WMD_MSG_SetQueueId
29667 - *
29668 - *! Revision History:
29669 - *! =================
29670 - *! 24-Jul-2002 jeh     Release critical section in WMD_MSG_Put() before
29671 - *!                     scheduling DPC.
29672 - *! 09-May-2001 jeh     Free MSG queue NTFY object, remove unnecessary set/
29673 - *!                     reset of events.
29674 - *! 10-Jan-2001 jeh     Set/Reset message manager and message queue events
29675 - *!                     correctly.
29676 - *! 04-Dec-2000 jeh     Bug fixes.
29677 - *! 12-Sep-2000 jeh     Created.
29678 - */
29679 -
29680  /*  ----------------------------------- DSP/BIOS Bridge */
29681  #include <dspbridge/std.h>
29682  #include <dspbridge/dbdefs.h>
29683 @@ -86,11 +60,15 @@ DSP_STATUS WMD_MSG_Create(OUT struct MSG
29684         struct IO_MGR *hIOMgr;
29685         DSP_STATUS status = DSP_SOK;
29686  
29687 -       DBC_Require(phMsgMgr != NULL);
29688 -       DBC_Require(msgCallback != NULL);
29689 -       DBC_Require(hDevObject != NULL);
29690 +       if (!phMsgMgr || !msgCallback || !hDevObject) {
29691 +               status = DSP_EPOINTER;
29692 +               goto func_end;
29693 +       }
29694         DEV_GetIOMgr(hDevObject, &hIOMgr);
29695 -       DBC_Assert(hIOMgr != NULL);
29696 +       if (!hIOMgr) {
29697 +               status = DSP_EPOINTER;
29698 +               goto func_end;
29699 +       }
29700         *phMsgMgr = NULL;
29701         /* Allocate MSG manager object */
29702         MEM_AllocObject(pMsgMgr, struct MSG_MGR, MSGMGR_SIGNATURE);
29703 @@ -99,18 +77,25 @@ DSP_STATUS WMD_MSG_Create(OUT struct MSG
29704                 pMsgMgr->onExit = msgCallback;
29705                 pMsgMgr->hIOMgr = hIOMgr;
29706                 /* List of MSG_QUEUEs */
29707 -               pMsgMgr->queueList = LST_Create();
29708 +               pMsgMgr->queueList = MEM_Calloc(sizeof(struct LST_LIST),
29709 +                       MEM_NONPAGED);
29710                  /*  Queues of message frames for messages to the DSP. Message
29711                   * frames will only be added to the free queue when a
29712                   * MSG_QUEUE object is created.  */
29713 -               pMsgMgr->msgFreeList = LST_Create();
29714 -               pMsgMgr->msgUsedList = LST_Create();
29715 +               pMsgMgr->msgFreeList = MEM_Calloc(sizeof(struct LST_LIST),
29716 +                                       MEM_NONPAGED);
29717 +               pMsgMgr->msgUsedList = MEM_Calloc(sizeof(struct LST_LIST),
29718 +                                       MEM_NONPAGED);
29719                 if (pMsgMgr->queueList == NULL ||
29720                     pMsgMgr->msgFreeList == NULL ||
29721 -                   pMsgMgr->msgUsedList == NULL)
29722 +                   pMsgMgr->msgUsedList == NULL) {
29723                         status = DSP_EMEMORY;
29724 -               if (DSP_SUCCEEDED(status))
29725 +               } else {
29726 +                       INIT_LIST_HEAD(&pMsgMgr->queueList->head);
29727 +                       INIT_LIST_HEAD(&pMsgMgr->msgFreeList->head);
29728 +                       INIT_LIST_HEAD(&pMsgMgr->msgUsedList->head);
29729                         status = SYNC_InitializeDPCCS(&pMsgMgr->hSyncCS);
29730 +               }
29731  
29732                  /*  Create an event to be used by WMD_MSG_Put() in waiting
29733                  *  for an available free frame from the message manager.  */
29734 @@ -125,6 +110,7 @@ DSP_STATUS WMD_MSG_Create(OUT struct MSG
29735         } else {
29736                 status = DSP_EMEMORY;
29737         }
29738 +func_end:
29739         return status;
29740  }
29741  
29742 @@ -142,8 +128,11 @@ DSP_STATUS WMD_MSG_CreateQueue(struct MS
29743         struct MSG_QUEUE *pMsgQ;
29744         DSP_STATUS status = DSP_SOK;
29745  
29746 -       DBC_Require(MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE));
29747 -       DBC_Require(phMsgQueue != NULL);
29748 +       if (!MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE) ||
29749 +          phMsgQueue == NULL || !hMsgMgr->msgFreeList) {
29750 +               status = DSP_EHANDLE;
29751 +               goto func_end;
29752 +       }
29753  
29754         *phMsgQueue = NULL;
29755         /* Allocate MSG_QUEUE object */
29756 @@ -152,16 +141,20 @@ DSP_STATUS WMD_MSG_CreateQueue(struct MS
29757                 status = DSP_EMEMORY;
29758                 goto func_end;
29759         }
29760 -       LST_InitElem((struct LST_ELEM *) pMsgQ);
29761 +       LST_InitElem((struct list_head *)pMsgQ);
29762         pMsgQ->uMaxMsgs = uMaxMsgs;
29763         pMsgQ->hMsgMgr = hMsgMgr;
29764         pMsgQ->hArg = hArg;     /* Node handle */
29765         pMsgQ->dwId = dwId;     /* Node env (not valid yet) */
29766         /* Queues of Message frames for messages from the DSP */
29767 -       pMsgQ->msgFreeList = LST_Create();
29768 -       pMsgQ->msgUsedList = LST_Create();
29769 +       pMsgQ->msgFreeList = MEM_Calloc(sizeof(struct LST_LIST), MEM_NONPAGED);
29770 +       pMsgQ->msgUsedList = MEM_Calloc(sizeof(struct LST_LIST), MEM_NONPAGED);
29771         if (pMsgQ->msgFreeList == NULL || pMsgQ->msgUsedList == NULL)
29772                 status = DSP_EMEMORY;
29773 +       else {
29774 +               INIT_LIST_HEAD(&pMsgQ->msgFreeList->head);
29775 +               INIT_LIST_HEAD(&pMsgQ->msgUsedList->head);
29776 +       }
29777  
29778          /*  Create event that will be signalled when a message from
29779          *  the DSP is available.  */
29780 @@ -184,10 +177,6 @@ DSP_STATUS WMD_MSG_CreateQueue(struct MS
29781                 status = SYNC_OpenEvent(&pMsgQ->hSyncDoneAck, NULL);
29782  
29783         if (DSP_SUCCEEDED(status)) {
29784 -               if (!hMsgMgr->msgFreeList) {
29785 -                       status = DSP_EHANDLE;
29786 -                       goto func_end;
29787 -               }
29788                 /* Enter critical section */
29789                 (void)SYNC_EnterCS(hMsgMgr->hSyncCS);
29790                 /* Initialize message frames and put in appropriate queues */
29791 @@ -204,7 +193,7 @@ DSP_STATUS WMD_MSG_CreateQueue(struct MS
29792                         DeleteMsgQueue(pMsgQ, uNumAllocated);
29793                 } else {
29794                         LST_PutTail(hMsgMgr->queueList,
29795 -                                  (struct LST_ELEM *)pMsgQ);
29796 +                                  (struct list_head *)pMsgQ);
29797                         *phMsgQueue = pMsgQ;
29798                         /* Signal that free frames are now available */
29799                         if (!LST_IsEmpty(hMsgMgr->msgFreeList))
29800 @@ -226,9 +215,8 @@ func_end:
29801   */
29802  void WMD_MSG_Delete(struct MSG_MGR *hMsgMgr)
29803  {
29804 -       DBC_Require(MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE));
29805 -
29806 -       DeleteMsgMgr(hMsgMgr);
29807 +       if (MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE))
29808 +               DeleteMsgMgr(hMsgMgr);
29809  }
29810  
29811  /*
29812 @@ -237,10 +225,14 @@ void WMD_MSG_Delete(struct MSG_MGR *hMsg
29813   */
29814  void WMD_MSG_DeleteQueue(struct MSG_QUEUE *hMsgQueue)
29815  {
29816 -       struct MSG_MGR *hMsgMgr = hMsgQueue->hMsgMgr;
29817 +       struct MSG_MGR *hMsgMgr;
29818         u32 refCount;
29819  
29820 -       DBC_Require(MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE));
29821 +       if (!MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE) ||
29822 +                       !hMsgQueue->hMsgMgr)
29823 +               goto func_end;
29824 +
29825 +       hMsgMgr = hMsgQueue->hMsgMgr;
29826         hMsgQueue->fDone = true;
29827          /*  Unblock all threads blocked in MSG_Get() or MSG_Put().  */
29828         refCount = hMsgQueue->refCount;
29829 @@ -253,15 +245,17 @@ void WMD_MSG_DeleteQueue(struct MSG_QUEU
29830         }
29831         /* Remove message queue from hMsgMgr->queueList */
29832         (void)SYNC_EnterCS(hMsgMgr->hSyncCS);
29833 -       LST_RemoveElem(hMsgMgr->queueList, (struct LST_ELEM *)hMsgQueue);
29834 +       LST_RemoveElem(hMsgMgr->queueList, (struct list_head *)hMsgQueue);
29835         /* Free the message queue object */
29836         DeleteMsgQueue(hMsgQueue, hMsgQueue->uMaxMsgs);
29837 -       if (!hMsgMgr->msgFreeList)
29838 -               goto func_cont;
29839 +       if (!hMsgMgr->msgFreeList)
29840 +               goto func_cont;
29841         if (LST_IsEmpty(hMsgMgr->msgFreeList))
29842                 SYNC_ResetEvent(hMsgMgr->hSyncEvent);
29843  func_cont:
29844         (void)SYNC_LeaveCS(hMsgMgr->hSyncCS);
29845 +func_end:
29846 +       return;
29847  }
29848  
29849  /*
29850 @@ -278,14 +272,16 @@ DSP_STATUS WMD_MSG_Get(struct MSG_QUEUE 
29851         u32 uIndex;
29852         DSP_STATUS status = DSP_SOK;
29853  
29854 -       DBC_Require(MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE));
29855 -       DBC_Require(pMsg != NULL);
29856 +       if (!MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE) || pMsg == NULL) {
29857 +               status = DSP_EMEMORY;
29858 +               goto func_end;
29859 +       }
29860  
29861         hMsgMgr = hMsgQueue->hMsgMgr;
29862 -       if (!hMsgQueue->msgUsedList) {
29863 -               status = DSP_EHANDLE;
29864 -               goto func_end;
29865 -       }
29866 +       if (!hMsgQueue->msgUsedList) {
29867 +               status = DSP_EHANDLE;
29868 +               goto func_end;
29869 +       }
29870  
29871         /* Enter critical section */
29872         (void)SYNC_EnterCS(hMsgMgr->hSyncCS);
29873 @@ -296,9 +292,14 @@ DSP_STATUS WMD_MSG_Get(struct MSG_QUEUE 
29874                 if (pMsgFrame != NULL) {
29875                         *pMsg = pMsgFrame->msgData.msg;
29876                         LST_PutTail(hMsgQueue->msgFreeList,
29877 -                                  (struct LST_ELEM *)pMsgFrame);
29878 +                                  (struct list_head *)pMsgFrame);
29879                         if (LST_IsEmpty(hMsgQueue->msgUsedList))
29880                                 SYNC_ResetEvent(hMsgQueue->hSyncEvent);
29881 +                       else {
29882 +                               NTFY_Notify(hMsgQueue->hNtfy,
29883 +                                       DSP_NODEMESSAGEREADY);
29884 +                               SYNC_SetEvent(hMsgQueue->hSyncEvent);
29885 +                       }
29886  
29887                         fGotMsg = true;
29888                 }
29889 @@ -341,14 +342,16 @@ DSP_STATUS WMD_MSG_Get(struct MSG_QUEUE 
29890                                 if (pMsgFrame != NULL) {
29891                                         *pMsg = pMsgFrame->msgData.msg;
29892                                         LST_PutTail(hMsgQueue->msgFreeList,
29893 -                                       (struct LST_ELEM *)pMsgFrame);
29894 +                                       (struct list_head *)pMsgFrame);
29895                                 }
29896                         }
29897                         hMsgQueue->refCount--;
29898                         /* Reset the event if there are still queued messages */
29899 -                       if (!LST_IsEmpty(hMsgQueue->msgUsedList))
29900 +                       if (!LST_IsEmpty(hMsgQueue->msgUsedList)) {
29901 +                               NTFY_Notify(hMsgQueue->hNtfy,
29902 +                                       DSP_NODEMESSAGEREADY);
29903                                 SYNC_SetEvent(hMsgQueue->hSyncEvent);
29904 -
29905 +                       }
29906                         /* Exit critical section */
29907                         (void)SYNC_LeaveCS(hMsgMgr->hSyncCS);
29908                 }
29909 @@ -371,16 +374,16 @@ DSP_STATUS WMD_MSG_Put(struct MSG_QUEUE 
29910         u32 uIndex;
29911         DSP_STATUS status = DSP_SOK;
29912  
29913 -       DBC_Require(MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE));
29914 -       DBC_Require(pMsg != NULL);
29915 -
29916 +       if (!MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE) || !pMsg ||
29917 +                                               !hMsgQueue->hMsgMgr) {
29918 +               status = DSP_EMEMORY;
29919 +               goto func_end;
29920 +       }
29921         hMsgMgr = hMsgQueue->hMsgMgr;
29922 -
29923 -       if (!hMsgMgr->msgFreeList) {
29924 -               status = DSP_EHANDLE;
29925 -               goto func_end;
29926 -       }
29927 -
29928 +       if (!hMsgMgr->msgFreeList) {
29929 +               status = DSP_EHANDLE;
29930 +               goto func_end;
29931 +       }
29932  
29933         (void) SYNC_EnterCS(hMsgMgr->hSyncCS);
29934  
29935 @@ -391,8 +394,8 @@ DSP_STATUS WMD_MSG_Put(struct MSG_QUEUE 
29936                 if (pMsgFrame != NULL) {
29937                         pMsgFrame->msgData.msg = *pMsg;
29938                         pMsgFrame->msgData.dwId = hMsgQueue->dwId;
29939 -                       LST_PutTail(hMsgMgr->msgUsedList, (struct LST_ELEM *)
29940 -                                  pMsgFrame);
29941 +                       LST_PutTail(hMsgMgr->msgUsedList,
29942 +                                       (struct list_head *)pMsgFrame);
29943                         hMsgMgr->uMsgsPending++;
29944                         fPutMsg = true;
29945                 }
29946 @@ -418,6 +421,8 @@ DSP_STATUS WMD_MSG_Put(struct MSG_QUEUE 
29947                 hSyncs[1] = hMsgQueue->hSyncDone;
29948                 status = SYNC_WaitOnMultipleEvents(hSyncs, 2, uTimeout,
29949                          &uIndex);
29950 +               if (DSP_FAILED(status))
29951 +                       goto func_end;
29952                 /* Enter critical section */
29953                 (void)SYNC_EnterCS(hMsgMgr->hSyncCS);
29954                 if (hMsgQueue->fDone) {
29955 @@ -429,29 +434,28 @@ DSP_STATUS WMD_MSG_Put(struct MSG_QUEUE 
29956                         (void)SYNC_SetEvent(hMsgQueue->hSyncDoneAck);
29957                         status = DSP_EFAIL;
29958                 } else {
29959 -                       if (DSP_SUCCEEDED(status)) {
29960 -                               if (LST_IsEmpty(hMsgMgr->msgFreeList)) {
29961 -                                       status = DSP_EPOINTER;
29962 -                                       goto func_cont;
29963 -                               }
29964 -                               /* Get msg from free list */
29965 -                               pMsgFrame = (struct MSG_FRAME *)
29966 +                       if (LST_IsEmpty(hMsgMgr->msgFreeList)) {
29967 +                               status = DSP_EPOINTER;
29968 +                               goto func_cont;
29969 +                       }
29970 +                       /* Get msg from free list */
29971 +                       pMsgFrame = (struct MSG_FRAME *)
29972                                             LST_GetHead(hMsgMgr->msgFreeList);
29973 -                               /* Copy message into pMsg and put frame on the
29974 -                                * used list */
29975 -                               if (pMsgFrame != NULL) {
29976 -                                       pMsgFrame->msgData.msg = *pMsg;
29977 -                                       pMsgFrame->msgData.dwId =
29978 -                                               hMsgQueue->dwId;
29979 -                                       LST_PutTail(hMsgMgr->msgUsedList,
29980 -                                                  (struct LST_ELEM *)
29981 -                                                  pMsgFrame);
29982 -                                       hMsgMgr->uMsgsPending++;
29983 -                                       /* Schedule a DPC, to do the actual
29984 -                                        * data transfer: */
29985 -                                       IO_Schedule(hMsgMgr->hIOMgr);
29986 -                               }
29987 +                       /*
29988 +                        * Copy message into pMsg and put frame on the
29989 +                        * used list
29990 +                        */
29991 +                       if (pMsgFrame) {
29992 +                               pMsgFrame->msgData.msg = *pMsg;
29993 +                               pMsgFrame->msgData.dwId = hMsgQueue->dwId;
29994 +                               LST_PutTail(hMsgMgr->msgUsedList,
29995 +                                          (struct list_head *)pMsgFrame);
29996 +                               hMsgMgr->uMsgsPending++;
29997 +                               /* Schedule a DPC, to do the actual
29998 +                                * data transfer: */
29999 +                               IO_Schedule(hMsgMgr->hIOMgr);
30000                         }
30001 +
30002                         hMsgQueue->refCount--;
30003                         /* Reset event if there are still frames available */
30004                         if (!LST_IsEmpty(hMsgMgr->msgFreeList))
30005 @@ -474,10 +478,20 @@ DSP_STATUS WMD_MSG_RegisterNotify(struct
30006  {
30007         DSP_STATUS status = DSP_SOK;
30008  
30009 -       DBC_Require(MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE));
30010 -       DBC_Require(hNotification != NULL);
30011 -       DBC_Require(uEventMask == DSP_NODEMESSAGEREADY || uEventMask == 0);
30012 -       DBC_Require(uNotifyType == DSP_SIGNALEVENT);
30013 +       if (!MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE) || !hNotification) {
30014 +               status = DSP_EMEMORY;
30015 +               goto func_end;
30016 +       }
30017 +
30018 +       if (!(uEventMask == DSP_NODEMESSAGEREADY || uEventMask == 0)) {
30019 +               status = DSP_ENODETYPE;
30020 +               goto func_end;
30021 +       }
30022 +
30023 +       if (uNotifyType != DSP_SIGNALEVENT) {
30024 +               status = DSP_EWRONGSTATE;
30025 +               goto func_end;
30026 +       }
30027  
30028         status = NTFY_Register(hMsgQueue->hNtfy, hNotification, uEventMask,
30029                               uNotifyType);
30030 @@ -488,7 +502,7 @@ DSP_STATUS WMD_MSG_RegisterNotify(struct
30031                  *  by NODE, and message ready handled by MSG.  */
30032                 status = DSP_SOK;
30033         }
30034 -
30035 +func_end:
30036         return status;
30037  }
30038  
30039 @@ -497,9 +511,6 @@ DSP_STATUS WMD_MSG_RegisterNotify(struct
30040   */
30041  void WMD_MSG_SetQueueId(struct MSG_QUEUE *hMsgQueue, u32 dwId)
30042  {
30043 -       DBC_Require(MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE));
30044 -       /* DBC_Require(dwId != 0); */
30045 -
30046         /*
30047          *  A message queue must be created when a node is allocated,
30048          *  so that NODE_RegisterNotify() can be called before the node
30049 @@ -507,7 +518,8 @@ void WMD_MSG_SetQueueId(struct MSG_QUEUE
30050          *  node is created, we need this function to set hMsgQueue->dwId
30051          *  to the node environment, after the node is created.
30052          */
30053 -       hMsgQueue->dwId = dwId;
30054 +       if (MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE))
30055 +               hMsgQueue->dwId = dwId;
30056  }
30057  
30058  /*
30059 @@ -522,8 +534,8 @@ static DSP_STATUS AddNewMsg(struct LST_L
30060         pMsg = (struct MSG_FRAME *)MEM_Calloc(sizeof(struct MSG_FRAME),
30061                 MEM_PAGED);
30062         if (pMsg != NULL) {
30063 -               LST_InitElem((struct LST_ELEM *) pMsg);
30064 -               LST_PutTail(msgList, (struct LST_ELEM *) pMsg);
30065 +               LST_InitElem((struct list_head *)pMsg);
30066 +               LST_PutTail(msgList, (struct list_head *)pMsg);
30067         } else {
30068                 status = DSP_EMEMORY;
30069         }
30070 @@ -536,24 +548,25 @@ static DSP_STATUS AddNewMsg(struct LST_L
30071   */
30072  static void DeleteMsgMgr(struct MSG_MGR *hMsgMgr)
30073  {
30074 -       DBC_Require(MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE));
30075 +       if (!MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE))
30076 +               goto func_end;
30077  
30078         if (hMsgMgr->queueList) {
30079 -               if (LST_IsEmpty(hMsgMgr->queueList)) {
30080 -                       LST_Delete(hMsgMgr->queueList);
30081 -                       hMsgMgr->queueList = NULL;
30082 -               }
30083 +               if (LST_IsEmpty(hMsgMgr->queueList)) {
30084 +                       MEM_Free(hMsgMgr->queueList);
30085 +                       hMsgMgr->queueList = NULL;
30086 +               }
30087         }
30088  
30089 -       if (hMsgMgr->msgFreeList) {
30090 +       if (hMsgMgr->msgFreeList) {
30091                 FreeMsgList(hMsgMgr->msgFreeList);
30092 -               hMsgMgr->msgFreeList = NULL;
30093 -       }
30094 +               hMsgMgr->msgFreeList = NULL;
30095 +       }
30096  
30097 -       if (hMsgMgr->msgUsedList) {
30098 +       if (hMsgMgr->msgUsedList) {
30099                 FreeMsgList(hMsgMgr->msgUsedList);
30100 -               hMsgMgr->msgUsedList = NULL;
30101 -       }
30102 +               hMsgMgr->msgUsedList = NULL;
30103 +       }
30104  
30105         if (hMsgMgr->hSyncEvent)
30106                 SYNC_CloseEvent(hMsgMgr->hSyncEvent);
30107 @@ -562,6 +575,8 @@ static void DeleteMsgMgr(struct MSG_MGR 
30108                 SYNC_DeleteCS(hMsgMgr->hSyncCS);
30109  
30110         MEM_FreeObject(hMsgMgr);
30111 +func_end:
30112 +       return;
30113  }
30114  
30115  /*
30116 @@ -573,11 +588,11 @@ static void DeleteMsgQueue(struct MSG_QU
30117         struct MSG_FRAME *pMsg;
30118         u32 i;
30119  
30120 -       if (!MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE)
30121 -               || !hMsgQueue->hMsgMgr || !hMsgQueue->hMsgMgr->msgFreeList)
30122 -               goto func_end;
30123 -       hMsgMgr = hMsgQueue->hMsgMgr;
30124 +       if (!MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE) ||
30125 +           !hMsgQueue->hMsgMgr || !hMsgQueue->hMsgMgr->msgFreeList)
30126 +               goto func_end;
30127  
30128 +       hMsgMgr = hMsgQueue->hMsgMgr;
30129  
30130         /* Pull off uNumToDSP message frames from Msg manager and free */
30131         for (i = 0; i < uNumToDSP; i++) {
30132 @@ -594,12 +609,12 @@ static void DeleteMsgQueue(struct MSG_QU
30133  
30134         if (hMsgQueue->msgFreeList) {
30135                 FreeMsgList(hMsgQueue->msgFreeList);
30136 -               hMsgQueue->msgFreeList = NULL;
30137 +               hMsgQueue->msgFreeList = NULL;
30138         }
30139  
30140         if (hMsgQueue->msgUsedList) {
30141                 FreeMsgList(hMsgQueue->msgUsedList);
30142 -               hMsgQueue->msgUsedList = NULL;
30143 +               hMsgQueue->msgUsedList = NULL;
30144         }
30145  
30146  
30147 @@ -628,16 +643,16 @@ static void FreeMsgList(struct LST_LIST 
30148  {
30149         struct MSG_FRAME *pMsg;
30150  
30151 -       if (!msgList)
30152 -               goto func_end;
30153 +       if (!msgList)
30154 +               goto func_end;
30155  
30156         while ((pMsg = (struct MSG_FRAME *)LST_GetHead(msgList)) != NULL)
30157                 MEM_Free(pMsg);
30158  
30159         DBC_Assert(LST_IsEmpty(msgList));
30160  
30161 -       LST_Delete(msgList);
30162 +       MEM_Free(msgList);
30163  func_end:
30164 -       return;
30165 +       return;
30166  }
30167  
30168 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/tiomap3430.c kernel-power-2.6.28/drivers/dsp/bridge/wmd/tiomap3430.c
30169 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/tiomap3430.c        2011-04-17 17:32:26.000000000 +0100
30170 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/tiomap3430.c     2011-05-02 22:36:51.000000000 +0100
30171 @@ -3,6 +3,8 @@
30172   *
30173   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
30174   *
30175 + * Processor Manager Driver for TI OMAP3430 EVM.
30176 + *
30177   * Copyright (C) 2005-2006 Texas Instruments, Inc.
30178   *
30179   * This package is free software; you can redistribute it and/or modify
30180 @@ -14,18 +16,6 @@
30181   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30182   */
30183  
30184 -/*
30185 - *  ======== tiomap.c ========
30186 - *  Processor Manager Driver for TI OMAP3430 EVM.
30187 - *
30188 - *  Public Function:
30189 - *      WMD_DRV_Entry
30190 - *
30191 - *! Revision History:
30192 - *! ================
30193 - *   26-March-2008 HK and AL:  Added WMD_DEV_WalkTbl funciton.
30194 - */
30195 -
30196  /*  ----------------------------------- Host OS */
30197  #include <dspbridge/host_os.h>
30198  #include <linux/mm.h>
30199 @@ -34,7 +24,7 @@
30200  #include <mach-omap2/cm.h>
30201  #include <mach-omap2/prm-regbits-34xx.h>
30202  #include <mach-omap2/cm-regbits-34xx.h>
30203 -#include <mach/control.h>
30204 +#include <mach/control.h>
30205  
30206  /*  ----------------------------------- DSP/BIOS Bridge */
30207  #include <dspbridge/std.h>
30208 @@ -47,12 +37,9 @@
30209  
30210  /*  ----------------------------------- OS Adaptation Layer */
30211  #include <dspbridge/mem.h>
30212 -#include <dspbridge/util.h>
30213  #include <dspbridge/reg.h>
30214 -#include <dspbridge/dbreg.h>
30215  #include <dspbridge/cfg.h>
30216  #include <dspbridge/drv.h>
30217 -#include <dspbridge/csl.h>
30218  #include <dspbridge/sync.h>
30219  
30220  /* ------------------------------------ Hardware Abstraction Layer */
30221 @@ -95,12 +82,9 @@
30222  #define MMU_LARGE_PAGE_MASK      0xFFFF0000
30223  #define MMU_SMALL_PAGE_MASK      0xFFFFF000
30224  #define PAGES_II_LVL_TABLE   512
30225 -#define phys_to_page(phys)      pfn_to_page((phys) >> PAGE_SHIFT)
30226  
30227  #define MMU_GFLUSH 0x60
30228  
30229 -extern unsigned short min_active_opp;
30230 -
30231  /* Forward Declarations: */
30232  static DSP_STATUS WMD_BRD_Monitor(struct WMD_DEV_CONTEXT *pDevContext);
30233  static DSP_STATUS WMD_BRD_Read(struct WMD_DEV_CONTEXT *pDevContext,
30234 @@ -109,7 +93,7 @@ static DSP_STATUS WMD_BRD_Read(struct WM
30235  static DSP_STATUS WMD_BRD_Start(struct WMD_DEV_CONTEXT *pDevContext,
30236                         u32 dwDSPAddr);
30237  static DSP_STATUS WMD_BRD_Status(struct WMD_DEV_CONTEXT *pDevContext,
30238 -                       OUT BRD_STATUS *pdwState);
30239 +                       int *pdwState);
30240  static DSP_STATUS WMD_BRD_Stop(struct WMD_DEV_CONTEXT *pDevContext);
30241  static DSP_STATUS WMD_BRD_Write(struct WMD_DEV_CONTEXT *pDevContext,
30242                         IN u8 *pbHostBuf,
30243 @@ -281,7 +265,7 @@ static inline void tlb_flush_all(const v
30244  static inline void flush_all(struct WMD_DEV_CONTEXT *pDevContext)
30245  {
30246         if (pDevContext->dwBrdState == BRD_DSP_HIBERNATION ||
30247 -                       pDevContext->dwBrdState == BRD_HIBERNATION)
30248 +                               pDevContext->dwBrdState == BRD_HIBERNATION)
30249                 WakeDSP(pDevContext, NULL);
30250  
30251         tlb_flush_all(pDevContext->dwDSPMmuBase);
30252 @@ -296,7 +280,7 @@ static void bad_page_dump(u32 pa, struct
30253                 current->comm, pg, (int)(2*sizeof(unsigned long)),
30254                 (unsigned long)pg->flags, pg->mapping,
30255                 page_mapcount(pg), page_count(pg));
30256 -       BUG();
30257 +       dump_stack();
30258  }
30259  
30260  /*
30261 @@ -579,12 +563,11 @@ static DSP_STATUS WMD_BRD_Start(struct W
30262  
30263                 /* Enable the BIOS clock  */
30264                 (void)DEV_GetSymbol(pDevContext->hDevObject,
30265 -                                       BRIDGEINIT_BIOSGPTIMER,
30266 -                                    &ulBiosGpTimer);
30267 +                               BRIDGEINIT_BIOSGPTIMER, &ulBiosGpTimer);
30268                 DBG_Trace(DBG_LEVEL7, "BIOS GPTimer : 0x%x\n", ulBiosGpTimer);
30269                 (void)DEV_GetSymbol(pDevContext->hDevObject,
30270                                 BRIDGEINIT_LOADMON_GPTIMER,
30271 -                                    &ulLoadMonitorTimer);
30272 +                               &ulLoadMonitorTimer);
30273                 DBG_Trace(DBG_LEVEL7, "Load Monitor Timer : 0x%x\n",
30274                           ulLoadMonitorTimer);
30275         }
30276 @@ -600,20 +583,18 @@ static DSP_STATUS WMD_BRD_Start(struct W
30277  
30278                         extClkId = uClkCmd & MBX_PM_CLK_IDMASK;
30279                         for (tmpIndex = 0; tmpIndex < MBX_PM_MAX_RESOURCES;
30280 -                                      tmpIndex++) {
30281 +                            tmpIndex++) {
30282                                 if (extClkId == BPWR_CLKID[tmpIndex]) {
30283                                         clkIdIndex = tmpIndex;
30284                                         break;
30285                                 }
30286                         }
30287  
30288 -                       if (clkIdIndex < MBX_PM_MAX_RESOURCES)
30289 -                               status = CLK_Set_32KHz(
30290 -                                               BPWR_Clks[clkIdIndex].funClk);
30291 -                       else
30292 +                       if (clkIdIndex < MBX_PM_MAX_RESOURCES) {
30293 +                               status =
30294 +                                   CLK_Set_32KHz(BPWR_Clks[clkIdIndex].funClk);
30295 +                       } else {
30296                                 status = DSP_EFAIL;
30297 -
30298 -                       if (DSP_FAILED(status)) {
30299                                 DBG_Trace(DBG_LEVEL7, " Error while setting"
30300                                                         "LM Timer  to 32KHz\n");
30301                         }
30302 @@ -649,13 +630,11 @@ static DSP_STATUS WMD_BRD_Start(struct W
30303                                 }
30304                         }
30305  
30306 -                       if (clkIdIndex < MBX_PM_MAX_RESOURCES)
30307 +                       if (clkIdIndex < MBX_PM_MAX_RESOURCES) {
30308                                 status = CLK_Set_32KHz(
30309                                                 BPWR_Clks[clkIdIndex].funClk);
30310 -                       else
30311 +                       } else {
30312                                 status = DSP_EFAIL;
30313 -
30314 -                       if (DSP_FAILED(status)) {
30315                                 DBG_Trace(DBG_LEVEL7,
30316                                 " Error while setting BIOS Timer  to 32KHz\n");
30317                         }
30318 @@ -724,9 +703,7 @@ static DSP_STATUS WMD_BRD_Start(struct W
30319                 /* Enable Mailbox events and also drain any pending
30320                  * stale messages */
30321                 (void)CHNLSM_EnableInterrupt(pDevContext);
30322 -       }
30323  
30324 -       if (DSP_SUCCEEDED(status)) {
30325                 HW_RSTCTRL_RegGet(resources.dwPrmBase, HW_RST1_IVA2, &temp);
30326                 DBG_Trace(DBG_LEVEL7, "BRD_Start: RM_RSTCTRL_DSP = 0x%x \n",
30327                                 temp);
30328 @@ -754,10 +731,8 @@ static DSP_STATUS WMD_BRD_Start(struct W
30329                                 dwDSPAddr);
30330                 if (dsp_debug)
30331                         while (*((volatile u16 *)dwSyncAddr))
30332 -                               ;;
30333 -       }
30334 +                               ;
30335  
30336 -       if (DSP_SUCCEEDED(status)) {
30337                 /* Wait for DSP to clear word in shared memory */
30338                 /* Read the Location */
30339                 if (!WaitForStart(pDevContext, dwSyncAddr)) {
30340 @@ -774,8 +749,7 @@ static DSP_STATUS WMD_BRD_Start(struct W
30341                          * completion of OPP table update to DSP
30342                          */
30343                         *((volatile u32 *)dwSyncAddr) = 0XCAFECAFE;
30344 -               }
30345 -               if (DSP_SUCCEEDED(status)) {
30346 +
30347                         /* update board state */
30348                         pDevContext->dwBrdState = BRD_RUNNING;
30349                         /* (void)CHNLSM_EnableInterrupt(pDevContext);*/
30350 @@ -874,6 +848,7 @@ static DSP_STATUS WMD_BRD_Stop(struct WM
30351         DBG_Trace(DBG_LEVEL6, "WMD_BRD_Stop - End ****** \n");
30352         HW_RST_Reset(resources.dwPrmBase, HW_RST1_IVA2);
30353         HW_RST_Reset(resources.dwPrmBase, HW_RST2_IVA2);
30354 +       HW_RST_Reset(resources.dwPrmBase, HW_RST3_IVA2);
30355  
30356         return status;
30357  }
30358 @@ -940,6 +915,7 @@ static DSP_STATUS WMD_BRD_Delete(struct 
30359         DBG_Trace(DBG_LEVEL6, "WMD_BRD_Delete - End ****** \n");
30360         HW_RST_Reset(resources.dwPrmBase, HW_RST1_IVA2);
30361         HW_RST_Reset(resources.dwPrmBase, HW_RST2_IVA2);
30362 +       HW_RST_Reset(resources.dwPrmBase, HW_RST3_IVA2);
30363  
30364         return status;
30365  }
30366 @@ -950,7 +926,7 @@ static DSP_STATUS WMD_BRD_Delete(struct 
30367   *      Returns the board status.
30368   */
30369  static DSP_STATUS WMD_BRD_Status(struct WMD_DEV_CONTEXT *hDevContext,
30370 -                                OUT BRD_STATUS *pdwState)
30371 +                                int *pdwState)
30372  {
30373         struct WMD_DEV_CONTEXT *pDevContext = hDevContext;
30374         *pdwState = pDevContext->dwBrdState;
30375 @@ -1132,8 +1108,8 @@ static DSP_STATUS WMD_DEV_Create(OUT str
30376         if (DSP_SUCCEEDED(status)) {
30377                 /* Set the Endianism Register */ /* Need to set this */
30378                 /* Retrieve the TC u16 SWAP Option */
30379 -               status = REG_GetValue(NULL, CURRENTCONFIG, TCWORDSWAP,
30380 -                                    (u8 *)&tcWordSwap, &tcWordSwapSize);
30381 +               status = REG_GetValue(TCWORDSWAP, (u8 *)&tcWordSwap,
30382 +                                     &tcWordSwapSize);
30383                 /* Save the value */
30384                 pDevContext->tcWordSwapOn = tcWordSwap;
30385         }
30386 @@ -1266,11 +1242,16 @@ static DSP_STATUS WMD_DEV_Destroy(struct
30387         DSP_STATUS status = DSP_SOK;
30388         struct WMD_DEV_CONTEXT *pDevContext = (struct WMD_DEV_CONTEXT *)
30389                                                 hDevContext;
30390 +
30391 +       /* It should never happen */
30392 +       if (!hDevContext)
30393 +               return DSP_EHANDLE;
30394 +
30395         DBG_Trace(DBG_ENTER, "Entering WMD_DEV_Destroy:n hDevContext ::0x%x\n",
30396                   hDevContext);
30397         /* first put the device to stop state */
30398         WMD_BRD_Delete(pDevContext);
30399 -       if (pDevContext && pDevContext->pPtAttrs) {
30400 +       if (pDevContext->pPtAttrs) {
30401                 pPtAttrs = pDevContext->pPtAttrs;
30402                 if (pPtAttrs->hCSObj)
30403                         SYNC_DeleteCS(pPtAttrs->hCSObj);
30404 @@ -1379,8 +1360,14 @@ static DSP_STATUS WMD_BRD_MemMap(struct 
30405         struct HW_MMUMapAttrs_t hwAttrs;
30406         struct vm_area_struct *vma;
30407         struct mm_struct *mm = current->mm;
30408 -       u32 numUsrPgs = 0, nr_pages = 0;
30409 +       u32 write = 0;
30410 +       u32 numUsrPgs = 0;
30411 +       struct page *mappedPage, *pg;
30412 +       s32 pgNum;
30413         u32 va = ulVirtAddr;
30414 +       struct task_struct *curr_task = current;
30415 +       u32 pgI = 0;
30416 +       u32 mpuAddr, pa;
30417  
30418         DBG_Trace(DBG_ENTER, "> WMD_BRD_MemMap hDevContext %x, pa %x, va %x, "
30419                  "size %x, ulMapAttr %x\n", hDevContext, ulMpuAddr, ulVirtAddr,
30420 @@ -1480,81 +1467,80 @@ static DSP_STATUS WMD_BRD_MemMap(struct 
30421                 goto func_cont;
30422         }
30423  
30424 -       numUsrPgs =  PAGE_ALIGN(ulNumBytes) / PG_SIZE_4K;
30425 -
30426 -       DBG_Trace(DBG_LEVEL4, "%s :numOfActualTabEntries=%d, ulNumBytes= %d\n",
30427 -                 %s, numUsrPgs, ulNumBytes);
30428 -
30429 -       if (vma->vm_flags & (VM_IO | VM_PFNMAP | VM_RESERVED)) {
30430 -               for (nr_pages = numUsrPgs; nr_pages > 0;) {
30431 -                       u32 pa;
30432 -
30433 -                       pa = user_va2pa(mm, ulMpuAddr);
30434 +       if (vma->vm_flags & VM_IO) {
30435 +               numUsrPgs =  ulNumBytes / PG_SIZE_4K;
30436 +               mpuAddr = ulMpuAddr;
30437 +               DBG_Trace(DBG_LEVEL4, "WMD_BRD_MemMap:numOfActualTabEntries=%d,"
30438 +                         "ulNumBytes= %d\n",  numUsrPgs, ulNumBytes);
30439 +               /* Get the physical addresses for user buffer */
30440 +               for (pgI = 0; pgI < numUsrPgs; pgI++) {
30441 +                       pa = user_va2pa(mm, mpuAddr);
30442                         if (!pa) {
30443                                 status = DSP_EFAIL;
30444                                 pr_err("DSPBRIDGE: VM_IO mapping physical"
30445 -                                      "address is invalid\n");
30446 +                                               "address is invalid\n");
30447                                 break;
30448                         }
30449 -
30450 +                       if (pfn_valid(__phys_to_pfn(pa))) {
30451 +                               pg = phys_to_page(pa);
30452 +                               get_page(pg);
30453 +                               if (page_count(pg) < 1) {
30454 +                                       pr_err("Bad page in VM_IO buffer\n");
30455 +                                       bad_page_dump(pa, pg);
30456 +                               }
30457 +                       }
30458                         status = PteSet(pDevContext->pPtAttrs, pa,
30459                                         va, HW_PAGE_SIZE_4KB, &hwAttrs);
30460                         if (DSP_FAILED(status)) {
30461                                 DBG_Trace(DBG_LEVEL7,
30462 -                                         "WMD_BRD_MemMap: FAILED IN VM_IO"
30463 -                                         "PTESET \n");
30464 +                                       "WMD_BRD_MemMap: FAILED IN VM_IO"
30465 +                                       "PTESET \n");
30466                                 break;
30467                         }
30468 -
30469                         va += HW_PAGE_SIZE_4KB;
30470 -                       ulMpuAddr += HW_PAGE_SIZE_4KB;
30471 -                       nr_pages--;
30472 +                       mpuAddr += HW_PAGE_SIZE_4KB;
30473 +                       pa += HW_PAGE_SIZE_4KB;
30474                 }
30475         } else {
30476 -               int write = 0;
30477 -
30478 +               numUsrPgs =  ulNumBytes / PG_SIZE_4K;
30479                 if (vma->vm_flags & (VM_WRITE | VM_MAYWRITE))
30480                         write = 1;
30481  
30482 -               for (nr_pages = numUsrPgs; nr_pages > 0;) {
30483 -                       int i, ret;
30484 -                       struct page *pages[16]; /* for a reasonable batch */
30485 -
30486 -                       ret = get_user_pages(current, mm, ulMpuAddr,
30487 -                                            min_t(int,  nr_pages, ARRAY_SIZE(pages)),
30488 -                                            write, 1, pages, NULL);
30489 -                       if (ret <= 0) {
30490 -                               pr_err("DSPBRIDGE: get_user_pages FAILED,"
30491 -                                      "MPU addr = 0x%x,"
30492 -                                      "vma->vm_flags = 0x%lx,"
30493 -                                      "get_user_pages ErrValue = %d,"
30494 -                                      "Buffersize=0x%x\n",
30495 -                                      ulMpuAddr, vma->vm_flags, ret,
30496 -                                      ulNumBytes);
30497 -                               status = DSP_EFAIL;
30498 -                               goto fail_mapping;
30499 -                       }
30500 -
30501 -                       for (i = 0; i < ret; i++) {
30502 -                               struct page *page = pages[i];
30503 -
30504 +               for (pgI = 0; pgI < numUsrPgs; pgI++) {
30505 +                       pgNum = get_user_pages(curr_task, mm, ulMpuAddr, 1,
30506 +                                               write, 1, &mappedPage, NULL);
30507 +                       if (pgNum > 0) {
30508 +                               if (page_count(mappedPage) < 1) {
30509 +                                       pr_err("Bad page count after doing"
30510 +                                                       "get_user_pages on"
30511 +                                                       "user buffer\n");
30512 +                                       bad_page_dump(page_to_phys(mappedPage),
30513 +                                                               mappedPage);
30514 +                               }
30515                                 status = PteSet(pDevContext->pPtAttrs,
30516 -                                               page_to_phys(page), va,
30517 -                                               HW_PAGE_SIZE_4KB, &hwAttrs);
30518 +                                       page_to_phys(mappedPage), va,
30519 +                                       HW_PAGE_SIZE_4KB, &hwAttrs);
30520                                 if (DSP_FAILED(status)) {
30521 -                                       pr_err("%s: FAILED IN PTESET\n",
30522 -                                              __func__);
30523 -                                       goto fail_mapping;
30524 +                                       DBG_Trace(DBG_LEVEL7,
30525 +                                       "WMD_BRD_MemMap: FAILED IN PTESET \n");
30526 +                                       break;
30527                                 }
30528 -                               SetPageMlocked(page);
30529                                 va += HW_PAGE_SIZE_4KB;
30530                                 ulMpuAddr += HW_PAGE_SIZE_4KB;
30531 -                               nr_pages--;
30532 +                       } else {
30533 +                               pr_err("DSPBRIDGE: get_user_pages FAILED,"
30534 +                                               "MPU addr = 0x%x,"
30535 +                                               "vma->vm_flags = 0x%lx,"
30536 +                                               "get_user_pages Err"
30537 +                                               "Value = %d, Buffer"
30538 +                                               "size=0x%x\n", ulMpuAddr,
30539 +                                               vma->vm_flags, pgNum,
30540 +                                               ulNumBytes);
30541 +                               status = DSP_EFAIL;
30542 +                               break;
30543                         }
30544                 }
30545         }
30546 -
30547 -fail_mapping:
30548         up_read(&mm->mmap_sem);
30549  func_cont:
30550         /* Don't propogate Linux or HW status to upper layers */
30551 @@ -1566,9 +1552,9 @@ func_cont:
30552                  * Roll out the mapped pages incase it failed in middle of
30553                  * mapping
30554                  */
30555 -               if (numUsrPgs - nr_pages) {
30556 +               if (pgI) {
30557                         WMD_BRD_MemUnMap(pDevContext, ulVirtAddr,
30558 -                                        ((numUsrPgs - nr_pages) * PG_SIZE_4K));
30559 +                                               (pgI * PG_SIZE_4K));
30560                 }
30561                 status = DSP_EFAIL;
30562         }
30563 @@ -1692,10 +1678,10 @@ static DSP_STATUS WMD_BRD_MemUnMap(struc
30564                                                 "COUNT 0 FOR PA 0x%x, size = "
30565                                                 "0x%x\n", pAddr, ulNumBytes);
30566                                         bad_page_dump(pAddr, pg);
30567 +                               } else {
30568 +                                       SetPageDirty(pg);
30569 +                                       page_cache_release(pg);
30570                                 }
30571 -                               ClearPageMlocked(pg);
30572 -                               SetPageDirty(pg);
30573 -                               page_cache_release(pg);
30574                                 pAddr += HW_PAGE_SIZE_4KB;
30575                         }
30576                         if (HW_MMU_PteClear(pteAddrL2, vaCurr, pteSize)
30577 @@ -1758,10 +1744,10 @@ skip_coarse_page:
30578                                                 "COUNT 0 FOR PA 0x%x, size = "
30579                                                 "0x%x\n", pAddr, ulNumBytes);
30580                                         bad_page_dump(pAddr, pg);
30581 +                               } else {
30582 +                                       SetPageDirty(pg);
30583 +                                       page_cache_release(pg);
30584                                 }
30585 -                               ClearPageMlocked(pg);
30586 -                               SetPageDirty(pg);
30587 -                               page_cache_release(pg);
30588                         }
30589                         pAddr += HW_PAGE_SIZE_4KB;
30590                 }
30591 @@ -2052,9 +2038,7 @@ void configureDspMmu(struct WMD_DEV_CONT
30592                     enum HW_ElementSize_t elemSize,
30593                     enum HW_MMUMixedSize_t mixedSize)
30594  {
30595 -       struct CFG_HOSTRES resources;
30596         struct HW_MMUMapAttrs_t mapAttrs = { endianism, elemSize, mixedSize };
30597 -       DSP_STATUS status = DSP_SOK;
30598  
30599         DBC_Require(sizeInBytes > 0);
30600         DBG_Trace(DBG_LEVEL1,
30601 @@ -2063,9 +2047,8 @@ void configureDspMmu(struct WMD_DEV_CONT
30602  
30603         DBG_Trace(DBG_LEVEL1, "endianism %x, elemSize %x, mixedSize %x\n",
30604                  endianism, elemSize, mixedSize);
30605 -       status = CFG_GetHostResources(
30606 -                (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(), &resources);
30607 -       status = HW_MMU_TLBAdd(pDevContext->dwDSPMmuBase, dataBasePhys,
30608 +
30609 +       HW_MMU_TLBAdd(pDevContext->dwDSPMmuBase, dataBasePhys,
30610                                 dspBaseVirt, sizeInBytes, nEntryStart,
30611                                 &mapAttrs, HW_SET, HW_SET);
30612  }
30613 @@ -2076,14 +2059,14 @@ void configureDspMmu(struct WMD_DEV_CONT
30614   */
30615  bool WaitForStart(struct WMD_DEV_CONTEXT *pDevContext, u32 dwSyncAddr)
30616  {
30617 -       u16 usCount = TIHELEN_ACKTIMEOUT;
30618 +       u16 timeout = TIHELEN_ACKTIMEOUT;
30619  
30620         /*  Wait for response from board */
30621 -       while (*((volatile u16 *)dwSyncAddr) && --usCount)
30622 +       while (*((volatile u16 *)dwSyncAddr) && --timeout)
30623                 udelay(10);
30624  
30625         /*  If timed out: return FALSE */
30626 -       if (!usCount) {
30627 +       if (!timeout) {
30628                 DBG_Trace(DBG_LEVEL7, "Timed out Waiting for DSP to Start\n");
30629                 return FALSE;
30630         }
30631 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/tiomap3430_pwr.c kernel-power-2.6.28/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
30632 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/tiomap3430_pwr.c    2011-04-17 17:32:26.000000000 +0100
30633 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/tiomap3430_pwr.c 2011-05-02 22:36:51.000000000 +0100
30634 @@ -3,6 +3,8 @@
30635   *
30636   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
30637   *
30638 + * Implementation of DSP wake/sleep routines.
30639 + *
30640   * Copyright (C) 2007-2008 Texas Instruments, Inc.
30641   *
30642   * This package is free software; you can redistribute it and/or modify
30643 @@ -14,21 +16,6 @@
30644   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30645   */
30646  
30647 -/*
30648 - *  ======== _tiomap_pwr.c ========
30649 - *  Description:
30650 - *      Implementation of DSP wake/sleep routines.
30651 - *
30652 - *! Revision History
30653 - *! ================
30654 - *! 01-Nov-2007 HK: Added Off mode(Hibernation) support and DVFS support
30655 - *! 05-Jan-2004 vp: Moved the file to platform specific folder and commented the
30656 - *!                code.
30657 - *! 27-Mar-2003 vp: Added support for DSP boot idle mode.
30658 - *! 06-Dec-2002 cring:  Added Palm support.
30659 - *! 08-Oct-2002 rr:  Created.
30660 - */
30661 -
30662  /*  ----------------------------------- DSP/BIOS Bridge */
30663  #include <dspbridge/dbdefs.h>
30664  #include <dspbridge/errbase.h>
30665 @@ -42,7 +29,6 @@
30666  
30667  /*  ----------------------------------- OS Adaptation Layer */
30668  #include <dspbridge/mem.h>
30669 -#include <dspbridge/util.h>
30670  
30671  /*  ----------------------------------- Platform Manager */
30672  #include <dspbridge/brddefs.h>
30673 @@ -68,11 +54,10 @@
30674  #include <mach-omap2/cm-regbits-34xx.h>
30675  
30676  #ifdef CONFIG_PM
30677 -#include <mach/board-3430sdp.h>
30678 +extern s32 dsp_test_sleepstate;
30679  #endif
30680  extern struct MAILBOX_CONTEXT mboxsetting;
30681 -extern unsigned short enable_off_mode;
30682 -extern unsigned short min_active_opp;
30683 +
30684  /*
30685   *  ======== handle_constraints_set ========
30686   *     Sets new DSP constraint
30687 @@ -81,33 +66,18 @@ DSP_STATUS handle_constraints_set(struct
30688                                   IN void *pArgs)
30689  {
30690  #ifdef CONFIG_BRIDGE_DVFS
30691 -       u32 pConstraintVal;
30692 -       DSP_STATUS status = DSP_SOK;
30693 -       struct CFG_HOSTRES resources;
30694 +       u32 *pConstraintVal;
30695         struct dspbridge_platform_data *pdata =
30696                 omap_dspbridge_dev->dev.platform_data;
30697 -       status = CFG_GetHostResources(
30698 -               (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(), &resources);
30699  
30700 -       pConstraintVal = *(((u32 *)pArgs) + 1);
30701 +       pConstraintVal = (u32 *)(pArgs);
30702         /* Read the target value requested by DSP  */
30703         DBG_Trace(DBG_LEVEL7, "handle_constraints_set:"
30704 -               "opp requested = 0x%x\n", pConstraintVal);
30705 -       status = HW_MBOX_saveSettings(resources.dwMboxBase);
30706 +               "opp requested = 0x%x\n", (u32)*(pConstraintVal+1));
30707  
30708         /* Set the new opp value */
30709 -       if (pdata->dsp_set_min_opp) {
30710 -               /*
30711 -                * When Smartreflex is ON, DSP requires at least OPP level 3
30712 -                * to operate reliably. So boost lower OPP levels to OPP3.
30713 -                */
30714 -               if (pConstraintVal < min_active_opp) {
30715 -                       pr_debug("DSPBRIDGE: VDD1 OPP%x elevated to OPP%x\n",
30716 -                                       pConstraintVal, min_active_opp);
30717 -                       (*pdata->dsp_set_min_opp)(min_active_opp);
30718 -               } else
30719 -                       (*pdata->dsp_set_min_opp)(pConstraintVal);
30720 -       }
30721 +       if (pdata->dsp_set_min_opp)
30722 +               (*pdata->dsp_set_min_opp)((u32)*(pConstraintVal+1));
30723  #endif /* #ifdef CONFIG_BRIDGE_DVFS */
30724         return DSP_SOK;
30725  }
30726 @@ -120,7 +90,7 @@ DSP_STATUS handle_hibernation_fromDSP(st
30727  {
30728         DSP_STATUS status = DSP_SOK;
30729  #ifdef CONFIG_PM
30730 -       u16 usCount = TIHELEN_ACKTIMEOUT;
30731 +       u16 timeout = PWRSTST_TIMEOUT / 10;
30732         struct CFG_HOSTRES resources;
30733         enum HW_PwrState_t pwrState;
30734  #ifdef CONFIG_BRIDGE_DVFS
30735 @@ -137,14 +107,16 @@ DSP_STATUS handle_hibernation_fromDSP(st
30736  
30737         HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
30738                             &pwrState);
30739 -       /* Wait for DSP to move into Off state,  how much time should
30740 -        * we wait? */
30741 -       while ((pwrState != HW_PWR_STATE_OFF) && --usCount) {
30742 -               udelay(500);
30743 +       /* Wait for DSP to move into OFF state */
30744 +       while ((pwrState != HW_PWR_STATE_OFF) && --timeout) {
30745 +               if (msleep_interruptible(10)) {
30746 +                       pr_err("Waiting for DSP OFF mode interrupted\n");
30747 +                       return DSP_EFAIL;
30748 +               }
30749                 HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
30750                                     &pwrState);
30751         }
30752 -       if (usCount == 0) {
30753 +       if (timeout == 0) {
30754                 DBG_Trace(DBG_LEVEL7, "Timed out Waiting for DSP Off mode \n");
30755                 status = WMD_E_TIMEOUT;
30756                 return status;
30757 @@ -202,8 +174,10 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTE
30758         DSP_STATUS status = DSP_SOK;
30759  #ifdef CONFIG_PM
30760         struct CFG_HOSTRES resources;
30761 +#ifdef CONFIG_BRIDGE_NTFY_PWRERR
30762         struct DEH_MGR *hDehMgr;
30763 -       u16 usCount = TIHELEN_ACKTIMEOUT;
30764 +#endif /* CONFIG_BRIDGE_NTFY_PWRERR */
30765 +       u16 timeout = PWRSTST_TIMEOUT / 10;
30766         enum HW_PwrState_t pwrState, targetPwrState;
30767  
30768         DBG_Trace(DBG_LEVEL7, "SleepDSP- Enter function \n");
30769 @@ -222,7 +196,7 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTE
30770         switch (pDevContext->dwBrdState) {
30771         case BRD_RUNNING:
30772                 status = HW_MBOX_saveSettings(resources.dwMboxBase);
30773 -               if (enable_off_mode) {
30774 +               if (dsp_test_sleepstate == HW_PWR_STATE_OFF) {
30775                         CHNLSM_InterruptDSP2(pDevContext,
30776                                              MBX_PM_DSPHIBERNATE);
30777                         DBG_Trace(DBG_LEVEL7,
30778 @@ -237,7 +211,7 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTE
30779                 break;
30780         case BRD_RETENTION:
30781                 status = HW_MBOX_saveSettings(resources.dwMboxBase);
30782 -               if (enable_off_mode) {
30783 +               if (dsp_test_sleepstate == HW_PWR_STATE_OFF) {
30784                         CHNLSM_InterruptDSP2(pDevContext,
30785                                              MBX_PM_DSPHIBERNATE);
30786                         targetPwrState = HW_PWR_STATE_OFF;
30787 @@ -264,28 +238,30 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTE
30788         HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
30789                         &pwrState);
30790  
30791 -       /*
30792 -        * Wait for DSP to move into Standby state,  how much time
30793 -        * should we wait?
30794 -        */
30795 -       while ((pwrState != targetPwrState) && --usCount) {
30796 -               udelay(500);
30797 +       /* Wait for DSP to move into target power state */
30798 +       while ((pwrState != targetPwrState) && --timeout) {
30799 +               if (msleep_interruptible(10)) {
30800 +                       pr_err("Waiting for DSP to Suspend interrupted\n");
30801 +                       return DSP_EFAIL;
30802 +               }
30803                 HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
30804                                     &pwrState);
30805         }
30806  
30807 -       if (!usCount) {
30808 +       if (!timeout) {
30809                 DBG_Trace(DBG_LEVEL7, "SleepDSP: Timed out Waiting for DSP"
30810                          " STANDBY %x \n", pwrState);
30811 +#ifdef CONFIG_BRIDGE_NTFY_PWRERR
30812                 DEV_GetDehMgr(pDevContext->hDevObject, &hDehMgr);
30813                 WMD_DEH_Notify(hDehMgr, DSP_PWRERROR, 0);
30814 +#endif /* CONFIG_BRIDGE_NTFY_PWRERR */
30815                 return WMD_E_TIMEOUT;
30816         } else {
30817                 DBG_Trace(DBG_LEVEL7, "SleepDSP: DSP STANDBY Pwr state %x \n",
30818                          pwrState);
30819  
30820                 /* Update the Bridger Driver state */
30821 -               if (enable_off_mode)
30822 +               if (dsp_test_sleepstate == HW_PWR_STATE_OFF)
30823                         pDevContext->dwBrdState = BRD_HIBERNATION;
30824                 else
30825                         pDevContext->dwBrdState = BRD_RETENTION;
30826 @@ -319,8 +295,8 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTE
30827   */
30828  DSP_STATUS WakeDSP(struct WMD_DEV_CONTEXT *pDevContext, IN void *pArgs)
30829  {
30830 -#ifdef CONFIG_PM
30831         DSP_STATUS status = DSP_SOK;
30832 +#ifdef CONFIG_PM
30833  #ifdef CONFIG_BRIDGE_DEBUG
30834         enum HW_PwrState_t pwrState;
30835         struct CFG_HOSTRES resources;
30836 @@ -371,6 +347,8 @@ DSP_STATUS DSPPeripheralClkCtrl(struct W
30837         u32 dspPerClksBefore;
30838         DSP_STATUS status = DSP_SOK;
30839         DSP_STATUS status1 = DSP_SOK;
30840 +       struct CFG_HOSTRES resources;
30841 +       u32 value;
30842  
30843         DBG_Trace(DBG_ENTER, "Entering DSPPeripheralClkCtrl \n");
30844         dspPerClksBefore = pDevContext->uDspPerClks;
30845 @@ -379,6 +357,13 @@ DSP_STATUS DSPPeripheralClkCtrl(struct W
30846  
30847         extClk = (u32)*((u32 *)pArgs);
30848  
30849 +       status = CFG_GetHostResources(
30850 +                       (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
30851 +                       &resources);
30852 +
30853 +       if (DSP_FAILED(status))
30854 +               return DSP_EFAIL;
30855 +
30856         DBG_Trace(DBG_LEVEL3, "DSPPeripheralClkCtrl : extClk+Cmd = 0x%x \n",
30857                  extClk);
30858  
30859 @@ -409,6 +394,17 @@ DSP_STATUS DSPPeripheralClkCtrl(struct W
30860                          "DSPPeripheralClkCtrl : Disable CLK for \n");
30861                 status1 = CLK_Disable(BPWR_Clks[clkIdIndex].intClk);
30862                 status = CLK_Disable(BPWR_Clks[clkIdIndex].funClk);
30863 +               if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP1) {
30864 +                       /* clear MCBSP1_CLKS, on McBSP1 OFF */
30865 +                       value = __raw_readl(resources.dwSysCtrlBase + 0x274);
30866 +                       value &= ~(1 << 2);
30867 +                       __raw_writel(value, resources.dwSysCtrlBase + 0x274);
30868 +               } else if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP2) {
30869 +                       /* clear MCBSP2_CLKS, on McBSP2 OFF */
30870 +                       value = __raw_readl(resources.dwSysCtrlBase + 0x274);
30871 +                       value &= ~(1 << 6);
30872 +                       __raw_writel(value, resources.dwSysCtrlBase + 0x274);
30873 +               }
30874                 DSPClkWakeupEventCtrl(BPWR_Clks[clkIdIndex].clkId, false);
30875                 if ((DSP_SUCCEEDED(status)) && (DSP_SUCCEEDED(status1))) {
30876                         (pDevContext->uDspPerClks) &=
30877 @@ -423,6 +419,17 @@ DSP_STATUS DSPPeripheralClkCtrl(struct W
30878                          "DSPPeripheralClkCtrl : Enable CLK for \n");
30879                 status1 = CLK_Enable(BPWR_Clks[clkIdIndex].intClk);
30880                 status = CLK_Enable(BPWR_Clks[clkIdIndex].funClk);
30881 +               if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP1) {
30882 +                       /* set MCBSP1_CLKS, on McBSP1 ON */
30883 +                       value = __raw_readl(resources.dwSysCtrlBase + 0x274);
30884 +                       value |= 1 << 2;
30885 +                       __raw_writel(value, resources.dwSysCtrlBase + 0x274);
30886 +               } else if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP2) {
30887 +                       /* set MCBSP2_CLKS, on McBSP2 ON */
30888 +                       value = __raw_readl(resources.dwSysCtrlBase + 0x274);
30889 +                       value |= 1 << 6;
30890 +                       __raw_writel(value, resources.dwSysCtrlBase + 0x274);
30891 +               }
30892                 DSPClkWakeupEventCtrl(BPWR_Clks[clkIdIndex].clkId, true);
30893                 if ((DSP_SUCCEEDED(status)) && (DSP_SUCCEEDED(status1))) {
30894                         (pDevContext->uDspPerClks) |= (1 << clkIdIndex);
30895 @@ -485,13 +492,15 @@ DSP_STATUS PreScale_DSP(struct WMD_DEV_C
30896   */
30897  DSP_STATUS PostScale_DSP(struct WMD_DEV_CONTEXT *pDevContext, IN void *pArgs)
30898  {
30899 +       DSP_STATUS status = DSP_SOK;
30900  #ifdef CONFIG_BRIDGE_DVFS
30901         u32 level;
30902         u32 voltage_domain;
30903         struct IO_MGR *hIOMgr;
30904 -       DSP_STATUS status = DSP_SOK;
30905  
30906         status = DEV_GetIOMgr(pDevContext->hDevObject, &hIOMgr);
30907 +       if (!hIOMgr)
30908 +               return DSP_EHANDLE;
30909  
30910         voltage_domain = *((u32 *)pArgs);
30911         level = *((u32 *)pArgs + 1);
30912 @@ -506,7 +515,6 @@ DSP_STATUS PostScale_DSP(struct WMD_DEV_
30913                 DBG_Trace(DBG_LEVEL7,
30914                          "PostScale_DSP: IVA in sleep. Wrote to shared "
30915                          "memory \n");
30916 -               return DSP_SOK;
30917         } else  if ((pDevContext->dwBrdState == BRD_RUNNING)) {
30918                 /* Update the OPP value in shared memory */
30919                 IO_SHMsetting(hIOMgr, SHM_CURROPP, &level);
30920 @@ -515,14 +523,13 @@ DSP_STATUS PostScale_DSP(struct WMD_DEV_
30921                 DBG_Trace(DBG_LEVEL7,
30922                         "PostScale_DSP: Wrote to shared memory Sent post"
30923                         " notification to DSP\n");
30924 -               return DSP_SOK;
30925         } else {
30926                 DBG_Trace(DBG_LEVEL7, "PostScale_DSP: Failed - DSP BRD state "
30927                         "in wrong state");
30928 -               return DSP_EFAIL;
30929 +               status = DSP_EFAIL;
30930         }
30931  #endif /* #ifdef CONFIG_BRIDGE_DVFS */
30932 -       return DSP_SOK;
30933 +       return status;
30934  }
30935  
30936  /*
30937 @@ -532,14 +539,34 @@ DSP_STATUS PostScale_DSP(struct WMD_DEV_
30938  DSP_STATUS DSP_PeripheralClocks_Disable(struct WMD_DEV_CONTEXT *pDevContext,
30939                                         IN void *pArgs)
30940  {
30941 -
30942         u32 clkIdx;
30943         DSP_STATUS status = DSP_SOK;
30944 +       struct CFG_HOSTRES resources;
30945 +       u32 value;
30946 +
30947 +       status = CFG_GetHostResources(
30948 +                       (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
30949 +                       &resources);
30950  
30951         for (clkIdx = 0; clkIdx < MBX_PM_MAX_RESOURCES; clkIdx++) {
30952                 if (((pDevContext->uDspPerClks) >> clkIdx) & 0x01) {
30953                         /* Disables the interface clock of the peripheral */
30954                         status = CLK_Disable(BPWR_Clks[clkIdx].intClk);
30955 +                       if (BPWR_CLKID[clkIdx] == BPWR_MCBSP1) {
30956 +                               /* clear MCBSP1_CLKS, on McBSP1 OFF */
30957 +                               value = __raw_readl(resources.dwSysCtrlBase
30958 +                                                               + 0x274);
30959 +                               value &= ~(1 << 2);
30960 +                               __raw_writel(value, resources.dwSysCtrlBase
30961 +                                                               + 0x274);
30962 +                       } else if (BPWR_CLKID[clkIdx] == BPWR_MCBSP2) {
30963 +                               /* clear MCBSP2_CLKS, on McBSP2 OFF */
30964 +                               value = __raw_readl(resources.dwSysCtrlBase
30965 +                                                               + 0x274);
30966 +                               value &= ~(1 << 6);
30967 +                               __raw_writel(value, resources.dwSysCtrlBase
30968 +                                                               + 0x274);
30969 +                       }
30970                         if (DSP_FAILED(status)) {
30971                                 DBG_Trace(DBG_LEVEL7,
30972                                          "Failed to Enable the DSP Peripheral"
30973 @@ -566,11 +593,31 @@ DSP_STATUS DSP_PeripheralClocks_Enable(s
30974  {
30975         u32 clkIdx;
30976         DSP_STATUS int_clk_status = DSP_EFAIL, fun_clk_status = DSP_EFAIL;
30977 +       struct CFG_HOSTRES resources;
30978 +       u32 value;
30979 +
30980 +       CFG_GetHostResources((struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
30981 +                       &resources);
30982  
30983         for (clkIdx = 0; clkIdx < MBX_PM_MAX_RESOURCES; clkIdx++) {
30984                 if (((pDevContext->uDspPerClks) >> clkIdx) & 0x01) {
30985                         /* Enable the interface clock of the peripheral */
30986                         int_clk_status = CLK_Enable(BPWR_Clks[clkIdx].intClk);
30987 +                       if (BPWR_CLKID[clkIdx] == BPWR_MCBSP1) {
30988 +                               /* set MCBSP1_CLKS, on McBSP1 ON */
30989 +                               value = __raw_readl(resources.dwSysCtrlBase
30990 +                                                               + 0x274);
30991 +                               value |= 1 << 2;
30992 +                               __raw_writel(value, resources.dwSysCtrlBase
30993 +                                                               + 0x274);
30994 +                       } else if (BPWR_CLKID[clkIdx] == BPWR_MCBSP2) {
30995 +                               /* set MCBSP2_CLKS, on McBSP2 ON */
30996 +                               value = __raw_readl(resources.dwSysCtrlBase
30997 +                                                               + 0x274);
30998 +                               value |= 1 << 6;
30999 +                               __raw_writel(value, resources.dwSysCtrlBase
31000 +                                                               + 0x274);
31001 +                       }
31002                         /* Enable the functional clock of the periphearl */
31003                         fun_clk_status = CLK_Enable(BPWR_Clks[clkIdx].funClk);
31004                 }
31005 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/tiomap_io.c kernel-power-2.6.28/drivers/dsp/bridge/wmd/tiomap_io.c
31006 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/tiomap_io.c 2011-04-17 17:32:26.000000000 +0100
31007 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/tiomap_io.c      2011-05-02 22:36:51.000000000 +0100
31008 @@ -3,6 +3,8 @@
31009   *
31010   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
31011   *
31012 + * Implementation for the io read/write routines.
31013 + *
31014   * Copyright (C) 2005-2006 Texas Instruments, Inc.
31015   *
31016   * This package is free software; you can redistribute it and/or modify
31017 @@ -14,21 +16,6 @@
31018   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
31019   */
31020  
31021 -
31022 -/*
31023 - *  ======== _tiomap_io.c ========
31024 - *  Description:
31025 - *      Implementation for the io read/write routines.
31026 - *
31027 - *! Revision History
31028 - *! ================
31029 - *! 16-Feb-2004 vp:  Fixed warning in WriteDspData function.
31030 - *! 16-Apr-2003 vp:  Added support for TC word swap
31031 - *! 26-Feb-2003 vp:  Fixed issue with EXT_BEG and EXT_END address.
31032 - *! 24-Feb-2003 vp:  Ported to Linux platform
31033 - *! 08-Oct-2002 rr:  Created.
31034 - */
31035 -
31036  /*  ----------------------------------- DSP/BIOS Bridge */
31037  #include <dspbridge/dbdefs.h>
31038  #include <dspbridge/errbase.h>
31039 @@ -43,7 +30,6 @@
31040  
31041  /*  ----------------------------------- OS Adaptation Layer */
31042  #include <dspbridge/mem.h>
31043 -#include <dspbridge/util.h>
31044  #include <dspbridge/cfg.h>
31045  
31046  /*  ----------------------------------- specific to this file */
31047 @@ -92,7 +78,7 @@ DSP_STATUS ReadExtDspData(struct WMD_DEV
31048         DBC_Assert(ulShmBaseVirt != 0);
31049  
31050         /* Check if it is a read of Trace section */
31051 -       if (!ulTraceSecBeg) {
31052 +       if (DSP_SUCCEEDED(status) && !ulTraceSecBeg) {
31053                 status = DEV_GetSymbol(pDevContext->hDevObject,
31054                 DSP_TRACESEC_BEG, &ulTraceSecBeg);
31055         }
31056 @@ -114,7 +100,7 @@ DSP_STATUS ReadExtDspData(struct WMD_DEV
31057         }
31058  
31059         /* If reading from TRACE, force remap/unmap */
31060 -       if ((bTraceRead) && dwBaseAddr) {
31061 +       if (bTraceRead && dwBaseAddr) {
31062                 dwBaseAddr = 0;
31063                 pDevContext->dwDspExtBaseAddr = 0;
31064         }
31065 @@ -226,6 +212,9 @@ DSP_STATUS WriteDspData(struct WMD_DEV_C
31066         status =  CFG_GetHostResources(
31067                  (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(), &resources);
31068  
31069 +       if (DSP_FAILED(status))
31070 +               return status;
31071 +
31072         offset = dwDSPAddr - hDevContext->dwDSPStartAdd;
31073         if (offset < base1) {
31074                 dwBaseAddr = MEM_LinearAddress(resources.dwMemBase[2],
31075 @@ -240,8 +229,7 @@ DSP_STATUS WriteDspData(struct WMD_DEV_C
31076                                                 resources.dwMemLength[4]);
31077                 offset = offset - base3;
31078         } else{
31079 -               status = DSP_EFAIL;
31080 -               return status;
31081 +               return DSP_EFAIL;
31082         }
31083         if (ulNumBytes)
31084                 memcpy((u8 *) (dwBaseAddr+offset), pbHostBuf, ulNumBytes);
31085 @@ -378,9 +366,8 @@ DSP_STATUS WriteExtDspData(struct WMD_DE
31086                                  dwExtProgVirtMem);
31087  
31088                         pDevContext->dwDspExtBaseAddr =
31089 -                               (u32)MEM_LinearAddress((void *)
31090 -                               TO_VIRTUAL_UNCACHED(dwExtProgVirtMem), ulExtEnd
31091 -                               - ulExtBase);
31092 +                               (u32)MEM_LinearAddress((void *)dwExtProgVirtMem,
31093 +                                       ulExtEnd - ulExtBase);
31094                         dwBaseAddr += pDevContext->dwDspExtBaseAddr;
31095                         /* This dwDspExtBaseAddr will get cleared only when
31096                          * the board is stopped.  */
31097 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/tiomap_io.h kernel-power-2.6.28/drivers/dsp/bridge/wmd/tiomap_io.h
31098 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/tiomap_io.h 2011-04-17 17:32:26.000000000 +0100
31099 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/tiomap_io.h      2011-05-02 22:36:51.000000000 +0100
31100 @@ -3,6 +3,8 @@
31101   *
31102   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
31103   *
31104 + * Definitions, types and function prototypes for the io (r/w external mem).
31105 + *
31106   * Copyright (C) 2005-2006 Texas Instruments, Inc.
31107   *
31108   * This package is free software; you can redistribute it and/or modify
31109 @@ -14,18 +16,6 @@
31110   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
31111   */
31112  
31113 -
31114 -/*
31115 - *  ======== _tiomap_io.h ========
31116 - *  Description:
31117 - *      Definitions, types and function prototypes for the io
31118 - *      (r/w external mem).
31119 - *
31120 - *! Revision History
31121 - *! ================
31122 - *! 08-Oct-2002 rr:  Created.
31123 - */
31124 -
31125  #ifndef _TIOMAP_IO_
31126  #define _TIOMAP_IO_
31127  
31128 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/tiomap_sm.c kernel-power-2.6.28/drivers/dsp/bridge/wmd/tiomap_sm.c
31129 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/tiomap_sm.c 2011-04-17 17:32:26.000000000 +0100
31130 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/tiomap_sm.c      2011-05-02 22:36:51.000000000 +0100
31131 @@ -28,8 +28,6 @@
31132  
31133  #define MAILBOX_FIFOSTATUS(m) (0x80 + 4 * (m))
31134  
31135 -extern unsigned short min_active_opp;
31136 -
31137  static inline unsigned int fifo_full(void __iomem *mbox_base, int mbox_id)
31138  {
31139         return __raw_readl(mbox_base + MAILBOX_FIFOSTATUS(mbox_id)) & 0x1;
31140 @@ -42,7 +40,6 @@ DSP_STATUS CHNLSM_EnableInterrupt(struct
31141         u32 mbxValue;
31142         struct CFG_HOSTRES resources;
31143         u32 devType;
31144 -       struct IO_MGR *hIOMgr;
31145  
31146         DBG_Trace(DBG_ENTER, "CHNLSM_EnableInterrupt(0x%x)\n", pDevContext);
31147  
31148 @@ -51,7 +48,6 @@ DSP_STATUS CHNLSM_EnableInterrupt(struct
31149         CFG_GetHostResources((struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
31150                              &resources);
31151         DEV_GetDevType(pDevContext->hDevObject, &devType);
31152 -       status = DEV_GetIOMgr(pDevContext->hDevObject, &hIOMgr);
31153         if (devType == DSP_UNIT) {
31154                 HW_MBOX_NumMsgGet(resources.dwMboxBase,
31155                                   MBOX_DSP2ARM, &numMbxMsg);
31156 @@ -100,6 +96,11 @@ DSP_STATUS CHNLSM_DisableInterrupt(struc
31157  DSP_STATUS CHNLSM_InterruptDSP2(struct WMD_DEV_CONTEXT *pDevContext,
31158                                 u16 wMbVal)
31159  {
31160 +#ifdef CONFIG_BRIDGE_DVFS
31161 +       struct dspbridge_platform_data *pdata =
31162 +               omap_dspbridge_dev->dev.platform_data;
31163 +       u32 opplevel = 0;
31164 +#endif
31165         struct CFG_HOSTRES resources;
31166         DSP_STATUS status = DSP_SOK;
31167         unsigned long timeout;
31168 @@ -113,14 +114,12 @@ DSP_STATUS CHNLSM_InterruptDSP2(struct W
31169         if (pDevContext->dwBrdState == BRD_DSP_HIBERNATION ||
31170             pDevContext->dwBrdState == BRD_HIBERNATION) {
31171  #ifdef CONFIG_BRIDGE_DVFS
31172 -               struct dspbridge_platform_data *pdata =
31173 -                       omap_dspbridge_dev->dev.platform_data;
31174 -               /*
31175 -                * When Smartreflex is ON, DSP requires at least OPP level 3
31176 -                * to operate reliably. So boost lower OPP levels to OPP3.
31177 -                */
31178 -               if (pdata->dsp_set_min_opp)
31179 -                       (*pdata->dsp_set_min_opp)(min_active_opp);
31180 +               if (pdata->dsp_get_opp)
31181 +                       opplevel = (*pdata->dsp_get_opp)();
31182 +               if (opplevel == VDD1_OPP1) {
31183 +                       if (pdata->dsp_set_min_opp)
31184 +                               (*pdata->dsp_set_min_opp)(VDD1_OPP2);
31185 +               }
31186  #endif
31187                 /* Restart the peripheral clocks */
31188                 DSP_PeripheralClocks_Enable(pDevContext, NULL);
31189 @@ -140,13 +139,6 @@ DSP_STATUS CHNLSM_InterruptDSP2(struct W
31190                 temp = (temp & 0xFFFFFF08) | 0x37;
31191                 *(REG_UWORD32 *)(resources.dwCmBase + 0x4) = temp;
31192  
31193 -               /*
31194 -                * This delay is needed to avoid mailbox timed out
31195 -                * issue experienced while SmartReflex is ON.
31196 -                * TODO: Instead of 1 ms calculate proper value.
31197 -                */
31198 -               mdelay(1);
31199 -
31200                 /* Restore mailbox settings */
31201                 HW_MBOX_restoreSettings(resources.dwMboxBase);
31202  
31203 @@ -154,6 +146,9 @@ DSP_STATUS CHNLSM_InterruptDSP2(struct W
31204                 temp = *(REG_UWORD32 *)(resources.dwDmmuBase + 0x10);
31205  
31206                 pDevContext->dwBrdState = BRD_RUNNING;
31207 +       } else if (pDevContext->dwBrdState == BRD_RETENTION) {
31208 +               /* Restart the peripheral clocks */
31209 +               DSP_PeripheralClocks_Enable(pDevContext, NULL);
31210         }
31211  
31212         timeout = jiffies + msecs_to_jiffies(1);
31213 diff -rupN kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/ue_deh.c kernel-power-2.6.28/drivers/dsp/bridge/wmd/ue_deh.c
31214 --- kernel-power-2.6.28.orig/drivers/dsp/bridge/wmd/ue_deh.c    2011-04-17 17:32:26.000000000 +0100
31215 +++ kernel-power-2.6.28/drivers/dsp/bridge/wmd/ue_deh.c 2011-05-02 22:36:51.000000000 +0100
31216 @@ -3,6 +3,8 @@
31217   *
31218   * DSP-BIOS Bridge driver support functions for TI OMAP processors.
31219   *
31220 + * Implements upper edge DSP exception handling (DEH) functions.
31221 + *
31222   * Copyright (C) 2005-2006 Texas Instruments, Inc.
31223   *
31224   * This package is free software; you can redistribute it and/or modify
31225 @@ -14,23 +16,6 @@
31226   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
31227   */
31228  
31229 -
31230 -/*
31231 - *  ======== ue_deh.c ========
31232 - *  Description:
31233 - *      Implements upper edge DSP exception handling (DEH) functions.
31234 - *
31235 - *! Revision History:
31236 - *! ================
31237 - *! 03-Jan-2005 hn: Support for IVA DEH.
31238 - *! 05-Jan-2004 vp: Updated for the 24xx HW library.
31239 - *! 19-Feb-2003 vp: Code review updates.
31240 - *!                 - Cosmetic changes.
31241 - *! 18-Oct-2002 sb: Ported to Linux platform.
31242 - *! 10-Dec-2001 kc: Updated DSP error reporting in DEBUG mode.
31243 - *! 10-Sep-2001 kc: created.
31244 - */
31245 -
31246  /*  ----------------------------------- Host OS */
31247  #include <dspbridge/host_os.h>
31248  
31249 @@ -44,9 +29,7 @@
31250  #include <dspbridge/dbg.h>
31251  
31252  /*  ----------------------------------- OS Adaptation Layer */
31253 -#include <dspbridge/csl.h>
31254  #include <dspbridge/cfg.h>
31255 -#include <dspbridge/dpc.h>
31256  #include <dspbridge/mem.h>
31257  #include <dspbridge/ntfy.h>
31258  #include <dspbridge/drv.h>
31259 @@ -103,12 +86,11 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH
31260                 status = DSP_EMEMORY;
31261         } else {
31262                 /* Create an NTFY object to manage notifications */
31263 -               if (DSP_SUCCEEDED(status))
31264 -                       status = NTFY_Create(&pDehMgr->hNtfy);
31265 +               status = NTFY_Create(&pDehMgr->hNtfy);
31266 +
31267 +               /* Create a MMUfault DPC */
31268 +               tasklet_init(&pDehMgr->dpc_tasklet, MMU_FaultDpc, (u32)pDehMgr);
31269  
31270 -               /* Create a DPC object. */
31271 -               status = DPC_Create(&pDehMgr->hMmuFaultDpc, MMU_FaultDpc,
31272 -                                  (void *)pDehMgr);
31273                 if (DSP_SUCCEEDED(status))
31274                         status = DEV_GetDevNode(hDevObject, &hDevNode);
31275  
31276 @@ -123,11 +105,11 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH
31277                         pDehMgr->errInfo.dwVal2 = 0L;
31278                         pDehMgr->errInfo.dwVal3 = 0L;
31279                         /* Install ISR function for DSP MMU fault */
31280 -                       if ((request_irq(INT_DSP_MMU_IRQ, MMU_FaultIsr, 0,
31281 -                                           "DspBridge\tiommu fault", (void *)pDehMgr)) == 0)
31282 -                               status = DSP_SOK;
31283 -                       else
31284 -                               status = DSP_EFAIL;
31285 +                       if ((request_irq(INT_DSP_MMU_IRQ, MMU_FaultIsr, 0,
31286 +                          "DspBridge\tiommu fault", (void *)pDehMgr)) == 0)
31287 +                               status = DSP_SOK;
31288 +                       else
31289 +                               status = DSP_EFAIL;
31290                 }
31291         }
31292         if (DSP_FAILED(status)) {
31293 @@ -136,8 +118,7 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH
31294                 *phDehMgr = NULL;
31295         } else {
31296                 *phDehMgr = (struct DEH_MGR *)pDehMgr;
31297 -               DBG_Trace(DBG_LEVEL1, "ISR_IRQ Object 0x%x \n",
31298 -                                        pDehMgr);
31299 +               DBG_Trace(DBG_LEVEL1, "ISR_IRQ Object 0x%x \n", pDehMgr);
31300         }
31301         DBG_Trace(DBG_LEVEL1, "Exiting DEH_Create.\n");
31302         return status;
31303 @@ -160,8 +141,12 @@ DSP_STATUS WMD_DEH_Destroy(struct DEH_MG
31304                 if (pDehMgr->hNtfy)
31305                         (void)NTFY_Delete(pDehMgr->hNtfy);
31306                 /* Disable DSP MMU fault */
31307 -               free_irq(INT_DSP_MMU_IRQ, pDehMgr);
31308 -               (void)DPC_Destroy(pDehMgr->hMmuFaultDpc);
31309 +               free_irq(INT_DSP_MMU_IRQ, pDehMgr);
31310 +
31311 +               /* Free DPC object */
31312 +               tasklet_kill(&pDehMgr->dpc_tasklet);
31313 +               DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
31314 +
31315                 /* Deallocate the DEH manager object */
31316                 MEM_FreeObject(pDehMgr);
31317         }
31318 @@ -202,7 +187,6 @@ void WMD_DEH_Notify(struct DEH_MGR *hDeh
31319         struct DEH_MGR *pDehMgr = (struct DEH_MGR *)hDehMgr;
31320         struct WMD_DEV_CONTEXT *pDevContext;
31321         DSP_STATUS status = DSP_SOK;
31322 -       DSP_STATUS status1 = DSP_EFAIL;
31323         u32 memPhysical = 0;
31324         u32 HW_MMU_MAX_TLB_COUNT = 31;
31325         extern u32 faultAddr;
31326 @@ -281,6 +265,7 @@ DBG_Trace(DBG_LEVEL6, "WMD_DEH_Notify: D
31327                         HW_MMU_EventAck(resources.dwDmmuBase,
31328                                          HW_MMU_TRANSLATION_FAULT);
31329                         break;
31330 +#ifdef CONFIG_BRIDGE_NTFY_PWRERR
31331                 case DSP_PWRERROR:
31332                         /* reset errInfo structure before use */
31333                         pDehMgr->errInfo.dwErrMask = DSP_PWRERROR;
31334 @@ -291,6 +276,7 @@ DBG_Trace(DBG_LEVEL6, "WMD_DEH_Notify: D
31335                         printk(KERN_ERR "WMD_DEH_Notify: DSP_PWRERROR, errInfo "
31336                                         "= 0x%x\n", dwErrInfo);
31337                         break;
31338 +#endif /* CONFIG_BRIDGE_NTFY_PWRERR */
31339                 default:
31340                         DBG_Trace(DBG_LEVEL6,
31341                                  "WMD_DEH_Notify: Unknown Error, errInfo = "
31342 @@ -299,16 +285,8 @@ DBG_Trace(DBG_LEVEL6, "WMD_DEH_Notify: D
31343                 }
31344  
31345                 /* Filter subsequent notifications when an error occurs */
31346 -               if (pDevContext->dwBrdState != BRD_ERROR) {
31347 -                       /* Use it as a flag to send notifications the
31348 -                        * first time and error occurred, next time
31349 -                        * state will be BRD_ERROR */
31350 -                       status1 = DSP_EFAIL;
31351 -               }
31352 -
31353 -               /* Filter subsequent notifications when an error occurs */
31354                 if (pDevContext->dwBrdState != BRD_ERROR)
31355 -                       status1 = DSP_SOK;
31356 +                       NTFY_Notify(pDehMgr->hNtfy, ulEventMask);
31357  
31358                 /* Set the Board state as ERROR */
31359                 pDevContext->dwBrdState = BRD_ERROR;
31360 @@ -317,11 +295,6 @@ DBG_Trace(DBG_LEVEL6, "WMD_DEH_Notify: D
31361                 /* Call DSP Trace Buffer */
31362                 PrintDspTraceBuffer(hDehMgr->hWmdContext);
31363  
31364 -               if (DSP_SUCCEEDED(status1)) {
31365 -                       /* Signal DSP error/exception event. */
31366 -                       NTFY_Notify(pDehMgr->hNtfy, ulEventMask);
31367 -               }
31368 -
31369         }
31370         DBG_Trace(DBG_LEVEL1, "Exiting WMD_DEH_Notify\n");
31371  
31372 @@ -349,6 +322,8 @@ DSP_STATUS WMD_DEH_GetInfo(struct DEH_MG
31373                 pErrInfo->dwVal1 = pDehMgr->errInfo.dwVal1;
31374                 pErrInfo->dwVal2 = pDehMgr->errInfo.dwVal2;
31375                 pErrInfo->dwVal3 = pDehMgr->errInfo.dwVal3;
31376 +       } else {
31377 +               status = DSP_EHANDLE;
31378         }
31379  
31380         DBG_Trace(DBG_LEVEL1, "Exiting WMD_DEH_GetInfo\n");