1/* 2 * cmmdefs.h 3 * 4 * DSP-BIOS Bridge driver support functions for TI OMAP processors. 5 * 6 * Global MEM constants and types. 7 * 8 * Copyright (C) 2008 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 CMMDEFS_ 20#define CMMDEFS_ 21 22#include <dspbridge/list.h> 23 24/* Cmm attributes used in cmm_create() */ 25struct cmm_mgrattrs { 26 /* Minimum SM allocation; default 32 bytes. */ 27 u32 ul_min_block_size; 28}; 29 30/* Attributes for CMM_AllocBuf() & CMM_AllocDesc() */ 31struct cmm_attrs { 32 u32 ul_seg_id; /* 1,2... are SM segments. 0 is not. */ 33 u32 ul_alignment; /* 0,1,2,4....ul_min_block_size */ 34}; 35 36/* 37 * DSPPa to GPPPa Conversion Factor. 38 * 39 * For typical platforms: 40 * converted Address = PaDSP + ( c_factor * addressToConvert). 41 */ 42#define CMM_SUBFROMDSPPA -1 43#define CMM_ADDTODSPPA 1 44 45#define CMM_ALLSEGMENTS 0xFFFFFF /* All SegIds */ 46#define CMM_MAXGPPSEGS 1 /* Maximum # of SM segs */ 47 48/* 49 * SMSEGs are SM segments the DSP allocates from. 50 * 51 * This info is used by the GPP to xlate DSP allocated PAs. 52 */ 53 54struct cmm_seginfo { 55 u32 dw_seg_base_pa; /* Start Phys address of SM segment */ 56 /* Total size in bytes of segment: DSP+GPP */ 57 u32 ul_total_seg_size; 58 u32 dw_gpp_base_pa; /* Start Phys addr of Gpp SM seg */ 59 u32 ul_gpp_size; /* Size of Gpp SM seg in bytes */ 60 u32 dw_dsp_base_va; /* DSP virt base byte address */ 61 u32 ul_dsp_size; /* DSP seg size in bytes */ 62 /* # of current GPP allocations from this segment */ 63 u32 ul_in_use_cnt; 64 u32 dw_seg_base_va; /* Start Virt address of SM seg */ 65 66}; 67 68/* CMM useful information */ 69struct cmm_info { 70 /* # of SM segments registered with this Cmm. */ 71 u32 ul_num_gppsm_segs; 72 /* Total # of allocations outstanding for CMM */ 73 u32 ul_total_in_use_cnt; 74 /* Min SM block size allocation from cmm_create() */ 75 u32 ul_min_block_size; 76 /* Info per registered SM segment. */ 77 struct cmm_seginfo seg_info[CMM_MAXGPPSEGS]; 78}; 79 80/* XlatorCreate attributes */ 81struct cmm_xlatorattrs { 82 u32 ul_seg_id; /* segment Id used for SM allocations */ 83 u32 dw_dsp_bufs; /* # of DSP-side bufs */ 84 u32 dw_dsp_buf_size; /* size of DSP-side bufs in GPP bytes */ 85 /* Vm base address alloc'd in client process context */ 86 void *vm_base; 87 /* dw_vm_size must be >= (dwMaxNumBufs * dwMaxSize) */ 88 u32 dw_vm_size; 89}; 90 91/* 92 * Cmm translation types. Use to map SM addresses to process context. 93 */ 94enum cmm_xlatetype { 95 CMM_VA2PA = 0, /* Virtual to GPP physical address xlation */ 96 CMM_PA2VA = 1, /* GPP Physical to virtual */ 97 CMM_VA2DSPPA = 2, /* Va to DSP Pa */ 98 CMM_PA2DSPPA = 3, /* GPP Pa to DSP Pa */ 99 CMM_DSPPA2PA = 4, /* DSP Pa to GPP Pa */ 100}; 101 102struct cmm_object; 103struct cmm_xlatorobject; 104 105#endif /* CMMDEFS_ */ 106