diff options
Diffstat (limited to 'arch/frv')
29 files changed, 335 insertions, 291 deletions
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index ec85c0d6c6d..60a617aff8b 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig @@ -6,10 +6,6 @@ config FRV bool default y -config UID16 - bool - default y - config RWSEM_GENERIC_SPINLOCK bool default y @@ -274,6 +270,11 @@ config GPREL_DATA_NONE endchoice +config FRV_ONCPU_SERIAL + bool "Use on-CPU serial ports" + select SERIAL_8250 + default y + config PCI bool "Use PCI" depends on MB93090_MB00 @@ -305,23 +306,7 @@ config RESERVE_DMA_COHERENT source "drivers/pci/Kconfig" -config PCMCIA - tristate "Use PCMCIA" - help - Say Y here if you want to attach PCMCIA- or PC-cards to your FR-V - board. These are credit-card size devices such as network cards, - modems or hard drives often used with laptops computers. There are - actually two varieties of these cards: the older 16 bit PCMCIA cards - and the newer 32 bit CardBus cards. If you want to use CardBus - cards, you need to say Y here and also to "CardBus support" below. - - To use your PC-cards, you will need supporting software from David - Hinds pcmcia-cs package (see the file <file:Documentation/Changes> - for location). Please also read the PCMCIA-HOWTO, available from - <http://www.tldp.org/docs.html#howto>. - - To compile this driver as modules, choose M here: the - modules will be called pcmcia_core and ds. +source "drivers/pcmcia/Kconfig" #config MATH_EMULATION # bool "Math emulation support (EXPERIMENTAL)" diff --git a/arch/frv/Kconfig.debug b/arch/frv/Kconfig.debug index 0034b654995..211f01bc4ca 100644 --- a/arch/frv/Kconfig.debug +++ b/arch/frv/Kconfig.debug @@ -2,32 +2,10 @@ menu "Kernel hacking" source "lib/Kconfig.debug" -config EARLY_PRINTK - bool "Early printk" - depends on EMBEDDED && DEBUG_KERNEL - default n - help - Write kernel log output directly into the VGA buffer or to a serial - port. - - This is useful for kernel debugging when your machine crashes very - early before the console code is initialized. For normal operation - it is not recommended because it looks ugly and doesn't cooperate - with klogd/syslogd or the X server. You should normally N here, - unless you want to debug such a crash. - config DEBUG_STACKOVERFLOW bool "Check for stack overflows" depends on DEBUG_KERNEL -config DEBUG_PAGEALLOC - bool "Page alloc debugging" - depends on DEBUG_KERNEL - help - Unmap pages from the kernel linear mapping after free_pages(). - This results in a large slowdown, but helps to find certain types - of memory corruptions. - config GDBSTUB bool "Remote GDB kernel debugging" depends on DEBUG_KERNEL diff --git a/arch/frv/Makefile b/arch/frv/Makefile index 54046d2386f..90c0fb8d9dc 100644 --- a/arch/frv/Makefile +++ b/arch/frv/Makefile @@ -109,10 +109,10 @@ bootstrap: $(Q)$(MAKEBOOT) bootstrap archmrproper: - $(Q)$(MAKE) -C arch/frv/boot mrproper + $(Q)$(MAKE) $(build)=arch/frv/boot mrproper archclean: - $(Q)$(MAKE) -C arch/frv/boot clean + $(Q)$(MAKE) $(build)=arch/frv/boot clean archdep: scripts/mkdep symlinks - $(Q)$(MAKE) -C arch/frv/boot dep + $(Q)$(MAKE) $(build)=arch/frv/boot dep diff --git a/arch/frv/boot/Makefile b/arch/frv/boot/Makefile index d75e0d77136..5dfc93fd945 100644 --- a/arch/frv/boot/Makefile +++ b/arch/frv/boot/Makefile @@ -57,10 +57,10 @@ initrd: # installation # install: $(CONFIGURE) Image - sh ./install.sh $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) Image $(TOPDIR)/System.map "$(INSTALL_PATH)" + sh ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)" zinstall: $(CONFIGURE) zImage - sh ./install.sh $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)" + sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)" # # miscellany diff --git a/arch/frv/kernel/Makefile b/arch/frv/kernel/Makefile index 422f30ede57..5a827b349b5 100644 --- a/arch/frv/kernel/Makefile +++ b/arch/frv/kernel/Makefile @@ -21,3 +21,4 @@ obj-$(CONFIG_PM) += pm.o cmode.o obj-$(CONFIG_MB93093_PDK) += pm-mb93093.o obj-$(CONFIG_SYSCTL) += sysctl.o obj-$(CONFIG_FUTEX) += futex.o +obj-$(CONFIG_MODULES) += module.o diff --git a/arch/frv/kernel/frv_ksyms.c b/arch/frv/kernel/frv_ksyms.c index 1a76d524719..0f1c6cbc4f5 100644 --- a/arch/frv/kernel/frv_ksyms.c +++ b/arch/frv/kernel/frv_ksyms.c @@ -16,17 +16,16 @@ #include <asm/semaphore.h> #include <asm/checksum.h> #include <asm/hardirq.h> -#include <asm/current.h> +#include <asm/cacheflush.h> -extern void dump_thread(struct pt_regs *, struct user *); extern long __memcpy_user(void *dst, const void *src, size_t count); +extern long __memset_user(void *dst, const void *src, size_t count); /* platform dependent support */ EXPORT_SYMBOL(__ioremap); EXPORT_SYMBOL(iounmap); -EXPORT_SYMBOL(dump_thread); EXPORT_SYMBOL(strnlen); EXPORT_SYMBOL(strrchr); EXPORT_SYMBOL(strstr); @@ -50,7 +49,11 @@ EXPORT_SYMBOL(disable_irq); EXPORT_SYMBOL(__res_bus_clock_speed_HZ); EXPORT_SYMBOL(__page_offset); EXPORT_SYMBOL(__memcpy_user); -EXPORT_SYMBOL(flush_dcache_page); +EXPORT_SYMBOL(__memset_user); +EXPORT_SYMBOL(frv_dcache_writeback); +EXPORT_SYMBOL(frv_cache_invalidate); +EXPORT_SYMBOL(frv_icache_invalidate); +EXPORT_SYMBOL(frv_cache_wback_inv); #ifndef CONFIG_MMU EXPORT_SYMBOL(memory_start); @@ -72,6 +75,9 @@ EXPORT_SYMBOL(memcmp); EXPORT_SYMBOL(memscan); EXPORT_SYMBOL(memmove); +EXPORT_SYMBOL(__outsl_ns); +EXPORT_SYMBOL(__insl_ns); + EXPORT_SYMBOL(get_wchan); #ifdef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS @@ -80,14 +86,13 @@ EXPORT_SYMBOL(atomic_test_and_OR_mask); EXPORT_SYMBOL(atomic_test_and_XOR_mask); EXPORT_SYMBOL(atomic_add_return); EXPORT_SYMBOL(atomic_sub_return); -EXPORT_SYMBOL(__xchg_8); -EXPORT_SYMBOL(__xchg_16); EXPORT_SYMBOL(__xchg_32); -EXPORT_SYMBOL(__cmpxchg_8); -EXPORT_SYMBOL(__cmpxchg_16); EXPORT_SYMBOL(__cmpxchg_32); #endif +EXPORT_SYMBOL(__debug_bug_printk); +EXPORT_SYMBOL(__delay_loops_MHz); + /* * libgcc functions - functions that are used internally by the * compiler... (prototypes are not correct though, but that @@ -101,6 +106,8 @@ extern void __divdi3(void); extern void __lshrdi3(void); extern void __moddi3(void); extern void __muldi3(void); +extern void __mulll(void); +extern void __umulll(void); extern void __negdi2(void); extern void __ucmpdi2(void); extern void __udivdi3(void); @@ -116,8 +123,10 @@ EXPORT_SYMBOL(__ashrdi3); EXPORT_SYMBOL(__lshrdi3); //EXPORT_SYMBOL(__moddi3); EXPORT_SYMBOL(__muldi3); +EXPORT_SYMBOL(__mulll); +EXPORT_SYMBOL(__umulll); EXPORT_SYMBOL(__negdi2); -//EXPORT_SYMBOL(__ucmpdi2); +EXPORT_SYMBOL(__ucmpdi2); //EXPORT_SYMBOL(__udivdi3); //EXPORT_SYMBOL(__udivmoddi4); //EXPORT_SYMBOL(__umoddi3); diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c index 8c524cdd271..59580c59c62 100644 --- a/arch/frv/kernel/irq.c +++ b/arch/frv/kernel/irq.c @@ -32,6 +32,7 @@ #include <linux/irq.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> +#include <linux/module.h> #include <asm/atomic.h> #include <asm/io.h> @@ -178,6 +179,8 @@ void disable_irq_nosync(unsigned int irq) spin_unlock_irqrestore(&level->lock, flags); } +EXPORT_SYMBOL(disable_irq_nosync); + /** * disable_irq - disable an irq and wait for completion * @irq: Interrupt to disable @@ -204,6 +207,8 @@ void disable_irq(unsigned int irq) #endif } +EXPORT_SYMBOL(disable_irq); + /** * enable_irq - enable handling of an irq * @irq: Interrupt to enable @@ -268,6 +273,8 @@ void enable_irq(unsigned int irq) spin_unlock_irqrestore(&level->lock, flags); } +EXPORT_SYMBOL(enable_irq); + /*****************************************************************************/ /* * handles all normal device IRQ's @@ -425,6 +432,8 @@ int request_irq(unsigned int irq, return retval; } +EXPORT_SYMBOL(request_irq); + /** * free_irq - free an interrupt * @irq: Interrupt line to free @@ -496,6 +505,8 @@ void free_irq(unsigned int irq, void *dev_id) } } +EXPORT_SYMBOL(free_irq); + /* * IRQ autodetection code.. * @@ -519,6 +530,8 @@ unsigned long probe_irq_on(void) return 0; } +EXPORT_SYMBOL(probe_irq_on); + /* * Return a mask of triggered interrupts (this * can handle only legacy ISA interrupts). @@ -542,6 +555,8 @@ unsigned int probe_irq_mask(unsigned long xmask) return 0; } +EXPORT_SYMBOL(probe_irq_mask); + /* * Return the one interrupt that triggered (this can * handle any interrupt source). @@ -571,6 +586,8 @@ int probe_irq_off(unsigned long xmask) return -1; } +EXPORT_SYMBOL(probe_irq_off); + /* this was setup_x86_irq but it seems pretty generic */ int setup_irq(unsigned int irq, struct irqaction *new) { diff --git a/arch/frv/kernel/module.c b/arch/frv/kernel/module.c new file mode 100644 index 00000000000..850d168f69f --- /dev/null +++ b/arch/frv/kernel/module.c @@ -0,0 +1,80 @@ +/* module.c: FRV specific module loading bits + * + * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * - Derived from arch/i386/kernel/module.c, Copyright (C) 2001 Rusty Russell. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#include <linux/moduleloader.h> +#include <linux/elf.h> +#include <linux/vmalloc.h> +#include <linux/fs.h> +#include <linux/string.h> +#include <linux/kernel.h> + +#if 0 +#define DEBUGP printk +#else +#define DEBUGP(fmt...) +#endif + +void *module_alloc(unsigned long size) +{ + if (size == 0) + return NULL; + + return vmalloc_exec(size); +} + + +/* Free memory returned from module_alloc */ +void module_free(struct module *mod, void *module_region) +{ + vfree(module_region); + /* FIXME: If module_region == mod->init_region, trim exception + table entries. */ +} + +/* We don't need anything special. */ +int module_frob_arch_sections(Elf_Ehdr *hdr, + Elf_Shdr *sechdrs, + char *secstrings, + struct module *mod) +{ + return 0; +} + +int apply_relocate(Elf32_Shdr *sechdrs, + const char *strtab, + unsigned int symindex, + unsigned int relsec, + struct module *me) +{ + printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name); + return -ENOEXEC; +} + +int apply_relocate_add(Elf32_Shdr *sechdrs, + const char *strtab, + unsigned int symindex, + unsigned int relsec, + struct module *me) +{ + printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name); + return -ENOEXEC; +} + +int module_finalize(const Elf_Ehdr *hdr, + const Elf_Shdr *sechdrs, + struct module *me) +{ + return 0; +} + +void module_arch_cleanup(struct module *mod) +{ +} diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c index 712c3c24c95..f0b8fff3e73 100644 --- a/arch/frv/kernel/pm.c +++ b/arch/frv/kernel/pm.c @@ -13,6 +13,7 @@ #include <linux/config.h> #include <linux/init.h> +#include <linux/module.h> #include <linux/pm.h> #include <linux/pm_legacy.h> #include <linux/sched.h> @@ -27,6 +28,7 @@ #include "local.h" void (*pm_power_off)(void); +EXPORT_SYMBOL(pm_power_off); extern void frv_change_cmode(int); diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index 54a452136f0..0fff8a61ef2 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c @@ -204,7 +204,7 @@ int copy_thread(int nr, unsigned long clone_flags, regs0 = __kernel_frame0_ptr; childregs0 = (struct pt_regs *) - ((unsigned long) p->thread_info + THREAD_SIZE - USER_CONTEXT_SIZE); + (task_stack_page(p) + THREAD_SIZE - USER_CONTEXT_SIZE); childregs = childregs0; /* set up the userspace frame (the only place that the USP is stored) */ @@ -220,7 +220,7 @@ int copy_thread(int nr, unsigned long clone_flags, *childregs = *regs; childregs->sp = (unsigned long) childregs0; childregs->next_frame = childregs0; - childregs->gr15 = (unsigned long) p->thread_info; + childregs->gr15 = (unsigned long) task_thread_info(p); childregs->gr29 = (unsigned long) p; } @@ -244,28 +244,6 @@ int copy_thread(int nr, unsigned long clone_flags, } /* end copy_thread() */ /* - * fill in the user structure for a core dump.. - */ -void dump_thread(struct pt_regs *regs, struct user *dump) -{ -#if 0 - /* changed the size calculations - should hopefully work better. lbt */ - dump->magic = CMAGIC; - dump->start_code = 0; - dump->start_stack = user_stack(regs) & ~(PAGE_SIZE - 1); - dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT; - dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT; - dump->u_dsize -= dump->u_tsize; - dump->u_ssize = 0; - - if (dump->start_stack < TASK_SIZE) - dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT; - - dump->regs = *(struct user_context *) regs; -#endif -} - -/* * sys_execve() executes a new program. */ asmlinkage int sys_execve(char *name, char **argv, char **envp) diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c index 767ebb55bd8..5908deae960 100644 --- a/arch/frv/kernel/setup.c +++ b/arch/frv/kernel/setup.c @@ -787,6 +787,7 @@ void __init setup_arch(char **cmdline_p) #endif /* register those serial ports that are available */ +#ifdef CONFIG_FRV_ONCPU_SERIAL #ifndef CONFIG_GDBSTUB_UART0 __reg(UART0_BASE + UART_IER * 8) = 0; early_serial_setup(&__frv_uart0); @@ -795,6 +796,7 @@ void __init setup_arch(char **cmdline_p) __reg(UART1_BASE + UART_IER * 8) = 0; early_serial_setup(&__frv_uart1); #endif +#endif #if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH) /* we need to initialize the Flashrom device here since we might diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c index 5b7146f54fd..679c1d5cc95 100644 --- a/arch/frv/kernel/signal.c +++ b/arch/frv/kernel/signal.c @@ -35,74 +35,22 @@ struct fdpic_func_descriptor { unsigned long GOT; }; -static int do_signal(sigset_t *oldset); - /* * Atomically swap in the new signal mask, and wait for a signal. */ asmlinkage int sys_sigsuspend(int history0, int history1, old_sigset_t mask) { - sigset_t saveset; - mask &= _BLOCKABLE; spin_lock_irq(¤t->sighand->siglock); - saveset = current->blocked; + current->saved_sigmask = current->blocked; siginitset(¤t->blocked, mask); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); - __frame->gr8 = -EINTR; - while (1) { - current->state = TASK_INTERRUPTIBLE; - schedule(); - if (do_signal(&saveset)) - /* return the signal number as the return value of this function - * - this is an utterly evil hack. syscalls should not invoke do_signal() - * as entry.S sets regs->gr8 to the return value of the system call - * - we can't just use sigpending() as we'd have to discard SIG_IGN signals - * and call waitpid() if SIGCHLD needed discarding - * - this only works on the i386 because it passes arguments to the signal - * handler on the stack, and the return value in EAX is effectively - * discarded - */ - return __frame->gr8; - } -} - -asmlinkage int sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize) -{ - sigset_t saveset, newset; - - /* XXX: Don't preclude handling different sized sigset_t's. */ - if (sigsetsize != sizeof(sigset_t)) - return -EINVAL; - - if (copy_from_user(&newset, unewset, sizeof(newset))) - return -EFAULT; - sigdelsetmask(&newset, ~_BLOCKABLE); - - spin_lock_irq(¤t->sighand->siglock); - saveset = current->blocked; - current->blocked = newset; - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - - __frame->gr8 = -EINTR; - while (1) { - current->state = TASK_INTERRUPTIBLE; - schedule(); - if (do_signal(&saveset)) - /* return the signal number as the return value of this function - * - this is an utterly evil hack. syscalls should not invoke do_signal() - * as entry.S sets regs->gr8 to the return value of the system call - * - we can't just use sigpending() as we'd have to discard SIG_IGN signals - * and call waitpid() if SIGCHLD needed discarding - * - this only works on the i386 because it passes arguments to the signal - * handler on the stack, and the return value in EAX is effectively - * discarded - */ - return __frame->gr8; - } + current->state = TASK_INTERRUPTIBLE; + schedule(); + set_thread_flag(TIF_RESTORE_SIGMASK); + return -ERESTARTNOHAND; } asmlinkage int sys_sigaction(int sig, @@ -372,11 +320,11 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set) frame->pretcode); #endif - return 1; + return 0; give_sigsegv: force_sig(SIGSEGV, current); - return 0; + return -EFAULT; } /* end setup_frame() */ @@ -471,11 +419,11 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, frame->pretcode); #endif - return 1; + return 0; give_sigsegv: force_sig(SIGSEGV, current); - return 0; + return -EFAULT; } /* end setup_rt_frame() */ @@ -516,7 +464,7 @@ static int handle_signal(unsigned long sig, siginfo_t *info, else ret = setup_frame(sig, ka, oldset); - if (ret) { + if (ret == 0) { spin_lock_irq(¤t->sighand->siglock); sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); @@ -536,10 +484,11 @@ static int handle_signal(unsigned long sig, siginfo_t *info, * want to handle. Thus you cannot kill init even with a SIGKILL even by * mistake. */ -static int do_signal(sigset_t *oldset) +static void do_signal(void) { struct k_sigaction ka; siginfo_t info; + sigset_t *oldset; int signr; /* @@ -549,43 +498,62 @@ static int do_signal(sigset_t *oldset) * if so. */ if (!user_mode(__frame)) - return 1; + return; if (try_to_freeze()) goto no_signal; - if (!oldset) + if (test_thread_flag(TIF_RESTORE_SIGMASK)) + oldset = ¤t->saved_sigmask; + else oldset = ¤t->blocked; signr = get_signal_to_deliver(&info, &ka, __frame, NULL); - if (signr > 0) - return handle_signal(signr, &info, &ka, oldset); + if (signr > 0) { + if (handle_signal(signr, &info, &ka, oldset) == 0) { + /* a signal was successfully delivered; the saved + * sigmask will have been stored in the signal frame, + * and will be restored by sigreturn, so we can simply + * clear the TIF_RESTORE_SIGMASK flag */ + if (test_thread_flag(TIF_RESTORE_SIGMASK)) + clear_thread_flag(TIF_RESTORE_SIGMASK); + } + + return; + } no_signal: /* Did we come from a system call? */ if (__frame->syscallno >= 0) { /* Restart the system call - no handlers present */ - if (__frame->gr8 == -ERESTARTNOHAND || - __frame->gr8 == -ERESTARTSYS || - __frame->gr8 == -ERESTARTNOINTR) { + switch (__frame->gr8) { + case -ERESTARTNOHAND: + case -ERESTARTSYS: + case -ERESTARTNOINTR: __frame->gr8 = __frame->orig_gr8; __frame->pc -= 4; - } + break; - if (__frame->gr8 == -ERESTART_RESTARTBLOCK){ + case -ERESTART_RESTARTBLOCK: __frame->gr8 = __NR_restart_syscall; __frame->pc -= 4; + break; } } - return 0; + /* if there's no signal to deliver, we just put the saved sigmask + * back */ + if (test_thread_flag(TIF_RESTORE_SIGMASK)) { + clear_thread_flag(TIF_RESTORE_SIGMASK); + sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); + } } /* end do_signal() */ /*****************************************************************************/ /* * notification of userspace execution resumption - * - triggered by current->work.notify_resume + * - triggered by the TIF_WORK_MASK flags */ asmlinkage void do_notify_resume(__u32 thread_info_flags) { @@ -594,7 +562,7 @@ asmlinkage void do_notify_resume(__u32 thread_info_flags) clear_thread_flag(TIF_SINGLESTEP); /* deal with pending signal delivery */ - if (thread_info_flags & _TIF_SIGPENDING) - do_signal(NULL); + if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) + do_signal(); } /* end do_notify_resume() */ diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c index 2e9741227b7..24cf85f89e4 100644 --- a/arch/frv/kernel/time.c +++ b/arch/frv/kernel/time.c @@ -189,6 +189,8 @@ void do_gettimeofday(struct timeval *tv) tv->tv_usec = usec; } +EXPORT_SYMBOL(do_gettimeofday); + int do_settimeofday(struct timespec *tv) { time_t wtm_sec, sec = tv->tv_sec; @@ -218,6 +220,7 @@ int do_settimeofday(struct timespec *tv) clock_was_set(); return 0; } + EXPORT_SYMBOL(do_settimeofday); /* diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c index 89073cae4b5..9eb84b2e6ab 100644 --- a/arch/frv/kernel/traps.c +++ b/arch/frv/kernel/traps.c @@ -19,6 +19,7 @@ #include <linux/string.h> #include <linux/linkage.h> #include <linux/init.h> +#include <linux/module.h> #include <asm/setup.h> #include <asm/fpu.h> @@ -250,6 +251,8 @@ void dump_stack(void) show_stack(NULL, NULL); } +EXPORT_SYMBOL(dump_stack); + void show_stack(struct task_struct *task, unsigned long *sp) { } diff --git a/arch/frv/kernel/uaccess.c b/arch/frv/kernel/uaccess.c index f3fd58a5bc4..9b751c0f0e8 100644 --- a/arch/frv/kernel/uaccess.c +++ b/arch/frv/kernel/uaccess.c @@ -10,6 +10,7 @@ */ #include <linux/mm.h> +#include <linux/module.h> #include <asm/uaccess.h> /*****************************************************************************/ @@ -58,8 +59,11 @@ long strncpy_from_user(char *dst, const char *src, long count) memset(p, 0, count); /* clear remainder of buffer [security] */ return err; + } /* end strncpy_from_user() */ +EXPORT_SYMBOL(strncpy_from_user); + /*****************************************************************************/ /* * Return the size of a string (including the ending 0) @@ -92,4 +96,7 @@ long strnlen_user(const char *src, long count) } return p - src + 1; /* return length including NUL */ + } /* end strnlen_user() */ + +EXPORT_SYMBOL(strnlen_user); diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S index fceafd2cc20..f474534ba78 100644 --- a/arch/frv/kernel/vmlinux.lds.S +++ b/arch/frv/kernel/vmlinux.lds.S @@ -112,6 +112,7 @@ SECTIONS #endif ) SCHED_TEXT + LOCK_TEXT *(.fixup) *(.gnu.warning) *(.exitcall.exit) diff --git a/arch/frv/lib/Makefile b/arch/frv/lib/Makefile index 19be2626d5e..08be305c9f4 100644 --- a/arch/frv/lib/Makefile +++ b/arch/frv/lib/Makefile @@ -3,6 +3,6 @@ # lib-y := \ - __ashldi3.o __lshrdi3.o __muldi3.o __ashrdi3.o __negdi2.o \ + __ashldi3.o __lshrdi3.o __muldi3.o __ashrdi3.o __negdi2.o __ucmpdi2.o \ checksum.o memcpy.o memset.o atomic-ops.o \ outsl_ns.o outsl_sw.o insl_ns.o insl_sw.o cache.o diff --git a/arch/frv/lib/__ucmpdi2.S b/arch/frv/lib/__ucmpdi2.S new file mode 100644 index 00000000000..d892f16ffaa --- /dev/null +++ b/arch/frv/lib/__ucmpdi2.S @@ -0,0 +1,45 @@ +/* __ucmpdi2.S: 64-bit unsigned compare + * + * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + + + .text + .p2align 4 + +############################################################################### +# +# int __ucmpdi2(unsigned long long a [GR8:GR9], +# unsigned long long b [GR10:GR11]) +# +# - returns 0, 1, or 2 as a <, =, > b respectively. +# +############################################################################### + .globl __ucmpdi2 + .type __ucmpdi2,@function +__ucmpdi2: + or.p gr8,gr0,gr4 + subcc gr8,gr10,gr0,icc0 + setlos.p #0,gr8 + bclr icc0,#2 ; a.msw < b.msw + + setlos.p #2,gr8 + bhilr icc0,#0 ; a.msw > b.msw + + subcc.p gr9,gr11,gr0,icc1 + setlos #0,gr8 + setlos.p #2,gr9 + setlos #1,gr7 + cknc icc1,cc6 + cor.p gr9,gr0,gr8, cc6,#1 + cckls icc1,cc4, cc6,#1 + andcr cc6,cc4,cc4 + cor gr7,gr0,gr8, cc4,#1 + bralr + .size __ucmpdi2, .-__ucmpdi2 diff --git a/arch/frv/lib/atomic-ops.S b/arch/frv/lib/atomic-ops.S index b03d510a89e..545cd325ac5 100644 --- a/arch/frv/lib/atomic-ops.S +++ b/arch/frv/lib/atomic-ops.S @@ -129,48 +129,6 @@ atomic_sub_return: ############################################################################### # -# uint8_t __xchg_8(uint8_t i, uint8_t *v) -# -############################################################################### - .globl __xchg_8 - .type __xchg_8,@function -__xchg_8: - or.p gr8,gr8,gr10 -0: - orcc gr0,gr0,gr0,icc3 /* set ICC3.Z */ - ckeq icc3,cc7 - ldub.p @(gr9,gr0),gr8 /* LD.P/ORCR must be atomic */ - orcr cc7,cc7,cc3 /* set CC3 to true */ - cstb.p gr10,@(gr9,gr0) ,cc3,#1 - corcc gr29,gr29,gr0 ,cc3,#1 /* clear ICC3.Z if store happens */ - beq icc3,#0,0b - bralr - - .size __xchg_8, .-__xchg_8 - -############################################################################### -# -# uint16_t __xchg_16(uint16_t i, uint16_t *v) -# -############################################################################### - .globl __xchg_16 - .type __xchg_16,@function -__xchg_16: - or.p gr8,gr8,gr10 -0: - orcc gr0,gr0,gr0,icc3 /* set ICC3.Z */ - ckeq icc3,cc7 - lduh.p @(gr9,gr0),gr8 /* LD.P/ORCR must be atomic */ - orcr cc7,cc7,cc3 /* set CC3 to true */ - csth.p gr10,@(gr9,gr0) ,cc3,#1 - corcc gr29,gr29,gr0 ,cc3,#1 /* clear ICC3.Z if store happens */ - beq icc3,#0,0b - bralr - - .size __xchg_16, .-__xchg_16 - -############################################################################### -# # uint32_t __xchg_32(uint32_t i, uint32_t *v) # ############################################################################### @@ -192,56 +150,6 @@ __xchg_32: ############################################################################### # -# uint8_t __cmpxchg_8(uint8_t *v, uint8_t test, uint8_t new) -# -############################################################################### - .globl __cmpxchg_8 - .type __cmpxchg_8,@function -__cmpxchg_8: - or.p gr8,gr8,gr11 -0: - orcc gr0,gr0,gr0,icc3 - ckeq icc3,cc7 - ldub.p @(gr11,gr0),gr8 - orcr cc7,cc7,cc3 - sub gr8,gr9,gr7 - sllicc gr7,#24,gr0,icc0 - bne icc0,#0,1f - cstb.p gr10,@(gr11,gr0) ,cc3,#1 - corcc gr29,gr29,gr0 ,cc3,#1 - beq icc3,#0,0b -1: - bralr - - .size __cmpxchg_8, .-__cmpxchg_8 - -############################################################################### -# -# uint16_t __cmpxchg_16(uint16_t *v, uint16_t test, uint16_t new) -# -############################################################################### - .globl __cmpxchg_16 - .type __cmpxchg_16,@function -__cmpxchg_16: - or.p gr8,gr8,gr11 -0: - orcc gr0,gr0,gr0,icc3 - ckeq icc3,cc7 - lduh.p @(gr11,gr0),gr8 - orcr cc7,cc7,cc3 - sub gr8,gr9,gr7 - sllicc gr7,#16,gr0,icc0 - bne icc0,#0,1f - csth.p gr10,@(gr11,gr0) ,cc3,#1 - corcc gr29,gr29,gr0 ,cc3,#1 - beq icc3,#0,0b -1: - bralr - - .size __cmpxchg_16, .-__cmpxchg_16 - -############################################################################### -# # uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new) # ############################################################################### diff --git a/arch/frv/lib/checksum.c b/arch/frv/lib/checksum.c index 7bf5bd6cac8..20e7dfc474e 100644 --- a/arch/frv/lib/checksum.c +++ b/arch/frv/lib/checksum.c @@ -33,6 +33,7 @@ #include <net/checksum.h> #include <asm/checksum.h> +#include <linux/module.h> static inline unsigned short from32to16(unsigned long x) { @@ -115,34 +116,52 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) return result; } +EXPORT_SYMBOL(csum_partial); + /* * this routine is used for miscellaneous IP-like checksums, mainly * in icmp.c */ unsigned short ip_compute_csum(const unsigned char * buff, int len) { - return ~do_csum(buff,len); + return ~do_csum(buff, len); } +EXPORT_SYMBOL(ip_compute_csum); + /* * copy from fs while checksumming, otherwise like csum_partial */ - unsigned int -csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *csum_err) +csum_partial_copy_from_user(const char __user *src, char *dst, + int len, int sum, int *csum_err) { - if (csum_err) *csum_err = 0; - memcpy(dst, src, len); + int rem; + + if (csum_err) + *csum_err = 0; + + rem = copy_from_user(dst, src, len); + if (rem != 0) { + if (csum_err) + *csum_err = -EFAULT; + memset(dst + len - rem, 0, rem); + len = rem; + } + return csum_partial(dst, len, sum); } +EXPORT_SYMBOL(csum_partial_copy_from_user); + /* * copy from ds while checksumming, otherwise like csum_partial */ - unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum) { memcpy(dst, src, len); return csum_partial(dst, len, sum); } + +EXPORT_SYMBOL(csum_partial_copy); diff --git a/arch/frv/mb93090-mb00/Makefile b/arch/frv/mb93090-mb00/Makefile index 3faf0f8cf9b..76595e87073 100644 --- a/arch/frv/mb93090-mb00/Makefile +++ b/arch/frv/mb93090-mb00/Makefile @@ -3,7 +3,7 @@ # ifeq "$(CONFIG_PCI)" "y" -obj-y := pci-frv.o pci-irq.o pci-vdk.o +obj-y := pci-frv.o pci-irq.o pci-vdk.o pci-iomap.o ifeq "$(CONFIG_MMU)" "y" obj-y += pci-dma.o diff --git a/arch/frv/mb93090-mb00/pci-dma-nommu.c b/arch/frv/mb93090-mb00/pci-dma-nommu.c index 2082a9647f4..4985466b1a7 100644 --- a/arch/frv/mb93090-mb00/pci-dma-nommu.c +++ b/arch/frv/mb93090-mb00/pci-dma-nommu.c @@ -83,6 +83,8 @@ void *dma_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_hand return NULL; } +EXPORT_SYMBOL(dma_alloc_coherent); + void dma_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle) { struct dma_alloc_record *rec; @@ -102,6 +104,8 @@ void dma_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_ BUG(); } +EXPORT_SYMBOL(dma_free_coherent); + /* * Map a single buffer of the indicated size for DMA in streaming mode. * The 32-bit bus address to use is returned. @@ -120,6 +124,8 @@ dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size, return virt_to_bus(ptr); } +EXPORT_SYMBOL(dma_map_single); + /* * Map a set of buffers described by scatterlist in streaming * mode for DMA. This is the scather-gather version of the @@ -150,3 +156,5 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, return nents; } + +EXPORT_SYMBOL(dma_map_sg); diff --git a/arch/frv/mb93090-mb00/pci-dma.c b/arch/frv/mb93090-mb00/pci-dma.c index 86fbdadc51b..671ce1e8434 100644 --- a/arch/frv/mb93090-mb00/pci-dma.c +++ b/arch/frv/mb93090-mb00/pci-dma.c @@ -28,11 +28,15 @@ void *dma_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_hand return ret; } +EXPORT_SYMBOL(dma_alloc_coherent); + void dma_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle) { consistent_free(vaddr); } +EXPORT_SYMBOL(dma_free_coherent); + /* * Map a single buffer of the indicated size for DMA in streaming mode. * The 32-bit bus address to use is returned. @@ -51,6 +55,8 @@ dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size, return virt_to_bus(ptr); } +EXPORT_SYMBOL(dma_map_single); + /* * Map a set of buffers described by scatterlist in streaming * mode for DMA. This is the scather-gather version of the @@ -96,6 +102,8 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, return nents; } +EXPORT_SYMBOL(dma_map_sg); + dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction direction) { @@ -103,3 +111,5 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long off flush_dcache_page(page); return (dma_addr_t) page_to_phys(page) + offset; } + +EXPORT_SYMBOL(dma_map_page); diff --git a/arch/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c index 83e5489cf03..0a26bf6f1cd 100644 --- a/arch/frv/mb93090-mb00/pci-frv.c +++ b/arch/frv/mb93090-mb00/pci-frv.c @@ -142,9 +142,7 @@ static void __init pcibios_allocate_resources(int pass) u16 command; struct resource *r, *pr; - while (dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev), - dev != NULL - ) { + for_each_pci_dev(dev) { pci_read_config_word(dev, PCI_COMMAND, &command); for(idx = 0; idx < 6; idx++) { r = &dev->resource[idx]; @@ -188,9 +186,7 @@ static void __init pcibios_assign_resources(void) int idx; struct resource *r; - while (dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev), - dev != NULL - ) { + for_each_pci_dev(dev) { int class = dev->class >> 8; /* Don't touch classless devices and host bridges */ diff --git a/arch/frv/mb93090-mb00/pci-iomap.c b/arch/frv/mb93090-mb00/pci-iomap.c new file mode 100644 index 00000000000..068fa04bd52 --- /dev/null +++ b/arch/frv/mb93090-mb00/pci-iomap.c @@ -0,0 +1,29 @@ +/* pci-iomap.c: description + * + * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#include <linux/pci.h> +#include <linux/module.h> + +void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) +{ + unsigned long start = pci_resource_start(dev, bar); + unsigned long len = pci_resource_len(dev, bar); + unsigned long flags = pci_resource_flags(dev, bar); + + if (!len || !start) + return NULL; + + if ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM)) + return (void __iomem *) start; + + return NULL; +} + +EXPORT_SYMBOL(pci_iomap); diff --git a/arch/frv/mb93090-mb00/pci-irq.c b/arch/frv/mb93090-mb00/pci-irq.c index 24622d89b1c..c4a1144c98b 100644 --- a/arch/frv/mb93090-mb00/pci-irq.c +++ b/arch/frv/mb93090-mb00/pci-irq.c @@ -48,9 +48,7 @@ void __init pcibios_fixup_irqs(void) struct pci_dev *dev = NULL; uint8_t line, pin; - while (dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev), - dev != NULL - ) { + for_each_pci_dev(dev) { pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); if (pin) { dev->irq = pci_bus0_irq_routing[PCI_SLOT(dev->devfn)][pin - 1]; diff --git a/arch/frv/mm/cache-page.c b/arch/frv/mm/cache-page.c index 683b5e34431..0261cbe153b 100644 --- a/arch/frv/mm/cache-page.c +++ b/arch/frv/mm/cache-page.c @@ -11,6 +11,7 @@ #include <linux/sched.h> #include <linux/mm.h> #include <linux/highmem.h> +#include <linux/module.h> #include <asm/pgalloc.h> /*****************************************************************************/ @@ -38,6 +39,8 @@ void flush_dcache_page(struct page *page) } /* end flush_dcache_page() */ +EXPORT_SYMBOL(flush_dcache_page); + /*****************************************************************************/ /* * ICI takes a virtual address and the page may not currently have one @@ -64,3 +67,5 @@ void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, } } /* end flush_icache_user_range() */ + +EXPORT_SYMBOL(flush_icache_user_range); diff --git a/arch/frv/mm/extable.c b/arch/frv/mm/extable.c index 41be1128dc6..caacf030ac7 100644 --- a/arch/frv/mm/extable.c +++ b/arch/frv/mm/extable.c @@ -43,7 +43,7 @@ static inline unsigned long search_one_table(const struct exception_table_entry */ unsigned long search_exception_table(unsigned long pc) { - unsigned long ret = 0; + const struct exception_table_entry *extab; /* determine if the fault lay during a memcpy_user or a memset_user */ if (__frame->lr == (unsigned long) &__memset_user_error_lr && @@ -55,9 +55,10 @@ unsigned long search_exception_table(unsigned long pc) */ return (unsigned long) &__memset_user_error_handler; } - else if (__frame->lr == (unsigned long) &__memcpy_user_error_lr && - (unsigned long) &memcpy <= pc && pc < (unsigned long) &__memcpy_end - ) { + + if (__frame->lr == (unsigned long) &__memcpy_user_error_lr && + (unsigned long) &memcpy <= pc && pc < (unsigned long) &__memcpy_end + ) { /* the fault occurred in a protected memset * - we search for the return address (in LR) instead of the program counter * - it was probably during a copy_to/from_user() @@ -65,27 +66,10 @@ unsigned long search_exception_table(unsigned long pc) return (unsigned long) &__memcpy_user_error_handler; } -#ifndef CONFIG_MODULES - /* there is only the kernel to search. */ - ret = search_one_table(__start___ex_table, __stop___ex_table - 1, pc); - return ret; - -#else - /* the kernel is the last "module" -- no need to treat it special */ - unsigned long flags; - struct module *mp; + extab = search_exception_tables(pc); + if (extab) + return extab->fixup; - spin_lock_irqsave(&modlist_lock, flags); - - for (mp = module_list; mp != NULL; mp = mp->next) { - if (mp->ex_table_start == NULL || !(mp->flags & (MOD_RUNNING | MOD_INITIALIZING))) - continue; - ret = search_one_table(mp->ex_table_start, mp->ex_table_end - 1, pc); - if (ret) - break; - } + return 0; - spin_unlock_irqrestore(&modlist_lock, flags); - return ret; -#endif } /* end search_exception_table() */ diff --git a/arch/frv/mm/highmem.c b/arch/frv/mm/highmem.c index 7dc8fbf3af9..7f77db7fabc 100644 --- a/arch/frv/mm/highmem.c +++ b/arch/frv/mm/highmem.c @@ -9,6 +9,7 @@ * 2 of the License, or (at your option) any later version. */ #include <linux/highmem.h> +#include <linux/module.h> void *kmap(struct page *page) { @@ -18,6 +19,8 @@ void *kmap(struct page *page) return kmap_high(page); } +EXPORT_SYMBOL(kmap); + void kunmap(struct page *page) { if (in_interrupt()) @@ -27,7 +30,12 @@ void kunmap(struct page *page) kunmap_high(page); } +EXPORT_SYMBOL(kunmap); + struct page *kmap_atomic_to_page(void *ptr) { return virt_to_page(ptr); } + + +EXPORT_SYMBOL(kmap_atomic_to_page); |