Changeset de88998 in mainline


Ignore:
Timestamp:
2009-03-11T19:46:35Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
05915ba4
Parents:
63b1537
Message:

Some additional fixes to the sgcn driver.

Location:
kernel/arch/sparc64
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/drivers/sgcn.h

    r63b1537 rde88998  
    3737
    3838#include <arch/types.h>
     39#include <console/chardev.h>
    3940
    4041/* number of bytes in the TOC magic, including the terminating '\0' */
     
    118119void sgcn_grab(void);
    119120void sgcn_release(void);
    120 void sgcn_init(void);
     121void sgcn_init(chardev_t *);
    121122
    122123#endif
  • kernel/arch/sparc64/src/console.c

    r63b1537 rde88998  
    3838#include <arch/drivers/scr.h>
    3939#include <arch/drivers/kbd.h>
    40 
    4140#include <arch/drivers/sgcn.h>
    42 
     41#include <genarch/srln/srln.h>
    4342#include <console/chardev.h>
    4443#include <console/console.h>
     
    9897static void serengeti_init(void)
    9998{
    100         sgcn_init();
     99        srln_init(stdin);
     100        sgcn_init(&srlnin);
    101101}
    102102
  • kernel/arch/sparc64/src/drivers/sgcn.c

    r63b1537 rde88998  
    7474 * which can be used. It is, however, used because when the kernel
    7575 * is running, the OBP buffer is not used by OBP any more but OBP
    76  * has already made neccessary arangements so that the output will
     76 * has already made necessary arrangements so that the output will
    7777 * be read from the OBP buffer and input will go to the OBP buffer.
    7878 * Therefore HelenOS needs to make no such arrangements any more.
     
    9797 */
    9898#define SGCN_BUFFER(type, offset) \
    99                                 ((type *) (sgcn_buffer_begin + (offset)))
     99        ((type *) (sgcn_buffer_begin + (offset)))
    100100
    101101/** Returns a pointer to the console buffer header. */
     
    146146chardev_t sgcn_io;
    147147
     148/** Address of the chardev, which is connected to SGCN. */
     149static chardev_t *sgcnout;
     150
    148151/**
    149152 * Set some sysinfo values (SRAM address and SRAM size).
     
    153156        sysinfo_set_item_val("sram.area.size", NULL, MAPPED_AREA_SIZE);
    154157        sysinfo_set_item_val("sram.address.physical", NULL,
    155                 sram_begin_physical);
     158            sram_begin_physical);
    156159}
    157160
     
    164167 * be set to the virtual address which maps to the SRAM physical
    165168 * address.
    166  *
    167  * It also registers the physical area of SRAM and sets some sysinfo
    168  * values (SRAM address and SRAM size).
    169169 */
    170170static void init_sram_begin(void)
     
    185185
    186186        sram_begin_physical = SBBC_START + SBBC_SRAM_OFFSET
    187                 + *((uint32_t *) iosram_toc->value);
     187            + *((uint32_t *) iosram_toc->value);
    188188        sram_begin = hw_map(sram_begin_physical, MAPPED_AREA_SIZE);
    189189       
     
    219219       
    220220        sysinfo_set_item_val("sram.buffer.offset", NULL,
    221                 SRAM_TOC->keys[i].offset);
     221            SRAM_TOC->keys[i].offset);
    222222}
    223223
     
    242242        /* we need pointers to volatile variables */
    243243        volatile char *buf_ptr = (volatile char *)
    244                 SGCN_BUFFER(char, SGCN_BUFFER_HEADER->out_wrptr);
     244            SGCN_BUFFER(char, SGCN_BUFFER_HEADER->out_wrptr);
    245245        volatile uint32_t *out_wrptr_ptr = &(SGCN_BUFFER_HEADER->out_wrptr);
    246246        volatile uint32_t *out_rdptr_ptr = &(SGCN_BUFFER_HEADER->out_rdptr);
     
    320320        uint32_t size = end - begin;
    321321
     322        if (kbd_disabled)
     323                return;
     324
    322325        spinlock_lock(&sgcn_input_lock);
    323        
    324         ipl_t ipl = interrupts_disable();
    325 
    326         if (kbd_disabled) {
    327                 interrupts_restore(ipl);
    328                 return;
    329         }
    330326       
    331327        /* we need pointers to volatile variables */
    332328        volatile char *buf_ptr = (volatile char *)
    333                 SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr);
     329            SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr);
    334330        volatile uint32_t *in_wrptr_ptr = &(SGCN_BUFFER_HEADER->in_wrptr);
    335331        volatile uint32_t *in_rdptr_ptr = &(SGCN_BUFFER_HEADER->in_rdptr);
     
    338334               
    339335                buf_ptr = (volatile char *)
    340                         SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr);
     336                    SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr);
    341337                char c = *buf_ptr;
    342338                *in_rdptr_ptr = (((*in_rdptr_ptr) - begin + 1) % size) + begin;
    343339                       
    344                 if (c == '\r') {
    345                         c = '\n';
    346                 }
    347                 chardev_push_character(&sgcn_io, c);   
     340                if (sgcnout)
     341                        chardev_push_character(sgcnout, c);     
    348342        }       
    349343
    350         interrupts_restore(ipl);       
    351344        spinlock_unlock(&sgcn_input_lock);
    352345}
     
    368361 * and sets it as a default input/output.
    369362 */
    370 void sgcn_init(void)
     363void sgcn_init(chardev_t *devout)
    371364{
    372365        sgcn_buffer_begin_init();
     
    384377       
    385378        chardev_initialize("sgcn_io", &sgcn_io, &sgcn_ops);
    386         stdin = &sgcn_io;
    387379        stdout = &sgcn_io;
     380
     381        sgcnout = devout;
    388382}
    389383
Note: See TracChangeset for help on using the changeset viewer.