Rev 3978 | Rev 4011 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3978 | Rev 3982 | ||
---|---|---|---|
Line 64... | Line 64... | ||
64 | uintptr_t aligned_addr; |
64 | uintptr_t aligned_addr; |
65 | ofw_tree_property_t *prop; |
65 | ofw_tree_property_t *prop; |
66 | const char *name; |
66 | const char *name; |
67 | cir_t cir; |
67 | cir_t cir; |
68 | void *cir_arg; |
68 | void *cir_arg; |
- | 69 | ||
- | 70 | #ifdef CONFIG_NS16550 |
|
- | 71 | ns16550_t *ns16550; |
|
- | 72 | #endif |
|
- | 73 | #ifdef CONFIG_Z8530 |
|
- | 74 | z8530_t *z8530; |
|
- | 75 | #endif |
|
69 | 76 | ||
70 | name = ofw_tree_node_name(node); |
77 | name = ofw_tree_node_name(node); |
71 | 78 | ||
72 | /* |
79 | /* |
73 | * Determine keyboard serial controller type. |
80 | * Determine keyboard serial controller type. |
Line 98... | Line 105... | ||
98 | if ((!prop) || (!prop->value)) |
105 | if ((!prop) || (!prop->value)) |
99 | panic("Cannot find 'reg' property."); |
106 | panic("Cannot find 'reg' property."); |
100 | 107 | ||
101 | uintptr_t pa; |
108 | uintptr_t pa; |
102 | size_t size; |
109 | size_t size; |
- | 110 | devno_t devno; |
|
103 | inr_t inr; |
111 | inr_t inr; |
104 | 112 | ||
105 | switch (kbd_type) { |
113 | switch (kbd_type) { |
106 | case KBD_Z8530: |
114 | case KBD_Z8530: |
107 | size = ((ofw_fhc_reg_t *) prop->value)->size; |
115 | size = ((ofw_fhc_reg_t *) prop->value)->size; |
Line 146... | Line 154... | ||
146 | offset = pa - aligned_addr; |
154 | offset = pa - aligned_addr; |
147 | 155 | ||
148 | switch (kbd_type) { |
156 | switch (kbd_type) { |
149 | #ifdef CONFIG_Z8530 |
157 | #ifdef CONFIG_Z8530 |
150 | case KBD_Z8530: |
158 | case KBD_Z8530: |
- | 159 | devno = device_assign_devno(); |
|
- | 160 | z8530 = (z8530_t *) hw_map(aligned_addr, offset + size) + |
|
- | 161 | offset; |
|
151 | (void) z8530_init((z8530_t *) hw_map(aligned_addr, |
162 | (void) z8530_init(z8530, devno, inr, cir, cir_arg); |
- | 163 | ||
- | 164 | /* |
|
152 | offset + size) + offset, device_assign_devno(), inr, cir, |
165 | * This is the necessary evil until the userspace drivers are |
- | 166 | * entirely self-sufficient. |
|
- | 167 | */ |
|
- | 168 | sysinfo_set_item_val("kbd", NULL, true); |
|
- | 169 | sysinfo_set_item_val("kbd.type", NULL, KBD_Z8530); |
|
- | 170 | sysinfo_set_item_val("kbd.devno", NULL, devno); |
|
- | 171 | sysinfo_set_item_val("kbd.inr", NULL, inr); |
|
- | 172 | sysinfo_set_item_val("kbd.address.virtual", NULL, |
|
153 | cir_arg); |
173 | (uintptr_t) z8530); |
- | 174 | sysinfo_set_item_val("kbd.address.physical", NULL, pa); |
|
154 | break; |
175 | break; |
155 | #endif |
176 | #endif |
156 | #ifdef CONFIG_NS16550 |
177 | #ifdef CONFIG_NS16550 |
157 | case KBD_NS16550: |
178 | case KBD_NS16550: |
- | 179 | devno = device_assign_devno(); |
|
- | 180 | ns16550 = (ns16550_t *) hw_map(aligned_addr, offset + size) + |
|
- | 181 | offset; |
|
158 | (void) ns16550_init((ns16550_t *) (hw_map(aligned_addr, |
182 | (void) ns16550_init(ns16550, devno, inr, cir, cir_arg); |
- | 183 | ||
- | 184 | /* |
|
159 | offset + size) + offset), device_assign_devno(), inr, cir, |
185 | * This is the necessary evil until the userspace driver is |
- | 186 | * entirely self-sufficient. |
|
- | 187 | */ |
|
- | 188 | sysinfo_set_item_val("kbd", NULL, true); |
|
- | 189 | sysinfo_set_item_val("kbd.type", NULL, KBD_NS16550); |
|
- | 190 | sysinfo_set_item_val("kbd.devno", NULL, devno); |
|
- | 191 | sysinfo_set_item_val("kbd.inr", NULL, inr); |
|
- | 192 | sysinfo_set_item_val("kbd.address.virtual", NULL, |
|
160 | cir_arg); |
193 | (uintptr_t) ns16550); |
- | 194 | sysinfo_set_item_val("kbd.address.physical", NULL, pa); |
|
161 | break; |
195 | break; |
162 | #endif |
196 | #endif |
163 | default: |
197 | default: |
164 | printf("Kernel is not compiled with the necessary keyboard " |
198 | printf("Kernel is not compiled with the necessary keyboard " |
165 | "driver this machine requires.\n"); |
199 | "driver this machine requires.\n"); |