Changeset 0ffa3ef5 in mainline for arch


Ignore:
Timestamp:
2006-07-10T20:57:30Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
11675207
Parents:
7f1c620
Message:

Sync OpenFirmware functionality with boot.
Random cleanup.

Location:
arch/sparc64
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • arch/sparc64/include/asm.h

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64       
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef __sparc64_ASM_H__
    36 #define __sparc64_ASM_H__
     35#ifndef KERN_sparc64_ASM_H_
     36#define KERN_sparc64_ASM_H_
    3737
    3838#include <typedefs.h>
     
    305305}
    306306
    307 
    308 
    309307void cpu_halt(void);
    310308void cpu_sleep(void);
     
    313311#endif
    314312
    315  /** @}
    316  */
    317 
     313/** @}
     314 */
  • arch/sparc64/include/atomic.h

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64       
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
     
    100100#endif
    101101
    102  /** @}
     102/** @}
    103103 */
    104 
  • arch/sparc64/include/barrier.h

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64       
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
     
    7070#endif
    7171
    72  /** @}
     72/** @}
    7373 */
    74 
  • arch/sparc64/include/console.h

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64       
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef __sparc64_CONSOLE_H__
    36 #define __sparc64_CONSOLE_H__
     35#ifndef KERN_sparc64_CONSOLE_H_
     36#define KERN_sparc64_CONSOLE_H_
    3737
    38 extern void kofwinput(void *arg);
    3938extern void kkbdpoll(void *arg);
    4039extern void ofw_sparc64_console_init(void);
     
    4342#endif
    4443
    45  /** @}
     44/** @}
    4645 */
    47 
  • arch/sparc64/include/drivers/fb.h

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64       
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef __sparc64_FB_H__
    36 #define __sparc64_FB_H__
     35#ifndef KERN_sparc64_FB_H_
     36#define KERN_sparc64_FB_H_
    3737
    3838#define FB_PHYS_ADDRESS         0x1c901000000ULL
     
    4545#endif
    4646
    47  /** @}
     47/** @}
    4848 */
    49 
  • arch/sparc64/include/drivers/i8042.h

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64       
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef __sparc64_I8042_H__
    36 #define __sparc64_I8042_H__
     35#ifndef KERN_sparc64_I8042_H_
     36#define KERN_sparc64_I8042_H_
    3737
    3838#include <arch/types.h>
     
    7272#endif
    7373
    74  /** @}
     74/** @}
    7575 */
    76 
  • arch/sparc64/include/elf.h

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64       
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
     
    4242#endif
    4343
    44  /** @}
     44/** @}
    4545 */
    46 
  • arch/sparc64/include/register.h

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64       
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef __sparc64_REGISTER_H__
    36 #define __sparc64_REGISTER_H__
     35#ifndef KERN_sparc64_REGISTER_H_
     36#define KERN_sparc64_REGISTER_H_
     37
     38#ifdef __ASM__
     39#define PSTATE_IE_BIT   2
     40#define PSTATE_AM_BIT   8
     41#else
    3742
    3843#include <arch/types.h>
     
    107112#endif
    108113
    109  /** @}
     114#endif
     115
     116/** @}
    110117 */
    111 
  • arch/sparc64/include/stack.h

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64       
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef __sparc64_STACK_H__
    36 #define __sparc64_STACK_H__
     35#ifndef KERN_sparc64_STACK_H_
     36#define KERN_sparc64_STACK_H_
    3737
    3838#define STACK_ITEM_SIZE                 8
     
    5353#endif
    5454
    55  /** @}
     55/** @}
    5656 */
    57 
  • arch/sparc64/include/trap/interrupt.h

    r7f1c620 r0ffa3ef5  
    7979/** @}
    8080 */
    81 
  • arch/sparc64/src/asm.S

    r7f1c620 r0ffa3ef5  
    2727#
    2828
     29#include <arch/stack.h>
     30#include <arch/register.h>
     31
    2932.text
    3033
     
    3538.global memcpy_to_uspace_failover_address
    3639.global memsetb
     40
    3741
    3842memcpy:
     
    5256        nop
    5357
     58.global ofw
     59ofw:
     60        save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
     61        set ofw_cif, %l0
     62        ldx [%l0], %l0
     63
     64        rdpr  %pstate, %l1
     65        and  %l1, ~PSTATE_AM_BIT, %l2
     66        wrpr  %l2, 0, %pstate
     67           
     68        jmpl %l0, %o7
     69        mov %i0, %o0
     70       
     71        wrpr  %l1, 0, %pstate
     72
     73        ret
     74        restore %o0, 0, %o0
  • arch/sparc64/src/console.c

    r7f1c620 r0ffa3ef5  
    5252
    5353static void ofw_sparc64_putchar(chardev_t *d, const char ch);
    54 static char ofw_sparc64_getchar(chardev_t *d);
    55 static void ofw_sparc64_suspend(chardev_t *d);
    56 static void ofw_sparc64_resume(chardev_t *d);
    57 
    58 mutex_t canwork;
    5954
    6055static volatile int ofw_console_active;
     
    6358static chardev_operations_t ofw_sparc64_console_ops = {
    6459        .write = ofw_sparc64_putchar,
    65         .read = ofw_sparc64_getchar,
    66         .resume = ofw_sparc64_resume,
    67         .suspend = ofw_sparc64_suspend
    6860};
    6961
     
    7264{
    7365        chardev_initialize("ofw_sparc64_console", &ofw_sparc64_console, &ofw_sparc64_console_ops);
    74         stdin = &ofw_sparc64_console;
     66        stdin = NULL;
    7567        stdout = &ofw_sparc64_console;
    76         mutex_initialize(&canwork);
    7768        ofw_console_active = 1;
    7869}
     
    9586void ofw_sparc64_putchar(chardev_t *d, const char ch)
    9687{
    97         pstate_reg_t pstate;
    98 
    99         /*
    100          * 32-bit OpenFirmware depends on PSTATE.AM bit set.
    101          */     
    102         pstate.value = pstate_read();
    103         pstate.am = true;
    104         pstate_write(pstate.value);
    105 
    10688        if (ch == '\n')
    10789                ofw_putchar('\r');
    10890        ofw_putchar(ch);
    109        
    110         pstate.am = false;
    111         pstate_write(pstate.value);
    112 }
    113 
    114 /** Read one character using OpenFirmware.
    115  *
    116  * The call is non-blocking.
    117  *
    118  * @param d Character device (ignored).
    119  * @return Character read or zero if no character was read.
    120  */
    121 char ofw_sparc64_getchar(chardev_t *d)
    122 {
    123         char ch;
    124         pstate_reg_t pstate;
    125 
    126         /*
    127          * 32-bit OpenFirmware depends on PSTATE.AM bit set.
    128          */     
    129         pstate.value = pstate_read();
    130         pstate.am = true;
    131         pstate_write(pstate.value);
    132 
    133         ch = ofw_getchar();
    134        
    135         pstate.am = false;
    136         pstate_write(pstate.value);
    137        
    138         return ch;
    139 }
    140 
    141 void ofw_sparc64_suspend(chardev_t *d)
    142 {
    143         mutex_lock(&canwork);
    144 }
    145 
    146 void ofw_sparc64_resume(chardev_t *d)
    147 {
    148         mutex_unlock(&canwork);
    149 }
    150 
    151 /** Kernel thread for pushing characters read from OFW to input buffer.
    152  *
    153  * @param arg Ignored.
    154  */
    155 void kofwinput(void *arg)
    156 {
    157 
    158         while (ofw_console_active) {
    159                 char ch = 0;
    160                
    161                 mutex_lock(&canwork);
    162                 mutex_unlock(&canwork);
    163                
    164                 ch = ofw_sparc64_getchar(NULL);
    165                 if (ch) {
    166                         if (ch == '\r')
    167                                 ch = '\n';
    168                         chardev_push_character(&ofw_sparc64_console, ch);
    169                 }
    170                 thread_usleep(KEYBOARD_POLL_PAUSE);
    171         }
    17291}
    17392
  • arch/sparc64/src/drivers/i8042.c

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64       
     29/** @addtogroup sparc64
    3030 * @{
    3131 */
     
    4646}
    4747
    48  /** @}
     48/** @}
    4949 */
    50 
  • arch/sparc64/src/mm/frame.c

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64mm     
     29/** @addtogroup sparc64mm       
    3030 * @{
    3131 */
     
    5252}
    5353
    54  /** @}
     54/** @}
    5555 */
    56 
  • arch/sparc64/src/mm/memory_init.c

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64mm     
     29/** @addtogroup sparc64mm       
    3030 * @{
    3131 */
     
    4242}
    4343
    44  /** @}
     44/** @}
    4545 */
    4646
  • arch/sparc64/src/proc/scheduler.c

    r7f1c620 r0ffa3ef5  
    2727 */
    2828
    29  /** @addtogroup sparc64proc
     29/** @addtogroup sparc64proc
    3030 * @{
    3131 */
     
    8080}
    8181
    82  /** @}
     82/** @}
    8383 */
    84 
  • arch/sparc64/src/sparc64.c

    r7f1c620 r0ffa3ef5  
    4141#include <console/console.h>
    4242
     43#include <print.h>
     44#include <genarch/ofw/ofw.h>
     45#include <arch/asm.h>
     46#include <arch/register.h>
    4347void arch_pre_mm_init(void)
    4448{
    4549        interrupts_disable();
    4650        ofw_sparc64_console_init();
     51
    4752        trap_init();
    4853        tick_init();
     
    6166{
    6267        thread_t *t;
    63 
    64         /*
    65          * Create thread that reads characters from OFW's input.
    66          */
    67         t = thread_create(kofwinput, NULL, TASK, 0, "kofwinput");
    68         if (!t)
    69                 panic("cannot create kofwinput\n");
    70         thread_ready(t);
    7168
    7269        /*
  • arch/sparc64/src/start.S

    r7f1c620 r0ffa3ef5  
    2828
    2929#include <arch/boot/boot.h>
     30#include <arch/register.h>
    3031
    3132.register %g2, #scratch
     
    3839/*
    3940 * Here is where the kernel is passed control.
    40  * The code must be position independent until
    41  * the kernel relocates itself to its VMA.
    4241 */
    4342
     
    4645        flushw                          ! flush all but the active register window
    4746
    48         set ofw, %l0
     47        rdpr %pstate, %l0
     48        and %l0, ~PSTATE_AM_BIT, %l0
     49        wrpr %l0, 0, %pstate
     50
     51        set ofw_cif, %l0
    4952
    5053        call ofw_init
Note: See TracChangeset for help on using the changeset viewer.