/* User can over-ride above with "mem=nnn[KkMm]" in cmdline */ static int __init setup_mem_sz(char *str) { low_mem_sz = memparse(str, NULL) & PAGE_MASK; /* early console might not be setup yet - it will show up later */ pr_info("\"mem=%s\": mem sz set to %ldM\n", str, TO_MB(low_mem_sz)); return 0; }
static void print_section_info(struct section *s) { printf("section: "); printf_bin(s->name, SECTION_NAME_MAXLEN); printf("\n"); printf("Mem addr: 0x%.8x\n", ntohl(s->memaddr)); printf("Index: 0x%.8x\n", ntohl(s->index)); printf("Base addr: 0x%.8x\n", ntohl(s->baseaddr)); printf("Entry addr: 0x%.8x\n", ntohl(s->entryaddr)); printf("Data size: %u bytes (KB = %.1f) (MB = %.1f)\n", ntohl(s->data_size), (float)TO_KB(ntohl(s->data_size)), (float)TO_MB(ntohl(s->data_size))); printf("Part size: %u bytes (KB = %.1f) (MB = %.1f)\n", ntohl(s->part_size), (float)TO_KB(ntohl(s->part_size)), (float)TO_MB(ntohl(s->part_size))); }
void __init early_init_dt_add_memory_arch(u64 base, u64 size) { int in_use = 0; if (!low_mem_sz) { BUG_ON(base != low_mem_start); low_mem_sz = size; in_use = 1; } else { #ifdef CONFIG_HIGHMEM high_mem_start = base; high_mem_sz = size; in_use = 1; #endif } pr_info("Memory @ %llx [%lldM] %s\n", base, TO_MB(size), !in_use ? "Not used":""); }
/* * mem_init - initializes memory * * Frees up bootmem * Calculates and displays memory available/used */ void __init mem_init(void) { int codesize, datasize, initsize, reserved_pages, free_pages; int tmp; high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz); free_all_bootmem(); /* count all reserved pages [kernel code/data/mem_map..] */ reserved_pages = 0; for (tmp = 0; tmp < max_mapnr; tmp++) if (PageReserved(mem_map + tmp)) reserved_pages++; /* XXX: nr_free_pages() is equivalent */ free_pages = max_mapnr - reserved_pages; /* * For the purpose of display below, split the "reserve mem" * kernel code/data is already shown explicitly, * Show any other reservations (mem_map[ ] et al) */ reserved_pages -= (((unsigned int)_end - CONFIG_LINUX_LINK_BASE) >> PAGE_SHIFT); codesize = _etext - _text; datasize = _end - _etext; initsize = __init_end - __init_begin; pr_info("Memory Available: %dM / %ldM (%dK code, %dK data, %dK init, %dK reserv)\n", PAGES_TO_MB(free_pages), TO_MB(arc_mem_sz), TO_KB(codesize), TO_KB(datasize), TO_KB(initsize), PAGES_TO_KB(reserved_pages)); }
void __init early_init_dt_add_memory_arch(u64 base, u64 size) { arc_mem_sz = size & PAGE_MASK; pr_info("Memory size set via devicetree %ldM\n", TO_MB(arc_mem_sz)); }