[PATCH] h8300 support fix (1/2)

From: Yoshinori Sato
Date: Fri Aug 22 2003 - 00:14:05 EST


o build script update
o interrupt management fix
o mtd support fix
o signal handling fix

--
Yoshinori Sato
<ysato@xxxxxxxxxxxxxxxxxxxx>

diff -Nru linux-2.6.0-test3/MAINTAINERS linux-2.6.0-test3-h8300/MAINTAINERS
--- linux-2.6.0-test3/MAINTAINERS 2003-08-21 19:32:59.000000000 +0900
+++ linux-2.6.0-test3-h8300/MAINTAINERS 2003-08-22 01:09:26.000000000 +0900
@@ -2170,6 +2170,12 @@
W: http://www.ee.nec.de/uclinux/
S: Supported

+UCLINUX FOR RENESAS H8/300
+P: Yoshinori Sato
+M: ysato@xxxxxxxxxxxxxxxxxxxx
+W: http://uclinux-h8.sourceforge.jp/
+S: Supported
+
USB DIAMOND RIO500 DRIVER
P: Cesar Miquel
M: miquel@xxxxxxxxx
diff -Nru linux-2.6.0-test3/arch/h8300/Kconfig linux-2.6.0-test3-h8300/arch/h8300/Kconfig
--- linux-2.6.0-test3/arch/h8300/Kconfig 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/Kconfig 2003-08-22 00:42:22.000000000 +0900
@@ -190,6 +190,8 @@

source "drivers/base/Kconfig"

+source "drivers/mtd/Kconfig"
+
source "drivers/block/Kconfig"

source "drivers/ide/Kconfig"
diff -Nru linux-2.6.0-test3/arch/h8300/Makefile linux-2.6.0-test3-h8300/arch/h8300/Makefile
--- linux-2.6.0-test3/arch/h8300/Makefile 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/Makefile 2003-08-22 00:42:22.000000000 +0900
@@ -5,7 +5,7 @@
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
-# (C) Copyright 2002, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>
+# (C) Copyright 2002,2003 Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>
#
ifndef include-config
-include $(TOPDIR)/.config
@@ -37,8 +37,8 @@
CFLAGS += -mint32 -fno-builtin -Os
CFLAGS += -g
CFLAGS += -D__linux__
-CFLAGS += -DUTS_SYSNAME=\"uClinux\" -DTARGET=$(BOARD)
-AFLAGS += -DPLATFORM=$(PLATFORM) -DTARGET=$(BOARD) -DMODEL=$(MODEL) $(cflags-y)
+CFLAGS += -DUTS_SYSNAME=\"uClinux\"
+AFLAGS += -DPLATFORM=$(PLATFORM) -DMODEL=$(MODEL) $(cflags-y)
LDFLAGS += $(ldflags-y)

CROSS_COMPILE = h8300-elf-
@@ -53,28 +53,32 @@

libs-y += arch/$(ARCH)/lib/ $(LIBGCC)

-export MODEL
+boot := arch/h8300/boot
+
+export MODEL PLATFORM BOARD

archmrproper:

archclean:
- $(call descend arch/$(ARCH), subdirclean)
+ $(Q)$(MAKE) $(clean)=$(boot)
+
+prepare: include/asm-$(ARCH)/machine-depend.h include/asm-$(ARCH)/asm-offsets.h

-prepare: include/asm-$(ARCH)/asm-offsets.h
+include/asm-$(ARCH)/machine-depend.h: include/asm-$(ARCH)/$(BOARD)/machine-depend.h
+ $(Q)ln -sf $(BOARD)/machine-depend.h \
+ include/asm-$(ARCH)/machine-depend.h
+ @echo ' Create include/asm-$(ARCH)/machine-depend.h'

include/asm-$(ARCH)/asm-offsets.h: arch/$(ARCH)/kernel/asm-offsets.s \
include/asm include/linux/version.h
$(call filechk,gen-asm-offsets)

-vmlinux.bin: vmlinux
- $(OBJCOPY) -Obinary $< $@
-
-vmlinux.srec: vmlinux
- $(OBJCOPY) -Osrec $< $@
+vmlinux.srec vmlinux.bin: vmlinux
+ $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

