Changeset 94d614e in mainline for kernel/arch/sparc64/src
- Timestamp:
- 2006-07-13T17:32:38Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a5f76758
- Parents:
- 63cda71
- Location:
- kernel/arch/sparc64/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/asm.S
r63cda71 r94d614e 43 43 memcpy_from_uspace: 44 44 memcpy_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 53 0: 54 brz,pn %o2, 2f 55 mov 0, %g2 56 1: 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 63 2: 64 jmp %o7 + 8 ! exit point 65 mov %o1, %o0 66 3: 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 74 4: 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] 82 5: 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 90 6: 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 45 97 46 b _memcpy47 nop98 jmp %o7 + 8 ! exit point 99 mov %o1, %o0 48 100 49 101 memcpy_from_uspace_failover_address: 50 102 memcpy_to_uspace_failover_address: 51 b memcpy_from_uspace_failover_address52 nop103 jmp %o7 + 8 ! exit point 104 mov %g0, %o0 ! return 0 on failure 53 105 54 106 memsetb: 55 107 b _memsetb 56 108 nop 57 58 .global ofw59 ofw:60 save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp61 set ofw_cif, %l062 ldx [%l0], %l063 64 rdpr %pstate, %l165 and %l1, ~PSTATE_AM_BIT, %l266 wrpr %l2, 0, %pstate67 68 jmpl %l0, %o769 mov %i0, %o070 71 wrpr %l1, 0, %pstate72 73 ret74 restore %o0, 0, %o0 -
kernel/arch/sparc64/src/console.c
r63cda71 r94d614e 40 40 #include <arch/drivers/i8042.h> 41 41 #include <genarch/i8042/i8042.h> 42 #include <genarch/ofw/ofw.h>43 42 #include <console/chardev.h> 44 43 #include <console/console.h> … … 46 45 #include <arch/register.h> 47 46 #include <proc/thread.h> 48 #include <synch/mutex.h>49 47 #include <arch/mm/tlb.h> 48 #include <arch/boot/boot.h> 50 49 51 50 #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 }70 51 71 52 /** Initialize kernel console to use framebuffer and keyboard directly. */ 72 53 void standalone_sparc64_console_init(void) 73 54 { 74 ofw_console_active = 0;75 55 stdin = NULL; 76 56 77 57 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); 91 60 } 92 61 -
kernel/arch/sparc64/src/drivers/i8042.c
r63cda71 r94d614e 35 35 #include <arch/drivers/i8042.h> 36 36 #include <genarch/i8042/i8042.h> 37 #include <arch/boot/boot.h> 37 38 #include <arch/types.h> 38 39 #include <arch/mm/page.h> … … 42 43 void kbd_init() 43 44 { 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); 45 46 i8042_init(); 46 47 } -
kernel/arch/sparc64/src/mm/frame.c
r63cda71 r94d614e 34 34 35 35 #include <arch/mm/frame.h> 36 #include <genarch/ofw/memory_init.h>37 36 #include <mm/frame.h> 37 #include <arch/boot/boot.h> 38 38 #include <config.h> 39 39 #include <align.h> 40 40 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 */ 41 47 void frame_arch_init(void) 42 48 { 43 ofw_init_zones(); 49 int i; 50 pfn_t confdata; 44 51 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 52 67 } 53 68 -
kernel/arch/sparc64/src/mm/memory_init.c
r63cda71 r94d614e 34 34 35 35 #include <arch/mm/memory_init.h> 36 #include < genarch/ofw/memory_init.h>36 #include <arch/boot/boot.h> 37 37 #include <typedefs.h> 38 38 39 /** Return total size of available memory in bytes. 40 * 41 * @return Size of available memory in bytes. 42 */ 39 43 size_t get_memory_size(void) 40 44 { 41 return ofw_get_memory_size();45 return bootinfo.memmap.total; 42 46 } 43 47 44 48 /** @} 45 49 */ 46 -
kernel/arch/sparc64/src/sparc64.c
r63cda71 r94d614e 40 40 #include <proc/thread.h> 41 41 #include <console/console.h> 42 #include <arch/boot/boot.h> 42 43 43 #include <print.h> 44 #include <genarch/ofw/ofw.h> 45 #include <arch/asm.h> 46 #include <arch/register.h> 44 bootinfo_t bootinfo; 45 47 46 void arch_pre_mm_init(void) 48 47 { 49 interrupts_disable();50 ofw_sparc64_console_init();51 52 48 trap_init(); 53 49 tick_init(); -
kernel/arch/sparc64/src/start.S
r63cda71 r94d614e 27 27 # 28 28 29 #include <arch/boot/boot.h>30 29 #include <arch/regdef.h> 31 30 … … 40 39 * Here is where the kernel is passed control 41 40 * 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 42 45 */ 43 46 … … 46 49 flushw ! flush all but the active register window 47 50 51 /* 52 * Disable interrupts and disable 32-bit address masking. 53 */ 48 54 rdpr %pstate, %l0 49 and %l0, ~ PSTATE_AM_BIT, %l055 and %l0, ~(PSTATE_AM_BIT|PSTATE_IE_BIT), %l0 50 56 wrpr %l0, 0, %pstate 51 57 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 58 66 nop 59 67
Note:
See TracChangeset
for help on using the changeset viewer.