xref: /haiku/src/system/kernel/arch/arm/arch_int.cpp (revision 1294543de9ac0eff000eaea1b18368c36435d08e)
1 /*
2  * Copyright 2003-2010, Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  * 		Axel Dörfler <axeld@pinc-software.de>
7  * 		Ingo Weinhold <bonefish@cs.tu-berlin.de>
8  * 		François Revol <revol@free.fr>
9  *
10  * Copyright 2001, Travis Geiselbrecht. All rights reserved.
11  * Distributed under the terms of the NewOS License.
12  */
13 
14 
15 #include <int.h>
16 
17 #include <arch/smp.h>
18 #include <boot/kernel_args.h>
19 #include <device_manager.h>
20 #include <kscheduler.h>
21 #include <interrupt_controller.h>
22 #include <smp.h>
23 #include <thread.h>
24 #include <timer.h>
25 #include <util/DoublyLinkedList.h>
26 #include <util/kernel_cpp.h>
27 #include <vm/vm.h>
28 #include <vm/vm_priv.h>
29 #include <vm/VMAddressSpace.h>
30 #include <string.h>
31 
32 #warning M68K: writeme!
33 
34 
35 //#define TRACE_ARCH_INT
36 #ifdef TRACE_ARCH_INT
37 #	define TRACE(x) dprintf x
38 #else
39 #	define TRACE(x) ;
40 #endif
41 
42 /*typedef void (*m68k_exception_handler)(void);
43 #define M68K_EXCEPTION_VECTOR_COUNT 256
44 #warning M68K: align on 4 ?
45 //m68k_exception_handler gExceptionVectors[M68K_EXCEPTION_VECTOR_COUNT];
46 m68k_exception_handler *gExceptionVectors;
47 
48 // defined in arch_exceptions.S
49 extern "C" void __m68k_exception_noop(void);
50 extern "C" void __m68k_exception_common(void);
51 */
52 extern int __irqvec_start;
53 extern int __irqvec_end;
54 
55 //extern"C" void m68k_exception_tail(void);
56 
57 // current fault handler
58 addr_t gFaultHandler;
59 
60 // An iframe stack used in the early boot process when we don't have
61 // threads yet.
62 struct iframe_stack gBootFrameStack;
63 
64 // interrupt controller interface (initialized
65 // in arch_int_init_post_device_manager())
66 //static struct interrupt_controller_module_info *sPIC;
67 //static void *sPICCookie;
68 
69 
70 void
71 arch_int_enable_io_interrupt(int irq)
72 {
73 #warning ARM WRITEME
74 	//if (!sPIC)
75 	//	return;
76 
77 	// TODO: I have no idea, what IRQ type is appropriate.
78 	//sPIC->enable_io_interrupt(sPICCookie, irq, IRQ_TYPE_LEVEL);
79 //	M68KPlatform::Default()->EnableIOInterrupt(irq);
80 }
81 
82 
83 void
84 arch_int_disable_io_interrupt(int irq)
85 {
86 #warning ARM WRITEME
87 
88 	//if (!sPIC)
89 	//	return;
90 
91 	//sPIC->disable_io_interrupt(sPICCookie, irq);
92 //	M68KPlatform::Default()->DisableIOInterrupt(irq);
93 }
94 
95 
96 /* arch_int_*_interrupts() and friends are in arch_asm.S */
97 
98 
99 static void
100 print_iframe(struct iframe *frame)
101 {
102 /*
103 	dprintf("r0-r3:   0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r0, frame->r1, frame->r2, frame->r3);
104 	dprintf("r4-r7:   0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r4, frame->r5, frame->r6, frame->r7);
105 	dprintf("r8-r11:  0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r8, frame->r9, frame->r10, frame->r11);
106 	dprintf("r12-r15: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->r12, frame->r13, frame->a6, frame->a7);
107 	dprintf("      pc 0x%08lx         sr 0x%08lx\n", frame->pc, frame->sr);
108 */
109 
110 #warning ARM WRITEME
111 }
112 
113 
114 status_t
115 arch_int_init(kernel_args *args)
116 {
117 	status_t err;
118 	addr_t vbr;
119 	int i;
120 
121 //	gExceptionVectors = (m68k_exception_handler *)args->arch_args.vir_vbr;
122 
123 	/* fill in the vector table */
124 //	for (i = 0; i < M68K_EXCEPTION_VECTOR_COUNT; i++)
125 //		gExceptionVectors[i] = &__m68k_exception_common;
126 
127 //	vbr = args->arch_args.phys_vbr;
128 	/* point VBR to the new table */
129 //	asm volatile  ("movec %0,%%vbr" : : "r"(vbr):);
130 #warning ARM WRITEME
131 
132 	return B_OK;
133 }
134 
135 
136 status_t
137 arch_int_init_post_vm(kernel_args *args)
138 {
139 	status_t err;
140 //	err = M68KPlatform::Default()->InitPIC(args);
141 #warning ARM WRITEME
142 
143 	return err;
144 }
145 
146 
147 status_t
148 arch_int_init_io(kernel_args* args)
149 {
150 	return B_OK;
151 }
152 
153 
154 status_t
155 arch_int_init_post_device_manager(struct kernel_args *args)
156 {
157 	// no PIC found
158 	panic("arch_int_init_post_device_manager(): Found no supported PIC!");
159 
160 	return B_ENTRY_NOT_FOUND;
161 }
162 
163 
164