Lines Matching full:block
123 struct sst_mem_block *block, *tmp; in block_list_remove() local
126 /* disable each block */ in block_list_remove()
127 list_for_each_entry(block, block_list, module_list) { in block_list_remove()
129 if (block->ops && block->ops->disable) { in block_list_remove()
130 err = block->ops->disable(block); in block_list_remove()
133 "error: cant disable block %d:%d\n", in block_list_remove()
134 block->type, block->index); in block_list_remove()
138 /* mark each block as free */ in block_list_remove()
139 list_for_each_entry_safe(block, tmp, block_list, module_list) { in block_list_remove()
140 list_del(&block->module_list); in block_list_remove()
141 list_move(&block->list, &dsp->free_block_list); in block_list_remove()
142 dev_dbg(dsp->dev, "block freed %d:%d at offset 0x%x\n", in block_list_remove()
143 block->type, block->index, block->offset); in block_list_remove()
147 /* prepare the memory block to receive data from host - callers hold locks */
151 struct sst_mem_block *block; in block_list_prepare() local
154 /* enable each block so that's it'e ready for data */ in block_list_prepare()
155 list_for_each_entry(block, block_list, module_list) { in block_list_prepare()
157 if (block->ops && block->ops->enable && !block->users) { in block_list_prepare()
158 ret = block->ops->enable(block); in block_list_prepare()
161 "error: cant disable block %d:%d\n", in block_list_prepare()
162 block->type, block->index); in block_list_prepare()
170 list_for_each_entry(block, block_list, module_list) { in block_list_prepare()
171 if (block->ops && block->ops->disable) in block_list_prepare()
172 block->ops->disable(block); in block_list_prepare()
560 struct sst_mem_block *block; in find_block() local
562 list_for_each_entry(block, &dsp->free_block_list, list) { in find_block()
563 if (block->type == ba->type && block->offset == ba->offset) in find_block()
564 return block; in find_block()
570 /* Block allocator must be on block boundary */
575 struct sst_mem_block *block; in block_alloc_contiguous() local
581 block = find_block(dsp, ba); in block_alloc_contiguous()
582 if (!block) { in block_alloc_contiguous()
590 list_move_tail(&block->list, &tmp); in block_alloc_contiguous()
591 ba->offset += block->size; in block_alloc_contiguous()
592 ba->size -= block->size; in block_alloc_contiguous()
597 list_for_each_entry(block, &tmp, list) { in block_alloc_contiguous()
599 if (block->offset < block_start) in block_alloc_contiguous()
600 block_start = block->offset; in block_alloc_contiguous()
602 list_add(&block->module_list, block_list); in block_alloc_contiguous()
604 dev_dbg(dsp->dev, "block allocated %d:%d at offset 0x%x\n", in block_alloc_contiguous()
605 block->type, block->index, block->offset); in block_alloc_contiguous()
616 struct sst_mem_block *block, *tmp; in block_alloc() local
623 list_for_each_entry_safe(block, tmp, &dsp->free_block_list, list) { in block_alloc()
626 if (block->type != ba->type) in block_alloc()
629 if (ba->size > block->size) in block_alloc()
632 ba->offset = block->offset; in block_alloc()
633 block->bytes_used = ba->size % block->size; in block_alloc()
634 list_add(&block->module_list, block_list); in block_alloc()
635 list_move(&block->list, &dsp->used_block_list); in block_alloc()
636 dev_dbg(dsp->dev, "block allocated %d:%d at offset 0x%x\n", in block_alloc()
637 block->type, block->index, block->offset); in block_alloc()
642 list_for_each_entry_safe(block, tmp, &dsp->free_block_list, list) { in block_alloc()
645 if (block->type != ba->type) in block_alloc()
649 if (ba->size > block->size) { in block_alloc()
651 /* align ba to block boundary */ in block_alloc()
652 ba->offset = block->offset; in block_alloc()
661 /* not enough free block space */ in block_alloc()
670 dev_dbg(dsp->dev, "block request 0x%x bytes at offset 0x%x type %d\n", in sst_alloc_blocks()
705 struct sst_mem_block *block, *tmp; in block_alloc_fixed() local
715 list_for_each_entry_safe(block, tmp, block_list, module_list) { in block_alloc_fixed()
718 if (block->type != ba->type) in block_alloc_fixed()
721 block_end = block->offset + block->size; in block_alloc_fixed()
723 /* find block that holds section */ in block_alloc_fixed()
724 if (ba->offset >= block->offset && end <= block_end) in block_alloc_fixed()
727 /* does block span more than 1 section */ in block_alloc_fixed()
728 if (ba->offset >= block->offset && ba->offset < block_end) { in block_alloc_fixed()
730 /* align ba to block boundary */ in block_alloc_fixed()
743 list_for_each_entry_safe(block, tmp, &dsp->free_block_list, list) { in block_alloc_fixed()
744 block_end = block->offset + block->size; in block_alloc_fixed()
747 if (block->type != ba->type) in block_alloc_fixed()
750 /* find block that holds section */ in block_alloc_fixed()
751 if (ba->offset >= block->offset && end <= block_end) { in block_alloc_fixed()
753 /* add block */ in block_alloc_fixed()
754 list_move(&block->list, &dsp->used_block_list); in block_alloc_fixed()
755 list_add(&block->module_list, block_list); in block_alloc_fixed()
756 dev_dbg(dsp->dev, "block allocated %d:%d at offset 0x%x\n", in block_alloc_fixed()
757 block->type, block->index, block->offset); in block_alloc_fixed()
761 /* does block span more than 1 section */ in block_alloc_fixed()
762 if (ba->offset >= block->offset && ba->offset < block_end) { in block_alloc_fixed()
764 /* add block */ in block_alloc_fixed()
765 list_move(&block->list, &dsp->used_block_list); in block_alloc_fixed()
766 list_add(&block->module_list, block_list); in block_alloc_fixed()
767 /* align ba to block boundary */ in block_alloc_fixed()
795 dev_dbg(dsp->dev, "block request 0x%x bytes at offset 0x%x type %d\n", in sst_module_alloc_blocks()
875 dev_dbg(dsp->dev, "persistent fixed block request 0x%x bytes type %d offset 0x%x\n", in sst_module_runtime_alloc_blocks()
882 dev_dbg(dsp->dev, "persistent block request 0x%x bytes type %d\n", in sst_module_runtime_alloc_blocks()
900 dev_err(dsp->dev, "error: runtime block prepare failed\n"); in sst_module_runtime_alloc_blocks()
1017 /* register a DSP memory block for use with FW based modules */
1022 struct sst_mem_block *block; in sst_mem_block_register() local
1024 block = kzalloc(sizeof(*block), GFP_KERNEL); in sst_mem_block_register()
1025 if (block == NULL) in sst_mem_block_register()
1028 block->offset = offset; in sst_mem_block_register()
1029 block->size = size; in sst_mem_block_register()
1030 block->index = index; in sst_mem_block_register()
1031 block->type = type; in sst_mem_block_register()
1032 block->dsp = dsp; in sst_mem_block_register()
1033 block->private = private; in sst_mem_block_register()
1034 block->ops = ops; in sst_mem_block_register()
1037 list_add(&block->list, &dsp->free_block_list); in sst_mem_block_register()
1040 return block; in sst_mem_block_register()
1047 struct sst_mem_block *block, *tmp; in sst_mem_block_unregister_all() local
1052 list_for_each_entry_safe(block, tmp, &dsp->used_block_list, list) { in sst_mem_block_unregister_all()
1053 list_del(&block->list); in sst_mem_block_unregister_all()
1054 kfree(block); in sst_mem_block_unregister_all()
1058 list_for_each_entry_safe(block, tmp, &dsp->free_block_list, list) { in sst_mem_block_unregister_all()
1059 list_del(&block->list); in sst_mem_block_unregister_all()
1060 kfree(block); in sst_mem_block_unregister_all()
1103 dev_dbg(dsp->dev, "block request 0x%x bytes type %d at 0x%x\n", in sst_block_alloc_scratch()
1112 dev_dbg(dsp->dev, "block request 0x%x bytes type %d\n", in sst_block_alloc_scratch()
1126 dev_err(dsp->dev, "error: scratch block prepare failed\n"); in sst_block_alloc_scratch()
1186 /* returns block address in DSP address space */