Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dbdefs.h
Go to the documentation of this file.
1 /*
2  * dbdefs.h
3  *
4  * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5  *
6  * Global definitions and constants for DSP/BIOS Bridge.
7  *
8  * Copyright (C) 2005-2006 Texas Instruments, Inc.
9  *
10  * This package is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  *
14  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17  */
18 
19 #ifndef DBDEFS_
20 #define DBDEFS_
21 
22 #include <linux/types.h>
23 
24 #include <dspbridge/rms_sh.h> /* Types shared between GPP and DSP */
25 
26 #define PG_SIZE4K 4096
27 #define PG_MASK(pg_size) (~((pg_size)-1))
28 #define PG_ALIGN_LOW(addr, pg_size) ((addr) & PG_MASK(pg_size))
29 #define PG_ALIGN_HIGH(addr, pg_size) (((addr)+(pg_size)-1) & PG_MASK(pg_size))
30 
31 /* API return value and calling convention */
32 #define DBAPI int
33 
34 /* Maximum length of node name, used in dsp_ndbprops */
35 #define DSP_MAXNAMELEN 32
36 
37 /* notify_type values for the RegisterNotify() functions. */
38 #define DSP_SIGNALEVENT 0x00000001
39 
40 /* Types of events for processors */
41 #define DSP_PROCESSORSTATECHANGE 0x00000001
42 #define DSP_PROCESSORATTACH 0x00000002
43 #define DSP_PROCESSORDETACH 0x00000004
44 #define DSP_PROCESSORRESTART 0x00000008
45 
46 /* DSP exception events (DSP/BIOS and DSP MMU fault) */
47 #define DSP_MMUFAULT 0x00000010
48 #define DSP_SYSERROR 0x00000020
49 #define DSP_EXCEPTIONABORT 0x00000300
50 #define DSP_PWRERROR 0x00000080
51 #define DSP_WDTOVERFLOW 0x00000040
52 
53 /* IVA exception events (IVA MMU fault) */
54 #define IVA_MMUFAULT 0x00000040
55 /* Types of events for nodes */
56 #define DSP_NODESTATECHANGE 0x00000100
57 #define DSP_NODEMESSAGEREADY 0x00000200
58 
59 /* Types of events for streams */
60 #define DSP_STREAMDONE 0x00001000
61 #define DSP_STREAMIOCOMPLETION 0x00002000
62 
63 /* Handle definition representing the GPP node in DSPNode_Connect() calls */
64 #define DSP_HGPPNODE 0xFFFFFFFF
65 
66 /* Node directions used in DSPNode_Connect() */
67 #define DSP_TONODE 1
68 #define DSP_FROMNODE 2
69 
70 /* Define Node Minimum and Maximum Priorities */
71 #define DSP_NODE_MIN_PRIORITY 1
72 #define DSP_NODE_MAX_PRIORITY 15
73 
74 /* msg_ctrl contains SM buffer description */
75 #define DSP_RMSBUFDESC RMS_BUFDESC
76 
77 /* Processor ID numbers */
78 #define DSP_UNIT 0
79 #define IVA_UNIT 1
80 
81 #define DSPWORD unsigned char
82 #define DSPWORDSIZE sizeof(DSPWORD)
83 
84 #define MAX_PROFILES 16
85 
86 /* DSP chip type */
87 #define DSPTYPE64 0x99
88 
89 /* Handy Macros */
90 #define VALID_PROC_EVENT (DSP_PROCESSORSTATECHANGE | DSP_PROCESSORATTACH | \
91  DSP_PROCESSORDETACH | DSP_PROCESSORRESTART | DSP_NODESTATECHANGE | \
92  DSP_STREAMDONE | DSP_STREAMIOCOMPLETION | DSP_MMUFAULT | \
93  DSP_SYSERROR | DSP_WDTOVERFLOW | DSP_PWRERROR)
94 
95 static inline bool is_valid_proc_event(u32 x)
96 {
97  return (x == 0 || (x & VALID_PROC_EVENT && !(x & ~VALID_PROC_EVENT)));
98 }
99 
100 /* The Node UUID structure */
101 struct dsp_uuid {
107  u8 data6[6];
108 };
109 
110 /* DCD types */
118  /* DSP_DCDMAXOBJTYPE is meant to be the last DCD object type */
120 };
121 
122 /* Processor states */
128 };
129 
130 /*
131  * Node types: Message node, task node, xDAIS socket node, and
132  * device node. _NODE_GPP is used when defining a stream connection
133  * between a task or socket node and the GPP.
134  *
135  */
136 enum node_type {
142 };
143 
144 /*
145  * ======== node_state ========
146  * Internal node states.
147  */
159 };
160 
161 /* Stream states */
167 };
168 
169 /* Stream connect types */
175 };
176 
177 /* Stream mode types */
179  STRMMODE_PROCCOPY, /* Processor(s) copy stream data payloads */
180  STRMMODE_ZEROCOPY, /* Strm buffer ptrs swapped no data copied */
181  STRMMODE_LDMA, /* Local DMA : OMAP's System-DMA device */
182  STRMMODE_RDMA /* Remote DMA: OMAP's DSP-DMA device */
183 };
184 
185 /* Resource Types */
192 };
193 
194 /* Memory Segment Types */
200 };
201 
202 /* Memory Flush Types */
207 };
208 
209 /* Memory Segment Status Values */
210 struct dsp_memstat {
216 };
217 
218 /* Processor Load information Values */
224 };
225 
226 /* Attributes for STRM connections between nodes */
227 struct dsp_strmattr {
228  u32 seg_id; /* Memory segment on DSP to allocate buffers */
229  u32 buf_size; /* Buffer size (DSP words) */
230  u32 num_bufs; /* Number of buffers */
231  u32 buf_alignment; /* Buffer alignment */
232  u32 timeout; /* Timeout for blocking STRM calls */
233  enum dsp_strmmode strm_mode; /* mode of stream when opened */
234  /* DMA chnl id if dsp_strmmode is LDMA or RDMA */
236  u32 dma_priority; /* DMA channel priority 0=lowest, >0=high */
237 };
238 
239 /* The dsp_cbdata structure */
240 struct dsp_cbdata {
243 };
244 
245 /* The dsp_msg structure */
246 struct dsp_msg {
250 };
251 
252 /* The dsp_resourcereqmts structure for node's resource requirements */
263 };
264 
265 /*
266  * The dsp_streamconnect structure describes a stream connection
267  * between two nodes, or between a node and the GPP
268  */
276 };
277 
280 };
281 
282 /* The dsp_ndbprops structure reports the attributes of a node */
283 struct dsp_ndbprops {
298  u32 count_profiles; /* Number of supported profiles */
299  /* Array of profiles */
301  u32 stack_seg_name; /* Stack Segment Name */
302 };
303 
304  /* The dsp_nodeattrin structure describes the attributes of a
305  * node client */
311  /* Reserved, for Bridge Internal use only */
313  void *pgpp_virt_addr; /* Reserved, for Bridge Internal use only */
314 };
315 
316  /* The dsp_nodeinfo structure is used to retrieve information
317  * about a node */
318 struct dsp_nodeinfo {
327 };
328 
329  /* The dsp_nodeattr structure describes the attributes of a node */
330 struct dsp_nodeattr {
336 };
337 
338 /*
339  * Notification type: either the name of an opened event, or an event or
340  * window handle.
341  */
343  char *name;
344  void *handle;
345 };
346 
347 /* The dsp_processorattrin structure describes the attributes of a processor */
351 };
352 /*
353  * The dsp_processorinfo structure describes basic capabilities of a
354  * DSP processor
355  */
367 };
368 
369 /* Error information of last DSP exception signalled to the GPP */
375 };
376 
377 /* The dsp_processorstate structure describes the state of a DSP processor */
381 };
382 
383 /*
384  * The dsp_resourceinfo structure is used to retrieve information about a
385  * processor's resources
386  */
390  union {
394  } result;
395 };
396 
397 /*
398  * The dsp_streamattrin structure describes the attributes of a stream,
399  * including segment and alignment of data buffers allocated with
400  * DSPStream_AllocateBuffers(), if applicable
401  */
411 };
412 
413 /* The dsp_bufferattr structure describes the attributes of a data buffer */
418 };
419 
420 /*
421  * The dsp_streaminfo structure is used to retrieve information
422  * about a stream.
423  */
431 };
432 
433 /* DMM MAP attributes
434 It is a bit mask with each bit value indicating a specific attribute
435 bit 0 - GPP address type (user virtual=0, physical=1)
436 bit 1 - MMU Endianism (Big Endian=1, Little Endian=0)
437 bit 2 - MMU mixed page attribute (Mixed/ CPUES=1, TLBES =0)
438 bit 3 - MMU element size = 8bit (valid only for non mixed page entries)
439 bit 4 - MMU element size = 16bit (valid only for non mixed page entries)
440 bit 5 - MMU element size = 32bit (valid only for non mixed page entries)
441 bit 6 - MMU element size = 64bit (valid only for non mixed page entries)
442 
443 bit 14 - Input (read only) buffer
444 bit 15 - Output (writeable) buffer
445 */
446 
447 /* Types of mapping attributes */
448 
449 /* MPU address is virtual and needs to be translated to physical addr */
450 #define DSP_MAPVIRTUALADDR 0x00000000
451 #define DSP_MAPPHYSICALADDR 0x00000001
452 
453 /* Mapped data is big endian */
454 #define DSP_MAPBIGENDIAN 0x00000002
455 #define DSP_MAPLITTLEENDIAN 0x00000000
456 
457 /* Element size is based on DSP r/w access size */
458 #define DSP_MAPMIXEDELEMSIZE 0x00000004
459 
460 /*
461  * Element size for MMU mapping (8, 16, 32, or 64 bit)
462  * Ignored if DSP_MAPMIXEDELEMSIZE enabled
463  */
464 #define DSP_MAPELEMSIZE8 0x00000008
465 #define DSP_MAPELEMSIZE16 0x00000010
466 #define DSP_MAPELEMSIZE32 0x00000020
467 #define DSP_MAPELEMSIZE64 0x00000040
468 
469 #define DSP_MAPVMALLOCADDR 0x00000080
470 
471 #define DSP_MAPDONOTLOCK 0x00000100
472 
473 #define DSP_MAP_DIR_MASK 0x3FFF
474 
475 #define GEM_CACHE_LINE_SIZE 128
476 #define GEM_L1P_PREFETCH_SIZE 128
477 
478 /*
479  * Definitions from dbreg.h
480  */
481 
482 #define DSPPROCTYPE_C64 6410
483 #define IVAPROCTYPE_ARM7 470
484 
485 /* Max registry path length. Also the max registry value length. */
486 #define MAXREGPATHLENGTH 255
487 
488 #endif /* DBDEFS_ */