Rev 4343 | Rev 4345 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4343 | Rev 4344 | ||
---|---|---|---|
Line 50... | Line 50... | ||
50 | #include <proc/uarg.h> |
50 | #include <proc/uarg.h> |
51 | #include <syscall/syscall.h> |
51 | #include <syscall/syscall.h> |
52 | #include <ddi/irq.h> |
52 | #include <ddi/irq.h> |
53 | #include <ddi/device.h> |
53 | #include <ddi/device.h> |
54 | #include <arch/bootinfo.h> |
54 | #include <arch/bootinfo.h> |
55 | #include <arch/drivers/ega.h> |
55 | #include <genarch/drivers/legacy/ia32/io.h> |
56 | #include <genarch/drivers/ega/ega.h> |
56 | #include <genarch/drivers/ega/ega.h> |
57 | #include <genarch/kbd/i8042.h> |
57 | #include <genarch/kbd/i8042.h> |
58 | #include <genarch/kbd/ns16550.h> |
58 | #include <genarch/kbd/ns16550.h> |
59 | #include <smp/smp.h> |
59 | #include <smp/smp.h> |
60 | #include <smp/ipi.h> |
60 | #include <smp/ipi.h> |
Line 63... | Line 63... | ||
63 | #include <print.h> |
63 | #include <print.h> |
64 | #include <sysinfo/sysinfo.h> |
64 | #include <sysinfo/sysinfo.h> |
65 | 65 | ||
66 | /* NS16550 as a COM 1 */ |
66 | /* NS16550 as a COM 1 */ |
67 | #define NS16550_IRQ (4 + LEGACY_INTERRUPT_BASE) |
67 | #define NS16550_IRQ (4 + LEGACY_INTERRUPT_BASE) |
68 | #define NS16550_PORT 0x3f8 |
- | |
69 | 68 | ||
70 | bootinfo_t *bootinfo; |
69 | bootinfo_t *bootinfo; |
71 | 70 | ||
72 | static uint64_t iosapic_base = 0xfec00000; |
71 | static uint64_t iosapic_base = 0xfec00000; |
73 | 72 | ||
Line 159... | Line 158... | ||
159 | panic("Cannot create kkbdpoll."); |
158 | panic("Cannot create kkbdpoll."); |
160 | thread_ready(t); |
159 | thread_ready(t); |
161 | #endif |
160 | #endif |
162 | 161 | ||
163 | #ifdef I460GX |
162 | #ifdef I460GX |
164 | devno_t kbd = device_assign_devno(); |
163 | devno_t devno = device_assign_devno(); |
- | 164 | inr_t inr; |
|
165 | 165 | ||
166 | #ifdef CONFIG_NS16550 |
166 | #ifdef CONFIG_NS16550 |
- | 167 | inr = NS16550_IRQ; |
|
167 | ns16550_init(kbd, NS16550_PORT, NS16550_IRQ, NULL, NULL); |
168 | (void) ns16550_init((ns16550_t *)NS16550_BASE, devno, inr, NULL, NULL); |
- | 169 | sysinfo_set_item_val("kbd.type", NULL, KBD_NS16550); |
|
- | 170 | sysinfo_set_item_val("kbd.port", NULL, (uintptr_t)NS16550_BASE); |
|
168 | #else |
171 | #else |
- | 172 | inr = IRQ_KBD; |
|
169 | devno_t mouse = device_assign_devno(); |
173 | (void) i8042_init((i8042_t *)I8042_BASE, devno, inr); |
170 | i8042_init(kbd, IRQ_KBD, mouse, IRQ_MOUSE); |
174 | sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY); |
171 | #endif |
175 | #endif |
- | 176 | sysinfo_set_item_val("kbd", NULL, true); |
|
- | 177 | sysinfo_set_item_val("kbd.devno", NULL, devno); |
|
- | 178 | sysinfo_set_item_val("kbd.inr", NULL, inr); |
|
172 | #endif |
179 | #endif |
173 | 180 | ||
174 | sysinfo_set_item_val("ia64_iospace", NULL, true); |
181 | sysinfo_set_item_val("ia64_iospace", NULL, true); |
175 | sysinfo_set_item_val("ia64_iospace.address", NULL, true); |
182 | sysinfo_set_item_val("ia64_iospace.address", NULL, true); |
176 | sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, IO_OFFSET); |
183 | sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, IO_OFFSET); |
Line 220... | Line 227... | ||
220 | */ |
227 | */ |
221 | void arch_grab_console(void) |
228 | void arch_grab_console(void) |
222 | { |
229 | { |
223 | #ifdef SKI |
230 | #ifdef SKI |
224 | ski_kbd_grab(); |
231 | ski_kbd_grab(); |
225 | #else |
- | |
226 | #ifdef CONFIG_NS16550 |
- | |
227 | ns16550_grab(); |
- | |
228 | #else |
- | |
229 | i8042_grab(); |
- | |
230 | #endif |
- | |
231 | #endif |
232 | #endif |
232 | } |
233 | } |
233 | 234 | ||
234 | /** Return console to userspace |
235 | /** Return console to userspace |
235 | * |
236 | * |
236 | */ |
237 | */ |
237 | void arch_release_console(void) |
238 | void arch_release_console(void) |
238 | { |
239 | { |
239 | #ifdef SKI |
240 | #ifdef SKI |
240 | ski_kbd_release(); |
241 | ski_kbd_release(); |
241 | #else |
- | |
242 | #ifdef CONFIG_NS16550 |
- | |
243 | ns16550_release(); |
- | |
244 | #else |
- | |
245 | i8042_release(); |
- | |
246 | #endif |
- | |
247 | #endif |
242 | #endif |
248 | } |
243 | } |
249 | 244 | ||
250 | void arch_reboot(void) |
245 | void arch_reboot(void) |
251 | { |
246 | { |
252 | pio_write_8(0x64, 0xfe); |
247 | pio_write_8((ioport8_t *)0x64, 0xfe); |
253 | while (1) |
248 | while (1) |
254 | ; |
249 | ; |
255 | } |
250 | } |
256 | 251 | ||
257 | /** Construct function pointer |
252 | /** Construct function pointer |