setup-common.c (f7b9ebb79e90b19bf6a2cb805a536258437fc3fa) | setup-common.c (b1923caa6e641f3d0a93b5d045aef67ded5aef67) |
---|---|
1/* 2 * Common boot and setup code for both 32-bit and 64-bit. 3 * Extracted from arch/powerpc/kernel/setup_64.c. 4 * 5 * Copyright (C) 2001 PPC64 Team, IBM Corp 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 21 unchanged lines hidden (view full) --- 30#include <linux/cpu.h> 31#include <linux/unistd.h> 32#include <linux/serial.h> 33#include <linux/serial_8250.h> 34#include <linux/debugfs.h> 35#include <linux/percpu.h> 36#include <linux/memblock.h> 37#include <linux/of_platform.h> | 1/* 2 * Common boot and setup code for both 32-bit and 64-bit. 3 * Extracted from arch/powerpc/kernel/setup_64.c. 4 * 5 * Copyright (C) 2001 PPC64 Team, IBM Corp 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 21 unchanged lines hidden (view full) --- 30#include <linux/cpu.h> 31#include <linux/unistd.h> 32#include <linux/serial.h> 33#include <linux/serial_8250.h> 34#include <linux/debugfs.h> 35#include <linux/percpu.h> 36#include <linux/memblock.h> 37#include <linux/of_platform.h> |
38#include <linux/hugetlb.h> |
|
38#include <asm/io.h> 39#include <asm/paca.h> 40#include <asm/prom.h> 41#include <asm/processor.h> 42#include <asm/vdso_datapage.h> 43#include <asm/pgtable.h> 44#include <asm/smp.h> 45#include <asm/elf.h> --- 10 unchanged lines hidden (view full) --- 56#include <asm/serial.h> 57#include <asm/cache.h> 58#include <asm/page.h> 59#include <asm/mmu.h> 60#include <asm/xmon.h> 61#include <asm/cputhreads.h> 62#include <mm/mmu_decl.h> 63#include <asm/fadump.h> | 39#include <asm/io.h> 40#include <asm/paca.h> 41#include <asm/prom.h> 42#include <asm/processor.h> 43#include <asm/vdso_datapage.h> 44#include <asm/pgtable.h> 45#include <asm/smp.h> 46#include <asm/elf.h> --- 10 unchanged lines hidden (view full) --- 57#include <asm/serial.h> 58#include <asm/cache.h> 59#include <asm/page.h> 60#include <asm/mmu.h> 61#include <asm/xmon.h> 62#include <asm/cputhreads.h> 63#include <mm/mmu_decl.h> 64#include <asm/fadump.h> |
65#include <asm/udbg.h> 66#include <asm/hugetlb.h> 67#include <asm/livepatch.h> 68#include <asm/mmu_context.h> |
|
64 | 69 |
70#include "setup.h" 71 |
|
65#ifdef DEBUG 66#include <asm/udbg.h> 67#define DBG(fmt...) udbg_printf(fmt) 68#else 69#define DBG(fmt...) 70#endif 71 72/* The main machine-dep calls structure --- 680 unchanged lines hidden (view full) --- 753} 754 755void arch_setup_pdev_archdata(struct platform_device *pdev) 756{ 757 pdev->archdata.dma_mask = DMA_BIT_MASK(32); 758 pdev->dev.dma_mask = &pdev->archdata.dma_mask; 759 set_dma_ops(&pdev->dev, &dma_direct_ops); 760} | 72#ifdef DEBUG 73#include <asm/udbg.h> 74#define DBG(fmt...) udbg_printf(fmt) 75#else 76#define DBG(fmt...) 77#endif 78 79/* The main machine-dep calls structure --- 680 unchanged lines hidden (view full) --- 760} 761 762void arch_setup_pdev_archdata(struct platform_device *pdev) 763{ 764 pdev->archdata.dma_mask = DMA_BIT_MASK(32); 765 pdev->dev.dma_mask = &pdev->archdata.dma_mask; 766 set_dma_ops(&pdev->dev, &dma_direct_ops); 767} |
768 769static __init void print_system_info(void) 770{ 771 pr_info("-----------------------------------------------------\n"); 772#ifdef CONFIG_PPC_STD_MMU_64 773 pr_info("ppc64_pft_size = 0x%llx\n", ppc64_pft_size); 774#endif 775#ifdef CONFIG_PPC_STD_MMU_32 776 pr_info("Hash_size = 0x%lx\n", Hash_size); 777#endif 778 pr_info("phys_mem_size = 0x%llx\n", 779 (unsigned long long)memblock_phys_mem_size()); 780 781 pr_info("dcache_bsize = 0x%x\n", dcache_bsize); 782 pr_info("icache_bsize = 0x%x\n", icache_bsize); 783 if (ucache_bsize != 0) 784 pr_info("ucache_bsize = 0x%x\n", ucache_bsize); 785 786 pr_info("cpu_features = 0x%016lx\n", cur_cpu_spec->cpu_features); 787 pr_info(" possible = 0x%016lx\n", 788 (unsigned long)CPU_FTRS_POSSIBLE); 789 pr_info(" always = 0x%016lx\n", 790 (unsigned long)CPU_FTRS_ALWAYS); 791 pr_info("cpu_user_features = 0x%08x 0x%08x\n", 792 cur_cpu_spec->cpu_user_features, 793 cur_cpu_spec->cpu_user_features2); 794 pr_info("mmu_features = 0x%08x\n", cur_cpu_spec->mmu_features); 795#ifdef CONFIG_PPC64 796 pr_info("firmware_features = 0x%016lx\n", powerpc_firmware_features); 797#endif 798 799#ifdef CONFIG_PPC_STD_MMU_64 800 if (htab_address) 801 pr_info("htab_address = 0x%p\n", htab_address); 802 if (htab_hash_mask) 803 pr_info("htab_hash_mask = 0x%lx\n", htab_hash_mask); 804#endif 805#ifdef CONFIG_PPC_STD_MMU_32 806 if (Hash) 807 pr_info("Hash = 0x%p\n", Hash); 808 if (Hash_mask) 809 pr_info("Hash_mask = 0x%lx\n", Hash_mask); 810#endif 811 812 if (PHYSICAL_START > 0) 813 pr_info("physical_start = 0x%llx\n", 814 (unsigned long long)PHYSICAL_START); 815 pr_info("-----------------------------------------------------\n"); 816} 817 818/* 819 * Called into from start_kernel this initializes memblock, which is used 820 * to manage page allocation until mem_init is called. 821 */ 822void __init setup_arch(char **cmdline_p) 823{ 824 *cmdline_p = boot_command_line; 825 826 /* Set a half-reasonable default so udelay does something sensible */ 827 loops_per_jiffy = 500000000 / HZ; 828 829 /* Unflatten the device-tree passed by prom_init or kexec */ 830 unflatten_device_tree(); 831 832 /* 833 * Initialize cache line/block info from device-tree (on ppc64) or 834 * just cputable (on ppc32). 835 */ 836 initialize_cache_info(); 837 838 /* Initialize RTAS if available. */ 839 rtas_initialize(); 840 841 /* Check if we have an initrd provided via the device-tree. */ 842 check_for_initrd(); 843 844 /* Probe the machine type, establish ppc_md. */ 845 probe_machine(); 846 847 /* Setup panic notifier if requested by the platform. */ 848 setup_panic(); 849 850 /* 851 * Configure ppc_md.power_save (ppc32 only, 64-bit machines do 852 * it from their respective probe() function. 853 */ 854 setup_power_save(); 855 856 /* Discover standard serial ports. */ 857 find_legacy_serial_ports(); 858 859 /* Register early console with the printk subsystem. */ 860 register_early_udbg_console(); 861 862 /* Setup the various CPU maps based on the device-tree. */ 863 smp_setup_cpu_maps(); 864 865 /* Initialize xmon. */ 866 xmon_setup(); 867 868 /* Check the SMT related command line arguments (ppc64). */ 869 check_smt_enabled(); 870 871 /* On BookE, setup per-core TLB data structures. */ 872 setup_tlb_core_data(); 873 874 /* 875 * Release secondary cpus out of their spinloops at 0x60 now that 876 * we can map physical -> logical CPU ids. 877 * 878 * Freescale Book3e parts spin in a loop provided by firmware, 879 * so smp_release_cpus() does nothing for them. 880 */ 881#ifdef CONFIG_SMP 882 smp_release_cpus(); 883#endif 884 885 /* Print various info about the machine that has been gathered so far. */ 886 print_system_info(); 887 888 /* Reserve large chunks of memory for use by CMA for KVM. */ 889 kvm_cma_reserve(); 890 891 /* 892 * Reserve any gigantic pages requested on the command line. 893 * memblock needs to have been initialized by the time this is 894 * called since this will reserve memory. 895 */ 896 reserve_hugetlb_gpages(); 897 898 klp_init_thread_info(&init_thread_info); 899 900 init_mm.start_code = (unsigned long)_stext; 901 init_mm.end_code = (unsigned long) _etext; 902 init_mm.end_data = (unsigned long) _edata; 903 init_mm.brk = klimit; 904#ifdef CONFIG_PPC_64K_PAGES 905 init_mm.context.pte_frag = NULL; 906#endif 907#ifdef CONFIG_SPAPR_TCE_IOMMU 908 mm_iommu_init(&init_mm.context); 909#endif 910 irqstack_early_init(); 911 exc_lvl_early_init(); 912 emergency_stack_init(); 913 914 initmem_init(); 915 916#ifdef CONFIG_DUMMY_CONSOLE 917 conswitchp = &dummy_con; 918#endif 919 if (ppc_md.setup_arch) 920 ppc_md.setup_arch(); 921 922 paging_init(); 923 924 /* Initialize the MMU context management stuff. */ 925 mmu_context_init(); 926 927#ifdef CONFIG_PPC64 928 /* Interrupt code needs to be 64K-aligned. */ 929 if ((unsigned long)_stext & 0xffff) 930 panic("Kernelbase not 64K-aligned (0x%lx)!\n", 931 (unsigned long)_stext); 932#endif 933} |
|