Rev 4345 | Rev 4347 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4345 | Rev 4346 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | 42 | ||
43 | #include <genarch/multiboot/multiboot.h> |
43 | #include <genarch/multiboot/multiboot.h> |
44 | #include <genarch/drivers/legacy/ia32/io.h> |
44 | #include <genarch/drivers/legacy/ia32/io.h> |
45 | #include <genarch/drivers/ega/ega.h> |
45 | #include <genarch/drivers/ega/ega.h> |
46 | #include <arch/drivers/vesa.h> |
46 | #include <arch/drivers/vesa.h> |
- | 47 | #include <genarch/drivers/i8042/i8042.h> |
|
47 | #include <genarch/kbd/i8042.h> |
48 | #include <genarch/kbrd/kbrd.h> |
48 | #include <arch/drivers/i8254.h> |
49 | #include <arch/drivers/i8254.h> |
49 | #include <arch/drivers/i8259.h> |
50 | #include <arch/drivers/i8259.h> |
50 | 51 | ||
51 | #include <arch/context.h> |
52 | #include <arch/context.h> |
52 | 53 | ||
Line 108... | Line 109... | ||
108 | /* Initialize IRQ routing */ |
109 | /* Initialize IRQ routing */ |
109 | irq_init(IRQ_COUNT, IRQ_COUNT); |
110 | irq_init(IRQ_COUNT, IRQ_COUNT); |
110 | 111 | ||
111 | /* hard clock */ |
112 | /* hard clock */ |
112 | i8254_init(); |
113 | i8254_init(); |
113 | 114 | ||
114 | #ifdef CONFIG_FB |
115 | #ifdef CONFIG_FB |
115 | if (vesa_present()) |
116 | if (vesa_present()) |
116 | vesa_init(); |
117 | vesa_init(); |
117 | else |
118 | else |
118 | #endif |
119 | #endif |
- | 120 | #ifdef CONFIG_EGA |
|
119 | ega_init(EGA_BASE, EGA_VIDEORAM); /* video */ |
121 | ega_init(EGA_BASE, EGA_VIDEORAM); /* video */ |
- | 122 | #else |
|
- | 123 | {} |
|
- | 124 | #endif |
|
120 | 125 | ||
121 | /* Enable debugger */ |
126 | /* Enable debugger */ |
122 | debugger_init(); |
127 | debugger_init(); |
123 | /* Merge all memory zones to 1 big zone */ |
128 | /* Merge all memory zones to 1 big zone */ |
124 | zone_merge_all(); |
129 | zone_merge_all(); |
Line 144... | Line 149... | ||
144 | } |
149 | } |
145 | } |
150 | } |
146 | 151 | ||
147 | void arch_post_smp_init(void) |
152 | void arch_post_smp_init(void) |
148 | { |
153 | { |
- | 154 | #ifdef CONFIG_PC_KBD |
|
149 | devno_t devno = device_assign_devno(); |
155 | devno_t devno = device_assign_devno(); |
- | 156 | ||
- | 157 | /* |
|
150 | /* keyboard controller */ |
158 | * Initialize the i8042 controller. Then initialize the keyboard |
- | 159 | * module and connect it to i8042. Enable keyboard interrupts. |
|
- | 160 | */ |
|
151 | (void) i8042_init((i8042_t *) I8042_BASE, devno, IRQ_KBD); |
161 | indev_t *kbrdin = i8042_init((i8042_t *) I8042_BASE, devno, IRQ_KBD); |
- | 162 | if (kbrdin) { |
|
- | 163 | kbrd_init(kbrdin); |
|
- | 164 | trap_virtual_enable_irqs(1 << IRQ_KBD); |
|
- | 165 | } |
|
152 | 166 | ||
153 | /* |
167 | /* |
154 | * This is the necessary evil until the userspace driver is entirely |
168 | * This is the necessary evil until the userspace driver is entirely |
155 | * self-sufficient. |
169 | * self-sufficient. |
156 | */ |
170 | */ |
157 | sysinfo_set_item_val("kbd", NULL, true); |
171 | sysinfo_set_item_val("kbd", NULL, true); |
Line 159... | Line 173... | ||
159 | sysinfo_set_item_val("kbd.inr", NULL, IRQ_KBD); |
173 | sysinfo_set_item_val("kbd.inr", NULL, IRQ_KBD); |
160 | sysinfo_set_item_val("kbd.address.physical", NULL, |
174 | sysinfo_set_item_val("kbd.address.physical", NULL, |
161 | (uintptr_t) I8042_BASE); |
175 | (uintptr_t) I8042_BASE); |
162 | sysinfo_set_item_val("kbd.address.kernel", NULL, |
176 | sysinfo_set_item_val("kbd.address.kernel", NULL, |
163 | (uintptr_t) I8042_BASE); |
177 | (uintptr_t) I8042_BASE); |
- | 178 | #endif |
|
164 | } |
179 | } |
165 | 180 | ||
166 | void calibrate_delay_loop(void) |
181 | void calibrate_delay_loop(void) |
167 | { |
182 | { |
168 | i8254_calibrate_delay_loop(); |
183 | i8254_calibrate_delay_loop(); |
Line 192... | Line 207... | ||
192 | * |
207 | * |
193 | */ |
208 | */ |
194 | void arch_grab_console(void) |
209 | void arch_grab_console(void) |
195 | { |
210 | { |
196 | #ifdef CONFIG_FB |
211 | #ifdef CONFIG_FB |
- | 212 | if (vesa_present()) |
|
197 | vesa_redraw(); |
213 | vesa_redraw(); |
- | 214 | else |
|
- | 215 | #endif |
|
- | 216 | #ifdef CONFIG_EGA |
|
- | 217 | ega_redraw(); |
|
198 | #else |
218 | #else |
199 | ega_redraw(); |
219 | {} |
200 | #endif |
220 | #endif |
201 | } |
221 | } |
202 | 222 | ||
203 | /** Return console to userspace |
223 | /** Return console to userspace |
204 | * |
224 | * |