import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / arm / kernel / head-armo.S
1 /*
2  *  linux/arch/arm/kernel/head-armo.S
3  *
4  *  Copyright (C) 1994-2000 Russell King
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  *  26-bit kernel startup code
11  */
12 #include <linux/config.h>
13 #include <linux/linkage.h>
14 #include <asm/mach-types.h>
15
16                 .globl  SYMBOL_NAME(swapper_pg_dir)
17                 .equ    SYMBOL_NAME(swapper_pg_dir),    0x0207d000
18
19 /*
20  * Entry point.
21  */
22                 .section ".text.init",#alloc,#execinstr
23 ENTRY(stext)
24 __entry:        cmp     pc, #0x02000000
25                 ldrlt   pc, LC0                 @ if 0x01800000, call at 0x02080000
26                 teq     r0, #0                  @ Check for old calling method
27                 blne    oldparams               @ Move page if old
28                 adr     r0, LC0
29                 ldmib   r0, {r2-r5, sp}         @ Setup stack
30                 mov     r0, #0
31 1:              cmp     r2, r3                  @ Clear BSS
32                 strcc   r0, [r2], #4
33                 bcc     1b
34
35                 bl      detect_proc_type
36                 str     r0, [r4]
37                 bl      detect_arch_type
38                 str     r0, [r5]
39
40                 mov     fp, #0
41                 b       SYMBOL_NAME(start_kernel)
42
43 LC0:            .word   SYMBOL_NAME(_stext)
44                 .word   SYMBOL_NAME(__bss_start)                @ r2
45                 .word   SYMBOL_NAME(_end)                       @ r3
46                 .word   SYMBOL_NAME(processor_id)               @ r4
47                 .word   SYMBOL_NAME(__machine_arch_type)        @ r5
48                 .word   SYMBOL_NAME(init_task_union)+8192       @ sp
49 arm2_id:        .long   0x41560200
50 arm250_id:      .long   0x41560250
51                 .align
52
53 oldparams:      mov     r4, #0x02000000
54                 add     r3, r4, #0x00080000
55                 add     r4, r4, #0x0007c000
56 1:              ldmia   r0!, {r5 - r12}
57                 stmia   r4!, {r5 - r12}
58                 cmp     r4, r3
59                 blt     1b
60                 mov     pc, lr
61
62 /*
63  * We need some way to automatically detect the difference between
64  * these two machines.  Unfortunately, it is not possible to detect
65  * the presence of the SuperIO chip, because that will hang the old
66  * Archimedes machines solid.
67  */
68 /* DAG: Outdated, these have been combined !!!!!!! */
69 detect_arch_type:
70 #if defined(CONFIG_ARCH_ARC)
71                 mov     r0, #MACH_TYPE_ARCHIMEDES
72 #elif defined(CONFIG_ARCH_A5K)
73                 mov     r0, #MACH_TYPE_A5K
74 #endif
75                 mov     pc, lr
76
77 detect_proc_type:
78                 mov     ip, lr
79                 mov     r2, #0xea000000         @ Point undef instr to continuation
80                 adr     r0, continue - 12
81                 orr     r0, r2, r0, lsr #2
82                 mov     r1, #0
83                 str     r0, [r1, #4]
84                 ldr     r0, arm2_id
85                 swp     r2, r2, [r1]            @ check for swp (ARM2 cant)
86                 ldr     r0, arm250_id
87                 mrc     15, 0, r3, c0, c0       @ check for CP#15 (ARM250 cant)
88                 mov     r0, r3
89 continue:       mov     r2, #0xeb000000         @ Make undef vector loop
90                 sub     r2, r2, #2
91                 str     r2, [r1, #4]
92                 mov     pc, ip