Changeset 28ecadb in mainline for kernel/genarch/src


Ignore:
Timestamp:
2006-09-22T21:44:54Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d684e4
Parents:
16529d5
Message:

Convert sparc64 to detect keyboard and determine
its physical address by walking the memory representation
of the OpenFirmware device tree.

Add bus-specific functions that know how to apply the
"ranges" property to one component of the "reg" property.
Buses supported so far include FHC, EBUS and PCI.

Location:
kernel/genarch/src
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/kbd/i8042.c

    r16529d5 r28ecadb  
    8181static void i8042_resume(chardev_t *);
    8282
    83 chardev_t kbrd;
    8483static chardev_operations_t ops = {
    8584        .suspend = i8042_suspend,
    8685        .resume = i8042_resume,
    87         .read = key_read
     86        .read = i8042_key_read
    8887};
    8988
     
    174173}
    175174
    176 char key_read(chardev_t *d)
     175char i8042_key_read(chardev_t *d)
    177176{
    178177        char ch;       
  • kernel/genarch/src/kbd/key.c

    r16529d5 r28ecadb  
    5454#define ACTIVE_READ_BUFF_SIZE 16        /* Must be power of 2 */
    5555
     56chardev_t kbrd;
     57
    5658static uint8_t active_read_buff[ACTIVE_READ_BUFF_SIZE];
    5759
  • kernel/genarch/src/kbd/ns16550.c

    r16529d5 r28ecadb  
    6060static void ns16550_resume(chardev_t *);
    6161
    62 chardev_t kbrd;
    6362static chardev_operations_t ops = {
    6463        .suspend = ns16550_suspend,
    6564        .resume = ns16550_resume,
    66         .read = key_read
     65        .read = ns16550_key_read
    6766};
    6867
     
    119118}
    120119
    121 char key_read(chardev_t *d)
     120char ns16550_key_read(chardev_t *d)
    122121{
    123122        char ch;       
  • kernel/genarch/src/kbd/z8530.c

    r16529d5 r28ecadb  
    6363static void z8530_resume(chardev_t *);
    6464
    65 chardev_t kbrd;
    6665static chardev_operations_t ops = {
    6766        .suspend = z8530_suspend,
    6867        .resume = z8530_resume,
    69         .read = key_read
     68        .read = z8530_key_read
    7069};
    7170
     
    142141}
    143142
    144 char key_read(chardev_t *d)
     143char z8530_key_read(chardev_t *d)
    145144{
    146145        char ch;       
  • kernel/genarch/src/ofw/ofw_tree.c

    r16529d5 r28ecadb  
    5252}
    5353
     54/** Get OpenFirmware node property.
     55 *
     56 * @param node Node in which to lookup the property.
     57 * @param name Name of the property.
     58 *
     59 * @return Pointer to the property structure or NULL if no such property.
     60 */
     61ofw_tree_property_t *ofw_tree_getprop(const ofw_tree_node_t *node, const char *name)
     62{
     63        int i;
     64       
     65        for (i = 0; i < node->properties; i++) {
     66                if (strcmp(node->property[i].name, name) == 0)
     67                        return &node->property[i];
     68        }
     69
     70        return NULL;
     71}
     72
    5473/** Return value of the 'name' property.
    5574 *
     
    6079const char *ofw_tree_node_name(const ofw_tree_node_t *node)
    6180{
    62         int i;
     81        ofw_tree_property_t *prop;
    6382       
    64         for (i = 0; i < node->properties; i++) {
    65                 if (strncmp(node->property[i].name, "name", strlen("name")) == 0) {
    66                         if (node->property[i].size < 2)
    67                                 panic("Invalid name property.\n");
    68                         return node->property[i].value;
    69                 }
    70         }
     83        prop = ofw_tree_getprop(node, "name");
     84        if (!prop)
     85                panic("Node without name property.\n");
     86               
     87        if (prop->size < 2)
     88                panic("Invalid name property.\n");
    7189       
    72         panic("Node without name property.\n");
     90        return prop->value;
    7391}
    7492
     
    7694 *
    7795 * @param node Node whose child is being looked up.
    78  * @param da_name Disambigued name of the child being looked up.
     96 * @param name Name of the child being looked up.
    7997 *
    8098 * @return NULL if there is no such child or pointer to the matching child node.
    8199 */
    82 static ofw_tree_node_t *ofw_tree_find_child(ofw_tree_node_t *node, const char *da_name)
     100static ofw_tree_node_t *ofw_tree_find_child(ofw_tree_node_t *node, const char *name)
    83101{
    84102        ofw_tree_node_t *cur;
    85103       
     104        /*
     105         * Try to find the disambigued name.
     106         */
    86107        for (cur = node->child; cur; cur = cur->peer) {
    87                 if (strncmp(cur->da_name, da_name, strlen(da_name)) == 0)
     108                if (strcmp(cur->da_name, name) == 0)
    88109                        return cur;
    89110        }
    90111       
     112        /*
     113         * Disambigued name not found.
     114         * Lets try our luck with possibly ambiguous "name" property.
     115         *
     116         * We need to do this because paths stored in "/aliases"
     117         * are not always fully-qualified.
     118         */
     119        for (cur = node->child; cur; cur = cur->peer) {
     120                if (strcmp(ofw_tree_node_name(cur), name) == 0)
     121                        return cur;
     122        }
     123               
    91124        return NULL;
    92125}
Note: See TracChangeset for help on using the changeset viewer.