Rev 4055 | Rev 4296 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4055 | Rev 4156 | ||
|---|---|---|---|
| Line 48... | Line 48... | ||
| 48 | #include <userspace.h> |
48 | #include <userspace.h> |
| 49 | #include <console/console.h> |
49 | #include <console/console.h> |
| 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> |
- | |
| 54 | #include <arch/bootinfo.h> |
53 | #include <arch/bootinfo.h> |
| 55 | #include <genarch/drivers/legacy/ia32/io.h> |
54 | #include <genarch/drivers/legacy/ia32/io.h> |
| 56 | #include <genarch/drivers/ega/ega.h> |
55 | #include <genarch/drivers/ega/ega.h> |
| 57 | #include <genarch/kbrd/kbrd.h> |
56 | #include <genarch/kbrd/kbrd.h> |
| 58 | #include <genarch/srln/srln.h> |
57 | #include <genarch/srln/srln.h> |
| Line 66... | Line 65... | ||
| 66 | #include <print.h> |
65 | #include <print.h> |
| 67 | #include <sysinfo/sysinfo.h> |
66 | #include <sysinfo/sysinfo.h> |
| 68 | #include <string.h> |
67 | #include <string.h> |
| 69 | 68 | ||
| 70 | /* NS16550 as a COM 1 */ |
69 | /* NS16550 as a COM 1 */ |
| 71 | #define NS16550_IRQ (4 + LEGACY_INTERRUPT_BASE) |
70 | #define NS16550_IRQ (4 + LEGACY_INTERRUPT_BASE) |
| 72 | 71 | ||
| 73 | bootinfo_t *bootinfo; |
72 | bootinfo_t *bootinfo; |
| 74 | 73 | ||
| 75 | static uint64_t iosapic_base = 0xfec00000; |
74 | static uint64_t iosapic_base = 0xfec00000; |
| 76 | 75 | ||
| Line 128... | Line 127... | ||
| 128 | srlz_d(); |
127 | srlz_d(); |
| 129 | } |
128 | } |
| 130 | 129 | ||
| 131 | } |
130 | } |
| 132 | 131 | ||
| 133 | - | ||
| 134 | void arch_post_mm_init(void) |
132 | void arch_post_mm_init(void) |
| 135 | { |
133 | { |
| 136 | if (config.cpu_active == 1) { |
134 | if (config.cpu_active == 1) { |
| 137 | iosapic_init(); |
135 | iosapic_init(); |
| 138 | irq_init(INR_COUNT, INR_COUNT); |
136 | irq_init(INR_COUNT, INR_COUNT); |
| 139 | #ifdef SKI |
- | |
| 140 | ski_init_console(); |
- | |
| 141 | #else |
- | |
| 142 | ega_init(EGA_BASE, EGA_VIDEORAM); |
- | |
| 143 | #endif |
- | |
| 144 | } |
137 | } |
| 145 | it_init(); |
138 | it_init(); |
| 146 | - | ||
| 147 | } |
139 | } |
| 148 | 140 | ||
| 149 | void arch_post_cpu_init(void) |
141 | void arch_post_cpu_init(void) |
| 150 | { |
142 | { |
| 151 | } |
143 | } |
| Line 154... | Line 146... | ||
| 154 | { |
146 | { |
| 155 | } |
147 | } |
| 156 | 148 | ||
| 157 | void arch_post_smp_init(void) |
149 | void arch_post_smp_init(void) |
| 158 | { |
150 | { |
| 159 | /* |
- | |
| 160 | * Create thread that polls keyboard. |
- | |
| 161 | */ |
- | |
| 162 | #ifdef SKI |
151 | #ifdef SKI |
| - | 152 | indev_t *in; |
|
| 163 | thread_t *t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll", true); |
153 | in = skiin_init(); |
| 164 | if (!t) |
154 | if (in) |
| 165 | panic("Cannot create kkbdpoll."); |
155 | srln_init(in); |
| 166 | thread_ready(t); |
156 | skiout_init(); |
| 167 | #endif |
157 | #endif |
| 168 | 158 | ||
| 169 | #ifdef I460GX |
159 | #ifdef CONFIG_EGA |
| 170 | devno_t devno = device_assign_devno(); |
160 | ega_init(EGA_BASE, EGA_VIDEORAM); |
| 171 | inr_t inr; |
161 | #endif |
| 172 | 162 | ||
| 173 | #ifdef CONFIG_NS16550 |
163 | #ifdef CONFIG_NS16550 |
| 174 | inr = NS16550_IRQ; |
164 | indev_t *kbrdin_ns16550 |
| 175 | srln_init(stdin); |
- | |
| 176 | (void) ns16550_init((ns16550_t *)NS16550_BASE, devno, inr, NULL, NULL, |
165 | = ns16550_init((ns16550_t *) NS16550_BASE, NS16550_IRQ, NULL, NULL); |
| 177 | &srlnin); |
166 | if (kbrdin_ns16550) |
| - | 167 | srln_init(kbrdin_ns16550); |
|
| - | 168 | ||
| - | 169 | sysinfo_set_item_val("kbd", NULL, true); |
|
| - | 170 | sysinfo_set_item_val("kbd.inr", NULL, NS16550_IRQ); |
|
| 178 | sysinfo_set_item_val("kbd.type", NULL, KBD_NS16550); |
171 | sysinfo_set_item_val("kbd.type", NULL, KBD_NS16550); |
| 179 | sysinfo_set_item_val("kbd.address.physical", NULL, |
172 | sysinfo_set_item_val("kbd.address.physical", NULL, |
| 180 | (uintptr_t) NS16550_BASE); |
173 | (uintptr_t) NS16550_BASE); |
| 181 | sysinfo_set_item_val("kbd.address.kernel", NULL, |
174 | sysinfo_set_item_val("kbd.address.kernel", NULL, |
| 182 | (uintptr_t) NS16550_BASE); |
175 | (uintptr_t) NS16550_BASE); |
| 183 | #else |
176 | #endif |
| - | 177 | ||
| - | 178 | #ifdef CONFIG_I8042 |
|
| - | 179 | indev_t *kbrdin_i8042 = i8042_init((i8042_t *) I8042_BASE, IRQ_KBD); |
|
| 184 | inr = IRQ_KBD; |
180 | if (kbrdin_i8042) |
| 185 | kbrd_init(stdin); |
181 | kbrd_init(kbrdin_i8042); |
| - | 182 | ||
| 186 | (void) i8042_init((i8042_t *)I8042_BASE, devno, inr, &kbrdin); |
183 | sysinfo_set_item_val("kbd", NULL, true); |
| 187 | trap_virtual_enable_irqs(1 << inr); |
184 | sysinfo_set_item_val("kbd.inr", NULL, IRQ_KBD); |
| 188 | sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY); |
185 | sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY); |
| 189 | sysinfo_set_item_val("kbd.address.physical", NULL, |
186 | sysinfo_set_item_val("kbd.address.physical", NULL, |
| 190 | (uintptr_t) I8042_BASE); |
187 | (uintptr_t) I8042_BASE); |
| 191 | sysinfo_set_item_val("kbd.address.kernel", NULL, |
188 | sysinfo_set_item_val("kbd.address.kernel", NULL, |
| 192 | (uintptr_t) I8042_BASE); |
189 | (uintptr_t) I8042_BASE); |
| 193 | #endif |
190 | #endif |
| 194 | sysinfo_set_item_val("kbd", NULL, true); |
- | |
| 195 | sysinfo_set_item_val("kbd.devno", NULL, devno); |
- | |
| 196 | sysinfo_set_item_val("kbd.inr", NULL, inr); |
- | |
| 197 | #endif |
- | |
| 198 | 191 | ||
| 199 | sysinfo_set_item_val("ia64_iospace", NULL, true); |
192 | sysinfo_set_item_val("ia64_iospace", NULL, true); |
| 200 | sysinfo_set_item_val("ia64_iospace.address", NULL, true); |
193 | sysinfo_set_item_val("ia64_iospace.address", NULL, true); |
| 201 | sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, IO_OFFSET); |
194 | sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, IO_OFFSET); |
| 202 | } |
195 | } |
| 203 | 196 | ||