Changeset 9a5b556 in mainline
- Timestamp:
- 2006-09-12T13:03:55Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6eabb6e6
- Parents:
- 7bb6b06
- Files:
-
- 2 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc64/loader/Makefile
r7bb6b06 r9a5b556 52 52 main.c \ 53 53 ../../../generic/printf.c \ 54 ../../../generic/string.c \ 54 55 ../../../genarch/ofw.c \ 55 56 ofwarch.c \ -
boot/arch/sparc64/loader/main.c
r7bb6b06 r9a5b556 67 67 printf("Error: unable to get keyboard properties\n"); 68 68 69 if (!ofw_cpu(&bootinfo.cpu)) 70 printf("Error: unable to get cpu properties\n"); 71 69 72 printf("\nDevice statistics\n"); 73 printf(" cpu: %dMHz\n", bootinfo.cpu.clock_frequency/1000000); 70 74 printf(" memory: %dM\n", bootinfo.memmap.total>>20); 71 75 printf(" screen at %P, resolution %dx%d, %d bpp (scanline %d bytes)\n", (uintptr_t) bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline); -
boot/arch/sparc64/loader/main.h
r7bb6b06 r9a5b556 46 46 47 47 typedef struct { 48 uint32_t clock_frequency; 49 } cpu_t; 50 51 typedef struct { 48 52 taskmap_t taskmap; 49 53 memmap_t memmap; 50 54 screen_t screen; 51 55 keyboard_t keyboard; 56 cpu_t cpu; 52 57 } bootinfo_t; 53 58 -
boot/arch/sparc64/loader/ofwarch.c
r7bb6b06 r9a5b556 35 35 #include <ofw.h> 36 36 #include <printf.h> 37 #include <string.h> 38 #include "main.h" 37 39 38 40 int bpp2align[] = { … … 80 82 return true; 81 83 } 84 85 int ofw_cpu(cpu_t *cpu) 86 { 87 char type_name[BUF_SIZE]; 88 89 phandle node; 90 node = ofw_get_child_node(ofw_root); 91 if (node == 0 || node == -1) { 92 printf("Could not find any child nodes of the root node.\n"); 93 return; 94 } 95 96 for (; node != 0 && node != -1; node = ofw_get_peer_node(node)) { 97 if (ofw_get_property(node, "device_type", type_name, sizeof(type_name)) > 0) { 98 if (strncmp(type_name, "cpu", 3) == 0) { 99 uint32_t mhz; 100 101 if (ofw_get_property(node, "clock-frequency", &mhz, sizeof(mhz)) <= 0) 102 continue; 103 104 cpu->clock_frequency = mhz; 105 return 1; 106 } 107 } 108 }; 109 110 return 0; 111 } -
boot/arch/sparc64/loader/ofwarch.h
r7bb6b06 r9a5b556 30 30 #define BOOT_sparc64_OFWARCH_H_ 31 31 32 #include "main.h" 33 32 34 #define OFW_ADDRESS_CELLS 2 33 35 #define OFW_SIZE_CELLS 2 … … 35 37 extern int bpp2align[]; 36 38 39 extern int ofw_cpu(cpu_t *cpu); 40 37 41 #endif -
boot/genarch/ofw.c
r7bb6b06 r9a5b556 146 146 } 147 147 148 phandle ofw_get_child_node(const phandle node) 149 { 150 return ofw_call("child", 1, 1, NULL, node); 151 } 152 153 phandle ofw_get_peer_node(const phandle node) 154 { 155 return ofw_call("peer", 1, 1, NULL, node); 156 } 148 157 149 158 static ihandle ofw_open(const char *name) -
boot/genarch/ofw.h
r7bb6b06 r9a5b556 91 91 extern uintptr_t ofw_cif; 92 92 93 94 extern phandle ofw_chosen; 95 extern ihandle ofw_stdout; 96 extern phandle ofw_root; 97 extern ihandle ofw_mmu; 98 extern phandle ofw_memory; 93 99 extern phandle ofw_aliases; 94 100 95 101 extern void ofw_init(void); 102 96 103 extern void ofw_write(const char *str, const int len); 97 104 98 105 extern int ofw_get_property(const phandle device, const char *name, const void *buf, const int buflen); 106 107 extern phandle ofw_get_child_node(const phandle node); 108 extern phandle ofw_get_peer_node(const phandle node); 99 109 extern phandle ofw_find_device(const char *name); 100 110 -
boot/generic/gentypes.h
r7bb6b06 r9a5b556 34 34 #define true 1 35 35 36 typedef unsigned long size_t; 37 36 38 #endif -
kernel/arch/ia64/src/drivers/it.c
r7bb6b06 r9a5b556 27 27 */ 28 28 29 29 /** @addtogroup ia64 30 30 * @{ 31 31 */ … … 77 77 eoi_write(EOI); 78 78 79 m =itm_read();79 m = itm_read(); 80 80 81 while(1) 82 { 83 84 c=itc_read(); 85 c+=IT_SERVICE_CLOCKS; 81 while (1) { 82 c = itc_read(); 83 c += IT_SERVICE_CLOCKS; 86 84 87 m+=IT_DELTA; 88 if(m-c<0) 89 { 85 m += IT_DELTA; 86 if (m-c<0) 90 87 CPU->missed_clock_ticks++; 91 }92 elsebreak;88 else 89 break; 93 90 } 94 91 … … 96 93 srlz_d(); /* propagate changes */ 97 94 98 99 100 95 clock(); 101 96 poll_keyboard(); 102 97 } 103 98 104 99 /** @} 105 100 */ 106 -
kernel/arch/mips32/include/asm.h
r7bb6b06 r9a5b556 67 67 uintptr_t entry); 68 68 69 extern ipl_t interrupts_disable(void); 70 extern ipl_t interrupts_enable(void); 71 extern void interrupts_restore(ipl_t ipl); 72 extern ipl_t interrupts_read(void); 73 69 74 #endif 70 75 -
kernel/arch/mips32/src/interrupt.c
r7bb6b06 r9a5b556 27 27 */ 28 28 29 29 /** @addtogroup mips32interrupt 30 30 * @{ 31 31 */ … … 142 142 } 143 143 144 144 /** @} 145 145 */ 146 146 -
kernel/arch/sparc64/include/asm.h
r7bb6b06 r9a5b556 36 36 #define KERN_sparc64_ASM_H_ 37 37 38 #include <arch.h> 38 39 #include <typedefs.h> 39 40 #include <arch/types.h> 40 41 #include <arch/register.h> 41 42 #include <config.h> 43 #include <time/clock.h> 42 44 43 45 /** Read Processor State register. … … 336 338 extern void cpu_halt(void); 337 339 extern void cpu_sleep(void); 338 extern void asm_delay_loop( uint32_t t);340 extern void asm_delay_loop(const uint32_t usec); 339 341 340 342 extern uint64_t read_from_ag_g7(void); -
kernel/arch/sparc64/include/boot/boot.h
r7bb6b06 r9a5b556 84 84 85 85 typedef struct { 86 uint32_t clock_frequency; 87 } processor_t; 88 89 typedef struct { 86 90 taskmap_t taskmap; 87 91 memmap_t memmap; 88 92 screen_t screen; 89 93 keyboard_t keyboard; 94 processor_t processor; 90 95 } bootinfo_t; 91 96 -
kernel/arch/sparc64/include/cpu.h
r7bb6b06 r9a5b556 53 53 struct cpu_arch { 54 54 ver_reg_t ver; 55 uint32_t clock_frequency; 55 56 }; 56 57 -
kernel/arch/sparc64/include/drivers/tick.h
r7bb6b06 r9a5b556 38 38 #include <typedefs.h> 39 39 40 #define TICK_DELTA 50000041 42 40 extern void tick_init(void); 43 41 extern void tick_interrupt(int n, istate_t *istate); -
kernel/arch/sparc64/src/cpu/cpu.c
r7bb6b06 r9a5b556 33 33 */ 34 34 35 #include <arch/asm.h> 35 36 #include <cpu.h> 36 37 #include <arch.h> 37 38 #include <arch/register.h> 38 #include <arch/asm.h>39 39 #include <print.h> 40 #include <arch/boot/boot.h> 40 41 41 42 void cpu_arch_init(void) 42 43 { 44 CPU->arch.clock_frequency = bootinfo.processor.clock_frequency; 43 45 } 44 46 … … 94 96 } 95 97 96 printf("cpu%d: manuf=%s, impl=%s, mask=%d\n", CPU->id, manuf, impl, CPU->arch.ver.mask); 98 printf("cpu%d: manuf=%s, impl=%s, mask=%d (%dMHz)\n", 99 CPU->id, manuf, impl, CPU->arch.ver.mask, CPU->arch.clock_frequency/1000000); 97 100 } 98 101 -
kernel/arch/sparc64/src/drivers/tick.c
r7bb6b06 r9a5b556 37 37 #include <arch/asm.h> 38 38 #include <arch/register.h> 39 #include <typedefs.h> 40 #include <arch/cpu.h> 41 #include <arch/boot/boot.h> 42 #include <time/clock.h> 43 #include <arch.h> 39 44 #include <debug.h> 40 #include <time/clock.h> 41 # include <typedefs.h>45 46 #define TICK_RESTART_TIME 50 /* Worst case estimate. */ 42 47 43 48 /** Initialize tick interrupt. */ … … 48 53 interrupt_register(14, "tick_int", tick_interrupt); 49 54 compare.int_dis = false; 50 compare.tick_cmpr = TICK_DELTA;55 compare.tick_cmpr = bootinfo.processor.clock_frequency/HZ; 51 56 tick_compare_write(compare.value); 52 57 tick_write(0); … … 61 66 { 62 67 softint_reg_t softint, clear; 68 uint64_t next, compare, start, stop; 63 69 64 70 softint.value = softint_read(); … … 84 90 * Restart counter. 85 91 */ 86 tick_write(0); 92 compare = CPU->arch.clock_frequency/HZ; 93 start = tick_read(); 94 next = start - compare; 95 while (next >= compare - TICK_RESTART_TIME) { 96 next -= compare; 97 CPU->missed_clock_ticks++; 98 } 99 stop = tick_read(); 100 tick_write(next + (stop - start)); 87 101 88 102 clock(); -
kernel/arch/sparc64/src/dummy.s
r7bb6b06 r9a5b556 29 29 .text 30 30 31 .global asm_delay_loop32 31 .global cpu_sleep 33 32 .global fpu_context_restore … … 39 38 .global dummy 40 39 41 asm_delay_loop:42 40 cpu_sleep: 43 41 fpu_context_restore: -
kernel/arch/sparc64/src/sparc64.c
r7bb6b06 r9a5b556 43 43 #include <arch/boot/boot.h> 44 44 #include <arch/arch.h> 45 #include <arch/asm.h> 45 46 #include <arch/mm/page.h> 46 47 #include <arch/stack.h> … … 90 91 } 91 92 93 /** Calibrate delay loop. 94 * 95 * On sparc64, we implement delay() by waiting for the TICK register to 96 * reach a pre-computed value, as opposed to performing some pre-computed 97 * amount of instructions of known duration. We set the delay_loop_const 98 * to 1 in order to neutralize the multiplication done by delay(). 99 */ 92 100 void calibrate_delay_loop(void) 93 101 { 102 CPU->delay_loop_const = 1; 103 } 104 105 /** Wait several microseconds. 106 * 107 * We assume that interrupts are already disabled. 108 * 109 * @param t Microseconds to wait. 110 */ 111 void asm_delay_loop(const uint32_t usec) 112 { 113 uint64_t stop = tick_read() + (uint64_t) usec * (uint64_t) CPU->arch.clock_frequency / 1000000; 114 115 while (tick_read() < stop) 116 ; 94 117 } 95 118 -
kernel/arch/sparc64/src/start.S
r7bb6b06 r9a5b556 61 61 */ 62 62 63 flushw ! flush all but the active register window 64 wrpr %g0, 0, %tl ! TL = 0, primary context register is used 65 66 ! Disable interrupts and disable 32-bit address masking. 67 rdpr %pstate, %g1 68 and %g1, ~(PSTATE_AM_BIT|PSTATE_IE_BIT), %g1 69 wrpr %g1, 0, %pstate 70 71 wrpr %g0, 0, %pil ! intialize %pil 63 flushw ! flush all but the active register window 64 65 wrpr %g0, 0, %tl ! TL = 0, primary context register is used 66 67 wrpr %g0, PSTATE_PRIV_BIT, %pstate ! Disable interrupts and disable 32-bit address masking. 68 69 wrpr %g0, 0, %pil ! intialize %pil 72 70 73 71 /* -
kernel/generic/include/arch.h
r7bb6b06 r9a5b556 33 33 */ 34 34 35 #ifndef __ARCH_H__36 #define __ARCH_H__35 #ifndef KERN_ARCH_H_ 36 #define KERN_ARCH_H_ 37 37 38 38 #include <arch/types.h> … … 80 80 extern void calibrate_delay_loop(void); 81 81 82 extern ipl_t interrupts_disable(void);83 extern ipl_t interrupts_enable(void);84 extern void interrupts_restore(ipl_t ipl);85 extern ipl_t interrupts_read(void);86 87 82 #endif 88 83 -
kernel/generic/include/cpu.h
r7bb6b06 r9a5b556 33 33 */ 34 34 35 #ifndef __CPU_H__36 #define __CPU_H__35 #ifndef KERN_CPU_H_ 36 #define KERN_CPU_H_ 37 37 38 38 #include <arch/cpu.h> -
kernel/generic/include/time/clock.h
r7bb6b06 r9a5b556 33 33 */ 34 34 35 #ifndef __CLOCK_H__36 #define __CLOCK_H__35 #ifndef KERN_CLOCK_H_ 36 #define KERN_CLOCK_H_ 37 37 38 38 #define HZ 100 -
kernel/generic/include/time/delay.h
r7bb6b06 r9a5b556 33 33 */ 34 34 35 #ifndef __DELAY_H__36 #define __DELAY_H__35 #ifndef KERN_DELAY_H_ 36 #define KERN_DELAY_H_ 37 37 38 38 #include <arch/types.h> -
kernel/generic/include/time/timeout.h
r7bb6b06 r9a5b556 33 33 */ 34 34 35 #ifndef __TIMEOUT_H__36 #define __TIMEOUT_H__35 #ifndef KERN_TIMEOUT_H_ 36 #define KERN_TIMEOUT_H_ 37 37 38 38 #include <arch/types.h> -
kernel/generic/include/typedefs.h
r7bb6b06 r9a5b556 33 33 */ 34 34 35 #ifndef __TYPEDEFS_H__36 #define __TYPEDEFS_H__35 #ifndef KERN_TYPEDEFS_H_ 36 #define KERN_TYPEDEFS_H_ 37 37 38 38 #define false 0 -
kernel/generic/src/cpu/cpu.c
r7bb6b06 r9a5b556 110 110 } 111 111 112 112 /** @} 113 113 */ 114 114
Note:
See TracChangeset
for help on using the changeset viewer.