4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 * This memory manager provides general heap management and arbitrary
7 * alignment for any number of memory segments, and management of overlay
10 * Copyright (C) 2005-2006 Texas Instruments, Inc.
12 * This package is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
16 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25 * ======== rmm_addr ========
34 * ======== rmm_segment ========
35 * Memory segment on the DSP available for remote allocations.
38 u32 base; /* Base of the segment */
39 u32 length; /* Size of the segment (target MAUs) */
40 s32 space; /* Code or data */
41 u32 number; /* Number of Allocated Blocks */
45 * ======== RMM_Target ========
47 struct rmm_target_obj;
50 * ======== rmm_alloc ========
52 * rmm_alloc is used to remotely allocate or reserve memory on the DSP.
55 * target - Target returned from rmm_create().
56 * segid - Memory segment to allocate from.
57 * size - Size (target MAUS) to allocate.
59 * dsp_address - If reserve is FALSE, the location to store allocated
60 * address on output, otherwise, the DSP address to
62 * reserve - If TRUE, reserve the memory specified by dsp_address.
65 * -ENOMEM: Memory allocation on GPP failed.
66 * -ENXIO: Cannot "allocate" overlay memory because it's
71 * dsp_address != NULL.
73 * reserve || target->num_segs > 0.
76 extern int rmm_alloc(struct rmm_target_obj *target, u32 segid, u32 size,
77 u32 align, u32 *dsp_address, bool reserve);
80 * ======== rmm_create ========
81 * Create a target object with memory segments for remote allocation. If
82 * seg_tab == NULL or num_segs == 0, memory can only be reserved through
86 * target_obj: - Location to store target on output.
87 * seg_tab: - Table of memory segments.
88 * num_segs: - Number of memory segments.
91 * -ENOMEM: Memory allocation failed.
95 * num_segs == 0 || seg_tab != NULL.
97 * Success: Valid *target_obj.
98 * Failure: *target_obj == NULL.
100 extern int rmm_create(struct rmm_target_obj **target_obj,
101 struct rmm_segment seg_tab[], u32 num_segs);
104 * ======== rmm_delete ========
105 * Delete target allocated in rmm_create().
108 * target - Target returned from rmm_create().
115 extern void rmm_delete(struct rmm_target_obj *target);
118 * ======== rmm_exit ========
119 * Exit the RMM module
124 * rmm_init successfully called.
127 extern void rmm_exit(void);
130 * ======== rmm_free ========
131 * Free or unreserve memory allocated through rmm_alloc().
134 * target: - Target returned from rmm_create().
135 * segid: - Segment of memory to free.
136 * dsp_address: - Address to free or unreserve.
137 * size: - Size of memory to free or unreserve.
138 * reserved: - TRUE if memory was reserved only, otherwise FALSE.
143 * reserved || segid < target->num_segs.
144 * reserve || [dsp_address, dsp_address + size] is a valid memory range.
147 extern bool rmm_free(struct rmm_target_obj *target, u32 segid, u32 dsp_addr,
148 u32 size, bool reserved);
151 * ======== rmm_init ========
152 * Initialize the RMM module
161 extern bool rmm_init(void);
164 * ======== rmm_stat ========
165 * Obtain memory segment status
168 * segid: Segment ID of the dynamic loading segment.
169 * mem_stat_buf: Pointer to allocated buffer into which memory stats are
175 * segid < target->num_segs
178 extern bool rmm_stat(struct rmm_target_obj *target, enum dsp_memtype segid,
179 struct dsp_memstat *mem_stat_buf);