define archhelp
echo 'vmlinux.bin - Create raw binary'
echo 'vmlinux.srec - Create srec binary'
endef

-CLEAN_FILES += arch/$(ARCH)/vmlinux.bin arch/$(ARCH)/vmlinux.srec
+CLEAN_FILES += include/asm-$(ARCH)/asm-offsets.h include/asm-$(ARCH)/machine-depend.h
diff -Nru linux-2.6.0-test3/arch/h8300/boot/Makefile linux-2.6.0-test3-h8300/arch/h8300/boot/Makefile
--- linux-2.6.0-test3/arch/h8300/boot/Makefile 1970-01-01 09:00:00.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/boot/Makefile 2003-08-22 00:42:22.000000000 +0900
@@ -0,0 +1,12 @@
+# arch/h8300/boot/Makefile
+
+targets := vmlinux.srec vmlinux.bin
+
+OBJCOPYFLAGS_vmlinux.srec := -Osrec
+OBJCOPYFLAGS_vmlinux.bin := -Obinary
+
+$(obj)/vmlinux.srec $(obj)/vmlinux.bin: vmlinux FORCE
+ $(call if_changed,objcopy)
+ @echo ' Kernel: $@ is ready'
+
+CLEAN_FILES += arch/$(ARCH)/vmlinux.bin arch/$(ARCH)/vmlinux.srec
diff -Nru linux-2.6.0-test3/arch/h8300/kernel/signal.c linux-2.6.0-test3-h8300/arch/h8300/kernel/signal.c
--- linux-2.6.0-test3/arch/h8300/kernel/signal.c 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/kernel/signal.c 2003-08-22 00:42:22.000000000 +0900
@@ -157,6 +157,7 @@
#if defined(CONFIG_CPU_H8S)
short dummy_exr;
#endif
+ long dummy_pc;
char *pretcode;
unsigned char retcode[8];
unsigned long extramask[_NSIG_WORDS-1];
@@ -170,6 +171,7 @@
#if defined(CONFIG_CPU_H8S)
short dummy_exr;
#endif
+ long dummy_pc;
char *pretcode;
unsigned char retcode[8];
struct siginfo info;
@@ -241,7 +243,7 @@

