diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-01-29 01:41:54 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-01-29 01:41:54 +0000 |
commit | f969d69ba9f952e5bdd38278e25e26a3e4a61a70 (patch) | |
tree | b3530d803df59d726afaabebc6626987dee1ca05 /arch/sh | |
parent | a10ce7ef2066b455d69187643ddf2073bfc4db24 (diff) |
Merge with 2.3.27.
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/config.in | 29 | ||||
-rw-r--r-- | arch/sh/defconfig | 19 | ||||
-rw-r--r-- | arch/sh/kernel/entry.S | 60 | ||||
-rw-r--r-- | arch/sh/kernel/head.S | 7 | ||||
-rw-r--r-- | arch/sh/kernel/irq.c | 2 | ||||
-rw-r--r-- | arch/sh/kernel/irq_onchip.c | 128 | ||||
-rw-r--r-- | arch/sh/kernel/process.c | 4 | ||||
-rw-r--r-- | arch/sh/kernel/setup.c | 24 | ||||
-rw-r--r-- | arch/sh/kernel/signal.c | 2 | ||||
-rw-r--r-- | arch/sh/kernel/sys_sh.c | 5 | ||||
-rw-r--r-- | arch/sh/kernel/time.c | 14 | ||||
-rw-r--r-- | arch/sh/kernel/traps.c | 2 | ||||
-rw-r--r-- | arch/sh/lib/checksum.S | 4 | ||||
-rw-r--r-- | arch/sh/lib/memcpy.S | 2 | ||||
-rw-r--r-- | arch/sh/lib/memmove.S | 2 | ||||
-rw-r--r-- | arch/sh/lib/memset.S | 2 | ||||
-rw-r--r-- | arch/sh/mm/cache.c | 2 | ||||
-rw-r--r-- | arch/sh/mm/extable.c | 2 | ||||
-rw-r--r-- | arch/sh/mm/fault.c | 104 | ||||
-rw-r--r-- | arch/sh/mm/init.c | 7 | ||||
-rw-r--r-- | arch/sh/mm/ioremap.c | 2 | ||||
-rw-r--r-- | arch/sh/vmlinux.lds.S | 2 |
23 files changed, 330 insertions, 97 deletions
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index ae76ea1eb..31fcf5d69 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile @@ -1,4 +1,4 @@ -# $Id$ +# $Id: Makefile,v 1.1 1999/09/18 16:55:51 gniibe Exp gniibe $ # # This file is subject to the terms and conditions of the GNU General Public # License. See the file "COPYING" in the main directory of this archive diff --git a/arch/sh/config.in b/arch/sh/config.in index 516dc3748..6471e7aa8 100644 --- a/arch/sh/config.in +++ b/arch/sh/config.in @@ -11,9 +11,22 @@ endmenu mainmenu_option next_comment comment 'Processor type and features' -choice 'Processor family' \ - "SH-3 CONFIG_CPU_SH3 \ - SH-4 CONFIG_CPU_SH4" SH-3 +choice 'Processor type' \ + "SH7708 CONFIG_CPU_SUBTYPE_SH7708 \ + SH7709 CONFIG_CPU_SUBTYPE_SH7709 \ + SH7750 CONFIG_CPU_SUBTYPE_SH7750" SH7708 +if [ "$CONFIG_CPU_SUBTYPE_SH7708" = "y" ]; then + define_bool CONFIG_CPU_SH3 y + define_bool CONFIG_CPU_SH4 n +fi +if [ "$CONFIG_CPU_SUBTYPE_SH7709" = "y" ]; then + define_bool CONFIG_CPU_SH3 y + define_bool CONFIG_CPU_SH4 n +fi +if [ "$CONFIG_CPU_SUBTYPE_SH7750" = "y" ]; then + define_bool CONFIG_CPU_SH3 n + define_bool CONFIG_CPU_SH4 y +fi bool 'Little Endian' CONFIG_LITTLE_ENDIAN hex 'Physical memory start address' CONFIG_MEMORY_START 08000000 bool 'Use SH CPU internal real time clock' CONFIG_SH_CPU_RTC @@ -35,6 +48,12 @@ bool 'System V IPC' CONFIG_SYSVIPC bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT bool 'Sysctl support' CONFIG_SYSCTL +if [ "$CONFIG_PROC_FS" = "y" ]; then + choice 'Kernel core (/proc/kcore) format' \ + "ELF CONFIG_KCORE_ELF \ + A.OUT CONFIG_KCORE_AOUT" ELF +fi + tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC endmenu @@ -61,6 +80,10 @@ endmenu if [ "$CONFIG_NET" = "y" ]; then source net/Config.in + mainmenu_option next_comment + comment 'Network device drivers' + source drivers/net/Config.in + endmenu fi mainmenu_option next_comment diff --git a/arch/sh/defconfig b/arch/sh/defconfig index dcf006a15..6a65ad411 100644 --- a/arch/sh/defconfig +++ b/arch/sh/defconfig @@ -10,10 +10,14 @@ # # Processor type and features # -# CONFIG_CPU_SH3 is not set -CONFIG_CPU_SH4=y +CONFIG_CPU_SUBTYPE_SH7708=y +# CONFIG_CPU_SUBTYPE_SH7709 is not set +# CONFIG_CPU_SUBTYPE_SH7750 is not set +CONFIG_CPU_SH3=y +# CONFIG_CPU_SH4 is not set CONFIG_LITTLE_ENDIAN=y -CONFIG_MEMORY_START=08000000 +CONFIG_MEMORY_START=0c000000 +CONFIG_SH_CPU_RTC=y # # Loadable module support @@ -27,6 +31,8 @@ CONFIG_MEMORY_START=08000000 # CONFIG_SYSVIPC is not set # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_SYSCTL is not set +CONFIG_KCORE_ELF=y +# CONFIG_KCORE_AOUT is not set CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set @@ -35,8 +41,8 @@ CONFIG_BINFMT_ELF=y # # CONFIG_SERIAL is not set CONFIG_SERIAL_CONSOLE=y -# CONFIG_SH_SCI_SERIAL is not set -CONFIG_SH_SCIF_SERIAL=y +CONFIG_SH_SCI_SERIAL=y +# CONFIG_SH_SCIF_SERIAL is not set # # Floppy, IDE, and other block devices @@ -59,9 +65,6 @@ CONFIG_BLK_DEV_INITRD=y # CONFIG_AFFS_FS is not set # CONFIG_HFS_FS is not set # CONFIG_FAT_FS is not set -# CONFIG_MSDOS_FS is not set -# CONFIG_UMSDOS_FS is not set -# CONFIG_VFAT_FS is not set # CONFIG_ISO9660_FS is not set # CONFIG_JOLIET is not set # CONFIG_UDF_FS is not set diff --git a/arch/sh/kernel/entry.S b/arch/sh/kernel/entry.S index ac5a075c0..a3e5a918c 100644 --- a/arch/sh/kernel/entry.S +++ b/arch/sh/kernel/entry.S @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: entry.S,v 1.19 1999/10/31 13:19:35 gniibe Exp gniibe $ * * linux/arch/sh/entry.S * @@ -61,7 +61,11 @@ ENOSYS = 38 #if defined(__sh3__) TRA = 0xffffffd0 EXPEVT = 0xffffffd4 +#ifdef CONFIG_CPU_SUBTYPE_SH7709 +INTEVT = 0xa4000000 ! INTEVTE2(0xa4000000) +#else INTEVT = 0xffffffd8 +#endif MMU_TEA = 0xfffffffc ! TLB Exception Address Register #elif defined(__SH4__) TRA = 0xff000020 @@ -251,6 +255,11 @@ system_call: mov.l 1f,r2 mov.l @r2,r8 ! + ! DEBUG DEBUG + ! mov.l led,r1 + ! mov r0,r2 + ! mov.b r2,@r1 + ! #ifdef CONFIG_DEBUG_KERNEL_WITH_GDB_STUB mov #0x20,r1 extu.b r1,r1 @@ -320,6 +329,7 @@ system_call: 3: .long SYMBOL_NAME(syscall_trace) 2: .long 0xefffffff ! BL=0 1: .long TRA +led: .long 0xa8000000 ! For my board -- gN .section .fixup,"ax" fixup_syscall_argerr: @@ -571,6 +581,37 @@ ENTRY(interrupt_table) .long SYMBOL_NAME(do_IRQ) ! rovi .long SYMBOL_NAME(do_IRQ) .long SYMBOL_NAME(do_IRQ) +#if defined(CONFIG_CPU_SUBTYPE_SH7709) + .long SYMBOL_NAME(do_IRQ) ! 32 IRQ irq0 + .long SYMBOL_NAME(do_IRQ) ! 33 irq1 + .long SYMBOL_NAME(do_IRQ) ! 34 irq2 + .long SYMBOL_NAME(do_IRQ) ! 35 irq3 + .long SYMBOL_NAME(do_IRQ) ! 36 irq4 + .long SYMBOL_NAME(do_IRQ) ! 37 irq5 + .long SYMBOL_NAME(do_IRQ) ! 38 + .long SYMBOL_NAME(do_IRQ) ! 39 + .long SYMBOL_NAME(do_IRQ) ! 40 PINT pint0-7 + .long SYMBOL_NAME(do_IRQ) ! 41 pint8-15 + .long SYMBOL_NAME(do_IRQ) ! 42 + .long SYMBOL_NAME(do_IRQ) ! 43 + .long SYMBOL_NAME(do_IRQ) ! 44 + .long SYMBOL_NAME(do_IRQ) ! 45 + .long SYMBOL_NAME(do_IRQ) ! 46 + .long SYMBOL_NAME(do_IRQ) ! 47 + .long SYMBOL_NAME(do_IRQ) ! 48 DMAC dei0 + .long SYMBOL_NAME(do_IRQ) ! 49 dei1 + .long SYMBOL_NAME(do_IRQ) ! 50 dei2 + .long SYMBOL_NAME(do_IRQ) ! 51 dei3 + .long SYMBOL_NAME(do_IRQ) ! 52 IrDA eri1 + .long SYMBOL_NAME(do_IRQ) ! 53 rxi1 + .long SYMBOL_NAME(do_IRQ) ! 54 bri1 + .long SYMBOL_NAME(do_IRQ) ! 55 txi1 + .long SYMBOL_NAME(do_IRQ) ! 56 SCIF eri2 + .long SYMBOL_NAME(do_IRQ) ! 57 rxi2 + .long SYMBOL_NAME(do_IRQ) ! 58 bri2 + .long SYMBOL_NAME(do_IRQ) ! 59 txi2 + .long SYMBOL_NAME(do_IRQ) ! 60 ADC adi +#elif defined(__SH4__) .long SYMBOL_NAME(do_IRQ) ! Hitachi UDI .long SYMBOL_NAME(do_IRQ) ! GPIO .long SYMBOL_NAME(do_IRQ) ! DMAC dmte0 @@ -589,6 +630,7 @@ ENTRY(interrupt_table) .long error .long error ! fpu .long error ! fpu +#endif ENTRY(sys_call_table) .long SYMBOL_NAME(sys_ni_syscall) /* 0 - old "setup()" system call*/ @@ -608,7 +650,7 @@ ENTRY(sys_call_table) .long SYMBOL_NAME(sys_mknod) .long SYMBOL_NAME(sys_chmod) /* 15 */ .long SYMBOL_NAME(sys_lchown) - .long SYMBOL_NAME(sys_ni_syscall) /* old break syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old break syscall holder */ .long SYMBOL_NAME(sys_stat) .long SYMBOL_NAME(sys_lseek) .long SYMBOL_NAME(sys_getpid) /* 20 */ @@ -622,8 +664,8 @@ ENTRY(sys_call_table) .long SYMBOL_NAME(sys_fstat) .long SYMBOL_NAME(sys_pause) .long SYMBOL_NAME(sys_utime) /* 30 */ - .long SYMBOL_NAME(sys_ni_syscall) /* old stty syscall holder */ - .long SYMBOL_NAME(sys_ni_syscall) /* old gtty syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old stty syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old gtty syscall holder */ .long SYMBOL_NAME(sys_access) .long SYMBOL_NAME(sys_nice) .long SYMBOL_NAME(sys_ni_syscall) /* 35 */ /* old ftime syscall holder */ @@ -635,7 +677,7 @@ ENTRY(sys_call_table) .long SYMBOL_NAME(sys_dup) .long SYMBOL_NAME(sys_pipe) .long SYMBOL_NAME(sys_times) - .long SYMBOL_NAME(sys_ni_syscall) /* old prof syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old prof syscall holder */ .long SYMBOL_NAME(sys_brk) /* 45 */ .long SYMBOL_NAME(sys_setgid) .long SYMBOL_NAME(sys_getgid) @@ -644,12 +686,12 @@ ENTRY(sys_call_table) .long SYMBOL_NAME(sys_getegid) /* 50 */ .long SYMBOL_NAME(sys_acct) .long SYMBOL_NAME(sys_umount) /* recycled never used phys() */ - .long SYMBOL_NAME(sys_ni_syscall) /* old lock syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old lock syscall holder */ .long SYMBOL_NAME(sys_ioctl) .long SYMBOL_NAME(sys_fcntl) /* 55 */ - .long SYMBOL_NAME(sys_ni_syscall) /* old mpx syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old mpx syscall holder */ .long SYMBOL_NAME(sys_setpgid) - .long SYMBOL_NAME(sys_ni_syscall) /* old ulimit syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old ulimit syscall holder */ .long SYMBOL_NAME(sys_ni_syscall) /* sys_olduname */ .long SYMBOL_NAME(sys_umask) /* 60 */ .long SYMBOL_NAME(sys_chroot) @@ -689,7 +731,7 @@ ENTRY(sys_call_table) .long SYMBOL_NAME(sys_fchown) /* 95 */ .long SYMBOL_NAME(sys_getpriority) .long SYMBOL_NAME(sys_setpriority) - .long SYMBOL_NAME(sys_ni_syscall) /* old profil syscall holder */ + .long SYMBOL_NAME(sys_ni_syscall) /* old profil syscall holder */ .long SYMBOL_NAME(sys_statfs) .long SYMBOL_NAME(sys_fstatfs) /* 100 */ .long SYMBOL_NAME(sys_ni_syscall) /* ioperm */ diff --git a/arch/sh/kernel/head.S b/arch/sh/kernel/head.S index 17d019707..f6378927e 100644 --- a/arch/sh/kernel/head.S +++ b/arch/sh/kernel/head.S @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: head.S,v 1.7 1999/10/27 09:41:42 gniibe Exp gniibe $ * * arch/sh/kernel/head.S * @@ -18,9 +18,8 @@ ENTRY(empty_zero_page) .long 0 /* RAMDISK_FLAGS */ .long 0x0200 /* ORIG_ROOT_DEV */ .long 1 /* LOADER_TYPE */ - .long 0x88400000 /* INITRD_START */ - .long 0x00400000 /* INITRD_SIZE */ - .long 0x89000000 /* MEMORY_END */ + .long 0x00360000 /* INITRD_START */ + .long 0x000a0000 /* INITRD_SIZE */ .long 0 .text diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c index 580f4415c..e87972c73 100644 --- a/arch/sh/kernel/irq.c +++ b/arch/sh/kernel/irq.c @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: irq.c,v 1.4 1999/10/11 13:12:14 gniibe Exp $ * * linux/arch/sh/kernel/irq.c * diff --git a/arch/sh/kernel/irq_onchip.c b/arch/sh/kernel/irq_onchip.c index 0ed3400ef..f03456bfa 100644 --- a/arch/sh/kernel/irq_onchip.c +++ b/arch/sh/kernel/irq_onchip.c @@ -1,8 +1,8 @@ -/* $Id$ +/* $Id: irq_onchip.c,v 1.5 1999/10/28 02:18:33 gniibe Exp $ * * linux/arch/sh/kernel/irq_onchip.c * - * Copyright (C) 1999 Niibe Yutaka + * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi * * Interrupt handling for on-chip supporting modules (TMU, RTC, etc.). * @@ -135,6 +135,109 @@ static void end_onChip_irq(unsigned int irq) enable_onChip_irq(irq); } + +#ifdef CONFIG_CPU_SUBTYPE_SH7709 +/* + * SH7707/SH7709/SH7709A/SH7729 Extended on-chip I/O + */ + +#define INTC_IRR0 0xa4000004UL +#define INTC_IPRC 0xa4000016UL + +#define IRQ0_IRQ 32 +#define IRQ1_IRQ 33 +#define IRQ2_IRQ 34 +#define IRQ3_IRQ 35 +#define IRQ4_IRQ 36 +#define IRQ5_IRQ 37 + +#define IRQ0_IRP_OFFSET 32 +#define IRQ1_IRP_OFFSET 36 +#define IRQ2_IRP_OFFSET 40 +#define IRQ3_IRP_OFFSET 44 +#define IRQ4_IRP_OFFSET 48 +#define IRQ5_IRP_OFFSET 52 + +#define IRQ0_PRIORITY 1 +#define IRQ1_PRIORITY 1 +#define IRQ2_PRIORITY 1 +#define IRQ3_PRIORITY 1 +#define IRQ4_PRIORITY 1 +#define IRQ5_PRIORITY 1 + +static void enable_onChip2_irq(unsigned int irq); +void disable_onChip2_irq(unsigned int irq); + +/* shutdown is same as "disable" */ +#define shutdown_onChip2_irq disable_onChip2_irq + +static void mask_and_ack_onChip2(unsigned int); +static void end_onChip2_irq(unsigned int irq); + +static unsigned int startup_onChip2_irq(unsigned int irq) +{ + enable_onChip2_irq(irq); + return 0; /* never anything pending */ +} + +static struct hw_interrupt_type onChip2_irq_type = { + "SH7709 Extended On-Chip Supporting Module", + startup_onChip2_irq, + shutdown_onChip2_irq, + enable_onChip2_irq, + disable_onChip2_irq, + mask_and_ack_onChip2, + end_onChip2_irq +}; + +void disable_onChip2_irq(unsigned int irq) +{ + unsigned long val, flags; + /* Set priority in IPR to 0 */ + int offset = ipr_data[irq-TIMER_IRQ].offset - 32; + unsigned long intc_ipr_address = INTC_IPRC + (offset/16*INTC_SIZE); + unsigned short mask = 0xffff ^ (0xf << (offset%16)); + + save_and_cli(flags); + val = ctrl_inw(intc_ipr_address); + val &= mask; + ctrl_outw(val, intc_ipr_address); + restore_flags(flags); +} + +static void enable_onChip2_irq(unsigned int irq) +{ + unsigned long val, flags; + /* Set priority in IPR back to original value */ + int offset = ipr_data[irq-TIMER_IRQ].offset - 32; + int priority = ipr_data[irq-TIMER_IRQ].priority; + unsigned long intc_ipr_address = INTC_IPRC + (offset/16*INTC_SIZE); + unsigned short value = (priority << (offset%16)); + + save_and_cli(flags); + val = ctrl_inw(intc_ipr_address); + val |= value; + ctrl_outw(val, intc_ipr_address); + restore_flags(flags); +} + +static void mask_and_ack_onChip2(unsigned int irq) +{ + disable_onChip2_irq(irq); + if (IRQ0_IRQ <= irq && irq <= IRQ5_IRQ) { + /* Clear external interrupt request */ + int a = ctrl_inb(INTC_IRR0); + a &= ~(1 << (irq - IRQ0_IRQ)); + ctrl_outb(a, INTC_IRR0); + } +} + +static void end_onChip2_irq(unsigned int irq) +{ + enable_onChip2_irq(irq); +} +#endif /* CONFIG_CPU_SUBTYPE_SH7709 */ + void __init init_IRQ(void) { int i; @@ -142,4 +245,25 @@ void __init init_IRQ(void) for (i = TIMER_IRQ; i < NR_IRQS; i++) { irq_desc[i].handler = &onChip_irq_type; } + +#ifdef CONFIG_CPU_SUBTYPE_SH7709 + for (i = IRQ0_IRQ; i < NR_IRQS; i++) { + irq_desc[i].handler = &onChip2_irq_type; + } + + /* + * Enable external irq(INTC IRQ mode). + * You should set corresponding bits of PFC to "00" + * to enable these interrupts. + */ + set_ipr_data(IRQ0_IRQ, IRQ0_IRP_OFFSET, IRQ0_PRIORITY); + set_ipr_data(IRQ1_IRQ, IRQ1_IRP_OFFSET, IRQ1_PRIORITY); + set_ipr_data(IRQ2_IRQ, IRQ2_IRP_OFFSET, IRQ2_PRIORITY); + set_ipr_data(IRQ3_IRQ, IRQ3_IRP_OFFSET, IRQ3_PRIORITY); + set_ipr_data(IRQ4_IRQ, IRQ4_IRP_OFFSET, IRQ4_PRIORITY); + set_ipr_data(IRQ5_IRQ, IRQ5_IRP_OFFSET, IRQ5_PRIORITY); + + ctrl_inb(INTC_IRR0); + ctrl_outb(0, INTC_IRR0); +#endif /* CONFIG_CPU_SUBTYPE_SH7709 */ } diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index 2e58ad830..5d2a5696c 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: process.c,v 1.8 1999/10/31 13:19:16 gniibe Exp $ * * linux/arch/sh/kernel/process.c * @@ -249,8 +249,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, p->thread.sp = (unsigned long) childregs; p->thread.pc = (unsigned long) ret_from_fork; - if (p->mm) - p->mm->context = NO_CONTEXT; return 0; } diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index deb532300..f97e66585 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: setup.c,v 1.7 1999/10/23 01:34:50 gniibe Exp gniibe $ * * linux/arch/sh/kernel/setup.c * @@ -135,9 +135,9 @@ static inline void parse_mem_cmdline (char ** cmdline_p) memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; - memory_start = (unsigned long)__va(0)+__MEMORY_START; + memory_start = (unsigned long)PAGE_OFFSET+__MEMORY_START; /* Default is 4Mbyte. */ - memory_end = (unsigned long)__va(0x00400000)+__MEMORY_START; + memory_end = (unsigned long)PAGE_OFFSET+0x00400000+__MEMORY_START; for (;;) { /* @@ -214,7 +214,7 @@ void __init setup_arch(char **cmdline_p) /* * Initialize the boot-time allocator (with low memory only): */ - bootmap_size = init_bootmem(start_pfn, max_low_pfn); + bootmap_size = init_bootmem(start_pfn, max_low_pfn, __MEMORY_START); /* * FIXME: what about high memory? @@ -259,16 +259,18 @@ void __init setup_arch(char **cmdline_p) #ifdef CONFIG_BLK_DEV_INITRD if (LOADER_TYPE) { - initrd_start = INITRD_START ? INITRD_START : 0; - initrd_end = initrd_start+INITRD_SIZE; - if (initrd_end > memory_end) { + if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { + reserve_bootmem(INITRD_START, INITRD_SIZE); + initrd_start = + INITRD_START ? INITRD_START + PAGE_OFFSET + __MEMORY_START : 0; + initrd_end = initrd_start+INITRD_SIZE; + } else { printk("initrd extends beyond end of memory " "(0x%08lx > 0x%08lx)\ndisabling initrd\n", - initrd_end,memory_end); + INITRD_START + INITRD_SIZE, + max_low_pfn << PAGE_SHIFT); initrd_start = 0; - } else - reserve_bootmem(__pa(initrd_start)-__MEMORY_START, - INITRD_SIZE); + } } #endif diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c index 6abc7952e..8583afff1 100644 --- a/arch/sh/kernel/signal.c +++ b/arch/sh/kernel/signal.c @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: signal.c,v 1.10 1999/09/27 23:25:44 gniibe Exp $ * * linux/arch/sh/kernel/signal.c * diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c index a485f10a3..8f480f764 100644 --- a/arch/sh/kernel/sys_sh.c +++ b/arch/sh/kernel/sys_sh.c @@ -44,9 +44,8 @@ asmlinkage int sys_pipe(unsigned long * fildes) } asmlinkage unsigned long -sys_mmap(int fd, unsigned long addr, - unsigned long len, unsigned long prot, - unsigned long flags, unsigned long off) +sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, + unsigned long flags, int fd, unsigned long off) { int error = -EFAULT; struct file *file = NULL; diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c index efe436336..49a765f83 100644 --- a/arch/sh/kernel/time.c +++ b/arch/sh/kernel/time.c @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: time.c,v 1.7 1999/11/06 02:00:37 gniibe Exp $ * * linux/arch/sh/kernel/time.c * @@ -43,7 +43,10 @@ #define TMU0_TCNT 0xfffffe98 /* Long access */ #define TMU0_TCR 0xfffffe9c /* Word access */ -#define INTERVAL 37500 /* (1000000*CLOCK_MHZ/HZ/2) ??? */ +#define INTERVAL 37500 /* (1000000*CLOCK_MHZ/HZ/2) ??? for CqREEK */ +#if 0 /* Takeshi's board */ +#define INTERVAL 83333 +#endif /* SH-3 RTC */ #define R64CNT 0xfffffec0 @@ -195,6 +198,13 @@ static inline void do_timer_interrupt(int irq, void *dev_id, struct pt_regs *reg { do_timer(regs); +#ifdef TAKESHI + { + unsigned long what_is_this=0xa4000124; + + ctrl_outb(ctrl_inb(what_is_this)+1,what_is_this); + } +#endif #if 0 if (!user_mode(regs)) sh_do_profile(regs->pc); diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c index 353281518..8a9b3e1f9 100644 --- a/arch/sh/kernel/traps.c +++ b/arch/sh/kernel/traps.c @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: traps.c,v 1.3 1999/09/21 14:37:19 gniibe Exp $ * * linux/arch/sh/traps.c * diff --git a/arch/sh/lib/checksum.S b/arch/sh/lib/checksum.S index e0727df75..3471084b9 100644 --- a/arch/sh/lib/checksum.S +++ b/arch/sh/lib/checksum.S @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: checksum.S,v 1.2 1999/10/29 13:06:55 gniibe Exp $ * * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket @@ -192,7 +192,7 @@ DST( mov.w r0,@r5 ) mov #-5,r0 shld r0,r6 tst r6,r6 - bf/s 2f + bt/s 2f clrt SRC(1: mov.l @r4+,r0 ) SRC( mov.l @r4+,r1 ) diff --git a/arch/sh/lib/memcpy.S b/arch/sh/lib/memcpy.S index 2da59276e..6f3121662 100644 --- a/arch/sh/lib/memcpy.S +++ b/arch/sh/lib/memcpy.S @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: memcpy.S,v 1.3 1999/09/28 11:32:48 gniibe Exp $ * * "memcpy" implementation of SuperH * diff --git a/arch/sh/lib/memmove.S b/arch/sh/lib/memmove.S index 9e5c2fad3..61b97b7c2 100644 --- a/arch/sh/lib/memmove.S +++ b/arch/sh/lib/memmove.S @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: memmove.S,v 1.2 1999/09/21 12:55:49 gniibe Exp $ * * "memmove" implementation of SuperH * diff --git a/arch/sh/lib/memset.S b/arch/sh/lib/memset.S index 40505631d..312d605e4 100644 --- a/arch/sh/lib/memset.S +++ b/arch/sh/lib/memset.S @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: memset.S,v 1.1 1999/09/18 16:57:09 gniibe Exp $ * * "memset" implementation of SuperH * diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c index 129aba7cc..d15c62385 100644 --- a/arch/sh/mm/cache.c +++ b/arch/sh/mm/cache.c @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: cache.c,v 1.7 1999/09/23 11:43:07 gniibe Exp $ * * linux/arch/sh/mm/cache.c * diff --git a/arch/sh/mm/extable.c b/arch/sh/mm/extable.c index 72fcfee4a..dc77f57fe 100644 --- a/arch/sh/mm/extable.c +++ b/arch/sh/mm/extable.c @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: extable.c,v 1.1 1999/09/18 16:57:37 gniibe Exp $ * * linux/arch/sh/mm/extable.c * Taken from: diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c index 93c352679..7f3610a3b 100644 --- a/arch/sh/mm/fault.c +++ b/arch/sh/mm/fault.c @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: fault.c,v 1.5 1999/10/31 13:17:31 gniibe Exp $ * * linux/arch/sh/mm/fault.c * Copyright (C) 1999 Niibe Yutaka @@ -81,6 +81,34 @@ bad_area: return 0; } +static void handle_vmalloc_fault(struct task_struct *tsk, unsigned long address) +{ + pgd_t *dir; + pmd_t *pmd; + pte_t *pte; + pte_t entry; + + dir = pgd_offset_k(address); + pmd = pmd_offset(dir, address); + if (pmd_none(*pmd)) { + printk(KERN_ERR "vmalloced area %08lx bad\n", address); + return; + } + if (pmd_bad(*pmd)) { + pmd_ERROR(*pmd); + pmd_clear(pmd); + return; + } + pte = pte_offset(pmd, address); + entry = *pte; + if (pte_none(entry) || !pte_present(entry) || !pte_write(entry)) { + printk(KERN_ERR "vmalloced area %08lx bad\n", address); + return; + } + + update_mmu_cache(NULL, address, entry); +} + /* * This routine handles page faults. It determines the address, * and the problem, and then passes it off to one of the appropriate @@ -98,6 +126,11 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess, tsk = current; mm = tsk->mm; + if (address >= VMALLOC_START && address < VMALLOC_END) { + handle_vmalloc_fault(tsk, address); + return; + } + /* * If we're in an interrupt or have no user * context, we must not take the fault.. @@ -222,23 +255,13 @@ void update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t pte) { unsigned long flags; - unsigned long asid; unsigned long pteval; - asid = get_asid(); - - address &= PAGE_MASK; -#if 0/*defined(__SH4__)*//* SH-4 has separate I/D caches: XXX really needed? */ - if ((vma->vm_flags & VM_EXEC) != 0) -/* && - ((pte_val(pte) & (_PAGE_PRESENT | _PAGE_DIRTY)) == - (_PAGE_PRESENT | _PAGE_DIRTY))) */ - flush_icache_range(address,address+PAGE_SIZE); -#endif save_and_cli(flags); - /* Set PTEH register */ - ctrl_outl((address|asid), MMU_PTEH); - + /* + * We don't need to set PTEH register. + * It's automatically set by the hardware. + */ pteval = pte_val(pte); pteval &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */ pteval |= _PAGE_FLAGS_HARDWARE_DEFAULT; /* add default flags */ @@ -246,18 +269,31 @@ void update_mmu_cache(struct vm_area_struct * vma, ctrl_outl(pteval, MMU_PTEL); /* Load the TLB */ - asm volatile ("ldtlb" : /* no output */ : /* no input */ - : "memory"); + asm volatile("ldtlb": /* no output */ : /* no input */ : "memory"); restore_flags(flags); } -static __inline__ void __flush_tlb_page(unsigned long asid, unsigned long page) +static void __flush_tlb_page(struct mm_struct *mm, unsigned long page) { - unsigned long addr, data; + unsigned long addr, data, asid; + unsigned long saved_asid = MMU_NO_ASID; + + if (mm->context == NO_CONTEXT) + return; + + asid = mm->context & MMU_CONTEXT_ASID_MASK; + if (mm != current->mm) { + saved_asid = get_asid(); + /* + * We need to set ASID of the target entry to flush, + * because TLB is indexed by (ASID and PAGE). + */ + set_asid(asid); + } #if defined(__sh3__) - addr = MMU_TLB_ADDRESS_ARRAY | (page & 0x1F000) | MMU_PAGE_ASSOC_BIT; - data = page | asid; /* VALID bit is off */ + addr = MMU_TLB_ADDRESS_ARRAY |(page & 0x1F000)| MMU_PAGE_ASSOC_BIT; + data = (page & 0xfffe0000) | asid; /* VALID bit is off */ ctrl_outl(data, addr); #elif defined(__SH4__) int i; @@ -276,19 +312,18 @@ static __inline__ void __flush_tlb_page(unsigned long asid, unsigned long page) } } #endif + if (saved_asid != MMU_NO_ASID) + set_asid(saved_asid); } void flush_tlb_page(struct vm_area_struct *vma, unsigned long page) { - unsigned long asid; - - if (vma->vm_mm->context != NO_CONTEXT) { - unsigned long flags; + unsigned long flags; + if (vma->vm_mm) { page &= PAGE_MASK; - asid = vma->vm_mm->context & MMU_CONTEXT_ASID_MASK; save_and_cli(flags); - __flush_tlb_page (asid, page); + __flush_tlb_page(vma->vm_mm, page); restore_flags(flags); } } @@ -303,18 +338,15 @@ void flush_tlb_range(struct mm_struct *mm, unsigned long start, save_and_cli(flags); size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; if (size > (MMU_NTLB_ENTRIES/4)) { /* Too many TLB to flush */ - get_new_mmu_context(mm); + mm->context = NO_CONTEXT; if (mm == current->mm) - set_asid(mm->context & MMU_CONTEXT_ASID_MASK); + activate_context(mm); } else { - unsigned long asid; - - asid = mm->context & MMU_CONTEXT_ASID_MASK; start &= PAGE_MASK; end += (PAGE_SIZE - 1); end &= PAGE_MASK; while (start < end) { - __flush_tlb_page (asid, start); + __flush_tlb_page(mm, start); start += PAGE_SIZE; } } @@ -325,14 +357,14 @@ void flush_tlb_range(struct mm_struct *mm, unsigned long start, void flush_tlb_mm(struct mm_struct *mm) { /* Invalidate all TLB of this process. */ - /* Instead of flush TLBs, we get new MMU context. */ + /* Instead of invalidating each TLB, we get new MMU context. */ if (mm->context != NO_CONTEXT) { unsigned long flags; save_and_cli(flags); - get_new_mmu_context(mm); + mm->context = NO_CONTEXT; if (mm == current->mm) - set_asid(mm->context & MMU_CONTEXT_ASID_MASK); + activate_context(mm); restore_flags(flags); } } diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 2dc194a77..83e2f3e9e 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: init.c,v 1.4 1999/10/23 01:37:02 gniibe Exp gniibe $ * * linux/arch/sh/mm/init.c * @@ -193,13 +193,14 @@ pgd_t swapper_pg_dir[1024]; */ void __init paging_init(void) { + int i; pgd_t * pg_dir; /* We don't need kernel mapping as hardware support that. */ pg_dir = swapper_pg_dir; - /* Unmap the original low memory mappings to detect NULL reference */ - pgd_val(pg_dir[0]) = 0; + for (i=0; i < USER_PTRS_PER_PGD*2; i++) + pgd_val(pg_dir[i]) = 0; /* Enable MMU */ ctrl_outl(MMU_CONTROL_INIT, MMUCR); diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c index d86d29279..90fd190ef 100644 --- a/arch/sh/mm/ioremap.c +++ b/arch/sh/mm/ioremap.c @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: ioremap.c,v 1.1 1999/09/18 16:57:48 gniibe Exp $ * * arch/sh/mm/ioremap.c * diff --git a/arch/sh/vmlinux.lds.S b/arch/sh/vmlinux.lds.S index 374cb4ad7..688c4c9c4 100644 --- a/arch/sh/vmlinux.lds.S +++ b/arch/sh/vmlinux.lds.S @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: vmlinux.lds.S,v 1.3 1999/10/05 12:33:48 gniibe Exp $ * ld script to make SuperH Linux kernel * Written by Niibe Yutaka */ |