diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-05-07 02:55:41 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-05-07 02:55:41 +0000 |
commit | dcec8a13bf565e47942a1751a9cec21bec5648fe (patch) | |
tree | 548b69625b18cc2e88c3e68d0923be546c9ebb03 /include/asm-sparc | |
parent | 2e0f55e79c49509b7ff70ff1a10e1e9e90a3dfd4 (diff) |
o Merge with Linux 2.1.99.
o Fix ancient bug in the ELF loader making ldd crash.
o Fix ancient bug in the keyboard code for SGI, SNI and Jazz.
Diffstat (limited to 'include/asm-sparc')
41 files changed, 1640 insertions, 338 deletions
diff --git a/include/asm-sparc/a.out.h b/include/asm-sparc/a.out.h index cdc3e76ca..25ddaf086 100644 --- a/include/asm-sparc/a.out.h +++ b/include/asm-sparc/a.out.h @@ -1,4 +1,4 @@ -/* $Id: a.out.h,v 1.11 1996/12/03 08:44:56 jj Exp $ */ +/* $Id: a.out.h,v 1.12 1998/02/05 14:20:00 jj Exp $ */ #ifndef __SPARC_A_OUT_H__ #define __SPARC_A_OUT_H__ @@ -89,10 +89,31 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */ #ifdef __KERNEL__ +#include <linux/config.h> +#include <asm/btfixup.h> + +#ifdef CONFIG_SUN4 + +#define STACK_TOP (0xefffe000UL) + +#else + extern unsigned long stack_top; -#define STACK_TOP (stack_top) +# ifndef MODULE + + BTFIXUPDEF_SETHI_INIT(stack_top,0xeffff000) + +# define STACK_TOP ((unsigned long)BTFIXUP_SETHI(stack_top)) + +# else /* MODULE */ + +# define STACK_TOP (stack_top) + +# endif /* MODULE */ + +#endif /* !CONFIG_SUN4 */ -#endif +#endif /* __KERNEL__ */ #endif /* __SPARC_A_OUT_H__ */ diff --git a/include/asm-sparc/asi.h b/include/asm-sparc/asi.h index 59fcd4337..72ccc64ba 100644 --- a/include/asm-sparc/asi.h +++ b/include/asm-sparc/asi.h @@ -1,4 +1,4 @@ -/* $Id: asi.h,v 1.17 1997/06/24 15:48:10 jj Exp $ */ +/* $Id: asi.h,v 1.18 1998/03/09 14:04:46 jj Exp $ */ #ifndef _SPARC_ASI_H #define _SPARC_ASI_H @@ -103,6 +103,9 @@ #define ASI_M_DCDR 0x39 /* Data Cache Diagnostics Register rw, ss */ +#define ASI_M_VIKING_TMP1 0x40 /* Emulation temporary 1 on Viking */ +#define ASI_M_VIKING_TMP2 0x41 /* Emulation temporary 2 on Viking */ + #define ASI_M_ACTION 0x4c /* Breakpoint Action Register (GNU/Viking) */ #endif /* _SPARC_ASI_H */ diff --git a/include/asm-sparc/asm_offsets.h b/include/asm-sparc/asm_offsets.h index b3cf79d56..5e0578bf1 100644 --- a/include/asm-sparc/asm_offsets.h +++ b/include/asm-sparc/asm_offsets.h @@ -2,22 +2,291 @@ #ifndef __ASM_OFFSETS_H__ #define __ASM_OFFSETS_H__ +#ifndef __SMP__ + #define AOFF_task_state 0x00000000 #define ASIZ_task_state 0x00000004 -#define AOFF_task_counter 0x00000004 +#define AOFF_task_flags 0x00000004 +#define ASIZ_task_flags 0x00000004 +#define AOFF_task_sigpending 0x00000008 +#define ASIZ_task_sigpending 0x00000004 +#define AOFF_task_addr_limit 0x0000000c +#define ASIZ_task_addr_limit 0x00000004 +#define AOFF_task_exec_domain 0x00000010 +#define ASIZ_task_exec_domain 0x00000004 +#define AOFF_task_debugreg 0x00000014 +#define ASIZ_task_debugreg 0x00000020 +#define AOFF_task_counter 0x00000034 #define ASIZ_task_counter 0x00000004 -#define AOFF_task_priority 0x00000008 +#define AOFF_task_priority 0x00000038 #define ASIZ_task_priority 0x00000004 -#define AOFF_task_flags 0x0000000c +#define AOFF_task_binfmt 0x0000003c +#define ASIZ_task_binfmt 0x00000004 +#define AOFF_task_next_task 0x00000040 +#define ASIZ_task_next_task 0x00000004 +#define AOFF_task_prev_task 0x00000044 +#define ASIZ_task_prev_task 0x00000004 +#define AOFF_task_next_run 0x00000048 +#define ASIZ_task_next_run 0x00000004 +#define AOFF_task_prev_run 0x0000004c +#define ASIZ_task_prev_run 0x00000004 +#define AOFF_task_exit_code 0x00000050 +#define ASIZ_task_exit_code 0x00000004 +#define AOFF_task_exit_signal 0x00000054 +#define ASIZ_task_exit_signal 0x00000004 +#define AOFF_task_pdeath_signal 0x00000058 +#define ASIZ_task_pdeath_signal 0x00000004 +#define AOFF_task_personality 0x0000005c +#define ASIZ_task_personality 0x00000004 +#define AOFF_task_pid 0x00000064 +#define ASIZ_task_pid 0x00000004 +#define AOFF_task_pgrp 0x00000068 +#define ASIZ_task_pgrp 0x00000004 +#define AOFF_task_tty_old_pgrp 0x0000006c +#define ASIZ_task_tty_old_pgrp 0x00000004 +#define AOFF_task_session 0x00000070 +#define ASIZ_task_session 0x00000004 +#define AOFF_task_leader 0x00000074 +#define ASIZ_task_leader 0x00000004 +#define AOFF_task_ngroups 0x00000078 +#define ASIZ_task_ngroups 0x00000004 +#define AOFF_task_groups 0x0000007c +#define ASIZ_task_groups 0x00000040 +#define AOFF_task_p_opptr 0x000000bc +#define ASIZ_task_p_opptr 0x00000004 +#define AOFF_task_p_pptr 0x000000c0 +#define ASIZ_task_p_pptr 0x00000004 +#define AOFF_task_p_cptr 0x000000c4 +#define ASIZ_task_p_cptr 0x00000004 +#define AOFF_task_p_ysptr 0x000000c8 +#define ASIZ_task_p_ysptr 0x00000004 +#define AOFF_task_p_osptr 0x000000cc +#define ASIZ_task_p_osptr 0x00000004 +#define AOFF_task_pidhash_next 0x000000d0 +#define ASIZ_task_pidhash_next 0x00000004 +#define AOFF_task_pidhash_pprev 0x000000d4 +#define ASIZ_task_pidhash_pprev 0x00000004 +#define AOFF_task_tarray_ptr 0x000000d8 +#define ASIZ_task_tarray_ptr 0x00000004 +#define AOFF_task_wait_chldexit 0x000000dc +#define ASIZ_task_wait_chldexit 0x00000004 +#define AOFF_task_uid 0x000000e0 +#define ASIZ_task_uid 0x00000002 +#define AOFF_task_euid 0x000000e2 +#define ASIZ_task_euid 0x00000002 +#define AOFF_task_suid 0x000000e4 +#define ASIZ_task_suid 0x00000002 +#define AOFF_task_fsuid 0x000000e6 +#define ASIZ_task_fsuid 0x00000002 +#define AOFF_task_gid 0x000000e8 +#define ASIZ_task_gid 0x00000002 +#define AOFF_task_egid 0x000000ea +#define ASIZ_task_egid 0x00000002 +#define AOFF_task_sgid 0x000000ec +#define ASIZ_task_sgid 0x00000002 +#define AOFF_task_fsgid 0x000000ee +#define ASIZ_task_fsgid 0x00000002 +#define AOFF_task_timeout 0x000000f0 +#define ASIZ_task_timeout 0x00000004 +#define AOFF_task_policy 0x000000f4 +#define ASIZ_task_policy 0x00000004 +#define AOFF_task_rt_priority 0x000000f8 +#define ASIZ_task_rt_priority 0x00000004 +#define AOFF_task_it_real_value 0x000000fc +#define ASIZ_task_it_real_value 0x00000004 +#define AOFF_task_it_prof_value 0x00000100 +#define ASIZ_task_it_prof_value 0x00000004 +#define AOFF_task_it_virt_value 0x00000104 +#define ASIZ_task_it_virt_value 0x00000004 +#define AOFF_task_it_real_incr 0x00000108 +#define ASIZ_task_it_real_incr 0x00000004 +#define AOFF_task_it_prof_incr 0x0000010c +#define ASIZ_task_it_prof_incr 0x00000004 +#define AOFF_task_it_virt_incr 0x00000110 +#define ASIZ_task_it_virt_incr 0x00000004 +#define AOFF_task_real_timer 0x00000114 +#define ASIZ_task_real_timer 0x00000014 +#define AOFF_task_times 0x00000128 +#define ASIZ_task_times 0x00000010 +#define AOFF_task_start_time 0x00000138 +#define ASIZ_task_start_time 0x00000004 +#define AOFF_task_per_cpu_utime 0x0000013c +#define ASIZ_task_per_cpu_utime 0x00000004 +#define AOFF_task_min_flt 0x00000144 +#define ASIZ_task_min_flt 0x00000004 +#define AOFF_task_maj_flt 0x00000148 +#define ASIZ_task_maj_flt 0x00000004 +#define AOFF_task_nswap 0x0000014c +#define ASIZ_task_nswap 0x00000004 +#define AOFF_task_cmin_flt 0x00000150 +#define ASIZ_task_cmin_flt 0x00000004 +#define AOFF_task_cmaj_flt 0x00000154 +#define ASIZ_task_cmaj_flt 0x00000004 +#define AOFF_task_cnswap 0x00000158 +#define ASIZ_task_cnswap 0x00000004 +#define AOFF_task_swap_address 0x00000160 +#define ASIZ_task_swap_address 0x00000004 +#define AOFF_task_old_maj_flt 0x00000164 +#define ASIZ_task_old_maj_flt 0x00000004 +#define AOFF_task_dec_flt 0x00000168 +#define ASIZ_task_dec_flt 0x00000004 +#define AOFF_task_swap_cnt 0x0000016c +#define ASIZ_task_swap_cnt 0x00000004 +#define AOFF_task_rlim 0x00000170 +#define ASIZ_task_rlim 0x00000050 +#define AOFF_task_used_math 0x000001c0 +#define ASIZ_task_used_math 0x00000002 +#define AOFF_task_io_usage 0x000001c4 +#define ASIZ_task_io_usage 0x00000004 +#define AOFF_task_comm 0x000001c8 +#define ASIZ_task_comm 0x00000010 +#define AOFF_task_link_count 0x000001d8 +#define ASIZ_task_link_count 0x00000004 +#define AOFF_task_tty 0x000001dc +#define ASIZ_task_tty 0x00000004 +#define AOFF_task_semundo 0x000001e0 +#define ASIZ_task_semundo 0x00000004 +#define AOFF_task_semsleeping 0x000001e4 +#define ASIZ_task_semsleeping 0x00000004 +#define AOFF_task_ldt 0x000001e8 +#define ASIZ_task_ldt 0x00000004 +#define AOFF_task_tss 0x000001f0 +#define ASIZ_task_tss 0x00000390 +#define AOFF_task_fs 0x00000580 +#define ASIZ_task_fs 0x00000004 +#define AOFF_task_files 0x00000584 +#define ASIZ_task_files 0x00000004 +#define AOFF_task_mm 0x00000588 +#define ASIZ_task_mm 0x00000004 +#define AOFF_task_sig 0x0000058c +#define ASIZ_task_sig 0x00000004 +#define AOFF_task_signal 0x00000590 +#define ASIZ_task_signal 0x00000008 +#define AOFF_task_blocked 0x00000598 +#define ASIZ_task_blocked 0x00000008 +#define AOFF_task_sigqueue 0x000005a0 +#define ASIZ_task_sigqueue 0x00000004 +#define AOFF_task_sigqueue_tail 0x000005a4 +#define ASIZ_task_sigqueue_tail 0x00000004 +#define AOFF_task_has_cpu 0x000005a8 +#define ASIZ_task_has_cpu 0x00000004 +#define AOFF_task_processor 0x000005ac +#define ASIZ_task_processor 0x00000004 +#define AOFF_task_last_processor 0x000005b0 +#define ASIZ_task_last_processor 0x00000004 +#define AOFF_task_lock_depth 0x000005b4 +#define ASIZ_task_lock_depth 0x00000004 +#define AOFF_task_sigmask_lock 0x000005b8 +#define ASIZ_task_sigmask_lock 0x00000000 +#define AOFF_mm_mmap 0x00000000 +#define ASIZ_mm_mmap 0x00000004 +#define AOFF_mm_mmap_cache 0x00000004 +#define ASIZ_mm_mmap_cache 0x00000004 +#define AOFF_mm_pgd 0x00000008 +#define ASIZ_mm_pgd 0x00000004 +#define AOFF_mm_count 0x0000000c +#define ASIZ_mm_count 0x00000004 +#define AOFF_mm_map_count 0x00000010 +#define ASIZ_mm_map_count 0x00000004 +#define AOFF_mm_mmap_sem 0x00000014 +#define ASIZ_mm_mmap_sem 0x0000000c +#define AOFF_mm_context 0x00000020 +#define ASIZ_mm_context 0x00000004 +#define AOFF_mm_start_code 0x00000024 +#define ASIZ_mm_start_code 0x00000004 +#define AOFF_mm_end_code 0x00000028 +#define ASIZ_mm_end_code 0x00000004 +#define AOFF_mm_start_data 0x0000002c +#define ASIZ_mm_start_data 0x00000004 +#define AOFF_mm_end_data 0x00000030 +#define ASIZ_mm_end_data 0x00000004 +#define AOFF_mm_start_brk 0x00000034 +#define ASIZ_mm_start_brk 0x00000004 +#define AOFF_mm_brk 0x00000038 +#define ASIZ_mm_brk 0x00000004 +#define AOFF_mm_start_stack 0x0000003c +#define ASIZ_mm_start_stack 0x00000004 +#define AOFF_mm_arg_start 0x00000040 +#define ASIZ_mm_arg_start 0x00000004 +#define AOFF_mm_arg_end 0x00000044 +#define ASIZ_mm_arg_end 0x00000004 +#define AOFF_mm_env_start 0x00000048 +#define ASIZ_mm_env_start 0x00000004 +#define AOFF_mm_env_end 0x0000004c +#define ASIZ_mm_env_end 0x00000004 +#define AOFF_mm_rss 0x00000050 +#define ASIZ_mm_rss 0x00000004 +#define AOFF_mm_total_vm 0x00000054 +#define ASIZ_mm_total_vm 0x00000004 +#define AOFF_mm_locked_vm 0x00000058 +#define ASIZ_mm_locked_vm 0x00000004 +#define AOFF_mm_def_flags 0x0000005c +#define ASIZ_mm_def_flags 0x00000004 +#define AOFF_mm_cpu_vm_mask 0x00000060 +#define ASIZ_mm_cpu_vm_mask 0x00000004 +#define AOFF_thread_uwinmask 0x00000000 +#define ASIZ_thread_uwinmask 0x00000004 +#define AOFF_thread_kregs 0x00000004 +#define ASIZ_thread_kregs 0x00000004 +#define AOFF_thread_sig_address 0x00000008 +#define ASIZ_thread_sig_address 0x00000004 +#define AOFF_thread_sig_desc 0x0000000c +#define ASIZ_thread_sig_desc 0x00000004 +#define AOFF_thread_ksp 0x00000010 +#define ASIZ_thread_ksp 0x00000004 +#define AOFF_thread_kpc 0x00000014 +#define ASIZ_thread_kpc 0x00000004 +#define AOFF_thread_kpsr 0x00000018 +#define ASIZ_thread_kpsr 0x00000004 +#define AOFF_thread_kwim 0x0000001c +#define ASIZ_thread_kwim 0x00000004 +#define AOFF_thread_fork_kpsr 0x00000020 +#define ASIZ_thread_fork_kpsr 0x00000004 +#define AOFF_thread_fork_kwim 0x00000024 +#define ASIZ_thread_fork_kwim 0x00000004 +#define AOFF_thread_reg_window 0x00000028 +#define ASIZ_thread_reg_window 0x00000200 +#define AOFF_thread_rwbuf_stkptrs 0x00000228 +#define ASIZ_thread_rwbuf_stkptrs 0x00000020 +#define AOFF_thread_w_saved 0x00000248 +#define ASIZ_thread_w_saved 0x00000004 +#define AOFF_thread_float_regs 0x00000250 +#define ASIZ_thread_float_regs 0x00000080 +#define AOFF_thread_fsr 0x000002d0 +#define ASIZ_thread_fsr 0x00000004 +#define AOFF_thread_fpqdepth 0x000002d4 +#define ASIZ_thread_fpqdepth 0x00000004 +#define AOFF_thread_fpqueue 0x000002d8 +#define ASIZ_thread_fpqueue 0x00000080 +#define AOFF_thread_sstk_info 0x00000358 +#define ASIZ_thread_sstk_info 0x00000008 +#define AOFF_thread_flags 0x00000360 +#define ASIZ_thread_flags 0x00000004 +#define AOFF_thread_current_ds 0x00000364 +#define ASIZ_thread_current_ds 0x00000004 +#define AOFF_thread_core_exec 0x00000368 +#define ASIZ_thread_core_exec 0x00000020 +#define AOFF_thread_new_signal 0x00000388 +#define ASIZ_thread_new_signal 0x00000004 + +#else /* __SMP__ */ + +#define AOFF_task_state 0x00000000 +#define ASIZ_task_state 0x00000004 +#define AOFF_task_flags 0x00000004 #define ASIZ_task_flags 0x00000004 -#define AOFF_task_addr_limit 0x00000010 -#define ASIZ_task_addr_limit 0x00000004 -#define AOFF_task_sigpending 0x00000014 +#define AOFF_task_sigpending 0x00000008 #define ASIZ_task_sigpending 0x00000004 -#define AOFF_task_debugreg 0x00000018 -#define ASIZ_task_debugreg 0x00000020 -#define AOFF_task_exec_domain 0x00000038 +#define AOFF_task_addr_limit 0x0000000c +#define ASIZ_task_addr_limit 0x00000004 +#define AOFF_task_exec_domain 0x00000010 #define ASIZ_task_exec_domain 0x00000004 +#define AOFF_task_debugreg 0x00000014 +#define ASIZ_task_debugreg 0x00000020 +#define AOFF_task_counter 0x00000034 +#define ASIZ_task_counter 0x00000004 +#define AOFF_task_priority 0x00000038 +#define ASIZ_task_priority 0x00000004 #define AOFF_task_binfmt 0x0000003c #define ASIZ_task_binfmt 0x00000004 #define AOFF_task_next_task 0x00000040 @@ -108,72 +377,74 @@ #define ASIZ_task_times 0x00000010 #define AOFF_task_start_time 0x00000138 #define ASIZ_task_start_time 0x00000004 -#define AOFF_task_min_flt 0x0000013c +#define AOFF_task_per_cpu_utime 0x0000013c +#define ASIZ_task_per_cpu_utime 0x00000080 +#define AOFF_task_min_flt 0x0000023c #define ASIZ_task_min_flt 0x00000004 -#define AOFF_task_maj_flt 0x00000140 +#define AOFF_task_maj_flt 0x00000240 #define ASIZ_task_maj_flt 0x00000004 -#define AOFF_task_nswap 0x00000144 +#define AOFF_task_nswap 0x00000244 #define ASIZ_task_nswap 0x00000004 -#define AOFF_task_cmin_flt 0x00000148 +#define AOFF_task_cmin_flt 0x00000248 #define ASIZ_task_cmin_flt 0x00000004 -#define AOFF_task_cmaj_flt 0x0000014c +#define AOFF_task_cmaj_flt 0x0000024c #define ASIZ_task_cmaj_flt 0x00000004 -#define AOFF_task_cnswap 0x00000150 +#define AOFF_task_cnswap 0x00000250 #define ASIZ_task_cnswap 0x00000004 -#define AOFF_task_swap_address 0x00000158 +#define AOFF_task_swap_address 0x00000258 #define ASIZ_task_swap_address 0x00000004 -#define AOFF_task_old_maj_flt 0x0000015c +#define AOFF_task_old_maj_flt 0x0000025c #define ASIZ_task_old_maj_flt 0x00000004 -#define AOFF_task_dec_flt 0x00000160 +#define AOFF_task_dec_flt 0x00000260 #define ASIZ_task_dec_flt 0x00000004 -#define AOFF_task_swap_cnt 0x00000164 +#define AOFF_task_swap_cnt 0x00000264 #define ASIZ_task_swap_cnt 0x00000004 -#define AOFF_task_rlim 0x00000168 +#define AOFF_task_rlim 0x00000268 #define ASIZ_task_rlim 0x00000050 -#define AOFF_task_used_math 0x000001b8 +#define AOFF_task_used_math 0x000002b8 #define ASIZ_task_used_math 0x00000002 -#define AOFF_task_io_usage 0x000001bc +#define AOFF_task_io_usage 0x000002bc #define ASIZ_task_io_usage 0x00000004 -#define AOFF_task_comm 0x000001c0 +#define AOFF_task_comm 0x000002c0 #define ASIZ_task_comm 0x00000010 -#define AOFF_task_link_count 0x000001d0 +#define AOFF_task_link_count 0x000002d0 #define ASIZ_task_link_count 0x00000004 -#define AOFF_task_tty 0x000001d4 +#define AOFF_task_tty 0x000002d4 #define ASIZ_task_tty 0x00000004 -#define AOFF_task_semundo 0x000001d8 +#define AOFF_task_semundo 0x000002d8 #define ASIZ_task_semundo 0x00000004 -#define AOFF_task_semsleeping 0x000001dc +#define AOFF_task_semsleeping 0x000002dc #define ASIZ_task_semsleeping 0x00000004 -#define AOFF_task_ldt 0x000001e0 +#define AOFF_task_ldt 0x000002e0 #define ASIZ_task_ldt 0x00000004 -#define AOFF_task_tss 0x000001e8 +#define AOFF_task_tss 0x000002e8 #define ASIZ_task_tss 0x00000390 -#define AOFF_task_fs 0x00000578 +#define AOFF_task_fs 0x00000678 #define ASIZ_task_fs 0x00000004 -#define AOFF_task_files 0x0000057c +#define AOFF_task_files 0x0000067c #define ASIZ_task_files 0x00000004 -#define AOFF_task_mm 0x00000580 +#define AOFF_task_mm 0x00000680 #define ASIZ_task_mm 0x00000004 -#define AOFF_task_sig 0x00000584 +#define AOFF_task_sig 0x00000684 #define ASIZ_task_sig 0x00000004 -#define AOFF_task_signal 0x00000588 +#define AOFF_task_signal 0x00000688 #define ASIZ_task_signal 0x00000008 -#define AOFF_task_blocked 0x00000590 +#define AOFF_task_blocked 0x00000690 #define ASIZ_task_blocked 0x00000008 -#define AOFF_task_sigqueue 0x00000598 +#define AOFF_task_sigqueue 0x00000698 #define ASIZ_task_sigqueue 0x00000004 -#define AOFF_task_sigqueue_tail 0x0000059c +#define AOFF_task_sigqueue_tail 0x0000069c #define ASIZ_task_sigqueue_tail 0x00000004 -#define AOFF_task_has_cpu 0x000005a0 +#define AOFF_task_has_cpu 0x000006a0 #define ASIZ_task_has_cpu 0x00000004 -#define AOFF_task_processor 0x000005a4 +#define AOFF_task_processor 0x000006a4 #define ASIZ_task_processor 0x00000004 -#define AOFF_task_last_processor 0x000005a8 +#define AOFF_task_last_processor 0x000006a8 #define ASIZ_task_last_processor 0x00000004 -#define AOFF_task_lock_depth 0x000005ac +#define AOFF_task_lock_depth 0x000006ac #define ASIZ_task_lock_depth 0x00000004 -#define AOFF_task_sigmask_lock 0x000005b0 -#define ASIZ_task_sigmask_lock 0x00000000 +#define AOFF_task_sigmask_lock 0x000006b0 +#define ASIZ_task_sigmask_lock 0x00000001 #define AOFF_mm_mmap 0x00000000 #define ASIZ_mm_mmap 0x00000004 #define AOFF_mm_mmap_cache 0x00000004 @@ -182,26 +453,26 @@ #define ASIZ_mm_pgd 0x00000004 #define AOFF_mm_count 0x0000000c #define ASIZ_mm_count 0x00000004 -#define AOFF_mm_mmap_sem 0x00000010 +#define AOFF_mm_map_count 0x00000010 +#define ASIZ_mm_map_count 0x00000004 +#define AOFF_mm_mmap_sem 0x00000014 #define ASIZ_mm_mmap_sem 0x0000000c -#define AOFF_mm_context 0x0000001c +#define AOFF_mm_context 0x00000020 #define ASIZ_mm_context 0x00000004 -#define AOFF_mm_start_code 0x00000020 +#define AOFF_mm_start_code 0x00000024 #define ASIZ_mm_start_code 0x00000004 -#define AOFF_mm_end_code 0x00000024 +#define AOFF_mm_end_code 0x00000028 #define ASIZ_mm_end_code 0x00000004 -#define AOFF_mm_start_data 0x00000028 +#define AOFF_mm_start_data 0x0000002c #define ASIZ_mm_start_data 0x00000004 -#define AOFF_mm_end_data 0x0000002c +#define AOFF_mm_end_data 0x00000030 #define ASIZ_mm_end_data 0x00000004 -#define AOFF_mm_start_brk 0x00000030 +#define AOFF_mm_start_brk 0x00000034 #define ASIZ_mm_start_brk 0x00000004 -#define AOFF_mm_brk 0x00000034 +#define AOFF_mm_brk 0x00000038 #define ASIZ_mm_brk 0x00000004 -#define AOFF_mm_start_stack 0x00000038 +#define AOFF_mm_start_stack 0x0000003c #define ASIZ_mm_start_stack 0x00000004 -#define AOFF_mm_start_mmap 0x0000003c -#define ASIZ_mm_start_mmap 0x00000004 #define AOFF_mm_arg_start 0x00000040 #define ASIZ_mm_arg_start 0x00000004 #define AOFF_mm_arg_end 0x00000044 @@ -265,4 +536,6 @@ #define AOFF_thread_new_signal 0x00000388 #define ASIZ_thread_new_signal 0x00000004 +#endif /* __SMP__ */ + #endif /* __ASM_OFFSETS_H__ */ diff --git a/include/asm-sparc/asmmacro.h b/include/asm-sparc/asmmacro.h index 40c71b0d6..ed49f6ea0 100644 --- a/include/asm-sparc/asmmacro.h +++ b/include/asm-sparc/asmmacro.h @@ -6,11 +6,24 @@ #ifndef _SPARC_ASMMACRO_H #define _SPARC_ASMMACRO_H -#define GET_PROCESSOR_ID(reg) \ +#include <linux/config.h> +#include <asm/btfixup.h> +#include <asm/asi.h> + +#define GET_PROCESSOR4M_ID(reg) \ rd %tbr, %reg; \ srl %reg, 12, %reg; \ and %reg, 3, %reg; +#define GET_PROCESSOR4D_ID(reg) \ + lda [%g0] ASI_M_VIKING_TMP1, %reg; + +/* Blackbox */ +#define GET_PROCESSOR_ID(reg) \ + sethi %hi(___b_smp_processor_id), %reg; \ + sethi %hi(boot_cpu_id), %reg; \ + ldub [%reg + %lo(boot_cpu_id)], %reg; + #define GET_PROCESSOR_MID(reg, tmp) \ rd %tbr, %reg; \ sethi C_LABEL(mid_xlate), %tmp; \ @@ -19,15 +32,15 @@ and %reg, 3, %reg; \ ldub [%tmp + %reg], %reg; -#define GET_PROCESSOR_OFFSET(reg) \ +#define GET_PROCESSOR_OFFSET(reg, tmp) \ GET_PROCESSOR_ID(reg) \ - sll %reg, 2, %reg; - -#define PROCESSOR_OFFSET_TO_ID(reg) \ - srl %reg, 2, %reg; + sethi C_LABEL(cpu_offset), %tmp; \ + sll %reg, 2, %reg; \ + or %tmp, %lo(C_LABEL(cpu_offset)), %tmp; \ + ld [%tmp + %reg], %reg; -#define PROCESSOR_ID_TO_OFFSET(reg) \ - sll %reg, 2, %reg; +#define GET_PAGE_OFFSET(reg) \ + sethi BTFIXUP_SETHI_INIT(page_offset,0xf0000000), %reg; /* All trap entry points _must_ begin with this macro or else you * lose. It makes sure the kernel has a proper window so that @@ -43,4 +56,15 @@ /* All traps low-level code here must end with this macro. */ #define RESTORE_ALL b ret_trap_entry; clr %l6; +/* sun4 probably wants half word accesses to ASI_SEGMAP, while sun4c+ + likes byte accesses. These are to avoid ifdef mania. */ + +#ifdef CONFIG_SUN4 +#define lduXa lduha +#define stXa stha +#else +#define lduXa lduba +#define stXa stba +#endif + #endif /* !(_SPARC_ASMMACRO_H) */ diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h index a433b684c..dbc259cb6 100644 --- a/include/asm-sparc/bitops.h +++ b/include/asm-sparc/bitops.h @@ -1,4 +1,4 @@ -/* $Id: bitops.h,v 1.48 1997/12/18 02:44:06 ecd Exp $ +/* $Id: bitops.h,v 1.49 1998/02/23 01:46:44 rth Exp $ * bitops.h: Bit string operations on the Sparc. * * Copyright 1995 David S. Miller (davem@caip.rutgers.edu) @@ -60,7 +60,7 @@ extern __inline__ unsigned long clear_bit(unsigned long nr, void *addr) return (unsigned long) ADDR; } -extern __inline__ unsigned long change_bit(unsigned long nr, void *addr) +extern __inline__ void change_bit(unsigned long nr, void *addr) { int mask; unsigned long *ADDR = (unsigned long *) addr; @@ -76,8 +76,6 @@ extern __inline__ unsigned long change_bit(unsigned long nr, void *addr) : "=&r" (ADDR) : "0" (ADDR), "r" (mask) : "g2", "g3"); - - return (unsigned long) ADDR; } #else /* __KERNEL__ */ @@ -136,7 +134,7 @@ extern __inline__ unsigned long test_and_clear_bit(unsigned long nr, __SMPVOL vo return mask; } -extern __inline__ unsigned long clear_bit(unsigned long nr, __SMPVOL void *addr) +extern __inline__ void clear_bit(unsigned long nr, __SMPVOL void *addr) { (void) test_and_clear_bit(nr, addr); } @@ -159,7 +157,7 @@ extern __inline__ unsigned long test_and_change_bit(unsigned long nr, __SMPVOL v return mask; } -extern __inline__ unsigned long change_bit(unsigned long nr, __SMPVOL void *addr) +extern __inline__ void change_bit(unsigned long nr, __SMPVOL void *addr) { (void) test_and_change_bit(nr, addr); } diff --git a/include/asm-sparc/btfixup.h b/include/asm-sparc/btfixup.h new file mode 100644 index 000000000..e2ad32144 --- /dev/null +++ b/include/asm-sparc/btfixup.h @@ -0,0 +1,219 @@ +/* $Id: btfixup.h,v 1.4 1998/03/09 14:04:43 jj Exp $ + * asm-sparc/btfixup.h: Macros for boot time linking. + * + * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + */ + +#ifndef _SPARC_BTFIXUP_H +#define _SPARC_BTFIXUP_H + +#include <linux/init.h> + +#ifndef __ASSEMBLY__ + +#ifdef MODULE +extern unsigned int ___illegal_use_of_BTFIXUP_SIMM13_in_module(void); +extern unsigned int ___illegal_use_of_BTFIXUP_SETHI_in_module(void); +extern unsigned int ___illegal_use_of_BTFIXUP_HALF_in_module(void); +extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void); +#endif + +/* Fixup call xx */ + +#define BTFIXUPDEF_CALL(__type, __name, __args...) \ + extern __type ___f_##__name(__args); \ + extern unsigned ___fs_##__name[3]; +#define BTFIXUPDEF_CALL_CONST(__type, __name, __args...) \ + extern __type ___f_##__name(__args) __attribute__((const)); \ + extern unsigned ___fs_##__name[3]; +#define BTFIXUP_CALL(__name) ___f_##__name + +#define BTFIXUPDEF_BLACKBOX(__name) \ + extern unsigned ___bs_##__name[2]; +#ifdef MODULE +#define BTFIXUP_BLACKBOX(__name) ___illegal_use_of_BTFIXUP_BLACKBOX_in_module +#else +/* This must be written in assembly and present in a sethi */ +#define BTFIXUP_BLACKBOX(__name) ___b_##__name +#endif + +/* Put bottom 13bits into some register variable */ + +#define BTFIXUPDEF_SIMM13(__name) \ + extern unsigned int ___sf_##__name(void) __attribute__((const)); \ + extern unsigned ___ss_##__name[2]; \ + extern __inline__ unsigned int ___sf_##__name(void) { \ + unsigned int ret; \ + __asm__ ("or %%g0, ___s_" #__name ", %0" : "=r"(ret)); \ + return ret; \ + } +#define BTFIXUPDEF_SIMM13_INIT(__name,__val) \ + extern unsigned int ___sf_##__name(void) __attribute__((const)); \ + extern unsigned ___ss_##__name[2]; \ + extern __inline__ unsigned int ___sf_##__name(void) { \ + unsigned int ret; \ + __asm__ ("or %%g0, ___s_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ + return ret; \ + } +#ifdef MODULE +#define BTFIXUP_SIMM13(__name) ___illegal_use_of_BTFIXUP_SIMM13_in_module() +#else +#define BTFIXUP_SIMM13(__name) ___sf_##__name() +#endif + +/* Put either bottom 13 bits, or upper 22 bits into some register variable + * (depending on the value, this will lead into sethi FIX, reg; or + * mov FIX, reg; ) + */ + +#define BTFIXUPDEF_HALF(__name) \ + extern unsigned int ___af_##__name(void) __attribute__((const)); \ + extern unsigned ___as_##__name[2]; \ + extern __inline__ unsigned int ___af_##__name(void) { \ + unsigned int ret; \ + __asm__ ("or %%g0, ___a_" #__name ", %0" : "=r"(ret)); \ + return ret; \ + } +#define BTFIXUPDEF_HALF_INIT(__name,__val) \ + extern unsigned int ___af_##__name(void) __attribute__((const)); \ + extern unsigned ___as_##__name[2]; \ + extern __inline__ unsigned int ___af_##__name(void) { \ + unsigned int ret; \ + __asm__ ("or %%g0, ___a_" #__name "__btset_" #__val ", %0" : "=r"(ret));\ + return ret; \ + } +#ifdef MODULE +#define BTFIXUP_HALF(__name) ___illegal_use_of_BTFIXUP_HALF_in_module() +#else +#define BTFIXUP_HALF(__name) ___af_##__name() +#endif + +/* Put upper 22 bits into some register variable */ + +#define BTFIXUPDEF_SETHI(__name) \ + extern unsigned int ___hf_##__name(void) __attribute__((const)); \ + extern unsigned ___hs_##__name[2]; \ + extern __inline__ unsigned int ___hf_##__name(void) { \ + unsigned int ret; \ + __asm__ ("sethi %%hi(___h_" #__name "), %0" : "=r"(ret)); \ + return ret; \ + } +#define BTFIXUPDEF_SETHI_INIT(__name,__val) \ + extern unsigned int ___hf_##__name(void) __attribute__((const)); \ + extern unsigned ___hs_##__name[2]; \ + extern __inline__ unsigned int ___hf_##__name(void) { \ + unsigned int ret; \ + __asm__ ("sethi %%hi(___h_" #__name "__btset_" #__val "), %0" : \ + "=r"(ret)); \ + return ret; \ + } +#ifdef MODULE +#define BTFIXUP_SETHI(__name) ___illegal_use_of_BTFIXUP_SETHI_in_module() +#else +#define BTFIXUP_SETHI(__name) ___hf_##__name() +#endif + +/* Put a full 32bit integer into some register variable */ + +#define BTFIXUPDEF_INT(__name) \ + extern unsigned char ___i_##__name; \ + extern unsigned ___is_##__name[2]; +#ifdef MODULE +#define BTFIXUP_INT(__name) ___illegal_use_of_BTFIXUP_INT_in_module() +#else +#define BTFIXUP_INT(__name) ((unsigned int)&___i_##__name) +#endif + +#define BTFIXUPCALL_NORM 0x00000000 /* Always call */ +#define BTFIXUPCALL_NOP 0x01000000 /* Possibly optimize to nop */ +#define BTFIXUPCALL_RETINT(i) (0x90102000|((i) & 0x1fff)) /* Possibly optimize to mov i, %o0 */ +#define BTFIXUPCALL_ORINT(i) (0x90122000|((i) & 0x1fff)) /* Possibly optimize to or %o0, i, %o0 */ +#define BTFIXUPCALL_RETO0 0x01000000 /* Return first parameter, actually a nop */ +#define BTFIXUPCALL_ANDNINT(i) (0x902a2000|((i) & 0x1fff)) /* Possibly optimize to andn %o0, i, %o0 */ +#define BTFIXUPCALL_SWAPO0O1 0xd27a0000 /* Possibly optimize to swap [%o0],%o1 */ +#define BTFIXUPCALL_SWAPO0G0 0xc07a0000 /* Possibly optimize to swap [%o0],%g0 */ +#define BTFIXUPCALL_SWAPG1G2 0xc4784000 /* Possibly optimize to swap [%g1],%g2 */ +#define BTFIXUPCALL_STG0O0 0xc0220000 /* Possibly optimize to st %g0,[%o0] */ +#define BTFIXUPCALL_STO1O0 0xd2220000 /* Possibly optimize to st %o1,[%o0] */ + +#define BTFIXUPSET_CALL(__name, __addr, __insn) \ + do { \ + ___fs_##__name[0] |= 1; \ + ___fs_##__name[1] = (unsigned long)__addr; \ + ___fs_##__name[2] = __insn; \ + } while (0) + +#define BTFIXUPSET_BLACKBOX(__name, __func) \ + do { \ + ___bs_##__name[0] |= 1; \ + ___bs_##__name[1] = (unsigned long)__func; \ + } while (0) + +#define BTFIXUPCOPY_CALL(__name, __from) \ + do { \ + ___fs_##__name[0] |= 1; \ + ___fs_##__name[1] = ___fs_##__from[1]; \ + ___fs_##__name[2] = ___fs_##__from[2]; \ + } while (0) + +#define BTFIXUPSET_SIMM13(__name, __val) \ + do { \ + ___ss_##__name[0] |= 1; \ + ___ss_##__name[1] = (unsigned)__val; \ + } while (0) + +#define BTFIXUPCOPY_SIMM13(__name, __from) \ + do { \ + ___ss_##__name[0] |= 1; \ + ___ss_##__name[1] = ___ss_##__from[1]; \ + } while (0) + +#define BTFIXUPSET_HALF(__name, __val) \ + do { \ + ___as_##__name[0] |= 1; \ + ___as_##__name[1] = (unsigned)__val; \ + } while (0) + +#define BTFIXUPCOPY_HALF(__name, __from) \ + do { \ + ___as_##__name[0] |= 1; \ + ___as_##__name[1] = ___as_##__from[1]; \ + } while (0) + +#define BTFIXUPSET_SETHI(__name, __val) \ + do { \ + ___hs_##__name[0] |= 1; \ + ___hs_##__name[1] = (unsigned)__val; \ + } while (0) + +#define BTFIXUPCOPY_SETHI(__name, __from) \ + do { \ + ___hs_##__name[0] |= 1; \ + ___hs_##__name[1] = ___hs_##__from[1]; \ + } while (0) + +#define BTFIXUPSET_INT(__name, __val) \ + do { \ + ___is_##__name[0] |= 1; \ + ___is_##__name[1] = (unsigned)__val; \ + } while (0) + +#define BTFIXUPCOPY_INT(__name, __from) \ + do { \ + ___is_##__name[0] |= 1; \ + ___is_##__name[1] = ___is_##__from[1]; \ + } while (0) + +#define BTFIXUPVAL_CALL(__name) \ + ((unsigned long)___fs_##__name[1]) + +extern void btfixup(void); + +#else /* __ASSEMBLY__ */ + +#define BTFIXUP_SETHI(__name) %hi(___h_ ## __name) +#define BTFIXUP_SETHI_INIT(__name,__val) %hi(___h_ ## __name ## __btset_ ## __val) + +#endif /* __ASSEMBLY__ */ + +#endif /* !(_SPARC_BTFIXUP_H) */ diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h index 85311970c..90bb1976a 100644 --- a/include/asm-sparc/checksum.h +++ b/include/asm-sparc/checksum.h @@ -1,4 +1,4 @@ -/* $Id: checksum.h,v 1.27 1997/04/11 00:42:18 davem Exp $ */ +/* $Id: checksum.h,v 1.28 1998/04/17 02:37:25 davem Exp $ */ #ifndef __SPARC_CHECKSUM_H #define __SPARC_CHECKSUM_H @@ -158,10 +158,22 @@ extern __inline__ unsigned short ip_fast_csum(__const__ unsigned char *iph, return sum; } -/* computes the checksum of the TCP/UDP pseudo-header - * returns a 16-bit checksum, already complemented - */ -extern __inline__ unsigned short csum_tcpudp_magic(unsigned long saddr, +/* Fold a partial checksum without adding pseudo headers. */ +extern __inline__ unsigned int csum_fold(unsigned int sum) +{ + unsigned int tmp; + + __asm__ __volatile__("addcc\t%0, %1, %1\n\t" + "srl\t%1, 16, %1\n\t" + "addx\t%1, %%g0, %1\n\t" + "xnor\t%%g0, %1, %0" + : "=&r" (sum), "=r" (tmp) + : "0" (sum), "1" (sum<<16) + : "cc"); + return sum; +} + +extern __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned int len, unsigned short proto, @@ -171,11 +183,6 @@ extern __inline__ unsigned short csum_tcpudp_magic(unsigned long saddr, "addxcc\t%2, %0, %0\n\t" "addxcc\t%3, %0, %0\n\t" "addx\t%0, %%g0, %0\n\t" - "sll\t%0, 16, %1\n\t" - "addcc\t%1, %0, %0\n\t" - "srl\t%0, 16, %0\n\t" - "addx\t%0, %%g0, %0\n\t" - "xnor\t%%g0, %0, %0" : "=r" (sum), "=r" (saddr) : "r" (daddr), "r" ((proto<<16)+len), "0" (sum), "1" (saddr) @@ -183,19 +190,17 @@ extern __inline__ unsigned short csum_tcpudp_magic(unsigned long saddr, return sum; } -/* Fold a partial checksum without adding pseudo headers. */ -extern __inline__ unsigned int csum_fold(unsigned int sum) +/* + * computes the checksum of the TCP/UDP pseudo-header + * returns a 16-bit checksum, already complemented + */ +static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, + unsigned long daddr, + unsigned short len, + unsigned short proto, + unsigned int sum) { - unsigned int tmp; - - __asm__ __volatile__("addcc\t%0, %1, %1\n\t" - "srl\t%1, 16, %1\n\t" - "addx\t%1, %%g0, %1\n\t" - "xnor\t%%g0, %1, %0" - : "=&r" (sum), "=r" (tmp) - : "0" (sum), "1" (sum<<16) - : "cc"); - return sum; + return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); } #define _HAVE_ARCH_IPV6_CSUM diff --git a/include/asm-sparc/contregs.h b/include/asm-sparc/contregs.h index adf4718a2..1657f7d0b 100644 --- a/include/asm-sparc/contregs.h +++ b/include/asm-sparc/contregs.h @@ -1,4 +1,4 @@ -/* $Id: contregs.h,v 1.6 1995/11/25 02:31:27 davem Exp $ */ +/* $Id: contregs.h,v 1.7 1998/01/30 10:59:48 jj Exp $ */ #ifndef _SPARC_CONTREGS_H #define _SPARC_CONTREGS_H @@ -14,7 +14,7 @@ #define AC_CONTEXT 0x30000000 /* 4c current mmu-context */ #define AC_SENABLE 0x40000000 /* 4c system dvma/cache/reset enable reg */ #define AC_UDVMA_ENB 0x50000000 /* 4 Not used on Sun boards, byte */ -#define AC_BUS_ERROR 0x60000000 /* 4 Cleared on read, byte. */ +#define AC_BUS_ERROR 0x60000000 /* 4 Not cleared on read, byte. */ #define AC_SYNC_ERR 0x60000000 /* c fault type */ #define AC_SYNC_VA 0x60000004 /* c fault virtual address */ #define AC_ASYNC_ERR 0x60000008 /* c asynchronous fault type */ diff --git a/include/asm-sparc/dma.h b/include/asm-sparc/dma.h index 9c6885d10..a9f43c034 100644 --- a/include/asm-sparc/dma.h +++ b/include/asm-sparc/dma.h @@ -1,4 +1,4 @@ -/* $Id: dma.h,v 1.24 1997/04/10 05:13:21 davem Exp $ +/* $Id: dma.h,v 1.25 1998/02/09 13:27:01 jj Exp $ * include/asm-sparc/dma.h * * Copyright 1995 (C) David S. Miller (davem@caip.rutgers.edu) @@ -7,6 +7,7 @@ #ifndef _ASM_SPARC_DMA_H #define _ASM_SPARC_DMA_H +#include <linux/config.h> #include <linux/kernel.h> #include <linux/types.h> @@ -71,7 +72,13 @@ struct Linux_SBus_DMA { extern struct Linux_SBus_DMA *dma_chain; /* Broken hardware... */ +#ifdef CONFIG_SUN4 +/* Have to sort this out. Does rev0 work fine on sun4[cmd] without isbroken? + * Or is rev0 present only on sun4 boxes? -jj */ +#define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev0 || (dma)->revision == dvmarev1) +#else #define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev1) +#endif #define DMA_ISESC1(dma) ((dma)->revision == dvmaesc1) /* Main routines in dma.c */ diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h index 483cd73f2..ac1fc8300 100644 --- a/include/asm-sparc/elf.h +++ b/include/asm-sparc/elf.h @@ -1,4 +1,4 @@ -/* $Id: elf.h,v 1.11 1997/09/26 18:37:32 tdyas Exp $ */ +/* $Id: elf.h,v 1.15 1998/03/23 08:41:32 jj Exp $ */ #ifndef __ASMSPARC_ELF_H #define __ASMSPARC_ELF_H @@ -6,6 +6,7 @@ * ELF register definitions.. */ +#include <linux/config.h> #include <asm/ptrace.h> #include <asm/mbus.h> @@ -29,7 +30,12 @@ typedef unsigned long elf_fpregset_t; #define ELF_DATA ELFDATA2MSB #define USE_ELF_CORE_DUMP +#ifndef CONFIG_SUN4 #define ELF_EXEC_PAGESIZE 4096 +#else +#define ELF_EXEC_PAGESIZE 8192 +#endif + /* This is the location that an ET_DYN program is loaded if exec'ed. Typical use of this is to invoke "./ld.so someprog" to test out a new version of @@ -45,7 +51,7 @@ typedef unsigned long elf_fpregset_t; /* Sun4c has none of the capabilities, most sun4m's have them all. * XXX This is gross, set some global variable at boot time. -DaveM */ -#define ELF_HWCAP ((sparc_cpu_model == sun4c) ? 0 : \ +#define ELF_HWCAP ((ARCH_SUN4C_SUN4) ? 0 : \ (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \ HWCAP_SPARC_SWAP | \ ((srmmu_modtype != Cypress && \ @@ -55,7 +61,7 @@ typedef unsigned long elf_fpregset_t; /* This yields a string that ld.so will use to load implementation specific libraries for optimization. This is more specific in - intent than poking at uname or /proc/cpuinfo. */ + intent than poking at uname or /proc/cpuinfo. */ #define ELF_PLATFORM (NULL) diff --git a/include/asm-sparc/head.h b/include/asm-sparc/head.h index 7693be507..94e6b8333 100644 --- a/include/asm-sparc/head.h +++ b/include/asm-sparc/head.h @@ -1,4 +1,4 @@ -/* $Id: head.h,v 1.33 1997/10/04 08:54:22 ecd Exp $ */ +/* $Id: head.h,v 1.35 1998/03/18 09:15:40 jj Exp $ */ #ifndef __SPARC_HEAD_H #define __SPARC_HEAD_H @@ -10,8 +10,7 @@ #define NCPUS 4 /* Architectural limit of sun4m. */ -#define SUN4_PROM_VECTOR 0xFFE81000 /* To safely die on a SUN4 */ -#define SUN4_PRINTF 0x84 /* Offset into SUN4_PROM_VECTOR */ +#define SUN4_PROM_VECTOR 0xFFE81000 /* SUN4 PROM needs to be hardwired */ #define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */ #define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */ @@ -32,6 +31,10 @@ #define BAD_TRAP(num) \ rd %psr, %l0; mov num, %l7; b bad_trap_handler; rd %wim, %l3; +/* This is for traps when we want just skip the instruction which caused it */ +#define SKIP_TRAP(type, name) \ + jmpl %l2, %g0; rett %l2 + 4; nop; nop; + /* Notice that for the system calls we pull a trick. We load up a * different pointer to the system call vector table in %l7, but call * the same generic system call low-level entry point. The trap table diff --git a/include/asm-sparc/io-unit.h b/include/asm-sparc/io-unit.h index 606346937..d76219df4 100644 --- a/include/asm-sparc/io-unit.h +++ b/include/asm-sparc/io-unit.h @@ -1,6 +1,6 @@ /* io-unit.h: Definitions for the sun4d IO-UNIT. * - * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) */ #ifndef _SPARC_IO_UNIT_H #define _SPARC_IO_UNIT_H @@ -22,8 +22,8 @@ #define IOUNIT_DMA_BASE 0xfc000000 /* TOP - 64M */ #define IOUNIT_DMA_SIZE 0x04000000 /* 64M */ -/* We use last 4M for sparc_dvma_malloc */ -#define IOUNIT_DVMA_SIZE 0x00400000 /* 4M */ +/* We use last 1M for sparc_dvma_malloc */ +#define IOUNIT_DVMA_SIZE 0x00100000 /* 1M */ /* The format of an iopte in the external page tables */ #define IOUPTE_PAGE 0xffffff00 /* Physical page number (PA[35:12]) */ @@ -36,8 +36,18 @@ #define IOUPTE_PARITY 0x00000001 struct iounit_struct { - spinlock_t iommu_lock; + unsigned int bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned int)]; + spinlock_t lock; iopte_t *page_table; + unsigned long rotor[3]; + unsigned long limit[4]; }; +#define IOUNIT_BMAP1_START 0x00000000 +#define IOUNIT_BMAP1_END (IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 1)) +#define IOUNIT_BMAP2_START IOUNIT_BMAP1_END +#define IOUNIT_BMAP2_END IOUNIT_BMAP2_START + (IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 2)) +#define IOUNIT_BMAPM_START IOUNIT_BMAP2_END +#define IOUNIT_BMAPM_END ((IOUNIT_DMA_SIZE - IOUNIT_DVMA_SIZE) >> PAGE_SHIFT) + #endif /* !(_SPARC_IO_UNIT_H) */ diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h index b1fb5b30e..93e5fde77 100644 --- a/include/asm-sparc/io.h +++ b/include/asm-sparc/io.h @@ -1,4 +1,4 @@ -/* $Id: io.h,v 1.14 1997/04/10 05:13:22 davem Exp $ */ +/* $Id: io.h,v 1.15 1998/01/30 10:59:51 jj Exp $ */ #ifndef __SPARC_IO_H #define __SPARC_IO_H @@ -99,6 +99,7 @@ extern __inline__ void mapioaddr(unsigned long physaddr, unsigned long virt_addr { switch(sparc_cpu_model) { case sun4c: + case sun4: sun4c_mapioaddr(physaddr, virt_addr, bus, rdonly); break; case sun4m: @@ -122,6 +123,7 @@ extern __inline__ void unmapioaddr(unsigned long virt_addr) { switch(sparc_cpu_model) { case sun4c: + case sun4: sun4c_unmapioaddr(virt_addr); break; case sun4m: diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h index 60a328094..526aeef9c 100644 --- a/include/asm-sparc/irq.h +++ b/include/asm-sparc/irq.h @@ -1,4 +1,4 @@ -/* $Id: irq.h,v 1.21 1997/11/19 15:12:20 jj Exp $ +/* $Id: irq.h,v 1.22 1998/02/05 14:20:05 jj Exp $ * irq.h: IRQ registers on the Sparc. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -10,6 +10,7 @@ #include <linux/linkage.h> #include <asm/system.h> /* For NCPUS */ +#include <asm/btfixup.h> /* This is used for sun4d */ struct devid_cookie { @@ -66,27 +67,47 @@ extern __inline__ void irq_exit(int cpu, int irq) #define irq_exit(cpu, irq) (local_irq_count[cpu]--) #endif +static __inline__ int irq_cannonicalize(int irq) +{ + return irq; +} + /* Dave Redman (djhr@tadpole.co.uk) * changed these to function pointers.. it saves cycles and will allow * the irq dependencies to be split into different files at a later date * sun4c_irq.c, sun4m_irq.c etc so we could reduce the kernel size. + * Jakub Jelinek (jj@sunsite.mff.cuni.cz) + * Changed these to btfixup entities... It saves cycles :) */ -extern void (*disable_irq)(unsigned int); -extern void (*enable_irq)(unsigned int); -extern void (*disable_pil_irq)(unsigned int); -extern void (*enable_pil_irq)(unsigned int); -extern void (*clear_clock_irq)(void); -extern void (*clear_profile_irq)(int); -extern void (*load_profile_irq)(int cpu, unsigned int timeout); +BTFIXUPDEF_CALL(void, disable_irq, unsigned int) +BTFIXUPDEF_CALL(void, enable_irq, unsigned int) +BTFIXUPDEF_CALL(void, disable_pil_irq, unsigned int) +BTFIXUPDEF_CALL(void, enable_pil_irq, unsigned int) +BTFIXUPDEF_CALL(void, clear_clock_irq, void) +BTFIXUPDEF_CALL(void, clear_profile_irq, int) +BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int) + +#define disable_irq(irq) BTFIXUP_CALL(disable_irq)(irq) +#define enable_irq(irq) BTFIXUP_CALL(enable_irq)(irq) +#define disable_pil_irq(irq) BTFIXUP_CALL(disable_pil_irq)(irq) +#define enable_pil_irq(irq) BTFIXUP_CALL(enable_pil_irq)(irq) +#define clear_clock_irq() BTFIXUP_CALL(clear_clock_irq)() +#define clear_profile_irq(cpu) BTFIXUP_CALL(clear_profile_irq)(cpu) +#define load_profile_irq(cpu,limit) BTFIXUP_CALL(load_profile_irq)(cpu,limit) + extern void (*init_timers)(void (*lvl10_irq)(int, void *, struct pt_regs *)); extern void claim_ticker14(void (*irq_handler)(int, void *, struct pt_regs *), int irq, unsigned int timeout); #ifdef __SMP__ -extern void (*set_cpu_int)(int, int); -extern void (*clear_cpu_int)(int, int); -extern void (*set_irq_udt)(int); +BTFIXUPDEF_CALL(void, set_cpu_int, int, int) +BTFIXUPDEF_CALL(void, clear_cpu_int, int, int) +BTFIXUPDEF_CALL(void, set_irq_udt, int) + +#define set_cpu_int(cpu,level) BTFIXUP_CALL(set_cpu_int)(cpu,level) +#define clear_cpu_int(cpu,level) BTFIXUP_CALL(clear_cpu_int)(cpu,level) +#define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu) #endif extern int request_fast_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, __const__ char *devname); diff --git a/include/asm-sparc/mmu_context.h b/include/asm-sparc/mmu_context.h index d104a758c..d6ac7e922 100644 --- a/include/asm-sparc/mmu_context.h +++ b/include/asm-sparc/mmu_context.h @@ -1,6 +1,8 @@ #ifndef __SPARC_MMU_CONTEXT_H #define __SPARC_MMU_CONTEXT_H +#include <asm/btfixup.h> + /* For now I still leave the context handling in the * switch_to() macro, I'll do it right soon enough. */ @@ -9,11 +11,15 @@ /* Initialize the context related info for a new mm_struct * instance. */ -extern void (*init_new_context)(struct mm_struct *mm); +BTFIXUPDEF_CALL(void, init_new_context, struct mm_struct *) + +#define init_new_context(mm) BTFIXUP_CALL(init_new_context)(mm) /* Destroy context related info for an mm_struct that is about * to be put to rest. */ -extern void (*destroy_context)(struct mm_struct *mm); +BTFIXUPDEF_CALL(void, destroy_context, struct mm_struct *) + +#define destroy_context(mm) BTFIXUP_CALL(destroy_context)(mm) #endif /* !(__SPARC_MMU_CONTEXT_H) */ diff --git a/include/asm-sparc/namei.h b/include/asm-sparc/namei.h index d16626424..401e80820 100644 --- a/include/asm-sparc/namei.h +++ b/include/asm-sparc/namei.h @@ -1,4 +1,4 @@ -/* $Id: namei.h,v 1.10 1997/09/24 16:20:36 jj Exp $ +/* $Id: namei.h,v 1.11 1998/01/15 12:58:24 jj Exp $ * linux/include/asm-sparc/namei.h * * Routines to handle famous /usr/gnemul/s*. @@ -18,8 +18,11 @@ __sparc_lookup_dentry(const char *name, int follow_link) char *emul; switch (current->personality) { +#if 0 +/* Until we solve, why SunOS apps sometime crash, disable gnemul support for SunOS */ case PER_BSD: emul = SPARC_BSD_EMUL; break; +#endif case PER_SVR4: emul = SPARC_SOL_EMUL; break; default: diff --git a/include/asm-sparc/obio.h b/include/asm-sparc/obio.h index 171a0a34d..62e1d7796 100644 --- a/include/asm-sparc/obio.h +++ b/include/asm-sparc/obio.h @@ -1,4 +1,4 @@ -/* $Id: obio.h,v 1.3 1997/12/18 14:21:41 jj Exp $ +/* $Id: obio.h,v 1.4 1998/03/09 14:04:55 jj Exp $ * obio.h: Some useful locations in 0xFXXXXXXXX PA obio space on sun4d. * * Copyright (C) 1997 Jakub Jelinek <jj@sunsite.mff.cuni.cz> @@ -66,9 +66,20 @@ /* Boot Bus */ #define BB_LOCAL_BASE 0xf0000000 +#define BB_STAT1 0x00100000 +#define BB_STAT2 0x00120000 +#define BB_STAT3 0x00140000 #define BB_LEDS 0x002e0000 +/* Bits in BB_STAT2 */ +#define BB_STAT2_AC_INTR 0x04 /* Aiee! 5ms and power is gone... */ +#define BB_STAT2_TMP_INTR 0x10 /* My Penguins are burning. Are you able to smell it? */ +#define BB_STAT2_FAN_INTR 0x20 /* My fan refuses to work */ +#define BB_STAT2_PWR_INTR 0x40 /* On SC2000, one of the two ACs died. Ok, we go on... */ +#define BB_STAT2_MASK (BB_STAT2_AC_INTR|BB_STAT2_TMP_INTR|BB_STAT2_FAN_INTR|BB_STAT2_PWR_INTR) + /* Cache Controller */ +#define CC_BASE 0x1F00000 #define CC_DATSTREAM 0x1F00000 /* Data stream register */ #define CC_DATSIZE 0x1F0003F /* Size */ #define CC_SRCSTREAM 0x1F00100 /* Source stream register */ @@ -144,10 +155,13 @@ extern __inline__ void bw_set_ctrl(int cpu, unsigned ctrl) "i" (ASI_M_CTL)); } -extern __inline__ void show_leds(int cpuid, unsigned char mask) +extern unsigned char cpu_leds[32]; + +extern __inline__ void show_leds(int cpuid) { + cpuid &= 0x1e; __asm__ __volatile__ ("stba %0, [%1] %2" : : - "r" (mask), + "r" ((cpu_leds[cpuid] << 4) | cpu_leds[cpuid+1]), "r" (ECSR_BASE(cpuid) | BB_LEDS), "i" (ASI_M_CTL)); } @@ -190,6 +204,25 @@ extern __inline__ void cc_set_imsk(unsigned mask) "i" (ASI_M_MXCC)); } +extern __inline__ unsigned cc_get_imsk_other(int cpuid) +{ + unsigned mask; + + __asm__ __volatile__ ("lduha [%1] %2, %0" : + "=r" (mask) : + "r" (ECSR_BASE(cpuid) | CC_IMSK), + "i" (ASI_M_CTL)); + return mask; +} + +extern __inline__ void cc_set_imsk_other(int cpuid, unsigned mask) +{ + __asm__ __volatile__ ("stha %0, [%1] %2" : : + "r" (mask), + "r" (ECSR_BASE(cpuid) | CC_IMSK), + "i" (ASI_M_CTL)); +} + extern __inline__ void cc_set_igen(unsigned gen) { __asm__ __volatile__ ("sta %0, [%1] %2" : : @@ -198,6 +231,19 @@ extern __inline__ void cc_set_igen(unsigned gen) "i" (ASI_M_MXCC)); } +/* +-------+-------------+-----------+------------------------------------+ + * | bcast | devid | sid | levels mask | + * +-------+-------------+-----------+------------------------------------+ + * 31 30 23 22 15 14 0 + */ +#define IGEN_MESSAGE(bcast, devid, sid, levels) \ + (((bcast) << 31) | ((devid) << 23) | ((sid) << 15) | (levels)) + +extern __inline__ void sun4d_send_ipi(int cpu, int level) +{ + cc_set_igen(IGEN_MESSAGE(0, cpu << 3, 6 + ((level >> 1) & 7), 1 << (level - 1))); +} + #endif /* !__ASSEMBLY__ */ #endif /* !(_SPARC_OBIO_H) */ diff --git a/include/asm-sparc/oplib.h b/include/asm-sparc/oplib.h index f91394a7f..2d1094b07 100644 --- a/include/asm-sparc/oplib.h +++ b/include/asm-sparc/oplib.h @@ -1,4 +1,4 @@ -/* $Id: oplib.h,v 1.18 1997/09/24 11:34:18 jj Exp $ +/* $Id: oplib.h,v 1.19 1998/01/30 10:59:53 jj Exp $ * oplib.h: Describes the interface and available routines in the * Linux Prom library. * @@ -20,6 +20,7 @@ enum prom_major_version { PROM_V3, /* sun4m and later, up to sun4d/sun4e machines V3 */ PROM_P1275, /* IEEE compliant ISA based Sun PROM, only sun4u */ PROM_AP1000, /* actually no prom at all */ + PROM_SUN4, /* Old sun4 proms are totally different, but we'll shoehorn it to make it fit */ }; extern enum prom_major_version prom_vers; diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h index 2cd6512b4..922f5e5e9 100644 --- a/include/asm-sparc/page.h +++ b/include/asm-sparc/page.h @@ -1,4 +1,4 @@ -/* $Id: page.h,v 1.37 1997/11/28 15:59:21 jj Exp $ +/* $Id: page.h,v 1.40 1998/02/06 14:14:46 jj Exp $ * page.h: Various defines and such for MMU operations on the Sparc for * the Linux kernel. * @@ -8,7 +8,12 @@ #ifndef _SPARC_PAGE_H #define _SPARC_PAGE_H +#include <linux/config.h> +#ifdef CONFIG_SUN4 +#define PAGE_SHIFT 13 +#else #define PAGE_SHIFT 12 +#endif #define PAGE_SIZE (1 << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) @@ -16,6 +21,10 @@ #include <linux/config.h> #include <asm/head.h> /* for KERNBASE */ +#include <asm/btfixup.h> + +/* This is always 2048*sizeof(long), doesn't change with PAGE_SIZE */ +#define TASK_UNION_SIZE 8192 #ifndef __ASSEMBLY__ @@ -24,11 +33,20 @@ extern unsigned long page_offset; -#define PAGE_OFFSET (page_offset) +BTFIXUPDEF_SETHI_INIT(page_offset,0xf0000000) + +#ifdef MODULE +#define PAGE_OFFSET (page_offset) +#else +#define PAGE_OFFSET BTFIXUP_SETHI(page_offset) +#endif /* translate between physical and virtual addresses */ -extern unsigned long (*mmu_v2p)(unsigned long); -extern unsigned long (*mmu_p2v)(unsigned long); +BTFIXUPDEF_CALL_CONST(unsigned long, mmu_v2p, unsigned long) +BTFIXUPDEF_CALL_CONST(unsigned long, mmu_p2v, unsigned long) + +#define mmu_v2p(vaddr) BTFIXUP_CALL(mmu_v2p)(vaddr) +#define mmu_p2v(paddr) BTFIXUP_CALL(mmu_p2v)(paddr) #define __pa(x) (mmu_v2p((unsigned long)(x))) #define __va(x) ((void *)(mmu_p2v((unsigned long)(x)))) @@ -248,7 +266,9 @@ typedef unsigned long iopgprot_t; extern unsigned long sparc_unmapped_base; -#define TASK_UNMAPPED_BASE (sparc_unmapped_base) +BTFIXUPDEF_SETHI(sparc_unmapped_base) + +#define TASK_UNMAPPED_BASE BTFIXUP_SETHI(sparc_unmapped_base) /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index a8403c531..11f37e980 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.64 1997/11/07 15:01:44 jj Exp $ */ +/* $Id: pgtable.h,v 1.74 1998/03/11 04:08:37 tdyas Exp $ */ #ifndef _SPARC_PGTABLE_H #define _SPARC_PGTABLE_H @@ -6,33 +6,42 @@ * with Sparc page tables. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) + * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) */ #include <linux/mm.h> +#include <linux/config.h> #include <asm/asi.h> +#ifdef CONFIG_SUN4 +#include <asm/pgtsun4.h> +#else #include <asm/pgtsun4c.h> +#endif #include <asm/pgtsrmmu.h> #include <asm/vac-ops.h> #include <asm/oplib.h> #include <asm/sbus.h> +#include <asm/btfixup.h> +#include <asm/spinlock.h> extern void load_mmu(void); extern int io_remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot, int space); + +BTFIXUPDEF_CALL(void, quick_kernel_fault, unsigned long) -extern void (*quick_kernel_fault)(unsigned long); +#define quick_kernel_fault(addr) BTFIXUP_CALL(quick_kernel_fault)(addr) /* Allocate a block of RAM which is aligned to its size. This procedure can be used until the call to mem_init(). */ extern void *sparc_init_alloc(unsigned long *kbrk, unsigned long size); -/* translate between physical and virtual addresses */ -extern unsigned long (*mmu_v2p)(unsigned long); -extern unsigned long (*mmu_p2v)(unsigned long); - /* Routines for data transfer buffers. */ -extern char *(*mmu_lockarea)(char *, unsigned long); -extern void (*mmu_unlockarea)(char *, unsigned long); +BTFIXUPDEF_CALL(char *, mmu_lockarea, char *, unsigned long) +BTFIXUPDEF_CALL(void, mmu_unlockarea, char *, unsigned long) + +#define mmu_lockarea(vaddr,len) BTFIXUP_CALL(mmu_lockarea)(vaddr,len) +#define mmu_unlockarea(vaddr,len) BTFIXUP_CALL(mmu_unlockarea)(vaddr,len) /* Routines for getting a dvma scsi buffer. */ struct mmu_sglist { @@ -41,58 +50,76 @@ struct mmu_sglist { unsigned int len; __u32 dvma_addr; }; -extern __u32 (*mmu_get_scsi_one)(char *, unsigned long, struct linux_sbus *sbus); -extern void (*mmu_get_scsi_sgl)(struct mmu_sglist *, int, struct linux_sbus *sbus); -extern void (*mmu_release_scsi_one)(__u32, unsigned long, struct linux_sbus *sbus); -extern void (*mmu_release_scsi_sgl)(struct mmu_sglist *, int, struct linux_sbus *sbus); +BTFIXUPDEF_CALL(__u32, mmu_get_scsi_one, char *, unsigned long, struct linux_sbus *sbus) +BTFIXUPDEF_CALL(void, mmu_get_scsi_sgl, struct mmu_sglist *, int, struct linux_sbus *sbus) +BTFIXUPDEF_CALL(void, mmu_release_scsi_one, __u32, unsigned long, struct linux_sbus *sbus) +BTFIXUPDEF_CALL(void, mmu_release_scsi_sgl, struct mmu_sglist *, int, struct linux_sbus *sbus) +BTFIXUPDEF_CALL(void, mmu_map_dma_area, unsigned long addr, int len) -extern void (*mmu_map_dma_area)(unsigned long addr, int len); +#define mmu_get_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_get_scsi_one)(vaddr,len,sbus) +#define mmu_get_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_get_scsi_sgl)(sg,sz,sbus) +#define mmu_release_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_release_scsi_one)(vaddr,len,sbus) +#define mmu_release_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_release_scsi_sgl)(sg,sz,sbus) -extern unsigned int pmd_shift; -extern unsigned int pmd_size; -extern unsigned int pmd_mask; -extern unsigned int (*pmd_align)(unsigned int); +#define mmu_map_dma_area(addr,len) BTFIXUP_CALL(mmu_map_dma_area)(addr,len) -extern unsigned int pgdir_shift; -extern unsigned int pgdir_size; -extern unsigned int pgdir_mask; -extern unsigned int (*pgdir_align)(unsigned int); +BTFIXUPDEF_SIMM13(pmd_shift) +BTFIXUPDEF_SETHI(pmd_size) +BTFIXUPDEF_SETHI(pmd_mask) -extern unsigned int ptrs_per_pte; -extern unsigned int ptrs_per_pmd; -extern unsigned int ptrs_per_pgd; +extern unsigned int pmd_align(unsigned int addr) __attribute__((const)); +extern __inline__ unsigned int pmd_align(unsigned int addr) +{ + return ((addr + ~BTFIXUP_SETHI(pmd_mask)) & BTFIXUP_SETHI(pmd_mask)); +} + +BTFIXUPDEF_SIMM13(pgdir_shift) +BTFIXUPDEF_SETHI(pgdir_size) +BTFIXUPDEF_SETHI(pgdir_mask) -extern unsigned int ptrs_per_page; +extern unsigned int pgdir_align(unsigned int addr) __attribute__((const)); +extern __inline__ unsigned int pgdir_align(unsigned int addr) +{ + return ((addr + ~BTFIXUP_SETHI(pgdir_mask)) & BTFIXUP_SETHI(pgdir_mask)); +} -extern unsigned long (*(vmalloc_start))(void); +BTFIXUPDEF_SIMM13(ptrs_per_pte) +BTFIXUPDEF_SIMM13(ptrs_per_pmd) +BTFIXUPDEF_SIMM13(ptrs_per_pgd) +BTFIXUPDEF_SIMM13(user_ptrs_per_pgd) #define VMALLOC_VMADDR(x) ((unsigned long)(x)) -#define VMALLOC_START vmalloc_start() - -extern pgprot_t page_none; -extern pgprot_t page_shared; -extern pgprot_t page_copy; -extern pgprot_t page_readonly; -extern pgprot_t page_kernel; - -#define PMD_SHIFT (pmd_shift) -#define PMD_SIZE (pmd_size) -#define PMD_MASK (pmd_mask) -#define PMD_ALIGN (pmd_align) -#define PGDIR_SHIFT (pgdir_shift) -#define PGDIR_SIZE (pgdir_size) -#define PGDIR_MASK (pgdir_mask) -#define PGDIR_ALIGN (pgdir_align) -#define PTRS_PER_PTE (ptrs_per_pte) -#define PTRS_PER_PMD (ptrs_per_pmd) -#define PTRS_PER_PGD (ptrs_per_pgd) - -#define PAGE_NONE (page_none) -#define PAGE_SHARED (page_shared) -#define PAGE_COPY (page_copy) -#define PAGE_READONLY (page_readonly) -#define PAGE_KERNEL (page_kernel) -#define PAGE_INVALID (page_invalid) +/* This is the same accross all platforms */ +#define VMALLOC_START (0xfe300000) + +BTFIXUPDEF_INT(page_none) +BTFIXUPDEF_INT(page_shared) +BTFIXUPDEF_INT(page_copy) +BTFIXUPDEF_INT(page_readonly) +BTFIXUPDEF_INT(page_kernel) + +#define PMD_SHIFT BTFIXUP_SIMM13(pmd_shift) +#define PMD_SIZE BTFIXUP_SETHI(pmd_size) +#define PMD_MASK BTFIXUP_SETHI(pmd_mask) +#define PMD_ALIGN(addr) pmd_align(addr) +#define PGDIR_SHIFT BTFIXUP_SIMM13(pgdir_shift) +#define PGDIR_SIZE BTFIXUP_SETHI(pgdir_size) +#define PGDIR_MASK BTFIXUP_SETHI(pgdir_mask) +#define PGDIR_ALIGN pgdir_align(addr) +#define PTRS_PER_PTE BTFIXUP_SIMM13(ptrs_per_pte) +#define PTRS_PER_PMD BTFIXUP_SIMM13(ptrs_per_pmd) +#define PTRS_PER_PGD BTFIXUP_SIMM13(ptrs_per_pgd) +#define USER_PTRS_PER_PGD BTFIXUP_SIMM13(user_ptrs_per_pgd) + +#define PAGE_NONE __pgprot(BTFIXUP_INT(page_none)) +#define PAGE_SHARED __pgprot(BTFIXUP_INT(page_shared)) +#define PAGE_COPY __pgprot(BTFIXUP_INT(page_copy)) +#define PAGE_READONLY __pgprot(BTFIXUP_INT(page_readonly)) +#define PAGE_KERNEL __pgprot(BTFIXUP_INT(page_kernel)) + +BTFIXUPDEF_CALL(void, set_pgdir, unsigned long, pgd_t) + +#define set_pgdir(address,entry) BTFIXUP_CALL(set_pgdir)(address,entry) /* Top-level page directory */ extern pgd_t swapper_pg_dir[1024]; @@ -159,122 +186,250 @@ extern unsigned long empty_zero_page; #define SIZEOF_PTR_LOG2 2 -extern unsigned long (*pte_page)(pte_t); -extern unsigned long (*pmd_page)(pmd_t); -extern unsigned long (*pgd_page)(pgd_t); +BTFIXUPDEF_CALL_CONST(unsigned long, pte_page, pte_t) +BTFIXUPDEF_CALL_CONST(unsigned long, pmd_page, pmd_t) +BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page, pgd_t) -extern void (*sparc_update_rootmmu_dir)(struct task_struct *, pgd_t *pgdir); +#define pte_page(pte) BTFIXUP_CALL(pte_page)(pte) +#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd) +#define pgd_page(pgd) BTFIXUP_CALL(pgd_page)(pgd) -#define SET_PAGE_DIR(tsk,pgdir) sparc_update_rootmmu_dir(tsk, pgdir) +BTFIXUPDEF_CALL(void, sparc_update_rootmmu_dir, struct task_struct *, pgd_t *pgdir) + +#define SET_PAGE_DIR(tsk,pgdir) BTFIXUP_CALL(sparc_update_rootmmu_dir)(tsk, pgdir) /* to find an entry in a page-table */ #define PAGE_PTR(address) \ ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK) -extern int (*pte_none)(pte_t); -extern int (*pte_present)(pte_t); -extern void (*pte_clear)(pte_t *); +BTFIXUPDEF_SETHI(none_mask) +BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) +BTFIXUPDEF_CALL(void, pte_clear, pte_t *) + +extern __inline__ int pte_none(pte_t pte) +{ + return !(pte_val(pte) & ~BTFIXUP_SETHI(none_mask)); +} + +#define pte_present(pte) BTFIXUP_CALL(pte_present)(pte) +#define pte_clear(pte) BTFIXUP_CALL(pte_clear)(pte) + +BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t) +BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t) +BTFIXUPDEF_CALL(void, pmd_clear, pmd_t *) -extern int (*pmd_none)(pmd_t); -extern int (*pmd_bad)(pmd_t); -extern int (*pmd_present)(pmd_t); -extern void (*pmd_clear)(pmd_t *); +extern __inline__ int pmd_none(pmd_t pmd) +{ + return !(pmd_val(pmd) & ~BTFIXUP_SETHI(none_mask)); +} -extern int (*pgd_none)(pgd_t); -extern int (*pgd_bad)(pgd_t); -extern int (*pgd_present)(pgd_t); -extern void (*pgd_clear)(pgd_t *); +#define pmd_bad(pmd) BTFIXUP_CALL(pmd_bad)(pmd) +#define pmd_present(pmd) BTFIXUP_CALL(pmd_present)(pmd) +#define pmd_clear(pmd) BTFIXUP_CALL(pmd_clear)(pmd) + +BTFIXUPDEF_CALL_CONST(int, pgd_none, pgd_t) +BTFIXUPDEF_CALL_CONST(int, pgd_bad, pgd_t) +BTFIXUPDEF_CALL_CONST(int, pgd_present, pgd_t) +BTFIXUPDEF_CALL(void, pgd_clear, pgd_t *) + +#define pgd_none(pgd) BTFIXUP_CALL(pgd_none)(pgd) +#define pgd_bad(pgd) BTFIXUP_CALL(pgd_bad)(pgd) +#define pgd_present(pgd) BTFIXUP_CALL(pgd_present)(pgd) +#define pgd_clear(pgd) BTFIXUP_CALL(pgd_clear)(pgd) /* * The following only work if pte_present() is true. * Undefined behaviour if not.. */ -extern int (*pte_write)(pte_t); -extern int (*pte_dirty)(pte_t); -extern int (*pte_young)(pte_t); +BTFIXUPDEF_HALF(pte_writei) +BTFIXUPDEF_HALF(pte_dirtyi) +BTFIXUPDEF_HALF(pte_youngi) + +extern int pte_write(pte_t pte) __attribute__((const)); +extern __inline__ int pte_write(pte_t pte) +{ + return pte_val(pte) & BTFIXUP_HALF(pte_writei); +} + +extern int pte_dirty(pte_t pte) __attribute__((const)); +extern __inline__ int pte_dirty(pte_t pte) +{ + return pte_val(pte) & BTFIXUP_HALF(pte_dirtyi); +} -extern pte_t (*pte_wrprotect)(pte_t); -extern pte_t (*pte_mkclean)(pte_t); -extern pte_t (*pte_mkold)(pte_t); -extern pte_t (*pte_mkwrite)(pte_t); -extern pte_t (*pte_mkdirty)(pte_t); -extern pte_t (*pte_mkyoung)(pte_t); +extern int pte_young(pte_t pte) __attribute__((const)); +extern __inline__ int pte_young(pte_t pte) +{ + return pte_val(pte) & BTFIXUP_HALF(pte_youngi); +} + +BTFIXUPDEF_HALF(pte_wrprotecti) +BTFIXUPDEF_HALF(pte_mkcleani) +BTFIXUPDEF_HALF(pte_mkoldi) + +extern pte_t pte_wrprotect(pte_t pte) __attribute__((const)); +extern __inline__ pte_t pte_wrprotect(pte_t pte) +{ + return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_wrprotecti)); +} + +extern pte_t pte_mkclean(pte_t pte) __attribute__((const)); +extern __inline__ pte_t pte_mkclean(pte_t pte) +{ + return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkcleani)); +} + +extern pte_t pte_mkold(pte_t pte) __attribute__((const)); +extern __inline__ pte_t pte_mkold(pte_t pte) +{ + return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkoldi)); +} + +BTFIXUPDEF_CALL_CONST(pte_t, pte_mkwrite, pte_t) +BTFIXUPDEF_CALL_CONST(pte_t, pte_mkdirty, pte_t) +BTFIXUPDEF_CALL_CONST(pte_t, pte_mkyoung, pte_t) + +#define pte_mkwrite(pte) BTFIXUP_CALL(pte_mkwrite)(pte) +#define pte_mkdirty(pte) BTFIXUP_CALL(pte_mkdirty)(pte) +#define pte_mkyoung(pte) BTFIXUP_CALL(pte_mkyoung)(pte) /* * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -extern pte_t (*mk_pte)(unsigned long, pgprot_t); -extern pte_t (*mk_pte_phys)(unsigned long, pgprot_t); -extern pte_t (*mk_pte_io)(unsigned long, pgprot_t, int); +BTFIXUPDEF_CALL_CONST(pte_t, mk_pte, unsigned long, pgprot_t) +BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_phys, unsigned long, pgprot_t) +BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_io, unsigned long, pgprot_t, int) + +#define mk_pte(page,pgprot) BTFIXUP_CALL(mk_pte)(page,pgprot) +#define mk_pte_phys(page,pgprot) BTFIXUP_CALL(mk_pte_phys)(page,pgprot) +#define mk_pte_io(page,pgprot,space) BTFIXUP_CALL(mk_pte_io)(page,pgprot,space) + +BTFIXUPDEF_CALL(void, pgd_set, pgd_t *, pmd_t *) -extern void (*pgd_set)(pgd_t *, pmd_t *); +#define pgd_set(pgdp,pmdp) BTFIXUP_CALL(pgd_set)(pgdp,pmdp) -extern pte_t (*pte_modify)(pte_t, pgprot_t); +BTFIXUPDEF_INT(pte_modify_mask) + +extern pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute__((const)); +extern __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) +{ + return __pte((pte_val(pte) & BTFIXUP_INT(pte_modify_mask)) | + pgprot_val(newprot)); +} + +BTFIXUPDEF_CALL(pgd_t *, pgd_offset, struct mm_struct *, unsigned long) +BTFIXUPDEF_CALL(pmd_t *, pmd_offset, pgd_t *, unsigned long) +BTFIXUPDEF_CALL(pte_t *, pte_offset, pmd_t *, unsigned long) /* to find an entry in a kernel page-table-directory */ #define pgd_offset_k(address) pgd_offset(&init_mm, address) /* to find an entry in a page-table-directory */ -extern pgd_t * (*pgd_offset)(struct mm_struct *, unsigned long); +#define pgd_offset(mm,addr) BTFIXUP_CALL(pgd_offset)(mm,addr) /* Find an entry in the second-level page table.. */ -extern pmd_t * (*pmd_offset)(pgd_t *, unsigned long); +#define pmd_offset(dir,addr) BTFIXUP_CALL(pmd_offset)(dir,addr) /* Find an entry in the third-level page table.. */ -extern pte_t * (*pte_offset)(pmd_t *, unsigned long); +#define pte_offset(dir,addr) BTFIXUP_CALL(pte_offset)(dir,addr) + +extern struct pgtable_cache_struct { + unsigned long *pgd_cache; + unsigned long *pte_cache; + unsigned long pgtable_cache_sz; + unsigned long pgd_cache_sz; + spinlock_t pgd_spinlock; + spinlock_t pte_spinlock; +} pgt_quicklists; +#define pgd_quicklist (pgt_quicklists.pgd_cache) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist (pgt_quicklists.pte_cache) +#define pgd_spinlock (pgt_quicklists.pgd_spinlock) +#define pte_spinlock (pgt_quicklists.pte_spinlock) +#define pgtable_cache_size (pgt_quicklists.pgtable_cache_sz) +#define pgd_cache_size (pgt_quicklists.pgd_cache_sz) + +BTFIXUPDEF_CALL(pte_t *, get_pte_fast, void) +BTFIXUPDEF_CALL(pgd_t *, get_pgd_fast, void) +BTFIXUPDEF_CALL(void, free_pte_slow, pte_t *) +BTFIXUPDEF_CALL(void, free_pgd_slow, pgd_t *) + +#define get_pte_fast() BTFIXUP_CALL(get_pte_fast)() +extern __inline__ pmd_t *get_pmd_fast(void) +{ + return (pmd_t *)0; +} +#define get_pgd_fast() BTFIXUP_CALL(get_pgd_fast)() +#define free_pte_slow(pte) BTFIXUP_CALL(free_pte_slow)(pte) +extern __inline__ void free_pmd_slow(pmd_t *pmd) +{ +} +#define free_pgd_slow(pgd) BTFIXUP_CALL(free_pgd_slow)(pgd) /* * Allocate and free page tables. The xxx_kernel() versions are * used to allocate a kernel page table - this turns on ASN bits * if any, and marks the page tables reserved. */ -extern void (*pte_free_kernel)(pte_t *); +BTFIXUPDEF_CALL(void, pte_free_kernel, pte_t *) +BTFIXUPDEF_CALL(pte_t *, pte_alloc_kernel, pmd_t *, unsigned long) -extern pte_t * (*pte_alloc_kernel)(pmd_t *, unsigned long); +#define pte_free_kernel(pte) BTFIXUP_CALL(pte_free_kernel)(pte) +#define pte_alloc_kernel(pmd,addr) BTFIXUP_CALL(pte_alloc_kernel)(pmd,addr) -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -extern void (*pmd_free_kernel)(pmd_t *); +BTFIXUPDEF_CALL(void, pmd_free_kernel, pmd_t *) +BTFIXUPDEF_CALL(pmd_t *, pmd_alloc_kernel, pgd_t *, unsigned long) -extern pmd_t * (*pmd_alloc_kernel)(pgd_t *, unsigned long); +#define pmd_free_kernel(pmd) BTFIXUP_CALL(pmd_free_kernel)(pmd) +#define pmd_alloc_kernel(pgd,addr) BTFIXUP_CALL(pmd_alloc_kernel)(pgd,addr) -extern void (*pte_free)(pte_t *); +BTFIXUPDEF_CALL(void, pte_free, pte_t *) +BTFIXUPDEF_CALL(pte_t *, pte_alloc, pmd_t *, unsigned long) -extern pte_t * (*pte_alloc)(pmd_t *, unsigned long); +#define pte_free(pte) BTFIXUP_CALL(pte_free)(pte) +#define pte_alloc(pmd,addr) BTFIXUP_CALL(pte_alloc)(pmd,addr) -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -extern void (*pmd_free)(pmd_t *); +BTFIXUPDEF_CALL(void, pmd_free, pmd_t *) +BTFIXUPDEF_CALL(pmd_t *, pmd_alloc, pgd_t *, unsigned long) -extern pmd_t * (*pmd_alloc)(pgd_t *, unsigned long); +#define pmd_free(pmd) BTFIXUP_CALL(pmd_free)(pmd) +#define pmd_alloc(pgd,addr) BTFIXUP_CALL(pmd_alloc)(pgd,addr) -extern void (*pgd_free)(pgd_t *); +BTFIXUPDEF_CALL(void, pgd_free, pgd_t *) +BTFIXUPDEF_CALL(pgd_t *, pgd_alloc, void) -extern pgd_t * (*pgd_alloc)(void); +#define pgd_free(pgd) BTFIXUP_CALL(pgd_free)(pgd) +#define pgd_alloc() BTFIXUP_CALL(pgd_alloc)() /* Fine grained cache/tlb flushing. */ #ifdef __SMP__ -extern void (*local_flush_cache_all)(void); -extern void (*local_flush_cache_mm)(struct mm_struct *); -extern void (*local_flush_cache_range)(struct mm_struct *, unsigned long start, - unsigned long end); -extern void (*local_flush_cache_page)(struct vm_area_struct *, unsigned long address); +BTFIXUPDEF_CALL(void, local_flush_cache_all, void) +BTFIXUPDEF_CALL(void, local_flush_cache_mm, struct mm_struct *) +BTFIXUPDEF_CALL(void, local_flush_cache_range, struct mm_struct *, unsigned long, unsigned long) +BTFIXUPDEF_CALL(void, local_flush_cache_page, struct vm_area_struct *, unsigned long) -extern void (*local_flush_tlb_all)(void); -extern void (*local_flush_tlb_mm)(struct mm_struct *); -extern void (*local_flush_tlb_range)(struct mm_struct *, unsigned long start, - unsigned long end); -extern void (*local_flush_tlb_page)(struct vm_area_struct *, unsigned long address); +#define local_flush_cache_all() BTFIXUP_CALL(local_flush_cache_all)() +#define local_flush_cache_mm(mm) BTFIXUP_CALL(local_flush_cache_mm)(mm) +#define local_flush_cache_range(mm,start,end) BTFIXUP_CALL(local_flush_cache_range)(mm,start,end) +#define local_flush_cache_page(vma,addr) BTFIXUP_CALL(local_flush_cache_page)(vma,addr) -extern void (*local_flush_page_to_ram)(unsigned long address); +BTFIXUPDEF_CALL(void, local_flush_tlb_all, void) +BTFIXUPDEF_CALL(void, local_flush_tlb_mm, struct mm_struct *) +BTFIXUPDEF_CALL(void, local_flush_tlb_range, struct mm_struct *, unsigned long, unsigned long) +BTFIXUPDEF_CALL(void, local_flush_tlb_page, struct vm_area_struct *, unsigned long) -extern void (*local_flush_sig_insns)(struct mm_struct *mm, unsigned long insn_addr); +#define local_flush_tlb_all() BTFIXUP_CALL(local_flush_tlb_all)() +#define local_flush_tlb_mm(mm) BTFIXUP_CALL(local_flush_tlb_mm)(mm) +#define local_flush_tlb_range(mm,start,end) BTFIXUP_CALL(local_flush_tlb_range)(mm,start,end) +#define local_flush_tlb_page(vma,addr) BTFIXUP_CALL(local_flush_tlb_page)(vma,addr) + +BTFIXUPDEF_CALL(void, local_flush_page_to_ram, unsigned long) +BTFIXUPDEF_CALL(void, local_flush_sig_insns, struct mm_struct *, unsigned long) + +#define local_flush_page_to_ram(addr) BTFIXUP_CALL(local_flush_page_to_ram)(addr) +#define local_flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(local_flush_sig_insns)(mm,insn_addr) extern void smp_flush_cache_all(void); extern void smp_flush_cache_mm(struct mm_struct *mm); @@ -293,47 +448,62 @@ extern void smp_flush_page_to_ram(unsigned long page); extern void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr); #endif -extern void (*flush_cache_all)(void); -extern void (*flush_cache_mm)(struct mm_struct *); -extern void (*flush_cache_range)(struct mm_struct *, unsigned long start, - unsigned long end); -extern void (*flush_cache_page)(struct vm_area_struct *, unsigned long address); +BTFIXUPDEF_CALL(void, flush_cache_all, void) +BTFIXUPDEF_CALL(void, flush_cache_mm, struct mm_struct *) +BTFIXUPDEF_CALL(void, flush_cache_range, struct mm_struct *, unsigned long, unsigned long) +BTFIXUPDEF_CALL(void, flush_cache_page, struct vm_area_struct *, unsigned long) + +#define flush_cache_all() BTFIXUP_CALL(flush_cache_all)() +#define flush_cache_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm) +#define flush_cache_range(mm,start,end) BTFIXUP_CALL(flush_cache_range)(mm,start,end) +#define flush_cache_page(vma,addr) BTFIXUP_CALL(flush_cache_page)(vma,addr) #define flush_icache_range(start, end) do { } while (0) -extern void (*flush_tlb_all)(void); -extern void (*flush_tlb_mm)(struct mm_struct *); -extern void (*flush_tlb_range)(struct mm_struct *, unsigned long start, unsigned long end); -extern void (*flush_tlb_page)(struct vm_area_struct *, unsigned long address); +BTFIXUPDEF_CALL(void, flush_tlb_all, void) +BTFIXUPDEF_CALL(void, flush_tlb_mm, struct mm_struct *) +BTFIXUPDEF_CALL(void, flush_tlb_range, struct mm_struct *, unsigned long, unsigned long) +BTFIXUPDEF_CALL(void, flush_tlb_page, struct vm_area_struct *, unsigned long) + +#define flush_tlb_all() BTFIXUP_CALL(flush_tlb_all)() +#define flush_tlb_mm(mm) BTFIXUP_CALL(flush_tlb_mm)(mm) +#define flush_tlb_range(mm,start,end) BTFIXUP_CALL(flush_tlb_range)(mm,start,end) +#define flush_tlb_page(vma,addr) BTFIXUP_CALL(flush_tlb_page)(vma,addr) -extern void (*flush_page_to_ram)(unsigned long page); +BTFIXUPDEF_CALL(void, flush_page_to_ram, unsigned long) +BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long) -extern void (*flush_sig_insns)(struct mm_struct *mm, unsigned long insn_addr); +#define flush_page_to_ram(addr) BTFIXUP_CALL(flush_page_to_ram)(addr) +#define flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(flush_sig_insns)(mm,insn_addr) /* The permissions for pgprot_val to make a page mapped on the obio space */ extern unsigned int pg_iobits; /* MMU context switching. */ -extern void (*switch_to_context)(struct task_struct *tsk); +BTFIXUPDEF_CALL(void, switch_to_context, struct task_struct *) + +#define switch_to_context(tsk) BTFIXUP_CALL(switch_to_context)(tsk) /* Certain architectures need to do special things when pte's * within a page table are directly modified. Thus, the following * hook is made available. */ -#if 0 /* XXX try this soon XXX */ -extern void (*set_pte)(struct vm_area_struct *vma, unsigned long address, - pte_t *pteptr, pte_t pteval); -#else -extern void (*set_pte)(pte_t *pteptr, pte_t pteval); -#endif +BTFIXUPDEF_CALL(void, set_pte, pte_t *, pte_t) + +#define set_pte(ptep,pteval) BTFIXUP_CALL(set_pte)(ptep,pteval) -extern char *(*mmu_info)(void); +BTFIXUPDEF_CALL(int, mmu_info, char *) + +#define mmu_info(p) BTFIXUP_CALL(mmu_info)(p) /* Fault handler stuff... */ #define FAULT_CODE_PROT 0x1 #define FAULT_CODE_WRITE 0x2 #define FAULT_CODE_USER 0x4 -extern void (*update_mmu_cache)(struct vm_area_struct *vma, unsigned long address, pte_t pte); + +BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t) + +#define update_mmu_cache(vma,addr,pte) BTFIXUP_CALL(update_mmu_cache)(vma,addr,pte) extern int invalid_segment; @@ -373,6 +543,7 @@ extern __inline__ unsigned long __get_phys (unsigned long addr) { switch (sparc_cpu_model){ + case sun4: case sun4c: return sun4c_get_pte (addr) << PAGE_SHIFT; case sun4m: @@ -387,6 +558,7 @@ extern __inline__ int __get_iospace (unsigned long addr) { switch (sparc_cpu_model){ + case sun4: case sun4c: return -1; /* Don't check iospace on sun4c */ case sun4m: @@ -399,5 +571,9 @@ __get_iospace (unsigned long addr) #define module_map vmalloc #define module_unmap vfree +#define module_shrink vshrink + +/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ +#define PageSkip(page) (test_bit(PG_skip, &(page)->flags)) #endif /* !(_SPARC_PGTABLE_H) */ diff --git a/include/asm-sparc/pgtsun4.h b/include/asm-sparc/pgtsun4.h index 4161526c0..170465d98 100644 --- a/include/asm-sparc/pgtsun4.h +++ b/include/asm-sparc/pgtsun4.h @@ -1,10 +1,161 @@ -/* $Id: pgtsun4.h,v 1.2 1995/11/25 02:32:26 davem Exp $ - * pgtsun4.c: Regular Sun4 MMU support goes in here. +/* $Id: pgtsun4.h,v 1.3 1998/01/30 11:00:01 jj Exp $ + * pgtsun4.h: Sun4 specific pgtable.h defines and code. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) + * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) */ +#ifndef _SPARC_PGTSUN4C_H +#define _SPARC_PGTSUN4C_H -#ifndef _SPARC_PGTSUN4_H -#define _SPARC_PGTSUN4_H +#include <asm/contregs.h> + +/* PMD_SHIFT determines the size of the area a second-level page table can map */ +#define SUN4C_PMD_SHIFT 23 +#define SUN4C_PMD_SIZE (1UL << SUN4C_PMD_SHIFT) +#define SUN4C_PMD_MASK (~(SUN4C_PMD_SIZE-1)) +#define SUN4C_PMD_ALIGN(addr) (((addr)+SUN4C_PMD_SIZE-1)&SUN4C_PMD_MASK) + +/* PGDIR_SHIFT determines what a third-level page table entry can map */ +#define SUN4C_PGDIR_SHIFT 23 +#define SUN4C_PGDIR_SIZE (1UL << SUN4C_PGDIR_SHIFT) +#define SUN4C_PGDIR_MASK (~(SUN4C_PGDIR_SIZE-1)) +#define SUN4C_PGDIR_ALIGN(addr) (((addr)+SUN4C_PGDIR_SIZE-1)&SUN4C_PGDIR_MASK) + +/* To represent how the sun4c mmu really lays things out. */ +#define SUN4C_REAL_PGDIR_SHIFT 18 +#define SUN4C_REAL_PGDIR_SIZE (1UL << SUN4C_REAL_PGDIR_SHIFT) +#define SUN4C_REAL_PGDIR_MASK (~(SUN4C_REAL_PGDIR_SIZE-1)) +#define SUN4C_REAL_PGDIR_ALIGN(addr) (((addr)+SUN4C_REAL_PGDIR_SIZE-1)&SUN4C_REAL_PGDIR_MASK) + +/* 19 bit PFN on sun4 */ +#define SUN4C_PFN_MASK 0x7ffff + +/* Don't increase these unless the structures in sun4c.c are fixed */ +#define SUN4C_MAX_SEGMAPS 256 +#define SUN4C_MAX_CONTEXTS 16 + +/* + * To be efficient, and not have to worry about allocating such + * a huge pgd, we make the kernel sun4c tables each hold 1024 + * entries and the pgd similarly just like the i386 tables. + */ +#define SUN4C_PTRS_PER_PTE 1024 +#define SUN4C_PTRS_PER_PMD 1 +#define SUN4C_PTRS_PER_PGD 1024 + +/* On the sun4 the physical ram limit is 128MB. We set up our I/O + * translations at KERNBASE + 128MB for 1MB, then we begin the VMALLOC + * area, makes sense. This works out to the value below. + */ +#define SUN4C_VMALLOC_START (0xfe300000) + +/* + * Sparc SUN4C pte fields. + */ +#define _SUN4C_PAGE_VALID 0x80000000 +#define _SUN4C_PAGE_SILENT_READ 0x80000000 /* synonym */ +#define _SUN4C_PAGE_DIRTY 0x40000000 +#define _SUN4C_PAGE_SILENT_WRITE 0x40000000 /* synonym */ +#define _SUN4C_PAGE_PRIV 0x20000000 /* privileged page */ +#define _SUN4C_PAGE_NOCACHE 0x10000000 /* non-cacheable page */ +#define _SUN4C_PAGE_PRESENT 0x08000000 /* implemented in software */ +#define _SUN4C_PAGE_IO 0x04000000 /* I/O page */ +#define _SUN4C_PAGE_READ 0x00800000 /* implemented in software */ +#define _SUN4C_PAGE_WRITE 0x00400000 /* implemented in software */ +#define _SUN4C_PAGE_ACCESSED 0x00200000 /* implemented in software */ +#define _SUN4C_PAGE_MODIFIED 0x00100000 /* implemented in software */ + +#define _SUN4C_READABLE (_SUN4C_PAGE_READ|_SUN4C_PAGE_SILENT_READ|\ + _SUN4C_PAGE_ACCESSED) +#define _SUN4C_WRITEABLE (_SUN4C_PAGE_WRITE|_SUN4C_PAGE_SILENT_WRITE|\ + _SUN4C_PAGE_MODIFIED) + +#define _SUN4C_PAGE_CHG_MASK (0xffff|_SUN4C_PAGE_ACCESSED|_SUN4C_PAGE_MODIFIED) + +#define SUN4C_PAGE_NONE __pgprot(_SUN4C_PAGE_PRESENT) +#define SUN4C_PAGE_SHARED __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE|\ + _SUN4C_PAGE_WRITE) +#define SUN4C_PAGE_COPY __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) +#define SUN4C_PAGE_READONLY __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) +#define SUN4C_PAGE_KERNEL __pgprot(_SUN4C_READABLE|_SUN4C_WRITEABLE|\ + _SUN4C_PAGE_DIRTY|_SUN4C_PAGE_PRIV) + +#ifndef __ASSEMBLY__ + +extern __inline__ unsigned long sun4c_get_synchronous_error(void) +{ + unsigned long sync_err; + + __asm__ __volatile__("lda [%1] %2, %0\n\t" : + "=r" (sync_err) : + "r" (AC_SYNC_ERR), "i" (ASI_CONTROL)); + return sync_err; +} + +extern __inline__ unsigned long sun4c_get_synchronous_address(void) +{ + unsigned long sync_addr; + + __asm__ __volatile__("lda [%1] %2, %0\n\t" : + "=r" (sync_addr) : + "r" (AC_SYNC_VA), "i" (ASI_CONTROL)); + return sync_addr; +} + +/* SUN4 pte, segmap, and context manipulation */ +extern __inline__ unsigned long sun4c_get_segmap(unsigned long addr) +{ + register unsigned long entry; + + __asm__ __volatile__("\n\tlduha [%1] %2, %0\n\t" : + "=r" (entry) : + "r" (addr), "i" (ASI_SEGMAP)); + return entry; +} + +extern __inline__ void sun4c_put_segmap(unsigned long addr, unsigned long entry) +{ + __asm__ __volatile__("\n\tstha %1, [%0] %2; nop; nop; nop;\n\t" : : + "r" (addr), "r" (entry), + "i" (ASI_SEGMAP)); +} + +extern __inline__ unsigned long sun4c_get_pte(unsigned long addr) +{ + register unsigned long entry; + + __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" : + "=r" (entry) : + "r" (addr), "i" (ASI_PTE)); + return entry; +} + +extern __inline__ void sun4c_put_pte(unsigned long addr, unsigned long entry) +{ + __asm__ __volatile__("\n\tsta %1, [%0] %2; nop; nop; nop;\n\t" : : + "r" (addr), + "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE)); +} + +extern __inline__ int sun4c_get_context(void) +{ + register int ctx; + + __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" : + "=r" (ctx) : + "r" (AC_CONTEXT), "i" (ASI_CONTROL)); + + return ctx; +} + +extern __inline__ int sun4c_set_context(int ctx) +{ + __asm__ __volatile__("\n\tstba %0, [%1] %2; nop; nop; nop;\n\t" : : + "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL)); + + return ctx; +} + +#endif /* !(__ASSEMBLY__) */ #endif /* !(_SPARC_PGTSUN4_H) */ diff --git a/include/asm-sparc/pgtsun4c.h b/include/asm-sparc/pgtsun4c.h index 93b00ce72..d23881bfb 100644 --- a/include/asm-sparc/pgtsun4c.h +++ b/include/asm-sparc/pgtsun4c.h @@ -1,4 +1,4 @@ -/* $Id: pgtsun4c.h,v 1.34 1997/03/23 03:47:08 davem Exp $ +/* $Id: pgtsun4c.h,v 1.35 1998/01/30 11:00:05 jj Exp $ * pgtsun4c.h: Sun4c specific pgtable.h defines and code. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -26,6 +26,13 @@ #define SUN4C_REAL_PGDIR_MASK (~(SUN4C_REAL_PGDIR_SIZE-1)) #define SUN4C_REAL_PGDIR_ALIGN(addr) (((addr)+SUN4C_REAL_PGDIR_SIZE-1)&SUN4C_REAL_PGDIR_MASK) +/* 16 bit PFN on sun4c */ +#define SUN4C_PFN_MASK 0xffff + +/* Don't increase these unless the structures in sun4c.c are fixed */ +#define SUN4C_MAX_SEGMAPS 256 +#define SUN4C_MAX_CONTEXTS 16 + /* * To be efficient, and not have to worry about allocating such * a huge pgd, we make the kernel sun4c tables each hold 1024 diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h index 8b6bfdeed..cc5e3df5d 100644 --- a/include/asm-sparc/processor.h +++ b/include/asm-sparc/processor.h @@ -1,4 +1,4 @@ -/* $Id: processor.h,v 1.61 1997/10/22 09:25:42 jj Exp $ +/* $Id: processor.h,v 1.62 1998/02/05 14:20:02 jj Exp $ * include/asm-sparc/processor.h * * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) @@ -14,6 +14,8 @@ #include <asm/head.h> #include <asm/signal.h> #include <asm/segment.h> +#include <asm/btfixup.h> +#include <asm/page.h> /* * Bus types @@ -33,7 +35,7 @@ * That one page is used to protect kernel from intruders, so that * we can make our access_ok test faster */ -#define TASK_SIZE (page_offset) +#define TASK_SIZE PAGE_OFFSET #define COPY_TASK_STRUCT(dst, src) \ do { \ @@ -155,8 +157,11 @@ extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc, #ifdef __KERNEL__ /* Allocation and freeing of basic task resources. */ -extern struct task_struct *(*alloc_task_struct)(void); -extern void (*free_task_struct)(struct task_struct *tsk); +BTFIXUPDEF_CALL(struct task_struct *, alloc_task_struct, void) +BTFIXUPDEF_CALL(void, free_task_struct, struct task_struct *) + +#define alloc_task_struct() BTFIXUP_CALL(alloc_task_struct)() +#define free_task_struct(tsk) BTFIXUP_CALL(free_task_struct)(tsk) #define init_task (init_task_union.task) #define init_stack (init_task_union.stack) diff --git a/include/asm-sparc/sbi.h b/include/asm-sparc/sbi.h index 75aa2598b..739ccac5d 100644 --- a/include/asm-sparc/sbi.h +++ b/include/asm-sparc/sbi.h @@ -1,4 +1,4 @@ -/* $Id: sbi.h,v 1.1 1997/11/19 15:12:16 jj Exp $ +/* $Id: sbi.h,v 1.2 1998/03/09 14:04:48 jj Exp $ * sbi.h: SBI (Sbus Interface on sun4d) definitions * * Copyright (C) 1997 Jakub Jelinek <jj@sunsite.mff.cuni.cz> @@ -83,6 +83,14 @@ extern __inline__ void release_sbi(int devid, int mask) "i" (ASI_M_CTL)); } +extern __inline__ void set_sbi_tid(int devid, int targetid) +{ + __asm__ __volatile__ ("sta %0, [%1] %2" : : + "r" (targetid), + "r" (ECSR_DEV_BASE(devid) | SBI_INTR_TID), + "i" (ASI_M_CTL)); +} + extern __inline__ int get_sbi_ctl(int devid, int cfgno) { int cfg; diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h index 5e8131118..96a824dd9 100644 --- a/include/asm-sparc/sbus.h +++ b/include/asm-sparc/sbus.h @@ -1,4 +1,4 @@ -/* $Id: sbus.h,v 1.13 1997/11/19 15:12:18 jj Exp $ +/* $Id: sbus.h,v 1.14 1998/03/09 14:04:56 jj Exp $ * sbus.h: Defines for the Sun SBus. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -47,8 +47,7 @@ struct linux_sbus_device { struct linux_sbus_device *child; /* For ledma and espdma on sun4m */ struct linux_sbus *my_bus; /* Back ptr to sbus */ int prom_node; /* PROM device tree node for this device */ - char prom_name[64]; /* PROM device name */ - char linux_name[64]; /* Name used internally by Linux */ + char prom_name[32]; /* PROM device name */ struct linux_prom_registers reg_addrs[PROMREG_MAX]; int num_registers, ranges_applied; diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h index 62a97ed40..8ecf68d08 100644 --- a/include/asm-sparc/smp.h +++ b/include/asm-sparc/smp.h @@ -6,7 +6,9 @@ #ifndef _SPARC_SMP_H #define _SPARC_SMP_H +#include <linux/tasks.h> #include <asm/head.h> +#include <asm/btfixup.h> #ifndef __ASSEMBLY__ /* PROM provided per-processor information we need @@ -25,7 +27,10 @@ extern int linux_num_cpus; /* number of CPUs probed */ #ifndef __ASSEMBLY__ -extern struct prom_cpuinfo linux_cpus[NCPUS]; +#include <asm/ptrace.h> +#include <asm/asi.h> + +extern struct prom_cpuinfo linux_cpus[NR_CPUS]; /* Per processor Sparc parameters we need. */ @@ -36,6 +41,7 @@ struct cpuinfo_sparc { }; extern struct cpuinfo_sparc cpu_data[NR_CPUS]; +extern unsigned long cpu_offset[NR_CPUS]; struct klock_info { unsigned char kernel_flag; @@ -61,12 +67,28 @@ typedef void (*smpfunc_t)(unsigned long, unsigned long, unsigned long, /* * General functions that each host system must provide. */ + +void sun4m_init_smp(void); +void sun4d_init_smp(void); + +void smp_callin(void); +void smp_boot_cpus(void); +void smp_store_cpu_info(int); + +BTFIXUPDEF_CALL(void, smp_cross_call, smpfunc_t, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) +BTFIXUPDEF_CALL(void, smp_message_pass, int, int, unsigned long, int) +BTFIXUPDEF_CALL(int, __smp_processor_id, void) +BTFIXUPDEF_BLACKBOX(smp_processor_id) +BTFIXUPDEF_BLACKBOX(load_current) -extern void smp_callin(void); -extern void smp_boot_cpus(void); -extern void smp_store_cpu_info(int id); -extern void smp_cross_call(smpfunc_t func, unsigned long arg1, unsigned long arg2, - unsigned long arg3, unsigned long arg4, unsigned long arg5); +#define smp_cross_call(func,arg1,arg2,arg3,arg4,arg5) BTFIXUP_CALL(smp_cross_call)(func,arg1,arg2,arg3,arg4,arg5) +#define smp_message_pass(target,msg,data,wait) BTFIXUP_CALL(smp_message_pass)(target,msg,data,wait) + +BTFIXUPDEF_CALL(int, smp_bogo_info, char *) +BTFIXUPDEF_CALL(int, smp_info, char *) + +#define smp_bogo_info(buf) BTFIXUP_CALL(smp_bogo_info)(buf) +#define smp_info(buf) BTFIXUP_CALL(smp_info)(buf) extern __inline__ void xc0(smpfunc_t func) { smp_cross_call(func, 0, 0, 0, 0, 0); } extern __inline__ void xc1(smpfunc_t func, unsigned long arg1) @@ -84,10 +106,15 @@ extern __inline__ void xc5(smpfunc_t func, unsigned long arg1, unsigned long arg { smp_cross_call(func, arg1, arg2, arg3, arg4, arg5); } extern __volatile__ int cpu_number_map[NR_CPUS]; -extern __volatile__ int cpu_logical_map[NR_CPUS]; +extern __volatile__ int __cpu_logical_map[NR_CPUS]; extern unsigned long smp_proc_in_lock[NR_CPUS]; -extern __inline__ int hard_smp_processor_id(void) +extern __inline__ int cpu_logical_map(int cpu) +{ + return __cpu_logical_map[cpu]; +} + +extern __inline__ int hard_smp4m_processor_id(void) { int cpuid; @@ -98,6 +125,49 @@ extern __inline__ int hard_smp_processor_id(void) return cpuid; } +extern __inline__ int hard_smp4d_processor_id(void) +{ + int cpuid; + + __asm__ __volatile__("lda [%%g0] %1, %0\n\t" : + "=&r" (cpuid) : "i" (ASI_M_VIKING_TMP1)); + return cpuid; +} + +#ifndef MODULE +extern __inline__ int hard_smp_processor_id(void) +{ + int cpuid; + + /* Black box - sun4m + __asm__ __volatile__("rd %%tbr, %0\n\t" + "srl %0, 12, %0\n\t" + "and %0, 3, %0\n\t" : + "=&r" (cpuid)); + - sun4d + __asm__ __volatile__("lda [%g0] ASI_M_VIKING_TMP1, %0\n\t" + "nop; nop" : + "=&r" (cpuid)); + See btfixup.h and btfixupprep.c to understand how a blackbox works. + */ + __asm__ __volatile__("sethi %%hi(___b_smp_processor_id), %0\n\t" + "sethi %%hi(boot_cpu_id), %0\n\t" + "ldub [%0 + %%lo(boot_cpu_id)], %0\n\t" : + "=&r" (cpuid)); + return cpuid; +} +#else +extern __inline__ int hard_smp_processor_id(void) +{ + int cpuid __asm__ ("g2"); + + __asm__ __volatile__("mov %%o7, %%g1\n\t" + "call ___f___smp_processor_id\n\t" + " nop\n\t" : "=r"(cpuid) : : "g1"); + return cpuid; +} +#endif + #define smp_processor_id() hard_smp_processor_id() #endif /* !(__ASSEMBLY__) */ @@ -121,6 +191,13 @@ extern __inline__ int hard_smp_processor_id(void) #define SMP_FROM_INT 1 #define SMP_FROM_SYSCALL 2 +#else /* !(__SMP__) */ +#ifndef __ASSEMBLY__ +extern __inline__ int cpu_logical_map(int cpu) +{ + return cpu; +} +#endif #endif /* !(__SMP__) */ #define NO_PROC_ID 0xFF diff --git a/include/asm-sparc/softirq.h b/include/asm-sparc/softirq.h index 41b72b40a..204ad53f8 100644 --- a/include/asm-sparc/softirq.h +++ b/include/asm-sparc/softirq.h @@ -72,7 +72,7 @@ do { unsigned long flags; \ spin_unlock_irqrestore(&global_bh_lock, flags); \ } while(0) -#define softirq_trylock() \ +#define softirq_trylock(cpu) \ ({ \ int ret = 1; \ if(atomic_add_return(1, &__sparc_bh_counter) != 1) { \ @@ -81,7 +81,7 @@ do { unsigned long flags; \ } \ ret; \ }) -#define softirq_endlock() atomic_dec(&__sparc_bh_counter) +#define softirq_endlock(cpu) atomic_dec(&__sparc_bh_counter) #define clear_active_bhs(mask) \ do { unsigned long flags; \ spin_lock_irqsave(&global_bh_lock, flags); \ @@ -96,8 +96,8 @@ extern int __sparc_bh_counter; #define start_bh_atomic() do { __sparc_bh_counter++; barrier(); } while(0) #define end_bh_atomic() do { barrier(); __sparc_bh_counter--; } while(0) -#define softirq_trylock() (__sparc_bh_counter ? 0 : (__sparc_bh_counter=1)) -#define softirq_endlock() (__sparc_bh_counter = 0) +#define softirq_trylock(cpu) (__sparc_bh_counter ? 0 : (__sparc_bh_counter=1)) +#define softirq_endlock(cpu) (__sparc_bh_counter = 0) #define clear_active_bhs(x) (bh_active &= ~(x)) #define init_bh(nr, routine) \ diff --git a/include/asm-sparc/stat.h b/include/asm-sparc/stat.h index 35f929c56..62038a4de 100644 --- a/include/asm-sparc/stat.h +++ b/include/asm-sparc/stat.h @@ -1,4 +1,4 @@ -/* $Id: stat.h,v 1.7 1996/10/27 08:55:48 davem Exp $ */ +/* $Id: stat.h,v 1.8 1998/02/06 12:52:07 jj Exp $ */ #ifndef _SPARC_STAT_H #define _SPARC_STAT_H @@ -38,4 +38,40 @@ struct stat { unsigned long __unused4[2]; }; +typedef struct { + __u32 major; + __u32 minor; +} __new_dev_t; + +struct stat64 { + __new_dev_t st_dev; + __u64 st_ino; + __u32 st_mode; + __u32 st_nlink; + __s32 st_uid; + __s32 st_gid; + __new_dev_t st_rdev; + __s64 st_size; + __u64 st_blocks; + __s32 st_atime; + __u32 __unused1; + __s32 st_mtime; + __u32 __unused2; + __s32 st_ctime; + __u32 __unused3; + __u32 st_blksize; + __u32 __unused4; +}; + +#define __XSTAT_VER_1 1 +#define __XSTAT_VER_2 2 +#define __XSTAT_VER_MASK 0xff + +#define __XSTAT_VER_XSTAT 0x000 +#define __XSTAT_VER_LXSTAT 0x100 +#define __XSTAT_VER_FXSTAT 0x200 +#define __XSTAT_VER_TYPEMASK 0xff00 + +#define __XMKNOD_VER_1 1 + #endif diff --git a/include/asm-sparc/string.h b/include/asm-sparc/string.h index 6957dde67..7f8d06587 100644 --- a/include/asm-sparc/string.h +++ b/include/asm-sparc/string.h @@ -1,4 +1,4 @@ -/* $Id: string.h,v 1.33 1997/11/19 07:57:48 jj Exp $ +/* $Id: string.h,v 1.34 1998/01/30 10:59:55 jj Exp $ * string.h: External definitions for optimized assembly string * routines for the Linux Kernel. * @@ -9,6 +9,8 @@ #ifndef __SPARC_STRING_H__ #define __SPARC_STRING_H__ +#include <asm/page.h> + /* Really, userland/ksyms should not see any of this stuff. */ #ifdef __KERNEL__ @@ -40,7 +42,7 @@ extern inline void *__constant_memcpy(void *to, const void *from, __kernel_size_ __builtin_memcpy(to, from, n); } else { switch(n) { - case 4096: + case PAGE_SIZE: __copy_1page(to, from); break; default: @@ -71,7 +73,7 @@ extern inline void *__constant_c_and_count_memset(void *s, char c, __kernel_size extern __kernel_size_t __bzero(void *, __kernel_size_t); if(!c) { - if(count == 4096) + if(count == PAGE_SIZE) bzero_1page(s); else __bzero(s, count); diff --git a/include/asm-sparc/sun4paddr.h b/include/asm-sparc/sun4paddr.h new file mode 100644 index 000000000..a2c6ed390 --- /dev/null +++ b/include/asm-sparc/sun4paddr.h @@ -0,0 +1,19 @@ +/* $Id: sun4paddr.h,v 1.2 1998/02/09 13:26:41 jj Exp $ + * sun4paddr.h: Various physical addresses on sun4 machines + * + * Copyright (C) 1997 Anton Blanchard (anton@progsoc.uts.edu.au) + */ + +#ifndef _SPARC_SUN4PADDR_H +#define _SPARC_SUN4PADDR_H + +#define SUN4_MEMREG_PHYSADDR 0xf4000000 +#define SUN4_IE_PHYSADDR 0xf5000000 +#define SUN4_300_MOSTEK_PHYSADDR 0xf2000000 +#define SUN4_300_TIMER_PHYSADDR 0xef000000 +#define SUN4_300_ETH_PHYSADDR 0xf9000000 +#define SUN4_300_BWTWO_PHYSADDR 0xfb400000 +#define SUN4_300_DMA_PHYSADDR 0xfa001000 +#define SUN4_300_ESP_PHYSADDR 0xfa000000 + +#endif /* !(_SPARC_SUN4PADDR_H) */ diff --git a/include/asm-sparc/sun4prom.h b/include/asm-sparc/sun4prom.h new file mode 100644 index 000000000..3a6167f4b --- /dev/null +++ b/include/asm-sparc/sun4prom.h @@ -0,0 +1,83 @@ +/* + * sun4prom.h -- interface to sun4 PROM monitor. We don't use most of this, + * so most of these are just placeholders. + */ + +#ifndef _SUN4PROM_H_ +#define _SUN4PROM_H_ + +/* + * Although this looks similar to an romvec for a OpenProm machine, it is + * actually closer to what was used in the Sun2 and Sun3. + * + * V2 entries exist only in version 2 PROMs and later, V3 in version 3 and later. + * + * Many of the function prototypes are guesses. Some are certainly wrong. + * Use with care. + */ + +typedef struct { + char *initSP; /* Initial system stack ptr */ + void (*startmon)(void); /* Initial PC for hardware */ + int *diagberr; /* Bus err handler for diags */ + struct linux_arguments_v0 **bootParam; /* Info for bootstrapped pgm */ + unsigned int *memorysize; /* Usable memory in bytes */ + unsigned char (*getchar)(void); /* Get char from input device */ + void (*putchar)(char); /* Put char to output device */ + int (*mayget)(void); /* Maybe get char, or -1 */ + int (*mayput)(void); /* Maybe put char, or -1 */ + unsigned char *echo; /* Should getchar echo? */ + unsigned char *insource; /* Input source selector */ + unsigned char *outsink; /* Output sink selector */ + int (*getkey)(void); /* Get next key if one exists */ + void (*initgetkey)(void); /* Initialize get key */ + unsigned int *translation; /* Kbd translation selector */ + unsigned char *keybid; /* Keyboard ID byte */ + int *screen_x; /* V2: Screen x pos (r/o) */ + int *screen_y; /* V2: Screen y pos (r/o) */ + struct keybuf *keybuf; /* Up/down keycode buffer */ + char *monid; /* Monitor version ID */ + void (*fbwritechar)(char); /* Write a character to FB */ + int *fbAddr; /* Address of frame buffer */ + char **font; /* Font table for FB */ + void (*fbwritestr)(char *); /* Write string to FB */ + void (*reboot)(char *); /* e.g. reboot("sd()vmlinux") */ + unsigned char *linebuf; /* The line input buffer */ + unsigned char **lineptr; /* Cur pointer into linebuf */ + int *linesize; /* length of line in linebuf */ + void (*getline)(char *); /* Get line from user */ + unsigned char (*getnextchar)(void); /* Get next char from linebuf */ + unsigned char (*peeknextchar)(void); /* Peek at next char */ + int *fbthere; /* =1 if frame buffer there */ + int (*getnum)(void); /* Grab hex num from line */ + int (*printf)(char *, ...); /* See prom_printf() instead */ + void (*printhex)(int); /* Format N digits in hex */ + unsigned char *leds; /* RAM copy of LED register */ + void (*setLEDs)(unsigned char *); /* Sets LED's and RAM copy */ + void (*NMIaddr)(void *); /* Addr for level 7 vector */ + void (*abortentry)(void); /* Entry for keyboard abort */ + int *nmiclock; /* Counts up in msec */ + int *FBtype; /* Frame buffer type */ + unsigned int romvecversion; /* Version number for this romvec */ + struct globram *globram; /* monitor global variables ??? */ + void * kbdaddr; /* Addr of keyboard in use */ + int *keyrinit; /* ms before kbd repeat */ + unsigned char *keyrtick; /* ms between repetitions */ + unsigned int *memoryavail; /* V1: Main mem usable size */ + long *resetaddr; /* where to jump on a reset */ + long *resetmap; /* pgmap entry for resetaddr */ + void (*exittomon)(void); /* Exit from user program */ + unsigned char **memorybitmap; /* V1: &{0 or &bits} */ + void (*setcxsegmap)(int ctxt, char *va, int pmeg); /* Set seg in any context */ + void (**vector_cmd)(void *); /* V2: Handler for 'v' cmd */ + unsigned long *expectedtrapsig; /* V3: Location of the expected trap signal */ + unsigned long *trapvectorbasetable; /* V3: Address of the trap vector table */ + int unused1; + int unused2; + int unused3; + int unused4; +} linux_sun4_romvec; + +extern linux_sun4_romvec *sun4_romvec; + +#endif /* _SUN4PROM_H_ */ diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h index 69d7cfe16..2ddecf4fe 100644 --- a/include/asm-sparc/system.h +++ b/include/asm-sparc/system.h @@ -1,4 +1,6 @@ -/* $Id: system.h,v 1.65 1997/05/14 20:47:59 davem Exp $ */ +/* $Id: system.h,v 1.68 1998/03/09 14:04:51 jj Exp $ */ +#include <linux/config.h> + #ifndef __SPARC_SYSTEM_H #define __SPARC_SYSTEM_H @@ -11,6 +13,7 @@ #include <asm/oplib.h> #include <asm/psr.h> #include <asm/ptrace.h> +#include <asm/btfixup.h> #define EMPTY_PGT (&empty_bad_page) #define EMPTY_PGE (&empty_bad_page_table) @@ -37,6 +40,14 @@ enum sparc_cpu { extern enum sparc_cpu sparc_cpu_model; +#ifndef CONFIG_SUN4 +#define ARCH_SUN4C_SUN4 (sparc_cpu_model==sun4c) +#define ARCH_SUN4 0 +#else +#define ARCH_SUN4C_SUN4 1 +#define ARCH_SUN4 1 +#endif + extern unsigned long empty_bad_page; extern unsigned long empty_bad_page_table; extern unsigned long empty_zero_page; @@ -98,6 +109,8 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, "std %%g4, [%%g6 + %2]\n\t" \ "ldd [%1 + %2], %%g4\n\t" \ "mov %1, %%g6\n\t" \ + ".globl patchme_store_new_current\n" \ +"patchme_store_new_current:\n\t" \ "st %1, [%0]\n\t" \ "wr %%g4, 0x20, %%psr\n\t" \ "nop\n\t" \ @@ -237,9 +250,11 @@ extern void __global_restore_flags(unsigned long flags); #define restore_flags(flags) __global_restore_flags(flags) #else +#error For combined sun4[md] smp, we need to get rid of the rdtbr. + /* Visit arch/sparc/lib/irqlock.S for all the fun details... */ #define cli() __asm__ __volatile__("mov %%o7, %%g4\n\t" \ - "call ___global_cli\n\t" \ + "call ___f_global_cli\n\t" \ " rd %%tbr, %%g7" : : \ : "g1", "g2", "g3", "g4", "g5", "g7", \ "memory", "cc") @@ -248,7 +263,7 @@ extern void __global_restore_flags(unsigned long flags); do { register unsigned long bits asm("g7"); \ bits = 0; \ __asm__ __volatile__("mov %%o7, %%g4\n\t" \ - "call ___global_sti\n\t" \ + "call ___f_global_sti\n\t" \ " rd %%tbr, %%g2" \ : /* no outputs */ \ : "r" (bits) \ @@ -260,7 +275,7 @@ do { register unsigned long bits asm("g7"); \ do { register unsigned long bits asm("g7"); \ bits = flags; \ __asm__ __volatile__("mov %%o7, %%g4\n\t" \ - "call ___global_restore_flags\n\t" \ + "call ___f_global_restore_flags\n\t" \ " andcc %%g7, 0x1, %%g0" \ : "=&r" (bits) \ : "0" (bits) \ @@ -285,6 +300,11 @@ do { register unsigned long bits asm("g7"); \ #define nop() __asm__ __volatile__ ("nop"); +/* This has special calling conventions */ +#ifndef __SMP__ +BTFIXUPDEF_CALL(void, ___xchg32, void) +#endif + extern __inline__ unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) { #ifdef __SMP__ @@ -299,10 +319,12 @@ extern __inline__ unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned ptr = (unsigned long *) m; ret = val; + /* Note: this is magic and the nop there is + really needed. */ __asm__ __volatile__(" mov %%o7, %%g4 - call ___xchg32 - add %%o7, 8, %%o7 + call ___f____xchg32 + nop " : "=&r" (ret) : "0" (ret), "r" (ptr) : "g3", "g4", "g7", "memory", "cc"); diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h index 2ad2868ce..23f293eaa 100644 --- a/include/asm-sparc/termios.h +++ b/include/asm-sparc/termios.h @@ -61,6 +61,8 @@ struct winsize { #define N_PPP 3 #define N_STRIP 4 #define N_AX25 5 +#define N_X25 6 +#define N_6PACK 7 #ifdef __KERNEL__ diff --git a/include/asm-sparc/timer.h b/include/asm-sparc/timer.h index 9dcd84dec..91add4f49 100644 --- a/include/asm-sparc/timer.h +++ b/include/asm-sparc/timer.h @@ -1,12 +1,16 @@ -/* $Id: timer.h,v 1.15 1997/12/18 14:21:43 jj Exp $ +/* $Id: timer.h,v 1.16 1998/01/30 10:59:59 jj Exp $ * timer.h: Definitions for the timer chips on the Sparc. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) */ + +#include <linux/config.h> + #ifndef _SPARC_TIMER_H #define _SPARC_TIMER_H #include <asm/system.h> /* For NCPUS */ +#include <asm/sun4paddr.h> /* Timer structures. The interrupt timer has two properties which * are the counter (which is handled in do_timer in sched.c) and the limit. @@ -31,6 +35,11 @@ struct sun4c_timer_info { }; #define SUN4C_TIMER_PHYSADDR 0xf3000000 +#ifdef CONFIG_SUN4 +#define SUN_TIMER_PHYSADDR SUN4_300_TIMER_PHYSADDR +#else +#define SUN_TIMER_PHYSADDR SUN4C_TIMER_PHYSADDR +#endif /* A sun4m has two blocks of registers which are probably of the same * structure. LSI Logic's L64851 is told to _decrement_ from the limit diff --git a/include/asm-sparc/traps.h b/include/asm-sparc/traps.h index 3a3940df2..6690ab956 100644 --- a/include/asm-sparc/traps.h +++ b/include/asm-sparc/traps.h @@ -1,4 +1,4 @@ -/* $Id: traps.h,v 1.8 1996/05/17 10:38:53 davem Exp $ +/* $Id: traps.h,v 1.9 1998/03/09 14:04:53 jj Exp $ * traps.h: Format of entries for the Sparc trap table. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -11,7 +11,7 @@ #ifndef __ASSEMBLY__ -/* This is for V8 and V9 compliant Sparc CPUS */ +/* This is for V8 compliant Sparc CPUS */ struct tt_entry { unsigned long inst_one; unsigned long inst_two; @@ -22,25 +22,6 @@ struct tt_entry { /* We set this to _start in system setup. */ extern struct tt_entry *sparc_ttable; -/* This for V9 compliant Sparc CPUS */ -struct tt_v9_entry { - unsigned long inst_one; - unsigned long inst_two; - unsigned long inst_three; - unsigned long inst_four; - unsigned long inst_five; - unsigned long inst_six; - unsigned long inst_seven; - unsigned long inst_eight; -}; - -/* V9 has multiple trap tables, which one is used depends - * upon how deep within multiple traps you are. - * I believe the UltraSparc supports two levels now. - */ -extern struct tt_v9_entry *sparc_v9_ttablel0; -extern struct tt_v9_entry *sparc_v9_ttablel1; - extern __inline__ unsigned long get_tbr(void) { unsigned long tbr; diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h index c89ec9c35..638e234a0 100644 --- a/include/asm-sparc/uaccess.h +++ b/include/asm-sparc/uaccess.h @@ -1,4 +1,4 @@ -/* $Id: uaccess.h,v 1.14 1997/09/18 10:42:02 rth Exp $ +/* $Id: uaccess.h,v 1.15 1998/02/05 14:19:54 jj Exp $ * uaccess.h: User space memore access functions. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -39,7 +39,7 @@ * No one can read/write anything from userland in the kernel space by setting * large size and address near to page_offset - a fault will break his intentions. */ -#define __user_ok(addr,size) ((addr) < stack_top) +#define __user_ok(addr,size) ((addr) < STACK_TOP) #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) #define __access_ok(addr,size) (__user_ok((addr) & get_fs().seg,(size))) #define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h index f5425f51b..7682680a4 100644 --- a/include/asm-sparc/unistd.h +++ b/include/asm-sparc/unistd.h @@ -1,4 +1,4 @@ -/* $Id: unistd.h,v 1.36 1997/12/14 23:24:43 ecd Exp $ */ +/* $Id: unistd.h,v 1.38 1998/03/27 07:01:56 davem Exp $ */ #ifndef _SPARC_UNISTD_H #define _SPARC_UNISTD_H @@ -29,12 +29,12 @@ #define __NR_unlink 10 /* Common */ #define __NR_execv 11 /* SunOS Specific */ #define __NR_chdir 12 /* Common */ -/* #define __NR_ni_syscall 13 ENOSYS under SunOS */ +#define __NR_xstat 13 /* Linux Specific */ #define __NR_mknod 14 /* Common */ #define __NR_chmod 15 /* Common */ #define __NR_chown 16 /* Common */ #define __NR_brk 17 /* Common */ -/* #define __NR_ni_syscall 18 ENOSYS under SunOS */ +#define __NR_xmknod 18 /* Linux Specific */ #define __NR_lseek 19 /* Common */ #define __NR_getpid 20 /* Common */ /* #define __NR_ni_syscall 21 ENOSYS under SunOS */ @@ -425,8 +425,6 @@ return -1; \ */ #define __NR__exit __NR_exit static __inline__ _syscall0(int,idle) -static __inline__ _syscall0(int,fork) -static __inline__ _syscall2(int,clone,unsigned long,flags,char *,ksp) static __inline__ _syscall0(int,pause) static __inline__ _syscall1(int,setup,int,magic) static __inline__ _syscall0(int,sync) diff --git a/include/asm-sparc/user.h b/include/asm-sparc/user.h index 7306b0d10..b5f1abf73 100644 --- a/include/asm-sparc/user.h +++ b/include/asm-sparc/user.h @@ -1,4 +1,4 @@ -/* $Id: user.h,v 1.4 1996/07/24 23:17:14 miguel Exp $ +/* $Id: user.h,v 1.5 1998/02/23 01:49:22 rth Exp $ * asm-sparc/user.h: Core file definitions for the Sparc. * * Keep in sync with reg.h. Actually, we could get rid of this @@ -50,11 +50,11 @@ struct user { unsigned long sigcode; /* Special sigcontext subcode, if any */ }; -#define NBPG PAGE_SIZE +#define NBPG 0x2000 #define UPAGES 1 #define HOST_TEXT_START_ADDR (u.start_code) -#define HOST_DATA_START_ADDR (u.start_data) -#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) +#define HOST_DATA_START_ADDR (u.uexec.a_data) +#define HOST_STACK_END_ADDR (- u.u_ssize * NBPG) #define SUNOS_CORE_MAGIC 0x080456 #endif /* !(_SPARC_USER_H) */ diff --git a/include/asm-sparc/vac-ops.h b/include/asm-sparc/vac-ops.h index d963a7fa3..eafe7a452 100644 --- a/include/asm-sparc/vac-ops.h +++ b/include/asm-sparc/vac-ops.h @@ -1,4 +1,4 @@ -/* $Id: vac-ops.h,v 1.12 1996/07/08 15:12:30 ecd Exp $ */ +/* $Id: vac-ops.h,v 1.13 1998/01/30 10:59:59 jj Exp $ */ #ifndef _SPARC_VAC_OPS_H #define _SPARC_VAC_OPS_H @@ -8,6 +8,7 @@ * Copyright (C) 1994, David S. Miller (davem@caip.rutgers.edu) */ +#include <linux/config.h> #include <asm/sysen.h> #include <asm/contregs.h> #include <asm/asi.h> @@ -60,9 +61,12 @@ #define S4CVACTAG_TID 0x0000fffc /* Sun4c VAC Virtual Address */ +/* These aren't used, why bother? (Anton) */ +#if 0 #define S4CVACVA_TID 0x3fff0000 #define S4CVACVA_LINE 0x0000fff0 #define S4CVACVA_BIL 0x0000000f +#endif /* The indexing of cache lines creates a problem. Because the line * field of a virtual address extends past the page offset within @@ -73,7 +77,12 @@ * not the case, and thus is a 'bad alias' we must turn off the * cacheable bit in the pte's of all such pages. */ -#define S4CVAC_BADBITS 0x0000f000 + +#ifdef CONFIG_SUN4 +#define S4CVAC_BADBITS 0x0001e000 +#else +#define S4CVAC_BADBITS 0x0000f000 +#endif /* The following is true if vaddr1 and vaddr2 would cause * a 'bad alias'. @@ -89,6 +98,8 @@ struct sun4c_vac_props { unsigned int num_bytes; /* Size of the cache */ unsigned int num_lines; /* Number of cache lines */ unsigned int do_hwflushes; /* Hardware flushing available? */ + enum { NONE, WRITE_THROUGH, + WRITE_BACK } type; /* What type of VAC? */ unsigned int linesize; /* Size of each line in bytes */ unsigned int log2lsize; /* log2(linesize) */ unsigned int on; /* VAC is enabled */ diff --git a/include/asm-sparc/winmacro.h b/include/asm-sparc/winmacro.h index cb2f4e73b..f31322e8e 100644 --- a/include/asm-sparc/winmacro.h +++ b/include/asm-sparc/winmacro.h @@ -1,4 +1,4 @@ -/* $Id: winmacro.h,v 1.19 1997/05/01 01:42:05 davem Exp $ +/* $Id: winmacro.h,v 1.20 1998/03/09 14:04:54 jj Exp $ * winmacro.h: Window loading-unloading macros. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -112,13 +112,26 @@ st %scratch, [%cur_reg + AOFF_task_tss + AOFF_thread_w_saved]; #ifdef __SMP__ -#define LOAD_CURRENT(dest_reg, idreg) \ +#define LOAD_CURRENT4M(dest_reg, idreg) \ rd %tbr, %idreg; \ sethi %hi(C_LABEL(current_set)), %dest_reg; \ srl %idreg, 10, %idreg; \ or %dest_reg, %lo(C_LABEL(current_set)), %dest_reg; \ and %idreg, 0xc, %idreg; \ ld [%idreg + %dest_reg], %dest_reg; + +/* Sliiick. We have a Linux current register :) -jj */ +#define LOAD_CURRENT4D(dest_reg) \ + lda [%g0] ASI_M_VIKING_TMP2, %dest_reg; + +/* Blackbox - take care with this... - check smp4m and smp4d before changing this. */ +#define LOAD_CURRENT(dest_reg, idreg) \ + sethi %hi(___b_load_current), %idreg; \ + sethi %hi(C_LABEL(current_set)), %dest_reg; \ + sethi %hi(C_LABEL(boot_cpu_id4)), %idreg; \ + or %dest_reg, %lo(C_LABEL(current_set)), %dest_reg; \ + ldub [%idreg + %lo(C_LABEL(boot_cpu_id4))], %idreg; \ + ld [%idreg + %dest_reg], %dest_reg; #else #define LOAD_CURRENT(dest_reg, idreg) \ sethi %hi(C_LABEL(current_set)), %idreg; \ diff --git a/include/asm-sparc/xstat.h b/include/asm-sparc/xstat.h new file mode 100644 index 000000000..53b1d59d0 --- /dev/null +++ b/include/asm-sparc/xstat.h @@ -0,0 +1,35 @@ +/* $Id: xstat.h,v 1.1 1998/02/06 12:52:08 jj Exp $ + * xstat.h: sys_xstat/xmknod architecture dependent stuff. + * + * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + */ + +extern __inline__ int cp_xstat(struct inode *inode, struct stat64 *s, unsigned long blocks, int blksize) +{ + struct stat64 tmp; + + memset (&tmp, 0, sizeof(tmp)); + tmp.st_dev.major = MAJOR(inode->i_dev); + tmp.st_dev.minor = MINOR(inode->i_dev); + tmp.st_ino = inode->i_ino; + tmp.st_mode = inode->i_mode; + tmp.st_nlink = inode->i_nlink; + tmp.st_uid = inode->i_uid; + tmp.st_gid = inode->i_gid; + tmp.st_rdev.major = MAJOR(inode->i_rdev); + tmp.st_rdev.minor = MINOR(inode->i_rdev); + tmp.st_size = inode->i_size; + tmp.st_blksize = blksize; + tmp.st_blocks = blocks; + tmp.st_atime = inode->i_atime; + tmp.st_mtime = inode->i_mtime; + tmp.st_ctime = inode->i_ctime; + return copy_to_user(s,&tmp,sizeof(tmp)); +} + +extern __inline__ int get_user_new_dev_t(kdev_t *kdev, __new_dev_t *udev) { + __new_dev_t ndev; + if (copy_from_user (&ndev, udev, sizeof(__new_dev_t))) return -EFAULT; + *kdev = MKDEV(ndev.major, ndev.minor); + return 0; +} |