source: mainline/kernel/arch/arm32/src/arm32.c@ 41df2827

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 41df2827 was a71c158, checked in by Martin Decky <martin@…>, 16 years ago

kernel output devices now suport multiple instances (except ski and sgcn, which respect the same interface, but behave as singletons)
if more than one output device gets initialized, the output is cloned to all of them
get rid of arch_grab_console() and arch_release_console() (output devices can implement a generic "redraw" method, input devices respect the "silent" global variable)
related cleanups and modifications

  • Property mode set to 100644
File size: 4.4 KB
Line 
1/*
2 * Copyright (c) 2007 Michal Kebrt
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 * @brief ARM32 architecture specific functions.
34 */
35
36#include <arch.h>
37#include <config.h>
38#include <genarch/fb/fb.h>
39#include <genarch/fb/visuals.h>
40#include <sysinfo/sysinfo.h>
41#include <console/console.h>
42#include <ddi/irq.h>
43#include <print.h>
44#include <config.h>
45#include <interrupt.h>
46#include <arch/regutils.h>
47#include <userspace.h>
48#include <macros.h>
49#include <string.h>
50
51#ifdef MACHINE_testarm
52 #include <arch/mach/testarm/testarm.h>
53#endif
54
55#ifdef MACHINE_integratorcp
56 #include <arch/mach/integratorcp/integratorcp.h>
57#endif
58
59
60/** Performs arm32-specific initialization before main_bsp() is called. */
61void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
62{
63 unsigned int i;
64
65 init.cnt = bootinfo->cnt;
66
67 for (i = 0; i < min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); ++i) {
68 init.tasks[i].addr = bootinfo->tasks[i].addr;
69 init.tasks[i].size = bootinfo->tasks[i].size;
70 str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
71 bootinfo->tasks[i].name);
72 }
73}
74
75/** Performs arm32 specific initialization before mm is initialized. */
76void arch_pre_mm_init(void)
77{
78 /* It is not assumed by default */
79 interrupts_disable();
80}
81
82/** Performs arm32 specific initialization afterr mm is initialized. */
83void arch_post_mm_init(void)
84{
85 machine_init();
86
87 /* Initialize exception dispatch table */
88 exception_init();
89 interrupt_init();
90
91 machine_output_init();
92}
93
94/** Performs arm32 specific tasks needed after cpu is initialized.
95 *
96 * Currently the function is empty.
97 */
98void arch_post_cpu_init(void)
99{
100}
101
102
103/** Performs arm32 specific tasks needed before the multiprocessing is
104 * initialized.
105 *
106 * Currently the function is empty because SMP is not supported.
107 */
108void arch_pre_smp_init(void)
109{
110}
111
112
113/** Performs arm32 specific tasks needed after the multiprocessing is
114 * initialized.
115 *
116 * Currently the function is empty because SMP is not supported.
117 */
118void arch_post_smp_init(void)
119{
120 machine_input_init();
121}
122
123
124/** Performs arm32 specific tasks needed before the new task is run. */
125void before_task_runs_arch(void)
126{
127}
128
129
130/** Performs arm32 specific tasks needed before the new thread is scheduled.
131 *
132 * It sets supervisor_sp.
133 */
134void before_thread_runs_arch(void)
135{
136 uint8_t *stck;
137
138 tlb_invalidate_all();
139 stck = &THREAD->kstack[THREAD_STACK_SIZE - SP_DELTA];
140 supervisor_sp = (uintptr_t) stck;
141}
142
143/** Performs arm32 specific tasks before a thread stops running.
144 *
145 * Currently the function is empty.
146 */
147void after_thread_ran_arch(void)
148{
149}
150
151/** Halts CPU. */
152void cpu_halt(void)
153{
154 machine_cpu_halt();
155}
156
157/** Reboot. */
158void arch_reboot()
159{
160 /* not implemented */
161 while (1);
162}
163
164/** Construct function pointer
165 *
166 * @param fptr function pointer structure
167 * @param addr function address
168 * @param caller calling function address
169 *
170 * @return address of the function pointer
171 *
172 */
173void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
174{
175 return addr;
176}
177
178/** @}
179 */
Note: See TracBrowser for help on using the repository browser.