diff options
Diffstat (limited to 'arch/mips/kernel')
| -rw-r--r-- | arch/mips/kernel/Makefile | 2 | ||||
| -rw-r--r-- | arch/mips/kernel/cpufreq/Kconfig | 41 | ||||
| -rw-r--r-- | arch/mips/kernel/cpufreq/Makefile | 5 | ||||
| -rw-r--r-- | arch/mips/kernel/cpufreq/loongson2_cpufreq.c | 255 | ||||
| -rw-r--r-- | arch/mips/kernel/early_printk.c | 12 | ||||
| -rw-r--r-- | arch/mips/kernel/linux32.c | 119 | ||||
| -rw-r--r-- | arch/mips/kernel/process.c | 48 | ||||
| -rw-r--r-- | arch/mips/kernel/scall64-n32.S | 8 | ||||
| -rw-r--r-- | arch/mips/kernel/scall64-o32.S | 6 | ||||
| -rw-r--r-- | arch/mips/kernel/smp.c | 2 | ||||
| -rw-r--r-- | arch/mips/kernel/traps.c | 15 | 
11 files changed, 30 insertions, 483 deletions
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index de75fb50562..520a908d45d 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile @@ -92,8 +92,6 @@ CFLAGS_cpu-bugs64.o	= $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/n  obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT)	+= 8250-platform.o -obj-$(CONFIG_MIPS_CPUFREQ)	+= cpufreq/ -  obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o  obj-$(CONFIG_HW_PERF_EVENTS)	+= perf_event_mipsxx.o diff --git a/arch/mips/kernel/cpufreq/Kconfig b/arch/mips/kernel/cpufreq/Kconfig deleted file mode 100644 index 58c601eee6f..00000000000 --- a/arch/mips/kernel/cpufreq/Kconfig +++ /dev/null @@ -1,41 +0,0 @@ -# -# CPU Frequency scaling -# - -config MIPS_EXTERNAL_TIMER -	bool - -config MIPS_CPUFREQ -	bool -	default y -	depends on CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER - -if MIPS_CPUFREQ - -menu "CPU Frequency scaling" - -source "drivers/cpufreq/Kconfig" - -if CPU_FREQ - -comment "CPUFreq processor drivers" - -config LOONGSON2_CPUFREQ -	tristate "Loongson2 CPUFreq Driver" -	select CPU_FREQ_TABLE -	depends on MIPS_CPUFREQ -	help -	  This option adds a CPUFreq driver for loongson processors which -	  support software configurable cpu frequency. - -	  Loongson2F and it's successors support this feature. - -	  For details, take a look at <file:Documentation/cpu-freq/>. - -	  If in doubt, say N. - -endif	# CPU_FREQ - -endmenu - -endif	# MIPS_CPUFREQ diff --git a/arch/mips/kernel/cpufreq/Makefile b/arch/mips/kernel/cpufreq/Makefile deleted file mode 100644 index 05a5715ee38..00000000000 --- a/arch/mips/kernel/cpufreq/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# -# Makefile for the Linux/MIPS cpufreq. -# - -obj-$(CONFIG_LOONGSON2_CPUFREQ) += loongson2_cpufreq.o diff --git a/arch/mips/kernel/cpufreq/loongson2_cpufreq.c b/arch/mips/kernel/cpufreq/loongson2_cpufreq.c deleted file mode 100644 index 3237c5235f9..00000000000 --- a/arch/mips/kernel/cpufreq/loongson2_cpufreq.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Cpufreq driver for the loongson-2 processors - * - * The 2E revision of loongson processor not support this feature. - * - * Copyright (C) 2006 - 2008 Lemote Inc. & Insititute of Computing Technology - * Author: Yanhua, yanh@lemote.com - * - * 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. - */ -#include <linux/cpufreq.h> -#include <linux/module.h> -#include <linux/err.h> -#include <linux/sched.h>	/* set_cpus_allowed() */ -#include <linux/delay.h> -#include <linux/platform_device.h> - -#include <asm/clock.h> - -#include <asm/mach-loongson/loongson.h> - -static uint nowait; - -static struct clk *cpuclk; - -static void (*saved_cpu_wait) (void); - -static int loongson2_cpu_freq_notifier(struct notifier_block *nb, -					unsigned long val, void *data); - -static struct notifier_block loongson2_cpufreq_notifier_block = { -	.notifier_call = loongson2_cpu_freq_notifier -}; - -static int loongson2_cpu_freq_notifier(struct notifier_block *nb, -					unsigned long val, void *data) -{ -	if (val == CPUFREQ_POSTCHANGE) -		current_cpu_data.udelay_val = loops_per_jiffy; - -	return 0; -} - -static unsigned int loongson2_cpufreq_get(unsigned int cpu) -{ -	return clk_get_rate(cpuclk); -} - -/* - * Here we notify other drivers of the proposed change and the final change. - */ -static int loongson2_cpufreq_target(struct cpufreq_policy *policy, -				     unsigned int target_freq, -				     unsigned int relation) -{ -	unsigned int cpu = policy->cpu; -	unsigned int newstate = 0; -	cpumask_t cpus_allowed; -	struct cpufreq_freqs freqs; -	unsigned int freq; - -	if (!cpu_online(cpu)) -		return -ENODEV; - -	cpus_allowed = current->cpus_allowed; -	set_cpus_allowed_ptr(current, cpumask_of(cpu)); - -	if (cpufreq_frequency_table_target -	    (policy, &loongson2_clockmod_table[0], target_freq, relation, -	     &newstate)) -		return -EINVAL; - -	freq = -	    ((cpu_clock_freq / 1000) * -	     loongson2_clockmod_table[newstate].index) / 8; -	if (freq < policy->min || freq > policy->max) -		return -EINVAL; - -	pr_debug("cpufreq: requested frequency %u Hz\n", target_freq * 1000); - -	freqs.cpu = cpu; -	freqs.old = loongson2_cpufreq_get(cpu); -	freqs.new = freq; -	freqs.flags = 0; - -	if (freqs.new == freqs.old) -		return 0; - -	/* notifiers */ -	cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); - -	set_cpus_allowed_ptr(current, &cpus_allowed); - -	/* setting the cpu frequency */ -	clk_set_rate(cpuclk, freq); - -	/* notifiers */ -	cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); - -	pr_debug("cpufreq: set frequency %u kHz\n", freq); - -	return 0; -} - -static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) -{ -	int i; -	unsigned long rate; -	int ret; - -	if (!cpu_online(policy->cpu)) -		return -ENODEV; - -	cpuclk = clk_get(NULL, "cpu_clk"); -	if (IS_ERR(cpuclk)) { -		printk(KERN_ERR "cpufreq: couldn't get CPU clk\n"); -		return PTR_ERR(cpuclk); -	} - -	rate = cpu_clock_freq / 1000; -	if (!rate) { -		clk_put(cpuclk); -		return -EINVAL; -	} -	ret = clk_set_rate(cpuclk, rate); -	if (ret) { -		clk_put(cpuclk); -		return ret; -	} - -	/* clock table init */ -	for (i = 2; -	     (loongson2_clockmod_table[i].frequency != CPUFREQ_TABLE_END); -	     i++) -		loongson2_clockmod_table[i].frequency = (rate * i) / 8; - -	policy->cur = loongson2_cpufreq_get(policy->cpu); - -	cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0], -					 policy->cpu); - -	return cpufreq_frequency_table_cpuinfo(policy, -					    &loongson2_clockmod_table[0]); -} - -static int loongson2_cpufreq_verify(struct cpufreq_policy *policy) -{ -	return cpufreq_frequency_table_verify(policy, -					      &loongson2_clockmod_table[0]); -} - -static int loongson2_cpufreq_exit(struct cpufreq_policy *policy) -{ -	clk_put(cpuclk); -	return 0; -} - -static struct freq_attr *loongson2_table_attr[] = { -	&cpufreq_freq_attr_scaling_available_freqs, -	NULL, -}; - -static struct cpufreq_driver loongson2_cpufreq_driver = { -	.owner = THIS_MODULE, -	.name = "loongson2", -	.init = loongson2_cpufreq_cpu_init, -	.verify = loongson2_cpufreq_verify, -	.target = loongson2_cpufreq_target, -	.get = loongson2_cpufreq_get, -	.exit = loongson2_cpufreq_exit, -	.attr = loongson2_table_attr, -}; - -static struct platform_device_id platform_device_ids[] = { -	{ -		.name = "loongson2_cpufreq", -	}, -	{} -}; - -MODULE_DEVICE_TABLE(platform, platform_device_ids); - -static struct platform_driver platform_driver = { -	.driver = { -		.name = "loongson2_cpufreq", -		.owner = THIS_MODULE, -	}, -	.id_table = platform_device_ids, -}; - -/* - * This is the simple version of Loongson-2 wait, Maybe we need do this in - * interrupt disabled context. - */ - -static DEFINE_SPINLOCK(loongson2_wait_lock); - -static void loongson2_cpu_wait(void) -{ -	unsigned long flags; -	u32 cpu_freq; - -	spin_lock_irqsave(&loongson2_wait_lock, flags); -	cpu_freq = LOONGSON_CHIPCFG0; -	LOONGSON_CHIPCFG0 &= ~0x7;	/* Put CPU into wait mode */ -	LOONGSON_CHIPCFG0 = cpu_freq;	/* Restore CPU state */ -	spin_unlock_irqrestore(&loongson2_wait_lock, flags); -} - -static int __init cpufreq_init(void) -{ -	int ret; - -	/* Register platform stuff */ -	ret = platform_driver_register(&platform_driver); -	if (ret) -		return ret; - -	pr_info("cpufreq: Loongson-2F CPU frequency driver.\n"); - -	cpufreq_register_notifier(&loongson2_cpufreq_notifier_block, -				  CPUFREQ_TRANSITION_NOTIFIER); - -	ret = cpufreq_register_driver(&loongson2_cpufreq_driver); - -	if (!ret && !nowait) { -		saved_cpu_wait = cpu_wait; -		cpu_wait = loongson2_cpu_wait; -	} - -	return ret; -} - -static void __exit cpufreq_exit(void) -{ -	if (!nowait && saved_cpu_wait) -		cpu_wait = saved_cpu_wait; -	cpufreq_unregister_driver(&loongson2_cpufreq_driver); -	cpufreq_unregister_notifier(&loongson2_cpufreq_notifier_block, -				    CPUFREQ_TRANSITION_NOTIFIER); - -	platform_driver_unregister(&platform_driver); -} - -module_init(cpufreq_init); -module_exit(cpufreq_exit); - -module_param(nowait, uint, 0644); -MODULE_PARM_DESC(nowait, "Disable Loongson-2F specific wait"); - -MODULE_AUTHOR("Yanhua <yanh@lemote.com>"); -MODULE_DESCRIPTION("cpufreq driver for Loongson2F"); -MODULE_LICENSE("GPL"); diff --git a/arch/mips/kernel/early_printk.c b/arch/mips/kernel/early_printk.c index 9e6440eaa45..505cb77d128 100644 --- a/arch/mips/kernel/early_printk.c +++ b/arch/mips/kernel/early_printk.c @@ -7,7 +7,9 @@   * Copyright (C) 2007 MIPS Technologies, Inc.   *   written by Ralf Baechle (ralf@linux-mips.org)   */ +#include <linux/kernel.h>  #include <linux/console.h> +#include <linux/printk.h>  #include <linux/init.h>  #include <asm/setup.h> @@ -24,20 +26,18 @@ static void early_console_write(struct console *con, const char *s, unsigned n)  	}  } -static struct console early_console = { +static struct console early_console_prom = {  	.name	= "early",  	.write	= early_console_write,  	.flags	= CON_PRINTBUFFER | CON_BOOT,  	.index	= -1  }; -static int early_console_initialized __initdata; -  void __init setup_early_printk(void)  { -	if (early_console_initialized) +	if (early_console)  		return; -	early_console_initialized = 1; +	early_console = &early_console_prom; -	register_console(&early_console); +	register_console(&early_console_prom);  } diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index db9655f0889..d1d576b765f 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c @@ -119,99 +119,6 @@ SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf,  	return sys_pwrite64(fd, buf, count, merge_64(a4, a5));  } -#ifdef CONFIG_SYSVIPC - -SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third, -	unsigned long, ptr, unsigned long, fifth) -{ -	int version, err; - -	version = call >> 16; /* hack for backward compatibility */ -	call &= 0xffff; - -	switch (call) { -	case SEMOP: -		/* struct sembuf is the same on 32 and 64bit :)) */ -		err = sys_semtimedop(first, compat_ptr(ptr), second, NULL); -		break; -	case SEMTIMEDOP: -		err = compat_sys_semtimedop(first, compat_ptr(ptr), second, -					    compat_ptr(fifth)); -		break; -	case SEMGET: -		err = sys_semget(first, second, third); -		break; -	case SEMCTL: -		err = compat_sys_semctl(first, second, third, compat_ptr(ptr)); -		break; -	case MSGSND: -		err = compat_sys_msgsnd(first, second, third, compat_ptr(ptr)); -		break; -	case MSGRCV: -		err = compat_sys_msgrcv(first, second, fifth, third, -					version, compat_ptr(ptr)); -		break; -	case MSGGET: -		err = sys_msgget((key_t) first, second); -		break; -	case MSGCTL: -		err = compat_sys_msgctl(first, second, compat_ptr(ptr)); -		break; -	case SHMAT: -		err = compat_sys_shmat(first, second, third, version, -				       compat_ptr(ptr)); -		break; -	case SHMDT: -		err = sys_shmdt(compat_ptr(ptr)); -		break; -	case SHMGET: -		err = sys_shmget(first, (unsigned)second, third); -		break; -	case SHMCTL: -		err = compat_sys_shmctl(first, second, compat_ptr(ptr)); -		break; -	default: -		err = -ENOSYS; -		break; -	} - -	return err; -} - -#else - -SYSCALL_DEFINE6(32_ipc, u32, call, int, first, int, second, int, third, -	u32, ptr, u32, fifth) -{ -	return -ENOSYS; -} - -#endif /* CONFIG_SYSVIPC */ - -#ifdef CONFIG_MIPS32_N32 -SYSCALL_DEFINE4(n32_semctl, int, semid, int, semnum, int, cmd, u32, arg) -{ -	/* compat_sys_semctl expects a pointer to union semun */ -	u32 __user *uptr = compat_alloc_user_space(sizeof(u32)); -	if (put_user(arg, uptr)) -		return -EFAULT; -	return compat_sys_semctl(semid, semnum, cmd, uptr); -} - -SYSCALL_DEFINE4(n32_msgsnd, int, msqid, u32, msgp, unsigned int, msgsz, -	int, msgflg) -{ -	return compat_sys_msgsnd(msqid, msgsz, msgflg, compat_ptr(msgp)); -} - -SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz, -	int, msgtyp, int, msgflg) -{ -	return compat_sys_msgrcv(msqid, msgsz, msgtyp, msgflg, IPC_64, -				 compat_ptr(msgp)); -} -#endif -  SYSCALL_DEFINE1(32_personality, unsigned long, personality)  {  	unsigned int p = personality & 0xffffffff; @@ -226,26 +133,6 @@ SYSCALL_DEFINE1(32_personality, unsigned long, personality)  	return ret;  } -SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd, -	compat_off_t __user *, offset, s32, count) -{ -	mm_segment_t old_fs = get_fs(); -	int ret; -	off_t of; - -	if (offset && get_user(of, offset)) -		return -EFAULT; - -	set_fs(KERNEL_DS); -	ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count); -	set_fs(old_fs); - -	if (offset && put_user(of, offset)) -		return -EFAULT; - -	return ret; -} -  asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3,  				   size_t count)  { @@ -279,12 +166,6 @@ asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2,  			     merge_64(len_a4, len_a5));  } -asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf, -	size_t len) -{ -	return sys_lookup_dcookie(merge_64(a0, a1), buf, len); -} -  SYSCALL_DEFINE6(32_fanotify_mark, int, fanotify_fd, unsigned int, flags,  		u64, a3, u64, a4, int, dfd, const char	__user *, pathname)  { diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 3be4405c2d1..cfc742d75b7 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -41,44 +41,26 @@  #include <asm/inst.h>  #include <asm/stacktrace.h> -/* - * The idle thread. There's no useful work to be done, so just try to conserve - * power and have a low exit latency (ie sit in a loop waiting for somebody to - * say that they'd like to reschedule) - */ -void __noreturn cpu_idle(void) +#ifdef CONFIG_HOTPLUG_CPU +void arch_cpu_idle_dead(void)  { -	int cpu; - -	/* CPU is going idle. */ -	cpu = smp_processor_id(); +	/* What the heck is this check doing ? */ +	if (!cpu_isset(smp_processor_id(), cpu_callin_map)) +		play_dead(); +} +#endif -	/* endless idle loop with no priority at all */ -	while (1) { -		tick_nohz_idle_enter(); -		rcu_idle_enter(); -		while (!need_resched() && cpu_online(cpu)) { +void arch_cpu_idle(void) +{  #ifdef CONFIG_MIPS_MT_SMTC -			extern void smtc_idle_loop_hook(void); +	extern void smtc_idle_loop_hook(void); -			smtc_idle_loop_hook(); +	smtc_idle_loop_hook();  #endif - -			if (cpu_wait) { -				/* Don't trace irqs off for idle */ -				stop_critical_timings(); -				(*cpu_wait)(); -				start_critical_timings(); -			} -		} -#ifdef CONFIG_HOTPLUG_CPU -		if (!cpu_online(cpu) && !cpu_isset(cpu, cpu_callin_map)) -			play_dead(); -#endif -		rcu_idle_exit(); -		tick_nohz_idle_exit(); -		schedule_preempt_disabled(); -	} +	if (cpu_wait) +		(*cpu_wait)(); +	else +		local_irq_enable();  }  asmlinkage void ret_from_fork(void); diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 693d60b0855..edcb6594e7b 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S @@ -143,7 +143,7 @@ EXPORT(sysn32_call_table)  	PTR	compat_sys_setitimer  	PTR	sys_alarm  	PTR	sys_getpid -	PTR	sys_32_sendfile +	PTR	compat_sys_sendfile  	PTR	sys_socket			/* 6040 */  	PTR	sys_connect  	PTR	sys_accept @@ -168,11 +168,11 @@ EXPORT(sysn32_call_table)  	PTR	sys_newuname  	PTR	sys_semget  	PTR	sys_semop -	PTR	sys_n32_semctl +	PTR	compat_sys_semctl  	PTR	sys_shmdt			/* 6065 */  	PTR	sys_msgget -	PTR	sys_n32_msgsnd -	PTR	sys_n32_msgrcv +	PTR	compat_sys_msgsnd +	PTR	compat_sys_msgrcv  	PTR	compat_sys_msgctl  	PTR	compat_sys_fcntl		/* 6070 */  	PTR	sys_flock diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index af8887f779f..103bfe570fe 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S @@ -309,7 +309,7 @@ sys_call_table:  	PTR	compat_sys_wait4  	PTR	sys_swapoff			/* 4115 */  	PTR	compat_sys_sysinfo -	PTR	sys_32_ipc +	PTR	compat_sys_ipc  	PTR	sys_fsync  	PTR	sys32_sigreturn  	PTR	__sys_clone			/* 4120 */ @@ -399,7 +399,7 @@ sys_call_table:  	PTR	sys_capget  	PTR	sys_capset			/* 4205 */  	PTR	compat_sys_sigaltstack -	PTR	sys_32_sendfile +	PTR	compat_sys_sendfile  	PTR	sys_ni_syscall  	PTR	sys_ni_syscall  	PTR	sys_mips_mmap2			/* 4210 */ @@ -439,7 +439,7 @@ sys_call_table:  	PTR	compat_sys_io_submit  	PTR	sys_io_cancel			/* 4245 */  	PTR	sys_exit_group -	PTR	sys32_lookup_dcookie +	PTR	compat_sys_lookup_dcookie  	PTR	sys_epoll_create  	PTR	sys_epoll_ctl  	PTR	sys_epoll_wait			/* 4250 */ diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 66bf4e22d9b..aee04af213c 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c @@ -139,7 +139,7 @@ asmlinkage __cpuinit void start_secondary(void)  	WARN_ON_ONCE(!irqs_disabled());  	mp_ops->smp_finish(); -	cpu_idle(); +	cpu_startup_entry(CPUHP_ONLINE);  }  /* diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index c3abb88170f..25225515451 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c @@ -206,19 +206,6 @@ void show_stack(struct task_struct *task, unsigned long *sp)  	show_stacktrace(task, ®s);  } -/* - * The architecture-independent dump_stack generator - */ -void dump_stack(void) -{ -	struct pt_regs regs; - -	prepare_frametrace(®s); -	show_backtrace(current, ®s); -} - -EXPORT_SYMBOL(dump_stack); -  static void show_code(unsigned int __user *pc)  {  	long i; @@ -244,7 +231,7 @@ static void __show_regs(const struct pt_regs *regs)  	unsigned int cause = regs->cp0_cause;  	int i; -	printk("Cpu %d\n", smp_processor_id()); +	show_regs_print_info(KERN_DEFAULT);  	/*  	 * Saved main processor registers  |