| @@ -1,17 +1,17 @@ | | | @@ -1,17 +1,17 @@ |
1 | /* $NetBSD: kloader_zaurus.S,v 1.1 2009/03/11 09:02:05 nonaka Exp $ */ | | 1 | /* $NetBSD: kloader_zaurus.S,v 1.2 2012/01/17 15:48:33 nonaka Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2009 NONAKA Kimihiro <nonaka@netbsd.org> | | 4 | * Copyright (c) 2009-2012 NONAKA Kimihiro <nonaka@netbsd.org> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
15 | * | | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | | 16 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| @@ -46,29 +46,29 @@ | | | @@ -46,29 +46,29 @@ |
46 | mov tmp, tmp /* wait for it to complete */ ;\ | | 46 | mov tmp, tmp /* wait for it to complete */ ;\ |
47 | CPWAIT_BRANCH /* branch to next insn */ | | 47 | CPWAIT_BRANCH /* branch to next insn */ |
48 | | | 48 | |
49 | .text | | 49 | .text |
50 | /* | | 50 | /* |
51 | * void | | 51 | * void |
52 | * kloader_zaurus_boot(struct kloader_bootinfo *kbi, | | 52 | * kloader_zaurus_boot(struct kloader_bootinfo *kbi, |
53 | * struct kloader_page_tag *tag) | | 53 | * struct kloader_page_tag *tag) |
54 | * | | 54 | * |
55 | * r0: kbi, r1: tag | | 55 | * r0: kbi, r1: tag |
56 | */ | | 56 | */ |
57 | .global _C_LABEL(kloader_zaurus_boot) | | 57 | .global _C_LABEL(kloader_zaurus_boot) |
58 | _C_LABEL(kloader_zaurus_boot): | | 58 | _C_LABEL(kloader_zaurus_boot): |
59 | mov r0, r12 /* r12: kbi */ | | 59 | mov sp, r0 /* sp: kbi */ |
60 | bic r12, r12, #0xff000000 | | 60 | bic sp, sp, #0xff000000 /* clear upper 8 bits */ |
61 | orr r12, r12, #0xa0000000 | | 61 | orr sp, sp, #0xa0000000 /* OR in physical base address */ |
62 | | | 62 | |
63 | /* We will go ahead and disable the MMU here. */ | | 63 | /* We will go ahead and disable the MMU here. */ |
64 | adr r8, .Lmmuoff | | 64 | adr r8, .Lmmuoff |
65 | bic r8, r8, #0xff000000 /* clear upper 8 bits */ | | 65 | bic r8, r8, #0xff000000 /* clear upper 8 bits */ |
66 | orr r8, r8, #0xa0000000 /* OR in physical base address */ | | 66 | orr r8, r8, #0xa0000000 /* OR in physical base address */ |
67 | | | 67 | |
68 | mrc p15, 0, r2, c1, c0, 0 | | 68 | mrc p15, 0, r2, c1, c0, 0 |
69 | bic r2, r2, #CPU_CONTROL_MMU_ENABLE | | 69 | bic r2, r2, #CPU_CONTROL_MMU_ENABLE |
70 | bic r2, r2, #CPU_CONTROL_DC_ENABLE | | 70 | bic r2, r2, #CPU_CONTROL_DC_ENABLE |
71 | bic r2, r2, #CPU_CONTROL_IC_ENABLE | | 71 | bic r2, r2, #CPU_CONTROL_IC_ENABLE |
72 | mcr p15, 0, r2, c1, c0, 0 | | 72 | mcr p15, 0, r2, c1, c0, 0 |
73 | | | 73 | |
74 | nop | | 74 | nop |
| @@ -95,45 +95,40 @@ _C_LABEL(kloader_zaurus_boot): | | | @@ -95,45 +95,40 @@ _C_LABEL(kloader_zaurus_boot): |
95 | 2: ldr r9, [r5], #4 /* copy */ | | 95 | 2: ldr r9, [r5], #4 /* copy */ |
96 | str r9, [r6], #4 | | 96 | str r9, [r6], #4 |
97 | cmp r8, r6 | | 97 | cmp r8, r6 |
98 | bne 2b | | 98 | bne 2b |
99 | #ifdef PROGRESS | | 99 | #ifdef PROGRESS |
100 | bl .Lprogress | | 100 | bl .Lprogress |
101 | #endif | | 101 | #endif |
102 | b 1b | | 102 | b 1b |
103 | 3: | | 103 | 3: |
104 | #ifdef PROGRESS | | 104 | #ifdef PROGRESS |
105 | bl .Lputcrlf | | 105 | bl .Lputcrlf |
106 | #endif | | 106 | #endif |
107 | | | 107 | |
108 | /* set temporary stack pointer */ | | 108 | /* Set kernel entry */ |
| | | 109 | ldr r0, [sp] |
| | | 110 | |
| | | 111 | /* Set temporary stack pointer */ |
109 | ldr sp, .Lstack_addr | | 112 | ldr sp, .Lstack_addr |
110 | | | 113 | |
111 | /* Jump to kernel entry */ | | 114 | /* Jump to kernel entry */ |
112 | #if 0 /* XXX */ | | | |
113 | ldr r0, [r12] /* kbi->entry */ | | | |
114 | #else | | | |
115 | ldr r0, .Lstart_addr | | | |
116 | #endif | | | |
117 | mov pc, r0 | | 115 | mov pc, r0 |
118 | | | 116 | |
119 | 99: b 99b | | 117 | 99: b 99b |
120 | | | 118 | |
121 | .Lstack_addr: | | 119 | .Lstack_addr: |
122 | .word 0xa0004000 | | 120 | .word 0xa0004000 |
123 | | | 121 | |
124 | .Lstart_addr: | | | |
125 | .word 0xa0200000 | | | |
126 | | | | |
127 | #ifdef PROGRESS | | 122 | #ifdef PROGRESS |
128 | .Lprogress: | | 123 | .Lprogress: |
129 | mov r0, #0x2e /*'.'*/ | | 124 | mov r0, #0x2e /*'.'*/ |
130 | b .Lputchar | | 125 | b .Lputchar |
131 | | | 126 | |
132 | .Lputchar: | | 127 | .Lputchar: |
133 | ldr r2, .Lffuart_txdata | | 128 | ldr r2, .Lffuart_txdata |
134 | ldr r1, .Lffuart_txbusy | | 129 | ldr r1, .Lffuart_txbusy |
135 | 1: | | 130 | 1: |
136 | ldr r9, [r1] | | 131 | ldr r9, [r1] |
137 | tst r9, #0x20 | | 132 | tst r9, #0x20 |
138 | beq 1b | | 133 | beq 1b |
139 | str r0, [r2] | | 134 | str r0, [r2] |