asmlinkage int do_sigreturn(unsigned long __unused,...)
{
- struct pt_regs *regs = (struct pt_regs *) &__unused;
+ struct pt_regs *regs = (struct pt_regs *) (&__unused - 1);
unsigned long usp = rdusp();
struct sigframe *frame = (struct sigframe *)(usp - 4);
sigset_t set;
@@ -416,7 +418,6 @@
/* Set up to return from userspace. */
err |= __put_user(frame->retcode, &frame->pretcode);

- /* moveq #,d0; notb d0; movea.l #,a5; trap #0 */
/* sub.l er0,er0; mov.b #__NR_rt_sigreturn,r0l; trapa #0 */
err != __put_user(0x1a80f800 + (__NR_rt_sigreturn & 0xff),
(long *)(frame->retcode + 0));
diff -Nru linux-2.6.0-test3/arch/h8300/kernel/syscalls.S linux-2.6.0-test3-h8300/arch/h8300/kernel/syscalls.S
--- linux-2.6.0-test3/arch/h8300/kernel/syscalls.S 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/kernel/syscalls.S 2003-08-22 00:42:22.000000000 +0900
@@ -275,14 +275,18 @@
.long SYMBOL_NAME(sys_ni_syscall) /* sys_remap_file_pages */
.long SYMBOL_NAME(sys_set_tid_address)
.long SYMBOL_NAME(sys_timer_create)
- .long SYMBOL_NAME(sys_timer_settime) /* 260 */
+ .long SYMBOL_NAME(sys_timer_settime) /* 260 */
.long SYMBOL_NAME(sys_timer_gettime)
.long SYMBOL_NAME(sys_timer_getoverrun)
.long SYMBOL_NAME(sys_timer_delete)
.long SYMBOL_NAME(sys_clock_settime)
- .long SYMBOL_NAME(sys_clock_gettime) /* 265 */
+ .long SYMBOL_NAME(sys_clock_gettime) /* 265 */
.long SYMBOL_NAME(sys_clock_getres)
.long SYMBOL_NAME(sys_clock_nanosleep)
+ .long SYMBOL_NAME(sys_statfs64)
+ .long SYMBOL_NAME(sys_fstatfs64)
+ .long SYMBOL_NAME(sys_tgkill) /* 270 */
+ .long SYMBOL_NAME(sys_utimes)

.rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4
.long SYMBOL_NAME(sys_ni_syscall)
diff -Nru linux-2.6.0-test3/arch/h8300/kernel/vmlinux.lds.S linux-2.6.0-test3-h8300/arch/h8300/kernel/vmlinux.lds.S
--- linux-2.6.0-test3/arch/h8300/kernel/vmlinux.lds.S 2003-08-21 19:33:00.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/kernel/vmlinux.lds.S 2003-08-22 00:20:06.000000000 +0900
@@ -2,58 +2,62 @@

#ifdef CONFIG_H8300H_GENERIC
#ifdef CONFIG_ROMKERNEL
-#include "platform/h8300h/generic/rom.ld"
+#include "../platform/h8300h/generic/rom.ld"
#endif
#ifdef CONFIG_RAMKERNEL
-#include "platform/h8300h/generic/ram.ld"
+#include "../platform/h8300h/generic/ram.ld"
#endif
#endif

#ifdef CONFIG_H8300H_AKI3068NET
#ifdef CONFIG_ROMKERNEL
-#include "platform/h8300h/aki3068net/rom.ld"
+#include "../platform/h8300h/aki3068net/rom.ld"
#endif
#ifdef CONFIG_RAMKERNEL
-#include "platform/h8300h/aki3068net/ram.ld"
+#include "../platform/h8300h/aki3068net/ram.ld"
#endif
#endif

#ifdef CONFIG_H8300H_H8MAX
#ifdef CONFIG_ROMKERNEL
-#include "platform/h8300h/h8max/rom.ld"
+#include "../platform/h8300h/h8max/rom.ld"
#endif
#ifdef CONFIG_RAMKERNEL
-#include "platform/h8300h/h8max/ram.ld"
+#include "../platform/h8300h/h8max/ram.ld"
#endif
#endif

#ifdef CONFIG_H8300H_SIM
#ifdef CONFIG_ROMKERNEL
-#include "platform/h8300h/generic/rom.ld"
+#include "../platform/h8300h/generic/rom.ld"
#endif
#ifdef CONFIG_RAMKERNEL
-#include "platform/h8300h/generic/ram.ld"
+#include "../platform/h8300h/generic/ram.ld"
#endif
#endif

#ifdef CONFIG_H8S_SIM
#ifdef CONFIG_ROMKERNEL
-#include "platform/h8s/generic/rom.ld"
+#include "../platform/h8s/generic/rom.ld"
#endif
#ifdef CONFIG_RAMKERNEL
-#include "platform/h8s/generic/ram.ld"
+#include "../platform/h8s/generic/ram.ld"
#endif
#endif

#ifdef CONFIG_H8S_EDOSK2674
#ifdef CONFIG_ROMKERNEL
-#include "platform/h8s/edosk2674/rom.ld"
+#include "../platform/h8s/edosk2674/rom.ld"
#endif
#ifdef CONFIG_RAMKERNEL
-#include "platform/h8s/edosk2674/ram.ld"
+#include "../platform/h8s/edosk2674/ram.ld"
#endif
#endif

+#if defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)
+INPUT(romfs.o)
+#endif
+
_jiffies = _jiffies_64 + 4;

SECTIONS
@@ -169,6 +173,10 @@
__end = . ;
__ramstart = .;
} > ram
+ .romfs :
+ {
+ *(.romfs*)
+ } > ram
.dummy :
{
COMMAND_START = . - 0x200 ;
diff -Nru linux-2.6.0-test3/arch/h8300/lib/romfs.S linux-2.6.0-test3-h8300/arch/h8300/lib/romfs.S
--- linux-2.6.0-test3/arch/h8300/lib/romfs.S 1970-01-01 09:00:00.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/lib/romfs.S 2003-08-22 00:42:22.000000000 +0900
@@ -0,0 +1,52 @@
+/* romfs move to __ebss */
+
+#include <asm/linkage.h>
+
+#if defined(__H8300H__)
+ .h8300h
+#endif
+#if defined(__H8300S__)
+ .h8300s
+#endif
+
+ .text
+.globl __move_romfs
+_romfs_sig_len = 8
+
+__move_romfs:
+ mov.l #__sbss,er0
+ mov.l #_romfs_sig,er1
+ mov.b #_romfs_sig_len,r3l
+1: /* check romfs image */
+ mov.b @er0+,r2l
+ mov.b @er1+,r2h
+ cmp.b r2l,r2h
+ bne 2f
+ dec.b r3l
+ bne 1b
+
+ /* find romfs image */
+ mov.l @__sbss+8,er0 /* romfs length(be) */
+ mov.l #__sbss,er1
+ add.l er0,er1 /* romfs image end */
+ mov.l #__ebss,er2
+ add.l er0,er2 /* distination address */
+ adds #2,er0
+ adds #1,er0
+ shlr er0
+ shlr er0 /* transfer length */
+1:
+ mov.l @er1,er3 /* copy image */
+ mov.l er3,@er2
+ subs #4,er1
+ subs #4,er2
+ dec.l #1,er0
+ bpl 1b
+2:
+ rts
+
+ .section .rodata
+_romfs_sig:
+ .ascii "-rom1fs-"
+
+ .end
diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8300h/aki3068net/timer.c linux-2.6.0-test3-h8300/arch/h8300/platform/h8300h/aki3068net/timer.c
--- linux-2.6.0-test3/arch/h8300/platform/h8300h/aki3068net/timer.c 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8300h/aki3068net/timer.c 2003-08-22 00:42:22.000000000 +0900
@@ -25,15 +25,11 @@

#define CMFA 6

-extern int request_irq_boot(unsigned int,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long, const char *, void *);
-
void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
{
outb(H8300_TIMER_COUNT_DATA,TCORA2);
outb(0x00,_8TCSR2);
- request_irq_boot(40,timer_int,0,"timer",0);
+ request_irq(40,timer_int,0,"timer",0);
outb(0x40|0x08|0x03,_8TCR2);
}

diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8300h/entry.S linux-2.6.0-test3-h8300/arch/h8300/platform/h8300h/entry.S
--- linux-2.6.0-test3/arch/h8300/platform/h8300h/entry.S 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8300h/entry.S 2003-08-22 00:42:22.000000000 +0900
@@ -111,7 +111,7 @@
mov.l er1,@(8:16,er0)

mov.l @sp+,er1
- add.l #(LRET-LORIG),sp /* remove LORIG - LRET */
+ add.l #(LRET-LER1),sp /* remove LORIG - LRET */
mov.l sp,@SYMBOL_NAME(sw_ksp)
mov.l er0,sp
bra 8f
@@ -255,6 +255,7 @@
btst #TIF_NEED_RESCHED,r1l
bne @SYMBOL_NAME(reschedule):16
mov.l sp,er1
+ subs #4,er1 /* adjust retpc */
mov.l er2,er0
jsr @SYMBOL_NAME(do_signal)
3:
diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8300h/generic/crt0_rom.S linux-2.6.0-test3-h8300/arch/h8300/platform/h8300h/generic/crt0_rom.S
--- linux-2.6.0-test3/arch/h8300/platform/h8300h/generic/crt0_rom.S 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8300h/generic/crt0_rom.S 2003-08-22 00:42:22.000000000 +0900
@@ -44,14 +44,19 @@

/* copy .data */
#if !defined(CONFIG_H8300H_SIM)
+ /* copy .data */
mov.l #__begin_data,er5
mov.l #__sdata,er6
mov.l #__edata,er4
- sub.l er6,er4
+ sub.l er6,er4
+ shlr.l er4
+ shlr.l er4
1:
- eepmov.w
- dec.w #1,e4
- bpl 1b
+ mov.l @er5+,er0
+ mov.l er0,@er6
+ adds #4,er6
+ dec.l #1,er4
+ bne 1b
#endif

/* copy kernel commandline */
diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8300h/h8max/timer.c linux-2.6.0-test3-h8300/arch/h8300/platform/h8300h/h8max/timer.c
--- linux-2.6.0-test3/arch/h8300/platform/h8300h/h8max/timer.c 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8300h/h8max/timer.c 2003-08-22 00:42:22.000000000 +0900
@@ -25,15 +25,11 @@

#define CMFA 6

-extern int request_irq_boot(unsigned int,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long, const char *, void *);
-
void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
{
outb(H8300_TIMER_COUNT_DATA,TCORA2);
outb(0x00,_8TCSR2);
- request_irq_boot(40,timer_int,0,"timer",0);
+ request_irq(40,timer_int,0,"timer",0);
outb(0x40|0x08|0x03,_8TCR2);
}

diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8300h/ints.c linux-2.6.0-test3-h8300/arch/h8300/platform/h8300h/ints.c
--- linux-2.6.0-test3/arch/h8300/platform/h8300h/ints.c 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8300h/ints.c 2003-08-22 00:42:22.000000000 +0900
@@ -52,7 +52,8 @@
const char *devname;
} irq_handler_t;

