Lines Matching refs:ba

562 	struct sst_block_allocator *ba)  in find_block()  argument
567 if (block->type == ba->type && block->offset == ba->offset) in find_block()
576 struct sst_block_allocator *ba, struct list_head *block_list) in block_alloc_contiguous() argument
581 int size = ba->size, offset = ba->offset; in block_alloc_contiguous()
583 while (ba->size > 0) { in block_alloc_contiguous()
585 block = find_block(dsp, ba); in block_alloc_contiguous()
589 ba->size = size; in block_alloc_contiguous()
590 ba->offset = offset; in block_alloc_contiguous()
595 ba->offset += block->size; in block_alloc_contiguous()
596 ba->size -= block->size; in block_alloc_contiguous()
598 ba->size = size; in block_alloc_contiguous()
599 ba->offset = offset; in block_alloc_contiguous()
617 static int block_alloc(struct sst_dsp *dsp, struct sst_block_allocator *ba, in block_alloc() argument
623 if (ba->size == 0) in block_alloc()
630 if (block->type != ba->type) in block_alloc()
633 if (ba->size > block->size) in block_alloc()
636 ba->offset = block->offset; in block_alloc()
637 block->bytes_used = ba->size % block->size; in block_alloc()
649 if (block->type != ba->type) in block_alloc()
653 if (ba->size > block->size) { in block_alloc()
656 ba->offset = block->offset; in block_alloc()
658 ret = block_alloc_contiguous(dsp, ba, block_list); in block_alloc()
669 int sst_alloc_blocks(struct sst_dsp *dsp, struct sst_block_allocator *ba, in sst_alloc_blocks() argument
675 ba->size, ba->offset, ba->type); in sst_alloc_blocks()
679 ret = block_alloc(dsp, ba, block_list); in sst_alloc_blocks()
706 static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba, in block_alloc_fixed() argument
710 struct sst_block_allocator ba_tmp = *ba; in block_alloc_fixed()
711 u32 end = ba->offset + ba->size, block_end; in block_alloc_fixed()
715 if (ba->type != SST_MEM_IRAM && ba->type != SST_MEM_DRAM) in block_alloc_fixed()
722 if (block->type != ba->type) in block_alloc_fixed()
728 if (ba->offset >= block->offset && end <= block_end) in block_alloc_fixed()
732 if (ba->offset >= block->offset && ba->offset < block_end) { in block_alloc_fixed()
735 ba_tmp.size -= block_end - ba->offset; in block_alloc_fixed()
751 if (block->type != ba->type) in block_alloc_fixed()
755 if (ba->offset >= block->offset && end <= block_end) { in block_alloc_fixed()
766 if (ba->offset >= block->offset && ba->offset < block_end) { in block_alloc_fixed()
772 ba_tmp.size -= block_end - ba->offset; in block_alloc_fixed()
791 struct sst_block_allocator ba; in sst_module_alloc_blocks() local
794 memset(&ba, 0, sizeof(ba)); in sst_module_alloc_blocks()
795 ba.size = module->size; in sst_module_alloc_blocks()
796 ba.type = module->type; in sst_module_alloc_blocks()
797 ba.offset = module->offset; in sst_module_alloc_blocks()
800 ba.size, ba.offset, ba.type); in sst_module_alloc_blocks()
805 ret = block_alloc_fixed(dsp, &ba, &module->block_list); in sst_module_alloc_blocks()
862 struct sst_block_allocator ba; in sst_module_runtime_alloc_blocks() local
868 memset(&ba, 0, sizeof(ba)); in sst_module_runtime_alloc_blocks()
869 ba.size = module->persistent_size; in sst_module_runtime_alloc_blocks()
870 ba.type = SST_MEM_DRAM; in sst_module_runtime_alloc_blocks()
877 ba.offset = offset; in sst_module_runtime_alloc_blocks()
880 ba.size, ba.type, ba.offset); in sst_module_runtime_alloc_blocks()
883 ret = block_alloc_fixed(dsp, &ba, &runtime->block_list); in sst_module_runtime_alloc_blocks()
887 ba.size, ba.type); in sst_module_runtime_alloc_blocks()
890 ret = block_alloc(dsp, &ba, &runtime->block_list); in sst_module_runtime_alloc_blocks()
899 runtime->persistent_offset = ba.offset; in sst_module_runtime_alloc_blocks()
1075 struct sst_block_allocator ba; in sst_block_alloc_scratch() local
1101 ba.size = dsp->scratch_size; in sst_block_alloc_scratch()
1102 ba.type = SST_MEM_DRAM; in sst_block_alloc_scratch()
1108 ba.size, ba.type, ba.offset); in sst_block_alloc_scratch()
1110 ba.offset = dsp->scratch_offset; in sst_block_alloc_scratch()
1113 ret = block_alloc_fixed(dsp, &ba, &dsp->scratch_block_list); in sst_block_alloc_scratch()
1117 ba.size, ba.type); in sst_block_alloc_scratch()
1119 ba.offset = 0; in sst_block_alloc_scratch()
1120 ret = block_alloc(dsp, &ba, &dsp->scratch_block_list); in sst_block_alloc_scratch()
1136 dsp->scratch_offset = ba.offset; in sst_block_alloc_scratch()