aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/kernel')
-rw-r--r--arch/arm64/kernel/Makefile2
-rw-r--r--arch/arm64/kernel/asm-offsets.c4
-rw-r--r--arch/arm64/kernel/cputable.c33
-rw-r--r--arch/arm64/kernel/head.S76
-rw-r--r--arch/arm64/kernel/setup.c16
5 files changed, 8 insertions, 123 deletions
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 5ee07eee80c2..d5e70747c7a2 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -12,7 +12,7 @@ CFLAGS_REMOVE_insn.o = -pg
12CFLAGS_REMOVE_return_address.o = -pg 12CFLAGS_REMOVE_return_address.o = -pg
13 13
14# Object file lists. 14# Object file lists.
15arm64-obj-y := cputable.o debug-monitors.o entry.o irq.o fpsimd.o \ 15arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \
16 entry-fpsimd.o process.o ptrace.o setup.o signal.o \ 16 entry-fpsimd.o process.o ptrace.o setup.o signal.o \
17 sys.o stacktrace.o time.o traps.o io.o vdso.o \ 17 sys.o stacktrace.o time.o traps.o io.o vdso.o \
18 hyp-stub.o psci.o psci-call.o cpu_ops.o insn.o \ 18 hyp-stub.o psci.o psci-call.o cpu_ops.o insn.o \
diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
index f7fa65d4c352..14dd3d1afa57 100644
--- a/arch/arm64/kernel/asm-offsets.c
+++ b/arch/arm64/kernel/asm-offsets.c
@@ -24,7 +24,6 @@
24#include <linux/kvm_host.h> 24#include <linux/kvm_host.h>
25#include <asm/thread_info.h> 25#include <asm/thread_info.h>
26#include <asm/memory.h> 26#include <asm/memory.h>
27#include <asm/cputable.h>
28#include <asm/smp_plat.h> 27#include <asm/smp_plat.h>
29#include <asm/suspend.h> 28#include <asm/suspend.h>
30#include <asm/vdso_datapage.h> 29#include <asm/vdso_datapage.h>
@@ -71,9 +70,6 @@ int main(void)
71 BLANK(); 70 BLANK();
72 DEFINE(PAGE_SZ, PAGE_SIZE); 71 DEFINE(PAGE_SZ, PAGE_SIZE);
73 BLANK(); 72 BLANK();
74 DEFINE(CPU_INFO_SZ, sizeof(struct cpu_info));
75 DEFINE(CPU_INFO_SETUP, offsetof(struct cpu_info, cpu_setup));
76 BLANK();
77 DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL); 73 DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL);
78 DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE); 74 DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE);
79 DEFINE(DMA_FROM_DEVICE, DMA_FROM_DEVICE); 75 DEFINE(DMA_FROM_DEVICE, DMA_FROM_DEVICE);
diff --git a/arch/arm64/kernel/cputable.c b/arch/arm64/kernel/cputable.c
deleted file mode 100644
index fd3993cb060f..000000000000
--- a/arch/arm64/kernel/cputable.c
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * arch/arm64/kernel/cputable.c
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <linux/init.h>
20
21#include <asm/cputable.h>
22
23extern unsigned long __cpu_setup(void);
24
25struct cpu_info cpu_table[] = {
26 {
27 .cpu_id_val = 0x000f0000,
28 .cpu_id_mask = 0x000f0000,
29 .cpu_name = "AArch64 Processor",
30 .cpu_setup = __cpu_setup,
31 },
32 { /* Empty */ },
33};
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index d17649d39392..ebb9e630230a 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -245,22 +245,12 @@ ENTRY(stext)
245 bl __calc_phys_offset // x24=PHYS_OFFSET, x28=PHYS_OFFSET-PAGE_OFFSET 245 bl __calc_phys_offset // x24=PHYS_OFFSET, x28=PHYS_OFFSET-PAGE_OFFSET
246 bl set_cpu_boot_mode_flag 246 bl set_cpu_boot_mode_flag
247 mrs x22, midr_el1 // x22=cpuid 247 mrs x22, midr_el1 // x22=cpuid
248 mov x0, x22 248
249 bl lookup_processor_type
250 mov x23, x0 // x23=current cpu_table
251 /*
252 * __error_p may end up out of range for cbz if text areas are
253 * aligned up to section sizes.
254 */
255 cbnz x23, 1f // invalid processor (x23=0)?
256 b __error_p
2571:
258 bl __vet_fdt 249 bl __vet_fdt
259 bl __create_page_tables // x25=TTBR0, x26=TTBR1 250 bl __create_page_tables // x25=TTBR0, x26=TTBR1
260 /* 251 /*
261 * The following calls CPU specific code in a position independent 252 * The following calls CPU setup code, see arch/arm64/mm/proc.S for
262 * manner. See arch/arm64/mm/proc.S for details. x23 = base of 253 * details.
263 * cpu_info structure selected by lookup_processor_type above.
264 * On return, the CPU will be ready for the MMU to be turned on and 254 * On return, the CPU will be ready for the MMU to be turned on and
265 * the TCR will have been set. 255 * the TCR will have been set.
266 */ 256 */
@@ -268,9 +258,7 @@ ENTRY(stext)
268 // MMU has been enabled 258 // MMU has been enabled
269 adrp lr, __enable_mmu // return (PIC) address 259 adrp lr, __enable_mmu // return (PIC) address
270 add lr, lr, #:lo12:__enable_mmu 260 add lr, lr, #:lo12:__enable_mmu
271 ldr x12, [x23, #CPU_INFO_SETUP] 261 b __cpu_setup // initialise processor
272 add x12, x12, x28 // __virt_to_phys
273 br x12 // initialise processor
274ENDPROC(stext) 262ENDPROC(stext)
275 263
276/* 264/*
@@ -634,15 +622,9 @@ ENTRY(secondary_startup)
634 * Common entry point for secondary CPUs. 622 * Common entry point for secondary CPUs.
635 */ 623 */
636 mrs x22, midr_el1 // x22=cpuid 624 mrs x22, midr_el1 // x22=cpuid
637 mov x0, x22
638 bl lookup_processor_type
639 mov x23, x0 // x23=current cpu_table
640 cbz x23, __error_p // invalid processor (x23=0)?
641 625
642 pgtbl x25, x26, x28 // x25=TTBR0, x26=TTBR1 626 pgtbl x25, x26, x28 // x25=TTBR0, x26=TTBR1
643 ldr x12, [x23, #CPU_INFO_SETUP] 627 bl __cpu_setup // initialise processor
644 add x12, x12, x28 // __virt_to_phys
645 blr x12 // initialise processor
646 628
647 ldr x21, =secondary_data 629 ldr x21, =secondary_data
648 ldr x27, =__secondary_switched // address to jump to after enabling the MMU 630 ldr x27, =__secondary_switched // address to jump to after enabling the MMU
@@ -708,51 +690,3 @@ ENDPROC(__calc_phys_offset)
708 .align 3 690 .align 3
7091: .quad . 6911: .quad .
710 .quad PAGE_OFFSET 692 .quad PAGE_OFFSET
711
712/*
713 * Exception handling. Something went wrong and we can't proceed. We ought to
714 * tell the user, but since we don't have any guarantee that we're even
715 * running on the right architecture, we do virtually nothing.
716 */
717__error_p:
718ENDPROC(__error_p)
719
720__error:
7211: nop
722 b 1b
723ENDPROC(__error)
724
725/*
726 * This function gets the processor ID in w0 and searches the cpu_table[] for
727 * a match. It returns a pointer to the struct cpu_info it found. The
728 * cpu_table[] must end with an empty (all zeros) structure.
729 *
730 * This routine can be called via C code and it needs to work with the MMU
731 * both disabled and enabled (the offset is calculated automatically).
732 */
733ENTRY(lookup_processor_type)
734 adr x1, __lookup_processor_type_data
735 ldp x2, x3, [x1]
736 sub x1, x1, x2 // get offset between VA and PA
737 add x3, x3, x1 // convert VA to PA
7381:
739 ldp w5, w6, [x3] // load cpu_id_val and cpu_id_mask
740 cbz w5, 2f // end of list?
741 and w6, w6, w0
742 cmp w5, w6
743 b.eq 3f
744 add x3, x3, #CPU_INFO_SZ
745 b 1b
7462:
747 mov x3, #0 // unknown processor
7483:
749 mov x0, x3
750 ret
751ENDPROC(lookup_processor_type)
752
753 .align 3
754 .type __lookup_processor_type_data, %object
755__lookup_processor_type_data:
756 .quad .
757 .quad cpu_table
758 .size __lookup_processor_type_data, . - __lookup_processor_type_data
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 14808947bf46..3852405d70b5 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -50,7 +50,6 @@
50#include <asm/cpu.h> 50#include <asm/cpu.h>
51#include <asm/cputype.h> 51#include <asm/cputype.h>
52#include <asm/elf.h> 52#include <asm/elf.h>
53#include <asm/cputable.h>
54#include <asm/cpufeature.h> 53#include <asm/cpufeature.h>
55#include <asm/cpu_ops.h> 54#include <asm/cpu_ops.h>
56#include <asm/sections.h> 55#include <asm/sections.h>
@@ -84,7 +83,6 @@ unsigned int compat_elf_hwcap2 __read_mostly;
84 83
85DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS); 84DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS);
86 85
87static const char *cpu_name;
88phys_addr_t __fdt_pointer __initdata; 86phys_addr_t __fdt_pointer __initdata;
89 87
90/* 88/*
@@ -234,22 +232,12 @@ void __init up_late_init(void)
234 232
235static void __init setup_processor(void) 233static void __init setup_processor(void)
236{ 234{
237 struct cpu_info *cpu_info;
238 u64 features, block; 235 u64 features, block;
239 u32 cwg; 236 u32 cwg;
240 int cls; 237 int cls;
241 238
242 cpu_info = lookup_processor_type(read_cpuid_id()); 239 printk("CPU: AArch64 Processor [%08x] revision %d\n",
243 if (!cpu_info) { 240 read_cpuid_id(), read_cpuid_id() & 15);
244 printk("CPU configuration botched (ID %08x), unable to continue.\n",
245 read_cpuid_id());
246 while (1);
247 }
248
249 cpu_name = cpu_info->cpu_name;
250
251 printk("CPU: %s [%08x] revision %d\n",
252 cpu_name, read_cpuid_id(), read_cpuid_id() & 15);
253 241
254 sprintf(init_utsname()->machine, ELF_PLATFORM); 242 sprintf(init_utsname()->machine, ELF_PLATFORM);
255 elf_hwcap = 0; 243 elf_hwcap = 0;