-irq_handler_t *irq_list[NR_IRQS];
+static irq_handler_t *irq_list[NR_IRQS];
+static int use_kmalloc;

extern unsigned long *interrupt_redirect_table;

@@ -119,20 +120,6 @@
#endif
}

-void __init request_irq_boot(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- irq_handler_t *irq_handle;
- irq_handle = alloc_bootmem(sizeof(irq_handler_t));
- irq_handle->handler = handler;
- irq_handle->flags = flags;
- irq_handle->count = 0;
- irq_handle->dev_id = dev_id;
- irq_handle->devname = devname;
- irq_list[irq] = irq_handle;
-}
-
int request_irq(unsigned int irq,
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *devname, void *dev_id)
@@ -154,7 +141,14 @@
return -EBUSY;
H8300_GPIO_DDR(H8300_GPIO_P9, (irq - EXT_IRQ0), 0);
}
- irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
+
+ if (use_kmalloc)
+ irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
+ else {
+ irq_handle = alloc_bootmem(sizeof(irq_handler_t));
+ (unsigned long)irq_handle |= 0x80000000; /* bootmem allocater */
+ }
+
if (irq_handle == NULL)
return -ENOMEM;

@@ -177,8 +171,10 @@
irq, irq_list[irq]->devname);
if (irq >= EXT_IRQ0 && irq <= EXT_IRQ5)
*(volatile unsigned char *)IER &= ~(1 << (irq - EXT_IRQ0));
- kfree(irq_list[irq]);
- irq_list[irq] = NULL;
+ if ((irq_list[irq] & 0x80000000) == 0) {
+ kfree(irq_list[irq]);
+ irq_list[irq] = NULL;
+ }
}

