Rev 3514 | Rev 3618 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3514 | Rev 3549 | ||
|---|---|---|---|
| Line 54... | Line 54... | ||
| 54 | #include <proc/thread.h> |
54 | #include <proc/thread.h> |
| 55 | #include <arch/mm/tlb.h> |
55 | #include <arch/mm/tlb.h> |
| 56 | #include <genarch/ofw/ofw_tree.h> |
56 | #include <genarch/ofw/ofw_tree.h> |
| 57 | #include <arch.h> |
57 | #include <arch.h> |
| 58 | #include <panic.h> |
58 | #include <panic.h> |
| - | 59 | #include <func.h> |
|
| 59 | #include <print.h> |
60 | #include <print.h> |
| 60 | 61 | ||
| 61 | #define KEYBOARD_POLL_PAUSE 50000 /* 50ms */ |
62 | #define KEYBOARD_POLL_PAUSE 50000 /* 50ms */ |
| 62 | 63 | ||
| - | 64 | /** |
|
| 63 | /** Initialize kernel console to use framebuffer and keyboard directly. */ |
65 | * Initialize kernel console to use framebuffer and keyboard directly. |
| - | 66 | * Called on UltraSPARC64 machines with standard keyboard and framebuffer. |
|
| - | 67 | * |
|
| - | 68 | * @param aliases the "/aliases" OBP node |
|
| - | 69 | */ |
|
| 64 | void standalone_sparc64_console_init(void) |
70 | static void standard_console_init(ofw_tree_node_t *aliases) |
| 65 | { |
71 | { |
| 66 | stdin = NULL; |
72 | stdin = NULL; |
| 67 | 73 | ||
| 68 | ofw_tree_node_t *aliases; |
- | |
| 69 | ofw_tree_property_t *prop; |
74 | ofw_tree_property_t *prop; |
| 70 | ofw_tree_node_t *screen; |
75 | ofw_tree_node_t *screen; |
| 71 | ofw_tree_node_t *keyboard; |
76 | ofw_tree_node_t *keyboard; |
| 72 | 77 | ||
| 73 | aliases = ofw_tree_lookup("/aliases"); |
- | |
| 74 | if (!aliases) |
- | |
| 75 | panic("Can't find /aliases.\n"); |
- | |
| 76 | - | ||
| 77 | prop = ofw_tree_getprop(aliases, "screen"); |
78 | prop = ofw_tree_getprop(aliases, "screen"); |
| 78 | if (!prop) |
79 | if (!prop) |
| 79 | panic("Can't find property \"screen\".\n"); |
80 | panic("Can't find property \"screen\".\n"); |
| 80 | if (!prop->value) |
81 | if (!prop->value) |
| 81 | panic("Can't find screen alias.\n"); |
82 | panic("Can't find screen alias.\n"); |
| Line 95... | Line 96... | ||
| 95 | panic("Can't find %s\n", prop->value); |
96 | panic("Can't find %s\n", prop->value); |
| 96 | 97 | ||
| 97 | kbd_init(keyboard); |
98 | kbd_init(keyboard); |
| 98 | } |
99 | } |
| 99 | 100 | ||
| - | 101 | /** Initilize I/O on the Serengeti machine. */ |
|
| - | 102 | static void serengeti_init(void) |
|
| - | 103 | { |
|
| - | 104 | sgcn_init(); |
|
| - | 105 | } |
|
| - | 106 | ||
| - | 107 | /** |
|
| - | 108 | * Initialize input/output. Auto-detects the type of machine |
|
| - | 109 | * and calls the appropriate I/O init routine. |
|
| - | 110 | */ |
|
| - | 111 | void standalone_sparc64_console_init(void) |
|
| - | 112 | { |
|
| - | 113 | ofw_tree_node_t *aliases; |
|
| - | 114 | ofw_tree_property_t *prop; |
|
| - | 115 | ||
| - | 116 | aliases = ofw_tree_lookup("/aliases"); |
|
| - | 117 | if (!aliases) |
|
| - | 118 | panic("Can't find /aliases.\n"); |
|
| - | 119 | ||
| - | 120 | /* "def-cn" = "default console" */ |
|
| - | 121 | prop = ofw_tree_getprop(aliases, "def-cn"); |
|
| - | 122 | ||
| - | 123 | if ((!prop) || (!prop->value) || (strcmp(prop->value, "/sgcn") != 0)) { |
|
| - | 124 | standard_console_init(aliases); |
|
| - | 125 | } else { |
|
| - | 126 | serengeti_init(); |
|
| - | 127 | } |
|
| - | 128 | } |
|
| - | 129 | ||
| - | 130 | ||
| 100 | /** Kernel thread for polling keyboard. |
131 | /** Kernel thread for polling keyboard. |
| 101 | * |
132 | * |
| 102 | * @param arg Ignored. |
133 | * @param arg Ignored. |
| 103 | */ |
134 | */ |
| 104 | void kkbdpoll(void *arg) |
135 | void kkbdpoll(void *arg) |
| Line 117... | Line 148... | ||
| 117 | while (1) { |
148 | while (1) { |
| 118 | #ifdef CONFIG_NS16550 |
149 | #ifdef CONFIG_NS16550 |
| 119 | if (kbd_type == KBD_NS16550) |
150 | if (kbd_type == KBD_NS16550) |
| 120 | ns16550_poll(); |
151 | ns16550_poll(); |
| 121 | #endif |
152 | #endif |
| - | 153 | #ifdef CONFIG_SGCN |
|
| - | 154 | if (kbd_type == KBD_SGCN) |
|
| 122 | sgcn_poll(); |
155 | sgcn_poll(); |
| - | 156 | #endif |
|
| - | 157 | ||
| 123 | thread_usleep(KEYBOARD_POLL_PAUSE); |
158 | thread_usleep(KEYBOARD_POLL_PAUSE); |
| 124 | } |
159 | } |
| 125 | } |
160 | } |
| 126 | 161 | ||
| 127 | /** Acquire console back for kernel |
162 | /** Acquire console back for kernel |
| Line 138... | Line 173... | ||
| 138 | #ifdef CONFIG_NS16550 |
173 | #ifdef CONFIG_NS16550 |
| 139 | case KBD_NS16550: |
174 | case KBD_NS16550: |
| 140 | ns16550_grab(); |
175 | ns16550_grab(); |
| 141 | break; |
176 | break; |
| 142 | #endif |
177 | #endif |
| - | 178 | #ifdef CONFIG_SGCN |
|
| - | 179 | case KBD_SGCN: |
|
| - | 180 | sgcn_grab(); |
|
| - | 181 | break; |
|
| - | 182 | #endif |
|
| 143 | default: |
183 | default: |
| 144 | break; |
184 | break; |
| 145 | } |
185 | } |
| 146 | } |
186 | } |
| 147 | 187 | ||