aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/tidspbridge/include/dspbridge/cmmdefs.h
blob: a264fa69a4fcb55673c5ca377fa5ca9ac1449b85 (plain) (blame)
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
/*
 * cmmdefs.h
 *
 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
 *
 * Global MEM constants and types.
 *
 * Copyright (C) 2008 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 CMMDEFS_
#define CMMDEFS_


/* Cmm attributes used in cmm_create() */
struct cmm_mgrattrs {
	/* Minimum SM allocation; default 32 bytes. */
	u32 min_block_size;
};

/* Attributes for CMM_AllocBuf() & CMM_AllocDesc() */
struct cmm_attrs {
	u32 seg_id;		/*  1,2... are SM segments. 0 is not. */
	u32 alignment;		/*  0,1,2,4....min_block_size */
};

/*
 *  DSPPa to GPPPa Conversion Factor.
 *
 *  For typical platforms:
 *      converted Address = PaDSP + ( c_factor * addressToConvert).
 */
#define CMM_SUBFROMDSPPA	-1
#define CMM_ADDTODSPPA		1

#define CMM_ALLSEGMENTS         0xFFFFFF	/* All SegIds */
#define CMM_MAXGPPSEGS          1	/* Maximum # of SM segs */

/*
 *  SMSEGs are SM segments the DSP allocates from.
 *
 *  This info is used by the GPP to xlate DSP allocated PAs.
 */

struct cmm_seginfo {
	u32 seg_base_pa;	/* Start Phys address of SM segment */
	/* Total size in bytes of segment: DSP+GPP */
	u32 total_seg_size;
	u32 gpp_base_pa;	/* Start Phys addr of Gpp SM seg */
	u32 gpp_size;	/* Size of Gpp SM seg in bytes */
	u32 dsp_base_va;	/* DSP virt base byte address */
	u32 dsp_size;		/* DSP seg size in bytes */
	/* # of current GPP allocations from this segment */
	u32 in_use_cnt;
	u32 seg_base_va;	/* Start Virt address of SM seg */

};

/* CMM useful information */
struct cmm_info {
	/* # of SM segments registered with this Cmm. */
	u32 num_gppsm_segs;
	/* Total # of allocations outstanding for CMM */
	u32 total_in_use_cnt;
	/* Min SM block size allocation from cmm_create() */
	u32 min_block_size;
	/* Info per registered SM segment. */
	struct cmm_seginfo seg_info[CMM_MAXGPPSEGS];
};

/* XlatorCreate attributes */
struct cmm_xlatorattrs {
	u32 seg_id;		/* segment Id used for SM allocations */
	u32 dsp_bufs;		/* # of DSP-side bufs */
	u32 dsp_buf_size;	/* size of DSP-side bufs in GPP bytes */
	/* Vm base address alloc'd in client process context */
	void *vm_base;
	/* vm_size must be >= (dwMaxNumBufs * dwMaxSize) */
	u32 vm_size;
};

/*
 * Cmm translation types. Use to map SM addresses to process context.
 */
enum cmm_xlatetype {
	CMM_VA2PA = 0,		/* Virtual to GPP physical address xlation */
	CMM_PA2VA = 1,		/* GPP Physical to virtual */
	CMM_VA2DSPPA = 2,	/* Va to DSP Pa */
	CMM_PA2DSPPA = 3,	/* GPP Pa to DSP Pa */
	CMM_DSPPA2PA = 4,	/* DSP Pa to GPP Pa */
};

struct cmm_object;
struct cmm_xlatorobject;

#endif /* CMMDEFS_ */