/*
@@ -244,3 +240,9 @@
void init_irq_proc(void)
{
}
+
+static void __init enable_kmalloc(void)
+{
+ use_kmalloc = 1;
+}
+__initcall(enable_kmalloc);
diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8s/edosk2674/crt0_ram.S linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/edosk2674/crt0_ram.S
--- linux-2.6.0-test3/arch/h8300/platform/h8s/edosk2674/crt0_ram.S 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/edosk2674/crt0_ram.S 2003-08-22 00:42:22.000000000 +0900
@@ -37,7 +37,8 @@
/* CPU Reset entry */
SYMBOL_NAME_LABEL(_start)
mov.l #RAMEND,sp
- ldc #0x07,exr
+ ldc #0x80,ccr
+ ldc #0x00,exr

/* Peripheral Setup */
bclr #4,@INTCR:8 /* interrupt mode 2 */
@@ -46,7 +47,7 @@
bset #1,@ISCRL+1:16 /* IRQ0 Positive Edge */
bclr #0,@ISCRL+1:16

-#if defined(CONFIG_BLK_DEV_BLKMEM)
+#if defined(CONFIG_MTD_UCLINUX)
/* move romfs image */
jsr @__move_romfs
#endif
@@ -71,7 +72,7 @@
eepmov.w

/* uClinux kernel start */
- ldc #0x10,ccr /* running kernel */
+ ldc #0x90,ccr /* running kernel */
mov.l #SYMBOL_NAME(init_thread_union),sp
add.l #0x2000,sp
jsr @_start_kernel
diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8s/edosk2674/timer.c linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/edosk2674/timer.c
--- linux-2.6.0-test3/arch/h8300/platform/h8s/edosk2674/timer.c 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/edosk2674/timer.c 2003-08-22 00:42:22.000000000 +0900
@@ -26,10 +26,6 @@
#define REGS(regs) __REGS(regs)
#define __REGS(regs) #regs

