Subversion Repositories HelenOS

Rev

Rev 4073 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4073 Rev 4130
Line 63... Line 63...
63
#include <func.h>
63
#include <func.h>
64
#include <print.h>
64
#include <print.h>
65
 
65
 
66
#define KEYBOARD_POLL_PAUSE 50000   /* 50ms */
66
#define KEYBOARD_POLL_PAUSE 50000   /* 50ms */
67
 
67
 
68
#if defined (SUN4U)
-
 
69
 
-
 
70
/**
-
 
71
 * Initialize kernel console to use framebuffer and keyboard directly.
-
 
72
 * Called on UltraSPARC machines with standard keyboard and framebuffer.
-
 
73
 *
-
 
74
 * @param aliases   the "/aliases" OBP node
-
 
75
 */
-
 
76
static void standard_console_init(ofw_tree_node_t *aliases)
-
 
77
{
-
 
78
    stdin = NULL;
-
 
79
 
-
 
80
    ofw_tree_property_t *prop;
-
 
81
    ofw_tree_node_t *screen;
-
 
82
    ofw_tree_node_t *keyboard;
-
 
83
   
-
 
84
    prop = ofw_tree_getprop(aliases, "screen");
-
 
85
    if (!prop)
-
 
86
        panic("Can't find property \"screen\".\n");
-
 
87
    if (!prop->value)
-
 
88
        panic("Can't find screen alias.\n");
-
 
89
    screen = ofw_tree_lookup(prop->value);
-
 
90
    if (!screen)
-
 
91
        panic("Can't find %s\n", prop->value);
-
 
92
 
-
 
93
    scr_init(screen);
-
 
94
 
-
 
95
    prop = ofw_tree_getprop(aliases, "keyboard");
-
 
96
    if (!prop)
-
 
97
        panic("Can't find property \"keyboard\".\n");
-
 
98
    if (!prop->value)
-
 
99
        panic("Can't find keyboard alias.\n");
-
 
100
    keyboard = ofw_tree_lookup(prop->value);
-
 
101
    if (!keyboard)
-
 
102
        panic("Can't find %s\n", prop->value);
-
 
103
 
-
 
104
    kbd_init(keyboard);
-
 
105
}
-
 
106
 
-
 
107
/** Initilize I/O on the Serengeti machine. */
-
 
108
static void serengeti_init(void)
-
 
109
{
-
 
110
    sgcn_init();
-
 
111
}
-
 
112
 
-
 
113
#endif
-
 
114
 
-
 
115
/**
-
 
116
 * Initialize input/output. Auto-detects the type of machine
-
 
117
 * and calls the appropriate I/O init routine.
-
 
118
 */
-
 
119
void standalone_sparc64_console_init(void)
-
 
120
{
-
 
121
#if defined (SUN4U)
-
 
122
    ofw_tree_node_t *aliases;
-
 
123
    ofw_tree_property_t *prop;
-
 
124
   
-
 
125
    aliases = ofw_tree_lookup("/aliases");
-
 
126
    if (!aliases)
-
 
127
        panic("Can't find /aliases.\n");
-
 
128
   
-
 
129
    /* "def-cn" = "default console" */
-
 
130
    prop = ofw_tree_getprop(aliases, "def-cn");
-
 
131
   
-
 
132
    if ((!prop) || (!prop->value) || (strcmp(prop->value, "/sgcn") != 0)) {
-
 
133
        standard_console_init(aliases);
-
 
134
    } else {
-
 
135
        serengeti_init();
-
 
136
    }
-
 
137
#elif defined (SUN4V)
-
 
138
    niagara_init();
-
 
139
#endif
-
 
140
}
-
 
141
 
-
 
142
 
-
 
143
/** Kernel thread for polling keyboard.
68
/** Kernel thread for polling keyboard.
144
 *
69
 *
145
 * @param arg Ignored.
70
 * @param arg Ignored.
146
 */
71
 */
147
void kkbdpoll(void *arg)
72
void kkbdpoll(void *arg)
Line 184... Line 109...
184
#endif
109
#endif
185
        thread_usleep(KEYBOARD_POLL_PAUSE);
110
        thread_usleep(KEYBOARD_POLL_PAUSE);
186
    }
111
    }
187
}
112
}
188
 
113
 
189
/** Acquire console back for kernel
-
 
190
 *
-
 
191
 */
-
 
192
void arch_grab_console(void)
-
 
193
{
-
 
194
    scr_redraw();
-
 
195
    switch (kbd_type) {
-
 
196
#ifdef CONFIG_Z8530
-
 
197
    case KBD_Z8530:
-
 
198
        z8530_grab();
-
 
199
        break;
-
 
200
#endif
-
 
201
#ifdef CONFIG_NS16550
-
 
202
    case KBD_NS16550:
-
 
203
        ns16550_grab();
-
 
204
        break;
-
 
205
#endif
-
 
206
#ifdef CONFIG_SGCN
-
 
207
    case KBD_SGCN:
-
 
208
        sgcn_grab();
-
 
209
        break;
-
 
210
#endif
-
 
211
#ifdef SUN4V
-
 
212
    case KBD_SUN4V:
-
 
213
        niagara_grab();
-
 
214
        break;
-
 
215
#endif
-
 
216
    default:
-
 
217
        break;
-
 
218
    }
-
 
219
}
-
 
220
 
-
 
221
/** Return console to userspace
-
 
222
 *
-
 
223
 */
-
 
224
void arch_release_console(void)
-
 
225
{
-
 
226
    switch (kbd_type) {
-
 
227
#ifdef CONFIG_Z8530
-
 
228
    case KBD_Z8530:
-
 
229
        z8530_release();
-
 
230
        break;
-
 
231
#endif
-
 
232
#ifdef CONFIG_NS16550
-
 
233
    case KBD_NS16550:
-
 
234
        ns16550_release();
-
 
235
        break;
-
 
236
#endif
-
 
237
#ifdef CONFIG_SGCN
-
 
238
    case KBD_SGCN:
-
 
239
        sgcn_release();
-
 
240
        break;
-
 
241
#endif
-
 
242
#ifdef SUN4V
-
 
243
    case KBD_SUN4V:
-
 
244
        niagara_release();
-
 
245
        break;
-
 
246
#endif
-
 
247
    default:
-
 
248
        break;
-
 
249
    }
-
 
250
}
-
 
251
 
114
 
252
/** @}
115
/** @}
253
 */
116
 */