Esempio n. 1
0
void * __init __alloc_bootmem_node_nopanic(pg_data_t *pgdat, unsigned long size,
				   unsigned long align, unsigned long goal)
{
	void *ptr;

	if (WARN_ON_ONCE(slab_is_available()))
		return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);

	ptr =  __alloc_memory_core_early(pgdat->node_id, size, align,
						 goal, -1ULL);
	if (ptr)
		return ptr;

	return __alloc_bootmem_nopanic(size, align, goal);
}
Esempio n. 2
0
void dspbridge_reserve_sdram(void)
{
	void *va;
	unsigned long size = CONFIG_BRIDGE_MEMPOOL_SIZE;

	if (!size)
		return;

	va = __alloc_bootmem_nopanic(size, SZ_1M, 0);
	if (!va) {
		pr_err("%s: Failed to bootmem allocation(%lu bytes)\n",
		       __func__, size);
		return;
	}
	dspbridge_phys_mempool_base = virt_to_phys(va);
}
Esempio n. 3
0
static u32 __init allocate_aperture(void) 
{
	u32 aper_size;
	void *p; 

	if (fallback_aper_order > 7) 
		fallback_aper_order = 7; 
	aper_size = (32 * 1024 * 1024) << fallback_aper_order; 

	/* 
	 * Aperture has to be naturally aligned. This means an 2GB aperture won't
	 * have much chances to find a place in the lower 4GB of memory.
	 * Unfortunately we cannot move it up because that would make the
	 * IOMMU useless.
	 */
	p = __alloc_bootmem_nopanic(aper_size, aper_size, 0);
	if (!p || __pa(p)+aper_size > 0xffffffff) {
		printk("Cannot allocate aperture memory hole (%p,%uK)\n",
		       p, aper_size>>10);
		if (p)
			free_bootmem(__pa(p), aper_size);
		return 0;
	}