Changeset 94d614e in mainline for kernel/arch/sparc64/src


Ignore:
Timestamp:
2006-07-13T17:32:38Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a5f76758
Parents:
63cda71
Message:

Remove OpenFirmware calls from kernel/ entirely.

Switch the sparc64 port to use bootinfo.

Copy memcpy from boot/ to sparc64 kernel/ and
adjust it for memcpy_from/to_uspace.

Location:
kernel/arch/sparc64/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/asm.S

    r63cda71 r94d614e  
    4343memcpy_from_uspace:
    4444memcpy_to_uspace:
     45        .register       %g2, #scratch
     46        .register       %g3, #scratch
     47        add     %o1, 7, %g1
     48        and     %g1, -8, %g1
     49        cmp     %o1, %g1
     50        be,pn   %xcc, 3f
     51        add     %o0, 7, %g1
     52        mov     0, %g3
     530:
     54        brz,pn  %o2, 2f
     55        mov     0, %g2
     561:
     57        ldub    [%g3 + %o1], %g1
     58        add     %g2, 1, %g2
     59        cmp     %o2, %g2
     60        stb     %g1, [%g3 + %o0]
     61        bne,pt  %xcc, 1b
     62        mov     %g2, %g3
     632:
     64        jmp     %o7 + 8                 ! exit point
     65        mov     %o1, %o0
     663:
     67        and     %g1, -8, %g1
     68        cmp     %o0, %g1
     69        bne,pt  %xcc, 0b
     70        mov     0, %g3
     71        srlx    %o2, 3, %g4
     72        brz,pn  %g4, 5f
     73        mov     0, %g5
     744:
     75        sllx    %g3, 3, %g2
     76        add     %g5, 1, %g3
     77        ldx     [%o1 + %g2], %g1
     78        mov     %g3, %g5
     79        cmp     %g4, %g3
     80        bne,pt  %xcc, 4b
     81        stx     %g1, [%o0 + %g2]
     825:
     83        and     %o2, 7, %o2
     84        brz,pn  %o2, 2b
     85        sllx    %g4, 3, %g1
     86        mov     0, %g2
     87        add     %g1, %o0, %o0
     88        add     %g1, %o1, %g4
     89        mov     0, %g3
     906:
     91        ldub    [%g2 + %g4], %g1
     92        stb     %g1, [%g2 + %o0]
     93        add     %g3, 1, %g2
     94        cmp     %o2, %g2
     95        bne,pt  %xcc, 6b
     96        mov     %g2, %g3
    4597
    46         b _memcpy
    47         nop
     98        jmp     %o7 + 8                 ! exit point
     99        mov     %o1, %o0
    48100
    49101memcpy_from_uspace_failover_address:
    50102memcpy_to_uspace_failover_address:
    51         b memcpy_from_uspace_failover_address
    52         nop
     103        jmp     %o7 + 8                 ! exit point
     104        mov     %g0, %o0                ! return 0 on failure
    53105
    54106memsetb:
    55107        b _memsetb
    56108        nop
    57 
    58 .global ofw
    59 ofw:
    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
  • kernel/arch/sparc64/src/console.c

    r63cda71 r94d614e  
    4040#include <arch/drivers/i8042.h>
    4141#include <genarch/i8042/i8042.h>
    42 #include <genarch/ofw/ofw.h>
    4342#include <console/chardev.h>
    4443#include <console/console.h>
     
    4645#include <arch/register.h>
    4746#include <proc/thread.h>
    48 #include <synch/mutex.h>
    4947#include <arch/mm/tlb.h>
     48#include <arch/boot/boot.h>
    5049
    5150#define KEYBOARD_POLL_PAUSE     50000   /* 50ms */
    52 
    53 static void ofw_sparc64_putchar(chardev_t *d, const char ch);
    54 
    55 static volatile int ofw_console_active;
    56 
    57 static chardev_t ofw_sparc64_console;
    58 static chardev_operations_t ofw_sparc64_console_ops = {
    59         .write = ofw_sparc64_putchar,
    60 };
    61 
    62 /** Initialize kernel console to use OpenFirmware services. */
    63 void ofw_sparc64_console_init(void)
    64 {
    65         chardev_initialize("ofw_sparc64_console", &ofw_sparc64_console, &ofw_sparc64_console_ops);
    66         stdin = NULL;
    67         stdout = &ofw_sparc64_console;
    68         ofw_console_active = 1;
    69 }
    7051
    7152/** Initialize kernel console to use framebuffer and keyboard directly. */
    7253void standalone_sparc64_console_init(void)
    7354{
    74         ofw_console_active = 0;
    7555        stdin = NULL;
    7656
    7757        kbd_init();
    78         fb_init(FB_PHYS_ADDRESS, FB_X_RES, FB_Y_RES, FB_COLOR_DEPTH, FB_X_RES * FB_COLOR_DEPTH / 8);
    79 }
    80 
    81 /** Write one character using OpenFirmware.
    82  *
    83  * @param d Character device (ignored).
    84  * @param ch Character to be written.
    85  */
    86 void ofw_sparc64_putchar(chardev_t *d, const char ch)
    87 {
    88         if (ch == '\n')
    89                 ofw_putchar('\r');
    90         ofw_putchar(ch);
     58        fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height,
     59                bootinfo.screen.bpp, bootinfo.screen.scanline);
    9160}
    9261
  • kernel/arch/sparc64/src/drivers/i8042.c

    r63cda71 r94d614e  
    3535#include <arch/drivers/i8042.h>
    3636#include <genarch/i8042/i8042.h>
     37#include <arch/boot/boot.h>
    3738#include <arch/types.h>
    3839#include <arch/mm/page.h>
     
    4243void kbd_init()
    4344{
    44         kbd_virt_address = (uint8_t *) hw_map(KBD_PHYS_ADDRESS, LAST_REG);
     45        kbd_virt_address = (uint8_t *) hw_map(bootinfo.keyboard.addr, LAST_REG);
    4546        i8042_init();
    4647}
  • kernel/arch/sparc64/src/mm/frame.c

    r63cda71 r94d614e  
    3434
    3535#include <arch/mm/frame.h>
    36 #include <genarch/ofw/memory_init.h>
    3736#include <mm/frame.h>
     37#include <arch/boot/boot.h>
    3838#include <config.h>
    3939#include <align.h>
    4040
     41/** Create memory zones according to information stored in bootinfo.
     42 *
     43 * Walk the bootinfo memory map and create frame zones according to it.
     44 * The first frame is not blacklisted here as it is done in generic
     45 * frame_init().
     46 */
    4147void frame_arch_init(void)
    4248{
    43         ofw_init_zones();
     49        int i;
     50        pfn_t confdata;
    4451
    45         /*
    46          * Workaround to prevent slab allocator from allocating frame 0.
    47          * Frame 0 is
    48          * a) not mapped by OFW
    49          * b) would be confused with NULL error return code
    50          */
    51         frame_mark_unavailable(0, 1);
     52        for (i = 0; i < bootinfo.memmap.count; i++) {
     53
     54                /*
     55                 * The memmap is created by HelenOS boot loader.
     56                 * It already contains no holes.
     57                 */
     58       
     59                confdata = ADDR2PFN(bootinfo.memmap.zones[i].start);
     60                if (confdata == 0)
     61                        confdata = 2;
     62                zone_create(ADDR2PFN(bootinfo.memmap.zones[i].start),
     63                        SIZE2FRAMES(ALIGN_DOWN(bootinfo.memmap.zones[i].size, PAGE_SIZE)),
     64                        confdata, 0);
     65        }
     66
    5267}
    5368
  • kernel/arch/sparc64/src/mm/memory_init.c

    r63cda71 r94d614e  
    3434
    3535#include <arch/mm/memory_init.h>
    36 #include <genarch/ofw/memory_init.h>
     36#include <arch/boot/boot.h>
    3737#include <typedefs.h>
    3838
     39/** Return total size of available memory in bytes.
     40 *
     41 * @return Size of available memory in bytes.
     42 */
    3943size_t get_memory_size(void)
    4044{
    41         return ofw_get_memory_size();
     45        return bootinfo.memmap.total;
    4246}
    4347
    4448/** @}
    4549 */
    46 
  • kernel/arch/sparc64/src/sparc64.c

    r63cda71 r94d614e  
    4040#include <proc/thread.h>
    4141#include <console/console.h>
     42#include <arch/boot/boot.h>
    4243
    43 #include <print.h>
    44 #include <genarch/ofw/ofw.h>
    45 #include <arch/asm.h>
    46 #include <arch/register.h>
     44bootinfo_t bootinfo;
     45
    4746void arch_pre_mm_init(void)
    4847{
    49         interrupts_disable();
    50         ofw_sparc64_console_init();
    51 
    5248        trap_init();
    5349        tick_init();
  • kernel/arch/sparc64/src/start.S

    r63cda71 r94d614e  
    2727#
    2828
    29 #include <arch/boot/boot.h>
    3029#include <arch/regdef.h>
    3130
     
    4039 * Here is where the kernel is passed control
    4140 * from the boot loader.
     41 *
     42 * The registers are expected to be in this state:
     43 * %o0 bootinfo structure address
     44 * %o1 bootinfo structure size
    4245 */
    4346
     
    4649        flushw                          ! flush all but the active register window
    4750
     51        /*
     52         * Disable interrupts and disable 32-bit address masking.
     53         */
    4854        rdpr %pstate, %l0
    49         and %l0, ~PSTATE_AM_BIT, %l0
     55        and %l0, ~(PSTATE_AM_BIT|PSTATE_IE_BIT), %l0
    5056        wrpr %l0, 0, %pstate
    5157
    52         set ofw_cif, %l0
    53 
    54         call ofw_init
    55         stx %o4, [%l0]
    56 
    57         call ofw_init_memmap
     58        /*
     59         * Copy the bootinfo structure passed from the boot loader
     60         * to the kernel bootinfo structure.
     61         */
     62        mov %o1, %o2
     63        mov %o0, %o1
     64        set bootinfo, %o0
     65        call memcpy
    5866        nop
    5967
Note: See TracChangeset for help on using the changeset viewer.