1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
/*
* io_sm.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* IO dispatcher for a shared memory channel driver.
* Also, includes macros to simulate shm via port io calls.
*
* 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 IOSM_
#define IOSM_
#include <dspbridge/_chnl_sm.h>
#include <dspbridge/host_os.h>
#include <dspbridge/iodefs.h>
#define IO_INPUT 0
#define IO_OUTPUT 1
#define IO_SERVICE 2
#ifdef CONFIG_TIDSPBRIDGE_DVFS
/* The maximum number of OPPs that are supported */
extern s32 dsp_max_opps;
/* The Vdd1 opp table information */
extern u32 vdd1_dsp_freq[6][4];
#endif
/*
* ======== io_cancel_chnl ========
* Purpose:
* Cancel IO on a given channel.
* Parameters:
* hio_mgr: IO Manager.
* chnl: Index of channel to cancel IO on.
* Returns:
* Requires:
* Valid hio_mgr.
* Ensures:
*/
extern void io_cancel_chnl(struct io_mgr *hio_mgr, u32 chnl);
/*
* ======== io_dpc ========
* Purpose:
* Deferred procedure call for shared memory channel driver ISR. Carries
* out the dispatch of I/O.
* Parameters:
* ref_data: Pointer to reference data registered via a call to
* DPC_Create().
* Returns:
* Requires:
* Must not block.
* Must not acquire resources.
* All data touched must be locked in memory if running in kernel mode.
* Ensures:
* Non-preemptible (but interruptible).
*/
extern void io_dpc(unsigned long ref_data);
/*
* ======== io_mbox_msg ========
* Purpose:
* Main message handler for the shared memory Bridge channel manager.
* Determine if this message is ours, then schedules a DPC to
* dispatch I/O.
* Parameters:
* self: Pointer to its own notifier_block struct.
* len: Length of message.
* msg: Message code received.
* Returns:
* NOTIFY_OK if handled; NOTIFY_BAD otherwise.
*/
int io_mbox_msg(struct notifier_block *self, unsigned long len, void *msg);
/*
* ======== io_request_chnl ========
* Purpose:
* Request I/O from the DSP. Sets flags in shared memory, then interrupts
* the DSP.
* Parameters:
* hio_mgr: IO manager handle.
* pchnl: Ptr to the channel requesting I/O.
* io_mode: Mode of channel: {IO_INPUT | IO_OUTPUT}.
* Returns:
* Requires:
* pchnl != NULL
* Ensures:
*/
extern void io_request_chnl(struct io_mgr *io_manager,
struct chnl_object *pchnl,
u8 io_mode, u16 *mbx_val);
/*
* ======== iosm_schedule ========
* Purpose:
* Schedule DPC for IO.
* Parameters:
* pio_mgr: Ptr to a I/O manager.
* Returns:
* Requires:
* pchnl != NULL
* Ensures:
*/
extern void iosm_schedule(struct io_mgr *io_manager);
/*
* DSP-DMA IO functions
*/
/*
* ======== io_ddma_init_chnl_desc ========
* Purpose:
* Initialize DSP DMA channel descriptor.
* Parameters:
* hio_mgr: Handle to a I/O manager.
* ddma_chnl_id: DDMA channel identifier.
* num_desc: Number of buffer descriptors(equals # of IOReqs &
* Chirps)
* dsp: Dsp address;
* Returns:
* Requires:
* ddma_chnl_id < DDMA_MAXDDMACHNLS
* num_desc > 0
* pVa != NULL
* pDspPa != NULL
*
* Ensures:
*/
extern void io_ddma_init_chnl_desc(struct io_mgr *hio_mgr, u32 ddma_chnl_id,
u32 num_desc, void *dsp);
/*
* ======== io_ddma_clear_chnl_desc ========
* Purpose:
* Clear DSP DMA channel descriptor.
* Parameters:
* hio_mgr: Handle to a I/O manager.
* ddma_chnl_id: DDMA channel identifier.
* Returns:
* Requires:
* ddma_chnl_id < DDMA_MAXDDMACHNLS
* Ensures:
*/
extern void io_ddma_clear_chnl_desc(struct io_mgr *hio_mgr, u32 ddma_chnl_id);
/*
* ======== io_ddma_request_chnl ========
* Purpose:
* Request channel DSP-DMA from the DSP. Sets up SM descriptors and
* control fields in shared memory.
* Parameters:
* hio_mgr: Handle to a I/O manager.
* pchnl: Ptr to channel object
* chnl_packet_obj: Ptr to channel i/o request packet.
* Returns:
* Requires:
* pchnl != NULL
* pchnl->cio_reqs > 0
* chnl_packet_obj != NULL
* Ensures:
*/
extern void io_ddma_request_chnl(struct io_mgr *hio_mgr,
struct chnl_object *pchnl,
struct chnl_irp *chnl_packet_obj,
u16 *mbx_val);
/*
* Zero-copy IO functions
*/
/*
* ======== io_ddzc_init_chnl_desc ========
* Purpose:
* Initialize ZCPY channel descriptor.
* Parameters:
* hio_mgr: Handle to a I/O manager.
* zid: zero-copy channel identifier.
* Returns:
* Requires:
* ddma_chnl_id < DDMA_MAXZCPYCHNLS
* hio_mgr != Null
* Ensures:
*/
extern void io_ddzc_init_chnl_desc(struct io_mgr *hio_mgr, u32 zid);
/*
* ======== io_ddzc_clear_chnl_desc ========
* Purpose:
* Clear DSP ZC channel descriptor.
* Parameters:
* hio_mgr: Handle to a I/O manager.
* ch_id: ZC channel identifier.
* Returns:
* Requires:
* hio_mgr is valid
* ch_id < DDMA_MAXZCPYCHNLS
* Ensures:
*/
extern void io_ddzc_clear_chnl_desc(struct io_mgr *hio_mgr, u32 ch_id);
/*
* ======== io_ddzc_request_chnl ========
* Purpose:
* Request zero-copy channel transfer. Sets up SM descriptors and
* control fields in shared memory.
* Parameters:
* hio_mgr: Handle to a I/O manager.
* pchnl: Ptr to channel object
* chnl_packet_obj: Ptr to channel i/o request packet.
* Returns:
* Requires:
* pchnl != NULL
* pchnl->cio_reqs > 0
* chnl_packet_obj != NULL
* Ensures:
*/
extern void io_ddzc_request_chnl(struct io_mgr *hio_mgr,
struct chnl_object *pchnl,
struct chnl_irp *chnl_packet_obj,
u16 *mbx_val);
/*
* ======== io_sh_msetting ========
* Purpose:
* Sets the shared memory setting
* Parameters:
* hio_mgr: Handle to a I/O manager.
* desc: Shared memory type
* pargs: Ptr to shm setting
* Returns:
* Requires:
* hio_mgr != NULL
* pargs != NULL
* Ensures:
*/
extern int io_sh_msetting(struct io_mgr *hio_mgr, u8 desc, void *pargs);
/*
* Misc functions for the CHNL_IO shared memory library:
*/
/* Maximum channel bufsize that can be used. */
extern u32 io_buf_size(struct io_mgr *hio_mgr);
extern u32 io_read_value(struct bridge_dev_context *dev_ctxt, u32 dsp_addr);
extern void io_write_value(struct bridge_dev_context *dev_ctxt,
u32 dsp_addr, u32 value);
extern u32 io_read_value_long(struct bridge_dev_context *dev_ctxt,
u32 dsp_addr);
extern void io_write_value_long(struct bridge_dev_context *dev_ctxt,
u32 dsp_addr, u32 value);
extern void io_or_set_value(struct bridge_dev_context *dev_ctxt,
u32 dsp_addr, u32 value);
extern void io_and_set_value(struct bridge_dev_context *dev_ctxt,
u32 dsp_addr, u32 value);
extern void io_sm_init(void);
#ifdef CONFIG_TIDSPBRIDGE_BACKTRACE
/*
* ========print_dsp_trace_buffer ========
* Print DSP tracebuffer.
*/
extern int print_dsp_trace_buffer(struct bridge_dev_context
*hbridge_context);
int dump_dsp_stack(struct bridge_dev_context *bridge_context);
void dump_dl_modules(struct bridge_dev_context *bridge_context);
#endif
#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG)
void print_dsp_debug_trace(struct io_mgr *hio_mgr);
#endif
#endif /* IOSM_ */
|