Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 22 additions & 25 deletions src/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ void init_heap(struct sof *sof)
struct block_map *current_map;
int i;
int j;
int k;

/* sanity check for malformed images or loader issues */
if (memmap.system[0].heap != HEAP_SYSTEM_0_BASE)
Expand All @@ -627,20 +626,19 @@ void init_heap(struct sof *sof)
for (i = 0; i < PLATFORM_HEAP_BUFFER; i++) {
heap = &memmap.buffer[i];

for (j = 0; j < heap->blocks; j++) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the new line

/* init the map[0] */
current_map = &heap->map[0];
current_map->base = heap->heap;
flush_block_map(current_map);

/* map[j]'s base is calculated based on map[j-1] */
for (j = 1; j < heap->blocks; j++) {
next_map = &heap->map[j];
next_map->base = current_map->base +
current_map->block_size *
current_map->count;
current_map = &heap->map[j];
current_map->base = heap->heap;
flush_block_map(current_map);

for (k = 1; k < heap->blocks; k++) {
next_map = &heap->map[k];
next_map->base = current_map->base +
current_map->block_size *
current_map->count;
current_map = &heap->map[k];
flush_block_map(current_map);
}
}

dcache_writeback_invalidate_region(heap, sizeof(*heap));
Expand All @@ -650,20 +648,19 @@ void init_heap(struct sof *sof)
for (i = 0; i < PLATFORM_HEAP_RUNTIME; i++) {
heap = &memmap.runtime[i];

for (j = 0; j < heap->blocks; j++) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep new line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for this and upper review comments.

/* init the map[0] */
current_map = &heap->map[0];
current_map->base = heap->heap;
flush_block_map(current_map);

/* map[j]'s base is calculated based on map[j-1] */
for (j = 1; j < heap->blocks; j++) {
next_map = &heap->map[j];
next_map->base = current_map->base +
current_map->block_size *
current_map->count;
current_map = &heap->map[j];
current_map->base = heap->heap;
flush_block_map(current_map);

for (k = 1; k < heap->blocks; k++) {
next_map = &heap->map[k];
next_map->base = current_map->base +
current_map->block_size *
current_map->count;
current_map = &heap->map[k];
flush_block_map(current_map);
}
}

dcache_writeback_invalidate_region(heap, sizeof(*heap));
Expand Down