-extern int request_irq_boot(unsigned int,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long, const char *, void *);
-
int __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
{
unsigned char mstpcrl;
@@ -38,7 +34,7 @@
outb(mstpcrl,MSTPCRL);
outb(H8300_TIMER_COUNT_DATA,_8TCORA1);
outb(0x00,_8TCSR1);
- request_irq_boot(76,timer_int,0,"timer",0);
+ request_irq(76,timer_int,0,"timer",0);
outb(0x40|0x08|0x03,_8TCR1);
return 0;
}
diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8s/entry.S linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/entry.S
--- linux-2.6.0-test3/arch/h8300/platform/h8s/entry.S 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/entry.S 2003-08-22 00:42:22.000000000 +0900
@@ -112,7 +112,7 @@
mov.l er1,@(10:16,er0)

mov.l @sp+,er1
- add.l #(LRET-LORIG),sp /* remove LORIG - LRET */
+ add.l #(LRET-LER1),sp /* remove LORIG - LRET */
mov.l sp,@SYMBOL_NAME(sw_ksp)
mov.l er0,sp
bra 8f
@@ -252,6 +252,7 @@
btst #TIF_NEED_RESCHED,r1l
bne @SYMBOL_NAME(reschedule):16
mov.l sp,er1
+ subs #4,er1 /* adjust retpc */
mov.l er2,er0
jsr @SYMBOL_NAME(do_signal)
3:
diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8s/generic/crt0_ram.S linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/generic/crt0_ram.S
--- linux-2.6.0-test3/arch/h8300/platform/h8s/generic/crt0_ram.S 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/generic/crt0_ram.S 2003-08-22 00:42:22.000000000 +0900
@@ -37,13 +37,14 @@
/* CPU Reset entry */
SYMBOL_NAME_LABEL(_start)
mov.l #RAMEND,sp
- ldc #0x07,exr
+ ldc #0x80,ccr
+ ldc #0x00,exr

/* Peripheral Setup */
bclr #4,@INTCR:8 /* interrupt mode 2 */
bset #5,@INTCR:8

-#if defined(CONFIG_BLK_DEV_BLKMEM)
+#if defined(CONFIG_MTD_UCLINUX)
/* move romfs image */
jsr @__move_romfs
#endif
@@ -68,7 +69,7 @@
eepmov.w

/* uClinux kernel start */
- ldc #0x10,ccr /* running kernel */
+ ldc #0x90,ccr /* running kernel */
mov.l #SYMBOL_NAME(init_thread_union),sp
add.l #0x2000,sp
jsr @_start_kernel
diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8s/generic/crt0_rom.S linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/generic/crt0_rom.S
--- linux-2.6.0-test3/arch/h8300/platform/h8s/generic/crt0_rom.S 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/generic/crt0_rom.S 2003-08-22 00:42:22.000000000 +0900
@@ -33,36 +33,32 @@

/* Peripheral Setup */

- /* .bss clear */
- mov.l #__sbss,er5
- mov.l er5,er6
- inc.l #1,er6
- mov.l #__ebss,er4
- sub.l er5,er4
- sub.w r0,r0
- mov.b r0l,@er5
-1:
- eepmov.w
- dec.w #1,e4
- bpl 1b
-
/* copy .data */
#if !defined(CONFIG_H8S_SIM)
mov.l #__begin_data,er5
mov.l #__sdata,er6
mov.l #__edata,er4
- sub.l er6,er4
+ sub.l er6,er4
+ shlr.l #2,er4
1:
- eepmov.w
- dec.w #1,e4
- bpl 1b
+ mov.l @er5+,er0
+ mov.l er0,@er6
+ adds #4,er6
+ dec.l #1,er4
+ bne 1b
#endif

- /* copy kernel commandline */
- mov.l #COMMAND_START,er5
- mov.l #SYMBOL_NAME(_command_line),er6
- mov.w #512,r4
- eepmov.w
+ /* .bss clear */
+ mov.l #__sbss,er5
+ mov.l #__ebss,er4
+ sub.l er5,er4
+ shlr.l #2,er4
+ sub.l er0,er0
+1:
+ mov.l er0,@er5
+ adds #4,er5
+ dec.l #1,er4
+ bne 1b

