/* * Functions for ST-RAM allocations * * Copyright 1994-97 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details.
*/
/* * The ST-RAM allocator allocates memory from a pool of reserved ST-RAM of * configurable size, set aside on ST-RAM init. * As long as this pool is not exhausted, allocation of real ST-RAM can be * guaranteed.
*/
/* set if kernel is in ST-RAM */ staticint kernel_in_stram;
staticint __init atari_stram_setup(char *arg)
{ if (!MACH_IS_ATARI) return 0;
pool_size = memparse(arg, NULL); return 0;
}
early_param("stram_pool", atari_stram_setup);
/* * This init function is called very early by atari/config.c * It initializes some internal variables needed for stram_alloc()
*/ void __init atari_stram_init(void)
{ int i;
/* * determine whether kernel code resides in ST-RAM * (then ST-RAM is the first memory block at virtual 0x0)
*/
kernel_in_stram = (m68k_memory[0].addr == 0);
for (i = 0; i < m68k_num_memory; ++i) { if (m68k_memory[i].addr == 0) { return;
}
}
/* Should never come here! (There is always ST-Ram!) */
panic("atari_stram_init: no ST-RAM found!");
}
/* * This function is called from setup_arch() to reserve the pages needed for * ST-RAM management, if the kernel resides in ST-RAM.
*/ void __init atari_stram_reserve_pages(void *start_mem)
{ if (kernel_in_stram) {
pr_debug("atari_stram pool: kernel in ST-RAM, using alloc_bootmem!\n");
stram_pool.start = (resource_size_t)memblock_alloc_low(pool_size,
PAGE_SIZE); if (!stram_pool.start)
panic("%s: Failed to allocate %lu bytes align=%lx\n",
__func__, pool_size, PAGE_SIZE);
/* * This function is called as arch initcall to reserve the pages needed for * ST-RAM management, if the kernel does not reside in ST-RAM.
*/ staticint __init atari_stram_map_pages(void)
{ if (!kernel_in_stram) { /* * Skip page 0, as the fhe first 2 KiB are supervisor-only!
*/
pr_debug("atari_stram pool: kernel not in ST-RAM, using ioremap!\n");
stram_pool.start = PAGE_SIZE;
stram_pool.end = stram_pool.start + pool_size - 1;
request_resource(&iomem_resource, &stram_pool);
stram_virt_offset = (unsignedlong) ioremap(stram_pool.start,
resource_size(&stram_pool)) - stram_pool.start;
pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n",
pool_size, &stram_pool);
pr_debug("atari_stram pool: stram_virt_offset = %lx\n",
stram_virt_offset);
} return 0;
}
arch_initcall(atari_stram_map_pages);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.