~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/csky/kernel/setup.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
  3 
  4 #include <linux/console.h>
  5 #include <linux/memblock.h>
  6 #include <linux/initrd.h>
  7 #include <linux/of.h>
  8 #include <linux/of_fdt.h>
  9 #include <linux/start_kernel.h>
 10 #include <linux/dma-map-ops.h>
 11 #include <asm/sections.h>
 12 #include <asm/mmu_context.h>
 13 #include <asm/pgalloc.h>
 14 
 15 static void __init csky_memblock_init(void)
 16 {
 17         unsigned long lowmem_size = PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET);
 18         unsigned long sseg_size = PFN_DOWN(SSEG_SIZE - PHYS_OFFSET_OFFSET);
 19         unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
 20         signed long size;
 21 
 22         memblock_reserve(__pa(_start), _end - _start);
 23 
 24         early_init_fdt_reserve_self();
 25         early_init_fdt_scan_reserved_mem();
 26 
 27         memblock_dump_all();
 28 
 29         min_low_pfn = PFN_UP(memblock_start_of_DRAM());
 30         max_low_pfn = max_pfn = PFN_DOWN(memblock_end_of_DRAM());
 31 
 32         size = max_pfn - min_low_pfn;
 33 
 34         if (size >= lowmem_size) {
 35                 max_low_pfn = min_low_pfn + lowmem_size;
 36 #ifdef CONFIG_PAGE_OFFSET_80000000
 37                 write_mmu_msa1(read_mmu_msa0() + SSEG_SIZE);
 38 #endif
 39         } else if (size > sseg_size) {
 40                 max_low_pfn = min_low_pfn + sseg_size;
 41         }
 42 
 43         max_zone_pfn[ZONE_NORMAL] = max_low_pfn;
 44 
 45         mmu_init(min_low_pfn, max_low_pfn);
 46 
 47 #ifdef CONFIG_HIGHMEM
 48         max_zone_pfn[ZONE_HIGHMEM] = max_pfn;
 49 
 50         highstart_pfn = max_low_pfn;
 51         highend_pfn   = max_pfn;
 52 #endif
 53         memblock_set_current_limit(PFN_PHYS(max_low_pfn));
 54 
 55         dma_contiguous_reserve(0);
 56 
 57         free_area_init(max_zone_pfn);
 58 }
 59 
 60 void __init setup_arch(char **cmdline_p)
 61 {
 62         *cmdline_p = boot_command_line;
 63 
 64         console_verbose();
 65 
 66         pr_info("Phys. mem: %ldMB\n",
 67                 (unsigned long) memblock_phys_mem_size()/1024/1024);
 68 
 69         setup_initial_init_mm(_start, _etext, _edata, _end);
 70 
 71         parse_early_param();
 72 
 73         csky_memblock_init();
 74 
 75         unflatten_and_copy_device_tree();
 76 
 77 #ifdef CONFIG_SMP
 78         setup_smp();
 79 #endif
 80 
 81         sparse_init();
 82 
 83         fixaddr_init();
 84 
 85 #ifdef CONFIG_HIGHMEM
 86         kmap_init();
 87 #endif
 88 }
 89 
 90 unsigned long va_pa_offset;
 91 EXPORT_SYMBOL(va_pa_offset);
 92 
 93 static inline unsigned long read_mmu_msa(void)
 94 {
 95 #ifdef CONFIG_PAGE_OFFSET_80000000
 96         return read_mmu_msa0();
 97 #endif
 98 
 99 #ifdef CONFIG_PAGE_OFFSET_A0000000
100         return read_mmu_msa1();
101 #endif
102 }
103 
104 asmlinkage __visible void __init csky_start(unsigned int unused,
105                                             void *dtb_start)
106 {
107         /* Clean up bss section */
108         memset(__bss_start, 0, __bss_stop - __bss_start);
109 
110         va_pa_offset = read_mmu_msa() & ~(SSEG_SIZE - 1);
111 
112         pre_trap_init();
113 
114         if (dtb_start == NULL)
115                 early_init_dt_scan(__dtb_start);
116         else
117                 early_init_dt_scan(dtb_start);
118 
119         start_kernel();
120 
121         asm volatile("br .\n");
122 }
123 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php