Skip to content

Commit

Permalink
memory manager: Add runtime memory discovery
Browse files Browse the repository at this point in the history
Add runtime physical memory discovery. This allows platforms with
different physical memory sizes to use the same driver for memory
management.

Signed-off-by: Jakub Dabek <[email protected]>
  • Loading branch information
dabekjakub authored and nashif committed Nov 7, 2022
1 parent ad5c3a1 commit b052143
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/mm/mm_drv_intel_adsp_mtl_tlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,15 @@ static int sys_mm_drv_mm_init(const struct device *dev)

ARG_UNUSED(dev);

/*
* Change size of avalible physical memory according to fw register information
* in runtime.
*/

uint32_t avalible_memory_size = ace_hpsram_get_bank_count() * SRAM_BANK_SIZE;

L2_PHYS_SRAM_REGION.num_blocks = avalible_memory_size / CONFIG_MM_DRV_PAGE_SIZE;

/*
* Initialize memblocks that will store physical
* page usage. Initially all physical pages are
Expand Down

0 comments on commit b052143

Please sign in to comment.