Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6:
sh: Fix stacktrace simplification fallout.
sh: SH7760 DMABRG support.
sh: clockevent/clocksource/hrtimers/nohz TMU support.
sh: Truncate MAX_ACTIVE_REGIONS for the common case.
rtc: rtc-sh: Fix rtc_dev pointer for rtc_update_irq().
sh: Convert to common die chain.
sh: Wire up utimensat syscall.
sh: landisk mv_nr_irqs definition.
sh: Fixup ndelay() xloops calculation for alternate HZ.
sh: Add 32-bit opcode feature CPU flag.
sh: Fix PC adjustments for varying opcode length.
sh: Support for SH-2A 32-bit opcodes.
sh: Kill off redundant __div64_32 symbol export.
sh: Share exception vector table for SH-3/4.
sh: Always define TRAPA_BUG_OPCODE.
sh: __GFP_REPEAT for pte allocations, too.
rtc: rtc-sh: Fix up dev_dbg() warnings.
sh: generic quicklist support.

+586 -412
+7 -22
arch/sh/Kconfig
··· 52 52 config GENERIC_TIME 53 53 def_bool n 54 54 55 + config GENERIC_CLOCKEVENTS 56 + def_bool n 57 + 55 58 config SYS_SUPPORTS_APM_EMULATION 56 59 bool 57 60 ··· 439 436 440 437 menu "Timer and clock configuration" 441 438 442 - if !GENERIC_TIME 443 - 444 439 config SH_TMU 445 440 bool "TMU timer support" 446 441 depends on CPU_SH3 || CPU_SH4 442 + select GENERIC_TIME 443 + select GENERIC_CLOCKEVENTS 447 444 default y 448 445 help 449 446 This enables the use of the TMU as the system timer. ··· 462 459 help 463 460 This enables the use of the MTU2 as the system timer. 464 461 465 - endif 466 - 467 462 config SH_TIMER_IRQ 468 463 int 469 464 default "28" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785 470 465 default "86" if CPU_SUBTYPE_SH7619 471 466 default "140" if CPU_SUBTYPE_SH7206 472 467 default "16" 473 - 474 - config NO_IDLE_HZ 475 - bool "Dynamic tick timer" 476 - help 477 - Select this option if you want to disable continuous timer ticks 478 - and have them programmed to occur as required. This option saves 479 - power as the system can remain in idle state for longer. 480 - 481 - By default dynamic tick is disabled during the boot, and can be 482 - manually enabled with: 483 - 484 - echo 1 > /sys/devices/system/timer/timer0/dyn_tick 485 - 486 - Alternatively, if you want dynamic tick automatically enabled 487 - during boot, pass "dyntick=enable" via the kernel command string. 488 - 489 - Please note that dynamic tick may affect the accuracy of 490 - timekeeping on some platforms depending on the implementation. 491 468 492 469 config SH_PCLK_FREQ 493 470 int "Peripheral clock frequency (in Hz)" ··· 491 508 depends on CPU_SUBTYPE_SH7619 || CPU_SUBTYPE_SH7206 492 509 help 493 510 MD2 - MD0 pin setting. 511 + 512 + source "kernel/time/Kconfig" 494 513 495 514 endmenu 496 515
+1
arch/sh/boards/landisk/setup.c
··· 93 93 */ 94 94 struct sh_machine_vector mv_landisk __initmv = { 95 95 .mv_name = "LANDISK", 96 + .mv_nr_irqs = 72, 96 97 .mv_setup = landisk_setup, 97 98 .mv_init_irq = init_landisk_IRQ, 98 99 };
+2 -1
arch/sh/drivers/Makefile
··· 2 2 # Makefile for the Linux SuperH-specific device drivers. 3 3 # 4 4 5 + obj-y += dma/ 6 + 5 7 obj-$(CONFIG_PCI) += pci/ 6 - obj-$(CONFIG_SH_DMA) += dma/ 7 8 obj-$(CONFIG_SUPERHYWAY) += superhyway/ 8 9 obj-$(CONFIG_PUSH_SWITCH) += push-switch.o 9 10 obj-$(CONFIG_HEARTBEAT) += heartbeat.o
+14 -6
arch/sh/drivers/dma/Kconfig
··· 1 1 menu "DMA support" 2 2 3 - config SH_DMA 4 - bool "DMA controller (DMAC) support" 5 - help 6 - Selecting this option will provide same API as PC's Direct Memory 7 - Access Controller(8237A) for SuperH DMAC. 3 + config SH_DMA_API 4 + bool 8 5 9 - If unsure, say N. 6 + config SH_DMA 7 + bool "SuperH on-chip DMA controller (DMAC) support" 8 + select SH_DMA_API 9 + default n 10 10 11 11 config NR_ONCHIP_DMA_CHANNELS 12 12 depends on SH_DMA ··· 52 52 This allows the specification of the dual address dma channel, 53 53 in case channel 3 is unavailable. On the SH4, channels 1,2, and 3 54 54 are dual-address capable. 55 + 56 + config SH_DMABRG 57 + bool "SH7760 DMABRG support" 58 + depends on CPU_SUBTYPE_SH7760 59 + help 60 + The DMABRG does data transfers from main memory to Audio/USB units 61 + of the SH7760. 62 + Say Y if you want to use Audio/USB DMA on your SH7760 board. 55 63 56 64 endmenu
+2 -2
arch/sh/drivers/dma/Makefile
··· 2 2 # Makefile for the SuperH DMA specific kernel interface routines under Linux. 3 3 # 4 4 5 - obj-y += dma-api.o 5 + obj-$(CONFIG_SH_DMA_API) += dma-api.o dma-sysfs.o 6 6 obj-$(CONFIG_ISA_DMA_API) += dma-isa.o 7 - obj-$(CONFIG_SYSFS) += dma-sysfs.o 8 7 obj-$(CONFIG_SH_DMA) += dma-sh.o 9 8 obj-$(CONFIG_SH_DREAMCAST) += dma-pvr2.o dma-g2.o 9 + obj-$(CONFIG_SH_DMABRG) += dmabrg.o
+196
arch/sh/drivers/dma/dmabrg.c
··· 1 + /* 2 + * SH7760 DMABRG IRQ handling 3 + * 4 + * (c) 2007 MSC Vertriebsges.m.b.H, Manuel Lauss <mlau@msc-ge.com> 5 + * licensed under the GPLv2. 6 + * 7 + */ 8 + 9 + #include <linux/interrupt.h> 10 + #include <linux/kernel.h> 11 + #include <asm/dma.h> 12 + #include <asm/dmabrg.h> 13 + #include <asm/io.h> 14 + 15 + /* 16 + * The DMABRG is a special DMA unit within the SH7760. It does transfers 17 + * from USB-SRAM/Audio units to main memory (and also the LCDC; but that 18 + * part is sensibly placed in the LCDC registers and requires no irqs) 19 + * It has 3 IRQ lines which trigger 10 events, and works independently 20 + * from the traditional SH DMAC (although it blocks usage of DMAC 0) 21 + * 22 + * BRGIRQID | component | dir | meaning | source 23 + * ----------------------------------------------------- 24 + * 0 | USB-DMA | ... | xfer done | DMABRGI1 25 + * 1 | USB-UAE | ... | USB addr err.| DMABRGI0 26 + * 2 | HAC0/SSI0 | play| all done | DMABRGI1 27 + * 3 | HAC0/SSI0 | play| half done | DMABRGI2 28 + * 4 | HAC0/SSI0 | rec | all done | DMABRGI1 29 + * 5 | HAC0/SSI0 | rec | half done | DMABRGI2 30 + * 6 | HAC1/SSI1 | play| all done | DMABRGI1 31 + * 7 | HAC1/SSI1 | play| half done | DMABRGI2 32 + * 8 | HAC1/SSI1 | rec | all done | DMABRGI1 33 + * 9 | HAC1/SSI1 | rec | half done | DMABRGI2 34 + * 35 + * all can be enabled/disabled in the DMABRGCR register, 36 + * as well as checked if they occured. 37 + * 38 + * DMABRGI0 services USB DMA Address errors, but it still must be 39 + * enabled/acked in the DMABRGCR register. USB-DMA complete indicator 40 + * is grouped together with the audio buffer end indicators, too bad... 41 + * 42 + * DMABRGCR: Bits 31-24: audio-dma ENABLE flags, 43 + * Bits 23-16: audio-dma STATUS flags, 44 + * Bits 9-8: USB error/xfer ENABLE, 45 + * Bits 1-0: USB error/xfer STATUS. 46 + * Ack an IRQ by writing 0 to the STATUS flag. 47 + * Mask IRQ by writing 0 to ENABLE flag. 48 + * 49 + * Usage is almost like with any other IRQ: 50 + * dmabrg_request_irq(BRGIRQID, handler, data) 51 + * dmabrg_free_irq(BRGIRQID) 52 + * 53 + * handler prototype: void brgirqhandler(void *data) 54 + */ 55 + 56 + #define DMARSRA 0xfe090000 57 + #define DMAOR 0xffa00040 58 + #define DMACHCR0 0xffa0000c 59 + #define DMABRGCR 0xfe3c0000 60 + 61 + #define DMAOR_BRG 0x0000c000 62 + #define DMAOR_DMEN 0x00000001 63 + 64 + #define DMABRGI0 68 65 + #define DMABRGI1 69 66 + #define DMABRGI2 70 67 + 68 + struct dmabrg_handler { 69 + void (*handler)(void *); 70 + void *data; 71 + } *dmabrg_handlers; 72 + 73 + static inline void dmabrg_call_handler(int i) 74 + { 75 + dmabrg_handlers[i].handler(dmabrg_handlers[i].data); 76 + } 77 + 78 + /* 79 + * main DMABRG irq handler. It acks irqs and then 80 + * handles every set and unmasked bit sequentially. 81 + * No locking and no validity checks; it should be 82 + * as fast as possible (audio!) 83 + */ 84 + static irqreturn_t dmabrg_irq(int irq, void *data) 85 + { 86 + unsigned long dcr; 87 + unsigned int i; 88 + 89 + dcr = ctrl_inl(DMABRGCR); 90 + ctrl_outl(dcr & ~0x00ff0003, DMABRGCR); /* ack all */ 91 + dcr &= dcr >> 8; /* ignore masked */ 92 + 93 + /* USB stuff, get it out of the way first */ 94 + if (dcr & 1) 95 + dmabrg_call_handler(DMABRGIRQ_USBDMA); 96 + if (dcr & 2) 97 + dmabrg_call_handler(DMABRGIRQ_USBDMAERR); 98 + 99 + /* Audio */ 100 + dcr >>= 16; 101 + while (dcr) { 102 + i = __ffs(dcr); 103 + dcr &= dcr - 1; 104 + dmabrg_call_handler(i + DMABRGIRQ_A0TXF); 105 + } 106 + return IRQ_HANDLED; 107 + } 108 + 109 + static void dmabrg_disable_irq(unsigned int dmairq) 110 + { 111 + unsigned long dcr; 112 + dcr = ctrl_inl(DMABRGCR); 113 + dcr &= ~(1 << ((dmairq > 1) ? dmairq + 22 : dmairq + 8)); 114 + ctrl_outl(dcr, DMABRGCR); 115 + } 116 + 117 + static void dmabrg_enable_irq(unsigned int dmairq) 118 + { 119 + unsigned long dcr; 120 + dcr = ctrl_inl(DMABRGCR); 121 + dcr |= (1 << ((dmairq > 1) ? dmairq + 22 : dmairq + 8)); 122 + ctrl_outl(dcr, DMABRGCR); 123 + } 124 + 125 + int dmabrg_request_irq(unsigned int dmairq, void(*handler)(void*), 126 + void *data) 127 + { 128 + if ((dmairq > 9) || !handler) 129 + return -ENOENT; 130 + if (dmabrg_handlers[dmairq].handler) 131 + return -EBUSY; 132 + 133 + dmabrg_handlers[dmairq].handler = handler; 134 + dmabrg_handlers[dmairq].data = data; 135 + 136 + dmabrg_enable_irq(dmairq); 137 + return 0; 138 + } 139 + EXPORT_SYMBOL_GPL(dmabrg_request_irq); 140 + 141 + void dmabrg_free_irq(unsigned int dmairq) 142 + { 143 + if (likely(dmairq < 10)) { 144 + dmabrg_disable_irq(dmairq); 145 + dmabrg_handlers[dmairq].handler = NULL; 146 + dmabrg_handlers[dmairq].data = NULL; 147 + } 148 + } 149 + EXPORT_SYMBOL_GPL(dmabrg_free_irq); 150 + 151 + static int __init dmabrg_init(void) 152 + { 153 + unsigned long or; 154 + int ret; 155 + 156 + dmabrg_handlers = kzalloc(10 * sizeof(struct dmabrg_handler), 157 + GFP_KERNEL); 158 + if (!dmabrg_handlers) 159 + return -ENOMEM; 160 + 161 + #ifdef CONFIG_SH_DMA 162 + /* request DMAC channel 0 before anyone else can get it */ 163 + ret = request_dma(0, "DMAC 0 (DMABRG)"); 164 + if (ret < 0) 165 + printk(KERN_INFO "DMABRG: DMAC ch0 not reserved!\n"); 166 + #endif 167 + 168 + ctrl_outl(0, DMABRGCR); 169 + ctrl_outl(0, DMACHCR0); 170 + ctrl_outl(0x94000000, DMARSRA); /* enable DMABRG in DMAC 0 */ 171 + 172 + /* enable DMABRG mode, enable the DMAC */ 173 + or = ctrl_inl(DMAOR); 174 + ctrl_outl(or | DMAOR_BRG | DMAOR_DMEN, DMAOR); 175 + 176 + ret = request_irq(DMABRGI0, dmabrg_irq, IRQF_DISABLED, 177 + "DMABRG USB address error", NULL); 178 + if (ret) 179 + goto out0; 180 + 181 + ret = request_irq(DMABRGI1, dmabrg_irq, IRQF_DISABLED, 182 + "DMABRG Transfer End", NULL); 183 + if (ret) 184 + goto out1; 185 + 186 + ret = request_irq(DMABRGI2, dmabrg_irq, IRQF_DISABLED, 187 + "DMABRG Transfer Half", NULL); 188 + if (ret == 0) 189 + return ret; 190 + 191 + free_irq(DMABRGI1, 0); 192 + out1: free_irq(DMABRGI0, 0); 193 + out0: kfree(dmabrg_handlers); 194 + return ret; 195 + } 196 + subsys_initcall(dmabrg_init);
+2 -3
arch/sh/kernel/cpu/sh2a/Makefile
··· 2 2 # Makefile for the Linux/SuperH SH-2A backends. 3 3 # 4 4 5 - obj-y := common.o probe.o 5 + obj-y := common.o probe.o opcode_helper.o 6 6 7 - common-y += $(addprefix ../sh2/, ex.o) 8 - common-y += $(addprefix ../sh2/, entry.o) 7 + common-y += $(addprefix ../sh2/, ex.o entry.o) 9 8 10 9 obj-$(CONFIG_CPU_SUBTYPE_SH7206) += setup-sh7206.o clock-sh7206.o
+55
arch/sh/kernel/cpu/sh2a/opcode_helper.c
··· 1 + /* 2 + * arch/sh/kernel/cpu/sh2a/opcode_helper.c 3 + * 4 + * Helper for the SH-2A 32-bit opcodes. 5 + * 6 + * Copyright (C) 2007 Paul Mundt 7 + * 8 + * This file is subject to the terms and conditions of the GNU General Public 9 + * License. See the file "COPYING" in the main directory of this archive 10 + * for more details. 11 + */ 12 + #include <linux/kernel.h> 13 + #include <asm/system.h> 14 + 15 + /* 16 + * Instructions on SH are generally fixed at 16-bits, however, SH-2A 17 + * introduces some 32-bit instructions. Since there are no real 18 + * constraints on their use (and they can be mixed and matched), we need 19 + * to check the instruction encoding to work out if it's a true 32-bit 20 + * instruction or not. 21 + * 22 + * Presently, 32-bit opcodes have only slight variations in what the 23 + * actual encoding looks like in the first-half of the instruction, which 24 + * makes it fairly straightforward to differentiate from the 16-bit ones. 25 + * 26 + * First 16-bits of encoding Used by 27 + * 28 + * 0011nnnnmmmm0001 mov.b, mov.w, mov.l, fmov.d, 29 + * fmov.s, movu.b, movu.w 30 + * 31 + * 0011nnnn0iii1001 bclr.b, bld.b, bset.b, bst.b, band.b, 32 + * bandnot.b, bldnot.b, bor.b, bornot.b, 33 + * bxor.b 34 + * 35 + * 0000nnnniiii0000 movi20 36 + * 0000nnnniiii0001 movi20s 37 + */ 38 + unsigned int instruction_size(unsigned int insn) 39 + { 40 + /* Look for the common cases */ 41 + switch ((insn & 0xf00f)) { 42 + case 0x0000: /* movi20 */ 43 + case 0x0001: /* movi20s */ 44 + case 0x3001: /* 32-bit mov/fmov/movu variants */ 45 + return 4; 46 + } 47 + 48 + /* And the special cases.. */ 49 + switch ((insn & 0xf08f)) { 50 + case 0x3009: /* 32-bit b*.b bit operations */ 51 + return 4; 52 + } 53 + 54 + return 2; 55 + }
+1
arch/sh/kernel/cpu/sh2a/probe.c
··· 18 18 { 19 19 /* Just SH7206 for now .. */ 20 20 current_cpu_data.type = CPU_SH7206; 21 + current_cpu_data.flags |= CPU_HAS_OP32; 21 22 22 23 current_cpu_data.dcache.ways = 4; 23 24 current_cpu_data.dcache.way_incr = (1 << 11);
+8 -5
arch/sh/kernel/cpu/sh3/ex.S
··· 1 1 /* 2 2 * arch/sh/kernel/cpu/sh3/ex.S 3 3 * 4 - * The SH-3 exception vector table. 4 + * The SH-3 and SH-4 exception vector table. 5 5 6 6 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka 7 7 * Copyright (C) 2003 - 2006 Paul Mundt ··· 9 9 * This file is subject to the terms and conditions of the GNU General Public 10 10 * License. See the file "COPYING" in the main directory of this archive 11 11 * for more details. 12 - * 13 12 */ 14 13 #include <linux/linkage.h> 15 14 ··· 35 36 .long exception_error ! address error load 36 37 .long exception_error ! address error store /* 100 */ 37 38 #endif 38 - .long exception_error ! fpu_exception /* 120 */ 39 - .long exception_error /* 140 */ 39 + #if defined(CONFIG_SH_FPU) 40 + .long do_fpu_error /* 120 */ 41 + #else 42 + .long exception_error /* 120 */ 43 + #endif 44 + .long exception_error /* 140 */ 40 45 .long system_call ! Unconditional Trap /* 160 */ 41 46 .long exception_error ! reserved_instruction (filled by trap_init) /* 180 */ 42 47 .long exception_error ! illegal_slot_instruction (filled by trap_init) /*1A0*/ ··· 58 55 * away offsets can be manually inserted in to their appropriate 59 56 * location via set_exception_table_{evt,vec}(). 60 57 */ 61 - .balign 4096,0,4096 58 + .balign 4096,0,4096
+3 -3
arch/sh/kernel/cpu/sh4/Makefile
··· 2 2 # Makefile for the Linux/SuperH SH-4 backends. 3 3 # 4 4 5 - obj-y := ex.o probe.o common.o 6 - common-y += $(addprefix ../sh3/, entry.o) 5 + obj-y := probe.o common.o 6 + common-y += $(addprefix ../sh3/, entry.o ex.o) 7 7 8 - obj-$(CONFIG_SH_FPU) += fpu.o 8 + obj-$(CONFIG_SH_FPU) += fpu.o 9 9 obj-$(CONFIG_SH_STORE_QUEUES) += sq.o 10 10 11 11 # CPU subtype setup
-62
arch/sh/kernel/cpu/sh4/ex.S
··· 1 - /* 2 - * arch/sh/kernel/cpu/sh4/ex.S 3 - * 4 - * The SH-4 exception vector table. 5 - 6 - * Copyright (C) 1999, 2000, 2002 Niibe Yutaka 7 - * Copyright (C) 2003 - 2006 Paul Mundt 8 - * 9 - * This file is subject to the terms and conditions of the GNU General Public 10 - * License. See the file "COPYING" in the main directory of this archive 11 - * for more details. 12 - * 13 - */ 14 - #include <linux/linkage.h> 15 - 16 - .align 2 17 - .data 18 - 19 - ENTRY(exception_handling_table) 20 - .long exception_error /* 000 */ 21 - .long exception_error 22 - #if defined(CONFIG_MMU) 23 - .long tlb_miss_load /* 040 */ 24 - .long tlb_miss_store 25 - .long initial_page_write 26 - .long tlb_protection_violation_load 27 - .long tlb_protection_violation_store 28 - .long address_error_load 29 - .long address_error_store /* 100 */ 30 - #else 31 - .long exception_error ! tlb miss load /* 040 */ 32 - .long exception_error ! tlb miss store 33 - .long exception_error ! initial page write 34 - .long exception_error ! tlb prot violation load 35 - .long exception_error ! tlb prot violation store 36 - .long exception_error ! address error load 37 - .long exception_error ! address error store /* 100 */ 38 - #endif 39 - #if defined(CONFIG_SH_FPU) 40 - .long do_fpu_error /* 120 */ 41 - #else 42 - .long exception_error /* 120 */ 43 - #endif 44 - .long exception_error /* 140 */ 45 - .long system_call ! Unconditional Trap /* 160 */ 46 - .long exception_error ! reserved_instruction (filled by trap_init) /* 180 */ 47 - .long exception_error ! illegal_slot_instruction (filled by trap_init) /*1A0*/ 48 - ENTRY(nmi_slot) 49 - #if defined (CONFIG_KGDB_NMI) 50 - .long debug_enter /* 1C0 */ ! Allow trap to debugger 51 - #else 52 - .long exception_none /* 1C0 */ ! Not implemented yet 53 - #endif 54 - ENTRY(user_break_point_trap) 55 - .long break_point_trap /* 1E0 */ 56 - 57 - /* 58 - * Pad the remainder of the table out, exceptions residing in far 59 - * away offsets can be manually inserted in to their appropriate 60 - * location via set_exception_table_{evt,vec}(). 61 - */ 62 - .balign 4096,0,4096
+2 -1
arch/sh/kernel/cpu/sh4/fpu.c
··· 16 16 #include <linux/sched.h> 17 17 #include <linux/signal.h> 18 18 #include <asm/processor.h> 19 + #include <asm/system.h> 19 20 #include <asm/io.h> 20 21 21 22 /* The PR (precision) bit in the FP Status Register must be clear when ··· 266 265 nextpc = regs->pr; 267 266 finsn = *(unsigned short *) (regs->pc + 2); 268 267 } else { 269 - nextpc = regs->pc + 2; 268 + nextpc = regs->pc + instruction_size(insn); 270 269 finsn = insn; 271 270 } 272 271
+11 -5
arch/sh/kernel/process.c
··· 15 15 #include <linux/pm.h> 16 16 #include <linux/kallsyms.h> 17 17 #include <linux/kexec.h> 18 - #include <asm/kdebug.h> 18 + #include <linux/kdebug.h> 19 + #include <linux/tick.h> 19 20 #include <asm/uaccess.h> 20 21 #include <asm/mmu_context.h> 22 + #include <asm/pgalloc.h> 23 + #include <asm/system.h> 21 24 #include <asm/ubc.h> 22 25 23 26 static int hlt_counter; ··· 61 58 if (!idle) 62 59 idle = default_idle; 63 60 61 + tick_nohz_stop_sched_tick(); 64 62 while (!need_resched()) 65 63 idle(); 64 + tick_nohz_restart_sched_tick(); 66 65 67 66 preempt_enable_no_resched(); 68 67 schedule(); 69 68 preempt_disable(); 69 + check_pgt_cache(); 70 70 } 71 71 } 72 72 ··· 501 495 struct pt_regs *regs = RELOC_HIDE(&__regs, 0); 502 496 503 497 /* Rewind */ 504 - regs->pc -= 2; 498 + regs->pc -= instruction_size(ctrl_inw(regs->pc - 4)); 505 499 506 - if (notify_die(DIE_TRAP, regs, regs->tra & 0xff, 500 + if (notify_die(DIE_TRAP, "debug trap", regs, 0, regs->tra & 0xff, 507 501 SIGTRAP) == NOTIFY_STOP) 508 502 return; 509 503 ··· 520 514 struct pt_regs *regs = RELOC_HIDE(&__regs, 0); 521 515 522 516 /* Rewind */ 523 - regs->pc -= 2; 517 + regs->pc -= instruction_size(ctrl_inw(regs->pc - 4)); 524 518 525 - if (notify_die(DIE_TRAP, regs, TRAPA_BUG_OPCODE & 0xff, 519 + if (notify_die(DIE_TRAP, "bug trap", regs, 0, TRAPA_BUG_OPCODE & 0xff, 526 520 SIGTRAP) == NOTIFY_STOP) 527 521 return; 528 522
+1 -1
arch/sh/kernel/setup.c
··· 431 431 /* Symbolic CPU flags, keep in sync with asm/cpu-features.h */ 432 432 static const char *cpu_flags[] = { 433 433 "none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr", 434 - "ptea", "llsc", "l2", NULL 434 + "ptea", "llsc", "l2", "op32", NULL 435 435 }; 436 436 437 437 static void show_cpuflags(struct seq_file *m, struct sh_cpuinfo *c)
-2
arch/sh/kernel/sh_ksyms.c
··· 58 58 EXPORT_SYMBOL(__ndelay); 59 59 EXPORT_SYMBOL(__const_udelay); 60 60 61 - EXPORT_SYMBOL(__div64_32); 62 - 63 61 #define DECLARE_EXPORT(name) extern void name(void);EXPORT_SYMBOL(name) 64 62 65 63 /* These symbols are generated by the compiler itself */
+8 -5
arch/sh/kernel/signal.c
··· 23 23 #include <linux/personality.h> 24 24 #include <linux/binfmts.h> 25 25 #include <linux/freezer.h> 26 - 26 + #include <asm/system.h> 27 27 #include <asm/ucontext.h> 28 28 #include <asm/uaccess.h> 29 29 #include <asm/pgtable.h> ··· 500 500 } 501 501 /* fallthrough */ 502 502 case -ERESTARTNOINTR: 503 - regs->pc -= 2; 503 + regs->pc -= instruction_size( 504 + ctrl_inw(regs->pc - 4)); 505 + break; 504 506 } 505 507 } else { 506 508 /* gUSA handling */ ··· 518 516 regs->regs[15] = regs->regs[1]; 519 517 if (regs->pc < regs->regs[0]) 520 518 /* Go to rewind point #1 */ 521 - regs->pc = regs->regs[0] + offset - 2; 519 + regs->pc = regs->regs[0] + offset - 520 + instruction_size(ctrl_inw(regs->pc-4)); 522 521 } 523 522 #ifdef CONFIG_PREEMPT 524 523 local_irq_restore(flags); ··· 603 600 regs->regs[0] == -ERESTARTSYS || 604 601 regs->regs[0] == -ERESTARTNOINTR) { 605 602 regs->regs[0] = save_r0; 606 - regs->pc -= 2; 603 + regs->pc -= instruction_size(ctrl_inw(regs->pc - 4)); 607 604 } else if (regs->regs[0] == -ERESTART_RESTARTBLOCK) { 608 - regs->pc -= 2; 605 + regs->pc -= instruction_size(ctrl_inw(regs->pc - 4)); 609 606 regs->regs[3] = __NR_restart_syscall; 610 607 } 611 608 }
+1 -1
arch/sh/kernel/stacktrace.c
··· 17 17 /* 18 18 * Save stack-backtrace addresses into a stack_trace buffer. 19 19 */ 20 - void save_stack_trace(struct stack_trace *trace, struct task_struct *task) 20 + void save_stack_trace(struct stack_trace *trace) 21 21 { 22 22 unsigned long *sp = (unsigned long *)current_stack_pointer; 23 23
+1
arch/sh/kernel/syscalls.S
··· 354 354 .long sys_move_pages 355 355 .long sys_getcpu 356 356 .long sys_epoll_pwait 357 + .long sys_utimensat /* 320 */
+61 -123
arch/sh/kernel/time.c
··· 3 3 * 4 4 * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka 5 5 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> 6 - * Copyright (C) 2002 - 2006 Paul Mundt 6 + * Copyright (C) 2002 - 2007 Paul Mundt 7 7 * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org> 8 8 * 9 9 * Some code taken from i386 version. ··· 15 15 #include <linux/profile.h> 16 16 #include <linux/timex.h> 17 17 #include <linux/sched.h> 18 + #include <linux/clockchips.h> 18 19 #include <asm/clock.h> 19 20 #include <asm/rtc.h> 20 21 #include <asm/timer.h> ··· 35 34 } 36 35 37 36 static int null_rtc_set_time(const time_t secs) 37 + { 38 + return 0; 39 + } 40 + 41 + /* 42 + * Null high precision timer functions for systems lacking one. 43 + */ 44 + static cycle_t null_hpt_read(void) 38 45 { 39 46 return 0; 40 47 } ··· 110 101 EXPORT_SYMBOL(do_settimeofday); 111 102 #endif /* !CONFIG_GENERIC_TIME */ 112 103 104 + #ifndef CONFIG_GENERIC_CLOCKEVENTS 113 105 /* last time the RTC clock got updated */ 114 106 static long last_rtc_update; 115 107 ··· 148 138 last_rtc_update = xtime.tv_sec - 600; 149 139 } 150 140 } 141 + #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 151 142 152 143 #ifdef CONFIG_PM 153 144 int timer_suspend(struct sys_device *dev, pm_message_t state) ··· 179 168 .resume = timer_resume, 180 169 }; 181 170 182 - #ifdef CONFIG_NO_IDLE_HZ 183 - static int timer_dyn_tick_enable(void) 184 - { 185 - struct dyn_tick_timer *dyn_tick = sys_timer->dyn_tick; 186 - unsigned long flags; 187 - int ret = -ENODEV; 188 - 189 - if (dyn_tick) { 190 - spin_lock_irqsave(&dyn_tick->lock, flags); 191 - ret = 0; 192 - if (!(dyn_tick->state & DYN_TICK_ENABLED)) { 193 - ret = dyn_tick->enable(); 194 - 195 - if (ret == 0) 196 - dyn_tick->state |= DYN_TICK_ENABLED; 197 - } 198 - spin_unlock_irqrestore(&dyn_tick->lock, flags); 199 - } 200 - 201 - return ret; 202 - } 203 - 204 - static int timer_dyn_tick_disable(void) 205 - { 206 - struct dyn_tick_timer *dyn_tick = sys_timer->dyn_tick; 207 - unsigned long flags; 208 - int ret = -ENODEV; 209 - 210 - if (dyn_tick) { 211 - spin_lock_irqsave(&dyn_tick->lock, flags); 212 - ret = 0; 213 - if (dyn_tick->state & DYN_TICK_ENABLED) { 214 - ret = dyn_tick->disable(); 215 - 216 - if (ret == 0) 217 - dyn_tick->state &= ~DYN_TICK_ENABLED; 218 - } 219 - spin_unlock_irqrestore(&dyn_tick->lock, flags); 220 - } 221 - 222 - return ret; 223 - } 224 - 225 - /* 226 - * Reprogram the system timer for at least the calculated time interval. 227 - * This function should be called from the idle thread with IRQs disabled, 228 - * immediately before sleeping. 229 - */ 230 - void timer_dyn_reprogram(void) 231 - { 232 - struct dyn_tick_timer *dyn_tick = sys_timer->dyn_tick; 233 - unsigned long next, seq, flags; 234 - 235 - if (!dyn_tick) 236 - return; 237 - 238 - spin_lock_irqsave(&dyn_tick->lock, flags); 239 - if (dyn_tick->state & DYN_TICK_ENABLED) { 240 - next = next_timer_interrupt(); 241 - do { 242 - seq = read_seqbegin(&xtime_lock); 243 - dyn_tick->reprogram(next - jiffies); 244 - } while (read_seqretry(&xtime_lock, seq)); 245 - } 246 - spin_unlock_irqrestore(&dyn_tick->lock, flags); 247 - } 248 - 249 - static ssize_t timer_show_dyn_tick(struct sys_device *dev, char *buf) 250 - { 251 - return sprintf(buf, "%i\n", 252 - (sys_timer->dyn_tick->state & DYN_TICK_ENABLED) >> 1); 253 - } 254 - 255 - static ssize_t timer_set_dyn_tick(struct sys_device *dev, const char *buf, 256 - size_t count) 257 - { 258 - unsigned int enable = simple_strtoul(buf, NULL, 2); 259 - 260 - if (enable) 261 - timer_dyn_tick_enable(); 262 - else 263 - timer_dyn_tick_disable(); 264 - 265 - return count; 266 - } 267 - static SYSDEV_ATTR(dyn_tick, 0644, timer_show_dyn_tick, timer_set_dyn_tick); 268 - 269 - /* 270 - * dyntick=enable|disable 271 - */ 272 - static char dyntick_str[4] __initdata = ""; 273 - 274 - static int __init dyntick_setup(char *str) 275 - { 276 - if (str) 277 - strlcpy(dyntick_str, str, sizeof(dyntick_str)); 278 - return 1; 279 - } 280 - 281 - __setup("dyntick=", dyntick_setup); 282 - #endif 283 - 284 171 static int __init timer_init_sysfs(void) 285 172 { 286 173 int ret = sysdev_class_register(&timer_sysclass); ··· 186 277 return ret; 187 278 188 279 sys_timer->dev.cls = &timer_sysclass; 189 - ret = sysdev_register(&sys_timer->dev); 190 - 191 - #ifdef CONFIG_NO_IDLE_HZ 192 - if (ret == 0 && sys_timer->dyn_tick) { 193 - ret = sysdev_create_file(&sys_timer->dev, &attr_dyn_tick); 194 - 195 - /* 196 - * Turn on dynamic tick after calibrate delay 197 - * for correct bogomips 198 - */ 199 - if (ret == 0 && dyntick_str[0] == 'e') 200 - ret = timer_dyn_tick_enable(); 201 - } 202 - #endif 203 - 204 - return ret; 280 + return sysdev_register(&sys_timer->dev); 205 281 } 206 282 device_initcall(timer_init_sysfs); 207 283 208 284 void (*board_time_init)(void); 285 + 286 + /* 287 + * Shamelessly based on the MIPS and Sparc64 work. 288 + */ 289 + static unsigned long timer_ticks_per_nsec_quotient __read_mostly; 290 + unsigned long sh_hpt_frequency = 0; 291 + 292 + #define NSEC_PER_CYC_SHIFT 10 293 + 294 + struct clocksource clocksource_sh = { 295 + .name = "SuperH", 296 + .rating = 200, 297 + .mask = CLOCKSOURCE_MASK(32), 298 + .read = null_hpt_read, 299 + .shift = 16, 300 + .flags = CLOCK_SOURCE_IS_CONTINUOUS, 301 + }; 302 + 303 + static void __init init_sh_clocksource(void) 304 + { 305 + if (!sh_hpt_frequency || clocksource_sh.read == null_hpt_read) 306 + return; 307 + 308 + clocksource_sh.mult = clocksource_hz2mult(sh_hpt_frequency, 309 + clocksource_sh.shift); 310 + 311 + timer_ticks_per_nsec_quotient = 312 + clocksource_hz2mult(sh_hpt_frequency, NSEC_PER_CYC_SHIFT); 313 + 314 + clocksource_register(&clocksource_sh); 315 + } 316 + 317 + #ifdef CONFIG_GENERIC_TIME 318 + unsigned long long sched_clock(void) 319 + { 320 + unsigned long long ticks = clocksource_sh.read(); 321 + return (ticks * timer_ticks_per_nsec_quotient) >> NSEC_PER_CYC_SHIFT; 322 + } 323 + #endif 209 324 210 325 void __init time_init(void) 211 326 { ··· 249 316 sys_timer = get_sys_timer(); 250 317 printk(KERN_INFO "Using %s for system timer\n", sys_timer->name); 251 318 252 - #ifdef CONFIG_NO_IDLE_HZ 253 - if (sys_timer->dyn_tick) 254 - spin_lock_init(&sys_timer->dyn_tick->lock); 255 - #endif 319 + if (sys_timer->ops->read) 320 + clocksource_sh.read = sys_timer->ops->read; 321 + 322 + init_sh_clocksource(); 323 + 324 + if (sh_hpt_frequency) 325 + printk("Using %lu.%03lu MHz high precision timer.\n", 326 + ((sh_hpt_frequency + 500) / 1000) / 1000, 327 + ((sh_hpt_frequency + 500) / 1000) % 1000); 256 328 257 329 #if defined(CONFIG_SH_KGDB) 258 330 /*
+117 -81
arch/sh/kernel/timers/timer-tmu.c
··· 1 1 /* 2 2 * arch/sh/kernel/timers/timer-tmu.c - TMU Timer Support 3 3 * 4 - * Copyright (C) 2005 Paul Mundt 4 + * Copyright (C) 2005 - 2007 Paul Mundt 5 5 * 6 6 * TMU handling code hacked out of arch/sh/kernel/time.c 7 7 * ··· 18 18 #include <linux/kernel.h> 19 19 #include <linux/interrupt.h> 20 20 #include <linux/seqlock.h> 21 + #include <linux/clockchips.h> 21 22 #include <asm/timer.h> 22 23 #include <asm/rtc.h> 23 24 #include <asm/io.h> ··· 26 25 #include <asm/clock.h> 27 26 28 27 #define TMU_TOCR_INIT 0x00 29 - #define TMU0_TCR_INIT 0x0020 30 - #define TMU_TSTR_INIT 1 28 + #define TMU_TCR_INIT 0x0020 31 29 32 - #define TMU0_TCR_CALIB 0x0000 33 - 34 - static unsigned long tmu_timer_get_offset(void) 30 + static int tmu_timer_start(void) 35 31 { 36 - int count; 37 - static int count_p = 0x7fffffff; /* for the first call after boot */ 38 - static unsigned long jiffies_p = 0; 39 - 40 - /* 41 - * cache volatile jiffies temporarily; we have IRQs turned off. 42 - */ 43 - unsigned long jiffies_t; 44 - 45 - /* timer count may underflow right here */ 46 - count = ctrl_inl(TMU0_TCNT); /* read the latched count */ 47 - 48 - jiffies_t = jiffies; 49 - 50 - /* 51 - * avoiding timer inconsistencies (they are rare, but they happen)... 52 - * there is one kind of problem that must be avoided here: 53 - * 1. the timer counter underflows 54 - */ 55 - 56 - if (jiffies_t == jiffies_p) { 57 - if (count > count_p) { 58 - /* the nutcase */ 59 - if (ctrl_inw(TMU0_TCR) & 0x100) { /* Check UNF bit */ 60 - count -= LATCH; 61 - } else { 62 - printk("%s (): hardware timer problem?\n", 63 - __FUNCTION__); 64 - } 65 - } 66 - } else 67 - jiffies_p = jiffies_t; 68 - 69 - count_p = count; 70 - 71 - count = ((LATCH-1) - count) * TICK_SIZE; 72 - count = (count + LATCH/2) / LATCH; 73 - 74 - return count; 32 + ctrl_outb(ctrl_inb(TMU_TSTR) | 0x3, TMU_TSTR); 33 + return 0; 75 34 } 35 + 36 + static void tmu0_timer_set_interval(unsigned long interval, unsigned int reload) 37 + { 38 + ctrl_outl(interval, TMU0_TCNT); 39 + 40 + /* 41 + * TCNT reloads from TCOR on underflow, clear it if we don't 42 + * intend to auto-reload 43 + */ 44 + if (reload) 45 + ctrl_outl(interval, TMU0_TCOR); 46 + else 47 + ctrl_outl(0, TMU0_TCOR); 48 + 49 + tmu_timer_start(); 50 + } 51 + 52 + static int tmu_timer_stop(void) 53 + { 54 + ctrl_outb(ctrl_inb(TMU_TSTR) & ~0x3, TMU_TSTR); 55 + return 0; 56 + } 57 + 58 + static cycle_t tmu_timer_read(void) 59 + { 60 + return ~ctrl_inl(TMU1_TCNT); 61 + } 62 + 63 + static int tmu_set_next_event(unsigned long cycles, 64 + struct clock_event_device *evt) 65 + { 66 + tmu0_timer_set_interval(cycles, 1); 67 + return 0; 68 + } 69 + 70 + static void tmu_set_mode(enum clock_event_mode mode, 71 + struct clock_event_device *evt) 72 + { 73 + switch (mode) { 74 + case CLOCK_EVT_MODE_PERIODIC: 75 + ctrl_outl(ctrl_inl(TMU0_TCNT), TMU0_TCOR); 76 + break; 77 + case CLOCK_EVT_MODE_ONESHOT: 78 + ctrl_outl(0, TMU0_TCOR); 79 + break; 80 + case CLOCK_EVT_MODE_UNUSED: 81 + case CLOCK_EVT_MODE_SHUTDOWN: 82 + break; 83 + } 84 + } 85 + 86 + static struct clock_event_device tmu0_clockevent = { 87 + .name = "tmu0", 88 + .shift = 32, 89 + .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 90 + .set_mode = tmu_set_mode, 91 + .set_next_event = tmu_set_next_event, 92 + }; 76 93 77 94 static irqreturn_t tmu_timer_interrupt(int irq, void *dummy) 78 95 { 96 + struct clock_event_device *evt = &tmu0_clockevent; 79 97 unsigned long timer_status; 80 98 81 99 /* Clear UNF bit */ ··· 102 82 timer_status &= ~0x100; 103 83 ctrl_outw(timer_status, TMU0_TCR); 104 84 105 - /* 106 - * Here we are in the timer irq handler. We just have irqs locally 107 - * disabled but we don't know if the timer_bh is running on the other 108 - * CPU. We need to avoid to SMP race with it. NOTE: we don' t need 109 - * the irq version of write_lock because as just said we have irq 110 - * locally disabled. -arca 111 - */ 112 - write_seqlock(&xtime_lock); 113 - handle_timer_tick(); 114 - write_sequnlock(&xtime_lock); 85 + evt->event_handler(evt); 115 86 116 87 return IRQ_HANDLED; 117 88 } 118 89 119 - static struct irqaction tmu_irq = { 120 - .name = "timer", 90 + static struct irqaction tmu0_irq = { 91 + .name = "periodic timer", 121 92 .handler = tmu_timer_interrupt, 122 93 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 123 94 .mask = CPU_MASK_NONE, 124 95 }; 125 96 126 - static void tmu_clk_init(struct clk *clk) 97 + static void tmu0_clk_init(struct clk *clk) 127 98 { 128 - u8 divisor = TMU0_TCR_INIT & 0x7; 129 - ctrl_outw(TMU0_TCR_INIT, TMU0_TCR); 99 + u8 divisor = TMU_TCR_INIT & 0x7; 100 + ctrl_outw(TMU_TCR_INIT, TMU0_TCR); 130 101 clk->rate = clk->parent->rate / (4 << (divisor << 1)); 131 102 } 132 103 133 - static void tmu_clk_recalc(struct clk *clk) 104 + static void tmu0_clk_recalc(struct clk *clk) 134 105 { 135 106 u8 divisor = ctrl_inw(TMU0_TCR) & 0x7; 136 107 clk->rate = clk->parent->rate / (4 << (divisor << 1)); 137 108 } 138 109 139 - static struct clk_ops tmu_clk_ops = { 140 - .init = tmu_clk_init, 141 - .recalc = tmu_clk_recalc, 110 + static struct clk_ops tmu0_clk_ops = { 111 + .init = tmu0_clk_init, 112 + .recalc = tmu0_clk_recalc, 142 113 }; 143 114 144 115 static struct clk tmu0_clk = { 145 116 .name = "tmu0_clk", 146 - .ops = &tmu_clk_ops, 117 + .ops = &tmu0_clk_ops, 147 118 }; 148 119 149 - static int tmu_timer_start(void) 120 + static void tmu1_clk_init(struct clk *clk) 150 121 { 151 - ctrl_outb(TMU_TSTR_INIT, TMU_TSTR); 152 - return 0; 122 + u8 divisor = TMU_TCR_INIT & 0x7; 123 + ctrl_outw(divisor, TMU1_TCR); 124 + clk->rate = clk->parent->rate / (4 << (divisor << 1)); 153 125 } 154 126 155 - static int tmu_timer_stop(void) 127 + static void tmu1_clk_recalc(struct clk *clk) 156 128 { 157 - ctrl_outb(0, TMU_TSTR); 158 - return 0; 129 + u8 divisor = ctrl_inw(TMU1_TCR) & 0x7; 130 + clk->rate = clk->parent->rate / (4 << (divisor << 1)); 159 131 } 132 + 133 + static struct clk_ops tmu1_clk_ops = { 134 + .init = tmu1_clk_init, 135 + .recalc = tmu1_clk_recalc, 136 + }; 137 + 138 + static struct clk tmu1_clk = { 139 + .name = "tmu1_clk", 140 + .ops = &tmu1_clk_ops, 141 + }; 160 142 161 143 static int tmu_timer_init(void) 162 144 { 163 145 unsigned long interval; 146 + unsigned long frequency; 164 147 165 - setup_irq(CONFIG_SH_TIMER_IRQ, &tmu_irq); 148 + setup_irq(CONFIG_SH_TIMER_IRQ, &tmu0_irq); 166 149 167 150 tmu0_clk.parent = clk_get(NULL, "module_clk"); 151 + tmu1_clk.parent = clk_get(NULL, "module_clk"); 168 152 169 - /* Start TMU0 */ 170 153 tmu_timer_stop(); 154 + 171 155 #if !defined(CONFIG_CPU_SUBTYPE_SH7300) && \ 172 156 !defined(CONFIG_CPU_SUBTYPE_SH7760) && \ 173 157 !defined(CONFIG_CPU_SUBTYPE_SH7785) ··· 179 155 #endif 180 156 181 157 clk_register(&tmu0_clk); 158 + clk_register(&tmu1_clk); 182 159 clk_enable(&tmu0_clk); 160 + clk_enable(&tmu1_clk); 183 161 184 - interval = (clk_get_rate(&tmu0_clk) + HZ / 2) / HZ; 185 - printk(KERN_INFO "Interval = %ld\n", interval); 162 + frequency = clk_get_rate(&tmu0_clk); 163 + interval = (frequency + HZ / 2) / HZ; 186 164 187 - ctrl_outl(interval, TMU0_TCOR); 188 - ctrl_outl(interval, TMU0_TCNT); 165 + sh_hpt_frequency = clk_get_rate(&tmu1_clk); 166 + ctrl_outl(~0, TMU1_TCNT); 167 + ctrl_outl(~0, TMU1_TCOR); 189 168 190 - tmu_timer_start(); 169 + tmu0_timer_set_interval(interval, 1); 170 + 171 + tmu0_clockevent.mult = div_sc(frequency, NSEC_PER_SEC, 172 + tmu0_clockevent.shift); 173 + tmu0_clockevent.max_delta_ns = 174 + clockevent_delta2ns(-1, &tmu0_clockevent); 175 + tmu0_clockevent.min_delta_ns = 176 + clockevent_delta2ns(1, &tmu0_clockevent); 177 + 178 + tmu0_clockevent.cpumask = cpumask_of_cpu(0); 179 + 180 + clockevents_register_device(&tmu0_clockevent); 191 181 192 182 return 0; 193 183 } ··· 210 172 .init = tmu_timer_init, 211 173 .start = tmu_timer_start, 212 174 .stop = tmu_timer_stop, 213 - #ifndef CONFIG_GENERIC_TIME 214 - .get_offset = tmu_timer_get_offset, 215 - #endif 175 + .read = tmu_timer_read, 216 176 }; 217 177 218 178 struct sys_timer tmu_timer = {
+3 -17
arch/sh/kernel/traps.c
··· 20 20 #include <linux/io.h> 21 21 #include <linux/bug.h> 22 22 #include <linux/debug_locks.h> 23 + #include <linux/kdebug.h> 23 24 #include <linux/limits.h> 24 25 #include <asm/system.h> 25 26 #include <asm/uaccess.h> 26 - #include <asm/kdebug.h> 27 27 28 28 #ifdef CONFIG_SH_KGDB 29 29 #include <asm/kgdb.h> ··· 75 75 printk("\n"); 76 76 } 77 77 } 78 - 79 - ATOMIC_NOTIFIER_HEAD(shdie_chain); 80 - 81 - int register_die_notifier(struct notifier_block *nb) 82 - { 83 - return atomic_notifier_chain_register(&shdie_chain, nb); 84 - } 85 - EXPORT_SYMBOL(register_die_notifier); 86 - 87 - int unregister_die_notifier(struct notifier_block *nb) 88 - { 89 - return atomic_notifier_chain_unregister(&shdie_chain, nb); 90 - } 91 - EXPORT_SYMBOL(unregister_die_notifier); 92 78 93 79 static DEFINE_SPINLOCK(die_lock); 94 80 ··· 491 505 simple: 492 506 ret = handle_unaligned_ins(instruction,regs); 493 507 if (ret==0) 494 - regs->pc += 2; 508 + regs->pc += instruction_size(instruction); 495 509 return ret; 496 510 } 497 511 #endif /* CONFIG_CPU_SH2A */ ··· 668 682 669 683 err = do_fpu_inst(inst, regs); 670 684 if (!err) { 671 - regs->pc += 2; 685 + regs->pc += instruction_size(inst); 672 686 return; 673 687 } 674 688 /* not a FPU inst. */
+3 -2
arch/sh/lib/delay.c
··· 24 24 __asm__("dmulu.l %0, %2\n\t" 25 25 "sts mach, %0" 26 26 : "=r" (xloops) 27 - : "0" (xloops), "r" (cpu_data[raw_smp_processor_id()].loops_per_jiffy) 27 + : "0" (xloops), 28 + "r" (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy) 28 29 : "macl", "mach"); 29 - __delay(xloops * HZ); 30 + __delay(xloops); 30 31 } 31 32 32 33 void __udelay(unsigned long usecs)
+7
arch/sh/mm/Kconfig
··· 218 218 219 219 menu "Memory management options" 220 220 221 + config QUICKLIST 222 + def_bool y 223 + 221 224 config MMU 222 225 bool "Support for memory management hardware" 223 226 depends on !CPU_SH2 ··· 302 299 303 300 config ARCH_FLATMEM_ENABLE 304 301 def_bool y 302 + 303 + config MAX_ACTIVE_REGIONS 304 + int 305 + default "1" 305 306 306 307 config ARCH_POPULATES_NODE_MAP 307 308 def_bool y
+1 -1
arch/sh/mm/fault.c
··· 15 15 #include <linux/mm.h> 16 16 #include <linux/hardirq.h> 17 17 #include <linux/kprobes.h> 18 - #include <asm/kdebug.h> 18 + #include <linux/kdebug.h> 19 19 #include <asm/system.h> 20 20 #include <asm/mmu_context.h> 21 21 #include <asm/tlbflush.h>
+2
arch/sh/mm/init.c
··· 67 67 printk("%d slab pages\n", slab); 68 68 printk("%d pages shared\n", shared); 69 69 printk("%d pages swap cached\n", cached); 70 + printk(KERN_INFO "Total of %ld pages in page table cache\n", 71 + quicklist_total_size()); 70 72 } 71 73 72 74 #ifdef CONFIG_MMU
+4 -4
drivers/rtc/rtc-sh.c
··· 104 104 105 105 writeb(tmp, rtc->regbase + RCR1); 106 106 107 - rtc_update_irq(&rtc->rtc_dev, 1, events); 107 + rtc_update_irq(rtc->rtc_dev, 1, events); 108 108 109 109 spin_unlock(&rtc->lock); 110 110 ··· 139 139 140 140 rtc->rearm_aie = 1; 141 141 142 - rtc_update_irq(&rtc->rtc_dev, 1, events); 142 + rtc_update_irq(rtc->rtc_dev, 1, events); 143 143 } 144 144 145 145 spin_unlock(&rtc->lock); ··· 153 153 154 154 spin_lock(&rtc->lock); 155 155 156 - rtc_update_irq(&rtc->rtc_dev, 1, RTC_PF | RTC_IRQF); 156 + rtc_update_irq(rtc->rtc_dev, 1, RTC_PF | RTC_IRQF); 157 157 158 158 spin_unlock(&rtc->lock); 159 159 ··· 341 341 tm->tm_sec--; 342 342 #endif 343 343 344 - dev_dbg(&dev, "%s: tm is secs=%d, mins=%d, hours=%d, " 344 + dev_dbg(dev, "%s: tm is secs=%d, mins=%d, hours=%d, " 345 345 "mday=%d, mon=%d, year=%d, wday=%d\n", 346 346 __FUNCTION__, 347 347 tm->tm_sec, tm->tm_min, tm->tm_hour,
+2 -2
include/asm-sh/bug.h
··· 1 1 #ifndef __ASM_SH_BUG_H 2 2 #define __ASM_SH_BUG_H 3 3 4 + #define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ 5 + 4 6 #ifdef CONFIG_BUG 5 7 #define HAVE_ARCH_BUG 6 8 #define HAVE_ARCH_WARN_ON 7 - 8 - #define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ 9 9 10 10 /** 11 11 * _EMIT_BUG_ENTRY
+1
include/asm-sh/cpu-features.h
··· 20 20 #define CPU_HAS_PTEA 0x0020 /* PTEA register */ 21 21 #define CPU_HAS_LLSC 0x0040 /* movli.l/movco.l */ 22 22 #define CPU_HAS_L2_CACHE 0x0080 /* Secondary cache / URAM */ 23 + #define CPU_HAS_OP32 0x0100 /* 32-bit instruction support */ 23 24 24 25 #endif /* __ASM_SH_CPU_FEATURES_H */
+23
include/asm-sh/dmabrg.h
··· 1 + /* 2 + * SH7760 DMABRG (USB/Audio) support 3 + */ 4 + 5 + #ifndef _DMABRG_H_ 6 + #define _DMABRG_H_ 7 + 8 + /* IRQ sources */ 9 + #define DMABRGIRQ_USBDMA 0 10 + #define DMABRGIRQ_USBDMAERR 1 11 + #define DMABRGIRQ_A0TXF 2 12 + #define DMABRGIRQ_A0TXH 3 13 + #define DMABRGIRQ_A0RXF 4 14 + #define DMABRGIRQ_A0RXH 5 15 + #define DMABRGIRQ_A1TXF 6 16 + #define DMABRGIRQ_A1TXH 7 17 + #define DMABRGIRQ_A1RXF 8 18 + #define DMABRGIRQ_A1RXH 9 19 + 20 + extern int dmabrg_request_irq(unsigned int, void(*)(void *), void *); 21 + extern void dmabrg_free_irq(unsigned int); 22 + 23 + #endif
+2 -23
include/asm-sh/kdebug.h
··· 2 2 #define __ASM_SH_KDEBUG_H 3 3 4 4 #include <linux/notifier.h> 5 - #include <asm-generic/kdebug.h> 6 - 7 - struct pt_regs; 8 - 9 - struct die_args { 10 - struct pt_regs *regs; 11 - int trapnr; 12 - }; 13 - 14 - int register_die_notifier(struct notifier_block *nb); 15 - int unregister_die_notifier(struct notifier_block *nb); 16 - int register_page_fault_notifier(struct notifier_block *nb); 17 - int unregister_page_fault_notifier(struct notifier_block *nb); 18 - extern struct atomic_notifier_head shdie_chain; 19 5 20 6 /* Grossly misnamed. */ 21 7 enum die_val { ··· 9 23 DIE_PAGE_FAULT, 10 24 }; 11 25 12 - static inline int notify_die(enum die_val val, struct pt_regs *regs, 13 - int trap, int sig) 14 - { 15 - struct die_args args = { 16 - .regs = regs, 17 - .trapnr = trap, 18 - }; 26 + int register_page_fault_notifier(struct notifier_block *nb); 27 + int unregister_page_fault_notifier(struct notifier_block *nb); 19 28 20 - return atomic_notifier_call_chain(&shdie_chain, val, &args); 21 - } 22 29 #endif /* __ASM_SH_KDEBUG_H */
+28 -16
include/asm-sh/pgalloc.h
··· 1 1 #ifndef __ASM_SH_PGALLOC_H 2 2 #define __ASM_SH_PGALLOC_H 3 3 4 + #include <linux/quicklist.h> 5 + #include <asm/page.h> 6 + 7 + #define QUICK_PGD 0 /* We preserve special mappings over free */ 8 + #define QUICK_PT 1 /* Other page table pages that are zero on free */ 9 + 4 10 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, 5 11 pte_t *pte) 6 12 { ··· 19 13 set_pmd(pmd, __pmd((unsigned long)page_address(pte))); 20 14 } 21 15 16 + static inline void pgd_ctor(void *x) 17 + { 18 + pgd_t *pgd = x; 19 + 20 + memcpy(pgd + USER_PTRS_PER_PGD, 21 + swapper_pg_dir + USER_PTRS_PER_PGD, 22 + (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); 23 + } 24 + 22 25 /* 23 26 * Allocate and free page tables. 24 27 */ 25 28 static inline pgd_t *pgd_alloc(struct mm_struct *mm) 26 29 { 27 - pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT); 28 - 29 - if (pgd) { 30 - memset(pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); 31 - memcpy(pgd + USER_PTRS_PER_PGD, 32 - swapper_pg_dir + USER_PTRS_PER_PGD, 33 - (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); 34 - } 35 - 36 - return pgd; 30 + return quicklist_alloc(QUICK_PGD, GFP_KERNEL | __GFP_REPEAT, pgd_ctor); 37 31 } 38 32 39 33 static inline void pgd_free(pgd_t *pgd) 40 34 { 41 - free_page((unsigned long)pgd); 35 + quicklist_free(QUICK_PGD, NULL, pgd); 42 36 } 43 37 44 38 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 45 39 unsigned long address) 46 40 { 47 - return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); 41 + return quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL); 48 42 } 49 43 50 44 static inline struct page *pte_alloc_one(struct mm_struct *mm, 51 45 unsigned long address) 52 46 { 53 - return alloc_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); 47 + void *pg = quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL); 48 + return pg ? virt_to_page(pg) : NULL; 54 49 } 55 50 56 51 static inline void pte_free_kernel(pte_t *pte) 57 52 { 58 - free_page((unsigned long)pte); 53 + quicklist_free(QUICK_PT, NULL, pte); 59 54 } 60 55 61 56 static inline void pte_free(struct page *pte) 62 57 { 63 - __free_page(pte); 58 + quicklist_free_page(QUICK_PT, NULL, pte); 64 59 } 65 60 66 61 #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) ··· 73 66 74 67 #define pmd_free(x) do { } while (0) 75 68 #define __pmd_free_tlb(tlb,x) do { } while (0) 76 - #define check_pgt_cache() do { } while (0) 69 + 70 + static inline void check_pgt_cache(void) 71 + { 72 + quicklist_trim(QUICK_PGD, NULL, 25, 16); 73 + quicklist_trim(QUICK_PT, NULL, 25, 16); 74 + } 77 75 78 76 #endif /* __ASM_SH_PGALLOC_H */
+9
include/asm-sh/system.h
··· 255 255 return set_exception_table_vec(evt >> 5, handler); 256 256 } 257 257 258 + /* 259 + * SH-2A has both 16 and 32-bit opcodes, do lame encoding checks. 260 + */ 261 + #ifdef CONFIG_CPU_SH2A 262 + extern unsigned int instruction_size(unsigned int insn); 263 + #else 264 + #define instruction_size(insn) (2) 265 + #endif 266 + 258 267 /* XXX 259 268 * disable hlt during certain critical i/o operations 260 269 */
+4 -21
include/asm-sh/timer.h
··· 2 2 #define __ASM_SH_TIMER_H 3 3 4 4 #include <linux/sysdev.h> 5 + #include <linux/clocksource.h> 5 6 #include <asm/cpu/timer.h> 6 7 7 8 struct sys_timer_ops { 8 9 int (*init)(void); 9 10 int (*start)(void); 10 11 int (*stop)(void); 12 + cycle_t (*read)(void); 11 13 #ifndef CONFIG_GENERIC_TIME 12 14 unsigned long (*get_offset)(void); 13 15 #endif ··· 20 18 21 19 struct sys_device dev; 22 20 struct sys_timer_ops *ops; 23 - 24 - #ifdef CONFIG_NO_IDLE_HZ 25 - struct dyn_tick_timer *dyn_tick; 26 - #endif 27 21 }; 28 - 29 - #ifdef CONFIG_NO_IDLE_HZ 30 - #define DYN_TICK_ENABLED (1 << 1) 31 - 32 - struct dyn_tick_timer { 33 - spinlock_t lock; 34 - unsigned int state; /* Current state */ 35 - int (*enable)(void); /* Enables dynamic tick */ 36 - int (*disable)(void); /* Disables dynamic tick */ 37 - void (*reprogram)(unsigned long); /* Reprograms the timer */ 38 - int (*handler)(int, void *); 39 - }; 40 - 41 - void timer_dyn_reprogram(void); 42 - #else 43 - #define timer_dyn_reprogram() do { } while (0) 44 - #endif 45 22 46 23 #define TICK_SIZE (tick_nsec / 1000) 47 24 ··· 39 58 40 59 /* arch/sh/kernel/time.c */ 41 60 void handle_timer_tick(void); 61 + extern unsigned long sh_hpt_frequency; 62 + extern struct clocksource clocksource_sh; 42 63 43 64 #endif /* __ASM_SH_TIMER_H */
+3 -2
include/asm-sh/unistd.h
··· 85 85 #define __NR_sigpending 73 86 86 #define __NR_sethostname 74 87 87 #define __NR_setrlimit 75 88 - #define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ 88 + #define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ 89 89 #define __NR_getrusage 77 90 90 #define __NR_gettimeofday 78 91 91 #define __NR_settimeofday 79 ··· 328 328 #define __NR_move_pages 317 329 329 #define __NR_getcpu 318 330 330 #define __NR_epoll_pwait 319 331 + #define __NR_utimensat 320 331 332 332 - #define NR_syscalls 320 333 + #define NR_syscalls 321 333 334 334 335 #ifdef __KERNEL__ 335 336
+1 -1
mm/Kconfig
··· 166 166 config NR_QUICK 167 167 int 168 168 depends on QUICKLIST 169 + default "2" if SUPERH 169 170 default "1" 170 -