summaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
commit6d403070f28cd44860fdb3a53be5da0275c65cf4 (patch)
tree0d0e7fe7b5fb7568d19e11d7d862b77a866ce081 /arch/sh
parentecf1bf5f6c2e668d03b0a9fb026db7aa41e292e1 (diff)
Merge with 2.4.0-test1-ac21 + pile of MIPS cleanups to make merging
possible. Chainsawed RM200 kernel to compile again. Jazz machine status unknown.
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/Makefile9
-rw-r--r--arch/sh/boot/Makefile43
-rw-r--r--arch/sh/boot/compressed/Makefile39
-rw-r--r--arch/sh/boot/compressed/head.S53
-rw-r--r--arch/sh/boot/compressed/install.sh56
-rw-r--r--arch/sh/boot/compressed/misc.c232
-rw-r--r--arch/sh/config.in24
-rw-r--r--arch/sh/defconfig15
-rw-r--r--arch/sh/kernel/Makefile12
-rw-r--r--arch/sh/kernel/cf-enabler.c66
-rw-r--r--arch/sh/kernel/entry.S94
-rw-r--r--arch/sh/kernel/io_hd64461.c109
-rw-r--r--arch/sh/kernel/io_se.c3
-rw-r--r--arch/sh/kernel/irq.c15
-rw-r--r--arch/sh/kernel/process.c16
-rw-r--r--arch/sh/kernel/ptrace.c39
-rw-r--r--arch/sh/kernel/setup.c25
-rw-r--r--arch/sh/kernel/setup_hd64461.c128
-rw-r--r--arch/sh/kernel/setup_od.c35
-rw-r--r--arch/sh/kernel/signal.c2
-rw-r--r--arch/sh/kernel/time.c9
-rw-r--r--arch/sh/mm/fault.c26
-rw-r--r--arch/sh/vmlinux.lds.S6
23 files changed, 931 insertions, 125 deletions
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 1857ef33b..05cc37101 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.4 2000/03/08 15:14:14 gniibe Exp $
+# $Id: Makefile,v 1.6 2000/06/10 03:03:52 gniibe Exp $
#
# 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
@@ -22,6 +22,11 @@ CFLAGS += -ml
AFLAGS += -ml
# LINKFLAGS += -EL
LDFLAGS := -EL
+else
+CFLAGS += -mb
+AFLAGS += -mb
+# LINKFLAGS += -EB
+LDFLAGS := -EB
endif
# ifdef CONFIG_CROSSCOMPILE
@@ -29,7 +34,7 @@ CROSS_COMPILE = $(tool-prefix)
# endif
LD =$(CROSS_COMPILE)ld $(LDFLAGS)
-OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
+OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -R .stab -R .stabstr -S
MODFLAGS +=
diff --git a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile
index 8c087beb1..aff166e28 100644
--- a/arch/sh/boot/Makefile
+++ b/arch/sh/boot/Makefile
@@ -5,37 +5,30 @@
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
+# Copyright (C) 1999 Stuart Menefy
+#
-.S.s:
- $(CPP) $(CFLAGS) $< -o $*.s
-.S.o:
- $(CC) $(CFLAGS) -c $< -o $*.o
+SYSTEM =$(TOPDIR)/vmlinux
-OBJS =
+Image: $(CONFIGURE) $(SYSTEM)
+ $(OBJCOPY) $(SYSTEM) Image
-#
-# Drop some uninteresting sections in the kernel.
-#
-drop-sections = .reginfo .mdebug
-strip-flags = $(addprefix --remove-section=,$(drop-sections))
+zImage: $(CONFIGURE) compressed/vmlinux
+ $(OBJCOPY) compressed/vmlinux zImage
-#
-# Fake compressed boot
-#
-zImage: $(CONFIGURE) mkboot $(TOPDIR)/vmlinux
- $(OBJCOPY) $(strip-flags) $(TOPDIR)/vmlinux zImage.tmp
- ./mkboot zImage.tmp zImage
- rm -f zImage.tmp
+compressed/vmlinux: $(TOPDIR)/vmlinux
+ $(MAKE) -C compressed vmlinux
+
+install: $(CONFIGURE) Image
+ sh -x ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)"
-mkboot: mkboot.c
- $(HOSTCC) -o $@ $^
+zinstall: $(CONFIGURE) zImage
+ sh -x ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)"
-# Don't build dependencies, this may die if $(CC) isn't gcc
dep:
clean:
- rm -f zImage zImage.tmp mkboot
-
-dummy:
-
-include $(TOPDIR)/Rules.make
+ rm -f tools/build
+ rm -f setup bootsect zImage compressed/vmlinux.out
+ rm -f bsetup bbootsect bzImage compressed/bvmlinux.out
+ @$(MAKE) -C compressed clean
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile
new file mode 100644
index 000000000..7a5b5b22f
--- /dev/null
+++ b/arch/sh/boot/compressed/Makefile
@@ -0,0 +1,39 @@
+#
+# linux/arch/sh/boot/compressed/Makefile
+#
+# create a compressed vmlinux image from the original vmlinux
+#
+
+HEAD = head.o
+SYSTEM = $(TOPDIR)/vmlinux
+
+OBJECTS = $(HEAD) misc.o
+
+ZLDFLAGS = -e startup -T $(TOPDIR)/arch/sh/vmlinux.lds
+
+#
+# ZIMAGE_OFFSET is the load offset of the compression loader
+#
+ZIMAGE_OFFSET = $(shell printf "0x%8x" $$[0x80000000+0x$(CONFIG_MEMORY_START)+0x200000])
+
+ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS)
+
+all: vmlinux
+
+vmlinux: piggy.o $(OBJECTS)
+ $(LD) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o
+
+head.o: head.S
+ $(CC) $(AFLAGS) -traditional -c head.S
+
+piggy.o: $(SYSTEM)
+ tmppiggy=_tmp_$$$$piggy; \
+ rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
+ $(OBJCOPY) -R .empty_zero_page $(SYSTEM) $$tmppiggy; \
+ gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
+ echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
+ $(LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-shl -T $$tmppiggy.lnk; \
+ rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk
+
+clean:
+ rm -f vmlinux _tmp_*
diff --git a/arch/sh/boot/compressed/head.S b/arch/sh/boot/compressed/head.S
new file mode 100644
index 000000000..d270d1b47
--- /dev/null
+++ b/arch/sh/boot/compressed/head.S
@@ -0,0 +1,53 @@
+/*
+ * linux/arch/sh/boot/compressed/head.S
+ *
+ * Copyright (C) 1999 Stuart Menefy
+ */
+
+.text
+
+#include <linux/linkage.h>
+
+ .global startup
+startup:
+
+ /* First clear BSS */
+ mov.l end_addr, r1
+ mov.l bss_start_addr, r2
+ mov #0, r0
+l1:
+ mov.l r0, @-r1
+ cmp/eq r1,r2
+ bf l1
+
+ /* Load initial status register */
+ mov.l init_sr, r1
+ ldc r1, sr
+
+ /* Set the initial pointer. */
+ mov.l init_stack_addr, r0
+ mov.l @r0, r15
+
+ /* Decompress the kernel */
+ mov.l decompress_kernel_addr, r0
+ jsr @r0
+ nop
+
+ /* Jump to the start of the decompressed kernel */
+ mov.l kernel_start_addr, r0
+ jmp @r0
+ nop
+
+ .align 2
+bss_start_addr:
+ .long __bss_start
+end_addr:
+ .long _end
+init_sr:
+ .long 0x50000000 /* Privileged mode, Bank=0, Block=1, I3-I0=0 */
+init_stack_addr:
+ .long stack_start
+decompress_kernel_addr:
+ .long decompress_kernel
+kernel_start_addr:
+ .long _text+0x1000
diff --git a/arch/sh/boot/compressed/install.sh b/arch/sh/boot/compressed/install.sh
new file mode 100644
index 000000000..90589f0fe
--- /dev/null
+++ b/arch/sh/boot/compressed/install.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# arch/sh/boot/install.sh
+#
+# 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
+# for more details.
+#
+# Copyright (C) 1995 by Linus Torvalds
+#
+# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+# Adapted from code in arch/i386/boot/install.sh by Russell King
+# Adapted from code in arch/arm/boot/install.sh by Stuart Menefy
+#
+# "make install" script for sh architecture
+#
+# Arguments:
+# $1 - kernel version
+# $2 - kernel image file
+# $3 - kernel map file
+# $4 - default install path (blank if root directory)
+#
+
+# User may have a custom install script
+
+if [ -x /sbin/installkernel ]; then
+ exec /sbin/installkernel "$@"
+fi
+
+if [ "$2" = "zImage" ]; then
+# Compressed install
+ echo "Installing compressed kernel"
+ if [ -f $4/vmlinuz-$1 ]; then
+ mv $4/vmlinuz-$1 $4/vmlinuz.old
+ fi
+
+ if [ -f $4/System.map-$1 ]; then
+ mv $4/System.map-$1 $4/System.old
+ fi
+
+ cat $2 > $4/vmlinuz-$1
+ cp $3 $4/System.map-$1
+else
+# Normal install
+ echo "Installing normal kernel"
+ if [ -f $4/vmlinux-$1 ]; then
+ mv $4/vmlinux-$1 $4/vmlinux.old
+ fi
+
+ if [ -f $4/System.map ]; then
+ mv $4/System.map $4/System.old
+ fi
+
+ cat $2 > $4/vmlinux-$1
+ cp $3 $4/System.map
+fi
diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c
new file mode 100644
index 000000000..aab798505
--- /dev/null
+++ b/arch/sh/boot/compressed/misc.c
@@ -0,0 +1,232 @@
+/*
+ * arch/sh/boot/compressed/misc.c
+ *
+ * This is a collection of several routines from gzip-1.0.3
+ * adapted for Linux.
+ *
+ * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
+ *
+ * Adapted for SH by Stuart Menefy, Aug 1999
+ */
+
+#include <linux/config.h>
+#include <asm/uaccess.h>
+
+/*
+ * gzip declarations
+ */
+
+#define OF(args) args
+#define STATIC static
+
+#undef memset
+#undef memcpy
+#define memzero(s, n) memset ((s), 0, (n))
+
+typedef unsigned char uch;
+typedef unsigned short ush;
+typedef unsigned long ulg;
+
+#define WSIZE 0x8000 /* Window size must be at least 32k, */
+ /* and a power of two */
+
+static uch *inbuf; /* input buffer */
+static uch window[WSIZE]; /* Sliding window buffer */
+
+static unsigned insize = 0; /* valid bytes in inbuf */
+static unsigned inptr = 0; /* index of next byte to be processed in inbuf */
+static unsigned outcnt = 0; /* bytes in output buffer */
+
+/* gzip flag byte */
+#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */
+#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
+#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
+#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
+#define COMMENT 0x10 /* bit 4 set: file comment present */
+#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
+#define RESERVED 0xC0 /* bit 6,7: reserved */
+
+#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
+
+/* Diagnostic functions */
+#ifdef DEBUG
+# define Assert(cond,msg) {if(!(cond)) error(msg);}
+# define Trace(x) fprintf x
+# define Tracev(x) {if (verbose) fprintf x ;}
+# define Tracevv(x) {if (verbose>1) fprintf x ;}
+# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
+# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
+#else
+# define Assert(cond,msg)
+# define Trace(x)
+# define Tracev(x)
+# define Tracevv(x)
+# define Tracec(c,x)
+# define Tracecv(c,x)
+#endif
+
+static int fill_inbuf(void);
+static void flush_window(void);
+static void error(char *m);
+static void gzip_mark(void **);
+static void gzip_release(void **);
+
+extern char input_data[];
+extern int input_len;
+
+static long bytes_out = 0;
+static uch *output_data;
+static unsigned long output_ptr = 0;
+
+
+static void *malloc(int size);
+static void free(void *where);
+static void error(char *m);
+static void gzip_mark(void **);
+static void gzip_release(void **);
+
+static void puts(const char *);
+
+extern int _text; /* Defined in vmlinux.lds.S */
+extern int _end;
+static unsigned long free_mem_ptr;
+static unsigned long free_mem_end_ptr;
+
+#define HEAP_SIZE 0x10000
+
+#include "../../../../lib/inflate.c"
+
+static void *malloc(int size)
+{
+ void *p;
+
+ if (size <0) error("Malloc error\n");
+ if (free_mem_ptr == 0) error("Memory error\n");
+
+ free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
+
+ p = (void *)free_mem_ptr;
+ free_mem_ptr += size;
+
+ if (free_mem_ptr >= free_mem_end_ptr)
+ error("\nOut of memory\n");
+
+ return p;
+}
+
+static void free(void *where)
+{ /* Don't care */
+}
+
+static void gzip_mark(void **ptr)
+{
+ *ptr = (void *) free_mem_ptr;
+}
+
+static void gzip_release(void **ptr)
+{
+ free_mem_ptr = (long) *ptr;
+}
+
+#ifdef CONFIG_DEBUG_KERNEL_WITH_GDB_STUB
+#define IN_GDB 1
+#endif
+#include <asm/io.h>
+#include "../../../../drivers/char/sh-sci.h"
+
+static int strlen(const char *s)
+{
+ int i = 0;
+
+ while (*s++)
+ i++;
+ return i;
+}
+
+void puts(const char *s)
+{
+ put_string(s, strlen(s));
+}
+
+void* memset(void* s, int c, size_t n)
+{
+ int i;
+ char *ss = (char*)s;
+
+ for (i=0;i<n;i++) ss[i] = c;
+ return s;
+}
+
+void* memcpy(void* __dest, __const void* __src,
+ size_t __n)
+{
+ int i;
+ char *d = (char *)__dest, *s = (char *)__src;
+
+ for (i=0;i<__n;i++) d[i] = s[i];
+ return __dest;
+}
+
+/* ===========================================================================
+ * Fill the input buffer. This is called only when the buffer is empty
+ * and at least one byte is really needed.
+ */
+static int fill_inbuf(void)
+{
+ if (insize != 0) {
+ error("ran out of input data\n");
+ }
+
+ inbuf = input_data;
+ insize = input_len;
+ inptr = 1;
+ return inbuf[0];
+}
+
+/* ===========================================================================
+ * Write the output window window[0..outcnt-1] and update crc and bytes_out.
+ * (Used for the decompressed data only.)
+ */
+static void flush_window(void)
+{
+ ulg c = crc; /* temporary variable */
+ unsigned n;
+ uch *in, *out, ch;
+
+ in = window;
+ out = &output_data[output_ptr];
+ for (n = 0; n < outcnt; n++) {
+ ch = *out++ = *in++;
+ c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
+ }
+ crc = c;
+ bytes_out += (ulg)outcnt;
+ output_ptr += (ulg)outcnt;
+ outcnt = 0;
+}
+
+static void error(char *x)
+{
+ puts("\n\n");
+ puts(x);
+ puts("\n\n -- System halted");
+
+ while(1); /* Halt */
+}
+
+#define STACK_SIZE (4096)
+long user_stack [STACK_SIZE];
+long* stack_start = &user_stack[STACK_SIZE];
+
+void decompress_kernel(void)
+{
+ output_data = 0;
+ output_ptr = (unsigned long)&_text+0x20001000;
+ free_mem_ptr = (unsigned long)&_end;
+ free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
+
+ makecrc();
+ puts("Uncompressing Linux... ");
+ gunzip();
+ puts("Ok, booting the kernel.\n");
+}
diff --git a/arch/sh/config.in b/arch/sh/config.in
index ef521e0d4..f67a029e0 100644
--- a/arch/sh/config.in
+++ b/arch/sh/config.in
@@ -1,6 +1,6 @@
#
# For a description of the syntax of this configuration file,
-# see the Configure script.
+# see Documentation/kbuild/config-language.txt.
#
mainmenu_name "Linux/SuperH Kernel Configuration"
@@ -17,7 +17,9 @@ mainmenu_option next_comment
comment 'Processor type and features'
choice 'SuperH system type' \
"Generic CONFIG_SH_GENERIC \
- SolutionEngine CONFIG_SH_SOLUTION_ENGINE" Generic
+ SolutionEngine CONFIG_SH_SOLUTION_ENGINE \
+ Overdrive CONFIG_SH_OVERDRIVE \
+ HP600 CONFIG_SH_HP600" Generic
choice 'Processor type' \
"SH7708 CONFIG_CPU_SUBTYPE_SH7708 \
@@ -36,7 +38,8 @@ if [ "$CONFIG_CPU_SUBTYPE_SH7750" = "y" ]; then
define_bool CONFIG_CPU_SH4 y
fi
bool 'Little Endian' CONFIG_LITTLE_ENDIAN
-if [ "$CONFIG_SH_SOLUTION_ENGINE" = "y" ]; then
+if [ "$CONFIG_SH_SOLUTION_ENGINE" = "y" -o "$CONFIG_SH_HP600" = "y" -o \
+ "$CONFIG_SH_OVERDRIVE" = "y" ]; then
define_hex CONFIG_MEMORY_START 0c000000
else
hex 'Physical memory start address' CONFIG_MEMORY_START 08000000
@@ -61,8 +64,14 @@ define_bool CONFIG_SBUS n
bool 'Networking support' CONFIG_NET
-if [ "$CONFIG_SH_SOLUTION_ENGINE" != "y" ]; then
- bool 'Directly Connected Compact Flash support' CONFIG_CF_ENABLER
+if [ "$CONFIG_SH_GENERIC" = "y" -o "$CONFIG_SH_SOLUTION_ENGINE" = "y" ]; then
+ bool 'Compact Flash Enabler support' CONFIG_CF_ENABLER
+fi
+
+bool 'Hitachi HD64461 companion chip support' CONFIG_HD64461
+if [ "$CONFIG_HD64461" = "y" ]; then
+ int 'HD64461 IRQ' CONFIG_HD64461_IRQ 36
+ bool 'HD64461 PCMCIA enabler' CONFIG_HD64461_ENABLER
fi
bool 'PCI support' CONFIG_PCI
@@ -158,11 +167,6 @@ if [ "$CONFIG_VT" = "y" ]; then
fi
tristate 'Serial support' CONFIG_SERIAL
-if [ "$CONFIG_SERIAL" = "y" -o "$CONFIG_SERIAL" = "m" ]; then
- choice 'Serial interface type' \
- "SCI CONFIG_SH_SCI_SERIAL \
- SCIF CONFIG_SH_SCIF_SERIAL"
-fi
if [ "$CONFIG_SERIAL" = "y" ]; then
bool ' Support for console on serial port' CONFIG_SERIAL_CONSOLE
fi
diff --git a/arch/sh/defconfig b/arch/sh/defconfig
index 6e1a2ba2d..be2685bd7 100644
--- a/arch/sh/defconfig
+++ b/arch/sh/defconfig
@@ -14,6 +14,8 @@ CONFIG_UID16=y
#
CONFIG_SH_GENERIC=y
# CONFIG_SH_SOLUTION_ENGINE is not set
+# CONFIG_SH_OVERDRIVE is not set
+# CONFIG_SH_HP600 is not set
CONFIG_CPU_SUBTYPE_SH7708=y
# CONFIG_CPU_SUBTYPE_SH7709 is not set
# CONFIG_CPU_SUBTYPE_SH7750 is not set
@@ -35,6 +37,7 @@ CONFIG_IOPORT_START=ba000000
# CONFIG_SBUS is not set
# CONFIG_NET is not set
CONFIG_CF_ENABLER=y
+# CONFIG_HD64461 is not set
# CONFIG_PCI is not set
# CONFIG_HOTPLUG is not set
# CONFIG_PCMCIA is not set
@@ -59,17 +62,16 @@ CONFIG_BINFMT_ELF=y
# CONFIG_PARIDE is not set
# CONFIG_BLK_CPQ_DA is not set
# CONFIG_BLK_DEV_DAC960 is not set
-
-#
-# Additional Block Devices
-#
# CONFIG_BLK_DEV_LOOP is not set
# CONFIG_BLK_DEV_NBD is not set
# CONFIG_BLK_DEV_LVM is not set
# CONFIG_BLK_DEV_MD is not set
# CONFIG_MD_LINEAR is not set
# CONFIG_MD_RAID0 is not set
+# CONFIG_MD_RAID1 is not set
+# CONFIG_MD_RAID5 is not set
CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_INITRD=y
#
@@ -96,6 +98,8 @@ CONFIG_BLK_DEV_IDEDISK=y
# CONFIG_BLK_DEV_IDEDISK_QUANTUM is not set
# CONFIG_BLK_DEV_IDEDISK_SEAGATE is not set
# CONFIG_BLK_DEV_IDEDISK_WD is not set
+# CONFIG_BLK_DEV_COMMERIAL is not set
+# CONFIG_BLK_DEV_TIVO is not set
# CONFIG_BLK_DEV_IDECS is not set
# CONFIG_BLK_DEV_IDECD is not set
# CONFIG_BLK_DEV_IDETAPE is not set
@@ -110,6 +114,7 @@ CONFIG_BLK_DEV_IDEDISK=y
# CONFIG_BLK_DEV_ISAPNP is not set
# CONFIG_IDE_CHIPSETS is not set
# CONFIG_IDEDMA_AUTO is not set
+# CONFIG_DMA_NONPCI is not set
# CONFIG_BLK_DEV_IDE_MODES is not set
#
@@ -122,8 +127,6 @@ CONFIG_BLK_DEV_IDEDISK=y
#
# CONFIG_VT is not set
CONFIG_SERIAL=y
-CONFIG_SH_SCI_SERIAL=y
-# CONFIG_SH_SCIF_SERIAL is not set
CONFIG_SERIAL_CONSOLE=y
#
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index cb14a2b50..95b6c5f13 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -28,10 +28,22 @@ ifdef CONFIG_SH_SOLUTION_ENGINE
O_OBJS += setup_se.o io_se.o
endif
+ifdef CONFIG_SH_OVERDRIVE
+O_OBJS += setup_od.o io_generic.o
+endif
+
+ifdef CONFIG_SH_HP600
+O_OBJS += io_hd64461.o
+endif
+
ifdef CONFIG_CPU_SH4
O_OBJS += fpu.o
endif
+ifdef CONFIG_HD64461
+O_OBJS += setup_hd64461.o
+endif
+
all: kernel.o head.o init_task.o
entry.o: entry.S
diff --git a/arch/sh/kernel/cf-enabler.c b/arch/sh/kernel/cf-enabler.c
index 80dc511b3..d5c7437ae 100644
--- a/arch/sh/kernel/cf-enabler.c
+++ b/arch/sh/kernel/cf-enabler.c
@@ -1,19 +1,81 @@
-/* $Id: cf-enabler.c,v 1.2 1999/12/20 10:14:40 gniibe Exp $
+/* $Id: cf-enabler.c,v 1.2 2000/06/08 05:50:10 gniibe Exp $
*
* linux/drivers/block/cf-enabler.c
*
* Copyright (C) 1999 Niibe Yutaka
+ * Copyright (C) 2000 Toshiharu Nozawa
*
* Enable the CF configuration.
*/
+#include <linux/config.h>
#include <linux/init.h>
#include <asm/io.h>
#include <asm/irq.h>
+#ifdef CONFIG_SH_SOLUTION_ENGINE
+#include <asm/hitachi_se.h>
+/*
+ * 0xB8400000 : Common Memory
+ * 0xB8500000 : Attribute
+ * 0xB8600000 : I/O
+ */
+
+int __init cf_init(void)
+{
+ if ((ctrl_inw(MRSHPC_CSR) & 0x000c) != 0)
+ return 0; /* Not detected */
+
+ if ((ctrl_inw(MRSHPC_CSR) & 0x0080) == 0) {
+ ctrl_outw(0x0674, MRSHPC_CPWCR); /* Card Vcc is 3.3v? */
+ } else {
+ ctrl_outw(0x0678, MRSHPC_CPWCR); /* Card Vcc is 5V */
+ }
+
+ /*
+ * PC-Card window open
+ * flag == COMMON/ATTRIBUTE/IO
+ */
+ /* common window open */
+ ctrl_outw(0x8a84, MRSHPC_MW0CR1);/* window 0xb8400000 */
+ if((ctrl_inw(MRSHPC_CSR) & 0x4000) != 0)
+ /* common mode & bus width 16bit SWAP = 1*/
+ ctrl_outw(0x0b00, MRSHPC_MW0CR2);
+ else
+ /* common mode & bus width 16bit SWAP = 0*/
+ ctrl_outw(0x0300, MRSHPC_MW0CR2);
+
+ /* attribute window open */
+ ctrl_outw(0x8a85, MRSHPC_MW1CR1);/* window 0xb8500000 */
+ if ((ctrl_inw(MRSHPC_CSR) & 0x4000) != 0)
+ /* attribute mode & bus width 16bit SWAP = 1*/
+ ctrl_outw(0x0a00, MRSHPC_MW1CR2);
+ else
+ /* attribute mode & bus width 16bit SWAP = 0*/
+ ctrl_outw(0x0200, MRSHPC_MW1CR2);
+
+ /* I/O window open */
+ ctrl_outw(0x8a86, MRSHPC_IOWCR1);/* I/O window 0xb8600000 */
+ ctrl_outw(0x0008, MRSHPC_CDCR); /* I/O card mode */
+ if ((ctrl_inw(MRSHPC_CSR) & 0x4000) != 0)
+ ctrl_outw(0x0a00, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 1*/
+ else
+ ctrl_outw(0x0200, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 0*/
+
+ ctrl_outw(0x2000, MRSHPC_ICR);
+ ctrl_outb(0x00, PA_MRSHPC_MW2 + 0x206);
+ ctrl_outb(0x42, PA_MRSHPC_MW2 + 0x200);
+ return 0;
+}
+#else /* then generic system type */
#define CF_CIS_BASE 0xb8000000
/*
+ * You can connect Compact Flash directly to the bus of SuperH.
+ * This is the enabler for that.
+ */
+
+/*
* 0xB8000000 : Attribute
* 0xB8001000 : Common Memory
* 0xBA000000 : I/O
@@ -21,10 +83,12 @@
int __init cf_init(void)
{
+ /* Enable the card, and set the level interrupt */
outw(0x0042, CF_CIS_BASE+0x0200);
make_imask_irq(14);
disable_irq(14);
return 0;
}
+#endif
__initcall (cf_init);
diff --git a/arch/sh/kernel/entry.S b/arch/sh/kernel/entry.S
index dcb306cac..e54c37b09 100644
--- a/arch/sh/kernel/entry.S
+++ b/arch/sh/kernel/entry.S
@@ -52,8 +52,9 @@
flags = 4
sigpending = 8
need_resched = 20
+tsk_ptrace = 60
-PF_TRACESYS = 0x00000020
+PT_TRACESYS = 0x00000002
PF_USEDFPU = 0x00100000
ENOSYS = 38
@@ -127,7 +128,7 @@ SYSCALL_NR = (16*4+6*4)
or $r11, $r10; \
ldc $r10, $sr
- .balign 4
+ .align 2
tlb_miss_load:
mov.l 2f, $r0
mov.l @$r0, $r6
@@ -137,7 +138,7 @@ tlb_miss_load:
jmp @$r0
mov #0, $r5
- .balign 4
+ .align 2
tlb_miss_store:
mov.l 2f, $r0
mov.l @$r0, $r6
@@ -147,7 +148,7 @@ tlb_miss_store:
jmp @$r0
mov #1, $r5
- .balign 4
+ .align 2
initial_page_write:
mov.l 2f, $r0
mov.l @$r0, $r6
@@ -157,7 +158,7 @@ initial_page_write:
jmp @$r0
mov #1, $r5
- .balign 4
+ .align 2
tlb_protection_violation_load:
mov.l 2f, $r0
mov.l @$r0, $r6
@@ -167,7 +168,7 @@ tlb_protection_violation_load:
jmp @$r0
mov #0, $r5
- .balign 4
+ .align 2
tlb_protection_violation_store:
mov.l 2f, $r0
mov.l @$r0, $r6
@@ -177,14 +178,14 @@ tlb_protection_violation_store:
jmp @$r0
mov #1, $r5
- .balign 4
+ .align 2
1: .long SYMBOL_NAME(do_page_fault)
2: .long MMU_TEA
#ifdef CONFIG_DEBUG_KERNEL_WITH_GDB_STUB
- .balign 4
+ .align 2
/* Unwind the stack and jmp to the debug entry */
-debug:
+debug_kernel:
mov.l @$r15+, $r0
mov.l @$r15+, $r1
mov.l @$r15+, $r2
@@ -216,19 +217,36 @@ debug:
mov.l 2f, $k0
jmp @$k0
ldc $k1, $ssr
- .balign 4
+ .align 2
1: .long 0x300000f0
2: .long 0xa0000100
#endif
- .balign 4
+ .align 2
+debug_trap:
+#ifdef CONFIG_DEBUG_KERNEL_WITH_GDB_STUB
+ mov #SR, $r0
+ mov.l @($r0,$r15), $r0 ! get status register
+ shll $r0
+ shll $r0 ! kernel space?
+ bt/s debug_kernel
+#endif
+ mov.l @$r15, $r0
+ mov.l 1f, $r8
+ jmp @$r8
+ nop
+
+ .align 2
+1: .long SYMBOL_NAME(break_point_trap_software)
+
+ .align 2
error:
!
STI()
mov.l 1f, $r0
jmp @$r0
nop
- .balign 4
+ .align 2
1: .long SYMBOL_NAME(do_exception_error)
badsys: mov #-ENOSYS, $r0
@@ -263,13 +281,11 @@ system_call:
mov.l 1f, $r9
mov.l @$r9, $r8
!
-#ifdef CONFIG_DEBUG_KERNEL_WITH_GDB_STUB
mov #0x20, $r9
extu.b $r9, $r9
shll2 $r9
cmp/hs $r9, $r8
- bt debug
-#endif
+ bt debug_trap
!
mov #SYSCALL_NR, $r14
add $r15, $r14
@@ -311,16 +327,34 @@ system_call:
bt 7b
#endif
0: stc $k_current, $r11
- mov.l @(flags,$r11), $r10 ! Is it trace?
- mov #PF_TRACESYS, $r11
+ mov.l @(tsk_ptrace,$r11), $r10 ! Is it trace?
+ mov #PT_TRACESYS, $r11
tst $r11, $r10
bt 5f
! Trace system call
mov #-ENOSYS, $r11
mov.l $r11, @(R0,$r15)
+ ! Push up $R0--$R2, and $R4--$R7
+ mov.l $r0, @-$r15
+ mov.l $r1, @-$r15
+ mov.l $r2, @-$r15
+ mov.l $r4, @-$r15
+ mov.l $r5, @-$r15
+ mov.l $r6, @-$r15
+ mov.l $r7, @-$r15
+ !
mov.l 2f, $r11
jsr @$r11
nop
+ ! Pop down $R0--$R2, and $R4--$R7
+ mov.l @$r15+, $r7
+ mov.l @$r15+, $r6
+ mov.l @$r15+, $r5
+ mov.l @$r15+, $r4
+ mov.l @$r15+, $r2
+ mov.l @$r15+, $r1
+ mov.l @$r15+, $r0
+ !
mov.l __syscall_ret_trace, $r10
bra 6f
lds $r10, $pr
@@ -337,7 +371,7 @@ system_call:
nop
! In case of trace
- .balign 4
+ .align 2
3:
#ifdef COMPAT_OLD_SYSCALL_ABI
add $r8, $r15 ! pop off the arguments
@@ -347,7 +381,7 @@ system_call:
mova SYMBOL_NAME(ret_from_syscall), $r0
jmp @$r1
lds $r0, $pr
- .balign 4
+ .align 2
1: .long TRA
2: .long SYMBOL_NAME(syscall_trace)
__n_sys: .long NR_syscalls
@@ -366,18 +400,18 @@ fixup_syscall_argerr:
.previous
.section __ex_table, "a"
- .balign 4
+ .align 2
.long 4b,fixup_syscall_argerr
.previous
#endif
- .balign 4
+ .align 2
reschedule:
mova SYMBOL_NAME(ret_from_syscall), $r0
mov.l 1f, $r1
jmp @$r1
lds $r0, $pr
- .balign 4
+ .align 2
1: .long SYMBOL_NAME(schedule)
ENTRY(ret_from_irq)
@@ -401,11 +435,11 @@ ENTRY(ret_from_exception)
STI()
bra ret_from_syscall
nop
- .balign 4
+ .align 2
__INV_IMASK:
.long 0xffffff0f ! ~(IMASK)
- .balign 4
+ .align 2
syscall_ret:
#ifdef COMPAT_OLD_SYSCALL_ABI
add $r8, $r15 ! pop off the arguments
@@ -438,7 +472,7 @@ signal_return:
mova restore_all, $r0
jmp @$r1
lds $r0, $pr
- .balign 4
+ .align 2
__do_signal:
.long SYMBOL_NAME(do_signal)
__softirq_state:
@@ -446,7 +480,7 @@ __softirq_state:
__do_softirq:
.long SYMBOL_NAME(do_softirq)
- .balign 4
+ .align 2
restore_all:
#if defined(__SH4__)
mov.l __fpu_prepare_fd, $r0
@@ -554,7 +588,7 @@ restore_all:
rte
nop
- .balign 4
+ .align 2
__blrb_flags: .long 0x30000000
#if defined(__SH4__)
__fpu_prepare_fd:
@@ -582,7 +616,7 @@ general_exception:
mov.l 2f, $k3
bra handle_exception
mov.l @$k2, $k2
- .balign 4
+ .align 2
2: .long SYMBOL_NAME(ret_from_exception)
1: .long EXPEVT
!
@@ -601,7 +635,7 @@ interrupt:
bra handle_exception
mov.l @$k2, $k2
- .balign 4
+ .align 2
1: .long EXPEVT
2: .long INTEVT
3: .long SYMBOL_NAME(ret_from_irq)
@@ -707,7 +741,7 @@ handle_exception:
mov.l @$r9, $r9
jmp @$r9
nop
- .balign 4
+ .align 2
1: .long SYMBOL_NAME(exception_handling_table)
2: .long 0x00008000 ! FD=1
3: .long 0x000000f0 ! FD=0, IMASK=15
diff --git a/arch/sh/kernel/io_hd64461.c b/arch/sh/kernel/io_hd64461.c
new file mode 100644
index 000000000..7c655942b
--- /dev/null
+++ b/arch/sh/kernel/io_hd64461.c
@@ -0,0 +1,109 @@
+/*
+ * $Id: io_hd64461.c,v 1.1 2000/06/10 21:45:18 yaegashi Exp $
+ * Copyright (C) 2000 YAEGASHI Takeshi
+ * Typical I/O routines for HD64461 system.
+ */
+
+#include <linux/config.h>
+#include <asm/io.h>
+#include <asm/hd64461.h>
+
+static __inline__ unsigned long PORT2ADDR(unsigned long port)
+{
+ /* HD64461 internal devices (0xb0000000) */
+ if (port < 0x10000) return CONFIG_HD64461_IOBASE + port;
+
+ /* PCMCIA channel 0, I/O (0xba000000) */
+ if (port < 0x20000) return 0xba000000 + port - 0x10000;
+
+ /* PCMCIA channel 1, memory (0xb5000000)
+ SH7709 cannot support I/O card attached to Area 5 */
+ if (port < 0x30000) return 0xb5000000 + port - 0x20000;
+
+ /* Whole physical address space (0xa0000000) */
+ return 0xa0000000 + (port & 0x1fffffff);
+}
+
+static inline void delay(void)
+{
+ ctrl_inw(0xa0000000);
+}
+
+unsigned long inb(unsigned int port)
+{
+ return *(volatile unsigned char*)PORT2ADDR(port);
+}
+
+unsigned long inb_p(unsigned int port)
+{
+ unsigned long v = *(volatile unsigned char*)PORT2ADDR(port);
+ delay();
+ return v;
+}
+
+unsigned long inw(unsigned int port)
+{
+ return *(volatile unsigned short*)PORT2ADDR(port);
+}
+
+unsigned long inl(unsigned int port)
+{
+ return *(volatile unsigned long*)PORT2ADDR(port);
+}
+
+void insb(unsigned int port, void *buffer, unsigned long count)
+{
+ unsigned char *buf=buffer;
+ while(count--) *buf++=inb(port);
+}
+
+void insw(unsigned int port, void *buffer, unsigned long count)
+{
+ unsigned short *buf=buffer;
+ while(count--) *buf++=inw(port);
+}
+
+void insl(unsigned int port, void *buffer, unsigned long count)
+{
+ unsigned long *buf=buffer;
+ while(count--) *buf++=inl(port);
+}
+
+void outb(unsigned long b, unsigned int port)
+{
+ *(volatile unsigned char*)PORT2ADDR(port) = b;
+}
+
+void outb_p(unsigned long b, unsigned int port)
+{
+ *(volatile unsigned char*)PORT2ADDR(port) = b;
+ delay();
+}
+
+void outw(unsigned long b, unsigned int port)
+{
+ *(volatile unsigned short*)PORT2ADDR(port) = b;
+}
+
+void outl(unsigned long b, unsigned int port)
+{
+ *(volatile unsigned long*)PORT2ADDR(port) = b;
+}
+
+void outsb(unsigned int port, const void *buffer, unsigned long count)
+{
+ const unsigned char *buf=buffer;
+ while(count--) outb(*buf++, port);
+}
+
+void outsw(unsigned int port, const void *buffer, unsigned long count)
+{
+ const unsigned short *buf=buffer;
+ while(count--) outw(*buf++, port);
+}
+
+void outsl(unsigned int port, const void *buffer, unsigned long count)
+{
+ const unsigned long *buf=buffer;
+ while(count--) outl(*buf++, port);
+}
diff --git a/arch/sh/kernel/io_se.c b/arch/sh/kernel/io_se.c
index 1726980b6..a16c4738d 100644
--- a/arch/sh/kernel/io_se.c
+++ b/arch/sh/kernel/io_se.c
@@ -1,4 +1,4 @@
-/* $Id: io_se.c,v 1.4 2000/05/07 23:31:58 gniibe Exp $
+/* $Id: io_se.c,v 1.5 2000/06/08 05:50:10 gniibe Exp $
*
* linux/arch/sh/kernel/io_se.c
*
@@ -7,6 +7,7 @@
* I/O routine for Hitachi SolutionEngine.
*
*/
+
#include <linux/kernel.h>
#include <linux/types.h>
#include <asm/io.h>
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index b7d01e9a2..f21d0e451 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -37,6 +37,9 @@
#include <asm/irq.h>
#include <linux/irq.h>
+#ifdef CONFIG_HD64461
+#include <asm/hd64461.h>
+#endif
unsigned int local_bh_count[NR_CPUS];
unsigned int local_irq_count[NR_CPUS];
@@ -243,6 +246,18 @@ asmlinkage int do_IRQ(unsigned long r4, unsigned long r5,
"shlr %0\n\t"
"add #-16, %0\n\t"
:"=z" (irq));
+#if defined(CONFIG_HD64461)
+ if (irq == CONFIG_HD64461_IRQ) {
+ unsigned short bit;
+ unsigned short nirr = inw(HD64461_NIRR);
+ unsigned short nimr = inw(HD64461_NIMR);
+ nirr &= ~nimr;
+ for (bit = 1, irq = 0; irq < 16; bit <<= 1, irq++)
+ if (nirr & bit) break;
+ if (irq == 16) irq = CONFIG_HD64461_IRQ;
+ else irq += HD64461_IRQBASE;
+ }
+#endif
kstat.irqs[cpu][irq]++;
desc = irq_desc + irq;
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 2d0f5e18a..acefb5e4f 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -339,7 +339,7 @@ asmlinkage int sys_execve(char *ufilename, char **uargv,
error = do_execve(filename, uargv, uenvp, &regs);
if (error == 0)
- current->flags &= ~PF_DTRACE;
+ current->ptrace &= ~PT_DTRACE;
putname(filename);
out:
unlock_kernel();
@@ -384,11 +384,21 @@ asmlinkage void print_syscall(int x)
restore_flags(flags);
}
-asmlinkage void break_point_trap(void)
+asmlinkage void break_point_trap(unsigned long r4, unsigned long r5,
+ unsigned long r6, unsigned long r7,
+ struct pt_regs regs)
{
- /* Clear traicng. */
+ /* Clear tracing. */
ctrl_outw(0, UBC_BBRA);
ctrl_outw(0, UBC_BBRB);
force_sig(SIGTRAP, current);
}
+
+asmlinkage void break_point_trap_software(unsigned long r4, unsigned long r5,
+ unsigned long r6, unsigned long r7,
+ struct pt_regs regs)
+{
+ regs.pc -= 2;
+ force_sig(SIGTRAP, current);
+}
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c
index 73601b358..7f42367e2 100644
--- a/arch/sh/kernel/ptrace.c
+++ b/arch/sh/kernel/ptrace.c
@@ -1,4 +1,4 @@
-/* $Id: ptrace.c,v 1.5 2000/05/09 01:42:21 gniibe Exp $
+/* $Id: ptrace.c,v 1.6 2000/06/08 23:44:50 gniibe Exp $
*
* linux/arch/sh/kernel/ptrace.c
*
@@ -10,6 +10,7 @@
*
*/
+#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/mm.h>
@@ -121,13 +122,21 @@ ubc_set_tracing(int asid, unsigned long nextpc1, unsigned nextpc2)
{
ctrl_outl(nextpc1, UBC_BARA);
ctrl_outb(asid, UBC_BASRA);
+#if defined(CONFIG_CPU_SUBTYPE_SH7709)
+ ctrl_outl(0x0fff, UBC_BAMRA);
+#else
ctrl_outb(BAMR_12, UBC_BAMRA);
+#endif
ctrl_outw(BBR_INST | BBR_READ, UBC_BBRA);
if (nextpc2 != (unsigned long) -1) {
ctrl_outl(nextpc2, UBC_BARB);
ctrl_outb(asid, UBC_BASRB);
+#if defined(CONFIG_CPU_SUBTYPE_SH7709)
+ ctrl_outl(0x0fff, UBC_BAMRA);
+#else
ctrl_outb(BAMR_12, UBC_BAMRB);
+#endif
ctrl_outw(BBR_INST | BBR_READ, UBC_BBRB);
}
ctrl_outw(BRCR_PCBA | BRCR_PCBB, UBC_BRCR);
@@ -143,10 +152,10 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
ret = -EPERM;
if (request == PTRACE_TRACEME) {
/* are we already being traced? */
- if (current->flags & PF_PTRACED)
+ if (current->ptrace & PT_PTRACED)
goto out;
/* set the ptrace bit in the process flags. */
- current->flags |= PF_PTRACED;
+ current->ptrace |= PT_PTRACED;
ret = 0;
goto out;
}
@@ -176,9 +185,9 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
(tsk->gid != child->gid)) && !capable(CAP_SYS_PTRACE))
goto out_tsk;
/* the same process cannot be attached many times */
- if (child->flags & PF_PTRACED)
+ if (child->ptrace & PT_PTRACED)
goto out_tsk;
- child->flags |= PF_PTRACED;
+ child->ptrace |= PT_PTRACED;
write_lock_irq(&tasklist_lock);
if (child->p_pptr != tsk) {
@@ -193,7 +202,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
goto out_tsk;
}
ret = -ESRCH;
- if (!(child->flags & PF_PTRACED))
+ if (!(child->ptrace & PT_PTRACED))
goto out_tsk;
if (child->state != TASK_STOPPED) {
if (request != PTRACE_KILL)
@@ -280,9 +289,9 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
if ((unsigned long) data > _NSIG)
break;
if (request == PTRACE_SYSCALL)
- child->flags |= PF_TRACESYS;
+ child->ptrace |= PT_TRACESYS;
else
- child->flags &= ~PF_TRACESYS;
+ child->ptrace &= ~PT_TRACESYS;
child->exit_code = data;
wake_up_process(child);
ret = 0;
@@ -313,16 +322,16 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
- child->flags &= ~PF_TRACESYS;
- if ((child->flags & PF_DTRACE) == 0) {
+ child->ptrace &= ~PT_TRACESYS;
+ if ((child->ptrace & PT_DTRACE) == 0) {
/* Spurious delayed TF traps may occur */
- child->flags |= PF_DTRACE;
+ child->ptrace |= PT_DTRACE;
}
/* Compute next pc. */
pc = get_stack_long(child, (long)&dummy->pc);
regs = (struct pt_regs *)((unsigned long)child + THREAD_SIZE - sizeof(struct pt_regs));
- if (access_process_vm(child, pc&~3, &tmp, sizeof(tmp), 1) != sizeof(data))
+ if (access_process_vm(child, pc&~3, &tmp, sizeof(tmp), 0) != sizeof(tmp))
break;
#ifdef __LITTLE_ENDIAN__
@@ -357,7 +366,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
- child->flags &= ~(PF_PTRACED|PF_TRACESYS);
+ child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
child->exit_code = data;
write_lock_irq(&tasklist_lock);
REMOVE_LINKS(child);
@@ -384,8 +393,8 @@ asmlinkage void syscall_trace(void)
{
struct task_struct *tsk = current;
- if ((tsk->flags & (PF_PTRACED|PF_TRACESYS))
- != (PF_PTRACED|PF_TRACESYS))
+ if ((tsk->ptrace & (PT_PTRACED|PT_TRACESYS))
+ != (PT_PTRACED|PT_TRACESYS))
return;
tsk->exit_code = SIGTRAP;
tsk->state = TASK_STOPPED;
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 49179f08f..c8c04ec12 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -110,23 +110,6 @@ static struct resource rom_resources[MAXROMS] = {
static unsigned long memory_start, memory_end;
-unsigned long __init memparse(char *ptr, char **retptr)
-{
- unsigned long ret;
-
- ret = simple_strtoul(ptr, retptr, 0);
-
- if (**retptr == 'K' || **retptr == 'k') {
- ret <<= 10;
- (*retptr)++;
- }
- else if (**retptr == 'M' || **retptr == 'm') {
- ret <<= 20;
- (*retptr)++;
- }
- return ret;
-} /* memparse */
-
static inline void parse_mem_cmdline (char ** cmdline_p)
{
char c = ' ', *to = command_line, *from = COMMAND_LINE;
@@ -327,5 +310,13 @@ int get_cpuinfo(char *buffer)
(loops_per_sec+2500)/500000,
((loops_per_sec+2500)/5000) % 100);
+#define PRINT_CLOCK(name, value) \
+ p += sprintf(p, name " clock: %d.%02dMHz\n", \
+ ((value) / 1000000), ((value) % 1000000)/10000)
+
+ PRINT_CLOCK("CPU", boot_cpu_data.cpu_clock);
+ PRINT_CLOCK("Bus", boot_cpu_data.bus_clock);
+ PRINT_CLOCK("Peripheral module", boot_cpu_data.module_clock);
+
return p - buffer;
}
diff --git a/arch/sh/kernel/setup_hd64461.c b/arch/sh/kernel/setup_hd64461.c
new file mode 100644
index 000000000..0ee07e887
--- /dev/null
+++ b/arch/sh/kernel/setup_hd64461.c
@@ -0,0 +1,128 @@
+/*
+ * $Id: setup_hd64461.c,v 1.1 2000/06/10 21:45:18 yaegashi Exp $
+ * Copyright (C) 2000 YAEGASHI Takeshi
+ * Hitachi HD64461 companion chip support
+ */
+
+#include <linux/config.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/param.h>
+#include <linux/interrupt.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+
+#include <asm/hd64461.h>
+
+static void disable_hd64461_irq(unsigned int irq)
+{
+ unsigned long flags;
+ unsigned short nimr;
+ unsigned short mask = 1 << (irq - HD64461_IRQBASE);
+
+ save_and_cli(flags);
+ nimr = inw(HD64461_NIMR);
+ nimr |= mask;
+ outw(nimr, HD64461_NIMR);
+ restore_flags(flags);
+}
+
+
+static void enable_hd64461_irq(unsigned int irq)
+{
+ unsigned long flags;
+ unsigned short nimr;
+ unsigned short mask = 1 << (irq - HD64461_IRQBASE);
+
+ save_and_cli(flags);
+ nimr = inw(HD64461_NIMR);
+ nimr &= ~mask;
+ outw(nimr, HD64461_NIMR);
+ restore_flags(flags);
+}
+
+
+static void mask_and_ack_hd64461(unsigned int irq)
+{
+ disable_hd64461_irq(irq);
+#ifdef CONFIG_HD64461_ENABLER
+ if (irq == HD64461_IRQBASE + 13)
+ outb(0x00, HD64461_PCC1CSCR);
+#endif
+}
+
+
+static void end_hd64461_irq(unsigned int irq)
+{
+ enable_hd64461_irq(irq);
+}
+
+
+static unsigned int startup_hd64461_irq(unsigned int irq)
+{
+ enable_hd64461_irq(irq);
+ return 0;
+}
+
+
+static void shutdown_hd64461_irq(unsigned int irq)
+{
+ disable_hd64461_irq(irq);
+}
+
+
+static struct hw_interrupt_type hd64461_irq_type = {
+ "HD64461-IRQ",
+ startup_hd64461_irq,
+ shutdown_hd64461_irq,
+ enable_hd64461_irq,
+ disable_hd64461_irq,
+ mask_and_ack_hd64461,
+ end_hd64461_irq
+};
+
+
+static void hd64461_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+ printk(KERN_INFO
+ "HD64461: spurious interrupt, nirr: 0x%lx nimr: 0x%lx\n",
+ inw(HD64461_NIRR), inw(HD64461_NIMR));
+}
+
+
+static struct irqaction irq0 = { hd64461_interrupt, SA_INTERRUPT, 0, "HD64461", NULL, NULL};
+
+
+int __init setup_hd64461(void)
+{
+ int i;
+
+ printk(KERN_INFO "HD64461 configured at 0x%x on irq %d(mapped into %d to %d)\n",
+ CONFIG_HD64461_IOBASE, CONFIG_HD64461_IRQ,
+ HD64461_IRQBASE, HD64461_IRQBASE+15);
+#if 1
+ /* IRQ line for HD64461 should be set level trigger mode("10"). */
+ /* And this should be done earlier than the kernel starts. */
+ ctrl_outw(0x0200, INTC_ICR1); /* when connected to IRQ4. */
+#endif
+ outw(0xffff, HD64461_NIMR);
+
+ for (i = HD64461_IRQBASE; i < HD64461_IRQBASE + 16; i++) {
+ irq_desc[i].handler = &hd64461_irq_type;
+ }
+
+ setup_irq(CONFIG_HD64461_IRQ, &irq0);
+
+#ifdef CONFIG_HD64461_ENABLER
+ printk(KERN_INFO "HD64461: enabling PCMCIA devices\n");
+ outb(0x04, HD64461_PCC1CSCIER);
+ outb(0x00, HD64461_PCC1CSCR);
+#endif
+
+ return 0;
+}
+
+module_init(setup_hd64461);
diff --git a/arch/sh/kernel/setup_od.c b/arch/sh/kernel/setup_od.c
new file mode 100644
index 000000000..f605bd20e
--- /dev/null
+++ b/arch/sh/kernel/setup_od.c
@@ -0,0 +1,35 @@
+/* $Id: setup_od.c,v 1.1 2000/06/14 09:35:59 stuart_menefy Exp $
+ *
+ * arch/sh/kernel/setup_od.c
+ *
+ * Copyright (C) 2000 Stuart Menefy
+ *
+ * STMicroelectronics Overdrive Support.
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+/*
+ * Initialize the board
+ */
+int __init setup_od(void)
+{
+ /* Enable RS232 receive buffers */
+ volatile int* p = (volatile int*)0xa3000000;
+
+#if defined(CONFIG_SH_ORION)
+ *p=1;
+#elif defined(CONFIG_SH_OVERDRIVE)
+ *p=0x1e;
+#else
+#error Illegal configuration
+#endif
+
+ printk(KERN_INFO "STMicroelectronics Overdrive Setup...done\n");
+ return 0;
+}
+
+module_init(setup_od);
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c
index 14ce2eae9..65469f7e1 100644
--- a/arch/sh/kernel/signal.c
+++ b/arch/sh/kernel/signal.c
@@ -595,7 +595,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
if (!signr)
break;
- if ((current->flags & PF_PTRACED) && signr != SIGKILL) {
+ if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) {
/* Let the debugger run. */
current->exit_code = signr;
current->state = TASK_STOPPED;
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index de6150184..35c34a77b 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -421,7 +421,11 @@ void __init time_init(void)
tmp = (frqcr & 0x2000) >> 11;
tmp |= frqcr & 0x0003;
pfc = pfc_table[tmp];
+#ifdef CONFIG_SH_HP600
+ master_clock = cpu_clock/6;
+#else
master_clock = cpu_clock;
+#endif
bus_clock = master_clock/pfc;
}
#elif defined(__SH4__)
@@ -444,6 +448,11 @@ void __init time_init(void)
printk("Interval = %ld\n", interval);
+ current_cpu_data.cpu_clock = cpu_clock;
+ current_cpu_data.master_clock = master_clock;
+ current_cpu_data.bus_clock = bus_clock;
+ current_cpu_data.module_clock = module_clock;
+
/* Start TMU0 */
ctrl_outb(TMU_TOCR_INIT, TMU_TOCR);
ctrl_outw(TMU0_TCR_INIT, TMU0_TCR);
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index d3a874447..428bec21c 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -82,7 +82,7 @@ bad_area:
return 0;
}
-static void handle_vmalloc_fault(struct task_struct *tsk, unsigned long address)
+static void handle_vmalloc_fault(struct mm_struct *mm, unsigned long address)
{
pgd_t *dir;
pmd_t *pmd;
@@ -107,6 +107,13 @@ static void handle_vmalloc_fault(struct task_struct *tsk, unsigned long address)
return;
}
+#if defined(__SH4__)
+ /*
+ * ITLB is not affected by "ldtlb" instruction.
+ * So, we need to flush the entry by ourselves.
+ */
+ __flush_tlb_page(mm, address&PAGE_MASK);
+#endif
update_mmu_cache(NULL, address, entry);
}
@@ -128,7 +135,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
mm = tsk->mm;
if (address >= VMALLOC_START && address < VMALLOC_END) {
- handle_vmalloc_fault(tsk, address);
+ handle_vmalloc_fault(mm, address);
return;
}
@@ -269,18 +276,13 @@ void update_mmu_cache(struct vm_area_struct * vma,
unsigned long pteaddr;
save_and_cli(flags);
-#if defined(__SH4__)
- /*
- * ITLB is not affected by "ldtlb" instruction.
- * So, we need to flush the entry by ourselves.
- */
- __flush_tlb_page(vma->vm_mm, address&PAGE_MASK);
-#endif
/* Set PTEH register */
- pteaddr = (address & MMU_VPN_MASK) |
- (vma->vm_mm->context & MMU_CONTEXT_ASID_MASK);
- ctrl_outl(pteaddr, MMU_PTEH);
+ if (vma) {
+ pteaddr = (address & MMU_VPN_MASK) |
+ (vma->vm_mm->context & MMU_CONTEXT_ASID_MASK);
+ ctrl_outl(pteaddr, MMU_PTEH);
+ }
/* Set PTEL register */
pteval = pte_val(pte);
diff --git a/arch/sh/vmlinux.lds.S b/arch/sh/vmlinux.lds.S
index 53a7fff56..736e4301f 100644
--- a/arch/sh/vmlinux.lds.S
+++ b/arch/sh/vmlinux.lds.S
@@ -15,12 +15,14 @@ SECTIONS
. = 0x80000000 + CONFIG_MEMORY_START + 0x1000;
_text = .; /* Text and read-only data */
text = .; /* Text and read-only data */
- .text : {
+ .empty_zero_page : {
*(.empty_zero_page)
+ } = 0
+ .text : {
*(.text)
*(.fixup)
*(.gnu.warning)
- } = 0
+ } = 0x0009
.text.lock : { *(.text.lock) } /* out-of-line lock text */
.rodata : { *(.rodata) }
.kstrtab : { *(.kstrtab) }