| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Port on Texas Instruments TMS320C6x architecture |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated |
|---|
| 5 | 6 | * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 9 | | - * published by the Free Software Foundation. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | #include <linux/mm.h> |
|---|
| 12 | 9 | #include <linux/swap.h> |
|---|
| 13 | 10 | #include <linux/module.h> |
|---|
| 14 | | -#include <linux/bootmem.h> |
|---|
| 11 | +#include <linux/memblock.h> |
|---|
| 15 | 12 | #ifdef CONFIG_BLK_DEV_RAM |
|---|
| 16 | 13 | #include <linux/blkdev.h> |
|---|
| 17 | 14 | #endif |
|---|
| .. | .. |
|---|
| 36 | 33 | void __init paging_init(void) |
|---|
| 37 | 34 | { |
|---|
| 38 | 35 | struct pglist_data *pgdat = NODE_DATA(0); |
|---|
| 39 | | - unsigned long zones_size[MAX_NR_ZONES] = {0, }; |
|---|
| 36 | + unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, }; |
|---|
| 40 | 37 | |
|---|
| 41 | | - empty_zero_page = (unsigned long) alloc_bootmem_pages(PAGE_SIZE); |
|---|
| 42 | | - memset((void *)empty_zero_page, 0, PAGE_SIZE); |
|---|
| 38 | + empty_zero_page = (unsigned long) memblock_alloc(PAGE_SIZE, |
|---|
| 39 | + PAGE_SIZE); |
|---|
| 40 | + if (!empty_zero_page) |
|---|
| 41 | + panic("%s: Failed to allocate %lu bytes align=0x%lx\n", |
|---|
| 42 | + __func__, PAGE_SIZE, PAGE_SIZE); |
|---|
| 43 | 43 | |
|---|
| 44 | 44 | /* |
|---|
| 45 | 45 | * Set up user data space |
|---|
| .. | .. |
|---|
| 49 | 49 | /* |
|---|
| 50 | 50 | * Define zones |
|---|
| 51 | 51 | */ |
|---|
| 52 | | - zones_size[ZONE_NORMAL] = (memory_end - PAGE_OFFSET) >> PAGE_SHIFT; |
|---|
| 53 | | - pgdat->node_zones[ZONE_NORMAL].zone_start_pfn = |
|---|
| 54 | | - __pa(PAGE_OFFSET) >> PAGE_SHIFT; |
|---|
| 52 | + max_zone_pfn[ZONE_NORMAL] = memory_end >> PAGE_SHIFT; |
|---|
| 55 | 53 | |
|---|
| 56 | | - free_area_init(zones_size); |
|---|
| 54 | + free_area_init(max_zone_pfn); |
|---|
| 57 | 55 | } |
|---|
| 58 | 56 | |
|---|
| 59 | 57 | void __init mem_init(void) |
|---|
| .. | .. |
|---|
| 61 | 59 | high_memory = (void *)(memory_end & PAGE_MASK); |
|---|
| 62 | 60 | |
|---|
| 63 | 61 | /* this will put all memory onto the freelists */ |
|---|
| 64 | | - free_all_bootmem(); |
|---|
| 62 | + memblock_free_all(); |
|---|
| 65 | 63 | |
|---|
| 66 | 64 | mem_init_print_info(NULL); |
|---|
| 67 | | -} |
|---|
| 68 | | - |
|---|
| 69 | | -#ifdef CONFIG_BLK_DEV_INITRD |
|---|
| 70 | | -void __init free_initrd_mem(unsigned long start, unsigned long end) |
|---|
| 71 | | -{ |
|---|
| 72 | | - free_reserved_area((void *)start, (void *)end, -1, "initrd"); |
|---|
| 73 | | -} |
|---|
| 74 | | -#endif |
|---|
| 75 | | - |
|---|
| 76 | | -void __init free_initmem(void) |
|---|
| 77 | | -{ |
|---|
| 78 | | - free_initmem_default(-1); |
|---|
| 79 | 65 | } |
|---|