Rev 3635 | Rev 3659 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3635 | Rev 3657 | ||
|---|---|---|---|
| Line 61... | Line 61... | ||
| 61 | #include <panic.h> |
61 | #include <panic.h> |
| 62 | #include <print.h> |
62 | #include <print.h> |
| 63 | #include <sysinfo/sysinfo.h> |
63 | #include <sysinfo/sysinfo.h> |
| 64 | 64 | ||
| 65 | /*NS16550 as a COM 1*/ |
65 | /*NS16550 as a COM 1*/ |
| 66 | #define NS16550_IRQ 4 |
66 | #define NS16550_IRQ (4+LAGACY_INTERRUPT_BASE) |
| 67 | #define NS16550_PORT 0x3f8 |
67 | #define NS16550_PORT 0x3f8 |
| 68 | 68 | ||
| 69 | bootinfo_t *bootinfo; |
69 | bootinfo_t *bootinfo; |
| 70 | 70 | ||
| - | 71 | static uint64_t iosapic_base=0xfec00000; |
|
| - | 72 | ||
| 71 | void arch_pre_main(void) |
73 | void arch_pre_main(void) |
| 72 | { |
74 | { |
| 73 | /* Setup usermode init tasks. */ |
75 | /* Setup usermode init tasks. */ |
| 74 | 76 | ||
| 75 | //#ifdef I460GX |
77 | //#ifdef I460GX |
| Line 109... | Line 111... | ||
| 109 | iva_write((uintptr_t) &ivt); |
111 | iva_write((uintptr_t) &ivt); |
| 110 | srlz_d(); |
112 | srlz_d(); |
| 111 | 113 | ||
| 112 | } |
114 | } |
| 113 | 115 | ||
| - | 116 | static void iosapic_init(void) |
|
| - | 117 | { |
|
| - | 118 | ||
| - | 119 | uint64_t IOSAPIC = PA2KA((unative_t)(iosapic_base))|FW_OFFSET; |
|
| - | 120 | int i; |
|
| - | 121 | ||
| - | 122 | ||
| - | 123 | for(i=0;i<16;i++) |
|
| - | 124 | { |
|
| - | 125 | ||
| - | 126 | if(i==2) continue; //Disable Cascade interrupt |
|
| - | 127 | ((uint32_t*)(IOSAPIC+0x00))[0]=0x10+2*i; |
|
| - | 128 | srlz_d(); |
|
| - | 129 | ((uint32_t*)(IOSAPIC+0x10))[0]=LAGACY_INTERRUPT_BASE+i; |
|
| - | 130 | srlz_d(); |
|
| - | 131 | ((uint32_t*)(IOSAPIC+0x00))[0]=0x10+2*i+1; |
|
| - | 132 | srlz_d(); |
|
| - | 133 | ((uint32_t*)(IOSAPIC+0x10))[0]=1<<(56-32); |
|
| - | 134 | srlz_d(); |
|
| - | 135 | } |
|
| - | 136 | ||
| - | 137 | } |
|
| - | 138 | ||
| - | 139 | ||
| 114 | void arch_post_mm_init(void) |
140 | void arch_post_mm_init(void) |
| 115 | { |
141 | { |
| 116 | if(config.cpu_active==1) |
142 | if(config.cpu_active==1) |
| 117 | { |
143 | { |
| - | 144 | iosapic_init(); |
|
| - | 145 | ||
| 118 | irq_init(INR_COUNT, INR_COUNT); |
146 | irq_init(INR_COUNT, INR_COUNT); |
| 119 | #ifdef SKI |
147 | #ifdef SKI |
| 120 | ski_init_console(); |
148 | ski_init_console(); |
| 121 | #else |
149 | #else |
| 122 | ega_init(); |
150 | ega_init(); |
| 123 | #endif |
151 | #endif |
| 124 | } |
152 | } |
| 125 | it_init(); |
153 | it_init(); |
| - | 154 | ||
| 126 | } |
155 | } |
| 127 | 156 | ||
| 128 | void arch_post_cpu_init(void) |
157 | void arch_post_cpu_init(void) |
| 129 | { |
158 | { |
| 130 | } |
159 | } |
| Line 140... | Line 169... | ||
| 140 | static void i8042_kkbdpoll(void *arg) |
169 | static void i8042_kkbdpoll(void *arg) |
| 141 | { |
170 | { |
| 142 | while (1) { |
171 | while (1) { |
| 143 | i8042_poll(); |
172 | i8042_poll(); |
| 144 | #ifdef CONFIG_NS16550 |
173 | #ifdef CONFIG_NS16550 |
| - | 174 | #ifndef CONFIG_NS16550_INTERRUPT_DRIVEN |
|
| 145 | ns16550_poll(); |
175 | ns16550_poll(); |
| - | 176 | #endif |
|
| 146 | #endif |
177 | #endif |
| 147 | thread_usleep(POLL_INTERVAL); |
178 | thread_usleep(POLL_INTERVAL); |
| 148 | } |
179 | } |
| 149 | } |
180 | } |
| 150 | #endif |
181 | #endif |
| 151 | 182 | ||
| - | 183 | ||
| - | 184 | static void end_of_irq_void(void *cir_arg __attribute__((unused)),inr_t inr __attribute__((unused))) |
|
| - | 185 | { |
|
| - | 186 | return; |
|
| - | 187 | } |
|
| - | 188 | ||
| - | 189 | ||
| 152 | void arch_post_smp_init(void) |
190 | void arch_post_smp_init(void) |
| 153 | { |
191 | { |
| 154 | 192 | ||
| 155 | { |
193 | { |
| 156 | /* |
194 | /* |
| Line 169... | Line 207... | ||
| 169 | devno_t mouse = device_assign_devno(); |
207 | devno_t mouse = device_assign_devno(); |
| 170 | /* keyboard controller */ |
208 | /* keyboard controller */ |
| 171 | i8042_init(kbd, IRQ_KBD, mouse, IRQ_MOUSE); |
209 | i8042_init(kbd, IRQ_KBD, mouse, IRQ_MOUSE); |
| 172 | 210 | ||
| 173 | #ifdef CONFIG_NS16550 |
211 | #ifdef CONFIG_NS16550 |
| 174 | ns16550_init(kbd, NS16550_IRQ, NS16550_PORT); // as a COM 1 |
212 | ns16550_init(kbd, NS16550_IRQ, NS16550_PORT,end_of_irq_void,NULL); // as a COM 1 |
| 175 | #else |
213 | #else |
| 176 | #endif |
214 | #endif |
| 177 | thread_t *t; |
215 | thread_t *t; |
| 178 | t = thread_create(i8042_kkbdpoll, NULL, TASK, 0, "kkbdpoll", true); |
216 | t = thread_create(i8042_kkbdpoll, NULL, TASK, 0, "kkbdpoll", true); |
| 179 | if (!t) |
217 | if (!t) |
| Line 186... | Line 224... | ||
| 186 | 224 | ||
| 187 | sysinfo_set_item_val("ia64_iospace", NULL, true); |
225 | sysinfo_set_item_val("ia64_iospace", NULL, true); |
| 188 | sysinfo_set_item_val("ia64_iospace.address", NULL, true); |
226 | sysinfo_set_item_val("ia64_iospace.address", NULL, true); |
| 189 | sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, IO_OFFSET); |
227 | sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, IO_OFFSET); |
| 190 | 228 | ||
| - | 229 | ||
| - | 230 | ||
| - | 231 | ||
| - | 232 | ||
| 191 | } |
233 | } |
| 192 | 234 | ||
| 193 | 235 | ||
| 194 | /** Enter userspace and never return. */ |
236 | /** Enter userspace and never return. */ |
| 195 | void userspace(uspace_arg_t *kernel_uarg) |
237 | void userspace(uspace_arg_t *kernel_uarg) |
| Line 235... | Line 277... | ||
| 235 | */ |
277 | */ |
| 236 | void arch_grab_console(void) |
278 | void arch_grab_console(void) |
| 237 | { |
279 | { |
| 238 | #ifdef SKI |
280 | #ifdef SKI |
| 239 | ski_kbd_grab(); |
281 | ski_kbd_grab(); |
| - | 282 | #else |
|
| - | 283 | i8042_grab(); |
|
| - | 284 | #ifdef CONFIG_NS16550 |
|
| - | 285 | ns16550_grab(); |
|
| - | 286 | #endif |
|
| - | 287 | ||
| 240 | #endif |
288 | #endif |
| 241 | } |
289 | } |
| 242 | /** Return console to userspace |
290 | /** Return console to userspace |
| 243 | * |
291 | * |
| 244 | */ |
292 | */ |
| 245 | void arch_release_console(void) |
293 | void arch_release_console(void) |
| 246 | { |
294 | { |
| 247 | #ifdef SKI |
295 | #ifdef SKI |
| 248 | ski_kbd_release(); |
296 | ski_kbd_release(); |
| - | 297 | i8042_release(); |
|
| - | 298 | #else |
|
| - | 299 | #ifdef CONFIG_NS16550 |
|
| - | 300 | ns16550_release(); |
|
| - | 301 | #endif |
|
| - | 302 | ||
| 249 | #endif |
303 | #endif |
| 250 | } |
304 | } |
| 251 | 305 | ||
| 252 | void arch_reboot(void) |
306 | void arch_reboot(void) |
| 253 | { |
307 | { |