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