| .. | .. |
|---|
| 16 | 16 | #include <linux/sched.h> |
|---|
| 17 | 17 | #include <linux/sched/task.h> |
|---|
| 18 | 18 | #include <linux/console.h> |
|---|
| 19 | | -#include <linux/bootmem.h> |
|---|
| 19 | +#include <linux/memblock.h> |
|---|
| 20 | 20 | #include <linux/initrd.h> |
|---|
| 21 | 21 | #include <linux/of_fdt.h> |
|---|
| 22 | 22 | #include <linux/screen_info.h> |
|---|
| .. | .. |
|---|
| 123 | 123 | dtb_passed = r6; |
|---|
| 124 | 124 | |
|---|
| 125 | 125 | if (r7) |
|---|
| 126 | | - strncpy(cmdline_passed, (char *)r7, COMMAND_LINE_SIZE); |
|---|
| 126 | + strlcpy(cmdline_passed, (char *)r7, COMMAND_LINE_SIZE); |
|---|
| 127 | 127 | } |
|---|
| 128 | 128 | #endif |
|---|
| 129 | 129 | |
|---|
| .. | .. |
|---|
| 131 | 131 | |
|---|
| 132 | 132 | #ifndef CONFIG_CMDLINE_FORCE |
|---|
| 133 | 133 | if (cmdline_passed[0]) |
|---|
| 134 | | - strncpy(boot_command_line, cmdline_passed, COMMAND_LINE_SIZE); |
|---|
| 134 | + strlcpy(boot_command_line, cmdline_passed, COMMAND_LINE_SIZE); |
|---|
| 135 | 135 | #ifdef CONFIG_NIOS2_CMDLINE_IGNORE_DTB |
|---|
| 136 | 136 | else |
|---|
| 137 | | - strncpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); |
|---|
| 137 | + strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); |
|---|
| 138 | 138 | #endif |
|---|
| 139 | 139 | #endif |
|---|
| 140 | 140 | |
|---|
| .. | .. |
|---|
| 143 | 143 | |
|---|
| 144 | 144 | void __init setup_arch(char **cmdline_p) |
|---|
| 145 | 145 | { |
|---|
| 146 | | - int bootmap_size; |
|---|
| 146 | + int dram_start; |
|---|
| 147 | 147 | |
|---|
| 148 | 148 | console_verbose(); |
|---|
| 149 | 149 | |
|---|
| 150 | + dram_start = memblock_start_of_DRAM(); |
|---|
| 151 | + memory_size = memblock_phys_mem_size(); |
|---|
| 150 | 152 | memory_start = PAGE_ALIGN((unsigned long)__pa(_end)); |
|---|
| 151 | 153 | memory_end = (unsigned long) CONFIG_NIOS2_MEM_BASE + memory_size; |
|---|
| 152 | 154 | |
|---|
| .. | .. |
|---|
| 163 | 165 | max_low_pfn = PFN_DOWN(memory_end); |
|---|
| 164 | 166 | max_mapnr = max_low_pfn; |
|---|
| 165 | 167 | |
|---|
| 166 | | - /* |
|---|
| 167 | | - * give all the memory to the bootmap allocator, tell it to put the |
|---|
| 168 | | - * boot mem_map at the start of memory |
|---|
| 169 | | - */ |
|---|
| 170 | | - pr_debug("init_bootmem_node(?,%#lx, %#x, %#lx)\n", |
|---|
| 171 | | - min_low_pfn, PFN_DOWN(PHYS_OFFSET), max_low_pfn); |
|---|
| 172 | | - bootmap_size = init_bootmem_node(NODE_DATA(0), |
|---|
| 173 | | - min_low_pfn, PFN_DOWN(PHYS_OFFSET), |
|---|
| 174 | | - max_low_pfn); |
|---|
| 175 | | - |
|---|
| 176 | | - /* |
|---|
| 177 | | - * free the usable memory, we have to make sure we do not free |
|---|
| 178 | | - * the bootmem bitmap so we then reserve it after freeing it :-) |
|---|
| 179 | | - */ |
|---|
| 180 | | - pr_debug("free_bootmem(%#lx, %#lx)\n", |
|---|
| 181 | | - memory_start, memory_end - memory_start); |
|---|
| 182 | | - free_bootmem(memory_start, memory_end - memory_start); |
|---|
| 183 | | - |
|---|
| 184 | | - /* |
|---|
| 185 | | - * Reserve the bootmem bitmap itself as well. We do this in two |
|---|
| 186 | | - * steps (first step was init_bootmem()) because this catches |
|---|
| 187 | | - * the (very unlikely) case of us accidentally initializing the |
|---|
| 188 | | - * bootmem allocator with an invalid RAM area. |
|---|
| 189 | | - * |
|---|
| 190 | | - * Arguments are start, size |
|---|
| 191 | | - */ |
|---|
| 192 | | - pr_debug("reserve_bootmem(%#lx, %#x)\n", memory_start, bootmap_size); |
|---|
| 193 | | - reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT); |
|---|
| 194 | | - |
|---|
| 168 | + memblock_reserve(dram_start, memory_start - dram_start); |
|---|
| 195 | 169 | #ifdef CONFIG_BLK_DEV_INITRD |
|---|
| 196 | 170 | if (initrd_start) { |
|---|
| 197 | | - reserve_bootmem(virt_to_phys((void *)initrd_start), |
|---|
| 198 | | - initrd_end - initrd_start, BOOTMEM_DEFAULT); |
|---|
| 171 | + memblock_reserve(virt_to_phys((void *)initrd_start), |
|---|
| 172 | + initrd_end - initrd_start); |
|---|
| 199 | 173 | } |
|---|
| 200 | 174 | #endif /* CONFIG_BLK_DEV_INITRD */ |
|---|
| 201 | 175 | |
|---|
| .. | .. |
|---|
| 222 | 196 | * get kmalloc into gear |
|---|
| 223 | 197 | */ |
|---|
| 224 | 198 | paging_init(); |
|---|
| 225 | | - |
|---|
| 226 | | -#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) |
|---|
| 227 | | - conswitchp = &dummy_con; |
|---|
| 228 | | -#endif |
|---|
| 229 | 199 | } |
|---|