40 #include <linux/types.h>
41 #include <linux/list.h>
100 if (!alloc_block(target, segid, size, align, dsp_address)) {
105 target->
seg_tab[segid].number++;
115 if (addr <= sect->addr) {
117 if ((addr + size > sect->
addr) || (prev_sect &&
130 if (new_sect ==
NULL) {
135 new_sect->
page = segid;
182 for (i = 0; i < (
s32) num_segs; i++) {
198 for (i = 0, tmp = seg_tab; num_segs > 0;
246 for (i = 0; i < target->
num_segs; i++) {
273 ret = free_block(target, segid, dsp_addr, size);
275 target->
seg_tab[segid].number--;
281 if (dsp_addr == sect->
addr) {
300 u32 max_free_size = 0;
301 u32 total_free_size = 0;
304 if ((
u32) segid < target->num_segs) {
308 while (head !=
NULL) {
309 max_free_size =
max(max_free_size, head->
size);
310 total_free_size += head->
size;
316 mem_stat_buf->
size = target->
seg_tab[segid].length;
354 alignbytes = (align == 0) ? 1 : align;
365 (tmpalign = (
u32) addr % alignbytes);
367 tmpalign = alignbytes - tmpalign;
369 allocsize = size + tmpalign;
371 if (hsize >= allocsize) {
372 if (hsize == allocsize && prevhead !=
NULL) {
376 head->
size = hsize - allocsize;
377 head->
addr += allocsize;
382 free_block(target, segid, addr, tmpalign);
384 *dsp_address = addr + tmpalign;
391 }
while (head !=
NULL);
419 if (addr >= head->
addr) {