18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Port on Texas Instruments TMS320C6x architecture 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated 68c2ecf20Sopenharmony_ci * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci#include <linux/mm.h> 98c2ecf20Sopenharmony_ci#include <linux/swap.h> 108c2ecf20Sopenharmony_ci#include <linux/module.h> 118c2ecf20Sopenharmony_ci#include <linux/memblock.h> 128c2ecf20Sopenharmony_ci#ifdef CONFIG_BLK_DEV_RAM 138c2ecf20Sopenharmony_ci#include <linux/blkdev.h> 148c2ecf20Sopenharmony_ci#endif 158c2ecf20Sopenharmony_ci#include <linux/initrd.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include <asm/sections.h> 188c2ecf20Sopenharmony_ci#include <linux/uaccess.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/* 218c2ecf20Sopenharmony_ci * ZERO_PAGE is a special page that is used for zero-initialized 228c2ecf20Sopenharmony_ci * data and COW. 238c2ecf20Sopenharmony_ci */ 248c2ecf20Sopenharmony_ciunsigned long empty_zero_page; 258c2ecf20Sopenharmony_ciEXPORT_SYMBOL(empty_zero_page); 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* 288c2ecf20Sopenharmony_ci * paging_init() continues the virtual memory environment setup which 298c2ecf20Sopenharmony_ci * was begun by the code in arch/head.S. 308c2ecf20Sopenharmony_ci * The parameters are pointers to where to stick the starting and ending 318c2ecf20Sopenharmony_ci * addresses of available kernel virtual memory. 328c2ecf20Sopenharmony_ci */ 338c2ecf20Sopenharmony_civoid __init paging_init(void) 348c2ecf20Sopenharmony_ci{ 358c2ecf20Sopenharmony_ci struct pglist_data *pgdat = NODE_DATA(0); 368c2ecf20Sopenharmony_ci unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, }; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci empty_zero_page = (unsigned long) memblock_alloc(PAGE_SIZE, 398c2ecf20Sopenharmony_ci PAGE_SIZE); 408c2ecf20Sopenharmony_ci if (!empty_zero_page) 418c2ecf20Sopenharmony_ci panic("%s: Failed to allocate %lu bytes align=0x%lx\n", 428c2ecf20Sopenharmony_ci __func__, PAGE_SIZE, PAGE_SIZE); 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci /* 458c2ecf20Sopenharmony_ci * Set up user data space 468c2ecf20Sopenharmony_ci */ 478c2ecf20Sopenharmony_ci set_fs(KERNEL_DS); 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci /* 508c2ecf20Sopenharmony_ci * Define zones 518c2ecf20Sopenharmony_ci */ 528c2ecf20Sopenharmony_ci max_zone_pfn[ZONE_NORMAL] = memory_end >> PAGE_SHIFT; 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci free_area_init(max_zone_pfn); 558c2ecf20Sopenharmony_ci} 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_civoid __init mem_init(void) 588c2ecf20Sopenharmony_ci{ 598c2ecf20Sopenharmony_ci high_memory = (void *)(memory_end & PAGE_MASK); 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci /* this will put all memory onto the freelists */ 628c2ecf20Sopenharmony_ci memblock_free_all(); 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci mem_init_print_info(NULL); 658c2ecf20Sopenharmony_ci} 66