Subversion Repositories HelenOS

Rev

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 52... Line 52...
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 <genarch/drivers/legacy/ia32/io.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/kbrd/kbrd.h>
58
#include <genarch/kbd/ns16550.h>
58
#include <genarch/srln/srln.h>
-
 
59
#include <genarch/drivers/i8042/i8042.h>
-
 
60
#include <genarch/drivers/ns16550/ns16550.h>
-
 
61
#include <arch/drivers/kbd.h>
59
#include <smp/smp.h>
62
#include <smp/smp.h>
60
#include <smp/ipi.h>
63
#include <smp/ipi.h>
61
#include <arch/atomic.h>
64
#include <arch/atomic.h>
62
#include <panic.h>
65
#include <panic.h>
63
#include <print.h>
66
#include <print.h>
64
#include <sysinfo/sysinfo.h>
67
#include <sysinfo/sysinfo.h>
65
#include <string.h>
68
#include <string.h>
66
 
69
 
67
/* NS16550 as a COM 1 */
70
/* NS16550 as a COM 1 */
68
#define NS16550_IRQ (4 + LEGACY_INTERRUPT_BASE)
71
#define NS16550_IRQ  (4 + LEGACY_INTERRUPT_BASE)
69
 
72
 
70
bootinfo_t *bootinfo;
73
bootinfo_t *bootinfo;
71
 
74
 
72
static uint64_t iosapic_base = 0xfec00000;
75
static uint64_t iosapic_base = 0xfec00000;
73
 
76
 
Line 125... Line 128...
125
        srlz_d();
128
        srlz_d();
126
    }
129
    }
127
 
130
 
128
}
131
}
129
 
132
 
130
 
-
 
131
void arch_post_mm_init(void)
133
void arch_post_mm_init(void)
132
{
134
{
133
    if (config.cpu_active == 1) {
135
    if (config.cpu_active == 1) {
134
        iosapic_init();
136
        iosapic_init();
135
        irq_init(INR_COUNT, INR_COUNT);
137
        irq_init(INR_COUNT, INR_COUNT);
136
#ifdef SKI
-
 
137
        ski_init_console();
-
 
138
#else
-
 
139
        ega_init(EGA_BASE, EGA_VIDEORAM);
-
 
140
#endif
-
 
141
    }
138
    }
142
    it_init();
139
    it_init(); 
143
       
-
 
144
}
140
}
145
 
141
 
146
void arch_post_cpu_init(void)
142
void arch_post_cpu_init(void)
147
{
143
{
148
}
144
}
Line 151... Line 147...
151
{
147
{
152
}
148
}
153
 
149
 
154
void arch_post_smp_init(void)
150
void arch_post_smp_init(void)
155
{
151
{
156
    /*
-
 
157
     * Create thread that polls keyboard.
-
 
158
     */
-
 
159
#ifdef SKI
152
#ifdef SKI
-
 
153
    indev_t *in;
160
    thread_t *t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll", true);
154
    in = skiin_init();
161
    if (!t)
155
    if (in)
162
        panic("Cannot create kkbdpoll.");
156
        srln_init(in);
163
    thread_ready(t);
157
    skiout_init();
164
#endif      
158
#endif
165
 
159
   
166
#ifdef I460GX
160
#ifdef CONFIG_EGA
167
    devno_t devno = device_assign_devno();
161
    ega_init(EGA_BASE, EGA_VIDEORAM);
168
    inr_t inr;
162
#endif
169
 
163
   
170
#ifdef CONFIG_NS16550
164
#ifdef CONFIG_NS16550
-
 
165
    devno_t devno_ns16550 = device_assign_devno();
171
    inr = NS16550_IRQ;
166
    indev_t *kbrdin_ns16550
172
    (void) ns16550_init((ns16550_t *)NS16550_BASE, devno, inr, NULL, NULL);
167
        = ns16550_init((ns16550_t *) NS16550_BASE, devno_ns16550, NS16550_IRQ, NULL, NULL);
-
 
168
    if (kbrdin_ns16550)
-
 
169
        srln_init(kbrdin_ns16550);
-
 
170
   
-
 
171
    sysinfo_set_item_val("kbd", NULL, true);
-
 
172
    sysinfo_set_item_val("kbd.devno", NULL, devno_ns16550);
-
 
173
    sysinfo_set_item_val("kbd.inr", NULL, NS16550_IRQ);
173
    sysinfo_set_item_val("kbd.type", NULL, KBD_NS16550);
174
    sysinfo_set_item_val("kbd.type", NULL, KBD_NS16550);
174
    sysinfo_set_item_val("kbd.address.physical", NULL,
175
    sysinfo_set_item_val("kbd.address.physical", NULL,
175
        (uintptr_t) NS16550_BASE);
176
        (uintptr_t) NS16550_BASE);
176
    sysinfo_set_item_val("kbd.address.kernel", NULL,
177
    sysinfo_set_item_val("kbd.address.kernel", NULL,
177
        (uintptr_t) NS16550_BASE);
178
        (uintptr_t) NS16550_BASE);
178
#else
179
#endif
-
 
180
   
179
    inr = IRQ_KBD;
181
#ifdef CONFIG_I8042
-
 
182
    devno_t devno_i8042 = device_assign_devno();
180
    (void) i8042_init((i8042_t *)I8042_BASE, devno, inr);
183
    indev_t *kbrdin_i8042 = i8042_init((i8042_t *) I8042_BASE, devno_i8042, IRQ_KBD);
-
 
184
    if (kbrdin_i8042)
-
 
185
        kbrd_init(kbrdin_i8042);
-
 
186
   
-
 
187
    sysinfo_set_item_val("kbd", NULL, true);
-
 
188
    sysinfo_set_item_val("kbd.devno", NULL, devno_i8042);
-
 
189
    sysinfo_set_item_val("kbd.inr", NULL, IRQ_KBD);
181
    sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY);
190
    sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY);
182
    sysinfo_set_item_val("kbd.address.physical", NULL,
191
    sysinfo_set_item_val("kbd.address.physical", NULL,
183
        (uintptr_t) I8042_BASE);
192
        (uintptr_t) I8042_BASE);
184
    sysinfo_set_item_val("kbd.address.kernel", NULL,
193
    sysinfo_set_item_val("kbd.address.kernel", NULL,
185
        (uintptr_t) I8042_BASE);
194
        (uintptr_t) I8042_BASE);
186
#endif
195
#endif
187
    sysinfo_set_item_val("kbd", NULL, true);
-
 
188
    sysinfo_set_item_val("kbd.devno", NULL, devno);
-
 
189
    sysinfo_set_item_val("kbd.inr", NULL, inr);
-
 
190
#endif
-
 
191
 
196
   
192
    sysinfo_set_item_val("ia64_iospace", NULL, true);
197
    sysinfo_set_item_val("ia64_iospace", NULL, true);
193
    sysinfo_set_item_val("ia64_iospace.address", NULL, true);
198
    sysinfo_set_item_val("ia64_iospace.address", NULL, true);
194
    sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, IO_OFFSET);
199
    sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, IO_OFFSET);
195
}
200
}
196
 
201