*参照元 [#oab90d85] #backlinks *説明 [#v4235dc8] -パス: [[linux-4.4.1/drivers/of/of_reserved_mem.c]] -FIXME: これは何? --説明 **引数 [#bffe9b14] -phys_addr_t size -- --[[linux-4.4.1/phys_addr_t]] -phys_addr_t align -- -phys_addr_t start -- -phys_addr_t end -- -bool nomap -- -phys_addr_t *res_base -- **返り値 [#l8318dc5] - -int -- **参考 [#def9fe17] *実装 [#w38f0eab] #if defined(CONFIG_HAVE_MEMBLOCK) - --[[linux-4.4.1/CONFIG_HAVE_MEMBLOCK]] #include <linux/memblock.h> int __init __weak early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, phys_addr_t align, phys_addr_t start, phys_addr_t end, bool nomap, phys_addr_t *res_base) { /* * We use __memblock_alloc_base() because memblock_alloc_base() * panic()s on allocation failure. */ phys_addr_t base = __memblock_alloc_base(size, align, end); if (!base) return -ENOMEM; - --[[linux-4.4.1/__memblock_alloc_base()]] /* * Check if the allocated region fits in to start..end window */ if (base < start) { memblock_free(base, size); return -ENOMEM; } - --[[linux-4.4.1/memblock_free()]] *res_base = base; if (nomap) return memblock_remove(base, size); return 0; - --[[linux-4.4.1/memblock_remove()]] } #else int __init __weak early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, phys_addr_t align, phys_addr_t start, phys_addr_t end, bool nomap, phys_addr_t *res_base) { pr_err("Reserved memory not supported, ignoring region 0x%llx%s\n", size, nomap ? " (nomap)" : ""); return -ENOSYS; - --[[linux-4.4.1/pr_err()]] } #endif *コメント [#b7e33fb7]