Changeset 28ecadb in mainline for kernel/arch/sparc64/src/console.c


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/console.c

    r16529d5 r28ecadb  
    5454#include <arch/mm/tlb.h>
    5555#include <arch/boot/boot.h>
     56#include <genarch/ofw/ofw_tree.h>
    5657#include <arch.h>
     58#include <panic.h>
     59#include <print.h>
    5760
    5861#define KEYBOARD_POLL_PAUSE     50000   /* 50ms */
     
    6265{
    6366        stdin = NULL;
    64                
     67
     68        ofw_tree_node_t *aliases;
     69        ofw_tree_property_t *prop;
     70        ofw_tree_node_t *screen;
     71        ofw_tree_node_t *keyboard;
     72       
     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        if (!prop)
     79                panic("Can't find property \"screen\".\n");
     80        if (!prop->value)
     81                panic("Can't find screen alias.\n");
     82        screen = ofw_tree_lookup(prop->value);
     83        if (!screen)
     84                panic("Can't find %s\n", prop->value);
     85
    6586        fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height,
    6687                bootinfo.screen.bpp, bootinfo.screen.scanline, true);
     88       
     89        prop = ofw_tree_getprop(aliases, "keyboard");
     90        if (!prop)
     91                panic("Can't find property \"keyboard\".\n");
     92        if (!prop->value)
     93                panic("Can't find keyboard alias.\n");
     94        keyboard = ofw_tree_lookup(prop->value);
     95        if (!keyboard)
     96                panic("Can't find %s\n", prop->value);
    6797
    68 #ifdef KBD_ADDR_OVRD
    69         if (!bootinfo.keyboard.addr)
    70                 bootinfo.keyboard.addr = KBD_ADDR_OVRD;
    71 #endif
    72 
    73         if (bootinfo.keyboard.addr)
    74                 kbd_init();
     98        kbd_init(keyboard);
    7599}
    76100
     
    83107        thread_detach(THREAD);
    84108
    85         if (!bootinfo.keyboard.addr)
    86                 return;
    87                
    88         while (1) {
    89109#ifdef CONFIG_Z8530
     110        if (kbd_type == KBD_Z8530)
    90111                return;
    91112#endif
     113
     114        while (1) {
    92115#ifdef CONFIG_NS16550
    93                 ns16550_poll();
     116                if (kbd_type == KBD_NS16550)
     117                        ns16550_poll();
    94118#endif
    95119                thread_usleep(KEYBOARD_POLL_PAUSE);
     
    103127{
    104128#ifdef CONFIG_Z8530
    105         z8530_grab();
     129        if (kbd_type == KBD_Z8530)
     130                z8530_grab();
    106131#endif
    107132}
     
    113138{
    114139#ifdef CONFIG_Z8530
    115         z8530_release();
     140        if (kbd_type == KBD_Z8530)
     141                z8530_release();
    116142#endif
    117143}
Note: See TracChangeset for help on using the changeset viewer.