Rev 2360 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2128 | jermar | 1 | /* |
2159 | kebrt | 2 | * Copyright (c) 2007 Michal Kebrt |
2128 | jermar | 3 | * All rights reserved. |
4 | * |
||
5 | * Redistribution and use in source and binary forms, with or without |
||
6 | * modification, are permitted provided that the following conditions |
||
7 | * are met: |
||
8 | * |
||
9 | * - Redistributions of source code must retain the above copyright |
||
10 | * notice, this list of conditions and the following disclaimer. |
||
11 | * - Redistributions in binary form must reproduce the above copyright |
||
12 | * notice, this list of conditions and the following disclaimer in the |
||
13 | * documentation and/or other materials provided with the distribution. |
||
14 | * - The name of the author may not be used to endorse or promote products |
||
15 | * derived from this software without specific prior written permission. |
||
16 | * |
||
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
||
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
||
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
27 | */ |
||
28 | |||
29 | /** @addtogroup arm32 |
||
30 | * @{ |
||
31 | */ |
||
32 | /** @file |
||
33 | */ |
||
34 | |||
35 | |||
36 | #include <arch.h> |
||
2159 | kebrt | 37 | #include <arch/boot.h> |
38 | #include <config.h> |
||
2173 | kebrt | 39 | #include <arch/console.h> |
40 | #include <ddi/device.h> |
||
2263 | kebrt | 41 | #include <genarch/fb/fb.h> |
42 | #include <genarch/fb/visuals.h> |
||
43 | #include <ddi/irq.h> |
||
2326 | kebrt | 44 | #include <arch/debug/print.h> |
2200 | jancik | 45 | #include <print.h> |
46 | #include <config.h> |
||
2245 | stepan | 47 | #include <interrupt.h> |
2280 | jancik | 48 | #include <arch/regutils.h> |
2294 | kebrt | 49 | #include <arch/machine.h> |
2280 | jancik | 50 | #include <userspace.h> |
2289 | stepan | 51 | |
2357 | kebrt | 52 | |
2159 | kebrt | 53 | bootinfo_t bootinfo; |
2289 | stepan | 54 | extern uintptr_t supervisor_sp; |
2159 | kebrt | 55 | |
2329 | kebrt | 56 | |
2128 | jermar | 57 | void arch_pre_main(void) |
58 | { |
||
2159 | kebrt | 59 | int i; |
60 | |||
61 | init.cnt = bootinfo.cnt; |
||
62 | |||
63 | for (i = 0; i < bootinfo.cnt; ++i) { |
||
64 | init.tasks[i].addr = bootinfo.tasks[i].addr; |
||
65 | init.tasks[i].size = bootinfo.tasks[i].size; |
||
66 | } |
||
2300 | kebrt | 67 | |
2128 | jermar | 68 | } |
69 | |||
2329 | kebrt | 70 | |
2128 | jermar | 71 | void arch_pre_mm_init(void) |
72 | { |
||
2245 | stepan | 73 | /* It is not assumed by default */ |
74 | interrupts_disable(); |
||
2128 | jermar | 75 | } |
76 | |||
2280 | jancik | 77 | |
2128 | jermar | 78 | void arch_post_mm_init(void) |
79 | { |
||
2294 | kebrt | 80 | machine_hw_map_init(); |
2284 | stepan | 81 | |
82 | /* Initialize dispatch table */ |
||
2270 | jancik | 83 | exception_init(); |
84 | |||
2263 | kebrt | 85 | interrupt_init(); |
2235 | stepan | 86 | |
2284 | stepan | 87 | console_init(device_assign_devno()); |
2341 | kebrt | 88 | |
2360 | kebrt | 89 | #ifdef CONFIG_FB |
90 | fb_init(machine_get_fb_address(), 640, 480, 1920, VISUAL_RGB_8_8_8); |
||
91 | #endif |
||
2128 | jermar | 92 | } |
93 | |||
2329 | kebrt | 94 | |
2128 | jermar | 95 | void arch_post_cpu_init(void) |
96 | { |
||
97 | } |
||
98 | |||
2329 | kebrt | 99 | |
2128 | jermar | 100 | void arch_pre_smp_init(void) |
101 | { |
||
102 | /* TODO */ |
||
103 | } |
||
104 | |||
2329 | kebrt | 105 | |
2128 | jermar | 106 | void arch_post_smp_init(void) |
107 | { |
||
108 | /* TODO */ |
||
109 | } |
||
110 | |||
2329 | kebrt | 111 | |
2128 | jermar | 112 | /** Perform arm32 specific tasks needed before the new task is run. */ |
113 | void before_task_runs_arch(void) |
||
114 | { |
||
2329 | kebrt | 115 | tlb_invalidate_all(); |
2128 | jermar | 116 | } |
117 | |||
2329 | kebrt | 118 | |
2128 | jermar | 119 | /** Perform arm32 specific tasks needed before the new thread is scheduled. */ |
120 | void before_thread_runs_arch(void) |
||
121 | { |
||
2298 | stepan | 122 | supervisor_sp = (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA]; |
2128 | jermar | 123 | } |
124 | |||
2329 | kebrt | 125 | |
2128 | jermar | 126 | void after_thread_ran_arch(void) |
127 | { |
||
128 | } |
||
129 | |||
2329 | kebrt | 130 | |
2280 | jancik | 131 | |
2300 | kebrt | 132 | void cpu_halt(void) |
133 | { |
||
134 | machine_cpu_halt(); |
||
135 | } |
||
136 | |||
2128 | jermar | 137 | /** @} |
138 | */ |
||
2280 | jancik | 139 | |
140 | |||
141 | |||
142 | |||
143 | |||
144 | |||
145 | |||
146 | |||
147 | |||
148 | |||
149 | |||
150 | |||
151 | |||
152 |