diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 01:37:49 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 01:37:49 (GMT) |
commit | 4690dfa8cd66c37fbe99bb8cd5baa86102110776 (patch) | |
tree | 063d1f68298cab19d29a4aa689d755266ae85a7d /arch/microblaze | |
parent | c2e08e7ce5ab25a781197a71c5241742e8c9fdfe (diff) | |
parent | f3aef2510e2bb28cdbf32e5f3b8f04f03336ac81 (diff) | |
download | linux-4690dfa8cd66c37fbe99bb8cd5baa86102110776.tar.xz |
Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblaze
* 'next' of git://git.monstr.eu/linux-2.6-microblaze:
microblaze: Wire-up new system calls
microblaze: Remove NO_IRQ from architecture
input: xilinx_ps2: Don't use NO_IRQ
block: xsysace: Don't use NO_IRQ
microblaze: Trivial asm fix
microblaze: Fix debug message in module
microblaze: Remove eprintk macro
microblaze: Send CR before LF for early console
microblaze: Change NO_IRQ to 0
microblaze: Use irq_of_parse_and_map for timer
microblaze: intc: Change variable name
microblaze: Use of_find_compatible_node for timer and intc
microblaze: Add __cmpdi2
microblaze: Synchronize __pa __va macros
Diffstat (limited to 'arch/microblaze')
-rw-r--r-- | arch/microblaze/include/asm/irq.h | 11 | ||||
-rw-r--r-- | arch/microblaze/include/asm/page.h | 11 | ||||
-rw-r--r-- | arch/microblaze/include/asm/setup.h | 6 | ||||
-rw-r--r-- | arch/microblaze/include/asm/unistd.h | 5 | ||||
-rw-r--r-- | arch/microblaze/kernel/early_printk.c | 4 | ||||
-rw-r--r-- | arch/microblaze/kernel/entry.S | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/intc.c | 52 | ||||
-rw-r--r-- | arch/microblaze/kernel/irq.c | 11 | ||||
-rw-r--r-- | arch/microblaze/kernel/module.c | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/setup.c | 18 | ||||
-rw-r--r-- | arch/microblaze/kernel/syscall_table.S | 3 | ||||
-rw-r--r-- | arch/microblaze/kernel/timer.c | 21 | ||||
-rw-r--r-- | arch/microblaze/lib/Makefile | 1 | ||||
-rw-r--r-- | arch/microblaze/lib/cmpdi2.c | 26 | ||||
-rw-r--r-- | arch/microblaze/pci/pci-common.c | 4 |
15 files changed, 93 insertions, 84 deletions
diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h index cc54187..a175132 100644 --- a/arch/microblaze/include/asm/irq.h +++ b/arch/microblaze/include/asm/irq.h @@ -9,7 +9,14 @@ #ifndef _ASM_MICROBLAZE_IRQ_H #define _ASM_MICROBLAZE_IRQ_H -#define NR_IRQS 32 + +/* + * Linux IRQ# is currently offset by one to map to the hardware + * irq number. So hardware IRQ0 maps to Linux irq 1. + */ +#define NO_IRQ_OFFSET 1 +#define IRQ_OFFSET NO_IRQ_OFFSET +#define NR_IRQS (32 + IRQ_OFFSET) #include <asm-generic/irq.h> /* This type is the placeholder for a hardware interrupt number. It has to @@ -20,8 +27,6 @@ typedef unsigned long irq_hw_number_t; extern unsigned int nr_irq; -#define NO_IRQ (-1) - struct pt_regs; extern void do_IRQ(struct pt_regs *regs); diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h index ed9d0f6..a25e6b5 100644 --- a/arch/microblaze/include/asm/page.h +++ b/arch/microblaze/include/asm/page.h @@ -174,15 +174,8 @@ extern int page_is_ram(unsigned long pfn); #define virt_addr_valid(vaddr) (pfn_valid(virt_to_pfn(vaddr))) - -# ifndef CONFIG_MMU -# define __pa(vaddr) ((unsigned long) (vaddr)) -# define __va(paddr) ((void *) (paddr)) -# else /* CONFIG_MMU */ -# define __pa(x) __virt_to_phys((unsigned long)(x)) -# define __va(x) ((void *)__phys_to_virt((unsigned long)(x))) -# endif /* CONFIG_MMU */ - +# define __pa(x) __virt_to_phys((unsigned long)(x)) +# define __va(x) ((void *)__phys_to_virt((unsigned long)(x))) /* Convert between virtual and physical address for MMU. */ /* Handle MicroBlaze processor with virtual memory. */ diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h index 904e5ef..6c72ed7 100644 --- a/arch/microblaze/include/asm/setup.h +++ b/arch/microblaze/include/asm/setup.h @@ -26,12 +26,6 @@ int setup_early_printk(char *opt); void remap_early_printk(void); void disable_early_printk(void); -#if defined(CONFIG_EARLY_PRINTK) -#define eprintk early_printk -#else -#define eprintk printk -#endif - void heartbeat(void); void setup_heartbeat(void); diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h index 7d7092b..d20ffbc 100644 --- a/arch/microblaze/include/asm/unistd.h +++ b/arch/microblaze/include/asm/unistd.h @@ -391,8 +391,11 @@ #define __NR_clock_adjtime 373 #define __NR_syncfs 374 #define __NR_setns 375 +#define __NR_sendmmsg 376 +#define __NR_process_vm_readv 377 +#define __NR_process_vm_writev 378 -#define __NR_syscalls 376 +#define __NR_syscalls 379 #ifdef __KERNEL__ #ifndef __ASSEMBLY__ diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c index d26d92d..8356e47 100644 --- a/arch/microblaze/kernel/early_printk.c +++ b/arch/microblaze/kernel/early_printk.c @@ -50,9 +50,9 @@ static void early_printk_uartlite_write(struct console *unused, const char *s, unsigned n) { while (*s && n-- > 0) { - early_printk_uartlite_putc(*s); if (*s == '\n') early_printk_uartlite_putc('\r'); + early_printk_uartlite_putc(*s); s++; } } @@ -94,9 +94,9 @@ static void early_printk_uart16550_write(struct console *unused, const char *s, unsigned n) { while (*s && n-- > 0) { - early_printk_uart16550_putc(*s); if (*s == '\n') early_printk_uart16550_putc('\r'); + early_printk_uart16550_putc(*s); s++; } } diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S index ca15bc5..66e34a3 100644 --- a/arch/microblaze/kernel/entry.S +++ b/arch/microblaze/kernel/entry.S @@ -468,7 +468,7 @@ C_ENTRY(sys_fork_wrapper): addi r5, r0, SIGCHLD /* Arg 0: flags */ lwi r6, r1, PT_R1 /* Arg 1: child SP (use parent's) */ addik r7, r1, 0 /* Arg 2: parent context */ - add r8. r0, r0 /* Arg 3: (unused) */ + add r8, r0, r0 /* Arg 3: (unused) */ add r9, r0, r0; /* Arg 4: (unused) */ brid do_fork /* Do real work (tail-call) */ add r10, r0, r0; /* Arg 5: (unused) */ diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c index eb41441..44b177e 100644 --- a/arch/microblaze/kernel/intc.c +++ b/arch/microblaze/kernel/intc.c @@ -42,8 +42,9 @@ unsigned int nr_irq; static void intc_enable_or_unmask(struct irq_data *d) { - unsigned long mask = 1 << d->irq; - pr_debug("enable_or_unmask: %d\n", d->irq); + unsigned long mask = 1 << d->hwirq; + + pr_debug("enable_or_unmask: %ld\n", d->hwirq); out_be32(INTC_BASE + SIE, mask); /* ack level irqs because they can't be acked during @@ -56,20 +57,21 @@ static void intc_enable_or_unmask(struct irq_data *d) static void intc_disable_or_mask(struct irq_data *d) { - pr_debug("disable: %d\n", d->irq); - out_be32(INTC_BASE + CIE, 1 << d->irq); + pr_debug("disable: %ld\n", d->hwirq); + out_be32(INTC_BASE + CIE, 1 << d->hwirq); } static void intc_ack(struct irq_data *d) { - pr_debug("ack: %d\n", d->irq); - out_be32(INTC_BASE + IAR, 1 << d->irq); + pr_debug("ack: %ld\n", d->hwirq); + out_be32(INTC_BASE + IAR, 1 << d->hwirq); } static void intc_mask_ack(struct irq_data *d) { - unsigned long mask = 1 << d->irq; - pr_debug("disable_and_ack: %d\n", d->irq); + unsigned long mask = 1 << d->hwirq; + + pr_debug("disable_and_ack: %ld\n", d->hwirq); out_be32(INTC_BASE + CIE, mask); out_be32(INTC_BASE + IAR, mask); } @@ -91,7 +93,7 @@ unsigned int get_irq(struct pt_regs *regs) * order to handle multiple interrupt controllers. It currently * is hardcoded to check for interrupts only on the first INTC. */ - irq = in_be32(INTC_BASE + IVR); + irq = in_be32(INTC_BASE + IVR) + NO_IRQ_OFFSET; pr_debug("get_irq: %d\n", irq); return irq; @@ -99,7 +101,7 @@ unsigned int get_irq(struct pt_regs *regs) void __init init_IRQ(void) { - u32 i, j, intr_type; + u32 i, intr_mask; struct device_node *intc = NULL; #ifdef CONFIG_SELFMOD_INTC unsigned int intc_baseaddr = 0; @@ -113,35 +115,24 @@ void __init init_IRQ(void) 0 }; #endif - const char * const intc_list[] = { - "xlnx,xps-intc-1.00.a", - NULL - }; - - for (j = 0; intc_list[j] != NULL; j++) { - intc = of_find_compatible_node(NULL, NULL, intc_list[j]); - if (intc) - break; - } + intc = of_find_compatible_node(NULL, NULL, "xlnx,xps-intc-1.00.a"); BUG_ON(!intc); - intc_baseaddr = be32_to_cpup(of_get_property(intc, - "reg", NULL)); + intc_baseaddr = be32_to_cpup(of_get_property(intc, "reg", NULL)); intc_baseaddr = (unsigned long) ioremap(intc_baseaddr, PAGE_SIZE); nr_irq = be32_to_cpup(of_get_property(intc, "xlnx,num-intr-inputs", NULL)); - intr_type = - be32_to_cpup(of_get_property(intc, - "xlnx,kind-of-intr", NULL)); - if (intr_type > (u32)((1ULL << nr_irq) - 1)) + intr_mask = + be32_to_cpup(of_get_property(intc, "xlnx,kind-of-intr", NULL)); + if (intr_mask > (u32)((1ULL << nr_irq) - 1)) printk(KERN_INFO " ERROR: Mismatch in kind-of-intr param\n"); #ifdef CONFIG_SELFMOD_INTC selfmod_function((int *) arr_func, intc_baseaddr); #endif - printk(KERN_INFO "%s #0 at 0x%08x, num_irq=%d, edge=0x%x\n", - intc_list[j], intc_baseaddr, nr_irq, intr_type); + printk(KERN_INFO "XPS intc #0 at 0x%08x, num_irq=%d, edge=0x%x\n", + intc_baseaddr, nr_irq, intr_mask); /* * Disable all external interrupts until they are @@ -155,8 +146,8 @@ void __init init_IRQ(void) /* Turn on the Master Enable. */ out_be32(intc_baseaddr + MER, MER_HIE | MER_ME); - for (i = 0; i < nr_irq; ++i) { - if (intr_type & (0x00000001 << i)) { + for (i = IRQ_OFFSET; i < (nr_irq + IRQ_OFFSET); ++i) { + if (intr_mask & (0x00000001 << (i - IRQ_OFFSET))) { irq_set_chip_and_handler_name(i, &intc_dev, handle_edge_irq, "edge"); irq_clear_status_flags(i, IRQ_LEVEL); @@ -165,5 +156,6 @@ void __init init_IRQ(void) handle_level_irq, "level"); irq_set_status_flags(i, IRQ_LEVEL); } + irq_get_irq_data(i)->hwirq = i - IRQ_OFFSET; } } diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c index e5d63a8..bbebcae 100644 --- a/arch/microblaze/kernel/irq.c +++ b/arch/microblaze/kernel/irq.c @@ -33,11 +33,12 @@ void __irq_entry do_IRQ(struct pt_regs *regs) irq_enter(); irq = get_irq(regs); next_irq: - BUG_ON(irq == -1U); - generic_handle_irq(irq); + BUG_ON(!irq); + /* Substract 1 because of get_irq */ + generic_handle_irq(irq + IRQ_OFFSET - NO_IRQ_OFFSET); irq = get_irq(regs); - if (irq != -1U) { + if (irq) { pr_debug("next irq: %d\n", irq); ++concurrent_irq; goto next_irq; @@ -52,13 +53,13 @@ next_irq: intc without any cascades or any connection that's why mapping is 1:1 */ unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq) { - return hwirq; + return hwirq + IRQ_OFFSET; } EXPORT_SYMBOL_GPL(irq_create_mapping); unsigned int irq_create_of_mapping(struct device_node *controller, const u32 *intspec, unsigned int intsize) { - return intspec[0]; + return intspec[0] + IRQ_OFFSET; } EXPORT_SYMBOL_GPL(irq_create_of_mapping); diff --git a/arch/microblaze/kernel/module.c b/arch/microblaze/kernel/module.c index 142426f..f39257a 100644 --- a/arch/microblaze/kernel/module.c +++ b/arch/microblaze/kernel/module.c @@ -100,7 +100,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, break; case R_MICROBLAZE_64_NONE: - pr_debug("R_MICROBLAZE_NONE\n"); + pr_debug("R_MICROBLAZE_64_NONE\n"); break; case R_MICROBLAZE_NONE: diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c index 0e654a1..604cd9d 100644 --- a/arch/microblaze/kernel/setup.c +++ b/arch/microblaze/kernel/setup.c @@ -145,32 +145,32 @@ void __init machine_early_init(const char *cmdline, unsigned int ram, setup_early_printk(NULL); #endif - eprintk("Ramdisk addr 0x%08x, ", ram); + printk("Ramdisk addr 0x%08x, ", ram); if (fdt) - eprintk("FDT at 0x%08x\n", fdt); + printk("FDT at 0x%08x\n", fdt); else - eprintk("Compiled-in FDT at 0x%08x\n", + printk("Compiled-in FDT at 0x%08x\n", (unsigned int)_fdt_start); #ifdef CONFIG_MTD_UCLINUX - eprintk("Found romfs @ 0x%08x (0x%08x)\n", + printk("Found romfs @ 0x%08x (0x%08x)\n", romfs_base, romfs_size); - eprintk("#### klimit %p ####\n", old_klimit); + printk("#### klimit %p ####\n", old_klimit); BUG_ON(romfs_size < 0); /* What else can we do? */ - eprintk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n", + printk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n", romfs_size, romfs_base, (unsigned)&_ebss); - eprintk("New klimit: 0x%08x\n", (unsigned)klimit); + printk("New klimit: 0x%08x\n", (unsigned)klimit); #endif #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR if (msr) - eprintk("!!!Your kernel has setup MSR instruction but " + printk("!!!Your kernel has setup MSR instruction but " "CPU don't have it %x\n", msr); #else if (!msr) - eprintk("!!!Your kernel not setup MSR instruction but " + printk("!!!Your kernel not setup MSR instruction but " "CPU have it %x\n", msr); #endif diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S index 8789daa..6a2b294 100644 --- a/arch/microblaze/kernel/syscall_table.S +++ b/arch/microblaze/kernel/syscall_table.S @@ -380,3 +380,6 @@ ENTRY(sys_call_table) .long sys_clock_adjtime .long sys_syncfs .long sys_setns /* 375 */ + .long sys_sendmmsg + .long sys_process_vm_readv + .long sys_process_vm_writev diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index af74b11..3cb0bf6 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c @@ -243,7 +243,7 @@ static int timer_initialized; void __init time_init(void) { - u32 irq, i = 0; + u32 irq; u32 timer_num = 1; struct device_node *timer = NULL; const void *prop; @@ -258,33 +258,24 @@ void __init time_init(void) 0 }; #endif - const char * const timer_list[] = { - "xlnx,xps-timer-1.00.a", - NULL - }; - - for (i = 0; timer_list[i] != NULL; i++) { - timer = of_find_compatible_node(NULL, NULL, timer_list[i]); - if (timer) - break; - } + timer = of_find_compatible_node(NULL, NULL, "xlnx,xps-timer-1.00.a"); BUG_ON(!timer); timer_baseaddr = be32_to_cpup(of_get_property(timer, "reg", NULL)); timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE); - irq = be32_to_cpup(of_get_property(timer, "interrupts", NULL)); + irq = irq_of_parse_and_map(timer, 0); timer_num = be32_to_cpup(of_get_property(timer, "xlnx,one-timer-only", NULL)); if (timer_num) { - eprintk(KERN_EMERG "Please enable two timers in HW\n"); + printk(KERN_EMERG "Please enable two timers in HW\n"); BUG(); } #ifdef CONFIG_SELFMOD_TIMER selfmod_function((int *) arr_func, timer_baseaddr); #endif - printk(KERN_INFO "%s #0 at 0x%08x, irq=%d\n", - timer_list[i], timer_baseaddr, irq); + printk(KERN_INFO "XPS timer #0 at 0x%08x, irq=%d\n", + timer_baseaddr, irq); /* If there is clock-frequency property than use it */ prop = of_get_property(timer, "clock-frequency", NULL); diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile index c13067b..844960e 100644 --- a/arch/microblaze/lib/Makefile +++ b/arch/microblaze/lib/Makefile @@ -20,6 +20,7 @@ lib-y += uaccess_old.o lib-y += ashldi3.o lib-y += ashrdi3.o +lib-y += cmpdi2.o lib-y += divsi3.o lib-y += lshrdi3.o lib-y += modsi3.o diff --git a/arch/microblaze/lib/cmpdi2.c b/arch/microblaze/lib/cmpdi2.c new file mode 100644 index 0000000..a708400 --- /dev/null +++ b/arch/microblaze/lib/cmpdi2.c @@ -0,0 +1,26 @@ +#include <linux/module.h> + +#include "libgcc.h" + +word_type __cmpdi2(long long a, long long b) +{ + const DWunion au = { + .ll = a + }; + const DWunion bu = { + .ll = b + }; + + if (au.s.high < bu.s.high) + return 0; + else if (au.s.high > bu.s.high) + return 2; + + if ((unsigned int) au.s.low < (unsigned int) bu.s.low) + return 0; + else if ((unsigned int) au.s.low > (unsigned int) bu.s.low) + return 2; + + return 1; +} +EXPORT_SYMBOL(__cmpdi2); diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index db841c7..0d71b2e 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c @@ -242,7 +242,7 @@ int pci_read_irq_line(struct pci_dev *pci_dev) line, pin); virq = irq_create_mapping(NULL, line); - if (virq != NO_IRQ) + if (virq) irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); } else { pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", @@ -253,7 +253,7 @@ int pci_read_irq_line(struct pci_dev *pci_dev) virq = irq_create_of_mapping(oirq.controller, oirq.specifier, oirq.size); } - if (virq == NO_IRQ) { + if (!virq) { pr_debug(" Failed to map !\n"); return -1; } |