hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/openrisc/kernel/setup.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * OpenRISC setup.c
34 *
....@@ -8,11 +9,6 @@
89 * Modifications for the OpenRISC architecture:
910 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
1011 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11
- *
12
- * This program is free software; you can redistribute it and/or
13
- * modify it under the terms of the GNU General Public License
14
- * as published by the Free Software Foundation; either version
15
- * 2 of the License, or (at your option) any later version.
1612 *
1713 * This file handles the architecture-dependent parts of initialization
1814 */
....@@ -30,18 +26,15 @@
3026 #include <linux/delay.h>
3127 #include <linux/console.h>
3228 #include <linux/init.h>
33
-#include <linux/bootmem.h>
29
+#include <linux/memblock.h>
3430 #include <linux/seq_file.h>
3531 #include <linux/serial.h>
3632 #include <linux/initrd.h>
3733 #include <linux/of_fdt.h>
3834 #include <linux/of.h>
39
-#include <linux/memblock.h>
4035 #include <linux/device.h>
4136
4237 #include <asm/sections.h>
43
-#include <asm/segment.h>
44
-#include <asm/pgtable.h>
4538 #include <asm/types.h>
4639 #include <asm/setup.h>
4740 #include <asm/io.h>
....@@ -55,17 +48,12 @@
5548 unsigned long ram_start_pfn;
5649 unsigned long ram_end_pfn;
5750 phys_addr_t memory_start, memory_end;
58
- struct memblock_region *region;
5951
6052 memory_end = memory_start = 0;
6153
6254 /* Find main memory where is the kernel, we assume its the only one */
63
- for_each_memblock(memory, region) {
64
- memory_start = region->base;
65
- memory_end = region->base + region->size;
66
- printk(KERN_INFO "%s: Memory: 0x%x-0x%x\n", __func__,
67
- memory_start, memory_end);
68
- }
55
+ memory_start = memblock_start_of_DRAM();
56
+ memory_end = memblock_end_of_DRAM();
6957
7058 if (!memory_end) {
7159 panic("No memory!");
....@@ -86,6 +74,16 @@
8674 * RAM usable.
8775 */
8876 memblock_reserve(__pa(_stext), _end - _stext);
77
+
78
+#ifdef CONFIG_BLK_DEV_INITRD
79
+ /* Then reserve the initrd, if any */
80
+ if (initrd_start && (initrd_end > initrd_start)) {
81
+ unsigned long aligned_start = ALIGN_DOWN(initrd_start, PAGE_SIZE);
82
+ unsigned long aligned_end = ALIGN(initrd_end, PAGE_SIZE);
83
+
84
+ memblock_reserve(__pa(aligned_start), aligned_end - aligned_start);
85
+ }
86
+#endif /* CONFIG_BLK_DEV_INITRD */
8987
9088 early_init_fdt_reserve_self();
9189 early_init_fdt_scan_reserved_mem();
....@@ -158,9 +156,8 @@
158156 {
159157 u32 hwid;
160158 struct device_node *cpun;
161
- struct device_node *cpus = of_find_node_by_path("/cpus");
162159
163
- for_each_available_child_of_node(cpus, cpun) {
160
+ for_each_of_cpu_node(cpun) {
164161 if (of_property_read_u32(cpun, "reg", &hwid))
165162 continue;
166163 if (hwid == cpu)
....@@ -302,13 +299,15 @@
302299 init_mm.brk = (unsigned long)_end;
303300
304301 #ifdef CONFIG_BLK_DEV_INITRD
305
- initrd_start = (unsigned long)&__initrd_start;
306
- initrd_end = (unsigned long)&__initrd_end;
307302 if (initrd_start == initrd_end) {
303
+ printk(KERN_INFO "Initial ramdisk not found\n");
308304 initrd_start = 0;
309305 initrd_end = 0;
306
+ } else {
307
+ printk(KERN_INFO "Initial ramdisk at: 0x%p (%lu bytes)\n",
308
+ (void *)(initrd_start), initrd_end - initrd_start);
309
+ initrd_below_start_ok = 1;
310310 }
311
- initrd_below_start_ok = 1;
312311 #endif
313312
314313 /* setup memblock allocator */
....@@ -316,11 +315,6 @@
316315
317316 /* paging_init() sets up the MMU and marks all pages as reserved */
318317 paging_init();
319
-
320
-#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
321
- if (!conswitchp)
322
- conswitchp = &dummy_con;
323
-#endif
324318
325319 *cmdline_p = boot_command_line;
326320