staging: add ti dspbridge driver
cover staging: add ti dspbridge driver
Add TI's DSP Bridge driver to the staging area.
TI's DSP Bridge driver supplies a direct link between host applications and DSP tasks running on a remote processor.
Please pull from:
git://wizery.com/pub/tidspbridge.git for-greg
The patches will be sent as a follow-on to this message to lkml and l-o for people to see.
The patches are the result of a staging relocation and a linux-next rebase of 85343cd5491260881b34ab7bb7cdc8fdeef078e4 atgit://dev.omapzoom.org/pub/scm/tidspbridge/kernel-dspbridge.git dspbridge
For more information about TI's DSP Bridge, check out the submitted documentation and also:
http://omapzoom.org/gf/project/omapbridge/docman/?subdir=3
The DSP/Bridge project wish to thank all of its contributors; current bridge driver is the result of the work of all of them.
The following is an alphabetical order of all contributors (that we know of. If by any chance we forgot to mention anyone, please let us know, thanks!):
Suman Anna
Sripal Bagadia
Felipe Balbi
Ohad Ben-Cohen
Phil Carmody
Deepak Chitriki
Felipe Contreras
Hiroshi Doyu
Seth Forshee
Ivan Gomez Castellanos
Mark Grosen
Ramesh Gupta G
Fernando Guzman Lugo
Axel Haslam
Janet Head
Shivananda Hebbar
Hari Kanigeri
Tony Lindgren
Antonio Luna
Hari Nagalla
Nishanth Menon
Ameya Palande
Vijay Pasam
Gilbert Pitney
Omar Ramirez Luna
Ernesto Ramos
Chris Ring
Larry Schiefer
Rebecca Schultz Zavin
Bhavin Shah
Andy Shevchenko
Jeff Taylor
Roman Tereshonkov
Armando Uribe de Leon
Nischal Varide
Wenbiao Wang
Thanks,
Ohad Ben-Cohen (1):
staging: ti dspbridge: add TODO file
Omar Ramirez Luna (10):
staging: ti dspbridge: add driver documentation
staging: ti dspbridge: add core driver sources
staging: ti dspbridge: add platform manager code
staging: ti dspbridge: add resource manager
staging: ti dspbridge: add MMU support
staging: ti dspbridge: add generic utilities
staging: ti dspbridge: add services
staging: ti dspbridge: add DOFF binaries loader
staging: ti dspbridge: add header files
staging: ti dspbridge: enable driver building
drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + .../staging/tidspbridge/Documentation/CONTRIBUTORS | 82 + drivers/staging/tidspbridge/Documentation/README | 70 + .../staging/tidspbridge/Documentation/error-codes | 157 + drivers/staging/tidspbridge/Kconfig | 88 + drivers/staging/tidspbridge/Makefile | 34 + drivers/staging/tidspbridge/TODO | 18 + drivers/staging/tidspbridge/core/_cmm.h | 45 + drivers/staging/tidspbridge/core/_deh.h | 35 + drivers/staging/tidspbridge/core/_msg_sm.h | 142 + drivers/staging/tidspbridge/core/_tiomap.h | 377 +++ drivers/staging/tidspbridge/core/_tiomap_pwr.h | 85 + drivers/staging/tidspbridge/core/chnl_sm.c | 1015 ++++++ drivers/staging/tidspbridge/core/dsp-clock.c | 421 +++ drivers/staging/tidspbridge/core/io_sm.c | 2410 +++++++++++++++ drivers/staging/tidspbridge/core/mmu_fault.c | 139 + drivers/staging/tidspbridge/core/mmu_fault.h | 36 + drivers/staging/tidspbridge/core/msg_sm.c | 673 ++++ drivers/staging/tidspbridge/core/tiomap3430.c | 1887 ++++++++++++ drivers/staging/tidspbridge/core/tiomap3430_pwr.c | 604 ++++ drivers/staging/tidspbridge/core/tiomap_io.c | 458 +++ drivers/staging/tidspbridge/core/tiomap_io.h | 104 + drivers/staging/tidspbridge/core/ue_deh.c | 303 ++ drivers/staging/tidspbridge/core/wdt.c | 150 + drivers/staging/tidspbridge/dynload/cload.c | 1960 ++++++++++++ .../staging/tidspbridge/dynload/dload_internal.h | 351 +++ drivers/staging/tidspbridge/dynload/doff.h | 344 +++ drivers/staging/tidspbridge/dynload/getsection.c | 416 +++ drivers/staging/tidspbridge/dynload/header.h | 55 + drivers/staging/tidspbridge/dynload/module_list.h | 159 + drivers/staging/tidspbridge/dynload/params.h | 226 ++ drivers/staging/tidspbridge/dynload/reloc.c | 484 +++ drivers/staging/tidspbridge/dynload/reloc_table.h | 102 + .../tidspbridge/dynload/reloc_table_c6000.c | 257 ++ drivers/staging/tidspbridge/dynload/tramp.c | 1143 +++++++ .../tidspbridge/dynload/tramp_table_c6000.c | 164 + drivers/staging/tidspbridge/gen/gb.c | 167 + drivers/staging/tidspbridge/gen/gh.c | 213 ++ drivers/staging/tidspbridge/gen/gs.c | 89 + drivers/staging/tidspbridge/gen/uuidutil.c | 223 ++ drivers/staging/tidspbridge/hw/EasiGlobal.h | 41 + drivers/staging/tidspbridge/hw/GlobalTypes.h | 308 ++ drivers/staging/tidspbridge/hw/MMUAccInt.h | 76 + drivers/staging/tidspbridge/hw/MMURegAcM.h | 226 ++ drivers/staging/tidspbridge/hw/hw_defs.h | 60 + drivers/staging/tidspbridge/hw/hw_mmu.c | 587 ++++ drivers/staging/tidspbridge/hw/hw_mmu.h | 161 + .../tidspbridge/include/dspbridge/_chnl_sm.h | 181 ++ .../tidspbridge/include/dspbridge/brddefs.h | 39 + .../staging/tidspbridge/include/dspbridge/cfg.h | 222 ++ .../tidspbridge/include/dspbridge/cfgdefs.h | 81 + .../staging/tidspbridge/include/dspbridge/chnl.h | 130 + .../tidspbridge/include/dspbridge/chnldefs.h | 67 + .../tidspbridge/include/dspbridge/chnlpriv.h | 101 + .../staging/tidspbridge/include/dspbridge/clk.h | 101 + .../staging/tidspbridge/include/dspbridge/cmm.h | 386 +++ .../tidspbridge/include/dspbridge/cmmdefs.h | 105 + .../staging/tidspbridge/include/dspbridge/cod.h | 369 +++ .../staging/tidspbridge/include/dspbridge/dbc.h | 46 + .../staging/tidspbridge/include/dspbridge/dbdcd.h | 358 +++ .../tidspbridge/include/dspbridge/dbdcddef.h | 78 + .../staging/tidspbridge/include/dspbridge/dbdefs.h | 546 ++++ .../tidspbridge/include/dspbridge/dbldefs.h | 140 + .../staging/tidspbridge/include/dspbridge/dbll.h | 59 + .../tidspbridge/include/dspbridge/dblldefs.h | 496 +++ .../staging/tidspbridge/include/dspbridge/dbtype.h | 88 + .../tidspbridge/include/dspbridge/dehdefs.h | 32 + .../staging/tidspbridge/include/dspbridge/dev.h | 702 +++++ .../tidspbridge/include/dspbridge/devdefs.h | 26 + .../staging/tidspbridge/include/dspbridge/disp.h | 204 ++ .../tidspbridge/include/dspbridge/dispdefs.h | 35 + .../staging/tidspbridge/include/dspbridge/dmm.h | 75 + .../staging/tidspbridge/include/dspbridge/drv.h | 522 ++++ .../tidspbridge/include/dspbridge/drvdefs.h | 25 + .../tidspbridge/include/dspbridge/dspapi-ioctl.h | 475 +++ .../staging/tidspbridge/include/dspbridge/dspapi.h | 167 + .../tidspbridge/include/dspbridge/dspchnl.h | 72 + .../tidspbridge/include/dspbridge/dspdefs.h | 1128 +++++++ .../staging/tidspbridge/include/dspbridge/dspdeh.h | 47 + .../staging/tidspbridge/include/dspbridge/dspdrv.h | 62 + .../staging/tidspbridge/include/dspbridge/dspio.h | 41 + .../tidspbridge/include/dspbridge/dspioctl.h | 73 + .../staging/tidspbridge/include/dspbridge/dspmsg.h | 56 + .../tidspbridge/include/dspbridge/dynamic_loader.h | 492 +++ drivers/staging/tidspbridge/include/dspbridge/gb.h | 79 + .../tidspbridge/include/dspbridge/getsection.h | 108 + drivers/staging/tidspbridge/include/dspbridge/gh.h | 32 + drivers/staging/tidspbridge/include/dspbridge/gs.h | 59 + .../tidspbridge/include/dspbridge/host_os.h | 89 + drivers/staging/tidspbridge/include/dspbridge/io.h | 114 + .../staging/tidspbridge/include/dspbridge/io_sm.h | 309 ++ .../staging/tidspbridge/include/dspbridge/iodefs.h | 36 + .../staging/tidspbridge/include/dspbridge/ldr.h | 29 + .../staging/tidspbridge/include/dspbridge/list.h | 225 ++ .../staging/tidspbridge/include/dspbridge/mbx_sh.h | 198 ++ .../tidspbridge/include/dspbridge/memdefs.h | 30 + .../staging/tidspbridge/include/dspbridge/mgr.h | 205 ++ .../tidspbridge/include/dspbridge/mgrpriv.h | 45 + .../staging/tidspbridge/include/dspbridge/msg.h | 86 + .../tidspbridge/include/dspbridge/msgdefs.h | 29 + .../staging/tidspbridge/include/dspbridge/nldr.h | 55 + .../tidspbridge/include/dspbridge/nldrdefs.h | 293 ++ .../staging/tidspbridge/include/dspbridge/node.h | 579 ++++ .../tidspbridge/include/dspbridge/nodedefs.h | 28 + .../tidspbridge/include/dspbridge/nodepriv.h | 182 ++ .../staging/tidspbridge/include/dspbridge/ntfy.h | 217 ++ .../staging/tidspbridge/include/dspbridge/proc.h | 621 ++++ .../tidspbridge/include/dspbridge/procpriv.h | 25 + .../staging/tidspbridge/include/dspbridge/pwr.h | 107 + .../staging/tidspbridge/include/dspbridge/pwr_sh.h | 33 + .../include/dspbridge/resourcecleanup.h | 63 + .../staging/tidspbridge/include/dspbridge/rmm.h | 181 ++ .../staging/tidspbridge/include/dspbridge/rms_sh.h | 95 + .../tidspbridge/include/dspbridge/rmstypes.h | 28 + .../tidspbridge/include/dspbridge/services.h | 50 + .../staging/tidspbridge/include/dspbridge/std.h | 94 + .../staging/tidspbridge/include/dspbridge/strm.h | 404 +++ .../tidspbridge/include/dspbridge/strmdefs.h | 46 + .../staging/tidspbridge/include/dspbridge/sync.h | 109 + .../tidspbridge/include/dspbridge/utildefs.h | 39 + .../tidspbridge/include/dspbridge/uuidutil.h | 62 + .../staging/tidspbridge/include/dspbridge/wdt.h | 79 + drivers/staging/tidspbridge/pmgr/chnl.c | 163 + drivers/staging/tidspbridge/pmgr/chnlobj.h | 46 + drivers/staging/tidspbridge/pmgr/cmm.c | 1172 +++++++ drivers/staging/tidspbridge/pmgr/cod.c | 658 ++++ drivers/staging/tidspbridge/pmgr/dbll.c | 1585 ++++++++++ drivers/staging/tidspbridge/pmgr/dev.c | 1171 +++++++ drivers/staging/tidspbridge/pmgr/dmm.c | 533 ++++ drivers/staging/tidspbridge/pmgr/dspapi.c | 1685 ++++++++++ drivers/staging/tidspbridge/pmgr/io.c | 142 + drivers/staging/tidspbridge/pmgr/ioobj.h | 38 + drivers/staging/tidspbridge/pmgr/msg.c | 129 + drivers/staging/tidspbridge/pmgr/msgobj.h | 38 + drivers/staging/tidspbridge/rmgr/dbdcd.c | 1506 +++++++++ drivers/staging/tidspbridge/rmgr/disp.c | 754 +++++ drivers/staging/tidspbridge/rmgr/drv.c | 1047 +++++++ drivers/staging/tidspbridge/rmgr/drv_interface.c | 644 ++++ drivers/staging/tidspbridge/rmgr/drv_interface.h | 27 + drivers/staging/tidspbridge/rmgr/dspdrv.c | 142 + drivers/staging/tidspbridge/rmgr/mgr.c | 374 +++ drivers/staging/tidspbridge/rmgr/nldr.c | 1999 ++++++++++++ drivers/staging/tidspbridge/rmgr/node.c | 3231 ++++++++++++++++++++ drivers/staging/tidspbridge/rmgr/proc.c | 1948 ++++++++++++ drivers/staging/tidspbridge/rmgr/pwr.c | 182 ++ drivers/staging/tidspbridge/rmgr/rmm.c | 535 ++++ drivers/staging/tidspbridge/rmgr/strm.c | 861 ++++++ drivers/staging/tidspbridge/services/cfg.c | 253 ++ drivers/staging/tidspbridge/services/ntfy.c | 31 + drivers/staging/tidspbridge/services/services.c | 69 + drivers/staging/tidspbridge/services/sync.c | 104 + 152 files changed, 51105 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/Documentation/CONTRIBUTORS create mode 100644 drivers/staging/tidspbridge/Documentation/README create mode 100644 drivers/staging/tidspbridge/Documentation/error-codes create mode 100644 drivers/staging/tidspbridge/Kconfig create mode 100644 drivers/staging/tidspbridge/Makefile create mode 100644 drivers/staging/tidspbridge/TODO create mode 100644 drivers/staging/tidspbridge/core/_cmm.h create mode 100644 drivers/staging/tidspbridge/core/_deh.h create mode 100644 drivers/staging/tidspbridge/core/_msg_sm.h create mode 100644 drivers/staging/tidspbridge/core/_tiomap.h create mode 100644 drivers/staging/tidspbridge/core/_tiomap_pwr.h create mode 100644 drivers/staging/tidspbridge/core/chnl_sm.c create mode 100644 drivers/staging/tidspbridge/core/dsp-clock.c create mode 100644 drivers/staging/tidspbridge/core/io_sm.c create mode 100644 drivers/staging/tidspbridge/core/mmu_fault.c create mode 100644 drivers/staging/tidspbridge/core/mmu_fault.h create mode 100644 drivers/staging/tidspbridge/core/msg_sm.c create mode 100644 drivers/staging/tidspbridge/core/tiomap3430.c create mode 100644 drivers/staging/tidspbridge/core/tiomap3430_pwr.c create mode 100644 drivers/staging/tidspbridge/core/tiomap_io.c create mode 100644 drivers/staging/tidspbridge/core/tiomap_io.h create mode 100644 drivers/staging/tidspbridge/core/ue_deh.c create mode 100644 drivers/staging/tidspbridge/core/wdt.c create mode 100644 drivers/staging/tidspbridge/dynload/cload.c create mode 100644 drivers/staging/tidspbridge/dynload/dload_internal.h create mode 100644 drivers/staging/tidspbridge/dynload/doff.h create mode 100644 drivers/staging/tidspbridge/dynload/getsection.c create mode 100644 drivers/staging/tidspbridge/dynload/header.h create mode 100644 drivers/staging/tidspbridge/dynload/module_list.h create mode 100644 drivers/staging/tidspbridge/dynload/params.h create mode 100644 drivers/staging/tidspbridge/dynload/reloc.c create mode 100644 drivers/staging/tidspbridge/dynload/reloc_table.h create mode 100644 drivers/staging/tidspbridge/dynload/reloc_table_c6000.c create mode 100644 drivers/staging/tidspbridge/dynload/tramp.c create mode 100644 drivers/staging/tidspbridge/dynload/tramp_table_c6000.c create mode 100644 drivers/staging/tidspbridge/gen/gb.c create mode 100644 drivers/staging/tidspbridge/gen/gh.c create mode 100644 drivers/staging/tidspbridge/gen/gs.c create mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c create mode 100644 drivers/staging/tidspbridge/hw/EasiGlobal.h create mode 100644 drivers/staging/tidspbridge/hw/GlobalTypes.h create mode 100644 drivers/staging/tidspbridge/hw/MMUAccInt.h create mode 100644 drivers/staging/tidspbridge/hw/MMURegAcM.h create mode 100644 drivers/staging/tidspbridge/hw/hw_defs.h create mode 100644 drivers/staging/tidspbridge/hw/hw_mmu.c create mode 100644 drivers/staging/tidspbridge/hw/hw_mmu.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/_chnl_sm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/brddefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/cfg.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/chnl.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/chnldefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/chnlpriv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/clk.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/cmm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/cmmdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/cod.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbc.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbdcd.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbdcddef.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbldefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbll.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dblldefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbtype.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dehdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dev.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/devdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/disp.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dispdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dmm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/drv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/drvdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspapi-ioctl.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspapi.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspchnl.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspdeh.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspdrv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspio.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspioctl.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspmsg.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dynamic_loader.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/gb.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/getsection.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/gh.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/gs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/host_os.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/io.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/io_sm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/iodefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/ldr.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/list.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/mbx_sh.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/memdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/mgr.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/mgrpriv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/msg.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/msgdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/nldr.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/nldrdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/node.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/nodedefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/nodepriv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/ntfy.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/proc.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/procpriv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/pwr.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/pwr_sh.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/resourcecleanup.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/rmm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/rms_sh.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/rmstypes.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/services.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/std.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/strm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/strmdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/sync.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/utildefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/uuidutil.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/wdt.h create mode 100644 drivers/staging/tidspbridge/pmgr/chnl.c create mode 100644 drivers/staging/tidspbridge/pmgr/chnlobj.h create mode 100644 drivers/staging/tidspbridge/pmgr/cmm.c create mode 100644 drivers/staging/tidspbridge/pmgr/cod.c create mode 100644 drivers/staging/tidspbridge/pmgr/dbll.c create mode 100644 drivers/staging/tidspbridge/pmgr/dev.c create mode 100644 drivers/staging/tidspbridge/pmgr/dmm.c create mode 100644 drivers/staging/tidspbridge/pmgr/dspapi.c create mode 100644 drivers/staging/tidspbridge/pmgr/io.c create mode 100644 drivers/staging/tidspbridge/pmgr/ioobj.h create mode 100644 drivers/staging/tidspbridge/pmgr/msg.c create mode 100644 drivers/staging/tidspbridge/pmgr/msgobj.h create mode 100644 drivers/staging/tidspbridge/rmgr/dbdcd.c create mode 100644 drivers/staging/tidspbridge/rmgr/disp.c create mode 100644 drivers/staging/tidspbridge/rmgr/drv.c create mode 100644 drivers/staging/tidspbridge/rmgr/drv_interface.c create mode 100644 drivers/staging/tidspbridge/rmgr/drv_interface.h create mode 100644 drivers/staging/tidspbridge/rmgr/dspdrv.c create mode 100644 drivers/staging/tidspbridge/rmgr/mgr.c create mode 100644 drivers/staging/tidspbridge/rmgr/nldr.c create mode 100644 drivers/staging/tidspbridge/rmgr/node.c create mode 100644 drivers/staging/tidspbridge/rmgr/proc.c create mode 100644 drivers/staging/tidspbridge/rmgr/pwr.c create mode 100644 drivers/staging/tidspbridge/rmgr/rmm.c create mode 100644 drivers/staging/tidspbridge/rmgr/strm.c create mode 100644 drivers/staging/tidspbridge/services/cfg.c create mode 100644 drivers/staging/tidspbridge/services/ntfy.c create mode 100644 drivers/staging/tidspbridge/services/services.c create mode 100644 drivers/staging/tidspbridge/services/sync.c
PATCH 1/11 staging: ti dspbridge: add driver documentation
From: Omar Ramirez Luna <[email protected]>
Add a README with a general overview of TI's DSP Bridge driver, a short explanations of how error codes are currently used, and a CONTRIBUTORS file with all past & present contributors.
For additional information about TI's DSP Bridge,
check out http://omapzoom.org/gf/project/omapbridge/docman/?subdir=3
Note: if by any chance we forgot to mention any contributor, please let us know and we will fix that.
--- .../staging/tidspbridge/Documentation/CONTRIBUTORS | 82 ++++++++++ drivers/staging/tidspbridge/Documentation/README | 70 +++++++++ .../staging/tidspbridge/Documentation/error-codes | 157 ++++++++++++++++++++ 3 files changed, 309 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/Documentation/CONTRIBUTORS create mode 100644 drivers/staging/tidspbridge/Documentation/README create mode 100644 drivers/staging/tidspbridge/Documentation/error-codes
drivers/staging/tidspbridge/Documentation/CONTRIBUTORS new file +82 -0
@@ -0,0 +1,82 @@ +TI DSP/Bridge Driver - Contributors File + +The DSP/Bridge project wish to thank all of its contributors, current bridge +driver is the result of the work of all of them. If any name is accidentally +omitted, let us know by sending a mail to [email protected] or [email protected]. + +Please keep the following list in alphabetical order. + + Suman Anna + Sripal Bagadia + Felipe Balbi + Ohad Ben-Cohen + Phil Carmody + Deepak Chitriki + Felipe Contreras + Hiroshi Doyu + Seth Forshee + Ivan Gomez Castellanos + Mark Grosen + Ramesh Gupta G + Fernando Guzman Lugo + Axel Haslam + Janet Head + Shivananda Hebbar + Hari Kanigeri + Tony Lindgren + Antonio Luna + Hari Nagalla + Nishanth Menon + Ameya Palande + Vijay Pasam + Gilbert Pitney + Omar Ramirez Luna + Ernesto Ramos + Chris Ring + Larry Schiefer + Rebecca Schultz Zavin + Bhavin Shah + Andy Shevchenko + Jeff Taylor + Roman Tereshonkov + Armando Uribe de Leon + Nischal Varide + Wenbiao Wang + + + +The following list was taken from file Revision History, if you recognize your +alias or did any contribution to the project please let us now, so we can +proper credit your work. + + ag + ap + cc + db + dh4 + dr + hp + jg + kc + kln + kw + ge + gv + map + mf + mk + mr + nn + rajesh + rg + rr + rt + sb + sg + sh + sp + srid + swa + vp + ww
drivers/staging/tidspbridge/Documentation/README new file +70 -0
70 lines not on this page · raw message
drivers/staging/tidspbridge/Documentation/error-codes new file +157 -0
157 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 2/11 staging: ti dspbridge: add core driver sources
In reply to Ohad Ben-CohenFrom: Omar Ramirez Luna <[email protected]>
Add TI's DSP Bridge core driver sources
--- drivers/staging/tidspbridge/core/_cmm.h | 45 + drivers/staging/tidspbridge/core/_deh.h | 35 + drivers/staging/tidspbridge/core/_msg_sm.h | 142 ++ drivers/staging/tidspbridge/core/_tiomap.h | 377 ++++ drivers/staging/tidspbridge/core/_tiomap_pwr.h | 85 + drivers/staging/tidspbridge/core/chnl_sm.c | 1015 +++++++++ drivers/staging/tidspbridge/core/dsp-clock.c | 421 ++++ drivers/staging/tidspbridge/core/io_sm.c | 2410 +++++++++++++++++++++ drivers/staging/tidspbridge/core/mmu_fault.c | 139 ++ drivers/staging/tidspbridge/core/mmu_fault.h | 36 + drivers/staging/tidspbridge/core/msg_sm.c | 673 ++++++ drivers/staging/tidspbridge/core/tiomap3430.c | 1887 ++++++++++++++++ drivers/staging/tidspbridge/core/tiomap3430_pwr.c | 604 ++++++ drivers/staging/tidspbridge/core/tiomap_io.c | 458 ++++ drivers/staging/tidspbridge/core/tiomap_io.h | 104 + drivers/staging/tidspbridge/core/ue_deh.c | 303 +++ drivers/staging/tidspbridge/core/wdt.c | 150 ++ 17 files changed, 8884 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/core/_cmm.h create mode 100644 drivers/staging/tidspbridge/core/_deh.h create mode 100644 drivers/staging/tidspbridge/core/_msg_sm.h create mode 100644 drivers/staging/tidspbridge/core/_tiomap.h create mode 100644 drivers/staging/tidspbridge/core/_tiomap_pwr.h create mode 100644 drivers/staging/tidspbridge/core/chnl_sm.c create mode 100644 drivers/staging/tidspbridge/core/dsp-clock.c create mode 100644 drivers/staging/tidspbridge/core/io_sm.c create mode 100644 drivers/staging/tidspbridge/core/mmu_fault.c create mode 100644 drivers/staging/tidspbridge/core/mmu_fault.h create mode 100644 drivers/staging/tidspbridge/core/msg_sm.c create mode 100644 drivers/staging/tidspbridge/core/tiomap3430.c create mode 100644 drivers/staging/tidspbridge/core/tiomap3430_pwr.c create mode 100644 drivers/staging/tidspbridge/core/tiomap_io.c create mode 100644 drivers/staging/tidspbridge/core/tiomap_io.h create mode 100644 drivers/staging/tidspbridge/core/ue_deh.c create mode 100644 drivers/staging/tidspbridge/core/wdt.c
drivers/staging/tidspbridge/core/_cmm.h new file +45 -0
@@ -0,0 +1,45 @@ +/* +* _cmm.h +* +* DSP-BIOS Bridge driver support functions for TI OMAP processors. +* +* Private header file defining CMM manager objects and defines needed +* by IO manager to register shared memory regions when DSP base image +* is loaded(bridge_io_on_loaded). +* +* Copyright (C) 2005-2006 Texas Instruments, Inc. +* +* This package is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef _CMM_ +#define _CMM_ + +/* +* These target side symbols define the beginning and ending addresses +* of the section of shared memory used for shared memory manager CMM. +* They are defined in the *cfg.cmd file by cdb code. +*/ +#define SHM0_SHARED_BASE_SYM "_SHM0_BEG" +#define SHM0_SHARED_END_SYM "_SHM0_END" +#define SHM0_SHARED_RESERVED_BASE_SYM "_SHM0_RSVDSTRT" + +/* +* Shared Memory Region #0(SHMSEG0) is used in the following way: +* +* |(_SHM0_BEG) | (_SHM0_RSVDSTRT) | (_SHM0_END) +* V V V +* ------------------------------------------------------------ +* | DSP-side allocations | GPP-side allocations | +* ------------------------------------------------------------ +* +* +*/ + +#endif /* _CMM_ */
drivers/staging/tidspbridge/core/_deh.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* _deh.h +* +* DSP-BIOS Bridge driver support functions for TI OMAP processors. +* +* Private header for DEH module. +* +* Copyright (C) 2005-2006 Texas Instruments, Inc. +* +* This package is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef _DEH_ +#define _DEH_ + +#include <dspbridge/ntfy.h> +#include <dspbridge/dspdefs.h> + +/* DEH Manager: only one created per board: */ +struct deh_mgr { +struct bridge_dev_context *hbridge_context;/* Bridge context. */ +struct ntfy_object *ntfy_obj;/* NTFY object */ +struct dsp_errorinfo err_info;/* DSP exception info. */ + +/* MMU Fault DPC */ +struct tasklet_struct dpc_tasklet; +}; + +#endif /* _DEH_ */
drivers/staging/tidspbridge/core/_msg_sm.h new file +142 -0
142 lines not on this page · raw message
drivers/staging/tidspbridge/core/_tiomap.h new file +377 -0
377 lines not on this page · raw message
drivers/staging/tidspbridge/core/_tiomap_pwr.h new file +85 -0
85 lines not on this page · raw message
drivers/staging/tidspbridge/core/chnl_sm.c new file +1015 -0
1,015 lines not on this page · raw message
drivers/staging/tidspbridge/core/dsp-clock.c new file +421 -0
421 lines not on this page · raw message
drivers/staging/tidspbridge/core/io_sm.c new file +2410 -0
880 lines not on this page · raw message
drivers/staging/tidspbridge/core/mmu_fault.c new file +139 -0
139 lines not on this page · raw message
drivers/staging/tidspbridge/core/mmu_fault.h new file +36 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/core/msg_sm.c new file +673 -0
673 lines not on this page · raw message
drivers/staging/tidspbridge/core/tiomap3430.c new file +1887 -0
1,887 lines not on this page · raw message
drivers/staging/tidspbridge/core/tiomap3430_pwr.c new file +604 -0
604 lines not on this page · raw message
drivers/staging/tidspbridge/core/tiomap_io.c new file +458 -0
458 lines not on this page · raw message
drivers/staging/tidspbridge/core/tiomap_io.h new file +104 -0
104 lines not on this page · raw message
drivers/staging/tidspbridge/core/ue_deh.c new file +303 -0
303 lines not on this page · raw message
drivers/staging/tidspbridge/core/wdt.c new file +150 -0
150 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.0.4
Part of the diff is not shown here. View the raw message.
PATCH 3/11 staging: ti dspbridge: add platform manager code
In reply to Ohad Ben-CohenFrom: Omar Ramirez Luna <[email protected]>
Add TI's DSP Bridge platform manager driver sources
--- drivers/staging/tidspbridge/pmgr/chnl.c | 163 +++ drivers/staging/tidspbridge/pmgr/chnlobj.h | 46 + drivers/staging/tidspbridge/pmgr/cmm.c | 1172 +++++++++++++++++++ drivers/staging/tidspbridge/pmgr/cod.c | 658 +++++++++++ drivers/staging/tidspbridge/pmgr/dbll.c | 1585 ++++++++++++++++++++++++++ drivers/staging/tidspbridge/pmgr/dev.c | 1171 +++++++++++++++++++ drivers/staging/tidspbridge/pmgr/dmm.c | 533 +++++++++ drivers/staging/tidspbridge/pmgr/dspapi.c | 1685 ++++++++++++++++++++++++++++ drivers/staging/tidspbridge/pmgr/io.c | 142 +++ drivers/staging/tidspbridge/pmgr/ioobj.h | 38 + drivers/staging/tidspbridge/pmgr/msg.c | 129 +++ drivers/staging/tidspbridge/pmgr/msgobj.h | 38 + 12 files changed, 7360 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/pmgr/chnl.c create mode 100644 drivers/staging/tidspbridge/pmgr/chnlobj.h create mode 100644 drivers/staging/tidspbridge/pmgr/cmm.c create mode 100644 drivers/staging/tidspbridge/pmgr/cod.c create mode 100644 drivers/staging/tidspbridge/pmgr/dbll.c create mode 100644 drivers/staging/tidspbridge/pmgr/dev.c create mode 100644 drivers/staging/tidspbridge/pmgr/dmm.c create mode 100644 drivers/staging/tidspbridge/pmgr/dspapi.c create mode 100644 drivers/staging/tidspbridge/pmgr/io.c create mode 100644 drivers/staging/tidspbridge/pmgr/ioobj.h create mode 100644 drivers/staging/tidspbridge/pmgr/msg.c create mode 100644 drivers/staging/tidspbridge/pmgr/msgobj.h
drivers/staging/tidspbridge/pmgr/chnl.c new file +163 -0
@@ -0,0 +1,163 @@ +/* +* chnl.c +* +* DSP-BIOS Bridge driver support functions for TI OMAP processors. +* +* DSP API channel interface: multiplexes data streams through the single +* physical link managed by a Bridge Bridge driver. +* +* Copyright (C) 2005-2006 Texas Instruments, Inc. +* +* This package is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* ----------------------------------- Host OS */ +#include <dspbridge/host_os.h> + +/* ----------------------------------- DSP/BIOS Bridge */ +#include <dspbridge/std.h> +#include <dspbridge/dbdefs.h> + +/* ----------------------------------- Trace & Debug */ +#include <dspbridge/dbc.h> + +/* ----------------------------------- OS Adaptation Layer */ +#include <dspbridge/cfg.h> +#include <dspbridge/sync.h> + +/* ----------------------------------- Platform Manager */ +#include <dspbridge/proc.h> +#include <dspbridge/dev.h> + +/* ----------------------------------- Others */ +#include <dspbridge/chnlpriv.h> +#include <chnlobj.h> + +/* ----------------------------------- This */ +#include <dspbridge/chnl.h> + +/* ----------------------------------- Globals */ +static u32 refs; + +/* +* ======== chnl_create ======== +* Purpose: +* Create a channel manager object, responsible for opening new channels +* and closing old ones for a given 'Bridge board. +*/ +int chnl_create(OUT struct chnl_mgr **phChnlMgr, +struct dev_object *hdev_obj, + IN CONST struct chnl_mgrattrs *pMgrAttrs) +{ +int status; +struct chnl_mgr *hchnl_mgr; +struct chnl_mgr_ *chnl_mgr_obj =NULL ; + +DBC_REQUIRE (refs >0 ); +DBC_REQUIRE (phChnlMgr !=NULL ); +DBC_REQUIRE (pMgrAttrs !=NULL ); + + *phChnlMgr =NULL ; + +/* Validate args: */ +if ((0 < pMgrAttrs->max_channels) && + (pMgrAttrs->max_channels <=CHNL_MAXCHANNELS )) + status =0 ; +else if (pMgrAttrs->max_channels ==0 ) + status = -EINVAL ; +else + status = -ECHRNG ; + +if (pMgrAttrs->word_size ==0 ) + status = -EINVAL ; + +if (DSP_SUCCEEDED (status)) { + status =dev_get_chnl_mgr (hdev_obj, &hchnl_mgr); +if (DSP_SUCCEEDED (status) && hchnl_mgr !=NULL ) + status = -EEXIST ; + + } + +if (DSP_SUCCEEDED (status)) { +struct bridge_drv_interface *intf_fxns; +dev_get_intf_fxns (hdev_obj, &intf_fxns); +/* Let Bridge channel module finish the create: */ + status = (*intf_fxns->pfn_chnl_create) (&hchnl_mgr, hdev_obj, + pMgrAttrs); +if (DSP_SUCCEEDED (status)) { +/* Fill in DSP API channel module's fields of the +* chnl_mgr structure */ + chnl_mgr_obj = (struct chnl_mgr_ *)hchnl_mgr; + chnl_mgr_obj->intf_fxns = intf_fxns; +/* Finally, return the new channel manager handle: */ + *phChnlMgr = hchnl_mgr; + } + } + +DBC_ENSURE (DSP_FAILED (status) || chnl_mgr_obj); + +return status; +} + +/* +* ======== chnl_destroy ======== +* Purpose: +* Close all open channels, and destroy the channel manager. +*/ +int chnl_destroy (struct chnl_mgr *hchnl_mgr) +{ +struct chnl_mgr_ *chnl_mgr_obj = (struct chnl_mgr_ *)hchnl_mgr; +struct bridge_drv_interface *intf_fxns; +int status; + +DBC_REQUIRE (refs >0 ); + +if (chnl_mgr_obj) { + intf_fxns = chnl_mgr_obj->intf_fxns; +/* Let Bridge channel module destroy the chnl_mgr: */ + status = (*intf_fxns->pfn_chnl_destroy) (hchnl_mgr); + }else { + status = -EFAULT ; + } + +return status; +} + +/* +* ======== chnl_exit ======== +* Purpose: +* Discontinue usage of the CHNL module. +*/ +void chnl_exit (void ) +{ +DBC_REQUIRE (refs >0 ); + + refs--; + +DBC_ENSURE (refs >=0 ); +} + +/* +* ======== chnl_init ======== +* Purpose: +* Initialize the CHNL module's private state. +*/ +bool chnl_init (void ) +{ +bool ret = true; + +DBC_REQUIRE (refs >=0 ); + +if (ret) + refs++; + +DBC_ENSURE ((ret && (refs >0 )) || (!ret && (refs >=0 ))); + +return ret; +}
drivers/staging/tidspbridge/pmgr/chnlobj.h new file +46 -0
46 lines not on this page · raw message
drivers/staging/tidspbridge/pmgr/cmm.c new file +1172 -0
1,172 lines not on this page · raw message
drivers/staging/tidspbridge/pmgr/cod.c new file +658 -0
658 lines not on this page · raw message
drivers/staging/tidspbridge/pmgr/dbll.c new file +1585 -0
961 lines not on this page · raw message
drivers/staging/tidspbridge/pmgr/dev.c new file +1171 -0
1,171 lines not on this page · raw message
drivers/staging/tidspbridge/pmgr/dmm.c new file +533 -0
533 lines not on this page · raw message
drivers/staging/tidspbridge/pmgr/dspapi.c new file +1685 -0
1,685 lines not on this page · raw message
drivers/staging/tidspbridge/pmgr/io.c new file +142 -0
142 lines not on this page · raw message
drivers/staging/tidspbridge/pmgr/ioobj.h new file +38 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/pmgr/msg.c new file +129 -0
129 lines not on this page · raw message
drivers/staging/tidspbridge/pmgr/msgobj.h new file +38 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.0.4
Part of the diff is not shown here. View the raw message.
PATCH 4/11 staging: ti dspbridge: add resource manager
In reply to Ohad Ben-CohenFrom: Omar Ramirez Luna <[email protected]>
Add TI's DSP Bridge resource manager driver sources
--- drivers/staging/tidspbridge/rmgr/dbdcd.c | 1506 ++++++++++ drivers/staging/tidspbridge/rmgr/disp.c | 754 +++++ drivers/staging/tidspbridge/rmgr/drv.c | 1047 +++++++ drivers/staging/tidspbridge/rmgr/drv_interface.c | 644 +++++ drivers/staging/tidspbridge/rmgr/drv_interface.h | 27 + drivers/staging/tidspbridge/rmgr/dspdrv.c | 142 + drivers/staging/tidspbridge/rmgr/mgr.c | 374 +++ drivers/staging/tidspbridge/rmgr/nldr.c | 1999 +++++++++++++ drivers/staging/tidspbridge/rmgr/node.c | 3231 ++++++++++++++++++++++ drivers/staging/tidspbridge/rmgr/proc.c | 1948 +++++++++++++ drivers/staging/tidspbridge/rmgr/pwr.c | 182 ++ drivers/staging/tidspbridge/rmgr/rmm.c | 535 ++++ drivers/staging/tidspbridge/rmgr/strm.c | 861 ++++++ 13 files changed, 13250 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/rmgr/dbdcd.c create mode 100644 drivers/staging/tidspbridge/rmgr/disp.c create mode 100644 drivers/staging/tidspbridge/rmgr/drv.c create mode 100644 drivers/staging/tidspbridge/rmgr/drv_interface.c create mode 100644 drivers/staging/tidspbridge/rmgr/drv_interface.h create mode 100644 drivers/staging/tidspbridge/rmgr/dspdrv.c create mode 100644 drivers/staging/tidspbridge/rmgr/mgr.c create mode 100644 drivers/staging/tidspbridge/rmgr/nldr.c create mode 100644 drivers/staging/tidspbridge/rmgr/node.c create mode 100644 drivers/staging/tidspbridge/rmgr/proc.c create mode 100644 drivers/staging/tidspbridge/rmgr/pwr.c create mode 100644 drivers/staging/tidspbridge/rmgr/rmm.c create mode 100644 drivers/staging/tidspbridge/rmgr/strm.c
drivers/staging/tidspbridge/rmgr/dbdcd.c new file +1506 -0
@@ -0,0 +1,1506 @@ +/* +* dbdcd.c +* +* DSP-BIOS Bridge driver support functions for TI OMAP processors. +* +* This file contains the implementation of the DSP/BIOS Bridge +* Configuration Database (DCD). +* +* Notes: +* The fxn dcd_get_objects can apply a callback fxn to each DCD object +* that is located in a specified COFF file. At the moment, +* dcd_auto_register, dcd_auto_unregister, and NLDR module all use +* dcd_get_objects. +* +* Copyright (C) 2005-2006 Texas Instruments, Inc. +* +* This package is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* ----------------------------------- Host OS */ +#include <dspbridge/host_os.h> + +/* ----------------------------------- DSP/BIOS Bridge */ +#include <dspbridge/std.h> +#include <dspbridge/dbdefs.h> +/* ----------------------------------- Trace & Debug */ +#include <dspbridge/dbc.h> + +/* ----------------------------------- Platform Manager */ +#include <dspbridge/cod.h> + +/* ----------------------------------- Others */ +#include <dspbridge/uuidutil.h> + +/* ----------------------------------- This */ +#include <dspbridge/dbdcd.h> + +/* ----------------------------------- Global defines. */ +#define MAX_INT2CHAR_LENGTH 16/* Max int2char len of 32 bit int */ + +/* Name of section containing dependent libraries */ +#define DEPLIBSECT ".dspbridge_deplibs" + +/* DCD specific structures. */ +struct dcd_manager { +struct cod_manager *cod_mgr;/* Handle to COD manager object. */ +}; + +/* Pointer to the registry support key */ +static struct list_head reg_key_list; +static DEFINE_SPINLOCK (dbdcd_lock); + +/* Global reference variables. */ +static u32 refs; +static u32 enum_refs; + +/* Helper function prototypes. */ +static s32 atoi (char *psz_buf); +static int get_attrs_from_buf (char *psz_buf,u32 ul_buf_size, +enum dsp_dcdobjtype obj_type, +struct dcd_genericobj *pGenObj); +static void compress_buf (char *psz_buf,u32 ul_buf_size,s32 cCharSize); +static char dsp_char2_gpp_char (char *pWord,s32 cDspCharSize); +static int get_dep_lib_info(IN struct dcd_manager *hdcd_mgr, + IN struct dsp_uuid *uuid_obj, + IN OUT u16 *pNumLibs, + OPTIONAL OUT u16 *pNumPersLibs, + OPTIONAL OUT struct dsp_uuid *pDepLibUuids, + OPTIONAL OUT bool *pPersistentDepLibs, + IN enum nldr_phase phase); + +/* +* ======== dcd_auto_register ======== +* Purpose: +* Parses the supplied image and resigsters with DCD. +*/ +int dcd_auto_register(IN struct dcd_manager *hdcd_mgr, + IN char *pszCoffPath) +{ +int status =0 ; + +DBC_REQUIRE (refs >0 ); + +if (hdcd_mgr) + status =dcd_get_objects (hdcd_mgr, pszCoffPath, + (dcd_registerfxn ) dcd_register_object, + (void *)pszCoffPath); +else + status = -EFAULT ; + +return status; +} + +/* +* ======== dcd_auto_unregister ======== +* Purpose: +* Parses the supplied DSP image and unresiters from DCD. +*/ +int dcd_auto_unregister(IN struct dcd_manager *hdcd_mgr, + IN char *pszCoffPath) +{ +int status =0 ; + +DBC_REQUIRE (refs >0 ); + +if (hdcd_mgr) + status =dcd_get_objects (hdcd_mgr, pszCoffPath, + (dcd_registerfxn ) dcd_register_object, +NULL ); +else + status = -EFAULT ; + +return status; +} + +/* +* ======== dcd_create_manager ======== +* Purpose: +* Creates DCD manager. +*/ +int dcd_create_manager(IN char *pszZlDllName, + OUT struct dcd_manager **phDcdMgr) +{ +struct cod_manager *cod_mgr;/* COD manager handle */ +struct dcd_manager *dcd_mgr_obj =NULL ;/* DCD Manager pointer */ +int status =0 ; + +DBC_REQUIRE (refs >=0 ); +DBC_REQUIRE (phDcdMgr); + + status =cod_create (&cod_mgr, pszZlDllName,NULL ); +if (DSP_FAILED (status)) + goto func_end; + +/* Create a DCD object. */ + dcd_mgr_obj =kzalloc (sizeof (struct dcd_manager ),GFP_KERNEL ); +if (dcd_mgr_obj !=NULL ) { +/* Fill out the object. */ + dcd_mgr_obj->cod_mgr = cod_mgr; + +/* Return handle to this DCD interface. */ + *phDcdMgr = dcd_mgr_obj; + }else { + status = -ENOMEM ; + +/* +* If allocation of DcdManager object failed, delete the +* COD manager. +*/ +cod_delete (cod_mgr); + } + +DBC_ENSURE ((DSP_SUCCEEDED (status)) || + ((dcd_mgr_obj ==NULL ) && (status == -ENOMEM ))); + +func_end: +return status; +} + +/* +* ======== dcd_destroy_manager ======== +* Purpose: +* Frees DCD Manager object. +*/ +int dcd_destroy_manager(IN struct dcd_manager *hdcd_mgr) +{ +struct dcd_manager *dcd_mgr_obj = hdcd_mgr; +int status = -EFAULT ; + +DBC_REQUIRE (refs >=0 ); + +if (hdcd_mgr) { +/* Delete the COD manager. */ +cod_delete (dcd_mgr_obj->cod_mgr); + +/* Deallocate a DCD manager object. */ +kfree (dcd_mgr_obj); + + status =0 ; + } + +return status; +} + +/* +* ======== dcd_enumerate_object ======== +* Purpose: +* Enumerates objects in the DCD. +*/ +int dcd_enumerate_object(IN s32 cIndex, IN enum dsp_dcdobjtype obj_type, + OUT struct dsp_uuid *uuid_obj) +{ +int status =0 ; +char sz_reg_key[DCD_MAXPATHLENGTH ]; +char sz_value[DCD_MAXPATHLENGTH ]; +struct dsp_uuid dsp_uuid_obj; +char sz_obj_type[MAX_INT2CHAR_LENGTH ];/* str. rep. of obj_type. */ +u32 dw_key_len =0 ; +struct dcd_key_elem *dcd_key; +int len; + +DBC_REQUIRE (refs >=0 ); +DBC_REQUIRE (cIndex >=0 ); +DBC_REQUIRE (uuid_obj !=NULL ); + +if ((cIndex !=0 ) && (enum_refs ==0 )) { +/* +* If an enumeration is being performed on an index greater +* than zero, then the current enum_refs must have been +* incremented to greater than zero. +*/ + status = -EIDRM ; + }else { +/* +* Pre-determine final key length. It's length of DCD_REGKEY + +* "_\0" + length of sz_obj_type string + terminating NULL. +*/ + dw_key_len =strlen (DCD_REGKEY ) +1 +sizeof (sz_obj_type) +1 ; +DBC_ASSERT (dw_key_len <DCD_MAXPATHLENGTH ); + +/* Create proper REG key; concatenate DCD_REGKEY with +* obj_type. */ +strncpy (sz_reg_key,DCD_REGKEY ,strlen (DCD_REGKEY ) +1 ); +if ((strlen (sz_reg_key) +strlen ("_\0" )) < +DCD_MAXPATHLENGTH ) { +strncat (sz_reg_key,"_\0" ,2 ); + }else { + status = -EPERM ; + } + +/* This snprintf is guaranteed not to exceed max size of an +* integer. */ + status =snprintf (sz_obj_type,MAX_INT2CHAR_LENGTH ,"%d" , + obj_type); + +if (status ==-1 ) { + status = -EPERM ; + }else { + status =0 ; +if ((strlen (sz_reg_key) +strlen (sz_obj_type)) < +DCD_MAXPATHLENGTH ) { +strncat (sz_reg_key, sz_obj_type, +strlen (sz_obj_type) +1 ); + }else { + status = -EPERM ; + } + } + +if (DSP_SUCCEEDED (status)) { + len =strlen (sz_reg_key); +spin_lock (&dbdcd_lock); +list_for_each_entry (dcd_key, ®_key_list, link) { +if (!strncmp (dcd_key->name, sz_reg_key, len) + && !cIndex--) { +strncpy (sz_value, &dcd_key->name[len], +strlen (&dcd_key->name[len]) +1 ); +break ; + } + } +spin_unlock (&dbdcd_lock); + +if (&dcd_key->link == ®_key_list) + status = -ENODATA ; + } + +if (DSP_SUCCEEDED (status)) { +/* Create UUID value using string retrieved from +* registry. */ +uuid_uuid_from_string (sz_value, &dsp_uuid_obj); + + *uuid_obj = dsp_uuid_obj; + +/* Increment enum_refs to update reference count. */ + enum_refs++; + + status =0 ; + }else if (status == -ENODATA ) { +/* At the end of enumeration. Reset enum_refs. */ + enum_refs =0 ; + +/* +* TODO: Revisit, this is not an errror case but code +* expects non-zero value. +*/ + status =ENODATA ; + }else { + status = -EPERM ; + } + } + +DBC_ENSURE (uuid_obj || (status == -EPERM )); + +return status; +} + +/* +* ======== dcd_exit ======== +* Purpose: +* Discontinue usage of the DCD module. +*/ +void dcd_exit (void ) +{ +struct dcd_key_elem *rv, *rv_tmp; +DBC_REQUIRE (refs >0 ); + + refs--; +if (refs ==0 ) { +cod_exit (); +list_for_each_entry_safe (rv, rv_tmp, ®_key_list, link) { +list_del (&rv->link); +kfree (rv->path); +kfree (rv); + } + } + +DBC_ENSURE (refs >=0 ); +} + +/* +* ======== dcd_get_dep_libs ======== +*/ +int dcd_get_dep_libs(IN struct dcd_manager *hdcd_mgr, + IN struct dsp_uuid *uuid_obj, + u16 numLibs, OUT struct dsp_uuid *pDepLibUuids, + OUT bool *pPersistentDepLibs, + IN enum nldr_phase phase) +{ +int status =0 ; + +DBC_REQUIRE (refs >0 ); +DBC_REQUIRE (hdcd_mgr); +DBC_REQUIRE (uuid_obj !=NULL ); +DBC_REQUIRE (pDepLibUuids !=NULL ); +DBC_REQUIRE (pPersistentDepLibs !=NULL ); + + status = +get_dep_lib_info (hdcd_mgr, uuid_obj, &numLibs,NULL , pDepLibUuids, + pPersistentDepLibs, phase); + +return status; +} + +/* +* ======== dcd_get_num_dep_libs ======== +*/ +int dcd_get_num_dep_libs(IN struct dcd_manager *hdcd_mgr, + IN struct dsp_uuid *uuid_obj, + OUT u16 *pNumLibs, OUT u16 *pNumPersLibs, + IN enum nldr_phase phase) +{ +int status =0 ; + +DBC_REQUIRE (refs >0 ); +DBC_REQUIRE (hdcd_mgr); +DBC_REQUIRE (pNumLibs !=NULL ); +DBC_REQUIRE (pNumPersLibs !=NULL ); +DBC_REQUIRE (uuid_obj !=NULL ); + + status =get_dep_lib_info (hdcd_mgr, uuid_obj, pNumLibs, pNumPersLibs, +NULL ,NULL , phase); + +return status; +} + +/* +* ======== dcd_get_object_def ======== +* Purpose: +* Retrieves the properties of a node or processor based on the UUID and +* object type. +*/ +int dcd_get_object_def(IN struct dcd_manager *hdcd_mgr, + IN struct dsp_uuid *pObjUuid, + IN enum dsp_dcdobjtype obj_type, + OUT struct dcd_genericobj *pObjDef) +{ +struct dcd_manager *dcd_mgr_obj = hdcd_mgr;/* ptr to DCD mgr */ +struct cod_libraryobj *lib =NULL ; +int status =0 ; +u32 ul_addr =0 ;/* Used by cod_get_section */ +u32 ul_len =0 ;/* Used by cod_get_section */ +u32 dw_buf_size;/* Used by REG functions */ +char sz_reg_key[DCD_MAXPATHLENGTH ]; +char *sz_uuid;/*[MAXUUIDLEN]; */ +struct dcd_key_elem *dcd_key =NULL ; +char sz_sect_name[MAXUUIDLEN +2 ];/* ".[UUID]\0" */ +char *psz_coff_buf; +u32 dw_key_len;/* Len of REG key. */ +char sz_obj_type[MAX_INT2CHAR_LENGTH ];/* str. rep. of obj_type. */ + +DBC_REQUIRE (refs >0 ); +DBC_REQUIRE (pObjDef !=NULL ); +DBC_REQUIRE (pObjUuid !=NULL ); + + sz_uuid =kzalloc (MAXUUIDLEN ,GFP_KERNEL ); +if (!sz_uuid) { + status = -ENOMEM ; + goto func_end; + } + +if (!hdcd_mgr) { + status = -EFAULT ; + goto func_end; + } + +/* Pre-determine final key length. It's length of DCD_REGKEY + +* "_\0" + length of sz_obj_type string + terminating NULL */ + dw_key_len =strlen (DCD_REGKEY ) +1 +sizeof (sz_obj_type) +1 ; +DBC_ASSERT (dw_key_len <DCD_MAXPATHLENGTH ); + +/* Create proper REG key; concatenate DCD_REGKEY with obj_type. */ +strncpy (sz_reg_key,DCD_REGKEY ,strlen (DCD_REGKEY ) +1 ); + +if ((strlen (sz_reg_key) +strlen ("_\0" )) <DCD_MAXPATHLENGTH ) +strncat (sz_reg_key,"_\0" ,2 ); +else + status = -EPERM ; + + status =snprintf (sz_obj_type,MAX_INT2CHAR_LENGTH ,"%d" , obj_type); +if (status ==-1 ) { + status = -EPERM ; + }else { + status =0 ; + +if ((strlen (sz_reg_key) +strlen (sz_obj_type)) < +DCD_MAXPATHLENGTH ) { +strncat (sz_reg_key, sz_obj_type, +strlen (sz_obj_type) +1 ); + }else { + status = -EPERM ; + } + +/* Create UUID value to set in registry. */ +uuid_uuid_to_string (pObjUuid, sz_uuid,MAXUUIDLEN ); + +if ((strlen (sz_reg_key) +MAXUUIDLEN ) <DCD_MAXPATHLENGTH ) +strncat (sz_reg_key, sz_uuid,MAXUUIDLEN ); +else + status = -EPERM ; + +/* Retrieve paths from the registry based on struct dsp_uuid */ + dw_buf_size =DCD_MAXPATHLENGTH ; + } +if (DSP_SUCCEEDED (status)) { +spin_lock (&dbdcd_lock); +list_for_each_entry (dcd_key, ®_key_list, link) { +if (!strncmp (dcd_key->name, sz_reg_key, +strlen (sz_reg_key) +1 )) +break ; + } +spin_unlock (&dbdcd_lock); +if (&dcd_key->link == ®_key_list) { + status = -ENOKEY ; + goto func_end; + } + } + + +/* Open COFF file. */ + status =cod_open (dcd_mgr_obj->cod_mgr, dcd_key->path, +COD_NOLOAD , &lib); +if (DSP_FAILED (status)) { + status = -EACCES ; + goto func_end; + } + +/* Ensure sz_uuid + 1 is not greater than sizeof sz_sect_name. */ +DBC_ASSERT ((strlen (sz_uuid) +1 ) <sizeof (sz_sect_name)); + +/* Create section name based on node UUID. A period is +* pre-pended to the UUID string to form the section name. +* I.e. ".24BC8D90_BB45_11d4_B756_006008BDB66F" */ +strncpy (sz_sect_name,"." ,2 ); +strncat (sz_sect_name, sz_uuid,strlen (sz_uuid)); + +/* Get section information. */ + status =cod_get_section (lib, sz_sect_name, &ul_addr, &ul_len); +if (DSP_FAILED (status)) { + status = -EACCES ; + goto func_end; + } + +/* Allocate zeroed buffer. */ + psz_coff_buf =kzalloc (ul_len +4 ,GFP_KERNEL ); +#ifdef _DB_TIOMAP +if (strstr (dcd_key->path,"iva" ) ==NULL ) { +/* Locate section by objectID and read its content. */ + status = +cod_read_section (lib, sz_sect_name, psz_coff_buf, ul_len); + }else { + status = +cod_read_section (lib, sz_sect_name, psz_coff_buf, ul_len); +dev_dbg (bridge,"%s: Skipped Byte swap for IVA!!\n" , __func__); + } +#else + status =cod_read_section (lib, sz_sect_name, psz_coff_buf, ul_len); +#endif +if (DSP_SUCCEEDED (status)) { +/* Compres DSP buffer to conform to PC format. */ +if (strstr (dcd_key->path,"iva" ) ==NULL ) { +compress_buf (psz_coff_buf, ul_len,DSPWORDSIZE ); + }else { +compress_buf (psz_coff_buf, ul_len,1 ); +dev_dbg (bridge,"%s: Compressing IVA COFF buffer by 1 " +"for IVA!!\n" , __func__); + } + +/* Parse the content of the COFF buffer. */ + status = +get_attrs_from_buf (psz_coff_buf, ul_len, obj_type, pObjDef); +if (DSP_FAILED (status)) + status = -EACCES ; + }else { + status = -EACCES ; + } + +/* Free the previously allocated dynamic buffer. */ +kfree (psz_coff_buf); +func_end: +if (lib) +cod_close (lib); + +kfree (sz_uuid); + +return status; +} + +/* +* ======== dcd_get_objects ======== +*/ +int dcd_get_objects(IN struct dcd_manager *hdcd_mgr, + IN char *pszCoffPath, dcd_registerfxn registerFxn, +void *handle) +{ +struct dcd_manager *dcd_mgr_obj = hdcd_mgr; +int status =0 ; +char *psz_coff_buf; +char *psz_cur; +struct cod_libraryobj *lib =NULL ; +u32 ul_addr =0 ;/* Used by cod_get_section */ +u32 ul_len =0 ;/* Used by cod_get_section */ +char seps[] =":, " ; +char *token =NULL ; +struct dsp_uuid dsp_uuid_obj; +s32 object_type; + +DBC_REQUIRE (refs >0 ); +if (!hdcd_mgr) { + status = -EFAULT ; + goto func_end; + } + +/* Open DSP coff file, don't load symbols. */ + status =cod_open (dcd_mgr_obj->cod_mgr, pszCoffPath,COD_NOLOAD , &lib); +if (DSP_FAILED (status)) { + status = -EACCES ; + goto func_cont; + } + +/* Get DCD_RESIGER_SECTION section information. */ + status =cod_get_section (lib,DCD_REGISTER_SECTION , &ul_addr, &ul_len); +if (DSP_FAILED (status) || !(ul_len >0 )) { + status = -EACCES ; + goto func_cont; + } + +/* Allocate zeroed buffer. */ + psz_coff_buf =kzalloc (ul_len +4 ,GFP_KERNEL ); +#ifdef _DB_TIOMAP +if (strstr (pszCoffPath,"iva" ) ==NULL ) { +/* Locate section by objectID and read its content. */ + status =cod_read_section (lib,DCD_REGISTER_SECTION , + psz_coff_buf, ul_len); + }else { +dev_dbg (bridge,"%s: Skipped Byte swap for IVA!!\n" , __func__); + status =cod_read_section (lib,DCD_REGISTER_SECTION , + psz_coff_buf, ul_len); + } +#else + status = +cod_read_section (lib,DCD_REGISTER_SECTION , psz_coff_buf, ul_len); +#endif +if (DSP_SUCCEEDED (status)) { +/* Compress DSP buffer to conform to PC format. */ +if (strstr (pszCoffPath,"iva" ) ==NULL ) { +compress_buf (psz_coff_buf, ul_len,DSPWORDSIZE ); + }else { +compress_buf (psz_coff_buf, ul_len,1 ); +dev_dbg (bridge,"%s: Compress COFF buffer with 1 word " +"for IVA!!\n" , __func__); + } + +/* Read from buffer and register object in buffer. */ + psz_cur = psz_coff_buf; +while ((token =strsep (&psz_cur, seps)) && *token !='\0' ) { +/* Retrieve UUID string. */ +uuid_uuid_from_string (token, &dsp_uuid_obj); + +/* Retrieve object type */ + token =strsep (&psz_cur, seps); + +/* Retrieve object type */ + object_type =atoi (token); + +/* +* Apply registerFxn to the found DCD object. +* Possible actions include: +* +* 1) Register found DCD object. +* 2) Unregister found DCD object (when handle == NULL) +* 3) Add overlay node. +*/ + status = +registerFxn (&dsp_uuid_obj, object_type, handle); +if (DSP_FAILED (status)) { +/* if error occurs, break from while loop. */ +break ; + } + } + }else { + status = -EACCES ; + } + +/* Free the previously allocated dynamic buffer. */ +kfree (psz_coff_buf); +func_cont: +if (lib) +cod_close (lib); + +func_end: +return status; +} + +/* +* ======== dcd_get_library_name ======== +* Purpose: +* Retrieves the library name for the given UUID. +* +*/ +int dcd_get_library_name(IN struct dcd_manager *hdcd_mgr, + IN struct dsp_uuid *uuid_obj, + IN OUT char *pstrLibName, IN OUT u32 * pdwSize, + enum nldr_phase phase, OUT bool *phase_split) +{ +char sz_reg_key[DCD_MAXPATHLENGTH ]; +char sz_uuid[MAXUUIDLEN ]; +u32 dw_key_len;/* Len of REG key. */ +char sz_obj_type[MAX_INT2CHAR_LENGTH ];/* str. rep. of obj_type. */ +int status =0 ; +struct dcd_key_elem *dcd_key =NULL ; + +DBC_REQUIRE (uuid_obj !=NULL ); +DBC_REQUIRE (pstrLibName !=NULL ); +DBC_REQUIRE (pdwSize !=NULL ); +DBC_REQUIRE (hdcd_mgr); + +dev_dbg (bridge,"%s: hdcd_mgr %p, uuid_obj %p, pstrLibName %p, pdwSize " +"%p\n" , __func__, hdcd_mgr, uuid_obj, pstrLibName, pdwSize); + +/* +* Pre-determine final key length. It's length of DCD_REGKEY + +* "_\0" + length of sz_obj_type string + terminating NULL. +*/ + dw_key_len =strlen (DCD_REGKEY ) +1 +sizeof (sz_obj_type) +1 ; +DBC_ASSERT (dw_key_len <DCD_MAXPATHLENGTH ); + +/* Create proper REG key; concatenate DCD_REGKEY with obj_type. */ +strncpy (sz_reg_key,DCD_REGKEY ,strlen (DCD_REGKEY ) +1 ); +if ((strlen (sz_reg_key) +strlen ("_\0" )) <DCD_MAXPATHLENGTH ) +strncat (sz_reg_key,"_\0" ,2 ); +else + status = -EPERM ; + +switch (phase) { +case NLDR_CREATE : +/* create phase type */ +sprintf (sz_obj_type,"%d" ,DSP_DCDCREATELIBTYPE ); +break ; +case NLDR_EXECUTE : +/* execute phase type */ +sprintf (sz_obj_type,"%d" ,DSP_DCDEXECUTELIBTYPE ); +break ; +case NLDR_DELETE : +/* delete phase type */ +sprintf (sz_obj_type,"%d" ,DSP_DCDDELETELIBTYPE ); +break ; +case NLDR_NOPHASE : +/* known to be a dependent library */ +sprintf (sz_obj_type,"%d" ,DSP_DCDLIBRARYTYPE ); +break ; +default : + status = -EINVAL ; +DBC_ASSERT (false); + } +if (DSP_SUCCEEDED (status)) { +if ((strlen (sz_reg_key) +strlen (sz_obj_type)) < +DCD_MAXPATHLENGTH ) { +strncat (sz_reg_key, sz_obj_type, +strlen (sz_obj_type) +1 ); + }else { + status = -EPERM ; + } +/* Create UUID value to find match in registry. */ +uuid_uuid_to_string (uuid_obj, sz_uuid,MAXUUIDLEN ); +if ((strlen (sz_reg_key) +MAXUUIDLEN ) <DCD_MAXPATHLENGTH ) +strncat (sz_reg_key, sz_uuid,MAXUUIDLEN ); +else + status = -EPERM ; + } +if (DSP_SUCCEEDED (status)) { +spin_lock (&dbdcd_lock); +list_for_each_entry (dcd_key, ®_key_list, link) { +/* See if the name matches. */ +if (!strncmp (dcd_key->name, sz_reg_key, +strlen (sz_reg_key) +1 )) +break ; + } +spin_unlock (&dbdcd_lock); + } + +if (&dcd_key->link == ®_key_list) + status = -ENOKEY ; + +/* If can't find, phases might be registered as generic LIBRARYTYPE */ +if (DSP_FAILED (status) && phase !=NLDR_NOPHASE ) { +if (phase_split) + *phase_split = false; + +strncpy (sz_reg_key,DCD_REGKEY ,strlen (DCD_REGKEY ) +1 ); +if ((strlen (sz_reg_key) +strlen ("_\0" )) < +DCD_MAXPATHLENGTH ) { +strncat (sz_reg_key,"_\0" ,2 ); + }else { + status = -EPERM ; + } +sprintf (sz_obj_type,"%d" ,DSP_DCDLIBRARYTYPE ); +if ((strlen (sz_reg_key) +strlen (sz_obj_type)) + <DCD_MAXPATHLENGTH ) { +strncat (sz_reg_key, sz_obj_type, +strlen (sz_obj_type) +1 ); + }else { + status = -EPERM ; + } +uuid_uuid_to_string (uuid_obj, sz_uuid,MAXUUIDLEN ); +if ((strlen (sz_reg_key) +MAXUUIDLEN ) <DCD_MAXPATHLENGTH ) +strncat (sz_reg_key, sz_uuid,MAXUUIDLEN ); +else + status = -EPERM ; + +spin_lock (&dbdcd_lock); +list_for_each_entry (dcd_key, ®_key_list, link) { +/* See if the name matches. */ +if (!strncmp (dcd_key->name, sz_reg_key, +strlen (sz_reg_key) +1 )) +break ; + } +spin_unlock (&dbdcd_lock); + + status = (&dcd_key->link != ®_key_list) ? +0 : -ENOKEY ; + } + +if (DSP_SUCCEEDED (status)) +memcpy (pstrLibName, dcd_key->path,strlen (dcd_key->path) +1 ); +return status; +} + +/* +* ======== dcd_init ======== +* Purpose: +* Initialize the DCD module. +*/ +bool dcd_init (void ) +{ +bool init_cod; +bool ret = true; + +DBC_REQUIRE (refs >=0 ); + +if (refs ==0 ) { +/* Initialize required modules. */ + init_cod =cod_init (); + +if (!init_cod) { + ret = false; +/* Exit initialized modules. */ +if (init_cod) +cod_exit (); + } + +INIT_LIST_HEAD (®_key_list); + } + +if (ret) + refs++; + +DBC_ENSURE ((ret && (refs >0 )) || (!ret && (refs ==0 ))); + +return ret; +} + +/* +* ======== dcd_register_object ======== +* Purpose: +* Registers a node or a processor with the DCD. +* If psz_path_name == NULL, unregister the specified DCD object. +*/ +int dcd_register_object(IN struct dsp_uuid *uuid_obj, + IN enum dsp_dcdobjtype obj_type, + IN char *psz_path_name) +{ +int status =0 ; +char sz_reg_key[DCD_MAXPATHLENGTH ]; +char sz_uuid[MAXUUIDLEN +1 ]; +u32 dw_path_size =0 ; +u32 dw_key_len;/* Len of REG key. */ +char sz_obj_type[MAX_INT2CHAR_LENGTH ];/* str. rep. of obj_type. */ +struct dcd_key_elem *dcd_key =NULL ; + +DBC_REQUIRE (refs >0 ); +DBC_REQUIRE (uuid_obj !=NULL ); +DBC_REQUIRE ((obj_type ==DSP_DCDNODETYPE ) || + (obj_type ==DSP_DCDPROCESSORTYPE ) || + (obj_type ==DSP_DCDLIBRARYTYPE ) || + (obj_type ==DSP_DCDCREATELIBTYPE ) || + (obj_type ==DSP_DCDEXECUTELIBTYPE ) || + (obj_type ==DSP_DCDDELETELIBTYPE )); + +dev_dbg (bridge,"%s: object UUID %p, obj_type %d, szPathName %s\n" , + __func__, uuid_obj, obj_type, psz_path_name); + +/* +* Pre-determine final key length. It's length of DCD_REGKEY + +* "_\0" + length of sz_obj_type string + terminating NULL. +*/ + dw_key_len =strlen (DCD_REGKEY ) +1 +sizeof (sz_obj_type) +1 ; +DBC_ASSERT (dw_key_len <DCD_MAXPATHLENGTH ); + +/* Create proper REG key; concatenate DCD_REGKEY with obj_type. */ +strncpy (sz_reg_key,DCD_REGKEY ,strlen (DCD_REGKEY ) +1 ); +if ((strlen (sz_reg_key) +strlen ("_\0" )) <DCD_MAXPATHLENGTH ) +strncat (sz_reg_key,"_\0" ,2 ); +else { + status = -EPERM ; + goto func_end; + } + + status =snprintf (sz_obj_type,MAX_INT2CHAR_LENGTH ,"%d" , obj_type); +if (status ==-1 ) { + status = -EPERM ; + }else { + status =0 ; +if ((strlen (sz_reg_key) +strlen (sz_obj_type)) < +DCD_MAXPATHLENGTH ) { +strncat (sz_reg_key, sz_obj_type, +strlen (sz_obj_type) +1 ); + }else + status = -EPERM ; + +/* Create UUID value to set in registry. */ +uuid_uuid_to_string (uuid_obj, sz_uuid,MAXUUIDLEN ); +if ((strlen (sz_reg_key) +MAXUUIDLEN ) <DCD_MAXPATHLENGTH ) +strncat (sz_reg_key, sz_uuid,MAXUUIDLEN ); +else + status = -EPERM ; + } + +if (DSP_FAILED (status)) + goto func_end; + +/* +* If psz_path_name != NULL, perform registration, otherwise, +* perform unregistration. +*/ + +if (psz_path_name) { + dw_path_size =strlen (psz_path_name) +1 ; +spin_lock (&dbdcd_lock); +list_for_each_entry (dcd_key, ®_key_list, link) { +/* See if the name matches. */ +if (!strncmp (dcd_key->name, sz_reg_key, +strlen (sz_reg_key) +1 )) +break ; + } +spin_unlock (&dbdcd_lock); +if (&dcd_key->link == ®_key_list) { +/* +* Add new reg value (UUID+obj_type) +* with COFF path info +*/ + + dcd_key =kmalloc (sizeof (struct dcd_key_elem ), +GFP_KERNEL ); +if (!dcd_key) { + status = -ENOMEM ; + goto func_end; + } + + dcd_key->path =kmalloc (strlen (sz_reg_key) +1 , +GFP_KERNEL ); + +if (!dcd_key->path) { +kfree (dcd_key); + status = -ENOMEM ; + goto func_end; + } + +strncpy (dcd_key->name, sz_reg_key, +strlen (sz_reg_key) +1 ); +strncpy (dcd_key->path, psz_path_name , + dw_path_size); +spin_lock (&dbdcd_lock); +list_add_tail (&dcd_key->link, ®_key_list); +spin_unlock (&dbdcd_lock); + }else { +/* Make sure the new data is the same. */ +if (strncmp (dcd_key->path, psz_path_name, + dw_path_size)) { +/* The caller needs a different data size! */ +kfree (dcd_key->path); + dcd_key->path =kmalloc (dw_path_size, +GFP_KERNEL ); +if (dcd_key->path ==NULL ) { + status = -ENOMEM ; + goto func_end; + } + } + +/* We have a match! Copy out the data. */ +memcpy (dcd_key->path, psz_path_name, dw_path_size); + } +dev_dbg (bridge,"%s: psz_path_name=%s, dw_path_size=%d\n" , + __func__, psz_path_name, dw_path_size); + }else { +/* Deregister an existing object */ +spin_lock (&dbdcd_lock); +list_for_each_entry (dcd_key, ®_key_list, link) { +if (!strncmp (dcd_key->name, sz_reg_key, +strlen (sz_reg_key) +1 )) { +list_del (&dcd_key->link); +kfree (dcd_key->path); +kfree (dcd_key); +break ; + } + } +spin_unlock (&dbdcd_lock); +if (&dcd_key->link == ®_key_list) + status = -EPERM ; + } + +if (DSP_SUCCEEDED (status)) { +/* +* Because the node database has been updated through a +* successful object registration/de-registration operation, +* we need to reset the object enumeration counter to allow +* current enumerations to reflect this update in the node +* database. +*/ + enum_refs =0 ; + } +func_end: +return status; +} + +/* +* ======== dcd_unregister_object ======== +* Call DCD_Register object with psz_path_name set to NULL to +* perform actual object de-registration. +*/ +int dcd_unregister_object(IN struct dsp_uuid *uuid_obj, + IN enum dsp_dcdobjtype obj_type) +{ +int status =0 ; + +DBC_REQUIRE (refs >0 ); +DBC_REQUIRE (uuid_obj !=NULL ); +DBC_REQUIRE ((obj_type ==DSP_DCDNODETYPE ) || + (obj_type ==DSP_DCDPROCESSORTYPE ) || + (obj_type ==DSP_DCDLIBRARYTYPE ) || + (obj_type ==DSP_DCDCREATELIBTYPE ) || + (obj_type ==DSP_DCDEXECUTELIBTYPE ) || + (obj_type ==DSP_DCDDELETELIBTYPE )); + +/* +* When dcd_register_object is called with NULL as pathname, +* it indicates an unregister object operation. +*/ + status =dcd_register_object (uuid_obj, obj_type,NULL ); + +return status; +} + +/* +********************************************************************** +* DCD Helper Functions +********************************************************************** +*/ + +/* +* ======== atoi ======== +* Purpose: +* This function converts strings in decimal or hex format to integers. +*/ +static s32 atoi (char *psz_buf) +{ +char *pch = psz_buf; +s32 base =0 ; + +while (isspace (*pch)) + pch++; + +if (*pch =='-' || *pch =='+' ) { + base =10 ; + pch++; + }else if (*pch &&tolower (pch[strlen (pch) -1 ]) =='h' ) { + base =16 ; + } + +return simple_strtoul (pch,NULL , base); +} + +/* +* ======== get_attrs_from_buf ======== +* Purpose: +* Parse the content of a buffer filled with DSP-side data and +* retrieve an object's attributes from it. IMPORTANT: Assume the +* buffer has been converted from DSP format to GPP format. +*/ +static int get_attrs_from_buf (char *psz_buf,u32 ul_buf_size, +enum dsp_dcdobjtype obj_type, +struct dcd_genericobj *pGenObj) +{ +int status =0 ; +char seps[] =", " ; +char *psz_cur; +char *token; +s32 token_len =0 ; +u32 i =0 ; +#ifdef _DB_TIOMAP +s32 entry_id; +#endif + +DBC_REQUIRE (psz_buf !=NULL ); +DBC_REQUIRE (ul_buf_size !=0 ); +DBC_REQUIRE ((obj_type ==DSP_DCDNODETYPE ) + || (obj_type ==DSP_DCDPROCESSORTYPE )); +DBC_REQUIRE (pGenObj !=NULL ); + +switch (obj_type) { +case DSP_DCDNODETYPE : +/* +* Parse COFF sect buffer to retrieve individual tokens used +* to fill in object attrs. +*/ + psz_cur = psz_buf; + token =strsep (&psz_cur, seps); + +/* u32 cb_struct */ + pGenObj->obj_data.node_obj.ndb_props.cb_struct = + (u32 )atoi (token); + token =strsep (&psz_cur, seps); + +/* dsp_uuid ui_node_id */ +uuid_uuid_from_string (token, + &pGenObj->obj_data.node_obj.ndb_props. + ui_node_id); + token =strsep (&psz_cur, seps); + +/* ac_name */ +DBC_REQUIRE (token); + token_len =strlen (token); +if (token_len >DSP_MAXNAMELEN -1 ) + token_len =DSP_MAXNAMELEN -1 ; + +strncpy (pGenObj->obj_data.node_obj.ndb_props.ac_name, + token, token_len); + pGenObj->obj_data.node_obj.ndb_props.ac_name[token_len] ='\0' ; + token =strsep (&psz_cur, seps); +/* u32 ntype */ + pGenObj->obj_data.node_obj.ndb_props.ntype =atoi (token); + token =strsep (&psz_cur, seps); +/* u32 cache_on_gpp */ + pGenObj->obj_data.node_obj.ndb_props.cache_on_gpp =atoi (token); + token =strsep (&psz_cur, seps); +/* dsp_resourcereqmts dsp_resource_reqmts */ + pGenObj->obj_data.node_obj.ndb_props.dsp_resource_reqmts. + cb_struct = (u32 )atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.node_obj.ndb_props. + dsp_resource_reqmts.static_data_size =atoi (token); + token =strsep (&psz_cur, seps); + pGenObj->obj_data.node_obj.ndb_props. + dsp_resource_reqmts.global_data_size =atoi (token); + token =strsep (&psz_cur, seps); + pGenObj->obj_data.node_obj.ndb_props. + dsp_resource_reqmts.program_mem_size =atoi (token); + token =strsep (&psz_cur, seps); + pGenObj->obj_data.node_obj.ndb_props. + dsp_resource_reqmts.uwc_execution_time =atoi (token); + token =strsep (&psz_cur, seps); + pGenObj->obj_data.node_obj.ndb_props. + dsp_resource_reqmts.uwc_period =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.node_obj.ndb_props. + dsp_resource_reqmts.uwc_deadline =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.node_obj.ndb_props. + dsp_resource_reqmts.avg_exection_time =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.node_obj.ndb_props. + dsp_resource_reqmts.minimum_period =atoi (token); + token =strsep (&psz_cur, seps); + +/* s32 prio */ + pGenObj->obj_data.node_obj.ndb_props.prio =atoi (token); + token =strsep (&psz_cur, seps); + +/* u32 stack_size */ + pGenObj->obj_data.node_obj.ndb_props.stack_size =atoi (token); + token =strsep (&psz_cur, seps); + +/* u32 sys_stack_size */ + pGenObj->obj_data.node_obj.ndb_props.sys_stack_size = +atoi (token); + token =strsep (&psz_cur, seps); + +/* u32 stack_seg */ + pGenObj->obj_data.node_obj.ndb_props.stack_seg =atoi (token); + token =strsep (&psz_cur, seps); + +/* u32 message_depth */ + pGenObj->obj_data.node_obj.ndb_props.message_depth = +atoi (token); + token =strsep (&psz_cur, seps); + +/* u32 num_input_streams */ + pGenObj->obj_data.node_obj.ndb_props.num_input_streams = +atoi (token); + token =strsep (&psz_cur, seps); + +/* u32 num_output_streams */ + pGenObj->obj_data.node_obj.ndb_props.num_output_streams = +atoi (token); + token =strsep (&psz_cur, seps); + +/* u32 utimeout */ + pGenObj->obj_data.node_obj.ndb_props.utimeout =atoi (token); + token =strsep (&psz_cur, seps); + +/* char *pstr_create_phase_fxn */ +DBC_REQUIRE (token); + token_len =strlen (token); + pGenObj->obj_data.node_obj.pstr_create_phase_fxn = +kzalloc (token_len +1 ,GFP_KERNEL ); +strncpy (pGenObj->obj_data.node_obj.pstr_create_phase_fxn, + token, token_len); + pGenObj->obj_data.node_obj.pstr_create_phase_fxn[token_len] = +'\0' ; + token =strsep (&psz_cur, seps); + +/* char *pstr_execute_phase_fxn */ +DBC_REQUIRE (token); + token_len =strlen (token); + pGenObj->obj_data.node_obj.pstr_execute_phase_fxn = +kzalloc (token_len +1 ,GFP_KERNEL ); +strncpy (pGenObj->obj_data.node_obj.pstr_execute_phase_fxn, + token, token_len); + pGenObj->obj_data.node_obj.pstr_execute_phase_fxn[token_len] = +'\0' ; + token =strsep (&psz_cur, seps); + +/* char *pstr_delete_phase_fxn */ +DBC_REQUIRE (token); + token_len =strlen (token); + pGenObj->obj_data.node_obj.pstr_delete_phase_fxn = +kzalloc (token_len +1 ,GFP_KERNEL ); +strncpy (pGenObj->obj_data.node_obj.pstr_delete_phase_fxn, + token, token_len); + pGenObj->obj_data.node_obj.pstr_delete_phase_fxn[token_len] = +'\0' ; + token =strsep (&psz_cur, seps); + +/* Segment id for message buffers */ + pGenObj->obj_data.node_obj.msg_segid =atoi (token); + token =strsep (&psz_cur, seps); + +/* Message notification type */ + pGenObj->obj_data.node_obj.msg_notify_type =atoi (token); + token =strsep (&psz_cur, seps); + +/* char *pstr_i_alg_name */ +if (token) { + token_len =strlen (token); + pGenObj->obj_data.node_obj.pstr_i_alg_name = +kzalloc (token_len +1 ,GFP_KERNEL ); +strncpy (pGenObj->obj_data.node_obj.pstr_i_alg_name, + token, token_len); + pGenObj->obj_data.node_obj.pstr_i_alg_name[token_len] = +'\0' ; + token =strsep (&psz_cur, seps); + } + +/* Load type (static, dynamic, or overlay) */ +if (token) { + pGenObj->obj_data.node_obj.us_load_type =atoi (token); + token =strsep (&psz_cur, seps); + } + +/* Dynamic load data requirements */ +if (token) { + pGenObj->obj_data.node_obj.ul_data_mem_seg_mask = +atoi (token); + token =strsep (&psz_cur, seps); + } + +/* Dynamic load code requirements */ +if (token) { + pGenObj->obj_data.node_obj.ul_code_mem_seg_mask = +atoi (token); + token =strsep (&psz_cur, seps); + } + +/* Extract node profiles into node properties */ +if (token) { + + pGenObj->obj_data.node_obj.ndb_props.count_profiles = +atoi (token); +for (i =0 ; + i < + pGenObj->obj_data.node_obj. + ndb_props.count_profiles; i++) { + token =strsep (&psz_cur, seps); +if (token) { +/* Heap Size for the node */ + pGenObj->obj_data.node_obj. + ndb_props.node_profiles[i]. + ul_heap_size =atoi (token); + } + } + } + token =strsep (&psz_cur, seps); +if (token) { + pGenObj->obj_data.node_obj.ndb_props.stack_seg_name = + (u32) (token); + } + +break ; + +case DSP_DCDPROCESSORTYPE : +/* +* Parse COFF sect buffer to retrieve individual tokens used +* to fill in object attrs. +*/ + psz_cur = psz_buf; + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.proc_info.cb_struct =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.proc_info.processor_family =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.proc_info.processor_type =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.proc_info.clock_rate =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.proc_info.ul_internal_mem_size =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.proc_info.ul_external_mem_size =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.proc_info.processor_id =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.proc_info.ty_running_rtos =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.proc_info.node_min_priority =atoi (token); + token =strsep (&psz_cur, seps); + + pGenObj->obj_data.proc_info.node_max_priority =atoi (token); + +#ifdef _DB_TIOMAP +/* Proc object may contain additional(extended) attributes. */ +/* attr must match proc.hxx */ +for (entry_id =0 ; entry_id <7 ; entry_id++) { + token =strsep (&psz_cur, seps); + pGenObj->obj_data.ext_proc_obj.ty_tlb[entry_id]. + ul_gpp_phys =atoi (token); + + token =strsep (&psz_cur, seps); + pGenObj->obj_data.ext_proc_obj.ty_tlb[entry_id]. + ul_dsp_virt =atoi (token); + } +#endif + +break ; + +default : + status = -EPERM ; +break ; + } + +return status; +} + +/* +* ======== CompressBuffer ======== +* Purpose: +* Compress the DSP buffer, if necessary, to conform to PC format. +*/ +static void compress_buf (char *psz_buf,u32 ul_buf_size,s32 cCharSize) +{ +char *p; +char ch; +char *q; + + p = psz_buf; +if (p ==NULL ) +return ; + +for (q = psz_buf; q < (psz_buf + ul_buf_size);) { + ch =dsp_char2_gpp_char (q, cCharSize); +if (ch =='\\' ) { + q += cCharSize; + ch =dsp_char2_gpp_char (q, cCharSize); +switch (ch) { +case 't' : + *p ='\t' ; +break ; + +case 'n' : + *p ='\n' ; +break ; + +case 'r' : + *p ='\r' ; +break ; + +case '0' : + *p ='\0' ; +break ; + +default : + *p = ch; +break ; + } + }else { + *p = ch; + } + p++; + q += cCharSize; + } + +/* NULL out remainder of buffer. */ +while (p < q) + *p++ ='\0' ; +} + +/* +* ======== dsp_char2_gpp_char ======== +* Purpose: +* Convert DSP char to host GPP char in a portable manner +*/ +static char dsp_char2_gpp_char (char *pWord,s32 cDspCharSize) +{ +char ch ='\0' ; +char *ch_src; +s32 i; + +for (ch_src = pWord, i = cDspCharSize; i >0 ; i--) + ch |= *ch_src++; + +return ch; +} + +/* +* ======== get_dep_lib_info ======== +*/ +static int get_dep_lib_info(IN struct dcd_manager *hdcd_mgr, + IN struct dsp_uuid *uuid_obj, + IN OUT u16 *pNumLibs, + OPTIONAL OUT u16 *pNumPersLibs, + OPTIONAL OUT struct dsp_uuid *pDepLibUuids, + OPTIONAL OUT bool *pPersistentDepLibs, + enum nldr_phase phase) +{ + struct dcd_manager *dcd_mgr_obj = hdcd_mgr; +char *psz_coff_buf =NULL ; +char *psz_cur; +char *psz_file_name =NULL ; +struct cod_libraryobj *lib =NULL ; +u32 ul_addr =0 ;/* Used by cod_get_section */ +u32 ul_len =0 ;/* Used by cod_get_section */ +u32 dw_data_size =COD_MAXPATHLENGTH ; +char seps[] =", " ; +char *token =NULL ; +bool get_uuids = (pDepLibUuids !=NULL ); +u16 dep_libs =0 ; +int status =0 ; + +DBC_REQUIRE (refs >0 ); + +DBC_REQUIRE (hdcd_mgr); +DBC_REQUIRE (pNumLibs !=NULL ); +DBC_REQUIRE (uuid_obj !=NULL ); + +/* Initialize to 0 dependent libraries, if only counting number of +* dependent libraries */ +if (!get_uuids) { + *pNumLibs =0 ; + *pNumPersLibs =0 ; + } + +/* Allocate a buffer for file name */ + psz_file_name =kzalloc (dw_data_size,GFP_KERNEL ); +if (psz_file_name ==NULL ) { + status = -ENOMEM ; + }else { +/* Get the name of the library */ + status =dcd_get_library_name (hdcd_mgr, uuid_obj, psz_file_name, + &dw_data_size, phase,NULL ); + } + +/* Open the library */ +if (DSP_SUCCEEDED (status)) { + status =cod_open (dcd_mgr_obj->cod_mgr, psz_file_name, +COD_NOLOAD , &lib); + } +if (DSP_SUCCEEDED (status)) { +/* Get dependent library section information. */ + status =cod_get_section (lib,DEPLIBSECT , &ul_addr, &ul_len); + +if (DSP_FAILED (status)) { +/* Ok, no dependent libraries */ + ul_len =0 ; + status =0 ; + } + } + +if (DSP_FAILED (status) || !(ul_len >0 )) + goto func_cont; + +/* Allocate zeroed buffer. */ + psz_coff_buf =kzalloc (ul_len +4 ,GFP_KERNEL ); +if (psz_coff_buf ==NULL ) + status = -ENOMEM ; + +/* Read section contents. */ + status =cod_read_section (lib,DEPLIBSECT , psz_coff_buf, ul_len); +if (DSP_FAILED (status)) + goto func_cont; + +/* Compress and format DSP buffer to conform to PC format. */ +compress_buf (psz_coff_buf, ul_len,DSPWORDSIZE ); + +/* Read from buffer */ + psz_cur = psz_coff_buf; +while ((token =strsep (&psz_cur, seps)) && *token !='\0' ) { +if (get_uuids) { +if (dep_libs >= *pNumLibs) { +/* Gone beyond the limit */ +break ; + }else { +/* Retrieve UUID string. */ +uuid_uuid_from_string (token, + &(pDepLibUuids + [dep_libs])); +/* Is this library persistent? */ + token =strsep (&psz_cur, seps); + pPersistentDepLibs[dep_libs] =atoi (token); + dep_libs++; + } + }else { +/* Advanc to next token */ + token =strsep (&psz_cur, seps); +if (atoi (token)) + (*pNumPersLibs)++; + +/* Just counting number of dependent libraries */ + (*pNumLibs)++; + } + } +func_cont: +if (lib) +cod_close (lib); + +/* Free previously allocated dynamic buffers. */ +kfree (psz_file_name); + +kfree (psz_coff_buf); + +return status; +}
drivers/staging/tidspbridge/rmgr/disp.c new file +754 -0
754 lines not on this page · raw message
drivers/staging/tidspbridge/rmgr/drv.c new file +1047 -0
740 lines not on this page · raw message
drivers/staging/tidspbridge/rmgr/drv_interface.c new file +644 -0
644 lines not on this page · raw message
drivers/staging/tidspbridge/rmgr/drv_interface.h new file +27 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/rmgr/dspdrv.c new file +142 -0
142 lines not on this page · raw message
drivers/staging/tidspbridge/rmgr/mgr.c new file +374 -0
374 lines not on this page · raw message
drivers/staging/tidspbridge/rmgr/nldr.c new file +1999 -0
1,999 lines not on this page · raw message
drivers/staging/tidspbridge/rmgr/node.c new file +3231 -0
3,231 lines not on this page · raw message
drivers/staging/tidspbridge/rmgr/proc.c new file +1948 -0
1,948 lines not on this page · raw message
drivers/staging/tidspbridge/rmgr/pwr.c new file +182 -0
182 lines not on this page · raw message
drivers/staging/tidspbridge/rmgr/rmm.c new file +535 -0
535 lines not on this page · raw message
drivers/staging/tidspbridge/rmgr/strm.c new file +861 -0
861 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.0.4
Part of the diff is not shown here. View the raw message.
PATCH 5/11 staging: ti dspbridge: add MMU support
In reply to Ohad Ben-CohenFrom: Omar Ramirez Luna <[email protected]>
Add TI's DSP Bridge MMU support
--- drivers/staging/tidspbridge/hw/EasiGlobal.h | 41 ++ drivers/staging/tidspbridge/hw/GlobalTypes.h | 308 ++++++++++++++ drivers/staging/tidspbridge/hw/MMUAccInt.h | 76 ++++ drivers/staging/tidspbridge/hw/MMURegAcM.h | 226 ++++++++++ drivers/staging/tidspbridge/hw/hw_defs.h | 60 +++ drivers/staging/tidspbridge/hw/hw_mmu.c | 587 ++++++++++++++++++++++++++ drivers/staging/tidspbridge/hw/hw_mmu.h | 161 +++++++ 7 files changed, 1459 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/hw/EasiGlobal.h create mode 100644 drivers/staging/tidspbridge/hw/GlobalTypes.h create mode 100644 drivers/staging/tidspbridge/hw/MMUAccInt.h create mode 100644 drivers/staging/tidspbridge/hw/MMURegAcM.h create mode 100644 drivers/staging/tidspbridge/hw/hw_defs.h create mode 100644 drivers/staging/tidspbridge/hw/hw_mmu.c create mode 100644 drivers/staging/tidspbridge/hw/hw_mmu.h
drivers/staging/tidspbridge/hw/EasiGlobal.h new file +41 -0
@@ -0,0 +1,41 @@ +/* +* EasiGlobal.h +* +* DSP-BIOS Bridge driver support functions for TI OMAP processors. +* +* Copyright (C) 2007 Texas Instruments, Inc. +* +* This package is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef _EASIGLOBAL_H +#define _EASIGLOBAL_H +#include <linux/types.h> + +/* +* DEFINE: READ_ONLY, WRITE_ONLY & READ_WRITE +* +* DESCRIPTION: Defines used to describe register types for EASI-checker tests. +*/ + +#define READ_ONLY 1 +#define WRITE_ONLY 2 +#define READ_WRITE 3 + +/* +* MACRO: _DEBUG_LEVEL1_EASI +* +* DESCRIPTION: A MACRO which can be used to indicate that a particular beach +* register access function was called. +* +* NOTE: We currently dont use this functionality. +*/ +#define _DEBUG_LEVEL1_EASI (easiNum) ((void)0) + +#endif /* _EASIGLOBAL_H */
drivers/staging/tidspbridge/hw/GlobalTypes.h new file +308 -0
308 lines not on this page · raw message
drivers/staging/tidspbridge/hw/MMUAccInt.h new file +76 -0
76 lines not on this page · raw message
drivers/staging/tidspbridge/hw/MMURegAcM.h new file +226 -0
226 lines not on this page · raw message
drivers/staging/tidspbridge/hw/hw_defs.h new file +60 -0
60 lines not on this page · raw message
drivers/staging/tidspbridge/hw/hw_mmu.c new file +587 -0
587 lines not on this page · raw message
drivers/staging/tidspbridge/hw/hw_mmu.h new file +161 -0
161 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 6/11 staging: ti dspbridge: add generic utilities
In reply to Ohad Ben-CohenFrom: Omar Ramirez Luna <[email protected]>
Add TI's DSP Bridge generic utilities driver sources
--- drivers/staging/tidspbridge/gen/gb.c | 167 +++++++++++++++++++++ drivers/staging/tidspbridge/gen/gh.c | 213 ++++++++++++++++++++++++++ drivers/staging/tidspbridge/gen/gs.c | 89 +++++++++++ drivers/staging/tidspbridge/gen/uuidutil.c | 223 ++++++++++++++++++++++++++++ 4 files changed, 692 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/gen/gb.c create mode 100644 drivers/staging/tidspbridge/gen/gh.c create mode 100644 drivers/staging/tidspbridge/gen/gs.c create mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c
drivers/staging/tidspbridge/gen/gb.c new file +167 -0
@@ -0,0 +1,167 @@ +/* +* gb.c +* +* DSP-BIOS Bridge driver support functions for TI OMAP processors. +* +* Generic bitmap operations. +* +* Copyright (C) 2005-2006 Texas Instruments, Inc. +* +* This package is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* ----------------------------------- DSP/BIOS Bridge */ +#include <dspbridge/std.h> +#include <linux/types.h> +/* ----------------------------------- This */ +#include <dspbridge/gs.h> +#include <dspbridge/gb.h> + +struct gb_t_map { +u32 len; +u32 wcnt; +u32 *words; +}; + +/* +* ======== gb_clear ======== +* purpose: +* Clears a bit in the bit map. +*/ + +void gb_clear (struct gb_t_map *map,u32 bitn) +{ +u32 mask; + + mask =1L << (bitn %BITS_PER_LONG ); + map->words[bitn /BITS_PER_LONG ] &= ~mask; +} + +/* +* ======== gb_create ======== +* purpose: +* Creates a bit map. +*/ + +struct gb_t_map *gb_create (u32 len) +{ +struct gb_t_map *map; +u32 i; + map = (struct gb_t_map *)gs_alloc (sizeof (struct gb_t_map )); +if (map !=NULL ) { + map->len = len; + map->wcnt = len /BITS_PER_LONG +1 ; + map->words = (u32 *)gs_alloc (map->wcnt *sizeof (u32)); +if (map->words !=NULL ) { +for (i =0 ; i < map->wcnt; i++) + map->words[i] =0L ; + + }else { +gs_frees (map,sizeof (struct gb_t_map )); + map =NULL ; + } + } + +return map; +} + +/* +* ======== gb_delete ======== +* purpose: +* Frees a bit map. +*/ + +void gb_delete (struct gb_t_map *map) +{ +gs_frees (map->words, map->wcnt *sizeof (u32)); +gs_frees (map,sizeof (struct gb_t_map )); +} + +/* +* ======== gb_findandset ======== +* purpose: +* Finds a free bit and sets it. +*/ +u32 gb_findandset (struct gb_t_map *map) +{ +u32 bitn; + + bitn =gb_minclear (map); + +if (bitn !=GB_NOBITS ) +gb_set (map, bitn); + +return bitn; +} + +/* +* ======== gb_minclear ======== +* purpose: +* returns the location of the first unset bit in the bit map. +*/ +u32 gb_minclear (struct gb_t_map *map) +{ +u32 bit_location =0 ; +u32 bit_acc =0 ; +u32 i; +u32 bit; +u32 *word; + +for (word = map->words, i =0 ; i < map->wcnt; word++, i++) { +if (~*word) { +for (bit =0 ; bit <BITS_PER_LONG ; bit++, bit_acc++) { +if (bit_acc == map->len) +return GB_NOBITS ; + +if (~*word & (1L << bit)) { + bit_location = i *BITS_PER_LONG + bit; +return bit_location; + } + + } + }else { + bit_acc +=BITS_PER_LONG ; + } + } + +return GB_NOBITS ; +} + +/* +* ======== gb_set ======== +* purpose: +* Sets a bit in the bit map. +*/ + +void gb_set (struct gb_t_map *map,u32 bitn) +{ +u32 mask; + + mask =1L << (bitn %BITS_PER_LONG ); + map->words[bitn /BITS_PER_LONG ] |= mask; +} + +/* +* ======== gb_test ======== +* purpose: +* Returns true if the bit is set in the specified location. +*/ + +bool gb_test (struct gb_t_map *map,u32 bitn) +{ +bool state; +u32 mask; +u32 word; + + mask =1L << (bitn %BITS_PER_LONG ); + word = map->words[bitn /BITS_PER_LONG ]; + state = word & mask ? TRUE : FALSE; + +return state; +}
drivers/staging/tidspbridge/gen/gh.c new file +213 -0
213 lines not on this page · raw message
drivers/staging/tidspbridge/gen/gs.c new file +89 -0
89 lines not on this page · raw message
drivers/staging/tidspbridge/gen/uuidutil.c new file +223 -0
223 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [PATCH 06/11] staging: ti dspbridge: add generic utilities
Quoted 5 lines · Ohad Ben-Cohen
Add TI's DSP Bridge generic utilities driver sources
Signed-off-by Andy Shevchenko <[email protected]>+++
b/drivers/staging/tidspbridge/gen/uuidutil.c
Following part could be significantly simplified
drivers/staging/tidspbridge/gen/uuidutil.c line 118
Quoted 11 lines
drivers/staging/tidspbridge/gen/uuidutil.c new file +10
-0+/* +* ======== htoi ======== +* Purpose: +* Converts a hex value to a decimal integer. +*/ +/* +* ======== uuid_uuid_from_string ======== +* Purpose: +* Converts a string to a struct dsp_uuid. +*/
There is a code (because I am already in s-o-b list I just put here the excerpts, however, I could prepare patch in standard form, if you want to)
static s32 uuid_hex_to_bin(char *buf, s32 len)
{
s32 i;
s32 result = 0;
for (i = 0; i < len; i++) {
value = hex_to_bin(*buf++);
result *= 16;
if (value > 0)
result += value;
}
return result;
}void uuid_uuid_from_string(IN char *pszUuid, OUT struct dsp_uuid *uuid_obj)
{
s32 j;
uuid_obj->ul_data1 = uuid_hex_to_bin(pszUuid, 8);
pszUuid += 8;
/* Step over underscore */
pszUuid++;
uuid_obj->us_data2 = (u16) uuid_hex_to_bin(pszUuid, 4);
pszUuid += 4;
/* Step over underscore */
pszUuid++;
uuid_obj->us_data3 = (u16) uuid_hex_to_bin(pszUuid, 4);
pszUuid += 4;
/* Step over underscore */
pszUuid++;
uuid_obj->uc_data4 = (u8) uuid_hex_to_bin(pszUuid, 2);
pszUuid += 2;
uuid_obj->uc_data5 = (u8) uuid_hex_to_bin(pszUuid, 2);
pszUuid += 2;
/* Step over underscore */
pszUuid++;
for (j = 0; j < 6; j++) {
uuid_obj->uc_data6[j] = (u8) uuid_hex_to_bin(pszUuid, 2);
pszUuid += 2;
}
}Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 06/11] staging: ti dspbridge: add generic utilities
Quoted 1 line · Andy Shevchenko
... I could prepare patch in standard form, if you want to
That could be great, thanks !
PATCH 1/1 staging: tidspbridge: gen: simplify and clean up
There is recently added hex_to_bin() kernel's method which we could use instead of custom long function.
--- drivers/staging/tidspbridge/gen/uuidutil.c | 167 +++++----------------------- 1 files changed, 28 insertions(+), 139 deletions(-)
drivers/staging/tidspbridge/gen/uuidutil.c +28 -139
@@ -54,61 +54,19 @@ void uuid_uuid_to_string(IN struct dsp_uuid *uuid_obj, OUT char *pszUuid,DBC_ENSURE (i !=-1 ); } -/* -* ======== htoi ======== -* Purpose: -* Converts a hex value to a decimal integer. -*/ - -static int htoi (char c) +static s32 uuid_hex_to_bin (char *buf,s32 len) { -switch (c) { -case '0' : -return 0 ; -case '1' : -return 1 ; -case '2' : -return 2 ; -case '3' : -return 3 ; -case '4' : -return 4 ; -case '5' : -return 5 ; -case '6' : -return 6 ; -case '7' : -return 7 ; -case '8' : -return 8 ; -case '9' : -return 9 ; -case 'A' : -return 10 ; -case 'B' : -return 11 ; -case 'C' : -return 12 ; -case 'D' : -return 13 ; -case 'E' : -return 14 ; -case 'F' : -return 15 ; -case 'a' : -return 10 ; -case 'b' : -return 11 ; -case 'c' : -return 12 ; -case 'd' : -return 13 ; -case 'e' : -return 14 ; -case 'f' : -return 15 ; +s32 i; +s32 result =0 ; + +for (i =0 ; i < len; i++) { + value =hex_to_bin (*buf++); + result *=16 ; +if (value >0 ) + result += value; } -return 0 ; + +return result; }/*
@@ -118,106 +76,37 @@ static int htoi(char c)*/ void uuid_uuid_from_string(IN char *pszUuid, OUT struct dsp_uuid *uuid_obj) { -char c; -s32 i, j; -s32 result; -char *temp = pszUuid; +s32 j; - result =0 ; -for (i =0 ; i <8 ; i++) { -/* Get first character in string */ - c = *temp; - -/* Increase the results by new value */ - result *=16 ; - result +=htoi (c); - -/* Go to next character in string */ - temp++; - } - uuid_obj->ul_data1 = result; + uuid_obj->ul_data1 =uuid_hex_to_bin (pszUuid,8 ); + pszUuid +=8 ;/* Step over underscore */ - temp++; + pszUuid++; - result =0 ; -for (i =0 ; i <4 ; i++) { -/* Get first character in string */ - c = *temp; - -/* Increase the results by new value */ - result *=16 ; - result +=htoi (c); - -/* Go to next character in string */ - temp++; - } - uuid_obj->us_data2 = (u16 ) result; + uuid_obj->us_data2 = (u16 )uuid_hex_to_bin (pszUuid,4 ); + pszUuid +=4 ;/* Step over underscore */ - temp++; - - result =0 ; -for (i =0 ; i <4 ; i++) { -/* Get first character in string */ - c = *temp; + pszUuid++; -/* Increase the results by new value */ - result *=16 ; - result +=htoi (c); - -/* Go to next character in string */ - temp++; - } - uuid_obj->us_data3 = (u16 ) result; + uuid_obj->us_data3 = (u16 )uuid_hex_to_bin (pszUuid,4 ); + pszUuid +=4 ;/* Step over underscore */ - temp++; - - result =0 ; -for (i =0 ; i <2 ; i++) { -/* Get first character in string */ - c = *temp; + pszUuid++; -/* Increase the results by new value */ - result *=16 ; - result +=htoi (c); + uuid_obj->uc_data4 = (u8 )uuid_hex_to_bin (pszUuid,2 ); + pszUuid +=2 ; -/* Go to next character in string */ - temp++; - } - uuid_obj->uc_data4 = (u8 ) result; - - result =0 ; -for (i =0 ; i <2 ; i++) { -/* Get first character in string */ - c = *temp; - -/* Increase the results by new value */ - result *=16 ; - result +=htoi (c); - -/* Go to next character in string */ - temp++; - } - uuid_obj->uc_data5 = (u8 ) result; + uuid_obj->uc_data5 = (u8 )uuid_hex_to_bin (pszUuid,2 ); + pszUuid +=2 ;/* Step over underscore */ - temp++; + pszUuid++;for (j =0 ; j <6 ; j++) { - result =0 ; -for (i =0 ; i <2 ; i++) { -/* Get first character in string */ - c = *temp; - -/* Increase the results by new value */ - result *=16 ; - result +=htoi (c); - -/* Go to next character in string */ - temp++; - } - uuid_obj->uc_data6[j] = (u8 ) result; + uuid_obj->uc_data6[j] = (u8 )uuid_hex_to_bin (pszUuid,2 ); + pszUuid +=2 ; } }
Signature · 1 line
1.6.6.1
PATCH 7/11 staging: ti dspbridge: add services
In reply to Ohad Ben-CohenFrom: Omar Ramirez Luna <[email protected]>
Add TI's DSP Bridge driver services code
--- drivers/staging/tidspbridge/services/cfg.c | 253 +++++++++++++++++++++++ drivers/staging/tidspbridge/services/ntfy.c | 31 +++ drivers/staging/tidspbridge/services/services.c | 69 ++++++ drivers/staging/tidspbridge/services/sync.c | 104 +++++++++ 4 files changed, 457 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/services/cfg.c create mode 100644 drivers/staging/tidspbridge/services/ntfy.c create mode 100644 drivers/staging/tidspbridge/services/services.c create mode 100644 drivers/staging/tidspbridge/services/sync.c
drivers/staging/tidspbridge/services/cfg.c new file +253 -0
@@ -0,0 +1,253 @@ +/* +* cfg.c +* +* DSP-BIOS Bridge driver support functions for TI OMAP processors. +* +* Implementation of platform specific config services. +* +* Copyright (C) 2005-2006 Texas Instruments, Inc. +* +* This package is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* ----------------------------------- DSP/BIOS Bridge */ +#include <dspbridge/std.h> +#include <dspbridge/dbdefs.h> + +/* ----------------------------------- Trace & Debug */ +#include <dspbridge/dbc.h> + +/* ----------------------------------- OS Adaptation Layer */ + +/* ----------------------------------- This */ +#include <dspbridge/cfg.h> +#include <dspbridge/drv.h> + +struct drv_ext { +struct list_head link; +char sz_string[MAXREGPATHLENGTH ]; +}; + +/* +* ======== cfg_exit ======== +* Purpose: +* Discontinue usage of the CFG module. +*/ +void cfg_exit (void ) +{ +/* Do nothing */ +} + +/* +* ======== cfg_get_auto_start ======== +* Purpose: +* Retreive the autostart mask, if any, for this board. +*/ +int cfg_get_auto_start (struct cfg_devnode *dev_node_obj, + OUT u32 *pdwAutoStart) +{ +int status =0 ; +u32 dw_buf_size; +struct drv_data *drv_datap =dev_get_drvdata (bridge); + + dw_buf_size =sizeof (*pdwAutoStart); +if (!dev_node_obj) + status = -EFAULT ; +if (!pdwAutoStart || !drv_datap) + status = -EFAULT ; +if (DSP_SUCCEEDED (status)) + *pdwAutoStart = (drv_datap->base_img) ?1 :0 ; + +DBC_ENSURE ((status ==0 && + (*pdwAutoStart ==0 || *pdwAutoStart ==1 )) + || status !=0 ); +return status; +} + +/* +* ======== cfg_get_dev_object ======== +* Purpose: +* Retrieve the Device Object handle for a given devnode. +*/ +int cfg_get_dev_object (struct cfg_devnode *dev_node_obj, + OUT u32 *pdwValue) +{ +int status =0 ; +u32 dw_buf_size; +struct drv_data *drv_datap =dev_get_drvdata (bridge); + +if (!drv_datap) + status = -EPERM ; + +if (!dev_node_obj) + status = -EFAULT ; + +if (!pdwValue) + status = -EFAULT ; + + dw_buf_size =sizeof (pdwValue); +if (DSP_SUCCEEDED (status)) { + +/* check the device string and then store dev object */ +if (! + (strcmp + ((char *)((struct drv_ext *)dev_node_obj)->sz_string, +"TIOMAP1510" ))) + *pdwValue = (u32 )drv_datap->dev_object; + } +if (DSP_FAILED (status)) +pr_err ("%s: Failed, status 0x%x\n" , __func__, status); +return status; +} + +/* +* ======== cfg_get_exec_file ======== +* Purpose: +* Retreive the default executable, if any, for this board. +*/ +int cfg_get_exec_file (struct cfg_devnode *dev_node_obj,u32 ul_buf_size, + OUT char *pstrExecFile) +{ +int status =0 ; +struct drv_data *drv_datap =dev_get_drvdata (bridge); + +if (!dev_node_obj) + status = -EFAULT ; + +else if (!pstrExecFile || !drv_datap) + status = -EFAULT ; + +if (strlen (drv_datap->base_img) > ul_buf_size) + status = -EINVAL ; + +if (DSP_SUCCEEDED (status) && drv_datap->base_img) +strcpy (pstrExecFile, drv_datap->base_img); + +if (DSP_FAILED (status)) +pr_err ("%s: Failed, status 0x%x\n" , __func__, status); +DBC_ENSURE (((status ==0 ) && + (strlen (pstrExecFile) <= ul_buf_size)) + || (status !=0 )); +return status; +} + +/* +* ======== cfg_get_object ======== +* Purpose: +* Retrieve the Object handle from the Registry +*/ +int cfg_get_object(OUT u32 *pdwValue, u8 dw_type) +{ +int status = -EINVAL ; +struct drv_data *drv_datap =dev_get_drvdata (bridge); + +DBC_REQUIRE (pdwValue !=NULL ); + +if (!drv_datap) +return -EPERM ; + +switch (dw_type) { +case (REG_DRV_OBJECT ): +if (drv_datap->drv_object) { + *pdwValue = (u32 )drv_datap->drv_object; + status =0 ; + }else { + status = -ENODATA ; + } +break ; +case (REG_MGR_OBJECT ): +if (drv_datap->mgr_object) { + *pdwValue = (u32 )drv_datap->mgr_object; + status =0 ; + }else { + status = -ENODATA ; + } +break ; + +default : +break ; + } +if (DSP_FAILED (status)) { + *pdwValue =0 ; +pr_err ("%s: Failed, status 0x%x\n" , __func__, status); + } +DBC_ENSURE ((DSP_SUCCEEDED (status) && *pdwValue !=0 ) || + (DSP_FAILED (status) && *pdwValue ==0 )); +return status; +} + +/* +* ======== cfg_init ======== +* Purpose: +* Initialize the CFG module's private state. +*/ +bool cfg_init (void ) +{ +return true; +} + +/* +* ======== cfg_set_dev_object ======== +* Purpose: +* Store the Device Object handle and dev_node pointer for a given devnode. +*/ +int cfg_set_dev_object (struct cfg_devnode *dev_node_obj,u32 dwValue) +{ +int status =0 ; +struct drv_data *drv_datap =dev_get_drvdata (bridge); + +if (!drv_datap) { +pr_err ("%s: Failed, status 0x%x\n" , __func__, status); +return -EPERM ; + } + +if (!dev_node_obj) + status = -EFAULT ; + +if (DSP_SUCCEEDED (status)) { +/* Store the Bridge device object in the Registry */ + +if (!(strcmp ((char *)dev_node_obj,"TIOMAP1510" ))) + drv_datap->dev_object = (void *) dwValue; + } +if (DSP_FAILED (status)) +pr_err ("%s: Failed, status 0x%x\n" , __func__, status); + +return status; +} + +/* +* ======== cfg_set_object ======== +* Purpose: +* Store the Driver Object handle +*/ +int cfg_set_object (u32 dwValue,u8 dw_type) +{ +int status = -EINVAL ; +struct drv_data *drv_datap =dev_get_drvdata (bridge); + +if (!drv_datap) +return -EPERM ; + +switch (dw_type) { +case (REG_DRV_OBJECT ): + drv_datap->drv_object = (void *)dwValue; + status =0 ; +break ; +case (REG_MGR_OBJECT ): + drv_datap->mgr_object = (void *)dwValue; + status =0 ; +break ; +default : +break ; + } +if (DSP_FAILED (status)) +pr_err ("%s: Failed, status 0x%x\n" , __func__, status); +return status; +}
drivers/staging/tidspbridge/services/ntfy.c new file +31 -0
@@ -0,0 +1,31 @@ +/* +* ntfy.c +* +* DSP-BIOS Bridge driver support functions for TI OMAP processors. +* +* Manage lists of notification events. +* +* Copyright (C) 2005-2006 Texas Instruments, Inc. +* +* This package is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/* ----------------------------------- This */ +#include <dspbridge/ntfy.h> + +int dsp_notifier_event (struct notifier_block *this,unsigned long event, +void *data) +{ + struct ntfy_event *ne = container_of(this, struct ntfy_event, + noti_block); +if (ne->event & event) +sync_set_event (&ne->sync_obj); +return NOTIFY_OK ; +} +
drivers/staging/tidspbridge/services/services.c new file +69 -0
69 lines not on this page · raw message
drivers/staging/tidspbridge/services/sync.c new file +104 -0
104 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 8/11 staging: ti dspbridge: add DOFF binaries loader
In reply to Ohad Ben-CohenFrom: Omar Ramirez Luna <[email protected]>
Add TI's DSP Bridge DOFF binaries dynamic loader driver sources
--- drivers/staging/tidspbridge/dynload/cload.c | 1960 ++++++++++++++++++++ .../staging/tidspbridge/dynload/dload_internal.h | 351 ++++ drivers/staging/tidspbridge/dynload/doff.h | 344 ++++ drivers/staging/tidspbridge/dynload/getsection.c | 416 +++++ drivers/staging/tidspbridge/dynload/header.h | 55 + drivers/staging/tidspbridge/dynload/module_list.h | 159 ++ drivers/staging/tidspbridge/dynload/params.h | 226 +++ drivers/staging/tidspbridge/dynload/reloc.c | 484 +++++ drivers/staging/tidspbridge/dynload/reloc_table.h | 102 + .../tidspbridge/dynload/reloc_table_c6000.c | 257 +++ drivers/staging/tidspbridge/dynload/tramp.c | 1143 ++++++++++++ .../tidspbridge/dynload/tramp_table_c6000.c | 164 ++ 12 files changed, 5661 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/dynload/cload.c create mode 100644 drivers/staging/tidspbridge/dynload/dload_internal.h create mode 100644 drivers/staging/tidspbridge/dynload/doff.h create mode 100644 drivers/staging/tidspbridge/dynload/getsection.c create mode 100644 drivers/staging/tidspbridge/dynload/header.h create mode 100644 drivers/staging/tidspbridge/dynload/module_list.h create mode 100644 drivers/staging/tidspbridge/dynload/params.h create mode 100644 drivers/staging/tidspbridge/dynload/reloc.c create mode 100644 drivers/staging/tidspbridge/dynload/reloc_table.h create mode 100644 drivers/staging/tidspbridge/dynload/reloc_table_c6000.c create mode 100644 drivers/staging/tidspbridge/dynload/tramp.c create mode 100644 drivers/staging/tidspbridge/dynload/tramp_table_c6000.c
drivers/staging/tidspbridge/dynload/cload.c new file +1960 -0
@@ -0,0 +1,1960 @@ +/* +* cload.c +* +* DSP-BIOS Bridge driver support functions for TI OMAP processors. +* +* Copyright (C) 2005-2006 Texas Instruments, Inc. +* +* This package is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#include "header.h" + +#include "module_list.h" +#define LINKER_MODULES_HEADER ("_" MODULES_HEADER) + +/* +* we use the fact that DOFF section records are shaped just like +* ldr_section_info to reduce our section storage usage. This macro marks +* the places where that assumption is made +*/ +#define DOFFSEC_IS_LDRSEC (pdoffsec) ((struct ldr_section_info *)(pdoffsec)) + +/* +* forward references +*/ +static void dload_symbols (struct dload_state *dlthis); +static void dload_data (struct dload_state *dlthis); +static void allocate_sections (struct dload_state *dlthis); +static void string_table_free (struct dload_state *dlthis); +static void symbol_table_free (struct dload_state *dlthis); +static void section_table_free (struct dload_state *dlthis); +static void init_module_handle (struct dload_state *dlthis); +#if BITS_PER_AU >BITS_PER_BYTE +static char *unpack_name (struct dload_state *dlthis,u32 soffset); +#endif + +static const char cinitname[] = {".cinit" }; +static const char loader_dllview_root[] = {"?DLModules?" }; + +/* +* Error strings +*/ +static const char readstrm[] = {"Error reading %s from input stream" }; +static const char err_alloc[] = {"Syms->dload_allocate( %d ) failed" }; +static const char tgtalloc[] = { +"Target memory allocate failed, section %s size " FMT_UI32 }; +static const char initfail[] = {"%s to target address " FMT_UI32 " failed" }; +static const char dlvwrite[] = {"Write to DLLview list failed" }; +static const char iconnect[] = {"Connect call to init interface failed" }; +static const char err_checksum[] = {"Checksum failed on %s" }; + +/************************************************************************* +* Procedure dload_error +* +* Parameters: +* errtxt description of the error, printf style +* ... additional information +* +* Effect: +* Reports or records the error as appropriate. +*********************************************************************** */ +void dload_error (struct dload_state *dlthis,const char *errtxt, ...) +{ +va_list args; + +va_start (args, errtxt); + dlthis->mysym->error_report (dlthis->mysym, errtxt, args); +va_end (args); + dlthis->dload_errcount +=1 ; + +}/* dload_error */ + +#define DL_ERROR (zza, zzb) dload_error(dlthis, zza, zzb) + +/************************************************************************* +* Procedure dload_syms_error +* +* Parameters: +* errtxt description of the error, printf style +* ... additional information +* +* Effect: +* Reports or records the error as appropriate. +*********************************************************************** */ +void dload_syms_error (struct dynamic_loader_sym *syms,const char *errtxt, ...) +{ +va_list args; + +va_start (args, errtxt); + syms->error_report (syms, errtxt, args); +va_end (args); +} + +/************************************************************************* +* Procedure dynamic_load_module +* +* Parameters: +* module The input stream that supplies the module image +* syms Host-side symbol table and malloc/free functions +* alloc Target-side memory allocation +* init Target-side memory initialization +* options Option flags DLOAD_* +* mhandle A module handle for use with Dynamic_Unload +* +* Effect: +* The module image is read using *module. Target storage for the new +* image is +* obtained from *alloc. Symbols defined and referenced by the module are +* managed using *syms. The image is then relocated and references +* resolved as necessary, and the resulting executable bits are placed +* into target memory using *init. +* +* Returns: +* On a successful load, a module handle is placed in *mhandle, +* and zero is returned. On error, the number of errors detected is +* returned. Individual errors are reported during the load process +* using syms->error_report(). +********************************************************************** */ +int dynamic_load_module (struct dynamic_loader_stream *module, +struct dynamic_loader_sym *syms, +struct dynamic_loader_allocate *alloc, +struct dynamic_loader_initialize *init, +unsigned options,void **mhandle) +{ + registerunsigned *dp, sz; +struct dload_state dl_state;/* internal state for this call */ + +/* blast our internal state */ + dp = (unsigned *)&dl_state; +for (sz =sizeof (dl_state) /sizeof (unsigned ); sz >0 ; sz -=1 ) + *dp++ =0 ; + +/* Enable _only_ BSS initialization if enabled by user */ +if ((options &DLOAD_INITBSS ) ==DLOAD_INITBSS ) + dl_state.myoptions =DLOAD_INITBSS ; + +/* Check that mandatory arguments are present */ +if (!module || !syms) { +dload_error (&dl_state,"Required parameter is NULL" ); + }else { + dl_state.strm = module; + dl_state.mysym = syms; +dload_headers (&dl_state); +if (!dl_state.dload_errcount) +dload_strings (&dl_state, false); +if (!dl_state.dload_errcount) +dload_sections (&dl_state); + +if (init && !dl_state.dload_errcount) { +if (init->connect (init)) { + dl_state.myio = init; + dl_state.myalloc = alloc; +/* do now, before reducing symbols */ +allocate_sections (&dl_state); + }else +dload_error (&dl_state, iconnect); + } + +if (!dl_state.dload_errcount) { +/* fix up entry point address */ +unsigned sref = dl_state.dfile_hdr.df_entry_secn -1 ; +if (sref < dl_state.allocated_secn_count) + dl_state.dfile_hdr.df_entrypt += + dl_state.ldr_sections[sref].run_addr; + +dload_symbols (&dl_state); + } + +if (init && !dl_state.dload_errcount) +dload_data (&dl_state); + +init_module_handle (&dl_state); + +/* dl_state.myio is init or 0 at this point. */ +if (dl_state.myio) { +if ((!dl_state.dload_errcount) && + (dl_state.dfile_hdr.df_entry_secn !=DN_UNDEF ) && + (!init->execute (init, + dl_state.dfile_hdr.df_entrypt))) +dload_error (&dl_state,"Init->Execute Failed" ); + init->release (init); + } + +symbol_table_free (&dl_state); +section_table_free (&dl_state); +string_table_free (&dl_state); +dload_tramp_cleanup (&dl_state); + +if (dl_state.dload_errcount) { +dynamic_unload_module (dl_state.myhandle, syms, alloc, + init); + dl_state.myhandle =NULL ; + } + } + +if (mhandle) + *mhandle = dl_state.myhandle;/* give back the handle */ + +return dl_state.dload_errcount; +}/* DLOAD_File */ + +/************************************************************************* +* Procedure dynamic_open_module +* +* Parameters: +* module The input stream that supplies the module image +* syms Host-side symbol table and malloc/free functions +* alloc Target-side memory allocation +* init Target-side memory initialization +* options Option flags DLOAD_* +* mhandle A module handle for use with Dynamic_Unload +* +* Effect: +* The module image is read using *module. Target storage for the new +* image is +* obtained from *alloc. Symbols defined and referenced by the module are +* managed using *syms. The image is then relocated and references +* resolved as necessary, and the resulting executable bits are placed +* into target memory using *init. +* +* Returns: +* On a successful load, a module handle is placed in *mhandle, +* and zero is returned. On error, the number of errors detected is +* returned. Individual errors are reported during the load process +* using syms->error_report(). +********************************************************************** */ +int +dynamic_open_module (struct dynamic_loader_stream *module, +struct dynamic_loader_sym *syms, +struct dynamic_loader_allocate *alloc, +struct dynamic_loader_initialize *init, +unsigned options,void **mhandle) +{ + registerunsigned *dp, sz; +struct dload_state dl_state;/* internal state for this call */ + +/* blast our internal state */ + dp = (unsigned *)&dl_state; +for (sz =sizeof (dl_state) /sizeof (unsigned ); sz >0 ; sz -=1 ) + *dp++ =0 ; + +/* Enable _only_ BSS initialization if enabled by user */ +if ((options &DLOAD_INITBSS ) ==DLOAD_INITBSS ) + dl_state.myoptions =DLOAD_INITBSS ; + +/* Check that mandatory arguments are present */ +if (!module || !syms) { +dload_error (&dl_state,"Required parameter is NULL" ); + }else { + dl_state.strm = module; + dl_state.mysym = syms; +dload_headers (&dl_state); +if (!dl_state.dload_errcount) +dload_strings (&dl_state, false); +if (!dl_state.dload_errcount) +dload_sections (&dl_state); + +if (init && !dl_state.dload_errcount) { +if (init->connect (init)) { + dl_state.myio = init; + dl_state.myalloc = alloc; +/* do now, before reducing symbols */ +allocate_sections (&dl_state); + }else +dload_error (&dl_state, iconnect); + } + +if (!dl_state.dload_errcount) { +/* fix up entry point address */ +unsigned sref = dl_state.dfile_hdr.df_entry_secn -1 ; +if (sref < dl_state.allocated_secn_count) + dl_state.dfile_hdr.df_entrypt += + dl_state.ldr_sections[sref].run_addr; + +dload_symbols (&dl_state); + } + +init_module_handle (&dl_state); + +/* dl_state.myio is either 0 or init at this point. */ +if (dl_state.myio) { +if ((!dl_state.dload_errcount) && + (dl_state.dfile_hdr.df_entry_secn !=DN_UNDEF ) && + (!init->execute (init, + dl_state.dfile_hdr.df_entrypt))) +dload_error (&dl_state,"Init->Execute Failed" ); + init->release (init); + } + +symbol_table_free (&dl_state); +section_table_free (&dl_state); +string_table_free (&dl_state); + +if (dl_state.dload_errcount) { +dynamic_unload_module (dl_state.myhandle, syms, alloc, + init); + dl_state.myhandle =NULL ; + } + } + +if (mhandle) + *mhandle = dl_state.myhandle;/* give back the handle */ + +return dl_state.dload_errcount; +}/* DLOAD_File */ + +/************************************************************************* +* Procedure dload_headers +* +* Parameters: +* none +* +* Effect: +* Loads the DOFF header and verify record. Deals with any byte-order +* issues and checks them for validity. +*********************************************************************** */ +#define COMBINED_HEADER_SIZE (sizeof(struct doff_filehdr_t)+ \ + sizeof(struct doff_verify_rec_t)) + +void dload_headers (struct dload_state *dlthis) +{ +u32 map; + +/* Read the header and the verify record as one. If we don't get it +all, we're done */ +if (dlthis->strm->read_buffer (dlthis->strm, &dlthis->dfile_hdr, +COMBINED_HEADER_SIZE ) != +COMBINED_HEADER_SIZE ) { +DL_ERROR (readstrm,"File Headers" ); +return ; + } +/* +* Verify that we have the byte order of the file correct. +* If not, must fix it before we can continue +*/ + map =REORDER_MAP (dlthis->dfile_hdr.df_byte_reshuffle); +if (map !=REORDER_MAP (BYTE_RESHUFFLE_VALUE )) { +/* input is either byte-shuffled or bad */ +if ((map &0xFCFCFCFC ) ==0 ) {/* no obviously bogus bits */ +dload_reorder (&dlthis->dfile_hdr,COMBINED_HEADER_SIZE , + map); + } +if (dlthis->dfile_hdr.df_byte_reshuffle != +BYTE_RESHUFFLE_VALUE ) { +/* didn't fix the problem, the byte swap map is bad */ +dload_error (dlthis, +"Bad byte swap map " FMT_UI32 " in header" , + dlthis->dfile_hdr.df_byte_reshuffle); +return ; + } + dlthis->reorder_map = map;/* keep map for future use */ + } + +/* +* Verify checksum of header and verify record +*/ +if (~dload_checksum (&dlthis->dfile_hdr, +sizeof (struct doff_filehdr_t )) || + ~dload_checksum (&dlthis->verify, +sizeof (struct doff_verify_rec_t ))) { +DL_ERROR (err_checksum,"header or verify record" ); +return ; + } +#if HOST_ENDIANNESS + dlthis->dfile_hdr.df_byte_reshuffle = map;/* put back for later */ +#endif + +/* Check for valid target ID */ +if ((dlthis->dfile_hdr.df_target_id !=TARGET_ID ) && + -(dlthis->dfile_hdr.df_target_id !=TMS470_ID )) { +dload_error (dlthis,"Bad target ID 0x%x and TARGET_ID 0x%x" , + dlthis->dfile_hdr.df_target_id,TARGET_ID ); +return ; + } +/* Check for valid file format */ +if ((dlthis->dfile_hdr.df_doff_version !=DOFF0 )) { +dload_error (dlthis,"Bad DOFF version 0x%x" , + dlthis->dfile_hdr.df_doff_version); +return ; + } + +/* +* Apply reasonableness checks to count fields +*/ +if (dlthis->dfile_hdr.df_strtab_size >MAX_REASONABLE_STRINGTAB ) { +dload_error (dlthis,"Excessive string table size " FMT_UI32 , + dlthis->dfile_hdr.df_strtab_size); +return ; + } +if (dlthis->dfile_hdr.df_no_scns >MAX_REASONABLE_SECTIONS ) { +dload_error (dlthis,"Excessive section count 0x%x" , + dlthis->dfile_hdr.df_no_scns); +return ; + } +#ifndef TARGET_ENDIANNESS +/* +* Check that endianness does not disagree with explicit specification +*/ +if ((dlthis->dfile_hdr.df_flags >>ALIGN_COFF_ENDIANNESS ) & + dlthis->myoptions &ENDIANNESS_MASK ) { +dload_error (dlthis, +"Input endianness disagrees with specified option" ); +return ; + } + dlthis->big_e_target = dlthis->dfile_hdr.df_flags &DF_BIG ; +#endif + +}/* dload_headers */ + +/* COFF Section Processing +* +* COFF sections are read in and retained intact. Each record is embedded +* in a new structure that records the updated load and +* run addresses of the section */ + +static const char secn_errid[] = {"section" }; + +/************************************************************************* +* Procedure dload_sections +* +* Parameters: +* none +* +* Effect: +* Loads the section records into an internal table. +*********************************************************************** */ +void dload_sections (struct dload_state *dlthis) +{ +s16 siz; +struct doff_scnhdr_t *shp; +unsigned nsecs = dlthis->dfile_hdr.df_no_scns; + +/* allocate space for the DOFF section records */ + siz = nsecs *sizeof (struct doff_scnhdr_t ); + shp = + (struct doff_scnhdr_t *)dlthis->mysym->dload_allocate (dlthis->mysym, + siz); +if (!shp) {/* not enough storage */ +DL_ERROR (err_alloc, siz); +return ; + } + dlthis->sect_hdrs = shp; + +/* read in the section records */ +if (dlthis->strm->read_buffer (dlthis->strm, shp, siz) != siz) { +DL_ERROR (readstrm, secn_errid); +return ; + } + +/* if we need to fix up byte order, do it now */ +if (dlthis->reorder_map) +dload_reorder (shp, siz, dlthis->reorder_map); + +/* check for validity */ +if (~dload_checksum (dlthis->sect_hdrs, siz) != + dlthis->verify.dv_scn_rec_checksum) { +DL_ERROR (err_checksum, secn_errid); +return ; + } + +}/* dload_sections */ + +/***************************************************************************** +* Procedure allocate_sections +* +* Parameters: +* alloc target memory allocator class +* +* Effect: +* Assigns new (target) addresses for sections +**************************************************************************** */ +static void allocate_sections (struct dload_state *dlthis) +{ +u16 curr_sect, nsecs, siz; +struct doff_scnhdr_t *shp; +struct ldr_section_info *asecs; +struct my_handle *hndl; + nsecs = dlthis->dfile_hdr.df_no_scns; +if (!nsecs) +return ; +if ((dlthis->myalloc ==NULL ) && + (dlthis->dfile_hdr.df_target_scns >0 )) { +DL_ERROR ("Arg 3 (alloc) required but NULL" ,0 ); +return ; + } +/* +* allocate space for the module handle, which we will keep for unload +* purposes include an additional section store for an auto-generated +* trampoline section in case we need it. +*/ + siz = (dlthis->dfile_hdr.df_target_scns +1 ) * +sizeof (struct ldr_section_info ) +MY_HANDLE_SIZE ; + + hndl = + (struct my_handle *)dlthis->mysym->dload_allocate (dlthis->mysym, + siz); +if (!hndl) {/* not enough storage */ +DL_ERROR (err_alloc, siz); +return ; + } +/* initialize the handle header */ + hndl->dm.hnext = hndl->dm.hprev = hndl;/* circular list */ + hndl->dm.hroot =NULL ; + hndl->dm.dbthis =0 ; + dlthis->myhandle = hndl;/* save away for return */ +/* pointer to the section list of allocated sections */ + dlthis->ldr_sections = asecs = hndl->secns; +/* * Insert names into all sections, make copies of +the sections we allocate */ + shp = dlthis->sect_hdrs; +for (curr_sect =0 ; curr_sect < nsecs; curr_sect++) { +u32 soffset = shp->ds_offset; +#if BITS_PER_AU <=BITS_PER_BYTE +/* attempt to insert the name of this section */ +if (soffset < dlthis->dfile_hdr.df_strtab_size) +DOFFSEC_IS_LDRSEC (shp)->name = dlthis->str_head + + soffset; +else { +dload_error (dlthis,"Bad name offset in section %d" , + curr_sect); +DOFFSEC_IS_LDRSEC (shp)->name =NULL ; + } +#endif +/* allocate target storage for sections that require it */ +if (DS_NEEDS_ALLOCATION (shp)) { + *asecs = *DOFFSEC_IS_LDRSEC (shp); + asecs->context =0 ;/* zero the context field */ +#if BITS_PER_AU >BITS_PER_BYTE + asecs->name =unpack_name (dlthis, soffset); + dlthis->debug_string_size = soffset + dlthis->temp_len; +#else + dlthis->debug_string_size = soffset; +#endif +if (dlthis->myalloc !=NULL ) { +if (!dlthis->myalloc-> +dload_allocate (dlthis->myalloc, asecs, +DS_ALIGNMENT (asecs->type))) { +dload_error (dlthis, tgtalloc, + asecs->name, asecs->size); +return ; + } + } +/* keep address deltas in original section table */ + shp->ds_vaddr = asecs->load_addr - shp->ds_vaddr; + shp->ds_paddr = asecs->run_addr - shp->ds_paddr; + dlthis->allocated_secn_count +=1 ; + }/* allocate target storage */ + shp +=1 ; + asecs +=1 ; + } +#if BITS_PER_AU <=BITS_PER_BYTE + dlthis->debug_string_size += +strlen (dlthis->str_head + dlthis->debug_string_size) +1 ; +#endif +}/* allocate sections */ + +/************************************************************************* +* Procedure section_table_free +* +* Parameters: +* none +* +* Effect: +* Frees any state used by the symbol table. +* +* WARNING: +* This routine is not allowed to declare errors! +*********************************************************************** */ +static void section_table_free (struct dload_state *dlthis) +{ +struct doff_scnhdr_t *shp; + + shp = dlthis->sect_hdrs; +if (shp) + dlthis->mysym->dload_deallocate (dlthis->mysym, shp); + +}/* section_table_free */ + +/************************************************************************* +* Procedure dload_strings +* +* Parameters: +* sec_names_only If true only read in the "section names" +* portion of the string table +* +* Effect: +* Loads the DOFF string table into memory. DOFF keeps all strings in a +* big unsorted array. We just read that array into memory in bulk. +*********************************************************************** */ +static const char stringtbl[] = {"string table" }; + +void dload_strings (struct dload_state *dlthis,bool sec_names_only) +{ +u32 ssiz; +char *strbuf; + +if (sec_names_only) { + ssiz =BYTE_TO_HOST (DOFF_ALIGN + (dlthis->dfile_hdr.df_scn_name_size)); + }else { + ssiz =BYTE_TO_HOST (DOFF_ALIGN + (dlthis->dfile_hdr.df_strtab_size)); + } +if (ssiz ==0 ) +return ; + +/* get some memory for the string table */ +#if BITS_PER_AU >BITS_PER_BYTE + strbuf = (char *)dlthis->mysym->dload_allocate (dlthis->mysym, ssiz + + dlthis->dfile_hdr. + df_max_str_len); +#else + strbuf = (char *)dlthis->mysym->dload_allocate (dlthis->mysym, ssiz); +#endif +if (strbuf ==NULL ) { +DL_ERROR (err_alloc, ssiz); +return ; + } + dlthis->str_head = strbuf; +#if BITS_PER_AU >BITS_PER_BYTE + dlthis->str_temp = strbuf + ssiz; +#endif +/* read in the strings and verify them */ +if ((unsigned )(dlthis->strm->read_buffer (dlthis->strm, strbuf, + ssiz)) != ssiz) { +DL_ERROR (readstrm, stringtbl); + } +/* if we need to fix up byte order, do it now */ +#ifndef _BIG_ENDIAN +if (dlthis->reorder_map) +dload_reorder (strbuf, ssiz, dlthis->reorder_map); + +if ((!sec_names_only) && (~dload_checksum (strbuf, ssiz) != + dlthis->verify.dv_str_tab_checksum)) { +DL_ERROR (err_checksum, stringtbl); + } +#else +if (dlthis->dfile_hdr.df_byte_reshuffle != +HOST_BYTE_ORDER (REORDER_MAP (BYTE_RESHUFFLE_VALUE ))) { +/* put strings in big-endian order, not in PC order */ +dload_reorder (strbuf, ssiz, +HOST_BYTE_ORDER (dlthis-> + dfile_hdr.df_byte_reshuffle)); + } +if ((!sec_names_only) && (~dload_reverse_checksum (strbuf, ssiz) != + dlthis->verify.dv_str_tab_checksum)) { +DL_ERROR (err_checksum, stringtbl); + } +#endif +}/* dload_strings */ + +/************************************************************************* +* Procedure string_table_free +* +* Parameters: +* none +* +* Effect: +* Frees any state used by the string table. +* +* WARNING: +* This routine is not allowed to declare errors! +************************************************************************ */ +static void string_table_free (struct dload_state *dlthis) +{ +if (dlthis->str_head) + dlthis->mysym->dload_deallocate (dlthis->mysym, + dlthis->str_head); + +}/* string_table_free */ + +/* +* Symbol Table Maintenance Functions +* +* COFF symbols are read by dload_symbols(), which is called after +* sections have been allocated. Symbols which might be used in +* relocation (ie, not debug info) are retained in an internal temporary +* compressed table (type local_symbol). A particular symbol is recovered +* by index by calling dload_find_symbol(). dload_find_symbol +* reconstructs a more explicit representation (type SLOTVEC) which is +* used by reloc.c +*/ +/* real size of debug header */ +#define DBG_HDR_SIZE (sizeof(struct dll_module) - sizeof(struct dll_sect)) + +static const char sym_errid[] = {"symbol" }; + +/************************************************************************** +* Procedure dload_symbols +* +* Parameters: +* none +* +* Effect: +* Reads in symbols and retains ones that might be needed for relocation +* purposes. +*********************************************************************** */ +/* size of symbol buffer no bigger than target data buffer, to limit stack +* usage */ +#define MY_SYM_BUF_SIZ (BYTE_TO_HOST(IMAGE_PACKET_SIZE)/\ + sizeof(struct doff_syment_t)) + +static void dload_symbols (struct dload_state *dlthis) +{ +u32 sym_count, siz, dsiz, symbols_left; +u32 checks; +struct local_symbol *sp; +struct dynload_symbol *symp; +struct dynload_symbol *newsym; + + sym_count = dlthis->dfile_hdr.df_no_syms; +if (sym_count ==0 ) +return ; + +/* +* We keep a local symbol table for all of the symbols in the input. +* This table contains only section & value info, as we do not have +* to do any name processing for locals. We reuse this storage +* as a temporary for .dllview record construction. +* Allocate storage for the whole table. Add 1 to the section count +* in case a trampoline section is auto-generated as well as the +* size of the trampoline section name so DLLView doens't get lost. +*/ + + siz = sym_count *sizeof (struct local_symbol ); + dsiz =DBG_HDR_SIZE + + (sizeof (struct dll_sect ) * dlthis->allocated_secn_count) + +BYTE_TO_HOST_ROUND (dlthis->debug_string_size +1 ); +if (dsiz > siz) + siz = dsiz;/* larger of symbols and .dllview temp */ + sp = (struct local_symbol *)dlthis->mysym->dload_allocate (dlthis->mysym, + siz); +if (!sp) { +DL_ERROR (err_alloc, siz); +return ; + } + dlthis->local_symtab = sp; +/* Read the symbols in the input, store them in the table, and post any +* globals to the global symbol table. In the process, externals +become defined from the global symbol table */ + checks = dlthis->verify.dv_sym_tab_checksum; + symbols_left = sym_count; +do {/* read all symbols */ +char *sname; +u32 val; +s32 delta; +struct doff_syment_t *input_sym; +unsigned syms_in_buf; +struct doff_syment_t my_sym_buf[MY_SYM_BUF_SIZ ]; + input_sym = my_sym_buf; + syms_in_buf = symbols_left >MY_SYM_BUF_SIZ ? +MY_SYM_BUF_SIZ : symbols_left; + siz = syms_in_buf *sizeof (struct doff_syment_t ); +if (dlthis->strm->read_buffer (dlthis->strm, input_sym, siz) != + siz) { +DL_ERROR (readstrm, sym_errid); +return ; + } +if (dlthis->reorder_map) +dload_reorder (input_sym, siz, dlthis->reorder_map); + + checks +=dload_checksum (input_sym, siz); +do {/* process symbols in buffer */ + symbols_left -=1 ; +/* attempt to derive the name of this symbol */ + sname =NULL ; +if (input_sym->dn_offset >0 ) { +#if BITS_PER_AU <=BITS_PER_BYTE +if ((u32 ) input_sym->dn_offset < + dlthis->dfile_hdr.df_strtab_size) + sname = dlthis->str_head + +BYTE_TO_HOST (input_sym->dn_offset); +else +dload_error (dlthis, +"Bad name offset in symbol " +" %d" , symbols_left); +#else + sname =unpack_name (dlthis, + input_sym->dn_offset); +#endif + } + val = input_sym->dn_value; + delta =0 ; + sp->sclass = input_sym->dn_sclass; + sp->secnn = input_sym->dn_scnum; +/* if this is an undefined symbol, +* define it (or fail) now */ +if (sp->secnn ==DN_UNDEF ) { +/* pointless for static undefined */ +if (input_sym->dn_sclass !=DN_EXT ) + goto loop_cont; + +/* try to define symbol from previously +* loaded images */ + symp = dlthis->mysym->find_matching_symbol + (dlthis->mysym, sname); +if (!symp) { +DL_ERROR + ("Undefined external symbol %s" , + sname); + goto loop_cont; + } + val = delta = symp->value; +#ifdef ENABLE_TRAMP_DEBUG +dload_syms_error (dlthis->mysym, +"===> ext sym [%s] at %x" , + sname, val); +#endif + + goto loop_cont; + } +/* symbol defined by this module */ +if (sp->secnn >0 ) { +/* symbol references a section */ +if ((unsigned )sp->secnn <= + dlthis->allocated_secn_count) { +/* section was allocated */ +struct doff_scnhdr_t *srefp = + &dlthis->sect_hdrs[sp->secnn -1 ]; + +if (input_sym->dn_sclass == +DN_STATLAB || + input_sym->dn_sclass ==DN_EXTLAB ) { +/* load */ + delta = srefp->ds_vaddr; + }else { +/* run */ + delta = srefp->ds_paddr; + } + val += delta; + } + goto loop_itr; + } +/* This symbol is an absolute symbol */ +if (sp->secnn ==DN_ABS && ((sp->sclass ==DN_EXT ) || + (sp->sclass == +DN_EXTLAB ))) { + symp = + dlthis->mysym->find_matching_symbol (dlthis-> + mysym, + sname); +if (!symp) + goto loop_itr; +/* This absolute symbol is already defined. */ +if (symp->value == input_sym->dn_value) { +/* If symbol values are equal, continue +* but don't add to the global symbol +* table */ + sp->value = val; + sp->delta = delta; + sp +=1 ; + input_sym +=1 ; +continue ; + }else { +/* If symbol values are not equal, +* return with redefinition error */ +DL_ERROR ("Absolute symbol %s is " +"defined multiple times with " +"different values" , sname); +return ; + } + } +loop_itr: +/* if this is a global symbol, post it to the +* global table */ +if (input_sym->dn_sclass ==DN_EXT || + input_sym->dn_sclass ==DN_EXTLAB ) { +/* Keep this global symbol for subsequent +* modules. Don't complain on error, to allow +* symbol API to suppress global symbols */ +if (!sname) + goto loop_cont; + + newsym = dlthis->mysym->add_to_symbol_table + (dlthis->mysym, sname, + (unsigned )dlthis->myhandle); +if (newsym) + newsym->value = val; + + }/* global */ +loop_cont: + sp->value = val; + sp->delta = delta; + sp +=1 ; + input_sym +=1 ; + }while ((syms_in_buf -=1 ) >0 );/* process sym in buf */ + }while (symbols_left >0 );/* read all symbols */ +if (~checks) +dload_error (dlthis,"Checksum of symbols failed" ); + +}/* dload_symbols */ + +/***************************************************************************** +* Procedure symbol_table_free +* +* Parameters: +* none +* +* Effect: +* Frees any state used by the symbol table. +* +* WARNING: +* This routine is not allowed to declare errors! +**************************************************************************** */ +static void symbol_table_free (struct dload_state *dlthis) +{ +if (dlthis->local_symtab) { +if (dlthis->dload_errcount) {/* blow off our symbols */ + dlthis->mysym->purge_symbol_table (dlthis->mysym, + (unsigned ) + dlthis->myhandle); + } + dlthis->mysym->dload_deallocate (dlthis->mysym, + dlthis->local_symtab); + } +}/* symbol_table_free */ + +/* .cinit Processing +* +* The dynamic loader does .cinit interpretation. cload_cinit() +* acts as a special write-to-target function, in that it takes relocated +* data from the normal data flow, and interprets it as .cinit actions. +* Because the normal data flow does not necessarily process the whole +* .cinit section in one buffer, cload_cinit() must be prepared to +* interpret the data piecemeal. A state machine is used for this +* purpose. +*/ + +/* The following are only for use by reloc.c and things it calls */ +static const struct ldr_section_info cinit_info_init = { cinitname,0 ,0 , + (ldr_addr)-1 ,0 ,DLOAD_BSS ,0 +}; + +/************************************************************************* +* Procedure cload_cinit +* +* Parameters: +* ipacket Pointer to data packet to be loaded +* +* Effect: +* Interprets the data in the buffer as .cinit data, and performs the +* appropriate initializations. +*********************************************************************** */ +static void cload_cinit (struct dload_state *dlthis, +struct image_packet_t *ipacket) +{ +#if TDATA_TO_HOST (CINIT_COUNT )*BITS_PER_AU >16 +s32 init_count, left; +#else +s16 init_count, left; +#endif +unsigned char *pktp = ipacket->img_data; +unsigned char *pktend = pktp +BYTE_TO_HOST_ROUND (ipacket->packet_size); +int temp; +ldr_addr atmp; +struct ldr_section_info cinit_info; + +/* PROCESS ALL THE INITIALIZATION RECORDS IN THE BUFFER. */ +while (true) { + left = pktend - pktp; +switch (dlthis->cinit_state) { +case CI_COUNT :/* count field */ +if (left <TDATA_TO_HOST (CINIT_COUNT )) + goto loopexit; + temp =dload_unpack (dlthis, (tgt_au_t *) pktp, +CINIT_COUNT *TDATA_AU_BITS ,0 , +ROP_SGN ); + pktp +=TDATA_TO_HOST (CINIT_COUNT ); +/* negative signifies BSS table, zero means done */ +if (temp <=0 ) { + dlthis->cinit_state =CI_DONE ; +break ; + } + dlthis->cinit_count = temp; + dlthis->cinit_state =CI_ADDRESS ; +break ; +#if CINIT_ALIGN <CINIT_ADDRESS +case CI_PARTADDRESS : + pktp -=TDATA_TO_HOST (CINIT_ALIGN ); +/* back up pointer into space courtesy of caller */ + *(uint16_t *) pktp = dlthis->cinit_addr; +/* stuff in saved bits !! FALL THRU !! */ +#endif +case CI_ADDRESS :/* Address field for a copy packet */ +if (left <TDATA_TO_HOST (CINIT_ADDRESS )) { +#if CINIT_ALIGN <CINIT_ADDRESS +if (left ==TDATA_TO_HOST (CINIT_ALIGN )) { +/* address broken into halves */ + dlthis->cinit_addr = *(uint16_t *) pktp; +/* remember 1st half */ + dlthis->cinit_state =CI_PARTADDRESS ; + left =0 ; + } +#endif + goto loopexit; + } + atmp =dload_unpack (dlthis, (tgt_au_t *) pktp, +CINIT_ADDRESS *TDATA_AU_BITS ,0 , +ROP_UNS ); + pktp +=TDATA_TO_HOST (CINIT_ADDRESS ); +#if CINIT_PAGE_BITS >0 + dlthis->cinit_page = atmp & + ((1 <<CINIT_PAGE_BITS ) -1 ); + atmp >>=CINIT_PAGE_BITS ; +#else + dlthis->cinit_page =CINIT_DEFAULT_PAGE ; +#endif + dlthis->cinit_addr = atmp; + dlthis->cinit_state =CI_COPY ; +break ; +case CI_COPY :/* copy bits to the target */ + init_count =HOST_TO_TDATA (left); +if (init_count > dlthis->cinit_count) + init_count = dlthis->cinit_count; +if (init_count ==0 ) + goto loopexit;/* get more bits */ + cinit_info = cinit_info_init; + cinit_info.page = dlthis->cinit_page; +if (!dlthis->myio->writemem (dlthis->myio, pktp, +TDATA_TO_TADDR + (dlthis->cinit_addr), + &cinit_info, +TDATA_TO_HOST (init_count))) { +dload_error (dlthis, initfail,"write" , + dlthis->cinit_addr); + } + dlthis->cinit_count -= init_count; +if (dlthis->cinit_count <=0 ) { + dlthis->cinit_state =CI_COUNT ; + init_count = (init_count +CINIT_ALIGN -1 ) & + -CINIT_ALIGN ; +/* align to next init */ + } + pktp +=TDATA_TO_HOST (init_count); + dlthis->cinit_addr += init_count; +break ; +case CI_DONE :/* no more .cinit to do */ +return ; + }/* switch (cinit_state) */ + }/* while */ + +loopexit: +if (left >0 ) { +dload_error (dlthis,"%d bytes left over in cinit packet" , left); + dlthis->cinit_state =CI_DONE ;/* left over bytes are bad */ + } +}/* cload_cinit */ + +/* Functions to interface to reloc.c +* +* reloc.c is the relocation module borrowed from the linker, with +* minimal (we hope) changes for our purposes. cload_sect_data() invokes +* this module on a section to relocate and load the image data for that +* section. The actual read and write actions are supplied by the global +* routines below. +*/ + +/************************************************************************ +* Procedure relocate_packet +* +* Parameters: +* ipacket Pointer to an image packet to relocate +* +* Effect: +* Performs the required relocations on the packet. Returns a checksum +* of the relocation operations. +*********************************************************************** */ +#define MY_RELOC_BUF_SIZ 8 +/* careful! exists at the same time as the image buffer */ +static int relocate_packet (struct dload_state *dlthis, +struct image_packet_t *ipacket, +u32 *checks,bool *tramps_generated) +{ +u32 rnum; + *tramps_generated = false; + + rnum = ipacket->num_relocs; +do {/* all relocs */ +unsigned rinbuf; +int siz; +struct reloc_record_t *rp, rrec[MY_RELOC_BUF_SIZ ]; + rp = rrec; + rinbuf = rnum >MY_RELOC_BUF_SIZ ?MY_RELOC_BUF_SIZ : rnum; + siz = rinbuf *sizeof (struct reloc_record_t ); +if (dlthis->strm->read_buffer (dlthis->strm, rp, siz) != siz) { +DL_ERROR (readstrm,"relocation" ); +return 0 ; + } +/* reorder the bytes if need be */ +if (dlthis->reorder_map) +dload_reorder (rp, siz, dlthis->reorder_map); + + *checks +=dload_checksum (rp, siz); +do { +/* perform the relocation operation */ +dload_relocate (dlthis, (tgt_au_t *) ipacket->img_data, + rp, tramps_generated, false); + rp +=1 ; + rnum -=1 ; + }while ((rinbuf -=1 ) >0 ); + }while (rnum >0 );/* all relocs */ +/* If trampoline(s) were generated, we need to do an update of the +* trampoline copy of the packet since a 2nd phase relo will be done +* later. */ +if (*tramps_generated == true) { +dload_tramp_pkt_udpate (dlthis, + (dlthis->image_secn - + dlthis->ldr_sections), + dlthis->image_offset, ipacket); + } + +return 1 ; +}/* dload_read_reloc */ + +#define IPH_SIZE (sizeof(struct image_packet_t) - sizeof(u32)) + +/* VERY dangerous */ +static const char imagepak[] = {"image packet" }; + +/************************************************************************* +* Procedure dload_data +* +* Parameters: +* none +* +* Effect: +* Read image data from input file, relocate it, and download it to the +* target. +*********************************************************************** */ +static void dload_data (struct dload_state *dlthis) +{ +u16 curr_sect; +struct doff_scnhdr_t *sptr = dlthis->sect_hdrs; +struct ldr_section_info *lptr = dlthis->ldr_sections; +#ifdef OPT_ZERO_COPY_LOADER +bool zero_copy = false; +#endif +u8 *dest; + +struct { +struct image_packet_t ipacket; +u8 bufr[BYTE_TO_HOST (IMAGE_PACKET_SIZE )]; + } ibuf; + +/* Indicates whether CINIT processing has occurred */ +bool cinit_processed = false; + +/* Loop through the sections and load them one at a time. +*/ +for (curr_sect =0 ; curr_sect < dlthis->dfile_hdr.df_no_scns; + curr_sect +=1 ) { +if (DS_NEEDS_DOWNLOAD (sptr)) { +s32 nip; +ldr_addr image_offset =0 ; +/* set relocation info for this section */ +if (curr_sect < dlthis->allocated_secn_count) + dlthis->delta_runaddr = sptr->ds_paddr; +else { + lptr =DOFFSEC_IS_LDRSEC (sptr); + dlthis->delta_runaddr =0 ; + } + dlthis->image_secn = lptr; +#if BITS_PER_AU >BITS_PER_BYTE + lptr->name =unpack_name (dlthis, sptr->ds_offset); +#endif + nip = sptr->ds_nipacks; +while ((nip -=1 ) >=0 ) {/* process packets */ + +s32 ipsize; +u32 checks; +bool tramp_generated = false; + +/* get the fixed header bits */ +if (dlthis->strm->read_buffer (dlthis->strm, + &ibuf.ipacket, +IPH_SIZE ) != +IPH_SIZE ) { +DL_ERROR (readstrm, imagepak); +return ; + } +/* reorder the header if need be */ +if (dlthis->reorder_map) { +dload_reorder (&ibuf.ipacket,IPH_SIZE , + dlthis->reorder_map); + } +/* now read the rest of the packet */ + ipsize = +BYTE_TO_HOST (DOFF_ALIGN + (ibuf.ipacket.packet_size)); +if (ipsize >BYTE_TO_HOST (IMAGE_PACKET_SIZE )) { +DL_ERROR ("Bad image packet size %d" , + ipsize); +return ; + } + dest = ibuf.bufr; +#ifdef OPT_ZERO_COPY_LOADER + zero_copy = false; +if (DLOAD_SECT_TYPE (sptr) !=DLOAD_CINIT ) { + dlthis->myio->writemem (dlthis->myio, + &dest, + lptr->load_addr + + image_offset, + lptr,0 ); + zero_copy = (dest != ibuf.bufr); + } +#endif +/* End of determination */ + +if (dlthis->strm->read_buffer (dlthis->strm, + ibuf.bufr, + ipsize) != + ipsize) { +DL_ERROR (readstrm, imagepak); +return ; + } + ibuf.ipacket.img_data = dest; + +/* reorder the bytes if need be */ +#if !defined(_BIG_ENDIAN) || (TARGET_AU_BITS >16 ) +if (dlthis->reorder_map) { +dload_reorder (dest, ipsize, + dlthis->reorder_map); + } + checks =dload_checksum (dest, ipsize); +#else +if (dlthis->dfile_hdr.df_byte_reshuffle != +TARGET_ORDER (REORDER_MAP + (BYTE_RESHUFFLE_VALUE ))) { +/* put image bytes in big-endian order, +* not PC order */ +dload_reorder (dest, ipsize, +TARGET_ORDER + (dlthis->dfile_hdr. + df_byte_reshuffle)); + } +#if TARGET_AU_BITS >8 + checks =dload_reverse_checksum16 (dest, ipsize); +#else + checks =dload_reverse_checksum (dest, ipsize); +#endif +#endif + + checks +=dload_checksum (&ibuf.ipacket, +IPH_SIZE ); +/* relocate the image bits as needed */ +if (ibuf.ipacket.num_relocs) { + dlthis->image_offset = image_offset; +if (!relocate_packet (dlthis, + &ibuf.ipacket, + &checks, + &tramp_generated)) +return ;/* serious error */ + } +if (~checks) +DL_ERROR (err_checksum, imagepak); +/* Only write the result to the target if no +* trampoline was generated. Otherwise it +*will be done during trampoline finalize. */ + +if (tramp_generated == false) { + +/* stuff the result into target +* memory */ +if (DLOAD_SECT_TYPE (sptr) == +DLOAD_CINIT ) { +cload_cinit (dlthis, + &ibuf.ipacket); + cinit_processed = true; + }else { +#ifdef OPT_ZERO_COPY_LOADER +if (!zero_copy) { +#endif +/* FIXME */ +if (!dlthis->myio-> +writemem (dlthis-> + myio, + ibuf.bufr, + lptr-> + load_addr + + image_offset, + lptr, +BYTE_TO_HOST + (ibuf. + ipacket. + packet_size))) { +DL_ERROR + ("Write to " +FMT_UI32 +" failed" , + lptr-> + load_addr + + image_offset); + } +#ifdef OPT_ZERO_COPY_LOADER + } +#endif + } + } + image_offset += +BYTE_TO_TADDR (ibuf.ipacket.packet_size); + }/* process packets */ +/* if this is a BSS section, we may want to fill it */ +if (DLOAD_SECT_TYPE (sptr) !=DLOAD_BSS ) + goto loop_cont; + +if (!(dlthis->myoptions &DLOAD_INITBSS )) + goto loop_cont; + +if (cinit_processed) { +/* Don't clear BSS after load-time +* initialization */ +DL_ERROR + ("Zero-initialization at " FMT_UI32 +" after " "load-time initialization!" , + lptr->load_addr); + goto loop_cont; + } +/* fill the .bss area */ + dlthis->myio->fillmem (dlthis->myio, +TADDR_TO_HOST (lptr->load_addr), + lptr,TADDR_TO_HOST (lptr->size), +DLOAD_FILL_BSS ); + goto loop_cont; + } +/* if DS_DOWNLOAD_MASK */ +/* If not loading, but BSS, zero initialize */ +if (DLOAD_SECT_TYPE (sptr) !=DLOAD_BSS ) + goto loop_cont; + +if (!(dlthis->myoptions &DLOAD_INITBSS )) + goto loop_cont; + +if (curr_sect >= dlthis->allocated_secn_count) + lptr =DOFFSEC_IS_LDRSEC (sptr); + +if (cinit_processed) { +/*Don't clear BSS after load-time initialization */ +DL_ERROR ("Zero-initialization at " FMT_UI32 +" attempted after " +"load-time initialization!" , lptr->load_addr); + goto loop_cont; + } +/* fill the .bss area */ + dlthis->myio->fillmem (dlthis->myio, +TADDR_TO_HOST (lptr->load_addr), lptr, +TADDR_TO_HOST (lptr->size), +DLOAD_FILL_BSS ); +loop_cont: + sptr +=1 ; + lptr +=1 ; + }/* load sections */ + +/* Finalize any trampolines that were created during the load */ +if (dload_tramp_finalize (dlthis) ==0 ) { +DL_ERROR ("Finalization of auto-trampolines (size = " FMT_UI32 +") failed" , dlthis->tramp.tramp_sect_next_addr); + } +}/* dload_data */ + +/************************************************************************* +* Procedure dload_reorder +* +* Parameters: +* data 32-bit aligned pointer to data to be byte-swapped +* dsiz size of the data to be reordered in sizeof() units. +* map 32-bit map defining how to reorder the data. Value +* must be REORDER_MAP() of some permutation +* of 0x00 01 02 03 +* +* Effect: +* Re-arranges the bytes in each word according to the map specified. +* +*********************************************************************** */ +/* mask for byte shift count */ +#define SHIFT_COUNT_MASK (3 << LOG_BITS_PER_BYTE) + +void dload_reorder (void *data,int dsiz,unsigned int map) +{ + registeru32 tmp, tmap, datv; +u32 *dp = (u32 *) data; + + map <<=LOG_BITS_PER_BYTE ;/* align map with SHIFT_COUNT_MASK */ +do { + tmp =0 ; + datv = *dp; + tmap = map; +do { + tmp |= (datv &BYTE_MASK ) << (tmap &SHIFT_COUNT_MASK ); + tmap >>=BITS_PER_BYTE ; + }while (datv >>=BITS_PER_BYTE ); + *dp++ = tmp; + }while ((dsiz -=sizeof (u32)) >0 ); +}/* dload_reorder */ + +/************************************************************************* +* Procedure dload_checksum +* +* Parameters: +* data 32-bit aligned pointer to data to be checksummed +* siz size of the data to be checksummed in sizeof() units. +* +* Effect: +* Returns a checksum of the specified block +* +*********************************************************************** */ +u32 dload_checksum (void *data,unsigned siz) +{ +u32 sum; +u32 *dp; +int left; + + sum =0 ; + dp = (u32 *) data; +for (left = siz; left >0 ; left -=sizeof (u32)) + sum += *dp++; +return sum; +}/* dload_checksum */ + +#if HOST_ENDIANNESS +/************************************************************************* +* Procedure dload_reverse_checksum +* +* Parameters: +* data 32-bit aligned pointer to data to be checksummed +* siz size of the data to be checksummed in sizeof() units. +* +* Effect: +* Returns a checksum of the specified block, which is assumed to be bytes +* in big-endian order. +* +* Notes: +* In a big-endian host, things like the string table are stored as bytes +* in host order. But dllcreate always checksums in little-endian order. +* It is most efficient to just handle the difference a word at a time. +* +********************************************************************** */ +u32 dload_reverse_checksum (void *data,unsigned siz) +{ +u32 sum, temp; +u32 *dp; +int left; + + sum =0 ; + dp = (u32 *) data; + +for (left = siz; left >0 ; left -=sizeof (u32)) { + temp = *dp++; + sum += temp <<BITS_PER_BYTE *3 ; + sum += temp >>BITS_PER_BYTE *3 ; + sum += (temp >>BITS_PER_BYTE ) & (BYTE_MASK <<BITS_PER_BYTE ); + sum += (temp & (BYTE_MASK <<BITS_PER_BYTE )) <<BITS_PER_BYTE ; + } + +return sum; +}/* dload_reverse_checksum */ + +#if (TARGET_AU_BITS >8 ) && (TARGET_AU_BITS <32 ) +u32 dload_reverse_checksum16 (void *data,unsigned siz) +{ +uint_fast32_t sum, temp; +u32 *dp; +int left; + + sum =0 ; + dp = (u32 *) data; + +for (left = siz; left >0 ; left -=sizeof (u32)) { + temp = *dp++; + sum += temp <<BITS_PER_BYTE *2 ; + sum += temp >>BITS_PER_BYTE *2 ; + } + +return sum; +}/* dload_reverse_checksum16 */ +#endif +#endif + +/************************************************************************* +* Procedure swap_words +* +* Parameters: +* data 32-bit aligned pointer to data to be swapped +* siz size of the data to be swapped. +* bitmap Bit map of how to swap each 32-bit word; 1 => 2 shorts, +* 0 => 1 long +* +* Effect: +* Swaps the specified data according to the specified map +* +*********************************************************************** */ +static void swap_words (void *data,unsigned siz,unsigned bitmap) +{ + registerint i; +#if TARGET_AU_BITS <16 + registeru16 *sp; +#endif + registeru32 *lp; + + siz /=sizeof (u16); + +#if TARGET_AU_BITS <16 +/* pass 1: do all the bytes */ + i = siz; + sp = (u16 *) data; +do { + registeru16 tmp; + tmp = *sp; + *sp++ =SWAP16BY8 (tmp); + }while ((i -=1 ) >0 ); +#endif + +#if TARGET_AU_BITS <32 +/* pass 2: fixup the 32-bit words */ + i = siz >>1 ; + lp = (u32 *) data; +do { +if ((bitmap &1 ) ==0 ) { + registeru32 tmp; + tmp = *lp; + *lp =SWAP32BY16 (tmp); + } + lp +=1 ; + bitmap >>=1 ; + }while ((i -=1 ) >0 ); +#endif +}/* swap_words */ + +/************************************************************************* +* Procedure copy_tgt_strings +* +* Parameters: +* dstp Destination address. Assumed to be 32-bit aligned +* srcp Source address. Assumed to be 32-bit aligned +* charcount Number of characters to copy. +* +* Effect: +* Copies strings from the source (which is in usual .dof file order on +* the loading processor) to the destination buffer (which should be in proper +* target addressable unit order). Makes sure the last string in the +* buffer is NULL terminated (for safety). +* Returns the first unused destination address. +*********************************************************************** */ +static char *copy_tgt_strings (void *dstp,void *srcp,unsigned charcount) +{ + registertgt_au_t *src = (tgt_au_t *) srcp; + registertgt_au_t *dst = (tgt_au_t *) dstp; + registerint cnt = charcount; +do { +#if TARGET_AU_BITS <=BITS_PER_AU +/* byte-swapping issues may exist for strings on target */ + *dst++ = *src++; +#else + *dst++ = *src++; +#endif + }while ((cnt -= (sizeof (tgt_au_t) *BITS_PER_AU /BITS_PER_BYTE )) >0 ); +/*apply force to make sure that the string table has null terminator */ +#if (BITS_PER_AU ==BITS_PER_BYTE ) && (TARGET_AU_BITS ==BITS_PER_BYTE ) + dst[-1 ] =0 ; +#else +/* little endian */ + dst[-1 ] &= (1 << (BITS_PER_AU -BITS_PER_BYTE )) -1 ; +#endif +return (char *)dst; +}/* copy_tgt_strings */ + +/************************************************************************* +* Procedure init_module_handle +* +* Parameters: +* none +* +* Effect: +* Initializes the module handle we use to enable unloading, and installs +* the debug information required by the target. +* +* Notes: +* The handle returned from dynamic_load_module needs to encapsulate all the +* allocations done for the module, and enable them plus the modules symbols to +* be deallocated. +* +*********************************************************************** */ +#ifndef _BIG_ENDIAN +static const struct ldr_section_info dllview_info_init = {".dllview" ,0 ,0 , + (ldr_addr)-1 ,DBG_LIST_PAGE ,DLOAD_DATA ,0 +}; +#else +static const struct ldr_section_info dllview_info_init = {".dllview" ,0 ,0 , + (ldr_addr)-1 ,DLOAD_DATA ,DBG_LIST_PAGE ,0 +}; +#endif +static void init_module_handle (struct dload_state *dlthis) +{ +struct my_handle *hndl; +u16 curr_sect; +struct ldr_section_info *asecs; +struct dll_module *dbmod; +struct dll_sect *dbsec; +struct dbg_mirror_root *mlist; + registerchar *cp; +struct modules_header mhdr; +struct ldr_section_info dllview_info; +struct dynload_symbol *debug_mirror_sym; + hndl = dlthis->myhandle; +if (!hndl) +return ;/* must be errors detected, so forget it */ + +/* Store the section count */ + hndl->secn_count = dlthis->allocated_secn_count; + +/* If a trampoline section was created, add it in */ +if (dlthis->tramp.tramp_sect_next_addr !=0 ) + hndl->secn_count +=1 ; + + hndl->secn_count = hndl->secn_count <<1 ; + + hndl->secn_count = dlthis->allocated_secn_count <<1 ; +#ifndef TARGET_ENDIANNESS +if (dlthis->big_e_target) + hndl->secn_count +=1 ;/* flag for big-endian */ +#endif +if (dlthis->dload_errcount) +return ;/* abandon if errors detected */ +/* Locate the symbol that names the header for the CCS debug list +of modules. If not found, we just don't generate the debug record. +If found, we create our modules list. We make sure to create the +loader_dllview_root even if there is no relocation info to record, +just to try to put both symbols in the same symbol table and +module. */ + debug_mirror_sym = dlthis->mysym->find_matching_symbol (dlthis->mysym, + loader_dllview_root); +if (!debug_mirror_sym) { +struct dynload_symbol *dlmodsym; +struct dbg_mirror_root *mlst; + +/* our root symbol is not yet present; +check if we have DLModules defined */ + dlmodsym = dlthis->mysym->find_matching_symbol (dlthis->mysym, +LINKER_MODULES_HEADER ); +if (!dlmodsym) +return ;/* no DLModules list so no debug info */ +/* if we have DLModules defined, construct our header */ + mlst = (struct dbg_mirror_root *) + dlthis->mysym->dload_allocate (dlthis->mysym, +sizeof (struct +dbg_mirror_root )); +if (!mlst) { +DL_ERROR (err_alloc,sizeof (struct dbg_mirror_root )); +return ; + } + mlst->hnext =NULL ; + mlst->changes =0 ; + mlst->refcount =0 ; + mlst->dbthis =TDATA_TO_TADDR (dlmodsym->value); +/* add our root symbol */ + debug_mirror_sym = dlthis->mysym->add_to_symbol_table + (dlthis->mysym, loader_dllview_root, + (unsigned )dlthis->myhandle); +if (!debug_mirror_sym) { +/* failed, recover memory */ + dlthis->mysym->dload_deallocate (dlthis->mysym, mlst); +return ; + } + debug_mirror_sym->value = (u32 ) mlst; + } +/* First create the DLLview record and stuff it into the buffer. +Then write it to the DSP. Record pertinent locations in our hndl, +and add it to the per-processor list of handles with debug info. */ +#ifndef DEBUG_HEADER_IN_LOADER + mlist = (struct dbg_mirror_root *)debug_mirror_sym->value; +if (!mlist) +return ; +#else + mlist = (struct dbg_mirror_root *)&debug_list_header; +#endif + hndl->dm.hroot = mlist;/* set pointer to root into our handle */ +if (!dlthis->allocated_secn_count) +return ;/* no load addresses to be recorded */ +/* reuse temporary symbol storage */ + dbmod = (struct dll_module *)dlthis->local_symtab; +/* Create the DLLview record in the memory we retain for our handle */ + dbmod->num_sects = dlthis->allocated_secn_count; + dbmod->timestamp = dlthis->verify.dv_timdat; + dbmod->version =INIT_VERSION ; + dbmod->verification =VERIFICATION ; + asecs = dlthis->ldr_sections; + dbsec = dbmod->sects; +for (curr_sect = dlthis->allocated_secn_count; + curr_sect >0 ; curr_sect -=1 ) { + dbsec->sect_load_adr = asecs->load_addr; + dbsec->sect_run_adr = asecs->run_addr; + dbsec +=1 ; + asecs +=1 ; + } + +/* If a trampoline section was created go ahead and add its info */ +if (dlthis->tramp.tramp_sect_next_addr !=0 ) { + dbmod->num_sects++; + dbsec->sect_load_adr = asecs->load_addr; + dbsec->sect_run_adr = asecs->run_addr; + dbsec++; + asecs++; + } + +/* now cram in the names */ + cp =copy_tgt_strings (dbsec, dlthis->str_head, + dlthis->debug_string_size); + +/* If a trampoline section was created, add its name so DLLView +* can show the user the section info. */ +if (dlthis->tramp.tramp_sect_next_addr !=0 ) { + cp =copy_tgt_strings (cp, + dlthis->tramp.final_string_table, +strlen (dlthis->tramp.final_string_table) + +1 ); + } + +/* round off the size of the debug record, and remember same */ + hndl->dm.dbsiz =HOST_TO_TDATA_ROUND (cp - (char *)dbmod); + *cp =0 ;/* strictly to make our test harness happy */ + dllview_info = dllview_info_init; + dllview_info.size =TDATA_TO_TADDR (hndl->dm.dbsiz); +/* Initialize memory context to default heap */ + dllview_info.context =0 ; + hndl->dm.context =0 ; +/* fill in next pointer and size */ +if (mlist->hnext) { + dbmod->next_module =TADDR_TO_TDATA (mlist->hnext->dm.dbthis); + dbmod->next_module_size = mlist->hnext->dm.dbsiz; + }else { + dbmod->next_module_size =0 ; + dbmod->next_module =0 ; + } +/* allocate memory for on-DSP DLLview debug record */ +if (!dlthis->myalloc) +return ; +if (!dlthis->myalloc->dload_allocate (dlthis->myalloc, &dllview_info, +HOST_TO_TADDR (sizeof (u32)))) { +return ; + } +/* Store load address of .dllview section */ + hndl->dm.dbthis = dllview_info.load_addr; +/* Store memory context (segid) in which .dllview section +* was allocated */ + hndl->dm.context = dllview_info.context; + mlist->refcount +=1 ; +/* swap bytes in the entire debug record, but not the string table */ +if (TARGET_ENDIANNESS_DIFFERS (TARGET_BIG_ENDIAN )) { +swap_words (dbmod, (char *)dbsec - (char *)dbmod, +DLL_MODULE_BITMAP ); + } +/* Update the DLLview list on the DSP write new record */ +if (!dlthis->myio->writemem (dlthis->myio, dbmod, + dllview_info.load_addr, &dllview_info, +TADDR_TO_HOST (dllview_info.size))) { +return ; + } +/* write new header */ + mhdr.first_module_size = hndl->dm.dbsiz; + mhdr.first_module =TADDR_TO_TDATA (dllview_info.load_addr); +/* swap bytes in the module header, if needed */ +if (TARGET_ENDIANNESS_DIFFERS (TARGET_BIG_ENDIAN )) { +swap_words (&mhdr,sizeof (struct modules_header ) -sizeof (u16), +MODULES_HEADER_BITMAP ); + } + dllview_info = dllview_info_init; +if (!dlthis->myio->writemem (dlthis->myio, &mhdr, mlist->dbthis, + &dllview_info, +sizeof (struct modules_header ) - +sizeof (u16))) { +return ; + } +/* Add the module handle to this processor's list +of handles with debug info */ + hndl->dm.hnext = mlist->hnext; +if (hndl->dm.hnext) + hndl->dm.hnext->dm.hprev = hndl; + hndl->dm.hprev = (struct my_handle *)mlist; + mlist->hnext = hndl;/* insert after root */ +}/* init_module_handle */ + +/************************************************************************* +* Procedure dynamic_unload_module +* +* Parameters: +* mhandle A module handle from dynamic_load_module +* syms Host-side symbol table and malloc/free functions +* alloc Target-side memory allocation +* +* Effect: +* The module specified by mhandle is unloaded. Unloading causes all +* target memory to be deallocated, all symbols defined by the module to +* be purged, and any host-side storage used by the dynamic loader for +* this module to be released. +* +* Returns: +* Zero for success. On error, the number of errors detected is returned. +* Individual errors are reported using syms->error_report(). +*********************************************************************** */ +int dynamic_unload_module (void *mhandle, +struct dynamic_loader_sym *syms, +struct dynamic_loader_allocate *alloc, +struct dynamic_loader_initialize *init) +{ +s16 curr_sect; +struct ldr_section_info *asecs; +struct my_handle *hndl; +struct dbg_mirror_root *root; +unsigned errcount =0 ; +struct ldr_section_info dllview_info = dllview_info_init; +struct modules_header mhdr; + + hndl = (struct my_handle *)mhandle; +if (!hndl) +return 0 ;/* if handle is null, nothing to do */ +/* Clear out the module symbols +* Note that if this is the module that defined MODULES_HEADER +(the head of the target debug list) +* then this operation will blow away that symbol. +It will therefore be impossible for subsequent +* operations to add entries to this un-referenceable list. */ +if (!syms) +return 1 ; + syms->purge_symbol_table (syms, (unsigned )hndl); +/* Deallocate target memory for sections +* NOTE: The trampoline section, if created, gets deleted here, too */ + + asecs = hndl->secns; +if (alloc) +for (curr_sect = (hndl->secn_count >>1 ); curr_sect >0 ; + curr_sect -=1 ) { + asecs->name =NULL ; + alloc->dload_deallocate (alloc, asecs++); + } + root = hndl->dm.hroot; +if (!root) { +/* there is a debug list containing this module */ + goto func_end; + } +if (!hndl->dm.dbthis) {/* target-side dllview record exists */ + goto loop_end; + } +/* Retrieve memory context in which .dllview was allocated */ + dllview_info.context = hndl->dm.context; +if (hndl->dm.hprev == hndl) + goto exitunltgt; + +/* target-side dllview record is in list */ +/* dequeue this record from our GPP-side mirror list */ + hndl->dm.hprev->dm.hnext = hndl->dm.hnext; +if (hndl->dm.hnext) + hndl->dm.hnext->dm.hprev = hndl->dm.hprev; +/* Update next_module of previous entry in target list +* We are using mhdr here as a surrogate for either a +struct modules_header or a dll_module */ +if (hndl->dm.hnext) { + mhdr.first_module =TADDR_TO_TDATA (hndl->dm.hnext->dm.dbthis); + mhdr.first_module_size = hndl->dm.hnext->dm.dbsiz; + }else { + mhdr.first_module =0 ; + mhdr.first_module_size =0 ; + } +if (!init) + goto exitunltgt; + +if (!init->connect (init)) { +dload_syms_error (syms, iconnect); + errcount +=1 ; + goto exitunltgt; + } +/* swap bytes in the module header, if needed */ +if (TARGET_ENDIANNESS_DIFFERS (hndl->secn_count &0x1 )) { +swap_words (&mhdr,sizeof (struct modules_header ) -sizeof (u16), +MODULES_HEADER_BITMAP ); + } +if (!init->writemem (init, &mhdr, hndl->dm.hprev->dm.dbthis, + &dllview_info,sizeof (struct modules_header ) - +sizeof (mhdr.update_flag))) { +dload_syms_error (syms, dlvwrite); + errcount +=1 ; + } +/* update change counter */ + root->changes +=1 ; +if (!init->writemem (init, &(root->changes), + root->dbthis +HOST_TO_TADDR + (sizeof (mhdr.first_module) + +sizeof (mhdr.first_module_size)), + &dllview_info,sizeof (mhdr.update_flag))) { +dload_syms_error (syms, dlvwrite); + errcount +=1 ; + } + init->release (init); +exitunltgt: +/* release target storage */ + dllview_info.size =TDATA_TO_TADDR (hndl->dm.dbsiz); + dllview_info.load_addr = hndl->dm.dbthis; +if (alloc) + alloc->dload_deallocate (alloc, &dllview_info); + root->refcount -=1 ; +/* target-side dllview record exists */ +loop_end: +#ifndef DEBUG_HEADER_IN_LOADER +if (root->refcount <=0 ) { +/* if all references gone, blow off the header */ +/* our root symbol may be gone due to the Purge above, +but if not, do not destroy the root */ +if (syms->find_matching_symbol + (syms, loader_dllview_root) ==NULL ) + syms->dload_deallocate (syms, root); + } +#endif +func_end: +/* there is a debug list containing this module */ + syms->dload_deallocate (syms, mhandle);/* release our storage */ +return errcount; +}/* dynamic_unload_module */ + +#if BITS_PER_AU >BITS_PER_BYTE +/************************************************************************* +* Procedure unpack_name +* +* Parameters: +* soffset Byte offset into the string table +* +* Effect: +* Returns a pointer to the string specified by the offset supplied, or +* NULL for error. +* +*********************************************************************** */ +static char *unpack_name (struct dload_state *dlthis,u32 soffset) +{ +u8 tmp, *src; +char *dst; + +if (soffset >= dlthis->dfile_hdr.df_strtab_size) { +dload_error (dlthis,"Bad string table offset " FMT_UI32 , + soffset); +return NULL ; + } + src = (uint_least8_t *) dlthis->str_head + + (soffset >> (LOG_BITS_PER_AU -LOG_BITS_PER_BYTE )); + dst = dlthis->str_temp; +if (soffset &1 ) + *dst++ = *src++;/* only 1 character in first word */ +do { + tmp = *src++; + *dst = (tmp >>BITS_PER_BYTE ); +if (!(*dst++)) +break ; + }while ((*dst++ = tmp &BYTE_MASK )); + dlthis->temp_len = dst - dlthis->str_temp; +/* squirrel away length including terminating null */ +return dlthis->str_temp; +}/* unpack_name */ +#endif
drivers/staging/tidspbridge/dynload/dload_internal.h new file +351 -0
351 lines not on this page · raw message
drivers/staging/tidspbridge/dynload/doff.h new file +344 -0
344 lines not on this page · raw message
drivers/staging/tidspbridge/dynload/getsection.c new file +416 -0
345 lines not on this page · raw message
drivers/staging/tidspbridge/dynload/header.h new file +55 -0
55 lines not on this page · raw message
drivers/staging/tidspbridge/dynload/module_list.h new file +159 -0
159 lines not on this page · raw message
drivers/staging/tidspbridge/dynload/params.h new file +226 -0
226 lines not on this page · raw message
drivers/staging/tidspbridge/dynload/reloc.c new file +484 -0
484 lines not on this page · raw message
drivers/staging/tidspbridge/dynload/reloc_table.h new file +102 -0
102 lines not on this page · raw message
drivers/staging/tidspbridge/dynload/reloc_table_c6000.c new file +257 -0
257 lines not on this page · raw message
drivers/staging/tidspbridge/dynload/tramp.c new file +1143 -0
1,143 lines not on this page · raw message
drivers/staging/tidspbridge/dynload/tramp_table_c6000.c new file +164 -0
164 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.0.4
Part of the diff is not shown here. View the raw message.
PATCH 9/11 staging: ti dspbridge: add header files
In reply to Ohad Ben-CohenFrom: Omar Ramirez Luna <[email protected]>
Add TI's DSP Bridge driver header files
--- .../tidspbridge/include/dspbridge/_chnl_sm.h | 181 ++++ .../tidspbridge/include/dspbridge/brddefs.h | 39 + .../staging/tidspbridge/include/dspbridge/cfg.h | 222 ++++ .../tidspbridge/include/dspbridge/cfgdefs.h | 81 ++ .../staging/tidspbridge/include/dspbridge/chnl.h | 130 +++ .../tidspbridge/include/dspbridge/chnldefs.h | 67 ++ .../tidspbridge/include/dspbridge/chnlpriv.h | 101 ++ .../staging/tidspbridge/include/dspbridge/clk.h | 101 ++ .../staging/tidspbridge/include/dspbridge/cmm.h | 386 +++++++ .../tidspbridge/include/dspbridge/cmmdefs.h | 105 ++ .../staging/tidspbridge/include/dspbridge/cod.h | 369 +++++++ .../staging/tidspbridge/include/dspbridge/dbc.h | 46 + .../staging/tidspbridge/include/dspbridge/dbdcd.h | 358 +++++++ .../tidspbridge/include/dspbridge/dbdcddef.h | 78 ++ .../staging/tidspbridge/include/dspbridge/dbdefs.h | 546 ++++++++++ .../tidspbridge/include/dspbridge/dbldefs.h | 140 +++ .../staging/tidspbridge/include/dspbridge/dbll.h | 59 + .../tidspbridge/include/dspbridge/dblldefs.h | 496 +++++++++ .../staging/tidspbridge/include/dspbridge/dbtype.h | 88 ++ .../tidspbridge/include/dspbridge/dehdefs.h | 32 + .../staging/tidspbridge/include/dspbridge/dev.h | 702 ++++++++++++ .../tidspbridge/include/dspbridge/devdefs.h | 26 + .../staging/tidspbridge/include/dspbridge/disp.h | 204 ++++ .../tidspbridge/include/dspbridge/dispdefs.h | 35 + .../staging/tidspbridge/include/dspbridge/dmm.h | 75 ++ .../staging/tidspbridge/include/dspbridge/drv.h | 522 +++++++++ .../tidspbridge/include/dspbridge/drvdefs.h | 25 + .../tidspbridge/include/dspbridge/dspapi-ioctl.h | 475 ++++++++ .../staging/tidspbridge/include/dspbridge/dspapi.h | 167 +++ .../tidspbridge/include/dspbridge/dspchnl.h | 72 ++ .../tidspbridge/include/dspbridge/dspdefs.h | 1128 ++++++++++++++++++++ .../staging/tidspbridge/include/dspbridge/dspdeh.h | 47 + .../staging/tidspbridge/include/dspbridge/dspdrv.h | 62 ++ .../staging/tidspbridge/include/dspbridge/dspio.h | 41 + .../tidspbridge/include/dspbridge/dspioctl.h | 73 ++ .../staging/tidspbridge/include/dspbridge/dspmsg.h | 56 + .../tidspbridge/include/dspbridge/dynamic_loader.h | 492 +++++++++ drivers/staging/tidspbridge/include/dspbridge/gb.h | 79 ++ .../tidspbridge/include/dspbridge/getsection.h | 108 ++ drivers/staging/tidspbridge/include/dspbridge/gh.h | 32 + drivers/staging/tidspbridge/include/dspbridge/gs.h | 59 + .../tidspbridge/include/dspbridge/host_os.h | 89 ++ drivers/staging/tidspbridge/include/dspbridge/io.h | 114 ++ .../staging/tidspbridge/include/dspbridge/io_sm.h | 309 ++++++ .../staging/tidspbridge/include/dspbridge/iodefs.h | 36 + .../staging/tidspbridge/include/dspbridge/ldr.h | 29 + .../staging/tidspbridge/include/dspbridge/list.h | 225 ++++ .../staging/tidspbridge/include/dspbridge/mbx_sh.h | 198 ++++ .../tidspbridge/include/dspbridge/memdefs.h | 30 + .../staging/tidspbridge/include/dspbridge/mgr.h | 205 ++++ .../tidspbridge/include/dspbridge/mgrpriv.h | 45 + .../staging/tidspbridge/include/dspbridge/msg.h | 86 ++ .../tidspbridge/include/dspbridge/msgdefs.h | 29 + .../staging/tidspbridge/include/dspbridge/nldr.h | 55 + .../tidspbridge/include/dspbridge/nldrdefs.h | 293 +++++ .../staging/tidspbridge/include/dspbridge/node.h | 579 ++++++++++ .../tidspbridge/include/dspbridge/nodedefs.h | 28 + .../tidspbridge/include/dspbridge/nodepriv.h | 182 ++++ .../staging/tidspbridge/include/dspbridge/ntfy.h | 217 ++++ .../staging/tidspbridge/include/dspbridge/proc.h | 621 +++++++++++ .../tidspbridge/include/dspbridge/procpriv.h | 25 + .../staging/tidspbridge/include/dspbridge/pwr.h | 107 ++ .../staging/tidspbridge/include/dspbridge/pwr_sh.h | 33 + .../include/dspbridge/resourcecleanup.h | 63 ++ .../staging/tidspbridge/include/dspbridge/rmm.h | 181 ++++ .../staging/tidspbridge/include/dspbridge/rms_sh.h | 95 ++ .../tidspbridge/include/dspbridge/rmstypes.h | 28 + .../tidspbridge/include/dspbridge/services.h | 50 + .../staging/tidspbridge/include/dspbridge/std.h | 94 ++ .../staging/tidspbridge/include/dspbridge/strm.h | 404 +++++++ .../tidspbridge/include/dspbridge/strmdefs.h | 46 + .../staging/tidspbridge/include/dspbridge/sync.h | 109 ++ .../tidspbridge/include/dspbridge/utildefs.h | 39 + .../tidspbridge/include/dspbridge/uuidutil.h | 62 ++ .../staging/tidspbridge/include/dspbridge/wdt.h | 79 ++ 75 files changed, 12890 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/include/dspbridge/_chnl_sm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/brddefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/cfg.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/chnl.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/chnldefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/chnlpriv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/clk.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/cmm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/cmmdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/cod.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbc.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbdcd.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbdcddef.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbldefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbll.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dblldefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dbtype.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dehdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dev.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/devdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/disp.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dispdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dmm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/drv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/drvdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspapi-ioctl.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspapi.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspchnl.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspdeh.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspdrv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspio.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspioctl.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dspmsg.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/dynamic_loader.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/gb.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/getsection.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/gh.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/gs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/host_os.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/io.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/io_sm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/iodefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/ldr.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/list.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/mbx_sh.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/memdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/mgr.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/mgrpriv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/msg.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/msgdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/nldr.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/nldrdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/node.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/nodedefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/nodepriv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/ntfy.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/proc.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/procpriv.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/pwr.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/pwr_sh.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/resourcecleanup.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/rmm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/rms_sh.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/rmstypes.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/services.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/std.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/strm.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/strmdefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/sync.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/utildefs.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/uuidutil.h create mode 100644 drivers/staging/tidspbridge/include/dspbridge/wdt.h
drivers/staging/tidspbridge/include/dspbridge/_chnl_sm.h new file +181 -0
@@ -0,0 +1,181 @@ +/* +* _chnl_sm.h +* +* DSP-BIOS Bridge driver support functions for TI OMAP processors. +* +* Private header file defining channel manager and channel objects for +* a shared memory channel driver. +* +* Shared between the modules implementing the shared memory channel class +* library. +* +* Copyright (C) 2005-2006 Texas Instruments, Inc. +* +* This package is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef _CHNL_SM_ +#define _CHNL_SM_ + +#include <dspbridge/dspapi.h> +#include <dspbridge/dspdefs.h> + +#include <dspbridge/list.h> +#include <dspbridge/ntfy.h> + +/* +* These target side symbols define the beginning and ending addresses +* of shared memory buffer. They are defined in the *cfg.cmd file by +* cdb code. +*/ +#define CHNL_SHARED_BUFFER_BASE_SYM "_SHM_BEG" +#define CHNL_SHARED_BUFFER_LIMIT_SYM "_SHM_END" +#define BRIDGEINIT_BIOSGPTIMER "_BRIDGEINIT_BIOSGPTIMER" +#define BRIDGEINIT_LOADMON_GPTIMER "_BRIDGEINIT_LOADMON_GPTIMER" + +#ifndef _CHNL_WORDSIZE +#define _CHNL_WORDSIZE 4/* default _CHNL_WORDSIZE is 2 bytes/word */ +#endif + +#define MAXOPPS 16 + +/* Shared memory config options */ +#define SHM_CURROPP 0/* Set current OPP in shm */ +#define SHM_OPPINFO 1/* Set dsp voltage and freq table values */ +#define SHM_GETOPP 2/* Get opp requested by DSP */ + +struct opp_table_entry { +u32 voltage; +u32 frequency; +u32 min_freq; +u32 max_freq; +}; + +struct opp_struct { +u32 curr_opp_pt; +u32 num_opp_pts; +struct opp_table_entry opp_point[MAXOPPS ]; +}; + +/* Request to MPU */ +struct opp_rqst_struct { +u32 rqst_dsp_freq; +u32 rqst_opp_pt; +}; + +/* Info to MPU */ +struct load_mon_struct { +u32 curr_dsp_load; +u32 curr_dsp_freq; +u32 pred_dsp_load; +u32 pred_dsp_freq; +}; + +/* Structure in shared between DSP and PC for communication. */ +struct shm { +u32 dsp_free_mask;/* Written by DSP, read by PC. */ +u32 host_free_mask;/* Written by PC, read by DSP */ + +u32 input_full;/* Input channel has unread data. */ +u32 input_id;/* Channel for which input is available. */ +u32 input_size;/* Size of data block (in DSP words). */ + +u32 output_full;/* Output channel has unread data. */ +u32 output_id;/* Channel for which output is available. */ +u32 output_size;/* Size of data block (in DSP words). */ + +u32 arg;/* Arg for Issue/Reclaim (23 bits for 55x). */ +u32 resvd;/* Keep structure size even for 32-bit DSPs */ + +/* Operating Point structure */ +struct opp_struct opp_table_struct; +/* Operating Point Request structure */ +struct opp_rqst_struct opp_request; +/* load monitor information structure */ +struct load_mon_struct load_mon_info; +#ifdef CONFIG_BRIDGE_WDT3 +/* Flag for WDT enable/disable F/I clocks */ +u32 wdt_setclocks; +u32 wdt_overflow;/* WDT overflow time */ +char dummy[176 ];/* padding to 256 byte boundary */ +#else +char dummy[184 ];/* padding to 256 byte boundary */ +#endif +u32 shm_dbg_var[64 ];/* shared memory debug variables */ +}; + +/* Channel Manager: only one created per board: */ +struct chnl_mgr { +/* Function interface to Bridge driver */ +struct bridge_drv_interface *intf_fxns; +struct io_mgr *hio_mgr;/* IO manager */ +/* Device this board represents */ +struct dev_object *hdev_obj; + +/* These fields initialized in bridge_chnl_create(): */ +u32 dw_output_mask;/* Host output channels w/ full buffers */ +u32 dw_last_output;/* Last output channel fired from DPC */ +/* Critical section object handle */ +spinlock_t chnl_mgr_lock; +u32 word_size;/* Size in bytes of DSP word */ +u8 max_channels;/* Total number of channels */ +u8 open_channels;/* Total number of open channels */ +struct chnl_object **ap_channel;/* Array of channels */ +u8 dw_type;/* Type of channel class library */ +/* If no shm syms, return for CHNL_Open */ +int chnl_open_status; +}; + +/* +* Channel: up to CHNL_MAXCHANNELS per board or if DSP-DMA supported then +* up to CHNL_MAXCHANNELS + CHNL_MAXDDMACHNLS per board. +*/ +struct chnl_object { +/* Pointer back to channel manager */ +struct chnl_mgr *chnl_mgr_obj; +u32 chnl_id;/* Channel id */ +u8 dw_state;/* Current channel state */ +s8 chnl_mode;/* Chnl mode and attributes */ +/* Chnl I/O completion event (user mode) */ +void *user_event; +/* Abstract syncronization object */ +struct sync_object *sync_event; +u32 process;/* Process which created this channel */ +u32 pcb_arg;/* Argument to use with callback */ +struct lst_list *pio_requests;/* List of IOR's to driver */ +s32 cio_cs;/* Number of IOC's in queue */ +s32 cio_reqs;/* Number of IORequests in queue */ +s32 chnl_packets;/* Initial number of free Irps */ +/* List of IOC's from driver */ +struct lst_list *pio_completions; +struct lst_list *free_packets_list;/* List of free Irps */ +struct ntfy_object *ntfy_obj; +u32 bytes_moved;/* Total number of bytes transfered */ + +/* For DSP-DMA */ + +/* Type of chnl transport:CHNL_[PCPY][DDMA] */ +u32 chnl_type; +}; + +/* I/O Request/completion packet: */ +struct chnl_irp { +struct list_head link;/* Link to next CHIRP in queue. */ +/* Buffer to be filled/emptied. (User) */ +u8 *host_user_buf; +/* Buffer to be filled/emptied. (System) */ +u8 *host_sys_buf; +u32 dw_arg;/* Issue/Reclaim argument. */ +u32 dsp_tx_addr;/* Transfer address on DSP side. */ +u32 byte_size;/* Bytes transferred. */ +u32 buf_size;/* Actual buffer size when allocated. */ +u32 status;/* Status of IO completion. */ +}; + +#endif /* _CHNL_SM_ */
drivers/staging/tidspbridge/include/dspbridge/brddefs.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* brddefs.h +* +* DSP-BIOS Bridge driver support functions for TI OMAP processors. +* +* Global BRD constants and types, shared between DSP API and Bridge driver. +* +* Copyright (C) 2005-2006 Texas Instruments, Inc. +* +* This package is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef BRDDEFS_ +#define BRDDEFS_ + +/* platform status values */ +#define BRD_STOPPED 0x0/* No Monitor Loaded, Not running. */ +#define BRD_IDLE 0x1/* Monitor Loaded, but suspended. */ +#define BRD_RUNNING 0x2/* Monitor loaded, and executing. */ +#define BRD_UNKNOWN 0x3/* Board state is indeterminate. */ +#define BRD_SYNCINIT 0x4 +#define BRD_LOADED 0x5 +#define BRD_LASTSTATE BRD_LOADED/* Set to highest legal board state. */ +#define BRD_SLEEP_TRANSITION 0x6/* Sleep transition in progress */ +#define BRD_HIBERNATION 0x7/* MPU initiated hibernation */ +#define BRD_RETENTION 0x8/* Retention mode */ +#define BRD_DSP_HIBERNATION 0x9/* DSP initiated hibernation */ +#define BRD_ERROR 0xA/* Board state is Error */ + +/* BRD Object */ +struct brd_object ; + +#endif /* BRDDEFS_ */
drivers/staging/tidspbridge/include/dspbridge/cfg.h new file +222 -0
222 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h new file +81 -0
81 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/chnl.h new file +130 -0
130 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/chnldefs.h new file +67 -0
67 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/chnlpriv.h new file +101 -0
101 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/clk.h new file +101 -0
101 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/cmm.h new file +386 -0
386 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/cmmdefs.h new file +105 -0
105 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/cod.h new file +369 -0
369 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dbc.h new file +46 -0
46 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dbdcd.h new file +358 -0
358 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dbdcddef.h new file +78 -0
78 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dbdefs.h new file +546 -0
546 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dbldefs.h new file +140 -0
140 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dbll.h new file +59 -0
50 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dblldefs.h new file +496 -0
496 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dbtype.h new file +88 -0
88 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dehdefs.h new file +32 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/dev.h new file +702 -0
702 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/devdefs.h new file +26 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/disp.h new file +204 -0
204 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dispdefs.h new file +35 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/dmm.h new file +75 -0
75 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/drv.h new file +522 -0
522 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/drvdefs.h new file +25 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/dspapi-ioctl.h new file +475 -0
475 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dspapi.h new file +167 -0
167 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dspchnl.h new file +72 -0
72 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dspdefs.h new file +1128 -0
1,128 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dspdeh.h new file +47 -0
47 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dspdrv.h new file +62 -0
62 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dspio.h new file +41 -0
41 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dspioctl.h new file +73 -0
73 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dspmsg.h new file +56 -0
56 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/dynamic_loader.h new file +492 -0
492 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/gb.h new file +79 -0
79 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/getsection.h new file +108 -0
108 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/gh.h new file +32 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/gs.h new file +59 -0
59 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/host_os.h new file +89 -0
89 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/io.h new file +114 -0
114 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/io_sm.h new file +309 -0
309 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/iodefs.h new file +36 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/ldr.h new file +29 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/list.h new file +225 -0
225 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/mbx_sh.h new file +198 -0
198 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/memdefs.h new file +30 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/mgr.h new file +205 -0
205 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/mgrpriv.h new file +45 -0
45 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/msg.h new file +86 -0
86 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/msgdefs.h new file +29 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/nldr.h new file +55 -0
55 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/nldrdefs.h new file +293 -0
293 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/node.h new file +579 -0
579 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/nodedefs.h new file +28 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/nodepriv.h new file +182 -0
182 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/ntfy.h new file +217 -0
217 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/proc.h new file +621 -0
621 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/procpriv.h new file +25 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/pwr.h new file +107 -0
107 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/pwr_sh.h new file +33 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/resourcecleanup.h new file +63 -0
63 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/rmm.h new file +181 -0
181 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/rms_sh.h new file +95 -0
95 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/rmstypes.h new file +28 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/services.h new file +50 -0
50 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/std.h new file +94 -0
94 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/strm.h new file +404 -0
404 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/strmdefs.h new file +46 -0
46 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/sync.h new file +109 -0
109 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/utildefs.h new file +39 -0
Lines of this file are not shown. View the raw message.
drivers/staging/tidspbridge/include/dspbridge/uuidutil.h new file +62 -0
62 lines not on this page · raw message
drivers/staging/tidspbridge/include/dspbridge/wdt.h new file +79 -0
79 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.0.4
Part of the diff is not shown here. View the raw message.
PATCH 10/11 staging: ti dspbridge: add TODO file
In reply to Ohad Ben-CohenAdd a general cleaning roadmap TODO file to TI's DSP Bridge staging driver.
---
I can also be reached at < ohadb at ti dot com >
drivers/staging/tidspbridge/TODO | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/TODO
drivers/staging/tidspbridge/TODO new file +18 -0
@@ -0,0 +1,18 @@ +* Migrate to (and if necessary, extend) existing upstream code such as + iommu, wdt, mcbsp, gptimers +* Decouple hardware-specific code (e.g. bridge_brd_start/stop/delete/monitor) +* DOFF binary loader: consider pushing to user space. at the very least + eliminate the direct filesystem access +* Eliminate general services and libraries - use or extend existing kernel + libraries instead (e.g. gcf/lcm in nldr.c, global helpers in gen/) +* Eliminate direct manipulation of OMAP_SYSC_BASE +* Eliminate list.h : seem like a redundant wrapper to existing kernel lists +* Eliminate DSP_SUCCEEDED macros and their imposed redundant indentations + (adopt the kernel way of checking for return values) +* Audit interfaces exposed to user space +* Audit and clean up header files folder +* Use kernel coding style +* checkpatch.pl fixes + +Please send any patches to Greg Kroah-Hartman <[email protected]> +and Omar Ramirez Luna <[email protected]>.
Signature · 1 line
1.7.0.4
PATCH 11/11 staging: ti dspbridge: enable driver building
In reply to Ohad Ben-CohenFrom: Omar Ramirez Luna <[email protected]>
Add Kconfig + Makefile for TI's DSP Bridge driver
and expose it to the staging menu.
--- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/tidspbridge/Kconfig | 88 ++++++++++++++++++++++++++++++++++ drivers/staging/tidspbridge/Makefile | 34 +++++++++++++ 4 files changed, 125 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/Kconfig create mode 100644 drivers/staging/tidspbridge/Makefile
drivers/staging/Kconfig +2 -0
@@ -151,5 +151,7 @@ source "drivers/staging/msm/Kconfig" source "drivers/staging/easycap/Kconfig" +source "drivers/staging/tidspbridge/Kconfig" + endif # !STAGING_EXCLUDE_BUILD endif # STAGING
drivers/staging/Makefile +1 -0
@@ -56,3 +56,4 @@ obj-$(CONFIG_FB_XGI) += xgifb/ obj-$(CONFIG_TOUCHSCREEN_MRSTOUCH) += mrst-touchscreen/ obj-$(CONFIG_MSM_STAGING) += msm/ obj-$(CONFIG_EASYCAP) += easycap/ +obj-$(CONFIG_TIDSPBRIDGE) += tidspbridge/
drivers/staging/tidspbridge/Kconfig new file +88 -0
88 lines not on this page · raw message
drivers/staging/tidspbridge/Makefile new file +34 -0
@@ -0,0 +1,34 @@ +obj-$(CONFIG_TIDSPBRIDGE) += bridgedriver.o + +libgen = gen/gb.o gen/gs.o gen/gh.o gen/uuidutil.o +libservices = services/sync.o services/cfg.o \ + services/ntfy.o services/services.o +libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \ + core/tiomap3430_pwr.o core/tiomap_io.o \ + core/mmu_fault.o core/ue_deh.o core/wdt.o core/dsp-clock.o +libpmgr = pmgr/chnl.o pmgr/io.o pmgr/msg.o pmgr/cod.o pmgr/dev.o pmgr/dspapi.o \ + pmgr/dmm.o pmgr/cmm.o pmgr/dbll.o +librmgr = rmgr/dbdcd.o rmgr/disp.o rmgr/drv.o rmgr/mgr.o rmgr/node.o \ + rmgr/proc.o rmgr/pwr.o rmgr/rmm.o rmgr/strm.o rmgr/dspdrv.o \ + rmgr/nldr.o rmgr/drv_interface.o +libdload = dynload/cload.o dynload/getsection.o dynload/reloc.o \ + dynload/tramp.o +libhw = hw/hw_mmu.o + +bridgedriver-objs = $(libgen) $(libservices) $(libcore) $(libpmgr) $(librmgr) \ + $(libdload) $(libhw) + +#Machine dependent +ccflags-y += -D_TI_ -D_DB_TIOMAP -DTMS32060 \ + -DTICFG_PROC_VER -DTICFG_EVM_TYPE -DCHNL_SMCLASS \ + -DCHNL_MESSAGES -DUSE_LEVEL_1_MACROS + +ccflags-y += -Idrivers/staging/tidspbridge/include +ccflags-y += -Idrivers/staging/tidspbridge/services +ccflags-y += -Idrivers/staging/tidspbridge/core +ccflags-y += -Idrivers/staging/tidspbridge/pmgr +ccflags-y += -Idrivers/staging/tidspbridge/rmgr +ccflags-y += -Idrivers/staging/tidspbridge/dynload +ccflags-y += -Idrivers/staging/tidspbridge/hw +ccflags-y += -Iarch/arm +
Signature · 1 line
1.7.0.4
Re: [PATCH 11/11] staging: ti dspbridge: enable driver building
Quoted 60 lines · Ohad Ben-Cohen
From: Omar Ramirez Luna <[email protected]>
Add
Kconfig+Makefilefor TI's DSP Bridge driver
and expose it to the staging menu.Signed-off-by Omar Ramirez Luna <[email protected]>Signed-off-by Kanigeri, Hari <[email protected]>Signed-off-by Ameya Palande <[email protected]>Signed-off-by Guzman Lugo, Fernando <[email protected]>Signed-off-by Hebbar, Shivananda <[email protected]>Signed-off-by Ramos Falcon, Ernesto <[email protected]>Signed-off-by Felipe Contreras <[email protected]>Signed-off-by Anna, Suman <[email protected]>Signed-off-by Gupta, Ramesh <[email protected]>Signed-off-by Gomez Castellanos, Ivan <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>Signed-off-by Armando Uribe De Leon <[email protected]>Signed-off-by Deepak Chitriki <[email protected]>Signed-off-by Menon, Nishanth <[email protected]>Signed-off-by Phil Carmody <[email protected]>Signed-off-by Ohad Ben-Cohen <[email protected]>--- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/tidspbridge/Kconfig | 88 ++++++++++++++++++++++++++++++++++ drivers/staging/tidspbridge/Makefile | 34 +++++++++++++ 4 files changed, 125 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/Kconfig create mode 100644 drivers/staging/tidspbridge/Makefiledrivers/staging/Kconfig +4
-0@@ -153,5 +153,9 @@ source "drivers/staging/easycap/Kconfig" source "drivers/staging/solo6x10/Kconfig" +source "drivers/staging/tidspbridge/Kconfig" + +source "drivers/staging/tidspbridge/Kconfig" + endif # !STAGING_EXCLUDE_BUILD endif # STAGINGdrivers/staging/Makefile +1
-0@@ -57,3 +57,4 @@ obj-$(CONFIG_TOUCHSCREEN_MRSTOUCH) += mrst-touchscreen/ obj-$(CONFIG_MSM_STAGING) += msm/ obj-$(CONFIG_EASYCAP) += easycap/ obj-$(CONFIG_SOLO6X10) += solo6x10/ +obj-$(CONFIG_TIDSPBRIDGE) += tidspbridge/drivers/staging/tidspbridge/Kconfig new file +0
-0
drivers/staging/tidspbridge/Kconfig line 7
Quoted 7 lines
drivers/staging/tidspbridge/Kconfig new file +7
-0@@ -0,0 +1,88 @@ +# +# DSP Bridge Driver Support +# + +menuconfig TIDSPBRIDGE + tristate "DSP Bridge driver" + default n
The default is always 'n' so you don't need this.
Also, this enables the driver to be built on x86, which fails horribly, and I don't think is what you really want to have happen :)
So I need some more Kconfig changes here, care to redo just this one patch? I've applied all the others and they will show up in linux-next tomorrow.
thanks,
greg k-h
PATCH 11/11 staging: ti dspbridge: enable driver building
From: Omar Ramirez Luna <[email protected]>
Add Kconfig + Makefile for TI's DSP Bridge driver
and expose it to the staging menu.
For now, have tidspbridge depend on ARCH_OMAP3.
That dependency should be relaxed as soon as required cleanups are applied.
--- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/tidspbridge/Kconfig | 88 ++++++++++++++++++++++++++++++++++ drivers/staging/tidspbridge/Makefile | 34 +++++++++++++ 4 files changed, 125 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/tidspbridge/Kconfig create mode 100644 drivers/staging/tidspbridge/Makefile
drivers/staging/Kconfig +2 -0
@@ -151,5 +151,7 @@ source "drivers/staging/msm/Kconfig" source "drivers/staging/easycap/Kconfig" +source "drivers/staging/tidspbridge/Kconfig" + endif # !STAGING_EXCLUDE_BUILD endif # STAGING
drivers/staging/Makefile +1 -0
@@ -56,3 +56,4 @@ obj-$(CONFIG_FB_XGI) += xgifb/ obj-$(CONFIG_TOUCHSCREEN_MRSTOUCH) += mrst-touchscreen/ obj-$(CONFIG_MSM_STAGING) += msm/ obj-$(CONFIG_EASYCAP) += easycap/ +obj-$(CONFIG_TIDSPBRIDGE) += tidspbridge/
drivers/staging/tidspbridge/Kconfig new file +88 -0
88 lines not on this page · raw message
drivers/staging/tidspbridge/Makefile new file +34 -0
@@ -0,0 +1,34 @@ +obj-$(CONFIG_TIDSPBRIDGE) += bridgedriver.o + +libgen = gen/gb.o gen/gs.o gen/gh.o gen/uuidutil.o +libservices = services/sync.o services/cfg.o \ + services/ntfy.o services/services.o +libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \ + core/tiomap3430_pwr.o core/tiomap_io.o \ + core/mmu_fault.o core/ue_deh.o core/wdt.o core/dsp-clock.o +libpmgr = pmgr/chnl.o pmgr/io.o pmgr/msg.o pmgr/cod.o pmgr/dev.o pmgr/dspapi.o \ + pmgr/dmm.o pmgr/cmm.o pmgr/dbll.o +librmgr = rmgr/dbdcd.o rmgr/disp.o rmgr/drv.o rmgr/mgr.o rmgr/node.o \ + rmgr/proc.o rmgr/pwr.o rmgr/rmm.o rmgr/strm.o rmgr/dspdrv.o \ + rmgr/nldr.o rmgr/drv_interface.o +libdload = dynload/cload.o dynload/getsection.o dynload/reloc.o \ + dynload/tramp.o +libhw = hw/hw_mmu.o + +bridgedriver-objs = $(libgen) $(libservices) $(libcore) $(libpmgr) $(librmgr) \ + $(libdload) $(libhw) + +#Machine dependent +ccflags-y += -D_TI_ -D_DB_TIOMAP -DTMS32060 \ + -DTICFG_PROC_VER -DTICFG_EVM_TYPE -DCHNL_SMCLASS \ + -DCHNL_MESSAGES -DUSE_LEVEL_1_MACROS + +ccflags-y += -Idrivers/staging/tidspbridge/include +ccflags-y += -Idrivers/staging/tidspbridge/services +ccflags-y += -Idrivers/staging/tidspbridge/core +ccflags-y += -Idrivers/staging/tidspbridge/pmgr +ccflags-y += -Idrivers/staging/tidspbridge/rmgr +ccflags-y += -Idrivers/staging/tidspbridge/dynload +ccflags-y += -Idrivers/staging/tidspbridge/hw +ccflags-y += -Iarch/arm +
Signature · 1 line
1.7.0.4
Re: [PATCH 11/11] staging: ti dspbridge: enable driver building
In reply to Greg KHQuoted 8 lines · Greg KH
The default is always 'n' so you don't need this.
Also, this enables the driver to be built on x86, which fails horribly, and I don't think is what you really want to have happen :)
So I need some more
Kconfigchanges here, care to redo just this one patch? I've applied all the others and they will show up in linux-next tomorrow.
I fixed all that stuff some time ago:
http://article.gmane.org/gmane.linux.ports.arm.omap/36065
But the patches were ignored.
I might rebase them if nobody beats me to it.
Signature · 5 lines
Felipe Contreras -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/11] staging: ti dspbridge: enable driver building
Quoted 6 lines · Felipe Contreras
Quoted 5 lines · Greg KH
The default is always 'n' so you don't need this.
Also, this enables the driver to be built on x86, which fails horribly, and I don't think is what you really want to have happen :)
Quoted 8 lines
Quoted 3 lines
So I need some more
Kconfigchanges here, care to redo just this one patch? I've applied all the others and they will show up in linux-next tomorrow.I fixed all that stuff some time ago:
http://article.gmane.org/gmane.linux.ports.arm.omap/36065But the patches were ignored.
Patches were not ignored, discussion was held privately (you and me), patch 13 was not accepted because changing indentation doesn't deserve a copyright assignment (IMHO), at that point *you* wanted your patches not to be included if the last one wasn't merged in.
- omar
Re: [PATCH 11/11] staging: ti dspbridge: enable driver building
I'm removing many people from the Cc which I think don't care about this. Is this even the right place for discussing about it?
Quoted 6 lines · Omar Ramirez Luna
Quoted 5 lines · Felipe Contreras
Quoted 3 lines · Greg KH
So I need some more
Kconfigchanges here, care to redo just this one patch? I've applied all the others and they will show up in linux-next tomorrow.
Quoted 6 lines
Quoted 4 lines
I fixed all that stuff some time ago:
http://article.gmane.org/gmane.linux.ports.arm.omap/36065But the patches were ignored.
Patches were not ignored, discussion was held privately (you and me),
That was for the deh reorganization. Not the Kconfig ones.
Regarding the deh reorganization...
Quoted 3 lines
patch
13 was not accepted because changing indentation doesn't deserve a copyright assignment (IMHO),
You didn't want to add a copyright without giving any valid reason, so you started a private thread. You never mentioned any rejection of the patches on any grounds, neither publicly, nor privately.
If the patch series is only changing indentation then the lines removed would match the lines added, which is not the case. Take a look:
15 files changed, 184 insertions(+), 509 deletions(-)
In my book removing 300 lines of code while keeping all the functionality is a good thing. Without even considering that the rest of the insertions are cleaning up the code.
Quoted 2 lines
at that point *you* wanted your patches not to be
included if the last one wasn't merged in.
Not without the copyright update patch.
Maybe you are forgetting that I made many changes before those patches. Here are some stats for ue_deh and mmu_fault:
Me:
22 commits, 487 insertions(+), 742 deletions(-)
Others:
60 commits, 394 insertions(+), 617 deletions(-)
(I didn't count the automated camel case removal)
218 insertions(+), 209 deletions(-)
And 'git blame' shows me on 70% of ue_deh (which doesn't take into consideration code removals which is the main thing I did).
While the vast majority of the changes are cleanups (much needed); there are also functional changes, mostly fixing memory corruptions, both reproduced and theoretical.
If somebody writes a piece of code that's 10,000 lines, and another person reorganizes the code to make it 1,000 lines; IMO the usefulness of the code relies on both person's contributions. Depending on whether you care about having something functional, or maintainability/readability; you might assign more value to one, or the other, but I think both are important.
So. Would you care to give a reason why my contributions don't deserve a copyright?
Signature · 1 line
Felipe Contreras
Re: [PATCH 11/11] staging: ti dspbridge: enable driver building
Quoted 5 lines · Felipe Contreras
Quoted 2 lines · Omar Ramirez Luna
at that point *you* wanted your patches not to be
included if the last one wasn't merged in.Not without the copyright update patch.
...
Quoted 2 lines
So. Would you care to give a reason why my contributions don't deserve a copyright?
Disclaimer: I am not a lawyer, and I speak only for myself in this post, and doesn't represent TI in anyway.
AFAICT, you get copyright for every kernel change you submit and is accepted. Even if you just contribute whitespace cleanups, you get the copyright to those cleanups (not to suggest this was the sole contribution here).
The copyright assignment is per the actual git commit itself, obviously, and it doesn't apply for the rest of the code in those files you edited.
There are some exceptions, but they are not applicable here:
- Usually when you get paid for the work, the employer keeps the copyright of the patch, not the author.
- There are some projects where you have to relinquish the copyright in order for the patch to be accepted. This is how FSF (Free Software Foundation) projects work (e.g. gcc), but not the Linux kernel (which is not a FSF project).
As I mentioned, I don't think these exceptions apply in this case, and AFAICT, Felipe - you inherently get the copyright for the changes that your accepted patches introduce.
So it all boils down to the semantic question whether to edit the header file, adding new copyright lines, or not.
Felipe, I think your contributions are important and helpful, and I would personally be happy if you continue to do them. I personally don't think that adding an explicit copyright line to the header should be important, because you get your copyright anyway. The exact change, to which you get copyright on, is kept in the git history, and will not likely to go away. I think this is pretty satisfying, and as a result, you don't see people(/companies) changing copyright headers when they submit kernel patches that edit existing files.
The only thing I am not sure about, and that may be a concern to TI, is whether adding a copyright line in the header might actually give copyright ownership for the complete file. If this is true, I can understand why TI might not be so keen in adding copyright owners to the file header, without explicitly specifying what is the copyright about (not to suggest any opinion of TI on the matter, I speak only for myself).
Again: I am not a lawyer, and I speak only for myself in this post, and doesn't represent TI in anyway.
Thanks,
Ohad.
Quoted 4 lines
--
Felipe Contreras
RE: [PATCH 11/11] staging: ti dspbridge: enable driver building
In reply to Felipe ContrerasQuoted 12 lines
From: Felipe Contreras [mailto:[email protected]]
I'm removing many people from the Cc which I think don't care about this. Is this even the right place for discussing about it?
Quoted 6 lines · Omar Ramirez Luna
Quoted 5 lines · Felipe Contreras
Quoted 3 lines · Greg KH
So I need some more
Kconfigchanges here, care to redo just this one patch? I've applied all the others and they will show up in linux-next tomorrow.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
I fixed all that stuff some time ago:
http://article.gmane.org/gmane.linux.ports.arm.omap/36065But the patches were ignored.
Patches were not ignored, discussion was held privately (you and me),
That was for the deh reorganization. Not the
Kconfigones.
Yes, you are right, somehow opening this link showed the deh reorganization patches, my bad.
But then again patches were not ignored, I sent you a notification that I was wrongly tracking the first patch for dspbridge branch in case you might wanted to resend again.
Discussion, if any, about copyrights can be done in the patch itself.
- omar