blob: a97e51a3e26d3108154ce557a08b15e513b1be9a [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001// SPDX-License-Identifier: GPL-2.0-only
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * Port on Texas Instruments TMS320C6x architecture
4 *
5 * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
6 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007 */
8#include <linux/mm.h>
9#include <linux/swap.h>
10#include <linux/module.h>
David Brazdil0f672f62019-12-10 10:32:29 +000011#include <linux/memblock.h>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000012#ifdef CONFIG_BLK_DEV_RAM
13#include <linux/blkdev.h>
14#endif
15#include <linux/initrd.h>
16
17#include <asm/sections.h>
18#include <linux/uaccess.h>
19
20/*
21 * ZERO_PAGE is a special page that is used for zero-initialized
22 * data and COW.
23 */
24unsigned long empty_zero_page;
25EXPORT_SYMBOL(empty_zero_page);
26
27/*
28 * paging_init() continues the virtual memory environment setup which
29 * was begun by the code in arch/head.S.
30 * The parameters are pointers to where to stick the starting and ending
31 * addresses of available kernel virtual memory.
32 */
33void __init paging_init(void)
34{
35 struct pglist_data *pgdat = NODE_DATA(0);
Olivier Deprez157378f2022-04-04 15:47:50 +020036 unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, };
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000037
David Brazdil0f672f62019-12-10 10:32:29 +000038 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);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000043
44 /*
45 * Set up user data space
46 */
47 set_fs(KERNEL_DS);
48
49 /*
50 * Define zones
51 */
Olivier Deprez157378f2022-04-04 15:47:50 +020052 max_zone_pfn[ZONE_NORMAL] = memory_end >> PAGE_SHIFT;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000053
Olivier Deprez157378f2022-04-04 15:47:50 +020054 free_area_init(max_zone_pfn);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000055}
56
57void __init mem_init(void)
58{
59 high_memory = (void *)(memory_end & PAGE_MASK);
60
61 /* this will put all memory onto the freelists */
David Brazdil0f672f62019-12-10 10:32:29 +000062 memblock_free_all();
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000063
64 mem_init_print_info(NULL);
65}