Lines Matching refs:ba

556 	struct sst_block_allocator *ba)  in find_block()  argument
561 if (block->type == ba->type && block->offset == ba->offset) in find_block()
570 struct sst_block_allocator *ba, struct list_head *block_list) in block_alloc_contiguous() argument
575 int size = ba->size, offset = ba->offset; in block_alloc_contiguous()
577 while (ba->size > 0) { in block_alloc_contiguous()
579 block = find_block(dsp, ba); in block_alloc_contiguous()
583 ba->size = size; in block_alloc_contiguous()
584 ba->offset = offset; in block_alloc_contiguous()
589 ba->offset += block->size; in block_alloc_contiguous()
590 ba->size -= block->size; in block_alloc_contiguous()
592 ba->size = size; in block_alloc_contiguous()
593 ba->offset = offset; in block_alloc_contiguous()
611 static int block_alloc(struct sst_dsp *dsp, struct sst_block_allocator *ba, in block_alloc() argument
617 if (ba->size == 0) in block_alloc()
624 if (block->type != ba->type) in block_alloc()
627 if (ba->size > block->size) in block_alloc()
630 ba->offset = block->offset; in block_alloc()
631 block->bytes_used = ba->size % block->size; in block_alloc()
643 if (block->type != ba->type) in block_alloc()
647 if (ba->size > block->size) { in block_alloc()
650 ba->offset = block->offset; in block_alloc()
652 ret = block_alloc_contiguous(dsp, ba, block_list); in block_alloc()
663 int sst_alloc_blocks(struct sst_dsp *dsp, struct sst_block_allocator *ba, in sst_alloc_blocks() argument
669 ba->size, ba->offset, ba->type); in sst_alloc_blocks()
673 ret = block_alloc(dsp, ba, block_list); in sst_alloc_blocks()
700 static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba, in block_alloc_fixed() argument
704 struct sst_block_allocator ba_tmp = *ba; in block_alloc_fixed()
705 u32 end = ba->offset + ba->size, block_end; in block_alloc_fixed()
709 if (ba->type != SST_MEM_IRAM && ba->type != SST_MEM_DRAM) in block_alloc_fixed()
716 if (block->type != ba->type) in block_alloc_fixed()
722 if (ba->offset >= block->offset && end <= block_end) in block_alloc_fixed()
726 if (ba->offset >= block->offset && ba->offset < block_end) { in block_alloc_fixed()
729 ba_tmp.size -= block_end - ba->offset; in block_alloc_fixed()
745 if (block->type != ba->type) in block_alloc_fixed()
749 if (ba->offset >= block->offset && end <= block_end) { in block_alloc_fixed()
760 if (ba->offset >= block->offset && ba->offset < block_end) { in block_alloc_fixed()
766 ba_tmp.size -= block_end - ba->offset; in block_alloc_fixed()
785 struct sst_block_allocator ba; in sst_module_alloc_blocks() local
788 memset(&ba, 0, sizeof(ba)); in sst_module_alloc_blocks()
789 ba.size = module->size; in sst_module_alloc_blocks()
790 ba.type = module->type; in sst_module_alloc_blocks()
791 ba.offset = module->offset; in sst_module_alloc_blocks()
794 ba.size, ba.offset, ba.type); in sst_module_alloc_blocks()
799 ret = block_alloc_fixed(dsp, &ba, &module->block_list); in sst_module_alloc_blocks()
856 struct sst_block_allocator ba; in sst_module_runtime_alloc_blocks() local
862 memset(&ba, 0, sizeof(ba)); in sst_module_runtime_alloc_blocks()
863 ba.size = module->persistent_size; in sst_module_runtime_alloc_blocks()
864 ba.type = SST_MEM_DRAM; in sst_module_runtime_alloc_blocks()
871 ba.offset = offset; in sst_module_runtime_alloc_blocks()
874 ba.size, ba.type, ba.offset); in sst_module_runtime_alloc_blocks()
877 ret = block_alloc_fixed(dsp, &ba, &runtime->block_list); in sst_module_runtime_alloc_blocks()
881 ba.size, ba.type); in sst_module_runtime_alloc_blocks()
884 ret = block_alloc(dsp, &ba, &runtime->block_list); in sst_module_runtime_alloc_blocks()
893 runtime->persistent_offset = ba.offset; in sst_module_runtime_alloc_blocks()
1069 struct sst_block_allocator ba; in sst_block_alloc_scratch() local
1095 ba.size = dsp->scratch_size; in sst_block_alloc_scratch()
1096 ba.type = SST_MEM_DRAM; in sst_block_alloc_scratch()
1102 ba.size, ba.type, ba.offset); in sst_block_alloc_scratch()
1104 ba.offset = dsp->scratch_offset; in sst_block_alloc_scratch()
1107 ret = block_alloc_fixed(dsp, &ba, &dsp->scratch_block_list); in sst_block_alloc_scratch()
1111 ba.size, ba.type); in sst_block_alloc_scratch()
1113 ba.offset = 0; in sst_block_alloc_scratch()
1114 ret = block_alloc(dsp, &ba, &dsp->scratch_block_list); in sst_block_alloc_scratch()
1130 dsp->scratch_offset = ba.offset; in sst_block_alloc_scratch()