Subversion Repositories HelenOS

Rev

Rev 1896 | Rev 1911 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1896 Rev 1909
Line 66... Line 66...
66
    ofw_tree_property_t *prop;
66
    ofw_tree_property_t *prop;
67
    const char *name;
67
    const char *name;
68
   
68
   
69
    name = ofw_tree_node_name(node);
69
    name = ofw_tree_node_name(node);
70
   
70
   
-
 
71
    /*
-
 
72
     * Determine keyboard serial controller type.
-
 
73
     */
71
    if (strcmp(name, "zs") == 0)
74
    if (strcmp(name, "zs") == 0)
72
        kbd_type = KBD_Z8530;
75
        kbd_type = KBD_Z8530;
73
    else if (strcmp(name, "su") == 0)
76
    else if (strcmp(name, "su") == 0)
74
        kbd_type = KBD_NS16550;
77
        kbd_type = KBD_NS16550;
75
   
78
   
76
    if (kbd_type == KBD_UNKNOWN) {
79
    if (kbd_type == KBD_UNKNOWN) {
77
        printf("Unknown keyboard device.\n");
80
        printf("Unknown keyboard device.\n");
78
        return;
81
        return;
79
    }
82
    }
80
   
83
   
-
 
84
    /*
-
 
85
     * Read 'interrupts' property.
-
 
86
     */
-
 
87
    uint32_t interrupts;
-
 
88
    prop = ofw_tree_getprop(node, "interrupts");
-
 
89
    if (!prop || !prop->value)
-
 
90
        panic("Can't find \"interrupts\" property.\n");
-
 
91
    interrupts = *((uint32_t *) prop->value);
-
 
92
 
-
 
93
    /*
-
 
94
     * Read 'reg' property.
-
 
95
     */
81
    prop = ofw_tree_getprop(node, "reg");
96
    prop = ofw_tree_getprop(node, "reg");
82
    if (!prop)
97
    if (!prop || !prop->value)
83
        panic("Can't find \"reg\" property.\n");
98
        panic("Can't find \"reg\" property.\n");
84
   
99
   
85
    uintptr_t pa;
100
    uintptr_t pa;
86
    size_t size;
101
    size_t size;
-
 
102
    int ino;
87
   
103
   
88
    switch (kbd_type) {
104
    switch (kbd_type) {
89
    case KBD_Z8530:
105
    case KBD_Z8530:
90
        size = ((ofw_fhc_reg_t *) prop->value)->size;
106
        size = ((ofw_fhc_reg_t *) prop->value)->size;
91
        if (!ofw_fhc_apply_ranges(node->parent, ((ofw_fhc_reg_t *) prop->value) , &pa)) {
107
        if (!ofw_fhc_apply_ranges(node->parent, ((ofw_fhc_reg_t *) prop->value) , &pa)) {
92
            printf("Failed to determine keyboard address.\n");
108
            printf("Failed to determine keyboard address.\n");
93
            return;
109
            return;
94
        }
110
        }
-
 
111
        if (!ofw_fhc_map_interrupts(node->parent, ((ofw_fhc_reg_t *) prop->value), interrupts, &ino)) {
-
 
112
            printf("Failed to determine keyboard interrupts.\n");
-
 
113
            return;
-
 
114
        }
95
        break;
115
        break;
96
    case KBD_NS16550:
116
    case KBD_NS16550:
97
        size = ((ofw_ebus_reg_t *) prop->value)->size;
117
        size = ((ofw_ebus_reg_t *) prop->value)->size;
98
        if (!ofw_ebus_apply_ranges(node->parent, ((ofw_ebus_reg_t *) prop->value) , &pa)) {
118
        if (!ofw_ebus_apply_ranges(node->parent, ((ofw_ebus_reg_t *) prop->value) , &pa)) {
99
            printf("Failed to determine keyboard address.\n");
119
            printf("Failed to determine keyboard address.\n");
100
            return;
120
            return;
101
        }
121
        }
-
 
122
        if (!ofw_ebus_map_interrupts(node->parent, ((ofw_ebus_reg_t *) prop->value), interrupts, &ino)) {
-
 
123
            printf("Failed to determine keyboard interrupts.\n");
-
 
124
            return;
-
 
125
        }
102
        break;
126
        break;
103
    default:
127
    default:
104
        panic("Unexpected type.\n");
128
        panic("Unexpected type.\n");
105
    }
129
    }
106
   
130