/* linux kernel start */
ldc #0x90,ccr /* running kernel */
diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8s/generic/rom.ld linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/generic/rom.ld
--- linux-2.6.0-test3/arch/h8300/platform/h8s/generic/rom.ld 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/generic/rom.ld 2003-08-22 00:42:22.000000000 +0900
@@ -6,6 +6,6 @@
vector : ORIGIN = 0x000000, LENGTH = 0x000200
rom : ORIGIN = 0x000200, LENGTH = 0x200000-0x000200
erom : ORIGIN = 0x200000, LENGTH = 0
- ram : ORIGIN = 0x200000, LENGTH = 0x200000
- eram : ORIGIN = 0x400000, LENGTH = 0
+ ram : ORIGIN = 0x200000, LENGTH = 0x400000
+ eram : ORIGIN = 0x600000, LENGTH = 0
}
diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8s/generic/timer.c linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/generic/timer.c
--- linux-2.6.0-test3/arch/h8300/platform/h8s/generic/timer.c 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/generic/timer.c 2003-08-22 00:42:22.000000000 +0900
@@ -23,15 +23,11 @@
#include <asm/irq.h>
#include <asm/regs267x.h>

-extern int request_irq_boot(unsigned int,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long, const char *, void *);
-
int platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
{
outb(H8300_TIMER_COUNT_DATA,_8TCORA1);
outb(0x00,_8TCSR1);
- request_irq_boot(76,timer_int,0,"timer",0);
+ request_irq(76,timer_int,0,"timer",0);
outb(0x40|0x08|0x03,_8TCR1);
return 0;
}
diff -Nru linux-2.6.0-test3/arch/h8300/platform/h8s/ints.c linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/ints.c
--- linux-2.6.0-test3/arch/h8300/platform/h8s/ints.c 2003-08-09 20:30:17.000000000 +0900
+++ linux-2.6.0-test3-h8300/arch/h8300/platform/h8s/ints.c 2003-08-22 00:42:22.000000000 +0900
@@ -91,6 +91,8 @@
{H8300_GPIO_P2,H8300_GPIO_B6},{H8300_GPIO_P2,H8300_GPIO_B7},
};

+static int use_kmalloc;
+
extern unsigned long *interrupt_redirect_table;

static inline unsigned long *get_vector_address(void)
@@ -159,22 +161,6 @@
#endif
}

-/* special request_irq */
-/* used bootmem allocater */
-void __init request_irq_boot(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- irq_handler_t *irq_handle;
- irq_handle = alloc_bootmem(sizeof(irq_handler_t));
- irq_handle->handler = handler;
- irq_handle->flags = flags;
- irq_handle->count = 0;
- irq_handle->dev_id = dev_id;
- irq_handle->devname = devname;
- irq_list[irq] = irq_handle;
-}
-
int request_irq(unsigned int irq,
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *devname, void *dev_id)
@@ -202,7 +188,14 @@
H8300_GPIO_DDR(port_no, bit_no, H8300_GPIO_INPUT);
*(volatile unsigned short *)ISR &= ~ptn; /* ISR clear */
}
- irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
+
+ if (use_kmalloc)
+ irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
+ else {
+ irq_handle = alloc_bootmem(sizeof(irq_handler_t));
+ (unsigned long)irq_handle |= 0x80000000; /* bootmem allocater */
+ }
+
if (irq_handle == NULL)
return -ENOMEM;

@@ -243,8 +236,10 @@
}
H8300_GPIO_FREE(port_no, bit_no);
}
- kfree(irq_list[irq]);
- irq_list[irq] = NULL;
+ if (((unsigned long)irq_list[irq] & 0x80000000) == 0) {
+ kfree(irq_list[irq]);
+ irq_list[irq] = NULL;
+ }
}

unsigned long probe_irq_on (void)
@@ -306,3 +301,10 @@
void init_irq_proc(void)
{
}
+
+static int __init enable_kmalloc(void)
+{
+ use_kmalloc = 1;
+ return 0;
+}
+__initcall(enable_kmalloc);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/