Commit 7cf32cad authored by Mikael Starvik's avatar Mikael Starvik Committed by Linus Torvalds

[PATCH] CRIS update: misc patches

* Start threads with IRQs enabled.
* Move symbol exports to arch specific file.
* Prepare for real command line in the future.
* Handle csum for partition that crosses flash boundary.
* Set utsname.
Signed-off-by: default avatarMikael Starvik <starvik@axis.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2e0cea1d
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
#include <asm/arch/sv_addr_ag.h> #include <asm/arch/sv_addr_ag.h>
#define RAM_INIT_MAGIC 0x56902387 #define RAM_INIT_MAGIC 0x56902387
#define COMMAND_LINE_MAGIC 0x87109563
;; Exported symbols ;; Exported symbols
.globl _input_data .globl _input_data
...@@ -88,6 +89,12 @@ basse: move.d pc, r5 ...@@ -88,6 +89,12 @@ basse: move.d pc, r5
cmp.d r2, r1 cmp.d r2, r1
bcs 1b bcs 1b
nop nop
;; Save command line magic and address.
move.d _cmd_line_magic, $r12
move.d $r10, [$r12]
move.d _cmd_line_addr, $r12
move.d $r11, [$r12]
;; Do the decompression and save compressed size in _inptr ;; Do the decompression and save compressed size in _inptr
...@@ -98,7 +105,13 @@ basse: move.d pc, r5 ...@@ -98,7 +105,13 @@ basse: move.d pc, r5
move.d [_input_data], r9 ; flash address of compressed kernel move.d [_input_data], r9 ; flash address of compressed kernel
add.d [_inptr], r9 ; size of compressed kernel add.d [_inptr], r9 ; size of compressed kernel
;; Restore command line magic and address.
move.d _cmd_line_magic, $r10
move.d [$r10], $r10
move.d _cmd_line_addr, $r11
move.d [$r11], $r11
;; Enter the decompressed kernel ;; Enter the decompressed kernel
move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized
jump 0x40004000 ; kernel is linked to this address jump 0x40004000 ; kernel is linked to this address
...@@ -107,5 +120,8 @@ basse: move.d pc, r5 ...@@ -107,5 +120,8 @@ basse: move.d pc, r5
_input_data: _input_data:
.dword 0 ; used by the decompressor .dword 0 ; used by the decompressor
_cmd_line_magic:
.dword 0
_cmd_line_addr:
.dword 0
#include "../../lib/hw_settings.S" #include "../../lib/hw_settings.S"
/* $Id: head.S,v 1.6 2003/04/09 08:12:43 pkj Exp $ /* $Id: head.S,v 1.7 2005/03/07 12:11:06 starvik Exp $
* *
* Rescue code, made to reside at the beginning of the * Rescue code, made to reside at the beginning of the
* flash-memory. when it starts, it checks a partition * flash-memory. when it starts, it checks a partition
...@@ -121,12 +121,13 @@ ...@@ -121,12 +121,13 @@
;; 0x80000000 if loaded in flash (as it should be) ;; 0x80000000 if loaded in flash (as it should be)
;; since etrax actually starts at address 2 when booting from flash, we ;; since etrax actually starts at address 2 when booting from flash, we
;; put a nop (2 bytes) here first so we dont accidentally skip the di ;; put a nop (2 bytes) here first so we dont accidentally skip the di
nop nop
di di
jump in_cache ; enter cached area instead jump in_cache ; enter cached area instead
in_cache: in_cache:
;; first put a jump test to give a possibility of upgrading the rescue code ;; first put a jump test to give a possibility of upgrading the rescue code
;; without erasing/reflashing the sector. we put a longword of -1 here and if ;; without erasing/reflashing the sector. we put a longword of -1 here and if
...@@ -325,9 +326,29 @@ flash_ok: ...@@ -325,9 +326,29 @@ flash_ok:
;; result will be in r0 ;; result will be in r0
checksum: checksum:
moveq 0, $r0 moveq 0, $r0
1: addu.b [$r1+], $r0 moveq CONFIG_ETRAX_FLASH1_SIZE, $r6
subq 1, $r2
bne 1b ;; If the first physical flash memory is exceeded wrap to the second one.
btstq 26, $r1 ; Are we addressing first flash?
bpl 1f
nop
clear.d $r6
1: test.d $r6 ; 0 = no wrapping
beq 2f
nop
lslq 20, $r6 ; Convert MB to bytes
sub.d $r1, $r6
2: addu.b [$r1+], $r0
subq 1, $r6 ; Flash memory left
beq 3f
subq 1, $r2 ; Length left
bne 2b
nop nop
ret ret
nop nop
3: move.d MEM_CSE1_START, $r1 ; wrap to second flash
ba 2b
nop
/* $Id: entry.S,v 1.23 2004/10/19 13:07:37 starvik Exp $ /* $Id: entry.S,v 1.28 2005/06/20 05:06:30 starvik Exp $
* *
* linux/arch/cris/entry.S * linux/arch/cris/entry.S
* *
...@@ -7,6 +7,22 @@ ...@@ -7,6 +7,22 @@
* Authors: Bjorn Wesen (bjornw@axis.com) * Authors: Bjorn Wesen (bjornw@axis.com)
* *
* $Log: entry.S,v $ * $Log: entry.S,v $
* Revision 1.28 2005/06/20 05:06:30 starvik
* Remove unnecessary diff to kernel.org tree
*
* Revision 1.27 2005/03/04 08:16:16 starvik
* Merge of Linux 2.6.11.
*
* Revision 1.26 2005/01/11 13:49:47 starvik
* Added NMI handler.
*
* Revision 1.25 2004/12/27 11:18:32 starvik
* Merge of Linux 2.6.10 (not functional yet).
*
* Revision 1.24 2004/12/22 10:41:23 starvik
* Updates to make v10 compile with the latest SMP aware generic code (even
* though v10 will never have SMP).
*
* Revision 1.23 2004/10/19 13:07:37 starvik * Revision 1.23 2004/10/19 13:07:37 starvik
* Merge of Linux 2.6.9 * Merge of Linux 2.6.9
* *
...@@ -279,6 +295,7 @@ ...@@ -279,6 +295,7 @@
#ifdef CONFIG_PREEMPT #ifdef CONFIG_PREEMPT
; Check if preemptive kernel scheduling should be done ; Check if preemptive kernel scheduling should be done
_resume_kernel: _resume_kernel:
di
; Load current task struct ; Load current task struct
movs.w -8192, $r0 ; THREAD_SIZE = 8192 movs.w -8192, $r0 ; THREAD_SIZE = 8192
and.d $sp, $r0 and.d $sp, $r0
...@@ -291,12 +308,7 @@ _need_resched: ...@@ -291,12 +308,7 @@ _need_resched:
bpl _Rexit bpl _Rexit
nop nop
; Ok, lets's do some preemptive kernel scheduling ; Ok, lets's do some preemptive kernel scheduling
move.d PREEMPT_ACTIVE, $r10 jsr preempt_schedule_irq
move.d $r10, [$r0+TI_preempt_count] ; Mark as active
ei
jsr schedule
clear.d [$r0+TI_preempt_count] ; Mark as inactive
di
; Load new task struct ; Load new task struct
movs.w -8192, $r0 ; THREAD_SIZE = 8192 movs.w -8192, $r0 ; THREAD_SIZE = 8192
and.d $sp, $r0 and.d $sp, $r0
...@@ -590,15 +602,15 @@ mmu_bus_fault: ...@@ -590,15 +602,15 @@ mmu_bus_fault:
move.d $r0, [$sp+16] move.d $r0, [$sp+16]
1: btstq 12, $r1 ; Refill? 1: btstq 12, $r1 ; Refill?
bpl 2f bpl 2f
lsrq PMD_SHIFT, $r1 ; Get PMD index into PGD (bit 24-31) lsrq 24, $r1 ; Get PGD index (bit 24-31)
move.d [current_pgd], $r0 ; PGD for the current process move.d [per_cpu__current_pgd], $r0 ; PGD for the current process
move.d [$r0+$r1.d], $r0 ; Get PMD move.d [$r0+$r1.d], $r0 ; Get PMD
beq 2f beq 2f
nop nop
and.w PAGE_MASK, $r0 ; Remove PMD flags and.w PAGE_MASK, $r0 ; Remove PMD flags
move.d [R_MMU_CAUSE], $r1 move.d [R_MMU_CAUSE], $r1
lsrq PAGE_SHIFT, $r1 lsrq PAGE_SHIFT, $r1
and.d 0x7ff, $r1 ; Get PTE index into PMD (bit 13-24) and.d 0x7ff, $r1 ; Get PTE index into PGD (bit 13-23)
move.d [$r0+$r1.d], $r1 ; Get PTE move.d [$r0+$r1.d], $r1 ; Get PTE
beq 2f beq 2f
nop nop
...@@ -656,11 +668,6 @@ hwbreakpoint: ...@@ -656,11 +668,6 @@ hwbreakpoint:
nop nop
IRQ1_interrupt: IRQ1_interrupt:
#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
;; If we receive a watchdog interrupt while it is not expected, then set
;; up a canonical frame and dump register contents before dying.
;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!! ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!
move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
push $srp push $srp
...@@ -672,9 +679,16 @@ IRQ1_interrupt: ...@@ -672,9 +679,16 @@ IRQ1_interrupt:
push $r10 ; push orig_r10 push $r10 ; push orig_r10
clear.d [$sp=$sp-4] ; frametype == 0, normal frame clear.d [$sp=$sp-4] ; frametype == 0, normal frame
;; We don't check that we actually were bit by the watchdog as opposed to move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog?
;; an external NMI, since there is currently no handler for external NMI. and.d 0x80000000, $r1
beq wdog
move.d $sp, $r10
jsr handle_nmi
setf m ; Enable NMI again
retb ; Return from NMI
nop
wdog:
#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
;; Check if we're waiting for reset to happen, as signalled by ;; Check if we're waiting for reset to happen, as signalled by
;; hard_reset_now setting cause_of_death to a magic value. If so, just ;; hard_reset_now setting cause_of_death to a magic value. If so, just
;; get stuck until reset happens. ;; get stuck until reset happens.
...@@ -1118,6 +1132,10 @@ sys_call_table: ...@@ -1118,6 +1132,10 @@ sys_call_table:
.long sys_mq_getsetattr .long sys_mq_getsetattr
.long sys_ni_syscall /* reserved for kexec */ .long sys_ni_syscall /* reserved for kexec */
.long sys_waitid .long sys_waitid
.long sys_ni_syscall /* 285 */ /* available */
.long sys_add_key
.long sys_request_key
.long sys_keyctl
/* /*
* NOTE!! This doesn't have to be exact - we just have * NOTE!! This doesn't have to be exact - we just have
......
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
*! Jul 21 1999 Bjorn Wesen eLinux port *! Jul 21 1999 Bjorn Wesen eLinux port
*! *!
*! $Log: kgdb.c,v $ *! $Log: kgdb.c,v $
*! Revision 1.6 2005/01/14 10:12:17 starvik
*! KGDB on separate port.
*! Console fixes from 2.4.
*!
*! Revision 1.5 2004/10/07 13:59:08 starvik *! Revision 1.5 2004/10/07 13:59:08 starvik
*! Corrected call to set_int_vector *! Corrected call to set_int_vector
*! *!
...@@ -71,7 +75,7 @@ ...@@ -71,7 +75,7 @@
*! *!
*!--------------------------------------------------------------------------- *!---------------------------------------------------------------------------
*! *!
*! $Id: kgdb.c,v 1.5 2004/10/07 13:59:08 starvik Exp $ *! $Id: kgdb.c,v 1.6 2005/01/14 10:12:17 starvik Exp $
*! *!
*! (C) Copyright 1999, Axis Communications AB, LUND, SWEDEN *! (C) Copyright 1999, Axis Communications AB, LUND, SWEDEN
*! *!
...@@ -225,6 +229,7 @@ ...@@ -225,6 +229,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/reboot.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
...@@ -1344,12 +1349,11 @@ handle_exception (int sigval) ...@@ -1344,12 +1349,11 @@ handle_exception (int sigval)
} }
} }
/* The jump is to the address 0x00000002. Performs a complete re-start /* Performs a complete re-start from scratch. */
from scratch. */
static void static void
kill_restart () kill_restart ()
{ {
__asm__ volatile ("jump 2"); machine_restart("");
} }
/********************************** Breakpoint *******************************/ /********************************** Breakpoint *******************************/
...@@ -1506,6 +1510,11 @@ asm (" ...@@ -1506,6 +1510,11 @@ asm ("
bne goback bne goback
nop nop
move.d [reg+0x5E], $r10 ; Get DCCR
btstq 8, $r10 ; Test the U-flag.
bmi goback
nop
;; ;;
;; Handle the communication ;; Handle the communication
;; ;;
......
/* $Id: process.c,v 1.9 2004/10/19 13:07:37 starvik Exp $ /* $Id: process.c,v 1.12 2004/12/27 11:18:32 starvik Exp $
* *
* linux/arch/cris/kernel/process.c * linux/arch/cris/kernel/process.c
* *
...@@ -101,6 +101,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) ...@@ -101,6 +101,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
regs.r11 = (unsigned long)fn; regs.r11 = (unsigned long)fn;
regs.r12 = (unsigned long)arg; regs.r12 = (unsigned long)arg;
regs.irp = (unsigned long)kernel_thread_helper; regs.irp = (unsigned long)kernel_thread_helper;
regs.dccr = 1 << I_DCCR_BITNR;
/* Ok, create the new process.. */ /* Ok, create the new process.. */
return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL); return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
......
...@@ -27,13 +27,13 @@ extern void __Udiv(void); ...@@ -27,13 +27,13 @@ extern void __Udiv(void);
extern void __Umod(void); extern void __Umod(void);
extern void __Div(void); extern void __Div(void);
extern void __Mod(void); extern void __Mod(void);
extern void __ashldi3(void);
extern void __ashrdi3(void); extern void __ashrdi3(void);
extern void iounmap(void *addr); extern void __lshrdi3(void);
extern void iounmap(volatile void * __iomem);
/* Platform dependent support */ /* Platform dependent support */
EXPORT_SYMBOL(dump_thread); EXPORT_SYMBOL(dump_thread);
EXPORT_SYMBOL(enable_irq);
EXPORT_SYMBOL(disable_irq);
EXPORT_SYMBOL(kernel_thread); EXPORT_SYMBOL(kernel_thread);
EXPORT_SYMBOL(get_cmos_time); EXPORT_SYMBOL(get_cmos_time);
EXPORT_SYMBOL(loops_per_usec); EXPORT_SYMBOL(loops_per_usec);
...@@ -57,7 +57,9 @@ EXPORT_SYMBOL(__Udiv); ...@@ -57,7 +57,9 @@ EXPORT_SYMBOL(__Udiv);
EXPORT_SYMBOL(__Umod); EXPORT_SYMBOL(__Umod);
EXPORT_SYMBOL(__Div); EXPORT_SYMBOL(__Div);
EXPORT_SYMBOL(__Mod); EXPORT_SYMBOL(__Mod);
EXPORT_SYMBOL(__ashldi3);
EXPORT_SYMBOL(__ashrdi3); EXPORT_SYMBOL(__ashrdi3);
EXPORT_SYMBOL(__lshrdi3);
/* Memory functions */ /* Memory functions */
EXPORT_SYMBOL(__ioremap); EXPORT_SYMBOL(__ioremap);
...@@ -69,23 +71,10 @@ EXPORT_SYMBOL(__down); ...@@ -69,23 +71,10 @@ EXPORT_SYMBOL(__down);
EXPORT_SYMBOL(__down_interruptible); EXPORT_SYMBOL(__down_interruptible);
EXPORT_SYMBOL(__down_trylock); EXPORT_SYMBOL(__down_trylock);
/* Export shadow registers for the CPU I/O pins */
EXPORT_SYMBOL(genconfig_shadow);
EXPORT_SYMBOL(port_pa_data_shadow);
EXPORT_SYMBOL(port_pa_dir_shadow);
EXPORT_SYMBOL(port_pb_data_shadow);
EXPORT_SYMBOL(port_pb_dir_shadow);
EXPORT_SYMBOL(port_pb_config_shadow);
EXPORT_SYMBOL(port_g_data_shadow);
/* Userspace access functions */ /* Userspace access functions */
EXPORT_SYMBOL(__copy_user_zeroing); EXPORT_SYMBOL(__copy_user_zeroing);
EXPORT_SYMBOL(__copy_user); EXPORT_SYMBOL(__copy_user);
/* Cache flush functions */
EXPORT_SYMBOL(flush_etrax_cache);
EXPORT_SYMBOL(prepare_rx_descriptor);
#undef memcpy #undef memcpy
#undef memset #undef memset
extern void * memset(void *, int, __kernel_size_t); extern void * memset(void *, int, __kernel_size_t);
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/utsname.h>
#include <asm/setup.h> #include <asm/setup.h>
...@@ -29,7 +30,7 @@ struct screen_info screen_info; ...@@ -29,7 +30,7 @@ struct screen_info screen_info;
extern int root_mountflags; extern int root_mountflags;
extern char _etext, _edata, _end; extern char _etext, _edata, _end;
static char command_line[COMMAND_LINE_SIZE] = { 0, }; char cris_command_line[COMMAND_LINE_SIZE] = { 0, };
extern const unsigned long text_start, edata; /* set by the linker script */ extern const unsigned long text_start, edata; /* set by the linker script */
extern unsigned long dram_start, dram_end; extern unsigned long dram_start, dram_end;
...@@ -147,34 +148,35 @@ setup_arch(char **cmdline_p) ...@@ -147,34 +148,35 @@ setup_arch(char **cmdline_p)
paging_init(); paging_init();
/* We don't use a command line yet, so just re-initialize it without *cmdline_p = cris_command_line;
saving anything that might be there. */
*cmdline_p = command_line;
#ifdef CONFIG_ETRAX_CMDLINE #ifdef CONFIG_ETRAX_CMDLINE
strlcpy(command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE); if (!strcmp(cris_command_line, "")) {
command_line[COMMAND_LINE_SIZE - 1] = '\0'; strlcpy(cris_command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE);
cris_command_line[COMMAND_LINE_SIZE - 1] = '\0';
}
#endif
/* Save command line for future references. */ /* Save command line for future references. */
memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); memcpy(saved_command_line, cris_command_line, COMMAND_LINE_SIZE);
saved_command_line[COMMAND_LINE_SIZE - 1] = '\0'; saved_command_line[COMMAND_LINE_SIZE - 1] = '\0';
#endif
/* give credit for the CRIS port */ /* give credit for the CRIS port */
show_etrax_copyright(); show_etrax_copyright();
/* Setup utsname */
strcpy(system_utsname.machine, cris_machine_name);
} }
static void *c_start(struct seq_file *m, loff_t *pos) static void *c_start(struct seq_file *m, loff_t *pos)
{ {
/* We only got one CPU... */ return *pos < NR_CPUS ? (void *)(int)(*pos + 1): NULL;
return *pos < 1 ? (void *)1 : NULL;
} }
static void *c_next(struct seq_file *m, void *v, loff_t *pos) static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{ {
++*pos; ++*pos;
return NULL; return c_start(m, pos);
} }
static void c_stop(struct seq_file *m, void *v) static void c_stop(struct seq_file *m, void *v)
......
...@@ -11,6 +11,8 @@ extern inline unsigned long rdvr(void) { ...@@ -11,6 +11,8 @@ extern inline unsigned long rdvr(void) {
return vr; return vr;
} }
#define cris_machine_name "cris"
/* read/write the user-mode stackpointer */ /* read/write the user-mode stackpointer */
extern inline unsigned long rdusp(void) { extern inline unsigned long rdusp(void) {
......
...@@ -40,4 +40,7 @@ struct partitiontable_entry { ...@@ -40,4 +40,7 @@ struct partitiontable_entry {
#define PARTITION_TYPE_KERNEL 0x0002 #define PARTITION_TYPE_KERNEL 0x0002
#define PARTITION_TYPE_JFFS 0x0003 #define PARTITION_TYPE_JFFS 0x0003
/* The master mtd for the entire flash. */
extern struct mtd_info* axisflash_mtd;
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment