Commit 9f5a6912 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'fixes-for-linus' of git://git.monstr.eu/linux-2.6-microblaze

* 'fixes-for-linus' of git://git.monstr.eu/linux-2.6-microblaze:
  microblaze: add parameter to microblaze_read()
  microblaze: Use CFLAGS_KERNEL instead of CFLAGS
  microblaze: Add STATE_SAVE_ARG_SPACE for noMMU kernel too
  microblaze: Do not check use_dcache
  microblaze: Do not use PVR configuration for broken MB version
  microblaze: Fix USR1/2 pvr printing message
  microblaze: iowrite upon timeout
  microblaze: Correspond CONFIG...PCMP in Makefile/Kconfig
  microblaze: Remove redundant variable
  microblaze: Move start_thread to process.c
  microblaze: Add missing preadv and pwritev syscalls
  microblaze: Add missing declaration for die and _exception func
  microblaze: Remove sparse error in traps.c
  microblaze: Move task_pt_regs up
  microblaze: Rename kernel_mode to pt_mode in pt_regs
  microblaze: Remove uncache shadow condition
  microblaze: Remove while(1) loop from show_regs function
  microblaze: Remove unneded per cpu SYSCALL_SAVE variable
parents ef54b1bb f57f2fe2
...@@ -26,21 +26,19 @@ ifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY))) ...@@ -26,21 +26,19 @@ ifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY)))
endif endif
CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP) += -mxl-pattern-compare CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER)) CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
# The various CONFIG_XILINX cpu features options are integers 0/1/2... # The various CONFIG_XILINX cpu features options are integers 0/1/2...
# rather than bools y/n # rather than bools y/n
CFLAGS += $(CPUFLAGS-1)
CFLAGS += $(CPUFLAGS-2)
# r31 holds current when in kernel mode # r31 holds current when in kernel mode
CFLAGS += -ffixed-r31 CFLAGS_KERNEL += -ffixed-r31 $(CPUFLAGS-1) $(CPUFLAGS-2)
LDFLAGS_BLOB := --format binary --oformat elf32-microblaze LDFLAGS_BLOB := --format binary --oformat elf32-microblaze
LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) LIBGCC := $(shell $(CC) $(CFLAGS_KERNEL) -print-libgcc-file-name)
head-y := arch/microblaze/kernel/head.o head-y := arch/microblaze/kernel/head.o
libs-y += arch/microblaze/lib/ $(LIBGCC) libs-y += arch/microblaze/lib/ $(LIBGCC)
......
...@@ -37,9 +37,4 @@ void _invalidate_dcache(unsigned int addr); ...@@ -37,9 +37,4 @@ void _invalidate_dcache(unsigned int addr);
#define __disable_dcache() _disable_dcache() #define __disable_dcache() _disable_dcache()
#define __invalidate_dcache(addr) _invalidate_dcache(addr) #define __invalidate_dcache(addr) _invalidate_dcache(addr)
/* FIXME - I don't think this is right */
#ifdef CONFIG_XILINX_UNCACHED_SHADOW
#define UNCACHED_SHADOW_MASK (CONFIG_XILINX_ERAM_SIZE)
#endif
#endif /* _ASM_MICROBLAZE_CACHE_H */ #endif /* _ASM_MICROBLAZE_CACHE_H */
...@@ -29,7 +29,9 @@ DECLARE_PER_CPU(unsigned int, KM); /* Kernel/user mode */ ...@@ -29,7 +29,9 @@ DECLARE_PER_CPU(unsigned int, KM); /* Kernel/user mode */
DECLARE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */ DECLARE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */
DECLARE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */ DECLARE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */
DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */ DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
DECLARE_PER_CPU(unsigned int, SYSCALL_SAVE); /* Saved syscall number */
# endif /* __ASSEMBLY__ */ # endif /* __ASSEMBLY__ */
/* noMMU hasn't any space for args */
# define STATE_SAVE_ARG_SPACE (0)
#endif /* _ASM_MICROBLAZE_ENTRY_H */ #endif /* _ASM_MICROBLAZE_ENTRY_H */
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
int fsr, int addr); int fsr, int addr);
void die(const char *str, struct pt_regs *fp, long err);
void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr);
#if defined(CONFIG_XMON) #if defined(CONFIG_XMON)
extern void xmon(struct pt_regs *regs); extern void xmon(struct pt_regs *regs);
extern int xmon_bpt(struct pt_regs *regs); extern int xmon_bpt(struct pt_regs *regs);
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/registers.h> #include <asm/registers.h>
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/entry.h>
#include <asm/current.h>
# ifndef __ASSEMBLY__ # ifndef __ASSEMBLY__
/* from kernel/cpu/mb.c */ /* from kernel/cpu/mb.c */
...@@ -26,6 +28,12 @@ extern const struct seq_operations cpuinfo_op; ...@@ -26,6 +28,12 @@ extern const struct seq_operations cpuinfo_op;
# endif /* __ASSEMBLY__ */ # endif /* __ASSEMBLY__ */
#define task_pt_regs(tsk) \
(((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
/* Do necessary setup to start up a newly executed thread. */
void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp);
/* /*
* User space process size: memory size * User space process size: memory size
* *
...@@ -55,16 +63,6 @@ struct task_struct; ...@@ -55,16 +63,6 @@ struct task_struct;
struct thread_struct { }; struct thread_struct { };
# define INIT_THREAD { } # define INIT_THREAD { }
/* Do necessary setup to start up a newly executed thread. */
static inline void start_thread(struct pt_regs *regs,
unsigned long pc,
unsigned long usp)
{
regs->pc = pc;
regs->r1 = usp;
regs->kernel_mode = 0;
}
/* Free all resources held by a thread. */ /* Free all resources held by a thread. */
static inline void release_thread(struct task_struct *dead_task) static inline void release_thread(struct task_struct *dead_task)
{ {
...@@ -84,9 +82,6 @@ extern unsigned long get_wchan(struct task_struct *p); ...@@ -84,9 +82,6 @@ extern unsigned long get_wchan(struct task_struct *p);
*/ */
extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
# define task_pt_regs(tsk) \
(((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
# define KSTK_EIP(tsk) (0) # define KSTK_EIP(tsk) (0)
# define KSTK_ESP(tsk) (0) # define KSTK_ESP(tsk) (0)
......
...@@ -52,10 +52,10 @@ struct pt_regs { ...@@ -52,10 +52,10 @@ struct pt_regs {
microblaze_reg_t ear; microblaze_reg_t ear;
microblaze_reg_t esr; microblaze_reg_t esr;
microblaze_reg_t fsr; microblaze_reg_t fsr;
int kernel_mode; int pt_mode;
}; };
#define kernel_mode(regs) ((regs)->kernel_mode) #define kernel_mode(regs) ((regs)->pt_mode)
#define user_mode(regs) (!kernel_mode(regs)) #define user_mode(regs) (!kernel_mode(regs))
#define instruction_pointer(regs) ((regs)->pc) #define instruction_pointer(regs) ((regs)->pc)
......
...@@ -378,8 +378,10 @@ ...@@ -378,8 +378,10 @@
#define __NR_sendmsg 360 /* new */ #define __NR_sendmsg 360 /* new */
#define __NR_recvmsg 361 /* new */ #define __NR_recvmsg 361 /* new */
#define __NR_accept04 362 /* new */ #define __NR_accept04 362 /* new */
#define __NR_preadv 363 /* new */
#define __NR_pwritev 364 /* new */
#define __NR_syscalls 363 #define __NR_syscalls 365
#ifdef __KERNEL__ #ifdef __KERNEL__
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
...@@ -57,7 +57,7 @@ int main(int argc, char *argv[]) ...@@ -57,7 +57,7 @@ int main(int argc, char *argv[])
DEFINE(PT_R29, offsetof(struct pt_regs, r29)); DEFINE(PT_R29, offsetof(struct pt_regs, r29));
DEFINE(PT_R30, offsetof(struct pt_regs, r30)); DEFINE(PT_R30, offsetof(struct pt_regs, r30));
DEFINE(PT_R31, offsetof(struct pt_regs, r31)); DEFINE(PT_R31, offsetof(struct pt_regs, r31));
DEFINE(PT_MODE, offsetof(struct pt_regs, kernel_mode)); DEFINE(PT_MODE, offsetof(struct pt_regs, pt_mode));
BLANK(); BLANK();
/* Magic offsets for PTRACE PEEK/POKE etc */ /* Magic offsets for PTRACE PEEK/POKE etc */
......
...@@ -100,7 +100,6 @@ void _enable_dcache(void) ...@@ -100,7 +100,6 @@ void _enable_dcache(void)
void _disable_dcache(void) void _disable_dcache(void)
{ {
if (cpuinfo.use_dcache) {
#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
__asm__ __volatile__ (" \ __asm__ __volatile__ (" \
msrclr r0, %0; \ msrclr r0, %0; \
...@@ -119,12 +118,10 @@ void _disable_dcache(void) ...@@ -119,12 +118,10 @@ void _disable_dcache(void)
: "i" (MSR_DCE) \ : "i" (MSR_DCE) \
: "memory", "r12"); : "memory", "r12");
#endif #endif
}
} }
void _invalidate_dcache(unsigned int addr) void _invalidate_dcache(unsigned int addr)
{ {
if (cpuinfo.use_dcache)
__asm__ __volatile__ (" \ __asm__ __volatile__ (" \
wdc %0, r0" \ wdc %0, r0" \
: \ : \
......
...@@ -30,6 +30,13 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu) ...@@ -30,6 +30,13 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
int temp; /* for saving temp value */ int temp; /* for saving temp value */
get_pvr(&pvr); get_pvr(&pvr);
CI(ver_code, VERSION);
if (!ci->ver_code) {
printk(KERN_ERR "ERROR: MB has broken PVR regs "
"-> use DTS setting\n");
return;
}
temp = PVR_USE_BARREL(pvr) | PVR_USE_MSR_INSTR(pvr) |\ temp = PVR_USE_BARREL(pvr) | PVR_USE_MSR_INSTR(pvr) |\
PVR_USE_PCMP_INSTR(pvr) | PVR_USE_DIV(pvr); PVR_USE_PCMP_INSTR(pvr) | PVR_USE_DIV(pvr);
if (ci->use_instr != temp) if (ci->use_instr != temp)
...@@ -60,8 +67,6 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu) ...@@ -60,8 +67,6 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
CI(mmu, USE_MMU); CI(mmu, USE_MMU);
CI(ver_code, VERSION);
CI(use_icache, USE_ICACHE); CI(use_icache, USE_ICACHE);
CI(icache_tagbits, ICACHE_ADDR_TAG_BITS); CI(icache_tagbits, ICACHE_ADDR_TAG_BITS);
CI(icache_write, ICACHE_ALLOW_WR); CI(icache_write, ICACHE_ALLOW_WR);
......
...@@ -71,7 +71,7 @@ void __init setup_cpuinfo(void) ...@@ -71,7 +71,7 @@ void __init setup_cpuinfo(void)
__func__); __func__);
set_cpuinfo_static(&cpuinfo, cpu); set_cpuinfo_static(&cpuinfo, cpu);
break; break;
/* FIXME I found weird behavior with MB 7.00.a/b /* FIXME I found weird behavior with MB 7.00.a/b 7.10.a
* please do not use FULL PVR with MMU */ * please do not use FULL PVR with MMU */
case 1: case 1:
printk(KERN_INFO "%s: Using full CPU PVR support\n", printk(KERN_INFO "%s: Using full CPU PVR support\n",
......
...@@ -115,8 +115,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -115,8 +115,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
cpuinfo.hw_debug ? "yes" : "no"); cpuinfo.hw_debug ? "yes" : "no");
count += seq_printf(m, count += seq_printf(m,
"PVR-USR1:\t%x\n" "PVR-USR1:\t%02x\n"
"PVR-USR2:\t%x\n", "PVR-USR2:\t%08x\n",
cpuinfo.pvr_user1, cpuinfo.pvr_user1,
cpuinfo.pvr_user2); cpuinfo.pvr_user2);
......
...@@ -36,7 +36,7 @@ static void early_printk_putc(char c) ...@@ -36,7 +36,7 @@ static void early_printk_putc(char c)
unsigned retries = 10000; unsigned retries = 10000;
/* read status bit - 0x8 offset */ /* read status bit - 0x8 offset */
while (retries-- && (in_be32(base_addr + 8) & (1 << 3))) while (--retries && (in_be32(base_addr + 8) & (1 << 3)))
; ;
/* Only attempt the iowrite if we didn't timeout */ /* Only attempt the iowrite if we didn't timeout */
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
void show_regs(struct pt_regs *regs) void show_regs(struct pt_regs *regs)
{ {
printk(KERN_INFO " Registers dump: mode=%X\r\n", regs->kernel_mode); printk(KERN_INFO " Registers dump: mode=%X\r\n", regs->pt_mode);
printk(KERN_INFO " r1=%08lX, r2=%08lX, r3=%08lX, r4=%08lX\n", printk(KERN_INFO " r1=%08lX, r2=%08lX, r3=%08lX, r4=%08lX\n",
regs->r1, regs->r2, regs->r3, regs->r4); regs->r1, regs->r2, regs->r3, regs->r4);
printk(KERN_INFO " r5=%08lX, r6=%08lX, r7=%08lX, r8=%08lX\n", printk(KERN_INFO " r5=%08lX, r6=%08lX, r7=%08lX, r8=%08lX\n",
...@@ -37,8 +37,6 @@ void show_regs(struct pt_regs *regs) ...@@ -37,8 +37,6 @@ void show_regs(struct pt_regs *regs)
regs->r29, regs->r30, regs->r31, regs->pc); regs->r29, regs->r30, regs->r31, regs->pc);
printk(KERN_INFO " msr=%08lX, ear=%08lX, esr=%08lX, fsr=%08lX\n", printk(KERN_INFO " msr=%08lX, ear=%08lX, esr=%08lX, fsr=%08lX\n",
regs->msr, regs->ear, regs->esr, regs->fsr); regs->msr, regs->ear, regs->esr, regs->fsr);
while (1)
;
} }
void (*pm_idle)(void); void (*pm_idle)(void);
...@@ -163,7 +161,6 @@ static void kernel_thread_helper(int (*fn)(void *), void *arg) ...@@ -163,7 +161,6 @@ static void kernel_thread_helper(int (*fn)(void *), void *arg)
int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
{ {
struct pt_regs regs; struct pt_regs regs;
int ret;
memset(&regs, 0, sizeof(regs)); memset(&regs, 0, sizeof(regs));
/* store them in non-volatile registers */ /* store them in non-volatile registers */
...@@ -171,12 +168,10 @@ int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) ...@@ -171,12 +168,10 @@ int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
regs.r6 = (unsigned long)arg; regs.r6 = (unsigned long)arg;
local_save_flags(regs.msr); local_save_flags(regs.msr);
regs.pc = (unsigned long)kernel_thread_helper; regs.pc = (unsigned long)kernel_thread_helper;
regs.kernel_mode = 1; regs.pt_mode = 1;
ret = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0,
&regs, 0, NULL, NULL); &regs, 0, NULL, NULL);
return ret;
} }
unsigned long get_wchan(struct task_struct *p) unsigned long get_wchan(struct task_struct *p)
...@@ -184,3 +179,12 @@ unsigned long get_wchan(struct task_struct *p) ...@@ -184,3 +179,12 @@ unsigned long get_wchan(struct task_struct *p)
/* TBD (used by procfs) */ /* TBD (used by procfs) */
return 0; return 0;
} }
/* Set up a thread for executing a new program */
void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp)
{
set_fs(USER_DS);
regs->pc = pc;
regs->r1 = usp;
regs->pt_mode = 0;
}
...@@ -178,7 +178,9 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, int *rval_p) ...@@ -178,7 +178,9 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, int *rval_p)
asmlinkage int sys_sigreturn(struct pt_regs *regs) asmlinkage int sys_sigreturn(struct pt_regs *regs)
{ {
struct sigframe *frame = (struct sigframe *)regs->r1; struct sigframe *frame =
(struct sigframe *)(regs->r1 + STATE_SAVE_ARG_SPACE);
sigset_t set; sigset_t set;
int rval; int rval;
...@@ -209,7 +211,9 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs) ...@@ -209,7 +211,9 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
{ {
struct rt_sigframe *frame = (struct rt_sigframe *)regs->r1; struct rt_sigframe *frame =
(struct rt_sigframe *)(regs->r1 + STATE_SAVE_ARG_SPACE);
sigset_t set; sigset_t set;
stack_t st; stack_t st;
int rval; int rval;
...@@ -336,7 +340,8 @@ static void setup_frame(int sig, struct k_sigaction *ka, ...@@ -336,7 +340,8 @@ static void setup_frame(int sig, struct k_sigaction *ka,
goto give_sigsegv; goto give_sigsegv;
/* Set up registers for signal handler */ /* Set up registers for signal handler */
regs->r1 = (unsigned long) frame; regs->r1 = (unsigned long) frame - STATE_SAVE_ARG_SPACE;
/* Signal handler args: */ /* Signal handler args: */
regs->r5 = signal; /* Arg 0: signum */ regs->r5 = signal; /* Arg 0: signum */
regs->r6 = (unsigned long) &frame->sc; /* arg 1: sigcontext */ regs->r6 = (unsigned long) &frame->sc; /* arg 1: sigcontext */
...@@ -414,7 +419,8 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -414,7 +419,8 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
goto give_sigsegv; goto give_sigsegv;
/* Set up registers for signal handler */ /* Set up registers for signal handler */
regs->r1 = (unsigned long) frame; regs->r1 = (unsigned long) frame - STATE_SAVE_ARG_SPACE;
/* Signal handler args: */ /* Signal handler args: */
regs->r5 = signal; /* arg 0: signum */ regs->r5 = signal; /* arg 0: signum */
regs->r6 = (unsigned long) &frame->info; /* arg 1: siginfo */ regs->r6 = (unsigned long) &frame->info; /* arg 1: siginfo */
......
...@@ -363,3 +363,5 @@ ENTRY(sys_call_table) ...@@ -363,3 +363,5 @@ ENTRY(sys_call_table)
.long sys_sendmsg /* 360 */ .long sys_sendmsg /* 360 */
.long sys_recvmsg .long sys_recvmsg
.long sys_ni_syscall .long sys_ni_syscall
.long sys_ni_syscall
.long sys_ni_syscall
...@@ -176,7 +176,7 @@ static __init void microblaze_clockevent_init(void) ...@@ -176,7 +176,7 @@ static __init void microblaze_clockevent_init(void)
clockevents_register_device(&clockevent_microblaze_timer); clockevents_register_device(&clockevent_microblaze_timer);
} }
static cycle_t microblaze_read(void) static cycle_t microblaze_read(struct clocksource *cs)
{ {
/* reading actual value of timer 1 */ /* reading actual value of timer 1 */
return (cycle_t) (in_be32(TIMER_BASE + TCR1)); return (cycle_t) (in_be32(TIMER_BASE + TCR1));
......
...@@ -34,7 +34,7 @@ static int kstack_depth_to_print = 24; ...@@ -34,7 +34,7 @@ static int kstack_depth_to_print = 24;
static int __init kstack_setup(char *s) static int __init kstack_setup(char *s)
{ {
kstack_depth_to_print = strict_strtoul(s, 0, 0); kstack_depth_to_print = strict_strtoul(s, 0, NULL);
return 1; return 1;
} }
......
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