Changeset 6a44ee4 in mainline for kernel/arch/sparc64/src/drivers/kbd.c
- Timestamp:
- 2011-07-20T15:26:21Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- efcebe1
- Parents:
- 25bef0ff (diff), a701812 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/drivers/kbd.c
r25bef0ff r6a44ee4 35 35 #include <arch/drivers/kbd.h> 36 36 #include <genarch/ofw/ofw_tree.h> 37 #include <genarch/ofw/fhc.h>38 37 #include <genarch/ofw/ebus.h> 39 38 #include <console/console.h> … … 51 50 #endif 52 51 53 #ifdef CONFIG_Z853054 #include <genarch/drivers/z8530/z8530.h>55 #endif56 57 52 #ifdef CONFIG_NS16550 58 53 #include <genarch/drivers/ns16550/ns16550.h> … … 60 55 61 56 #ifdef CONFIG_SUN_KBD 62 63 #ifdef CONFIG_Z853064 65 static bool kbd_z8530_init(ofw_tree_node_t *node)66 {67 const char *name = ofw_tree_node_name(node);68 69 if (str_cmp(name, "zs") != 0)70 return false;71 72 /*73 * Read 'interrupts' property.74 */75 ofw_tree_property_t *prop = ofw_tree_getprop(node, "interrupts");76 if ((!prop) || (!prop->value)) {77 printf("z8530: Unable to find interrupts property\n");78 return false;79 }80 81 uint32_t interrupts = *((uint32_t *) prop->value);82 83 /*84 * Read 'reg' property.85 */86 prop = ofw_tree_getprop(node, "reg");87 if ((!prop) || (!prop->value)) {88 printf("z8530: Unable to find reg property\n");89 return false;90 }91 92 size_t size = ((ofw_fhc_reg_t *) prop->value)->size;93 94 uintptr_t pa;95 if (!ofw_fhc_apply_ranges(node->parent,96 ((ofw_fhc_reg_t *) prop->value), &pa)) {97 printf("z8530: Failed to determine address\n");98 return false;99 }100 101 inr_t inr;102 cir_t cir;103 void *cir_arg;104 if (!ofw_fhc_map_interrupt(node->parent,105 ((ofw_fhc_reg_t *) prop->value), interrupts, &inr, &cir,106 &cir_arg)) {107 printf("z8530: Failed to determine interrupt\n");108 return false;109 }110 111 /*112 * We need to pass aligned address to hw_map().113 * However, the physical keyboard address can114 * be pretty much unaligned, depending on the115 * underlying controller.116 */117 uintptr_t aligned_addr = ALIGN_DOWN(pa, PAGE_SIZE);118 size_t offset = pa - aligned_addr;119 120 z8530_t *z8530 = (z8530_t *)121 (hw_map(aligned_addr, offset + size) + offset);122 123 z8530_instance_t *z8530_instance = z8530_init(z8530, inr, cir, cir_arg);124 if (z8530_instance) {125 kbrd_instance_t *kbrd_instance = kbrd_init();126 if (kbrd_instance) {127 indev_t *sink = stdin_wire();128 indev_t *kbrd = kbrd_wire(kbrd_instance, sink);129 z8530_wire(z8530_instance, kbrd);130 }131 }132 133 /*134 * This is the necessary evil until the userspace drivers are135 * entirely self-sufficient.136 */137 sysinfo_set_item_val("kbd", NULL, true);138 sysinfo_set_item_val("kbd.inr", NULL, inr);139 sysinfo_set_item_val("kbd.address.kernel", NULL,140 (uintptr_t) z8530);141 sysinfo_set_item_val("kbd.address.physical", NULL, pa);142 sysinfo_set_item_val("kbd.type.z8530", NULL, true);143 144 return true;145 }146 147 #endif /* CONFIG_Z8530 */148 57 149 58 #ifdef CONFIG_NS16550 … … 243 152 void kbd_init(ofw_tree_node_t *node) 244 153 { 245 #ifdef CONFIG_Z8530246 kbd_z8530_init(node);247 #endif248 249 154 #ifdef CONFIG_NS16550 250 155 kbd_ns16550_init(node);
Note:
See TracChangeset
for help on using the changeset viewer.