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
6 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
8 + * Private header file defining channel manager and channel objects for
9 + * a shared memory channel driver.
11 + * Shared between the modules implementing the shared memory channel class
14 * Copyright (C) 2005-2006 Texas Instruments, Inc.
16 * This package is free software; you can redistribute it and/or modify
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 - * ======== _chnl_sm.h ========
25 - * Private header file defining channel manager and channel objects for
26 - * a shared memory channel driver.
32 - * Shared between the modules implementing the shared memory channel class
35 - *! Revision History:
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
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.
62 #include <dspbridge/wcd.h>
63 #include <dspbridge/wmd.h>
64 -#include <dspbridge/dpc.h>
66 #include <dspbridge/list.h>
67 #include <dspbridge/ntfy.h>
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 */
77 struct oppTableEntry {
80 @@ -105,12 +77,6 @@ struct loadMonStruct {
87 - SHM_GETOPP = 2, /* Get DSP requested OPP info */
90 /* Structure in shared between DSP and PC for communication.*/
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 {
104 /* I/O Request/completion packet: */
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) */
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
116 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
118 + * Includes the wrapper functions called directly by the
119 + * DeviceIOControl interface.
121 * Copyright (C) 2005-2006 Texas Instruments, Inc.
123 * This package is free software; you can redistribute it and/or modify
125 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
130 - * ======== _dcd.h ========
132 - * Includes the wrapper functions called directly by the
133 - * DeviceIOControl interface.
135 - * Public Functions:
138 - * WCD_InitComplete2
143 - * Compiled with CDECL calling convention.
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.
169 extern u32 MGRWRAP_WaitForBridgeEvents(union Trapped_Args *args,
172 -#ifndef RES_CLEANUP_DISABLE
173 extern u32 MGRWRAP_GetProcessResourcesInfo(union Trapped_Args *args,
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
185 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
187 + * Global BRD constants and types, shared between WCD and WMD.
189 * Copyright (C) 2005-2006 Texas Instruments, Inc.
191 * This package is free software; you can redistribute it and/or modify
193 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
198 - * ======== brddefs.h ========
200 - * Global BRD constants and types, shared between WSX, WCD, and WMD.
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.
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;
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
228 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
230 + * PM Configuration module.
232 * Copyright (C) 2005-2006 Texas Instruments, Inc.
234 * This package is free software; you can redistribute it and/or modify
236 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
241 - * ======== cfg.h ========
243 - * PM Configuration module.
245 - * Private Functions:
250 - * CFG_GetDSPResources
252 - * CFG_GetHostResources
255 - * CFG_GetWMDFileName
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.
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
295 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
297 + * Global CFG constants and types, shared between class and mini driver.
299 * Copyright (C) 2005-2006 Texas Instruments, Inc.
301 * This package is free software; you can redistribute it and/or modify
303 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
307 - * ======== cfgdefs.h ========
309 - * Global CFG constants and types, shared between class and mini driver.
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.
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
339 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
341 + * WCD channel interface: multiplexes data streams through the single
342 + * physical link managed by a mini-driver.
344 + * See DSP API chnl.h for more details.
346 * Copyright (C) 2005-2006 Texas Instruments, Inc.
348 * This package is free software; you can redistribute it and/or modify
350 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
355 - * ======== chnl.h ========
357 - * WCD channel interface: multiplexes data streams through the single
358 - * physical link managed by a mini-driver.
360 - * Public Functions:
365 - * CHNL_CloseOrphans
371 - * CHNL_GetEventHandle
373 - * CHNL_GetIOCompletion
378 - * CHNL_GetProcessHandle
383 - * See DSP API chnl.h for more details.
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.
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
401 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
403 + * Prototypes for channel lower edge functions for a Bridge mini driver
404 + * implementing data transfer via shared memory.
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.
411 * Copyright (C) 2005-2006 Texas Instruments, Inc.
413 * This package is free software; you can redistribute it and/or modify
415 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
420 - * ======== chnl_sm.h ========
422 - * Prototypes for channel lower edge functions for a WinBRIDGE mini driver
423 - * implementing data transfer via shared memory.
425 - * Public Functions:
426 - * CHNLSM_DisableInterrupt;
427 - * CHNLSM_EnableInterrupt;
430 - * CHNLSM_UpdateSHMLength;
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.
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
448 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
450 + * System-wide channel objects and constants.
452 * Copyright (C) 2005-2006 Texas Instruments, Inc.
454 * This package is free software; you can redistribute it and/or modify
456 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
461 - * ======== chnldefs.h ========
463 - * System-wide channel objects and constants.
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.
487 #define CHNL_IsIOCancelled(ioc) (ioc.status & CHNL_IOCSTATCANCEL)
488 #define CHNL_IsTimedOut(ioc) (ioc.status & CHNL_IOCSTATTIMEOUT)
491 - typedef u32 CHNL_MODE; /* Channel transfer mode. */
493 /* Channel attributes: */
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
500 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
502 + * Private channel header shared between DSPSYS, WCD and WMD modules.
504 * Copyright (C) 2005-2006 Texas Instruments, Inc.
506 * This package is free software; you can redistribute it and/or modify
508 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
513 - * ======== chnlpriv.h ========
515 - * Private channel header shared between DSPSYS, WCD and WMD modules.
517 - * Public Functions:
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.
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. */
550 * Name of channel I/O completion event. Not required in Linux
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
557 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
559 + * Provides Clock functions.
561 * Copyright (C) 2005-2006 Texas Instruments, Inc.
563 * This package is free software; you can redistribute it and/or modify
565 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
569 - * ======== clk.h ========
570 - * Purpose: Provides Clock functions.
572 - *! Revision History:
573 - *! ================
574 - *! 08-May-2007 rg: Moved all clock functions from sync module.
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
585 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
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.
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.
600 + * CMM_XlatorAllocBuf - Used by Node and Stream modules for SM address
603 * Copyright (C) 2008 Texas Instruments, Inc.
605 * This package is free software; you can redistribute it and/or modify
607 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
611 - * ======== cmm.h ========
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.
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.
626 - * Public Functions:
635 - * CMM_RegisterGPPSMSeg
636 - * CMM_UnRegisterGPPSMSeg
637 - * CMM_XlatorAllocBuf (Note #1 below)
638 - * CMM_XlatorCreate "
639 - * CMM_XlatorDelete "
640 - * CMM_XlatorFreeBuf "
641 - * CMM_XlatorTranslate "
645 - * #1: Used by Node and Stream modules for SM address translation.
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.
667 - extern DSP_STATUS CMM_GetHandle(DSP_HPROCESSOR hProcessor,
668 + extern DSP_STATUS CMM_GetHandle(void *hProcessor,
669 OUT struct CMM_OBJECT **phCmmMgr);
673 unsigned int dwGPPBasePA,
676 - enum CMM_CNVTTYPE cFactor,
678 unsigned int dwDSPBase,
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
686 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
688 + * Global MEM constants and types.
690 * Copyright (C) 2008 Texas Instruments, Inc.
692 * This package is free software; you can redistribute it and/or modify
694 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
699 - * ======== cmmdefs.h ========
701 - * Global MEM constants and types.
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.
719 * For typical platforms:
720 * converted Address = PaDSP + ( cFactor * addressToConvert).
722 - enum CMM_CNVTTYPE {
723 - CMM_SUBFROMDSPPA = -1,
724 - /* PreOMAP is special case: not simple offset */
725 - CMM_POMAPEMIF2DSPBUS = 0,
728 +#define CMM_SUBFROMDSPPA -1
729 +#define CMM_ADDTODSPPA 1
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 */
737 CMM_DSPPA2PA = 4, /* DSP Pa to GPP Pa */
741 - * Used to "map" between device process virt addr and dsp addr.
743 - enum CMM_KERNMAPTYPE {
744 - CMM_KERNVA2DSP = 0, /* Device process context to dsp address. */
745 - CMM_DSP2KERNVA = 1, /* Dsp address to device process context. */
749 struct CMM_XLATOROBJECT;
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
756 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
758 + * Code management module for DSPs. This module provides an interface
759 + * interface for loading both static and dynamic code objects onto DSP
762 * Copyright (C) 2005-2006 Texas Instruments, Inc.
764 * This package is free software; you can redistribute it and/or modify
766 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
771 - * ======== cod.h ========
773 - * Code management module for DSPs. This module provides an interface
774 - * interface for loading both static and dynamic code objects onto DSP
777 - * Public Functions:
792 - * COD_UnloadSection
795 - * Currently, only static loading is supported.
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
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
818 - *! 29-May-1996 gp: Changed WCD_STATUS to DSP_STATUS. Removed include's.
819 - *! 07-May-1996 mg: Created.
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
833 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
835 - * Copyright (C) 2008 Texas Instruments, Inc.
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.
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.
847 - * ======== csl.h ========
849 - * Platform independent C Standard library functions.
851 - * Public Functions:
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.
881 -#include <dspbridge/host_os.h>
884 - * ======== CSL_Exit ========
886 - * Discontinue usage of the CSL module.
892 - * Resources acquired in CSL_Init(void) are freed.
894 - extern void CSL_Exit(void);
897 - * ======== CSL_Init ========
899 - * Initialize the CSL module's private state.
902 - * TRUE if initialized; FALSE if error occured.
905 - * A requirement for each of the other public CSL functions.
907 - extern bool CSL_Init(void);
910 - * ======== CSL_NumToAscii ========
912 - * Convert a 1 or 2 digit number to a 2 digit string.
914 - * pstrNumber: Buffer to store converted string.
915 - * dwNum: Number to convert.
918 - * pstrNumber must be able to hold at least three characters.
920 - * pstrNumber will be null terminated.
922 - extern void CSL_NumToAscii(OUT char *pstrNumber, IN u32 dwNum);
926 - * ======== CSL_Strtok ========
928 - * Tokenize a NULL terminated string
930 - * ptstrSrc: pointer to string.
931 - * szSeparators: pointer to a string of seperators
936 - * ptstrSrc is a valid string pointer.
937 - * szSeparators is a valid string pointer.
940 - extern char *CSL_Strtok(IN char *ptstrSrc,
941 - IN CONST char *szSeparators);
944 - * ======== CSL_Strtokr ========
946 - * Re-entrant version of strtok.
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
953 - * char * (the token)
956 - * szSeparators != NULL
960 - extern char *CSL_Strtokr(IN char *pstrSrc,
961 - IN CONST char *szSeparators,
962 - OUT char **ppstrCur);
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
970 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
972 + * "Design by Contract" programming macros.
975 + * Requires that the GT->ERROR function has been defaulted to a valid
976 + * error handler for the given execution environment.
978 + * Does not require that GT_init() be called.
980 * Copyright (C) 2008 Texas Instruments, Inc.
982 * This package is free software; you can redistribute it and/or modify
984 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
988 - * ======== dbc.h ========
990 - * "Design by Contract" programming macros.
992 - * Public Functions:
998 - * Requires that the GT->ERROR function has been defaulted to a valid
999 - * error handler for the given execution environment.
1001 - * Does not require that GT_init() be called.
1003 - *! Revision History:
1004 - *! ================
1005 - *! 11-Aug-2000 ag: Removed include <dspbridge/std.h>
1006 - *! 22-Apr-1996 gp: Created.
1014 #include <dspbridge/gt.h>
1016 -#define DBC_Assert(exp) \
1018 - printk("%s, line %d: Assertion (" #exp ") failed.\n", \
1019 - __FILE__, __LINE__)
1020 +#define DBC_Assert(exp) \
1023 + pr_err("%s, line %d: Assertion (" #exp ") failed.\n", \
1024 + __FILE__, __LINE__); \
1026 #define DBC_Require DBC_Assert /* Function Precondition. */
1027 #define DBC_Ensure DBC_Assert /* Function Postcondition. */
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
1034 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1036 + * Defines the DSP/BIOS Bridge Configuration Database (DCD) API.
1038 * Copyright (C) 2008 Texas Instruments, Inc.
1040 * This package is free software; you can redistribute it and/or modify
1042 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1046 - * ======== dbdcd.h ========
1048 - * Defines the DSP/BIOS Bridge Configuration Database (DCD) API.
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.
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
1077 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1079 + * DCD (DSP/BIOS Bridge Configuration Database) constants and types.
1081 * Copyright (C) 2008 Texas Instruments, Inc.
1083 * This package is free software; you can redistribute it and/or modify
1085 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1090 - * ======== dbdcddef.h ========
1092 - * DCD (DSP/BIOS Bridge Configuration Database) constants and types.
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.
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
1121 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1123 + * Global definitions and constants for DSP/BIOS Bridge.
1125 * Copyright (C) 2005-2006 Texas Instruments, Inc.
1127 * This package is free software; you can redistribute it and/or modify
1129 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1133 - * ======== dbdefs.h ========
1135 - * Global definitions and constants for DSP/BIOS Bridge.
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
1186 #include <linux/types.h>
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 */
1195 #define PG_SIZE_4K 4096
1196 #define PG_MASK(pg_size) (~((pg_size)-1))
1197 @@ -155,17 +106,12 @@
1199 #define MAX_PROFILES 16
1201 +/* DSP chip type */
1202 +#define DSPTYPE_64 0x99
1204 /* Types defined for 'Bridge API */
1205 typedef u32 DSP_STATUS; /* API return code type */
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 */
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 */
1216 #define IsValidProcEvent(x) (((x) == 0) || (((x) & (DSP_PROCESSORSTATECHANGE | \
1217 DSP_PROCESSORATTACH | \
1220 DSP_DCDCREATELIBTYPE,
1221 DSP_DCDEXECUTELIBTYPE,
1222 - DSP_DCDDELETELIBTYPE
1223 + DSP_DCDDELETELIBTYPE,
1224 + /* DSP_DCDMAXOBJTYPE is meant to be the last DCD object type */
1228 /* Processor states */
1231 enum DSP_CONNECTTYPE lType;
1232 u32 uThisNodeStreamIndex;
1233 - DSP_HNODE hConnectedNode;
1234 + void *hConnectedNode;
1235 struct DSP_UUID uiConnectedNodeID;
1236 u32 uConnectedNodeStreamIndex;
1239 struct DSP_NDBPROPS nbNodeDatabaseProps;
1240 u32 uExecutionPriority;
1241 enum NODE_STATE nsExecutionState;
1242 - DSP_HNODE hDeviceOwner;
1243 + void *hDeviceOwner;
1245 struct DSP_STREAMCONNECT scStreamConnection[16];
1247 @@ -450,26 +398,19 @@
1259 * The DSP_PROCESSORINFO structure describes basic capabilities of a
1262 struct DSP_PROCESSORINFO {
1264 - DSP_PROCFAMILY uProcessorFamily;
1265 - DSP_PROCTYPE uProcessorType;
1266 + long uProcessorFamily;
1267 + long uProcessorType;
1269 u32 ulInternalMemSize;
1270 u32 ulExternalMemSize;
1272 - DSP_RTOSTYPE tyRunningRTOS;
1273 + long tyRunningRTOS;
1274 s32 nNodeMinPriority;
1275 s32 nNodeMaxPriority;
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
1283 + * Definitions from dbreg.h
1286 +#define DSPPROCTYPE_C64 6410
1287 +#define IVAPROCTYPE_ARM7 470
1289 +#define REG_MGR_OBJECT 1
1290 +#define REG_DRV_OBJECT 2
1293 +#define DRVOBJECT "DrvObject"
1294 +#define MGROBJECT "MgrObject"
1296 +/* Max registry path length. Also the max registry value length. */
1297 +#define MAXREGPATHLENGTH 255
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 */
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
1313 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1315 + * Provide debugging services for Bridge Mini Drivers.
1317 * Copyright (C) 2008 Texas Instruments, Inc.
1319 * This package is free software; you can redistribute it and/or modify
1321 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1325 - * ======== dbg.h ========
1327 - * Provide debugging services for 'Bridge Mini Drivers.
1329 - * Public Functions:
1336 - * WMD's must not call DBG_Init or DBG_Exit.
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.
1349 #include <dspbridge/host_os.h>
1351 #define DBG_LEVEL6 (u8)(0x40) /* Warn SERVICES Failures */
1352 #define DBG_LEVEL7 (u8)(0x80) /* Warn Critical Errors */
1354 -#if (defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
1355 +#if (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
1358 * ======== DBG_Exit ========
1360 #define DBG_Init(void) true
1361 #define DBG_Trace(bLevel, pstrFormat, args...) do {} while (0)
1363 -#endif /* (defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE */
1364 +#endif /* (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE */
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
1374 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1376 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
1389 - * ======== dbl.h ========
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.
1404 -#include <dspbridge/dbdefs.h>
1405 -#include <dspbridge/dbldefs.h>
1408 - * ======== DBL_close ========
1409 - * Close library opened with DBL_open.
1411 - * lib - Handle returned from DBL_open().
1414 - * DBL initialized.
1418 - extern void DBL_close(struct DBL_LibraryObj *lib);
1421 - * ======== DBL_create ========
1422 - * Create a target object by specifying the alloc, free, and write
1423 - * functions for the target.
1425 - * pTarget - Location to store target handle on output.
1426 - * pAttrs - Attributes.
1428 - * DSP_SOK: Success.
1429 - * DSP_EMEMORY: Memory allocation failed.
1431 - * DBL initialized.
1433 - * pTarget != NULL;
1435 - * Success: *pTarget != NULL.
1436 - * Failure: *pTarget == NULL.
1438 - extern DSP_STATUS DBL_create(struct DBL_TargetObj **pTarget,
1439 - struct DBL_Attrs *pAttrs);
1442 - * ======== DBL_delete ========
1443 - * Delete target object and free resources for any loaded libraries.
1445 - * target - Handle returned from DBL_Create().
1448 - * DBL initialized.
1452 - extern void DBL_delete(struct DBL_TargetObj *target);
1455 - * ======== DBL_exit ========
1456 - * Discontinue use of DBL module.
1464 - extern void DBL_exit(void);
1467 - * ======== DBL_getAddr ========
1468 - * Get address of name in the specified library.
1470 - * lib - Handle returned from DBL_open().
1471 - * name - Name of symbol
1472 - * ppSym - Location to store symbol address on output.
1475 - * FALSE: Symbol not found.
1477 - * DBL initialized.
1483 - extern bool DBL_getAddr(struct DBL_LibraryObj *lib, char *name,
1484 - struct DBL_Symbol **ppSym);
1487 - * ======== DBL_getAttrs ========
1488 - * Retrieve the attributes of the target.
1490 - * target - Handle returned from DBL_Create().
1491 - * pAttrs - Location to store attributes on output.
1494 - * DBL initialized.
1499 - extern void DBL_getAttrs(struct DBL_TargetObj *target,
1500 - struct DBL_Attrs *pAttrs);
1503 - * ======== DBL_getCAddr ========
1504 - * Get address of "C" name in the specified library.
1506 - * lib - Handle returned from DBL_open().
1507 - * name - Name of symbol
1508 - * ppSym - Location to store symbol address on output.
1511 - * FALSE: Symbol not found.
1513 - * DBL initialized.
1519 - extern bool DBL_getCAddr(struct DBL_LibraryObj *lib, char *name,
1520 - struct DBL_Symbol **ppSym);
1523 - * ======== DBL_getEntry ========
1524 - * Get program entry point.
1527 - * lib - Handle returned from DBL_open().
1528 - * pEntry - Location to store entry address on output.
1533 - * DBL initialized.
1538 - extern bool DBL_getEntry(struct DBL_LibraryObj *lib, u32 *pEntry);
1541 - * ======== DBL_getSect ========
1542 - * Get address and size of a named section.
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.
1549 - * DSP_SOK: Success.
1550 - * DSP_ENOSECT: Section not found.
1552 - * DBL initialized.
1559 - extern DSP_STATUS DBL_getSect(struct DBL_LibraryObj *lib, char *name,
1560 - u32 *pAddr, u32 *pSize);
1563 - * ======== DBL_init ========
1564 - * Initialize DBL module.
1572 - * Success: cRefs > 0.
1573 - * Failure: cRefs >= 0.
1575 - extern bool DBL_init(void);
1578 - * ======== DBL_load ========
1579 - * Add symbols/code/data defined in file to that already present on
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.
1588 - * DSP_SOK: Success.
1589 - * DSP_EFREAD: File read failed.
1590 - * DSP_EFWRITE: Write to target failed.
1592 - * DBL initialized.
1597 - extern DSP_STATUS DBL_load(struct DBL_LibraryObj *lib, DBL_Flags flags,
1598 - struct DBL_Attrs *attrs, u32 *pEntry);
1601 - * ======== DBL_loadSect ========
1602 - * Load a named section from an library (for overlay support).
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.
1608 - * DSP_SOK: Success.
1609 - * DSP_ENOSECT: Section not found.
1610 - * DSP_EFWRITE: Write function failed.
1613 - * sectName != NULL.
1615 - * attrs->write != NULL.
1618 - extern DSP_STATUS DBL_loadSect(struct DBL_LibraryObj *lib,
1620 - struct DBL_Attrs *attrs);
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().
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.
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.
1638 - * DBL initialized.
1642 - * struct DBL_Attrs fopen function non-NULL.
1644 - * Success: Valid *pLib.
1645 - * Failure: *pLib == NULL.
1647 - extern DSP_STATUS DBL_open(struct DBL_TargetObj *target, char *file,
1649 - struct DBL_LibraryObj **pLib);
1652 - * ======== DBL_readSect ========
1653 - * Read COFF section into a character buffer.
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
1660 - * DSP_SOK: Success.
1661 - * DSP_ENOSECT: Named section does not exists.
1663 - * DBL initialized.
1670 - extern DSP_STATUS DBL_readSect(struct DBL_LibraryObj *lib, char *name,
1671 - char *pBuf, u32 size);
1674 - * ======== DBL_setAttrs ========
1675 - * Set the attributes of the target.
1677 - * target - Handle returned from DBL_create().
1678 - * pAttrs - New attributes.
1681 - * DBL initialized.
1686 - extern void DBL_setAttrs(struct DBL_TargetObj *target,
1687 - struct DBL_Attrs *pAttrs);
1690 - * ======== DBL_unload ========
1691 - * Remove the symbols/code/data corresponding to the library lib.
1693 - * lib - Handle returned from DBL_open().
1694 - * attrs - Contains free() function and handle to pass to it.
1697 - * DBL initialized.
1701 - extern void DBL_unload(struct DBL_LibraryObj *lib,
1702 - struct DBL_Attrs *attrs);
1705 - * ======== DBL_unloadSect ========
1706 - * Unload a named section from an library (for overlay support).
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.
1712 - * DSP_SOK: Success.
1713 - * DSP_ENOSECT: Named section not found.
1715 - * DBL initialized.
1717 - * sectName != NULL.
1720 - extern DSP_STATUS DBL_unloadSect(struct DBL_LibraryObj *lib,
1722 - struct DBL_Attrs *attrs);
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
1729 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1734 - * ======== dbldefs.h ========
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.
1747 #define DBL_MAXPATHLENGTH 255
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
1759 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1761 + * DSP/BIOS Bridge Dynamic load library module interface. Function header
1762 + * comments are in the file dblldefs.h.
1764 * Copyright (C) 2005-2006 Texas Instruments, Inc.
1766 * This package is free software; you can redistribute it and/or modify
1768 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1773 - * ======== dbll.h ========
1774 - * DSP/BIOS Bridge Dynamic load library module interface. Function header
1775 - * comments are in the file dblldefs.h.
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.
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
1790 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1795 - * ======== dblldefs.h ========
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.
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
1814 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1816 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
1829 - * ======== dbof.h ========
1831 - * Defines and typedefs for DSP/BIOS Bridge Object File Format (DBOF).
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.
1844 -/* Enough to hold DCD section names: 32 digit ID + underscores */
1845 -#define DBOF_DCDSECTNAMELEN 40
1847 -/* Values for DBOF_SectHdr page field. */
1848 -#define DBOF_PROGRAM 0
1849 -#define DBOF_DATA 1
1850 -#define DBOF_CINIT 2
1853 - * ======== DBOF_FileHdr ========
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 */
1871 - * ======== DBOF_DCDSectHdr ========
1873 - struct DBOF_DCDSectHdr {
1874 - u32 size; /* Sect size (target MAUs) */
1875 - char name[DBOF_DCDSECTNAMELEN]; /* DCD section name */
1879 - * ======== DBOF_OvlySectHdr ========
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 */
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.
1892 - u16 numOtherSects;
1893 - u16 resvd; /* Reserved for future use */
1897 - * ======== DBOF_OvlySectData ========
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 */
1908 - * ======== DBOF_SectHdr ========
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 */
1918 - * ======== DBOF_SymbolHdr ========
1920 - struct DBOF_SymbolHdr {
1921 - u32 value; /* Symbol value */
1922 - u16 nameLen; /* Length of symbol name */
1923 - u16 resvd; /* Reserved for future use */
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
1935 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
1937 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
1950 - * ======== dbreg.h ========
1952 - * Registry keys for use in Linux. This is the clearinghouse for
1953 - * registry definitions, hopefully eliminating overlapping between
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.
1991 -#define DBREG_ 1 /* Defined as "1" so InstallShield programs compile. */
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 */
2002 -#define DSPPROCTYPE_C55 5510
2003 -#define DSPPROCTYPE_C64 6410
2004 -#define IVAPROCTYPE_ARM7 470
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 */
2015 -/* MiniDriver related definitions */
2016 -/* The following definitions are under "Drivers\\DirectDSP\\Device\\XXX "
2017 - * Where XXX is the device or board name */
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 */
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
2050 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
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
2056 * Copyright (C) 2008 Texas Instruments, Inc.
2058 * This package is free software; you can redistribute it and/or modify
2060 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2064 - * ======== dbtype.h ========
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.
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.
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
2088 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2090 + * Definition for mini-driver module DEH.
2092 * Copyright (C) 2005-2006 Texas Instruments, Inc.
2094 * This package is free software; you can redistribute it and/or modify
2096 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2100 - * ======== dehdefs.h ========
2102 - * Definition for mini-driver module DEH.
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.
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
2119 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2121 + * Bridge Mini-driver device operations.
2123 * Copyright (C) 2005-2006 Texas Instruments, Inc.
2125 * This package is free software; you can redistribute it and/or modify
2127 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2132 - * ======== dev.h ========
2134 - * 'Bridge Mini-driver device operations.
2136 - * Public Functions:
2138 - * DEV_CreateDevice
2141 - * DEV_DestroyDevice
2147 - * DEV_GetDSPWordSize
2153 - * DEV_GetNodeManager
2155 - * DEV_GetWMDContext
2158 - * DEV_InsertProcObject
2160 - * DEV_NotifyClient
2161 - * DEV_RegisterNotify
2162 - * DEV_ReleaseCodMgr
2163 - * DEV_RemoveDevice
2164 - * DEV_RemoveProcObject
2167 - * DEV_SetLockOwner
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.
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
2200 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2202 + * Definition of common include typedef between wmd.h and dev.h. Required
2203 + * to break circular dependency between WMD and DEV include files.
2205 * Copyright (C) 2008 Texas Instruments, Inc.
2207 * This package is free software; you can redistribute it and/or modify
2209 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2213 - * ======== devdefs.h ========
2215 - * Definition of common include typedef between wmd.h and dev.h. Required
2216 - * to break circular dependency between WMD and DEV include files.
2218 - *! Revision History:
2219 - *! ================
2220 - *! 12-Nov-1996 gp: Renamed from dev1.h.
2221 - *! 30-May-1996 gp: Broke out from dev.h
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
2232 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2234 + * DSP/BIOS Bridge Node Dispatcher.
2236 * Copyright (C) 2005-2006 Texas Instruments, Inc.
2238 * This package is free software; you can redistribute it and/or modify
2240 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2245 - * ======== disp.h ========
2248 - * DSP/BIOS Bridge Node Dispatcher.
2250 - * Public Functions:
2255 - * DISP_NodeChangePriority
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.
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
2280 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2282 + * Global DISP constants and types, shared by PROCESSOR, NODE, and DISP.
2284 * Copyright (C) 2005-2006 Texas Instruments, Inc.
2286 * This package is free software; you can redistribute it and/or modify
2288 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2293 - * ======== dispdefs.h ========
2295 - * Global DISP constants and types, shared by PROCESSOR, NODE, and DISP.
2297 - *! Revision History
2298 - *! ================
2299 - *! 08-Aug-2000 jeh Added fields to DISP_ATTRS.
2300 - *! 06-Jul-2000 jeh Created.
2307 u32 ulChnlOffset; /* Offset of channel ids reserved for RMS */
2308 /* Size of buffer for sending data to RMS */
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. */
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
2322 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
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.
2327 * Copyright (C) 2005-2006 Texas Instruments, Inc.
2329 * This package is free software; you can redistribute it and/or modify
2331 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2336 - * ======== dmm.h ========
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
2341 - * Public Functions:
2343 - *! Revision History:
2344 - *! ================
2345 - *! 20-Feb-2004 sb: Created.
2353 * This is typically called from the client process.
2356 - extern DSP_STATUS DMM_GetHandle(DSP_HPROCESSOR hProcessor,
2357 + extern DSP_STATUS DMM_GetHandle(void *hProcessor,
2358 OUT struct DMM_OBJECT **phDmmMgr);
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
2368 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2370 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
2383 - * ======== dpc.h ========
2385 - * Deferred Procedure Call(DPC) Services.
2387 - * Public Functions:
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.
2408 - struct DPC_OBJECT;
2411 - * ======== DPC_PROC ========
2413 - * Deferred processing routine. Typically scheduled from an ISR to
2414 - * complete I/O processing.
2416 - * pRefData: Ptr to user data: passed in via ISR_ScheduleDPC.
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.
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.
2427 - typedef void(*DPC_PROC) (void *pRefData);
2430 - * ======== DPC_Cancel ========
2432 - * Cancel a DPC previously scheduled by DPC_Schedule.
2434 - * hDPC: A DPC object handle created in DPC_Create().
2436 - * DSP_SOK: Scheduled DPC, if any, is cancelled.
2437 - * DSP_SFALSE: No DPC is currently scheduled for execution.
2438 - * DSP_EHANDLE: Invalid hDPC.
2441 - * If the DPC has already executed, is executing, or was not yet
2442 - * scheduled, this function will have no effect.
2444 - extern DSP_STATUS DPC_Cancel(IN struct DPC_OBJECT *hDPC);
2447 - * ======== DPC_Create ========
2449 - * Create a DPC object, allowing a client's own DPC procedure to be
2450 - * scheduled for a call with client reference data.
2452 - * phDPC: Pointer to location to store DPC object.
2453 - * pfnDPC: Client's DPC procedure.
2454 - * pRefData: Pointer to user-defined reference data.
2456 - * DSP_SOK: DPC object created.
2457 - * DSP_EPOINTER: phDPC == NULL or pfnDPC == NULL.
2458 - * DSP_EMEMORY: Insufficient memory.
2460 - * Must not be called at interrupt time.
2462 - * DSP_SOK: DPC object is created;
2463 - * else: *phDPC is set to NULL.
2465 - extern DSP_STATUS DPC_Create(OUT struct DPC_OBJECT **phDPC,
2466 - IN DPC_PROC pfnDPC,
2467 - IN void *pRefData);
2470 - * ======== DPC_Destroy ========
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.
2476 - * hDPC: A DPC object handle created in DPC_Create().
2478 - * DSP_SOK: Success.
2479 - * DSP_EHANDLE: Invalid hDPC.
2481 - * All DPC's scheduled for the DPC object must have completed their
2484 - * (SUCCESS && hDPC is NULL) or DSP_EFAILED status
2486 - extern DSP_STATUS DPC_Destroy(IN struct DPC_OBJECT *hDPC);
2489 - * ======== DPC_Exit ========
2491 - * Discontinue usage of the DPC module.
2495 - * DPC_Init(void) was previously called.
2497 - * Resources acquired in DPC_Init(void) are freed.
2499 - extern void DPC_Exit(void);
2502 - * ======== DPC_Init ========
2504 - * Initialize the DPC module's private state.
2507 - * TRUE if initialized; FALSE if error occured.
2510 - * A requirement for each of the other public DPC functions.
2512 - extern bool DPC_Init(void);
2515 - * ======== DPC_Schedule ========
2517 - * Schedule a deferred procedure call to be executed at a later time.
2518 - * Latency and order of DPC execution is platform specific.
2520 - * hDPC: A DPC object handle created in DPC_Create().
2522 - * DSP_SOK: An event is scheduled for deferred processing.
2523 - * DSP_EHANDLE: Invalid hDPC.
2525 - * See requirements for DPC_PROC.
2527 - * DSP_SOK: The DPC will not be called before this function returns.
2529 - extern DSP_STATUS DPC_Schedule(IN struct DPC_OBJECT *hDPC);
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
2537 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2539 + * DRV Resource allocation module. Driver Object gets Created
2540 + * at the time of Loading. It holds the List of Device Objects
2543 * Copyright (C) 2005-2006 Texas Instruments, Inc.
2545 * This package is free software; you can redistribute it and/or modify
2547 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2552 - * ======== drv.h ========
2554 - * DRV Resource allocation module. Driver Object gets Created
2555 - * at the time of Loading. It holds the List of Device Objects
2558 - * Public Functions:
2562 - * DRV_GetDevObject
2563 - * DRV_GetDevExtension
2564 - * DRV_GetFirstDevObject
2565 - * DRV_GetNextDevObject
2566 - * DRV_GetNextDevExtension
2568 - * DRV_InsertDevObject
2569 - * DRV_RemoveDevObject
2570 - * DRV_RequestResources
2571 - * DRV_ReleaseResources
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.
2590 - *! 24-Sep-1999 rr: Added DRV_EXTENSION and DSP_DRIVER structures.
2597 @@ -118,13 +78,12 @@
2598 #define OMAP_PRCM_VDD1_DOMAIN 1
2599 #define OMAP_PRCM_VDD2_DOMAIN 2
2601 -#ifndef RES_CLEANUP_DISABLE
2603 /* GPP PROCESS CLEANUP Data structures */
2605 /* New structure (member of process context) abstracts NODE resource info */
2606 struct NODE_RES_OBJECT {
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;
2620 struct STRM_RES_OBJECT *next;
2621 @@ -173,31 +132,25 @@ struct PROCESS_CONTEXT{
2623 enum GPP_PROC_RES_STATE resState;
2625 - /* Process ID (Same as UNIX process ID) */
2628 - /* Pointer to next process context
2629 - * (To maintain a linked list of process contexts) */
2630 - struct PROCESS_CONTEXT *next;
2632 - /* List of Processors */
2633 - struct list_head processor_list;
2634 - spinlock_t proc_list_lock;
2635 + /* Handle to Processor */
2638 /* DSP Node resources */
2639 struct NODE_RES_OBJECT *pNodeList;
2640 + struct mutex node_mutex;
2643 struct DMM_RES_OBJECT *pDMMList;
2644 - spinlock_t dmm_list_lock;
2645 + struct mutex dmm_mutex;
2647 /* DSP Heap resources */
2648 struct DSPHEAP_RES_OBJECT *pDSPHEAPList;
2650 /* Stream resources */
2651 struct STRM_RES_OBJECT *pSTRMList;
2652 + struct mutex strm_mutex;
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
2664 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2666 + * Definition of common struct between wmd.h and drv.h.
2668 * Copyright (C) 2005-2006 Texas Instruments, Inc.
2670 * This package is free software; you can redistribute it and/or modify
2672 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2677 - * ======== drvdefs.h ========
2679 - * Definition of common include typedef between wmd.h and drv.h.
2681 - *! Revision History:
2682 - *! ================
2683 - *! 17-Jul-2000 rr: Created
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
2694 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2696 + * This is the Stream Interface for the DDSP Class driver.
2697 + * All Device operations are performed via DeviceIOControl.
2699 * Copyright (C) 2005-2006 Texas Instruments, Inc.
2701 * This package is free software; you can redistribute it and/or modify
2703 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2708 - * ======== dspdrv.h ========
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.
2714 - * Public Functions
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.
2736 #if !defined __DSPDRV_h__
2737 #define __DSPDRV_h__
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
2743 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
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
2756 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2758 + * Central repository for DSP/BIOS Bridge error and status code.
2760 + * Error codes are of the form:
2761 + * [<MODULE>]_E<ERRORCODE>
2763 + * Success codes are of the form:
2764 + * [<MODULE>]_S<SUCCESSCODE>
2766 * Copyright (C) 2008 Texas Instruments, Inc.
2768 * This package is free software; you can redistribute it and/or modify
2770 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2774 - * ======== errbase.h ========
2776 - * Central repository for DSP/BIOS Bridge error and status code.
2778 - * Error codes are of the form:
2779 - * [<MODULE>]_E<ERRORCODE>
2781 - * Success codes are of the form:
2782 - * [<MODULE>]_S<SUCCESSCODE>
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
2799 - *! 10-May-1996 gp: Created.
2805 @@ -324,21 +303,6 @@
2806 /* Insufficient buffer size */
2807 #define CFG_E_INSUFFICIENTBUFSIZE (CFG_EBASE + 0x05)
2809 -/* FAILURE Codes : BRD */
2810 -#define BRD_EBASE (DSP_COMP_EBASE + 0x300)
2812 -/* Board client does not have sufficient access rights for this operation. */
2813 -#define BRD_E_ACCESSDENIED (BRD_EBASE + 0x00)
2815 -/* Unable to find trace buffer symbols in the DSP executable COFF file. */
2816 -#define BRD_E_NOTRACEBUFFER (BRD_EBASE + 0x01)
2818 -/* Attempted to auto-start board, but no default DSP executable configured. */
2819 -#define BRD_E_NOEXEC (BRD_EBASE + 0x02)
2821 -/* The operation failed because it was started from a wrong state */
2822 -#define BRD_E_WRONGSTATE (BRD_EBASE + 0x03)
2824 /* FAILURE Codes : COD */
2825 #define COD_EBASE (DSP_COMP_EBASE + 0x400)
2827 @@ -479,31 +443,4 @@
2828 /* Insufficient space to hold data in registry value. */
2829 #define REG_E_MOREDATA (REG_EBASE + 0x03)
2831 -/* FAILURE Codes : KFILE */
2832 -#define KFILE_EBASE (DSP_COMP_EBASE + 0x900)
2834 -/* Invalid file handle. */
2835 -#define E_KFILE_INVALIDHANDLE (KFILE_EBASE + 0x01)
2837 -/* Bad file name. */
2838 -#define E_KFILE_BADFILENAME (KFILE_EBASE + 0x02)
2840 -/* Invalid file mode. */
2841 -#define E_KFILE_INVALIDMODE (KFILE_EBASE + 0x03)
2843 -/* No resources available. */
2844 -#define E_KFILE_NORESOURCES (KFILE_EBASE + 0x04)
2846 -/* Invalid file buffer . */
2847 -#define E_KFILE_INVALIDBUFFER (KFILE_EBASE + 0x05)
2849 -/* Bad origin argument. */
2850 -#define E_KFILE_BADORIGINFLAG (KFILE_EBASE + 0x06)
2852 -/* Invalid file offset value. */
2853 -#define E_KFILE_INVALIDOFFSET (KFILE_EBASE + 0x07)
2855 -/* General KFILE error condition */
2856 -#define E_KFILE_ERROR (KFILE_EBASE + 0x08)
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
2864 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
2866 + * Generic bitmap manager.
2868 * Copyright (C) 2005-2006 Texas Instruments, Inc.
2870 * This package is free software; you can redistribute it and/or modify
2872 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2876 - * ======== gb.h ========
2877 - * Generic bitmap manager.
2879 - *! Revision History
2880 - *! ================
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
2891 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
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
2898 + * Functions in this API assume that the supplied Dynamic_Loader_Stream
2899 + * object supports the set_file_posn method.
2901 * Copyright (C) 2008 Texas Instruments, Inc.
2903 * This package is free software; you can redistribute it and/or modify
2905 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2909 #ifndef _GETSECTION_H_
2910 #define _GETSECTION_H_
2913 #include "dynamic_loader.h"
2916 - * Get Section Information
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
2923 - * Functions in this API assume that the supplied Dynamic_Loader_Stream object
2924 - * supports the set_file_posn method.
2927 /* opaque handle for module information */
2928 typedef void *DLOAD_module_info;
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
2934 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2939 - * ======== gh.h ========
2941 - *! Revision History
2942 - *! ================
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
2953 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
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
2960 * Copyright (C) 2005-2006 Texas Instruments, Inc.
2962 * This package is free software; you can redistribute it and/or modify
2964 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
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
2973 - *! Revision History
2974 - *! ================
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
2984 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2989 - * ======== gt.h ========
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).
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).
3014 #include <linux/types.h>
3017 @@ -241,7 +232,7 @@ extern struct GT_Config _GT_params;
3019 #define GT_assert(mask, expr) \
3021 - printk("assertion violation: %s, line %d\n", \
3022 + pr_err("assertion violation: %s, line %d\n", \
3023 __FILE__, __LINE__), NULL : NULL)
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
3030 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3035 - * ======== windows.h ========
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
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
3060 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3062 + * The io module manages IO between CHNL and MSG.
3064 * Copyright (C) 2005-2006 Texas Instruments, Inc.
3066 * This package is free software; you can redistribute it and/or modify
3068 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3073 - * ======== io.h ========
3075 - * The io module manages IO between CHNL and MSG.
3077 - * Public Functions:
3085 - *! Revision History:
3086 - *! ================
3087 - *! 07-Nov-2000 jeh Created.
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
3098 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3100 + * IO dispatcher for a shared memory channel driver.
3101 + * Also, includes macros to simulate SHM via port io calls.
3103 * Copyright (C) 2005-2006 Texas Instruments, Inc.
3105 * This package is free software; you can redistribute it and/or modify
3107 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3112 - * ======== io_sm.h ========
3114 - * IO dispatcher for a shared memory channel driver.
3115 - * Also, includes macros to simulate SHM via port io calls.
3117 - * Public Functions:
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.
3150 * Non-preemptible (but interruptible).
3152 - extern void IO_DPC(IN OUT void *pRefData);
3153 + extern void IO_DPC(IN OUT unsigned long pRefData);
3156 * ======== IO_ISR ========
3161 - extern DSP_STATUS IO_SHMsetting(IN struct IO_MGR *hIOMgr,
3162 - IN enum SHM_DESCTYPE desc,
3164 + extern DSP_STATUS IO_SHMsetting(struct IO_MGR *hIOMgr,
3165 + u8 desc, void *pArgs);
3168 * Misc functions for the CHNL_IO shared memory library:
3169 @@ -323,13 +290,13 @@
3171 extern void IO_IntrDSP2(IN struct IO_MGR *pIOMgr, IN u16 wMbVal);
3173 - extern void IO_SM_init(void);
3174 + extern void IO_SM_init(void);
3177 * ========PrintDspTraceBuffer ========
3178 * Print DSP tracebuffer.
3180 - extern DSP_STATUS PrintDspTraceBuffer(struct WMD_DEV_CONTEXT
3182 + extern DSP_STATUS PrintDspTraceBuffer(struct WMD_DEV_CONTEXT
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
3191 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3193 + * System-wide channel objects and constants.
3195 * Copyright (C) 2005-2006 Texas Instruments, Inc.
3197 * This package is free software; you can redistribute it and/or modify
3199 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3204 - * ======== iodefs.h ========
3206 - * System-wide channel objects and constants.
3208 - *! Revision History:
3209 - *! ================
3210 - *! 07-Nov-2000 jeh Created.
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
3223 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3225 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
3238 - * ======== kfile.h ========
3240 - * Provide file I/O management capabilities.
3242 - * Public Functions:
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.).
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.
3275 - * Constants for KFILE_Seek. Note that these MUST be the same definitions as
3276 - * those defined for fseek.
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 */
3282 - struct KFILE_FileObj;
3285 - * ======== KFILE_Close ========
3287 - * This function closes a file's stream.
3289 - * hFile: Handle of the file stream returned by KFILE_Open.
3291 - * E_KFILE_INVALIDHANDLE: bad handle.
3293 - * E_KFILE_ERROR: unable to close specified handle.
3295 - * KFILE initialized.
3298 - extern s32 KFILE_Close(IN struct KFILE_FileObj *hFile);
3301 - * ======== KFILE_Exit ========
3303 - * Discontinue usage of module; free resources when reference count
3308 - * KFILE initialized.
3310 - * Resources used by module are freed when cRef reaches zero.
3312 - extern void KFILE_Exit(void);
3315 - * ======== KFILE_Init ========
3317 - * Initializes private state of KFILE module.
3320 - * TRUE if success, else FALSE.
3323 - * KFILE initialized.
3325 - extern bool KFILE_Init(void);
3328 - * ======== KFILE_Open ========
3330 - * Opens a file for use.
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.
3337 - * A valid file handle if success, else NULL.
3339 - * - KFILE initialized.
3340 - * - pszMode != NULL.
3341 - * - pszFileName != NULL.
3344 - extern struct KFILE_FileObj *KFILE_Open(IN CONST char *filename,
3345 - IN CONST char *mode);
3348 - * ======== KFILE_Read ========
3350 - * This function reads a specified number of bytes into a buffer.
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.
3357 - * E_KFILE_INVALIDHANDLE: bad file handle.
3358 - * E_KFILE_ERROR: general failure.
3359 - * > 0: success; # of objects read from file.
3361 - * KFILE initialized.
3362 - * pBuffer is a valid pointer.
3365 - extern s32 KFILE_Read(OUT void __user*buffer,
3366 - IN s32 size, IN s32 count,
3367 - IN struct KFILE_FileObj *hFile);
3370 - * ======== KFILE_Seek ========
3372 - * This function sets the file position indicator. NOTE: we don't
3373 - * support seeking beyond the boundaries of a file.
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.
3383 - * E_KFILE_INVALIDHANDLE: bad handle.
3384 - * E_KFILE_BADORIGIN: invalid origin paramater.
3385 - * E_KFILE_ERROR: general failure.
3387 - * KFILE initialized.
3390 - extern s32 KFILE_Seek(IN struct KFILE_FileObj *hFile,
3391 - IN s32 offset, IN s32 origin);
3394 - * ======== KFILE_Tell ========
3396 - * This function reports the current value of the position indicator.
3398 - * hFile: Handle of the file stream returned by KFILE_Open.
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.
3405 - * KFILE initialized.
3408 - extern s32 KFILE_Tell(IN struct KFILE_FileObj *hFile);
3411 - * ======== KFILE_Write ========
3413 - * This function writes a number of objects to the stream.
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.
3420 - * E_KFILE_INVALIDHANDLE: bad file handle.
3421 - * E_KFILE_ERROR: general failure.
3422 - * > 0: success; # of objects written to file.
3424 - * KFILE initialized.
3425 - * pBuffer != NULL.
3427 - * The file position indicator is advanced by the number of
3428 - * characters written.
3430 - extern s32 KFILE_Write(OUT void *buffer,
3433 - IN struct KFILE_FileObj *hFile);
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
3441 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3443 + * Provide module loading services and symbol export services.
3446 + * This service is meant to be used by modules of the DSP/BIOS Bridge
3449 * Copyright (C) 2005-2006 Texas Instruments, Inc.
3451 * This package is free software; you can redistribute it and/or modify
3453 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3458 - * ======== ldr.h ========
3460 - * Provide module loading services and symbol export services.
3462 - * Public Functions:
3465 - * LDR_GetProcAddress
3470 - * This service is meant to be used by modules of the DSP/BIOS Bridge
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.
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
3492 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3494 + * Declarations of list management control structures and definitions
3495 + * of inline list management functions.
3497 * Copyright (C) 2008 Texas Instruments, Inc.
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.
3506 - * ======== list.h ========
3508 - * Declarations of list management control structures and definitions
3509 - * of inline list management functions.
3511 - * Public Functions:
3519 - * LST_InsertBefore
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").
3540 #include <dspbridge/host_os.h>
3541 +#include <linux/list.h>
3543 -#define LST_IsEmpty(l) (((l)->head.next == &(l)->head))
3544 +#define LST_IsEmpty(l) list_empty(&(l)->head)
3547 - struct LST_ELEM *next;
3548 - struct LST_ELEM *prev;
3549 - struct LST_ELEM *self;
3553 - struct LST_ELEM head;
3557 - * ======== LST_Create ========
3559 - * Allocates and initializes a circular list.
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.
3568 - * Pointer to beginning of created list (success)
3569 - * NULL --> Allocation failed
3571 - * LST initialized.
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).
3578 - extern struct LST_LIST *LST_Create(void);
3581 - * ======== LST_Delete ========
3583 - * Removes a list by freeing its control structure's memory space.
3585 - * Uses portable MEM_Free() function to deallocate the memory
3586 - * block pointed at by the input parameter.
3588 - * pList: Pointer to list control structure of list to be deleted
3592 - * - LST initialized.
3593 - * - pList != NULL.
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.
3600 - extern void LST_Delete(IN struct LST_LIST *pList);
3603 - * ======== LST_Exit ========
3605 - * Discontinue usage of module; free resources when reference count
3610 - * LST initialized.
3612 - * Resources used by module are freed when cRef reaches zero.
3614 - extern void LST_Exit(void);
3616 + struct list_head head;
3620 * ======== LST_First ========
3625 - extern struct LST_ELEM *LST_First(IN struct LST_LIST *pList);
3626 +static inline struct list_head *LST_First(struct LST_LIST *pList)
3628 + if (pList && !list_empty(&pList->head))
3629 + return pList->head.next;
3634 * ======== LST_GetHead ========
3636 * Pointer to element that was at the head of the list (success)
3637 * NULL No elements in list
3639 - * - head.self must be correctly set to &head.
3640 * - LST initialized.
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.
3647 - extern struct LST_ELEM *LST_GetHead(IN struct LST_LIST *pList);
3648 +static inline struct list_head *LST_GetHead(struct LST_LIST *pList)
3650 + struct list_head *pElem;
3652 + if (!pList || list_empty(&pList->head))
3655 + pElem = pList->head.next;
3656 + pList->head.next = pElem->next;
3657 + pElem->next->prev = &pList->head;
3660 - * ======== LST_Init ========
3662 - * Initializes private state of LST module.
3665 - * TRUE if initialized; FALSE otherwise.
3668 - * LST initialized.
3670 - extern bool LST_Init(void);
3675 * ======== LST_InitElem ========
3676 @@ -200,7 +108,13 @@
3677 * of a list chain -- that would break the chain.
3680 - extern void LST_InitElem(IN struct LST_ELEM *pListElem);
3681 +static inline void LST_InitElem(struct list_head *pElem)
3684 + pElem->next = NULL;
3685 + pElem->prev = NULL;
3690 * ======== LST_InsertBefore ========
3691 @@ -218,9 +132,13 @@
3692 * - pElemExisting != NULL.
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)
3702 + if (pList && pElem && pElemExisting)
3703 + list_add_tail(pElem, pElemExisting);
3707 * ======== LST_Next ========
3708 @@ -238,8 +156,14 @@
3709 * - pCurElem != NULL.
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)
3717 + if (pList && !list_empty(&pList->head) && pCurElem &&
3718 + (pCurElem->next != &pList->head))
3719 + return pCurElem->next;
3724 * ======== LST_PutTail ========
3725 @@ -262,18 +186,18 @@
3728 * *pElem and *pList must both exist.
3729 - * pElem->self = pElem before pElem is passed to this function.
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.
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)
3743 + if (pList && pElem)
3744 + list_add_tail(pElem, &pList->head);
3748 * ======== LST_RemoveElem ========
3749 @@ -290,7 +214,11 @@
3750 * - pCurElem != NULL.
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)
3758 + if (pList && !list_empty(&pList->head) && pCurElem)
3759 + list_del_init(pCurElem);
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
3768 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3770 + * Definitions for shared mailbox cmd/data values.(used on both
3771 + * the GPP and DSP sides).
3773 * Copyright (C) 2008 Texas Instruments, Inc.
3775 * This package is free software; you can redistribute it and/or modify
3777 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3782 - * ======== mbx_sh.h ========
3783 - * Definitions for shared mailbox cmd/data values.(used on both
3784 - * the GPP and DSP sides).
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.
3792 * Note: Only 16 bits of each is used. Other 16 bit data reg available.
3795 * | (class) | (module specific) |
3799 * B: DSP-DMA link driver channels (DDMA) : class = 1.
3803 * c -> channel Id (32 DDMA chnls max)
3808 * C: Proc-copy link driver channels (PCPY) : class = 2.
3811 @@ -110,16 +105,6 @@
3812 * where x -> not used
3813 * c -> Power management command
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.
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
3833 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3835 + * Memory management and address mapping services for the DSP/BIOS Bridge
3836 + * class driver and mini-driver.
3838 * Copyright (C) 2008 Texas Instruments, Inc.
3840 * This package is free software; you can redistribute it and/or modify
3842 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3847 - * ======== mem.h ========
3849 - * Memory management and address mapping services for the DSP/BIOS Bridge
3850 - * class driver and mini-driver.
3852 - * Public Functions:
3855 - * MEM_AllocPhysMem
3864 - * MEM_IsValidHandle
3865 - * MEM_LinearAddress
3868 - * MEM_UnMapLinearAddress
3869 - * MEM_VirtualToPhysical
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.
3899 @@ -108,13 +60,13 @@
3901 * A subsequent call to MEM_IsValidHandle() will succeed for this object.
3903 -#define MEM_AllocObject(pObj, Obj, Signature) \
3905 - pObj = MEM_Calloc(sizeof(Obj), MEM_NONPAGED); \
3907 - pObj->dwSignature = Signature; \
3910 +#define MEM_AllocObject(pObj, Obj, Signature) \
3912 + pObj = MEM_Calloc(sizeof(Obj), MEM_NONPAGED); \
3914 + pObj->dwSignature = Signature; \
3918 /* ======== MEM_AllocPhysMem ========
3920 @@ -252,11 +204,11 @@
3922 * A subsequent call to MEM_IsValidHandle() will fail for this object.
3924 -#define MEM_FreeObject(pObj) \
3926 - pObj->dwSignature = 0x00; \
3929 +#define MEM_FreeObject(pObj) \
3931 + pObj->dwSignature = 0x00; \
3936 * ======== MEM_GetNumPages ========
3938 extern void MEM_ExtPhysPoolInit(IN u32 poolPhysBase,
3942 + * ======== MEM_ExtPhysPoolRelease ========
3944 + extern void MEM_ExtPhysPoolRelease(void);
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
3952 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3954 + * Global MEM constants and types, shared between WCD and WMD.
3956 * Copyright (C) 2008 Texas Instruments, Inc.
3958 * This package is free software; you can redistribute it and/or modify
3960 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
3965 - * ======== memdefs.h ========
3967 - * Global MEM constants and types, shared between WSX, WCD, and WMD.
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.
3981 #define MEM_GETVIRTUALSEGID 0x20000000
3982 #define MEM_MASKVIRTUALSEGID (MEM_SETVIRTUALSEGID | MEM_GETVIRTUALSEGID)
3984 -#define TO_VIRTUAL_UNCACHED(x) x
3985 -#define INTREG_TO_VIRTUAL_UNCACHED(x) x
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
3993 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
3995 + * This is the Class driver RM module interface.
3997 * Copyright (C) 2005-2006 Texas Instruments, Inc.
3999 * This package is free software; you can redistribute it and/or modify
4001 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4006 - * ======== mgr.h ========
4008 - * This is the Class driver RM module interface.
4010 - * Public Functions:
4013 - * MGR_EnumNodeInfo
4014 - * MGR_EnumProcessorInfo
4016 - * MGR_GetDCDHandle
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.
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
4042 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4044 + * Global MGR constants and types, shared by PROC, MGR, and WCD.
4046 * Copyright (C) 2008 Texas Instruments, Inc.
4048 * This package is free software; you can redistribute it and/or modify
4050 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4055 - * ======== mgrpriv.h ========
4057 - * Global MGR constants and types, shared by PROC, MGR, and WCD.
4059 - *! Revision History:
4060 - *! ================
4061 - *! 29-July-2001 ag: added MGR_PROCESSOREXTINFO.
4062 - *! 05-July-2000 rr: Created
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
4073 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4075 + * DSP/BIOS Bridge MSG Module.
4077 * Copyright (C) 2005-2006 Texas Instruments, Inc.
4079 * This package is free software; you can redistribute it and/or modify
4081 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4086 - * ======== msg.h ========
4088 - * DSP/BIOS Bridge MSG Module.
4090 - * Public Functions:
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.
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
4114 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4116 + * Global MSG constants and types.
4118 * Copyright (C) 2005-2006 Texas Instruments, Inc.
4120 * This package is free software; you can redistribute it and/or modify
4122 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4127 - * ======== msgdefs.h ========
4129 - * Global MSG constants and types.
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.
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
4146 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4148 + * DSP/BIOS Bridge dynamic loader interface.
4150 * Copyright (C) 2005-2006 Texas Instruments, Inc.
4152 * This package is free software; you can redistribute it and/or modify
4154 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4159 - * ======== nldr.h ========
4162 - * DSP/BIOS Bridge dynamic loader interface. See the file dldrdefs.h
4163 - * for a description of these functions.
4165 - * Public Functions:
4178 - *! Revision History
4179 - *! ================
4180 - *! 31-Jul-2002 jeh Removed function header comments.
4181 - *! 17-Apr-2002 jeh Created.
4184 #include <dspbridge/dbdefs.h>
4185 #include <dspbridge/dbdcddef.h>
4186 #include <dspbridge/dev.h>
4189 extern void NLDR_Delete(struct NLDR_OBJECT *hNldr);
4190 extern void NLDR_Exit(void);
4191 - extern void NLDR_Free(struct NLDR_NODEOBJECT *hNldrNode);
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
4200 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4202 + * Global Dynamic + static/overlay Node loader (NLDR) constants and types.
4204 * Copyright (C) 2008 Texas Instruments, Inc.
4206 * This package is free software; you can redistribute it and/or modify
4208 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4213 - * ======== nldrdefs.h ========
4215 - * Global Dynamic + static/overlay Node loader (NLDR) constants and types.
4217 - *! Revision History
4218 - *! ================
4219 - *! 07-Apr-2003 map Consolidated dldrdefs.h into nldrdefs.h
4220 - *! 05-Aug-2002 jeh Created.
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
4239 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4241 + * DSP/BIOS Bridge Node Manager.
4243 * Copyright (C) 2005-2006 Texas Instruments, Inc.
4245 * This package is free software; you can redistribute it and/or modify
4247 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4252 - * ======== node.h ========
4254 - * DSP/BIOS Bridge Node Manager.
4256 - * Public Functions:
4258 - * NODE_AllocMsgBuf
4259 - * NODE_ChangePriority
4270 - * NODE_GetProcessor
4275 - * NODE_RegisterNotify
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.
4300 * (*puAllocated == *puNumNodes)
4302 extern DSP_STATUS NODE_EnumNodes(struct NODE_MGR *hNodeMgr,
4303 - IN DSP_HNODE *aNodeTab,
4306 OUT u32 *puNumNodes,
4307 OUT u32 *puAllocated);
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
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
4322 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4324 + * Global NODE constants and types, shared by PROCESSOR, NODE, and DISP.
4326 * Copyright (C) 2005-2006 Texas Instruments, Inc.
4328 * This package is free software; you can redistribute it and/or modify
4330 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4335 - * ======== nodedefs.h ========
4337 - * Global NODE constants and types, shared by PROCESSOR, NODE, and DISP.
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.
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
4355 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4357 + * Private node header shared by NODE and DISP.
4359 * Copyright (C) 2005-2006 Texas Instruments, Inc.
4361 * This package is free software; you can redistribute it and/or modify
4363 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4367 - * ======== nodepriv.h ========
4369 - * Private node header shared by NODE and DISP.
4371 - * Public Functions:
4372 - * NODE_GetChannelId
4376 - * NODE_GetLoadType
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.
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
4395 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4397 + * Manage lists of notification events.
4399 * Copyright (C) 2005-2006 Texas Instruments, Inc.
4401 * This package is free software; you can redistribute it and/or modify
4403 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4408 - * ======== ntfy.h ========
4410 - * Manage lists of notification events.
4412 - * Public Functions:
4420 - *! Revision History:
4421 - *! =================
4422 - *! 05-Nov-2001 kc: Updated NTFY_Register.
4423 - *! 07-Sep-2000 jeh Created.
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
4434 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4436 + * This is the Class driver RM module interface.
4438 * Copyright (C) 2005-2006 Texas Instruments, Inc.
4440 * This package is free software; you can redistribute it and/or modify
4442 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4447 - * ======== proc.h ========
4449 - * This is the Class driver RM module interface.
4451 - * Public Functions:
4454 - * PROC_Ctrl (OEM-function)
4459 - * PROC_FlushMemory
4460 - * PROC_GetDevObject (OEM-function)
4461 - * PROC_GetResourceInfo
4463 - * PROC_GetProcessorId
4464 - * PROC_GetTrace (OEM-function)
4466 - * PROC_Load (OEM-function)
4468 - * PROC_NotifyAllclients
4469 - * PROC_NotifyClients (OEM-function)
4470 - * PROC_RegisterNotify
4471 - * PROC_ReserveMemory
4472 - * PROC_Start (OEM-function)
4474 - * PROC_UnReserveMemory
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
4494 #include <dspbridge/devdefs.h>
4495 #include <dspbridge/drv.h>
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
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;
4521 * ======== PROC_Attach ========
4523 @@ -117,8 +51,7 @@ struct PROC_OBJECT {
4525 extern DSP_STATUS PROC_Attach(u32 uProcessor,
4526 OPTIONAL CONST struct DSP_PROCESSORATTRIN
4528 - OUT DSP_HPROCESSOR *phProcessor,
4529 + *pAttrIn, void **phProcessor,
4530 struct PROCESS_CONTEXT *pr_ctxt);
4533 @@ -167,7 +100,7 @@ struct PROC_OBJECT {
4535 * This function Calls WMD_BRD_Ioctl.
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);
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.
4546 - * hProcessor : The processor handle.
4547 + * pr_ctxt : The processor handle.
4549 * DSP_SOK : Success.
4550 * DSP_EHANDLE : InValid Handle.
4551 @@ -186,8 +119,7 @@ struct PROC_OBJECT {
4553 * PROC Object is destroyed.
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);
4560 * ======== PROC_EnumNodes ========
4561 @@ -220,8 +152,8 @@ struct PROC_OBJECT {
4565 - extern DSP_STATUS PROC_EnumNodes(DSP_HPROCESSOR hProcessor,
4566 - IN DSP_HNODE *aNodeTab,
4567 + extern DSP_STATUS PROC_EnumNodes(void *hProcessor,
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.
4576 - extern DSP_STATUS PROC_GetResourceInfo(DSP_HPROCESSOR hProcessor,
4577 + extern DSP_STATUS PROC_GetResourceInfo(void *hProcessor,
4579 OUT struct DSP_RESOURCEINFO *
4581 @@ -291,7 +223,7 @@ struct PROC_OBJECT {
4582 * DSP_SOK : *phDevObject is not NULL
4583 * DSP_EFAIL : *phDevObject is NULL.
4585 - extern DSP_STATUS PROC_GetDevObject(DSP_HPROCESSOR hProcessor,
4586 + extern DSP_STATUS PROC_GetDevObject(void *hProcessor,
4587 struct DEV_OBJECT **phDevObject);
4590 @@ -328,7 +260,7 @@ struct PROC_OBJECT {
4594 - extern DSP_STATUS PROC_GetState(DSP_HPROCESSOR hProcessor,
4595 + extern DSP_STATUS PROC_GetState(void *hProcessor,
4596 OUT struct DSP_PROCESSORSTATE
4598 u32 uStateInfoSize);
4599 @@ -352,7 +284,7 @@ struct PROC_OBJECT {
4603 - extern DSP_STATUS PROC_GetProcessorId(DSP_HPROCESSOR hProcessor,
4604 + extern DSP_STATUS PROC_GetProcessorId(void *hProcessor,
4608 @@ -375,7 +307,7 @@ struct PROC_OBJECT {
4612 - extern DSP_STATUS PROC_GetTrace(DSP_HPROCESSOR hProcessor, u8 *pBuf,
4613 + extern DSP_STATUS PROC_GetTrace(void *hProcessor, u8 *pBuf,
4617 @@ -409,7 +341,7 @@ struct PROC_OBJECT {
4618 * Does not implement access rights to control which GPP application
4619 * can load the processor.
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);
4626 @@ -435,7 +367,7 @@ struct PROC_OBJECT {
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
4635 @@ -457,7 +389,7 @@ struct PROC_OBJECT {
4639 - extern DSP_STATUS PROC_NotifyClients(DSP_HPROCESSOR hProc,
4640 + extern DSP_STATUS PROC_NotifyClients(void *hProc,
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.
4648 - extern DSP_STATUS PROC_NotifyAllClients(DSP_HPROCESSOR hProc,
4649 + extern DSP_STATUS PROC_NotifyAllClients(void *hProc,
4653 @@ -503,7 +435,7 @@ struct PROC_OBJECT {
4654 * Success and ProcState == PROC_RUNNING or DSP_FAILED status.
4657 - extern DSP_STATUS PROC_Start(DSP_HPROCESSOR hProcessor);
4658 + extern DSP_STATUS PROC_Start(void *hProcessor);
4661 * ======== PROC_Stop ========
4662 @@ -525,7 +457,7 @@ struct PROC_OBJECT {
4663 * Success and ProcState == PROC_RUNNING or DSP_FAILED status.
4666 - extern DSP_STATUS PROC_Stop(DSP_HPROCESSOR hProcessor);
4667 + extern DSP_STATUS PROC_Stop(void *hProcessor);
4670 * ======== PROC_FlushMemory ========
4671 @@ -546,7 +478,7 @@ struct PROC_OBJECT {
4673 * All the arguments are currently ignored.
4675 - extern DSP_STATUS PROC_FlushMemory(DSP_HPROCESSOR hProcessor,
4676 + extern DSP_STATUS PROC_FlushMemory(void *hProcessor,
4678 u32 ulSize, u32 ulFlags);
4680 @@ -569,7 +501,7 @@ struct PROC_OBJECT {
4682 * All the arguments are currently ignored.
4684 - extern DSP_STATUS PROC_InvalidateMemory(DSP_HPROCESSOR hProcessor,
4685 + extern DSP_STATUS PROC_InvalidateMemory(void *hProcessor,
4689 @@ -600,7 +532,7 @@ struct PROC_OBJECT {
4693 - extern DSP_STATUS PROC_Map(DSP_HPROCESSOR hProcessor,
4694 + extern DSP_STATUS PROC_Map(void *hProcessor,
4698 @@ -626,7 +558,7 @@ struct PROC_OBJECT {
4702 - extern DSP_STATUS PROC_ReserveMemory(DSP_HPROCESSOR hProcessor,
4703 + extern DSP_STATUS PROC_ReserveMemory(void *hProcessor,
4704 u32 ulSize, void **ppRsvAddr);
4707 @@ -648,7 +580,7 @@ struct PROC_OBJECT {
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);
4716 @@ -670,7 +602,7 @@ struct PROC_OBJECT {
4720 - extern DSP_STATUS PROC_UnReserveMemory(DSP_HPROCESSOR hProcessor,
4721 + extern DSP_STATUS PROC_UnReserveMemory(void *hProcessor,
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
4730 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4732 + * Global PROC constants and types, shared by PROC, MGR and WCD.
4734 * Copyright (C) 2005-2006 Texas Instruments, Inc.
4736 * This package is free software; you can redistribute it and/or modify
4738 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4743 - * ======== procpriv.h ========
4745 - * Global PROC constants and types, shared by PROC, MGR, and WCD.
4747 - *! Revision History:
4748 - *! ================
4749 - *! 05-July-2000 rr: Created
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
4759 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4764 - * ======== pwr.h ========
4766 - * Public Functions:
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.
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
4789 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4791 + * Power Manager shared definitions (used on both GPP and DSP sides).
4793 * Copyright (C) 2008 Texas Instruments, Inc.
4795 * This package is free software; you can redistribute it and/or modify
4797 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4801 - * ======== pwr_sh.h ========
4803 - * Power Manager shared definitions (used on both GPP and DSP sides).
4805 - *! Revision History
4806 - *! ================
4807 - *! 17-Apr-2002 sg: Initial.
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
4818 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
4820 + * Provides registry functions.
4822 * Copyright (C) 2005-2006 Texas Instruments, Inc.
4824 * This package is free software; you can redistribute it and/or modify
4826 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
4831 - * ======== reg.h ========
4833 - * Provide registry functions.
4835 - * Public Functions:
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
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.
4866 #include <linux/types.h>
4868 -/* ------------------------- Defines, Data Structures, Typedefs for Linux */
4876 -#define REG_BINARY 3
4880 -#define REG_DWORD 4
4883 -#endif /* UNDER_CE */
4885 #define REG_MAXREGPATHLENGTH 255
4889 * Deletes a registry entry. NOTE: A registry entry is not the same as
4892 - * phKey: Currently reserved; must be NULL.
4893 - * pstrSubkey: Path to key to open.
4894 * pstrValue: Name of entry to delete.
4897 * DSP_EFAIL: General failure.
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.
4908 - extern DSP_STATUS REG_DeleteValue(OPTIONAL IN HANDLE *phKey,
4909 - IN CONST char *pstrSubkey,
4910 - IN CONST char *pstrValue);
4913 - * ======== REG_EnumKey ========
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.
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.
4928 - * DSP_SOK: Success.
4929 - * DSP_EFAIL: General failure.
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.
4937 - * - strlen(pstrSubkey) is > strlen(pstrKey) &&
4938 - * - strlen(pstrSubkey) is < REG_MAXREGPATHLENGTH
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);
4947 * ======== REG_EnumValue ========
4949 * Enumerates values of a specified key. Retrieves each value name and
4950 * the data associated with the value.
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.
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.
4966 - extern DSP_STATUS REG_EnumValue(IN HANDLE *phKey,
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);
4980 * ======== REG_Exit ========
4983 * Retrieve a value from the registry.
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.
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.
5002 - extern DSP_STATUS REG_GetValue(OPTIONAL IN HANDLE *phKey,
5003 - IN CONST char *pstrSubkey,
5004 - IN CONST char *pstrEntry,
5006 - IN OUT u32 *pdwValueSize);
5007 +extern DSP_STATUS REG_GetValue(IN CONST char *pstrEntry, OUT u8 *pbValue,
5008 + IN OUT u32 *pdwValueSize);
5011 * ======== REG_Init ========
5012 @@ -229,10 +130,7 @@
5014 * Set a value in the registry.
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.
5023 @@ -240,18 +138,13 @@
5024 * DSP_EFAIL: General failure.
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.
5032 - * - length of pstrSubkey < REG_MAXREGPATHLENGTH.
5033 * - length of pstrEntry < REG_MAXREGPATHLENGTH.
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);
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
5049 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5052 -#ifndef RES_CLEANUP_DISABLE
5054 #include <dspbridge/nodepriv.h>
5055 #include <dspbridge/drv.h>
5056 @@ -30,15 +29,12 @@ extern DSP_STATUS DRV_RemoveAllDMMResEle
5058 extern DSP_STATUS DRV_RemoveAllNodeResElements(HANDLE pCtxt);
5060 -extern DSP_STATUS DRV_ProcUpdatestate(HANDLE pCtxt,
5061 - enum GPP_PROC_RES_STATE resState);
5063 extern DSP_STATUS DRV_ProcSetPID(HANDLE pCtxt, s32 hProcess);
5065 extern DSP_STATUS DRV_RemoveAllResources(HANDLE pPctxt);
5067 extern DSP_STATUS DRV_RemoveProcContext(struct DRV_OBJECT *hDRVObject,
5071 extern DSP_STATUS DRV_GetNodeResElement(HANDLE hNode, HANDLE nodeRes,
5073 @@ -63,8 +59,7 @@ extern DSP_STATUS DRV_GetDMMResElement(u
5075 extern DSP_STATUS DRV_RemoveDMMResElement(HANDLE dmmRes, HANDLE pCtxt);
5077 -extern DSP_STATUS DRV_ProcUpdateSTRMRes(u32 uNumBufs, HANDLE STRMRes,
5079 +extern DSP_STATUS DRV_ProcUpdateSTRMRes(u32 uNumBufs, HANDLE STRMRes);
5081 extern DSP_STATUS DRV_ProcInsertSTRMResElement(HANDLE hStrm, HANDLE STRMRes,
5083 @@ -76,8 +71,5 @@ extern DSP_STATUS DRV_ProcRemoveSTRMResE
5085 extern DSP_STATUS DRV_RemoveAllSTRMResElements(HANDLE pCtxt);
5087 -extern DSP_STATUS DRV_ProcDisplayResInfo(u8 *pBuf, u32 *pSize);
5089 extern enum NODE_STATE NODE_GetState(HANDLE hNode);
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
5097 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5099 + * This memory manager provides general heap management and arbitrary
5100 + * alignment for any number of memory segments, and management of overlay
5103 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5105 * This package is free software; you can redistribute it and/or modify
5107 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5112 - * ======== rmm.h ========
5114 - * This memory manager provides general heap management and arbitrary
5115 - * alignment for any number of memory segments, and management of overlay
5118 - * Public functions:
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.
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
5140 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5142 + * DSP/BIOS Bridge Resource Manager Server shared definitions (used on both
5143 + * GPP and DSP sides).
5145 * Copyright (C) 2008 Texas Instruments, Inc.
5147 * This package is free software; you can redistribute it and/or modify
5149 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5154 - * ======== rms_sh.h ========
5156 - * DSP/BIOS Bridge Resource Manager Server shared definitions (used on both
5157 - * GPP and DSP sides).
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.
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
5191 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5193 + * DSP/BIOS Bridge Resource Manager Server shared data type definitions.
5195 * Copyright (C) 2008 Texas Instruments, Inc.
5197 * This package is free software; you can redistribute it and/or modify
5199 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5203 - * ======== rmstypes.h ========
5205 - * DSP/BIOS Bridge Resource Manager Server shared data type definitions.
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.
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
5223 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5225 + * Provide loading and unloading of SERVICES modules.
5227 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5229 * This package is free software; you can redistribute it and/or modify
5231 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5236 - * ======== services.h ========
5238 - * Provide loading and unloading of SERVICES modules.
5240 - * Public Functions:
5241 - * SERVICES_Exit(void)
5242 - * SERVICES_Init(void)
5244 - *! Revision History:
5245 - *! ================
5246 - *! 01-Feb-2000 kc: Created.
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
5256 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5260 - * ======== std.h ========
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
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.
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
5315 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5317 + * DSPBridge Stream Manager.
5319 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5321 * This package is free software; you can redistribute it and/or modify
5323 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5328 - * ======== strm.h ========
5330 - * DSPBridge Stream Manager.
5332 - * Public Functions:
5333 - * STRM_AllocateBuffer
5339 - * STRM_GetEventHandle
5345 - * STRM_PrepareBuffer
5347 - * STRM_RegisterNotify
5349 - * STRM_UnprepareBuffer
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.
5371 extern DSP_STATUS STRM_Close(struct STRM_OBJECT *hStrm,
5372 - struct PROCESS_CONTEXT *pr_ctxt);
5373 + struct PROCESS_CONTEXT *pr_ctxt);
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
5382 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5384 + * Global STRM constants and types.
5386 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5388 * This package is free software; you can redistribute it and/or modify
5390 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5395 - * ======== strmdefs.h ========
5397 - * Global STRM constants and types.
5399 - *! Revision History
5400 - *! ================
5401 - *! 19-Nov-2001 ag Added STRM_INFO..
5402 - *! 25-Sep-2000 jeh Created.
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
5413 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5415 + * Provide synchronization services.
5417 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5419 * This package is free software; you can redistribute it and/or modify
5421 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5425 - * ======== sync.h ========
5427 - * Provide synchronization services.
5429 - * Public Functions:
5435 - * SYNC_InitializeCS
5438 - * SYNC_PostMessage
5441 - * SYNC_WaitOnEvent
5442 - * SYNC_WaitOnMultipleEvents
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.
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
5472 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5474 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
5487 - * ======== util.h ========
5489 - * Provide general purpose utility functions.
5491 - * Public Functions:
5493 - * UTIL_CmdLineToArgs
5502 -#include <linux/delay.h>
5503 -#include <linux/sched.h>
5505 -#include <dspbridge/utildefs.h>
5508 - * ======== UTIL_CDTestDll ========
5510 - * Provides test entry point in class driver context.
5512 - * cArgc: test module command line input count.
5513 - * ppArgv: test module command line args.
5515 - * 0 if successful, a negative value otherwise.
5517 - * UTIL initialized.
5520 - extern u32 UTIL_CDTestDll(IN s32 cArgc, IN char **ppArgv);
5523 - * ======== UTIL_CmdLineToArgs ========
5525 - * This function re-creates C-style cmd line argc & argv from WinMain()
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.
5533 - * Returns the number of arguments found.
5535 - * UTIL initialized.
5538 - extern s32 UTIL_CmdLineToArgs(IN char *pszProgName,
5539 - IN char *argv[UTIL_MAXARGVS],
5540 - IN char *pCmdLine, IN bool fHasProgName);
5543 - * ======== UTIL_Exit ========
5545 - * Discontinue usage of module; free resources when reference count
5550 - * UTIL initialized.
5552 - * Resources used by module are freed when cRef reaches zero.
5554 - extern inline void UTIL_Exit(void)
5558 - * ======== UTIL_GetSysInfo ========
5560 - * This function return platform specific system information.
5563 - * pSysInfo - address to store the system information.
5568 - * UTIL initialized.
5569 - * pSysInfo != NULL
5572 - extern DSP_STATUS UTIL_GetSysInfo(OUT struct UTIL_SYSINFO *pSysInfo);
5575 - * ======== UTIL_Init ========
5577 - * Initializes private state of UTIL module.
5580 - * TRUE if success, else FALSE.
5583 - * UTIL initialized.
5585 - extern inline bool UTIL_Init(void)
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
5596 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5598 + * Global UTIL constants and types, shared between WCD and DSPSYS.
5600 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5602 * This package is free software; you can redistribute it and/or modify
5604 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5609 - * ======== utildefs.h ========
5611 - * Global UTIL constants and types, shared between WCD and DSPSYS.
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.
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
5629 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5631 + * This file contains the specification of UUID helper functions.
5633 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5635 * This package is free software; you can redistribute it and/or modify
5637 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5642 - * ======== uuidutil.h ========
5644 - * This file contains the specification of UUID helper functions.
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.
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
5662 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5664 + * Bridge class driver library functions, object definitions, and
5665 + * return error/status codes. To be included by Bridge mini drivers.
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
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.
5676 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5678 * This package is free software; you can redistribute it and/or modify
5680 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5685 - * ======== wcd.h ========
5687 - * 'Bridge class driver library functions, object definitions, and
5688 - * return error/status codes. To be included by 'Bridge mini drivers.
5690 - * Public Functions:
5691 - * See mem.h and dbg.h.
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
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.
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
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.
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
5728 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5730 + * Contains structures and commands that are used for interaction
5731 + * between the DDSP API and class driver.
5733 * Copyright (C) 2008 Texas Instruments, Inc.
5735 * This package is free software; you can redistribute it and/or modify
5737 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
5742 - * ======== wcdioctl.h ========
5744 - * Contains structures and commands that are used for interaction
5745 - * between the DDSP API and class driver.
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.
5792 @@ -100,7 +54,7 @@ union Trapped_Args {
5793 } ARGS_MGR_UNREGISTEROBJECT;
5796 - struct DSP_NOTIFICATION __user*__user *aNotifications;
5797 + struct DSP_NOTIFICATION __user *__user *aNotifications;
5799 u32 __user *puIndex;
5801 @@ -110,82 +64,79 @@ union Trapped_Args {
5804 struct DSP_PROCESSORATTRIN __user *pAttrIn;
5805 - DSP_HPROCESSOR __user *phProcessor;
5806 + void *__user *phProcessor;
5810 - DSP_HPROCESSOR hProcessor;
5813 struct DSP_CBDATA __user *pArgs;
5817 - DSP_HPROCESSOR hProcessor;
5822 - DSP_HPROCESSOR hProcessor;
5823 - DSP_HNODE __user *aNodeTab;
5825 + void *__user *aNodeTab;
5827 u32 __user *puNumNodes;
5828 u32 __user *puAllocated;
5829 } ARGS_PROC_ENUMNODE_INFO;
5832 - DSP_HPROCESSOR hProcessor;
5835 struct DSP_RESOURCEINFO *pResourceInfo;
5836 u32 uResourceInfoSize;
5837 } ARGS_PROC_ENUMRESOURCES;
5840 - DSP_HPROCESSOR hProcessor;
5842 struct DSP_PROCESSORSTATE __user *pProcStatus;
5844 } ARGS_PROC_GETSTATE;
5847 - DSP_HPROCESSOR hProcessor;
5851 - #ifndef RES_CLEANUP_DISABLE
5856 } ARGS_PROC_GETTRACE;
5859 - DSP_HPROCESSOR hProcessor;
5862 - char __user*__user *aArgv;
5863 + char __user *__user *aArgv;
5864 char *__user *aEnvp;
5868 - DSP_HPROCESSOR hProcessor;
5872 struct DSP_NOTIFICATION __user *hNotification;
5873 } ARGS_PROC_REGISTER_NOTIFY;
5876 - DSP_HPROCESSOR hProcessor;
5881 - DSP_HPROCESSOR hProcessor;
5884 void *__user *ppRsvAddr;
5888 - DSP_HPROCESSOR hProcessor;
5892 } ARGS_PROC_UNRSVMEM;
5895 - DSP_HPROCESSOR hProcessor;
5900 @@ -194,24 +145,24 @@ union Trapped_Args {
5904 - DSP_HPROCESSOR hProcessor;
5908 } ARGS_PROC_UNMAPMEM;
5911 - DSP_HPROCESSOR hProcessor;
5916 } ARGS_PROC_FLUSHMEMORY;
5919 - DSP_HPROCESSOR hProcessor;
5924 - DSP_HPROCESSOR hProcessor;
5928 } ARGS_PROC_INVALIDATEMEMORY;
5929 @@ -219,88 +170,88 @@ union Trapped_Args {
5933 - DSP_HPROCESSOR 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;
5946 struct DSP_BUFFERATTR __user *pAttr;
5947 u8 *__user *pBuffer;
5948 } ARGS_NODE_ALLOCMSGBUF;
5954 } ARGS_NODE_CHANGEPRIORITY;
5960 - DSP_HNODE hOtherNode;
5963 struct DSP_STRMATTR __user *pAttrs;
5964 struct DSP_CBDATA __user *pConnParam;
5965 } ARGS_NODE_CONNECT;
5980 struct DSP_BUFFERATTR __user *pAttr;
5982 } ARGS_NODE_FREEMSGBUF;
5987 struct DSP_NODEATTR __user *pAttr;
5989 } ARGS_NODE_GETATTR;
5994 struct DSP_MSG __user *pMessage;
5996 } ARGS_NODE_GETMESSAGE;
6006 struct DSP_MSG __user *pMessage;
6008 } ARGS_NODE_PUTMESSAGE;
6015 struct DSP_NOTIFICATION __user *hNotification;
6016 } ARGS_NODE_REGISTERNOTIFY;
6026 DSP_STATUS __user *pStatus;
6027 } ARGS_NODE_TERMINATE;
6030 - DSP_HPROCESSOR 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 {
6039 - DSP_HSTREAM hStream;
6042 u8 *__user *apBuffer;
6044 } ARGS_STRM_ALLOCATEBUFFER;
6047 - DSP_HSTREAM hStream;
6052 - DSP_HSTREAM hStream;
6054 u8 *__user *apBuffer;
6056 } ARGS_STRM_FREEBUFFER;
6059 - DSP_HSTREAM hStream;
6062 } ARGS_STRM_GETEVENTHANDLE;
6065 - DSP_HSTREAM hStream;
6067 struct STRM_INFO __user *pStreamInfo;
6068 u32 uStreamInfoSize;
6069 } ARGS_STRM_GETINFO;
6072 - DSP_HSTREAM hStream;
6078 - DSP_HSTREAM hStream;
6083 @@ -349,15 +300,15 @@ union Trapped_Args {
6091 struct STRM_ATTR __user *pAttrIn;
6092 - DSP_HSTREAM __user *phStream;
6093 + void *__user *phStream;
6097 - DSP_HSTREAM hStream;
6099 u8 *__user *pBufPtr;
6101 u32 __user *pBufSize;
6102 @@ -365,14 +316,14 @@ union Trapped_Args {
6103 } ARGS_STRM_RECLAIM;
6106 - DSP_HSTREAM hStream;
6110 struct DSP_NOTIFICATION __user *hNotification;
6111 } ARGS_STRM_REGISTERNOTIFY;
6114 - DSP_HSTREAM __user *aStreamTab;
6115 + void *__user *aStreamTab;
6119 @@ -393,7 +344,7 @@ union Trapped_Args {
6123 - DSP_HPROCESSOR hProcessor;
6125 struct CMM_OBJECT *__user *phCmmMgr;
6126 } ARGS_CMM_GETHANDLE;
6128 @@ -437,83 +388,159 @@ union Trapped_Args {
6129 } ARGS_UTIL_TESTDLL;
6134 + * Dspbridge Ioctl numbering scheme
6137 + * ---------------------------------
6138 + * | Module | Ioctl Number |
6139 + * ---------------------------------
6140 + * | x | x | x | 0 | 0 | 0 | 0 | 0 |
6141 + * ---------------------------------
6144 +/* Ioctl driver identifier */
6146 +#ifdef CONFIG_BRIDGE_NEW_API
6148 + * Following are used to distinguish between module ioctls, this is needed
6149 + * in case new ioctls are introduced.
6151 +#define DB_MODULE_MASK 0xE0
6152 +#define DB_IOC_MASK 0x1F
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)
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
6166 -#define CMD_MGR_END_OFFSET CMD_MGR_WAIT_OFFSET
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
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
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
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 */
6231 +#define DB_PROC 0x20
6232 +#define DB_NODE 0x40
6233 +#define DB_STRM 0x60
6234 +#define DB_CMM 0x80
6236 +#define DB_MODULE_SHIFT 5
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)
6246 +#else /* NEW_API */
6254 +#define DB_IOC(module, num) ((module) + (num))
6256 +/* Used to get dspbridge ioctl module */
6257 +static int DB_GET_MODULE(int cmd)
6261 + else if(cmd<DB_NODE)
6263 + else if(cmd<DB_STRM)
6265 + else if(cmd<DB_CMM)
6271 +/* Used to get dspbridge ioctl number */
6272 +static int DB_GET_IOC(int cmd)
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);
6283 + return (cmd-DB_CMM);
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 */
6296 +/* TODO: Remove deprecated and not implemented */
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)
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)
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)
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)
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)
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
6370 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6372 + * Bridge mini driver entry point and interface function declarations.
6375 + * The Bridge class driver obtains it's function interface to
6376 + * the Bridge mini driver via a call to WMD_DRV_Entry().
6378 + * Bridge Class Driver services exported to WMD's are initialized by the
6379 + * WCD on behalf of the WMD.
6381 + * WMD function DBC Requires and Ensures are also made by the WCD on
6382 + * behalf of the WMD, to simplify the WMD code.
6384 * Copyright (C) 2005-2006 Texas Instruments, Inc.
6386 * This package is free software; you can redistribute it and/or modify
6388 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6393 - * ======== wmd.h ========
6395 - * 'Bridge mini driver entry point and interface function declarations.
6397 - * Public Functions:
6401 - * The 'Bridge class driver obtains it's function interface to
6402 - * the 'Bridge mini driver via a call to WMD_DRV_Entry().
6404 - * 'Bridge Class Driver services exported to WMD's are initialized by the
6405 - * WCD on behalf of the WMD.
6407 - * WMD function DBC Requires and Ensures are also made by the WCD on
6408 - * behalf of the WMD, to simplify the WMD code.
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.
6441 typedef DSP_STATUS(*
6442 WMD_BRD_STATUS) (struct WMD_DEV_CONTEXT *hDevContext,
6443 - OUT BRD_STATUS * pdwState);
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
6451 struct CHNL_MGR *hChnlMgr,
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
6462 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
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.
6469 + * The function comment headers reside in wmd.h.
6471 * Copyright (C) 2005-2006 Texas Instruments, Inc.
6473 * This package is free software; you can redistribute it and/or modify
6475 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6480 - * ======== wmdchnl.h ========
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.
6486 - * Public Functions:
6489 - * The function comment headers reside with the function typedefs in wmd.h.
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
6497 - *! 11-Jul-1996 gp: Created.
6505 extern DSP_STATUS WMD_CHNL_Open(OUT struct CHNL_OBJECT **phChnl,
6506 struct CHNL_MGR *hChnlMgr,
6510 CONST IN OPTIONAL struct CHNL_ATTRS
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
6517 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6519 + * Defines upper edge DEH functions required by all WMD/WCD driver
6520 + * interface tables.
6523 + * Function comment headers reside with the function typedefs in wmd.h.
6525 * Copyright (C) 2005-2006 Texas Instruments, Inc.
6527 * This package is free software; you can redistribute it and/or modify
6529 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6534 - * ======== wmddeh.h ========
6536 - * Defines upper edge DEH functions required by all WMD/WCD driver
6537 - * interface tables.
6539 - * Public Functions:
6544 - * WMD_DEH_RegisterNotify
6548 - * Function comment headers reside with the function typedefs in wmd.h.
6550 - *! Revision History:
6551 - *! ================
6552 - *! 26-Dec-2004 hn: added IVA_DEH_Create.
6553 - *! 13-Sep-2001 kc: created.
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
6564 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6566 + * Declares the upper edge IO functions required by all WMD / WCD
6567 + * driver interface tables.
6570 + * Function comment headers reside in wmd.h.
6572 * Copyright (C) 2005-2006 Texas Instruments, Inc.
6574 * This package is free software; you can redistribute it and/or modify
6576 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6581 - * ======== wmdio.h ========
6583 - * Declares the upper edge IO functions required by
6584 - * all WMD / WCD driver interface tables.
6586 - * Public Functions:
6589 - * Function comment headers reside with the function typedefs in wmd.h.
6591 - *! Revision History:
6592 - *! ================
6593 - *! 27-Feb-2004 vp Added IVA releated function.
6594 - *! 06-Nov-2000 jeh Created.
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
6605 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6607 + * BRIDGE Minidriver BRD_IOCtl reserved command definitions.
6609 * Copyright (C) 2005-2006 Texas Instruments, Inc.
6611 * This package is free software; you can redistribute it and/or modify
6613 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6618 - * ======== wmdioctl.h ========
6620 - * BRIDGE Minidriver BRD_IOCtl reserved command definitions.
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.
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
6648 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
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.
6655 + * Function comment headers reside in wmd.h.
6657 * Copyright (C) 2005-2006 Texas Instruments, Inc.
6659 * This package is free software; you can redistribute it and/or modify
6661 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
6666 - * ======== wmdmsg.h ========
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.
6672 - * Public Functions:
6675 - * Function comment headers reside with the function typedefs in wmd.h.
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.
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
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
6702 CONFIG_BRIDGE_DVFS=y
6703 -CONFIG_BRIDGE_MEMPOOL_SIZE=0x412800
6704 +CONFIG_BRIDGE_MEMPOOL_SIZE=0x600000
6705 # CONFIG_BRIDGE_DEBUG is not set
6707 +# CONFIG_BRIDGE_NTFY_PWRERR is not set
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
6715 -obj-$(CONFIG_MPU_BRIDGE) += bridgedriver.o
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
6734 -bridgedriver-objs = $(libgen) $(libservices) $(libwmd) $(libpmgr) $(librmgr) \
6735 - $(libdload) $(libhw)
6738 -ifeq ($(CONFIG_BRIDGE_DEBUG),y)
6739 -ccflags-y += -DGT_TRACE -DDEBUG
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
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
6760 Say Y to enable Bridge debugging capabilities
6762 +comment "Bridge Notifications"
6763 + depends on MPU_BRIDGE
6765 +config BRIDGE_NTFY_PWRERR
6766 + bool "Notify DSP Power Error"
6767 + depends on MPU_BRIDGE
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
6776 +obj-$(CONFIG_MPU_BRIDGE) += bridgedriver.o
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 \
6793 +libhw = hw/hw_prcm.o hw/hw_dspssC64P.o hw/hw_mmu.o hw/hw_mbox.o
6795 +bridgedriver-objs = $(libgen) $(libservices) $(libwmd) $(libpmgr) $(librmgr) \
6796 + $(libdload) $(libhw)
6799 +ifeq ($(CONFIG_BRIDGE_DEBUG),y)
6800 +ccflags-y += -DGT_TRACE
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
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);
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);
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;
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.
6840 + siz = (dlthis->dfile_hdr.df_target_scns + 1) *
6841 + sizeof(struct LDR_SECTION_INFO) + MY_HANDLE_SIZE;
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)
6855 @@ -707,11 +713,16 @@ static void dload_symbols(struct dload_s
6859 - /* We keep a local symbol table for all of the symbols in the input.
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.
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
6877 val = delta = symp->value;
6878 +#ifdef ENABLE_TRAMP_DEBUG
6879 + dload_syms_error(dlthis->mysym,
6880 + "===> ext sym [%s] at %x",
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)
6896 + *tramps_generated = false;
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);
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);
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
6914 + if (*tramps_generated == true) {
6915 + dload_tramp_pkt_udpate(dlthis,
6916 + (dlthis->image_secn - dlthis->ldr_sections),
6917 + dlthis->image_offset, ipacket);
6921 } /* dload_read_reloc */
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;
6932 @@ -1107,7 +1136,7 @@ static void dload_data(struct dload_stat
6935 /* Indicates whether CINIT processing has occurred */
6936 - boolean cinit_processed = false;
6937 + bool cinit_processed = false;
6939 /* Loop through the sections and load them one at a time.
6941 @@ -1132,6 +1161,8 @@ static void dload_data(struct dload_stat
6945 + bool tramp_generated = false;
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 */
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;
6966 + /* Only write the result to the target if no
6967 + * trampoline was generated. Otherwise it
6968 + *will be done during trampoline finalize. */
6970 + if (tramp_generated == false) {
6972 + /* stuff the result into target
6974 + if (DLOAD_SECT_TYPE(sptr) ==
6976 + cload_cinit(dlthis,
6978 + cinit_processed = true;
6980 #ifdef OPT_ZERO_COPY_LOADER
6985 - if (!dlthis->myio->writemem
6986 - (dlthis->myio, ibuf.bufr,
6987 - lptr->load_addr + image_offset, lptr,
6989 - (ibuf.ipacket.i_packet_size))) {
6991 - "Write to " FMT_UI32 " failed",
6992 - lptr->load_addr + image_offset);
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))) {
7000 + "Write to " FMT_UI32
7005 #ifdef OPT_ZERO_COPY_LOADER
7013 BYTE_TO_TADDR(ibuf.ipacket.i_packet_size);
7014 @@ -1281,6 +1323,12 @@ loop_cont:
7017 } /* load sections */
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);
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 */
7031 -#elif TARGET_ENDIANNESS_DIFFERS(TARGET_BIG_ENDIAN)
7032 - register TgtAU_t tmp;
7034 - *dst++ = SWAP16BY8(tmp); /* right for TARGET_AU_BITS == 16 */
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)
7042 -#elif TARGET_BIG_ENDIAN
7043 - dst[-1] &= ~BYTE_MASK; /* big-endian */
7045 dst[-1] &= (1 << (BITS_PER_AU - BITS_PER_BYTE)) - 1; /* little endian */
7047 @@ -1532,6 +1574,16 @@ static void init_module_handle(struct dl
7048 hndl = dlthis->myhandle;
7050 return; /* must be errors detected, so forget it */
7052 + /* Store the section count */
7053 + hndl->secn_count = dlthis->allocated_secn_count;
7055 + /* If a trampoline section was created, add it in */
7056 + if (dlthis->tramp.tramp_sect_next_addr != 0)
7057 + hndl->secn_count += 1;
7059 + hndl->secn_count = hndl->secn_count << 1;
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
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;
7078 /* now cram in the names */
7079 cp = copy_tgt_strings(dbsec, dlthis->str_head,
7080 dlthis->debug_string_size);
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);
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
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 */
7103 asecs = hndl->secns;
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
7113 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
7115 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
7128 -#ifndef _DLCLASSES_HDR_H
7129 -#define _DLCLASSES_HDR_H
7131 -/*****************************************************************************
7132 - *****************************************************************************
7136 - * Sample classes in support of the dynamic loader
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 - *****************************************************************************/
7143 -#include <dspbridge/dynamic_loader.h>
7145 -#include "DLstream.h"
7146 -#include "DLsymtab.h"
7147 -#include "DLalloc.h"
7148 -#include "DLinit.h"
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
7155 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7160 #ifndef __DLOAD_INTERNAL__
7161 #define __DLOAD_INTERNAL__
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 */
7172 + * Trampoline data structures
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 */
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))
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:
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 + |----------------------------------------------|
7203 + This is very similar to how image data is laid out in the DOFF file
7206 +struct tramp_gen_code_hdr {
7207 + u32 tramp_code_size; /* in BYTES */
7209 + u32 relo_offset; /* in BYTES */
7212 +struct tramp_img_pkt {
7213 + struct tramp_img_pkt *next; /* MUST BE FIRST */
7215 + struct tramp_gen_code_hdr hdr;
7216 + u8 payload[VARIABLE_SIZE];
7219 +struct tramp_img_dup_relo {
7220 + struct tramp_img_dup_relo *next;
7221 + struct reloc_record_t relo;
7224 +struct tramp_img_dup_pkt {
7225 + struct tramp_img_dup_pkt *next; /* MUST BE FIRST */
7228 + struct image_packet_t img_pkt;
7229 + struct tramp_img_dup_relo *relo_chain;
7231 + /* PAYLOAD OF IMG PKT FOLLOWS */
7235 + struct tramp_sym *next; /* MUST BE FIRST */
7238 + struct Local_Symbol sym_info;
7241 +struct tramp_string {
7242 + struct tramp_string *next; /* MUST BE FIRST */
7244 + char str[VARIABLE_SIZE]; /* NULL terminated */
7247 +struct tramp_info {
7248 + u32 tramp_sect_next_addr;
7249 + struct LDR_SECTION_INFO sect_info;
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;
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;
7262 + struct tramp_img_pkt *tramp_pkts;
7263 + struct tramp_img_dup_pkt *dup_pkts;
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 */
7272 + struct tramp_info tramp; /* Trampoline data, if needed */
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
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);
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);
7302 + * exported by tramp.c
7304 +extern bool dload_tramp_avail(struct dload_state *dlthis,
7305 + struct reloc_record_t *rp);
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);
7311 +extern int dload_tramp_pkt_udpate(struct dload_state *dlthis,
7312 + s16 secnn, u32 image_offset,
7313 + struct image_packet_t *ipacket);
7315 +extern int dload_tramp_finalize(struct dload_state *dlthis);
7317 +extern void dload_tramp_cleanup(struct dload_state *dlthis);
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
7326 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
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.
7332 + * .dof files, when viewed as a sequence of 32-bit integers, look the same
7333 + * on big-endian and little-endian machines.
7335 * Copyright (C) 2005-2006 Texas Instruments, Inc.
7337 * This package is free software; you can redistribute it and/or modify
7339 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
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. */
7349 -/* .dof files, when viewed as a sequence of 32-bit integers, look the same */
7350 -/* on big-endian and little-endian machines. */
7351 -/*****************************************************************************/
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
7359 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7364 #include <dspbridge/getsection.h>
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
7371 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
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
7383 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7386 -/*============================================================================
7387 - Filename: module_list.h
7389 - Copyright (C) 2002 Texas Instruments Incorporated
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.
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.
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.
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.
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
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
7429 -============================================================================*/
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.
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.
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.
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.
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
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
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
7476 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
7478 + * This file defines host and target properties for all machines
7479 + * supported by the dynamic loader. To be tedious...
7481 + * host: the machine on which the dynamic loader runs
7482 + * target: the machine that the dynamic loader is loading
7484 + * Host and target may or may not be the same, depending upon the particular
7487 * Copyright (C) 2005-2006 Texas Instruments, Inc.
7489 * This package is free software; you can redistribute it and/or modify
7491 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7496 -/******************************************************************************
7498 - * This file defines host and target properties for all machines
7499 - * supported by the dynamic loader. To be tedious...
7501 - * host == the machine on which the dynamic loader runs
7502 - * target == the machine that the dynamic loader is loading
7504 - * Host and target may or may not be the same, depending upon the particular
7506 - *****************************************************************************/
7508 -/******************************************************************************
7512 - *****************************************************************************/
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)
7522 /* !! don't be tempted to insert type definitions here; use <stdint.h> !! */
7524 -/******************************************************************************
7526 - * Target Properties
7528 - *****************************************************************************/
7531 + * Target Properties
7534 /*--------------------------------------------------------------------------*/
7535 /* TMS320C6x Target Specific Parameters (byte-addressable) */
7541 * Useful properties and conversions derived from the above
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,
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 *
7565 unsigned int scale = 0;
7567 + struct image_packet_t *img_pkt = NULL;
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));
7579 rx = HASH_FUNC(rp->r_type);
7580 while (rop_map1[rx] != rp->r_type) {
7581 rx = HASH_L(rop_map2[rx]);
7584 - switch (rp->r_type) {
7588 - /* Ignore these reloc types and return */
7591 - /* Unknown reloc type, print error and return */
7592 - dload_error(dlthis, "Bad coff operator 0x%x", rp->r_type);
7594 + switch (rp->r_type) {
7598 + /* Ignore these reloc types and return */
7601 + /* Unknown reloc type, print error and return */
7602 + dload_error(dlthis, "Bad coff operator 0x%x",
7606 - dload_error(dlthis, "Bad coff operator 0x%x", rp->r_type);
7607 + dload_error(dlthis, "Bad coff operator 0x%x",
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];
7619 - dload_error(dlthis, "Buffer Overflow - Array Index Out of Bounds");
7620 + dload_error(dlthis, "Buffer Overflow - Array Index Out "
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;
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;
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 */
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. */
7666 @@ -414,10 +438,38 @@ void dload_relocate(struct dload_state *
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)) {
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,
7689 + dload_error(dlthis, "Failed to "
7690 + "generate trampoline for bit "
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);
7698 + *tramps_genereted = true;
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);
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
7713 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7718 #ifndef __RELOC_TABLE_H__
7719 #define __RELOC_TABLE_H__
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
7725 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
7729 /* Tables generated for c6000 */
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
7739 + * DSP-BIOS Bridge driver support functions for TI OMAP processors.
7741 + * Copyright (C) 2009 Texas Instruments, Inc.
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.
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.
7752 +#include "header.h"
7755 +#include "tramp_table_c6000.c"
7758 +#define MAX_RELOS_PER_PASS 4
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.
7765 +static int priv_tramp_sect_tgt_alloc(struct dload_state *dlthis)
7768 + struct LDR_SECTION_INFO *sect_info;
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];
7776 + sect_info->name = dlthis->tramp.final_string_table;
7777 + sect_info->size = dlthis->tramp.tramp_sect_next_addr;
7778 + sect_info->context = 0;
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));
7788 + dload_error(dlthis, "Failed to allocate target memory for"
7795 + * Function: priv_h2a
7796 + * Description: Helper function to convert a hex value to its ASCII
7797 + * representation. Used for trampoline symbol name generation.
7799 +static u8 priv_h2a(u8 value)
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.
7819 +static void priv_tramp_sym_gen_name(u32 value, char *dst)
7822 + volatile char *prefix = TRAMP_SYM_PREFIX;
7823 + volatile char *dst_local = dst;
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;
7830 + /* Copy the prefix to start */
7831 + for (i = 0; i < strlen(TRAMP_SYM_PREFIX); i++) {
7832 + *dst_local = *(prefix + i);
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);
7842 + *dst_local = priv_h2a(tmp & 0x0F);
7845 + tmp = *(((u8 *)&value) + i);
7846 + *dst_local = priv_h2a((tmp & 0xF0) >> 4);
7848 + *dst_local = priv_h2a(tmp & 0x0F);
7853 + /* NULL terminate */
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.
7863 +static struct tramp_string *priv_tramp_string_create(struct dload_state *dlthis,
7864 + u32 str_len, char *str)
7866 + struct tramp_string *new_string = NULL;
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);
7877 + *((u8 *)new_string + i) = 0;
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;
7885 + new_string->next = NULL;
7886 + if (dlthis->tramp.string_head == NULL)
7887 + dlthis->tramp.string_head = new_string;
7889 + dlthis->tramp.string_tail->next = new_string;
7891 + dlthis->tramp.string_tail = new_string;
7893 + /* Copy the string over to the new object */
7894 + for (i = 0; i < str_len; i++)
7895 + new_string->str[i] = str[i];
7898 + return new_string;
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.
7906 +static struct tramp_string *priv_tramp_string_find(struct dload_state *dlthis,
7909 + struct tramp_string *cur_str = NULL;
7910 + struct tramp_string *ret_val = NULL;
7912 + u32 str_len = strlen(str);
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
7919 + if (str_len != strlen(cur_str->str))
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
7927 + if (str[i] != cur_str->str[i])
7932 + ret_val = cur_str;
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.
7944 +static int priv_string_tbl_finalize(struct dload_state *dlthis)
7947 + struct tramp_string *cur_string;
7951 + /* Allocate enough space for all strings that have been created. The
7952 + * table is simply all strings concatenated together will NULL
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*
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;
7968 + /* Copy the string contents */
7969 + for (tmp = cur_string->str;
7974 + /* Pick up the NULL termination since it was missed by
7975 + * breaking using it to end the above loop. */
7979 + /* Free the string node, we don't need it any more. */
7980 + dlthis->mysym->Deallocate(dlthis->mysym, cur_string);
7982 + /* Move our pointer to the next one */
7983 + cur_string = dlthis->tramp.string_head;
7986 + /* Update our return value to success */
7989 + dload_error(dlthis, "Failed to allocate trampoline "
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.
8002 +static u32 priv_tramp_sect_alloc(struct dload_state *dlthis, u32 tramp_size)
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);
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;
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
8027 +static struct tramp_sym *priv_tramp_sym_create(struct dload_state *dlthis,
8028 + u32 str_index, struct Local_Symbol *tmp_sym)
8030 + struct tramp_sym *new_sym = NULL;
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;
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++;
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;
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;
8057 + dlthis->tramp.symbol_tail->next = new_sym;
8059 + dlthis->tramp.symbol_tail = new_sym;
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.
8071 +static struct tramp_sym *priv_tramp_sym_get(struct dload_state *dlthis,
8074 + struct tramp_sym *sym_found = NULL;
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)
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
8093 +static struct tramp_sym *priv_tramp_sym_find(struct dload_state *dlthis,
8096 + struct tramp_sym *sym_found = NULL;
8097 + struct tramp_string *str_found = NULL;
8099 + /* First, search for the string, then search for the sym based on the
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);
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.
8115 +static int priv_tramp_sym_finalize(struct dload_state *dlthis)
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;
8123 + /* Allocate a table to hold a flattened version of all symbols
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;
8141 + /* Copy the symbol contents into the flat table */
8142 + *new_sym = cur_sym->sym_info;
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
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;
8157 + /* Let go of the symbol node */
8158 + dlthis->mysym->Deallocate(dlthis->mysym, cur_sym);
8160 + /* Move to the next node */
8161 + cur_sym = dlthis->tramp.symbol_head;
8167 + dload_error(dlthis, "Failed to alloc trampoline sym table");
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.
8179 +static int priv_tgt_img_gen(struct dload_state *dlthis, u32 base,
8180 + u32 gen_index, struct tramp_sym *new_ext_sym)
8182 + struct tramp_img_pkt *new_img_pkt = NULL;
8184 + u32 pkt_size = tramp_img_pkt_size_get();
8185 + u8 *gen_tbl_entry;
8187 + struct reloc_record_t *cur_relo;
8190 + /* Allocate a new image packet and set it up. */
8192 + (struct tramp_img_pkt *)dlthis->mysym->Allocate(dlthis->mysym,
8194 + if (new_img_pkt != NULL) {
8195 + /* Save the base, this is where it goes in the section */
8196 + new_img_pkt->base = base;
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;
8207 + /* Update the relocations to point to the external symbol */
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;
8214 + /* Add it to the trampoline list. */
8215 + new_img_pkt->next = dlthis->tramp.tramp_pkts;
8216 + dlthis->tramp.tramp_pkts = new_img_pkt;
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.
8233 +static int priv_pkt_relo(struct dload_state *dlthis, TgtAU_t *data,
8234 + struct reloc_record_t *rp[], u32 relo_count)
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);
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.
8258 +static int priv_tramp_pkt_finalize(struct dload_state *dlthis)
8261 + struct tramp_img_pkt *cur_pkt = NULL;
8262 + struct reloc_record_t *relos[MAX_RELOS_PER_PASS];
8265 + struct reloc_record_t *cur_relo;
8266 + struct LDR_SECTION_INFO *sect_info =
8267 + &dlthis->ldr_sections[dlthis->allocated_secn_count];
8269 + /* Walk the list of trampoline packets and relocate each packet. This
8270 + * function is the trampoline equivalent of dload_data() from
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;
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;
8282 + /* Walk through all relos for the packet */
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,
8292 + final_sym_table[cur_relo->r_symndx].value);
8296 + ((i < MAX_RELOS_PER_PASS) &&
8297 + ((i + relos_done) < cur_pkt->hdr.num_relos));
8299 + relos[i] = cur_relo + i;
8301 + /* Do the actual relo */
8302 + ret_val = priv_pkt_relo(dlthis,
8303 + (TgtAU_t *)&cur_pkt->payload,
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);
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
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);
8331 + /* Done with the pkt, let it go */
8332 + dlthis->mysym->Deallocate(dlthis->mysym, cur_pkt);
8334 + /* Get the next packet to process */
8335 + cur_pkt = dlthis->tramp.tramp_pkts;
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.
8352 +static int priv_dup_pkt_finalize(struct dload_state *dlthis)
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;
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
8370 + dlthis->tramp.dup_pkts = cur_pkt->next;
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;
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
8379 + i = (s32)(dlthis->image_secn - dlthis->ldr_sections);
8380 + sect_hdr = dlthis->sect_hdrs + i;
8381 + dlthis->delta_runaddr = sect_hdr->ds_paddr;
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;
8394 + /* Do the actual relo */
8395 + ret_val = priv_pkt_relo(dlthis,
8396 + cur_pkt->img_pkt.i_bits,
8398 + if (ret_val == 0) {
8399 + dload_error(dlthis,
8400 + "Relocation of dup pkt at %x failed",
8401 + cur_pkt->offset + dlthis->image_secn->
8406 + /* Release all of these relos, we're done with them */
8408 + dlthis->mysym->Deallocate(dlthis->mysym,
8409 + GET_CONTAINER(relos[i - 1],
8410 + struct tramp_img_dup_relo, relo));
8414 + /* DO NOT ADVANCE cur_relo, IT IS ALREADY READY TO
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 +
8434 + dlthis->mysym->Deallocate(dlthis->mysym, cur_pkt);
8436 + /* Advance to the next packet */
8437 + cur_pkt = dlthis->tramp.dup_pkts;
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.
8450 +static struct tramp_img_dup_pkt *priv_dup_find(struct dload_state *dlthis,
8451 + s16 secnn, u32 image_offset)
8453 + struct tramp_img_dup_pkt *cur_pkt = NULL;
8455 + for (cur_pkt = dlthis->tramp.dup_pkts;
8457 + cur_pkt = cur_pkt->next) {
8458 + if ((cur_pkt->secnn == secnn) &&
8459 + (cur_pkt->offset == image_offset)) {
8460 + /* Found a match, break out */
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.
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)
8484 + struct tramp_img_dup_pkt *dup_pkt = NULL;
8488 + struct tramp_img_dup_relo *dup_relo = NULL;
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);
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;
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;
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);
8515 + /* Add the packet to the dup list */
8516 + dup_pkt->next = dlthis->tramp.dup_pkts;
8517 + dlthis->tramp.dup_pkts = dup_pkt;
8519 + dload_error(dlthis, "Failed to create dup packet!");
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);
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;
8545 + dup_relo->next = dup_pkt->relo_chain;
8546 + dup_pkt->relo_chain = dup_relo;
8548 + /* That's it, we're done. Make sure we update our
8549 + * return value to be success since everything finished
8553 + dload_error(dlthis, "Unable to alloc dup relo");
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.
8564 +bool dload_tramp_avail(struct dload_state *dlthis, struct reloc_record_t *rp)
8566 + bool ret_val = false;
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)
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
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)
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;
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);
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 +
8619 + dlthis->local_symtab[rp->r_symndx].value);
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;
8632 + ref_sym = &(dlthis->local_symtab[rp->r_symndx]);
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");
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());
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);
8661 + new_ext_sym = priv_tramp_sym_create(dlthis,
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
8670 + ret_val = priv_tgt_img_gen(dlthis,
8671 + new_tramp_base, gen_index,
8674 + /* Add generated image data to tramp
8676 + if (ret_val != 1) {
8677 + dload_error(dlthis, "Failed to"
8678 + " create image packet for "
8682 + dload_error(dlthis, "Failed to create "
8683 + "new tramp syms (%8.8X, %8.8X)\n",
8684 + new_tramp_sym, new_ext_sym);
8690 + /* Duplicate the image data and relo record that caused the
8691 + * tramp, including update the relo data to point to the tramp
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");
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.
8716 +int dload_tramp_pkt_udpate(struct dload_state *dlthis, s16 secnn,
8717 + u32 image_offset, struct image_packet_t *ipacket)
8719 + struct tramp_img_dup_pkt *dup_pkt = NULL;
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);
8732 + dload_error(dlthis,
8733 + "Unable to find existing DUP pkt for %x, offset %x",
8734 + secnn, image_offset);
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.
8749 +int dload_tramp_finalize(struct dload_state *dlthis)
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);
8758 + /* Do target allocation for section BEFORE finalizing
8761 + ret_val = priv_tramp_sect_tgt_alloc(dlthis);
8763 + /* Finalize symbols with their correct target information and
8766 + ret_val = priv_tramp_sym_finalize(dlthis);
8768 + /* Finalize all trampoline packets. This performs the
8769 + * relocation on the packets as well as writing them to target
8772 + ret_val = priv_tramp_pkt_finalize(dlthis);
8774 + /* Perform a 2nd pass relocation on the dup list. */
8776 + ret_val = priv_dup_pkt_finalize(dlthis);
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.
8790 +void dload_tramp_cleanup(struct dload_state *dlthis)
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;
8799 + /* If there were no tramps generated, just return */
8800 + if (tramp->tramp_sect_next_addr == 0)
8803 + /* Destroy all tramp information */
8804 + for (cur_sym = tramp->symbol_head;
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;
8811 + dlthis->mysym->Deallocate(dlthis->mysym, cur_sym);
8814 + if (tramp->final_sym_table != NULL)
8815 + dlthis->mysym->Deallocate(dlthis->mysym,
8816 + tramp->final_sym_table);
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;
8825 + dlthis->mysym->Deallocate(dlthis->mysym, cur_string);
8828 + if (tramp->final_string_table != NULL)
8829 + dlthis->mysym->Deallocate(dlthis->mysym,
8830 + tramp->final_string_table);
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);
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;
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);
8851 + dlthis->mysym->Deallocate(dlthis->mysym, cur_dup_pkt);
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
8859 + * tramp_table_c6000.c
8861 + * DSP-BIOS Bridge driver support functions for TI OMAP processors.
8863 + * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
8874 +#include "dload_internal.h"
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. */
8879 +#define R_C60LO16 0x54 /* C60: MVK Low Half Register */
8880 +#define R_C60HI16 0x55 /* C60: MVKH/MVKLH High Half Register */
8883 +#define C6X_TRAMP_WORD_COUNT 8
8884 +#define C6X_TRAMP_MAX_RELOS 8
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)
8890 +/* THIS MUST MATCH reloc_record_t FOR A SYMBOL BASED RELO */
8891 +struct c6000_relo_record {
8894 +#ifndef _BIG_ENDIAN
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];
8910 +/* Hash mapping for relos that can cause trampolines. */
8911 +static const u16 tramp_map[] =
8980 +static const struct c6000_gen_code tramp_gen_info[] =
8982 + /* Tramp caused by R_C60PCR21 */
8984 + /* Header - 8 instructions, 2 relos */
8986 + sizeof(u32) * C6X_TRAMP_WORD_COUNT,
8988 + FIELD_OFFSET(struct c6000_gen_code, relos)
8991 + /* Trampoline instructions */
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 */
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 }
9019 +/* TARGET SPECIFIC FUNCTIONS THAT MUST BE DEFINED */
9020 +static u32 tramp_size_get(void)
9022 + return sizeof(u32) * C6X_TRAMP_WORD_COUNT;
9026 +static u32 tramp_img_pkt_size_get(void)
9028 + return sizeof(struct c6000_gen_code);
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
9034 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9039 - * ======== _gt_para.c ========
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.
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.
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.
9062 /* ----------------------------------- Host OS */
9063 @@ -89,10 +77,10 @@ static void error(char *fmt, ...)
9067 - printk("ERROR: ");
9068 + pr_err("ERROR: ");
9069 printk(fmt, arg1, arg2, arg3, arg4, arg5, arg6);
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 "
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
9081 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
9083 + * Generic bitmap operations.
9085 * Copyright (C) 2005-2006 Texas Instruments, Inc.
9087 * This package is free software; you can redistribute it and/or modify
9089 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9094 - * ======== gb.c ========
9095 - * Description: Generic bitmap operations.
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().
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
9114 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9119 - * ======== gh.c ========
9122 #include <dspbridge/std.h>
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
9130 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
9132 + * General storage memory allocator services.
9134 * Copyright (C) 2005-2006 Texas Instruments, Inc.
9136 * This package is free software; you can redistribute it and/or modify
9138 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9143 - * ======== gs.c ========
9145 - * General storage memory allocator services.
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.
9156 /* ----------------------------------- DSP/BIOS Bridge */
9157 #include <dspbridge/std.h>
9158 #include <dspbridge/dbdefs.h>
9159 @@ -65,7 +52,7 @@ void *GS_alloc(u32 size)
9168 @@ -98,9 +85,5 @@ void GS_frees(void *ptr, u32 size)
9172 - static bool curInit;
9174 - if (curInit == false) {
9175 - curInit = MEM_Init(); /* which can't fail currently. */
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
9184 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
9186 + * This module implements the trace mechanism for bridge.
9188 * Copyright (C) 2005-2006 Texas Instruments, Inc.
9190 * This package is free software; you can redistribute it and/or modify
9192 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9197 - * ======== gt.c ========
9198 - * Description: This module implements the trace mechanism for bridge.
9200 - *! Revision History
9201 - *! ================
9202 - *! 16-May-1997 dr Changed GT_Config member names to conform to coding
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.
9209 /* ----------------------------------- DSP/BIOS Bridge */
9210 #include <dspbridge/std.h>
9212 @@ -238,7 +226,7 @@ s32 _GT_trace(struct GT_Mask *mask, char
9213 arg6 = va_arg(va, s32);
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
9226 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
9228 + * This file contains the implementation of UUID helper functions.
9230 * Copyright (C) 2005-2006 Texas Instruments, Inc.
9232 * This package is free software; you can redistribute it and/or modify
9234 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9239 - * ======== uuidutil.c ========
9241 - * This file contains the implementation of UUID helper functions.
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.
9255 /* ----------------------------------- Host OS */
9256 #include <dspbridge/host_os.h>
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
9263 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
9265 + * Global HW definitions
9267 * Copyright (C) 2007 Texas Instruments, Inc.
9269 * This package is free software; you can redistribute it and/or modify
9271 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9276 - * ======== GlobalTypes.h ========
9278 - * Global HW definitions
9280 - *! Revision History:
9281 - *! ================
9282 - *! 16 Feb 2003 sb: Initial version
9284 #ifndef __GLOBALTYPES_H
9285 #define __GLOBALTYPES_H
9288 * DESCRIPTION: Returns a 32 bit value given a 16 bit lower value and a 16
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)))
9297 * DESCRIPTION: Returns a 16 bit value given a 8 bit lower value and a 8
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)))
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
9309 #define SYSC_IVA2BOOTADDR_OFFSET 0x400
9310 #define SYSC_IVA2BOOTADDR_MASK 0xfffffc00
9313 -/* The following represent the enumerated values for each bitfield */
9315 -enum IPIIPI_SYSCONFIGAutoIdleE {
9316 - IPIIPI_SYSCONFIGAutoIdleclkfree = 0x0000,
9317 - IPIIPI_SYSCONFIGAutoIdleautoclkgate = 0x0001
9320 -enum IPIIPI_ENTRYElemSizeValueE {
9321 - IPIIPI_ENTRYElemSizeValueElemSz8b = 0x0000,
9322 - IPIIPI_ENTRYElemSizeValueElemSz16b = 0x0001,
9323 - IPIIPI_ENTRYElemSizeValueElemSz32b = 0x0002,
9324 - IPIIPI_ENTRYElemSizeValueReserved = 0x0003
9327 #endif /* _IPI_ACC_INT_H */
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
9333 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9338 #ifndef _IVA2_REG_ACM_H
9339 #define _IVA2_REG_ACM_H
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
9345 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9349 #ifndef _MLB_ACC_INT_H
9350 #define _MLB_ACC_INT_H
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 @@
9357 #if defined(USE_LEVEL_1_MACROS)
9359 -#define MLBMAILBOX_SYSCONFIGReadRegister32(baseAddress)\
9360 - (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGReadRegister32),\
9361 - __raw_readl(((baseAddress))+ \
9362 - MLB_MAILBOX_SYSCONFIG_OFFSET))
9365 -#define MLBMAILBOX_SYSCONFIGWriteRegister32(baseAddress, value)\
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);\
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))
9382 -#define MLBMAILBOX_SYSCONFIGSIdleModeWrite32(baseAddress, value)\
9384 - const u32 offset = MLB_MAILBOX_SYSCONFIG_OFFSET;\
9385 - register u32 data = __raw_readl(((u32)(baseAddress)) +\
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);\
9397 -#define MLBMAILBOX_SYSCONFIGSoftResetWrite32(baseAddress, value)\
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);\
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))
9420 -#define MLBMAILBOX_SYSCONFIGAutoIdleWrite32(baseAddress, value)\
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);\
9434 +#define MLBMAILBOX_SYSCONFIGReadRegister32(baseAddress) \
9435 + (_DEBUG_LEVEL_1_EASI(EASIL1_MLBMAILBOX_SYSCONFIGReadRegister32), \
9436 + __raw_readl(((baseAddress)) + MLB_MAILBOX_SYSCONFIG_OFFSET))
9439 +#define MLBMAILBOX_SYSCONFIGWriteRegister32(baseAddress, value) \
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); \
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))
9454 +#define MLBMAILBOX_SYSCONFIGSIdleModeWrite32(baseAddress, value) \
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); \
9467 +#define MLBMAILBOX_SYSCONFIGSoftResetWrite32(baseAddress, value) \
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); \
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))
9487 +#define MLBMAILBOX_SYSCONFIGAutoIdleWrite32(baseAddress, value) \
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); \
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))
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))))
9516 -#define MLBMAILBOX_MESSAGE___0_15WriteRegister32(baseAddress, bank, value)\
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);\
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))))
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))
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))
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))))
9566 -#define MLBMAILBOX_IRQSTATUS___0_3WriteRegister32(baseAddress, bank, value)\
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);\
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))))
9585 -#define MLBMAILBOX_IRQENABLE___0_3WriteRegister32(baseAddress, bank, value)\
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);\
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))
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))))
9608 +#define MLBMAILBOX_MESSAGE___0_15WriteRegister32(baseAddress, bank, value) \
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); \
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))))
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))
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))
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))))
9653 +#define MLBMAILBOX_IRQSTATUS___0_3WriteRegister32(baseAddress, bank, value) \
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); \
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))))
9671 +#define MLBMAILBOX_IRQENABLE___0_3WriteRegister32(baseAddress, bank, value) \
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); \
9681 #endif /* USE_LEVEL_1_MACROS */
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
9687 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9691 #ifndef _MMU_REG_ACM_H
9692 #define _MMU_REG_ACM_H
9694 @@ -26,227 +25,200 @@
9696 #if defined(USE_LEVEL_1_MACROS)
9699 -#define MMUMMU_SYSCONFIGReadRegister32(baseAddress)\
9700 - (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_SYSCONFIGReadRegister32),\
9701 - __raw_readl((baseAddress)+MMU_MMU_SYSCONFIG_OFFSET))
9704 -#define MMUMMU_SYSCONFIGIdleModeWrite32(baseAddress, value)\
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);\
9718 -#define MMUMMU_SYSCONFIGAutoIdleWrite32(baseAddress, value)\
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);\
9732 -#define MMUMMU_IRQSTATUSReadRegister32(baseAddress)\
9733 - (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQSTATUSReadRegister32),\
9734 - __raw_readl((baseAddress)+MMU_MMU_IRQSTATUS_OFFSET))
9737 -#define MMUMMU_IRQSTATUSWriteRegister32(baseAddress, value)\
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);\
9746 -#define MMUMMU_IRQENABLEReadRegister32(baseAddress)\
9747 - (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQENABLEReadRegister32),\
9748 - __raw_readl((baseAddress)+MMU_MMU_IRQENABLE_OFFSET))
9751 -#define MMUMMU_IRQENABLEWriteRegister32(baseAddress, value)\
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);\
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))
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))
9774 -#define MMUMMU_CNTLTWLEnableWrite32(baseAddress, value)\
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);\
9788 -#define MMUMMU_CNTLMMUEnableWrite32(baseAddress, value)\
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);\
9802 -#define MMUMMU_FAULT_ADReadRegister32(baseAddress)\
9803 - (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_FAULT_ADReadRegister32),\
9804 - __raw_readl((baseAddress)+MMU_MMU_FAULT_AD_OFFSET))
9807 -#define MMUMMU_TTBWriteRegister32(baseAddress, value)\
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);\
9816 -#define MMUMMU_LOCKReadRegister32(baseAddress)\
9817 - (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKReadRegister32),\
9818 - __raw_readl((baseAddress)+MMU_MMU_LOCK_OFFSET))
9821 -#define MMUMMU_LOCKWriteRegister32(baseAddress, value)\
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);\
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))
9837 -#define MMUMMU_LOCKBaseValueWrite32(baseAddress, value)\
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);\
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))
9858 -#define MMUMMU_LOCKCurrentVictimWrite32(baseAddress, value)\
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);\
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)))
9879 -#define MMUMMU_LD_TLBReadRegister32(baseAddress)\
9880 - (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LD_TLBReadRegister32),\
9881 - __raw_readl((baseAddress)+MMU_MMU_LD_TLB_OFFSET))
9884 -#define MMUMMU_LD_TLBWriteRegister32(baseAddress, value)\
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);\
9893 -#define MMUMMU_CAMWriteRegister32(baseAddress, value)\
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);\
9902 -#define MMUMMU_RAMWriteRegister32(baseAddress, value)\
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);\
9911 -#define MMUMMU_FLUSH_ENTRYWriteRegister32(baseAddress, value)\
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);\
9919 +#define MMUMMU_SYSCONFIGReadRegister32(baseAddress) \
9920 + (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_SYSCONFIGReadRegister32), \
9921 + __raw_readl((baseAddress) + MMU_MMU_SYSCONFIG_OFFSET))
9923 +#define MMUMMU_SYSCONFIGIdleModeWrite32(baseAddress, value) \
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); \
9936 +#define MMUMMU_SYSCONFIGAutoIdleWrite32(baseAddress, value) \
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); \
9949 +#define MMUMMU_IRQSTATUSReadRegister32(baseAddress) \
9950 + (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQSTATUSReadRegister32), \
9951 + __raw_readl((baseAddress) + MMU_MMU_IRQSTATUS_OFFSET))
9953 +#define MMUMMU_IRQSTATUSWriteRegister32(baseAddress, value) \
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); \
9961 +#define MMUMMU_IRQENABLEReadRegister32(baseAddress) \
9962 + (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_IRQENABLEReadRegister32), \
9963 + __raw_readl((baseAddress) + MMU_MMU_IRQENABLE_OFFSET))
9965 +#define MMUMMU_IRQENABLEWriteRegister32(baseAddress, value) \
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); \
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))
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))
9985 +#define MMUMMU_CNTLTWLEnableWrite32(baseAddress, value) \
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); \
9998 +#define MMUMMU_CNTLMMUEnableWrite32(baseAddress, value) \
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); \
10011 +#define MMUMMU_FAULT_ADReadRegister32(baseAddress) \
10012 + (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_FAULT_ADReadRegister32), \
10013 + __raw_readl((baseAddress) + MMU_MMU_FAULT_AD_OFFSET))
10015 +#define MMUMMU_TTBWriteRegister32(baseAddress, value) \
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); \
10023 +#define MMUMMU_LOCKReadRegister32(baseAddress) \
10024 + (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LOCKReadRegister32), \
10025 + __raw_readl((baseAddress) + MMU_MMU_LOCK_OFFSET))
10027 +#define MMUMMU_LOCKWriteRegister32(baseAddress, value) \
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); \
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)) \
10040 +#define MMUMMU_LOCKBaseValueWrite32(baseAddress, value) \
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); \
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))
10059 +#define MMUMMU_LOCKCurrentVictimWrite32(baseAddress, value) \
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); \
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)))
10078 +#define MMUMMU_LD_TLBReadRegister32(baseAddress) \
10079 + (_DEBUG_LEVEL_1_EASI(EASIL1_MMUMMU_LD_TLBReadRegister32), \
10080 + __raw_readl((baseAddress) + MMU_MMU_LD_TLB_OFFSET))
10082 +#define MMUMMU_LD_TLBWriteRegister32(baseAddress, value) \
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); \
10090 +#define MMUMMU_CAMWriteRegister32(baseAddress, value) \
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); \
10098 +#define MMUMMU_RAMWriteRegister32(baseAddress, value) \
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); \
10106 +#define MMUMMU_FLUSH_ENTRYWriteRegister32(baseAddress, value) \
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); \
10114 #endif /* USE_LEVEL_1_MACROS */
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 @@
10121 #if defined(USE_LEVEL_1_MACROS)
10123 -#define PRCMPRCM_CLKCFG_CTRLValid_configWriteClk_valid32(baseAddress)\
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);\
10138 -#define CM_FCLKEN_PERReadRegister32(baseAddress)\
10139 - (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32),\
10140 - __raw_readl(((u32)(baseAddress))+CM_FCLKEN_PER_OFFSET))
10143 -#define CM_ICLKEN_PERReadRegister32(baseAddress)\
10144 - (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32),\
10145 - __raw_readl(((u32)(baseAddress))+CM_ICLKEN_PER_OFFSET))
10148 -#define CM_FCLKEN_PER_GPT5WriteRegister32(baseAddress,value)\
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);\
10163 -#define CM_FCLKEN_PER_GPT6WriteRegister32(baseAddress,value)\
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);\
10178 -#define CM_ICLKEN_PER_GPT5WriteRegister32(baseAddress,value)\
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);\
10193 -#define CM_ICLKEN_PER_GPT6WriteRegister32(baseAddress,value)\
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);\
10208 -#define CM_FCLKEN1_COREReadRegister32(baseAddress)\
10209 - (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32),\
10210 - __raw_readl(((u32)(baseAddress))+CM_FCLKEN1_CORE_OFFSET))
10213 -#define PRCMCM_FCLKEN1_COREEN_GPT8Write32(baseAddress,value)\
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);\
10228 -#define PRCMCM_FCLKEN1_COREEN_GPT7Write32(baseAddress,value)\
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);\
10243 -#define CM_ICLKEN1_COREReadRegister32(baseAddress)\
10244 - (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN1_COREReadRegister32),\
10245 - __raw_readl(((u32)(baseAddress))+CM_ICLKEN1_CORE_OFFSET))
10248 -#define CM_ICLKEN1_COREEN_MAILBOXESWrite32(baseAddress, value)\
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);\
10263 -#define PRCMCM_ICLKEN1_COREEN_GPT8Write32(baseAddress, value)\
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);\
10278 -#define PRCMCM_ICLKEN1_COREEN_GPT7Write32(baseAddress, value)\
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);\
10293 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8Write32k32(baseAddress)\
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);\
10306 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteSys32(baseAddress)\
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);\
10319 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteExt32(baseAddress)\
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);\
10332 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7Write32k32(baseAddress)\
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);\
10345 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteSys32(baseAddress)\
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);\
10358 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteExt32(baseAddress)\
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);\
10371 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteSys32(baseAddress)\
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);\
10384 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteExt32(baseAddress)\
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);\
10397 -#define CM_CLKSEL_PER_GPT5Write32k32(baseAddress)\
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);\
10410 -#define CM_CLKSEL_PER_GPT6Write32k32(baseAddress)\
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);\
10423 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteSys32(baseAddress)\
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);\
10436 -#define PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteExt32(baseAddress)\
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);\
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))
10457 -#define CM_FCLKEN_IVA2EN_DSPWrite32(baseAddress,value)\
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);\
10472 -#define PRCMCM_ICLKEN_DSPEN_DSP_IPIWrite32(baseAddress, value)\
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);\
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))
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) \
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); \
10511 +#define CM_FCLKEN_PERReadRegister32(baseAddress) \
10512 + (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32), \
10513 + __raw_readl(((u32)(baseAddress)) + CM_FCLKEN_PER_OFFSET))
10515 +#define CM_ICLKEN_PERReadRegister32(baseAddress) \
10516 + (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32), \
10517 + __raw_readl(((u32)(baseAddress)) + CM_ICLKEN_PER_OFFSET))
10519 +#define CM_FCLKEN_PER_GPT5WriteRegister32(baseAddress, value) \
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); \
10532 +#define CM_FCLKEN_PER_GPT6WriteRegister32(baseAddress, value) \
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); \
10545 +#define CM_ICLKEN_PER_GPT5WriteRegister32(baseAddress, value) \
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); \
10558 +#define CM_ICLKEN_PER_GPT6WriteRegister32(baseAddress, value) \
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); \
10571 +#define CM_FCLKEN1_COREReadRegister32(baseAddress) \
10572 + (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_FCLKEN1_COREReadRegister32), \
10573 + __raw_readl(((u32)(baseAddress)) + CM_FCLKEN1_CORE_OFFSET))
10576 +#define PRCMCM_FCLKEN1_COREEN_GPT8Write32(baseAddress, value) \
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); \
10589 +#define PRCMCM_FCLKEN1_COREEN_GPT7Write32(baseAddress, value) \
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); \
10602 +#define CM_ICLKEN1_COREReadRegister32(baseAddress) \
10603 + (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMCM_ICLKEN1_COREReadRegister32), \
10604 + __raw_readl(((u32)(baseAddress)) + CM_ICLKEN1_CORE_OFFSET))
10606 +#define CM_ICLKEN1_COREEN_MAILBOXESWrite32(baseAddress, value) \
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); \
10620 +#define PRCMCM_ICLKEN1_COREEN_GPT8Write32(baseAddress, value) \
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); \
10633 +#define PRCMCM_ICLKEN1_COREEN_GPT7Write32(baseAddress, value) \
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); \
10646 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8Write32k32(baseAddress) \
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); \
10659 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteSys32(baseAddress) \
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); \
10671 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT8WriteExt32(baseAddress) \
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); \
10683 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7Write32k32(baseAddress) \
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); \
10695 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteSys32(baseAddress) \
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); \
10707 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT7WriteExt32(baseAddress) \
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); \
10719 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteSys32(baseAddress) \
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); \
10731 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT6WriteExt32(baseAddress) \
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); \
10743 +#define CM_CLKSEL_PER_GPT5Write32k32(baseAddress) \
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); \
10755 +#define CM_CLKSEL_PER_GPT6Write32k32(baseAddress) \
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); \
10767 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteSys32(baseAddress) \
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); \
10779 +#define PRCMCM_CLKSEL2_CORECLKSEL_GPT5WriteExt32(baseAddress) \
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); \
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))
10798 +#define CM_FCLKEN_IVA2EN_DSPWrite32(baseAddress, value) \
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); \
10811 +#define PRCMCM_ICLKEN_DSPEN_DSP_IPIWrite32(baseAddress, value) \
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); \
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))
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))
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))
10845 -#define PRCMCM_AUTOIDLE_DSPAUTO_DSP_IPIWrite32(baseAddress, value)\
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);\
10860 -#define PRCMCM_CLKSEL_DSPSYNC_DSPWrite32(baseAddress,value)\
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);\
10875 -#define PRCMCM_CLKSEL_DSPCLKSEL_DSP_IFWrite32(baseAddress, value)\
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);\
10890 -#define PRCMCM_CLKSEL_DSPCLKSEL_DSPWrite32(baseAddress, value)\
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);\
10905 -#define PRCMCM_CLKSTCTRL_IVA2WriteRegister32(baseAddress, value)\
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);\
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))
10928 -#define PRCMCM_CLKSTCTRL_DSPAutostate_DSPWrite32(baseAddress, value)\
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);\
10943 -#define PRCMRM_RSTCTRL_DSPReadRegister32(baseAddress)\
10944 - (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTCTRL_DSPReadRegister32),\
10945 - __raw_readl(((baseAddress))+PRCM_RM_RSTCTRL_DSP_OFFSET))
10948 -#define PRM_RSTCTRL_IVA2RST1_DSPWrite32(baseAddress,value)\
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);\
10963 -#define PRM_RSTCTRL_IVA2RST2_DSPWrite32(baseAddress,value)\
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);\
10978 -#define PRM_RSTCTRL_IVA2RST3_DSPWrite32(baseAddress,value)\
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);\
10993 -#define PRCMRM_RSTST_DSPReadRegister32(baseAddress)\
10994 - (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTST_DSPReadRegister32),\
10995 - __raw_readl(((baseAddress))+PRCM_RM_RSTST_DSP_OFFSET))
10998 -#define PRCMRM_RSTST_DSPWriteRegister32(baseAddress,value)\
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);\
11007 -#define PRCMPM_PWSTCTRL_DSPForceStateWrite32(baseAddress, value)\
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);\
11022 -#define PRCMPM_PWSTCTRL_IVA2PowerStateWriteON32(baseAddress)\
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);\
11035 -#define PRCMPM_PWSTCTRL_IVA2PowerStateWriteOFF32(baseAddress)\
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);\
11048 -#define PRCMPM_PWSTCTRL_DSPPowerStateWriteRET32(baseAddress)\
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);\
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))
11066 -#define PRCMPM_PWSTST_IVA2ReadRegister32(baseAddress)\
11067 - (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_IVA2ReadRegister32),\
11068 - __raw_readl((baseAddress) + PRCM_PM_PWSTST_IVA2_OFFSET))
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))
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))
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))
11094 +#define PRCMCM_AUTOIDLE_DSPAUTO_DSP_IPIWrite32(baseAddress, value) \
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); \
11108 +#define PRCMCM_CLKSEL_DSPSYNC_DSPWrite32(baseAddress, value) \
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); \
11122 +#define PRCMCM_CLKSEL_DSPCLKSEL_DSP_IFWrite32(baseAddress, value) \
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); \
11135 +#define PRCMCM_CLKSEL_DSPCLKSEL_DSPWrite32(baseAddress, value) \
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); \
11148 +#define PRCMCM_CLKSTCTRL_IVA2WriteRegister32(baseAddress, value) \
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); \
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))
11169 +#define PRCMCM_CLKSTCTRL_DSPAutostate_DSPWrite32(baseAddress, value) \
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); \
11182 +#define PRCMRM_RSTCTRL_DSPReadRegister32(baseAddress) \
11183 + (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTCTRL_DSPReadRegister32), \
11184 + __raw_readl(((baseAddress)) + PRCM_RM_RSTCTRL_DSP_OFFSET))
11186 +#define PRM_RSTCTRL_IVA2RST1_DSPWrite32(baseAddress, value) \
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); \
11199 +#define PRM_RSTCTRL_IVA2RST2_DSPWrite32(baseAddress, value) \
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); \
11212 +#define PRM_RSTCTRL_IVA2RST3_DSPWrite32(baseAddress, value) \
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); \
11225 +#define PRCMRM_RSTST_DSPReadRegister32(baseAddress) \
11226 + (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMRM_RSTST_DSPReadRegister32), \
11227 + __raw_readl(((baseAddress)) + PRCM_RM_RSTST_DSP_OFFSET))
11229 +#define PRCMRM_RSTST_DSPWriteRegister32(baseAddress, value) \
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); \
11237 +#define PRCMPM_PWSTCTRL_DSPForceStateWrite32(baseAddress, value) \
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); \
11250 +#define PRCMPM_PWSTCTRL_IVA2PowerStateWriteON32(baseAddress) \
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); \
11262 +#define PRCMPM_PWSTCTRL_IVA2PowerStateWriteOFF32(baseAddress) \
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); \
11274 +#define PRCMPM_PWSTCTRL_DSPPowerStateWriteRET32(baseAddress) \
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); \
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))
11291 +#define PRCMPM_PWSTST_IVA2ReadRegister32(baseAddress) \
11292 + (_DEBUG_LEVEL_1_EASI(EASIL1_PRCMPM_PWSTST_IVA2ReadRegister32), \
11293 + __raw_readl((baseAddress) + PRCM_PM_PWSTST_IVA2_OFFSET))
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))
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))
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))
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))
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))
11326 #endif /* USE_LEVEL_1_MACROS */
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
11333 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11335 + * Global HW definitions
11337 * Copyright (C) 2007 Texas Instruments, Inc.
11339 * This package is free software; you can redistribute it and/or modify
11341 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11346 - * ======== hw_defs.h ========
11348 - * Global HW definitions
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
11355 #ifndef __HW_DEFS_H
11356 #define __HW_DEFS_H
11359 /* HW_STATUS: return type for HW API */
11360 typedef long HW_STATUS;
11362 -/* HW_SetClear_t: Enumerated Type used to set and clear any bit */
11363 -enum HW_SetClear_t {
11367 +/* Macro used to set and clear any bit */
11368 +#define HW_CLEAR 0
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
11378 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11380 + * API definitions to configure DSP Subsystem modules like IPI
11382 * Copyright (C) 2005-2006 Texas Instruments, Inc.
11384 * This package is free software; you can redistribute it and/or modify
11386 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11390 - * ======== hw_dspss64P.c ========
11392 - * API definitions to configure DSP Subsystem modules like IPI
11394 - *! Revision History:
11395 - *! ================
11396 - *! 19 Apr 2004 sb: Implemented HW_DSPSS_IPIEndianismSet
11397 - *! 16 Feb 2003 sb: Initial version
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
11408 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11410 + * DSP Subsystem API declarations
11412 * Copyright (C) 2005-2006 Texas Instruments, Inc.
11414 * This package is free software; you can redistribute it and/or modify
11416 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11421 - * ======== hw_dspss.h ========
11423 - * DSP Subsystem API declarations
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
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
11440 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11442 + * Mailbox messaging & configuration API definitions
11444 * Copyright (C) 2007 Texas Instruments, Inc.
11446 * This package is free software; you can redistribute it and/or modify
11448 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11453 - * ======== hw_mbox.c ========
11455 - * Mailbox messaging & configuration API definitions
11457 - *! Revision History:
11458 - *! ================
11459 - *! 16 Feb 2003 sb: Initial version
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
11469 +/* SYSCONFIG: register bit definition */
11470 +#define AUTOIDLE (1 << 0)
11471 +#define SMARTIDLE (2 << 3)
11473 struct MAILBOX_CONTEXT mboxsetting = {
11474 - .sysconfig = 2 << 3 | 1, /* SMART/AUTO-IDLE */
11475 + .sysconfig = SMARTIDLE | AUTOIDLE,
11478 +HW_STATUS HW_MBOX_initSettings(void __iomem *baseAddress)
11480 + MLBMAILBOX_SYSCONFIGWriteRegister32(baseAddress, SMARTIDLE | AUTOIDLE);
11484 /* Saves the mailbox context */
11485 HW_STATUS HW_MBOX_saveSettings(void __iomem *baseAddress)
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
11492 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11494 + * HW Mailbox API and types definitions
11496 * Copyright (C) 2007 Texas Instruments, Inc.
11498 * This package is free software; you can redistribute it and/or modify
11500 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11504 - * ======== hw_mbox.h ========
11506 - * HW Mailbox API and types definitions
11508 - *! Revision History:
11509 - *! ================
11510 - *! 16 Feb 2003 sb: Initial version
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
11519 -extern HW_STATUS HW_MBOX_MsgWrite(
11520 - const void __iomem *baseAddress,
11521 - const HW_MBOX_Id_t mailBoxId,
11522 - const u32 writeValue
11524 +extern HW_STATUS HW_MBOX_MsgWrite(const void __iomem *baseAddress,
11525 + const HW_MBOX_Id_t mailBoxId, const u32 writeValue);
11528 * FUNCTION : HW_MBOX_NumMsgGet
11529 @@ -157,11 +147,8 @@ extern HW_STATUS HW_MBOX_MsgWrite(
11531 * PURPOSE: : this function gets number of messages in a specified mailbox.
11533 -extern HW_STATUS HW_MBOX_NumMsgGet(
11534 - const void __iomem *baseAddress,
11535 - const HW_MBOX_Id_t mailBoxId,
11536 - u32 *const pNumMsg
11538 +extern HW_STATUS HW_MBOX_NumMsgGet(const void __iomem *baseAddress,
11539 + const HW_MBOX_Id_t mailBoxId, u32 *const pNumMsg);
11542 * FUNCTION : HW_MBOX_EventEnable
11543 @@ -193,12 +180,10 @@ extern HW_STATUS HW_MBOX_NumMsgGet(
11545 * PURPOSE: : this function enables the specified IRQ.
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,
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);
11559 * FUNCTION : HW_MBOX_EventDisable
11560 @@ -230,12 +215,10 @@ extern HW_STATUS HW_MBOX_EventEnable(
11562 * PURPOSE: : this function disables the specified IRQ.
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,
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);
11576 * FUNCTION : HW_MBOX_EventAck
11577 @@ -269,12 +252,32 @@ extern HW_STATUS HW_MBOX_EventDisable(
11579 * PURPOSE: : this function sets the status of the specified IRQ.
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,
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);
11593 +* FUNCTION : HW_MBOX_initSettings
11597 +* Identifier : baseAddress
11598 +* Type : const u32
11599 +* Description : Base Address of instance of Mailbox module
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
11610 +* PURPOSE: : This function initialize the mailbox configuration.
11612 +extern HW_STATUS HW_MBOX_initSettings(void __iomem *baseAddres);
11615 * FUNCTION : HW_MBOX_saveSettings
11616 @@ -320,9 +323,4 @@ extern HW_STATUS HW_MBOX_saveSettings(vo
11618 extern HW_STATUS HW_MBOX_restoreSettings(void __iomem *baseAddres);
11620 -static inline void HW_MBOX_initSettings(void __iomem *baseAddres)
11622 - HW_MBOX_restoreSettings(baseAddres);
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
11631 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11633 + * API definitions to setup MMU TLB and PTE
11635 * Copyright (C) 2007 Texas Instruments, Inc.
11637 * This package is free software; you can redistribute it and/or modify
11639 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11643 - * ======== hw_mmu.c ========
11645 - * API definitions to setup MMU TLB and PTE
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
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
11663 struct HW_MMUMapAttrs_t *mapAttrs,
11664 - enum HW_SetClear_t preservedBit,
11665 - enum HW_SetClear_t validBit)
11666 + s8 preservedBit, s8 validBit)
11668 HW_STATUS status = RET_OK;
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
11675 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11677 + * MMU types and API declarations
11679 * Copyright (C) 2007 Texas Instruments, Inc.
11681 * This package is free software; you can redistribute it and/or modify
11683 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11688 - * ======== hw_mmu.h ========
11690 - * MMU types and API declarations
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
11702 @@ -98,8 +87,7 @@ extern HW_STATUS HW_MMU_TLBAdd(const voi
11705 struct HW_MMUMapAttrs_t *mapAttrs,
11706 - enum HW_SetClear_t preservedBit,
11707 - enum HW_SetClear_t validBit);
11708 + s8 preservedBit, s8 validBit);
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
11717 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11719 + * API definitions to configure PRCM (Power, Reset & Clocks Manager)
11721 * Copyright (C) 2007 Texas Instruments, Inc.
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.
11729 - * ======== hw_prcm.c ========
11731 - * API definitions to configure PRCM (Power, Reset & Clocks Manager)
11733 - *! Revision History:
11734 - *! ================
11735 - *! 16 Feb 2003 sb: Initial version
11738 #include <GlobalTypes.h>
11739 #include "PRCMRegAcM.h"
11740 #include <hw_defs.h>
11741 #include <hw_prcm.h>
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);
11748 HW_STATUS HW_RST_Reset(const void __iomem *baseAddress, enum HW_RstModule_t r)
11750 @@ -44,8 +35,7 @@ HW_STATUS HW_RST_UnReset(const void __io
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)
11758 HW_STATUS status = RET_OK;
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
11765 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11767 + * PRCM types and API declarations
11769 * Copyright (C) 2007 Texas Instruments, Inc.
11771 * This package is free software; you can redistribute it and/or modify
11773 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11777 - * ======== hw_prcm.h ========
11779 - * PRCM types and API declarations
11781 - *! Revision History:
11782 - *! ================
11783 - *! 16 Feb 2003 sb: Initial version
11786 #ifndef __HW_PRCM_H
11787 #define __HW_PRCM_H
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
11794 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11796 + * WCD channel interface: multiplexes data streams through the single
11797 + * physical link managed by a Bridge mini-driver.
11799 * Copyright (C) 2005-2006 Texas Instruments, Inc.
11801 * This package is free software; you can redistribute it and/or modify
11803 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11808 - * ======== chnl.c ========
11810 - * WCD channel interface: multiplexes data streams through the single
11811 - * physical link managed by a 'Bridge mini-driver.
11813 - * Public Functions:
11815 - * CHNL_CloseOrphans
11820 - * CHNL_GetProcessHandle
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().
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
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.
11854 /* ----------------------------------- Host OS */
11855 #include <dspbridge/host_os.h>
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>
11867 @@ -153,10 +105,12 @@ DSP_STATUS CHNL_Create(OUT struct CHNL_M
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,
11875 + status = DEV_GetIntfFxns(hDevObject, &pIntfFxns);
11877 + /* Let WMD channel module finish the create */
11878 + status = (*pIntfFxns->pfnChnlCreate)(&hChnlMgr,
11879 + hDevObject, pMgrAttrs);
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
11889 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11891 + * Structure subcomponents of channel class library channel objects which
11892 + * are exposed to class driver from mini-driver.
11894 * Copyright (C) 2005-2006 Texas Instruments, Inc.
11896 * This package is free software; you can redistribute it and/or modify
11898 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11903 - * ======== chnlobj.h ========
11905 - * Structure subcomponents of channel class library channel objects which
11906 - * are exposed to class driver from mini-driver.
11908 - * Public Functions:
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
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
11927 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
11929 + * The Communication(Shared) Memory Management(CMM) module provides
11930 + * shared memory management services for DSP/BIOS Bridge data streaming
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.
11938 + * Memory is coelesced back to the appropriate heap when a buffer is
11942 + * Va: Virtual address.
11943 + * Pa: Physical or kernel system address.
11945 * Copyright (C) 2005-2006 Texas Instruments, Inc.
11947 * This package is free software; you can redistribute it and/or modify
11949 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11954 - * ======== cmm.c ========
11956 - * The Communication(Shared) Memory Management(CMM) module provides
11957 - * shared memory management services for DSP/BIOS Bridge data streaming
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.
11965 - * Memory is coelesced back to the appropriate heap when a buffer is
11968 - * Public Functions:
11977 - * CMM_RegisterGPPSMSeg
11978 - * CMM_UnRegisterGPPSMSeg
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.
11984 - * Translator Routines:
11985 - * CMM_XlatorAllocBuf
11986 - * CMM_XlatorCreate
11987 - * CMM_XlatorDelete
11988 - * CMM_XlatorFreeBuf
11990 - * CMM_XlatorTranslate
11992 - * Private Functions:
11998 - * UnRegisterGPPSMSeg
12001 - * Va: Virtual address.
12002 - * Pa: Physical or kernel system address.
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++
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.
12031 /* ----------------------------------- DSP/BIOS Bridge */
12032 #include <dspbridge/std.h>
12033 #include <dspbridge/dbdefs.h>
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>
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
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
12055 /* SM node representing a block of memory. */
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,
12066 - /* leftovers go free */
12067 - AddToFreeList(pAllocator, pNewNode);
12069 + /* leftovers go free */
12070 + AddToFreeList(pAllocator, pNewNode);
12072 /* adjust our node's size */
12073 pNode->ulSize = uSize;
12075 @@ -289,7 +227,7 @@ void *CMM_CallocBuf(struct CMM_OBJECT *h
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 */
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() "
12095 + "CMM_Create: Out of memory\n");
12096 status = DSP_EMEMORY;
12098 + INIT_LIST_HEAD(&pCmmObject->pNodeFreeListHead->
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);
12113 /* delete NodeFreeList list */
12114 - LST_Delete(pCmmMgr->pNodeFreeListHead);
12115 + MEM_Free(pCmmMgr->pNodeFreeListHead);
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) {
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
12131 pCurNode = (struct CMM_MNODE *)LST_Next(pAllocator->
12132 - pInUseListHead, (struct LST_ELEM *)pCurNode);
12134 + (struct list_head *)pCurNode);
12136 SYNC_LeaveCS(pCmmMgr->hCmmLock);
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.
12142 -DSP_STATUS CMM_GetHandle(DSP_HPROCESSOR hProcessor,
12143 +DSP_STATUS CMM_GetHandle(void *hProcessor,
12144 OUT struct CMM_OBJECT **phCmmMgr)
12146 DSP_STATUS status = DSP_SOK;
12147 @@ -590,7 +530,7 @@ DSP_STATUS CMM_GetInfo(struct CMM_OBJECT
12149 pCurNode = (struct CMM_MNODE *)LST_Next(pAltr->
12151 - (struct LST_ELEM *)pCurNode);
12152 + (struct list_head *)pCurNode);
12156 @@ -632,7 +572,7 @@ bool CMM_Init(void)
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,
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;
12180 + INIT_LIST_HEAD(&pSMA->pFreeListHead->head);
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;
12195 + INIT_LIST_HEAD(&pSMA->pInUseListHead->head);
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 */
12202 LST_PutTail(pSMA->pFreeListHead,
12203 - (struct LST_ELEM *)pNewNode);
12204 + (struct list_head *)pNewNode);
12206 status = DSP_EMEMORY;
12208 @@ -820,27 +764,27 @@ static void UnRegisterGPPSMSeg(struct CM
12210 pNextNode = (struct CMM_MNODE *)LST_Next(pSMA->
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);
12219 pCurNode = pNextNode;
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);
12226 pNextNode = (struct CMM_MNODE *)LST_Next(pSMA->
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);
12235 pCurNode = pNextNode;
12237 - LST_Delete(pSMA->pInUseListHead); /* delete InUse list */
12238 + MEM_Free(pSMA->pInUseListHead); /* delete InUse list */
12240 if ((void *) pSMA->dwVmBase != NULL)
12241 MEM_UnmapLinearAddress((void *) pSMA->dwVmBase);
12242 @@ -893,15 +837,13 @@ static struct CMM_MNODE *GetNode(struct
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);
12251 if (pNode == NULL) {
12252 GT_0trace(CMM_debugMask, GT_7CLASS, "GetNode: Out Of Memory\n");
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)
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);
12270 @@ -937,12 +879,13 @@ static struct CMM_MNODE *GetFreeBlock(st
12272 if (uSize <= (u32) pCurNode->ulSize) {
12273 LST_RemoveElem(pAllocator->pFreeListHead,
12274 - (struct LST_ELEM *)pCurNode);
12275 + (struct list_head *)pCurNode);
12279 pCurNode = (struct CMM_MNODE *)LST_Next(pAllocator->
12280 - pFreeListHead, (struct LST_ELEM *)pCurNode);
12282 + (struct list_head *)pCurNode);
12286 @@ -977,7 +920,8 @@ static void AddToFreeList(struct CMM_ALL
12287 if ((pNodePrev == NULL) || (pNodeNext == NULL)) {
12289 pCurNode = (struct CMM_MNODE *)LST_Next(pAllocator->
12290 - pFreeListHead, (struct LST_ELEM *)pCurNode);
12292 + (struct list_head *)pCurNode);
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);
12312 pNode->ulSize += pNodeNext->ulSize;
12313 /* place node on mgr nodeFreeList */
12314 @@ -1011,17 +955,17 @@ static void AddToFreeList(struct CMM_ALL
12317 pCurNode = (struct CMM_MNODE *)LST_Next(pAllocator->
12318 - pFreeListHead, (struct LST_ELEM *)pCurNode);
12319 + pFreeListHead, (struct list_head *)pCurNode);
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);
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);
12336 @@ -1050,6 +994,12 @@ static struct CMM_ALLOCATOR *GetAllocato
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.
12346 * ======== CMM_XlatorCreate ========
12348 * Create an address translator object.
12349 @@ -1101,11 +1051,10 @@ DSP_STATUS CMM_XlatorDelete(struct CMM_X
12351 DBC_Require(cRefs > 0);
12353 - if (MEM_IsValidHandle(pXlator, CMMXLATESIGNATURE)) {
12354 + if (MEM_IsValidHandle(pXlator, CMMXLATESIGNATURE))
12355 MEM_FreeObject(pXlator);
12358 status = DSP_EHANDLE;
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
12368 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
12370 + * This module implements DSP code management for the DSP/BIOS Bridge
12371 + * environment. It is mostly a thin wrapper.
12373 + * This module provides an interface for loading both static and
12374 + * dynamic code objects onto DSP systems.
12376 * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
12385 - * ======== cod.c ========
12386 - * This module implements DSP code management for the DSP/BIOS Bridge
12387 - * environment. It is mostly a thin wrapper.
12389 - * This module provides an interface for loading both static and
12390 - * dynamic code objects onto DSP systems.
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.
12424 /* ----------------------------------- Host OS */
12425 #include <dspbridge/host_os.h>
12426 +#include <linux/fs.h>
12427 +#include <linux/uaccess.h>
12429 /* ----------------------------------- DSP/BIOS Bridge */
12430 #include <dspbridge/std.h>
12432 #include <dspbridge/gt.h>
12434 /* ----------------------------------- OS Adaptation Layer */
12435 -#include <dspbridge/csl.h>
12436 -#include <dspbridge/kfile.h>
12437 #include <dspbridge/ldr.h>
12438 #include <dspbridge/mem.h>
12440 @@ -137,6 +102,101 @@ static struct DBLL_Fxns dbllFxns = {
12441 static bool NoOp(void);
12444 + * File operations (originally were under kfile.c)
12446 +static s32 COD_fClose(struct file *hFile)
12448 + /* Check for valid handle */
12450 + return DSP_EHANDLE;
12452 + filp_close(hFile, NULL);
12454 + /* we can't use DSP_SOK here */
12458 +static struct file *COD_fOpen(CONST char *pszFileName, CONST char *pszMode)
12461 + struct file *hFile;
12464 + set_fs(get_ds());
12466 + /* ignore given mode and open file as read-only */
12467 + hFile = filp_open(pszFileName, O_RDONLY, 0);
12469 + if (IS_ERR(hFile))
12477 +static s32 COD_fRead(void __user *pBuffer, s32 cSize, s32 cCount,
12478 + struct file *hFile)
12480 + /* check for valid file handle */
12482 + return DSP_EHANDLE;
12484 + if ((cSize > 0) && (cCount > 0) && pBuffer) {
12488 + /* read from file */
12490 + set_fs(get_ds());
12491 + dwBytesRead = hFile->f_op->read(hFile, pBuffer, cSize * cCount,
12492 + &(hFile->f_pos));
12495 + if (!dwBytesRead)
12496 + return DSP_EFREAD;
12498 + return dwBytesRead / cSize;
12501 + return DSP_EINVALIDARG;
12504 +static s32 COD_fSeek(struct file *hFile, s32 lOffset, s32 cOrigin)
12508 + /* check for valid file handle */
12510 + return DSP_EHANDLE;
12512 + /* based on the origin flag, move the internal pointer */
12513 + dwCurPos = hFile->f_op->llseek(hFile, lOffset, cOrigin);
12515 + if ((s32)dwCurPos < 0)
12516 + return DSP_EFAIL;
12518 + /* we can't use DSP_SOK here */
12522 +static s32 COD_fTell(struct file *hFile)
12527 + return DSP_EHANDLE;
12529 + /* Get current position */
12530 + dwCurPos = hFile->f_op->llseek(hFile, 0, SEEK_CUR);
12532 + if ((s32)dwCurPos < 0)
12533 + return DSP_EFAIL;
12539 * ======== COD_Close ========
12541 void COD_Close(struct COD_LIBRARYOBJ *lib)
12542 @@ -200,11 +260,11 @@ DSP_STATUS COD_Create(OUT struct COD_MAN
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);
12562 if (uSize <= COD_MAXPATHLENGTH)
12563 - strncpy(pszName, hManager->szZLFile, uSize);
12564 + strncpy(pszName, hManager->szZLFile, uSize);
12566 status = DSP_EFAIL;
12568 @@ -341,7 +401,7 @@ DSP_STATUS COD_GetEntry(struct COD_MANAG
12569 * Get handle to the DBLL loader.
12571 DSP_STATUS COD_GetLoader(struct COD_MANAGER *hManager,
12572 - struct DBLL_TarObj **phLoader)
12573 + struct DBLL_TarObj **phLoader)
12575 DSP_STATUS status = DSP_SOK;
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
12584 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
12586 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
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.
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.
12618 -/* ----------------------------------- Host OS */
12619 -#include <dspbridge/host_os.h>
12621 -/* ----------------------------------- DSP/BIOS Bridge */
12622 -#include <dspbridge/std.h>
12623 -#include <dspbridge/dbdefs.h>
12624 -#include <dspbridge/errbase.h>
12626 -/* ----------------------------------- Trace & Debug */
12627 -#include <dspbridge/dbc.h>
12628 -#include <dspbridge/gt.h>
12630 -/* ----------------------------------- OS Adaptation Layer */
12631 -#include <dspbridge/csl.h>
12632 -#include <dspbridge/mem.h>
12633 -#include <dspbridge/kfile.h>
12635 -/* ----------------------------------- This */
12636 -#include <dspbridge/dbof.h>
12637 -#include <dspbridge/dbl.h>
12639 -#define DBL_TARGSIGNATURE 0x544c4244 /* "TLBD" */
12640 -#define DBL_LIBSIGNATURE 0x4c4c4244 /* "LLBD" */
12644 -#define NUMTARGS 2
12646 -#define C54MAGIC 0x98 /* Magic number for TI C54 COF */
12647 -#define C55MAGIC 0x9c /* Magic number for LEAD3 (C55) COF */
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 */
12655 -/* Default load buffer size */
12656 -#define LOADBUFSIZE 0x800
12658 -#define SWAPLONG(x) ((((x) << 24) & 0xFF000000) | (((x) << 8) & 0xFF0000L) | \
12659 - (((x) >> 8) & 0xFF00L) | (((x) >> 24) & 0xFF))
12661 -#define SWAPWORD(x) ((((x) << 8) & 0xFF00) | (((x) >> 8) & 0xFF))
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
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))
12682 - * ======== 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 */
12694 - * ======== OvlyData ========
12697 - struct OvlyHdr hdr;
12698 - struct DBOF_OvlySectData data[1];
12702 - * ======== Symbol ========
12705 - struct DBL_Symbol sym;
12710 - * ======== DCDSect ========
12713 - struct DBOF_DCDSectHdr sectHdr;
12718 - * ======== DBL_TargetObj ========
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 */
12727 - * ======== TargetInfo ========
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 */
12738 - * ======== DBL_LibraryObj ========
12739 - * Represents a library loaded on a target.
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 */
12757 -static struct GT_Mask DBL_debugMask = { NULL, NULL }; /* GT trace variable */
12760 -static u32 cRefs; /* module reference count */
12762 -static u32 magicTab[NUMTARGS] = { C54MAGIC, C55MAGIC };
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 */
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);
12784 - * ======== DBL_close ========
12786 - * Close library opened with DBL_open.
12788 -void DBL_close(struct DBL_LibraryObj *lib)
12790 - struct DBL_LibraryObj *pdblLib = (struct DBL_LibraryObj *)lib;
12793 - DBC_Require(cRefs > 0);
12794 - DBC_Require(MEM_IsValidHandle(pdblLib, DBL_LIBSIGNATURE));
12796 - GT_1trace(DBL_debugMask, GT_ENTER, "DBL_close: lib: 0x%x\n", lib);
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);
12805 - MEM_Free(pdblLib->symbols);
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);
12815 - MEM_Free(pdblLib->dcdSects);
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]->
12826 - MEM_Free(pdblLib->ppOvlyData[i]);
12829 - MEM_Free(pdblLib->ppOvlyData);
12832 - /* Close the file */
12833 - if (pdblLib->file)
12834 - (*pdblLib->pTarget->dblAttrs.fclose) (pdblLib->file);
12837 - MEM_FreeObject(pdblLib);
12841 - * ======== DBL_create ========
12843 - * Create a target object by specifying the alloc, free, and
12844 - * write functions for the target.
12846 -DSP_STATUS DBL_create(struct DBL_TargetObj **pTarget, struct DBL_Attrs *pAttrs)
12848 - struct DBL_TargetObj *pdblTarget = NULL;
12849 - DSP_STATUS status = DSP_SOK;
12851 - DBC_Require(cRefs > 0);
12852 - DBC_Require(pAttrs != NULL);
12853 - DBC_Require(pTarget != NULL);
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;
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;
12872 - if (DSP_SUCCEEDED(status)) {
12873 - *pTarget = pdblTarget;
12877 - DBL_delete(pdblTarget);
12880 - DBC_Ensure(DSP_SUCCEEDED(status) &&
12881 - ((MEM_IsValidHandle((*pTarget), DBL_TARGSIGNATURE)) ||
12882 - (DSP_FAILED(status) && *pTarget == NULL)));
12887 - * ======== DBL_delete ========
12889 - * Delete target object and free resources for any loaded libraries.
12891 -void DBL_delete(struct DBL_TargetObj *target)
12893 - DBC_Require(cRefs > 0);
12894 - DBC_Require(MEM_IsValidHandle(target, DBL_TARGSIGNATURE));
12896 - GT_1trace(DBL_debugMask, GT_ENTER,
12897 - "DBL_delete: target: 0x%x\n", target);
12899 - if (target->pBuf)
12900 - MEM_Free(target->pBuf);
12902 - MEM_FreeObject(target);
12906 - * ======== DBL_exit ========
12908 - * Discontinue usage of DBL module.
12912 - DBC_Require(cRefs > 0);
12914 - GT_1trace(DBL_debugMask, GT_5CLASS,
12915 - "DBL_exit() ref count: 0x%x\n", cRefs);
12916 - DBC_Ensure(cRefs >= 0);
12920 - * ======== DBL_getAddr ========
12922 - * Get address of name in the specified library.
12924 -bool DBL_getAddr(struct DBL_LibraryObj *lib, char *name,
12925 - struct DBL_Symbol **ppSym)
12927 - bool retVal = false;
12928 - struct Symbol *symbol;
12931 - DBC_Require(cRefs > 0);
12932 - DBC_Require(MEM_IsValidHandle(lib, DBL_LIBSIGNATURE));
12933 - DBC_Require(name != NULL);
12934 - DBC_Require(ppSym != NULL);
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) {
12943 - *ppSym = &lib->symbols[i].sym;
12952 - * ======== DBL_getAttrs ========
12954 - * Retrieve the attributes of the target.
12956 -void DBL_getAttrs(struct DBL_TargetObj *target, struct DBL_Attrs *pAttrs)
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;
12967 - * ======== DBL_getCAddr ========
12969 - * Get address of "C" name in the specified library.
12971 -bool DBL_getCAddr(struct DBL_LibraryObj *lib, char *name,
12972 - struct DBL_Symbol **ppSym)
12974 - bool retVal = false;
12975 - struct Symbol *symbol;
12978 - DBC_Require(cRefs > 0);
12979 - DBC_Require(MEM_IsValidHandle(lib, DBL_LIBSIGNATURE));
12980 - DBC_Require(name != NULL);
12981 - DBC_Require(ppSym != NULL);
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] == '_')) {
12992 - *ppSym = &lib->symbols[i].sym;
13001 - * ======== DBL_getEntry ========
13003 - * Get program entry point.
13006 -bool DBL_getEntry(struct DBL_LibraryObj *lib, u32 *pEntry)
13008 - struct DBL_LibraryObj *pdblLib = (struct DBL_LibraryObj *)lib;
13010 - DBC_Require(cRefs > 0);
13011 - DBC_Require(MEM_IsValidHandle(pdblLib, DBL_LIBSIGNATURE));
13012 - DBC_Require(pEntry != NULL);
13014 - GT_2trace(DBL_debugMask, GT_ENTER,
13015 - "DBL_getEntry: lib: 0x%x pEntry: 0x%x\n", lib, pEntry);
13016 - *pEntry = pdblLib->fileHdr.entry;
13022 - * ======== DBL_getSect ========
13024 - * Get address and size of a named section.
13026 -DSP_STATUS DBL_getSect(struct DBL_LibraryObj *lib, char *name, u32 *pAddr,
13029 - struct DBL_LibraryObj *pdblLib = (struct DBL_LibraryObj *)lib;
13031 - DSP_STATUS status = DSP_ENOSECT;
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));
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);
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 '.'
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,
13054 - *pSize = pdblLib->dcdSects[i].sectHdr.size *
13055 - pdblLib->pTargetInfo->mauSize;
13056 - status = DSP_SOK;
13061 - /* Check for overlay section */
13062 - for (i = 0; i < pdblLib->nOvlySects; i++) {
13063 - if (CSL_Strcmp(pdblLib->ppOvlyData[i]->hdr.pName,
13065 - /* Address and size are meaningless */
13068 - status = DSP_SOK;
13078 - * ======== DBL_init ========
13080 - * Initialize DBL module.
13082 -bool DBL_init(void)
13084 - bool retVal = true;
13086 - DBC_Require(cRefs >= 0);
13088 - if (cRefs == 0) {
13089 - DBC_Assert(!DBL_debugMask.flags);
13090 - GT_create(&DBL_debugMask, "BL"); /* "BL" for dBL */
13098 - GT_1trace(DBL_debugMask, GT_5CLASS, "DBL_init(), ref count: 0x%x\n",
13101 - DBC_Ensure((retVal && (cRefs > 0)) || (!retVal && (cRefs >= 0)));
13107 - * ======== DBL_load ========
13109 - * Add symbols/code/data defined in file to that already present
13112 -DSP_STATUS DBL_load(struct DBL_LibraryObj *lib, DBL_Flags flags,
13113 - struct DBL_Attrs *attrs, u32 *pEntry)
13115 - struct DBL_LibraryObj *pdblLib = (struct DBL_LibraryObj *)lib;
13116 - struct DBL_TargetObj *dbl;
13119 - DSP_STATUS status = DSP_EFAIL;
13121 - DBC_Require(cRefs > 0);
13122 - DBC_Require(MEM_IsValidHandle(pdblLib, DBL_LIBSIGNATURE));
13123 - DBC_Require(pEntry != NULL);
13124 - DBC_Require(attrs != NULL);
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);
13129 - dbl = pdblLib->pTarget;
13130 - *pEntry = pdblLib->fileHdr.entry;
13131 - nSects = pdblLib->fileHdr.numSects;
13132 - dbl->dblAttrs = *attrs;
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))
13142 - /* Done with file, we can close it */
13143 - if (pdblLib->file) {
13144 - (*pdblLib->pTarget->dblAttrs.fclose) (pdblLib->file);
13145 - pdblLib->file = NULL;
13151 - * ======== DBL_loadSect ========
13153 - * Load a named section from an library (for overlay support).
13155 -DSP_STATUS DBL_loadSect(struct DBL_LibraryObj *lib, char *sectName,
13156 - struct DBL_Attrs *attrs)
13158 - struct DBL_TargetObj *dbl;
13163 - s32 allocdSects = 0;
13171 - u16 *phaseRef = NULL;
13172 - u16 *otherRef = NULL;
13173 - char *name = NULL;
13174 - struct OvlyData *pOvlyData;
13175 - DSP_STATUS status = DSP_ENOSECT;
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;
13197 - if (DSP_SUCCEEDED(status)) {
13198 - DBC_Assert(i < lib->nOvlySects);
13199 - pOvlyData = lib->ppOvlyData[i];
13201 - * If node overlay, phase will be encoded in name. If not node
13202 - * overlay, set phase to NONE.
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. */
13210 - /* Not a node overlay */
13211 - phaseRef = &pOvlyData->hdr.otherRef;
13212 - nSects = numOtherSects(pOvlyData);
13213 - offset = otherOffset(pOvlyData);
13215 - case CREATEPHASE:
13216 - phaseRef = &pOvlyData->hdr.createRef;
13217 - otherRef = &pOvlyData->hdr.otherRef;
13219 - /* The overlay sections where node phase was
13220 - * not specified, have already been loaded. */
13221 - nSects = numCreateSects(pOvlyData);
13222 - offset = createOffset(pOvlyData);
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);
13232 - case DELETEPHASE:
13233 - phaseRef = &pOvlyData->hdr.deleteRef;
13234 - nSects = numDeleteSects(pOvlyData);
13235 - offset = deleteOffset(pOvlyData);
13237 - case EXECUTEPHASE:
13238 - phaseRef = &pOvlyData->hdr.executeRef;
13239 - nSects = numExecuteSects(pOvlyData);
13240 - offset = executeOffset(pOvlyData);
13244 - DBC_Assert(false);
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,
13257 - if (DSP_FAILED(status))
13262 - if (DSP_SUCCEEDED(status)) {
13263 - /* Load sections */
13264 - for (i = 0; i < nSects; i++) {
13265 - loadAddr = pOvlyData->data[offset + i].
13267 - runAddr = pOvlyData->data[offset + i].
13269 - size = pOvlyData->data[offset + i].
13271 - space = pOvlyData->data[offset + i].
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,
13283 - "DBL_loadSect: write"
13285 - status = DSP_EFWRITE;
13290 - /* Free sections on failure */
13291 - if (DSP_FAILED(status))
13292 - freeSects(dbl, pOvlyData, offset, allocdSects);
13296 - if (DSP_SUCCEEDED(status)) {
13297 - /* Increment reference counts */
13299 - *otherRef = *otherRef + 1;
13301 - *phaseRef = *phaseRef + 1;
13307 - * ======== DBL_open ========
13309 - * DBL_open() returns a library handle that can be used to
13310 - * load/unload the symbols/code/data via DBL_load()/DBL_unload().
13312 -DSP_STATUS DBL_open(struct DBL_TargetObj *target, char *file, DBL_Flags flags,
13313 - struct DBL_LibraryObj **pLib)
13315 - struct DBL_LibraryObj *pdblLib = NULL;
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);
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;
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;
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");
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),
13353 - if (pdblLib->symbols == NULL)
13354 - status = DSP_EMEMORY;
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");
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;
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");
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");
13391 - if (DSP_FAILED(status)) {
13393 - if (pdblLib != NULL)
13394 - DBL_close((struct DBL_LibraryObj *) pdblLib);
13399 - DBC_Ensure((DSP_SUCCEEDED(status) &&
13400 - (MEM_IsValidHandle((*pLib), DBL_LIBSIGNATURE))) ||
13401 - (DSP_FAILED(status) && *pLib == NULL));
13406 - * ======== DBL_readSect ========
13408 - * Read COFF section into a character buffer.
13410 -DSP_STATUS DBL_readSect(struct DBL_LibraryObj *lib, char *name, char *pContent,
13413 - struct DBL_LibraryObj *pdblLib = (struct DBL_LibraryObj *)lib;
13417 - DSP_STATUS status = DSP_ENOSECT;
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);
13427 - mauSize = pdblLib->pTargetInfo->mauSize;
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;
13445 - * ======== DBL_setAttrs ========
13447 - * Set the attributes of the target.
13449 -void DBL_setAttrs(struct DBL_TargetObj *target, struct DBL_Attrs *pAttrs)
13451 - DBC_Require(cRefs > 0);
13452 - DBC_Require(MEM_IsValidHandle(target, DBL_TARGSIGNATURE));
13453 - DBC_Require(pAttrs != NULL);
13455 - GT_2trace(DBL_debugMask, GT_ENTER, "DBL_setAttrs: target: 0x%x pAttrs: "
13456 - "0x%x\n", target, pAttrs);
13458 - target->dblAttrs = *pAttrs;
13462 - * ======== DBL_unload ========
13464 - * Remove the symbols/code/data corresponding to the library lib.
13466 -void DBL_unload(struct DBL_LibraryObj *lib, struct DBL_Attrs *attrs)
13468 - DBC_Require(cRefs > 0);
13469 - DBC_Require(MEM_IsValidHandle(lib, DBL_LIBSIGNATURE));
13471 - GT_1trace(DBL_debugMask, GT_ENTER, "DBL_unload: lib: 0x%x\n", lib);
13473 - /* Nothing to do for static loading */
13477 - * ======== DBL_unloadSect ========
13479 - * Unload a named section from an library (for overlay support).
13481 -DSP_STATUS DBL_unloadSect(struct DBL_LibraryObj *lib, char *sectName,
13482 - struct DBL_Attrs *attrs)
13484 - struct DBL_TargetObj *dbl;
13489 - u16 *phaseRef = NULL;
13490 - u16 *otherRef = NULL;
13491 - char *pName = NULL;
13492 - struct OvlyData *pOvlyData;
13493 - DSP_STATUS status = DSP_ENOSECT;
13495 - DBC_Require(cRefs > 0);
13496 - DBC_Require(MEM_IsValidHandle(lib, DBL_LIBSIGNATURE));
13497 - DBC_Require(sectName != NULL);
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;
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;
13519 - nSects = numOtherSects(pOvlyData);
13520 - phaseRef = &pOvlyData->hdr.otherRef;
13521 - offset = otherOffset(pOvlyData);
13523 - case CREATEPHASE:
13524 - nSects = numCreateSects(pOvlyData);
13525 - offset = createOffset(pOvlyData);
13526 - phaseRef = &pOvlyData->hdr.createRef;
13528 - case DELETEPHASE:
13529 - nSects = numDeleteSects(pOvlyData);
13530 - offset = deleteOffset(pOvlyData);
13531 - phaseRef = &pOvlyData->hdr.deleteRef;
13532 - otherRef = &pOvlyData->hdr.otherRef;
13534 - case EXECUTEPHASE:
13535 - nSects = numExecuteSects(pOvlyData);
13536 - offset = executeOffset(pOvlyData);
13537 - phaseRef = &pOvlyData->hdr.executeRef;
13541 - DBC_Assert(false);
13545 - *phaseRef = *phaseRef - 1;
13546 - if (*phaseRef == 0) {
13547 - /* Unload overlay sections for phase */
13548 - freeSects(dbl, pOvlyData, offset, nSects);
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,
13568 - * ======== freeSects ========
13572 -static void freeSects(struct DBL_TargetObj *dbl, struct OvlyData *pOvlyData,
13573 - s32 offset, s32 nSects)
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)) {
13587 - * Free function will not fail for overlay, unless
13588 - * address passed in is bad.
13590 - DBC_Assert(false);
13596 - * ======== loadSect ========
13598 - * Load section to target
13600 -static DSP_STATUS loadSect(struct DBL_TargetObj *dbl,
13601 - struct DBL_LibraryObj *pdblLib)
13603 - struct DBOF_SectHdr sectHdr;
13605 - struct KFILE_FileObj *file;
13613 - DSP_STATUS status = DSP_SOK;
13615 - file = pdblLib->file;
13616 - mauSize = pdblLib->pTargetInfo->mauSize;
13617 - bufSize = LOADBUFSIZE / mauSize;
13618 - pBuf = dbl->pBuf;
13620 - /* Read the section header */
13621 - if ((*dbl->dblAttrs.fread)(§Hdr, sizeof(struct DBOF_SectHdr),
13623 - GT_0trace(DBL_debugMask, GT_6CLASS,
13624 - "Failed to read DCD sect header\n");
13625 - status = DSP_EFREAD;
13627 - if (pdblLib->byteSwapped) {
13628 - sectHdr.size = SWAPLONG(sectHdr.size);
13629 - sectHdr.addr = SWAPLONG(sectHdr.addr);
13630 - sectHdr.page = SWAPWORD(sectHdr.page);
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,
13642 - GT_0trace(DBL_debugMask, GT_6CLASS,
13643 - "Failed to read DCD sect header\n");
13644 - status = DSP_EFREAD;
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;
13662 - * ======== readDCDSects ========
13664 - * Read DCD sections.
13666 -static DSP_STATUS readDCDSects(struct DBL_TargetObj *dbl,
13667 - struct DBL_LibraryObj *pdblLib)
13669 - struct DBOF_DCDSectHdr *pSectHdr;
13670 - struct DCDSect *pSect;
13671 - struct KFILE_FileObj *file;
13675 - DSP_STATUS status = DSP_SOK;
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;
13691 - if (pdblLib->byteSwapped)
13692 - pSectHdr->size = SWAPLONG(pSectHdr->size);
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,
13701 - status = DSP_EMEMORY;
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;
13718 - * ======== readHeader ========
13722 -static DSP_STATUS readHeader(struct DBL_TargetObj *dbl,
13723 - struct DBL_LibraryObj *pdblLib)
13725 - struct KFILE_FileObj *file;
13727 - struct DBOF_FileHdr *pHdr;
13729 - DSP_STATUS status = DSP_SOK;
13731 - pdblLib->byteSwapped = false;
13732 - file = pdblLib->file;
13733 - pHdr = &pdblLib->fileHdr;
13734 - if ((*dbl->dblAttrs.fread)(pHdr, sizeof(struct DBOF_FileHdr), 1,
13736 - GT_0trace(DBL_debugMask, GT_6CLASS,
13737 - "readHeader: Failed to read file header\n");
13738 - status = DSP_EFREAD;
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 ==
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->
13753 - pHdr->dcdSectOffset = SWAPLONG(pHdr->
13755 - pHdr->loadSectOffset = SWAPLONG(pHdr->
13757 - pHdr->ovlySectOffset = SWAPLONG(pHdr->
13759 - pHdr->numSymbols = SWAPWORD(pHdr->
13761 - pHdr->numDCDSects = SWAPWORD(pHdr->
13763 - pHdr->numSects = SWAPWORD(pHdr->
13765 - pHdr->numOvlySects = SWAPWORD(pHdr->
13771 - if (i == NUMTARGS) {
13772 - GT_0trace(DBL_debugMask, GT_6CLASS,
13773 - "readHeader: Failed to determine"
13774 - " target type\n");
13775 - status = DSP_ECORRUPTFILE;
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);
13788 - * ======== readOvlySects ========
13790 - * Read Overlay Sections
13792 -static DSP_STATUS readOvlySects(struct DBL_TargetObj *dbl,
13793 - struct DBL_LibraryObj *pdblLib)
13795 - struct DBOF_OvlySectHdr hdr;
13796 - struct DBOF_OvlySectData *pData;
13797 - struct OvlyData *pOvlyData;
13799 - struct KFILE_FileObj *file;
13803 - DSP_STATUS status = DSP_SOK;
13805 - pdblLib->nOvlySects = nSects = pdblLib->fileHdr.numOvlySects;
13806 - file = pdblLib->file;
13807 - if (nSects > 0) {
13808 - pdblLib->ppOvlyData = MEM_Calloc(nSects * sizeof(OvlyData *),
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;
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"
13826 - status = DSP_EFREAD;
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);
13841 - n = hdr.numCreateSects + hdr.numDeleteSects +
13842 - hdr.numExecuteSects + hdr.numOtherSects;
13844 - /* Allocate memory for node's overlay data */
13845 - pOvlyData = (struct OvlyData *)MEM_Calloc
13846 - (sizeof(struct OvlyHdr) +
13847 - n * sizeof(struct DBOF_OvlySectData),
13849 - if (pOvlyData == NULL) {
13850 - GT_0trace(DBL_debugMask, GT_7CLASS,
13851 - "Failed to allocatate ovlyay"
13852 - " data memory\n");
13853 - status = DSP_EMEMORY;
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;
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;
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;
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);
13895 - SWAPLONG(pData[j].size);
13897 - SWAPWORD(pData[j].page);
13906 - * ======== readSymbols ========
13910 -static DSP_STATUS readSymbols(struct DBL_TargetObj *dbl,
13911 - struct DBL_LibraryObj *pdblLib)
13913 - struct DBOF_SymbolHdr symHdr;
13914 - struct KFILE_FileObj *file;
13918 - char *pName = NULL;
13919 - DSP_STATUS status = DSP_SOK;
13921 - file = pdblLib->file;
13923 - nSymbols = pdblLib->fileHdr.numSymbols;
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;
13934 - if (pdblLib->byteSwapped) {
13935 - symHdr.nameLen = SWAPWORD(symHdr.nameLen);
13936 - symHdr.value = SWAPLONG(symHdr.value);
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;
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) !=
13952 - GT_0trace(DBL_debugMask, GT_6CLASS,
13953 - "Failed to read symbol value\n");
13954 - status = DSP_EFREAD;
13957 - pName[len] = '\0';
13958 - GT_2trace(DBL_debugMask, GT_ENTER,
13959 - "Symbol: %s Value: 0x%lx\n",
13960 - pName, symHdr.value);
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
13970 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13974 - * ======== dbll.c ========
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.
13993 /* ----------------------------------- Host OS */
13994 #include <dspbridge/host_os.h>
13997 #include <dspbridge/gh.h>
13999 /* ----------------------------------- OS Adaptation Layer */
14000 -#include <dspbridge/csl.h>
14001 #include <dspbridge/mem.h>
14003 /* Dynamic loader library interface */
14004 @@ -338,8 +317,6 @@ void DBLL_exit(void)
14012 DBLL_debugMask.flags = NULL;
14013 @@ -490,31 +467,20 @@ DSP_STATUS DBLL_getSect(struct DBLL_Libr
14015 bool DBLL_init(void)
14017 - bool retVal = true;
14019 DBC_Require(cRefs >= 0);
14022 DBC_Assert(!DBLL_debugMask.flags);
14023 GT_create(&DBLL_debugMask, "DL"); /* "DL" for dbDL */
14026 - retVal = MEM_Init();
14037 GT_1trace(DBLL_debugMask, GT_5CLASS, "DBLL_init(), ref count: 0x%x\n",
14040 - DBC_Ensure((retVal && (cRefs > 0)) || (!retVal && (cRefs >= 0)));
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 */
14056 @@ -693,7 +659,7 @@ DSP_STATUS DBLL_open(struct DBLL_TarObj
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,
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;
14069 - strncpy(zlLib->fileName, file,
14070 - strlen(file) + 1);
14071 + strncpy(zlLib->fileName, file,
14072 + strlen(file) + 1);
14074 zlLib->symTab = NULL;
14076 @@ -909,26 +875,23 @@ void DBLL_unload(struct DBLL_LibraryObj
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);
14086 - GT_1trace(DBLL_debugMask, GT_5CLASS,
14087 - "Dynamic_Unload_Module "
14088 - "failed: 0x%x\n", err);
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);
14100 + GT_1trace(DBLL_debugMask, GT_5CLASS,
14101 + "Dynamic_Unload_Module failed: 0x%x\n", err);
14103 - /* delete DOFF desc since it holds *lots* of host OS
14107 + /* remove symbols from symbol table */
14108 + if (zlLib->symTab != NULL) {
14109 + GH_delete(zlLib->symTab);
14110 + zlLib->symTab = NULL;
14112 + /* delete DOFF desc since it holds *lots* of host OS
14116 DBC_Ensure(zlLib->loadRef >= 0);
14118 @@ -1024,7 +987,7 @@ static bool nameMatch(void *key, void *v
14119 DBC_Require(value != NULL);
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)
14127 @@ -1183,7 +1146,7 @@ static struct dynload_symbol *addToSymbo
14128 struct dynload_symbol *retVal;
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));
14136 @@ -1201,15 +1164,15 @@ static struct dynload_symbol *addToSymbo
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,
14143 if (symbol.name == NULL)
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);
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
14159 + u32 runAddrFlag = 0;
14161 DBC_Require(this != NULL);
14163 @@ -1326,8 +1290,8 @@ static int rmmAlloc(struct Dynamic_Loade
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;
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;
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*/
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)*/
14193 - strict_strtol(szLastToken, 10, (long *)&req);
14194 + strict_strtol(szLastToken, 10, (long *)&req);
14196 if ((req == 0) || (req == 1)) {
14197 - if (strcmp(szSecLastToken, "DYN_DARAM") == 0) {
14198 + if (strcmp(szSecLastToken, "DYN_DARAM") == 0) {
14201 - if (strcmp(szSecLastToken, "DYN_SARAM") == 0) {
14202 + if (strcmp(szSecLastToken, "DYN_SARAM") == 0) {
14205 - if (strcmp(szSecLastToken,
14206 - "DYN_EXTERNAL") == 0) {
14207 + if (strcmp(szSecLastToken,
14208 + "DYN_EXTERNAL") == 0)
14214 @@ -1373,17 +1336,23 @@ static int rmmAlloc(struct Dynamic_Loade
14219 MEM_Free(szSectName);
14221 MEM_Free(szLastToken);
14222 szLastToken = NULL;
14223 MEM_Free(szSecLastToken);
14224 szSecLastToken = NULL;
14227 if (memType == DBLL_CODE)
14228 allocSize = info->size + GEM_L1P_PREFETCH_SIZE;
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)
14236 /* TODO - ideally, we can pass the alignment requirement also
14239 @@ -1396,12 +1365,16 @@ func_cont:
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);
14257 @@ -1410,7 +1383,7 @@ func_cont:
14258 * ======== rmmDealloc ========
14260 static void rmmDealloc(struct Dynamic_Loader_Allocate *this,
14261 - struct LDR_SECTION_INFO *info)
14262 + struct LDR_SECTION_INFO *info)
14264 struct DBLLAlloc *pAlloc = (struct DBLLAlloc *)this;
14265 struct DBLL_LibraryObj *lib;
14266 @@ -1488,13 +1461,14 @@ static int writeMem(struct Dynamic_Loade
14268 DBC_Require(this != NULL);
14270 - DBC_Require(MEM_IsValidHandle(lib, DBLL_LIBSIGNATURE));
14271 + if (!MEM_IsValidHandle(lib, DBLL_LIBSIGNATURE))
14274 + pTarget = lib->pTarget;
14276 memType = (DLOAD_SECTION_TYPE(info->type) == DLOAD_TEXT) ? DBLL_CODE :
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);
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
14290 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14292 + * Implementation of Bridge Mini-driver device operations.
14294 * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
14303 - * ======== dev.c ========
14305 - * Implementation of 'Bridge Mini-driver device operations.
14307 - * Public Functions:
14308 - * DEV_BrdWriteFxn
14309 - * DEV_CreateDevice
14312 - * DEV_DestroyDevice
14318 - * DEV_GetDSPWordSize
14320 - * DEV_GetIntfFxns
14323 - * DEV_GetNodeManager
14325 - * DEV_GetWMDContext
14328 - * DEV_InsertProcObject
14330 - * DEV_NotifyClient
14331 - * DEV_RegisterNotify
14332 - * DEV_ReleaseCodMgr
14333 - * DEV_RemoveDevice
14334 - * DEV_RemoveProcObject
14337 - * DEV_SetLockOwner
14338 - * DEV_StartDevice
14340 - * Private Functions:
14341 - * FxnNotImplemented
14343 - * InsertDevObject
14345 - * RemoveDevObject
14346 - * StoreInterfaceFxns
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
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
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
14399 /* ----------------------------------- Host OS */
14400 #include <dspbridge/host_os.h>
14403 #include <dspbridge/ldr.h>
14404 #include <dspbridge/list.h>
14405 #include <dspbridge/mem.h>
14406 -#include <dspbridge/util.h>
14408 /* ----------------------------------- Platform Manager */
14409 #include <dspbridge/cod.h>
14411 #include <dspbridge/node.h>
14413 /* ----------------------------------- Others */
14414 -#include <dspbridge/dbreg.h>
14415 #include <dspbridge/wcd.h> /* WCD version info. */
14417 #include <dspbridge/chnl.h>
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
14429 /* Create the Processor List */
14430 if (DSP_SUCCEEDED(status)) {
14431 - pDevObject->procList = LST_Create();
14432 + pDevObject->procList = MEM_Calloc(sizeof(struct LST_LIST),
14434 if (!(pDevObject->procList)) {
14435 status = DSP_EFAIL;
14436 GT_0trace(debugMask, GT_7CLASS, "DEV_Create: "
14437 "Failed to Create Proc List");
14439 + INIT_LIST_HEAD(&pDevObject->procList->head);
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);
14446 if (pDevObject && pDevObject->procList)
14447 - LST_Delete(pDevObject->procList);
14448 + MEM_Free(pDevObject->procList);
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;
14462 - if (pDevObject->hNodeMgr)
14463 + if (pDevObject->hNodeMgr) {
14464 NODE_DeleteMgr(pDevObject->hNodeMgr);
14465 + pDevObject->hNodeMgr = NULL;
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;
14474 - if (pDevObject->hMsgMgr)
14475 + if (pDevObject->hMsgMgr) {
14476 MSG_Delete(pDevObject->hMsgMgr);
14477 + pDevObject->hMsgMgr = NULL;
14480 if (pDevObject->hDehMgr) {
14481 /* Uninitialize DEH module. */
14482 (*pDevObject->intfFxns.pfnDehDestroy)
14483 (pDevObject->hDehMgr);
14484 + pDevObject->hDehMgr = NULL;
14486 - if (pDevObject->hCmmMgr)
14487 + if (pDevObject->hCmmMgr) {
14488 CMM_Destroy(pDevObject->hCmmMgr, true);
14489 + pDevObject->hCmmMgr = NULL;
14492 - if (pDevObject->hDmmMgr)
14493 + if (pDevObject->hDmmMgr) {
14494 DMM_Destroy(pDevObject->hDmmMgr);
14495 + pDevObject->hDmmMgr = NULL;
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;
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;
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;
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;
14530 struct DEV_OBJECT *pDevObject = hDevObject;
14531 - DSP_HPROCESSOR hProcObject;
14532 + void *hProcObject;
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);
14547 @@ -1286,7 +1208,7 @@ DSP_STATUS DEV_InsertProcObject(struct D
14548 *pbAlreadyAttached = true;
14550 /* Add DevObject to tail. */
14551 - LST_PutTail(pDevObject->procList, (struct LST_ELEM *)hProcObject);
14552 + LST_PutTail(pDevObject->procList, (struct list_head *)hProcObject);
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
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;
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
14570 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
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
14576 + * Region: Generic memory entitiy having a start address and a size
14577 + * Chunk: Reserved region
14579 * Copyright (C) 2005-2006 Texas Instruments, Inc.
14581 * This package is free software; you can redistribute it and/or modify
14583 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14587 - * ======== dmm.c ========
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
14592 - * Public Functions:
14593 - * DMM_CreateTables
14600 - * DMM_ReserveMemory
14601 - * DMM_UnMapMemory
14602 - * DMM_UnReserveMemory
14604 - * Private Functions:
14609 - * GetMappedRegion
14612 - * Region: Generic memory entitiy having a start address and a size
14613 - * Chunk: Reserved region
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.
14626 /* ----------------------------------- Host OS */
14627 #include <dspbridge/host_os.h>
14630 #include <dspbridge/gt.h>
14632 /* ----------------------------------- OS Adaptation Layer */
14633 -#include <dspbridge/list.h>
14634 #include <dspbridge/mem.h>
14635 #include <dspbridge/sync.h>
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.
14641 -DSP_STATUS DMM_GetHandle(DSP_HPROCESSOR hProcessor,
14642 +DSP_STATUS DMM_GetHandle(void *hProcessor,
14643 OUT struct DMM_OBJECT **phDmmMgr)
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
14651 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14653 + * IO manager interface: Manages IO between CHNL and MSG.
14655 * Copyright (C) 2005-2006 Texas Instruments, Inc.
14657 * This package is free software; you can redistribute it and/or modify
14659 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14664 - * ======== io.c ========
14666 - * IO manager interface: Manages IO between CHNL and MSG.
14668 - * Public Functions:
14676 - * This interface is basically a pass through to the WMD IO functions.
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.
14685 /* ----------------------------------- Host OS */
14686 #include <dspbridge/host_os.h>
14688 @@ -106,11 +85,13 @@ DSP_STATUS IO_Create(OUT struct IO_MGR *
14691 if (DSP_SUCCEEDED(status)) {
14692 - DEV_GetIntfFxns(hDevObject, &pIntfFxns);
14693 + status = DEV_GetIntfFxns(hDevObject, &pIntfFxns);
14695 - /* Let WMD channel module finish the create: */
14696 - status = (*pIntfFxns->pfnIOCreate)(&hIOMgr, hDevObject,
14699 + /* Let WMD channel module finish the create */
14700 + status = (*pIntfFxns->pfnIOCreate)(&hIOMgr, hDevObject,
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
14711 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14713 + * Structure subcomponents of channel class library IO objects which
14714 + * are exposed to class driver from mini-driver.
14716 * Copyright (C) 2005-2006 Texas Instruments, Inc.
14718 * This package is free software; you can redistribute it and/or modify
14720 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14725 - * ======== ioobj.h ========
14727 - * Structure subcomponents of channel class library IO objects which
14728 - * are exposed to class driver from mini-driver.
14730 - * Public Functions:
14733 - *! Revision History:
14734 - *! ================
14735 - *! 24-Feb-2003 swa PMGR Code review comments incorporated.
14736 - *! 01/16/97 gp: Created from chnlpriv.h
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
14747 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14749 + * DSP/BIOS Bridge MSG Module.
14751 * Copyright (C) 2005-2006 Texas Instruments, Inc.
14753 * This package is free software; you can redistribute it and/or modify
14755 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14760 - * ======== msg.c ========
14762 - * DSP/BIOS Bridge MSG Module.
14764 - * Public Functions:
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.
14779 /* ----------------------------------- Host OS */
14780 #include <dspbridge/host_os.h>
14783 #include <dspbridge/gt.h>
14785 /* ----------------------------------- OS Adaptation Layer */
14786 -#include <dspbridge/list.h>
14787 #include <dspbridge/mem.h>
14789 /* ----------------------------------- Mini Driver */
14790 @@ -92,10 +72,13 @@ DSP_STATUS MSG_Create(OUT struct MSG_MGR
14794 - DEV_GetIntfFxns(hDevObject, &pIntfFxns);
14795 + status = DEV_GetIntfFxns(hDevObject, &pIntfFxns);
14797 - /* Let WMD message module finish the create: */
14798 - status = (*pIntfFxns->pfnMsgCreate)(&hMsgMgr, hDevObject, msgCallback);
14800 + /* Let WMD message module finish the create */
14801 + status = (*pIntfFxns->pfnMsgCreate)(&hMsgMgr,
14802 + hDevObject, msgCallback);
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);
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);
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
14823 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14825 + * Structure subcomponents of channel class library MSG objects which
14826 + * are exposed to class driver from mini-driver.
14828 * Copyright (C) 2005-2006 Texas Instruments, Inc.
14830 * This package is free software; you can redistribute it and/or modify
14832 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14837 - * ======== msgobj.h ========
14839 - * Structure subcomponents of channel class library MSG objects which
14840 - * are exposed to class driver from mini-driver.
14842 - * Public Functions:
14845 - *! Revision History:
14846 - *! ================
14847 - *! 24-Feb-2003 swa PMGR Code review comments incorporated.
14848 - *! 17-Nov-2000 jeh Created.
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
14859 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
14861 + * Common WCD functions, also includes the wrapper
14862 + * functions called directly by the DeviceIOControl interface.
14864 * Copyright (C) 2005-2006 Texas Instruments, Inc.
14866 * This package is free software; you can redistribute it and/or modify
14868 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14872 - * ======== wcd.c ========
14874 - * Common WCD functions, also includes the wrapper
14875 - * functions called directly by the DeviceIOControl interface.
14877 - * Public Functions:
14878 - * WCD_CallDevIOCtl
14880 - * WCD_InitComplete2
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.
14948 /* ----------------------------------- Host OS */
14949 #include <dspbridge/host_os.h>
14952 #include <dspbridge/mem.h>
14953 #include <dspbridge/ntfy.h>
14954 #include <dspbridge/services.h>
14955 -#include <dspbridge/util.h>
14957 /* ----------------------------------- Platform Manager */
14958 #include <dspbridge/chnl.h>
14960 #include <dspbridge/_dcd.h>
14961 #include <dspbridge/dbdcd.h>
14963 -#ifndef RES_CLEANUP_DISABLE
14964 #include <dspbridge/resourcecleanup.h>
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
14973 +#ifdef CONFIG_BRIDGE_NEW_API
14975 +/* Used to get dspbridge ioctl table */
14976 +#define DB_GET_IOC_TABLE(cmd) (DB_GET_MODULE(cmd) >> DB_MODULE_SHIFT)
14978 +#else /* CONFIG_BRIDGE_NEW_API */
14979 +/* Used to get dspbridge ioctl table */
14980 +static int DB_GET_IOC_TABLE(int cmd)
14984 + else if(cmd<DB_NODE)
14986 + else if(cmd<DB_STRM)
14988 + else if(cmd<DB_CMM)
14994 +#define _IOC_TYPE(cmd) DB
14997 /* Device IOCtl function pointer */
14999 u32(*fxn)(union Trapped_Args *args, void *pr_ctxt);
15000 @@ -157,6 +104,95 @@ static struct GT_Mask WCD_debugMask = {
15002 static u32 WCD_cRefs;
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.
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 */
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 */
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 */
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 */
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 */
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),
15093 static inline void __cp_fm_usr(void *to, const void __user *from,
15094 DSP_STATUS *err, unsigned long bytes)
15096 @@ -198,89 +234,63 @@ static inline void __cp_to_usr(void __us
15097 __cp_to_usr(to, from, &(err), (n) * sizeof(*(from)))
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.
15105 -static struct WCD_Cmd WCD_cmdTable[] = {
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},
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},
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}
15169 * ======== WCD_CallDevIOCtl ========
15171 * Call the (wrapper) function for the corresponding WCD IOCTL.
15173 inline DSP_STATUS WCD_CallDevIOCtl(u32 cmd, union Trapped_Args *args,
15174 - u32 *pResult, void *pr_ctxt)
15175 + u32 *result, void *pr_ctxt)
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);
15181 + u32 (*ioctl_cmd)(union Trapped_Args *args, void *pr_ctxt) = NULL;
15184 + if (_IOC_TYPE(cmd) != DB) {
15185 + pr_err("%s: Incompatible dspbridge ioctl number\n", __func__);
15189 + if (DB_GET_IOC_TABLE(cmd) > ARRAY_SIZE(size_cmd)) {
15190 + pr_err("%s: undefined ioctl module\n", __func__);
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));
15202 + switch (DB_GET_MODULE(cmd)) {
15204 + ioctl_cmd = mgr_cmd[i].fxn;
15207 + ioctl_cmd = proc_cmd[i].fxn;
15210 + ioctl_cmd = node_cmd[i].fxn;
15213 + ioctl_cmd = strm_cmd[i].fxn;
15216 + ioctl_cmd = cmm_cmd[i].fxn;
15220 + if (!ioctl_cmd) {
15221 + pr_err("%s: requested ioctl not defined\n", __func__);
15224 - return DSP_EINVALIDARG;
15225 + *result = (*ioctl_cmd)(args, pr_ctxt);
15235 @@ -300,14 +310,12 @@ void WCD_Exit(void)
15248 DBC_Ensure(WCD_cRefs >= 0);
15250 @@ -320,18 +328,10 @@ void WCD_Exit(void)
15251 bool WCD_Init(void)
15254 - bool fDRV, fDEV, fCOD, fSERVICES, fCHNL, fMSG, fIO;
15255 - bool fMGR, fPROC, fNODE, fDISP, fNTFY, fSTRM, fRMM;
15257 - /* runtime check of Device IOCtl array. */
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;
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();
15278 fCHNL = CHNL_Init();
15279 @@ -349,13 +348,10 @@ bool WCD_Init(void)
15283 - fInit = fSERVICES && fDRV && fDEV && fCHNL && fCOD &&
15284 + fInit = fDRV && fDEV && fCHNL && fCOD &&
15286 fInit = fInit && fMGR && fPROC && fRMM;
15294 @@ -374,9 +370,6 @@ bool WCD_Init(void)
15304 @@ -457,6 +450,8 @@ DSP_STATUS WCD_InitComplete2(void)
15308 +/* TODO: Remove deprecated and not implemented ioctl wrappers */
15311 * ======== MGRWRAP_EnumNode_Info ========
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);
15318 + if (size < sizeof(struct DSP_NDBPROPS))
15319 + return DSP_ESIZE;
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);
15329 + if (size < sizeof(struct DSP_PROCESSORINFO))
15330 + return DSP_ESIZE;
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;
15340 + GT_1trace(WCD_debugMask, GT_ENTER,
15341 + "MGRWRAP_RegisterObject: entered "
15342 + "0x%x\n", args->ARGS_MGR_REGISTEROBJECT.pUuid);
15344 cp_fm_usr(&pUuid, args->ARGS_MGR_REGISTEROBJECT.pUuid, status, 1);
15345 if (DSP_FAILED(status))
15347 @@ -560,9 +568,9 @@ u32 MGRWRAP_RegisterObject(union Trapped
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;
15357 status = DCD_RegisterObject(&pUuid,
15358 args->ARGS_MGR_REGISTEROBJECT.objType,
15359 (char *)pszPathName);
15360 @@ -631,28 +639,15 @@ u32 MGRWRAP_WaitForBridgeEvents(union Tr
15364 -#ifndef RES_CLEANUP_DISABLE
15366 * ======== MGRWRAP_GetProcessResourceInfo ========
15368 -u32 MGRWRAP_GetProcessResourcesInfo(union Trapped_Args *args, void *pr_ctxt)
15369 +u32 __deprecated MGRWRAP_GetProcessResourcesInfo(union Trapped_Args *args,
15372 - DSP_STATUS status = DSP_SOK;
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);
15386 + pr_err("%s: deprecated dspbridge ioctl\n", __func__);
15393 @@ -660,7 +655,7 @@ u32 MGRWRAP_GetProcessResourcesInfo(unio
15395 u32 PROCWRAP_Attach(union Trapped_Args *args, void *pr_ctxt)
15397 - DSP_HPROCESSOR processor;
15399 DSP_STATUS status = DSP_SOK;
15400 struct DSP_PROCESSORATTRIN attrIn, *pAttrIn = NULL;
15402 @@ -696,6 +691,7 @@ u32 PROCWRAP_Ctrl(union Trapped_Args *ar
15403 args->ARGS_PROC_CTRL.pArgs;
15405 DSP_STATUS status = DSP_SOK;
15406 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
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;
15419 if (get_user(cbDataSize, pSize)) {
15420 status = DSP_EFAIL;
15421 @@ -734,16 +734,11 @@ func_end:
15423 * ======== PROCWRAP_Detach ========
15425 -u32 PROCWRAP_Detach(union Trapped_Args *args, void *pr_ctxt)
15426 +u32 __deprecated PROCWRAP_Detach(union Trapped_Args *args, void *pr_ctxt)
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);
15436 + /* PROC_Detach called at bridge_release only */
15437 + pr_err("%s: deprecated dspbridge ioctl\n", __func__);
15442 @@ -752,9 +747,10 @@ u32 PROCWRAP_Detach(union Trapped_Args *
15443 u32 PROCWRAP_EnumNode_Info(union Trapped_Args *args, void *pr_ctxt)
15446 - DSP_HNODE aNodeTab[MAX_NODES];
15447 + void *aNodeTab[MAX_NODES];
15450 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
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);
15460 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15461 + return DSP_EHANDLE;
15463 + if (!args->ARGS_PROC_ENUMNODE_INFO.uNodeTabSize)
15464 + return DSP_ESIZE;
15466 status = PROC_EnumNodes(args->ARGS_PROC_ENUMNODE_INFO.hProcessor,
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)
15473 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15475 GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_FlushMemory: entered\n");
15477 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15478 + return DSP_EHANDLE;
15480 + if (args->ARGS_PROC_FLUSHMEMORY.ulFlags >
15481 + PROC_WRITEBACK_INVALIDATE_MEM)
15482 + return DSP_EINVALIDARG;
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)
15491 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15493 GT_0trace(WCD_debugMask, GT_ENTER,
15494 "PROCWRAP_InvalidateMemory:entered\n");
15496 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15497 + return DSP_EHANDLE;
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
15504 DSP_STATUS status = DSP_SOK;
15505 struct DSP_RESOURCEINFO pResourceInfo;
15507 - if (DSP_FAILED(status))
15509 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
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);
15518 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15519 + return DSP_EHANDLE;
15521 + if (args->ARGS_PROC_ENUMRESOURCES.uResourceInfoSize <
15522 + sizeof(struct DSP_RESOURCEINFO))
15523 + return DSP_ESIZE;
15525 status = PROC_GetResourceInfo(args->ARGS_PROC_ENUMRESOURCES.hProcessor,
15526 args->ARGS_PROC_ENUMRESOURCES.uResourceType,
15528 args->ARGS_PROC_ENUMRESOURCES.uResourceInfoSize);
15529 - if (DSP_FAILED(status))
15532 cp_to_usr(args->ARGS_PROC_ENUMRESOURCES.pResourceInfo, &pResourceInfo,
15539 @@ -853,7 +872,17 @@ u32 PROCWRAP_GetState(union Trapped_Args
15542 struct DSP_PROCESSORSTATE procStatus;
15543 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15545 GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_GetState: entered\n");
15547 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15548 + return DSP_EHANDLE;
15550 + if (args->ARGS_PROC_GETSTATE.uStateInfoSize <
15551 + sizeof(struct DSP_PROCESSORSTATE))
15552 + return DSP_ESIZE;
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
15561 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15563 GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_GetTrace: entered\n");
15565 - DBC_Require(args->ARGS_PROC_GETTRACE.uMaxSize <= MAX_TRACEBUFLEN);
15566 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15567 + return DSP_EHANDLE;
15569 + if (args->ARGS_PROC_GETTRACE.uMaxSize > MAX_TRACEBUFLEN)
15570 + return DSP_ESIZE;
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;
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;
15582 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor) {
15583 + status = DSP_EHANDLE;
15587 - DBC_Require(count > 0);
15588 - DBC_Require(count <= MAX_LOADARGS);
15589 + if (count <= 0 || count > MAX_LOADARGS) {
15590 + status = DSP_EINVALIDARG;
15594 argv = MEM_Alloc(count * sizeof(u8 *), MEM_NONPAGED);
15596 @@ -1014,16 +1056,27 @@ u32 PROCWRAP_Map(union Trapped_Args *arg
15600 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15602 GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_Map: entered\n");
15604 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15605 + return DSP_EHANDLE;
15607 + if (!args->ARGS_PROC_MAPMEM.ulSize)
15608 + return DSP_ESIZE;
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);
15625 @@ -1036,10 +1089,14 @@ u32 PROCWRAP_RegisterNotify(union Trappe
15628 struct DSP_NOTIFICATION notification;
15629 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15631 GT_0trace(WCD_debugMask, GT_ENTER,
15632 "PROCWRAP_RegisterNotify: entered\n");
15634 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15635 + return DSP_EHANDLE;
15637 /* Initialize the notification data structure */
15638 notification.psName = NULL;
15639 notification.handle = NULL;
15640 @@ -1060,13 +1117,26 @@ u32 PROCWRAP_ReserveMemory(union Trapped
15644 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15646 GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_ReserveMemory: entered\n");
15648 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15649 + return DSP_EHANDLE;
15651 + if ((args->ARGS_PROC_RSVMEM.ulSize <= 0) ||
15652 + (args->ARGS_PROC_RSVMEM.ulSize & (PG_SIZE_4K - 1)) != 0)
15653 + return DSP_ESIZE;
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;
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,
15670 @@ -1076,8 +1146,13 @@ u32 PROCWRAP_ReserveMemory(union Trapped
15671 u32 PROCWRAP_Start(union Trapped_Args *args, void *pr_ctxt)
15674 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15676 GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_Start: entered\n");
15678 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15679 + return DSP_EHANDLE;
15681 retVal = PROC_Start(args->ARGS_PROC_START.hProcessor);
15684 @@ -1088,8 +1163,13 @@ u32 PROCWRAP_Start(union Trapped_Args *a
15685 u32 PROCWRAP_UnMap(union Trapped_Args *args, void *pr_ctxt)
15688 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15690 GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_UnMap: entered\n");
15692 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15693 + return DSP_EHANDLE;
15695 status = PROC_UnMap(args->ARGS_PROC_UNMAPMEM.hProcessor,
15696 args->ARGS_PROC_UNMAPMEM.pMapAddr, pr_ctxt);
15698 @@ -1101,9 +1181,14 @@ u32 PROCWRAP_UnMap(union Trapped_Args *a
15699 u32 PROCWRAP_UnReserveMemory(union Trapped_Args *args, void *pr_ctxt)
15702 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15704 GT_0trace(WCD_debugMask, GT_ENTER,
15705 "PROCWRAP_UnReserveMemory: entered\n");
15707 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15708 + return DSP_EHANDLE;
15710 status = PROC_UnReserveMemory(args->ARGS_PROC_UNRSVMEM.hProcessor,
15711 args->ARGS_PROC_UNRSVMEM.pRsvAddr);
15713 @@ -1115,13 +1200,41 @@ u32 PROCWRAP_UnReserveMemory(union Trapp
15714 u32 PROCWRAP_Stop(union Trapped_Args *args, void *pr_ctxt)
15717 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15719 GT_0trace(WCD_debugMask, GT_ENTER, "PROCWRAP_Stop: entered\n");
15721 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15722 + return DSP_EHANDLE;
15724 retVal = PROC_Stop(args->ARGS_PROC_STOP.hProcessor);
15729 +bool validate_node_handle(struct NODE_OBJECT *hNode, void *pr_ctxt)
15731 + bool retVal = false;
15732 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15733 + struct NODE_RES_OBJECT *pNode = pCtxt->pNodeList;
15735 + if (hNode == (struct NODE_OBJECT *) DSP_HGPPNODE)
15738 + if (mutex_lock_interruptible(&pCtxt->node_mutex))
15739 + return DSP_EFAIL;
15741 + while (pNode && !retVal) {
15742 + if (hNode == pNode->hNode)
15744 + pNode = pNode->next;
15747 + mutex_unlock(&pCtxt->node_mutex);
15753 * ======== NODEWRAP_Allocate ========
15755 @@ -1134,9 +1247,15 @@ u32 NODEWRAP_Allocate(union Trapped_Args
15757 struct DSP_NODEATTRIN attrIn, *pAttrIn = NULL;
15758 struct NODE_OBJECT *hNode;
15759 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15761 GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Allocate: entered\n");
15763 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor) {
15764 + status = DSP_EHANDLE;
15768 /* Optional argument */
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);
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);
15786 @@ -1187,6 +1312,13 @@ u32 NODEWRAP_AllocMsgBuf(union Trapped_A
15787 struct DSP_BUFFERATTR attr;
15788 u8 *pBuffer = NULL;
15790 + if (!args->ARGS_NODE_ALLOCMSGBUF.uSize)
15791 + return DSP_ESIZE;
15793 + if (!validate_node_handle(args->ARGS_NODE_ALLOCMSGBUF.hNode,
15795 + return DSP_EHANDLE;
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
15802 /* IN OUT argument */
15803 cp_fm_usr(&pBuffer, args->ARGS_NODE_ALLOCMSGBUF.pBuffer, status, 1);
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
15810 GT_0trace(WCD_debugMask, GT_ENTER,
15811 "NODEWRAP_ChangePriority: entered\n");
15813 + if (!validate_node_handle(args->ARGS_NODE_CHANGEPRIORITY.hNode,
15815 + return DSP_EHANDLE;
15817 retVal = NODE_ChangePriority(args->ARGS_NODE_CHANGEPRIORITY.hNode,
15818 args->ARGS_NODE_CHANGEPRIORITY.iPriority);
15820 @@ -1233,6 +1371,13 @@ u32 NODEWRAP_Connect(union Trapped_Args
15822 GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Connect: entered\n");
15824 + if (!validate_node_handle(args->ARGS_NODE_CONNECT.hNode,
15826 + !validate_node_handle(args->ARGS_NODE_CONNECT.hOtherNode,
15828 + status = DSP_EHANDLE;
15831 /* Optional argument */
15833 if (get_user(cbDataSize, pSize))
15834 @@ -1258,6 +1403,7 @@ u32 NODEWRAP_Connect(union Trapped_Args
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 *
15845 GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Create: entered\n");
15847 + if (!validate_node_handle(args->ARGS_NODE_CREATE.hNode,
15849 + return DSP_EHANDLE;
15851 retVal = NODE_Create(args->ARGS_NODE_CREATE.hNode);
15854 @@ -1293,6 +1444,11 @@ u32 NODEWRAP_Delete(union Trapped_Args *
15857 GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Delete: entered\n");
15859 + if (!validate_node_handle(args->ARGS_NODE_DELETE.hNode,
15861 + return DSP_EHANDLE;
15863 retVal = NODE_Delete(args->ARGS_NODE_DELETE.hNode, pr_ctxt);
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;
15871 + if (!args->ARGS_NODE_FREEMSGBUF.pBuffer)
15872 + return DSP_EPOINTER;
15874 + if (!validate_node_handle(args->ARGS_NODE_FREEMSGBUF.hNode,
15876 + return DSP_EHANDLE;
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))
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
15890 GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_GetAttr: entered\n");
15892 + if (!validate_node_handle(args->ARGS_NODE_GETATTR.hNode,
15894 + return DSP_EHANDLE;
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
15901 GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_GetMessage: entered\n");
15903 + if (!validate_node_handle(args->ARGS_NODE_GETMESSAGE.hNode,
15905 + return DSP_EHANDLE;
15907 status = NODE_GetMessage(args->ARGS_NODE_GETMESSAGE.hNode, &msg,
15908 args->ARGS_NODE_GETMESSAGE.uTimeout);
15910 @@ -1364,6 +1537,11 @@ u32 NODEWRAP_Pause(union Trapped_Args *a
15913 GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Pause: entered\n");
15915 + if (!validate_node_handle(args->ARGS_NODE_PAUSE.hNode,
15917 + return DSP_EHANDLE;
15919 retVal = NODE_Pause(args->ARGS_NODE_PAUSE.hNode);
15922 @@ -1379,6 +1557,10 @@ u32 NODEWRAP_PutMessage(union Trapped_Ar
15924 GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_PutMessage: entered\n");
15926 + if (!validate_node_handle(args->ARGS_NODE_PUTMESSAGE.hNode,
15928 + status = DSP_EHANDLE;
15930 cp_fm_usr(&msg, args->ARGS_NODE_PUTMESSAGE.pMessage, status, 1);
15932 if (DSP_SUCCEEDED(status)) {
15933 @@ -1404,6 +1586,15 @@ u32 NODEWRAP_RegisterNotify(union Trappe
15934 notification.psName = NULL;
15935 notification.handle = NULL;
15937 + if (!validate_node_handle(args->ARGS_NODE_REGISTERNOTIFY.hNode,
15939 + return DSP_EHANDLE;
15941 + if (!args->ARGS_PROC_REGISTER_NOTIFY.uEventMask)
15942 + cp_fm_usr(¬ification,
15943 + args->ARGS_PROC_REGISTER_NOTIFY.hNotification,
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
15952 GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Run: entered\n");
15954 + if (!validate_node_handle(args->ARGS_NODE_RUN.hNode,
15956 + return DSP_EHANDLE;
15958 retVal = NODE_Run(args->ARGS_NODE_RUN.hNode);
15961 @@ -1436,6 +1632,10 @@ u32 NODEWRAP_Terminate(union Trapped_Arg
15963 GT_0trace(WCD_debugMask, GT_ENTER, "NODEWRAP_Terminate: entered\n");
15965 + if (!validate_node_handle(args->ARGS_NODE_TERMINATE.hNode,
15967 + return DSP_EHANDLE;
15969 status = NODE_Terminate(args->ARGS_NODE_TERMINATE.hNode, &tempstatus);
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;
15978 GT_0trace(WCD_debugMask, GT_ENTER,
15979 "NODEWRAP_GetUUIDPropste: entered\n");
15981 + if (args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
15982 + return DSP_EHANDLE;
15984 cp_fm_usr(&nodeId, args->ARGS_NODE_GETUUIDPROPS.pNodeID, status, 1);
15985 if (DSP_FAILED(status))
15986 @@ -1475,6 +1678,27 @@ func_cont:
15991 +bool validate_strm_handle(struct STRM_OBJECT *hStrm, void *pr_ctxt)
15993 + bool retVal = false;
15994 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
15995 + struct STRM_RES_OBJECT *pStrm = pCtxt->pSTRMList;
15997 + if (mutex_lock_interruptible(&pCtxt->strm_mutex))
15998 + return DSP_EFAIL;
16000 + while (pStrm && !retVal) {
16001 + if (hStrm == pStrm->hStream)
16003 + pStrm = pStrm->next;
16006 + mutex_unlock(&pCtxt->strm_mutex);
16012 * ======== STRMWRAP_AllocateBuffer ========
16014 @@ -1484,15 +1708,28 @@ u32 STRMWRAP_AllocateBuffer(union Trappe
16015 u8 **apBuffer = NULL;
16016 u32 uNumBufs = args->ARGS_STRM_ALLOCATEBUFFER.uNumBufs;
16018 - DBC_Require(uNumBufs <= MAX_BUFS);
16019 + if (!validate_strm_handle(args->ARGS_STRM_ALLOCATEBUFFER.hStream,
16021 + return DSP_EHANDLE;
16023 + if (uNumBufs > MAX_BUFS)
16024 + return DSP_EINVALIDARG;
16026 apBuffer = MEM_Alloc((uNumBufs * sizeof(u8 *)), MEM_NONPAGED);
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,
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;
16039 + args->ARGS_STRM_ALLOCATEBUFFER.hStream,
16040 + apBuffer, uNumBufs, pr_ctxt);
16044 MEM_Free(apBuffer);
16046 @@ -1504,6 +1741,9 @@ u32 STRMWRAP_AllocateBuffer(union Trappe
16048 u32 STRMWRAP_Close(union Trapped_Args *args, void *pr_ctxt)
16050 + if (!validate_strm_handle(args->ARGS_STRM_CLOSE.hStream, pr_ctxt))
16051 + return DSP_EHANDLE;
16053 return STRM_Close(args->ARGS_STRM_CLOSE.hStream, pr_ctxt);
16056 @@ -1516,7 +1756,11 @@ u32 STRMWRAP_FreeBuffer(union Trapped_Ar
16057 u8 **apBuffer = NULL;
16058 u32 uNumBufs = args->ARGS_STRM_FREEBUFFER.uNumBufs;
16060 - DBC_Require(uNumBufs <= MAX_BUFS);
16061 + if (!validate_strm_handle(args->ARGS_STRM_FREEBUFFER.hStream, pr_ctxt))
16062 + return DSP_EHANDLE;
16064 + if (uNumBufs > MAX_BUFS)
16065 + return DSP_EINVALIDARG;
16067 apBuffer = MEM_Alloc((uNumBufs * sizeof(u8 *)), MEM_NONPAGED);
16069 @@ -1538,8 +1782,10 @@ u32 STRMWRAP_FreeBuffer(union Trapped_Ar
16071 * ======== STRMWRAP_GetEventHandle ========
16073 -u32 STRMWRAP_GetEventHandle(union Trapped_Args *args, void *pr_ctxt)
16074 +u32 __deprecated STRMWRAP_GetEventHandle(union Trapped_Args *args,
16077 + pr_err("%s: deprecated dspbridge ioctl\n", __func__);
16078 return DSP_ENOTIMPL;
16081 @@ -1553,6 +1799,9 @@ u32 STRMWRAP_GetInfo(union Trapped_Args
16082 struct DSP_STREAMINFO user;
16083 struct DSP_STREAMINFO *temp;
16085 + if (!validate_strm_handle(args->ARGS_STRM_GETINFO.hStream, pr_ctxt))
16086 + return DSP_EHANDLE;
16088 cp_fm_usr(&strmInfo, args->ARGS_STRM_GETINFO.pStreamInfo, status, 1);
16089 temp = strmInfo.pUser;
16091 @@ -1575,6 +1824,9 @@ u32 STRMWRAP_Idle(union Trapped_Args *ar
16095 + if (!validate_strm_handle(args->ARGS_STRM_IDLE.hStream, pr_ctxt))
16096 + return DSP_EHANDLE;
16098 retVal = STRM_Idle(args->ARGS_STRM_IDLE.hStream,
16099 args->ARGS_STRM_IDLE.bFlush);
16101 @@ -1587,6 +1839,13 @@ u32 STRMWRAP_Idle(union Trapped_Args *ar
16102 u32 STRMWRAP_Issue(union Trapped_Args *args, void *pr_ctxt)
16104 DSP_STATUS status = DSP_SOK;
16106 + if (!validate_strm_handle(args->ARGS_STRM_ISSUE.hStream, pr_ctxt))
16107 + return DSP_EHANDLE;
16109 + if (!args->ARGS_STRM_ISSUE.pBuffer)
16110 + return DSP_EPOINTER;
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
16115 @@ -1609,12 +1868,19 @@ u32 STRMWRAP_Open(union Trapped_Args *ar
16116 struct STRM_OBJECT *pStrm;
16117 struct DSP_STREAMATTRIN strmAttrIn;
16119 + if (!validate_node_handle(args->ARGS_NODE_ALLOCMSGBUF.hNode,
16121 + status = DSP_EHANDLE;
16123 cp_fm_usr(&attr, args->ARGS_STRM_OPEN.pAttrIn, status, 1);
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;
16135 status = STRM_Open(args->ARGS_STRM_OPEN.hNode,
16136 @@ -1636,6 +1902,9 @@ u32 STRMWRAP_Reclaim(union Trapped_Args
16140 + if (!validate_strm_handle(args->ARGS_STRM_RECLAIM.hStream, pr_ctxt))
16141 + return DSP_EHANDLE;
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");
16150 + if (!validate_strm_handle(args->ARGS_STRM_REGISTERNOTIFY.hStream,
16152 + return DSP_EHANDLE;
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;
16161 - DBC_Require(args->ARGS_STRM_SELECT.nStreams <= MAX_STREAMS);
16162 + if (args->ARGS_STRM_SELECT.nStreams > MAX_STREAMS)
16163 + return DSP_EINVALIDARG;
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 *
16169 * ======== CMMWRAP_CallocBuf ========
16171 -u32 CMMWRAP_CallocBuf(union Trapped_Args *args, void *pr_ctxt)
16172 +u32 __deprecated CMMWRAP_CallocBuf(union Trapped_Args *args, void *pr_ctxt)
16174 /* This operation is done in kernel */
16175 + pr_err("%s: deprecated dspbridge ioctl\n", __func__);
16176 return DSP_ENOTIMPL;
16180 * ======== CMMWRAP_FreeBuf ========
16182 -u32 CMMWRAP_FreeBuf(union Trapped_Args *args, void *pr_ctxt)
16183 +u32 __deprecated CMMWRAP_FreeBuf(union Trapped_Args *args, void *pr_ctxt)
16185 /* This operation is done in kernel */
16186 + pr_err("%s: deprecated dspbridge ioctl\n", __func__);
16187 return DSP_ENOTIMPL;
16190 @@ -1723,6 +1999,11 @@ u32 CMMWRAP_GetHandle(union Trapped_Args
16192 DSP_STATUS status = DSP_SOK;
16193 struct CMM_OBJECT *hCmmMgr;
16194 + struct PROCESS_CONTEXT *pCtxt = pr_ctxt;
16196 + if (args->ARGS_PROC_CTRL.hProcessor &&
16197 + args->ARGS_PROC_CTRL.hProcessor != pCtxt->hProcessor)
16198 + return DSP_EHANDLE;
16200 status = CMM_GetHandle(args->ARGS_CMM_GETHANDLE.hProcessor, &hCmmMgr);
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
16207 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
16209 + * This file contains the implementation of the DSP/BIOS Bridge
16210 + * Configuration Database (DCD).
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.
16218 * Copyright (C) 2005-2006 Texas Instruments, Inc.
16220 * This package is free software; you can redistribute it and/or modify
16222 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16227 - * ======== dbdcd.c ========
16229 - * This file contains the implementation of the DSP/BIOS Bridge
16230 - * Configuration Database (DCD).
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.
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
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.
16272 /* ----------------------------------- Host OS */
16273 #include <dspbridge/host_os.h>
16276 #include <dspbridge/gt.h>
16278 /* ----------------------------------- OS Adaptation Layer */
16279 -#include <dspbridge/csl.h>
16280 #include <dspbridge/mem.h>
16281 #include <dspbridge/reg.h>
16283 @@ -89,12 +50,12 @@
16284 /* ----------------------------------- Global defines. */
16285 #define SIGNATURE 0x5f444344 /* "DCD_" (in reverse). */
16287 -#define IsValidHandle(h) (((h) != NULL) && (h->dwSignature == SIGNATURE))
16288 +#define IsValidHandle(h) (((h) != NULL) && (h->dwSignature == SIGNATURE))
16290 #define MAX_INT2CHAR_LENGTH 16 /* Maximum int2char len of 32 bit int. */
16292 /* Name of section containing dependent libraries */
16293 -#define DEPLIBSECT ".dspbridge_deplibs"
16294 +#define DEPLIBSECT ".dspbridge_deplibs"
16296 /* DCD specific structures. */
16297 struct DCD_MANAGER {
16298 @@ -108,17 +69,13 @@ static u32 cEnumRefs;
16300 extern struct GT_Mask curTrace;
16302 -/* helper function prototypes. */
16303 +/* Helper function prototypes. */
16304 static s32 Atoi(char *pszBuf);
16306 static DSP_STATUS GetAttrsFromBuf(char *pszBuf, u32 ulBufSize,
16307 enum DSP_DCDOBJTYPE objType,
16308 struct DCD_GENERICOBJ *pGenObj);
16310 static void CompressBuf(char *pszBuf, u32 ulBufSize, s32 cCharSize);
16312 static char DspChar2GppChar(char *pWord, s32 cDspCharSize);
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
16319 * Parses the supplied image and resigsters with DCD.
16322 DSP_STATUS DCD_AutoRegister(IN struct DCD_MANAGER *hDcdMgr,
16323 - IN char *pszCoffPath)
16324 + IN char *pszCoffPath)
16326 DSP_STATUS status = DSP_SOK;
16328 @@ -162,7 +118,7 @@ DSP_STATUS DCD_AutoRegister(IN struct DC
16329 * Parses the supplied DSP image and unresiters from DCD.
16331 DSP_STATUS DCD_AutoUnregister(IN struct DCD_MANAGER *hDcdMgr,
16332 - IN char *pszCoffPath)
16333 + IN char *pszCoffPath)
16335 DSP_STATUS status = DSP_SOK;
16337 @@ -173,8 +129,7 @@ DSP_STATUS DCD_AutoUnregister(IN struct
16339 if (IsValidHandle(hDcdMgr)) {
16340 status = DCD_GetObjects(hDcdMgr, pszCoffPath,
16341 - (DCD_REGISTERFXN)DCD_RegisterObject,
16343 + (DCD_REGISTERFXN)DCD_RegisterObject, NULL);
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.
16350 DSP_STATUS DCD_CreateManager(IN char *pszZlDllName,
16351 - OUT struct DCD_MANAGER **phDcdMgr)
16352 + OUT struct DCD_MANAGER **phDcdMgr)
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;
16359 @@ -204,43 +159,43 @@ DSP_STATUS DCD_CreateManager(IN char *ps
16362 status = COD_Create(&hCodMgr, pszZlDllName, NULL);
16363 - if (DSP_SUCCEEDED(status)) {
16365 - /* Create a DCD object. */
16366 - MEM_AllocObject(pDcdMgr, struct DCD_MANAGER, SIGNATURE);
16367 - if (pDcdMgr != NULL) {
16369 - /* Fill out the object. */
16370 - pDcdMgr->hCodMgr = hCodMgr;
16372 - /* Return handle to this DCD interface. */
16373 - *phDcdMgr = pDcdMgr;
16375 - GT_2trace(curTrace, GT_5CLASS,
16376 - "DCD_CreateManager: pDcdMgr 0x%x, "
16377 - " hCodMgr 0x%x", pDcdMgr, hCodMgr);
16379 - status = DSP_EMEMORY;
16382 - * If allocation of DcdManager object failed, delete the
16385 - COD_Delete(hCodMgr);
16386 + if (DSP_FAILED(status)) {
16387 + GT_0trace(curTrace, GT_6CLASS,
16388 + "DCD_CreateManager: COD_Create failed\n");
16392 - GT_0trace(curTrace, GT_6CLASS,
16393 - "DCD_CreateManager: MEM_AllocObject failed\n");
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;
16401 + /* Return handle to this DCD interface. */
16402 + *phDcdMgr = pDcdMgr;
16404 + GT_2trace(curTrace, GT_5CLASS,
16405 + "DCD_CreateManager: pDcdMgr 0x%x, "
16406 + " hCodMgr 0x%x", pDcdMgr, hCodMgr);
16408 - status = DSP_EFAIL;
16409 + status = DSP_EMEMORY;
16412 + * If allocation of DcdManager object failed, delete the
16415 + COD_Delete(hCodMgr);
16417 GT_0trace(curTrace, GT_6CLASS,
16418 - "DCD_CreateManager: COD_Create failed\n");
16419 + "DCD_CreateManager: MEM_AllocObject failed\n");
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)));
16432 @@ -260,7 +215,6 @@ DSP_STATUS DCD_DestroyManager(IN struct
16435 if (IsValidHandle(hDcdMgr)) {
16437 /* Delete the COD manager. */
16438 COD_Delete(pDcdMgr->hCodMgr);
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.
16444 - dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16445 + dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16446 DBC_Assert(dwKeyLen < REG_MAXREGPATHLENGTH);
16448 /* Create proper REG key; concatenate DCD_REGKEY with
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);
16458 status = DSP_EFAIL;
16460 @@ -340,19 +294,18 @@ DSP_STATUS DCD_EnumerateObject(IN s32 cI
16461 status = DSP_EFAIL;
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);
16472 status = DSP_EFAIL;
16476 if (DSP_SUCCEEDED(status)) {
16477 - status = REG_EnumValue(NULL, cIndex, szRegKey, szValue,
16478 - &dwValueSize, szData,
16480 + status = REG_EnumValue(cIndex, szRegKey, szValue,
16481 + &dwValueSize, szData, &dwDataSize);
16484 if (DSP_SUCCEEDED(status)) {
16485 @@ -397,9 +350,7 @@ void DCD_Exit(void)
16494 DBC_Ensure(cRefs >= 0);
16495 @@ -449,7 +400,7 @@ DSP_STATUS DCD_GetNumDepLibs(IN struct D
16498 status = GetDepLibInfo(hDcdMgr, pUuid, pNumLibs, pNumPersLibs,
16499 - NULL, NULL, phase);
16500 + NULL, NULL, phase);
16504 @@ -461,9 +412,9 @@ DSP_STATUS DCD_GetNumDepLibs(IN struct D
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)
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,
16520 szUuid = (char *)MEM_Calloc(MAXUUIDLEN, MEM_PAGED);
16522 - return status = DSP_EMEMORY;
16524 + status = DSP_EMEMORY;
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");
16534 - /* Pre-determine final key length. It's length of DCD_REGKEY +
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);
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);
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);
16551 status = DSP_EFAIL;
16553 @@ -515,33 +470,34 @@ DSP_STATUS DCD_GetObjectDef(IN struct DC
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);
16563 status = DSP_EFAIL;
16566 /* Create UUID value to set in registry. */
16567 UUID_UuidToString(pObjUuid, szUuid, MAXUUIDLEN);
16569 - if ((strlen(szRegKey) + MAXUUIDLEN) < REG_MAXREGPATHLENGTH)
16570 - strncat(szRegKey, szUuid, MAXUUIDLEN);
16572 + if ((strlen(szRegKey) + MAXUUIDLEN) < REG_MAXREGPATHLENGTH)
16573 + strncat(szRegKey, szUuid, MAXUUIDLEN);
16575 status = DSP_EFAIL;
16577 /* Retrieve paths from the registry based on struct DSP_UUID */
16578 dwBufSize = REG_MAXREGPATHLENGTH;
16580 - if (DSP_SUCCEEDED(status)) {
16581 - status = REG_GetValue(NULL, szRegKey, szRegKey, (u8 *)szRegData,
16584 + if (DSP_SUCCEEDED(status))
16585 + status = REG_GetValue(szRegKey, (u8 *)szRegData, &dwBufSize);
16587 if (DSP_FAILED(status)) {
16588 status = DSP_EUUID;
16589 GT_0trace(curTrace, GT_6CLASS, "DCD_GetObjectDef: "
16590 "REG_GetValue() failed\n");
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");
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));
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));
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");
16622 /* Allocate zeroed buffer. */
16623 pszCoffBuf = MEM_Calloc(ulLen + 4, MEM_PAGED);
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);
16630 @@ -581,13 +541,14 @@ DSP_STATUS DCD_GetObjectDef(IN struct DC
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);
16638 CompressBuf(pszCoffBuf, ulLen, 1);
16639 GT_0trace(curTrace, GT_4CLASS, "Compressing IVA "
16640 "COFF buffer by 1 for IVA !!\n");
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");
16651 /* Free the previously allocated dynamic buffer. */
16652 MEM_Free(pszCoffBuf);
16654 @@ -608,6 +570,7 @@ func_end:
16662 @@ -638,6 +601,7 @@ DSP_STATUS DCD_GetObjects(IN struct DCD_
16663 "DCD_GetObjects: invalid DCD manager handle.\n");
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");
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");
16683 /* Allocate zeroed buffer. */
16684 pszCoffBuf = MEM_Calloc(ulLen + 4, MEM_PAGED);
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");
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);
16697 /* Retrieve object type */
16698 pToken = strsep(&pszCur, seps);
16700 /* Retrieve object type */
16701 cObjectType = Atoi(pToken);
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");
16711 /* Free the previously allocated dynamic buffer. */
16712 MEM_Free(pszCoffBuf);
16714 @@ -735,9 +706,9 @@ func_end:
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)
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);
16733 * Pre-determine final key length. It's length of DCD_REGKEY +
16734 * "_\0" + length of szObjType string + terminating NULL.
16736 - dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16737 + dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16738 DBC_Assert(dwKeyLen < REG_MAXREGPATHLENGTH);
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);
16748 status = DSP_EFAIL;
16750 @@ -785,60 +758,56 @@ DSP_STATUS DCD_GetLibraryName(IN struct
16751 sprintf(szObjType, "%d", DSP_DCDLIBRARYTYPE);
16755 + status = DSP_EINVALIDARG;
16758 - if (status == -1) {
16759 - status = DSP_EFAIL;
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);
16770 status = DSP_EFAIL;
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);
16780 status = DSP_EFAIL;
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);
16790 /* If can't find, phases might be registered as generic LIBRARYTYPE */
16791 if (DSP_FAILED(status) && phase != NLDR_NOPHASE) {
16793 *fPhaseSplit = false;
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);
16803 status = DSP_EFAIL;
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);
16812 status = DSP_EFAIL;
16814 UUID_UuidToString(pUuid, szUuid, MAXUUIDLEN);
16815 - if ((strlen(szRegKey) + MAXUUIDLEN) < REG_MAXREGPATHLENGTH)
16816 - strncat(szRegKey, szUuid, MAXUUIDLEN);
16818 + if ((strlen(szRegKey) + MAXUUIDLEN) < REG_MAXREGPATHLENGTH)
16819 + strncat(szRegKey, szUuid, MAXUUIDLEN);
16821 status = DSP_EFAIL;
16823 - status = REG_GetValue(NULL, szRegKey, szRegKey,
16824 - (u8 *)pstrLibName, pdwSize);
16825 + status = REG_GetValue(szRegKey, (u8 *)pstrLibName, pdwSize);
16829 @@ -851,8 +820,6 @@ DSP_STATUS DCD_GetLibraryName(IN struct
16831 bool DCD_Init(void)
16838 @@ -862,24 +829,15 @@ bool DCD_Init(void)
16843 /* Initialize required modules. */
16844 - fInitMEM = MEM_Init();
16845 fInitCOD = COD_Init();
16846 - fInitREG = REG_Init();
16847 - if (!fInitMEM || !fInitCOD || !fInitREG) {
16851 GT_0trace(curTrace, GT_6CLASS, "DCD_Init failed\n");
16852 /* Exit initialized modules. */
16865 @@ -902,92 +860,89 @@ bool DCD_Init(void)
16866 * If pszPathName == NULL, unregister the specified DCD object.
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)
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. */
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));
16896 GT_3trace(curTrace, GT_ENTER, "DCD_RegisterObject: object UUID 0x%x, "
16897 "objType %d, szPathName %s\n", pUuid, objType, pszPathName);
16900 * Pre-determine final key length. It's length of DCD_REGKEY +
16901 * "_\0" + length of szObjType string + terminating NULL.
16903 - dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16904 + dwKeyLen = strlen(DCD_REGKEY) + 1 + sizeof(szObjType) + 1;
16905 DBC_Assert(dwKeyLen < REG_MAXREGPATHLENGTH);
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);
16912 + strncpy(szRegKey, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
16913 + if ((strlen(szRegKey) + strlen("_\0")) < REG_MAXREGPATHLENGTH)
16914 + strncat(szRegKey, "_\0", 2);
16916 status = DSP_EFAIL;
16920 status = snprintf(szObjType, MAX_INT2CHAR_LENGTH, "%d", objType);
16921 if (status == -1) {
16922 status = DSP_EFAIL;
16925 - if ((strlen(szRegKey) + strlen(szObjType)) <
16926 + if ((strlen(szRegKey) + strlen(szObjType)) <
16927 REG_MAXREGPATHLENGTH) {
16928 - strncat(szRegKey, szObjType, strlen(szObjType) + 1);
16930 + strncat(szRegKey, szObjType, strlen(szObjType) + 1);
16932 status = DSP_EFAIL;
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);
16940 + if ((strlen(szRegKey) + MAXUUIDLEN) < REG_MAXREGPATHLENGTH)
16941 + strncat(szRegKey, szUuid, MAXUUIDLEN);
16943 status = DSP_EFAIL;
16947 - if (DSP_SUCCEEDED(status)) {
16949 - * If pszPathName != NULL, perform registration, otherwise,
16950 - * perform unregistration.
16952 - if (pszPathName) {
16953 - /* Add new reg value (UUID+objType) with COFF path
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");
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");
16977 + if (DSP_FAILED(status))
16981 + * If pszPathName != NULL, perform registration, otherwise,
16982 + * perform unregistration.
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");
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");
17003 if (DSP_SUCCEEDED(status)) {
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
17018 @@ -1086,7 +1040,6 @@ static s32 Atoi(char *pszBuf)
17026 @@ -1122,7 +1075,6 @@ static DSP_STATUS GetAttrsFromBuf(char *
17027 || (objType == DSP_DCDPROCESSORTYPE));
17028 DBC_Require(pGenObj != NULL);
17032 case DSP_DCDNODETYPE:
17034 @@ -1143,12 +1095,12 @@ static DSP_STATUS GetAttrsFromBuf(char *
17035 token = strsep(&pszCur, seps);
17038 - DBC_Require(token);
17039 + DBC_Require(token);
17040 cLen = strlen(token);
17041 if (cLen > DSP_MAXNAMELEN - 1)
17042 cLen = DSP_MAXNAMELEN - 1;
17044 - strncpy(pGenObj->objData.nodeObj.ndbProps.acName,
17045 + strncpy(pGenObj->objData.nodeObj.ndbProps.acName,
17047 pGenObj->objData.nodeObj.ndbProps.acName[cLen] = '\0';
17048 token = strsep(&pszCur, seps);
17049 @@ -1226,31 +1178,43 @@ static DSP_STATUS GetAttrsFromBuf(char *
17051 token = strsep(&pszCur, seps);
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;
17064 strncpy(pGenObj->objData.nodeObj.pstrCreatePhaseFxn,
17066 pGenObj->objData.nodeObj.pstrCreatePhaseFxn[cLen] = '\0';
17067 token = strsep(&pszCur, seps);
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;
17080 strncpy(pGenObj->objData.nodeObj.pstrExecutePhaseFxn,
17082 pGenObj->objData.nodeObj.pstrExecutePhaseFxn[cLen] = '\0';
17083 token = strsep(&pszCur, seps);
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;
17096 strncpy(pGenObj->objData.nodeObj.pstrDeletePhaseFxn,
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);
17103 - /* char * pstrIAlgName */
17104 + /* char *pstrIAlgName */
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;
17113 strncpy(pGenObj->objData.nodeObj.pstrIAlgName,
17115 pGenObj->objData.nodeObj.pstrIAlgName[cLen] = '\0';
17116 @@ -1375,6 +1343,13 @@ static DSP_STATUS GetAttrsFromBuf(char *
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);
17130 @@ -1394,7 +1369,6 @@ static void CompressBuf(char *pszBuf, u3
17133 for (q = pszBuf; q < (pszBuf + ulBufSize);) {
17135 ch = DspChar2GppChar(q, cCharSize);
17138 @@ -1430,7 +1404,6 @@ static void CompressBuf(char *pszBuf, u3
17139 /* NULL out remainder of buffer. */
17146 @@ -1466,8 +1439,8 @@ static DSP_STATUS GetDepLibInfo(IN struc
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);
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
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;
17174 @@ -1531,6 +1505,7 @@ static DSP_STATUS GetDepLibInfo(IN struc
17176 /* Compress and format DSP buffer to conform to PC format. */
17177 CompressBuf(pszCoffBuf, ulLen, DSPWORDSIZE);
17179 /* Read from buffer */
17180 pszCur = pszCoffBuf;
17181 while ((pToken = strsep(&pszCur, seps)) && *pToken != '\0') {
17182 @@ -1570,4 +1545,3 @@ func_cont:
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
17192 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
17194 + * Node Dispatcher interface. Communicates with Resource Manager Server
17195 + * (RMS) on DSP. Access to RMS is synchronized in NODE.
17197 * Copyright (C) 2005-2006 Texas Instruments, Inc.
17199 * This package is free software; you can redistribute it and/or modify
17201 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17206 - * ======== disp.c ========
17209 - * Node Dispatcher interface. Communicates with Resource Manager Server
17210 - * (RMS) on DSP. Access to RMS is synchronized in NODE.
17212 - * Public Functions:
17217 - * DISP_NodeChangePriority
17218 - * DISP_NodeCreate
17219 - * DISP_NodeDelete
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.
17236 /* ----------------------------------- Host OS */
17237 #include <dspbridge/host_os.h>
17240 #include <dspbridge/dbc.h>
17242 /* ----------------------------------- OS Adaptation Layer */
17243 -#include <dspbridge/dev.h>
17244 #include <dspbridge/mem.h>
17245 #include <dspbridge/sync.h>
17246 -#include <dspbridge/csl.h>
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;
17258 GT_1trace(DISP_DebugMask, GT_6CLASS,
17259 @@ -191,23 +160,22 @@ DSP_STATUS DISP_Create(OUT struct DISP_O
17260 status = DSP_EFAIL;
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);
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);
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
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;
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);
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);
17324 /* Get the reply */
17325 if (DSP_FAILED(status))
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
17332 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
17334 + * DSP/BIOS Bridge resource allocation module.
17336 * Copyright (C) 2005-2006 Texas Instruments, Inc.
17338 * This package is free software; you can redistribute it and/or modify
17340 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17345 - * ======== drv.c ========
17347 - * DSP/BIOS Bridge resource allocation module.
17349 - * Public Functions:
17353 - * DRV_GetDevObject
17354 - * DRV_GetDevExtension
17355 - * DRV_GetFirstDevObject
17356 - * DRV_GetNextDevObject
17357 - * DRV_GetNextDevExtension
17359 - * DRV_InsertDevObject
17360 - * DRV_RemoveDevObject
17361 - * DRV_RequestResources
17362 - * DRV_ReleaseResources
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.
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.
17419 /* ----------------------------------- Host OS */
17420 #include <dspbridge/host_os.h>
17422 @@ -104,26 +30,20 @@
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>
17431 -/* ----------------------------------- Others */
17432 -#include <dspbridge/dbreg.h>
17434 /* ----------------------------------- This */
17435 #include <dspbridge/drv.h>
17436 #include <dspbridge/dev.h>
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>
17447 /* ----------------------------------- Defines, Data Structures, Typedefs */
17448 #define SIGNATURE 0x5f52474d /* "DRV_" (in reverse) */
17449 @@ -132,9 +52,6 @@ struct DRV_OBJECT {
17451 struct LST_LIST *devList;
17452 struct LST_LIST *devNodeString;
17453 -#ifndef RES_CLEANUP_DISABLE
17454 - struct PROCESS_CONTEXT *procCtxtList;
17459 @@ -142,7 +59,7 @@ struct DRV_OBJECT {
17460 * DRV_ since it is living in this module
17463 - struct LST_ELEM link;
17464 + struct list_head link;
17465 char szString[MAXREGPATHLENGTH];
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);
17472 -#ifndef RES_CLEANUP_DISABLE
17473 /* GPP PROCESS CLEANUP CODE */
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);
17480 -/* Get the process context list from driver object */
17482 -/* Set the Process ID */
17483 -DSP_STATUS DRV_ProcSetPID(HANDLE hPCtxt, s32 hProcess)
17485 - struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
17486 - DSP_STATUS status = DSP_SOK;
17488 - DBC_Assert(hPCtxt != NULL);
17490 - pCtxt->pid = hProcess;
17495 -/* Getting the head of the process context list */
17496 -DSP_STATUS DRV_GetProcCtxtList(struct PROCESS_CONTEXT **pPctxt,
17497 - struct DRV_OBJECT *hDrvObject)
17499 - DSP_STATUS status = DSP_SOK;
17500 - struct DRV_OBJECT *pDrvObject = (struct DRV_OBJECT *)hDrvObject;
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);
17513 -/* Add a new process context to process context list */
17514 -DSP_STATUS DRV_InsertProcContext(struct DRV_OBJECT *hDrVObject, HANDLE hPCtxt)
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;
17521 - GT_0trace(curTrace, GT_ENTER, "\n In DRV_InsertProcContext\n");
17523 - status = CFG_GetObject((u32 *)&hDRVObject, REG_DRV_OBJECT);
17524 - DBC_Assert(hDRVObject != NULL);
17526 - *pCtxt = MEM_Calloc(1 * sizeof(struct PROCESS_CONTEXT), MEM_PAGED);
17528 - pr_err("DSP: MEM_Calloc failed in DRV_InsertProcContext\n");
17529 - return DSP_EMEMORY;
17532 - spin_lock_init(&(*pCtxt)->proc_list_lock);
17533 - INIT_LIST_HEAD(&(*pCtxt)->processor_list);
17535 - spin_lock_init(&(*pCtxt)->dmm_list_lock);
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 "
17548 - while (pCtxtList->next != NULL)
17549 - pCtxtList = pCtxtList->next;
17551 - pCtxtList->next = *pCtxt;
17553 - GT_0trace(curTrace, GT_ENTER,
17554 - "\n In DRV_InsertProcContext and "
17555 - "pCtxt is Null\n");
17556 - hDRVObject->procCtxtList = *pCtxt;
17561 -/* Delete a process context from process resource context list */
17562 -DSP_STATUS DRV_RemoveProcContext(struct DRV_OBJECT *hDRVObject,
17565 - DSP_STATUS status = DSP_SOK;
17566 - struct PROCESS_CONTEXT *pr_ctxt_list = NULL;
17567 - struct PROCESS_CONTEXT *uninitialized_var(ptr_prev);
17569 - DBC_Assert(hDRVObject != NULL);
17571 - GT_0trace(curTrace, GT_ENTER, "DRV_RemoveProcContext: 12");
17572 - DRV_GetProcCtxtList(&pr_ctxt_list, hDRVObject);
17574 - /* Special condition */
17575 - if (pr_ctxt_list == pr_ctxt) {
17576 - hDRVObject->procCtxtList = NULL;
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");
17588 - GT_0trace(curTrace, GT_ENTER, "DRV_RemoveProcContext: 3");
17590 - if (!pr_ctxt_list)
17591 - return DSP_ENOTFOUND;
17593 - ptr_prev->next = pr_ctxt_list->next;
17596 - MEM_Free(pr_ctxt);
17597 - GT_0trace(curTrace, GT_ENTER, "DRV_RemoveProcContext: 7");
17602 -/* Update the state of process context */
17603 -DSP_STATUS DRV_ProcUpdatestate(HANDLE hPCtxt, enum GPP_PROC_RES_STATE status)
17605 - struct PROCESS_CONTEXT *pCtxt = (struct PROCESS_CONTEXT *)hPCtxt;
17606 - DSP_STATUS status1 = DSP_SOK;
17607 - if (pCtxt != NULL) {
17608 - pCtxt->resState = status;
17610 - GT_0trace(curTrace, GT_ENTER,
17611 - "DRV_ProcUpdatestate: Failed to update "
17612 - "process state");
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;
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");
17640 + mutex_unlock(&pCtxt->node_mutex);
17642 GT_0trace(curTrace, GT_ENTER, "DRV_InsertNodeResElement: 4");
17644 @@ -345,25 +125,24 @@ DSP_STATUS DRV_RemoveNodeResElement(HAND
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;
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;
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;
17667 - if (pTempNode == NULL)
17668 - return DSP_ENOTFOUND;
17669 - else if (pTempNode2->next != NULL)
17670 - pTempNode2->next = pTempNode2->next->next;
17672 - MEM_Free(pTempNode);
17674 + while (pTempNode && pTempNode->next != pNodeRes)
17675 + pTempNode = pTempNode->next;
17677 + status = DSP_ENOTFOUND;
17679 + pTempNode->next = pNodeRes->next;
17681 + mutex_unlock(&pCtxt->node_mutex);
17682 + MEM_Free(pNodeRes);
17686 @@ -376,7 +155,6 @@ static DSP_STATUS DRV_ProcFreeNodeRes(HA
17687 struct NODE_RES_OBJECT *pNodeRes = NULL;
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
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;
17705 if (DSP_SUCCEEDED(status)) {
17706 + if (mutex_lock_interruptible(&pCtxt->dmm_mutex))
17707 + return DSP_EFAIL;
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");
17716 + mutex_unlock(&pCtxt->dmm_mutex);
17718 GT_0trace(curTrace, GT_ENTER, "DRV_InsertDMMResElement: 5");
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)
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;
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;
17748 + while (pTempDMMRes && pTempDMMRes->next != pDMMRes)
17749 + pTempDMMRes = pTempDMMRes->next;
17750 + if (!pTempDMMRes)
17751 + status = DSP_ENOTFOUND;
17753 + pTempDMMRes->next = pDMMRes->next;
17755 - GT_0trace(curTrace, GT_ENTER, "DRV_RemoveDMMResElement: 3");
17756 - if (pCtxt->pDMMList == pTempDMMRes)
17757 - pCtxt->pDMMList = pTempDMMRes->next;
17759 - if (pTempDMMRes == NULL)
17760 - return DSP_ENOTFOUND;
17761 - else if (pTempDMMRes2->next != NULL)
17762 - pTempDMMRes2->next = pTempDMMRes2->next->next;
17764 + mutex_unlock(&pCtxt->dmm_mutex);
17766 - GT_0trace(curTrace, GT_ENTER, "DRV_RemoveDMMResElement: 4");
17770 @@ -504,31 +277,34 @@ DSP_STATUS DRV_UpdateDMMResElement(HANDL
17773 /* Actual DMM De-Allocation */
17774 -DSP_STATUS DRV_ProcFreeDMMRes(HANDLE hPCtxt)
17775 +DSP_STATUS DRV_ProcFreeDMMRes(HANDLE hPCtxt)
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;
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;
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;
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;
17829 - DBC_Assert(hPCtxt != NULL);
17830 + if (mutex_lock_interruptible(&pCtxt->dmm_mutex))
17831 + return DSP_EFAIL;
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;
17843 + mutex_unlock(&pCtxt->dmm_mutex);
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;
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
17859 /* Getting the node resource element */
17861 DSP_STATUS DRV_GetNodeResElement(HANDLE hNode, HANDLE hNodeRes, HANDLE hPCtxt)
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;
17868 - DBC_Assert(hPCtxt != NULL);
17869 + if (mutex_lock_interruptible(&pCtxt->node_mutex))
17870 + return DSP_EFAIL;
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;
17879 + mutex_unlock(&pCtxt->node_mutex);
17881 if (pTempNode != NULL)
17882 *nodeRes = pTempNode;
17884 @@ -640,8 +421,6 @@ DSP_STATUS DRV_GetNodeResElement(HANDLE
17890 /* Allocate the STRM resource element
17891 * This is called after the actual resource is allocated
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);
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;
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");
17916 + mutex_unlock(&pCtxt->strm_mutex);
17923 /* Release Stream resource element context
17924 * This function called after the actual resource is freed
17926 @@ -688,69 +467,62 @@ DSP_STATUS DRV_ProcRemoveSTRMResElement
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;
17935 - DBC_Assert(hPCtxt != NULL);
17936 - while ((pTempSTRMRes != NULL) && (pTempSTRMRes != pSTRMRes)) {
17937 - pTempSTRMRes2 = pTempSTRMRes;
17938 - pTempSTRMRes = pTempSTRMRes->next;
17940 - if (pCtxt->pSTRMList == pTempSTRMRes)
17941 - pCtxt->pSTRMList = pTempSTRMRes->next;
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;
17951 + if (pCtxt->pSTRMList == pSTRMRes) {
17952 + pCtxt->pSTRMList = pSTRMRes->next;
17954 + while (pTempSTRMRes && pTempSTRMRes->next != pSTRMRes)
17955 + pTempSTRMRes = pTempSTRMRes->next;
17956 + if (pTempSTRMRes == NULL)
17957 + status = DSP_ENOTFOUND;
17959 + pTempSTRMRes->next = pSTRMRes->next;
17961 + mutex_unlock(&pCtxt->strm_mutex);
17962 MEM_Free(pSTRMRes);
17967 /* Actual Stream De-Allocation */
17968 static DSP_STATUS DRV_ProcFreeSTRMRes(HANDLE hPCtxt)
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;
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);
17998 + return DSP_EMEMORY;
17999 status = STRM_FreeBuffer(pSTRMRes->hStream, apBuffer,
18000 pSTRMRes->uNumBufs, pCtxt);
18001 MEM_Free(apBuffer);
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,
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);
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;
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(
18040 /* Getting the stream resource element */
18041 DSP_STATUS DRV_GetSTRMResElement(HANDLE hStrm, HANDLE hSTRMRes, HANDLE hPCtxt)
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;
18050 + if (mutex_lock_interruptible(&pCtxt->strm_mutex))
18051 + return DSP_EFAIL;
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;
18061 + mutex_unlock(&pCtxt->strm_mutex);
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
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)
18073 DSP_STATUS status = DSP_SOK;
18074 struct STRM_RES_OBJECT **STRMRes = (struct STRM_RES_OBJECT **)hSTRMRes;
18076 - DBC_Assert(hPCtxt != NULL);
18077 (*STRMRes)->uNumBufs = uNumBufs;
18081 -/* Displaying the resources allocated by a process */
18082 -DSP_STATUS DRV_ProcDisplayResInfo(u8 *pBuf1, u32 *pSize)
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;
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;
18116 - tempStrLen2 = sprintf((char *)pTempBuf,
18117 - "GPP Resource State: pCtxt->resState"
18118 - " = PROC_RES_DEALLOCATED, Process ID:%d\n",
18120 - tempStrLen2 += 2;
18121 - memmove(pBuf+tempStrLen, pTempBuf, tempStrLen2);
18122 - tempStrLen += tempStrLen2;
18124 - pNodeRes = pCtxt->pNodeList;
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;
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;
18160 - pDMMRes = pCtxt->pDMMList;
18161 - while (pDMMRes != NULL) {
18162 - GT_2trace(curTrace, GT_ENTER,
18163 - "DRV_ProcDisplayResourceInfo: #:%d "
18164 - " pCtxt->pDMMList->ulMpuAddr:%x\n",
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;
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;
18195 - pCtxt = pCtxt->next;
18197 - *pSize = tempStrLen;
18198 - status = PrintProcessInformation();
18199 - GT_0trace(curTrace, GT_ENTER, "*********************"
18200 - "DRV_ProcDisplayResourceInfo:**\n");
18205 - * ======== PrintProcessInformation ========
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.
18212 -static DSP_STATUS PrintProcessInformation(void)
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;
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, " -------------------"
18240 - if (pCtxtList->resState == PROC_RES_ALLOCATED) {
18241 - GT_0trace(curTrace, GT_4CLASS, " \nThe Process"
18242 - " is in Allocated state\n");
18244 - GT_0trace(curTrace, GT_4CLASS, "\nThe Process"
18245 - " is in DeAllocated state\n");
18248 - spin_lock(&pCtxtList->proc_list_lock);
18249 - list_for_each_entry(proc_obj_ptr, &pCtxtList->processor_list,
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");
18261 - GT_0trace(curTrace, GT_7CLASS,
18262 - "\n***ERROR:Invalid Processor Id***\n");
18265 - spin_unlock(&pCtxtList->proc_list_lock);
18267 - pNodeRes = pCtxtList->pNodeList;
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;
18280 - if (tempCount == 1)
18281 - GT_0trace(curTrace, GT_4CLASS,
18282 - "\n ***There are no Nodes"
18283 - " allocated by this Process***\n");
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;
18299 - if (tempCount == 1)
18300 - GT_0trace(curTrace, GT_4CLASS,
18301 - "\n ***There are no Heaps allocated"
18302 - " by this Process***\n");
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;
18318 - if (tempCount == 1)
18319 - GT_0trace(curTrace, GT_4CLASS,
18320 - "\n ***There are no DMM resources"
18321 - " allocated by this Process***\n");
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;
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;
18345 /* GPP PROCESS CLEANUP CODE END */
18349 * ======== = DRV_Create ======== =
18350 @@ -1097,43 +607,48 @@ DSP_STATUS DRV_Create(OUT struct DRV_OBJ
18351 MEM_AllocObject(pDRVObject, struct DRV_OBJECT, SIGNATURE);
18353 /* Create and Initialize List of device objects */
18354 - pDRVObject->devList = LST_Create();
18355 + pDRVObject->devList = MEM_Calloc(sizeof(struct LST_LIST),
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);
18368 + INIT_LIST_HEAD(&pDRVObject->devNodeString->
18370 + INIT_LIST_HEAD(&pDRVObject->devList->head);
18373 - status = DSP_EFAIL;
18374 + status = DSP_EMEMORY;
18375 GT_0trace(curTrace, GT_7CLASS,
18376 "Failed to Create Dev List ");
18377 - MEM_FreeObject(pDRVObject);
18380 - status = DSP_EFAIL;
18381 + status = DSP_EMEMORY;
18382 GT_0trace(curTrace, GT_7CLASS,
18383 "Failed to Allocate Memory for DRV Obj");
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 ",
18395 - *phDRVObject = pDRVObject;
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 ",
18405 + *phDRVObject = pDRVObject;
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 "
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
18421 if (pDRVObject->devList) {
18422 /* Could assert if the list is not empty */
18423 - LST_Delete(pDRVObject->devList);
18424 + MEM_Free(pDRVObject->devList);
18426 if (pDRVObject->devNodeString) {
18427 /* Could assert if the list is not empty */
18428 - LST_Delete(pDRVObject->devNodeString);
18429 + MEM_Free(pDRVObject->devNodeString);
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,
18436 *phDevObject = (struct DEV_OBJECT *) pDevObject;
18437 - status = DSP_SOK;
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);
18449 return dwNextDevObject;
18450 @@ -1332,7 +846,7 @@ u32 DRV_GetNextDevExtension(u32 hDevExte
18451 !LST_IsEmpty(pDrvObject->devNodeString)) {
18452 dwDevExtension = (u32)LST_Next(pDrvObject->
18454 - (struct LST_ELEM *)hDevExtension);
18455 + (struct list_head *)hDevExtension);
18459 @@ -1367,7 +881,7 @@ DSP_STATUS DRV_Init(void)
18460 * Insert a DevObject into the list of Manager object.
18462 DSP_STATUS DRV_InsertDevObject(struct DRV_OBJECT *hDRVObject,
18463 - struct DEV_OBJECT *hDevObject)
18464 + struct DEV_OBJECT *hDevObject)
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);
18472 - LST_PutTail(pDRVObject->devList, (struct LST_ELEM *)hDevObject);
18473 + LST_PutTail(pDRVObject->devList, (struct list_head *)hDevObject);
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
18480 DSP_STATUS DRV_RemoveDevObject(struct DRV_OBJECT *hDRVObject,
18481 - struct DEV_OBJECT *hDevObject)
18482 + struct DEV_OBJECT *hDevObject)
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;
18489 DBC_Require(cRefs > 0);
18490 DBC_Require(MEM_IsValidHandle(pDRVObject, SIGNATURE));
18491 @@ -1426,7 +940,7 @@ DSP_STATUS DRV_RemoveDevObject(struct DR
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;
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
18504 - if (DSP_SUCCEEDED(CFG_GetObject((u32 *)&pDRVObject,
18505 - REG_DRV_OBJECT))) {
18507 + status = CFG_GetObject((u32 *)&pDRVObject, REG_DRV_OBJECT);
18508 + if (DSP_SUCCEEDED(status)) {
18509 pszdevNode = MEM_Calloc(sizeof(struct DRV_EXT), MEM_NONPAGED);
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);
18519 GT_0trace(curTrace, GT_7CLASS,
18520 "Failed to Allocate Memory devNodeString ");
18521 - status = DSP_EFAIL;
18522 + status = DSP_EMEMORY;
18523 *pDevNodeString = 0;
18526 - status = DSP_EFAIL;
18527 GT_0trace(curTrace, GT_7CLASS,
18528 "Failed to get Driver Object from Registry");
18529 *pDevNodeString = 0;
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
18539 GT_0trace(curTrace, GT_ENTER, "Entering DRV_Release Resources\n");
18541 - if (!(strcmp((char *)((struct DRV_EXT *)dwContext)->szString,
18542 + if (!(strcmp((char *)((struct DRV_EXT *)dwContext)->szString,
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");
18550 - if (DSP_SUCCEEDED(status)) {
18551 + if (DSP_FAILED(status))
18552 GT_0trace(curTrace, GT_1CLASS,
18553 "Failed to relese bridge resources\n");
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? */
18566 if ((u32)pszdevNode == dwContext) {
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);
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;
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");
18592 - GT_0trace(curTrace, GT_1CLASS,
18593 - "REG_GetValue Succeeded \n");
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");
18603 + GT_0trace(curTrace, GT_1CLASS,
18604 + "REG_GetValue Succeeded \n");
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,
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 */
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;
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,
18648 /* Set all the other entries to NULL */
18649 MEM_Free(pResources);
18651 + status = DSP_EMEMORY;
18653 GT_0trace(curTrace, GT_ENTER, " <- RequestBridgeResources \n");
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 */
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");
18690 - GT_0trace(curTrace, GT_7CLASS,
18691 - " Failed to set the registry "
18692 - "value for CURRENTCONFIG\n");
18694 + GT_0trace(curTrace, GT_1CLASS,
18695 + " Successfully set the registry "
18696 + "value for CURRENTCONFIG\n");
18698 + GT_0trace(curTrace, GT_7CLASS,
18699 + " Failed to set the registry "
18700 + "value for CURRENTCONFIG\n");
18702 MEM_Free(pResources);
18704 @@ -1760,10 +1274,10 @@ static DSP_STATUS RequestBridgeResources
18705 OMAP_DSP_MEM3_SIZE);
18706 pResources->dwPerBase = ioremap(OMAP_PER_CM_BASE,
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,
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
18745 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
18747 + * DSP/BIOS Bridge driver interface.
18749 * Copyright (C) 2005-2006 Texas Instruments, Inc.
18751 * This package is free software; you can redistribute it and/or modify
18753 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18757 - * ======== linux_driver.c ========
18759 - * DSP/BIOS Bridge driver interface.
18761 - * Public Functions:
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
18786 /* ----------------------------------- Host OS */
18788 #include <dspbridge/host_os.h>
18790 #include <linux/moduleparam.h>
18791 #include <linux/cdev.h>
18793 -#include <mach/board-3430sdp.h>
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>
18804 /* ----------------------------------- Platform Manager */
18805 #include <dspbridge/wcdioctl.h>
18806 #include <dspbridge/_dcd.h>
18807 #include <dspbridge/dspdrv.h>
18808 -#include <dspbridge/dbreg.h>
18810 /* ----------------------------------- Resource Manager */
18811 #include <dspbridge/pwr.h>
18812 @@ -88,30 +56,28 @@
18813 /* ----------------------------------- This */
18814 #include <drv_interface.h>
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>
18828 -#include <mach/omap-pm.h>
18829 +#ifdef CONFIG_BRIDGE_DVFS
18830 #include <mach-omap2/omap3-opp.h>
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"
18841 struct platform_device *omap_dspbridge_dev;
18843 +/* This is a test variable used by Bridge to test different sleep states */
18844 +s32 dsp_test_sleepstate;
18845 struct bridge_dev {
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;
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;
18863 static u32 phys_mempool_base;
18864 static u32 phys_mempool_size;
18865 static int tc_wordswapon; /* Default value is always false */
18867 -/* Minimum ACTIVE VDD1 OPP level for reliable DSP operation */
18868 -unsigned short min_active_opp = 3;
18871 struct omap34xx_bridge_suspend_data {
18873 @@ -155,10 +119,9 @@ static int omap34xxbridge_suspend_lockou
18881 +#ifdef CONFIG_BRIDGE_DEBUG
18882 module_param(GT_str, charp, 0);
18883 MODULE_PARM_DESC(GT_str, "GT string, default = NULL");
18885 @@ -166,11 +129,8 @@ module_param(dsp_debug, int, 0);
18886 MODULE_PARM_DESC(dsp_debug, "Wait after loading DSP image. default = false");
18889 -module_param(driver_major, int, 0); /* Driver's major number */
18890 -MODULE_PARM_DESC(driver_major, "Major device number, default = 0 (auto)");
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");
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");
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");
18906 MODULE_AUTHOR("Texas Instruments");
18907 MODULE_LICENSE("GPL");
18908 +MODULE_VERSION(DSPBRIDGE_VERSION);
18910 static char *driver_name = DRIVER_NAME;
18912 @@ -200,7 +158,7 @@ static char *driver_name = DRIVER_NAME;
18913 static struct GT_Mask driverTrace;
18914 #endif /* CONFIG_BRIDGE_DEBUG */
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;
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);
18929 - result = alloc_chrdev_region(&dev, driver_minor, 1,
18931 - driver_major = MAJOR(dev);
18934 + result = alloc_chrdev_region(&dev, driver_minor, 1, driver_name);
18936 GT_1trace(driverTrace, GT_7CLASS, "bridge_init: "
18937 "Can't get Major %d \n", driver_major);
18942 - bridge_device = kmalloc(sizeof(struct bridge_dev), GFP_KERNEL);
18943 + driver_major = MAJOR(dev);
18945 + bridge_device = kzalloc(sizeof(struct bridge_dev), GFP_KERNEL);
18946 if (!bridge_device) {
18948 - unregister_chrdev_region(dev, 1);
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;
18957 status = cdev_add(&bridge_device->cdev, dev, 1);
18960 GT_0trace(driverTrace, GT_7CLASS,
18961 "Failed to add the bridge device \n");
18967 @@ -325,7 +274,7 @@ static int __devinit omap34xx_bridge_pro
18969 GT_create(&driverTrace, "LD");
18972 +#ifdef CONFIG_BRIDGE_DEBUG
18975 #elif defined(DDSP_DEBUG_PRODUCT) && GT_TRACE
18976 @@ -349,22 +298,17 @@ static int __devinit omap34xx_bridge_pro
18980 - REG_SetValue(NULL, NULL, AUTOSTART, REG_DWORD, (u8 *)&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);
18988 - REG_SetValue(NULL, NULL, AUTOSTART, REG_DWORD, (u8 *)&temp,
18990 - REG_SetValue(NULL, NULL, DEFEXEC, REG_SZ, (u8 *) "\0", (u32)2);
18992 - REG_SetValue(NULL, NULL, NUMPROCS, REG_SZ, (u8 *) num_procs,
18993 - strlen(num_procs) + 1);
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);
19002 + if (_shm_size >= 0x10000) { /* 64 KB */
19003 + initStatus = REG_SetValue(SHMSIZE, (u8 *)&_shm_size,
19004 + sizeof(_shm_size));
19006 initStatus = DSP_EINVALIDARG;
19008 @@ -372,38 +316,27 @@ static int __devinit omap34xx_bridge_pro
19009 "SHM size must be at least 64 KB\n");
19011 GT_1trace(driverTrace, GT_7CLASS,
19012 - "requested shm_size = 0x%x\n", shm_size);
19013 + "requested shm_size = 0x%x\n", _shm_size);
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;
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));
19025 GT_1trace(driverTrace, GT_7CLASS, "phys_mempool_base = 0x%x \n",
19026 phys_mempool_base);
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));
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));
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));
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");
19057 - * When Smartreflex is ON, DSP requires at least OPP level 3
19058 - * to operate reliably. So boost lower OPP levels to OPP3.
19060 - if (pdata->dsp_set_min_opp)
19061 - (*pdata->dsp_set_min_opp)(min_active_opp);
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");
19074 + kfree(bridge_device);
19077 + unregister_chrdev_region(dev, 1);
19083 static int __devexit omap34xx_bridge_remove(struct platform_device *pdev)
19084 @@ -456,10 +392,7 @@ static int __devexit omap34xx_bridge_rem
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;
19094 GT_0trace(driverTrace, GT_ENTER, "-> driver_exit\n");
19096 @@ -477,21 +410,6 @@ static int __devexit omap34xx_bridge_rem
19098 #endif /* #ifdef CONFIG_BRIDGE_DVFS */
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);
19109 - pTmp = pCtxtclosed->next;
19110 - DRV_RemoveProcContext((struct DRV_OBJECT *)hDrvObject,
19112 - pCtxtclosed = pTmp;
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);
19122 +#ifdef CONFIG_BRIDGE_DVFS
19123 clk_put(clk_handle);
19125 +#endif /* #ifdef CONFIG_BRIDGE_DVFS */
19128 + MEM_ExtPhysPoolRelease();
19133 @@ -580,27 +502,22 @@ static void __exit bridge_exit(void)
19134 static int bridge_open(struct inode *ip, struct file *filp)
19137 - DSP_STATUS dsp_status;
19138 - HANDLE hDrvObject;
19139 struct PROCESS_CONTEXT *pr_ctxt = NULL;
19141 GT_0trace(driverTrace, GT_ENTER, "-> bridge_open\n");
19143 - dsp_status = CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
19144 - if (DSP_SUCCEEDED(dsp_status)) {
19146 - * Allocate a new process context and insert it into global
19147 - * process context list.
19149 - DRV_InsertProcContext(hDrvObject, &pr_ctxt);
19151 - DRV_ProcUpdatestate(pr_ctxt, PROC_RES_ALLOCATED);
19152 - DRV_ProcSetPID(pr_ctxt, current->tgid);
19154 - status = -ENOMEM;
19157 + * Allocate a new process context and insert it into global
19158 + * process context list.
19160 + pr_ctxt = MEM_Calloc(sizeof(struct PROCESS_CONTEXT), MEM_PAGED);
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);
19168 + status = -ENOMEM;
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)
19176 - DSP_STATUS dsp_status;
19177 - HANDLE hDrvObject;
19178 struct PROCESS_CONTEXT *pr_ctxt;
19179 - struct PROC_OBJECT *proc_obj_ptr, *temp;
19181 GT_0trace(driverTrace, GT_ENTER, "-> bridge_release\n");
19183 if (!filp->private_data) {
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,
19194 - PROC_Detach(proc_obj_ptr, pr_ctxt);
19196 - DRV_RemoveProcContext((struct DRV_OBJECT *)hDrvObject,
19201 - filp->private_data = NULL;
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);
19212 + filp->private_data = NULL;
19215 GT_0trace(driverTrace, GT_ENTER, "<- bridge_release\n");
19218 @@ -665,13 +573,15 @@ static long bridge_ioctl(struct file *fi
19220 GT_0trace(driverTrace, GT_ENTER, " -> driver_ioctl\n");
19222 - /* Deduct one for the CMD_BASE. */
19223 - code = (code - 1);
19224 + if (!filp->private_data) {
19229 status = copy_from_user(&pBufIn, (union Trapped_Args *)args,
19230 sizeof(union Trapped_Args));
19232 - if (status >= 0) {
19234 status = WCD_CallDevIOCtl(code, &pBufIn, &retval,
19235 filp->private_data);
19237 @@ -685,8 +595,8 @@ static long bridge_ioctl(struct file *fi
19242 GT_0trace(driverTrace, GT_ENTER, " <- driver_ioctl\n");
19247 @@ -716,22 +626,18 @@ static int bridge_mmap(struct file *filp
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)
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);
19264 + DRV_RemoveAllSTRMResElements(pCtxt);
19265 + DRV_RemoveAllNodeResElements(pCtxt);
19266 + DRV_RemoveAllDMMResElements(pCtxt);
19267 + pCtxt->resState = PROC_RES_FREED;
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
19278 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19283 - * ======== drv_interface.h ========
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
19293 #ifndef _DRV_INTERFACE_H_
19294 #define _DRV_INTERFACE_H_
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
19301 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
19303 + * Interface to allocate and free bridge resources.
19305 * Copyright (C) 2005-2006 Texas Instruments, Inc.
19307 * This package is free software; you can redistribute it and/or modify
19309 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19314 - * ======== dspdrv.c ========
19316 - * Interface to allocate and free bridge resources.
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
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.
19389 /* ----------------------------------- Host OS */
19390 #include <dspbridge/host_os.h>
19394 /* ----------------------------------- OS Adaptation Layer */
19395 #include <dspbridge/cfg.h>
19396 -#include <dspbridge/csl.h>
19397 #include <dspbridge/mem.h>
19398 #include <dspbridge/reg.h>
19401 /* ----------------------------------- Resource Manager */
19402 #include <dspbridge/mgr.h>
19404 -/* ----------------------------------- Others */
19405 -#include <dspbridge/dbreg.h>
19407 /* ----------------------------------- This */
19408 #include <dspbridge/dspdrv.h>
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;
19416 u32 deviceNodeString;
19418 @@ -143,11 +63,12 @@ u32 DSP_Init(OUT u32 *initStatus)
19420 GT_0trace(curTrace, GT_ENTER, "Entering DSP_Init \r\n");
19422 - if (DSP_FAILED(WCD_Init())) {
19423 + if (!WCD_Init()) {
19424 GT_0trace(curTrace, GT_7CLASS, "DSP_Init Failed \n");
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");
19433 @@ -155,29 +76,27 @@ u32 DSP_Init(OUT u32 *initStatus)
19434 GT_0trace(curTrace, GT_5CLASS, "DSP_Init:DRV Created \r\n");
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);
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;
19463 GT_0trace(curTrace, GT_7CLASS,
19464 "DSP_Init:DRV_RequestResources Failed \r\n");
19465 status = DSP_EFAIL;
19466 - } /* DRV_RequestResources */
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
19485 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
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.
19491 * Copyright (C) 2005-2006 Texas Instruments, Inc.
19493 * This package is free software; you can redistribute it and/or modify
19495 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19500 - * ======== mgr.c ========
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.
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.
19524 /* ----------------------------------- DSP/BIOS Bridge */
19525 #include <dspbridge/std.h>
19526 #include <dspbridge/dbdefs.h>
19529 /* ----------------------------------- Others */
19530 #include <dspbridge/dbdcd.h>
19531 -#include <dspbridge/dbreg.h>
19532 #include <dspbridge/drv.h>
19533 #include <dspbridge/dev.h>
19535 @@ -97,16 +74,16 @@ DSP_STATUS MGR_Create(OUT struct MGR_OBJ
19537 MEM_AllocObject(pMgrObject, struct MGR_OBJECT, SIGNATURE);
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,
19548 + if (DSP_SUCCEEDED(status)) {
19549 *phMgrObject = pMgrObject;
19550 GT_0trace(MGR_DebugMask, GT_1CLASS,
19551 "MGR_Create:MGR Created\r\n");
19553 - status = DSP_EFAIL;
19554 GT_0trace(MGR_DebugMask, GT_7CLASS,
19555 "MGR_Create:CFG_SetObject "
19557 @@ -115,7 +92,6 @@ DSP_STATUS MGR_Create(OUT struct MGR_OBJ
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)
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);
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");
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;
19599 GT_0trace(MGR_DebugMask, GT_7CLASS,
19600 "Manager_EnumNodeInfo: "
19601 "Failed to Get Node Info \r\n");
19602 - status = DSP_EFAIL;
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;
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
19618 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
19620 + * DSP/BIOS Bridge dynamic + overlay Node loader.
19622 * Copyright (C) 2005-2006 Texas Instruments, Inc.
19624 * This package is free software; you can redistribute it and/or modify
19626 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19631 - * ======== nldr.c ========
19633 - * DSP/BIOS Bridge dynamic + overlay Node loader.
19635 - * Public Functions:
19641 - * NLDR_GetFxnAddr
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.
19665 #include <dspbridge/host_os.h>
19667 #include <dspbridge/std.h>
19668 @@ -58,12 +24,11 @@
19670 #include <dspbridge/dbc.h>
19671 #include <dspbridge/gt.h>
19673 +#ifdef CONFIG_BRIDGE_DEBUG
19674 #include <dspbridge/dbg.h>
19677 /* OS adaptation layer */
19678 -#include <dspbridge/csl.h>
19679 #include <dspbridge/mem.h>
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 */
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 */
19693 * Masks that define memory type. Must match defines in dynm.cdb.
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)
19710 * ======== MemInfo ========
19711 @@ -470,7 +435,7 @@ DSP_STATUS NLDR_Allocate(struct NLDR_OBJ
19713 /* Cleanup on failure */
19714 if (DSP_FAILED(status) && pNldrNode)
19715 - NLDR_Free((struct NLDR_NODEOBJECT *) pNldrNode);
19716 + MEM_FreeObject(pNldrNode);
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);
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 */
19736 + COD_GetLoader(hCodMgr, &pNldr->dbll);
19737 + COD_GetBaseLib(hCodMgr, &pNldr->baseLib);
19738 + COD_GetBaseName(hCodMgr, szZLFile, COD_MAXPATHLENGTH);
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;
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)
19756 - * ======== NLDR_Free ========
19758 -void NLDR_Free(struct NLDR_NODEOBJECT *hNldrNode)
19760 - DBC_Require(cRefs > 0);
19761 - DBC_Require(MEM_IsValidHandle(hNldrNode, NLDR_NODESIGNATURE));
19763 - GT_1trace(NLDR_debugMask, GT_ENTER, "NLDR_Free(0x%x)\n", hNldrNode);
19765 - MEM_FreeObject(hNldrNode);
19769 * ======== NLDR_GetFxnAddr ========
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;
19776 - UnloadLib(hNldrNode, pRootLib);
19778 + UnloadLib(hNldrNode, pRootLib);
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 */
19795 @@ -1052,18 +1000,18 @@ static DSP_STATUS AddOvlyInfo(void *hand
19797 /* Determine which phase this section belongs to */
19798 for (pch = pSectName + 1; *pch && *pch != seps; 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++;
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,
19817 @@ -1071,7 +1019,7 @@ static DSP_STATUS AddOvlyInfo(void *hand
19818 hNldr->ovlyTable[i].nDeleteSects++;
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,
19826 @@ -1121,14 +1069,14 @@ static DSP_STATUS AddOvlyNode(struct DSP
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;
19839 - strncpy(pBuf, pNodeName, uLen);
19840 + strncpy(pBuf, pNodeName, uLen);
19841 hNldr->ovlyTable[hNldr->nNode].pNodeName = pBuf;
19844 @@ -1432,7 +1380,7 @@ static DSP_STATUS LoadLib(struct NLDR_NO
19846 * Recursively load dependent libraries.
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];
19857 - if (depLibUUIDs) {
19858 - status = LoadLib(hNldrNode, pDepLib,
19859 + status = LoadLib(hNldrNode, pDepLib,
19861 persistentDepLibs[i], libPath,
19865 - status = DSP_EMEMORY;
19868 if (DSP_SUCCEEDED(status)) {
19869 if ((status != DSP_SALREADYLOADED) &&
19870 @@ -1560,6 +1504,12 @@ static DSP_STATUS LoadOvly(struct NLDR_N
19873 DBC_Assert(i < hNldr->nOvlyNodes);
19876 + status = DSP_ENOTFOUND;
19882 pRefCount = &(pONode->createRef);
19883 @@ -1583,10 +1533,6 @@ static DSP_STATUS LoadOvly(struct NLDR_N
19887 - DBC_Assert(pRefCount != NULL);
19888 - if (DSP_FAILED(status))
19891 if (pRefCount == NULL)
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;
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
19905 DBC_Assert(i < hNldr->nOvlyNodes);
19908 + /* TODO: Should we print warning here? */
19913 pRefCount = &(pONode->createRef);
19914 @@ -1901,23 +1851,21 @@ static void UnloadOvly(struct NLDR_NODEO
19918 - if (DSP_SUCCEEDED(status)) {
19919 - DBC_Assert(pRefCount && (*pRefCount > 0));
19920 - if (pRefCount && (*pRefCount > 0)) {
19923 - DBC_Assert(*pOtherRef > 0);
19926 + DBC_Assert(pRefCount && (*pRefCount > 0));
19927 + if (pRefCount && (*pRefCount > 0)) {
19930 + DBC_Assert(*pOtherRef > 0);
19934 - if (pRefCount && (*pRefCount == 0)) {
19936 + if (pRefCount && *pRefCount == 0) {
19937 /* 'Deallocate' memory */
19938 FreeSects(hNldr, pPhaseSects, nAlloc);
19940 if (pOtherRef && *pOtherRef == 0)
19941 FreeSects(hNldr, pOtherSects, nOtherAlloc);
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
19951 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
19953 + * DSP/BIOS Bridge Node Manager.
19955 * Copyright (C) 2005-2006 Texas Instruments, Inc.
19957 * This package is free software; you can redistribute it and/or modify
19959 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19963 - * ======== node.c ========
19966 - * DSP/BIOS Bridge Node Manager.
19968 - * Public Functions:
19970 - * NODE_AllocMsgBuf
19971 - * NODE_ChangePriority
19979 - * NODE_FreeMsgBuf
19981 - * NODE_GetChannelId
19982 - * NODE_GetMessage
19983 - * NODE_GetStrmMgr
19987 - * NODE_PutMessage
19988 - * NODE_RegisterNotify
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
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.
20040 /* ----------------------------------- Host OS */
20041 #include <dspbridge/host_os.h>
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>
20053 /* ----------------------------------- Others */
20054 #include <dspbridge/gb.h>
20056 +#ifdef CONFIG_BRIDGE_DEBUG
20057 #include <dspbridge/uuidutil.h>
20058 #include <dspbridge/dbg.h>
20060 @@ -144,12 +67,9 @@
20061 #include <dspbridge/dbll.h>
20062 #include <dspbridge/nldr.h>
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>
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 ========
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 */
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,
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 = {
20123 @@ -371,14 +290,13 @@ static struct NLDR_FXNS nldrFxns = {
20125 enum NODE_STATE NODE_GetState(HANDLE hNode)
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);
20133 - return pNode->nState;
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);
20141 + return pNode->nState;
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 */
20153 @@ -419,9 +336,7 @@ DSP_STATUS NODE_Allocate(struct PROC_OBJ
20154 struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
20157 -#ifndef RES_CLEANUP_DISABLE
20162 DBC_Require(cRefs > 0);
20163 DBC_Require(hProcessor != NULL);
20164 @@ -437,6 +352,9 @@ DSP_STATUS NODE_Allocate(struct PROC_OBJ
20166 status = PROC_GetProcessorId(hProcessor, &procId);
20168 + if (procId != DSP_UNIT)
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;
20178 - if (procId != DSP_UNIT)
20181 if (DSP_FAILED(status))
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;
20192 /* Allocate node object and fill in */
20193 if (DSP_FAILED(status))
20197 MEM_AllocObject(pNode, struct NODE_OBJECT, NODE_SIGNATURE);
20198 if (pNode == NULL) {
20199 status = DSP_EMEMORY;
20203 pNode->hNodeMgr = hNodeMgr;
20204 /* This critical section protects GetNodeProps */
20205 status = SYNC_EnterCS(hNodeMgr->hSync);
20206 - if (procId != DSP_UNIT)
20209 + if (DSP_FAILED(status))
20212 /* Get DSP_NDBPROPS from node database */
20213 status = GetNodeProps(hNodeMgr->hDcdMgr, pNode, pNodeId,
20214 &(pNode->dcdProps));
20215 if (DSP_FAILED(status))
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;
20228 /* Check if we have a user allocated node heap */
20229 if (!(pAttrIn->pGPPVirtAddr))
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;
20238 if (DSP_FAILED(status))
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);
20249 - GT_1trace(NODE_debugMask, GT_5CLASS,
20250 - "NODE_Allocate: DSPProcessor_Reserve"
20251 - " Memory successful: 0x%x\n", status);
20255 #ifdef DSP_DMM_DEBUG
20256 status = DMM_GetHandle(pProcObject, &hDmmMgr);
20257 - if (DSP_SUCCEEDED(status))
20258 - DMM_MemMapDump(hDmmMgr);
20260 if (DSP_FAILED(status))
20264 + DMM_MemMapDump(hDmmMgr);
20267 mapAttrs |= DSP_MAPLITTLEENDIAN;
20268 mapAttrs |= DSP_MAPELEMSIZE32;
20269 @@ -575,15 +489,13 @@ func_cont:
20270 " successful: 0x%x\n", status);
20275 (void)SYNC_LeaveCS(hNodeMgr->hSync);
20277 if (pAttrIn != NULL) {
20278 /* Overrides of NBD properties */
20279 pNode->uTimeout = pAttrIn->uTimeout;
20280 pNode->nPriority = pAttrIn->iPriority;
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),
20292 + sizeof(struct DSP_STREAMCONNECT),
20294 if (uNumStreams > 0 && pNode->streamConnect == NULL)
20295 status = DSP_EMEMORY;
20297 @@ -644,9 +556,9 @@ func_cont2:
20299 if (DSP_FAILED(status)) {
20300 GT_1trace(NODE_debugMask, GT_5CLASS,
20301 - "NODE_Allocate: Failed"
20302 - " to create SM translator: 0x%x\n",
20304 + "NODE_Allocate: Failed to "
20305 + "create SM translator: 0x%x\n",
20310 @@ -661,7 +573,7 @@ func_cont2:
20312 pmsgArgs->uArgLength = pArgs->cbData;
20313 memcpy(pmsgArgs->pData, pArgs->cData,
20319 @@ -691,18 +603,16 @@ func_cont2:
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 !=
20331 - label = MEM_Calloc(sizeof(STACKSEGLABEL)+1, MEM_PAGED);
20332 - strncpy(label, STACKSEGLABEL, sizeof(STACKSEGLABEL)+1);
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 "
20349 ulGppMemBase = (u32)hostRes.dwMemBase[1];
20350 @@ -744,24 +655,20 @@ func_cont2:
20361 if (DSP_SUCCEEDED(status)) {
20362 /* Add the node to the node manager's list of allocated
20364 - LST_InitElem((struct LST_ELEM *)pNode);
20365 + LST_InitElem((struct list_head *)pNode);
20366 NODE_SetState(pNode, NODE_ALLOCATED);
20368 status = SYNC_EnterCS(hNodeMgr->hSync);
20370 if (DSP_SUCCEEDED(status)) {
20371 LST_PutTail(hNodeMgr->nodeList,
20372 - (struct LST_ELEM *) pNode);
20373 + (struct list_head *) pNode);
20374 ++(hNodeMgr->uNumNodes);
20377 @@ -785,13 +692,11 @@ func_cont2:
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);
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.
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)
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,
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;
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);
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))
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;
20435 - if (DSP_SUCCEEDED(status)) {
20436 - status = PROC_GetProcessorId(pNode->hProcessor,
20438 - if (procId == DSP_UNIT) {
20439 - status = DISP_NodeChangePriority(hNodeMgr->
20441 - hNodeMgr->ulFxnAddrs[RMSCHANGENODEPRIORITY],
20442 - hNode->nodeEnv, nPriority);
20444 - if (DSP_SUCCEEDED(status))
20445 - NODE_SetPriority(hNode, nPriority);
20447 + status = PROC_GetProcessorId(pNode->hProcessor, &procId);
20448 + if (procId == DSP_UNIT) {
20449 + status = DISP_NodeChangePriority(hNodeMgr->
20451 + hNodeMgr->ulFxnAddrs[RMSCHANGENODEPRIORITY],
20452 + hNode->nodeEnv, nPriority);
20454 + if (DSP_SUCCEEDED(status))
20455 + NODE_SetPriority(hNode, nPriority);
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;
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;
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;
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:
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;
20502 /* Copy device name */
20503 - strncpy(pstrmDef->szDevice, hDevNode->pstrDevName,
20505 + strncpy(pstrmDef->szDevice, hDevNode->pstrDevName,
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);
20515 hDevNode->hDeviceOwner = hNode;
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;
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",
20529 - if (!MEM_IsValidHandle(pNode, NODE_SIGNATURE)) {
20530 - status = DSP_EHANDLE;
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))
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);
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
20557 - PROC_Ctrl(hNode->hProcessor, WMDIOCTL_DEEPSLEEP,
20560 - /* Increment count, sleep later when node fully
20562 - hNodeMgr->uNumCreated++;
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);
20572 pNodeMgr->hDevObject = hDevObject;
20573 - pNodeMgr->nodeList = LST_Create();
20574 + pNodeMgr->nodeList = MEM_Calloc(sizeof(struct LST_LIST),
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");
20583 + INIT_LIST_HEAD(&pNodeMgr->nodeList->head);
20584 status = NTFY_Create(&pNodeMgr->hNtfy);
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;
20594 if (DSP_SUCCEEDED(status)) {
20595 pNodeMgr->chnlMap = GB_create(pNodeMgr->ulNumChnls);
20596 @@ -1625,17 +1505,12 @@ DSP_STATUS NODE_Delete(struct NODE_OBJEC
20598 struct WMD_DRV_INTERFACE *pIntfFxns;
20600 -#ifndef RES_CLEANUP_DISABLE
20604 struct DSP_PROCESSORSTATE procStatus;
20605 DBC_Require(cRefs > 0);
20606 GT_1trace(NODE_debugMask, GT_ENTER, "NODE_Delete: hNode: 0x%x\n",
20608 - if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20609 - status = DSP_EHANDLE;
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:
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
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);
20637 GT_0trace(NODE_debugMask, GT_ENTER, "\nNODE_Delete13:\n ");
20638 DeleteNode(hNode, pr_ctxt);
20639 -#ifndef RES_CLEANUP_DISABLE
20641 GT_0trace(NODE_debugMask, GT_5CLASS, "\nNODE_Delete2:\n ");
20643 - DRV_RemoveNodeResElement(nodeRes, pr_ctxt);
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;
20652 DBC_Require(cRefs > 0);
20653 - DBC_Require(MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE));
20655 GT_1trace(NODE_debugMask, GT_ENTER, "NODE_DeleteMgr: hNodeMgr: 0x%x\n",
20657 - DeleteNodeMgr(hNodeMgr);
20658 + if (MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE))
20659 + DeleteNodeMgr(hNodeMgr);
20661 + status = DSP_EHANDLE;
20665 @@ -1799,7 +1669,7 @@ DSP_STATUS NODE_DeleteMgr(struct NODE_MG
20667 * Enumerate currently allocated nodes.
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)
20674 @@ -1807,7 +1677,6 @@ DSP_STATUS NODE_EnumNodes(struct NODE_MG
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,
20686 + if (!MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE)) {
20687 + status = DSP_EHANDLE;
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);
20700 *puAllocated = *puNumNodes = hNodeMgr->uNumNodes;
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);
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;
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
20723 /* pBuffer is clients Va. */
20724 status = CMM_XlatorFreeBuf(pNode->hXlator, pBuffer);
20725 - if (DSP_FAILED(status))
20726 - status = DSP_EFAIL;
20728 - status = DSP_SOK;
20732 DBC_Assert(NULL); /* BUG */
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,
20743 - if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20744 - status = DSP_EHANDLE;
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));
20767 - /* end of SYNC_EnterCS */
20768 - /* Exit critical section */
20769 - (void)SYNC_LeaveCS(hNodeMgr->hSync);
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));
20792 + /* end of SYNC_EnterCS */
20793 + /* Exit critical section */
20794 + (void)SYNC_LeaveCS(hNodeMgr->hSync);
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,
20803 - if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20804 - status = DSP_EHANDLE;
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;
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
20824 DBC_Require(cRefs > 0);
20826 - if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE))
20827 - status = DSP_EHANDLE;
20829 - *phStrmMgr = hNode->hNodeMgr->hStrmMgr;
20830 + *phStrmMgr = hNode->hNodeMgr->hStrmMgr;
20834 @@ -2131,16 +1984,10 @@ DSP_STATUS NODE_GetStrmMgr(struct NODE_O
20836 enum NLDR_LOADTYPE NODE_GetLoadType(struct NODE_OBJECT *hNode)
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);
20847 - return hNode->dcdProps.objData.nodeObj.usLoadType;
20849 + return hNode->dcdProps.objData.nodeObj.usLoadType;
20853 @@ -2152,13 +1999,8 @@ u32 NODE_GetTimeout(struct NODE_OBJECT *
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);
20863 - return hNode->uTimeout;
20865 + return hNode->uTimeout;
20869 @@ -2172,12 +2014,8 @@ enum NODE_TYPE NODE_GetType(struct NODE_
20871 if (hNode == (struct NODE_OBJECT *) DSP_HGPPNODE)
20872 nodeType = NODE_GPP;
20874 - if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE))
20877 - nodeType = hNode->nType;
20880 + nodeType = hNode->nType;
20884 @@ -2188,8 +2026,6 @@ enum NODE_TYPE NODE_GetType(struct NODE_
20886 bool NODE_Init(void)
20888 - bool fRetVal = true;
20890 DBC_Require(cRefs >= 0);
20893 @@ -2197,14 +2033,12 @@ bool NODE_Init(void)
20894 GT_create(&NODE_debugMask, "NO"); /* "NO" for NOde */
20901 GT_1trace(NODE_debugMask, GT_5CLASS, "NODE_Init(), ref count: 0x%x\n",
20904 - DBC_Ensure((fRetVal && (cRefs > 0)) || (!fRetVal && (cRefs >= 0)));
20910 @@ -2214,7 +2048,9 @@ bool NODE_Init(void)
20912 void NODE_OnExit(struct NODE_OBJECT *hNode, s32 nStatus)
20914 - DBC_Assert(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
20915 + if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE))
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
20923 GT_1trace(NODE_debugMask, GT_ENTER, "NODE_Pause: hNode: 0x%x\n", hNode);
20925 - if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
20926 - status = DSP_EHANDLE;
20929 - nodeType = NODE_GetType(hNode);
20930 - if (nodeType != NODE_TASK && nodeType != NODE_DAISSOCKET)
20931 - status = DSP_ENODETYPE;
20933 + nodeType = NODE_GetType(hNode);
20934 + if (nodeType != NODE_TASK && nodeType != NODE_DAISSOCKET)
20935 + status = DSP_ENODETYPE;
20937 if (DSP_FAILED(status))
20940 @@ -2278,11 +2110,13 @@ DSP_STATUS NODE_Pause(struct NODE_OBJECT
20941 if (state != NODE_RUNNING)
20942 status = DSP_EWRONGSTATE;
20944 + if (DSP_FAILED(status))
20946 hProcessor = hNode->hProcessor;
20947 status = PROC_GetState(hProcessor, &procStatus,
20948 sizeof(struct DSP_PROCESSORSTATE));
20949 if (DSP_FAILED(status))
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;
20962 if (DSP_SUCCEEDED(status)) {
20963 status = DISP_NodeChangePriority(hNodeMgr->
20964 @@ -2308,6 +2142,7 @@ DSP_STATUS NODE_Pause(struct NODE_OBJECT
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;
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.
20987 DSP_STATUS NODE_RegisterNotify(struct NODE_OBJECT *hNode, u32 uEventMask,
20989 - struct DSP_NOTIFICATION *hNotification)
20991 + struct DSP_NOTIFICATION *hNotification)
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);
20999 - if (!MEM_IsValidHandle(hNode, NODE_SIGNATURE)) {
21000 - status = DSP_EHANDLE;
21002 - /* Check if event mask is a valid node related event */
21003 - if (uEventMask & ~(DSP_NODESTATECHANGE |
21004 - DSP_NODEMESSAGEREADY))
21005 - status = DSP_EVALUE;
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;
21015 + /* Check if notify type is valid */
21016 + if (uNotifyType != DSP_SIGNALEVENT)
21017 + status = DSP_EVALUE;
21019 + /* Only one Notification can be registered at a
21020 + * time - Limitation */
21021 + if (uEventMask == (DSP_NODESTATECHANGE |
21022 + DSP_NODEMESSAGEREADY))
21023 + status = DSP_EVALUE;
21025 - /* Only one Notification can be registered at a
21026 - * time - Limitation */
21027 - if (uEventMask == (DSP_NODESTATECHANGE |
21028 - DSP_NODEMESSAGEREADY))
21029 - status = DSP_EVALUE;
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 *
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;
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 *
21049 hNodeMgr = hNode->hNodeMgr;
21050 + if (!MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE)) {
21051 + status = DSP_EHANDLE;
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
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;
21066 @@ -2778,10 +2608,10 @@ static void DeleteNode(struct NODE_OBJEC
21067 (struct PROC_OBJECT *)hNode->hProcessor;
21070 - DBC_Require(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
21072 hNodeMgr = hNode->hNodeMgr;
21073 - if (!MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE))
21075 + if (!MEM_IsValidHandle(hNodeMgr, NODEMGR_SIGNATURE))
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;
21086 + hNode->hMsgQueue = NULL;
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);
21093 MEM_Free(hNode->inputs);
21094 - hNode->inputs = NULL;
21095 + hNode->inputs = NULL;
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);
21102 MEM_Free(hNode->outputs);
21103 - hNode->outputs = NULL;
21104 + hNode->outputs = NULL;
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].
21112 - taskArgs.strmInDef[i].szDevice = NULL;
21113 + taskArgs.strmInDef[i].szDevice = NULL;
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].
21121 - taskArgs.strmOutDef[i].szDevice = NULL;
21122 + taskArgs.strmOutDef[i].szDevice = NULL;
21125 MEM_Free(taskArgs.strmOutDef);
21126 @@ -2841,8 +2670,8 @@ static void DeleteNode(struct NODE_OBJEC
21128 if (taskArgs.uDSPHeapResAddr) {
21129 status = PROC_UnMap(hNode->hProcessor,
21130 - (void *)taskArgs.uDSPHeapAddr,
21132 + (void *)taskArgs.uDSPHeapAddr,
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
21140 if (nodeType != NODE_MESSAGE) {
21141 - if (hNode->streamConnect) {
21142 + if (hNode->streamConnect) {
21143 MEM_Free(hNode->streamConnect);
21144 - hNode->streamConnect = NULL;
21146 + hNode->streamConnect = NULL;
21149 - if (hNode->pstrDevName) {
21150 + if (hNode->pstrDevName) {
21151 MEM_Free(hNode->pstrDevName);
21152 - hNode->pstrDevName = NULL;
21154 + hNode->pstrDevName = NULL;
21157 - if (hNode->hNtfy) {
21158 + if (hNode->hNtfy) {
21159 NTFY_Delete(hNode->hNtfy);
21160 - hNode->hNtfy = NULL;
21162 + hNode->hNtfy = NULL;
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;
21171 + hNode->dcdProps.objData.nodeObj.pstrCreatePhaseFxn = NULL;
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;
21179 + hNode->dcdProps.objData.nodeObj.pstrExecutePhaseFxn = NULL;
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;
21187 + hNode->dcdProps.objData.nodeObj.pstrDeletePhaseFxn = NULL;
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;
21195 + hNode->dcdProps.objData.nodeObj.pstrIAlgName = NULL;
21198 /* Free all SM address translator resources */
21201 (void) CMM_XlatorDelete(hXlator, TRUE); /* force free */
21205 - if (hNode->hNldrNode) {
21206 - hNodeMgr->nldrFxns.pfnFree(hNode->hNldrNode);
21207 - hNode->hNldrNode = NULL;
21212 + if (hNode->hNldrNode) {
21213 + MEM_Free(hNode->hNldrNode);
21214 + hNode->hNldrNode = NULL;
21216 + hNode->hNodeMgr = NULL;
21217 MEM_FreeObject(hNode);
21225 @@ -2944,7 +2775,7 @@ static void DeleteNodeMgr(struct NODE_MG
21226 DeleteNode(hNode, NULL);
21228 DBC_Assert(LST_IsEmpty(hNodeMgr->nodeList));
21229 - LST_Delete(hNodeMgr->nodeList);
21230 + MEM_Free(hNodeMgr->nodeList);
21232 if (hNodeMgr->hNtfy)
21233 NTFY_Delete(hNodeMgr->hNtfy);
21234 @@ -2990,8 +2821,8 @@ static void DeleteNodeMgr(struct NODE_MG
21235 * Fills stream information.
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)
21244 struct DSP_STREAMCONNECT *pStrm1 = NULL;
21245 @@ -3005,7 +2836,7 @@ static void FillStreamConnect(struct NOD
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
21256 pstrmDef->uNumBufs = DEFAULTNBUFS;
21257 pstrmDef->uBufsize = DEFAULTBUFSIZE / hNodeMgr->
21260 pstrmDef->uSegid = DEFAULTSEGID;
21261 pstrmDef->uAlignment = DEFAULTALIGNMENT;
21262 pstrmDef->uTimeout = DEFAULTTIMEOUT;
21263 @@ -3122,15 +2953,15 @@ static DSP_STATUS GetFxnAddress(struct N
21266 pstrFxnName = hNode->dcdProps.objData.nodeObj.
21267 - pstrCreatePhaseFxn;
21268 + pstrCreatePhaseFxn;
21271 pstrFxnName = hNode->dcdProps.objData.nodeObj.
21272 - pstrExecutePhaseFxn;
21273 + pstrExecutePhaseFxn;
21276 pstrFxnName = hNode->dcdProps.objData.nodeObj.
21277 - pstrDeletePhaseFxn;
21278 + pstrDeletePhaseFxn;
21281 /* Should never get here */
21282 @@ -3153,7 +2984,6 @@ void GetNodeInfo(struct NODE_OBJECT *hNo
21286 - DBC_Require(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
21287 DBC_Require(pNodeInfo != NULL);
21289 pNodeInfo->cbStruct = sizeof(struct DSP_NODEINFO);
21290 @@ -3178,9 +3008,9 @@ void GetNodeInfo(struct NODE_OBJECT *hNo
21291 * Retrieve node properties.
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)
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;
21308 +#ifdef CONFIG_BRIDGE_DEBUG
21309 char szUuid[MAXUUIDLEN];
21312 @@ -3198,7 +3028,7 @@ static DSP_STATUS GetNodeProps(struct DC
21313 if (DSP_SUCCEEDED(status)) {
21314 hNode->nType = nodeType = pndbProps->uNodeType;
21317 +#ifdef CONFIG_BRIDGE_DEBUG
21318 /* Create UUID value to set in registry. */
21319 UUID_UuidToString((struct DSP_UUID *)pNodeId, szUuid,
21321 @@ -3212,22 +3042,22 @@ static DSP_STATUS GetNodeProps(struct DC
21322 pMsgArgs->uNotifyType = pdcdProps->objData.nodeObj.
21324 pMsgArgs->uMaxMessages = pndbProps->uMessageDepth;
21326 +#ifdef CONFIG_BRIDGE_DEBUG
21327 DBG_Trace(DBG_LEVEL7,
21328 "** (node) Max Number of Messages: 0x%x\n",
21329 pMsgArgs->uMaxMessages);
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;
21342 - strncpy(hNode->pstrDevName,
21343 - pndbProps->acName, uLen);
21344 + strncpy(hNode->pstrDevName,
21345 + pndbProps->acName, uLen);
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;
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);
21377 @@ -3302,14 +3132,14 @@ static DSP_STATUS GetProcProps(struct NO
21379 * Fetch Node UUID properties from DCD/DOF file.
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)
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;
21393 DBC_Require(cRefs > 0);
21394 @@ -3340,12 +3170,12 @@ DSP_STATUS NODE_GetUUIDProps(DSP_HPROCES
21395 pNodeId, pNodeProps);
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;
21406 + if (hNodeMgr == NULL) {
21407 + status = DSP_EHANDLE;
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 */
21416 - DBC_Require(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
21418 hNodeMgr = hNode->hNodeMgr;
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);
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;
21436 + pr_debug("%s: failed to copy brd memory, status 0x%x\n"
21437 + , __func__, status);
21439 + pr_debug("%s: failed to get WMD context, status 0x%x\n",
21440 + __func__, status);
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 */
21449 - DBC_Require(MEM_IsValidHandle(hNode, NODE_SIGNATURE));
21450 DBC_Require(nMemSpace & DBLL_CODE || nMemSpace & DBLL_DATA);
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
21458 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
21460 + * Processor interface at the driver level.
21462 * Copyright (C) 2005-2006 Texas Instruments, Inc.
21464 * This package is free software; you can redistribute it and/or modify
21466 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21471 - * ======== proc.c ========
21473 - * Processor interface at the driver level.
21475 - * Public Functions:
21480 - * PROC_GetResourceInfo
21482 - * PROC_FlushMemory
21484 - * PROC_GetProcessorId
21489 - * PROC_NotifyClients
21490 - * PROC_RegisterNotify
21491 - * PROC_ReserveMemory
21494 - * PROC_UnReserveMemory
21495 - * PROC_InvalidateMemory
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
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
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
21550 - *! 27-Jul-2000 rr: PROC_GetTrace and PROC_Load implemented. Updated to
21552 - *! 06-Jul-2000 rr: Created.
21555 /* ------------------------------------ Host OS */
21556 #include <dspbridge/host_os.h>
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>
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>
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>
21588 -#ifndef RES_CLEANUP_DISABLE
21589 #include <dspbridge/resourcecleanup.h>
21591 /* ----------------------------------- Defines, Data Structures, Typedefs */
21592 #define PROC_SIGNATURE 0x434F5250 /* "PROC" (in reverse). */
21593 #define MAXCMDLINELEN 255
21595 #define PWR_TIMEOUT 500 /* Sleep/wake timout in msec */
21596 #define EXTEND "_EXT_END" /* Extmem end addr in DSP binary */
21598 -#define DSP_CACHE_LINE 128
21600 extern char *iva_img;
21602 /* ----------------------------------- Globals */
21603 @@ -168,6 +76,29 @@ extern char *iva_img;
21604 static struct GT_Mask PROC_DebugMask = { NULL, NULL }; /* WCD MGR Mask */
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
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;
21632 struct SYNC_CSOBJECT *hProcLock; /* For critical sections */
21633 @@ -179,47 +110,6 @@ static char **PrependEnvp(char **newEnvp
21637 - * ======== PROC_CleanupAllResources =====
21639 - * Funtion to clean the process resources.
21640 - * This function is intended to be called when the
21641 - * processor is in error state
21643 -DSP_STATUS PROC_CleanupAllResources(void)
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;
21650 - GT_0trace(PROC_DebugMask, GT_ENTER, "PROC_CleanupAllResources\n");
21652 - dsp_status = CFG_GetObject((u32 *)&hDrvObject, REG_DRV_OBJECT);
21653 - if (DSP_FAILED(dsp_status))
21656 - DRV_GetProcCtxtList(&pCtxtclosed, (struct DRV_OBJECT *)hDrvObject);
21658 - while (pCtxtclosed != NULL) {
21659 - if (current->tgid != pCtxtclosed->pid) {
21660 - GT_1trace(PROC_DebugMask, GT_5CLASS,
21662 - "process***%d\n", pCtxtclosed->pid);
21663 - list_for_each_entry_safe(proc_obj_ptr, temp,
21664 - &pCtxtclosed->processor_list,
21666 - PROC_Detach(proc_obj_ptr, pCtxtclosed);
21669 - pCtxtclosed = pCtxtclosed->next;
21672 - WMD_DEH_ReleaseDummyMem();
21674 - return dsp_status;
21678 * ======== PROC_Attach ========
21680 * Prepare for communication with a particular DSP processor, and return
21681 @@ -227,7 +117,7 @@ func_end:
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)
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);
21694 + if (pr_ctxt->hProcessor) {
21695 + *phProcessor = pr_ctxt->hProcessor;
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;
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;
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);
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);
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);
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) {
21744 - len = strlen(iva_img);
21745 - strncpy(execFile, iva_img, len + 1);
21746 + len = strlen(iva_img);
21747 + strncpy(execFile, iva_img, len + 1);
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;
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;
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
21790 if (DSP_FAILED(status))
21794 /* Stop the Device, put it into standby mode */
21795 status = PROC_Stop(hProcObject);
21796 - if (DSP_FAILED(CFG_GetAutoStart(hDevNode, &dwAutoStart)) ||
21799 + if (DSP_FAILED(status))
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),
21815 + if (DSP_SUCCEEDED(status)) {
21816 argv[0] = szExecFile;
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");
21823 - status = DSP_EFILE;
21824 GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_AutoStart: "
21825 "No Exec file found \n");
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.
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)
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);
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);
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);
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);
21862 - if (DSP_SUCCEEDED
21863 - ((*pProcObject->pIntfFxns->pfnDevCntrl)
21864 - (pProcObject->hWmdContext, dwCmd, arg))) {
21865 - status = DSP_SOK;
21867 - status = DSP_EFAIL;
21868 - GT_0trace(PROC_DebugMask, GT_7CLASS,
21869 - "PROC_Ctrl: Failed \n");
21872 + /* intercept PWR deep sleep command */
21873 + if (dwCmd == WMDIOCTL_DEEPSLEEP) {
21874 + timeout = arg->cbData;
21875 + status = PWR_SleepDSP(PWR_DEEPSLEEP, timeout);
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);
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);
21893 + if (DSP_SUCCEEDED
21894 + ((*pProcObject->pIntfFxns->pfnDevCntrl)
21895 + (pProcObject->hWmdContext, dwCmd, arg))) {
21896 + status = DSP_SOK;
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");
21905 GT_1trace(PROC_DebugMask, GT_ENTER, "Exiting PROC_Ctrl, 0x%x\n",
21908 @@ -591,29 +482,23 @@ DSP_STATUS PROC_Ctrl(DSP_HPROCESSOR hPro
21909 * Destroys the Processor Object. Removes the notification from the Dev
21912 -DSP_STATUS PROC_Detach(DSP_HPROCESSOR hProcessor,
21913 - struct PROCESS_CONTEXT *pr_ctxt)
21914 +DSP_STATUS PROC_Detach(struct PROCESS_CONTEXT *pr_ctxt)
21916 DSP_STATUS status = DSP_SOK;
21917 - struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
21918 + struct PROC_OBJECT *pProcObject = NULL;
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");
21925 + pProcObject = (struct PROC_OBJECT *)pr_ctxt->hProcessor;
21927 if (MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
21928 -#ifndef RES_CLEANUP_DISABLE
21930 - spin_lock(&pr_ctxt->proc_list_lock);
21931 - list_del(&pProcObject->proc_object);
21932 - spin_unlock(&pr_ctxt->proc_list_lock);
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);
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
21951 /* Free the Processor Object */
21952 MEM_FreeObject(pProcObject);
21953 + pr_ctxt->hProcessor = NULL;
21955 status = DSP_EHANDLE;
21956 GT_0trace(PROC_DebugMask, GT_7CLASS,
21957 "PROC_Detach: InValid Processor Handle \n");
21960 GT_1trace(PROC_DebugMask, GT_ENTER, "Exiting PROC_Detach, 0x%x\n",
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.
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)
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,
21980 - if (MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
21981 - if (DSP_SUCCEEDED(DEV_GetNodeManager(pProcObject->hDevObject,
21984 - status = NODE_EnumNodes(hNodeMgr, aNodeTab,
21990 + if (DSP_SUCCEEDED(DEV_GetNodeManager(pProcObject->hDevObject,
21993 + status = NODE_EnumNodes(hNodeMgr, aNodeTab,
21999 - status = DSP_EHANDLE;
22000 - GT_0trace(PROC_DebugMask, GT_7CLASS, "PROC_EnumNodes: "
22001 - "InValid Processor Handle \n");
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;
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__,
22017 page = follow_page(vma, start, FOLL_GET);
22019 @@ -750,7 +628,6 @@ static int memory_sync_vma(unsigned long
22022 start = vma->vm_end;
22027 @@ -759,13 +636,12 @@ static int memory_sync_vma(unsigned long
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)
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;
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);
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;
22053 down_read(¤t->mm->mmap_sem);
22055 if (memory_sync_vma((u32)pMpuAddr, ulSize, FlushMemType)) {
22056 @@ -789,7 +658,7 @@ static DSP_STATUS proc_memory_sync(DSP_H
22059 up_read(¤t->mm->mmap_sem);
22062 GT_2trace(PROC_DebugMask, GT_ENTER,
22063 "Leaving %s [0x%x]", __func__, status);
22065 @@ -801,14 +670,11 @@ err_out:
22069 -DSP_STATUS PROC_FlushMemory(DSP_HPROCESSOR hProcessor, void *pMpuAddr,
22070 +DSP_STATUS PROC_FlushMemory(void *hProcessor, void *pMpuAddr,
22071 u32 ulSize, u32 ulFlags)
22073 enum DSP_FLUSHTYPE mtype = PROC_WRITEBACK_INVALIDATE_MEM;
22076 - mtype = PROC_WRITEBACK_MEM;
22078 return proc_memory_sync(hProcessor, pMpuAddr, ulSize, ulFlags, mtype);
22081 @@ -817,7 +683,7 @@ DSP_STATUS PROC_FlushMemory(DSP_HPROCESS
22083 * Invalidates the memory specified
22085 -DSP_STATUS PROC_InvalidateMemory(DSP_HPROCESSOR hProcessor, void *pMpuAddr,
22086 +DSP_STATUS PROC_InvalidateMemory(void *hProcessor, void *pMpuAddr,
22089 enum DSP_FLUSHTYPE mtype = PROC_INVALIDATE_MEM;
22090 @@ -830,7 +696,7 @@ DSP_STATUS PROC_InvalidateMemory(DSP_HPR
22092 * Enumerate the resources currently available on a processor.
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)
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");
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,
22118 + status = DEV_GetNodeManager(pProcObject->hDevObject,
22120 + if (DSP_FAILED(status))
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->
22136 - status = DSP_SOK;
22137 + status = DSP_EVALUE;
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);
22157 status = DSP_EFAIL;
22158 @@ -923,7 +785,7 @@ void PROC_Exit(void)
22159 * Return the Dev Object handle for a given Processor.
22162 -DSP_STATUS PROC_GetDevObject(DSP_HPROCESSOR hProcessor,
22163 +DSP_STATUS PROC_GetDevObject(void *hProcessor,
22164 struct DEV_OBJECT **phDevObject)
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);
22171 - if (MEM_IsValidHandle(pProcObject, PROC_SIGNATURE)) {
22172 - *phDevObject = pProcObject->hDevObject;
22173 - status = DSP_SOK;
22175 - *phDevObject = NULL;
22176 - status = DSP_EHANDLE;
22178 + *phDevObject = pProcObject->hDevObject;
22179 + status = DSP_SOK;
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
22185 * Report the state of the specified DSP processor.
22187 -DSP_STATUS PROC_GetState(DSP_HPROCESSOR hProcessor,
22188 +DSP_STATUS PROC_GetState(void *hProcessor,
22189 OUT struct DSP_PROCESSORSTATE *pProcStatus,
22190 u32 uStateInfoSize)
22192 DSP_STATUS status = DSP_SOK;
22193 struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
22194 - BRD_STATUS brdStatus;
22196 struct DEH_MGR *hDehMgr;
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;
22211 - case BRD_DSP_HIBERNATION:
22212 - /* Fall through */
22213 - case BRD_RUNNING:
22214 - pProcStatus->iState = PROC_RUNNING;
22217 - pProcStatus->iState = PROC_LOADED;
22220 - pProcStatus->iState = PROC_ERROR;
22223 - pProcStatus->iState = 0xFF;
22224 - status = DSP_EFAIL;
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;
22237 + case BRD_SLEEP_TRANSITION:
22238 + case BRD_DSP_HIBERNATION:
22239 + /* Fall through */
22240 + case BRD_RUNNING:
22241 + pProcStatus->iState = PROC_RUNNING;
22244 + pProcStatus->iState = PROC_LOADED;
22247 + pProcStatus->iState = PROC_ERROR;
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");
22256 - /* Next, retrieve error information, if any */
22258 + GT_0trace(PROC_DebugMask, GT_7CLASS,
22259 + "PROC_GetState: General Failure"
22260 + " to read the PROC Status \n");
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");
22271 - status = DSP_EFAIL;
22272 GT_0trace(PROC_DebugMask, GT_7CLASS,
22273 "PROC_GetState: Failed to "
22274 "retrieve DEH handle.\n");
22277 - status = DSP_EHANDLE;
22278 - GT_0trace(PROC_DebugMask, GT_7CLASS,
22279 - "PROC_GetState:InValid Processor Handle \n");
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.
22287 -DSP_STATUS PROC_GetTrace(DSP_HPROCESSOR hProcessor, u8 *pBuf, u32 uMaxSize)
22288 +DSP_STATUS PROC_GetTrace(void *hProcessor, u8 *pBuf, u32 uMaxSize)
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.
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)
22300 DSP_STATUS status = DSP_SOK;
22301 @@ -1098,32 +951,31 @@ DSP_STATUS PROC_Load(DSP_HPROCESSOR hPro
22302 struct DMM_OBJECT *hDmmMgr;
22306 - BRD_STATUS uBrdState;
22307 +#ifdef CONFIG_BRIDGE_DEBUG
22311 #ifdef OPT_LOAD_TIME_INSTRUMENTATION
22312 struct timeval tv1;
22313 struct timeval tv2;
22316 +#if defined(CONFIG_BRIDGE_DVFS) && !defined(CONFIG_CPU_FREQ)
22317 + struct dspbridge_platform_data *pdata =
22318 + omap_dspbridge_dev->dev.platform_data;
22321 DBC_Require(cRefs > 0);
22322 DBC_Require(iArgc > 0);
22323 DBC_Require(aArgv != NULL);
22325 #ifdef OPT_LOAD_TIME_INSTRUMENTATION
22326 do_gettimeofday(&tv1);
22328 -#if defined(CONFIG_BRIDGE_DVFS) && !defined(CONFIG_CPU_FREQ)
22329 - struct dspbridge_platform_data *pdata =
22330 - omap_dspbridge_dev->dev.platform_data;
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");
22342 if (pProcObject->bIsAlreadyAttached) {
22343 GT_0trace(PROC_DebugMask, GT_7CLASS,
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),
22352 /* If memory allocated, save COFF file name*/
22353 if (pProcObject->g_pszLastCoff) {
22354 - strncpy(pProcObject->g_pszLastCoff,
22355 + strncpy(pProcObject->g_pszLastCoff,
22357 - (strlen((char *)aArgv[0]) + 1));
22358 + (strlen((char *)aArgv[0]) + 1));
22362 @@ -1251,30 +1103,19 @@ DSP_STATUS PROC_Load(DSP_HPROCESSOR hPro
22363 DBC_Assert(DSP_SUCCEEDED(status));
22364 DEV_SetMsgMgr(pProcObject->hDevObject, hMsgMgr);
22366 - if (status == DSP_ENOTIMPL) {
22367 - /* It's OK not to have a message manager */
22368 - status = DSP_SOK;
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;
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;
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);
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);
22409 GT_1trace(PROC_DebugMask, GT_7CLASS,
22410 "PROC_Load, pfnBrdSetState "
22411 "failed: 0x%x\n", status);
22412 - status = DSP_EFAIL;
22415 if (DSP_SUCCEEDED(status)) {
22416 @@ -1361,7 +1200,7 @@ DSP_STATUS PROC_Load(DSP_HPROCESSOR hPro
22417 /* Restore the original argv[0] */
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
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:
22436 * Maps a MPU buffer to DSP address space.
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)
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;
22447 -#ifndef RES_CLEANUP_DISABLE
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);
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");
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
22468 (void)SYNC_LeaveCS(hProcLock);
22470 -#ifndef RES_CLEANUP_DISABLE
22471 if (DSP_SUCCEEDED(status)) {
22472 - spin_lock(&pr_ctxt->dmm_list_lock);
22474 DRV_InsertDMMResElement(&dmmRes, pr_ctxt);
22475 DRV_UpdateDMMResElement(dmmRes, (u32)pMpuAddr, ulSize,
22476 (u32)pReqAddr, (u32)*ppMapAddr, hProcessor);
22478 - spin_unlock(&pr_ctxt->dmm_list_lock);
22482 GT_1trace(PROC_DebugMask, GT_ENTER, "Leaving PROC_Map [0x%x]", status);
22485 @@ -1482,7 +1306,7 @@ func_end:
22487 * Register to be notified of specific processor events.
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
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);
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);
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,
22513 - if (DSP_FAILED(status))
22514 - status = DSP_EFAIL;
22522 @@ -1565,7 +1378,7 @@ func_end:
22524 * Reserve a virtually contiguous region of DSP address space.
22526 -DSP_STATUS PROC_ReserveMemory(DSP_HPROCESSOR hProcessor, u32 ulSize,
22527 +DSP_STATUS PROC_ReserveMemory(void *hProcessor, u32 ulSize,
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");
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
22547 GT_1trace(PROC_DebugMask, GT_ENTER, "Leaving PROC_ReserveMemory [0x%x]",
22553 @@ -1600,24 +1407,19 @@ func_end:
22555 * Start a processor running.
22557 -DSP_STATUS PROC_Start(DSP_HPROCESSOR hProcessor)
22558 +DSP_STATUS PROC_Start(void *hProcessor)
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. */
22565 - BRD_STATUS uBrdState;
22566 +#ifdef CONFIG_BRIDGE_DEBUG
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");
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
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
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");
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->
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");
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:
22623 * Stop a processor running.
22625 -DSP_STATUS PROC_Stop(DSP_HPROCESSOR hProcessor)
22626 +DSP_STATUS PROC_Stop(void *hProcessor)
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;
22634 u32 uNodeTabSize = 1;
22636 u32 uNodesAllocated = 0;
22637 - BRD_STATUS uBrdState;
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");
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();
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);
22665 +#ifdef CONFIG_BRIDGE_DEBUG
22666 if (DSP_SUCCEEDED((*pProcObject->pIntfFxns->
22667 pfnBrdStatus)(pProcObject->hWmdContext,
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");
22675 GT_1trace(PROC_DebugMask, GT_ENTER, "Exiting PROC_Stop, status 0x%x\n",
22678 @@ -1783,7 +1574,7 @@ func_end:
22680 * Removes a MPU buffer mapping from the DSP address space.
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)
22686 DSP_STATUS status = DSP_SOK;
22687 @@ -1791,59 +1582,44 @@ DSP_STATUS PROC_UnMap(DSP_HPROCESSOR hPr
22688 struct DMM_OBJECT *hDmmMgr;
22691 -#ifndef RES_CLEANUP_DISABLE
22696 GT_2trace(PROC_DebugMask, GT_ENTER,
22697 "Entered PROC_UnMap, args:\n\thProcessor:"
22698 "0x%x pMapAddr: 0x%x\n", hProcessor, pMapAddr);
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");
22708 status = DMM_GetHandle(hProcessor, &hDmmMgr);
22709 - if (DSP_FAILED(status))
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);
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);
22724 + /* Critical section */
22725 + (void)SYNC_EnterCS(hProcLock);
22727 + * Update DMM structures. Get the size to unmap.
22728 + * This function returns error if the VA is not mapped
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);
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))
22747 - spin_lock(&pr_ctxt->dmm_list_lock);
22749 - rc = DRV_GetDMMResElement((u32)pMapAddr, &dmmRes, pr_ctxt);
22750 - if (rc != DSP_ENOTFOUND)
22751 - DRV_RemoveDMMResElement(dmmRes, pr_ctxt);
22753 - spin_unlock(&pr_ctxt->dmm_list_lock);
22756 + if (DRV_GetDMMResElement((u32)pMapAddr, &dmmRes, pr_ctxt)
22757 + != DSP_ENOTFOUND)
22758 + DRV_RemoveDMMResElement(dmmRes, pr_ctxt);
22760 GT_1trace(PROC_DebugMask, GT_ENTER,
22761 "Leaving PROC_UnMap [0x%x]", status);
22762 @@ -1855,7 +1631,7 @@ func_end:
22764 * Frees a previously reserved region of DSP address space.
22766 -DSP_STATUS PROC_UnReserveMemory(DSP_HPROCESSOR hProcessor, void *pRsvAddr)
22767 +DSP_STATUS PROC_UnReserveMemory(void *hProcessor, void *pRsvAddr)
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");
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]",
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;
22799 - BRD_STATUS uBrdState;
22800 +#ifdef CONFIG_BRIDGE_DEBUG
22804 DBC_Require(cRefs > 0);
22805 - DBC_Require(MEM_IsValidHandle(pProcObject, PROC_SIGNATURE));
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))) {
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",
22823 +#ifdef CONFIG_BRIDGE_DEBUG
22824 DBC_Ensure((DSP_SUCCEEDED(status) && uBrdState == BRD_IDLE) ||
22825 DSP_FAILED(status));
22827 @@ -2007,25 +1777,18 @@ static char **PrependEnvp(char **newEnvp
22829 * Notify the processor the events.
22831 -DSP_STATUS PROC_NotifyClients(DSP_HPROCESSOR hProc, u32 uEvents)
22832 +DSP_STATUS PROC_NotifyClients(void *hProc, u32 uEvents)
22834 DSP_STATUS status = DSP_SOK;
22835 struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProc;
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");
22847 NTFY_Notify(pProcObject->hNtfy, uEvents);
22848 GT_0trace(PROC_DebugMask, GT_1CLASS,
22849 "PROC_NotifyClients :Signaled. \n");
22855 @@ -2035,20 +1798,26 @@ func_end:
22856 * Notify the processor the events. This includes notifying all clients
22857 * attached to a particulat DSP.
22859 -DSP_STATUS PROC_NotifyAllClients(DSP_HPROCESSOR hProc, u32 uEvents)
22860 +DSP_STATUS PROC_NotifyAllClients(void *hProc, u32 uEvents)
22862 DSP_STATUS status = DSP_SOK;
22863 struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProc;
22865 - DBC_Require(MEM_IsValidHandle(pProcObject, PROC_SIGNATURE));
22866 DBC_Require(IsValidProcEvent(uEvents));
22867 DBC_Require(cRefs > 0);
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");
22876 DEV_NotifyClients(pProcObject->hDevObject, uEvents);
22878 GT_0trace(PROC_DebugMask, GT_1CLASS,
22879 "PROC_NotifyAllClients :Signaled. \n");
22885 @@ -2057,7 +1826,7 @@ DSP_STATUS PROC_NotifyAllClients(DSP_HPR
22887 * Retrieves the processor ID.
22889 -DSP_STATUS PROC_GetProcessorId(DSP_HPROCESSOR hProc, u32 *procID)
22890 +DSP_STATUS PROC_GetProcessorId(void *hProc, u32 *procID)
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
22899 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
22901 + * PWR API for controlling DSP power states.
22903 * Copyright (C) 2005-2006 Texas Instruments, Inc.
22905 * This package is free software; you can redistribute it and/or modify
22907 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22912 - * ======== PWR.c ========
22913 - * PWR API for controlling DSP power states.
22915 - * Public Functions:
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.
22927 /* ----------------------------------- Host OS */
22928 #include <dspbridge/host_os.h>
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
22934 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22939 - * ======== rmm.c ========
22942 * This memory manager provides general heap management and arbitrary
22943 * alignment for any number of memory segments.
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.
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.
22961 /* ----------------------------------- DSP/BIOS Bridge */
22962 @@ -84,7 +70,7 @@ struct RMM_Header {
22963 * Keeps track of memory occupied by overlay section.
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
22974 sect = (struct RMM_OvlySect *)LST_Next(target->ovlyList,
22975 - (struct LST_ELEM *)sect);
22976 + (struct list_head *)sect);
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;
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);
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);
23004 @@ -268,11 +254,14 @@ DSP_STATUS RMM_create(struct RMM_TargetO
23006 /* Initialize overlay memory list */
23007 if (DSP_SUCCEEDED(status)) {
23008 - target->ovlyList = LST_Create();
23009 + target->ovlyList = MEM_Calloc(sizeof(struct LST_LIST),
23011 if (target->ovlyList == NULL) {
23012 GT_0trace(RMM_debugMask, GT_6CLASS,
23013 "RMM_create: Memory allocation failed\n");
23014 status = DSP_EMEMORY;
23016 + INIT_LIST_HEAD(&target->ovlyList->head);
23020 @@ -315,7 +304,7 @@ void RMM_delete(struct RMM_TargetObj *ta
23023 DBC_Assert(LST_IsEmpty(target->ovlyList));
23024 - LST_Delete(target->ovlyList);
23025 + MEM_Free(target->ovlyList);
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",
23036 DBC_Ensure(cRefs >= 0);
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);
23048 sect = (struct RMM_OvlySect *)LST_Next(target->ovlyList,
23049 - (struct LST_ELEM *)sect);
23050 + (struct list_head *)sect);
23054 @@ -407,31 +393,21 @@ bool RMM_free(struct RMM_TargetObj *targ
23056 bool RMM_init(void)
23058 - bool retVal = true;
23060 DBC_Require(cRefs >= 0);
23063 DBC_Assert(!RMM_debugMask.flags);
23064 GT_create(&RMM_debugMask, "RM"); /* "RM" for RMm */
23066 - retVal = MEM_Init();
23077 GT_1trace(RMM_debugMask, GT_5CLASS,
23078 "RMM_init(), ref count: 0x%x\n",
23081 - DBC_Ensure((retVal && (cRefs > 0)) || (!retVal && (cRefs >= 0)));
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
23093 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
23095 + * DSP/BIOS Bridge Stream Manager.
23097 * Copyright (C) 2005-2006 Texas Instruments, Inc.
23099 * This package is free software; you can redistribute it and/or modify
23101 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23106 - * ======== strm.c ========
23108 - * DSP/BIOS Bridge Stream Manager.
23110 - * Public Functions:
23111 - * STRM_AllocateBuffer
23116 - * STRM_FreeBuffer
23117 - * STRM_GetEventHandle
23123 - * STRM_PrepareBuffer
23125 - * STRM_RegisterNotify
23127 - * STRM_UnprepareBuffer
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.
23151 /* ----------------------------------- Host OS */
23152 #include <dspbridge/host_os.h>
23155 /* ----------------------------------- This */
23156 #include <dspbridge/strm.h>
23158 -#ifndef RES_CLEANUP_DISABLE
23159 #include <dspbridge/cfg.h>
23160 -#include <dspbridge/dbreg.h>
23161 #include <dspbridge/resourcecleanup.h>
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;
23170 -#ifndef RES_CLEANUP_DISABLE
23175 DBC_Require(cRefs > 0);
23176 DBC_Require(apBuffer != NULL);
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)) {
23183 - * Allocate from segment specified at time of stream open.
23186 - status = DSP_ESIZE;
23188 + * Allocate from segment specified at time of stream open.
23191 + status = DSP_ESIZE;
23194 - if (DSP_FAILED(status)) {
23195 - status = DSP_EHANDLE;
23196 + if (DSP_FAILED(status))
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);
23207 -#ifndef RES_CLEANUP_DISABLE
23208 if (DSP_FAILED(status))
23211 if (DRV_GetSTRMResElement(hStrm, &hSTRMRes, pr_ctxt) !=
23213 - DRV_ProcUpdateSTRMRes(uNumBufs, hSTRMRes, pr_ctxt);
23217 + DRV_ProcUpdateSTRMRes(uNumBufs, hSTRMRes);
23222 @@ -221,48 +168,31 @@ DSP_STATUS STRM_Close(struct STRM_OBJECT
23223 struct CHNL_INFO chnlInfo;
23224 DSP_STATUS status = DSP_SOK;
23226 -#ifndef RES_CLEANUP_DISABLE
23231 DBC_Require(cRefs > 0);
23233 GT_1trace(STRM_debugMask, GT_ENTER, "STRM_Close: hStrm: 0x%x\n", hStrm);
23235 - if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE)) {
23236 - status = DSP_EHANDLE;
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));
23244 - if (chnlInfo.cIOCs > 0 || chnlInfo.cIOReqs > 0) {
23245 - status = DSP_EPENDING;
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));
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;
23261 + status = DeleteStrm(hStrm);
23263 - /* make sure we return a documented result */
23264 - status = DSP_EFAIL;
23268 -#ifndef RES_CLEANUP_DISABLE
23269 if (DSP_FAILED(status))
23272 if (DRV_GetSTRMResElement(hStrm, &hSTRMRes, pr_ctxt) !=
23275 DRV_ProcRemoveSTRMResElement(hSTRMRes, pr_ctxt);
23279 DBC_Ensure(status == DSP_SOK || status == DSP_EHANDLE ||
23280 status == DSP_EPENDING || status == DSP_EFAIL);
23282 @@ -368,37 +298,31 @@ DSP_STATUS STRM_FreeBuffer(struct STRM_O
23283 DSP_STATUS status = DSP_SOK;
23286 -#ifndef RES_CLEANUP_DISABLE
23287 HANDLE hSTRMRes = NULL;
23290 DBC_Require(cRefs > 0);
23291 DBC_Require(apBuffer != NULL);
23293 GT_3trace(STRM_debugMask, GT_ENTER, "STRM_FreeBuffer: hStrm: 0x%x\t"
23294 "apBuffer: 0x%x\tuNumBufs: 0x%x\n", hStrm, apBuffer, uNumBufs);
23296 - if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE))
23297 - status = DSP_EHANDLE;
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");
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");
23319 + apBuffer[i] = NULL;
23321 -#ifndef RES_CLEANUP_DISABLE
23322 - if (DRV_GetSTRMResElement(hStrm, hSTRMRes, pr_ctxt) !=
23324 - DRV_ProcUpdateSTRMRes(uNumBufs-i, hSTRMRes, pr_ctxt);
23326 + if (DSP_SUCCEEDED(status)) {
23327 + if (DRV_GetSTRMResElement(hStrm, hSTRMRes, pr_ctxt) !=
23329 + DRV_ProcUpdateSTRMRes(uNumBufs-i, hSTRMRes);
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;
23342 - if (uStreamInfoSize < sizeof(struct STRM_INFO)) {
23343 - /* size of users info */
23344 - status = DSP_ESIZE;
23347 + if (uStreamInfoSize < sizeof(struct STRM_INFO)) {
23348 + /* size of users info */
23349 + status = DSP_ESIZE;
23352 if (DSP_FAILED(status))
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);
23359 - if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE)) {
23360 - status = DSP_EHANDLE;
23362 - pIntfFxns = hStrm->hStrmMgr->pIntfFxns;
23363 + pIntfFxns = hStrm->hStrmMgr->pIntfFxns;
23365 + status = (*pIntfFxns->pfnChnlIdle) (hStrm->hChnl,
23366 + hStrm->uTimeout, fFlush);
23368 - status = (*pIntfFxns->pfnChnlIdle) (hStrm->hChnl,
23369 - hStrm->uTimeout, fFlush);
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,
23378 - if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE)) {
23379 - status = DSP_EHANDLE;
23381 - pIntfFxns = hStrm->hStrmMgr->pIntfFxns;
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;
23391 - if (DSP_SUCCEEDED(status)) {
23392 - status = (*pIntfFxns->pfnChnlAddIOReq)
23393 - (hStrm->hChnl, pBuf, ulBytes, ulBufSize,
23394 - (u32) pTmpBuf, dwArg);
23396 - if (DSP_FAILED(status)) {
23397 - if (status == CHNL_E_NOIORPS)
23398 - status = DSP_ESTREAMFULL;
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;
23409 + if (DSP_SUCCEEDED(status)) {
23410 + status = (*pIntfFxns->pfnChnlAddIOReq)
23411 + (hStrm->hChnl, pBuf, ulBytes, ulBufSize,
23412 + (u32) pTmpBuf, dwArg);
23414 + if (status == CHNL_E_NOIORPS)
23415 + status = DSP_ESTREAMFULL;
23420 @@ -578,22 +490,20 @@ DSP_STATUS STRM_Issue(struct STRM_OBJECT
23421 * XDAIS socket node on the DSP.
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)
23431 struct STRM_MGR *hStrmMgr;
23432 struct WMD_DRV_INTERFACE *pIntfFxns;
23434 struct STRM_OBJECT *pStrm = NULL;
23437 struct CHNL_ATTRS chnlAttrs;
23438 DSP_STATUS status = DSP_SOK;
23439 struct CMM_OBJECT *hCmmMgr = NULL; /* Shared memory manager hndl */
23441 -#ifndef RES_CLEANUP_DISABLE
23446 DBC_Require(cRefs > 0);
23447 DBC_Require(phStrm != NULL);
23448 @@ -724,14 +634,12 @@ func_cont:
23452 - if (DSP_SUCCEEDED(status))
23453 + if (DSP_SUCCEEDED(status)) {
23456 + DRV_ProcInsertSTRMResElement(*phStrm, &hSTRMRes, pr_ctxt);
23458 (void)DeleteStrm(pStrm);
23460 -#ifndef RES_CLEANUP_DISABLE
23461 - DRV_ProcInsertSTRMResElement(*phStrm, &hSTRMRes, pr_ctxt);
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,
23471 - if (!MEM_IsValidHandle(hStrm, STRM_SIGNATURE)) {
23472 - status = DSP_EHANDLE;
23475 pIntfFxns = hStrm->hStrmMgr->pIntfFxns;
23477 status = (*pIntfFxns->pfnChnlGetIOC)(hStrm->hChnl, hStrm->uTimeout,
23478 @@ -820,7 +724,6 @@ DSP_STATUS STRM_Reclaim(struct STRM_OBJE
23480 *pBufPtr = chnlIOC.pBuf;
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) |
23494 + if ((uEventMask & ~((DSP_STREAMIOCOMPLETION) |
23495 DSP_STREAMDONE)) != 0) {
23496 status = DSP_EVALUE;
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
23503 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
23505 + * Implementation of platform specific config services.
23507 * Copyright (C) 2005-2006 Texas Instruments, Inc.
23509 * This package is free software; you can redistribute it and/or modify
23511 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23516 - * ======== cfgce.c ========
23518 - * Implementation of platform specific config services.
23520 - * Private Functions:
23522 - * CFG_GetAutoStart
23523 - * CFG_GetDevObject
23524 - * CFG_GetDSPResources
23525 - * CFG_GetExecFile
23526 - * CFG_GetHostResources
23529 - * CFG_SetDevObject
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.
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
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.
23572 /* ----------------------------------- DSP/BIOS Bridge */
23573 #include <dspbridge/std.h>
23574 #include <dspbridge/dbdefs.h>
23575 @@ -82,18 +26,13 @@
23576 #include <dspbridge/gt.h>
23578 /* ----------------------------------- OS Adaptation Layer */
23579 -#include <dspbridge/csl.h>
23580 #include <dspbridge/reg.h>
23582 -/* ----------------------------------- Others */
23583 -#include <dspbridge/dbreg.h>
23585 /* ----------------------------------- This */
23586 #include <dspbridge/cfg.h>
23587 -#include <dspbridge/list.h>
23590 - struct LST_ELEM link;
23591 + struct list_head link;
23592 char szString[MAXREGPATHLENGTH];
23595 @@ -131,12 +70,12 @@ DSP_STATUS CFG_GetAutoStart(struct CFG_D
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,
23603 if (DSP_FAILED(status))
23604 status = CFG_E_RESOURCENOTAVAIL;
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)) {
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,
23618 GT_0trace(CFG_debugMask, GT_1CLASS,
23619 "Fetching DSP Device from "
23621 - status = REG_GetValue(NULL, (char *)hDevNode,
23623 - (u8 *)pdwValue, &dwBufSize);
23624 + status = REG_GetValue("DEVICE_DSP", (u8 *)pdwValue,
23627 GT_0trace(CFG_debugMask, GT_6CLASS,
23628 "Failed to Identify the Device to Fetch \n");
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);
23642 status = CFG_E_INVALIDHDEVNODE;
23643 - } else if (!pDSPResTable) {
23644 + else if (!pDSPResTable)
23645 status = CFG_E_INVALIDPOINTER;
23647 - status = REG_GetValue(NULL, CONFIG, DSPRESOURCES,
23648 - (u8 *)pDSPResTable,
23652 + status = REG_GetValue(DSPRESOURCES, (u8 *)pDSPResTable,
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");
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);
23669 status = CFG_E_INVALIDHDEVNODE;
23671 - if (!pstrExecFile)
23672 + else if (!pstrExecFile)
23673 status = CFG_E_INVALIDPOINTER;
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;
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
23693 DBC_Ensure(((status == DSP_SOK) &&
23694 - (strlen(pstrExecFile) <= ulBufSize)) || (status != DSP_SOK));
23695 + (strlen(pstrExecFile) <= ulBufSize)) || (status != DSP_SOK));
23699 @@ -307,13 +241,12 @@ DSP_STATUS CFG_GetHostResources(struct C
23701 if (DSP_SUCCEEDED(status)) {
23702 dwBufSize = sizeof(struct CFG_HOSTRES);
23703 - if (DSP_FAILED(REG_GetValue(NULL, (char *)hDevNode,
23705 - (u8 *)pHostResTable, &dwBufSize))) {
23706 + if (DSP_FAILED(REG_GetValue(CURRENTCONFIG, (u8 *)pHostResTable,
23708 status = CFG_E_RESOURCENOTAVAIL;
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);
23719 case (REG_DRV_OBJECT):
23720 - status = REG_GetValue(NULL, CONFIG, DRVOBJECT,
23723 + status = REG_GetValue(DRVOBJECT, (u8 *)pdwValue, &dwBufSize);
23724 + if (DSP_FAILED(status))
23725 + status = CFG_E_RESOURCENOTAVAIL;
23727 case (REG_MGR_OBJECT):
23728 - status = REG_GetValue(NULL, CONFIG, MGROBJECT,
23731 + status = REG_GetValue(MGROBJECT, (u8 *)pdwValue, &dwBufSize);
23732 + if (DSP_FAILED(status))
23733 + status = CFG_E_RESOURCENOTAVAIL;
23737 @@ -358,7 +291,6 @@ DSP_STATUS CFG_GetObject(OUT u32 *pdwVal
23738 "CFG_GetObject SUCCESS DrvObject: "
23739 "0x%x\n ", *pdwValue);
23741 - status = CFG_E_RESOURCENOTAVAIL;
23743 GT_0trace(CFG_debugMask, GT_6CLASS, "CFG_GetObject Failed \n");
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 "
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 */
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,
23774 + status = REG_SetValue("DEVICE_DSP", (u8 *)&dwValue,
23777 GT_0trace(CFG_debugMask, GT_6CLASS,
23778 "Failed to Register Device \n");
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);
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);
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);
23803 +#ifdef CONFIG_BRIDGE_DEBUG
23804 if (DSP_SUCCEEDED(status))
23805 GT_0trace(CFG_debugMask, GT_1CLASS, "CFG_SetObject SUCCESS \n");
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
23812 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
23814 + * Clock and Timer services.
23816 * Copyright (C) 2005-2006 Texas Instruments, Inc.
23818 * This package is free software; you can redistribute it and/or modify
23820 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23824 - * ======== clk.c ========
23826 - * Clock and Timer services.
23828 - * Public Functions:
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.
23841 /* ----------------------------------- Host OS */
23842 #include <dspbridge/host_os.h>
23844 @@ -45,22 +29,22 @@
23845 #include <dspbridge/gt.h>
23847 /* ----------------------------------- OS Adaptation Layer */
23848 -#include <dspbridge/csl.h>
23849 #include <dspbridge/mem.h>
23851 /* ----------------------------------- This */
23852 #include <dspbridge/clk.h>
23853 -#include <dspbridge/util.h>
23856 /* ----------------------------------- Defines, Data Structures, Typedefs */
23858 typedef volatile unsigned long REG_UWORD32;
23860 -#define SSI_Base 0x48058000
23862 -#define SSI_BASE IO_ADDRESS(SSI_Base)
23864 +#define OMAP_SSI_OFFSET 0x58000
23865 +#define OMAP_SSI_SIZE 0x1000
23866 +#define OMAP_SSI_SYSCONFIG_OFFSET 0x10
23868 +#define SSI_AUTOIDLE (1 << 0)
23869 +#define SSI_SIDLE_SMARTIDLE (2 << 3)
23870 +#define SSI_MIDLE_NOIDLE (1 << 12)
23872 struct SERVICES_Clk_t {
23873 struct clk *clk_handle;
23874 @@ -194,9 +178,7 @@ DSP_STATUS CLK_Enable(IN enum SERVICES_C
23876 pClk = SERVICES_Clks[clk_id].clk_handle;
23878 - if (clk_enable(pClk) == 0x0) {
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;
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;
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;
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;
23910 - useCount = pClk->usecount; /* FIXME: usecount shouldn't be used */
23911 + /* FIXME: usecount shouldn't be used */
23912 + useCount = pClk->usecount;
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
23918 void SSI_Clk_Prepare(bool FLAG)
23920 - u32 ssi_sysconfig;
23921 - ssi_sysconfig = __raw_readl((SSI_BASE) + 0x10);
23922 + void __iomem *ssi_base;
23923 + unsigned int value;
23925 + ssi_base = ioremap(L4_34XX_BASE + OMAP_SSI_OFFSET, OMAP_SSI_SIZE);
23927 + pr_err("%s: error, SSI not configured\n", __func__);
23932 /* Set Autoidle, SIDLEMode to smart idle, and MIDLEmode to
23935 - ssi_sysconfig = 0x1011;
23936 + value = SSI_AUTOIDLE | SSI_SIDLE_SMARTIDLE | SSI_MIDLE_NOIDLE;
23938 /* Set Autoidle, SIDLEMode to forced idle, and MIDLEmode to
23941 - ssi_sysconfig = 0x1;
23942 + value = SSI_AUTOIDLE;
23944 - __raw_writel((u32)ssi_sysconfig, SSI_BASE + 0x10);
23946 + __raw_writel(value, ssi_base + OMAP_SSI_SYSCONFIG_OFFSET);
23947 + iounmap(ssi_base);
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
23956 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
23958 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
23971 - * ======== cslce.c ========
23973 - * Provides platform independent C Standard library functions.
23975 - * Public Functions:
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.
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
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.
24005 -/* ----------------------------------- Host OS */
24006 -#include <dspbridge/host_os.h>
24008 -/* ----------------------------------- DSP/BIOS Bridge */
24009 -#include <dspbridge/std.h>
24010 -#include <dspbridge/dbdefs.h>
24012 -/* ----------------------------------- Trace & Debug */
24013 -#include <dspbridge/dbc.h>
24014 -#include <dspbridge/gt.h>
24016 -/* ----------------------------------- This */
24017 -#include <dspbridge/csl.h>
24019 -/* Is character c in the string pstrDelim? */
24020 -#define IsDelimiter(c, pstrDelim) ((c != '\0') && \
24021 - (strchr(pstrDelim, c) != NULL))
24023 -/* ----------------------------------- Globals */
24025 -static struct GT_Mask CSL_DebugMask = { NULL, NULL }; /* GT trace var. */
24029 - * ======== CSL_Exit ========
24031 - * Discontinue usage of the CSL module.
24033 -void CSL_Exit(void)
24035 - GT_0trace(CSL_DebugMask, GT_5CLASS, "CSL_Exit\n");
24039 - * ======== CSL_Init ========
24041 - * Initialize the CSL module's private state.
24043 -bool CSL_Init(void)
24045 - GT_create(&CSL_DebugMask, "CS");
24047 - GT_0trace(CSL_DebugMask, GT_5CLASS, "CSL_Init\n");
24053 - * ======== CSL_NumToAscii ========
24055 - * Convert a 1 or 2 digit number to a 2 digit string.
24057 -void CSL_NumToAscii(OUT char *pstrNumber, u32 dwNum)
24061 - DBC_Require(dwNum < 100);
24063 - if (dwNum < 100) {
24064 - tens = (char) dwNum / 10;
24065 - dwNum = dwNum % 10;
24068 - pstrNumber[0] = tens + '0';
24069 - pstrNumber[1] = (char) dwNum + '0';
24070 - pstrNumber[2] = '\0';
24072 - pstrNumber[0] = (char) dwNum + '0';
24073 - pstrNumber[1] = '\0';
24076 - pstrNumber[0] = '\0';
24084 - * ======= CSL_Strtokr =======
24086 - * Re-entrant version of strtok.
24088 -char *CSL_Strtokr(IN char *pstrSrc, IN CONST char *szSeparators,
24089 - OUT char **ppstrLast)
24094 - DBC_Require(szSeparators != NULL);
24095 - DBC_Require(ppstrLast != NULL);
24096 - DBC_Require(pstrSrc != NULL || *ppstrLast != NULL);
24099 - * Set string location to beginning (pstrSrc != NULL) or to the
24100 - * beginning of the next token.
24102 - pstrTemp = (pstrSrc != NULL) ? pstrSrc : *ppstrLast;
24103 - if (*pstrTemp == '\0') {
24104 - pstrToken = NULL;
24106 - pstrToken = pstrTemp;
24107 - while (*pstrTemp != '\0' && !IsDelimiter(*pstrTemp,
24111 - if (*pstrTemp != '\0') {
24112 - while (IsDelimiter(*pstrTemp, szSeparators)) {
24113 - /* TODO: Shouldn't we do this for
24114 - * only 1 char?? */
24115 - *pstrTemp = '\0';
24120 - /* Location in string for next call */
24121 - *ppstrLast = pstrTemp;
24124 - return pstrToken;
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
24131 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
24133 + * Provide debugging services for DSP/BIOS Bridge Mini Driver.
24135 * Copyright (C) 2005-2006 Texas Instruments, Inc.
24137 * This package is free software; you can redistribute it and/or modify
24139 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24144 - * ======== dbgce.c ========
24146 - * Provide debugging services for DSP/BIOS Bridge Mini Drivers.
24148 - * Public Functions:
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.
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.
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.
24173 /* ----------------------------------- DSP/BIOS Bridge */
24174 #include <dspbridge/std.h>
24175 #include <dspbridge/dbdefs.h>
24177 static struct GT_Mask DBG_debugMask = { NULL, NULL }; /* GT trace var. */
24180 -#if (defined(DEBUG) || defined (DDSP_DEBUG_PRODUCT)) && GT_TRACE
24181 +#if (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
24184 * ======== DBG_Init ========
24185 @@ -116,4 +87,4 @@ void DBG_Exit(void)
24186 GT_0trace(DBG_debugMask, GT_5CLASS, "DBG_Exit\n");
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
24198 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
24200 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
24213 - * ======== dpcce.c ========
24215 - * Deferred Procedure Call(DPC) Services.
24218 - * Public Functions:
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.
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.
24241 -/* ----------------------------------- Host OS */
24242 -#include <dspbridge/host_os.h>
24244 -/* ----------------------------------- DSP/BIOS Bridge */
24245 -#include <dspbridge/std.h>
24246 -#include <dspbridge/dbdefs.h>
24247 -#include <dspbridge/errbase.h>
24249 -/* ----------------------------------- Trace & Debug */
24250 -#include <dspbridge/dbc.h>
24251 -#include <dspbridge/gt.h>
24253 -/* ----------------------------------- OS Adaptation Layer */
24254 -#include <dspbridge/mem.h>
24256 -/* ----------------------------------- This */
24257 -#include <dspbridge/dpc.h>
24259 -/* ----------------------------------- Defines, Data Structures, Typedefs */
24260 -#define SIGNATURE 0x5f435044 /* "DPC_" (in reverse). */
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;
24272 - u32 cEntryCount; /* Number of times DPC reentered. */
24273 - u32 numRequestedMax; /* Keep track of max pending DPC's. */
24276 - spinlock_t dpc_lock;
24279 -/* ----------------------------------- Globals */
24281 -static struct GT_Mask DPC_DebugMask = { NULL, NULL }; /* DPC Debug Mask */
24284 -/* ----------------------------------- Function Prototypes */
24285 -static void DPC_DeferredProcedure(IN unsigned long pDeferredContext);
24288 - * ======== DPC_Create ========
24290 - * Create a DPC object, allowing a client's own DPC procedure to be
24291 - * scheduled for a call with client reference data.
24293 -DSP_STATUS DPC_Create(OUT struct DPC_OBJECT **phDPC, DPC_PROC pfnDPC,
24296 - DSP_STATUS status = DSP_SOK;
24297 - struct DPC_OBJECT *pDPCObject = NULL;
24299 - if ((phDPC != NULL) && (pfnDPC != NULL)) {
24301 - * Allocate a DPC object to store information allowing our DPC
24302 - * callback to dispatch to the client's DPC.
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;
24315 - pDPCObject->numRequestedMax = 0;
24316 - pDPCObject->cEntryCount = 0;
24318 - spin_lock_init(&pDPCObject->dpc_lock);
24319 - *phDPC = pDPCObject;
24321 - GT_0trace(DPC_DebugMask, GT_6CLASS,
24322 - "DPC_Create: DSP_EMEMORY\n");
24323 - status = DSP_EMEMORY;
24326 - GT_0trace(DPC_DebugMask, GT_6CLASS,
24327 - "DPC_Create: DSP_EPOINTER\n");
24328 - status = DSP_EPOINTER;
24330 - DBC_Ensure((DSP_FAILED(status) && (!phDPC || (phDPC && *phDPC == NULL)))
24331 - || DSP_SUCCEEDED(status));
24336 - * ======== DPC_Destroy ========
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.
24342 -DSP_STATUS DPC_Destroy(struct DPC_OBJECT *hDPC)
24344 - DSP_STATUS status = DSP_SOK;
24345 - struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)hDPC;
24347 - if (MEM_IsValidHandle(hDPC, SIGNATURE)) {
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");
24358 - GT_0trace(DPC_DebugMask, GT_6CLASS,
24359 - "DPC_Destroy: DSP_EHANDLE\n");
24360 - status = DSP_EHANDLE;
24362 - DBC_Ensure((DSP_SUCCEEDED(status) && pDPCObject == NULL)
24363 - || DSP_FAILED(status));
24368 - * ======== DPC_Exit ========
24370 - * Discontinue usage of the DPC module.
24372 -void DPC_Exit(void)
24374 - GT_0trace(DPC_DebugMask, GT_5CLASS, "Entered DPC_Exit\n");
24378 - * ======== DPC_Init ========
24380 - * Initialize the DPC module's private state.
24382 -bool DPC_Init(void)
24384 - GT_create(&DPC_DebugMask, "DP");
24386 - GT_0trace(DPC_DebugMask, GT_5CLASS, "Entered DPC_Init\n");
24392 - * ======== DPC_Schedule ========
24394 - * Schedule a deferred procedure call to be executed at a later time.
24395 - * Latency and order of DPC execution is platform specific.
24397 -DSP_STATUS DPC_Schedule(struct DPC_OBJECT *hDPC)
24399 - DSP_STATUS status = DSP_SOK;
24400 - struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)hDPC;
24401 - unsigned long flags;
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));
24413 - if (pDPCObject->numRequested > pDPCObject->numScheduled +
24414 - pDPCObject->numRequestedMax) {
24415 - pDPCObject->numRequestedMax = pDPCObject->numRequested -
24416 - pDPCObject->numScheduled;
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 */
24425 - GT_0trace(DPC_DebugMask, GT_6CLASS,
24426 - "DPC_Schedule: DSP_EHANDLE\n");
24427 - status = DSP_EHANDLE;
24429 - GT_1trace(DPC_DebugMask, GT_ENTER, "DPC_Schedule status %x\n", status);
24434 - * ======== DeferredProcedure ========
24436 - * Main DPC routine. This is called by host OS DPC callback
24437 - * mechanism with interrupts enabled.
24439 -static void DPC_DeferredProcedure(IN unsigned long pDeferredContext)
24441 - struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)pDeferredContext;
24442 - /* read numRequested in local variable */
24446 - DBC_Require(pDPCObject != NULL);
24447 - requested = pDPCObject->numRequested;
24448 - serviced = pDPCObject->numScheduled;
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: */
24457 - /* Call client's DPC: */
24458 - (*(pDPCObject->pfnDPC))(pDPCObject->pRefData);
24460 - } while (serviced != requested);
24462 - pDPCObject->numScheduled = requested;
24464 - GT_2trace(DPC_DebugMask, GT_ENTER,
24465 - "< DPC_DeferredProcedure requested %d"
24466 - " serviced %d\n", requested, serviced);
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
24476 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
24478 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
24491 - * ======== kfilece.c ========
24493 - * This module provides file i/o services.
24495 - * Public Functions:
24504 - *! Revision History
24505 - *! ================
24506 - *! 03-Feb-2000 rr: Module init/exit is handled by SERVICES Init/Exit.
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.
24516 -/* ----------------------------------- Host OS */
24517 -#include <dspbridge/host_os.h>
24519 -/* ----------------------------------- DSP/BIOS Bridge */
24520 -#include <dspbridge/std.h>
24521 -#include <dspbridge/dbdefs.h>
24522 -#include <dspbridge/errbase.h>
24524 -/* ----------------------------------- Trace & Debug */
24525 -#include <dspbridge/dbc.h>
24526 -#include <dspbridge/gt.h>
24528 -/* ----------------------------------- OS Adaptation Layer */
24529 -#include <dspbridge/csl.h>
24530 -#include <dspbridge/mem.h>
24532 -/* ----------------------------------- This */
24533 -#include <dspbridge/kfile.h>
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 */
24540 -/* The KFILE_FileObj abstracts the true file handle from a KFILE handle. */
24541 -struct KFILE_FileObj {
24543 - __kernel_pid_t owner_pid; /* PID of process that opened this file */
24548 - long hInternal; /* internal handle of file */
24549 - struct file *fileDesc;
24553 -/* ----------------------------------- Globals */
24555 -static struct GT_Mask KFILE_debugMask = { NULL, NULL }; /* Debug mask */
24559 - * ======== KFILE_Close ========
24561 - * This function closes a file's stream.
24563 -s32 KFILE_Close(struct KFILE_FileObj *hFile)
24565 - s32 cRetVal = 0; /* 0 indicates success */
24568 - GT_1trace(KFILE_debugMask, GT_ENTER, "KFILE_Close: hFile 0x%x\n",
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) ;
24577 - cRetVal = E_KFILE_ERROR;
24578 - GT_1trace(KFILE_debugMask, GT_6CLASS,
24579 - "KFILE_Close: sys_close "
24580 - "returned %d\n", fRetVal);
24582 - MEM_FreeObject(hFile);
24584 - cRetVal = E_KFILE_INVALIDHANDLE;
24585 - GT_0trace(KFILE_debugMask, GT_6CLASS, "KFILE_Close: "
24586 - "invalid file handle\n");
24592 - * ======== KFILE_Exit ========
24594 - * Decrement reference count, and free resources when reference count
24597 -void KFILE_Exit(void)
24599 - GT_0trace(KFILE_debugMask, GT_5CLASS, "KFILE_Exit\n");
24603 - * ======== KFILE_Init ========
24605 -bool KFILE_Init(void)
24607 - GT_create(&KFILE_debugMask, "KF"); /* "KF" for KFile */
24609 - GT_0trace(KFILE_debugMask, GT_5CLASS, "KFILE_Init\n");
24615 - * ======== KFILE_Open ========
24617 - * Open a file for reading ONLY
24619 -struct KFILE_FileObj *KFILE_Open(CONST char *pszFileName, CONST char *pszMode)
24621 - struct KFILE_FileObj *hFile; /* file handle */
24622 - DSP_STATUS status;
24625 - struct file*fileDesc = NULL;
24626 - DBC_Require(pszMode != NULL);
24627 - DBC_Require(pszFileName != NULL);
24629 - GT_2trace(KFILE_debugMask, GT_ENTER,
24630 - "KFILE_Open: pszFileName %s, pszMode "
24631 - "%s\n", pszFileName, pszMode);
24633 - /* create a KFILE object */
24634 - MEM_AllocObject(hFile, struct KFILE_FileObj, SIGNATURE);
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;
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,
24652 - fileDesc->f_op->llseek(fileDesc, 0, SEEK_SET);
24653 - /* Return TGID instead of process handle */
24654 - hFile->owner_pid = current->tgid;
24656 - status = DSP_SOK;
24659 - if (DSP_FAILED(status)) {
24660 - /* free memory, and clear handle */
24661 - MEM_FreeObject(hFile);
24665 - GT_0trace(KFILE_debugMask, GT_6CLASS,
24666 - "KFILE_Open: MEM_AllocObject failed\n");
24667 - status = DSP_EMEMORY;
24673 - * ======== KFILE_Read ========
24675 - * Reads a specified number of bytes into a buffer.
24678 -KFILE_Read(void __user*pBuffer, s32 cSize, s32 cCount,
24679 - struct KFILE_FileObj *hFile)
24681 - u32 dwBytesRead = 0;
24685 - DBC_Require(pBuffer != NULL);
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);
24691 - /* check for valid file handle */
24692 - if (MEM_IsValidHandle(hFile, SIGNATURE)) {
24693 - if ((cSize > 0) && (cCount > 0) && pBuffer) {
24694 - /* read from file */
24696 - set_fs(get_ds());
24697 - dwBytesRead = hFile->fileDesc->f_op->read(hFile->
24698 - fileDesc, pBuffer, cSize *cCount,
24699 - &(hFile->fileDesc->f_pos));
24701 - if (dwBytesRead) {
24702 - cRetVal = dwBytesRead / cSize;
24703 - hFile->curPos += dwBytesRead;
24704 - DBC_Assert((dwBytesRead / cSize) <= \
24707 - cRetVal = E_KFILE_ERROR;
24708 - GT_0trace(KFILE_debugMask, GT_6CLASS,
24709 - "KFILE_Read: sys_read() failed\n");
24712 - cRetVal = DSP_EINVALIDARG;
24713 - GT_0trace(KFILE_debugMask, GT_6CLASS,
24714 - "KFILE_Read: Invalid argument(s)\n");
24717 - cRetVal = E_KFILE_INVALIDHANDLE;
24718 - GT_0trace(KFILE_debugMask, GT_6CLASS,
24719 - "KFILE_Read: invalid file handle\n");
24726 - * ======== KFILE_Seek ========
24728 - * Sets the file position indicator. NOTE: we don't support seeking
24729 - * beyond the boundaries of a file.
24731 -s32 KFILE_Seek(struct KFILE_FileObj *hFile, s32 lOffset, s32 cOrigin)
24733 - s32 cRetVal = 0; /* 0 for success */
24734 - loff_t dwCurPos = 0;
24736 - struct file *fileDesc = NULL;
24738 - GT_3trace(KFILE_debugMask, GT_ENTER, "KFILE_Seek: hFile 0x%x, "
24739 - "lOffset 0x%x, cOrigin 0x%x\n",
24740 - hFile, lOffset, cOrigin);
24742 - /* check for valid file handle */
24743 - if (MEM_IsValidHandle(hFile, SIGNATURE)) {
24744 - /* based on the origin flag, move the internal pointer */
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);
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);
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);
24765 - cRetVal = E_KFILE_BADORIGINFLAG;
24766 - GT_0trace(KFILE_debugMask, GT_6CLASS,
24767 - "KFILE_Seek:bad origin flag\n");
24771 - cRetVal = E_KFILE_INVALIDHANDLE;
24772 - GT_0trace(KFILE_debugMask, GT_6CLASS,
24773 - "KFILE_Seek:invalid file handle\n");
24779 - * ======== KFILE_Tell ========
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).
24785 -s32 KFILE_Tell(struct KFILE_FileObj *hFile)
24787 - loff_t dwCurPos = 0;
24788 - s32 lRetVal = E_KFILE_ERROR;
24790 - GT_1trace(KFILE_debugMask, GT_ENTER, "KFILE_Tell: hFile 0x%x\n", hFile);
24792 - if (MEM_IsValidHandle(hFile, SIGNATURE)) {
24794 - /* Get current position. */
24795 - dwCurPos = hFile->fileDesc->f_op->llseek(hFile->fileDesc, 0,
24797 - if (dwCurPos >= 0)
24798 - lRetVal = dwCurPos;
24801 - lRetVal = E_KFILE_INVALIDHANDLE;
24802 - GT_0trace(KFILE_debugMask, GT_6CLASS,
24803 - "KFILE_Seek:invalid file handle\n");
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
24815 - * DSP-BIOS Bridge driver support functions for TI OMAP processors.
24817 - * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
24830 - * ======== listce.c ========
24832 - * Provides standard circular list handling functions.
24834 - * Public Functions:
24842 - * LST_InsertBefore
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.
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.
24861 -/* ----------------------------------- DSP/BIOS Bridge */
24862 -#include <dspbridge/std.h>
24863 -#include <dspbridge/dbdefs.h>
24865 -/* ----------------------------------- Trace & Debug */
24866 -#include <dspbridge/dbc.h>
24867 -#include <dspbridge/gt.h>
24869 -/* ----------------------------------- OS Adaptation Layer */
24870 -#include <dspbridge/mem.h>
24872 -/* ----------------------------------- This */
24873 -#include <dspbridge/list.h>
24875 -/* ----------------------------------- Globals */
24877 -static struct GT_Mask LST_debugMask = { NULL, NULL }; /* GT trace var. */
24881 - * ======== LST_Create ========
24883 - * Allocates and initializes a circular list.
24885 -struct LST_LIST *LST_Create(void)
24887 - struct LST_LIST *pList;
24889 - GT_0trace(LST_debugMask, GT_ENTER, "LST_Create: entered\n");
24891 - pList = (struct LST_LIST *) MEM_Calloc(sizeof(struct LST_LIST),
24893 - if (pList != NULL) {
24894 - pList->head.next = &pList->head;
24895 - pList->head.prev = &pList->head;
24896 - pList->head.self = NULL;
24903 - * ======== LST_Delete ========
24905 - * Removes a list by freeing its control structure's memory space.
24907 -void LST_Delete(struct LST_LIST *pList)
24909 - DBC_Require(pList != NULL);
24911 - GT_1trace(LST_debugMask, GT_ENTER, "LST_Delete: pList 0x%x\n", pList);
24917 - * ======== LST_Exit ========
24919 - * Discontinue usage of the LST module.
24921 -void LST_Exit(void)
24923 - GT_0trace(LST_debugMask, GT_5CLASS, "LST_Exit\n");
24927 - * ======== LST_First ========
24929 - * Returns a pointer to the first element of the list, or NULL if the
24932 -struct LST_ELEM *LST_First(struct LST_LIST *pList)
24934 - struct LST_ELEM *pElem = NULL;
24936 - DBC_Require(pList != NULL);
24938 - GT_1trace(LST_debugMask, GT_ENTER, "LST_First: pList 0x%x\n", pList);
24940 - if (!LST_IsEmpty(pList))
24941 - pElem = pList->head.next;
24947 - * ======== LST_GetHead ========
24949 - * "Pops" the head off the list and returns a pointer to it.
24951 -struct LST_ELEM *LST_GetHead(struct LST_LIST *pList)
24953 - struct LST_ELEM *pElem;
24955 - DBC_Require(pList != NULL);
24957 - GT_1trace(LST_debugMask, GT_ENTER, "LST_GetHead: pList 0x%x\n", pList);
24959 - if (LST_IsEmpty(pList))
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;
24968 - return pElem->self;
24972 - * ======== LST_Init ========
24974 - * Initialize LST module private state.
24976 -bool LST_Init(void)
24978 - GT_create(&LST_debugMask, "LS"); /* LS for LSt module */
24980 - GT_0trace(LST_debugMask, GT_5CLASS, "LST_Init\n");
24986 - * ======== LST_InitElem ========
24988 - * Initializes a list element to default (cleared) values
24990 -void LST_InitElem(struct LST_ELEM *pElem)
24992 - DBC_Require(pElem != NULL);
24994 - GT_1trace(LST_debugMask, GT_ENTER, "LST_InitElem: pElem 0x%x\n", pElem);
24997 - pElem->next = NULL;
24998 - pElem->prev = NULL;
24999 - pElem->self = pElem;
25004 - * ======== LST_InsertBefore ========
25006 - * Insert the element before the existing element.
25008 -void LST_InsertBefore(struct LST_LIST *pList, struct LST_ELEM *pElem,
25009 - struct LST_ELEM *pElemExisting)
25011 - DBC_Require(pList != NULL);
25012 - DBC_Require(pElem != NULL);
25013 - DBC_Require(pElemExisting != NULL);
25015 - GT_3trace(LST_debugMask, GT_ENTER, "LST_InsertBefore: pList 0x%x, "
25016 - "pElem 0x%x pElemExisting 0x%x\n", pList, pElem,
25019 - pElemExisting->prev->next = pElem;
25020 - pElem->prev = pElemExisting->prev;
25021 - pElem->next = pElemExisting;
25022 - pElemExisting->prev = pElem;
25026 - * ======== LST_Next ========
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.
25031 -struct LST_ELEM *LST_Next(struct LST_LIST *pList, struct LST_ELEM *pCurElem)
25033 - struct LST_ELEM *pNextElem = NULL;
25035 - DBC_Require(pList != NULL);
25036 - DBC_Require(pCurElem != NULL);
25038 - GT_2trace(LST_debugMask, GT_ENTER,
25039 - "LST_Next: pList 0x%x, pCurElem 0x%x\n",
25040 - pList, pCurElem);
25042 - if (!LST_IsEmpty(pList)) {
25043 - if (pCurElem->next != &pList->head)
25044 - pNextElem = pCurElem->next;
25047 - return pNextElem;
25051 - * ======== LST_PutTail ========
25053 - * Adds the specified element to the tail of the list
25055 -void LST_PutTail(struct LST_LIST *pList, struct LST_ELEM *pElem)
25057 - DBC_Require(pList != NULL);
25058 - DBC_Require(pElem != NULL);
25060 - GT_2trace(LST_debugMask, GT_ENTER,
25061 - "LST_PutTail: pList 0x%x, pElem 0x%x\n",
25064 - pElem->prev = pList->head.prev;
25065 - pElem->next = &pList->head;
25066 - pList->head.prev = pElem;
25067 - pElem->prev->next = pElem;
25069 - DBC_Ensure(!LST_IsEmpty(pList));
25073 - * ======== LST_RemoveElem ========
25075 - * Removes (unlinks) the given element from the list, if the list is not
25076 - * empty. Does not free the list element.
25078 -void LST_RemoveElem(struct LST_LIST *pList, struct LST_ELEM *pCurElem)
25080 - DBC_Require(pList != NULL);
25081 - DBC_Require(pCurElem != NULL);
25083 - GT_2trace(LST_debugMask, GT_ENTER,
25084 - "LST_RemoveElem: pList 0x%x, pCurElem "
25085 - "0x%x\n", pList, pCurElem);
25087 - if (!LST_IsEmpty(pList)) {
25088 - pCurElem->prev->next = pCurElem->next;
25089 - pCurElem->next->prev = pCurElem->prev;
25091 - /* set elem fields to NULL to prevent illegal references */
25092 - pCurElem->next = NULL;
25093 - pCurElem->prev = NULL;
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
25102 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
25104 + * Implementation of platform specific memory services.
25106 * Copyright (C) 2005-2006 Texas Instruments, Inc.
25108 * This package is free software; you can redistribute it and/or modify
25110 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25115 - * ======== mem.c ========
25117 - * Implementation of platform specific memory services.
25119 - * Public Functions:
25121 - * MEM_AllocPhysMem
25126 - * MEM_FreePhysMem
25128 - * MEM_ExtPhysPoolInit
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.
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.
25150 /* ----------------------------------- Host OS */
25151 #include <dspbridge/host_os.h>
25154 #define MEM_512MB 0x1fffffff
25155 #define memInfoSign 0x464E494D /* "MINF" (in reverse). */
25158 +#ifdef CONFIG_BRIDGE_DEBUG
25159 #define MEM_CHECK /* Use to detect source of memory leaks */
25163 static struct GT_Mask MEM_debugMask = { NULL, NULL }; /* GT trace variable */
25166 -static u32 cRefs; /* module reference count */
25168 static bool extPhysMemPoolEnabled;
25170 struct extPhysMemPool {
25171 @@ -95,7 +58,7 @@ static struct extPhysMemPool extMemPool;
25173 /* Information about each element allocated on heap */
25175 - struct LST_ELEM link; /* Must be first */
25176 + struct list_head link; /* Must be first */
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
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)
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;
25194 static inline void MLST_RemoveElem(struct LST_LIST *pList,
25195 - struct LST_ELEM *pCurElem)
25196 + struct list_head *pCurElem)
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)
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;
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);
25219 GT_1trace(MEM_debugMask, GT_7CLASS,
25220 @@ -199,7 +161,7 @@ void MEM_ExtPhysPoolInit(u32 poolPhysBas
25224 -static void MEM_ExtPhysPoolRelease(void)
25225 +void MEM_ExtPhysPoolRelease(void)
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
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);
25237 pMem = (void *)((u32)pMem +
25238 @@ -313,7 +275,7 @@ void *MEM_Alloc(u32 cBytes, enum MEM_POO
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);
25246 pMem = (void *)((u32)pMem +
25247 @@ -343,8 +305,6 @@ void *MEM_AllocPhysMem(u32 cBytes, u32 u
25248 void *pVaMem = NULL;
25251 - DBC_Require(cRefs > 0);
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 *)
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
25278 void MEM_Exit(void)
25280 - DBC_Require(cRefs > 0);
25282 - GT_1trace(MEM_debugMask, GT_5CLASS, "MEM_Exit: cRefs 0x%x\n", cRefs);
25291 - MEM_ExtPhysPoolRelease();
25292 - DBC_Ensure(cRefs >= 0);
25296 @@ -471,7 +422,8 @@ void MEM_Exit(void)
25298 void MEM_FlushCache(void *pMemBuf, u32 cBytes, s32 FlushType)
25300 - DBC_Require(cRefs > 0);
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 +
25311 - GT_1trace(MEM_debugMask, GT_6CLASS, "MEM_FlushCache: invalid "
25312 - "FlushMemType 0x%x\n", FlushType);
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;
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;
25335 @@ -586,7 +534,6 @@ void MEM_Free(IN void *pMemBuf)
25336 void MEM_FreePhysMem(void *pVirtualAddress, u32 pPhysicalAddress,
25339 - DBC_Require(cRefs > 0);
25340 DBC_Require(pVirtualAddress != NULL);
25342 GT_1trace(MEM_debugMask, GT_ENTER, "MEM_FreePhysMem: pVirtualAddress "
25343 @@ -604,25 +551,13 @@ void MEM_FreePhysMem(void *pVirtualAddre
25345 bool MEM_Init(void)
25347 - DBC_Require(cRefs >= 0);
25349 - if (cRefs == 0) {
25350 - GT_create(&MEM_debugMask, "MM"); /* MM for MeM module */
25351 + GT_create(&MEM_debugMask, "MM"); /* MM for MeM module */
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);
25367 - GT_1trace(MEM_debugMask, GT_5CLASS, "MEM_Init: cRefs 0x%x\n", cRefs);
25369 - DBC_Ensure(cRefs > 0);
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
25378 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
25380 + * Manage lists of notification events.
25382 * Copyright (C) 2005-2006 Texas Instruments, Inc.
25384 * This package is free software; you can redistribute it and/or modify
25386 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25391 - * ======== ntfyce.c ========
25393 - * Manage lists of notification events.
25395 - * Public Functions:
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.
25414 /* ----------------------------------- Host OS */
25415 #include <dspbridge/host_os.h>
25418 #include <dspbridge/gt.h>
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.
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 */
25434 @@ -117,12 +93,14 @@ DSP_STATUS NTFY_Create(struct NTFY_OBJEC
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),
25441 if (pNtfy->notifyList == NULL) {
25442 (void) SYNC_DeleteCS(pNtfy->hSync);
25443 MEM_FreeObject(pNtfy);
25444 status = DSP_EMEMORY;
25446 + INIT_LIST_HEAD(&pNtfy->notifyList->head);
25450 @@ -155,7 +133,7 @@ void NTFY_Delete(struct NTFY_OBJECT *hNt
25451 DeleteNotify(pNotify);
25453 DBC_Assert(LST_IsEmpty(hNtfy->notifyList));
25454 - LST_Delete(hNtfy->notifyList);
25455 + MEM_Free(hNtfy->notifyList);
25458 (void)SYNC_DeleteCS(hNtfy->hSync);
25459 @@ -216,7 +194,7 @@ void NTFY_Notify(struct NTFY_OBJECT *hNt
25462 pNotify = (struct NOTIFICATION *)LST_Next(hNtfy->notifyList,
25463 - (struct LST_ELEM *)pNotify);
25464 + (struct list_head *)pNotify);
25467 (void) SYNC_LeaveCS(hNtfy->hSync);
25468 @@ -265,7 +243,7 @@ DSP_STATUS NTFY_Register(struct NTFY_OBJ
25471 pNotify = (struct NOTIFICATION *)LST_Next(hNtfy->notifyList,
25472 - (struct LST_ELEM *)pNotify);
25473 + (struct list_head *)pNotify);
25475 if (pNotify == NULL) {
25476 /* Not registered */
25477 @@ -280,7 +258,7 @@ DSP_STATUS NTFY_Register(struct NTFY_OBJ
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);
25493 DeleteNotify(pNotify);
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);
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
25509 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
25511 + * Provide registry functions.
25513 * Copyright (C) 2005-2006 Texas Instruments, Inc.
25515 * This package is free software; you can redistribute it and/or modify
25517 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25522 - * ======== regce.c ========
25524 - * Provide registry functions.
25526 - * Public Functions:
25527 - * REG_DeleteValue
25534 - *! Revision History:
25535 - *! ================
25539 /* ----------------------------------- Host OS */
25540 #include <dspbridge/host_os.h>
25543 #include <dspbridge/gt.h>
25545 /* ----------------------------------- OS Adaptation Layer */
25546 -#include <dspbridge/csl.h>
25547 #include <dspbridge/mem.h>
25549 -/* ----------------------------------- Others */
25550 -#include <dspbridge/dbreg.h>
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.
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)
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);
25570 GT_0trace(REG_debugMask, GT_ENTER, "REG_DeleteValue: entered\n");
25572 - /* Note that we don't use phKey */
25573 - if (regsupDeleteValue(pstrSubkey, pstrValue) == DSP_SOK)
25574 - status = DSP_SOK;
25576 - status = DSP_EFAIL;
25577 + status = regsupDeleteValue(pstrValue);
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.
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 &&
25593 DBC_Require(*pdwValueSize <= REG_MAXREGPATHLENGTH);
25594 - DBC_Require(phKey == NULL);
25595 DBC_Require(strlen(pstrKey) < REG_MAXREGPATHLENGTH);
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.
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)
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);
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.
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)
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);
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;
25640 - status = DSP_EFAIL;
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.
25646 + status = regsupSetValue((char *)pstrValue, pbData, dwDataSize);
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
25655 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
25657 + * Provide registry support functions.
25659 * Copyright (C) 2005-2006 Texas Instruments, Inc.
25661 * This package is free software; you can redistribute it and/or modify
25663 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25668 - * ======== regsup.c ========
25670 - * Provide registry support functions.
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
25680 /* ----------------------------------- Host OS */
25681 #include <dspbridge/host_os.h>
25684 #include <dspbridge/std.h>
25685 #include <dspbridge/dbdefs.h>
25686 #include <dspbridge/errbase.h>
25687 -#include <dspbridge/dbreg.h>
25689 /* ----------------------------------- Trace & Debug */
25690 #include <dspbridge/dbc.h>
25691 @@ -43,50 +30,23 @@
25693 /* ----------------------------------- OS Adaptation Layer */
25694 #include <dspbridge/mem.h>
25695 -#include <dspbridge/csl.h>
25696 +#include <dspbridge/list.h>
25698 /* ----------------------------------- This */
25699 #include <regsup.h>
25701 -struct RegValueStruct {
25702 - char name[BRIDGE_MAX_NAME_SIZE]; /* Name of a given value entry */
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 */
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];
25718 /* Pointer to the registry support key */
25719 -static struct RegKeyStruct *pRegKey;
25720 +static struct LST_LIST regKey, *pRegKey = ®Key;
25723 extern struct GT_Mask REG_debugMask; /* GT trace var. */
25725 - * ======== printS ========
25727 - * Displays printable characters in pBuf, if any.
25729 -static inline void printS(void *pBuf)
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++));
25739 - GT_0trace(REG_debugMask, GT_2CLASS, "\n");
25743 -#define printS(pBuf)
25747 @@ -96,14 +56,7 @@ static inline void printS(void *pBuf)
25749 bool regsupInit(void)
25751 - if (pRegKey != NULL)
25754 - /* Need to allocate and setup our registry. */
25755 - pRegKey = MEM_Calloc(sizeof(struct RegKeyStruct), MEM_NONPAGED);
25756 - if (pRegKey == NULL)
25759 + INIT_LIST_HEAD(&pRegKey->head);
25763 @@ -114,41 +67,14 @@ bool regsupInit(void)
25765 void regsupExit(void)
25769 - /* Make sure data has actually been allocated. */
25770 - if (pRegKey == NULL) {
25771 - /* Nothing initialized.return! */
25775 - GT_1trace(REG_debugMask, GT_2CLASS, "pRegKey->numValueEntries %d\n",
25776 - pRegKey->numValueEntries);
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);
25792 - pRegKey->values[i].pData = NULL;
25793 - pRegKey->values[i].dataSize = 0;
25794 - pRegKey->values[i].name[0] = '\0';
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);
25803 - /* Don't forget to NULL out the global entry! */
25805 + MEM_Free(rv->pData);
25811 @@ -159,31 +85,29 @@ void regsupExit(void)
25812 DSP_STATUS regsupGetValue(char *valName, void *pBuf, u32 *dataSize)
25814 DSP_STATUS retVal = DSP_EFAIL;
25816 + struct RegValue *rv = (struct RegValue *) LST_First(pRegKey);
25818 /* Need to search through the entries looking for the right one. */
25819 - for (i = 0; i < pRegKey->numValueEntries; i++) {
25821 /* See if the name matches. */
25822 - if (strncmp(pRegKey->values[i].name, valName,
25823 - BRIDGE_MAX_NAME_SIZE) == 0) {
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);
25831 /* Get the size for the caller. */
25832 - *dataSize = pRegKey->values[i].dataSize;
25833 + *dataSize = rv->dataSize;
25835 /* Set our status to good and exit. */
25839 + rv = (struct RegValue *) LST_Next(pRegKey,
25840 + (struct list_head *) rv);
25843 if (DSP_SUCCEEDED(retVal)) {
25844 GT_2trace(REG_debugMask, GT_2CLASS, "G %s DATA %x ", valName,
25846 - printS((u8 *)pBuf);
25848 GT_1trace(REG_debugMask, GT_3CLASS, "G %s FAILED\n", valName);
25850 @@ -199,65 +123,51 @@ DSP_STATUS regsupGetValue(char *valName,
25851 DSP_STATUS regsupSetValue(char *valName, void *pBuf, u32 dataSize)
25853 DSP_STATUS retVal = DSP_EFAIL;
25855 + struct RegValue *rv = (struct RegValue *) LST_First(pRegKey);
25857 GT_2trace(REG_debugMask, GT_2CLASS, "S %s DATA %x ", valName,
25859 - printS((u8 *)pBuf);
25861 /* Need to search through the entries looking for the right one. */
25862 - for (i = 0; i < pRegKey->numValueEntries; i++) {
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,
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)
25883 /* We have a match! Copy out the data. */
25884 - memcpy(pRegKey->values[i].pData, pBuf, dataSize);
25885 + memcpy(rv->pData, pBuf, dataSize);
25887 /* Reset datasize - overwrite if new or same */
25888 - pRegKey->values[i].dataSize = dataSize;
25889 + rv->dataSize = dataSize;
25891 /* Set our status to good and exit. */
25895 + rv = (struct RegValue *) LST_Next(pRegKey,
25896 + (struct list_head *) rv);
25899 /* See if we found a match or if this is a new entry */
25900 - if (i == pRegKey->numValueEntries) {
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) {
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 !=
25914 - values[pRegKey->numValueEntries].pData,
25917 - values[pRegKey->numValueEntries].dataSize =
25919 - pRegKey->numValueEntries++;
25920 - retVal = DSP_SOK;
25923 - GT_0trace(REG_debugMask, GT_7CLASS,
25924 - "MAX NUM REG ENTRIES REACHED\n");
25925 + struct RegValue *new = MEM_Calloc(sizeof(struct RegValue),
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;
25938 @@ -274,7 +184,7 @@ DSP_STATUS regsupEnumValue(IN u32 dwInde
25939 IN OUT char *pstrData, IN OUT u32 *pdwDataSize)
25941 DSP_STATUS retVal = REG_E_INVALIDSUBKEY;
25943 + struct RegValue *rv = (struct RegValue *) LST_First(pRegKey);
25947 @@ -282,28 +192,26 @@ DSP_STATUS regsupEnumValue(IN u32 dwInde
25948 dwKeyLen = strlen(pstrKey);
25950 /* Need to search through the entries looking for the right one. */
25951 - for (i = 0; i < pRegKey->numValueEntries; i++) {
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. */
25980 + rv = (struct RegValue *) LST_Next(pRegKey,
25981 + (struct list_head *) rv);
25984 if (count && DSP_FAILED(retVal))
25985 @@ -315,54 +223,30 @@ DSP_STATUS regsupEnumValue(IN u32 dwInde
25987 * ======== regsupDeleteValue ========
25989 -DSP_STATUS regsupDeleteValue(IN CONST char *pstrSubkey,
25990 - IN CONST char *pstrValue)
25991 +DSP_STATUS regsupDeleteValue(IN CONST char *pstrValue)
25993 DSP_STATUS retVal = DSP_EFAIL;
25995 + struct RegValue *rv = (struct RegValue *) LST_First(pRegKey);
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) {
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
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;
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 =
26024 - values[pRegKey->numValueEntries-1].dataSize;
26025 - pRegKey->values[i].pData =
26027 - values[pRegKey->numValueEntries-1].pData;
26028 - /* don't have to do this, but for
26029 - * the paranoid... */
26031 - values[pRegKey->numValueEntries-1].name[0] =
26035 - /* another one bites the dust. */
26036 - pRegKey->numValueEntries--;
26037 + LST_RemoveElem(pRegKey, (struct list_head *)rv);
26038 + MEM_Free(rv->pData);
26041 /* Set our status to good and exit... */
26045 + rv = (struct RegValue *)LST_Next(pRegKey,
26046 + (struct list_head *)rv);
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
26054 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26059 - * ======== regsup.h ========
26061 - *! Revision History
26062 - *! ================
26068 -#define BRIDGE_MAX_NAME_SIZE MAXREGPATHLENGTH
26069 -#define BRIDGE_MAX_NUM_REG_ENTRIES 52
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);
26076 * ======== regsupDeleteValue ========
26078 -extern DSP_STATUS regsupDeleteValue(IN CONST char *pstrSubkey,
26079 - IN CONST char *pstrValue);
26080 +extern DSP_STATUS regsupDeleteValue(IN CONST char *pstrValue);
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
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
26090 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26092 + * Provide SERVICES loading.
26094 * Copyright (C) 2005-2006 Texas Instruments, Inc.
26096 * This package is free software; you can redistribute it and/or modify
26098 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26103 - * ======== services.c ========
26105 - * Provide SERVICES loading.
26107 - * Public Functions:
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.
26119 #include <dspbridge/host_os.h>
26121 /* ----------------------------------- DSP/BIOS Bridge */
26122 @@ -44,17 +28,12 @@
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>
26138 /* ----------------------------------- This */
26139 #include <dspbridge/services.h>
26141 static struct GT_Mask SERVICES_debugMask = { NULL, NULL }; /* GT trace var. */
26144 -static u32 cRefs; /* SERVICES module reference count */
26147 * ======== SERVICES_Exit ========
26149 @@ -74,31 +51,16 @@ static u32 cRefs; /* SERVICES module re
26151 void SERVICES_Exit(void)
26153 - DBC_Require(cRefs > 0);
26154 + /* Uninitialize all SERVICES modules here */
26163 - GT_1trace(SERVICES_debugMask, GT_5CLASS, "SERVICES_Exit: cRefs 0x%x\n",
26167 - if (cRefs == 0) {
26168 - /* Uninitialize all SERVICES modules here */
26185 - DBC_Ensure(cRefs >= 0);
26190 @@ -109,84 +71,49 @@ void SERVICES_Exit(void)
26191 bool SERVICES_Init(void)
26194 - bool fCFG, fCSL, fDBG, fDPC, fKFILE, fLST, fMEM;
26195 - bool fREG, fSYNC, fCLK, fUTIL, fNTFY;
26197 - DBC_Require(cRefs >= 0);
26198 + bool fCFG, fDBG, fMEM;
26199 + bool fREG, fSYNC, fCLK, fNTFY;
26201 - if (cRefs == 0) {
26203 + GT_create(&SERVICES_debugMask, "OS"); /* OS for OSal */
26206 - GT_create(&SERVICES_debugMask, "OS"); /* OS for OSal */
26208 - GT_0trace(SERVICES_debugMask, GT_ENTER,
26209 + GT_0trace(SERVICES_debugMask, GT_ENTER,
26210 "SERVICES_Init: entered\n");
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();
26227 - fInit = fCFG && fCSL && fDBG && fDPC && fKFILE &&
26228 - fLST && fMEM && fREG && fSYNC && fCLK && fUTIL;
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();
26272 + fInit = fCFG && fDBG && fMEM && fREG && fSYNC && fCLK;
26302 - GT_1trace(SERVICES_debugMask, GT_5CLASS, "SERVICES_Init: cRefs 0x%x\n",
26305 - DBC_Ensure((fInit && (cRefs > 0)) || (!fInit && (cRefs >= 0)));
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
26315 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26317 + * Synchronization services.
26319 * Copyright (C) 2005-2006 Texas Instruments, Inc.
26321 * This package is free software; you can redistribute it and/or modify
26323 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26327 - * ======== sync.c ========
26329 - * Synchronization services.
26331 - * Public Functions:
26332 - * SYNC_CloseEvent
26337 - * SYNC_InitializeCS
26340 - * SYNC_ResetEvent
26342 - * SYNC_WaitOnEvent
26343 - * SYNC_WaitOnMultipleEvents
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.
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.
26359 /* ----------------------------------- Host OS */
26360 #include <dspbridge/host_os.h>
26363 #include <dspbridge/gt.h>
26365 /* ----------------------------------- OS Adaptation Layer */
26366 -#include <dspbridge/csl.h>
26367 #include <dspbridge/mem.h>
26369 /* ----------------------------------- This */
26370 @@ -219,7 +187,6 @@ DSP_STATUS SYNC_ResetEvent(struct SYNC_O
26372 if (MEM_IsValidHandle(hEvent, SIGNATURE)) {
26373 pEvent->state = so_reset;
26374 - status = DSP_SOK;
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
26392 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
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).
26398 * Copyright (C) 2005-2006 Texas Instruments, Inc.
26400 * This package is free software; you can redistribute it and/or modify
26402 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26407 - * ======== _cmm.h ========
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).
26413 - * Public Functions:
26418 - *! Revision History:
26419 - *! ================
26420 - *! 24-Aug-2001 ag Created.
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
26431 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26433 + * Private header for DEH module.
26435 * Copyright (C) 2005-2006 Texas Instruments, Inc.
26437 * This package is free software; you can redistribute it and/or modify
26439 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26444 - * ======== _deh.h ========
26446 - * Private header for DEH module.
26448 - *! Revision History:
26449 - *! ================
26450 - *! 21-Sep-2001 kc: created.
26456 -#include <dspbridge/dpc.h>
26457 #include <dspbridge/ntfy.h>
26458 #include <dspbridge/wmd.h>
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. */
26467 + /* MMU Fault DPC */
26468 + struct tasklet_struct dpc_tasklet;
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
26477 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26479 + * Private header file defining MSG manager objects and defines needed
26482 * Copyright (C) 2005-2006 Texas Instruments, Inc.
26484 * This package is free software; you can redistribute it and/or modify
26486 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26491 - * ======== _msg_sm.h ========
26493 - * Private header file defining MSG manager objects and defines needed
26496 - * Public Functions:
26501 - *! Revision History:
26502 - *! ================
26503 - *! 09-May-2001 jeh Code Review cleanup.
26504 - *! 08-Nov-2000 jeh Created.
26510 @@ -121,7 +106,7 @@ struct MSG_MGR {
26511 * The MSG_QUEUE's hSynEvent gets posted when a message is ready.
26514 - struct LST_ELEM listElem;
26515 + struct list_head listElem;
26517 struct MSG_MGR *hMsgMgr;
26518 u32 uMaxMsgs; /* Node message depth */
26519 @@ -150,7 +135,7 @@ struct MSG_DSPMSG {
26520 * ======== MSG_FRAME ========
26523 - struct LST_ELEM listElem;
26524 + struct list_head listElem;
26525 struct MSG_DSPMSG msgData;
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
26533 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26535 + * Definitions and types private to this WMD.
26537 * Copyright (C) 2005-2006 Texas Instruments, Inc.
26539 * This package is free software; you can redistribute it and/or modify
26541 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26545 - * ======== _tiomap.h ========
26547 - * Definitions and types private to this WMD.
26554 @@ -214,12 +209,8 @@ static const struct MAP_L4PERIPHERAL L4P
26555 #define MBX_PM_MAX_RESOURCES 11
26557 /* Power Management Commands */
26558 -enum BPWR_ExtClockCmd {
26559 - BPWR_DisableClock = 0,
26560 - BPWR_EnableClock,
26561 - BPWR_DisableAutoIdle,
26562 - BPWR_EnableAutoIdle
26564 +#define BPWR_DisableClock 0
26565 +#define BPWR_EnableClock 1
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 */
26572 #define DSP_MAILBOX1_INT 10
26575 - * INTH_InterruptKind_t
26576 - * Identify the kind of interrupt: either FIQ/IRQ
26578 -enum INTH_InterruptKind_t {
26583 -enum INTH_SensitiveEdge_t {
26584 - FALLING_EDGE_SENSITIVE = 0,
26585 - LOW_LEVEL_SENSITIVE = 1
26589 * Bit definition of Interrupt Level Registers
26591 @@ -322,9 +298,9 @@ enum INTH_SensitiveEdge_t {
26592 #define ClearBit(reg, mask) (reg &= ~mask)
26593 #define SetBit(reg, mask) (reg |= mask)
26595 -#define SetGroupBits16(reg, position, width, value) \
26597 - reg &= ~((0xFFFF >> (16 - (width))) << (position)) ; \
26598 +#define SetGroupBits16(reg, position, width, value) \
26600 + reg &= ~((0xFFFF >> (16 - (width))) << (position)); \
26601 reg |= ((value & (0xFFFF >> (16 - (width)))) << (position)); \
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 */
26611 * DSP External memory prog address as seen virtually by the OS on
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 */
26642 * Processor specific info is set when prog loaded and read from DCD.
26643 @@ -358,14 +334,14 @@ struct WMD_DEV_CONTEXT {
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 */
26659 - bool tcWordSwapOn; /* Traffic Controller Word Swap */
26660 + bool tcWordSwapOn; /* Traffic Controller Word Swap */
26661 struct PgTableAttrs *pPtAttrs;
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
26669 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26671 + * Definitions and types for the DSP MMU modules.
26673 * Copyright (C) 2005-2006 Texas Instruments, Inc.
26675 * This package is free software; you can redistribute it and/or modify
26677 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26682 - * ======== _tiomap_mmu.h ========
26684 - * Definitions and types for the DSP MMU modules
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.
26694 #ifndef _TIOMAP_MMU_
26695 #define _TIOMAP_MMU_
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
26702 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26704 + * Definitions and types for the DSP wake/sleep routines.
26706 * Copyright (C) 2005-2006 Texas Instruments, Inc.
26708 * This package is free software; you can redistribute it and/or modify
26710 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26715 - * ======== _tiomap_pwr.h ========
26717 - * Definitions and types for the DSP wake/sleep routines.
26719 - *! Revision History
26720 - *! ================
26721 - *! 08-Oct-2002 rr: Created.
26724 #ifndef _TIOMAP_PWR_
26725 #define _TIOMAP_PWR_
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
26732 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26734 + * Definitions and types for the utility routines.
26736 * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
26745 - * ======== _tiomap_util.h ========
26747 - * Definitions and types for the utility routines.
26749 - *! Revision History
26750 - *! ================
26751 - *! 08-Oct-2002 rr: Created.
26754 #ifndef _TIOMAP_UTIL_
26755 #define _TIOMAP_UTIL_
26757 /* Time out Values in uSeconds*/
26758 #define TIHELEN_ACKTIMEOUT 10000
26761 + * Time out for power state transition (in msecs), due to system
26762 + * latencies and HZ resolution this timer can vary.
26764 +#define PWRSTST_TIMEOUT 200
26766 /* Time delay for HOM->SAM transition. */
26767 #define WAIT_SAM 1000000 /* in usec (1000 millisec) */
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
26774 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
26776 + * Implements upper edge functions for WMD channel module.
26778 * Copyright (C) 2005-2006 Texas Instruments, Inc.
26780 * This package is free software; you can redistribute it and/or modify
26782 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26787 - * ======== chnl_sm.c ========
26789 - * Implements upper edge functions for WMD channel module.
26791 - * Public Functions:
26792 - * WMD_CHNL_AddIOReq
26793 - * WMD_CHNL_CancelIO
26795 - * WMD_CHNL_Create
26796 - * WMD_CHNL_Destroy
26797 - * WMD_CHNL_FlushIO
26798 - * WMD_CHNL_GetInfo
26799 - * WMD_CHNL_GetIOC
26800 - * WMD_CHNL_GetMgrInfo
26805 * The lower edge functions must be implemented by the WMD writer, and
26806 * are declared in chnl_sm.h.
26809 * LST_Empty(pChnl->pIOCompletions) ==> pChnl->hSyncEvent is reset
26811 * !LST_Empty(pChnl->pIOCompletions) ==> pChnl->hSyncEvent is set.
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.
26868 /* ----------------------------------- OS */
26870 /* ----------------------------------- OS Adaptation Layer */
26871 #include <dspbridge/mem.h>
26872 #include <dspbridge/cfg.h>
26873 -#include <dspbridge/csl.h>
26874 #include <dspbridge/sync.h>
26876 /* ----------------------------------- Mini-Driver */
26877 @@ -183,6 +111,31 @@ DSP_STATUS WMD_CHNL_AddIOReq(struct CHNL
26879 fIsEOS = (cBytes == 0) ? true : false;
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;
26889 + /* Check the channel state: only queue chirp if channel state
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;
26899 + /* No other possible states left: */
26903 + if (DSP_FAILED(status))
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");
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;
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;
26935 - /* Check the channel state: only queue chirp if channel state
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;
26945 - /* No other possible states left: */
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;
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 *)
26971 - pChnl->cIOReqs++;
26972 - DBC_Assert(pChnl->cIOReqs <= pChnl->cChirps);
26973 - /* If end of stream, update the channel state to prevent
26976 - pChnl->dwState |= CHNL_STATEEOS;
26978 + * Note: for dma chans dwDspAddr contains dsp address
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
26996 + pChnl->dwState |= CHNL_STATEEOS;
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),
27004 + fSchedDPC = true;
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;
27018 enable_irq(MAILBOX_IRQ);
27019 SYNC_LeaveCS(pChnlMgr->hCSObj);
27021 IO_IntrDSP2(pChnlMgr->hIOMgr, wMbVal);
27023 - if (fSchedDPC == true) {
27024 - /* Schedule a DPC, to do the actual data transfer: */
27025 + /* Schedule a DPC, to do the actual data transfer: */
27027 IO_Schedule(pChnlMgr->hIOMgr);
27031 DBG_Trace(DBG_ENTER, "< WMD_CHNL_AddIOReq pChnl %p\n", pChnl);
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;
27040 struct CHNL_IRP *pChirp;
27041 struct CHNL_MGR *pChnlMgr = NULL;
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);
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;
27063 - struct CHNL_MGR *hChnlMgr;
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);
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);
27078 - if (DSP_SUCCEEDED(status)) {
27079 - /* Allocate channel manager object: */
27080 - MEM_AllocObject(pChnlMgr, struct CHNL_MGR, CHNL_MGRSIGNATURE);
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 *
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);
27109 - status = DSP_EMEMORY;
27112 + /* Allocate channel manager object: */
27113 + MEM_AllocObject(pChnlMgr, struct CHNL_MGR, CHNL_MGRSIGNATURE);
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);
27140 status = DSP_EMEMORY;
27143 + status = DSP_EMEMORY;
27146 if (DSP_FAILED(status)) {
27147 WMD_CHNL_Destroy(pChnlMgr);
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);
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);
27162 /* release critical section */
27163 if (pChnlMgr->hCSObj)
27164 @@ -562,7 +483,7 @@ DSP_STATUS WMD_CHNL_FlushIO(struct CHNL_
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;
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 *)
27179 + LST_PutTail(pChnl->pFreeList,
27180 + (struct list_head *)pChirp);
27184 @@ -763,7 +684,6 @@ DSP_STATUS WMD_CHNL_GetIOC(struct CHNL_O
27187 status = copy_to_user(ioc.pBuf, pHostSysBuf, ioc.cBytes);
27188 -#ifndef RES_CLEANUP_DISABLE
27190 if (current->flags & PF_EXITING) {
27191 DBG_Trace(DBG_LEVEL7,
27192 @@ -778,7 +698,6 @@ DSP_STATUS WMD_CHNL_GetIOC(struct CHNL_O
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,
27206 struct CHNL_MGR *pChnlMgr;
27207 DSP_STATUS status = DSP_SOK;
27209 @@ -865,7 +784,7 @@ DSP_STATUS WMD_CHNL_Idle(struct CHNL_OBJ
27210 * Open a new half-duplex channel to the DSP board.
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)
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);
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;
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] !=
27235 + else if (pChnlMgr->apChannel[uChnlId] !=
27237 status = CHNL_E_CHANBUSY;
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);
27245 status = DSP_EMEMORY;
27249 /* Protect queues from IO_DPC: */
27250 pChnl->dwState = CHNL_STATECANCEL;
27251 @@ -917,13 +836,9 @@ DSP_STATUS WMD_CHNL_Open(OUT struct CHNL
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;
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;
27275 pChnl->cBytesMoved = 0;
27276 @@ -942,9 +857,8 @@ DSP_STATUS WMD_CHNL_Open(OUT struct CHNL
27278 status = DSP_EMEMORY;
27281 - status = DSP_EINVALIDARG;
27284 if (DSP_FAILED(status)) {
27286 if (pChnl->pIOCompletions) {
27287 @@ -969,9 +883,7 @@ DSP_STATUS WMD_CHNL_Open(OUT struct CHNL
27288 pChnl->hNtfy = NULL;
27290 MEM_FreeObject(pChnl);
27293 - if (DSP_SUCCEEDED(status)) {
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;
27302 - pChirpList = LST_Create();
27303 + pChirpList = MEM_Calloc(sizeof(struct LST_LIST), MEM_NONPAGED);
27306 + INIT_LIST_HEAD(&pChirpList->head);
27307 /* Make N chirps and place on queue. */
27308 for (i = 0; (i < uChirps) && ((pChirp = MakeNewChirp()) !=
27310 - LST_PutTail(pChirpList, (struct LST_ELEM *)pChirp);
27311 + LST_PutTail(pChirpList, (struct list_head *)pChirp);
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));
27319 - LST_Delete(pChirpList);
27320 + MEM_Free(pChirpList);
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
27329 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
27331 + * IO dispatcher for a shared memory channel driver.
27333 * Copyright (C) 2005-2006 Texas Instruments, Inc.
27335 * This package is free software; you can redistribute it and/or modify
27336 @@ -15,37 +17,14 @@
27340 - * ======== io_sm.c ========
27342 - * IO dispatcher for a shared memory channel driver.
27344 - * Public Functions:
27347 - * WMD_IO_OnLoaded
27356 - * IO_ReadValueLong
27360 - * IO_WriteValueLong
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).
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
27375 -/* ----------------------------------- Host OS */
27377 #include <dspbridge/host_os.h>
27378 #include <linux/workqueue.h>
27380 @@ -54,51 +33,48 @@
27381 #include <dspbridge/dbdefs.h>
27382 #include <dspbridge/errbase.h>
27384 -/* ----------------------------------- Trace & Debug */
27385 +/* Trace & Debug */
27386 #include <dspbridge/dbc.h>
27387 #include <dspbridge/dbg.h>
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>
27398 -/* ------------------------------------ Hardware Abstraction Layer */
27399 +/* Hardware Abstraction Layer */
27400 #include <hw_defs.h>
27401 #include <hw_mmu.h>
27403 -/* ----------------------------------- 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>
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>
27420 -/* ----------------------------------- Others */
27422 #include <dspbridge/rms_sh.h>
27423 #include <dspbridge/mgr.h>
27424 #include <dspbridge/drv.h>
27427 -/* ----------------------------------- This */
27429 #include <dspbridge/io_sm.h>
27430 #include "_msg_sm.h"
27431 #include <dspbridge/gt.h>
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 */
27439 #define EXTEND "_EXT_END"
27441 @@ -107,34 +83,33 @@
27443 #define MAX_PM_REQS 32
27445 -/* IO Manager: only one created per board: */
27446 +/* IO Manager: only one created per board */
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 */
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];
27492 @@ -147,9 +122,15 @@ struct IO_MGR {
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;
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);
27513 -/* Bus Addr (cached kernel)*/
27514 +/* Bus Addr (cached kernel) */
27515 static DSP_STATUS registerSHMSegs(struct IO_MGR *hIOMgr,
27516 struct COD_MANAGER *hCodMan,
27518 @@ -206,22 +187,26 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_M
27519 struct CHNL_MGR *hChnlMgr;
27520 static int ref_count;
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;
27536 + DEV_GetChnlMgr(hDevObject, &hChnlMgr);
27537 + if (!hChnlMgr || hChnlMgr->hIOMgr) {
27538 + status = DSP_EHANDLE;
27542 * Message manager will be created when a file is loaded, since
27543 * size of message buffer in shared memory is configurable in
27546 DEV_GetWMDContext(hDevObject, &hWmdContext);
27547 - DBC_Assert(hWmdContext);
27548 + if (!hWmdContext) {
27549 + status = DSP_EHANDLE;
27552 DEV_GetDevType(hDevObject, &devType);
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.
27558 pSharedMem = (struct SHM *) -1;
27559 - if (DSP_FAILED(status))
27562 /* Create a Single Threaded Work Queue */
27563 if (ref_count == 0)
27564 bridge_workqueue = create_workqueue("bridge_work-queue");
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);
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;
27581 /* Intializing Work Element */
27582 if (ref_count == 0) {
27583 INIT_WORK(&pIOMgr->io_workq, (void *)IO_DispatchPM);
27587 PREPARE_WORK(&pIOMgr->io_workq, (void *)IO_DispatchPM);
27590 - /* Initialize CHNL_MGR object: */
27591 + /* Initialize CHNL_MGR object */
27592 #ifndef DSP_TRACEBUF_DISABLED
27593 pIOMgr->pMsg = NULL;
27595 @@ -265,8 +249,15 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_M
27596 status = SYNC_InitializeCS(&pIOMgr->hCSObj);
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);
27604 + /* Initialize DPC counters */
27605 + pIOMgr->dpc_req = 0;
27606 + pIOMgr->dpc_sched = 0;
27608 + spin_lock_init(&pIOMgr->dpc_lock);
27610 if (DSP_SUCCEEDED(status))
27611 status = DEV_GetDevNode(hDevObject, &hDevNode);
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",
27626 - status = DSP_EFAIL;
27627 + status = CHNL_E_ISR;
27629 - if (DSP_SUCCEEDED(status))
27630 - DBG_Trace(DBG_LEVEL1, "ISR_IRQ Object 0x%x \n",
27633 - status = CHNL_E_ISR;
27636 status = CHNL_E_ISR;
27640 if (DSP_FAILED(status)) {
27643 WMD_IO_Destroy(pIOMgr);
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,
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);
27669 + destroy_workqueue(bridge_workqueue);
27670 + /* Linux function to uninstall ISR */
27671 + free_irq(INT_MAIL_MPU_IRQ, (void *)hIOMgr);
27673 + /* Free IO DPC object */
27674 + tasklet_kill(&hIOMgr->dpc_tasklet);
27675 + DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
27677 #ifndef DSP_TRACEBUF_DISABLED
27679 MEM_Free(hIOMgr->pMsg);
27681 SYNC_DeleteCS(hIOMgr->hCSObj); /* Leak Fix. */
27682 - /* Free this IO manager object: */
27683 + /* Free this IO manager object */
27684 MEM_FreeObject(hIOMgr);
27687 status = DSP_EHANDLE;
27692 @@ -389,13 +382,17 @@ DSP_STATUS WMD_IO_OnLoaded(struct IO_MGR
27693 HW_PAGE_SIZE_64KB, HW_PAGE_SIZE_4KB };
27695 status = DEV_GetCodMgr(hIOMgr->hDevObject, &hCodMan);
27696 - DBC_Assert(DSP_SUCCEEDED(status));
27697 + if (DSP_FAILED(status))
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;
27711 if (hIOMgr->pSharedMem)
27712 hIOMgr->pSharedMem = NULL;
27714 @@ -404,25 +401,25 @@ DSP_STATUS WMD_IO_OnLoaded(struct IO_MGR
27716 if (DSP_FAILED(status)) {
27717 status = CHNL_E_NOMEMMAP;
27721 status = COD_GetSymValue(hCodMan, CHNL_SHARED_BUFFER_LIMIT_SYM,
27723 if (DSP_FAILED(status)) {
27724 status = CHNL_E_NOMEMMAP;
27728 if (ulShmLimit <= ulShmBase) {
27729 status = CHNL_E_INVALIDMEMBASE;
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)));
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)));
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;
27754 - /* Length (bytes) of messaging part of shared
27757 + * Length (bytes) of messaging part of shared
27760 ulMsgLength = (ulMsgLimit - ulMsgBase + 1) *
27762 - /* Total length (bytes) of shared memory:
27765 + * Total length (bytes) of shared memory:
27768 ulMemLength = ulShmLength + ulMsgLength;
27771 status = CHNL_E_NOMEMMAP;
27774 + status = CHNL_E_NOMEMMAP;
27776 if (DSP_SUCCEEDED(status)) {
27777 #ifndef DSP_TRACEBUF_DISABLED
27778 @@ -459,19 +462,16 @@ func_cont1:
27780 if (DSP_FAILED(status))
27781 status = CHNL_E_NOMEMMAP;
27784 if (DSP_SUCCEEDED(status)) {
27785 status = COD_GetSymValue(hCodMan, DYNEXTBASE, &ulDynExtBase);
27786 if (DSP_FAILED(status))
27787 status = CHNL_E_NOMEMMAP;
27790 if (DSP_SUCCEEDED(status)) {
27791 status = COD_GetSymValue(hCodMan, EXTEND, &ulExtEnd);
27792 if (DSP_FAILED(status))
27793 status = CHNL_E_NOMEMMAP;
27796 if (DSP_SUCCEEDED(status)) {
27797 /* Get memory reserved in host resources */
27798 @@ -485,7 +485,7 @@ func_cont1:
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:
27810 if (DSP_FAILED(status))
27815 vaCurr = ulDynExtBase * hIOMgr->uWordSize;
27816 @@ -536,9 +536,11 @@ func_cont1:
27817 mapAttrs |= DSP_MAPELEMSIZE32;
27818 mapAttrs |= DSP_MAPDONOTLOCK;
27820 - while (numBytes && DSP_SUCCEEDED(status)) {
27821 - /* To find the max. page size with which both PA & VA are
27823 + while (numBytes) {
27825 + * To find the max. page size with which both PA & VA are
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))
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
27844 + * Don't try smaller sizes. Hopefully we have
27845 * reached an address aligned to a bigger page
27852 @@ -564,13 +569,14 @@ func_cont1:
27853 vaCurr += ulPadSize;
27854 gppVaCurr += ulPadSize;
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;
27861 - while (numBytes && DSP_SUCCEEDED(status)) {
27862 - /* To find the max. page size with which both PA & VA are
27864 + while (numBytes ) {
27866 + * To find the max. page size with which both PA & VA are
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))
27875 if (ndx < MAX_LOCK_TLB_ENTRIES) {
27876 - /* This is the physical address written to
27879 + * This is the physical address written to
27882 aEProc[ndx].ulGppPa = paCurr;
27883 - /* THIS IS THE VIRTUAL UNCACHED IOREMAPPED
27886 + * This is the virtual uncached ioremapped
27889 aEProc[ndx].ulGppVa = gppVaCurr;
27890 aEProc[ndx].ulDspVa = vaCurr / hIOMgr->
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))
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*/
27907 + * Don't try smaller sizes. Hopefully we have reached
27908 + * an address aligned to a bigger page size.
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++) {
27919 + * Copy remaining entries from CDB. All entries are 1 MB and
27920 + * should not conflict with SHM entries on MPU or DSP side.
27922 + for (i = 3; i < 7 && ndx < WMDIOCTL_NUMOFMMUTLB; i++) {
27923 if (hIOMgr->extProcInfo.tyTlb[i].ulGppPhys == 0)
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);
27941 + if (DSP_FAILED(status))
27944 - if (i < 7 && DSP_SUCCEEDED(status)) {
27945 - /* All CDB entries could not be made*/
27946 - status = DSP_EFAIL;
27950 mapAttrs = 0x00000000;
27951 mapAttrs = DSP_MAPLITTLEENDIAN;
27952 mapAttrs |= DSP_MAPPHYSICALADDR;
27953 @@ -677,154 +689,148 @@ func_cont:
27955 /* Map the L4 peripherals */
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,
27963 if (DSP_FAILED(status))
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;
27976 - /* Set the SHM physical address entry (grayed out in CDB file)
27977 - * to the virtual uncached ioremapped address of SHM reserved
27979 - hIOMgr->extProcInfo.tyTlb[0].ulGppPhys = (ulGppVa + ulSeg1Size +
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:
27985 - if ((hIOMgr->extProcInfo.tyTlb[0].ulGppPhys == 0) ||
27986 - (uNumProcs != 1)) {
27987 - status = CHNL_E_NOMEMMAP;
27988 - DBC_Assert(false);
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].
28006 - ulShmBase += ulShmBaseOffset;
28007 - ulShmBase = (u32)MEM_LinearAddress((void *)ulShmBase,
28009 - DBC_Assert(ulShmBase != 0);
28010 - if (DSP_SUCCEEDED(status)) {
28011 - status = registerSHMSegs(hIOMgr, hCodMan,
28012 - aEProc[0].ulGppPa);
28013 - /* Register SM */
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 +
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));
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;
28064 + * Set the SHM physical address entry (grayed out in CDB file)
28065 + * to the virtual uncached ioremapped address of SHM reserved
28068 + hIOMgr->extProcInfo.tyTlb[0].ulGppPhys = (ulGppVa + ulSeg1Size +
28070 + DBG_Trace(DBG_LEVEL1, "*********extProcInfo *********%x \n",
28071 + hIOMgr->extProcInfo.tyTlb[0].ulGppPhys);
28073 + * Need SHM Phys addr. IO supports only one DSP for now:
28076 + if (!hIOMgr->extProcInfo.tyTlb[0].ulGppPhys || uNumProcs != 1) {
28077 + status = CHNL_E_NOMEMMAP;
28080 + if (aEProc[0].ulDspVa > ulShmBase) {
28081 + status = DSP_EFAIL;
28084 + /* ulShmBase may not be at ulDspVa address */
28085 + ulShmBaseOffset = (ulShmBase - aEProc[0].ulDspVa) *
28086 + hIOMgr->uWordSize;
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
28094 + status = hIOMgr->pIntfFxns->pfnDevCntrl(hIOMgr->hWmdContext,
28095 + WMDIOCTL_SETMMUCONFIG, aEProc);
28096 + if (DSP_FAILED(status))
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,
28104 + if (ulShmBase == 0) {
28105 + status = DSP_EPOINTER;
28108 + /* Register SM */
28109 + status = registerSHMSegs(hIOMgr, hCodMan, aEProc[0].ulGppPa);
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
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));
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;
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 */
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;
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;
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;
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);
28223 - DBG_Trace(DBG_LEVEL1, "** hIOMgr->pMsg: 0x%x\n", hIOMgr->pMsg);
28224 - hIOMgr->ulDspVa = ulDspVa;
28225 - hIOMgr->ulGppVa = (ulGppVa + ulSeg1Size + ulPadSize);
28228 IO_EnableInterrupt(hIOMgr->hWmdContext);
28233 @@ -834,9 +840,10 @@ func_cont:
28235 u32 IO_BufSize(struct IO_MGR *hIOMgr)
28237 - DBC_Require(MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE));
28239 - return hIOMgr->uSMBufSize;
28240 + if (MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE))
28241 + return hIOMgr->uSMBufSize;
28247 @@ -848,14 +855,17 @@ void IO_CancelChnl(struct IO_MGR *hIOMgr
28248 struct IO_MGR *pIOMgr = (struct IO_MGR *)hIOMgr;
28251 - DBC_Require(MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE));
28252 + if (!MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE))
28254 sm = hIOMgr->pSharedMem;
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,
28261 CHNLSM_InterruptDSP2(pIOMgr->hWmdContext, MBX_PCPY_CLASS);
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)
28271 - DBC_Require(MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE));
28272 + if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
28275 DBG_Trace(DBG_LEVEL3, "Entering IO_DispatchChnl \n");
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)
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);
28292 @@ -883,13 +897,16 @@ static void IO_DispatchChnl(IN struct IO
28294 static void IO_DispatchMsg(IN struct IO_MGR *pIOMgr, struct MSG_MGR *hMsgMgr)
28296 - DBC_Require(MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE));
28297 + if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
28300 DBG_Trace(DBG_LEVEL3, "Entering IO_DispatchMsg \n");
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);
28311 @@ -898,16 +915,13 @@ static void IO_DispatchMsg(IN struct IO_
28313 static void IO_DispatchPM(struct work_struct *work)
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);
28321 - /*DBC_Require(MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE));*/
28323 DBG_Trace(DBG_LEVEL7, "IO_DispatchPM: Entering IO_DispatchPM : \n");
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->
28330 @@ -947,13 +961,11 @@ static void IO_DispatchPM(struct work_st
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;
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.
28349 -void IO_DPC(IN OUT void *pRefData)
28350 +void IO_DPC(IN OUT unsigned long pRefData)
28352 struct IO_MGR *pIOMgr = (struct IO_MGR *)pRefData;
28353 struct CHNL_MGR *pChnlMgr;
28354 struct MSG_MGR *pMsgMgr;
28355 struct DEH_MGR *hDehMgr;
28359 - DBC_Require(MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE));
28360 + if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
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))
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 */
28373 - WMD_DEH_Notify(hDehMgr, DSP_SYSERROR, pIOMgr->wIntrVal);
28376 - IO_DispatchChnl(pIOMgr, NULL, IO_SERVICE);
28377 + requested = pIOMgr->dpc_req;
28378 + serviced = pIOMgr->dpc_sched;
28380 + if (serviced == requested)
28383 + /* Process pending DPC's */
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 */
28390 + WMD_DEH_Notify(hDehMgr, DSP_SYSERROR,
28391 + pIOMgr->wIntrVal);
28393 + IO_DispatchChnl(pIOMgr, NULL, IO_SERVICE);
28394 #ifdef CHNL_MESSAGES
28396 - DBC_Require(MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE));
28397 - IO_DispatchMsg(pIOMgr, pMsgMgr);
28399 + if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE))
28400 + IO_DispatchMsg(pIOMgr, pMsgMgr);
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);
28413 -#ifndef DSP_TRACEBUF_DISABLED
28414 - PrintDSPDebugTrace(pIOMgr);
28417 + } while (serviced != requested);
28418 + pIOMgr->dpc_sched = requested;
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
28429 struct IO_MGR *hIOMgr = (struct IO_MGR *)pRefData;
28431 - DBC_Require(irq == INT_MAIL_MPU_IRQ);
28432 - DBC_Require(MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE));
28433 + unsigned long flags;
28435 + if (irq != INT_MAIL_MPU_IRQ ||
28436 + !MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE))
28438 DBG_Trace(DBG_LEVEL3, "Entering IO_ISR(0x%x)\n", pRefData);
28440 /* Call WMD's CHNLSM_ISR() to see if interrupt is ours, and process. */
28441 if (IO_CALLISR(hIOMgr->hWmdContext, &fSchedDPC, &hIOMgr->wIntrVal)) {
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;
28458 + queue_work(bridge_workqueue, &hIOMgr->io_workq);
28460 + if (hIOMgr->wIntrVal == MBX_DEH_RESET) {
28461 + DBG_Trace(DBG_LEVEL6, "*** DSP RESET ***\n");
28462 + hIOMgr->wIntrVal = 0;
28463 + } else if (fSchedDPC) {
28465 + * PROC-COPY defer i/o.
28466 + * Increment count of DPC's pending.
28468 + spin_lock_irqsave(&hIOMgr->dpc_lock, flags);
28469 + hIOMgr->dpc_req++;
28470 + spin_unlock_irqrestore(&hIOMgr->dpc_lock, flags);
28472 - queue_work(bridge_workqueue, &hIOMgr->io_workq);
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);
28481 + /* Schedule DPC */
28482 + tasklet_schedule(&hIOMgr->dpc_tasklet);
28486 /* Ensure that, if WMD didn't claim it, the IRQ is shared. */
28487 DBC_Ensure(hIOMgr->fSharedIRQ);
28488 - return IRQ_HANDLED;
28491 + return IRQ_HANDLED;
28495 @@ -1055,30 +1089,39 @@ void IO_RequestChnl(struct IO_MGR *pIOMg
28497 struct CHNL_MGR *pChnlMgr;
28499 - DBC_Require(pChnl != NULL);
28500 - DBC_Require(pwMbVal != NULL);
28502 + if (!pChnl || !pwMbVal)
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: */
28510 + * Assertion fires if CHNL_AddIOReq() called on a stream
28511 + * which was cancelled, or attached to a dead board.
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: */
28524 + * This assertion fails if CHNL_AddIOReq() was called on a
28525 + * stream which was cancelled, or attached to a dead board.
28527 DBC_Assert((pChnl->dwState & ~CHNL_STATEEOS) ==
28529 - /* Record the fact that we have a buffer available for
28532 + * Record the fact that we have a buffer available for
28535 pChnlMgr->dwOutputMask |= (1 << pChnl->uId);
28537 DBC_Assert(iMode); /* Shouldn't get here. */
28544 @@ -1087,9 +1130,18 @@ void IO_RequestChnl(struct IO_MGR *pIOMg
28546 void IO_Schedule(struct IO_MGR *pIOMgr)
28548 - DBC_Require(MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE));
28549 + unsigned long flags;
28551 + if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
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);
28559 - DPC_Schedule(pIOMgr->hDPC);
28560 + /* Schedule DPC */
28561 + tasklet_schedule(&pIOMgr->dpc_tasklet);
28565 @@ -1108,7 +1160,8 @@ static u32 FindReadyOutput(struct CHNL_M
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)
28575 @@ -1117,7 +1170,6 @@ static u32 FindReadyOutput(struct CHNL_M
28578 pChnlMgr->dwLastOutput = id;
28583 @@ -1125,7 +1177,7 @@ static u32 FindReadyOutput(struct CHNL_M
28585 } while (id != startId);
28587 - DBC_Ensure((uRetval == OUTPUTNOTREADY) || (uRetval < CHNL_MAXCHANNELS));
28592 @@ -1150,7 +1202,7 @@ static void InputChnl(struct IO_MGR *pIO
28594 DBG_Trace(DBG_LEVEL3, "> InputChnl\n");
28596 - /* Attempt to perform input.... */
28597 + /* Attempt to perform input */
28598 if (!IO_GetValue(pIOMgr->hWmdContext, struct SHM, sm, inputFull))
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)
28607 - /* Get the I/O request, and attempt a transfer: */
28608 + if (!pChnl->pIORequests)
28610 + /* Get the I/O request, and attempt a transfer */
28611 pChirp = (struct CHNL_IRP *)LST_GetHead(pChnl->
28615 - DBC_Assert(pChnl->cIOReqs >= 0);
28616 - /* Ensure we don't overflow the client's
28618 + if (pChnl->cIOReqs < 0)
28621 + * Ensure we don't overflow the client's
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->
28634 - /* This assertion fails if the DSP
28636 + * This assertion fails if the DSP
28637 * sends EOS more than once on this
28639 - DBC_Assert(!(pChnl->dwState &
28641 - /* Zero bytes indicates EOS. Update
28642 - * IOC status for this chirp, and also
28643 - * the channel state: */
28646 + if (pChnl->dwState & CHNL_STATEEOS)
28649 + * Zero bytes indicates EOS. Update
28650 + * IOC status for this chirp, and also
28651 + * the channel state.
28653 pChirp->status |= CHNL_IOCSTATEOS;
28654 pChnl->dwState |= CHNL_STATEEOS;
28655 - /* Notify that end of stream has
28658 + * Notify that end of stream has
28661 NTFY_Notify(pChnl->hNtfy,
28663 DBG_Trace(DBG_LEVEL7, "Input Chnl NTFY "
28664 "chnl = 0x%x\n", pChnl);
28666 - /* Tell DSP if no more I/O buffers available: */
28667 - if (!pChnl->pIORequests)
28669 + /* Tell DSP if no more I/O buffers available */
28670 + if (!pChnl->pIORequests)
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
28677 fNotifyClient = true;
28679 - /* Input full for this channel, but we have no
28681 + * Input full for this channel, but we have no
28682 * buffers available. The channel must be
28683 * "idling". Clear out the physical input
28690 - /* Input channel cancelled: clear input channel. */
28691 + /* Input channel cancelled: clear input channel */
28695 - /* DPC fired after host closed channel: clear input channel. */
28696 + /* DPC fired after host closed channel: clear input channel */
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);
28705 if (fNotifyClient) {
28706 - /* Notify client with IO completion record: */
28707 + /* Notify client with IO completion record */
28708 NotifyChnlComplete(pChnl, pChirp);
28711 @@ -1261,12 +1324,12 @@ static void InputMsg(struct IO_MGR *pIOM
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,
28719 uMsgs = IO_GetValue(pIOMgr->hWmdContext, struct MSG, pCtrl, size);
28720 - if (fInputEmpty || uMsgs >= hMsgMgr->uMaxMsgs)
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)
28733 + if (!hMsgMgr->queueList)
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)
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.
28752 while (hMsgQueue != NULL) {
28753 if (msg.dwId == hMsgQueue->dwId) {
28755 if (msg.msg.dwCmd == RMS_EXITACK) {
28756 - /* The exit message does not get
28758 - /* Call the node exit notification */
28759 - /* Node handle */ /* status */
28761 + * Call the node exit notification.
28762 + * The exit message does not get
28765 (*hMsgMgr->onExit)((HANDLE)hMsgQueue->
28766 hArg, msg.msg.dwArg1);
28768 - /* Not an exit acknowledgement, queue
28770 - if (!hMsgQueue->msgFreeList)
28773 + * Not an exit acknowledgement, queue
28776 + if (!hMsgQueue->msgFreeList)
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->
28785 - (struct LST_ELEM *)pMsg);
28787 + (struct list_head *)pMsg);
28788 NTFY_Notify(hMsgQueue->hNtfy,
28789 DSP_NODEMESSAGEREADY);
28790 SYNC_SetEvent(hMsgQueue->
28793 - /* No free frame to copy the
28794 - * message into */
28796 + * No free frame to copy the
28799 DBG_Trace(DBG_LEVEL7, "NO FREE "
28800 "MSG FRAMES, DISCARDING"
28802 @@ -1331,10 +1398,10 @@ static void InputMsg(struct IO_MGR *pIOM
28806 - if (!hMsgMgr->queueList || !hMsgQueue)
28808 + if (!hMsgMgr->queueList || !hMsgQueue)
28810 hMsgQueue = (struct MSG_QUEUE *)LST_Next(hMsgMgr->
28811 - queueList, (struct LST_ELEM *)hMsgQueue);
28812 + queueList, (struct list_head *)hMsgQueue);
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);
28826 @@ -1361,23 +1427,31 @@ static void NotifyChnlComplete(struct CH
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)
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().
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);
28852 - DBC_Assert(pChnl->cIOCs <= pChnl->cChirps);
28853 - /* Signal the channel event (if not already set) that IO is complete: */
28855 + if (pChnl->cIOCs > pChnl->cChirps)
28857 + /* Signal the channel event (if not already set) that IO is complete */
28859 SYNC_SetEvent(pChnl->hSyncEvent);
28861 /* Notify that IO is complete */
28862 NTFY_Notify(pChnl->hNtfy, DSP_STREAMIOCOMPLETION);
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))
28877 if (pChnl && !((pChnl->dwState & ~CHNL_STATEEOS) == CHNL_STATEREADY))
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,
28884 chnlId = FindReadyOutput(pChnlMgr, pChnl, (pChnlMgr->dwOutputMask &
28885 @@ -1413,24 +1487,24 @@ static void OutputChnl(struct IO_MGR *pI
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 */
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);
28902 - if (pChnl->cIOReqs < 0 || !pChnl->pIORequests)
28904 + if (pChnl->cIOReqs < 0 || !pChnl->pIORequests)
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);
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->
28917 @@ -1450,7 +1524,7 @@ static void OutputChnl(struct IO_MGR *pI
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");
28935 - pMsg = (struct MSG_FRAME *)LST_GetHead(
28936 - hMsgMgr->msgUsedList);
28937 + if (!hMsgMgr->msgUsedList) {
28938 + DBG_Trace(DBG_LEVEL3, "msgUsedList is NULL\n");
28942 + pMsg = (struct MSG_FRAME *)LST_GetHead(
28943 + hMsgMgr->msgUsedList);
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,
28951 pMsgOutput += sizeof(struct MSG_DSPMSG);
28952 - if (!hMsgMgr->msgFreeList)
28954 + if (!hMsgMgr->msgFreeList)
28956 LST_PutTail(hMsgMgr->msgFreeList,
28957 - (struct LST_ELEM *) pMsg);
28958 + (struct list_head *)pMsg);
28959 SYNC_SetEvent(hMsgMgr->hSyncEvent);
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,
28965 /* Tell the DSP we have written the output. */
28966 - CHNLSM_InterruptDSP2(pIOMgr->hWmdContext, MBX_PCPY_CLASS);
28967 + CHNLSM_InterruptDSP2(pIOMgr->hWmdContext,
28978 @@ -1571,25 +1646,36 @@ static DSP_STATUS registerSHMSegs(struct
28979 u32 ulShmSegId0 = 0;
28980 u32 dwOffset, dwGPPBaseVA, ulDSPSize;
28982 - /* Read address and size info for first SM region.*/
28983 - /* Get start of 1st SM Heap region */
28985 + * Read address and size info for first SM region.
28986 + * Get start of 1st SM Heap region.
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;
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,
28999 - DBC_Assert(ulShm0_End != 0);
29000 + if (ulShm0_End == 0) {
29001 + status = DSP_EFAIL;
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;
29019 /* Register with CMM */
29020 if (DSP_SUCCEEDED(status)) {
29021 @@ -1608,36 +1694,51 @@ static DSP_STATUS registerSHMSegs(struct
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->
29029 - DBC_Assert(ulRsrvdSize > 0);
29030 - /* calc size of SM DSP can alloc from */
29031 + if (ulRsrvdSize <= 0) {
29032 + status = DSP_EFAIL;
29035 + /* Calc size of SM DSP can alloc from */
29036 ulDSPSize = (ulShm0_RsrvdStart - ulShm0_Base) * hIOMgr->
29038 - DBC_Assert(ulDSPSize > 0);
29039 - /* First TLB entry reserved for Bridge SM use.*/
29040 + if (ulDSPSize <= 0) {
29041 + status = DSP_EFAIL;
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->
29050 - /* Calc byte offset used to convert GPP phys <-> DSP byte
29053 + * Calc byte offset used to convert GPP phys <-> DSP byte
29056 if (dwGPPBasePA > ulDspVirt)
29057 dwOffset = dwGPPBasePA - ulDspVirt;
29059 dwOffset = ulDspVirt - dwGPPBasePA;
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;
29069 + * Calc Gpp phys base of SM region.
29070 + * This is actually uncached kernel virtual address.
29072 dwGPPBaseVA = ulGppPhys + ulShm0_RsrvdStart * hIOMgr->uWordSize
29074 - /* calc Gpp phys base of SM region */
29075 - /* Linux - this is the physical address*/
29077 + * Calc Gpp phys base of SM region.
29078 + * This is the physical address.
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 "
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;
29101 @@ -1669,7 +1772,7 @@ static u32 ReadData(struct WMD_DEV_CONTE
29102 * Copies buffers from the host side buffer to the shared memory.
29104 static u32 WriteData(struct WMD_DEV_CONTEXT *hDevContext, void *pDest,
29105 - void *pSrc, u32 uSize)
29106 + void *pSrc, u32 uSize)
29108 memcpy(pDest, pSrc, uSize);
29110 @@ -1685,8 +1788,7 @@ void IO_IntrDSP2(IN struct IO_MGR *pIOMg
29111 * ======== IO_SHMcontrol ========
29112 * Sets the requested SHM setting.
29114 -DSP_STATUS IO_SHMsetting(IN struct IO_MGR *hIOMgr, IN enum SHM_DESCTYPE desc,
29116 +DSP_STATUS IO_SHMsetting(struct IO_MGR *hIOMgr, u8 desc, void *pArgs)
29118 #ifdef CONFIG_BRIDGE_DVFS
29120 @@ -1703,8 +1805,10 @@ DSP_STATUS IO_SHMsetting(IN struct IO_MG
29124 - /* Update the shared memory with the voltage, frequency,
29125 - min and max frequency values for an OPP */
29127 + * Update the shared memory with the voltage, frequency,
29128 + * min and max frequency values for an OPP.
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
29135 u32 ulNewMessageLength = 0, ulGPPCurPointer;
29137 - GT_0trace(dsp_trace_mask, GT_ENTER, "Entering PrintDSPDebugTrace\n");
29138 + GT_0trace(dsp_trace_mask, GT_ENTER, "Entering PrintDSPDebugTrace\n");
29141 /* Get the DSP current pointer */
29142 @@ -1781,25 +1885,25 @@ void PrintDSPDebugTrace(struct IO_MGR *h
29145 /* No new debug messages available yet */
29146 - if (ulGPPCurPointer == hIOMgr->ulGPPReadPointer)
29147 + if (ulGPPCurPointer == hIOMgr->ulGPPReadPointer) {
29150 - /* Continuous data */
29151 - else if (ulGPPCurPointer > hIOMgr->ulGPPReadPointer) {
29152 + } else if (ulGPPCurPointer > hIOMgr->ulGPPReadPointer) {
29153 + /* Continuous data */
29154 ulNewMessageLength = ulGPPCurPointer - hIOMgr->
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
29164 + * Advance the GPP trace pointer to DSP current
29167 hIOMgr->ulGPPReadPointer += ulNewMessageLength;
29168 /* Print the trace messages */
29169 - GT_0trace(dsp_trace_mask, GT_1CLASS, hIOMgr->pMsg);
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
29185 + * Advance the GPP trace pointer to DSP current
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);
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).
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)
29204 - DSP_STATUS status = DSP_SOK;
29206 - char *lpBufStart;
29207 - char *lpTmpStart;
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;
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 */
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';
29232 - default: /* Copy in the actual ascii byte */
29233 - *lpTmpBuf++ = thisChar;
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);
29244 + DSP_STATUS status = DSP_SOK;
29246 + char *lpBufStart;
29247 + char *lpTmpStart;
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;
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 */
29267 + case '\n': /* Convert \n to \r\n */
29269 + * NOTE: do not reverse order; Some OS
29270 + * editors control doesn't understand "\n\r"
29272 + *lpTmpBuf++ = '\r';
29273 + *lpTmpBuf++ = '\n';
29275 + default: /* Copy in the actual ascii byte */
29276 + *lpTmpBuf++ = thisChar;
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);
29290 -#endif /* (defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE */
29291 +#endif /* (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE */
29294 * ======== PrintDspTraceBuffer ========
29295 @@ -1904,106 +2012,106 @@ static DSP_STATUS PackTraceBuffer(char *
29297 DSP_STATUS PrintDspTraceBuffer(struct WMD_DEV_CONTEXT *hWmdContext)
29299 - DSP_STATUS status = DSP_SOK;
29300 + DSP_STATUS status = DSP_SOK;
29302 +#if (defined(CONFIG_BRIDGE_DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
29303 + struct COD_MANAGER *hCodMgr;
29305 + u32 ulTraceBegin;
29306 + u32 ulNumBytes = 0;
29307 + u32 ulNumWords = 0;
29308 + u32 ulWordSize = 2;
29309 + CONST u32 uMaxSize = 512;
29313 + struct WMD_DEV_CONTEXT *pWmdContext = (struct WMD_DEV_CONTEXT *)
29315 + struct WMD_DRV_INTERFACE *pIntfFxns;
29316 + struct DEV_OBJECT *pDevObject = (struct DEV_OBJECT *)
29317 + pWmdContext->hDevObject;
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");
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",
29330 + if (DSP_FAILED(status))
29331 + GT_0trace(dsp_trace_mask, GT_2CLASS,
29332 + "PrintDspTraceBuffer: Failed on "
29333 + "COD_GetSymValue.\n");
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",
29340 + if (DSP_FAILED(status))
29341 + GT_0trace(dsp_trace_mask, GT_2CLASS,
29342 + "PrintDspTraceBuffer: Failed on "
29343 + "COD_GetSymValue.\n");
29345 + if (DSP_SUCCEEDED(status)) {
29346 + ulNumBytes = (ulTraceEnd - ulTraceBegin) * ulWordSize;
29348 + * If the chip type is 55 then the addresses will be
29349 + * byte addresses; convert them to word addresses.
29351 + if (ulNumBytes > uMaxSize)
29352 + ulNumBytes = uMaxSize;
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);
29364 -#if (defined(DEBUG) || defined(DDSP_DEBUG_PRODUCT)) && GT_TRACE
29365 - struct COD_MANAGER *hCodMgr;
29367 - u32 ulTraceBegin;
29368 - u32 ulNumBytes = 0;
29369 - u32 ulNumWords = 0;
29370 - u32 ulWordSize = 2;
29371 - CONST u32 uMaxSize = 512;
29375 - struct WMD_DEV_CONTEXT *pWmdContext = (struct WMD_DEV_CONTEXT *)
29377 - struct WMD_DRV_INTERFACE *pIntfFxns;
29378 - struct DEV_OBJECT *pDevObject = (struct DEV_OBJECT *)
29379 - pWmdContext->hDevObject;
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");
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",
29392 - if (DSP_FAILED(status))
29393 - GT_0trace(dsp_trace_mask, GT_2CLASS,
29394 - "PrintDspTraceBuffer: Failed on "
29395 - "COD_GetSymValue.\n");
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",
29402 - if (DSP_FAILED(status))
29403 - GT_0trace(dsp_trace_mask, GT_2CLASS,
29404 - "PrintDspTraceBuffer: Failed on "
29405 - "COD_GetSymValue.\n");
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;
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);
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,
29432 - if (DSP_FAILED(status))
29433 - GT_0trace(dsp_trace_mask, GT_2CLASS,
29434 - "PrintDspTraceBuffer: "
29435 - "Failed to Read Trace Buffer.\n");
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);
29446 - MEM_Free(pszBuf);
29447 - MEM_Free(lpszBuf);
29449 - GT_0trace(dsp_trace_mask, GT_2CLASS,
29450 - "PrintDspTraceBuffer: Failed to "
29451 - "allocate trace buffer.\n");
29452 - status = DSP_EMEMORY;
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,
29463 + if (DSP_FAILED(status))
29464 + GT_0trace(dsp_trace_mask, GT_2CLASS,
29465 + "PrintDspTraceBuffer: "
29466 + "Failed to Read Trace Buffer.\n");
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);
29477 + MEM_Free(pszBuf);
29478 + MEM_Free(lpszBuf);
29480 + GT_0trace(dsp_trace_mask, GT_2CLASS,
29481 + "PrintDspTraceBuffer: Failed to "
29482 + "allocate trace buffer.\n");
29483 + status = DSP_EMEMORY;
29491 void IO_SM_init(void)
29494 - GT_create(&dsp_trace_mask, "DT"); /* DSP Trace Mask */
29496 + GT_create(&dsp_trace_mask, "DT"); /* DSP Trace Mask */
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
29503 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
29505 + * Implements DSP MMU fault handling functions.
29507 * Copyright (C) 2005-2006 Texas Instruments, Inc.
29509 * This package is free software; you can redistribute it and/or modify
29511 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29515 - * ======== mmu_fault.c ========
29517 - * Implements DSP MMU fault handling functions.
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.
29531 /* ----------------------------------- DSP/BIOS Bridge */
29532 #include <dspbridge/std.h>
29533 #include <dspbridge/dbdefs.h>
29535 #include <dspbridge/dbg.h>
29537 /* ----------------------------------- OS Adaptation Layer */
29538 -#include <dspbridge/dpc.h>
29539 #include <dspbridge/mem.h>
29540 #include <dspbridge/drv.h>
29542 @@ -69,14 +53,13 @@ static bool MMU_CheckIfFault(struct WMD_
29543 * ======== MMU_FaultDpc ========
29544 * Deferred procedure call to handle DSP MMU fault.
29546 -void MMU_FaultDpc(IN void *pRefData)
29547 +void MMU_FaultDpc(IN unsigned long pRefData)
29549 struct DEH_MGR *hDehMgr = (struct DEH_MGR *)pRefData;
29550 - struct DEH_MGR *pDehMgr = (struct DEH_MGR *)hDehMgr;
29552 DBG_Trace(DBG_LEVEL1, "MMU_FaultDpc Enter: 0x%x\n", pRefData);
29556 WMD_DEH_Notify(hDehMgr, DSP_MMUFAULT, 0L);
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;
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));
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 */
29577 * Schedule a DPC directly. In the future, it may be
29578 * necessary to check if DSP MMU fault is intended for
29581 - DPC_Schedule(pDehMgr->hMmuFaultDpc);
29582 + tasklet_schedule(&pDehMgr->dpc_tasklet);
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);
29591 - return IRQ_HANDLED;
29592 + return IRQ_HANDLED;
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
29601 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
29603 + * Defines DSP MMU fault handling functions.
29605 * Copyright (C) 2005-2006 Texas Instruments, Inc.
29607 * This package is free software; you can redistribute it and/or modify
29609 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29614 - * ======== mmu_fault.h ========
29616 - * Defines DSP MMU fault handling functions.
29618 - *! Revision History:
29619 - *! ================
29620 - *! 26-Dec-2004 hn: IVA MMU handlers.
29621 - *! 10-Sep-2001 kc: created.
29628 * ======== MMU_FaultDpc ========
29629 * Deferred procedure call to handle DSP MMU fault.
29631 - void MMU_FaultDpc(IN void *pRefData);
29632 + void MMU_FaultDpc(IN unsigned long pRefData);
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
29641 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
29643 + * Implements upper edge functions for WMD message module.
29645 * Copyright (C) 2005-2006 Texas Instruments, Inc.
29647 * This package is free software; you can redistribute it and/or modify
29649 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29654 - * ======== msg_sm.c ========
29656 - * Implements upper edge functions for WMD message module.
29658 - * Public Functions:
29660 - * WMD_MSG_CreateQueue
29662 - * WMD_MSG_DeleteQueue
29665 - * WMD_MSG_RegisterNotify
29666 - * WMD_MSG_SetQueueId
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
29676 - *! 04-Dec-2000 jeh Bug fixes.
29677 - *! 12-Sep-2000 jeh Created.
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;
29687 - DBC_Require(phMsgMgr != NULL);
29688 - DBC_Require(msgCallback != NULL);
29689 - DBC_Require(hDevObject != NULL);
29690 + if (!phMsgMgr || !msgCallback || !hDevObject) {
29691 + status = DSP_EPOINTER;
29694 DEV_GetIOMgr(hDevObject, &hIOMgr);
29695 - DBC_Assert(hIOMgr != NULL);
29697 + status = DSP_EPOINTER;
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),
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),
29717 + pMsgMgr->msgUsedList = MEM_Calloc(sizeof(struct LST_LIST),
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))
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);
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
29736 status = DSP_EMEMORY;
29742 @@ -142,8 +128,11 @@ DSP_STATUS WMD_MSG_CreateQueue(struct MS
29743 struct MSG_QUEUE *pMsgQ;
29744 DSP_STATUS status = DSP_SOK;
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;
29754 *phMsgQueue = NULL;
29755 /* Allocate MSG_QUEUE object */
29756 @@ -152,16 +141,20 @@ DSP_STATUS WMD_MSG_CreateQueue(struct MS
29757 status = DSP_EMEMORY;
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;
29774 + INIT_LIST_HEAD(&pMsgQ->msgFreeList->head);
29775 + INIT_LIST_HEAD(&pMsgQ->msgUsedList->head);
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);
29783 if (DSP_SUCCEEDED(status)) {
29784 - if (!hMsgMgr->msgFreeList) {
29785 - status = DSP_EHANDLE;
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);
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:
29802 void WMD_MSG_Delete(struct MSG_MGR *hMsgMgr)
29804 - DBC_Require(MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE));
29806 - DeleteMsgMgr(hMsgMgr);
29807 + if (MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE))
29808 + DeleteMsgMgr(hMsgMgr);
29812 @@ -237,10 +225,14 @@ void WMD_MSG_Delete(struct MSG_MGR *hMsg
29814 void WMD_MSG_DeleteQueue(struct MSG_QUEUE *hMsgQueue)
29816 - struct MSG_MGR *hMsgMgr = hMsgQueue->hMsgMgr;
29817 + struct MSG_MGR *hMsgMgr;
29820 - DBC_Require(MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE));
29821 + if (!MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE) ||
29822 + !hMsgQueue->hMsgMgr)
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
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)
29839 + if (!hMsgMgr->msgFreeList)
29841 if (LST_IsEmpty(hMsgMgr->msgFreeList))
29842 SYNC_ResetEvent(hMsgMgr->hSyncEvent);
29844 (void)SYNC_LeaveCS(hMsgMgr->hSyncCS);
29850 @@ -278,14 +272,16 @@ DSP_STATUS WMD_MSG_Get(struct MSG_QUEUE
29852 DSP_STATUS status = DSP_SOK;
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;
29861 hMsgMgr = hMsgQueue->hMsgMgr;
29862 - if (!hMsgQueue->msgUsedList) {
29863 - status = DSP_EHANDLE;
29866 + if (!hMsgQueue->msgUsedList) {
29867 + status = DSP_EHANDLE;
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);
29882 + NTFY_Notify(hMsgQueue->hNtfy,
29883 + DSP_NODEMESSAGEREADY);
29884 + SYNC_SetEvent(hMsgQueue->hSyncEvent);
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);
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);
29906 /* Exit critical section */
29907 (void)SYNC_LeaveCS(hMsgMgr->hSyncCS);
29909 @@ -371,16 +374,16 @@ DSP_STATUS WMD_MSG_Put(struct MSG_QUEUE
29911 DSP_STATUS status = DSP_SOK;
29913 - DBC_Require(MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE));
29914 - DBC_Require(pMsg != NULL);
29916 + if (!MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE) || !pMsg ||
29917 + !hMsgQueue->hMsgMgr) {
29918 + status = DSP_EMEMORY;
29921 hMsgMgr = hMsgQueue->hMsgMgr;
29923 - if (!hMsgMgr->msgFreeList) {
29924 - status = DSP_EHANDLE;
29928 + if (!hMsgMgr->msgFreeList) {
29929 + status = DSP_EHANDLE;
29933 (void) SYNC_EnterCS(hMsgMgr->hSyncCS);
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 *)
29941 + LST_PutTail(hMsgMgr->msgUsedList,
29942 + (struct list_head *)pMsgFrame);
29943 hMsgMgr->uMsgsPending++;
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,
29950 + if (DSP_FAILED(status))
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;
29959 - if (DSP_SUCCEEDED(status)) {
29960 - if (LST_IsEmpty(hMsgMgr->msgFreeList)) {
29961 - status = DSP_EPOINTER;
29964 - /* Get msg from free list */
29965 - pMsgFrame = (struct MSG_FRAME *)
29966 + if (LST_IsEmpty(hMsgMgr->msgFreeList)) {
29967 + status = DSP_EPOINTER;
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
29975 - if (pMsgFrame != NULL) {
29976 - pMsgFrame->msgData.msg = *pMsg;
29977 - pMsgFrame->msgData.dwId =
29979 - LST_PutTail(hMsgMgr->msgUsedList,
29980 - (struct LST_ELEM *)
29982 - hMsgMgr->uMsgsPending++;
29983 - /* Schedule a DPC, to do the actual
29984 - * data transfer: */
29985 - IO_Schedule(hMsgMgr->hIOMgr);
29988 + * Copy message into pMsg and put frame on the
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);
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
30007 DSP_STATUS status = DSP_SOK;
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;
30018 + if (!(uEventMask == DSP_NODEMESSAGEREADY || uEventMask == 0)) {
30019 + status = DSP_ENODETYPE;
30023 + if (uNotifyType != DSP_SIGNALEVENT) {
30024 + status = DSP_EWRONGSTATE;
30028 status = NTFY_Register(hMsgQueue->hNtfy, hNotification, uEventMask,
30030 @@ -488,7 +502,7 @@ DSP_STATUS WMD_MSG_RegisterNotify(struct
30031 * by NODE, and message ready handled by MSG. */
30039 @@ -497,9 +511,6 @@ DSP_STATUS WMD_MSG_RegisterNotify(struct
30041 void WMD_MSG_SetQueueId(struct MSG_QUEUE *hMsgQueue, u32 dwId)
30043 - DBC_Require(MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE));
30044 - /* DBC_Require(dwId != 0); */
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.
30053 - hMsgQueue->dwId = dwId;
30054 + if (MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE))
30055 + hMsgQueue->dwId = dwId;
30059 @@ -522,8 +534,8 @@ static DSP_STATUS AddNewMsg(struct LST_L
30060 pMsg = (struct MSG_FRAME *)MEM_Calloc(sizeof(struct MSG_FRAME),
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);
30068 status = DSP_EMEMORY;
30070 @@ -536,24 +548,25 @@ static DSP_STATUS AddNewMsg(struct LST_L
30072 static void DeleteMsgMgr(struct MSG_MGR *hMsgMgr)
30074 - DBC_Require(MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE));
30075 + if (!MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE))
30078 if (hMsgMgr->queueList) {
30079 - if (LST_IsEmpty(hMsgMgr->queueList)) {
30080 - LST_Delete(hMsgMgr->queueList);
30081 - hMsgMgr->queueList = NULL;
30083 + if (LST_IsEmpty(hMsgMgr->queueList)) {
30084 + MEM_Free(hMsgMgr->queueList);
30085 + hMsgMgr->queueList = NULL;
30089 - if (hMsgMgr->msgFreeList) {
30090 + if (hMsgMgr->msgFreeList) {
30091 FreeMsgList(hMsgMgr->msgFreeList);
30092 - hMsgMgr->msgFreeList = NULL;
30094 + hMsgMgr->msgFreeList = NULL;
30097 - if (hMsgMgr->msgUsedList) {
30098 + if (hMsgMgr->msgUsedList) {
30099 FreeMsgList(hMsgMgr->msgUsedList);
30100 - hMsgMgr->msgUsedList = NULL;
30102 + hMsgMgr->msgUsedList = NULL;
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);
30110 MEM_FreeObject(hMsgMgr);
30116 @@ -573,11 +588,11 @@ static void DeleteMsgQueue(struct MSG_QU
30117 struct MSG_FRAME *pMsg;
30120 - if (!MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE)
30121 - || !hMsgQueue->hMsgMgr || !hMsgQueue->hMsgMgr->msgFreeList)
30123 - hMsgMgr = hMsgQueue->hMsgMgr;
30124 + if (!MEM_IsValidHandle(hMsgQueue, MSGQ_SIGNATURE) ||
30125 + !hMsgQueue->hMsgMgr || !hMsgQueue->hMsgMgr->msgFreeList)
30128 + hMsgMgr = hMsgQueue->hMsgMgr;
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
30134 if (hMsgQueue->msgFreeList) {
30135 FreeMsgList(hMsgQueue->msgFreeList);
30136 - hMsgQueue->msgFreeList = NULL;
30137 + hMsgQueue->msgFreeList = NULL;
30140 if (hMsgQueue->msgUsedList) {
30141 FreeMsgList(hMsgQueue->msgUsedList);
30142 - hMsgQueue->msgUsedList = NULL;
30143 + hMsgQueue->msgUsedList = NULL;
30147 @@ -628,16 +643,16 @@ static void FreeMsgList(struct LST_LIST
30149 struct MSG_FRAME *pMsg;
30156 while ((pMsg = (struct MSG_FRAME *)LST_GetHead(msgList)) != NULL)
30159 DBC_Assert(LST_IsEmpty(msgList));
30161 - LST_Delete(msgList);
30162 + MEM_Free(msgList);
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
30173 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
30175 + * Processor Manager Driver for TI OMAP3430 EVM.
30177 * Copyright (C) 2005-2006 Texas Instruments, Inc.
30179 * This package is free software; you can redistribute it and/or modify
30181 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30185 - * ======== tiomap.c ========
30186 - * Processor Manager Driver for TI OMAP3430 EVM.
30188 - * Public Function:
30191 - *! Revision History:
30192 - *! ================
30193 - * 26-March-2008 HK and AL: Added WMD_DEV_WalkTbl funciton.
30196 /* ----------------------------------- Host OS */
30197 #include <dspbridge/host_os.h>
30198 #include <linux/mm.h>
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>
30206 /* ----------------------------------- DSP/BIOS Bridge */
30207 #include <dspbridge/std.h>
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>
30220 /* ------------------------------------ Hardware Abstraction Layer */
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)
30227 #define MMU_GFLUSH 0x60
30229 -extern unsigned short min_active_opp;
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,
30237 static DSP_STATUS WMD_BRD_Status(struct WMD_DEV_CONTEXT *pDevContext,
30238 - OUT BRD_STATUS *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,
30243 @@ -281,7 +265,7 @@ static inline void tlb_flush_all(const v
30244 static inline void flush_all(struct WMD_DEV_CONTEXT *pDevContext)
30246 if (pDevContext->dwBrdState == BRD_DSP_HIBERNATION ||
30247 - pDevContext->dwBrdState == BRD_HIBERNATION)
30248 + pDevContext->dwBrdState == BRD_HIBERNATION)
30249 WakeDSP(pDevContext, NULL);
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));
30261 @@ -579,12 +563,11 @@ static DSP_STATUS WMD_BRD_Start(struct W
30263 /* Enable the BIOS clock */
30264 (void)DEV_GetSymbol(pDevContext->hDevObject,
30265 - BRIDGEINIT_BIOSGPTIMER,
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);
30276 @@ -600,20 +583,18 @@ static DSP_STATUS WMD_BRD_Start(struct W
30278 extClkId = uClkCmd & MBX_PM_CLK_IDMASK;
30279 for (tmpIndex = 0; tmpIndex < MBX_PM_MAX_RESOURCES;
30282 if (extClkId == BPWR_CLKID[tmpIndex]) {
30283 clkIdIndex = tmpIndex;
30288 - if (clkIdIndex < MBX_PM_MAX_RESOURCES)
30289 - status = CLK_Set_32KHz(
30290 - BPWR_Clks[clkIdIndex].funClk);
30292 + if (clkIdIndex < MBX_PM_MAX_RESOURCES) {
30294 + CLK_Set_32KHz(BPWR_Clks[clkIdIndex].funClk);
30296 status = DSP_EFAIL;
30298 - if (DSP_FAILED(status)) {
30299 DBG_Trace(DBG_LEVEL7, " Error while setting"
30300 "LM Timer to 32KHz\n");
30302 @@ -649,13 +630,11 @@ static DSP_STATUS WMD_BRD_Start(struct W
30306 - if (clkIdIndex < MBX_PM_MAX_RESOURCES)
30307 + if (clkIdIndex < MBX_PM_MAX_RESOURCES) {
30308 status = CLK_Set_32KHz(
30309 BPWR_Clks[clkIdIndex].funClk);
30312 status = DSP_EFAIL;
30314 - if (DSP_FAILED(status)) {
30315 DBG_Trace(DBG_LEVEL7,
30316 " Error while setting BIOS Timer to 32KHz\n");
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);
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",
30328 @@ -754,10 +731,8 @@ static DSP_STATUS WMD_BRD_Start(struct W
30331 while (*((volatile u16 *)dwSyncAddr))
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
30343 *((volatile u32 *)dwSyncAddr) = 0XCAFECAFE;
30345 - if (DSP_SUCCEEDED(status)) {
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);
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);
30366 @@ -950,7 +926,7 @@ static DSP_STATUS WMD_BRD_Delete(struct
30367 * Returns the board status.
30369 static DSP_STATUS WMD_BRD_Status(struct WMD_DEV_CONTEXT *hDevContext,
30370 - OUT BRD_STATUS *pdwState)
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;
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 *)
30391 + /* It should never happen */
30392 + if (!hDevContext)
30393 + return DSP_EHANDLE;
30395 DBG_Trace(DBG_ENTER, "Entering WMD_DEV_Destroy:n hDevContext ::0x%x\n",
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;
30410 + u32 numUsrPgs = 0;
30411 + struct page *mappedPage, *pg;
30413 u32 va = ulVirtAddr;
30414 + struct task_struct *curr_task = current;
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
30424 - numUsrPgs = PAGE_ALIGN(ulNumBytes) / PG_SIZE_4K;
30426 - DBG_Trace(DBG_LEVEL4, "%s :numOfActualTabEntries=%d, ulNumBytes= %d\n",
30427 - %s, numUsrPgs, ulNumBytes);
30429 - if (vma->vm_flags & (VM_IO | VM_PFNMAP | VM_RESERVED)) {
30430 - for (nr_pages = numUsrPgs; nr_pages > 0;) {
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);
30443 status = DSP_EFAIL;
30444 pr_err("DSPBRIDGE: VM_IO mapping physical"
30445 - "address is invalid\n");
30446 + "address is invalid\n");
30450 + if (pfn_valid(__phys_to_pfn(pa))) {
30451 + pg = phys_to_page(pa);
30453 + if (page_count(pg) < 1) {
30454 + pr_err("Bad page in VM_IO buffer\n");
30455 + bad_page_dump(pa, pg);
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"
30464 + "WMD_BRD_MemMap: FAILED IN VM_IO"
30469 va += HW_PAGE_SIZE_4KB;
30470 - ulMpuAddr += HW_PAGE_SIZE_4KB;
30472 + mpuAddr += HW_PAGE_SIZE_4KB;
30473 + pa += HW_PAGE_SIZE_4KB;
30478 + numUsrPgs = ulNumBytes / PG_SIZE_4K;
30479 if (vma->vm_flags & (VM_WRITE | VM_MAYWRITE))
30482 - for (nr_pages = numUsrPgs; nr_pages > 0;) {
30484 - struct page *pages[16]; /* for a reasonable batch */
30486 - ret = get_user_pages(current, mm, ulMpuAddr,
30487 - min_t(int, nr_pages, ARRAY_SIZE(pages)),
30488 - write, 1, pages, NULL);
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,
30497 - status = DSP_EFAIL;
30498 - goto fail_mapping;
30501 - for (i = 0; i < ret; i++) {
30502 - struct page *page = pages[i];
30504 + for (pgI = 0; pgI < numUsrPgs; pgI++) {
30505 + pgNum = get_user_pages(curr_task, mm, ulMpuAddr, 1,
30506 + write, 1, &mappedPage, NULL);
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),
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",
30523 - goto fail_mapping;
30524 + DBG_Trace(DBG_LEVEL7,
30525 + "WMD_BRD_MemMap: FAILED IN PTESET \n");
30528 - SetPageMlocked(page);
30529 va += HW_PAGE_SIZE_4KB;
30530 ulMpuAddr += HW_PAGE_SIZE_4KB;
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,
30541 + status = DSP_EFAIL;
30548 up_read(&mm->mmap_sem);
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
30555 - if (numUsrPgs - nr_pages) {
30557 WMD_BRD_MemUnMap(pDevContext, ulVirtAddr,
30558 - ((numUsrPgs - nr_pages) * PG_SIZE_4K));
30559 + (pgI * PG_SIZE_4K));
30561 status = DSP_EFAIL;
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);
30568 + SetPageDirty(pg);
30569 + page_cache_release(pg);
30571 - ClearPageMlocked(pg);
30572 - SetPageDirty(pg);
30573 - page_cache_release(pg);
30574 pAddr += HW_PAGE_SIZE_4KB;
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);
30582 + SetPageDirty(pg);
30583 + page_cache_release(pg);
30585 - ClearPageMlocked(pg);
30586 - SetPageDirty(pg);
30587 - page_cache_release(pg);
30589 pAddr += HW_PAGE_SIZE_4KB;
30591 @@ -2052,9 +2038,7 @@ void configureDspMmu(struct WMD_DEV_CONT
30592 enum HW_ElementSize_t elemSize,
30593 enum HW_MMUMixedSize_t mixedSize)
30595 - struct CFG_HOSTRES resources;
30596 struct HW_MMUMapAttrs_t mapAttrs = { endianism, elemSize, mixedSize };
30597 - DSP_STATUS status = DSP_SOK;
30599 DBC_Require(sizeInBytes > 0);
30600 DBG_Trace(DBG_LEVEL1,
30601 @@ -2063,9 +2047,8 @@ void configureDspMmu(struct WMD_DEV_CONT
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,
30609 + HW_MMU_TLBAdd(pDevContext->dwDSPMmuBase, dataBasePhys,
30610 dspBaseVirt, sizeInBytes, nEntryStart,
30611 &mapAttrs, HW_SET, HW_SET);
30613 @@ -2076,14 +2059,14 @@ void configureDspMmu(struct WMD_DEV_CONT
30615 bool WaitForStart(struct WMD_DEV_CONTEXT *pDevContext, u32 dwSyncAddr)
30617 - u16 usCount = TIHELEN_ACKTIMEOUT;
30618 + u16 timeout = TIHELEN_ACKTIMEOUT;
30620 /* Wait for response from board */
30621 - while (*((volatile u16 *)dwSyncAddr) && --usCount)
30622 + while (*((volatile u16 *)dwSyncAddr) && --timeout)
30625 /* If timed out: return FALSE */
30628 DBG_Trace(DBG_LEVEL7, "Timed out Waiting for DSP to Start\n");
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
30636 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
30638 + * Implementation of DSP wake/sleep routines.
30640 * Copyright (C) 2007-2008 Texas Instruments, Inc.
30642 * This package is free software; you can redistribute it and/or modify
30644 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30648 - * ======== _tiomap_pwr.c ========
30650 - * Implementation of DSP wake/sleep routines.
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
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.
30662 /* ----------------------------------- DSP/BIOS Bridge */
30663 #include <dspbridge/dbdefs.h>
30664 #include <dspbridge/errbase.h>
30667 /* ----------------------------------- OS Adaptation Layer */
30668 #include <dspbridge/mem.h>
30669 -#include <dspbridge/util.h>
30671 /* ----------------------------------- Platform Manager */
30672 #include <dspbridge/brddefs.h>
30673 @@ -68,11 +54,10 @@
30674 #include <mach-omap2/cm-regbits-34xx.h>
30677 -#include <mach/board-3430sdp.h>
30678 +extern s32 dsp_test_sleepstate;
30680 extern struct MAILBOX_CONTEXT mboxsetting;
30681 -extern unsigned short enable_off_mode;
30682 -extern unsigned short min_active_opp;
30685 * ======== handle_constraints_set ========
30686 * Sets new DSP constraint
30687 @@ -81,33 +66,18 @@ DSP_STATUS handle_constraints_set(struct
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);
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));
30708 /* Set the new opp value */
30709 - if (pdata->dsp_set_min_opp) {
30711 - * When Smartreflex is ON, DSP requires at least OPP level 3
30712 - * to operate reliably. So boost lower OPP levels to OPP3.
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);
30719 - (*pdata->dsp_set_min_opp)(pConstraintVal);
30721 + if (pdata->dsp_set_min_opp)
30722 + (*pdata->dsp_set_min_opp)((u32)*(pConstraintVal+1));
30723 #endif /* #ifdef CONFIG_BRIDGE_DVFS */
30726 @@ -120,7 +90,7 @@ DSP_STATUS handle_hibernation_fromDSP(st
30728 DSP_STATUS status = DSP_SOK;
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
30737 HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
30739 - /* Wait for DSP to move into Off state, how much time should
30741 - while ((pwrState != HW_PWR_STATE_OFF) && --usCount) {
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;
30749 HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
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;
30757 @@ -202,8 +174,10 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTE
30758 DSP_STATUS status = DSP_SOK;
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;
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) {
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
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,
30792 - * Wait for DSP to move into Standby state, how much time
30793 - * should we wait?
30795 - while ((pwrState != targetPwrState) && --usCount) {
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;
30803 HW_PWR_IVA2StateGet(resources.dwPrmBase, HW_PWR_DOMAIN_DSP,
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;
30817 DBG_Trace(DBG_LEVEL7, "SleepDSP: DSP STANDBY Pwr state %x \n",
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;
30825 pDevContext->dwBrdState = BRD_RETENTION;
30826 @@ -319,8 +295,8 @@ DSP_STATUS SleepDSP(struct WMD_DEV_CONTE
30828 DSP_STATUS WakeDSP(struct WMD_DEV_CONTEXT *pDevContext, IN void *pArgs)
30831 DSP_STATUS status = DSP_SOK;
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;
30843 DBG_Trace(DBG_ENTER, "Entering DSPPeripheralClkCtrl \n");
30844 dspPerClksBefore = pDevContext->uDspPerClks;
30845 @@ -379,6 +357,13 @@ DSP_STATUS DSPPeripheralClkCtrl(struct W
30847 extClk = (u32)*((u32 *)pArgs);
30849 + status = CFG_GetHostResources(
30850 + (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
30853 + if (DSP_FAILED(status))
30854 + return DSP_EFAIL;
30856 DBG_Trace(DBG_LEVEL3, "DSPPeripheralClkCtrl : extClk+Cmd = 0x%x \n",
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);
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);
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);
30890 + __raw_writel(value, resources.dwSysCtrlBase + 0x274);
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
30897 DSP_STATUS PostScale_DSP(struct WMD_DEV_CONTEXT *pDevContext, IN void *pArgs)
30899 + DSP_STATUS status = DSP_SOK;
30900 #ifdef CONFIG_BRIDGE_DVFS
30902 u32 voltage_domain;
30903 struct IO_MGR *hIOMgr;
30904 - DSP_STATUS status = DSP_SOK;
30906 status = DEV_GetIOMgr(pDevContext->hDevObject, &hIOMgr);
30908 + return DSP_EHANDLE;
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 "
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");
30926 DBG_Trace(DBG_LEVEL7, "PostScale_DSP: Failed - DSP BRD state "
30928 - return DSP_EFAIL;
30929 + status = DSP_EFAIL;
30931 #endif /* #ifdef CONFIG_BRIDGE_DVFS */
30937 @@ -532,14 +539,34 @@ DSP_STATUS PostScale_DSP(struct WMD_DEV_
30938 DSP_STATUS DSP_PeripheralClocks_Disable(struct WMD_DEV_CONTEXT *pDevContext,
30943 DSP_STATUS status = DSP_SOK;
30944 + struct CFG_HOSTRES resources;
30947 + status = CFG_GetHostResources(
30948 + (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
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
30959 + value &= ~(1 << 2);
30960 + __raw_writel(value, resources.dwSysCtrlBase
30962 + } else if (BPWR_CLKID[clkIdx] == BPWR_MCBSP2) {
30963 + /* clear MCBSP2_CLKS, on McBSP2 OFF */
30964 + value = __raw_readl(resources.dwSysCtrlBase
30966 + value &= ~(1 << 6);
30967 + __raw_writel(value, resources.dwSysCtrlBase
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
30976 DSP_STATUS int_clk_status = DSP_EFAIL, fun_clk_status = DSP_EFAIL;
30977 + struct CFG_HOSTRES resources;
30980 + CFG_GetHostResources((struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
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
30992 + __raw_writel(value, resources.dwSysCtrlBase
30994 + } else if (BPWR_CLKID[clkIdx] == BPWR_MCBSP2) {
30995 + /* set MCBSP2_CLKS, on McBSP2 ON */
30996 + value = __raw_readl(resources.dwSysCtrlBase
30999 + __raw_writel(value, resources.dwSysCtrlBase
31002 /* Enable the functional clock of the periphearl */
31003 fun_clk_status = CLK_Enable(BPWR_Clks[clkIdx].funClk);
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
31010 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
31012 + * Implementation for the io read/write routines.
31014 * Copyright (C) 2005-2006 Texas Instruments, Inc.
31016 * This package is free software; you can redistribute it and/or modify
31018 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
31023 - * ======== _tiomap_io.c ========
31025 - * Implementation for the io read/write routines.
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.
31036 /* ----------------------------------- DSP/BIOS Bridge */
31037 #include <dspbridge/dbdefs.h>
31038 #include <dspbridge/errbase.h>
31041 /* ----------------------------------- OS Adaptation Layer */
31042 #include <dspbridge/mem.h>
31043 -#include <dspbridge/util.h>
31044 #include <dspbridge/cfg.h>
31046 /* ----------------------------------- specific to this file */
31047 @@ -92,7 +78,7 @@ DSP_STATUS ReadExtDspData(struct WMD_DEV
31048 DBC_Assert(ulShmBaseVirt != 0);
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);
31056 @@ -114,7 +100,7 @@ DSP_STATUS ReadExtDspData(struct WMD_DEV
31059 /* If reading from TRACE, force remap/unmap */
31060 - if ((bTraceRead) && dwBaseAddr) {
31061 + if (bTraceRead && dwBaseAddr) {
31063 pDevContext->dwDspExtBaseAddr = 0;
31065 @@ -226,6 +212,9 @@ DSP_STATUS WriteDspData(struct WMD_DEV_C
31066 status = CFG_GetHostResources(
31067 (struct CFG_DEVNODE *)DRV_GetFirstDevExtension(), &resources);
31069 + if (DSP_FAILED(status))
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;
31079 - status = DSP_EFAIL;
31081 + return DSP_EFAIL;
31084 memcpy((u8 *) (dwBaseAddr+offset), pbHostBuf, ulNumBytes);
31085 @@ -378,9 +366,8 @@ DSP_STATUS WriteExtDspData(struct WMD_DE
31088 pDevContext->dwDspExtBaseAddr =
31089 - (u32)MEM_LinearAddress((void *)
31090 - TO_VIRTUAL_UNCACHED(dwExtProgVirtMem), ulExtEnd
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
31102 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
31104 + * Definitions, types and function prototypes for the io (r/w external mem).
31106 * Copyright (C) 2005-2006 Texas Instruments, Inc.
31108 * This package is free software; you can redistribute it and/or modify
31110 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
31115 - * ======== _tiomap_io.h ========
31117 - * Definitions, types and function prototypes for the io
31118 - * (r/w external mem).
31120 - *! Revision History
31121 - *! ================
31122 - *! 08-Oct-2002 rr: Created.
31125 #ifndef _TIOMAP_IO_
31126 #define _TIOMAP_IO_
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
31133 #define MAILBOX_FIFOSTATUS(m) (0x80 + 4 * (m))
31135 -extern unsigned short min_active_opp;
31137 static inline unsigned int fifo_full(void __iomem *mbox_base, int mbox_id)
31139 return __raw_readl(mbox_base + MAILBOX_FIFOSTATUS(mbox_id)) & 0x1;
31140 @@ -42,7 +40,6 @@ DSP_STATUS CHNLSM_EnableInterrupt(struct
31142 struct CFG_HOSTRES resources;
31144 - struct IO_MGR *hIOMgr;
31146 DBG_Trace(DBG_ENTER, "CHNLSM_EnableInterrupt(0x%x)\n", pDevContext);
31148 @@ -51,7 +48,6 @@ DSP_STATUS CHNLSM_EnableInterrupt(struct
31149 CFG_GetHostResources((struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
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,
31160 +#ifdef CONFIG_BRIDGE_DVFS
31161 + struct dspbridge_platform_data *pdata =
31162 + omap_dspbridge_dev->dev.platform_data;
31163 + u32 opplevel = 0;
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;
31175 - * When Smartreflex is ON, DSP requires at least OPP level 3
31176 - * to operate reliably. So boost lower OPP levels to OPP3.
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);
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;
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.
31200 /* Restore mailbox settings */
31201 HW_MBOX_restoreSettings(resources.dwMboxBase);
31203 @@ -154,6 +146,9 @@ DSP_STATUS CHNLSM_InterruptDSP2(struct W
31204 temp = *(REG_UWORD32 *)(resources.dwDmmuBase + 0x10);
31206 pDevContext->dwBrdState = BRD_RUNNING;
31207 + } else if (pDevContext->dwBrdState == BRD_RETENTION) {
31208 + /* Restart the peripheral clocks */
31209 + DSP_PeripheralClocks_Enable(pDevContext, NULL);
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
31218 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
31220 + * Implements upper edge DSP exception handling (DEH) functions.
31222 * Copyright (C) 2005-2006 Texas Instruments, Inc.
31224 * This package is free software; you can redistribute it and/or modify
31226 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
31231 - * ======== ue_deh.c ========
31233 - * Implements upper edge DSP exception handling (DEH) functions.
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.
31246 /* ----------------------------------- Host OS */
31247 #include <dspbridge/host_os.h>
31250 #include <dspbridge/dbg.h>
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;
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);
31267 + /* Create a MMUfault DPC */
31268 + tasklet_init(&pDehMgr->dpc_tasklet, MMU_FaultDpc, (u32)pDehMgr);
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);
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;
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;
31289 + status = DSP_EFAIL;
31292 if (DSP_FAILED(status)) {
31293 @@ -136,8 +118,7 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH
31296 *phDehMgr = (struct DEH_MGR *)pDehMgr;
31297 - DBG_Trace(DBG_LEVEL1, "ISR_IRQ Object 0x%x \n",
31299 + DBG_Trace(DBG_LEVEL1, "ISR_IRQ Object 0x%x \n", pDehMgr);
31301 DBG_Trace(DBG_LEVEL1, "Exiting DEH_Create.\n");
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);
31311 + /* Free DPC object */
31312 + tasklet_kill(&pDehMgr->dpc_tasklet);
31313 + DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
31315 /* Deallocate the DEH manager object */
31316 MEM_FreeObject(pDehMgr);
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);
31330 +#ifdef CONFIG_BRIDGE_NTFY_PWRERR
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);
31338 +#endif /* CONFIG_BRIDGE_NTFY_PWRERR */
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
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;
31353 - /* Filter subsequent notifications when an error occurs */
31354 if (pDevContext->dwBrdState != BRD_ERROR)
31355 - status1 = DSP_SOK;
31356 + NTFY_Notify(pDehMgr->hNtfy, ulEventMask);
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);
31364 - if (DSP_SUCCEEDED(status1)) {
31365 - /* Signal DSP error/exception event. */
31366 - NTFY_Notify(pDehMgr->hNtfy, ulEventMask);
31370 DBG_Trace(DBG_LEVEL1, "Exiting WMD_DEH_Notify\n");
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;
31377 + status = DSP_EHANDLE;
31380 DBG_Trace(DBG_LEVEL1, "Exiting WMD_DEH_GetInfo\n");