Changeset 94d614e in mainline
- Timestamp:
- 2006-07-13T17:32:38Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a5f76758
- Parents:
- 63cda71
- Files:
-
- 4 deleted
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc64/loader/asm.S
r63cda71 r94d614e 99 99 100 100 jump_to_kernel: 101 set ofw_cif, %l0 102 jmp %o0 ! jump to kernel 103 ldx [%l0], %o4 ! pass OpenFirmware address in %o4 101 mov %o0, %l1 102 mov %o1, %o0 103 mov %o2, %o1 104 jmp %l1 ! jump to kernel 105 nop 104 106 105 107 .global ofw -
boot/arch/sparc64/loader/main.c
r63cda71 r94d614e 81 81 printf("\nCopying components\n"); 82 82 unsigned int top = 0; 83 bootinfo. cnt = 0;83 bootinfo.taskmap.count = 0; 84 84 for (i = 0; i < COMPONENTS; i++) { 85 void * base = (void *) KERNEL_VIRTUAL_ADDRESS; 86 85 87 printf(" %s...", components[i].name); 86 88 top = ALIGN_UP(top, PAGE_SIZE); 87 memcpy( ((void *) KERNEL_VIRTUAL_ADDRESS)+ top, components[i].start, components[i].size);89 memcpy(base + top, components[i].start, components[i].size); 88 90 if (i > 0) { 89 bootinfo.task s[bootinfo.cnt].addr = ((void *) KERNEL_VIRTUAL_ADDRESS)+ top;90 bootinfo.task s[bootinfo.cnt].size = components[i].size;91 bootinfo. cnt++;91 bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr = base + top; 92 bootinfo.taskmap.tasks[bootinfo.taskmap.count].size = components[i].size; 93 bootinfo.taskmap.count++; 92 94 } 93 95 top += components[i].size; -
boot/arch/sparc64/loader/main.h
r63cda71 r94d614e 31 31 32 32 #include <ofw.h> 33 #include <types.h> 33 34 34 35 #define TASKMAP_MAX_RECORDS 32 … … 36 37 typedef struct { 37 38 void *addr; 38 u nsigned int size;39 uint32_t size; 39 40 } task_t; 40 41 41 42 typedef struct { 42 u nsigned int cnt;43 uint32_t count; 43 44 task_t tasks[TASKMAP_MAX_RECORDS]; 45 } taskmap_t; 46 47 typedef struct { 48 taskmap_t taskmap; 44 49 memmap_t memmap; 45 50 screen_t screen; -
boot/genarch/ofw.c
r63cda71 r94d614e 75 75 } 76 76 77 77 /** Perform a call to OpenFirmware client interface. 78 * 79 * @param service String identifying the service requested. 80 * @param nargs Number of input arguments. 81 * @param nret Number of output arguments. This includes the return value. 82 * @param rets Buffer for output arguments or NULL. The buffer must accommodate nret - 1 items. 83 * 84 * @return Return value returned by the client interface. 85 */ 78 86 static unsigned long ofw_call(const char *service, const int nargs, const int nret, ofw_arg_t *rets, ...) 79 87 { … … 82 90 int i; 83 91 84 args.service = service;92 args.service = (ofw_arg_t) service; 85 93 args.nargs = nargs; 86 94 args.nret = nret; -
boot/genarch/ofw.h
r63cda71 r94d614e 47 47 */ 48 48 typedef struct { 49 const char *service; /**< Command name*/50 unsigned long nargs; /**< Number of in arguments*/51 unsigned long nret; /**< Number of out arguments*/52 ofw_arg_t args[MAX_OFW_ARGS]; /**< List of arguments */49 ofw_arg_t service; /**< Command name. */ 50 ofw_arg_t nargs; /**< Number of in arguments. */ 51 ofw_arg_t nret; /**< Number of out arguments. */ 52 ofw_arg_t args[MAX_OFW_ARGS]; /**< List of arguments. */ 53 53 } ofw_args_t; 54 54 55 55 typedef struct { 56 56 void *start; 57 u nsigned int size;57 uint32_t size; 58 58 } memzone_t; 59 59 60 60 typedef struct { 61 u nsigned int total;62 u nsigned int count;61 uint32_t total; 62 uint32_t count; 63 63 memzone_t zones[MEMMAP_MAX_RECORDS]; 64 64 } memmap_t; … … 66 66 typedef struct { 67 67 void *addr; 68 u nsigned int width;69 u nsigned int height;70 u nsigned int bpp;71 u nsigned int scanline;68 uint32_t width; 69 uint32_t height; 70 uint32_t bpp; 71 uint32_t scanline; 72 72 } screen_t; 73 73 74 74 typedef struct { 75 75 void *addr; 76 u nsigned int size;76 uint32_t size; 77 77 } keyboard_t; 78 78 79 79 typedef struct { 80 u nsigned int info;81 u nsigned int addr_hi;82 u nsigned int addr_lo;80 uint32_t info; 81 uint32_t addr_hi; 82 uint32_t addr_lo; 83 83 } pci_addr_t; 84 84 85 85 typedef struct { 86 86 pci_addr_t addr; 87 u nsigned int size_hi;88 u nsigned int size_lo;87 uint32_t size_hi; 88 uint32_t size_lo; 89 89 } pci_reg_t; 90 90 -
kernel/arch/ppc32/src/ppc32.c
r63cda71 r94d614e 71 71 { 72 72 if (config.cpu_active == 1) { 73 fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline); 73 fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline); 74 74 75 75 /* Initialize PIC */ -
kernel/arch/sparc64/Makefile.inc
r63cda71 r94d614e 47 47 # 48 48 49 CONFIG_OFW = y50 51 49 ## Compile with page hash table support. 52 50 # -
kernel/arch/sparc64/_link.ld.in
r63cda71 r94d614e 7 7 */ 8 8 9 #define __ ASM__9 #define __LINKER__ 10 10 #include <arch/boot/boot.h> 11 11 -
kernel/arch/sparc64/include/boot/boot.h
r63cda71 r94d614e 33 33 */ 34 34 35 #ifndef __sparc64_BOOT_H__ 36 #define __sparc64_BOOT_H__ 35 #ifndef KERN_sparc64_BOOT_H_ 36 #define KERN_sparc64_BOOT_H_ 37 37 38 38 39 #define VMA 0x400000 39 40 #define LMA VMA 41 42 #ifndef __LINKER__ 43 44 #include <arch/types.h> 45 #include <typedefs.h> 46 47 #define TASKMAP_MAX_RECORDS 32 48 #define MEMMAP_MAX_RECORDS 32 49 50 typedef struct { 51 void * addr; 52 uint32_t size; 53 } utask_t; 54 55 typedef struct { 56 uint32_t count; 57 utask_t tasks[TASKMAP_MAX_RECORDS]; 58 } taskmap_t; 59 60 typedef struct { 61 uintptr_t start; 62 uint32_t size; 63 } memzone_t; 64 65 typedef struct { 66 uint32_t total; 67 uint32_t count; 68 memzone_t zones[MEMMAP_MAX_RECORDS]; 69 } memmap_t; 70 71 typedef struct { 72 uintptr_t addr; 73 uint32_t width; 74 uint32_t height; 75 uint32_t bpp; 76 uint32_t scanline; 77 } screen_t; 78 79 typedef struct { 80 uintptr_t addr; 81 uint32_t size; 82 } keyboard_t; 83 84 typedef struct { 85 taskmap_t taskmap; 86 memmap_t memmap; 87 screen_t screen; 88 keyboard_t keyboard; 89 } bootinfo_t; 90 91 extern bootinfo_t bootinfo; 92 93 #endif 40 94 41 95 #endif -
kernel/arch/sparc64/include/drivers/fb.h
r63cda71 r94d614e 36 36 #define KERN_sparc64_FB_H_ 37 37 38 #define FB_PHYS_ADDRESS 0x1c901000000ULL39 40 #define FB_X_RES 115241 #define FB_Y_RES 90042 43 #define FB_COLOR_DEPTH 844 45 38 #endif 46 39 -
kernel/arch/sparc64/include/drivers/i8042.h
r63cda71 r94d614e 38 38 #include <arch/types.h> 39 39 40 #define KBD_PHYS_ADDRESS 0x1fff8904000ULL41 42 40 #define STATUS_REG 4 43 41 #define COMMAND_REG 4 -
kernel/arch/sparc64/include/drivers/tick.h
r63cda71 r94d614e 27 27 */ 28 28 29 29 /** @addtogroup sparc64 30 30 * @{ 31 31 */ … … 45 45 #endif 46 46 47 47 /** @} 48 48 */ 49 -
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 -
kernel/genarch/Makefile.inc
r63cda71 r94d614e 29 29 # 30 30 31 ifeq ($(CONFIG_OFW),y)32 GENARCH_SOURCES += \33 genarch/src/ofw/ofw.c \34 genarch/src/ofw/memory_init.c35 endif36 31 ifeq ($(CONFIG_ACPI),y) 37 32 GENARCH_SOURCES += \ -
kernel/genarch/src/fb/fb.c
r63cda71 r94d614e 27 27 */ 28 28 29 29 /** @addtogroup genarch 30 30 * @{ 31 31 */ … … 420 420 } 421 421 422 /** @} 423 */ 424 422 /** @} 423 */ -
kernel/generic/src/mm/frame.c
r63cda71 r94d614e 1078 1078 1079 1079 /* Black list first frame, as allocating NULL would 1080 * fail on some places */1080 * fail in some places */ 1081 1081 frame_mark_unavailable(0, 1); 1082 1082 }
Note:
See TracChangeset
for help on using the changeset viewer.