9c4876ae7c40567f338ee3accfacdc7e1c382091
[h-e-n] / drivers / dsp / bridge / dynload / module_list.h
1 /*
2  * dspbridge/mpu_driver/src/dynload/module_list.h
3  *
4  * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5  *
6  * Copyright (C) 2008 Texas Instruments, Inc.
7  *
8  * This package is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  *
12  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15  */
16
17 /*============================================================================
18  Filename:     module_list.h
19
20  Copyright (C) 2002 Texas Instruments Incorporated
21
22
23  This C header file gives the layout of the data structure created by the
24  dynamic loader to describe the set of modules loaded into the DSP.
25
26  Linked List Structure:
27  ----------------------
28  The data structure defined here is a singly-linked list.  The list
29  represents the set of modules which are currently loaded in the DSP memory.
30  The first entry in the list is a header record which contains a flag
31  representing the state of the list.  The rest of the entries in the list
32  are module records.
33
34  Global symbol  _DLModules designates the first record in the list (i.e. the
35  header record).  This symbol must be defined in any program that wishes to
36  use DLLview plug-in.
37
38  String Representation:
39  ----------------------
40  The string names of the module and its sections are stored in a block of
41  memory which follows the module record itself.  The strings are ordered:
42  module name first, followed by section names in order from the first
43  section to the last.  String names are tightly packed arrays of 8-bit
44  characters (two characters per 16-bit word on the C55x).  Strings are
45  zero-byte-terminated.
46
47  Creating and updating the list:
48 -------------------------------
49  Upon loading a new module into the DSP memory the dynamic loader inserts a
50 new module record as the first module record in the list.  The fields of
51  this module record are initialized to reflect the properties of the module.
52  The dynamic loader does NOT increment the flag/counter in the list's header
53  record.
54
55  Upon unloading a module from the DSP memory the dynamic loader removes the
56 module's record from this list.  The dynamic loader also increments the
57  flag/counter in the list's header record to indicate that the list has been
58  changed.
59
60 ============================================================================*/
61
62 #ifndef _MODULE_LIST_H_
63 #define _MODULE_LIST_H_
64
65 #include <linux/types.h>
66
67 /* Global pointer to the modules_header structure*/
68 #define MODULES_HEADER "_DLModules"
69 #define MODULES_HEADER_NO_UNDERSCORE "DLModules"
70
71 /* Initial version number*/
72 #define INIT_VERSION 1
73
74 /* Verification number -- to be recorded in each module record */
75 #define VERIFICATION 0x79
76
77 /* forward declarations */
78 struct dll_module;
79 struct dll_sect;
80
81 /* the first entry in the list is the modules_header record;
82  * its address is contained in the global _DLModules pointer */
83 struct modules_header {
84
85         /* Address of the first dll_module record in the list or NULL.
86          Note: for C55x this is a word address (C55x data is word-addressable)*/
87         u32 first_module;
88
89         /* Combined storage size (in target addressable units) of the
90          * dll_module record which follows this header record, or zero
91          * if the list is empty.  This size includes the module's string table.
92          * Note: for C55x the unit is a 16-bit word */
93         u16 first_module_size;
94
95         /* Counter is incremented whenever a module record is removed from
96          * the list */
97         u16 update_flag;
98
99 } ;
100
101 /* for each 32-bits in above structure, a bitmap, LSB first, whose bits are:
102  * 0 => a 32-bit value, 1 => 2 16-bit values */
103 #define MODULES_HEADER_BITMAP 0x2 /* swapping bitmap for type modules_header */
104
105 /* information recorded about each section in a module */
106 struct dll_sect {
107
108         /* Load-time address of the section.
109          * Note: for C55x this is a byte address for program sections, and
110          * a word address for data sections.  C55x program memory is
111          * byte-addressable, while data memory is word-addressable. */
112         u32 sect_load_adr;
113
114         /* Run-time address of the section.
115          * Note 1: for C55x this is a byte address for program sections, and
116          * a word address for data sections.
117          * Note 2: for C55x two most significant bits of this field indicate
118          * the section type: '00' for a code section, '11' for a data section
119          * (C55 addresses are really only 24-bits wide). */
120         u32 sect_run_adr;
121
122 } ;
123
124 /* the rest of the entries in the list are module records */
125 struct dll_module {
126
127         /* Address of the next dll_module record in the list, or 0 if this is
128          * the last record in the list.
129          * Note: for C55x this is a word address (C55x data is
130          * word-addressable) */
131         u32 next_module;
132
133         /* Combined storage size (in target addressable units) of the
134          * dll_module record which follows this one, or zero if this is the
135          * last record in the list.  This size includes the module's string
136          * table.
137          * Note: for C55x the unit is a 16-bit word. */
138         u16 next_module_size;
139
140         /* version number of the tooling; set to INIT_VERSION for Phase 1 */
141         u16 version;
142
143         /* the verification word; set to VERIFICATION */
144         u16 verification;
145
146         /* Number of sections in the sects array */
147         u16 num_sects;
148
149         /* Module's "unique" id; copy of the timestamp from the host
150          * COFF file */
151         u32 timestamp;
152
153         /* Array of num_sects elements of the module's section records */
154         struct dll_sect sects[1];
155 } ;
156
157 /* for each 32 bits in above structure, a bitmap, LSB first, whose bits are:
158  * 0 => a 32-bit value, 1 => 2 16-bit values */
159 #define DLL_MODULE_BITMAP 0x6   /* swapping bitmap for type dll_module */
160
161 #endif                          /* _MODULE_LIST_H_ */