static int __init tcm_setup_pool()

in mm/tcm.c [130:159]


static int __init tcm_setup_pool(void)
{
#ifndef CONFIG_HAVE_DTCM
	u32 pool_size = (u32) (TCM_NR_PAGES * PAGE_SIZE)
				- (u32) (&__tcm_end - &__tcm_start);

	u32 tcm_pool_start = __fix_to_virt(FIX_TCM)
				+ (u32) (&__tcm_end - &__tcm_start);
#else
	u32 pool_size = (u32) (CONFIG_DTCM_NR_PAGES * PAGE_SIZE)
				- (u32) (&__tcm_end - &__dtcm_start);

	u32 tcm_pool_start = __fix_to_virt(FIX_TCM - CONFIG_ITCM_NR_PAGES)
				+ (u32) (&__tcm_end - &__dtcm_start);
#endif
	int ret;

	tcm_pool = gen_pool_create(2, -1);

	ret = gen_pool_add(tcm_pool, tcm_pool_start, pool_size, -1);
	if (ret) {
		pr_err("%s: gen_pool add failed!\n", __func__);
		return ret;
	}

	pr_info("%s: Added %d bytes @ 0x%08x to memory pool\n",
		__func__, pool_size, tcm_pool_start);

	return 0;
}