aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2009-04-21 23:02:09 -0400
committerPaul Mackerras <paulus@samba.org>2009-04-21 23:02:09 -0400
commit5bd3ef84d73c2ea7b4babbad060909753c4828d4 (patch)
treefdf2bafb48ae1ed03175f6c77a7548a181e69ee9 /include
parent0658c16056660886ea2f35c4f038be70a94b1532 (diff)
parent6d25b688ecc488753af3c9e6f6a9a575b863cf37 (diff)
Merge branch 'merge' of git://git.secretlab.ca/git/linux-2.6 into merge
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h1
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/asm-frv/Kbuild5
-rw-r--r--include/asm-frv/atomic.h198
-rw-r--r--include/asm-frv/auxvec.h4
-rw-r--r--include/asm-frv/ax88796.h22
-rw-r--r--include/asm-frv/bitops.h412
-rw-r--r--include/asm-frv/bug.h53
-rw-r--r--include/asm-frv/bugs.h14
-rw-r--r--include/asm-frv/busctl-regs.h41
-rw-r--r--include/asm-frv/byteorder.h6
-rw-r--r--include/asm-frv/cache.h23
-rw-r--r--include/asm-frv/cacheflush.h104
-rw-r--r--include/asm-frv/checksum.h180
-rw-r--r--include/asm-frv/cpu-irqs.h81
-rw-r--r--include/asm-frv/cpumask.h6
-rw-r--r--include/asm-frv/cputime.h6
-rw-r--r--include/asm-frv/current.h30
-rw-r--r--include/asm-frv/delay.h50
-rw-r--r--include/asm-frv/device.h7
-rw-r--r--include/asm-frv/div64.h1
-rw-r--r--include/asm-frv/dm9000.h37
-rw-r--r--include/asm-frv/dma-mapping.h174
-rw-r--r--include/asm-frv/dma.h125
-rw-r--r--include/asm-frv/elf.h142
-rw-r--r--include/asm-frv/emergency-restart.h6
-rw-r--r--include/asm-frv/errno.h7
-rw-r--r--include/asm-frv/fb.h12
-rw-r--r--include/asm-frv/fcntl.h1
-rw-r--r--include/asm-frv/fpu.h11
-rw-r--r--include/asm-frv/ftrace.h1
-rw-r--r--include/asm-frv/futex.h19
-rw-r--r--include/asm-frv/gdb-stub.h140
-rw-r--r--include/asm-frv/gpio-regs.h116
-rw-r--r--include/asm-frv/hardirq.h35
-rw-r--r--include/asm-frv/highmem.h182
-rw-r--r--include/asm-frv/hw_irq.h16
-rw-r--r--include/asm-frv/init.h12
-rw-r--r--include/asm-frv/io.h392
-rw-r--r--include/asm-frv/ioctl.h1
-rw-r--r--include/asm-frv/ioctls.h86
-rw-r--r--include/asm-frv/ipcbuf.h30
-rw-r--r--include/asm-frv/irc-regs.h53
-rw-r--r--include/asm-frv/irq.h30
-rw-r--r--include/asm-frv/irq_regs.h27
-rw-r--r--include/asm-frv/kdebug.h1
-rw-r--r--include/asm-frv/kmap_types.h29
-rw-r--r--include/asm-frv/linkage.h7
-rw-r--r--include/asm-frv/local.h6
-rw-r--r--include/asm-frv/math-emu.h301
-rw-r--r--include/asm-frv/mb-regs.h200
-rw-r--r--include/asm-frv/mb86943a.h42
-rw-r--r--include/asm-frv/mb93091-fpga-irqs.h42
-rw-r--r--include/asm-frv/mb93093-fpga-irqs.h29
-rw-r--r--include/asm-frv/mb93493-irqs.h50
-rw-r--r--include/asm-frv/mb93493-regs.h281
-rw-r--r--include/asm-frv/mc146818rtc.h16
-rw-r--r--include/asm-frv/mem-layout.h86
-rw-r--r--include/asm-frv/mman.h18
-rw-r--r--include/asm-frv/mmu.h41
-rw-r--r--include/asm-frv/mmu_context.h50
-rw-r--r--include/asm-frv/module.h28
-rw-r--r--include/asm-frv/msgbuf.h32
-rw-r--r--include/asm-frv/mutex.h9
-rw-r--r--include/asm-frv/page.h78
-rw-r--r--include/asm-frv/param.h22
-rw-r--r--include/asm-frv/pci.h118
-rw-r--r--include/asm-frv/percpu.h6
-rw-r--r--include/asm-frv/pgalloc.h69
-rw-r--r--include/asm-frv/pgtable.h551
-rw-r--r--include/asm-frv/poll.h12
-rw-r--r--include/asm-frv/posix_types.h62
-rw-r--r--include/asm-frv/processor.h153
-rw-r--r--include/asm-frv/ptrace.h83
-rw-r--r--include/asm-frv/registers.h232
-rw-r--r--include/asm-frv/resource.h7
-rw-r--r--include/asm-frv/scatterlist.h46
-rw-r--r--include/asm-frv/sections.h46
-rw-r--r--include/asm-frv/segment.h45
-rw-r--r--include/asm-frv/sembuf.h26
-rw-r--r--include/asm-frv/serial-regs.h44
-rw-r--r--include/asm-frv/serial.h18
-rw-r--r--include/asm-frv/setup.h31
-rw-r--r--include/asm-frv/shmbuf.h43
-rw-r--r--include/asm-frv/shmparam.h7
-rw-r--r--include/asm-frv/sigcontext.h26
-rw-r--r--include/asm-frv/siginfo.h12
-rw-r--r--include/asm-frv/signal.h161
-rw-r--r--include/asm-frv/smp.h9
-rw-r--r--include/asm-frv/socket.h61
-rw-r--r--include/asm-frv/sockios.h14
-rw-r--r--include/asm-frv/spinlock.h17
-rw-r--r--include/asm-frv/spr-regs.h416
-rw-r--r--include/asm-frv/stat.h100
-rw-r--r--include/asm-frv/statfs.h7
-rw-r--r--include/asm-frv/string.h51
-rw-r--r--include/asm-frv/suspend.h20
-rw-r--r--include/asm-frv/swab.h10
-rw-r--r--include/asm-frv/system.h301
-rw-r--r--include/asm-frv/termbits.h202
-rw-r--r--include/asm-frv/termios.h58
-rw-r--r--include/asm-frv/thread_info.h144
-rw-r--r--include/asm-frv/timer-regs.h106
-rw-r--r--include/asm-frv/timex.h20
-rw-r--r--include/asm-frv/tlb.h27
-rw-r--r--include/asm-frv/tlbflush.h73
-rw-r--r--include/asm-frv/topology.h12
-rw-r--r--include/asm-frv/types.h40
-rw-r--r--include/asm-frv/uaccess.h321
-rw-r--r--include/asm-frv/ucontext.h12
-rw-r--r--include/asm-frv/unaligned.h22
-rw-r--r--include/asm-frv/unistd.h382
-rw-r--r--include/asm-frv/user.h80
-rw-r--r--include/asm-frv/vga.h17
-rw-r--r--include/asm-frv/virtconvert.h41
-rw-r--r--include/asm-frv/xor.h1
-rw-r--r--include/asm-generic/percpu.h52
-rw-r--r--include/asm-generic/siginfo.h2
-rw-r--r--include/asm-mn10300/.gitignore2
-rw-r--r--include/asm-mn10300/Kbuild1
-rw-r--r--include/asm-mn10300/atomic.h157
-rw-r--r--include/asm-mn10300/auxvec.h4
-rw-r--r--include/asm-mn10300/bitops.h240
-rw-r--r--include/asm-mn10300/bug.h35
-rw-r--r--include/asm-mn10300/bugs.h20
-rw-r--r--include/asm-mn10300/busctl-regs.h151
-rw-r--r--include/asm-mn10300/byteorder.h6
-rw-r--r--include/asm-mn10300/cache.h54
-rw-r--r--include/asm-mn10300/cacheflush.h116
-rw-r--r--include/asm-mn10300/checksum.h86
-rw-r--r--include/asm-mn10300/cpu-regs.h290
-rw-r--r--include/asm-mn10300/cputime.h1
-rw-r--r--include/asm-mn10300/current.h37
-rw-r--r--include/asm-mn10300/delay.h19
-rw-r--r--include/asm-mn10300/device.h1
-rw-r--r--include/asm-mn10300/div64.h100
-rw-r--r--include/asm-mn10300/dma-mapping.h234
-rw-r--r--include/asm-mn10300/dma.h118
-rw-r--r--include/asm-mn10300/dmactl-regs.h101
-rw-r--r--include/asm-mn10300/elf.h147
-rw-r--r--include/asm-mn10300/emergency-restart.h1
-rw-r--r--include/asm-mn10300/errno.h1
-rw-r--r--include/asm-mn10300/exceptions.h121
-rw-r--r--include/asm-mn10300/fb.h23
-rw-r--r--include/asm-mn10300/fcntl.h1
-rw-r--r--include/asm-mn10300/fpu.h85
-rw-r--r--include/asm-mn10300/frame.inc91
-rw-r--r--include/asm-mn10300/ftrace.h1
-rw-r--r--include/asm-mn10300/futex.h1
-rw-r--r--include/asm-mn10300/gdb-stub.h183
-rw-r--r--include/asm-mn10300/hardirq.h48
-rw-r--r--include/asm-mn10300/highmem.h116
-rw-r--r--include/asm-mn10300/hw_irq.h14
-rw-r--r--include/asm-mn10300/intctl-regs.h73
-rw-r--r--include/asm-mn10300/io.h301
-rw-r--r--include/asm-mn10300/ioctl.h1
-rw-r--r--include/asm-mn10300/ioctls.h88
-rw-r--r--include/asm-mn10300/ipc.h1
-rw-r--r--include/asm-mn10300/ipcbuf.h29
-rw-r--r--include/asm-mn10300/irq.h32
-rw-r--r--include/asm-mn10300/irq_regs.h24
-rw-r--r--include/asm-mn10300/kdebug.h22
-rw-r--r--include/asm-mn10300/kmap_types.h31
-rw-r--r--include/asm-mn10300/kprobes.h50
-rw-r--r--include/asm-mn10300/linkage.h20
-rw-r--r--include/asm-mn10300/local.h1
-rw-r--r--include/asm-mn10300/mc146818rtc.h1
-rw-r--r--include/asm-mn10300/mman.h28
-rw-r--r--include/asm-mn10300/mmu.h19
-rw-r--r--include/asm-mn10300/mmu_context.h138
-rw-r--r--include/asm-mn10300/module.h27
-rw-r--r--include/asm-mn10300/msgbuf.h31
-rw-r--r--include/asm-mn10300/mutex.h16
-rw-r--r--include/asm-mn10300/nmi.h14
-rw-r--r--include/asm-mn10300/page.h128
-rw-r--r--include/asm-mn10300/page_offset.h11
-rw-r--r--include/asm-mn10300/param.h34
-rw-r--r--include/asm-mn10300/pci.h129
-rw-r--r--include/asm-mn10300/percpu.h1
-rw-r--r--include/asm-mn10300/pgalloc.h56
-rw-r--r--include/asm-mn10300/pgtable.h492
-rw-r--r--include/asm-mn10300/pio-regs.h233
-rw-r--r--include/asm-mn10300/poll.h1
-rw-r--r--include/asm-mn10300/posix_types.h132
-rw-r--r--include/asm-mn10300/proc-mn103e010/cache.h33
-rw-r--r--include/asm-mn10300/proc-mn103e010/clock.h18
-rw-r--r--include/asm-mn10300/proc-mn103e010/irq.h34
-rw-r--r--include/asm-mn10300/proc-mn103e010/proc.h18
-rw-r--r--include/asm-mn10300/processor.h186
-rw-r--r--include/asm-mn10300/ptrace.h103
-rw-r--r--include/asm-mn10300/reset-regs.h64
-rw-r--r--include/asm-mn10300/resource.h1
-rw-r--r--include/asm-mn10300/rtc-regs.h86
-rw-r--r--include/asm-mn10300/rtc.h41
-rw-r--r--include/asm-mn10300/scatterlist.h55
-rw-r--r--include/asm-mn10300/sections.h1
-rw-r--r--include/asm-mn10300/sembuf.h25
-rw-r--r--include/asm-mn10300/serial-regs.h160
-rw-r--r--include/asm-mn10300/serial.h36
-rw-r--r--include/asm-mn10300/setup.h17
-rw-r--r--include/asm-mn10300/shmbuf.h42
-rw-r--r--include/asm-mn10300/shmparam.h6
-rw-r--r--include/asm-mn10300/sigcontext.h52
-rw-r--r--include/asm-mn10300/siginfo.h1
-rw-r--r--include/asm-mn10300/signal.h171
-rw-r--r--include/asm-mn10300/smp.h18
-rw-r--r--include/asm-mn10300/socket.h60
-rw-r--r--include/asm-mn10300/sockios.h13
-rw-r--r--include/asm-mn10300/spinlock.h16
-rw-r--r--include/asm-mn10300/stat.h78
-rw-r--r--include/asm-mn10300/statfs.h1
-rw-r--r--include/asm-mn10300/string.h32
-rw-r--r--include/asm-mn10300/swab.h42
-rw-r--r--include/asm-mn10300/system.h237
-rw-r--r--include/asm-mn10300/termbits.h200
-rw-r--r--include/asm-mn10300/termios.h92
-rw-r--r--include/asm-mn10300/thread_info.h170
-rw-r--r--include/asm-mn10300/timer-regs.h293
-rw-r--r--include/asm-mn10300/timex.h33
-rw-r--r--include/asm-mn10300/tlb.h34
-rw-r--r--include/asm-mn10300/tlbflush.h80
-rw-r--r--include/asm-mn10300/topology.h1
-rw-r--r--include/asm-mn10300/types.h38
-rw-r--r--include/asm-mn10300/uaccess.h490
-rw-r--r--include/asm-mn10300/ucontext.h22
-rw-r--r--include/asm-mn10300/unaligned.h20
-rw-r--r--include/asm-mn10300/unistd.h390
-rw-r--r--include/asm-mn10300/unit-asb2303/clock.h45
-rw-r--r--include/asm-mn10300/unit-asb2303/leds.h43
-rw-r--r--include/asm-mn10300/unit-asb2303/serial.h136
-rw-r--r--include/asm-mn10300/unit-asb2303/smc91111.h50
-rw-r--r--include/asm-mn10300/unit-asb2303/timex.h135
-rw-r--r--include/asm-mn10300/unit-asb2305/clock.h45
-rw-r--r--include/asm-mn10300/unit-asb2305/leds.h51
-rw-r--r--include/asm-mn10300/unit-asb2305/serial.h120
-rw-r--r--include/asm-mn10300/unit-asb2305/timex.h135
-rw-r--r--include/asm-mn10300/user.h53
-rw-r--r--include/asm-mn10300/vga.h17
-rw-r--r--include/asm-mn10300/xor.h1
-rw-r--r--include/drm/drm_pciids.h2
-rw-r--r--include/drm/i915_drm.h3
-rw-r--r--include/linux/ata.h41
-rw-r--r--include/linux/backing-dev.h12
-rw-r--r--include/linux/bio.h19
-rw-r--r--include/linux/blkdev.h57
-rw-r--r--include/linux/capability.h23
-rw-r--r--include/linux/compiler.h7
-rw-r--r--include/linux/debug_locks.h8
-rw-r--r--include/linux/device-mapper.h1
-rw-r--r--include/linux/dma-mapping.h2
-rw-r--r--include/linux/dmar.h11
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/fb.h8
-rw-r--r--include/linux/fdtable.h4
-rw-r--r--include/linux/fiemap.h2
-rw-r--r--include/linux/fs.h46
-rw-r--r--include/linux/fsl_devices.h4
-rw-r--r--include/linux/ftrace.h37
-rw-r--r--include/linux/hardirq.h2
-rw-r--r--include/linux/hrtimer.h5
-rw-r--r--include/linux/i2c-algo-sgi.h26
-rw-r--r--include/linux/i2c-id.h38
-rw-r--r--include/linux/i2c.h6
-rw-r--r--include/linux/i2c/s6000.h10
-rw-r--r--include/linux/ide.h151
-rw-r--r--include/linux/init_task.h15
-rw-r--r--include/linux/intel-iommu.h13
-rw-r--r--include/linux/interrupt.h76
-rw-r--r--include/linux/ipc_namespace.h65
-rw-r--r--include/linux/irq.h19
-rw-r--r--include/linux/irqreturn.h2
-rw-r--r--include/linux/key.h1
-rw-r--r--include/linux/kmod.h2
-rw-r--r--include/linux/kprobes.h52
-rw-r--r--include/linux/leds-bd2802.h26
-rw-r--r--include/linux/leds.h4
-rw-r--r--include/linux/leds_pwm.h21
-rw-r--r--include/linux/lockd/xdr.h12
-rw-r--r--include/linux/lockd/xdr4.h10
-rw-r--r--include/linux/mfd/pcf50633/core.h2
-rw-r--r--include/linux/mfd/pcf50633/mbc.h1
-rw-r--r--include/linux/mg_disk.h206
-rw-r--r--include/linux/mtd/mtd.h21
-rw-r--r--include/linux/mtd/nand.h4
-rw-r--r--include/linux/mtd/partitions.h12
-rw-r--r--include/linux/nfs.h1
-rw-r--r--include/linux/nfs4.h138
-rw-r--r--include/linux/nfsd/cache.h8
-rw-r--r--include/linux/nfsd/nfsd.h225
-rw-r--r--include/linux/nfsd/nfsfh.h7
-rw-r--r--include/linux/nfsd/state.h84
-rw-r--r--include/linux/nfsd/stats.h9
-rw-r--r--include/linux/nfsd/xdr4.h129
-rw-r--r--include/linux/nilfs2_fs.h801
-rw-r--r--include/linux/parport_pc.h11
-rw-r--r--include/linux/pci.h5
-rw-r--r--include/linux/pci_ids.h28
-rw-r--r--include/linux/pda_power.h2
-rw-r--r--include/linux/percpu.h52
-rw-r--r--include/linux/rcuclassic.h16
-rw-r--r--include/linux/rcupdate.h1
-rw-r--r--include/linux/rcupreempt.h53
-rw-r--r--include/linux/rcutree.h27
-rw-r--r--include/linux/rotary_encoder.h13
-rw-r--r--include/linux/sched.h26
-rw-r--r--include/linux/security.h24
-rw-r--r--include/linux/serial_core.h5
-rw-r--r--include/linux/serial_max3100.h52
-rw-r--r--include/linux/sht15.h24
-rw-r--r--include/linux/slab_def.h10
-rw-r--r--include/linux/slub_def.h12
-rw-r--r--include/linux/spi/ad7879.h35
-rw-r--r--include/linux/spi/spi.h6
-rw-r--r--include/linux/stringify.h4
-rw-r--r--include/linux/sunrpc/svc.h16
-rw-r--r--include/linux/sunrpc/xdr.h42
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--include/linux/tty_driver.h3
-rw-r--r--include/linux/usb/serial.h7
-rw-r--r--include/linux/videodev2.h5
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/media/msp3400.h4
-rw-r--r--include/media/ov772x.h35
-rw-r--r--include/media/saa7146.h2
-rw-r--r--include/media/tvaudio.h19
-rw-r--r--include/media/v4l2-common.h141
-rw-r--r--include/media/v4l2-i2c-drv-legacy.h152
-rw-r--r--include/media/v4l2-i2c-drv.h6
-rw-r--r--include/media/v4l2-subdev.h115
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h5
-rw-r--r--include/scsi/fc/fc_fip.h237
-rw-r--r--include/scsi/fc_transport_fcoe.h54
-rw-r--r--include/scsi/libfc.h45
-rw-r--r--include/scsi/libfcoe.h227
-rw-r--r--include/scsi/scsi_scan.h11
-rw-r--r--include/trace/kmemtrace.h92
-rw-r--r--include/trace/syscall.h35
-rw-r--r--include/video/cyblafb.h175
-rw-r--r--include/video/tdfx.h26
339 files changed, 3091 insertions, 19061 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index a2228511d4be..c34b11022908 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -270,7 +270,6 @@ struct acpi_device {
270 struct list_head children; 270 struct list_head children;
271 struct list_head node; 271 struct list_head node;
272 struct list_head wakeup_list; 272 struct list_head wakeup_list;
273 struct list_head g_list;
274 struct acpi_device_status status; 273 struct acpi_device_status status;
275 struct acpi_device_flags flags; 274 struct acpi_device_flags flags;
276 struct acpi_device_pnp pnp; 275 struct acpi_device_pnp pnp;
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index aeaf7cd41dc7..4db89e98535d 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -191,14 +191,12 @@ acpi_evaluate_object(acpi_handle object,
191 struct acpi_object_list *parameter_objects, 191 struct acpi_object_list *parameter_objects,
192 struct acpi_buffer *return_object_buffer); 192 struct acpi_buffer *return_object_buffer);
193 193
194#ifdef ACPI_FUTURE_USAGE
195acpi_status 194acpi_status
196acpi_evaluate_object_typed(acpi_handle object, 195acpi_evaluate_object_typed(acpi_handle object,
197 acpi_string pathname, 196 acpi_string pathname,
198 struct acpi_object_list *external_params, 197 struct acpi_object_list *external_params,
199 struct acpi_buffer *return_buffer, 198 struct acpi_buffer *return_buffer,
200 acpi_object_type return_type); 199 acpi_object_type return_type);
201#endif
202 200
203acpi_status 201acpi_status
204acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); 202acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer);
diff --git a/include/asm-frv/Kbuild b/include/asm-frv/Kbuild
deleted file mode 100644
index 0f8956def738..000000000000
--- a/include/asm-frv/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += registers.h
4
5unifdef-y += termios.h
diff --git a/include/asm-frv/atomic.h b/include/asm-frv/atomic.h
deleted file mode 100644
index 296c35cfb207..000000000000
--- a/include/asm-frv/atomic.h
+++ /dev/null
@@ -1,198 +0,0 @@
1/* atomic.h: atomic operation emulation for FR-V
2 *
3 * For an explanation of how atomic ops work in this arch, see:
4 * Documentation/frv/atomic-ops.txt
5 *
6 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14#ifndef _ASM_ATOMIC_H
15#define _ASM_ATOMIC_H
16
17#include <linux/types.h>
18#include <asm/spr-regs.h>
19#include <asm/system.h>
20
21#ifdef CONFIG_SMP
22#error not SMP safe
23#endif
24
25/*
26 * Atomic operations that C can't guarantee us. Useful for
27 * resource counting etc..
28 *
29 * We do not have SMP systems, so we don't have to deal with that.
30 */
31
32/* Atomic operations are already serializing */
33#define smp_mb__before_atomic_dec() barrier()
34#define smp_mb__after_atomic_dec() barrier()
35#define smp_mb__before_atomic_inc() barrier()
36#define smp_mb__after_atomic_inc() barrier()
37
38#define ATOMIC_INIT(i) { (i) }
39#define atomic_read(v) ((v)->counter)
40#define atomic_set(v, i) (((v)->counter) = (i))
41
42#ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS
43static inline int atomic_add_return(int i, atomic_t *v)
44{
45 unsigned long val;
46
47 asm("0: \n"
48 " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */
49 " ckeq icc3,cc7 \n"
50 " ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */
51 " orcr cc7,cc7,cc3 \n" /* set CC3 to true */
52 " add%I2 %1,%2,%1 \n"
53 " cst.p %1,%M0 ,cc3,#1 \n"
54 " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */
55 " beq icc3,#0,0b \n"
56 : "+U"(v->counter), "=&r"(val)
57 : "NPr"(i)
58 : "memory", "cc7", "cc3", "icc3"
59 );
60
61 return val;
62}
63
64static inline int atomic_sub_return(int i, atomic_t *v)
65{
66 unsigned long val;
67
68 asm("0: \n"
69 " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */
70 " ckeq icc3,cc7 \n"
71 " ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */
72 " orcr cc7,cc7,cc3 \n" /* set CC3 to true */
73 " sub%I2 %1,%2,%1 \n"
74 " cst.p %1,%M0 ,cc3,#1 \n"
75 " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */
76 " beq icc3,#0,0b \n"
77 : "+U"(v->counter), "=&r"(val)
78 : "NPr"(i)
79 : "memory", "cc7", "cc3", "icc3"
80 );
81
82 return val;
83}
84
85#else
86
87extern int atomic_add_return(int i, atomic_t *v);
88extern int atomic_sub_return(int i, atomic_t *v);
89
90#endif
91
92static inline int atomic_add_negative(int i, atomic_t *v)
93{
94 return atomic_add_return(i, v) < 0;
95}
96
97static inline void atomic_add(int i, atomic_t *v)
98{
99 atomic_add_return(i, v);
100}
101
102static inline void atomic_sub(int i, atomic_t *v)
103{
104 atomic_sub_return(i, v);
105}
106
107static inline void atomic_inc(atomic_t *v)
108{
109 atomic_add_return(1, v);
110}
111
112static inline void atomic_dec(atomic_t *v)
113{
114 atomic_sub_return(1, v);
115}
116
117#define atomic_dec_return(v) atomic_sub_return(1, (v))
118#define atomic_inc_return(v) atomic_add_return(1, (v))
119
120#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
121#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
122#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
123
124/*****************************************************************************/
125/*
126 * exchange value with memory
127 */
128#ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS
129
130#define xchg(ptr, x) \
131({ \
132 __typeof__(ptr) __xg_ptr = (ptr); \
133 __typeof__(*(ptr)) __xg_orig; \
134 \
135 switch (sizeof(__xg_orig)) { \
136 case 4: \
137 asm volatile( \
138 "swap%I0 %M0,%1" \
139 : "+m"(*__xg_ptr), "=r"(__xg_orig) \
140 : "1"(x) \
141 : "memory" \
142 ); \
143 break; \
144 \
145 default: \
146 __xg_orig = (__typeof__(__xg_orig))0; \
147 asm volatile("break"); \
148 break; \
149 } \
150 \
151 __xg_orig; \
152})
153
154#else
155
156extern uint32_t __xchg_32(uint32_t i, volatile void *v);
157
158#define xchg(ptr, x) \
159({ \
160 __typeof__(ptr) __xg_ptr = (ptr); \
161 __typeof__(*(ptr)) __xg_orig; \
162 \
163 switch (sizeof(__xg_orig)) { \
164 case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \
165 default: \
166 __xg_orig = (__typeof__(__xg_orig))0; \
167 asm volatile("break"); \
168 break; \
169 } \
170 __xg_orig; \
171})
172
173#endif
174
175#define tas(ptr) (xchg((ptr), 1))
176
177#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new))
178#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
179
180static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
181{
182 int c, old;
183 c = atomic_read(v);
184 for (;;) {
185 if (unlikely(c == (u)))
186 break;
187 old = atomic_cmpxchg((v), c, c + (a));
188 if (likely(old == c))
189 break;
190 c = old;
191 }
192 return c != (u);
193}
194
195#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
196
197#include <asm-generic/atomic.h>
198#endif /* _ASM_ATOMIC_H */
diff --git a/include/asm-frv/auxvec.h b/include/asm-frv/auxvec.h
deleted file mode 100644
index 07710778fa10..000000000000
--- a/include/asm-frv/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __FRV_AUXVEC_H
2#define __FRV_AUXVEC_H
3
4#endif
diff --git a/include/asm-frv/ax88796.h b/include/asm-frv/ax88796.h
deleted file mode 100644
index 637e980393c5..000000000000
--- a/include/asm-frv/ax88796.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* ax88796.h: access points to the driver for the AX88796 NE2000 clone
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_AX88796_H
13#define _ASM_AX88796_H
14
15#include <asm/mb-regs.h>
16
17#define AX88796_IOADDR (__region_CS1 + 0x200)
18#define AX88796_IRQ IRQ_CPU_EXTERNAL7
19#define AX88796_FULL_DUPLEX 0 /* force full duplex */
20#define AX88796_BUS_INFO "CS1#+0x200" /* bus info for ethtool */
21
22#endif /* _ASM_AX88796_H */
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
deleted file mode 100644
index 287f6f697ce2..000000000000
--- a/include/asm-frv/bitops.h
+++ /dev/null
@@ -1,412 +0,0 @@
1/* bitops.h: bit operations for the Fujitsu FR-V CPUs
2 *
3 * For an explanation of how atomic ops work in this arch, see:
4 * Documentation/frv/atomic-ops.txt
5 *
6 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14#ifndef _ASM_BITOPS_H
15#define _ASM_BITOPS_H
16
17#include <linux/compiler.h>
18#include <asm/byteorder.h>
19
20#ifdef __KERNEL__
21
22#ifndef _LINUX_BITOPS_H
23#error only <linux/bitops.h> can be included directly
24#endif
25
26#include <asm-generic/bitops/ffz.h>
27
28/*
29 * clear_bit() doesn't provide any barrier for the compiler.
30 */
31#define smp_mb__before_clear_bit() barrier()
32#define smp_mb__after_clear_bit() barrier()
33
34#ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS
35static inline
36unsigned long atomic_test_and_ANDNOT_mask(unsigned long mask, volatile unsigned long *v)
37{
38 unsigned long old, tmp;
39
40 asm volatile(
41 "0: \n"
42 " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */
43 " ckeq icc3,cc7 \n"
44 " ld.p %M0,%1 \n" /* LD.P/ORCR are atomic */
45 " orcr cc7,cc7,cc3 \n" /* set CC3 to true */
46 " and%I3 %1,%3,%2 \n"
47 " cst.p %2,%M0 ,cc3,#1 \n" /* if store happens... */
48 " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* ... clear ICC3.Z */
49 " beq icc3,#0,0b \n"
50 : "+U"(*v), "=&r"(old), "=r"(tmp)
51 : "NPr"(~mask)
52 : "memory", "cc7", "cc3", "icc3"
53 );
54
55 return old;
56}
57
58static inline
59unsigned long atomic_test_and_OR_mask(unsigned long mask, volatile unsigned long *v)
60{
61 unsigned long old, tmp;
62
63 asm volatile(
64 "0: \n"
65 " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */
66 " ckeq icc3,cc7 \n"
67 " ld.p %M0,%1 \n" /* LD.P/ORCR are atomic */
68 " orcr cc7,cc7,cc3 \n" /* set CC3 to true */
69 " or%I3 %1,%3,%2 \n"
70 " cst.p %2,%M0 ,cc3,#1 \n" /* if store happens... */
71 " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* ... clear ICC3.Z */
72 " beq icc3,#0,0b \n"
73 : "+U"(*v), "=&r"(old), "=r"(tmp)
74 : "NPr"(mask)
75 : "memory", "cc7", "cc3", "icc3"
76 );
77
78 return old;
79}
80
81static inline
82unsigned long atomic_test_and_XOR_mask(unsigned long mask, volatile unsigned long *v)
83{
84 unsigned long old, tmp;
85
86 asm volatile(
87 "0: \n"
88 " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */
89 " ckeq icc3,cc7 \n"
90 " ld.p %M0,%1 \n" /* LD.P/ORCR are atomic */
91 " orcr cc7,cc7,cc3 \n" /* set CC3 to true */
92 " xor%I3 %1,%3,%2 \n"
93 " cst.p %2,%M0 ,cc3,#1 \n" /* if store happens... */
94 " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* ... clear ICC3.Z */
95 " beq icc3,#0,0b \n"
96 : "+U"(*v), "=&r"(old), "=r"(tmp)
97 : "NPr"(mask)
98 : "memory", "cc7", "cc3", "icc3"
99 );
100
101 return old;
102}
103
104#else
105
106extern unsigned long atomic_test_and_ANDNOT_mask(unsigned long mask, volatile unsigned long *v);
107extern unsigned long atomic_test_and_OR_mask(unsigned long mask, volatile unsigned long *v);
108extern unsigned long atomic_test_and_XOR_mask(unsigned long mask, volatile unsigned long *v);
109
110#endif
111
112#define atomic_clear_mask(mask, v) atomic_test_and_ANDNOT_mask((mask), (v))
113#define atomic_set_mask(mask, v) atomic_test_and_OR_mask((mask), (v))
114
115static inline int test_and_clear_bit(int nr, volatile void *addr)
116{
117 volatile unsigned long *ptr = addr;
118 unsigned long mask = 1UL << (nr & 31);
119 ptr += nr >> 5;
120 return (atomic_test_and_ANDNOT_mask(mask, ptr) & mask) != 0;
121}
122
123static inline int test_and_set_bit(int nr, volatile void *addr)
124{
125 volatile unsigned long *ptr = addr;
126 unsigned long mask = 1UL << (nr & 31);
127 ptr += nr >> 5;
128 return (atomic_test_and_OR_mask(mask, ptr) & mask) != 0;
129}
130
131static inline int test_and_change_bit(int nr, volatile void *addr)
132{
133 volatile unsigned long *ptr = addr;
134 unsigned long mask = 1UL << (nr & 31);
135 ptr += nr >> 5;
136 return (atomic_test_and_XOR_mask(mask, ptr) & mask) != 0;
137}
138
139static inline void clear_bit(int nr, volatile void *addr)
140{
141 test_and_clear_bit(nr, addr);
142}
143
144static inline void set_bit(int nr, volatile void *addr)
145{
146 test_and_set_bit(nr, addr);
147}
148
149static inline void change_bit(int nr, volatile void * addr)
150{
151 test_and_change_bit(nr, addr);
152}
153
154static inline void __clear_bit(int nr, volatile void * addr)
155{
156 volatile unsigned long *a = addr;
157 int mask;
158
159 a += nr >> 5;
160 mask = 1 << (nr & 31);
161 *a &= ~mask;
162}
163
164static inline void __set_bit(int nr, volatile void * addr)
165{
166 volatile unsigned long *a = addr;
167 int mask;
168
169 a += nr >> 5;
170 mask = 1 << (nr & 31);
171 *a |= mask;
172}
173
174static inline void __change_bit(int nr, volatile void *addr)
175{
176 volatile unsigned long *a = addr;
177 int mask;
178
179 a += nr >> 5;
180 mask = 1 << (nr & 31);
181 *a ^= mask;
182}
183
184static inline int __test_and_clear_bit(int nr, volatile void * addr)
185{
186 volatile unsigned long *a = addr;
187 int mask, retval;
188
189 a += nr >> 5;
190 mask = 1 << (nr & 31);
191 retval = (mask & *a) != 0;
192 *a &= ~mask;
193 return retval;
194}
195
196static inline int __test_and_set_bit(int nr, volatile void * addr)
197{
198 volatile unsigned long *a = addr;
199 int mask, retval;
200
201 a += nr >> 5;
202 mask = 1 << (nr & 31);
203 retval = (mask & *a) != 0;
204 *a |= mask;
205 return retval;
206}
207
208static inline int __test_and_change_bit(int nr, volatile void * addr)
209{
210 volatile unsigned long *a = addr;
211 int mask, retval;
212
213 a += nr >> 5;
214 mask = 1 << (nr & 31);
215 retval = (mask & *a) != 0;
216 *a ^= mask;
217 return retval;
218}
219
220/*
221 * This routine doesn't need to be atomic.
222 */
223static inline int __constant_test_bit(int nr, const volatile void * addr)
224{
225 return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
226}
227
228static inline int __test_bit(int nr, const volatile void * addr)
229{
230 int * a = (int *) addr;
231 int mask;
232
233 a += nr >> 5;
234 mask = 1 << (nr & 0x1f);
235 return ((mask & *a) != 0);
236}
237
238#define test_bit(nr,addr) \
239(__builtin_constant_p(nr) ? \
240 __constant_test_bit((nr),(addr)) : \
241 __test_bit((nr),(addr)))
242
243#include <asm-generic/bitops/find.h>
244
245/**
246 * fls - find last bit set
247 * @x: the word to search
248 *
249 * This is defined the same way as ffs:
250 * - return 32..1 to indicate bit 31..0 most significant bit set
251 * - return 0 to indicate no bits set
252 */
253#define fls(x) \
254({ \
255 int bit; \
256 \
257 asm(" subcc %1,gr0,gr0,icc0 \n" \
258 " ckne icc0,cc4 \n" \
259 " cscan.p %1,gr0,%0 ,cc4,#1 \n" \
260 " csub %0,%0,%0 ,cc4,#0 \n" \
261 " csub %2,%0,%0 ,cc4,#1 \n" \
262 : "=&r"(bit) \
263 : "r"(x), "r"(32) \
264 : "icc0", "cc4" \
265 ); \
266 \
267 bit; \
268})
269
270/**
271 * fls64 - find last bit set in a 64-bit value
272 * @n: the value to search
273 *
274 * This is defined the same way as ffs:
275 * - return 64..1 to indicate bit 63..0 most significant bit set
276 * - return 0 to indicate no bits set
277 */
278static inline __attribute__((const))
279int fls64(u64 n)
280{
281 union {
282 u64 ll;
283 struct { u32 h, l; };
284 } _;
285 int bit, x, y;
286
287 _.ll = n;
288
289 asm(" subcc.p %3,gr0,gr0,icc0 \n"
290 " subcc %4,gr0,gr0,icc1 \n"
291 " ckne icc0,cc4 \n"
292 " ckne icc1,cc5 \n"
293 " norcr cc4,cc5,cc6 \n"
294 " csub.p %0,%0,%0 ,cc6,1 \n"
295 " orcr cc5,cc4,cc4 \n"
296 " andcr cc4,cc5,cc4 \n"
297 " cscan.p %3,gr0,%0 ,cc4,0 \n"
298 " setlos #64,%1 \n"
299 " cscan.p %4,gr0,%0 ,cc4,1 \n"
300 " setlos #32,%2 \n"
301 " csub.p %1,%0,%0 ,cc4,0 \n"
302 " csub %2,%0,%0 ,cc4,1 \n"
303 : "=&r"(bit), "=r"(x), "=r"(y)
304 : "0r"(_.h), "r"(_.l)
305 : "icc0", "icc1", "cc4", "cc5", "cc6"
306 );
307 return bit;
308
309}
310
311/**
312 * ffs - find first bit set
313 * @x: the word to search
314 *
315 * - return 32..1 to indicate bit 31..0 most least significant bit set
316 * - return 0 to indicate no bits set
317 */
318static inline __attribute__((const))
319int ffs(int x)
320{
321 /* Note: (x & -x) gives us a mask that is the least significant
322 * (rightmost) 1-bit of the value in x.
323 */
324 return fls(x & -x);
325}
326
327/**
328 * __ffs - find first bit set
329 * @x: the word to search
330 *
331 * - return 31..0 to indicate bit 31..0 most least significant bit set
332 * - if no bits are set in x, the result is undefined
333 */
334static inline __attribute__((const))
335int __ffs(unsigned long x)
336{
337 int bit;
338 asm("scan %1,gr0,%0" : "=r"(bit) : "r"(x & -x));
339 return 31 - bit;
340}
341
342/**
343 * __fls - find last (most-significant) set bit in a long word
344 * @word: the word to search
345 *
346 * Undefined if no set bit exists, so code should check against 0 first.
347 */
348static inline unsigned long __fls(unsigned long word)
349{
350 unsigned long bit;
351 asm("scan %1,gr0,%0" : "=r"(bit) : "r"(word));
352 return bit;
353}
354
355/*
356 * special slimline version of fls() for calculating ilog2_u32()
357 * - note: no protection against n == 0
358 */
359#define ARCH_HAS_ILOG2_U32
360static inline __attribute__((const))
361int __ilog2_u32(u32 n)
362{
363 int bit;
364 asm("scan %1,gr0,%0" : "=r"(bit) : "r"(n));
365 return 31 - bit;
366}
367
368/*
369 * special slimline version of fls64() for calculating ilog2_u64()
370 * - note: no protection against n == 0
371 */
372#define ARCH_HAS_ILOG2_U64
373static inline __attribute__((const))
374int __ilog2_u64(u64 n)
375{
376 union {
377 u64 ll;
378 struct { u32 h, l; };
379 } _;
380 int bit, x, y;
381
382 _.ll = n;
383
384 asm(" subcc %3,gr0,gr0,icc0 \n"
385 " ckeq icc0,cc4 \n"
386 " cscan.p %3,gr0,%0 ,cc4,0 \n"
387 " setlos #63,%1 \n"
388 " cscan.p %4,gr0,%0 ,cc4,1 \n"
389 " setlos #31,%2 \n"
390 " csub.p %1,%0,%0 ,cc4,0 \n"
391 " csub %2,%0,%0 ,cc4,1 \n"
392 : "=&r"(bit), "=r"(x), "=r"(y)
393 : "0r"(_.h), "r"(_.l)
394 : "icc0", "cc4"
395 );
396 return bit;
397}
398
399#include <asm-generic/bitops/sched.h>
400#include <asm-generic/bitops/hweight.h>
401#include <asm-generic/bitops/lock.h>
402
403#include <asm-generic/bitops/ext2-non-atomic.h>
404
405#define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit ((nr) ^ 0x18, (addr))
406#define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr) ^ 0x18, (addr))
407
408#include <asm-generic/bitops/minix-le.h>
409
410#endif /* __KERNEL__ */
411
412#endif /* _ASM_BITOPS_H */
diff --git a/include/asm-frv/bug.h b/include/asm-frv/bug.h
deleted file mode 100644
index 6b1b44d71028..000000000000
--- a/include/asm-frv/bug.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/* bug.h: FRV bug trapping
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _ASM_BUG_H
12#define _ASM_BUG_H
13
14#include <linux/linkage.h>
15
16#ifdef CONFIG_BUG
17/*
18 * Tell the user there is some problem.
19 */
20extern asmlinkage void __debug_bug_trap(int signr);
21
22#ifdef CONFIG_NO_KERNEL_MSG
23#define _debug_bug_printk()
24#else
25extern void __debug_bug_printk(const char *file, unsigned line);
26#define _debug_bug_printk() __debug_bug_printk(__FILE__, __LINE__)
27#endif
28
29#define _debug_bug_trap(signr) \
30do { \
31 __debug_bug_trap(signr); \
32 asm volatile("nop"); \
33} while(0)
34
35#define HAVE_ARCH_BUG
36#define BUG() \
37do { \
38 _debug_bug_printk(); \
39 _debug_bug_trap(6 /*SIGABRT*/); \
40} while (0)
41
42#ifdef CONFIG_GDBSTUB
43#define HAVE_ARCH_KGDB_RAISE
44#define kgdb_raise(signr) do { _debug_bug_trap(signr); } while(0)
45
46#define HAVE_ARCH_KGDB_BAD_PAGE
47#define kgdb_bad_page(page) do { kgdb_raise(SIGABRT); } while(0)
48#endif
49#endif
50
51#include <asm-generic/bug.h>
52
53#endif
diff --git a/include/asm-frv/bugs.h b/include/asm-frv/bugs.h
deleted file mode 100644
index f2382be2b46c..000000000000
--- a/include/asm-frv/bugs.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/* bugs.h: arch bug checking entry
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12static inline void check_bugs(void)
13{
14}
diff --git a/include/asm-frv/busctl-regs.h b/include/asm-frv/busctl-regs.h
deleted file mode 100644
index bb0ff4816e27..000000000000
--- a/include/asm-frv/busctl-regs.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/* busctl-regs.h: FR400-series CPU bus controller registers
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_BUSCTL_REGS_H
13#define _ASM_BUSCTL_REGS_H
14
15/* bus controller registers */
16#define __get_LGCR() ({ *(volatile unsigned long *)(0xfe000010); })
17#define __get_LMAICR() ({ *(volatile unsigned long *)(0xfe000030); })
18#define __get_LEMBR() ({ *(volatile unsigned long *)(0xfe000040); })
19#define __get_LEMAM() ({ *(volatile unsigned long *)(0xfe000048); })
20#define __get_LCR(R) ({ *(volatile unsigned long *)(0xfe000100 + 8*(R)); })
21#define __get_LSBR(R) ({ *(volatile unsigned long *)(0xfe000c00 + 8*(R)); })
22#define __get_LSAM(R) ({ *(volatile unsigned long *)(0xfe000d00 + 8*(R)); })
23
24#define __set_LGCR(V) do { *(volatile unsigned long *)(0xfe000010) = (V); } while(0)
25#define __set_LMAICR(V) do { *(volatile unsigned long *)(0xfe000030) = (V); } while(0)
26#define __set_LEMBR(V) do { *(volatile unsigned long *)(0xfe000040) = (V); } while(0)
27#define __set_LEMAM(V) do { *(volatile unsigned long *)(0xfe000048) = (V); } while(0)
28#define __set_LCR(R,V) do { *(volatile unsigned long *)(0xfe000100 + 8*(R)) = (V); } while(0)
29#define __set_LSBR(R,V) do { *(volatile unsigned long *)(0xfe000c00 + 8*(R)) = (V); } while(0)
30#define __set_LSAM(R,V) do { *(volatile unsigned long *)(0xfe000d00 + 8*(R)) = (V); } while(0)
31
32/* FR401 SDRAM controller registers */
33#define __get_DBR(R) ({ *(volatile unsigned long *)(0xfe000e00 + 8*(R)); })
34#define __get_DAM(R) ({ *(volatile unsigned long *)(0xfe000f00 + 8*(R)); })
35
36/* FR551 SDRAM controller registers */
37#define __get_DARS(R) ({ *(volatile unsigned long *)(0xfeff0100 + 8*(R)); })
38#define __get_DAMK(R) ({ *(volatile unsigned long *)(0xfeff0110 + 8*(R)); })
39
40
41#endif /* _ASM_BUSCTL_REGS_H */
diff --git a/include/asm-frv/byteorder.h b/include/asm-frv/byteorder.h
deleted file mode 100644
index f29b7593e088..000000000000
--- a/include/asm-frv/byteorder.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_BYTEORDER_H
2#define _ASM_BYTEORDER_H
3
4#include <linux/byteorder/big_endian.h>
5
6#endif /* _ASM_BYTEORDER_H */
diff --git a/include/asm-frv/cache.h b/include/asm-frv/cache.h
deleted file mode 100644
index 2797163b8f4f..000000000000
--- a/include/asm-frv/cache.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/* cache.h: FRV cache definitions
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef __ASM_CACHE_H
13#define __ASM_CACHE_H
14
15
16/* bytes per L1 cache line */
17#define L1_CACHE_SHIFT (CONFIG_FRV_L1_CACHE_SHIFT)
18#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
19
20#define __cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES)))
21#define ____cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES)))
22
23#endif
diff --git a/include/asm-frv/cacheflush.h b/include/asm-frv/cacheflush.h
deleted file mode 100644
index 432a69e7f3d4..000000000000
--- a/include/asm-frv/cacheflush.h
+++ /dev/null
@@ -1,104 +0,0 @@
1/* cacheflush.h: FRV cache flushing routines
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_CACHEFLUSH_H
13#define _ASM_CACHEFLUSH_H
14
15/* Keep includes the same across arches. */
16#include <linux/mm.h>
17
18/*
19 * virtually-indexed cache management (our cache is physically indexed)
20 */
21#define flush_cache_all() do {} while(0)
22#define flush_cache_mm(mm) do {} while(0)
23#define flush_cache_dup_mm(mm) do {} while(0)
24#define flush_cache_range(mm, start, end) do {} while(0)
25#define flush_cache_page(vma, vmaddr, pfn) do {} while(0)
26#define flush_cache_vmap(start, end) do {} while(0)
27#define flush_cache_vunmap(start, end) do {} while(0)
28#define flush_dcache_mmap_lock(mapping) do {} while(0)
29#define flush_dcache_mmap_unlock(mapping) do {} while(0)
30
31/*
32 * physically-indexed cache management
33 * - see arch/frv/lib/cache.S
34 */
35extern void frv_dcache_writeback(unsigned long start, unsigned long size);
36extern void frv_cache_invalidate(unsigned long start, unsigned long size);
37extern void frv_icache_invalidate(unsigned long start, unsigned long size);
38extern void frv_cache_wback_inv(unsigned long start, unsigned long size);
39
40static inline void __flush_cache_all(void)
41{
42 asm volatile(" dcef @(gr0,gr0),#1 \n"
43 " icei @(gr0,gr0),#1 \n"
44 " membar \n"
45 : : : "memory"
46 );
47}
48
49/* dcache/icache coherency... */
50#ifdef CONFIG_MMU
51extern void flush_dcache_page(struct page *page);
52#else
53static inline void flush_dcache_page(struct page *page)
54{
55 unsigned long addr = page_to_phys(page);
56 frv_dcache_writeback(addr, addr + PAGE_SIZE);
57}
58#endif
59
60static inline void flush_page_to_ram(struct page *page)
61{
62 flush_dcache_page(page);
63}
64
65static inline void flush_icache(void)
66{
67 __flush_cache_all();
68}
69
70static inline void flush_icache_range(unsigned long start, unsigned long end)
71{
72 frv_cache_wback_inv(start, end);
73}
74
75#ifdef CONFIG_MMU
76extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
77 unsigned long start, unsigned long len);
78#else
79static inline void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
80 unsigned long start, unsigned long len)
81{
82 frv_cache_wback_inv(start, start + len);
83}
84#endif
85
86static inline void flush_icache_page(struct vm_area_struct *vma, struct page *page)
87{
88 flush_icache_user_range(vma, page, page_to_phys(page), PAGE_SIZE);
89}
90
91/*
92 * permit ptrace to access another process's address space through the icache
93 * and the dcache
94 */
95#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
96do { \
97 memcpy((dst), (src), (len)); \
98 flush_icache_user_range((vma), (page), (vaddr), (len)); \
99} while(0)
100
101#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
102 memcpy((dst), (src), (len))
103
104#endif /* _ASM_CACHEFLUSH_H */
diff --git a/include/asm-frv/checksum.h b/include/asm-frv/checksum.h
deleted file mode 100644
index 269da09ff637..000000000000
--- a/include/asm-frv/checksum.h
+++ /dev/null
@@ -1,180 +0,0 @@
1/* checksum.h: FRV checksumming
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_CHECKSUM_H
13#define _ASM_CHECKSUM_H
14
15#include <linux/in6.h>
16
17/*
18 * computes the checksum of a memory block at buff, length len,
19 * and adds in "sum" (32-bit)
20 *
21 * returns a 32-bit number suitable for feeding into itself
22 * or csum_tcpudp_magic
23 *
24 * this function must be called with even lengths, except
25 * for the last fragment, which may be odd
26 *
27 * it's best to have buff aligned on a 32-bit boundary
28 */
29__wsum csum_partial(const void *buff, int len, __wsum sum);
30
31/*
32 * the same as csum_partial, but copies from src while it
33 * checksums
34 *
35 * here even more important to align src and dst on a 32-bit (or even
36 * better 64-bit) boundary
37 */
38__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
39
40/*
41 * the same as csum_partial_copy, but copies from user space.
42 *
43 * here even more important to align src and dst on a 32-bit (or even
44 * better 64-bit) boundary
45 */
46extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
47 int len, __wsum sum, int *csum_err);
48
49/*
50 * This is a version of ip_compute_csum() optimized for IP headers,
51 * which always checksum on 4 octet boundaries.
52 *
53 */
54static inline
55__sum16 ip_fast_csum(const void *iph, unsigned int ihl)
56{
57 unsigned int tmp, inc, sum = 0;
58
59 asm(" addcc gr0,gr0,gr0,icc0\n" /* clear icc0.C */
60 " subi %1,#4,%1 \n"
61 "0: \n"
62 " ldu.p @(%1,%3),%4 \n"
63 " subicc %2,#1,%2,icc1 \n"
64 " addxcc.p %4,%0,%0,icc0 \n"
65 " bhi icc1,#2,0b \n"
66
67 /* fold the 33-bit result into 16-bits */
68 " addxcc gr0,%0,%0,icc0 \n"
69 " srli %0,#16,%1 \n"
70 " sethi #0,%0 \n"
71 " add %1,%0,%0 \n"
72 " srli %0,#16,%1 \n"
73 " add %1,%0,%0 \n"
74
75 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (inc), "=&r"(tmp)
76 : "0" (sum), "1" (iph), "2" (ihl), "3" (4),
77 "m"(*(volatile struct { int _[100]; } *)iph)
78 : "icc0", "icc1", "memory"
79 );
80
81 return (__force __sum16)~sum;
82}
83
84/*
85 * Fold a partial checksum
86 */
87static inline __sum16 csum_fold(__wsum sum)
88{
89 unsigned int tmp;
90
91 asm(" srli %0,#16,%1 \n"
92 " sethi #0,%0 \n"
93 " add %1,%0,%0 \n"
94 " srli %0,#16,%1 \n"
95 " add %1,%0,%0 \n"
96 : "=r"(sum), "=&r"(tmp)
97 : "0"(sum)
98 );
99
100 return (__force __sum16)~sum;
101}
102
103/*
104 * computes the checksum of the TCP/UDP pseudo-header
105 * returns a 16-bit checksum, already complemented
106 */
107static inline __wsum
108csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
109 unsigned short proto, __wsum sum)
110{
111 asm(" addcc %1,%0,%0,icc0 \n"
112 " addxcc %2,%0,%0,icc0 \n"
113 " addxcc %3,%0,%0,icc0 \n"
114 " addxcc gr0,%0,%0,icc0 \n"
115 : "=r" (sum)
116 : "r" (daddr), "r" (saddr), "r" (len + proto), "0"(sum)
117 : "icc0"
118 );
119 return sum;
120}
121
122static inline __sum16
123csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
124 unsigned short proto, __wsum sum)
125{
126 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
127}
128
129/*
130 * this routine is used for miscellaneous IP-like checksums, mainly
131 * in icmp.c
132 */
133extern __sum16 ip_compute_csum(const void *buff, int len);
134
135#define _HAVE_ARCH_IPV6_CSUM
136static inline __sum16
137csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
138 __u32 len, unsigned short proto, __wsum sum)
139{
140 unsigned long tmp, tmp2;
141
142 asm(" addcc %2,%0,%0,icc0 \n"
143
144 /* add up the source addr */
145 " ldi @(%3,0),%1 \n"
146 " addxcc %1,%0,%0,icc0 \n"
147 " ldi @(%3,4),%2 \n"
148 " addxcc %2,%0,%0,icc0 \n"
149 " ldi @(%3,8),%1 \n"
150 " addxcc %1,%0,%0,icc0 \n"
151 " ldi @(%3,12),%2 \n"
152 " addxcc %2,%0,%0,icc0 \n"
153
154 /* add up the dest addr */
155 " ldi @(%4,0),%1 \n"
156 " addxcc %1,%0,%0,icc0 \n"
157 " ldi @(%4,4),%2 \n"
158 " addxcc %2,%0,%0,icc0 \n"
159 " ldi @(%4,8),%1 \n"
160 " addxcc %1,%0,%0,icc0 \n"
161 " ldi @(%4,12),%2 \n"
162 " addxcc %2,%0,%0,icc0 \n"
163
164 /* fold the 33-bit result into 16-bits */
165 " addxcc gr0,%0,%0,icc0 \n"
166 " srli %0,#16,%1 \n"
167 " sethi #0,%0 \n"
168 " add %1,%0,%0 \n"
169 " srli %0,#16,%1 \n"
170 " add %1,%0,%0 \n"
171
172 : "=r" (sum), "=&r" (tmp), "=r" (tmp2)
173 : "r" (saddr), "r" (daddr), "0" (sum), "2" (len + proto)
174 : "icc0"
175 );
176
177 return (__force __sum16)~sum;
178}
179
180#endif /* _ASM_CHECKSUM_H */
diff --git a/include/asm-frv/cpu-irqs.h b/include/asm-frv/cpu-irqs.h
deleted file mode 100644
index 478f3498fcfe..000000000000
--- a/include/asm-frv/cpu-irqs.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/* cpu-irqs.h: on-CPU peripheral irqs
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_CPU_IRQS_H
13#define _ASM_CPU_IRQS_H
14
15#ifndef __ASSEMBLY__
16
17/* IRQ to level mappings */
18#define IRQ_GDBSTUB_LEVEL 15
19#define IRQ_UART_LEVEL 13
20
21#ifdef CONFIG_GDBSTUB_UART0
22#define IRQ_UART0_LEVEL IRQ_GDBSTUB_LEVEL
23#else
24#define IRQ_UART0_LEVEL IRQ_UART_LEVEL
25#endif
26
27#ifdef CONFIG_GDBSTUB_UART1
28#define IRQ_UART1_LEVEL IRQ_GDBSTUB_LEVEL
29#else
30#define IRQ_UART1_LEVEL IRQ_UART_LEVEL
31#endif
32
33#define IRQ_DMA0_LEVEL 14
34#define IRQ_DMA1_LEVEL 14
35#define IRQ_DMA2_LEVEL 14
36#define IRQ_DMA3_LEVEL 14
37#define IRQ_DMA4_LEVEL 14
38#define IRQ_DMA5_LEVEL 14
39#define IRQ_DMA6_LEVEL 14
40#define IRQ_DMA7_LEVEL 14
41
42#define IRQ_TIMER0_LEVEL 12
43#define IRQ_TIMER1_LEVEL 11
44#define IRQ_TIMER2_LEVEL 10
45
46#define IRQ_XIRQ0_LEVEL 1
47#define IRQ_XIRQ1_LEVEL 2
48#define IRQ_XIRQ2_LEVEL 3
49#define IRQ_XIRQ3_LEVEL 4
50#define IRQ_XIRQ4_LEVEL 5
51#define IRQ_XIRQ5_LEVEL 6
52#define IRQ_XIRQ6_LEVEL 7
53#define IRQ_XIRQ7_LEVEL 8
54
55/* IRQ IDs presented to drivers */
56#define IRQ_CPU__UNUSED IRQ_BASE_CPU
57#define IRQ_CPU_UART0 (IRQ_BASE_CPU + IRQ_UART0_LEVEL)
58#define IRQ_CPU_UART1 (IRQ_BASE_CPU + IRQ_UART1_LEVEL)
59#define IRQ_CPU_TIMER0 (IRQ_BASE_CPU + IRQ_TIMER0_LEVEL)
60#define IRQ_CPU_TIMER1 (IRQ_BASE_CPU + IRQ_TIMER1_LEVEL)
61#define IRQ_CPU_TIMER2 (IRQ_BASE_CPU + IRQ_TIMER2_LEVEL)
62#define IRQ_CPU_DMA0 (IRQ_BASE_CPU + IRQ_DMA0_LEVEL)
63#define IRQ_CPU_DMA1 (IRQ_BASE_CPU + IRQ_DMA1_LEVEL)
64#define IRQ_CPU_DMA2 (IRQ_BASE_CPU + IRQ_DMA2_LEVEL)
65#define IRQ_CPU_DMA3 (IRQ_BASE_CPU + IRQ_DMA3_LEVEL)
66#define IRQ_CPU_DMA4 (IRQ_BASE_CPU + IRQ_DMA4_LEVEL)
67#define IRQ_CPU_DMA5 (IRQ_BASE_CPU + IRQ_DMA5_LEVEL)
68#define IRQ_CPU_DMA6 (IRQ_BASE_CPU + IRQ_DMA6_LEVEL)
69#define IRQ_CPU_DMA7 (IRQ_BASE_CPU + IRQ_DMA7_LEVEL)
70#define IRQ_CPU_EXTERNAL0 (IRQ_BASE_CPU + IRQ_XIRQ0_LEVEL)
71#define IRQ_CPU_EXTERNAL1 (IRQ_BASE_CPU + IRQ_XIRQ1_LEVEL)
72#define IRQ_CPU_EXTERNAL2 (IRQ_BASE_CPU + IRQ_XIRQ2_LEVEL)
73#define IRQ_CPU_EXTERNAL3 (IRQ_BASE_CPU + IRQ_XIRQ3_LEVEL)
74#define IRQ_CPU_EXTERNAL4 (IRQ_BASE_CPU + IRQ_XIRQ4_LEVEL)
75#define IRQ_CPU_EXTERNAL5 (IRQ_BASE_CPU + IRQ_XIRQ5_LEVEL)
76#define IRQ_CPU_EXTERNAL6 (IRQ_BASE_CPU + IRQ_XIRQ6_LEVEL)
77#define IRQ_CPU_EXTERNAL7 (IRQ_BASE_CPU + IRQ_XIRQ7_LEVEL)
78
79#endif /* !__ASSEMBLY__ */
80
81#endif /* _ASM_CPU_IRQS_H */
diff --git a/include/asm-frv/cpumask.h b/include/asm-frv/cpumask.h
deleted file mode 100644
index d999c20c84d2..000000000000
--- a/include/asm-frv/cpumask.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_CPUMASK_H
2#define _ASM_CPUMASK_H
3
4#include <asm-generic/cpumask.h>
5
6#endif /* _ASM_CPUMASK_H */
diff --git a/include/asm-frv/cputime.h b/include/asm-frv/cputime.h
deleted file mode 100644
index f6c373ad2b80..000000000000
--- a/include/asm-frv/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_CPUTIME_H
2#define _ASM_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* _ASM_CPUTIME_H */
diff --git a/include/asm-frv/current.h b/include/asm-frv/current.h
deleted file mode 100644
index 86b027491b08..000000000000
--- a/include/asm-frv/current.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/* current.h: FRV current task pointer
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_CURRENT_H
13#define _ASM_CURRENT_H
14
15#ifndef __ASSEMBLY__
16
17/*
18 * dedicate GR29 to keeping the current task pointer
19 */
20register struct task_struct *current asm("gr29");
21
22#define get_current() current
23
24#else
25
26#define CURRENT gr29
27
28#endif
29
30#endif /* _ASM_CURRENT_H */
diff --git a/include/asm-frv/delay.h b/include/asm-frv/delay.h
deleted file mode 100644
index 597b4ebf03b4..000000000000
--- a/include/asm-frv/delay.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/* delay.h: FRV delay code
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_DELAY_H
13#define _ASM_DELAY_H
14
15#include <asm/param.h>
16#include <asm/timer-regs.h>
17
18/*
19 * delay loop - runs at __core_clock_speed_HZ / 2 [there are 2 insns in the loop]
20 */
21extern unsigned long __delay_loops_MHz;
22
23static inline void __delay(unsigned long loops)
24{
25 asm volatile("1: subicc %0,#1,%0,icc0 \n"
26 " bnc icc0,#2,1b \n"
27 : "=r" (loops)
28 : "0" (loops)
29 : "icc0"
30 );
31}
32
33/*
34 * Use only for very small delays ( < 1 msec). Should probably use a
35 * lookup table, really, as the multiplications take much too long with
36 * short delays. This is a "reasonable" implementation, though (and the
37 * first constant multiplications gets optimized away if the delay is
38 * a constant)
39 */
40
41extern unsigned long loops_per_jiffy;
42
43static inline void udelay(unsigned long usecs)
44{
45 __delay(usecs * __delay_loops_MHz);
46}
47
48#define ndelay(n) udelay((n) * 5)
49
50#endif /* _ASM_DELAY_H */
diff --git a/include/asm-frv/device.h b/include/asm-frv/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/include/asm-frv/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-frv/div64.h b/include/asm-frv/div64.h
deleted file mode 100644
index 6cd978cefb28..000000000000
--- a/include/asm-frv/div64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/div64.h>
diff --git a/include/asm-frv/dm9000.h b/include/asm-frv/dm9000.h
deleted file mode 100644
index f6f48fd9ec6e..000000000000
--- a/include/asm-frv/dm9000.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/* dm9000.h: Davicom DM9000 adapter configuration
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_DM9000_H
13#define _ASM_DM9000_H
14
15#include <asm/mb-regs.h>
16
17#define DM9000_ARCH_IOBASE (__region_CS6 + 0x300)
18#define DM9000_ARCH_IRQ IRQ_CPU_EXTERNAL3 /* XIRQ #3 (shared with FPGA) */
19#undef DM9000_ARCH_IRQ_ACTLOW /* IRQ pin active high */
20#define DM9000_ARCH_BUS_INFO "CS6#+0x300" /* bus info for ethtool */
21
22#undef __is_PCI_IO
23#define __is_PCI_IO(addr) 0 /* not PCI */
24
25#undef inl
26#define inl(addr) \
27({ \
28 unsigned long __ioaddr = (unsigned long) addr; \
29 uint32_t x = readl(__ioaddr); \
30 ((x & 0xff) << 24) | ((x & 0xff00) << 8) | ((x >> 8) & 0xff00) | ((x >> 24) & 0xff); \
31})
32
33#undef insl
34#define insl(a,b,l) __insl(a,b,l,0) /* don't byte-swap */
35
36
37#endif /* _ASM_DM9000_H */
diff --git a/include/asm-frv/dma-mapping.h b/include/asm-frv/dma-mapping.h
deleted file mode 100644
index b2898877c07b..000000000000
--- a/include/asm-frv/dma-mapping.h
+++ /dev/null
@@ -1,174 +0,0 @@
1#ifndef _ASM_DMA_MAPPING_H
2#define _ASM_DMA_MAPPING_H
3
4#include <linux/device.h>
5#include <asm/cache.h>
6#include <asm/cacheflush.h>
7#include <asm/scatterlist.h>
8#include <asm/io.h>
9
10#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
11#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
12
13extern unsigned long __nongprelbss dma_coherent_mem_start;
14extern unsigned long __nongprelbss dma_coherent_mem_end;
15
16void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp);
17void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle);
18
19/*
20 * Map a single buffer of the indicated size for DMA in streaming mode.
21 * The 32-bit bus address to use is returned.
22 *
23 * Once the device is given the dma address, the device owns this memory
24 * until either pci_unmap_single or pci_dma_sync_single is performed.
25 */
26extern dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
27 enum dma_data_direction direction);
28
29/*
30 * Unmap a single streaming mode DMA translation. The dma_addr and size
31 * must match what was provided for in a previous pci_map_single call. All
32 * other usages are undefined.
33 *
34 * After this call, reads by the cpu to the buffer are guarenteed to see
35 * whatever the device wrote there.
36 */
37static inline
38void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
39 enum dma_data_direction direction)
40{
41 BUG_ON(direction == DMA_NONE);
42}
43
44/*
45 * Map a set of buffers described by scatterlist in streaming
46 * mode for DMA. This is the scather-gather version of the
47 * above pci_map_single interface. Here the scatter gather list
48 * elements are each tagged with the appropriate dma address
49 * and length. They are obtained via sg_dma_{address,length}(SG).
50 *
51 * NOTE: An implementation may be able to use a smaller number of
52 * DMA address/length pairs than there are SG table elements.
53 * (for example via virtual mapping capabilities)
54 * The routine returns the number of addr/length pairs actually
55 * used, at most nents.
56 *
57 * Device ownership issues as mentioned above for pci_map_single are
58 * the same here.
59 */
60extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
61 enum dma_data_direction direction);
62
63/*
64 * Unmap a set of streaming mode DMA translations.
65 * Again, cpu read rules concerning calls here are the same as for
66 * pci_unmap_single() above.
67 */
68static inline
69void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
70 enum dma_data_direction direction)
71{
72 BUG_ON(direction == DMA_NONE);
73}
74
75extern
76dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset,
77 size_t size, enum dma_data_direction direction);
78
79static inline
80void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
81 enum dma_data_direction direction)
82{
83 BUG_ON(direction == DMA_NONE);
84}
85
86
87static inline
88void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
89 enum dma_data_direction direction)
90{
91}
92
93static inline
94void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
95 enum dma_data_direction direction)
96{
97 flush_write_buffers();
98}
99
100static inline
101void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
102 unsigned long offset, size_t size,
103 enum dma_data_direction direction)
104{
105}
106
107static inline
108void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
109 unsigned long offset, size_t size,
110 enum dma_data_direction direction)
111{
112 flush_write_buffers();
113}
114
115static inline
116void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
117 enum dma_data_direction direction)
118{
119}
120
121static inline
122void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
123 enum dma_data_direction direction)
124{
125 flush_write_buffers();
126}
127
128static inline
129int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
130{
131 return 0;
132}
133
134static inline
135int dma_supported(struct device *dev, u64 mask)
136{
137 /*
138 * we fall back to GFP_DMA when the mask isn't all 1s,
139 * so we can't guarantee allocations that must be
140 * within a tighter range than GFP_DMA..
141 */
142 if (mask < 0x00ffffff)
143 return 0;
144
145 return 1;
146}
147
148static inline
149int dma_set_mask(struct device *dev, u64 mask)
150{
151 if (!dev->dma_mask || !dma_supported(dev, mask))
152 return -EIO;
153
154 *dev->dma_mask = mask;
155
156 return 0;
157}
158
159static inline
160int dma_get_cache_alignment(void)
161{
162 return 1 << L1_CACHE_SHIFT;
163}
164
165#define dma_is_consistent(d, h) (1)
166
167static inline
168void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
169 enum dma_data_direction direction)
170{
171 flush_write_buffers();
172}
173
174#endif /* _ASM_DMA_MAPPING_H */
diff --git a/include/asm-frv/dma.h b/include/asm-frv/dma.h
deleted file mode 100644
index 683c47d48a5b..000000000000
--- a/include/asm-frv/dma.h
+++ /dev/null
@@ -1,125 +0,0 @@
1/* dma.h: FRV DMA controller management
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_DMA_H
13#define _ASM_DMA_H
14
15//#define DMA_DEBUG 1
16
17#include <linux/interrupt.h>
18
19#undef MAX_DMA_CHANNELS /* don't use kernel/dma.c */
20
21/* under 2.4 this is actually needed by the new bootmem allocator */
22#define MAX_DMA_ADDRESS PAGE_OFFSET
23
24/*
25 * FRV DMA controller management
26 */
27typedef irqreturn_t (*dma_irq_handler_t)(int dmachan, unsigned long cstr, void *data);
28
29extern void frv_dma_init(void);
30
31extern int frv_dma_open(const char *devname,
32 unsigned long dmamask,
33 int dmacap,
34 dma_irq_handler_t handler,
35 unsigned long irq_flags,
36 void *data);
37
38/* channels required */
39#define FRV_DMA_MASK_ANY ULONG_MAX /* any channel */
40
41/* capabilities required */
42#define FRV_DMA_CAP_DREQ 0x01 /* DMA request pin */
43#define FRV_DMA_CAP_DACK 0x02 /* DMA ACK pin */
44#define FRV_DMA_CAP_DONE 0x04 /* DMA done pin */
45
46extern void frv_dma_close(int dma);
47
48extern void frv_dma_config(int dma, unsigned long ccfr, unsigned long cctr, unsigned long apr);
49
50extern void frv_dma_start(int dma,
51 unsigned long sba, unsigned long dba,
52 unsigned long pix, unsigned long six, unsigned long bcl);
53
54extern void frv_dma_restart_circular(int dma, unsigned long six);
55
56extern void frv_dma_stop(int dma);
57
58extern int is_frv_dma_interrupting(int dma);
59
60extern void frv_dma_dump(int dma);
61
62extern void frv_dma_status_clear(int dma);
63
64#define FRV_DMA_NCHANS 8
65#define FRV_DMA_4CHANS 4
66#define FRV_DMA_8CHANS 8
67
68#define DMAC_CCFRx 0x00 /* channel configuration reg */
69#define DMAC_CCFRx_CM_SHIFT 16
70#define DMAC_CCFRx_CM_DA 0x00000000
71#define DMAC_CCFRx_CM_SCA 0x00010000
72#define DMAC_CCFRx_CM_DCA 0x00020000
73#define DMAC_CCFRx_CM_2D 0x00030000
74#define DMAC_CCFRx_ATS_SHIFT 8
75#define DMAC_CCFRx_RS_INTERN 0x00000000
76#define DMAC_CCFRx_RS_EXTERN 0x00000001
77#define DMAC_CCFRx_RS_SHIFT 0
78
79#define DMAC_CSTRx 0x08 /* channel status reg */
80#define DMAC_CSTRx_FS 0x0000003f
81#define DMAC_CSTRx_NE 0x00000100
82#define DMAC_CSTRx_FED 0x00000200
83#define DMAC_CSTRx_WER 0x00000800
84#define DMAC_CSTRx_RER 0x00001000
85#define DMAC_CSTRx_CE 0x00002000
86#define DMAC_CSTRx_INT 0x00800000
87#define DMAC_CSTRx_BUSY 0x80000000
88
89#define DMAC_CCTRx 0x10 /* channel control reg */
90#define DMAC_CCTRx_DSIZ_1 0x00000000
91#define DMAC_CCTRx_DSIZ_2 0x00000001
92#define DMAC_CCTRx_DSIZ_4 0x00000002
93#define DMAC_CCTRx_DSIZ_32 0x00000005
94#define DMAC_CCTRx_DAU_HOLD 0x00000000
95#define DMAC_CCTRx_DAU_INC 0x00000010
96#define DMAC_CCTRx_DAU_DEC 0x00000020
97#define DMAC_CCTRx_SSIZ_1 0x00000000
98#define DMAC_CCTRx_SSIZ_2 0x00000100
99#define DMAC_CCTRx_SSIZ_4 0x00000200
100#define DMAC_CCTRx_SSIZ_32 0x00000500
101#define DMAC_CCTRx_SAU_HOLD 0x00000000
102#define DMAC_CCTRx_SAU_INC 0x00001000
103#define DMAC_CCTRx_SAU_DEC 0x00002000
104#define DMAC_CCTRx_FC 0x08000000
105#define DMAC_CCTRx_ICE 0x10000000
106#define DMAC_CCTRx_IE 0x40000000
107#define DMAC_CCTRx_ACT 0x80000000
108
109#define DMAC_SBAx 0x18 /* source base address reg */
110#define DMAC_DBAx 0x20 /* data base address reg */
111#define DMAC_PIXx 0x28 /* primary index reg */
112#define DMAC_SIXx 0x30 /* secondary index reg */
113#define DMAC_BCLx 0x38 /* byte count limit reg */
114#define DMAC_APRx 0x40 /* alternate pointer reg */
115
116/*
117 * required for PCI + MODULES
118 */
119#ifdef CONFIG_PCI
120extern int isa_dma_bridge_buggy;
121#else
122#define isa_dma_bridge_buggy (0)
123#endif
124
125#endif /* _ASM_DMA_H */
diff --git a/include/asm-frv/elf.h b/include/asm-frv/elf.h
deleted file mode 100644
index 7279ec07d62e..000000000000
--- a/include/asm-frv/elf.h
+++ /dev/null
@@ -1,142 +0,0 @@
1/* elf.h: FR-V ELF definitions
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from include/asm-m68knommu/elf.h
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12#ifndef __ASM_ELF_H
13#define __ASM_ELF_H
14
15#include <asm/ptrace.h>
16#include <asm/user.h>
17
18struct elf32_hdr;
19
20/*
21 * ELF header e_flags defines.
22 */
23#define EF_FRV_GPR_MASK 0x00000003 /* mask for # of gprs */
24#define EF_FRV_GPR32 0x00000001 /* Only uses GR on 32-register */
25#define EF_FRV_GPR64 0x00000002 /* Only uses GR on 64-register */
26#define EF_FRV_FPR_MASK 0x0000000c /* mask for # of fprs */
27#define EF_FRV_FPR32 0x00000004 /* Only uses FR on 32-register */
28#define EF_FRV_FPR64 0x00000008 /* Only uses FR on 64-register */
29#define EF_FRV_FPR_NONE 0x0000000C /* Uses software floating-point */
30#define EF_FRV_DWORD_MASK 0x00000030 /* mask for dword support */
31#define EF_FRV_DWORD_YES 0x00000010 /* Assumes stack aligned to 8-byte boundaries. */
32#define EF_FRV_DWORD_NO 0x00000020 /* Assumes stack aligned to 4-byte boundaries. */
33#define EF_FRV_DOUBLE 0x00000040 /* Uses double instructions. */
34#define EF_FRV_MEDIA 0x00000080 /* Uses media instructions. */
35#define EF_FRV_PIC 0x00000100 /* Uses position independent code. */
36#define EF_FRV_NON_PIC_RELOCS 0x00000200 /* Does not use position Independent code. */
37#define EF_FRV_MULADD 0x00000400 /* -mmuladd */
38#define EF_FRV_BIGPIC 0x00000800 /* -fPIC */
39#define EF_FRV_LIBPIC 0x00001000 /* -mlibrary-pic */
40#define EF_FRV_G0 0x00002000 /* -G 0, no small data ptr */
41#define EF_FRV_NOPACK 0x00004000 /* -mnopack */
42#define EF_FRV_FDPIC 0x00008000 /* -mfdpic */
43#define EF_FRV_CPU_MASK 0xff000000 /* specific cpu bits */
44#define EF_FRV_CPU_GENERIC 0x00000000 /* Set CPU type is FR-V */
45#define EF_FRV_CPU_FR500 0x01000000 /* Set CPU type is FR500 */
46#define EF_FRV_CPU_FR300 0x02000000 /* Set CPU type is FR300 */
47#define EF_FRV_CPU_SIMPLE 0x03000000 /* SIMPLE */
48#define EF_FRV_CPU_TOMCAT 0x04000000 /* Tomcat, FR500 prototype */
49#define EF_FRV_CPU_FR400 0x05000000 /* Set CPU type is FR400 */
50#define EF_FRV_CPU_FR550 0x06000000 /* Set CPU type is FR550 */
51#define EF_FRV_CPU_FR405 0x07000000 /* Set CPU type is FR405 */
52#define EF_FRV_CPU_FR450 0x08000000 /* Set CPU type is FR450 */
53
54/*
55 * FR-V ELF relocation types
56 */
57
58
59/*
60 * ELF register definitions..
61 */
62typedef unsigned long elf_greg_t;
63
64#define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t))
65typedef elf_greg_t elf_gregset_t[ELF_NGREG];
66
67typedef struct user_fpmedia_regs elf_fpregset_t;
68
69/*
70 * This is used to ensure we don't load something for the wrong architecture.
71 */
72extern int elf_check_arch(const struct elf32_hdr *hdr);
73
74#define elf_check_fdpic(x) ((x)->e_flags & EF_FRV_FDPIC && !((x)->e_flags & EF_FRV_NON_PIC_RELOCS))
75#define elf_check_const_displacement(x) ((x)->e_flags & EF_FRV_PIC)
76
77/*
78 * These are used to set parameters in the core dumps.
79 */
80#define ELF_CLASS ELFCLASS32
81#define ELF_DATA ELFDATA2MSB
82#define ELF_ARCH EM_FRV
83
84#define ELF_PLAT_INIT(_r) \
85do { \
86 __kernel_frame0_ptr->gr16 = 0; \
87 __kernel_frame0_ptr->gr17 = 0; \
88 __kernel_frame0_ptr->gr18 = 0; \
89 __kernel_frame0_ptr->gr19 = 0; \
90 __kernel_frame0_ptr->gr20 = 0; \
91 __kernel_frame0_ptr->gr21 = 0; \
92 __kernel_frame0_ptr->gr22 = 0; \
93 __kernel_frame0_ptr->gr23 = 0; \
94 __kernel_frame0_ptr->gr24 = 0; \
95 __kernel_frame0_ptr->gr25 = 0; \
96 __kernel_frame0_ptr->gr26 = 0; \
97 __kernel_frame0_ptr->gr27 = 0; \
98 __kernel_frame0_ptr->gr29 = 0; \
99} while(0)
100
101#define ELF_FDPIC_PLAT_INIT(_regs, _exec_map_addr, _interp_map_addr, _dynamic_addr) \
102do { \
103 __kernel_frame0_ptr->gr16 = _exec_map_addr; \
104 __kernel_frame0_ptr->gr17 = _interp_map_addr; \
105 __kernel_frame0_ptr->gr18 = _dynamic_addr; \
106 __kernel_frame0_ptr->gr19 = 0; \
107 __kernel_frame0_ptr->gr20 = 0; \
108 __kernel_frame0_ptr->gr21 = 0; \
109 __kernel_frame0_ptr->gr22 = 0; \
110 __kernel_frame0_ptr->gr23 = 0; \
111 __kernel_frame0_ptr->gr24 = 0; \
112 __kernel_frame0_ptr->gr25 = 0; \
113 __kernel_frame0_ptr->gr26 = 0; \
114 __kernel_frame0_ptr->gr27 = 0; \
115 __kernel_frame0_ptr->gr29 = 0; \
116} while(0)
117
118#define USE_ELF_CORE_DUMP
119#define ELF_FDPIC_CORE_EFLAGS EF_FRV_FDPIC
120#define ELF_EXEC_PAGESIZE 16384
121
122/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
123 use of this is to invoke "./ld.so someprog" to test out a new version of
124 the loader. We need to make sure that it is out of the way of the program
125 that it will "exec", and that there is sufficient room for the brk. */
126
127#define ELF_ET_DYN_BASE 0x08000000UL
128
129/* This yields a mask that user programs can use to figure out what
130 instruction set this cpu supports. */
131
132#define ELF_HWCAP (0)
133
134/* This yields a string that ld.so will use to load implementation
135 specific libraries for optimization. This is more specific in
136 intent than poking at uname or /proc/cpuinfo. */
137
138#define ELF_PLATFORM (NULL)
139
140#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
141
142#endif
diff --git a/include/asm-frv/emergency-restart.h b/include/asm-frv/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/include/asm-frv/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/include/asm-frv/errno.h b/include/asm-frv/errno.h
deleted file mode 100644
index d010795ceefe..000000000000
--- a/include/asm-frv/errno.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_ERRNO_H
2#define _ASM_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#endif /* _ASM_ERRNO_H */
7
diff --git a/include/asm-frv/fb.h b/include/asm-frv/fb.h
deleted file mode 100644
index c7df38030992..000000000000
--- a/include/asm-frv/fb.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* _ASM_FB_H_ */
diff --git a/include/asm-frv/fcntl.h b/include/asm-frv/fcntl.h
deleted file mode 100644
index 46ab12db5739..000000000000
--- a/include/asm-frv/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/fcntl.h>
diff --git a/include/asm-frv/fpu.h b/include/asm-frv/fpu.h
deleted file mode 100644
index d73c60b56641..000000000000
--- a/include/asm-frv/fpu.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef __ASM_FPU_H
2#define __ASM_FPU_H
3
4
5/*
6 * MAX floating point unit state size (FSAVE/FRESTORE)
7 */
8
9#define kernel_fpu_end() do { asm volatile("bar":::"memory"); preempt_enable(); } while(0)
10
11#endif /* __ASM_FPU_H */
diff --git a/include/asm-frv/ftrace.h b/include/asm-frv/ftrace.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/include/asm-frv/ftrace.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/include/asm-frv/futex.h b/include/asm-frv/futex.h
deleted file mode 100644
index 08b3d1da3583..000000000000
--- a/include/asm-frv/futex.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10extern int futex_atomic_op_inuser(int encoded_op, int __user *uaddr);
11
12static inline int
13futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
14{
15 return -ENOSYS;
16}
17
18#endif
19#endif
diff --git a/include/asm-frv/gdb-stub.h b/include/asm-frv/gdb-stub.h
deleted file mode 100644
index 24f9738670bd..000000000000
--- a/include/asm-frv/gdb-stub.h
+++ /dev/null
@@ -1,140 +0,0 @@
1/* gdb-stub.h: FRV GDB stub
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from asm-mips/gdb-stub.h (c) 1995 Andreas Busse
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12#ifndef __ASM_GDB_STUB_H
13#define __ASM_GDB_STUB_H
14
15#undef GDBSTUB_DEBUG_PROTOCOL
16
17#include <asm/ptrace.h>
18
19/*
20 * important register numbers in GDB protocol
21 * - GR0, GR1, GR2, GR3, GR4, GR5, GR6, GR7,
22 * - GR8, GR9, GR10, GR11, GR12, GR13, GR14, GR15,
23 * - GR16, GR17, GR18, GR19, GR20, GR21, GR22, GR23,
24 * - GR24, GR25, GR26, GR27, GR28, GR29, GR30, GR31,
25 * - GR32, GR33, GR34, GR35, GR36, GR37, GR38, GR39,
26 * - GR40, GR41, GR42, GR43, GR44, GR45, GR46, GR47,
27 * - GR48, GR49, GR50, GR51, GR52, GR53, GR54, GR55,
28 * - GR56, GR57, GR58, GR59, GR60, GR61, GR62, GR63,
29 * - FR0, FR1, FR2, FR3, FR4, FR5, FR6, FR7,
30 * - FR8, FR9, FR10, FR11, FR12, FR13, FR14, FR15,
31 * - FR16, FR17, FR18, FR19, FR20, FR21, FR22, FR23,
32 * - FR24, FR25, FR26, FR27, FR28, FR29, FR30, FR31,
33 * - FR32, FR33, FR34, FR35, FR36, FR37, FR38, FR39,
34 * - FR40, FR41, FR42, FR43, FR44, FR45, FR46, FR47,
35 * - FR48, FR49, FR50, FR51, FR52, FR53, FR54, FR55,
36 * - FR56, FR57, FR58, FR59, FR60, FR61, FR62, FR63,
37 * - PC, PSR, CCR, CCCR,
38 * - _X132, _X133, _X134
39 * - TBR, BRR, DBAR0, DBAR1, DBAR2, DBAR3,
40 * - SCR0, SCR1, SCR2, SCR3,
41 * - LR, LCR,
42 * - IACC0H, IACC0L,
43 * - FSR0,
44 * - ACC0, ACC1, ACC2, ACC3, ACC4, ACC5, ACC6, ACC7,
45 * - ACCG0123, ACCG4567,
46 * - MSR0, MSR1,
47 * - GNER0, GNER1,
48 * - FNER0, FNER1,
49 */
50#define GDB_REG_GR(N) (N)
51#define GDB_REG_FR(N) (64+(N))
52#define GDB_REG_PC 128
53#define GDB_REG_PSR 129
54#define GDB_REG_CCR 130
55#define GDB_REG_CCCR 131
56#define GDB_REG_TBR 135
57#define GDB_REG_BRR 136
58#define GDB_REG_DBAR(N) (137+(N))
59#define GDB_REG_SCR(N) (141+(N))
60#define GDB_REG_LR 145
61#define GDB_REG_LCR 146
62#define GDB_REG_FSR0 149
63#define GDB_REG_ACC(N) (150+(N))
64#define GDB_REG_ACCG(N) (158+(N)/4)
65#define GDB_REG_MSR(N) (160+(N))
66#define GDB_REG_GNER(N) (162+(N))
67#define GDB_REG_FNER(N) (164+(N))
68
69#define GDB_REG_SP GDB_REG_GR(1)
70#define GDB_REG_FP GDB_REG_GR(2)
71
72#ifndef _LANGUAGE_ASSEMBLY
73
74/*
75 * Prototypes
76 */
77extern void show_registers_only(struct pt_regs *regs);
78
79extern void gdbstub_init(void);
80extern void gdbstub(int type);
81extern void gdbstub_exit(int status);
82
83extern void gdbstub_io_init(void);
84extern void gdbstub_set_baud(unsigned baud);
85extern int gdbstub_rx_char(unsigned char *_ch, int nonblock);
86extern void gdbstub_tx_char(unsigned char ch);
87extern void gdbstub_tx_flush(void);
88extern void gdbstub_do_rx(void);
89
90extern asmlinkage void __debug_stub_init_break(void);
91extern asmlinkage void __break_hijack_kernel_event(void);
92extern asmlinkage void __break_hijack_kernel_event_breaks_here(void);
93extern asmlinkage void start_kernel(void);
94
95extern asmlinkage void gdbstub_rx_handler(void);
96extern asmlinkage void gdbstub_rx_irq(void);
97extern asmlinkage void gdbstub_intercept(void);
98
99extern uint32_t __entry_usertrap_table[];
100extern uint32_t __entry_kerneltrap_table[];
101
102extern volatile u8 gdbstub_rx_buffer[PAGE_SIZE];
103extern volatile u32 gdbstub_rx_inp;
104extern volatile u32 gdbstub_rx_outp;
105extern volatile u8 gdbstub_rx_overflow;
106extern u8 gdbstub_rx_unget;
107
108extern void gdbstub_printk(const char *fmt, ...);
109extern void debug_to_serial(const char *p, int n);
110extern void console_set_baud(unsigned baud);
111
112#ifdef GDBSTUB_DEBUG_PROTOCOL
113#define gdbstub_proto(FMT,...) gdbstub_printk(FMT,##__VA_ARGS__)
114#else
115#define gdbstub_proto(FMT,...) ({ 0; })
116#endif
117
118/*
119 * we dedicate GR31 to keeping a pointer to the gdbstub exception frame
120 * - gr31 is destroyed on entry to the gdbstub if !MMU
121 * - gr31 is saved in scr3 on entry to the gdbstub if in !MMU
122 */
123register struct frv_frame0 *__debug_frame0 asm("gr31");
124
125#define __debug_frame (&__debug_frame0->regs)
126#define __debug_user_context (&__debug_frame0->uc)
127#define __debug_regs (&__debug_frame0->debug)
128#define __debug_reg(X) ((unsigned long *) ((unsigned long) &__debug_frame0 + (X)))
129
130struct frv_debug_status {
131 unsigned long bpsr;
132 unsigned long dcr;
133 unsigned long brr;
134 unsigned long nmar;
135};
136
137extern struct frv_debug_status __debug_status;
138
139#endif /* _LANGUAGE_ASSEMBLY */
140#endif /* __ASM_GDB_STUB_H */
diff --git a/include/asm-frv/gpio-regs.h b/include/asm-frv/gpio-regs.h
deleted file mode 100644
index 9edf5d5d4d3f..000000000000
--- a/include/asm-frv/gpio-regs.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/* gpio-regs.h: on-chip general purpose I/O registers
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_GPIO_REGS
13#define _ASM_GPIO_REGS
14
15#define __reg(ADDR) (*(volatile unsigned long *)(ADDR))
16
17#define __get_PDR() ({ __reg(0xfeff0400); })
18#define __set_PDR(V) do { __reg(0xfeff0400) = (V); mb(); } while(0)
19
20#define __get_GPDR() ({ __reg(0xfeff0408); })
21#define __set_GPDR(V) do { __reg(0xfeff0408) = (V); mb(); } while(0)
22
23#define __get_SIR() ({ __reg(0xfeff0410); })
24#define __set_SIR(V) do { __reg(0xfeff0410) = (V); mb(); } while(0)
25
26#define __get_SOR() ({ __reg(0xfeff0418); })
27#define __set_SOR(V) do { __reg(0xfeff0418) = (V); mb(); } while(0)
28
29#define __set_PDSR(V) do { __reg(0xfeff0420) = (V); mb(); } while(0)
30
31#define __set_PDCR(V) do { __reg(0xfeff0428) = (V); mb(); } while(0)
32
33#define __get_RSTR() ({ __reg(0xfeff0500); })
34#define __set_RSTR(V) do { __reg(0xfeff0500) = (V); mb(); } while(0)
35
36
37
38/* PDR definitions */
39#define PDR_GPIO_DATA(X) (1 << (X))
40
41/* GPDR definitions */
42#define GPDR_INPUT 0
43#define GPDR_OUTPUT 1
44#define GPDR_DREQ0_BIT 0x00001000
45#define GPDR_DREQ1_BIT 0x00008000
46#define GPDR_DREQ2_BIT 0x00040000
47#define GPDR_DREQ3_BIT 0x00080000
48#define GPDR_DREQ4_BIT 0x00004000
49#define GPDR_DREQ5_BIT 0x00020000
50#define GPDR_DREQ6_BIT 0x00100000
51#define GPDR_DREQ7_BIT 0x00200000
52#define GPDR_DACK0_BIT 0x00002000
53#define GPDR_DACK1_BIT 0x00010000
54#define GPDR_DACK2_BIT 0x00100000
55#define GPDR_DACK3_BIT 0x00200000
56#define GPDR_DONE0_BIT 0x00004000
57#define GPDR_DONE1_BIT 0x00020000
58#define GPDR_GPIO_DIR(X,D) ((D) << (X))
59
60/* SIR definitions */
61#define SIR_GPIO_INPUT 0
62#define SIR_DREQ7_INPUT 0x00200000
63#define SIR_DREQ6_INPUT 0x00100000
64#define SIR_DREQ3_INPUT 0x00080000
65#define SIR_DREQ2_INPUT 0x00040000
66#define SIR_DREQ5_INPUT 0x00020000
67#define SIR_DREQ1_INPUT 0x00008000
68#define SIR_DREQ4_INPUT 0x00004000
69#define SIR_DREQ0_INPUT 0x00001000
70#define SIR_RXD1_INPUT 0x00000400
71#define SIR_CTS0_INPUT 0x00000100
72#define SIR_RXD0_INPUT 0x00000040
73#define SIR_GATE1_INPUT 0x00000020
74#define SIR_GATE0_INPUT 0x00000010
75#define SIR_IRQ3_INPUT 0x00000008
76#define SIR_IRQ2_INPUT 0x00000004
77#define SIR_IRQ1_INPUT 0x00000002
78#define SIR_IRQ0_INPUT 0x00000001
79#define SIR_DREQ_BITS (SIR_DREQ0_INPUT | SIR_DREQ1_INPUT | \
80 SIR_DREQ2_INPUT | SIR_DREQ3_INPUT | \
81 SIR_DREQ4_INPUT | SIR_DREQ5_INPUT | \
82 SIR_DREQ6_INPUT | SIR_DREQ7_INPUT)
83
84/* SOR definitions */
85#define SOR_GPIO_OUTPUT 0
86#define SOR_DACK3_OUTPUT 0x00200000
87#define SOR_DACK2_OUTPUT 0x00100000
88#define SOR_DONE1_OUTPUT 0x00020000
89#define SOR_DACK1_OUTPUT 0x00010000
90#define SOR_DONE0_OUTPUT 0x00004000
91#define SOR_DACK0_OUTPUT 0x00002000
92#define SOR_TXD1_OUTPUT 0x00000800
93#define SOR_RTS0_OUTPUT 0x00000200
94#define SOR_TXD0_OUTPUT 0x00000080
95#define SOR_TOUT1_OUTPUT 0x00000020
96#define SOR_TOUT0_OUTPUT 0x00000010
97#define SOR_DONE_BITS (SOR_DONE0_OUTPUT | SOR_DONE1_OUTPUT)
98#define SOR_DACK_BITS (SOR_DACK0_OUTPUT | SOR_DACK1_OUTPUT | \
99 SOR_DACK2_OUTPUT | SOR_DACK3_OUTPUT)
100
101/* PDSR definitions */
102#define PDSR_UNCHANGED 0
103#define PDSR_SET_BIT(X) (1 << (X))
104
105/* PDCR definitions */
106#define PDCR_UNCHANGED 0
107#define PDCR_CLEAR_BIT(X) (1 << (X))
108
109/* RSTR definitions */
110/* Read Only */
111#define RSTR_POWERON 0x00000400
112#define RSTR_SOFTRESET_STATUS 0x00000100
113/* Write Only */
114#define RSTR_SOFTRESET 0x00000001
115
116#endif /* _ASM_GPIO_REGS */
diff --git a/include/asm-frv/hardirq.h b/include/asm-frv/hardirq.h
deleted file mode 100644
index fc47515822a2..000000000000
--- a/include/asm-frv/hardirq.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/* hardirq.h: FRV hardware IRQ management
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef __ASM_HARDIRQ_H
13#define __ASM_HARDIRQ_H
14
15#include <linux/threads.h>
16#include <linux/irq.h>
17
18typedef struct {
19 unsigned int __softirq_pending;
20 unsigned long idle_timestamp;
21} ____cacheline_aligned irq_cpustat_t;
22
23#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
24
25#ifdef CONFIG_SMP
26#error SMP not available on FR-V
27#endif /* CONFIG_SMP */
28
29extern atomic_t irq_err_count;
30static inline void ack_bad_irq(int irq)
31{
32 atomic_inc(&irq_err_count);
33}
34
35#endif
diff --git a/include/asm-frv/highmem.h b/include/asm-frv/highmem.h
deleted file mode 100644
index 68e4677fb9e7..000000000000
--- a/include/asm-frv/highmem.h
+++ /dev/null
@@ -1,182 +0,0 @@
1/* highmem.h: virtual kernel memory mappings for high memory
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from include/asm-i386/highmem.h
6 *
7 * See Documentation/frv/mmu-layout.txt for more information.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#ifndef _ASM_HIGHMEM_H
16#define _ASM_HIGHMEM_H
17
18#ifdef __KERNEL__
19
20#include <linux/init.h>
21#include <linux/highmem.h>
22#include <asm/mem-layout.h>
23#include <asm/spr-regs.h>
24#include <asm/mb-regs.h>
25
26#define NR_TLB_LINES 64 /* number of lines in the TLB */
27
28#ifndef __ASSEMBLY__
29
30#include <linux/interrupt.h>
31#include <asm/kmap_types.h>
32#include <asm/pgtable.h>
33
34#ifdef CONFIG_DEBUG_HIGHMEM
35#define HIGHMEM_DEBUG 1
36#else
37#define HIGHMEM_DEBUG 0
38#endif
39
40/* declarations for highmem.c */
41extern unsigned long highstart_pfn, highend_pfn;
42
43#define kmap_prot PAGE_KERNEL
44#define kmap_pte ______kmap_pte_in_TLB
45extern pte_t *pkmap_page_table;
46
47#define flush_cache_kmaps() do { } while (0)
48
49/*
50 * Right now we initialize only a single pte table. It can be extended
51 * easily, subsequent pte tables have to be allocated in one physical
52 * chunk of RAM.
53 */
54#define LAST_PKMAP PTRS_PER_PTE
55#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
56#define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT)
57#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
58
59extern void *kmap_high(struct page *page);
60extern void kunmap_high(struct page *page);
61
62extern void *kmap(struct page *page);
63extern void kunmap(struct page *page);
64
65extern struct page *kmap_atomic_to_page(void *ptr);
66
67#endif /* !__ASSEMBLY__ */
68
69/*
70 * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
71 * gives a more generic (and caching) interface. But kmap_atomic can
72 * be used in IRQ contexts, so in some (very limited) cases we need
73 * it.
74 */
75#define KMAP_ATOMIC_CACHE_DAMR 8
76
77#ifndef __ASSEMBLY__
78
79#define __kmap_atomic_primary(type, paddr, ampr) \
80({ \
81 unsigned long damlr, dampr; \
82 \
83 dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \
84 \
85 if (type != __KM_CACHE) \
86 asm volatile("movgs %0,dampr"#ampr :: "r"(dampr) : "memory"); \
87 else \
88 asm volatile("movgs %0,iampr"#ampr"\n" \
89 "movgs %0,dampr"#ampr"\n" \
90 :: "r"(dampr) : "memory" \
91 ); \
92 \
93 asm("movsg damlr"#ampr",%0" : "=r"(damlr)); \
94 \
95 /*printk("DAMR"#ampr": PRIM sl=%d L=%08lx P=%08lx\n", type, damlr, dampr);*/ \
96 \
97 (void *) damlr; \
98})
99
100#define __kmap_atomic_secondary(slot, paddr) \
101({ \
102 unsigned long damlr = KMAP_ATOMIC_SECONDARY_FRAME + (slot) * PAGE_SIZE; \
103 unsigned long dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \
104 \
105 asm volatile("movgs %0,tplr \n" \
106 "movgs %1,tppr \n" \
107 "tlbpr %0,gr0,#2,#1" \
108 : : "r"(damlr), "r"(dampr) : "memory"); \
109 \
110 /*printk("TLB: SECN sl=%d L=%08lx P=%08lx\n", slot, damlr, dampr);*/ \
111 \
112 (void *) damlr; \
113})
114
115static inline void *kmap_atomic(struct page *page, enum km_type type)
116{
117 unsigned long paddr;
118
119 pagefault_disable();
120 debug_kmap_atomic(type);
121 paddr = page_to_phys(page);
122
123 switch (type) {
124 case 0: return __kmap_atomic_primary(0, paddr, 2);
125 case 1: return __kmap_atomic_primary(1, paddr, 3);
126 case 2: return __kmap_atomic_primary(2, paddr, 4);
127 case 3: return __kmap_atomic_primary(3, paddr, 5);
128 case 4: return __kmap_atomic_primary(4, paddr, 6);
129 case 5: return __kmap_atomic_primary(5, paddr, 7);
130 case 6: return __kmap_atomic_primary(6, paddr, 8);
131 case 7: return __kmap_atomic_primary(7, paddr, 9);
132 case 8: return __kmap_atomic_primary(8, paddr, 10);
133
134 case 9 ... 9 + NR_TLB_LINES - 1:
135 return __kmap_atomic_secondary(type - 9, paddr);
136
137 default:
138 BUG();
139 return NULL;
140 }
141}
142
143#define __kunmap_atomic_primary(type, ampr) \
144do { \
145 asm volatile("movgs gr0,dampr"#ampr"\n" ::: "memory"); \
146 if (type == __KM_CACHE) \
147 asm volatile("movgs gr0,iampr"#ampr"\n" ::: "memory"); \
148} while(0)
149
150#define __kunmap_atomic_secondary(slot, vaddr) \
151do { \
152 asm volatile("tlbpr %0,gr0,#4,#1" : : "r"(vaddr) : "memory"); \
153} while(0)
154
155static inline void kunmap_atomic(void *kvaddr, enum km_type type)
156{
157 switch (type) {
158 case 0: __kunmap_atomic_primary(0, 2); break;
159 case 1: __kunmap_atomic_primary(1, 3); break;
160 case 2: __kunmap_atomic_primary(2, 4); break;
161 case 3: __kunmap_atomic_primary(3, 5); break;
162 case 4: __kunmap_atomic_primary(4, 6); break;
163 case 5: __kunmap_atomic_primary(5, 7); break;
164 case 6: __kunmap_atomic_primary(6, 8); break;
165 case 7: __kunmap_atomic_primary(7, 9); break;
166 case 8: __kunmap_atomic_primary(8, 10); break;
167
168 case 9 ... 9 + NR_TLB_LINES - 1:
169 __kunmap_atomic_secondary(type - 9, kvaddr);
170 break;
171
172 default:
173 BUG();
174 }
175 pagefault_enable();
176}
177
178#endif /* !__ASSEMBLY__ */
179
180#endif /* __KERNEL__ */
181
182#endif /* _ASM_HIGHMEM_H */
diff --git a/include/asm-frv/hw_irq.h b/include/asm-frv/hw_irq.h
deleted file mode 100644
index 522ad37923d8..000000000000
--- a/include/asm-frv/hw_irq.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/* hw_irq.h: FR-V specific h/w IRQ stuff
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_HW_IRQ_H
13#define _ASM_HW_IRQ_H
14
15
16#endif /* _ASM_HW_IRQ_H */
diff --git a/include/asm-frv/init.h b/include/asm-frv/init.h
deleted file mode 100644
index 8b15838de216..000000000000
--- a/include/asm-frv/init.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_INIT_H
2#define _ASM_INIT_H
3
4#define __init __attribute__ ((__section__ (".text.init")))
5#define __initdata __attribute__ ((__section__ (".data.init")))
6/* For assembly routines */
7#define __INIT .section ".text.init",#alloc,#execinstr
8#define __FINIT .previous
9#define __INITDATA .section ".data.init",#alloc,#write
10
11#endif
12
diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h
deleted file mode 100644
index ca7475e73b5e..000000000000
--- a/include/asm-frv/io.h
+++ /dev/null
@@ -1,392 +0,0 @@
1/* io.h: FRV I/O operations
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * This gets interesting when talking to the PCI bus - the CPU is in big endian
12 * mode, the PCI bus is little endian and the hardware in the middle can do
13 * byte swapping
14 */
15#ifndef _ASM_IO_H
16#define _ASM_IO_H
17
18#ifdef __KERNEL__
19
20#include <linux/types.h>
21#include <asm/virtconvert.h>
22#include <asm/string.h>
23#include <asm/mb-regs.h>
24#include <linux/delay.h>
25
26/*
27 * swap functions are sometimes needed to interface little-endian hardware
28 */
29
30static inline unsigned short _swapw(unsigned short v)
31{
32 return ((v << 8) | (v >> 8));
33}
34
35static inline unsigned long _swapl(unsigned long v)
36{
37 return ((v << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | (v >> 24));
38}
39
40//#define __iormb() asm volatile("membar")
41//#define __iowmb() asm volatile("membar")
42
43#define __raw_readb __builtin_read8
44#define __raw_readw __builtin_read16
45#define __raw_readl __builtin_read32
46
47#define __raw_writeb(datum, addr) __builtin_write8(addr, datum)
48#define __raw_writew(datum, addr) __builtin_write16(addr, datum)
49#define __raw_writel(datum, addr) __builtin_write32(addr, datum)
50
51static inline void io_outsb(unsigned int addr, const void *buf, int len)
52{
53 unsigned long __ioaddr = (unsigned long) addr;
54 const uint8_t *bp = buf;
55
56 while (len--)
57 __builtin_write8((volatile void __iomem *) __ioaddr, *bp++);
58}
59
60static inline void io_outsw(unsigned int addr, const void *buf, int len)
61{
62 unsigned long __ioaddr = (unsigned long) addr;
63 const uint16_t *bp = buf;
64
65 while (len--)
66 __builtin_write16((volatile void __iomem *) __ioaddr, (*bp++));
67}
68
69extern void __outsl_ns(unsigned int addr, const void *buf, int len);
70extern void __outsl_sw(unsigned int addr, const void *buf, int len);
71static inline void __outsl(unsigned int addr, const void *buf, int len, int swap)
72{
73 unsigned long __ioaddr = (unsigned long) addr;
74
75 if (!swap)
76 __outsl_ns(__ioaddr, buf, len);
77 else
78 __outsl_sw(__ioaddr, buf, len);
79}
80
81static inline void io_insb(unsigned long addr, void *buf, int len)
82{
83 uint8_t *bp = buf;
84
85 while (len--)
86 *bp++ = __builtin_read8((volatile void __iomem *) addr);
87}
88
89static inline void io_insw(unsigned long addr, void *buf, int len)
90{
91 uint16_t *bp = buf;
92
93 while (len--)
94 *bp++ = __builtin_read16((volatile void __iomem *) addr);
95}
96
97extern void __insl_ns(unsigned long addr, void *buf, int len);
98extern void __insl_sw(unsigned long addr, void *buf, int len);
99static inline void __insl(unsigned long addr, void *buf, int len, int swap)
100{
101 if (!swap)
102 __insl_ns(addr, buf, len);
103 else
104 __insl_sw(addr, buf, len);
105}
106
107#define mmiowb() mb()
108
109/*
110 * make the short names macros so specific devices
111 * can override them as required
112 */
113
114static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
115{
116 memset((void __force *) addr, val, count);
117}
118
119static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
120{
121 memcpy(dst, (void __force *) src, count);
122}
123
124static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count)
125{
126 memcpy((void __force *) dst, src, count);
127}
128
129static inline uint8_t inb(unsigned long addr)
130{
131 return __builtin_read8((void __iomem *)addr);
132}
133
134static inline uint16_t inw(unsigned long addr)
135{
136 uint16_t ret = __builtin_read16((void __iomem *)addr);
137
138 if (__is_PCI_IO(addr))
139 ret = _swapw(ret);
140
141 return ret;
142}
143
144static inline uint32_t inl(unsigned long addr)
145{
146 uint32_t ret = __builtin_read32((void __iomem *)addr);
147
148 if (__is_PCI_IO(addr))
149 ret = _swapl(ret);
150
151 return ret;
152}
153
154static inline void outb(uint8_t datum, unsigned long addr)
155{
156 __builtin_write8((void __iomem *)addr, datum);
157}
158
159static inline void outw(uint16_t datum, unsigned long addr)
160{
161 if (__is_PCI_IO(addr))
162 datum = _swapw(datum);
163 __builtin_write16((void __iomem *)addr, datum);
164}
165
166static inline void outl(uint32_t datum, unsigned long addr)
167{
168 if (__is_PCI_IO(addr))
169 datum = _swapl(datum);
170 __builtin_write32((void __iomem *)addr, datum);
171}
172
173#define inb_p(addr) inb(addr)
174#define inw_p(addr) inw(addr)
175#define inl_p(addr) inl(addr)
176#define outb_p(x,addr) outb(x,addr)
177#define outw_p(x,addr) outw(x,addr)
178#define outl_p(x,addr) outl(x,addr)
179
180#define outsb(a,b,l) io_outsb(a,b,l)
181#define outsw(a,b,l) io_outsw(a,b,l)
182#define outsl(a,b,l) __outsl(a,b,l,0)
183
184#define insb(a,b,l) io_insb(a,b,l)
185#define insw(a,b,l) io_insw(a,b,l)
186#define insl(a,b,l) __insl(a,b,l,0)
187
188#define IO_SPACE_LIMIT 0xffffffff
189
190static inline uint8_t readb(const volatile void __iomem *addr)
191{
192 return __builtin_read8((__force void volatile __iomem *) addr);
193}
194
195static inline uint16_t readw(const volatile void __iomem *addr)
196{
197 uint16_t ret = __builtin_read16((__force void volatile __iomem *)addr);
198
199 if (__is_PCI_MEM(addr))
200 ret = _swapw(ret);
201 return ret;
202}
203
204static inline uint32_t readl(const volatile void __iomem *addr)
205{
206 uint32_t ret = __builtin_read32((__force void volatile __iomem *)addr);
207
208 if (__is_PCI_MEM(addr))
209 ret = _swapl(ret);
210
211 return ret;
212}
213
214#define readb_relaxed readb
215#define readw_relaxed readw
216#define readl_relaxed readl
217
218static inline void writeb(uint8_t datum, volatile void __iomem *addr)
219{
220 __builtin_write8(addr, datum);
221 if (__is_PCI_MEM(addr))
222 __flush_PCI_writes();
223}
224
225static inline void writew(uint16_t datum, volatile void __iomem *addr)
226{
227 if (__is_PCI_MEM(addr))
228 datum = _swapw(datum);
229
230 __builtin_write16(addr, datum);
231 if (__is_PCI_MEM(addr))
232 __flush_PCI_writes();
233}
234
235static inline void writel(uint32_t datum, volatile void __iomem *addr)
236{
237 if (__is_PCI_MEM(addr))
238 datum = _swapl(datum);
239
240 __builtin_write32(addr, datum);
241 if (__is_PCI_MEM(addr))
242 __flush_PCI_writes();
243}
244
245
246/* Values for nocacheflag and cmode */
247#define IOMAP_FULL_CACHING 0
248#define IOMAP_NOCACHE_SER 1
249#define IOMAP_NOCACHE_NONSER 2
250#define IOMAP_WRITETHROUGH 3
251
252extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag);
253
254static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
255{
256 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
257}
258
259static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned long size)
260{
261 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
262}
263
264static inline void __iomem *ioremap_writethrough(unsigned long physaddr, unsigned long size)
265{
266 return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
267}
268
269static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned long size)
270{
271 return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
272}
273
274#define ioremap_wc ioremap_nocache
275
276extern void iounmap(void volatile __iomem *addr);
277
278static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
279{
280 return (void __iomem *) port;
281}
282
283static inline void ioport_unmap(void __iomem *p)
284{
285}
286
287static inline void flush_write_buffers(void)
288{
289 __asm__ __volatile__ ("membar" : : :"memory");
290}
291
292/*
293 * do appropriate I/O accesses for token type
294 */
295static inline unsigned int ioread8(void __iomem *p)
296{
297 return __builtin_read8(p);
298}
299
300static inline unsigned int ioread16(void __iomem *p)
301{
302 uint16_t ret = __builtin_read16(p);
303 if (__is_PCI_addr(p))
304 ret = _swapw(ret);
305 return ret;
306}
307
308static inline unsigned int ioread32(void __iomem *p)
309{
310 uint32_t ret = __builtin_read32(p);
311 if (__is_PCI_addr(p))
312 ret = _swapl(ret);
313 return ret;
314}
315
316static inline void iowrite8(u8 val, void __iomem *p)
317{
318 __builtin_write8(p, val);
319 if (__is_PCI_MEM(p))
320 __flush_PCI_writes();
321}
322
323static inline void iowrite16(u16 val, void __iomem *p)
324{
325 if (__is_PCI_addr(p))
326 val = _swapw(val);
327 __builtin_write16(p, val);
328 if (__is_PCI_MEM(p))
329 __flush_PCI_writes();
330}
331
332static inline void iowrite32(u32 val, void __iomem *p)
333{
334 if (__is_PCI_addr(p))
335 val = _swapl(val);
336 __builtin_write32(p, val);
337 if (__is_PCI_MEM(p))
338 __flush_PCI_writes();
339}
340
341static inline void ioread8_rep(void __iomem *p, void *dst, unsigned long count)
342{
343 io_insb((unsigned long) p, dst, count);
344}
345
346static inline void ioread16_rep(void __iomem *p, void *dst, unsigned long count)
347{
348 io_insw((unsigned long) p, dst, count);
349}
350
351static inline void ioread32_rep(void __iomem *p, void *dst, unsigned long count)
352{
353 __insl_ns((unsigned long) p, dst, count);
354}
355
356static inline void iowrite8_rep(void __iomem *p, const void *src, unsigned long count)
357{
358 io_outsb((unsigned long) p, src, count);
359}
360
361static inline void iowrite16_rep(void __iomem *p, const void *src, unsigned long count)
362{
363 io_outsw((unsigned long) p, src, count);
364}
365
366static inline void iowrite32_rep(void __iomem *p, const void *src, unsigned long count)
367{
368 __outsl_ns((unsigned long) p, src, count);
369}
370
371/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
372struct pci_dev;
373extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
374static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
375{
376}
377
378
379/*
380 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
381 * access
382 */
383#define xlate_dev_mem_ptr(p) __va(p)
384
385/*
386 * Convert a virtual cached pointer to an uncached pointer
387 */
388#define xlate_dev_kmem_ptr(p) p
389
390#endif /* __KERNEL__ */
391
392#endif /* _ASM_IO_H */
diff --git a/include/asm-frv/ioctl.h b/include/asm-frv/ioctl.h
deleted file mode 100644
index b279fe06dfe5..000000000000
--- a/include/asm-frv/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/include/asm-frv/ioctls.h b/include/asm-frv/ioctls.h
deleted file mode 100644
index d0c30e31fbda..000000000000
--- a/include/asm-frv/ioctls.h
+++ /dev/null
@@ -1,86 +0,0 @@
1#ifndef __ASM_IOCTLS_H__
2#define __ASM_IOCTLS_H__
3
4#include <asm/ioctl.h>
5
6/* 0x54 is just a magic number to make these relatively unique ('T') */
7
8#define TCGETS 0x5401
9#define TCSETS 0x5402
10#define TCSETSW 0x5403
11#define TCSETSF 0x5404
12#define TCGETA 0x5405
13#define TCSETA 0x5406
14#define TCSETAW 0x5407
15#define TCSETAF 0x5408
16#define TCSBRK 0x5409
17#define TCXONC 0x540A
18#define TCFLSH 0x540B
19#define TIOCEXCL 0x540C
20#define TIOCNXCL 0x540D
21#define TIOCSCTTY 0x540E
22#define TIOCGPGRP 0x540F
23#define TIOCSPGRP 0x5410
24#define TIOCOUTQ 0x5411
25#define TIOCSTI 0x5412
26#define TIOCGWINSZ 0x5413
27#define TIOCSWINSZ 0x5414
28#define TIOCMGET 0x5415
29#define TIOCMBIS 0x5416
30#define TIOCMBIC 0x5417
31#define TIOCMSET 0x5418
32#define TIOCGSOFTCAR 0x5419
33#define TIOCSSOFTCAR 0x541A
34#define FIONREAD 0x541B
35#define TIOCINQ FIONREAD
36#define TIOCLINUX 0x541C
37#define TIOCCONS 0x541D
38#define TIOCGSERIAL 0x541E
39#define TIOCSSERIAL 0x541F
40#define TIOCPKT 0x5420
41#define FIONBIO 0x5421
42#define TIOCNOTTY 0x5422
43#define TIOCSETD 0x5423
44#define TIOCGETD 0x5424
45#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
46#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
47#define TIOCSBRK 0x5427 /* BSD compatibility */
48#define TIOCCBRK 0x5428 /* BSD compatibility */
49#define TIOCGSID 0x5429 /* Return the session ID of FD */
50#define TCGETS2 _IOR('T',0x2A, struct termios2)
51#define TCSETS2 _IOW('T',0x2B, struct termios2)
52#define TCSETSW2 _IOW('T',0x2C, struct termios2)
53#define TCSETSF2 _IOW('T',0x2D, struct termios2)
54#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
55#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
56
57#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
58#define FIOCLEX 0x5451
59#define FIOASYNC 0x5452
60#define TIOCSERCONFIG 0x5453
61#define TIOCSERGWILD 0x5454
62#define TIOCSERSWILD 0x5455
63#define TIOCGLCKTRMIOS 0x5456
64#define TIOCSLCKTRMIOS 0x5457
65#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
66#define TIOCSERGETLSR 0x5459 /* Get line status register */
67#define TIOCSERGETMULTI 0x545A /* Get multiport config */
68#define TIOCSERSETMULTI 0x545B /* Set multiport config */
69
70#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
71#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
72#define FIOQSIZE 0x545E
73
74/* Used for packet mode */
75#define TIOCPKT_DATA 0
76#define TIOCPKT_FLUSHREAD 1
77#define TIOCPKT_FLUSHWRITE 2
78#define TIOCPKT_STOP 4
79#define TIOCPKT_START 8
80#define TIOCPKT_NOSTOP 16
81#define TIOCPKT_DOSTOP 32
82
83#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
84
85#endif /* __ASM_IOCTLS_H__ */
86
diff --git a/include/asm-frv/ipcbuf.h b/include/asm-frv/ipcbuf.h
deleted file mode 100644
index b546f67e455f..000000000000
--- a/include/asm-frv/ipcbuf.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef __ASM_IPCBUF_H__
2#define __ASM_IPCBUF_H__
3
4/*
5 * The user_ipc_perm structure for FR-V architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __ASM_IPCBUF_H__ */
30
diff --git a/include/asm-frv/irc-regs.h b/include/asm-frv/irc-regs.h
deleted file mode 100644
index afa30aeacc82..000000000000
--- a/include/asm-frv/irc-regs.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/* irc-regs.h: on-chip interrupt controller registers
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_IRC_REGS
13#define _ASM_IRC_REGS
14
15#define __reg(ADDR) (*(volatile unsigned long *)(ADDR))
16
17#define __get_TM0() ({ __reg(0xfeff9800); })
18#define __get_TM1() ({ __reg(0xfeff9808); })
19#define __set_TM1(V) do { __reg(0xfeff9808) = (V); mb(); } while(0)
20
21#define __set_TM1x(XI,V) \
22do { \
23 int shift = (XI) * 2 + 16; \
24 unsigned long tm1 = __reg(0xfeff9808); \
25 tm1 &= ~(0x3 << shift); \
26 tm1 |= (V) << shift; \
27 __reg(0xfeff9808) = tm1; \
28 mb(); \
29} while(0)
30
31#define __get_RS(C) ({ (__reg(0xfeff9810) >> ((C)+16)) & 1; })
32
33#define __clr_RC(C) do { __reg(0xfeff9818) = 1 << ((C)+16); mb(); } while(0)
34
35#define __get_MASK(C) ({ (__reg(0xfeff9820) >> ((C)+16)) & 1; })
36#define __set_MASK(C) do { __reg(0xfeff9820) |= 1 << ((C)+16); mb(); } while(0)
37#define __clr_MASK(C) do { __reg(0xfeff9820) &= ~(1 << ((C)+16)); mb(); } while(0)
38
39#define __get_MASK_all() __get_MASK(0)
40#define __set_MASK_all() __set_MASK(0)
41#define __clr_MASK_all() __clr_MASK(0)
42
43#define __get_IRL() ({ (__reg(0xfeff9828) >> 16) & 0xf; })
44#define __clr_IRL() do { __reg(0xfeff9828) = 0x100000; mb(); } while(0)
45
46#define __get_IRR(N) ({ __reg(0xfeff9840 + (N) * 8); })
47#define __set_IRR(N,V) do { __reg(0xfeff9840 + (N) * 8) = (V); } while(0)
48
49#define __get_IITMR(N) ({ __reg(0xfeff9880 + (N) * 8); })
50#define __set_IITMR(N,V) do { __reg(0xfeff9880 + (N) * 8) = (V); } while(0)
51
52
53#endif /* _ASM_IRC_REGS */
diff --git a/include/asm-frv/irq.h b/include/asm-frv/irq.h
deleted file mode 100644
index 3a66ebd754bd..000000000000
--- a/include/asm-frv/irq.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/* irq.h: FRV IRQ definitions
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_IRQ_H_
13#define _ASM_IRQ_H_
14
15#define NR_IRQS 48
16#define IRQ_BASE_CPU (0 * 16)
17#define IRQ_BASE_FPGA (1 * 16)
18#define IRQ_BASE_MB93493 (2 * 16)
19
20/* probe returns a 32-bit IRQ mask:-/ */
21#define MIN_PROBE_IRQ (NR_IRQS - 32)
22
23#ifndef __ASSEMBLY__
24static inline int irq_canonicalize(int irq)
25{
26 return irq;
27}
28#endif
29
30#endif /* _ASM_IRQ_H_ */
diff --git a/include/asm-frv/irq_regs.h b/include/asm-frv/irq_regs.h
deleted file mode 100644
index d22e83289ad1..000000000000
--- a/include/asm-frv/irq_regs.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/* FRV per-CPU frame pointer holder
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_IRQ_REGS_H
13#define _ASM_IRQ_REGS_H
14
15/*
16 * Per-cpu current frame pointer - the location of the last exception frame on
17 * the stack
18 * - on FRV, GR28 is dedicated to keeping a pointer to the current exception
19 * frame
20 */
21#define ARCH_HAS_OWN_IRQ_REGS
22
23#ifndef __ASSEMBLY__
24#define get_irq_regs() (__frame)
25#endif
26
27#endif /* _ASM_IRQ_REGS_H */
diff --git a/include/asm-frv/kdebug.h b/include/asm-frv/kdebug.h
deleted file mode 100644
index 6ece1b037665..000000000000
--- a/include/asm-frv/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/include/asm-frv/kmap_types.h b/include/asm-frv/kmap_types.h
deleted file mode 100644
index f8e16b2a5804..000000000000
--- a/include/asm-frv/kmap_types.h
+++ /dev/null
@@ -1,29 +0,0 @@
1
2#ifndef _ASM_KMAP_TYPES_H
3#define _ASM_KMAP_TYPES_H
4
5enum km_type {
6 /* arch specific kmaps - change the numbers attached to these at your peril */
7 __KM_CACHE, /* cache flush page attachment point */
8 __KM_PGD, /* current page directory */
9 __KM_ITLB_PTD, /* current instruction TLB miss page table lookup */
10 __KM_DTLB_PTD, /* current data TLB miss page table lookup */
11
12 /* general kmaps */
13 KM_BOUNCE_READ,
14 KM_SKB_SUNRPC_DATA,
15 KM_SKB_DATA_SOFTIRQ,
16 KM_USER0,
17 KM_USER1,
18 KM_BIO_SRC_IRQ,
19 KM_BIO_DST_IRQ,
20 KM_PTE0,
21 KM_PTE1,
22 KM_IRQ0,
23 KM_IRQ1,
24 KM_SOFTIRQ0,
25 KM_SOFTIRQ1,
26 KM_TYPE_NR
27};
28
29#endif
diff --git a/include/asm-frv/linkage.h b/include/asm-frv/linkage.h
deleted file mode 100644
index 636c1bced7d4..000000000000
--- a/include/asm-frv/linkage.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4#define __ALIGN .align 4
5#define __ALIGN_STR ".align 4"
6
7#endif
diff --git a/include/asm-frv/local.h b/include/asm-frv/local.h
deleted file mode 100644
index c27bdf04630e..000000000000
--- a/include/asm-frv/local.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_LOCAL_H
2#define _ASM_LOCAL_H
3
4#include <asm-generic/local.h>
5
6#endif /* _ASM_LOCAL_H */
diff --git a/include/asm-frv/math-emu.h b/include/asm-frv/math-emu.h
deleted file mode 100644
index 0c8f731b2180..000000000000
--- a/include/asm-frv/math-emu.h
+++ /dev/null
@@ -1,301 +0,0 @@
1#ifndef _ASM_MATH_EMU_H
2#define _ASM_MATH_EMU_H
3
4#include <asm/setup.h>
5#include <linux/linkage.h>
6
7/* Status Register bits */
8
9/* accrued exception bits */
10#define FPSR_AEXC_INEX 3
11#define FPSR_AEXC_DZ 4
12#define FPSR_AEXC_UNFL 5
13#define FPSR_AEXC_OVFL 6
14#define FPSR_AEXC_IOP 7
15
16/* exception status bits */
17#define FPSR_EXC_INEX1 8
18#define FPSR_EXC_INEX2 9
19#define FPSR_EXC_DZ 10
20#define FPSR_EXC_UNFL 11
21#define FPSR_EXC_OVFL 12
22#define FPSR_EXC_OPERR 13
23#define FPSR_EXC_SNAN 14
24#define FPSR_EXC_BSUN 15
25
26/* quotient byte, assumes big-endian, of course */
27#define FPSR_QUOTIENT(fpsr) (*((signed char *) &(fpsr) + 1))
28
29/* condition code bits */
30#define FPSR_CC_NAN 24
31#define FPSR_CC_INF 25
32#define FPSR_CC_Z 26
33#define FPSR_CC_NEG 27
34
35
36/* Control register bits */
37
38/* rounding mode */
39#define FPCR_ROUND_RN 0 /* round to nearest/even */
40#define FPCR_ROUND_RZ 1 /* round to zero */
41#define FPCR_ROUND_RM 2 /* minus infinity */
42#define FPCR_ROUND_RP 3 /* plus infinity */
43
44/* rounding precision */
45#define FPCR_PRECISION_X 0 /* long double */
46#define FPCR_PRECISION_S 1 /* double */
47#define FPCR_PRECISION_D 2 /* float */
48
49
50/* Flags to select the debugging output */
51#define PDECODE 0
52#define PEXECUTE 1
53#define PCONV 2
54#define PNORM 3
55#define PREGISTER 4
56#define PINSTR 5
57#define PUNIMPL 6
58#define PMOVEM 7
59
60#define PMDECODE (1<<PDECODE)
61#define PMEXECUTE (1<<PEXECUTE)
62#define PMCONV (1<<PCONV)
63#define PMNORM (1<<PNORM)
64#define PMREGISTER (1<<PREGISTER)
65#define PMINSTR (1<<PINSTR)
66#define PMUNIMPL (1<<PUNIMPL)
67#define PMMOVEM (1<<PMOVEM)
68
69#ifndef __ASSEMBLY__
70
71#include <linux/kernel.h>
72#include <linux/sched.h>
73
74union fp_mant64 {
75 unsigned long long m64;
76 unsigned long m32[2];
77};
78
79union fp_mant128 {
80 unsigned long long m64[2];
81 unsigned long m32[4];
82};
83
84/* internal representation of extended fp numbers */
85struct fp_ext {
86 unsigned char lowmant;
87 unsigned char sign;
88 unsigned short exp;
89 union fp_mant64 mant;
90};
91
92/* C representation of FPU registers */
93/* NOTE: if you change this, you have to change the assembler offsets
94 below and the size in <asm/fpu.h>, too */
95struct fp_data {
96 struct fp_ext fpreg[8];
97 unsigned int fpcr;
98 unsigned int fpsr;
99 unsigned int fpiar;
100 unsigned short prec;
101 unsigned short rnd;
102 struct fp_ext temp[2];
103};
104
105#if FPU_EMU_DEBUG
106extern unsigned int fp_debugprint;
107
108#define dprint(bit, fmt, args...) ({ \
109 if (fp_debugprint & (1 << (bit))) \
110 printk(fmt, ## args); \
111})
112#else
113#define dprint(bit, fmt, args...)
114#endif
115
116#define uprint(str) ({ \
117 static int __count = 3; \
118 \
119 if (__count > 0) { \
120 printk("You just hit an unimplemented " \
121 "fpu instruction (%s)\n", str); \
122 printk("Please report this to ....\n"); \
123 __count--; \
124 } \
125})
126
127#define FPDATA ((struct fp_data *)current->thread.fp)
128
129#else /* __ASSEMBLY__ */
130
131#define FPDATA %a2
132
133/* offsets from the base register to the floating point data in the task struct */
134#define FPD_FPREG (TASK_THREAD+THREAD_FPREG+0)
135#define FPD_FPCR (TASK_THREAD+THREAD_FPREG+96)
136#define FPD_FPSR (TASK_THREAD+THREAD_FPREG+100)
137#define FPD_FPIAR (TASK_THREAD+THREAD_FPREG+104)
138#define FPD_PREC (TASK_THREAD+THREAD_FPREG+108)
139#define FPD_RND (TASK_THREAD+THREAD_FPREG+110)
140#define FPD_TEMPFP1 (TASK_THREAD+THREAD_FPREG+112)
141#define FPD_TEMPFP2 (TASK_THREAD+THREAD_FPREG+124)
142#define FPD_SIZEOF (TASK_THREAD+THREAD_FPREG+136)
143
144/* offsets on the stack to access saved registers,
145 * these are only used during instruction decoding
146 * where we always know how deep we're on the stack.
147 */
148#define FPS_DO (PT_D0)
149#define FPS_D1 (PT_D1)
150#define FPS_D2 (PT_D2)
151#define FPS_A0 (PT_A0)
152#define FPS_A1 (PT_A1)
153#define FPS_A2 (PT_A2)
154#define FPS_SR (PT_SR)
155#define FPS_PC (PT_PC)
156#define FPS_EA (PT_PC+6)
157#define FPS_PC2 (PT_PC+10)
158
159.macro fp_get_fp_reg
160 lea (FPD_FPREG,FPDATA,%d0.w*4),%a0
161 lea (%a0,%d0.w*8),%a0
162.endm
163
164/* Macros used to get/put the current program counter.
165 * 020/030 use a different stack frame then 040/060, for the
166 * 040/060 the return pc points already to the next location,
167 * so this only needs to be modified for jump instructions.
168 */
169.macro fp_get_pc dest
170 move.l (FPS_PC+4,%sp),\dest
171.endm
172
173.macro fp_put_pc src,jump=0
174 move.l \src,(FPS_PC+4,%sp)
175.endm
176
177.macro fp_get_instr_data f,s,dest,label
178 getuser \f,%sp@(FPS_PC+4)@(0),\dest,\label,%sp@(FPS_PC+4)
179 addq.l #\s,%sp@(FPS_PC+4)
180.endm
181
182.macro fp_get_instr_word dest,label,addr
183 fp_get_instr_data w,2,\dest,\label,\addr
184.endm
185
186.macro fp_get_instr_long dest,label,addr
187 fp_get_instr_data l,4,\dest,\label,\addr
188.endm
189
190/* These macros are used to read from/write to user space
191 * on error we jump to the fixup section, load the fault
192 * address into %a0 and jump to the exit.
193 * (derived from <asm/uaccess.h>)
194 */
195.macro getuser size,src,dest,label,addr
196| printf ,"[\size<%08x]",1,\addr
197.Lu1\@: moves\size \src,\dest
198
199 .section .fixup,"ax"
200 .even
201.Lu2\@: move.l \addr,%a0
202 jra \label
203 .previous
204
205 .section __ex_table,"a"
206 .align 4
207 .long .Lu1\@,.Lu2\@
208 .previous
209.endm
210
211.macro putuser size,src,dest,label,addr
212| printf ,"[\size>%08x]",1,\addr
213.Lu1\@: moves\size \src,\dest
214.Lu2\@:
215
216 .section .fixup,"ax"
217 .even
218.Lu3\@: move.l \addr,%a0
219 jra \label
220 .previous
221
222 .section __ex_table,"a"
223 .align 4
224 .long .Lu1\@,.Lu3\@
225 .long .Lu2\@,.Lu3\@
226 .previous
227.endm
228
229
230.macro movestack nr,arg1,arg2,arg3,arg4,arg5
231 .if \nr
232 movestack (\nr-1),\arg2,\arg3,\arg4,\arg5
233 move.l \arg1,-(%sp)
234 .endif
235.endm
236
237.macro printf bit=-1,string,nr=0,arg1,arg2,arg3,arg4,arg5
238#ifdef FPU_EMU_DEBUG
239 .data
240.Lpdata\@:
241 .string "\string"
242 .previous
243
244 movem.l %d0/%d1/%a0/%a1,-(%sp)
245 .if \bit+1
246#if 0
247 moveq #\bit,%d0
248 andw #7,%d0
249 btst %d0,fp_debugprint+((31-\bit)/8)
250#else
251 btst #\bit,fp_debugprint+((31-\bit)/8)
252#endif
253 jeq .Lpskip\@
254 .endif
255 movestack \nr,\arg1,\arg2,\arg3,\arg4,\arg5
256 pea .Lpdata\@
257 jsr printk
258 lea ((\nr+1)*4,%sp),%sp
259.Lpskip\@:
260 movem.l (%sp)+,%d0/%d1/%a0/%a1
261#endif
262.endm
263
264.macro printx bit,fp
265#ifdef FPU_EMU_DEBUG
266 movem.l %d0/%a0,-(%sp)
267 lea \fp,%a0
268#if 0
269 moveq #'+',%d0
270 tst.w (%a0)
271 jeq .Lx1\@
272 moveq #'-',%d0
273.Lx1\@: printf \bit," %c",1,%d0
274 move.l (4,%a0),%d0
275 bclr #31,%d0
276 jne .Lx2\@
277 printf \bit,"0."
278 jra .Lx3\@
279.Lx2\@: printf \bit,"1."
280.Lx3\@: printf \bit,"%08x%08x",2,%d0,%a0@(8)
281 move.w (2,%a0),%d0
282 ext.l %d0
283 printf \bit,"E%04x",1,%d0
284#else
285 printf \bit," %08x%08x%08x",3,%a0@,%a0@(4),%a0@(8)
286#endif
287 movem.l (%sp)+,%d0/%a0
288#endif
289.endm
290
291.macro debug instr,args
292#ifdef FPU_EMU_DEBUG
293 \instr \args
294#endif
295.endm
296
297
298#endif /* __ASSEMBLY__ */
299
300#endif /* _ASM_FRV_MATH_EMU_H */
301
diff --git a/include/asm-frv/mb-regs.h b/include/asm-frv/mb-regs.h
deleted file mode 100644
index 219e5f926f18..000000000000
--- a/include/asm-frv/mb-regs.h
+++ /dev/null
@@ -1,200 +0,0 @@
1/* mb-regs.h: motherboard registers
2 *
3 * Copyright (C) 2003, 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_MB_REGS_H
13#define _ASM_MB_REGS_H
14
15#include <asm/cpu-irqs.h>
16#include <asm/sections.h>
17#include <asm/mem-layout.h>
18
19#ifndef __ASSEMBLY__
20/* gcc builtins, annotated */
21
22unsigned long __builtin_read8(volatile void __iomem *);
23unsigned long __builtin_read16(volatile void __iomem *);
24unsigned long __builtin_read32(volatile void __iomem *);
25void __builtin_write8(volatile void __iomem *, unsigned char);
26void __builtin_write16(volatile void __iomem *, unsigned short);
27void __builtin_write32(volatile void __iomem *, unsigned long);
28#endif
29
30#define __region_IO KERNEL_IO_START /* the region from 0xe0000000 to 0xffffffff has suitable
31 * protection laid over the top for use in memory-mapped
32 * I/O
33 */
34
35#define __region_CS0 0xff000000 /* Boot ROMs area */
36
37#ifdef CONFIG_MB93091_VDK
38/*
39 * VDK motherboard and CPU card specific stuff
40 */
41
42#include <asm/mb93091-fpga-irqs.h>
43
44#define IRQ_CPU_MB93493_0 IRQ_CPU_EXTERNAL0
45#define IRQ_CPU_MB93493_1 IRQ_CPU_EXTERNAL1
46
47#define __region_CS2 0xe0000000 /* SLBUS/PCI I/O space */
48#define __region_CS2_M 0x0fffffff /* mask */
49#define __region_CS2_C 0x00000000 /* control */
50#define __region_CS5 0xf0000000 /* MB93493 CSC area (DAV daughter board) */
51#define __region_CS5_M 0x00ffffff
52#define __region_CS5_C 0x00010000
53#define __region_CS7 0xf1000000 /* CB70 CPU-card PCMCIA port I/O space */
54#define __region_CS7_M 0x00ffffff
55#define __region_CS7_C 0x00410701
56#define __region_CS1 0xfc000000 /* SLBUS/PCI bridge control registers */
57#define __region_CS1_M 0x000fffff
58#define __region_CS1_C 0x00000000
59#define __region_CS6 0xfc100000 /* CB70 CPU-card DM9000 LAN I/O space */
60#define __region_CS6_M 0x000fffff
61#define __region_CS6_C 0x00400707
62#define __region_CS3 0xfc200000 /* MB93493 CSR area (DAV daughter board) */
63#define __region_CS3_M 0x000fffff
64#define __region_CS3_C 0xc8100000
65#define __region_CS4 0xfd000000 /* CB70 CPU-card extra flash space */
66#define __region_CS4_M 0x00ffffff
67#define __region_CS4_C 0x00000f07
68
69#define __region_PCI_IO (__region_CS2 + 0x04000000UL)
70#define __region_PCI_MEM (__region_CS2 + 0x08000000UL)
71#define __flush_PCI_writes() \
72do { \
73 __builtin_write8((volatile void __iomem *) __region_PCI_MEM, 0); \
74} while(0)
75
76#define __is_PCI_IO(addr) \
77 (((unsigned long)(addr) >> 24) - (__region_PCI_IO >> 24) < (0x04000000UL >> 24))
78
79#define __is_PCI_MEM(addr) \
80 ((unsigned long)(addr) - __region_PCI_MEM < 0x08000000UL)
81
82#define __is_PCI_addr(addr) \
83 ((unsigned long)(addr) - __region_PCI_IO < 0x0c000000UL)
84
85#define __get_CLKSW() ({ *(volatile unsigned long *)(__region_CS2 + 0x0130000cUL) & 0xffUL; })
86#define __get_CLKIN() (__get_CLKSW() * 125U * 100000U / 24U)
87
88#ifndef __ASSEMBLY__
89extern int __nongprelbss mb93090_mb00_detected;
90#endif
91
92#define __addr_LEDS() (__region_CS2 + 0x01200004UL)
93#ifdef CONFIG_MB93090_MB00
94#define __set_LEDS(X) \
95do { \
96 if (mb93090_mb00_detected) \
97 __builtin_write32((void __iomem *) __addr_LEDS(), ~(X)); \
98} while (0)
99#else
100#define __set_LEDS(X)
101#endif
102
103#define __addr_LCD() (__region_CS2 + 0x01200008UL)
104#define __get_LCD(B) __builtin_read32((volatile void __iomem *) (B))
105#define __set_LCD(B,X) __builtin_write32((volatile void __iomem *) (B), (X))
106
107#define LCD_D 0x000000ff /* LCD data bus */
108#define LCD_RW 0x00000100 /* LCD R/W signal */
109#define LCD_RS 0x00000200 /* LCD Register Select */
110#define LCD_E 0x00000400 /* LCD Start Enable Signal */
111
112#define LCD_CMD_CLEAR (LCD_E|0x001)
113#define LCD_CMD_HOME (LCD_E|0x002)
114#define LCD_CMD_CURSOR_INC (LCD_E|0x004)
115#define LCD_CMD_SCROLL_INC (LCD_E|0x005)
116#define LCD_CMD_CURSOR_DEC (LCD_E|0x006)
117#define LCD_CMD_SCROLL_DEC (LCD_E|0x007)
118#define LCD_CMD_OFF (LCD_E|0x008)
119#define LCD_CMD_ON(CRSR,BLINK) (LCD_E|0x00c|(CRSR<<1)|BLINK)
120#define LCD_CMD_CURSOR_MOVE_L (LCD_E|0x010)
121#define LCD_CMD_CURSOR_MOVE_R (LCD_E|0x014)
122#define LCD_CMD_DISPLAY_SHIFT_L (LCD_E|0x018)
123#define LCD_CMD_DISPLAY_SHIFT_R (LCD_E|0x01c)
124#define LCD_CMD_FUNCSET(DL,N,F) (LCD_E|0x020|(DL<<4)|(N<<3)|(F<<2))
125#define LCD_CMD_SET_CG_ADDR(X) (LCD_E|0x040|X)
126#define LCD_CMD_SET_DD_ADDR(X) (LCD_E|0x080|X)
127#define LCD_CMD_READ_BUSY (LCD_E|LCD_RW)
128#define LCD_DATA_WRITE(X) (LCD_E|LCD_RS|(X))
129#define LCD_DATA_READ (LCD_E|LCD_RS|LCD_RW)
130
131#else
132/*
133 * PDK unit specific stuff
134 */
135
136#include <asm/mb93093-fpga-irqs.h>
137
138#define IRQ_CPU_MB93493_0 IRQ_CPU_EXTERNAL0
139#define IRQ_CPU_MB93493_1 IRQ_CPU_EXTERNAL1
140
141#define __region_CS5 0xf0000000 /* MB93493 CSC area (DAV daughter board) */
142#define __region_CS5_M 0x00ffffff /* mask */
143#define __region_CS5_C 0x00010000 /* control */
144#define __region_CS2 0x20000000 /* FPGA registers */
145#define __region_CS2_M 0x000fffff
146#define __region_CS2_C 0x00000000
147#define __region_CS1 0xfc100000 /* LAN registers */
148#define __region_CS1_M 0x000fffff
149#define __region_CS1_C 0x00010404
150#define __region_CS3 0xfc200000 /* MB93493 CSR area (DAV daughter board) */
151#define __region_CS3_M 0x000fffff
152#define __region_CS3_C 0xc8000000
153#define __region_CS4 0xfd000000 /* extra ROMs area */
154#define __region_CS4_M 0x00ffffff
155#define __region_CS4_C 0x00000f07
156
157#define __region_CS6 0xfe000000 /* not used - hide behind CPU resource I/O regs */
158#define __region_CS6_M 0x000fffff
159#define __region_CS6_C 0x00000f07
160#define __region_CS7 0xfe000000 /* not used - hide behind CPU resource I/O regs */
161#define __region_CS7_M 0x000fffff
162#define __region_CS7_C 0x00000f07
163
164#define __is_PCI_IO(addr) 0 /* no PCI */
165#define __is_PCI_MEM(addr) 0
166#define __is_PCI_addr(addr) 0
167#define __region_PCI_IO 0
168#define __region_PCI_MEM 0
169#define __flush_PCI_writes() do { } while(0)
170
171#define __get_CLKSW() 0UL
172#define __get_CLKIN() 66000000UL
173
174#define __addr_LEDS() (__region_CS2 + 0x00000023UL)
175#define __set_LEDS(X) __builtin_write8((volatile void __iomem *) __addr_LEDS(), (X))
176
177#define __addr_FPGATR() (__region_CS2 + 0x00000030UL)
178#define __set_FPGATR(X) __builtin_write32((volatile void __iomem *) __addr_FPGATR(), (X))
179#define __get_FPGATR() __builtin_read32((volatile void __iomem *) __addr_FPGATR())
180
181#define MB93093_FPGA_FPGATR_AUDIO_CLK 0x00000003
182
183#define __set_FPGATR_AUDIO_CLK(V) \
184 __set_FPGATR((__get_FPGATR() & ~MB93093_FPGA_FPGATR_AUDIO_CLK) | (V))
185
186#define MB93093_FPGA_FPGATR_AUDIO_CLK_OFF 0x0
187#define MB93093_FPGA_FPGATR_AUDIO_CLK_11MHz 0x1
188#define MB93093_FPGA_FPGATR_AUDIO_CLK_12MHz 0x2
189#define MB93093_FPGA_FPGATR_AUDIO_CLK_02MHz 0x3
190
191#define MB93093_FPGA_SWR_PUSHSWMASK (0x1F<<26)
192#define MB93093_FPGA_SWR_PUSHSW4 (1<<29)
193
194#define __addr_FPGA_SWR ((volatile void __iomem *)(__region_CS2 + 0x28UL))
195#define __get_FPGA_PUSHSW1_5() (__builtin_read32(__addr_FPGA_SWR) & MB93093_FPGA_SWR_PUSHSWMASK)
196
197
198#endif
199
200#endif /* _ASM_MB_REGS_H */
diff --git a/include/asm-frv/mb86943a.h b/include/asm-frv/mb86943a.h
deleted file mode 100644
index e87ef924bfb4..000000000000
--- a/include/asm-frv/mb86943a.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/* mb86943a.h: MB86943 SPARClite <-> PCI bridge registers
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_MB86943A_H
13#define _ASM_MB86943A_H
14
15#include <asm/mb-regs.h>
16
17#define __reg_MB86943_sl_ctl *(volatile uint32_t *) (__region_CS1 + 0x00)
18
19#define MB86943_SL_CTL_BUS_WIDTH_64 0x00000001
20#define MB86943_SL_CTL_AS_HOST 0x00000002
21#define MB86943_SL_CTL_DRCT_MASTER_SWAP 0x00000004
22#define MB86943_SL_CTL_DRCT_SLAVE_SWAP 0x00000008
23#define MB86943_SL_CTL_PCI_CONFIG_SWAP 0x00000010
24#define MB86943_SL_CTL_ECS0_ENABLE 0x00000020
25#define MB86943_SL_CTL_ECS1_ENABLE 0x00000040
26#define MB86943_SL_CTL_ECS2_ENABLE 0x00000080
27
28#define __reg_MB86943_ecs_ctl(N) *(volatile uint32_t *) (__region_CS1 + 0x08 + (0x08*(N)))
29#define __reg_MB86943_ecs_range(N) *(volatile uint32_t *) (__region_CS1 + 0x20 + (0x10*(N)))
30#define __reg_MB86943_ecs_base(N) *(volatile uint32_t *) (__region_CS1 + 0x28 + (0x10*(N)))
31
32#define __reg_MB86943_sl_pci_io_range *(volatile uint32_t *) (__region_CS1 + 0x50)
33#define __reg_MB86943_sl_pci_io_base *(volatile uint32_t *) (__region_CS1 + 0x58)
34#define __reg_MB86943_sl_pci_mem_range *(volatile uint32_t *) (__region_CS1 + 0x60)
35#define __reg_MB86943_sl_pci_mem_base *(volatile uint32_t *) (__region_CS1 + 0x68)
36#define __reg_MB86943_pci_sl_io_base *(volatile uint32_t *) (__region_CS1 + 0x70)
37#define __reg_MB86943_pci_sl_mem_base *(volatile uint32_t *) (__region_CS1 + 0x78)
38
39#define __reg_MB86943_pci_arbiter *(volatile uint32_t *) (__region_CS2 + 0x01300014)
40#define MB86943_PCIARB_EN 0x00000001
41
42#endif /* _ASM_MB86943A_H */
diff --git a/include/asm-frv/mb93091-fpga-irqs.h b/include/asm-frv/mb93091-fpga-irqs.h
deleted file mode 100644
index 19778c5ba9d6..000000000000
--- a/include/asm-frv/mb93091-fpga-irqs.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/* mb93091-fpga-irqs.h: MB93091 CPU board FPGA IRQs
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_MB93091_FPGA_IRQS_H
13#define _ASM_MB93091_FPGA_IRQS_H
14
15#include <asm/irq.h>
16
17#ifndef __ASSEMBLY__
18
19/* IRQ IDs presented to drivers */
20enum {
21 IRQ_FPGA__UNUSED = IRQ_BASE_FPGA,
22 IRQ_FPGA_SYSINT_BUS_EXPANSION_1,
23 IRQ_FPGA_SL_BUS_EXPANSION_2,
24 IRQ_FPGA_PCI_INTD,
25 IRQ_FPGA_PCI_INTC,
26 IRQ_FPGA_PCI_INTB,
27 IRQ_FPGA_PCI_INTA,
28 IRQ_FPGA_SL_BUS_EXPANSION_7,
29 IRQ_FPGA_SYSINT_BUS_EXPANSION_8,
30 IRQ_FPGA_SL_BUS_EXPANSION_9,
31 IRQ_FPGA_MB86943_PCI_INTA,
32 IRQ_FPGA_MB86943_SLBUS_SIDE,
33 IRQ_FPGA_RTL8029_INTA,
34 IRQ_FPGA_SYSINT_BUS_EXPANSION_13,
35 IRQ_FPGA_SL_BUS_EXPANSION_14,
36 IRQ_FPGA_NMI,
37};
38
39
40#endif /* !__ASSEMBLY__ */
41
42#endif /* _ASM_MB93091_FPGA_IRQS_H */
diff --git a/include/asm-frv/mb93093-fpga-irqs.h b/include/asm-frv/mb93093-fpga-irqs.h
deleted file mode 100644
index 590266b1a6d3..000000000000
--- a/include/asm-frv/mb93093-fpga-irqs.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* mb93093-fpga-irqs.h: MB93093 CPU board FPGA IRQs
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_MB93093_FPGA_IRQS_H
13#define _ASM_MB93093_FPGA_IRQS_H
14
15#include <asm/irq.h>
16
17#ifndef __ASSEMBLY__
18
19/* IRQ IDs presented to drivers */
20enum {
21 IRQ_FPGA_PUSH_BUTTON_SW1_5 = IRQ_BASE_FPGA + 8,
22 IRQ_FPGA_ROCKER_C_SW8 = IRQ_BASE_FPGA + 9,
23 IRQ_FPGA_ROCKER_C_SW9 = IRQ_BASE_FPGA + 10,
24};
25
26
27#endif /* !__ASSEMBLY__ */
28
29#endif /* _ASM_MB93093_FPGA_IRQS_H */
diff --git a/include/asm-frv/mb93493-irqs.h b/include/asm-frv/mb93493-irqs.h
deleted file mode 100644
index 82c7aeddd333..000000000000
--- a/include/asm-frv/mb93493-irqs.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/* mb93493-irqs.h: MB93493 companion chip IRQs
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_MB93493_IRQS_H
13#define _ASM_MB93493_IRQS_H
14
15#include <asm/irq.h>
16
17#ifndef __ASSEMBLY__
18
19/* IRQ IDs presented to drivers */
20enum {
21 IRQ_MB93493_VDC = IRQ_BASE_MB93493 + 0,
22 IRQ_MB93493_VCC = IRQ_BASE_MB93493 + 1,
23 IRQ_MB93493_AUDIO_OUT = IRQ_BASE_MB93493 + 2,
24 IRQ_MB93493_I2C_0 = IRQ_BASE_MB93493 + 3,
25 IRQ_MB93493_I2C_1 = IRQ_BASE_MB93493 + 4,
26 IRQ_MB93493_USB = IRQ_BASE_MB93493 + 5,
27 IRQ_MB93493_LOCAL_BUS = IRQ_BASE_MB93493 + 7,
28 IRQ_MB93493_PCMCIA = IRQ_BASE_MB93493 + 8,
29 IRQ_MB93493_GPIO = IRQ_BASE_MB93493 + 9,
30 IRQ_MB93493_AUDIO_IN = IRQ_BASE_MB93493 + 10,
31};
32
33/* IRQ multiplexor mappings */
34#define ROUTE_VIA_IRQ0 0 /* route IRQ by way of CPU external IRQ 0 */
35#define ROUTE_VIA_IRQ1 1 /* route IRQ by way of CPU external IRQ 1 */
36
37#define IRQ_MB93493_VDC_ROUTE ROUTE_VIA_IRQ0
38#define IRQ_MB93493_VCC_ROUTE ROUTE_VIA_IRQ1
39#define IRQ_MB93493_AUDIO_OUT_ROUTE ROUTE_VIA_IRQ1
40#define IRQ_MB93493_I2C_0_ROUTE ROUTE_VIA_IRQ1
41#define IRQ_MB93493_I2C_1_ROUTE ROUTE_VIA_IRQ1
42#define IRQ_MB93493_USB_ROUTE ROUTE_VIA_IRQ1
43#define IRQ_MB93493_LOCAL_BUS_ROUTE ROUTE_VIA_IRQ1
44#define IRQ_MB93493_PCMCIA_ROUTE ROUTE_VIA_IRQ1
45#define IRQ_MB93493_GPIO_ROUTE ROUTE_VIA_IRQ1
46#define IRQ_MB93493_AUDIO_IN_ROUTE ROUTE_VIA_IRQ1
47
48#endif /* !__ASSEMBLY__ */
49
50#endif /* _ASM_MB93493_IRQS_H */
diff --git a/include/asm-frv/mb93493-regs.h b/include/asm-frv/mb93493-regs.h
deleted file mode 100644
index 8a1f6aac8cf1..000000000000
--- a/include/asm-frv/mb93493-regs.h
+++ /dev/null
@@ -1,281 +0,0 @@
1/* mb93493-regs.h: MB93493 companion chip registers
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_MB93493_REGS_H
13#define _ASM_MB93493_REGS_H
14
15#include <asm/mb-regs.h>
16#include <asm/mb93493-irqs.h>
17
18#define __addr_MB93493(X) ((volatile unsigned long *)(__region_CS3 + (X)))
19#define __get_MB93493(X) ({ *(volatile unsigned long *)(__region_CS3 + (X)); })
20
21#define __set_MB93493(X,V) \
22do { \
23 *(volatile unsigned long *)(__region_CS3 + (X)) = (V); mb(); \
24} while(0)
25
26#define __get_MB93493_STSR(X) __get_MB93493(0x3c0 + (X) * 4)
27#define __set_MB93493_STSR(X,V) __set_MB93493(0x3c0 + (X) * 4, (V))
28#define MB93493_STSR_EN
29
30#define __addr_MB93493_IQSR(X) __addr_MB93493(0x3d0 + (X) * 4)
31#define __get_MB93493_IQSR(X) __get_MB93493(0x3d0 + (X) * 4)
32#define __set_MB93493_IQSR(X,V) __set_MB93493(0x3d0 + (X) * 4, (V))
33
34#define __get_MB93493_DQSR(X) __get_MB93493(0x3e0 + (X) * 4)
35#define __set_MB93493_DQSR(X,V) __set_MB93493(0x3e0 + (X) * 4, (V))
36
37#define __get_MB93493_LBSER() __get_MB93493(0x3f0)
38#define __set_MB93493_LBSER(V) __set_MB93493(0x3f0, (V))
39
40#define MB93493_LBSER_VDC 0x00010000
41#define MB93493_LBSER_VCC 0x00020000
42#define MB93493_LBSER_AUDIO 0x00040000
43#define MB93493_LBSER_I2C_0 0x00080000
44#define MB93493_LBSER_I2C_1 0x00100000
45#define MB93493_LBSER_USB 0x00200000
46#define MB93493_LBSER_GPIO 0x00800000
47#define MB93493_LBSER_PCMCIA 0x01000000
48
49#define __get_MB93493_LBSR() __get_MB93493(0x3fc)
50#define __set_MB93493_LBSR(V) __set_MB93493(0x3fc, (V))
51
52/*
53 * video display controller
54 */
55#define __get_MB93493_VDC(X) __get_MB93493(MB93493_VDC_##X)
56#define __set_MB93493_VDC(X,V) __set_MB93493(MB93493_VDC_##X, (V))
57
58#define MB93493_VDC_RCURSOR 0x140 /* cursor position */
59#define MB93493_VDC_RCT1 0x144 /* cursor colour 1 */
60#define MB93493_VDC_RCT2 0x148 /* cursor colour 2 */
61#define MB93493_VDC_RHDC 0x150 /* horizontal display period */
62#define MB93493_VDC_RH_MARGINS 0x154 /* horizontal margin sizes */
63#define MB93493_VDC_RVDC 0x158 /* vertical display period */
64#define MB93493_VDC_RV_MARGINS 0x15c /* vertical margin sizes */
65#define MB93493_VDC_RC 0x170 /* VDC control */
66#define MB93493_VDC_RCLOCK 0x174 /* clock divider, DMA req delay */
67#define MB93493_VDC_RBLACK 0x178 /* black insert sizes */
68#define MB93493_VDC_RS 0x17c /* VDC status */
69
70#define __addr_MB93493_VDC_BCI(X) ({ (volatile unsigned long *)(__region_CS3 + 0x000 + (X)); })
71#define __addr_MB93493_VDC_TPO(X) (__region_CS3 + 0x1c0 + (X))
72
73#define VDC_TPO_WIDTH 32
74
75#define VDC_RC_DSR 0x00000080 /* VDC master reset */
76
77#define VDC_RS_IT 0x00060000 /* interrupt indicators */
78#define VDC_RS_IT_UNDERFLOW 0x00040000 /* - underflow event */
79#define VDC_RS_IT_VSYNC 0x00020000 /* - VSYNC event */
80#define VDC_RS_DFI 0x00010000 /* current interlace field number */
81#define VDC_RS_DFI_TOP 0x00000000 /* - top field */
82#define VDC_RS_DFI_BOTTOM 0x00010000 /* - bottom field */
83#define VDC_RS_DCSR 0x00000010 /* cursor state */
84#define VDC_RS_DCM 0x00000003 /* display mode */
85#define VDC_RS_DCM_DISABLED 0x00000000 /* - display disabled */
86#define VDC_RS_DCM_STOPPED 0x00000001 /* - VDC stopped */
87#define VDC_RS_DCM_FREERUNNING 0x00000002 /* - VDC free-running */
88#define VDC_RS_DCM_TRANSFERRING 0x00000003 /* - data being transferred to VDC */
89
90/*
91 * video capture controller
92 */
93#define __get_MB93493_VCC(X) __get_MB93493(MB93493_VCC_##X)
94#define __set_MB93493_VCC(X,V) __set_MB93493(MB93493_VCC_##X, (V))
95
96#define MB93493_VCC_RREDUCT 0x104 /* reduction rate */
97#define MB93493_VCC_RHY 0x108 /* horizontal brightness filter coefficients */
98#define MB93493_VCC_RHC 0x10c /* horizontal colour-difference filter coefficients */
99#define MB93493_VCC_RHSIZE 0x110 /* horizontal cycle sizes */
100#define MB93493_VCC_RHBC 0x114 /* horizontal back porch size */
101#define MB93493_VCC_RVCC 0x118 /* vertical capture period */
102#define MB93493_VCC_RVBC 0x11c /* vertical back porch period */
103#define MB93493_VCC_RV 0x120 /* vertical filter coefficients */
104#define MB93493_VCC_RDTS 0x128 /* DMA transfer size */
105#define MB93493_VCC_RDTS_4B 0x01000000 /* 4-byte transfer */
106#define MB93493_VCC_RDTS_32B 0x03000000 /* 32-byte transfer */
107#define MB93493_VCC_RDTS_SHIFT 24
108#define MB93493_VCC_RCC 0x130 /* VCC control */
109#define MB93493_VCC_RIS 0x134 /* VCC interrupt status */
110
111#define __addr_MB93493_VCC_TPI(X) (__region_CS3 + 0x180 + (X))
112
113#define VCC_RHSIZE_RHCC 0x000007ff
114#define VCC_RHSIZE_RHCC_SHIFT 0
115#define VCC_RHSIZE_RHTCC 0x0fff0000
116#define VCC_RHSIZE_RHTCC_SHIFT 16
117
118#define VCC_RVBC_RVBC 0x00003f00
119#define VCC_RVBC_RVBC_SHIFT 8
120
121#define VCC_RREDUCT_RHR 0x07ff0000
122#define VCC_RREDUCT_RHR_SHIFT 16
123#define VCC_RREDUCT_RVR 0x000007ff
124#define VCC_RREDUCT_RVR_SHIFT 0
125
126#define VCC_RCC_CE 0x00000001 /* VCC enable */
127#define VCC_RCC_CS 0x00000002 /* request video capture start */
128#define VCC_RCC_CPF 0x0000000c /* pixel format */
129#define VCC_RCC_CPF_YCBCR_16 0x00000000 /* - YCbCr 4:2:2 16-bit format */
130#define VCC_RCC_CPF_RGB 0x00000004 /* - RGB 4:4:4 format */
131#define VCC_RCC_CPF_YCBCR_24 0x00000008 /* - YCbCr 4:2:2 24-bit format */
132#define VCC_RCC_CPF_BT656 0x0000000c /* - ITU R-BT.656 format */
133#define VCC_RCC_CPF_SHIFT 2
134#define VCC_RCC_CSR 0x00000080 /* request reset */
135#define VCC_RCC_HSIP 0x00000100 /* HSYNC polarity */
136#define VCC_RCC_HSIP_LOACT 0x00000000 /* - low active */
137#define VCC_RCC_HSIP_HIACT 0x00000100 /* - high active */
138#define VCC_RCC_VSIP 0x00000200 /* VSYNC polarity */
139#define VCC_RCC_VSIP_LOACT 0x00000000 /* - low active */
140#define VCC_RCC_VSIP_HIACT 0x00000200 /* - high active */
141#define VCC_RCC_CIE 0x00000800 /* interrupt enable */
142#define VCC_RCC_CFP 0x00001000 /* RGB pixel packing */
143#define VCC_RCC_CFP_4TO3 0x00000000 /* - pack 4 pixels into 3 words */
144#define VCC_RCC_CFP_1TO1 0x00001000 /* - pack 1 pixel into 1 words */
145#define VCC_RCC_CSM 0x00006000 /* interlace specification */
146#define VCC_RCC_CSM_ONEPASS 0x00002000 /* - non-interlaced */
147#define VCC_RCC_CSM_INTERLACE 0x00004000 /* - interlaced */
148#define VCC_RCC_CSM_SHIFT 13
149#define VCC_RCC_ES 0x00008000 /* capture start polarity */
150#define VCC_RCC_ES_NEG 0x00000000 /* - negative edge */
151#define VCC_RCC_ES_POS 0x00008000 /* - positive edge */
152#define VCC_RCC_IFI 0x00080000 /* inferlace field evaluation reverse */
153#define VCC_RCC_FDTS 0x00300000 /* interlace field start */
154#define VCC_RCC_FDTS_3_8 0x00000000 /* - 3/8 of horizontal entire cycle */
155#define VCC_RCC_FDTS_1_4 0x00100000 /* - 1/4 of horizontal entire cycle */
156#define VCC_RCC_FDTS_7_16 0x00200000 /* - 7/16 of horizontal entire cycle */
157#define VCC_RCC_FDTS_SHIFT 20
158#define VCC_RCC_MOV 0x00400000 /* test bit - always set to 1 */
159#define VCC_RCC_STP 0x00800000 /* request video capture stop */
160#define VCC_RCC_TO 0x01000000 /* input during top-field only */
161
162#define VCC_RIS_VSYNC 0x01000000 /* VSYNC interrupt */
163#define VCC_RIS_OV 0x02000000 /* overflow interrupt */
164#define VCC_RIS_BOTTOM 0x08000000 /* interlace bottom field */
165#define VCC_RIS_STARTED 0x10000000 /* capture started */
166
167/*
168 * I2C
169 */
170#define MB93493_I2C_BSR 0x340 /* bus status */
171#define MB93493_I2C_BCR 0x344 /* bus control */
172#define MB93493_I2C_CCR 0x348 /* clock control */
173#define MB93493_I2C_ADR 0x34c /* address */
174#define MB93493_I2C_DTR 0x350 /* data */
175#define MB93493_I2C_BC2R 0x35c /* bus control 2 */
176
177#define __addr_MB93493_I2C(port,X) (__region_CS3 + MB93493_I2C_##X + ((port)*0x20))
178#define __get_MB93493_I2C(port,X) __get_MB93493(MB93493_I2C_##X + ((port)*0x20))
179#define __set_MB93493_I2C(port,X,V) __set_MB93493(MB93493_I2C_##X + ((port)*0x20), (V))
180
181#define I2C_BSR_BB (1 << 7)
182
183/*
184 * audio controller (I2S) registers
185 */
186#define __get_MB93493_I2S(X) __get_MB93493(MB93493_I2S_##X)
187#define __set_MB93493_I2S(X,V) __set_MB93493(MB93493_I2S_##X, (V))
188
189#define MB93493_I2S_ALDR 0x300 /* L-channel data */
190#define MB93493_I2S_ARDR 0x304 /* R-channel data */
191#define MB93493_I2S_APDR 0x308 /* 16-bit packed data */
192#define MB93493_I2S_AISTR 0x310 /* status */
193#define MB93493_I2S_AICR 0x314 /* control */
194
195#define __addr_MB93493_I2S_ALDR(X) (__region_CS3 + MB93493_I2S_ALDR + (X))
196#define __addr_MB93493_I2S_ARDR(X) (__region_CS3 + MB93493_I2S_ARDR + (X))
197#define __addr_MB93493_I2S_APDR(X) (__region_CS3 + MB93493_I2S_APDR + (X))
198#define __addr_MB93493_I2S_ADR(X) (__region_CS3 + 0x320 + (X))
199
200#define I2S_AISTR_OTST 0x00000003 /* status of output data transfer */
201#define I2S_AISTR_OTR 0x00000010 /* output transfer request pending */
202#define I2S_AISTR_OUR 0x00000020 /* output FIFO underrun detected */
203#define I2S_AISTR_OOR 0x00000040 /* output FIFO overrun detected */
204#define I2S_AISTR_ODS 0x00000100 /* output DMA transfer size */
205#define I2S_AISTR_ODE 0x00000400 /* output DMA transfer request enable */
206#define I2S_AISTR_OTRIE 0x00001000 /* output transfer request interrupt enable */
207#define I2S_AISTR_OURIE 0x00002000 /* output FIFO underrun interrupt enable */
208#define I2S_AISTR_OORIE 0x00004000 /* output FIFO overrun interrupt enable */
209#define I2S_AISTR__OUT_MASK 0x00007570
210#define I2S_AISTR_ITST 0x00030000 /* status of input data transfer */
211#define I2S_AISTR_ITST_SHIFT 16
212#define I2S_AISTR_ITR 0x00100000 /* input transfer request pending */
213#define I2S_AISTR_IUR 0x00200000 /* input FIFO underrun detected */
214#define I2S_AISTR_IOR 0x00400000 /* input FIFO overrun detected */
215#define I2S_AISTR_IDS 0x01000000 /* input DMA transfer size */
216#define I2S_AISTR_IDE 0x04000000 /* input DMA transfer request enable */
217#define I2S_AISTR_ITRIE 0x10000000 /* input transfer request interrupt enable */
218#define I2S_AISTR_IURIE 0x20000000 /* input FIFO underrun interrupt enable */
219#define I2S_AISTR_IORIE 0x40000000 /* input FIFO overrun interrupt enable */
220#define I2S_AISTR__IN_MASK 0x75700000
221
222#define I2S_AICR_MI 0x00000001 /* mono input requested */
223#define I2S_AICR_AMI 0x00000002 /* relation between LRCKI/FS1 and SDI */
224#define I2S_AICR_LRI 0x00000004 /* function of LRCKI pin */
225#define I2S_AICR_SDMI 0x00000070 /* format of input audio data */
226#define I2S_AICR_SDMI_SHIFT 4
227#define I2S_AICR_CLI 0x00000080 /* input FIFO clearing control */
228#define I2S_AICR_IM 0x00000300 /* input state control */
229#define I2S_AICR_IM_SHIFT 8
230#define I2S_AICR__IN_MASK 0x000003f7
231#define I2S_AICR_MO 0x00001000 /* mono output requested */
232#define I2S_AICR_AMO 0x00002000 /* relation between LRCKO/FS0 and SDO */
233#define I2S_AICR_AMO_SHIFT 13
234#define I2S_AICR_LRO 0x00004000 /* function of LRCKO pin */
235#define I2S_AICR_SDMO 0x00070000 /* format of output audio data */
236#define I2S_AICR_SDMO_SHIFT 16
237#define I2S_AICR_CLO 0x00080000 /* output FIFO clearing control */
238#define I2S_AICR_OM 0x00100000 /* output state control */
239#define I2S_AICR__OUT_MASK 0x001f7000
240#define I2S_AICR_DIV 0x03000000 /* frequency division rate */
241#define I2S_AICR_DIV_SHIFT 24
242#define I2S_AICR_FL 0x20000000 /* frame length */
243#define I2S_AICR_FS 0x40000000 /* frame sync method */
244#define I2S_AICR_ME 0x80000000 /* master enable */
245
246/*
247 * PCMCIA
248 */
249#define __addr_MB93493_PCMCIA(X) ((volatile unsigned long *)(__region_CS5 + (X)))
250
251/*
252 * GPIO
253 */
254#define __get_MB93493_GPIO_PDR(X) __get_MB93493(0x380 + (X) * 0xc0)
255#define __set_MB93493_GPIO_PDR(X,V) __set_MB93493(0x380 + (X) * 0xc0, (V))
256
257#define __get_MB93493_GPIO_GPDR(X) __get_MB93493(0x384 + (X) * 0xc0)
258#define __set_MB93493_GPIO_GPDR(X,V) __set_MB93493(0x384 + (X) * 0xc0, (V))
259
260#define __get_MB93493_GPIO_SIR(X) __get_MB93493(0x388 + (X) * 0xc0)
261#define __set_MB93493_GPIO_SIR(X,V) __set_MB93493(0x388 + (X) * 0xc0, (V))
262
263#define __get_MB93493_GPIO_SOR(X) __get_MB93493(0x38c + (X) * 0xc0)
264#define __set_MB93493_GPIO_SOR(X,V) __set_MB93493(0x38c + (X) * 0xc0, (V))
265
266#define __get_MB93493_GPIO_PDSR(X) __get_MB93493(0x390 + (X) * 0xc0)
267#define __set_MB93493_GPIO_PDSR(X,V) __set_MB93493(0x390 + (X) * 0xc0, (V))
268
269#define __get_MB93493_GPIO_PDCR(X) __get_MB93493(0x394 + (X) * 0xc0)
270#define __set_MB93493_GPIO_PDCR(X,V) __set_MB93493(0x394 + (X) * 0xc0, (V))
271
272#define __get_MB93493_GPIO_INTST(X) __get_MB93493(0x398 + (X) * 0xc0)
273#define __set_MB93493_GPIO_INTST(X,V) __set_MB93493(0x398 + (X) * 0xc0, (V))
274
275#define __get_MB93493_GPIO_IEHL(X) __get_MB93493(0x39c + (X) * 0xc0)
276#define __set_MB93493_GPIO_IEHL(X,V) __set_MB93493(0x39c + (X) * 0xc0, (V))
277
278#define __get_MB93493_GPIO_IELH(X) __get_MB93493(0x3a0 + (X) * 0xc0)
279#define __set_MB93493_GPIO_IELH(X,V) __set_MB93493(0x3a0 + (X) * 0xc0, (V))
280
281#endif /* _ASM_MB93493_REGS_H */
diff --git a/include/asm-frv/mc146818rtc.h b/include/asm-frv/mc146818rtc.h
deleted file mode 100644
index 90dfb7a633d1..000000000000
--- a/include/asm-frv/mc146818rtc.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/* mc146818rtc.h: RTC defs
2 *
3 * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_MC146818RTC_H
13#define _ASM_MC146818RTC_H
14
15
16#endif /* _ASM_MC146818RTC_H */
diff --git a/include/asm-frv/mem-layout.h b/include/asm-frv/mem-layout.h
deleted file mode 100644
index 2947764fc0e0..000000000000
--- a/include/asm-frv/mem-layout.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/* mem-layout.h: memory layout
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_MEM_LAYOUT_H
13#define _ASM_MEM_LAYOUT_H
14
15#ifndef __ASSEMBLY__
16#define __UL(X) ((unsigned long) (X))
17#else
18#define __UL(X) (X)
19#endif
20
21/*
22 * PAGE_SHIFT determines the page size
23 */
24#define PAGE_SHIFT 14
25
26#ifndef __ASSEMBLY__
27#define PAGE_SIZE (1UL << PAGE_SHIFT)
28#else
29#define PAGE_SIZE (1 << PAGE_SHIFT)
30#endif
31
32#define PAGE_MASK (~(PAGE_SIZE-1))
33
34/*
35 * the slab must be aligned such that load- and store-double instructions don't
36 * fault if used
37 */
38#define ARCH_KMALLOC_MINALIGN 8
39#define ARCH_SLAB_MINALIGN 8
40
41/*****************************************************************************/
42/*
43 * virtual memory layout from kernel's point of view
44 */
45#define PAGE_OFFSET ((unsigned long) &__page_offset)
46
47#ifdef CONFIG_MMU
48
49/* see Documentation/frv/mmu-layout.txt */
50#define KERNEL_LOWMEM_START __UL(0xc0000000)
51#define KERNEL_LOWMEM_END __UL(0xd0000000)
52#define VMALLOC_START __UL(0xd0000000)
53#define VMALLOC_END __UL(0xd8000000)
54#define PKMAP_BASE __UL(0xd8000000)
55#define PKMAP_END __UL(0xdc000000)
56#define KMAP_ATOMIC_SECONDARY_FRAME __UL(0xdc000000)
57#define KMAP_ATOMIC_PRIMARY_FRAME __UL(0xdd000000)
58
59#endif
60
61#define KERNEL_IO_START __UL(0xe0000000)
62
63
64/*****************************************************************************/
65/*
66 * memory layout from userspace's point of view
67 */
68#define BRK_BASE __UL(2 * 1024 * 1024 + PAGE_SIZE)
69#define STACK_TOP __UL(2 * 1024 * 1024)
70#define STACK_TOP_MAX __UL(0xc0000000)
71
72/* userspace process size */
73#ifdef CONFIG_MMU
74#define TASK_SIZE (PAGE_OFFSET)
75#else
76#define TASK_SIZE __UL(0xFFFFFFFFUL)
77#endif
78
79/* base of area at which unspecified mmaps will start */
80#ifdef CONFIG_BINFMT_ELF_FDPIC
81#define TASK_UNMAPPED_BASE __UL(16 * 1024 * 1024)
82#else
83#define TASK_UNMAPPED_BASE __UL(TASK_SIZE / 3)
84#endif
85
86#endif /* _ASM_MEM_LAYOUT_H */
diff --git a/include/asm-frv/mman.h b/include/asm-frv/mman.h
deleted file mode 100644
index b4371e928683..000000000000
--- a/include/asm-frv/mman.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef __ASM_MMAN_H__
2#define __ASM_MMAN_H__
3
4#include <asm-generic/mman.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13
14#define MCL_CURRENT 1 /* lock all current mappings */
15#define MCL_FUTURE 2 /* lock all future mappings */
16
17#endif /* __ASM_MMAN_H__ */
18
diff --git a/include/asm-frv/mmu.h b/include/asm-frv/mmu.h
deleted file mode 100644
index 86ca0e86e7d2..000000000000
--- a/include/asm-frv/mmu.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/* mmu.h: memory management context for FR-V with or without MMU support
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _ASM_MMU_H
12#define _ASM_MMU_H
13
14typedef struct {
15#ifdef CONFIG_MMU
16 struct list_head id_link; /* link in list of context ID owners */
17 unsigned short id; /* MMU context ID */
18 unsigned short id_busy; /* true if ID is in CXNR */
19 unsigned long itlb_cached_pge; /* [SCR0] PGE cached for insn TLB handler */
20 unsigned long itlb_ptd_mapping; /* [DAMR4] PTD mapping for itlb cached PGE */
21 unsigned long dtlb_cached_pge; /* [SCR1] PGE cached for data TLB handler */
22 unsigned long dtlb_ptd_mapping; /* [DAMR5] PTD mapping for dtlb cached PGE */
23
24#else
25 unsigned long end_brk;
26
27#endif
28
29#ifdef CONFIG_BINFMT_ELF_FDPIC
30 unsigned long exec_fdpic_loadmap;
31 unsigned long interp_fdpic_loadmap;
32#endif
33
34} mm_context_t;
35
36#ifdef CONFIG_MMU
37extern int __nongpreldata cxn_pinned;
38extern int cxn_pin_by_pid(pid_t pid);
39#endif
40
41#endif /* _ASM_MMU_H */
diff --git a/include/asm-frv/mmu_context.h b/include/asm-frv/mmu_context.h
deleted file mode 100644
index c7daa395156a..000000000000
--- a/include/asm-frv/mmu_context.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/* mmu_context.h: MMU context management routines
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_MMU_CONTEXT_H
13#define _ASM_MMU_CONTEXT_H
14
15#include <asm/setup.h>
16#include <asm/page.h>
17#include <asm/pgalloc.h>
18#include <asm-generic/mm_hooks.h>
19
20static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
21{
22}
23
24#ifdef CONFIG_MMU
25extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
26extern void change_mm_context(mm_context_t *old, mm_context_t *ctx, pgd_t *_pgd);
27extern void destroy_context(struct mm_struct *mm);
28
29#else
30#define init_new_context(tsk, mm) ({ 0; })
31#define change_mm_context(old, ctx, _pml4) do {} while(0)
32#define destroy_context(mm) do {} while(0)
33#endif
34
35#define switch_mm(prev, next, tsk) \
36do { \
37 if (prev != next) \
38 change_mm_context(&prev->context, &next->context, next->pgd); \
39} while(0)
40
41#define activate_mm(prev, next) \
42do { \
43 change_mm_context(&prev->context, &next->context, next->pgd); \
44} while(0)
45
46#define deactivate_mm(tsk, mm) \
47do { \
48} while(0)
49
50#endif
diff --git a/include/asm-frv/module.h b/include/asm-frv/module.h
deleted file mode 100644
index 3d5c6360289a..000000000000
--- a/include/asm-frv/module.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/* module.h: FRV module stuff
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _ASM_MODULE_H
12#define _ASM_MODULE_H
13
14struct mod_arch_specific
15{
16};
17
18#define Elf_Shdr Elf32_Shdr
19#define Elf_Sym Elf32_Sym
20#define Elf_Ehdr Elf32_Ehdr
21
22/*
23 * Include the architecture version.
24 */
25#define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " "
26
27#endif /* _ASM_MODULE_H */
28
diff --git a/include/asm-frv/msgbuf.h b/include/asm-frv/msgbuf.h
deleted file mode 100644
index 97ceb55a06fb..000000000000
--- a/include/asm-frv/msgbuf.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef _ASM_MSGBUF_H
2#define _ASM_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for FR-V architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 unsigned long __unused1;
18 __kernel_time_t msg_rtime; /* last msgrcv time */
19 unsigned long __unused2;
20 __kernel_time_t msg_ctime; /* last change time */
21 unsigned long __unused3;
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30
31#endif /* _ASM_MSGBUF_H */
32
diff --git a/include/asm-frv/mutex.h b/include/asm-frv/mutex.h
deleted file mode 100644
index 458c1f7fbc18..000000000000
--- a/include/asm-frv/mutex.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h
deleted file mode 100644
index bd9c220094c7..000000000000
--- a/include/asm-frv/page.h
+++ /dev/null
@@ -1,78 +0,0 @@
1#ifndef _ASM_PAGE_H
2#define _ASM_PAGE_H
3
4#include <asm/virtconvert.h>
5#include <asm/mem-layout.h>
6#include <asm/sections.h>
7#include <asm/setup.h>
8
9#ifndef __ASSEMBLY__
10
11#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
12#define free_user_page(page, addr) free_page(addr)
13
14#define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE)
15#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
16
17#define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE)
18#define copy_user_page(vto, vfrom, vaddr, topg) memcpy((vto), (vfrom), PAGE_SIZE)
19
20/*
21 * These are used to make use of C type-checking..
22 */
23typedef struct { unsigned long pte; } pte_t;
24typedef struct { unsigned long ste[64];} pmd_t;
25typedef struct { pmd_t pue[1]; } pud_t;
26typedef struct { pud_t pge[1]; } pgd_t;
27typedef struct { unsigned long pgprot; } pgprot_t;
28typedef struct page *pgtable_t;
29
30#define pte_val(x) ((x).pte)
31#define pmd_val(x) ((x).ste[0])
32#define pud_val(x) ((x).pue[0])
33#define pgd_val(x) ((x).pge[0])
34#define pgprot_val(x) ((x).pgprot)
35
36#define __pte(x) ((pte_t) { (x) } )
37#define __pmd(x) ((pmd_t) { (x) } )
38#define __pud(x) ((pud_t) { (x) } )
39#define __pgd(x) ((pgd_t) { (x) } )
40#define __pgprot(x) ((pgprot_t) { (x) } )
41#define PTE_MASK PAGE_MASK
42
43#define devmem_is_allowed(pfn) 1
44
45#define __pa(vaddr) virt_to_phys((void *) (unsigned long) (vaddr))
46#define __va(paddr) phys_to_virt((unsigned long) (paddr))
47
48#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
49
50extern unsigned long max_low_pfn;
51extern unsigned long min_low_pfn;
52extern unsigned long max_pfn;
53
54#ifdef CONFIG_MMU
55#define pfn_valid(pfn) ((pfn) < max_mapnr)
56#else
57#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
58#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn)
59
60#endif
61
62#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
63#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
64
65
66#ifdef CONFIG_MMU
67#define VM_DATA_DEFAULT_FLAGS \
68 (VM_READ | VM_WRITE | \
69 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
70 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
71#endif
72
73#endif /* __ASSEMBLY__ */
74
75#include <asm-generic/memory_model.h>
76#include <asm-generic/page.h>
77
78#endif /* _ASM_PAGE_H */
diff --git a/include/asm-frv/param.h b/include/asm-frv/param.h
deleted file mode 100644
index 6859dd503ed3..000000000000
--- a/include/asm-frv/param.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef _ASM_PARAM_H
2#define _ASM_PARAM_H
3
4#ifdef __KERNEL__
5#define HZ CONFIG_HZ /* Internal kernel timer frequency */
6#define USER_HZ 100 /* .. some user interfaces are in "ticks" */
7#define CLOCKS_PER_SEC (USER_HZ) /* like times() */
8#endif
9
10#ifndef HZ
11#define HZ 100
12#endif
13
14#define EXEC_PAGESIZE 16384
15
16#ifndef NOGROUP
17#define NOGROUP (-1)
18#endif
19
20#define MAXHOSTNAMELEN 64 /* max length of hostname */
21
22#endif /* _ASM_PARAM_H */
diff --git a/include/asm-frv/pci.h b/include/asm-frv/pci.h
deleted file mode 100644
index 585d9b49949a..000000000000
--- a/include/asm-frv/pci.h
+++ /dev/null
@@ -1,118 +0,0 @@
1/* pci.h: FR-V specific PCI declarations
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from include/asm-m68k/pci.h
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#ifndef ASM_PCI_H
14#define ASM_PCI_H
15
16#include <linux/mm.h>
17#include <asm/scatterlist.h>
18#include <asm-generic/pci-dma-compat.h>
19#include <asm-generic/pci.h>
20
21struct pci_dev;
22
23#define pcibios_assign_all_busses() 0
24
25extern void pcibios_set_master(struct pci_dev *dev);
26
27extern void pcibios_penalize_isa_irq(int irq);
28
29#ifdef CONFIG_MMU
30extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
31extern void consistent_free(void *vaddr);
32extern void consistent_sync(void *vaddr, size_t size, int direction);
33extern void consistent_sync_page(struct page *page, unsigned long offset,
34 size_t size, int direction);
35#endif
36
37extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
38 dma_addr_t *dma_handle);
39
40extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
41 void *vaddr, dma_addr_t dma_handle);
42
43/* Return the index of the PCI controller for device PDEV. */
44#define pci_controller_num(PDEV) (0)
45
46/* The PCI address space does equal the physical memory
47 * address space. The networking and block device layers use
48 * this boolean for bounce buffer decisions.
49 */
50#define PCI_DMA_BUS_IS_PHYS (1)
51
52/* pci_unmap_{page,single} is a nop so... */
53#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
54#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
55#define pci_unmap_addr(PTR, ADDR_NAME) (0)
56#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
57#define pci_unmap_len(PTR, LEN_NAME) (0)
58#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
59
60#ifdef CONFIG_PCI
61static inline void pci_dma_burst_advice(struct pci_dev *pdev,
62 enum pci_dma_burst_strategy *strat,
63 unsigned long *strategy_parameter)
64{
65 *strat = PCI_DMA_BURST_INFINITY;
66 *strategy_parameter = ~0UL;
67}
68#endif
69
70/*
71 * These are pretty much arbitary with the CoMEM implementation.
72 * We have the whole address space to ourselves.
73 */
74#define PCIBIOS_MIN_IO 0x100
75#define PCIBIOS_MIN_MEM 0x00010000
76
77/* Make physical memory consistent for a single
78 * streaming mode DMA translation after a transfer.
79 *
80 * If you perform a pci_map_single() but wish to interrogate the
81 * buffer using the cpu, yet do not wish to teardown the PCI dma
82 * mapping, you must call this function before doing so. At the
83 * next point you give the PCI dma address back to the card, the
84 * device again owns the buffer.
85 */
86static inline void pci_dma_sync_single(struct pci_dev *hwdev,
87 dma_addr_t dma_handle,
88 size_t size, int direction)
89{
90 if (direction == PCI_DMA_NONE)
91 BUG();
92
93 frv_cache_wback_inv((unsigned long)bus_to_virt(dma_handle),
94 (unsigned long)bus_to_virt(dma_handle) + size);
95}
96
97/* Make physical memory consistent for a set of streaming
98 * mode DMA translations after a transfer.
99 *
100 * The same as pci_dma_sync_single but for a scatter-gather list,
101 * same rules and usage.
102 */
103static inline void pci_dma_sync_sg(struct pci_dev *hwdev,
104 struct scatterlist *sg,
105 int nelems, int direction)
106{
107 int i;
108
109 if (direction == PCI_DMA_NONE)
110 BUG();
111
112 for (i = 0; i < nelems; i++)
113 frv_cache_wback_inv(sg_dma_address(&sg[i]),
114 sg_dma_address(&sg[i])+sg_dma_len(&sg[i]));
115}
116
117
118#endif
diff --git a/include/asm-frv/percpu.h b/include/asm-frv/percpu.h
deleted file mode 100644
index 2cad3f874ded..000000000000
--- a/include/asm-frv/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_PERCPU_H
2#define __ASM_PERCPU_H
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ASM_PERCPU_H */
diff --git a/include/asm-frv/pgalloc.h b/include/asm-frv/pgalloc.h
deleted file mode 100644
index 971e6addb009..000000000000
--- a/include/asm-frv/pgalloc.h
+++ /dev/null
@@ -1,69 +0,0 @@
1/* pgalloc.h: Page allocation routines for FRV
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * Derived from:
12 * include/asm-m68knommu/pgalloc.h
13 * include/asm-i386/pgalloc.h
14 */
15#ifndef _ASM_PGALLOC_H
16#define _ASM_PGALLOC_H
17
18#include <asm/setup.h>
19#include <asm/virtconvert.h>
20
21#ifdef CONFIG_MMU
22
23#define pmd_populate_kernel(mm, pmd, pte) __set_pmd(pmd, __pa(pte) | _PAGE_TABLE)
24#define pmd_populate(MM, PMD, PAGE) \
25do { \
26 __set_pmd((PMD), page_to_pfn(PAGE) << PAGE_SHIFT | _PAGE_TABLE); \
27} while(0)
28#define pmd_pgtable(pmd) pmd_page(pmd)
29
30/*
31 * Allocate and free page tables.
32 */
33
34extern pgd_t *pgd_alloc(struct mm_struct *);
35extern void pgd_free(struct mm_struct *mm, pgd_t *);
36
37extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
38
39extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
40
41static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
42{
43 free_page((unsigned long)pte);
44}
45
46static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
47{
48 pgtable_page_dtor(pte);
49 __free_page(pte);
50}
51
52#define __pte_free_tlb(tlb,pte) \
53do { \
54 pgtable_page_dtor(pte); \
55 tlb_remove_page((tlb),(pte)); \
56} while (0)
57
58/*
59 * allocating and freeing a pmd is trivial: the 1-entry pmd is
60 * inside the pgd, so has no extra memory associated with it.
61 * (In the PAE case we free the pmds as part of the pgd.)
62 */
63#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *) 2); })
64#define pmd_free(mm, x) do { } while (0)
65#define __pmd_free_tlb(tlb,x) do { } while (0)
66
67#endif /* CONFIG_MMU */
68
69#endif /* _ASM_PGALLOC_H */
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
deleted file mode 100644
index e16fdb1f4f4f..000000000000
--- a/include/asm-frv/pgtable.h
+++ /dev/null
@@ -1,551 +0,0 @@
1/* pgtable.h: FR-V page table mangling
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * Derived from:
12 * include/asm-m68knommu/pgtable.h
13 * include/asm-i386/pgtable.h
14 */
15
16#ifndef _ASM_PGTABLE_H
17#define _ASM_PGTABLE_H
18
19#include <asm/mem-layout.h>
20#include <asm/setup.h>
21#include <asm/processor.h>
22
23#ifndef __ASSEMBLY__
24#include <linux/threads.h>
25#include <linux/slab.h>
26#include <linux/list.h>
27#include <linux/spinlock.h>
28#include <linux/sched.h>
29struct vm_area_struct;
30#endif
31
32#ifndef __ASSEMBLY__
33#if defined(CONFIG_HIGHPTE)
34typedef unsigned long pte_addr_t;
35#else
36typedef pte_t *pte_addr_t;
37#endif
38#endif
39
40/*****************************************************************************/
41/*
42 * MMU-less operation case first
43 */
44#ifndef CONFIG_MMU
45
46#define pgd_present(pgd) (1) /* pages are always present on NO_MM */
47#define pgd_none(pgd) (0)
48#define pgd_bad(pgd) (0)
49#define pgd_clear(pgdp)
50#define kern_addr_valid(addr) (1)
51#define pmd_offset(a, b) ((void *) 0)
52
53#define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */
54#define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */
55#define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */
56#define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */
57#define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */
58
59#define __swp_type(x) (0)
60#define __swp_offset(x) (0)
61#define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })
62#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
63#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
64
65#ifndef __ASSEMBLY__
66static inline int pte_file(pte_t pte) { return 0; }
67#endif
68
69#define ZERO_PAGE(vaddr) ({ BUG(); NULL; })
70
71#define swapper_pg_dir ((pgd_t *) NULL)
72
73#define pgtable_cache_init() do {} while (0)
74#define arch_enter_lazy_mmu_mode() do {} while (0)
75#define arch_leave_lazy_mmu_mode() do {} while (0)
76#define arch_enter_lazy_cpu_mode() do {} while (0)
77#define arch_leave_lazy_cpu_mode() do {} while (0)
78
79#else /* !CONFIG_MMU */
80/*****************************************************************************/
81/*
82 * then MMU operation
83 */
84
85/*
86 * ZERO_PAGE is a global shared page that is always zero: used
87 * for zero-mapped memory areas etc..
88 */
89#ifndef __ASSEMBLY__
90extern unsigned long empty_zero_page;
91#define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page)
92#endif
93
94/*
95 * we use 2-level page tables, folding the PMD (mid-level table) into the PGE (top-level entry)
96 * [see Documentation/frv/mmu-layout.txt]
97 *
98 * Page Directory:
99 * - Size: 16KB
100 * - 64 PGEs per PGD
101 * - Each PGE holds 1 PUD and covers 64MB
102 *
103 * Page Upper Directory:
104 * - Size: 256B
105 * - 1 PUE per PUD
106 * - Each PUE holds 1 PMD and covers 64MB
107 *
108 * Page Mid-Level Directory
109 * - Size: 256B
110 * - 1 PME per PMD
111 * - Each PME holds 64 STEs, all of which point to separate chunks of the same Page Table
112 * - All STEs are instantiated at the same time
113 *
114 * Page Table
115 * - Size: 16KB
116 * - 4096 PTEs per PT
117 * - Each Linux PT is subdivided into 64 FR451 PT's, each of which holds 64 entries
118 *
119 * Pages
120 * - Size: 4KB
121 *
122 * total PTEs
123 * = 1 PML4E * 64 PGEs * 1 PUEs * 1 PMEs * 4096 PTEs
124 * = 1 PML4E * 64 PGEs * 64 STEs * 64 PTEs/FR451-PT
125 * = 262144 (or 256 * 1024)
126 */
127#define PGDIR_SHIFT 26
128#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
129#define PGDIR_MASK (~(PGDIR_SIZE - 1))
130#define PTRS_PER_PGD 64
131
132#define PUD_SHIFT 26
133#define PTRS_PER_PUD 1
134#define PUD_SIZE (1UL << PUD_SHIFT)
135#define PUD_MASK (~(PUD_SIZE - 1))
136#define PUE_SIZE 256
137
138#define PMD_SHIFT 26
139#define PMD_SIZE (1UL << PMD_SHIFT)
140#define PMD_MASK (~(PMD_SIZE - 1))
141#define PTRS_PER_PMD 1
142#define PME_SIZE 256
143
144#define __frv_PT_SIZE 256
145
146#define PTRS_PER_PTE 4096
147
148#define USER_PGDS_IN_LAST_PML4 (TASK_SIZE / PGDIR_SIZE)
149#define FIRST_USER_ADDRESS 0
150
151#define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT)
152#define KERNEL_PGD_PTRS (PTRS_PER_PGD - USER_PGD_PTRS)
153
154#define TWOLEVEL_PGDIR_SHIFT 26
155#define BOOT_USER_PGD_PTRS (__PAGE_OFFSET >> TWOLEVEL_PGDIR_SHIFT)
156#define BOOT_KERNEL_PGD_PTRS (PTRS_PER_PGD - BOOT_USER_PGD_PTRS)
157
158#ifndef __ASSEMBLY__
159
160extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
161
162#define pte_ERROR(e) \
163 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte)
164#define pmd_ERROR(e) \
165 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
166#define pud_ERROR(e) \
167 printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pmd_val(pud_val(e)))
168#define pgd_ERROR(e) \
169 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pmd_val(pud_val(pgd_val(e))))
170
171/*
172 * Certain architectures need to do special things when PTEs
173 * within a page table are directly modified. Thus, the following
174 * hook is made available.
175 */
176#define set_pte(pteptr, pteval) \
177do { \
178 *(pteptr) = (pteval); \
179 asm volatile("dcf %M0" :: "U"(*pteptr)); \
180} while(0)
181#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
182
183/*
184 * pgd_offset() returns a (pgd_t *)
185 * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
186 */
187#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
188
189/*
190 * a shortcut which implies the use of the kernel's pgd, instead
191 * of a process's
192 */
193#define pgd_offset_k(address) pgd_offset(&init_mm, address)
194
195/*
196 * The "pgd_xxx()" functions here are trivial for a folded two-level
197 * setup: the pud is never bad, and a pud always exists (as it's folded
198 * into the pgd entry)
199 */
200static inline int pgd_none(pgd_t pgd) { return 0; }
201static inline int pgd_bad(pgd_t pgd) { return 0; }
202static inline int pgd_present(pgd_t pgd) { return 1; }
203static inline void pgd_clear(pgd_t *pgd) { }
204
205#define pgd_populate(mm, pgd, pud) do { } while (0)
206/*
207 * (puds are folded into pgds so this doesn't get actually called,
208 * but the define is needed for a generic inline function.)
209 */
210#define set_pgd(pgdptr, pgdval) \
211do { \
212 memcpy((pgdptr), &(pgdval), sizeof(pgd_t)); \
213 asm volatile("dcf %M0" :: "U"(*(pgdptr))); \
214} while(0)
215
216static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
217{
218 return (pud_t *) pgd;
219}
220
221#define pgd_page(pgd) (pud_page((pud_t){ pgd }))
222#define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd }))
223
224/*
225 * allocating and freeing a pud is trivial: the 1-entry pud is
226 * inside the pgd, so has no extra memory associated with it.
227 */
228#define pud_alloc_one(mm, address) NULL
229#define pud_free(mm, x) do { } while (0)
230#define __pud_free_tlb(tlb, x) do { } while (0)
231
232/*
233 * The "pud_xxx()" functions here are trivial for a folded two-level
234 * setup: the pmd is never bad, and a pmd always exists (as it's folded
235 * into the pud entry)
236 */
237static inline int pud_none(pud_t pud) { return 0; }
238static inline int pud_bad(pud_t pud) { return 0; }
239static inline int pud_present(pud_t pud) { return 1; }
240static inline void pud_clear(pud_t *pud) { }
241
242#define pud_populate(mm, pmd, pte) do { } while (0)
243
244/*
245 * (pmds are folded into puds so this doesn't get actually called,
246 * but the define is needed for a generic inline function.)
247 */
248#define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
249
250#define pud_page(pud) (pmd_page((pmd_t){ pud }))
251#define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud }))
252
253/*
254 * (pmds are folded into pgds so this doesn't get actually called,
255 * but the define is needed for a generic inline function.)
256 */
257extern void __set_pmd(pmd_t *pmdptr, unsigned long __pmd);
258
259#define set_pmd(pmdptr, pmdval) \
260do { \
261 __set_pmd((pmdptr), (pmdval).ste[0]); \
262} while(0)
263
264#define __pmd_index(address) 0
265
266static inline pmd_t *pmd_offset(pud_t *dir, unsigned long address)
267{
268 return (pmd_t *) dir + __pmd_index(address);
269}
270
271#define pte_same(a, b) ((a).pte == (b).pte)
272#define pte_page(x) (mem_map + ((unsigned long)(((x).pte >> PAGE_SHIFT))))
273#define pte_none(x) (!(x).pte)
274#define pte_pfn(x) ((unsigned long)(((x).pte >> PAGE_SHIFT)))
275#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
276#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
277
278#define VMALLOC_VMADDR(x) ((unsigned long) (x))
279
280#endif /* !__ASSEMBLY__ */
281
282/*
283 * control flags in AMPR registers and TLB entries
284 */
285#define _PAGE_BIT_PRESENT xAMPRx_V_BIT
286#define _PAGE_BIT_WP DAMPRx_WP_BIT
287#define _PAGE_BIT_NOCACHE xAMPRx_C_BIT
288#define _PAGE_BIT_SUPER xAMPRx_S_BIT
289#define _PAGE_BIT_ACCESSED xAMPRx_RESERVED8_BIT
290#define _PAGE_BIT_DIRTY xAMPRx_M_BIT
291#define _PAGE_BIT_NOTGLOBAL xAMPRx_NG_BIT
292
293#define _PAGE_PRESENT xAMPRx_V
294#define _PAGE_WP DAMPRx_WP
295#define _PAGE_NOCACHE xAMPRx_C
296#define _PAGE_SUPER xAMPRx_S
297#define _PAGE_ACCESSED xAMPRx_RESERVED8 /* accessed if set */
298#define _PAGE_DIRTY xAMPRx_M
299#define _PAGE_NOTGLOBAL xAMPRx_NG
300
301#define _PAGE_RESERVED_MASK (xAMPRx_RESERVED8 | xAMPRx_RESERVED13)
302
303#define _PAGE_FILE 0x002 /* set:pagecache unset:swap */
304#define _PAGE_PROTNONE 0x000 /* If not present */
305
306#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
307
308#define __PGPROT_BASE \
309 (_PAGE_PRESENT | xAMPRx_SS_16Kb | xAMPRx_D | _PAGE_NOTGLOBAL | _PAGE_ACCESSED)
310
311#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
312#define PAGE_SHARED __pgprot(__PGPROT_BASE)
313#define PAGE_COPY __pgprot(__PGPROT_BASE | _PAGE_WP)
314#define PAGE_READONLY __pgprot(__PGPROT_BASE | _PAGE_WP)
315
316#define __PAGE_KERNEL (__PGPROT_BASE | _PAGE_SUPER | _PAGE_DIRTY)
317#define __PAGE_KERNEL_NOCACHE (__PGPROT_BASE | _PAGE_SUPER | _PAGE_DIRTY | _PAGE_NOCACHE)
318#define __PAGE_KERNEL_RO (__PGPROT_BASE | _PAGE_SUPER | _PAGE_DIRTY | _PAGE_WP)
319
320#define MAKE_GLOBAL(x) __pgprot((x) & ~_PAGE_NOTGLOBAL)
321
322#define PAGE_KERNEL MAKE_GLOBAL(__PAGE_KERNEL)
323#define PAGE_KERNEL_RO MAKE_GLOBAL(__PAGE_KERNEL_RO)
324#define PAGE_KERNEL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE)
325
326#define _PAGE_TABLE (_PAGE_PRESENT | xAMPRx_SS_16Kb)
327
328#ifndef __ASSEMBLY__
329
330/*
331 * The FR451 can do execute protection by virtue of having separate TLB miss handlers for
332 * instruction access and for data access. However, we don't have enough reserved bits to say
333 * "execute only", so we don't bother. If you can read it, you can execute it and vice versa.
334 */
335#define __P000 PAGE_NONE
336#define __P001 PAGE_READONLY
337#define __P010 PAGE_COPY
338#define __P011 PAGE_COPY
339#define __P100 PAGE_READONLY
340#define __P101 PAGE_READONLY
341#define __P110 PAGE_COPY
342#define __P111 PAGE_COPY
343
344#define __S000 PAGE_NONE
345#define __S001 PAGE_READONLY
346#define __S010 PAGE_SHARED
347#define __S011 PAGE_SHARED
348#define __S100 PAGE_READONLY
349#define __S101 PAGE_READONLY
350#define __S110 PAGE_SHARED
351#define __S111 PAGE_SHARED
352
353/*
354 * Define this to warn about kernel memory accesses that are
355 * done without a 'access_ok(VERIFY_WRITE,..)'
356 */
357#undef TEST_ACCESS_OK
358
359#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
360#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
361
362#define pmd_none(x) (!pmd_val(x))
363#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
364#define pmd_bad(x) (pmd_val(x) & xAMPRx_SS)
365#define pmd_clear(xp) do { __set_pmd(xp, 0); } while(0)
366
367#define pmd_page_vaddr(pmd) \
368 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
369
370#ifndef CONFIG_DISCONTIGMEM
371#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
372#endif
373
374#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
375
376/*
377 * The following only work if pte_present() is true.
378 * Undefined behaviour if not..
379 */
380static inline int pte_dirty(pte_t pte) { return (pte).pte & _PAGE_DIRTY; }
381static inline int pte_young(pte_t pte) { return (pte).pte & _PAGE_ACCESSED; }
382static inline int pte_write(pte_t pte) { return !((pte).pte & _PAGE_WP); }
383static inline int pte_special(pte_t pte) { return 0; }
384
385static inline pte_t pte_mkclean(pte_t pte) { (pte).pte &= ~_PAGE_DIRTY; return pte; }
386static inline pte_t pte_mkold(pte_t pte) { (pte).pte &= ~_PAGE_ACCESSED; return pte; }
387static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte |= _PAGE_WP; return pte; }
388static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte |= _PAGE_DIRTY; return pte; }
389static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte |= _PAGE_ACCESSED; return pte; }
390static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte &= ~_PAGE_WP; return pte; }
391static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
392
393static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
394{
395 int i = test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep);
396 asm volatile("dcf %M0" :: "U"(*ptep));
397 return i;
398}
399
400static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
401{
402 unsigned long x = xchg(&ptep->pte, 0);
403 asm volatile("dcf %M0" :: "U"(*ptep));
404 return __pte(x);
405}
406
407static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
408{
409 set_bit(_PAGE_BIT_WP, ptep);
410 asm volatile("dcf %M0" :: "U"(*ptep));
411}
412
413/*
414 * Macro to mark a page protection value as "uncacheable"
415 */
416#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NOCACHE))
417
418/*
419 * Conversion functions: convert a page and protection to a page entry,
420 * and a page entry and page directory to the page they refer to.
421 */
422
423#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
424#define mk_pte_huge(entry) ((entry).pte_low |= _PAGE_PRESENT | _PAGE_PSE)
425
426/* This takes a physical page address that is used by the remapping functions */
427#define mk_pte_phys(physpage, pgprot) pfn_pte((physpage) >> PAGE_SHIFT, pgprot)
428
429static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
430{
431 pte.pte &= _PAGE_CHG_MASK;
432 pte.pte |= pgprot_val(newprot);
433 return pte;
434}
435
436/* to find an entry in a page-table-directory. */
437#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
438#define pgd_index_k(addr) pgd_index(addr)
439
440/* Find an entry in the bottom-level page table.. */
441#define __pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
442
443/*
444 * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
445 *
446 * this macro returns the index of the entry in the pte page which would
447 * control the given virtual address
448 */
449#define pte_index(address) \
450 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
451#define pte_offset_kernel(dir, address) \
452 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
453
454#if defined(CONFIG_HIGHPTE)
455#define pte_offset_map(dir, address) \
456 ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address))
457#define pte_offset_map_nested(dir, address) \
458 ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address))
459#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
460#define pte_unmap_nested(pte) kunmap_atomic((pte), KM_PTE1)
461#else
462#define pte_offset_map(dir, address) \
463 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
464#define pte_offset_map_nested(dir, address) pte_offset_map((dir), (address))
465#define pte_unmap(pte) do { } while (0)
466#define pte_unmap_nested(pte) do { } while (0)
467#endif
468
469/*
470 * Handle swap and file entries
471 * - the PTE is encoded in the following format:
472 * bit 0: Must be 0 (!_PAGE_PRESENT)
473 * bit 1: Type: 0 for swap, 1 for file (_PAGE_FILE)
474 * bits 2-7: Swap type
475 * bits 8-31: Swap offset
476 * bits 2-31: File pgoff
477 */
478#define __swp_type(x) (((x).val >> 2) & 0x1f)
479#define __swp_offset(x) ((x).val >> 8)
480#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 8) })
481#define __pte_to_swp_entry(_pte) ((swp_entry_t) { (_pte).pte })
482#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
483
484static inline int pte_file(pte_t pte)
485{
486 return pte.pte & _PAGE_FILE;
487}
488
489#define PTE_FILE_MAX_BITS 29
490
491#define pte_to_pgoff(PTE) ((PTE).pte >> 2)
492#define pgoff_to_pte(off) __pte((off) << 2 | _PAGE_FILE)
493
494/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
495#define PageSkip(page) (0)
496#define kern_addr_valid(addr) (1)
497
498#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
499 remap_pfn_range(vma, vaddr, pfn, size, prot)
500
501#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
502#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
503#define __HAVE_ARCH_PTEP_SET_WRPROTECT
504#define __HAVE_ARCH_PTE_SAME
505#include <asm-generic/pgtable.h>
506
507/*
508 * preload information about a newly instantiated PTE into the SCR0/SCR1 PGE cache
509 */
510static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
511{
512 struct mm_struct *mm;
513 unsigned long ampr;
514
515 mm = current->mm;
516 if (mm) {
517 pgd_t *pge = pgd_offset(mm, address);
518 pud_t *pue = pud_offset(pge, address);
519 pmd_t *pme = pmd_offset(pue, address);
520
521 ampr = pme->ste[0] & 0xffffff00;
522 ampr |= xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C |
523 xAMPRx_V;
524 } else {
525 address = ULONG_MAX;
526 ampr = 0;
527 }
528
529 asm volatile("movgs %0,scr0\n"
530 "movgs %0,scr1\n"
531 "movgs %1,dampr4\n"
532 "movgs %1,dampr5\n"
533 :
534 : "r"(address), "r"(ampr)
535 );
536}
537
538#ifdef CONFIG_PROC_FS
539extern char *proc_pid_status_frv_cxnr(struct mm_struct *mm, char *buffer);
540#endif
541
542extern void __init pgtable_cache_init(void);
543
544#endif /* !__ASSEMBLY__ */
545#endif /* !CONFIG_MMU */
546
547#ifndef __ASSEMBLY__
548extern void __init paging_init(void);
549#endif /* !__ASSEMBLY__ */
550
551#endif /* _ASM_PGTABLE_H */
diff --git a/include/asm-frv/poll.h b/include/asm-frv/poll.h
deleted file mode 100644
index 0d01479ccc56..000000000000
--- a/include/asm-frv/poll.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_POLL_H
2#define _ASM_POLL_H
3
4#define POLLWRNORM POLLOUT
5#define POLLWRBAND 256
6
7#include <asm-generic/poll.h>
8
9#undef POLLREMOVE
10
11#endif
12
diff --git a/include/asm-frv/posix_types.h b/include/asm-frv/posix_types.h
deleted file mode 100644
index a9f1f5be0632..000000000000
--- a/include/asm-frv/posix_types.h
+++ /dev/null
@@ -1,62 +0,0 @@
1#ifndef _ASM_POSIX_TYPES_H
2#define _ASM_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10typedef unsigned long __kernel_ino_t;
11typedef unsigned short __kernel_mode_t;
12typedef unsigned short __kernel_nlink_t;
13typedef long __kernel_off_t;
14typedef int __kernel_pid_t;
15typedef unsigned short __kernel_ipc_pid_t;
16typedef unsigned short __kernel_uid_t;
17typedef unsigned short __kernel_gid_t;
18typedef unsigned int __kernel_size_t;
19typedef int __kernel_ssize_t;
20typedef int __kernel_ptrdiff_t;
21typedef long __kernel_time_t;
22typedef long __kernel_suseconds_t;
23typedef long __kernel_clock_t;
24typedef int __kernel_timer_t;
25typedef int __kernel_clockid_t;
26typedef int __kernel_daddr_t;
27typedef char * __kernel_caddr_t;
28typedef unsigned short __kernel_uid16_t;
29typedef unsigned short __kernel_gid16_t;
30typedef unsigned int __kernel_uid32_t;
31typedef unsigned int __kernel_gid32_t;
32
33typedef unsigned short __kernel_old_uid_t;
34typedef unsigned short __kernel_old_gid_t;
35typedef unsigned short __kernel_old_dev_t;
36
37#ifdef __GNUC__
38typedef long long __kernel_loff_t;
39#endif
40
41typedef struct {
42 int val[2];
43} __kernel_fsid_t;
44
45#if defined(__KERNEL__)
46
47#undef __FD_SET
48#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
49
50#undef __FD_CLR
51#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
52
53#undef __FD_ISSET
54#define __FD_ISSET(d, set) (!!((set)->fds_bits[__FDELT(d)] & __FDMASK(d)))
55
56#undef __FD_ZERO
57#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
58
59#endif /* defined(__KERNEL__) */
60
61#endif
62
diff --git a/include/asm-frv/processor.h b/include/asm-frv/processor.h
deleted file mode 100644
index 3744f2e47f48..000000000000
--- a/include/asm-frv/processor.h
+++ /dev/null
@@ -1,153 +0,0 @@
1/* processor.h: FRV processor definitions
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_PROCESSOR_H
13#define _ASM_PROCESSOR_H
14
15#include <asm/mem-layout.h>
16
17#ifndef __ASSEMBLY__
18/*
19 * Default implementation of macro that returns current
20 * instruction pointer ("program counter").
21 */
22#define current_text_addr() ({ __label__ _l; _l: &&_l;})
23
24#include <linux/compiler.h>
25#include <linux/linkage.h>
26#include <asm/sections.h>
27#include <asm/segment.h>
28#include <asm/fpu.h>
29#include <asm/registers.h>
30#include <asm/ptrace.h>
31#include <asm/current.h>
32#include <asm/cache.h>
33
34/* Forward declaration, a strange C thing */
35struct task_struct;
36
37/*
38 * CPU type and hardware bug flags. Kept separately for each CPU.
39 */
40struct cpuinfo_frv {
41#ifdef CONFIG_MMU
42 unsigned long *pgd_quick;
43 unsigned long *pte_quick;
44 unsigned long pgtable_cache_sz;
45#endif
46} __cacheline_aligned;
47
48extern struct cpuinfo_frv __nongprelbss boot_cpu_data;
49
50#define cpu_data (&boot_cpu_data)
51#define current_cpu_data boot_cpu_data
52
53/*
54 * Bus types
55 */
56#define EISA_bus 0
57#define MCA_bus 0
58
59struct thread_struct {
60 struct pt_regs *frame; /* [GR28] exception frame ptr for this thread */
61 struct task_struct *curr; /* [GR29] current pointer for this thread */
62 unsigned long sp; /* [GR1 ] kernel stack pointer */
63 unsigned long fp; /* [GR2 ] kernel frame pointer */
64 unsigned long lr; /* link register */
65 unsigned long pc; /* program counter */
66 unsigned long gr[12]; /* [GR16-GR27] */
67 unsigned long sched_lr; /* LR from schedule() */
68
69 union {
70 struct pt_regs *frame0; /* top (user) stack frame */
71 struct user_context *user; /* userspace context */
72 };
73} __attribute__((aligned(8)));
74
75extern struct pt_regs *__kernel_frame0_ptr;
76extern struct task_struct *__kernel_current_task;
77
78#endif
79
80#ifndef __ASSEMBLY__
81#define INIT_THREAD_FRAME0 \
82 ((struct pt_regs *) \
83 (sizeof(init_stack) + (unsigned long) init_stack - sizeof(struct user_context)))
84
85#define INIT_THREAD { \
86 NULL, \
87 (struct task_struct *) init_stack, \
88 0, 0, 0, 0, \
89 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, \
90 0, \
91 { INIT_THREAD_FRAME0 }, \
92}
93
94/*
95 * do necessary setup to start up a newly executed thread.
96 * - need to discard the frame stacked by init() invoking the execve syscall
97 */
98#define start_thread(_regs, _pc, _usp) \
99do { \
100 set_fs(USER_DS); /* reads from user space */ \
101 __frame = __kernel_frame0_ptr; \
102 __frame->pc = (_pc); \
103 __frame->psr &= ~PSR_S; \
104 __frame->sp = (_usp); \
105} while(0)
106
107extern void prepare_to_copy(struct task_struct *tsk);
108
109/* Free all resources held by a thread. */
110static inline void release_thread(struct task_struct *dead_task)
111{
112}
113
114extern asmlinkage int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
115extern asmlinkage void save_user_regs(struct user_context *target);
116extern asmlinkage void *restore_user_regs(const struct user_context *target, ...);
117
118#define copy_segments(tsk, mm) do { } while (0)
119#define release_segments(mm) do { } while (0)
120#define forget_segments() do { } while (0)
121
122/*
123 * Free current thread data structures etc..
124 */
125static inline void exit_thread(void)
126{
127}
128
129/*
130 * Return saved PC of a blocked thread.
131 */
132extern unsigned long thread_saved_pc(struct task_struct *tsk);
133
134unsigned long get_wchan(struct task_struct *p);
135
136#define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc)
137#define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp)
138
139/* Allocation and freeing of basic task resources. */
140extern struct task_struct *alloc_task_struct(void);
141extern void free_task_struct(struct task_struct *p);
142
143#define cpu_relax() barrier()
144
145/* data cache prefetch */
146#define ARCH_HAS_PREFETCH
147static inline void prefetch(const void *x)
148{
149 asm volatile("dcpl %0,gr0,#0" : : "r"(x));
150}
151
152#endif /* __ASSEMBLY__ */
153#endif /* _ASM_PROCESSOR_H */
diff --git a/include/asm-frv/ptrace.h b/include/asm-frv/ptrace.h
deleted file mode 100644
index cf6934012b64..000000000000
--- a/include/asm-frv/ptrace.h
+++ /dev/null
@@ -1,83 +0,0 @@
1/* ptrace.h: ptrace() relevant definitions
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _ASM_PTRACE_H
12#define _ASM_PTRACE_H
13
14#include <asm/registers.h>
15#ifdef __KERNEL__
16#include <asm/irq_regs.h>
17
18#define in_syscall(regs) (((regs)->tbr & TBR_TT) == TBR_TT_TRAP0)
19#endif
20
21
22#define PT_PSR 0
23#define PT_ISR 1
24#define PT_CCR 2
25#define PT_CCCR 3
26#define PT_LR 4
27#define PT_LCR 5
28#define PT_PC 6
29
30#define PT__STATUS 7 /* exception status */
31#define PT_SYSCALLNO 8 /* syscall number or -1 */
32#define PT_ORIG_GR8 9 /* saved GR8 for signal handling */
33#define PT_GNER0 10
34#define PT_GNER1 11
35#define PT_IACC0H 12
36#define PT_IACC0L 13
37
38#define PT_GR(j) ( 14 + (j)) /* GRj for 0<=j<=63 */
39#define PT_FR(j) ( 78 + (j)) /* FRj for 0<=j<=63 */
40#define PT_FNER(j) (142 + (j)) /* FNERj for 0<=j<=1 */
41#define PT_MSR(j) (144 + (j)) /* MSRj for 0<=j<=2 */
42#define PT_ACC(j) (146 + (j)) /* ACCj for 0<=j<=7 */
43#define PT_ACCG(jklm) (154 + (jklm)) /* ACCGjklm for 0<=jklm<=1 (reads four regs per slot) */
44#define PT_FSR(j) (156 + (j)) /* FSRj for 0<=j<=0 */
45#define PT__GPEND 78
46#define PT__END 157
47
48#define PT_TBR PT_GR(0)
49#define PT_SP PT_GR(1)
50#define PT_FP PT_GR(2)
51#define PT_PREV_FRAME PT_GR(28) /* previous exception frame pointer (old gr28 value) */
52#define PT_CURR_TASK PT_GR(29) /* current task */
53
54
55/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
56#define PTRACE_GETREGS 12
57#define PTRACE_SETREGS 13
58#define PTRACE_GETFPREGS 14
59#define PTRACE_SETFPREGS 15
60#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */
61
62#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
63#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
64
65#ifdef __KERNEL__
66#ifndef __ASSEMBLY__
67
68/*
69 * we dedicate GR28 to keeping a pointer to the current exception frame
70 * - gr28 is destroyed on entry to the kernel from userspace
71 */
72register struct pt_regs *__frame asm("gr28");
73
74#define user_mode(regs) (!((regs)->psr & PSR_S))
75#define instruction_pointer(regs) ((regs)->pc)
76
77extern unsigned long user_stack(const struct pt_regs *);
78extern void show_regs(struct pt_regs *);
79#define profile_pc(regs) ((regs)->pc)
80#endif
81
82#endif /* !__ASSEMBLY__ */
83#endif /* _ASM_PTRACE_H */
diff --git a/include/asm-frv/registers.h b/include/asm-frv/registers.h
deleted file mode 100644
index 9666119fcf6e..000000000000
--- a/include/asm-frv/registers.h
+++ /dev/null
@@ -1,232 +0,0 @@
1/* registers.h: register frame declarations
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12/*
13 * notes:
14 *
15 * (1) that the members of all these structures are carefully aligned to permit
16 * usage of STD/STDF instructions
17 *
18 * (2) if you change these structures, you must change the code in
19 * arch/frvnommu/kernel/{break.S,entry.S,switch_to.S,gdb-stub.c}
20 *
21 *
22 * the kernel stack space block looks like this:
23 *
24 * +0x2000 +----------------------
25 * | union {
26 * | struct frv_frame0 {
27 * | struct user_context {
28 * | struct user_int_regs
29 * | struct user_fpmedia_regs
30 * | }
31 * | struct frv_debug_regs
32 * | }
33 * | struct pt_regs [user exception]
34 * | }
35 * +---------------------- <-- __kernel_frame0_ptr (maybe GR28)
36 * |
37 * | kernel stack
38 * |
39 * |......................
40 * | struct pt_regs [kernel exception]
41 * |...................... <-- __kernel_frame0_ptr (maybe GR28)
42 * |
43 * | kernel stack
44 * |
45 * |...................... <-- stack pointer (GR1)
46 * |
47 * | unused stack space
48 * |
49 * +----------------------
50 * | struct thread_info
51 * +0x0000 +---------------------- <-- __current_thread_info (GR15);
52 *
53 * note that GR28 points to the current exception frame
54 */
55
56#ifndef _ASM_REGISTERS_H
57#define _ASM_REGISTERS_H
58
59#ifndef __ASSEMBLY__
60#define __OFFSET(X,N) ((X)+(N)*4)
61#define __OFFSETC(X,N) xxxxxxxxxxxxxxxxxxxxxxxx
62#else
63#define __OFFSET(X,N) ((X)+(N)*4)
64#define __OFFSETC(X,N) ((X)+(N))
65#endif
66
67/*****************************************************************************/
68/*
69 * Exception/Interrupt frame
70 * - held on kernel stack
71 * - 8-byte aligned on stack (old SP is saved in frame)
72 * - GR0 is fixed 0, so we don't save it
73 */
74#ifndef __ASSEMBLY__
75
76struct pt_regs {
77 unsigned long psr; /* Processor Status Register */
78 unsigned long isr; /* Integer Status Register */
79 unsigned long ccr; /* Condition Code Register */
80 unsigned long cccr; /* Condition Code for Conditional Insns Register */
81 unsigned long lr; /* Link Register */
82 unsigned long lcr; /* Loop Count Register */
83 unsigned long pc; /* Program Counter Register */
84 unsigned long __status; /* exception status */
85 unsigned long syscallno; /* syscall number or -1 */
86 unsigned long orig_gr8; /* original syscall arg #1 */
87 unsigned long gner0;
88 unsigned long gner1;
89 unsigned long long iacc0;
90 unsigned long tbr; /* GR0 is fixed zero, so we use this for TBR */
91 unsigned long sp; /* GR1: USP/KSP */
92 unsigned long fp; /* GR2: FP */
93 unsigned long gr3;
94 unsigned long gr4;
95 unsigned long gr5;
96 unsigned long gr6;
97 unsigned long gr7; /* syscall number */
98 unsigned long gr8; /* 1st syscall param; syscall return */
99 unsigned long gr9; /* 2nd syscall param */
100 unsigned long gr10; /* 3rd syscall param */
101 unsigned long gr11; /* 4th syscall param */
102 unsigned long gr12; /* 5th syscall param */
103 unsigned long gr13; /* 6th syscall param */
104 unsigned long gr14;
105 unsigned long gr15;
106 unsigned long gr16; /* GP pointer */
107 unsigned long gr17; /* small data */
108 unsigned long gr18; /* PIC/PID */
109 unsigned long gr19;
110 unsigned long gr20;
111 unsigned long gr21;
112 unsigned long gr22;
113 unsigned long gr23;
114 unsigned long gr24;
115 unsigned long gr25;
116 unsigned long gr26;
117 unsigned long gr27;
118 struct pt_regs *next_frame; /* GR28 - next exception frame */
119 unsigned long gr29; /* GR29 - OS reserved */
120 unsigned long gr30; /* GR30 - OS reserved */
121 unsigned long gr31; /* GR31 - OS reserved */
122} __attribute__((aligned(8)));
123
124#endif
125
126#define REG__STATUS_STEP 0x00000001 /* - reenable single stepping on return */
127#define REG__STATUS_STEPPED 0x00000002 /* - single step caused exception */
128#define REG__STATUS_BROKE 0x00000004 /* - BREAK insn caused exception */
129#define REG__STATUS_SYSC_ENTRY 0x40000000 /* - T on syscall entry (ptrace.c only) */
130#define REG__STATUS_SYSC_EXIT 0x80000000 /* - T on syscall exit (ptrace.c only) */
131
132#define REG_GR(R) __OFFSET(REG_GR0, (R))
133
134#define REG_SP REG_GR(1)
135#define REG_FP REG_GR(2)
136#define REG_PREV_FRAME REG_GR(28) /* previous exception frame pointer (old gr28 value) */
137#define REG_CURR_TASK REG_GR(29) /* current task */
138
139/*****************************************************************************/
140/*
141 * debugging registers
142 */
143#ifndef __ASSEMBLY__
144
145struct frv_debug_regs
146{
147 unsigned long dcr;
148 unsigned long ibar[4] __attribute__((aligned(8)));
149 unsigned long dbar[4] __attribute__((aligned(8)));
150 unsigned long dbdr[4][4] __attribute__((aligned(8)));
151 unsigned long dbmr[4][4] __attribute__((aligned(8)));
152} __attribute__((aligned(8)));
153
154#endif
155
156/*****************************************************************************/
157/*
158 * userspace registers
159 */
160#ifndef __ASSEMBLY__
161
162struct user_int_regs
163{
164 /* integer registers
165 * - up to gr[31] mirror pt_regs
166 * - total size must be multiple of 8 bytes
167 */
168 unsigned long psr; /* Processor Status Register */
169 unsigned long isr; /* Integer Status Register */
170 unsigned long ccr; /* Condition Code Register */
171 unsigned long cccr; /* Condition Code for Conditional Insns Register */
172 unsigned long lr; /* Link Register */
173 unsigned long lcr; /* Loop Count Register */
174 unsigned long pc; /* Program Counter Register */
175 unsigned long __status; /* exception status */
176 unsigned long syscallno; /* syscall number or -1 */
177 unsigned long orig_gr8; /* original syscall arg #1 */
178 unsigned long gner[2];
179 unsigned long long iacc[1];
180
181 union {
182 unsigned long tbr;
183 unsigned long gr[64];
184 };
185};
186
187struct user_fpmedia_regs
188{
189 /* FP/Media registers */
190 unsigned long fr[64];
191 unsigned long fner[2];
192 unsigned long msr[2];
193 unsigned long acc[8];
194 unsigned char accg[8];
195 unsigned long fsr[1];
196};
197
198struct user_context
199{
200 struct user_int_regs i;
201 struct user_fpmedia_regs f;
202
203 /* we provide a context extension so that we can save the regs for CPUs that
204 * implement many more of Fujitsu's lavish register spec
205 */
206 void *extension;
207} __attribute__((aligned(8)));
208
209struct frv_frame0 {
210 union {
211 struct pt_regs regs;
212 struct user_context uc;
213 };
214
215 struct frv_debug_regs debug;
216
217} __attribute__((aligned(32)));
218
219#endif
220
221#define __INT_GR(R) __OFFSET(__INT_GR0, (R))
222
223#define __FPMEDIA_FR(R) __OFFSET(__FPMEDIA_FR0, (R))
224#define __FPMEDIA_FNER(R) __OFFSET(__FPMEDIA_FNER0, (R))
225#define __FPMEDIA_MSR(R) __OFFSET(__FPMEDIA_MSR0, (R))
226#define __FPMEDIA_ACC(R) __OFFSET(__FPMEDIA_ACC0, (R))
227#define __FPMEDIA_ACCG(R) __OFFSETC(__FPMEDIA_ACCG0, (R))
228#define __FPMEDIA_FSR(R) __OFFSET(__FPMEDIA_FSR0, (R))
229
230#define __THREAD_GR(R) __OFFSET(__THREAD_GR16, (R) - 16)
231
232#endif /* _ASM_REGISTERS_H */
diff --git a/include/asm-frv/resource.h b/include/asm-frv/resource.h
deleted file mode 100644
index 5fc60548fd02..000000000000
--- a/include/asm-frv/resource.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_RESOURCE_H
2#define _ASM_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif /* _ASM_RESOURCE_H */
7
diff --git a/include/asm-frv/scatterlist.h b/include/asm-frv/scatterlist.h
deleted file mode 100644
index 4bca8a28546c..000000000000
--- a/include/asm-frv/scatterlist.h
+++ /dev/null
@@ -1,46 +0,0 @@
1#ifndef _ASM_SCATTERLIST_H
2#define _ASM_SCATTERLIST_H
3
4#include <asm/types.h>
5
6/*
7 * Drivers must set either ->address or (preferred) page and ->offset
8 * to indicate where data must be transferred to/from.
9 *
10 * Using page is recommended since it handles highmem data as well as
11 * low mem. ->address is restricted to data which has a virtual mapping, and
12 * it will go away in the future. Updating to page can be automated very
13 * easily -- something like
14 *
15 * sg->address = some_ptr;
16 *
17 * can be rewritten as
18 *
19 * sg_set_buf(sg, some_ptr, length);
20 *
21 * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens
22 */
23struct scatterlist {
24#ifdef CONFIG_DEBUG_SG
25 unsigned long sg_magic;
26#endif
27 unsigned long page_link;
28 unsigned int offset; /* for highmem, page offset */
29
30 dma_addr_t dma_address;
31 unsigned int length;
32};
33
34/*
35 * These macros should be used after a pci_map_sg call has been done
36 * to get bus addresses of each of the SG entries and their lengths.
37 * You should only work with the number of sg entries pci_map_sg
38 * returns, or alternatively stop on the first sg_dma_len(sg) which
39 * is 0.
40 */
41#define sg_dma_address(sg) ((sg)->dma_address)
42#define sg_dma_len(sg) ((sg)->length)
43
44#define ISA_DMA_THRESHOLD (0xffffffffUL)
45
46#endif /* !_ASM_SCATTERLIST_H */
diff --git a/include/asm-frv/sections.h b/include/asm-frv/sections.h
deleted file mode 100644
index 17d0fb171bba..000000000000
--- a/include/asm-frv/sections.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/* sections.h: linkage layout variables
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_SECTIONS_H
13#define _ASM_SECTIONS_H
14
15#ifndef __ASSEMBLY__
16
17#include <linux/types.h>
18#include <asm-generic/sections.h>
19
20#ifdef __KERNEL__
21
22/*
23 * we don't want to put variables in the GP-REL section if they're not used very much - that would
24 * be waste since GP-REL addressing is limited to GP16+/-2048
25 */
26#define __nongpreldata __attribute__((section(".data")))
27#define __nongprelbss __attribute__((section(".bss")))
28
29/*
30 * linker symbols
31 */
32extern const void __kernel_image_start, __kernel_image_end, __page_offset;
33
34extern unsigned long __nongprelbss memory_start;
35extern unsigned long __nongprelbss memory_end;
36extern unsigned long __nongprelbss rom_length;
37
38/* determine if we're running from ROM */
39static inline int is_in_rom(unsigned long addr)
40{
41 return 0; /* default case: not in ROM */
42}
43
44#endif
45#endif
46#endif /* _ASM_SECTIONS_H */
diff --git a/include/asm-frv/segment.h b/include/asm-frv/segment.h
deleted file mode 100644
index e3616a6f941d..000000000000
--- a/include/asm-frv/segment.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/* segment.h: MMU segment settings
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_SEGMENT_H
13#define _ASM_SEGMENT_H
14
15
16#ifndef __ASSEMBLY__
17
18typedef struct {
19 unsigned long seg;
20} mm_segment_t;
21
22#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
23
24#define KERNEL_DS MAKE_MM_SEG(0xdfffffffUL)
25
26#ifdef CONFIG_MMU
27#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
28#else
29#define USER_DS KERNEL_DS
30#endif
31
32#define get_ds() (KERNEL_DS)
33#define get_fs() (__current_thread_info->addr_limit)
34#define segment_eq(a,b) ((a).seg == (b).seg)
35#define __kernel_ds_p() segment_eq(get_fs(), KERNEL_DS)
36#define get_addr_limit() (get_fs().seg)
37
38#define set_fs(_x) \
39do { \
40 __current_thread_info->addr_limit = (_x); \
41} while(0)
42
43
44#endif /* __ASSEMBLY__ */
45#endif /* _ASM_SEGMENT_H */
diff --git a/include/asm-frv/sembuf.h b/include/asm-frv/sembuf.h
deleted file mode 100644
index 164b12786d6d..000000000000
--- a/include/asm-frv/sembuf.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef _ASM_SEMBUF_H
2#define _ASM_SEMBUF_H
3
4/*
5 * The semid64_ds structure for FR-V architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 unsigned long __unused1;
18 __kernel_time_t sem_ctime; /* last change time */
19 unsigned long __unused2;
20 unsigned long sem_nsems; /* no. of semaphores in array */
21 unsigned long __unused3;
22 unsigned long __unused4;
23};
24
25#endif /* _ASM_SEMBUF_H */
26
diff --git a/include/asm-frv/serial-regs.h b/include/asm-frv/serial-regs.h
deleted file mode 100644
index e1286bda00eb..000000000000
--- a/include/asm-frv/serial-regs.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/* serial-regs.h: serial port registers
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_SERIAL_REGS_H
13#define _ASM_SERIAL_REGS_H
14
15#include <linux/serial_reg.h>
16#include <asm/irc-regs.h>
17
18#define SERIAL_ICLK 33333333 /* the target serial input clock */
19#define UART0_BASE 0xfeff9c00
20#define UART1_BASE 0xfeff9c40
21
22#define __get_UART0(R) ({ __reg(UART0_BASE + (R) * 8) >> 24; })
23#define __get_UART1(R) ({ __reg(UART1_BASE + (R) * 8) >> 24; })
24#define __set_UART0(R,V) do { __reg(UART0_BASE + (R) * 8) = (V) << 24; } while(0)
25#define __set_UART1(R,V) do { __reg(UART1_BASE + (R) * 8) = (V) << 24; } while(0)
26
27#define __get_UART0_LSR() ({ __get_UART0(UART_LSR); })
28#define __get_UART1_LSR() ({ __get_UART1(UART_LSR); })
29
30#define __set_UART0_IER(V) __set_UART0(UART_IER,(V))
31#define __set_UART1_IER(V) __set_UART1(UART_IER,(V))
32
33/* serial prescaler select register */
34#define __get_UCPSR() ({ *(volatile unsigned long *)(0xfeff9c90); })
35#define __set_UCPSR(V) do { *(volatile unsigned long *)(0xfeff9c90) = (V); } while(0)
36#define UCPSR_SELECT0 0x07000000
37#define UCPSR_SELECT1 0x38000000
38
39/* serial prescaler base value register */
40#define __get_UCPVR() ({ *(volatile unsigned long *)(0xfeff9c98); mb(); })
41#define __set_UCPVR(V) do { *(volatile unsigned long *)(0xfeff9c98) = (V) << 24; mb(); } while(0)
42
43
44#endif /* _ASM_SERIAL_REGS_H */
diff --git a/include/asm-frv/serial.h b/include/asm-frv/serial.h
deleted file mode 100644
index dbb825998689..000000000000
--- a/include/asm-frv/serial.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * serial.h
3 *
4 * Copyright (C) 2003 Develer S.r.l. (http://www.develer.com/)
5 * Author: Bernardo Innocenti <bernie@codewiz.org>
6 *
7 * Based on linux/include/asm-i386/serial.h
8 */
9#include <asm/serial-regs.h>
10
11/*
12 * the base baud is derived from the clock speed and so is variable
13 */
14#define BASE_BAUD 0
15
16#define STD_COM_FLAGS ASYNC_BOOT_AUTOCONF
17
18#define SERIAL_PORT_DFNS
diff --git a/include/asm-frv/setup.h b/include/asm-frv/setup.h
deleted file mode 100644
index afd787ceede6..000000000000
--- a/include/asm-frv/setup.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/* setup.h: setup stuff
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_SETUP_H
13#define _ASM_SETUP_H
14
15#define COMMAND_LINE_SIZE 512
16
17#ifdef __KERNEL__
18
19#include <linux/init.h>
20
21#ifndef __ASSEMBLY__
22
23#ifdef CONFIG_MMU
24extern unsigned long __initdata num_mappedpages;
25#endif
26
27#endif /* !__ASSEMBLY__ */
28
29#endif /* __KERNEL__ */
30
31#endif /* _ASM_SETUP_H */
diff --git a/include/asm-frv/shmbuf.h b/include/asm-frv/shmbuf.h
deleted file mode 100644
index 4c6e711a4779..000000000000
--- a/include/asm-frv/shmbuf.h
+++ /dev/null
@@ -1,43 +0,0 @@
1#ifndef _ASM_SHMBUF_H
2#define _ASM_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for FR-V architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 unsigned long __unused1;
19 __kernel_time_t shm_dtime; /* last detach time */
20 unsigned long __unused2;
21 __kernel_time_t shm_ctime; /* last change time */
22 unsigned long __unused3;
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused4;
27 unsigned long __unused5;
28};
29
30struct shminfo64 {
31 unsigned long shmmax;
32 unsigned long shmmin;
33 unsigned long shmmni;
34 unsigned long shmseg;
35 unsigned long shmall;
36 unsigned long __unused1;
37 unsigned long __unused2;
38 unsigned long __unused3;
39 unsigned long __unused4;
40};
41
42#endif /* _ASM_SHMBUF_H */
43
diff --git a/include/asm-frv/shmparam.h b/include/asm-frv/shmparam.h
deleted file mode 100644
index ab711009cfaa..000000000000
--- a/include/asm-frv/shmparam.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_SHMPARAM_H
2#define _ASM_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* _ASM_SHMPARAM_H */
7
diff --git a/include/asm-frv/sigcontext.h b/include/asm-frv/sigcontext.h
deleted file mode 100644
index 3b263f3cc96f..000000000000
--- a/include/asm-frv/sigcontext.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/* sigcontext.h: FRV signal context
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _ASM_SIGCONTEXT_H
12#define _ASM_SIGCONTEXT_H
13
14#include <asm/registers.h>
15
16/*
17 * Signal context structure - contains all info to do with the state
18 * before the signal handler was invoked. Note: only add new entries
19 * to the end of the structure.
20 */
21struct sigcontext {
22 struct user_context sc_context;
23 unsigned long sc_oldmask; /* old sigmask */
24} __attribute__((aligned(8)));
25
26#endif
diff --git a/include/asm-frv/siginfo.h b/include/asm-frv/siginfo.h
deleted file mode 100644
index d3fd1ca45653..000000000000
--- a/include/asm-frv/siginfo.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_SIGINFO_H
2#define _ASM_SIGINFO_H
3
4#include <linux/types.h>
5#include <asm-generic/siginfo.h>
6
7#define FPE_MDAOVF (__SI_FAULT|9) /* media overflow */
8#undef NSIGFPE
9#define NSIGFPE 9
10
11#endif
12
diff --git a/include/asm-frv/signal.h b/include/asm-frv/signal.h
deleted file mode 100644
index 2079197d483d..000000000000
--- a/include/asm-frv/signal.h
+++ /dev/null
@@ -1,161 +0,0 @@
1#ifndef _ASM_SIGNAL_H
2#define _ASM_SIGNAL_H
3
4#include <linux/types.h>
5
6/* Avoid too many header ordering problems. */
7struct siginfo;
8
9#ifdef __KERNEL__
10/* Most things should be clean enough to redefine this at will, if care
11 is taken to make libc match. */
12
13#define _NSIG 64
14#define _NSIG_BPW 32
15#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
16
17typedef unsigned long old_sigset_t; /* at least 32 bits */
18
19typedef struct {
20 unsigned long sig[_NSIG_WORDS];
21} sigset_t;
22
23#else
24/* Here we must cater to libcs that poke about in kernel headers. */
25
26#define NSIG 32
27typedef unsigned long sigset_t;
28
29#endif /* __KERNEL__ */
30
31#define SIGHUP 1
32#define SIGINT 2
33#define SIGQUIT 3
34#define SIGILL 4
35#define SIGTRAP 5
36#define SIGABRT 6
37#define SIGIOT 6
38#define SIGBUS 7
39#define SIGFPE 8
40#define SIGKILL 9
41#define SIGUSR1 10
42#define SIGSEGV 11
43#define SIGUSR2 12
44#define SIGPIPE 13
45#define SIGALRM 14
46#define SIGTERM 15
47#define SIGSTKFLT 16
48#define SIGCHLD 17
49#define SIGCONT 18
50#define SIGSTOP 19
51#define SIGTSTP 20
52#define SIGTTIN 21
53#define SIGTTOU 22
54#define SIGURG 23
55#define SIGXCPU 24
56#define SIGXFSZ 25
57#define SIGVTALRM 26
58#define SIGPROF 27
59#define SIGWINCH 28
60#define SIGIO 29
61#define SIGPOLL SIGIO
62/*
63#define SIGLOST 29
64*/
65#define SIGPWR 30
66#define SIGSYS 31
67#define SIGUNUSED 31
68
69/* These should not be considered constants from userland. */
70#define SIGRTMIN 32
71#define SIGRTMAX (_NSIG-1)
72
73/*
74 * SA_FLAGS values:
75 *
76 * SA_ONSTACK indicates that a registered stack_t will be used.
77 * SA_RESTART flag to get restarting signals (which were the default long ago)
78 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
79 * SA_RESETHAND clears the handler when the signal is delivered.
80 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
81 * SA_NODEFER prevents the current signal from being masked in the handler.
82 *
83 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
84 * Unix names RESETHAND and NODEFER respectively.
85 */
86#define SA_NOCLDSTOP 0x00000001
87#define SA_NOCLDWAIT 0x00000002 /* not supported yet */
88#define SA_SIGINFO 0x00000004
89#define SA_ONSTACK 0x08000000
90#define SA_RESTART 0x10000000
91#define SA_NODEFER 0x40000000
92#define SA_RESETHAND 0x80000000
93
94#define SA_NOMASK SA_NODEFER
95#define SA_ONESHOT SA_RESETHAND
96
97#define SA_RESTORER 0x04000000
98
99/*
100 * sigaltstack controls
101 */
102#define SS_ONSTACK 1
103#define SS_DISABLE 2
104
105#define MINSIGSTKSZ 2048
106#define SIGSTKSZ 8192
107
108#include <asm-generic/signal.h>
109
110#ifdef __KERNEL__
111struct old_sigaction {
112 __sighandler_t sa_handler;
113 old_sigset_t sa_mask;
114 unsigned long sa_flags;
115 __sigrestore_t sa_restorer;
116};
117
118struct sigaction {
119 __sighandler_t sa_handler;
120 unsigned long sa_flags;
121 __sigrestore_t sa_restorer;
122 sigset_t sa_mask; /* mask last for extensibility */
123};
124
125struct k_sigaction {
126 struct sigaction sa;
127};
128#else
129/* Here we must cater to libcs that poke about in kernel headers. */
130
131struct sigaction {
132 union {
133 __sighandler_t _sa_handler;
134 void (*_sa_sigaction)(int, struct siginfo *, void *);
135 } _u;
136 sigset_t sa_mask;
137 unsigned long sa_flags;
138 void (*sa_restorer)(void);
139};
140
141#define sa_handler _u._sa_handler
142#define sa_sigaction _u._sa_sigaction
143
144#endif /* __KERNEL__ */
145
146typedef struct sigaltstack {
147 void __user *ss_sp;
148 int ss_flags;
149 size_t ss_size;
150} stack_t;
151
152#define ptrace_signal_deliver(regs, cookie) do { } while (0)
153
154#ifdef __KERNEL__
155
156#include <asm/sigcontext.h>
157#undef __HAVE_ARCH_SIG_BITOPS
158
159#endif /* __KERNEL__ */
160
161#endif /* _ASM_SIGNAL_H */
diff --git a/include/asm-frv/smp.h b/include/asm-frv/smp.h
deleted file mode 100644
index 38349ec8b61b..000000000000
--- a/include/asm-frv/smp.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __ASM_SMP_H
2#define __ASM_SMP_H
3
4
5#ifdef CONFIG_SMP
6#error SMP not supported
7#endif
8
9#endif
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h
deleted file mode 100644
index 57c3d4054e8b..000000000000
--- a/include/asm-frv/socket.h
+++ /dev/null
@@ -1,61 +0,0 @@
1#ifndef _ASM_SOCKET_H
2#define _ASM_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26#define SO_PASSCRED 16
27#define SO_PEERCRED 17
28#define SO_RCVLOWAT 18
29#define SO_SNDLOWAT 19
30#define SO_RCVTIMEO 20
31#define SO_SNDTIMEO 21
32
33/* Security levels - as per NRL IPv6 - don't actually do anything */
34#define SO_SECURITY_AUTHENTICATION 22
35#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
36#define SO_SECURITY_ENCRYPTION_NETWORK 24
37
38#define SO_BINDTODEVICE 25
39
40/* Socket filtering */
41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27
43
44#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29
46#define SCM_TIMESTAMP SO_TIMESTAMP
47
48#define SO_ACCEPTCONN 30
49
50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54
55#define SO_MARK 36
56
57#define SO_TIMESTAMPING 37
58#define SCM_TIMESTAMPING SO_TIMESTAMPING
59
60#endif /* _ASM_SOCKET_H */
61
diff --git a/include/asm-frv/sockios.h b/include/asm-frv/sockios.h
deleted file mode 100644
index 5dbdd13e6de3..000000000000
--- a/include/asm-frv/sockios.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _ASM_SOCKIOS__
2#define _ASM_SOCKIOS__
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif /* _ASM_SOCKIOS__ */
14
diff --git a/include/asm-frv/spinlock.h b/include/asm-frv/spinlock.h
deleted file mode 100644
index fe385f45d1fd..000000000000
--- a/include/asm-frv/spinlock.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/* spinlock.h: spinlocks for FR-V
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_SPINLOCK_H
13#define _ASM_SPINLOCK_H
14
15#error no spinlocks for FR-V yet
16
17#endif /* _ASM_SPINLOCK_H */
diff --git a/include/asm-frv/spr-regs.h b/include/asm-frv/spr-regs.h
deleted file mode 100644
index 01e6af5e99b8..000000000000
--- a/include/asm-frv/spr-regs.h
+++ /dev/null
@@ -1,416 +0,0 @@
1/* spr-regs.h: special-purpose registers on the FRV
2 *
3 * Copyright (C) 2003, 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_SPR_REGS_H
13#define _ASM_SPR_REGS_H
14
15/*
16 * PSR - Processor Status Register
17 */
18#define PSR_ET 0x00000001 /* enable interrupts/exceptions flag */
19#define PSR_PS 0x00000002 /* previous supervisor mode flag */
20#define PSR_S 0x00000004 /* supervisor mode flag */
21#define PSR_PIL 0x00000078 /* processor external interrupt level */
22#define PSR_PIL_0 0x00000000 /* - no interrupt in progress */
23#define PSR_PIL_13 0x00000068 /* - debugging only */
24#define PSR_PIL_14 0x00000070 /* - debugging in progress */
25#define PSR_PIL_15 0x00000078 /* - NMI in progress */
26#define PSR_EM 0x00000080 /* enable media operation */
27#define PSR_EF 0x00000100 /* enable FPU operation */
28#define PSR_BE 0x00001000 /* endianness mode */
29#define PSR_BE_LE 0x00000000 /* - little endian mode */
30#define PSR_BE_BE 0x00001000 /* - big endian mode */
31#define PSR_CM 0x00002000 /* conditional mode */
32#define PSR_NEM 0x00004000 /* non-excepting mode */
33#define PSR_ICE 0x00010000 /* in-circuit emulation mode */
34#define PSR_VERSION_SHIFT 24 /* CPU silicon ID */
35#define PSR_IMPLE_SHIFT 28 /* CPU core ID */
36
37#define PSR_VERSION(psr) (((psr) >> PSR_VERSION_SHIFT) & 0xf)
38#define PSR_IMPLE(psr) (((psr) >> PSR_IMPLE_SHIFT) & 0xf)
39
40#define PSR_IMPLE_FR401 0x2
41#define PSR_VERSION_FR401_MB93401 0x0
42#define PSR_VERSION_FR401_MB93401A 0x1
43#define PSR_VERSION_FR401_MB93403 0x2
44
45#define PSR_IMPLE_FR405 0x4
46#define PSR_VERSION_FR405_MB93405 0x0
47
48#define PSR_IMPLE_FR451 0x5
49#define PSR_VERSION_FR451_MB93451 0x0
50
51#define PSR_IMPLE_FR501 0x1
52#define PSR_VERSION_FR501_MB93501 0x1
53#define PSR_VERSION_FR501_MB93501A 0x2
54
55#define PSR_IMPLE_FR551 0x3
56#define PSR_VERSION_FR551_MB93555 0x1
57
58#define __get_PSR() ({ unsigned long x; asm volatile("movsg psr,%0" : "=r"(x)); x; })
59#define __set_PSR(V) do { asm volatile("movgs %0,psr" : : "r"(V)); } while(0)
60
61/*
62 * TBR - Trap Base Register
63 */
64#define TBR_TT 0x00000ff0
65#define TBR_TT_INSTR_MMU_MISS (0x01 << 4)
66#define TBR_TT_INSTR_ACC_ERROR (0x02 << 4)
67#define TBR_TT_INSTR_ACC_EXCEP (0x03 << 4)
68#define TBR_TT_PRIV_INSTR (0x06 << 4)
69#define TBR_TT_ILLEGAL_INSTR (0x07 << 4)
70#define TBR_TT_FP_EXCEPTION (0x0d << 4)
71#define TBR_TT_MP_EXCEPTION (0x0e << 4)
72#define TBR_TT_DATA_ACC_ERROR (0x11 << 4)
73#define TBR_TT_DATA_MMU_MISS (0x12 << 4)
74#define TBR_TT_DATA_ACC_EXCEP (0x13 << 4)
75#define TBR_TT_DATA_STR_ERROR (0x14 << 4)
76#define TBR_TT_DIVISION_EXCEP (0x17 << 4)
77#define TBR_TT_COMMIT_EXCEP (0x19 << 4)
78#define TBR_TT_INSTR_TLB_MISS (0x1a << 4)
79#define TBR_TT_DATA_TLB_MISS (0x1b << 4)
80#define TBR_TT_DATA_DAT_EXCEP (0x1d << 4)
81#define TBR_TT_DECREMENT_TIMER (0x1f << 4)
82#define TBR_TT_COMPOUND_EXCEP (0x20 << 4)
83#define TBR_TT_INTERRUPT_1 (0x21 << 4)
84#define TBR_TT_INTERRUPT_2 (0x22 << 4)
85#define TBR_TT_INTERRUPT_3 (0x23 << 4)
86#define TBR_TT_INTERRUPT_4 (0x24 << 4)
87#define TBR_TT_INTERRUPT_5 (0x25 << 4)
88#define TBR_TT_INTERRUPT_6 (0x26 << 4)
89#define TBR_TT_INTERRUPT_7 (0x27 << 4)
90#define TBR_TT_INTERRUPT_8 (0x28 << 4)
91#define TBR_TT_INTERRUPT_9 (0x29 << 4)
92#define TBR_TT_INTERRUPT_10 (0x2a << 4)
93#define TBR_TT_INTERRUPT_11 (0x2b << 4)
94#define TBR_TT_INTERRUPT_12 (0x2c << 4)
95#define TBR_TT_INTERRUPT_13 (0x2d << 4)
96#define TBR_TT_INTERRUPT_14 (0x2e << 4)
97#define TBR_TT_INTERRUPT_15 (0x2f << 4)
98#define TBR_TT_TRAP0 (0x80 << 4)
99#define TBR_TT_TRAP1 (0x81 << 4)
100#define TBR_TT_TRAP2 (0x82 << 4)
101#define TBR_TT_TRAP3 (0x83 << 4)
102#define TBR_TT_TRAP120 (0xf8 << 4)
103#define TBR_TT_TRAP121 (0xf9 << 4)
104#define TBR_TT_TRAP122 (0xfa << 4)
105#define TBR_TT_TRAP123 (0xfb << 4)
106#define TBR_TT_TRAP124 (0xfc << 4)
107#define TBR_TT_TRAP125 (0xfd << 4)
108#define TBR_TT_TRAP126 (0xfe << 4)
109#define TBR_TT_BREAK (0xff << 4)
110
111#define TBR_TT_ATOMIC_CMPXCHG32 TBR_TT_TRAP120
112#define TBR_TT_ATOMIC_XCHG32 TBR_TT_TRAP121
113#define TBR_TT_ATOMIC_XOR TBR_TT_TRAP122
114#define TBR_TT_ATOMIC_OR TBR_TT_TRAP123
115#define TBR_TT_ATOMIC_AND TBR_TT_TRAP124
116#define TBR_TT_ATOMIC_SUB TBR_TT_TRAP125
117#define TBR_TT_ATOMIC_ADD TBR_TT_TRAP126
118
119#define __get_TBR() ({ unsigned long x; asm volatile("movsg tbr,%0" : "=r"(x)); x; })
120
121/*
122 * HSR0 - Hardware Status Register 0
123 */
124#define HSR0_PDM 0x00000007 /* power down mode */
125#define HSR0_PDM_NORMAL 0x00000000 /* - normal mode */
126#define HSR0_PDM_CORE_SLEEP 0x00000001 /* - CPU core sleep mode */
127#define HSR0_PDM_BUS_SLEEP 0x00000003 /* - bus sleep mode */
128#define HSR0_PDM_PLL_RUN 0x00000005 /* - PLL run */
129#define HSR0_PDM_PLL_STOP 0x00000007 /* - PLL stop */
130#define HSR0_GRLE 0x00000040 /* GR lower register set enable */
131#define HSR0_GRHE 0x00000080 /* GR higher register set enable */
132#define HSR0_FRLE 0x00000100 /* FR lower register set enable */
133#define HSR0_FRHE 0x00000200 /* FR higher register set enable */
134#define HSR0_GRN 0x00000400 /* GR quantity */
135#define HSR0_GRN_64 0x00000000 /* - 64 GR registers */
136#define HSR0_GRN_32 0x00000400 /* - 32 GR registers */
137#define HSR0_FRN 0x00000800 /* FR quantity */
138#define HSR0_FRN_64 0x00000000 /* - 64 FR registers */
139#define HSR0_FRN_32 0x00000800 /* - 32 FR registers */
140#define HSR0_SA 0x00001000 /* start address (RAMBOOT#) */
141#define HSR0_ETMI 0x00008000 /* enable TIMERI (64-bit up timer) */
142#define HSR0_ETMD 0x00004000 /* enable TIMERD (32-bit down timer) */
143#define HSR0_PEDAT 0x00010000 /* previous DAT mode */
144#define HSR0_XEDAT 0x00020000 /* exception DAT mode */
145#define HSR0_EDAT 0x00080000 /* enable DAT mode */
146#define HSR0_RME 0x00400000 /* enable RAM mode */
147#define HSR0_EMEM 0x00800000 /* enable MMU_Miss mask */
148#define HSR0_EXMMU 0x01000000 /* enable extended MMU mode */
149#define HSR0_EDMMU 0x02000000 /* enable data MMU */
150#define HSR0_EIMMU 0x04000000 /* enable instruction MMU */
151#define HSR0_CBM 0x08000000 /* copy back mode */
152#define HSR0_CBM_WRITE_THRU 0x00000000 /* - write through */
153#define HSR0_CBM_COPY_BACK 0x08000000 /* - copy back */
154#define HSR0_NWA 0x10000000 /* no write allocate */
155#define HSR0_DCE 0x40000000 /* data cache enable */
156#define HSR0_ICE 0x80000000 /* instruction cache enable */
157
158#define __get_HSR(R) ({ unsigned long x; asm volatile("movsg hsr"#R",%0" : "=r"(x)); x; })
159#define __set_HSR(R,V) do { asm volatile("movgs %0,hsr"#R : : "r"(V)); } while(0)
160
161/*
162 * CCR - Condition Codes Register
163 */
164#define CCR_FCC0 0x0000000f /* FP/Media condition 0 (fcc0 reg) */
165#define CCR_FCC1 0x000000f0 /* FP/Media condition 1 (fcc1 reg) */
166#define CCR_FCC2 0x00000f00 /* FP/Media condition 2 (fcc2 reg) */
167#define CCR_FCC3 0x0000f000 /* FP/Media condition 3 (fcc3 reg) */
168#define CCR_ICC0 0x000f0000 /* Integer condition 0 (icc0 reg) */
169#define CCR_ICC0_C 0x00010000 /* - Carry flag */
170#define CCR_ICC0_V 0x00020000 /* - Overflow flag */
171#define CCR_ICC0_Z 0x00040000 /* - Zero flag */
172#define CCR_ICC0_N 0x00080000 /* - Negative flag */
173#define CCR_ICC1 0x00f00000 /* Integer condition 1 (icc1 reg) */
174#define CCR_ICC2 0x0f000000 /* Integer condition 2 (icc2 reg) */
175#define CCR_ICC3 0xf0000000 /* Integer condition 3 (icc3 reg) */
176
177/*
178 * CCCR - Condition Codes for Conditional Instructions Register
179 */
180#define CCCR_CC0 0x00000003 /* condition 0 (cc0 reg) */
181#define CCCR_CC0_FALSE 0x00000002 /* - condition is false */
182#define CCCR_CC0_TRUE 0x00000003 /* - condition is true */
183#define CCCR_CC1 0x0000000c /* condition 1 (cc1 reg) */
184#define CCCR_CC2 0x00000030 /* condition 2 (cc2 reg) */
185#define CCCR_CC3 0x000000c0 /* condition 3 (cc3 reg) */
186#define CCCR_CC4 0x00000300 /* condition 4 (cc4 reg) */
187#define CCCR_CC5 0x00000c00 /* condition 5 (cc5 reg) */
188#define CCCR_CC6 0x00003000 /* condition 6 (cc6 reg) */
189#define CCCR_CC7 0x0000c000 /* condition 7 (cc7 reg) */
190
191/*
192 * ISR - Integer Status Register
193 */
194#define ISR_EMAM 0x00000001 /* memory misaligned access handling */
195#define ISR_EMAM_EXCEPTION 0x00000000 /* - generate exception */
196#define ISR_EMAM_FUDGE 0x00000001 /* - mask out invalid address bits */
197#define ISR_AEXC 0x00000004 /* accrued [overflow] exception */
198#define ISR_DTT 0x00000018 /* division type trap */
199#define ISR_DTT_IGNORE 0x00000000 /* - ignore division error */
200#define ISR_DTT_DIVBYZERO 0x00000008 /* - generate exception */
201#define ISR_DTT_OVERFLOW 0x00000010 /* - record overflow */
202#define ISR_EDE 0x00000020 /* enable division exception */
203#define ISR_PLI 0x20000000 /* pre-load instruction information */
204#define ISR_QI 0x80000000 /* quad data implementation information */
205
206/*
207 * EPCR0 - Exception PC Register
208 */
209#define EPCR0_V 0x00000001 /* register content validity indicator */
210#define EPCR0_PC 0xfffffffc /* faulting instruction address */
211
212/*
213 * ESR0/14/15 - Exception Status Register
214 */
215#define ESRx_VALID 0x00000001 /* register content validity indicator */
216#define ESRx_EC 0x0000003e /* exception type */
217#define ESRx_EC_DATA_STORE 0x00000000 /* - data_store_error */
218#define ESRx_EC_INSN_ACCESS 0x00000006 /* - instruction_access_error */
219#define ESRx_EC_PRIV_INSN 0x00000008 /* - privileged_instruction */
220#define ESRx_EC_ILL_INSN 0x0000000a /* - illegal_instruction */
221#define ESRx_EC_MP_EXCEP 0x0000001c /* - mp_exception */
222#define ESRx_EC_DATA_ACCESS 0x00000020 /* - data_access_error */
223#define ESRx_EC_DIVISION 0x00000026 /* - division_exception */
224#define ESRx_EC_ITLB_MISS 0x00000034 /* - instruction_access_TLB_miss */
225#define ESRx_EC_DTLB_MISS 0x00000036 /* - data_access_TLB_miss */
226#define ESRx_EC_DATA_ACCESS_DAT 0x0000003a /* - data_access_DAT_exception */
227
228#define ESR0_IAEC 0x00000100 /* info for instruction-access-exception */
229#define ESR0_IAEC_RESV 0x00000000 /* - reserved */
230#define ESR0_IAEC_PROT_VIOL 0x00000100 /* - protection violation */
231
232#define ESR0_ATXC 0x00f00000 /* address translation exception code */
233#define ESR0_ATXC_MMU_MISS 0x00000000 /* - MMU miss exception and more (?) */
234#define ESR0_ATXC_MULTI_DAT 0x00800000 /* - multiple DAT entry hit */
235#define ESR0_ATXC_MULTI_SAT 0x00900000 /* - multiple SAT entry hit */
236#define ESR0_ATXC_AMRTLB_MISS 0x00a00000 /* - MMU/TLB miss exception */
237#define ESR0_ATXC_PRIV_EXCEP 0x00c00000 /* - privilege protection fault */
238#define ESR0_ATXC_WP_EXCEP 0x00d00000 /* - write protection fault */
239
240#define ESR0_EAV 0x00000800 /* true if EAR0 register valid */
241#define ESR15_EAV 0x00000800 /* true if EAR15 register valid */
242
243/*
244 * ESFR1 - Exception Status Valid Flag Register
245 */
246#define ESFR1_ESR0 0x00000001 /* true if ESR0 is valid */
247#define ESFR1_ESR14 0x00004000 /* true if ESR14 is valid */
248#define ESFR1_ESR15 0x00008000 /* true if ESR15 is valid */
249
250/*
251 * MSR - Media Status Register
252 */
253#define MSR0_AOVF 0x00000001 /* overflow exception accrued */
254#define MSRx_OVF 0x00000002 /* overflow exception detected */
255#define MSRx_SIE 0x0000003c /* last SIMD instruction exception detected */
256#define MSRx_SIE_NONE 0x00000000 /* - none detected */
257#define MSRx_SIE_FRkHI_ACCk 0x00000020 /* - exception at FRkHI or ACCk */
258#define MSRx_SIE_FRkLO_ACCk1 0x00000010 /* - exception at FRkLO or ACCk+1 */
259#define MSRx_SIE_FRk1HI_ACCk2 0x00000008 /* - exception at FRk+1HI or ACCk+2 */
260#define MSRx_SIE_FRk1LO_ACCk3 0x00000004 /* - exception at FRk+1LO or ACCk+3 */
261#define MSR0_MTT 0x00007000 /* type of last media trap detected */
262#define MSR0_MTT_NONE 0x00000000 /* - none detected */
263#define MSR0_MTT_OVERFLOW 0x00001000 /* - overflow detected */
264#define MSR0_HI 0x00c00000 /* hardware implementation */
265#define MSR0_HI_ROUNDING 0x00000000 /* - rounding mode */
266#define MSR0_HI_NONROUNDING 0x00c00000 /* - non-rounding mode */
267#define MSR0_EMCI 0x01000000 /* enable media custom instructions */
268#define MSR0_SRDAV 0x10000000 /* select rounding mode of MAVEH */
269#define MSR0_SRDAV_RDAV 0x00000000 /* - controlled by MSR.RDAV */
270#define MSR0_SRDAV_RD 0x10000000 /* - controlled by MSR.RD */
271#define MSR0_RDAV 0x20000000 /* rounding mode of MAVEH */
272#define MSR0_RDAV_NEAREST_MI 0x00000000 /* - round to nearest minus */
273#define MSR0_RDAV_NEAREST_PL 0x20000000 /* - round to nearest plus */
274#define MSR0_RD 0xc0000000 /* rounding mode */
275#define MSR0_RD_NEAREST 0x00000000 /* - nearest */
276#define MSR0_RD_ZERO 0x40000000 /* - zero */
277#define MSR0_RD_POS_INF 0x80000000 /* - postive infinity */
278#define MSR0_RD_NEG_INF 0xc0000000 /* - negative infinity */
279
280/*
281 * IAMPR0-7 - Instruction Address Mapping Register
282 * DAMPR0-7 - Data Address Mapping Register
283 */
284#define xAMPRx_V 0x00000001 /* register content validity indicator */
285#define DAMPRx_WP 0x00000002 /* write protect */
286#define DAMPRx_WP_RW 0x00000000 /* - read/write */
287#define DAMPRx_WP_RO 0x00000002 /* - read-only */
288#define xAMPRx_C 0x00000004 /* cached/uncached */
289#define xAMPRx_C_CACHED 0x00000000 /* - cached */
290#define xAMPRx_C_UNCACHED 0x00000004 /* - uncached */
291#define xAMPRx_S 0x00000008 /* supervisor only */
292#define xAMPRx_S_USER 0x00000000 /* - userspace can access */
293#define xAMPRx_S_KERNEL 0x00000008 /* - kernel only */
294#define xAMPRx_SS 0x000000f0 /* segment size */
295#define xAMPRx_SS_16Kb 0x00000000 /* - 16 kilobytes */
296#define xAMPRx_SS_64Kb 0x00000010 /* - 64 kilobytes */
297#define xAMPRx_SS_256Kb 0x00000020 /* - 256 kilobytes */
298#define xAMPRx_SS_1Mb 0x00000030 /* - 1 megabyte */
299#define xAMPRx_SS_2Mb 0x00000040 /* - 2 megabytes */
300#define xAMPRx_SS_4Mb 0x00000050 /* - 4 megabytes */
301#define xAMPRx_SS_8Mb 0x00000060 /* - 8 megabytes */
302#define xAMPRx_SS_16Mb 0x00000070 /* - 16 megabytes */
303#define xAMPRx_SS_32Mb 0x00000080 /* - 32 megabytes */
304#define xAMPRx_SS_64Mb 0x00000090 /* - 64 megabytes */
305#define xAMPRx_SS_128Mb 0x000000a0 /* - 128 megabytes */
306#define xAMPRx_SS_256Mb 0x000000b0 /* - 256 megabytes */
307#define xAMPRx_SS_512Mb 0x000000c0 /* - 512 megabytes */
308#define xAMPRx_RESERVED8 0x00000100 /* reserved bit */
309#define xAMPRx_NG 0x00000200 /* non-global */
310#define xAMPRx_L 0x00000400 /* locked */
311#define xAMPRx_M 0x00000800 /* modified */
312#define xAMPRx_D 0x00001000 /* DAT entry */
313#define xAMPRx_RESERVED13 0x00002000 /* reserved bit */
314#define xAMPRx_PPFN 0xfff00000 /* physical page frame number */
315
316#define xAMPRx_V_BIT 0
317#define DAMPRx_WP_BIT 1
318#define xAMPRx_C_BIT 2
319#define xAMPRx_S_BIT 3
320#define xAMPRx_RESERVED8_BIT 8
321#define xAMPRx_NG_BIT 9
322#define xAMPRx_L_BIT 10
323#define xAMPRx_M_BIT 11
324#define xAMPRx_D_BIT 12
325#define xAMPRx_RESERVED13_BIT 13
326
327#define __get_IAMPR(R) ({ unsigned long x; asm volatile("movsg iampr"#R",%0" : "=r"(x)); x; })
328#define __get_DAMPR(R) ({ unsigned long x; asm volatile("movsg dampr"#R",%0" : "=r"(x)); x; })
329
330#define __get_IAMLR(R) ({ unsigned long x; asm volatile("movsg iamlr"#R",%0" : "=r"(x)); x; })
331#define __get_DAMLR(R) ({ unsigned long x; asm volatile("movsg damlr"#R",%0" : "=r"(x)); x; })
332
333#define __set_IAMPR(R,V) do { asm volatile("movgs %0,iampr"#R : : "r"(V)); } while(0)
334#define __set_DAMPR(R,V) do { asm volatile("movgs %0,dampr"#R : : "r"(V)); } while(0)
335
336#define __set_IAMLR(R,V) do { asm volatile("movgs %0,iamlr"#R : : "r"(V)); } while(0)
337#define __set_DAMLR(R,V) do { asm volatile("movgs %0,damlr"#R : : "r"(V)); } while(0)
338
339#define save_dampr(R, _dampr) \
340do { \
341 asm volatile("movsg dampr"R",%0" : "=r"(_dampr)); \
342} while(0)
343
344#define restore_dampr(R, _dampr) \
345do { \
346 asm volatile("movgs %0,dampr"R :: "r"(_dampr)); \
347} while(0)
348
349/*
350 * AMCR - Address Mapping Control Register
351 */
352#define AMCR_IAMRN 0x000000ff /* quantity of IAMPR registers */
353#define AMCR_DAMRN 0x0000ff00 /* quantity of DAMPR registers */
354
355/*
356 * TTBR - Address Translation Table Base Register
357 */
358#define __get_TTBR() ({ unsigned long x; asm volatile("movsg ttbr,%0" : "=r"(x)); x; })
359
360/*
361 * TPXR - TLB Probe Extend Register
362 */
363#define TPXR_E 0x00000001
364#define TPXR_LMAX_SHIFT 20
365#define TPXR_LMAX_SMASK 0xf
366#define TPXR_WMAX_SHIFT 24
367#define TPXR_WMAX_SMASK 0xf
368#define TPXR_WAY_SHIFT 28
369#define TPXR_WAY_SMASK 0xf
370
371/*
372 * DCR - Debug Control Register
373 */
374#define DCR_IBCE3 0x00000001 /* break on conditional insn pointed to by IBAR3 */
375#define DCR_IBE3 0x00000002 /* break on insn pointed to by IBAR3 */
376#define DCR_IBCE1 0x00000004 /* break on conditional insn pointed to by IBAR2 */
377#define DCR_IBE1 0x00000008 /* break on insn pointed to by IBAR2 */
378#define DCR_IBCE2 0x00000010 /* break on conditional insn pointed to by IBAR1 */
379#define DCR_IBE2 0x00000020 /* break on insn pointed to by IBAR1 */
380#define DCR_IBCE0 0x00000040 /* break on conditional insn pointed to by IBAR0 */
381#define DCR_IBE0 0x00000080 /* break on insn pointed to by IBAR0 */
382
383#define DCR_DDBE1 0x00004000 /* use DBDR1x when checking DBAR1 */
384#define DCR_DWBE1 0x00008000 /* break on store to address in DBAR1/DBMR1x */
385#define DCR_DRBE1 0x00010000 /* break on load from address in DBAR1/DBMR1x */
386#define DCR_DDBE0 0x00020000 /* use DBDR0x when checking DBAR0 */
387#define DCR_DWBE0 0x00040000 /* break on store to address in DBAR0/DBMR0x */
388#define DCR_DRBE0 0x00080000 /* break on load from address in DBAR0/DBMR0x */
389
390#define DCR_EIM 0x0c000000 /* external interrupt disable */
391#define DCR_IBM 0x10000000 /* instruction break disable */
392#define DCR_SE 0x20000000 /* single step enable */
393#define DCR_EBE 0x40000000 /* exception break enable */
394
395/*
396 * BRR - Break Interrupt Request Register
397 */
398#define BRR_ST 0x00000001 /* single-step detected */
399#define BRR_SB 0x00000002 /* break instruction detected */
400#define BRR_BB 0x00000004 /* branch with hint detected */
401#define BRR_CBB 0x00000008 /* branch to LR detected */
402#define BRR_IBx 0x000000f0 /* hardware breakpoint detected */
403#define BRR_DBx 0x00000f00 /* hardware watchpoint detected */
404#define BRR_DBNEx 0x0000f000 /* ? */
405#define BRR_EBTT 0x00ff0000 /* trap type of exception break */
406#define BRR_TB 0x10000000 /* external break request detected */
407#define BRR_CB 0x20000000 /* ICE break command detected */
408#define BRR_EB 0x40000000 /* exception break detected */
409
410/*
411 * BPSR - Break PSR Save Register
412 */
413#define BPSR_BET 0x00000001 /* former PSR.ET */
414#define BPSR_BS 0x00001000 /* former PSR.S */
415
416#endif /* _ASM_SPR_REGS_H */
diff --git a/include/asm-frv/stat.h b/include/asm-frv/stat.h
deleted file mode 100644
index ce56de9b37ba..000000000000
--- a/include/asm-frv/stat.h
+++ /dev/null
@@ -1,100 +0,0 @@
1#ifndef _ASM_STAT_H
2#define _ASM_STAT_H
3
4struct __old_kernel_stat {
5 unsigned short st_dev;
6 unsigned short st_ino;
7 unsigned short st_mode;
8 unsigned short st_nlink;
9 unsigned short st_uid;
10 unsigned short st_gid;
11 unsigned short st_rdev;
12 unsigned long st_size;
13 unsigned long st_atime;
14 unsigned long st_mtime;
15 unsigned long st_ctime;
16};
17
18/* This matches struct stat in uClibc/glibc. */
19struct stat {
20 unsigned char __pad1[6];
21 unsigned short st_dev;
22
23 unsigned long __pad2;
24 unsigned long st_ino;
25
26 unsigned short __pad3;
27 unsigned short st_mode;
28 unsigned short __pad4;
29 unsigned short st_nlink;
30
31 unsigned short __pad5;
32 unsigned short st_uid;
33 unsigned short __pad6;
34 unsigned short st_gid;
35
36 unsigned char __pad7[6];
37 unsigned short st_rdev;
38
39 unsigned long __pad8;
40 unsigned long st_size;
41
42 unsigned long __pad9; /* align 64-bit st_blocks to 2-word */
43 unsigned long st_blksize;
44
45 unsigned long __pad10; /* future possible st_blocks high bits */
46 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
47
48 unsigned long __unused1;
49 unsigned long st_atime;
50
51 unsigned long __unused2;
52 unsigned long st_mtime;
53
54 unsigned long __unused3;
55 unsigned long st_ctime;
56
57 unsigned long long __unused4;
58};
59
60/* This matches struct stat64 in uClibc/glibc. The layout is exactly
61 the same as that of struct stat above, with 64-bit types taking up
62 space that was formerly used by padding. stat syscalls are still
63 different from stat64, though, in that the former tests for
64 overflow. */
65struct stat64 {
66 unsigned char __pad1[6];
67 unsigned short st_dev;
68
69 unsigned long long st_ino;
70
71 unsigned int st_mode;
72 unsigned int st_nlink;
73
74 unsigned long st_uid;
75 unsigned long st_gid;
76
77 unsigned char __pad2[6];
78 unsigned short st_rdev;
79
80 long long st_size;
81
82 unsigned long __pad3; /* align 64-bit st_blocks to 2-word */
83 unsigned long st_blksize;
84
85 unsigned long __pad4; /* future possible st_blocks high bits */
86 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
87
88 unsigned long st_atime_nsec;
89 unsigned long st_atime;
90
91 unsigned int st_mtime_nsec;
92 unsigned long st_mtime;
93
94 unsigned long st_ctime_nsec;
95 unsigned long st_ctime;
96
97 unsigned long long __unused4;
98};
99
100#endif /* _ASM_STAT_H */
diff --git a/include/asm-frv/statfs.h b/include/asm-frv/statfs.h
deleted file mode 100644
index 741f586045ba..000000000000
--- a/include/asm-frv/statfs.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_STATFS_H
2#define _ASM_STATFS_H
3
4#include <asm-generic/statfs.h>
5
6#endif /* _ASM_STATFS_H */
7
diff --git a/include/asm-frv/string.h b/include/asm-frv/string.h
deleted file mode 100644
index 5ed310f64b7e..000000000000
--- a/include/asm-frv/string.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/* string.h: FRV string handling
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_STRING_H_
13#define _ASM_STRING_H_
14
15#ifdef __KERNEL__ /* only set these up for kernel code */
16
17#define __HAVE_ARCH_MEMSET 1
18#define __HAVE_ARCH_MEMCPY 1
19
20extern void *memset(void *, int, __kernel_size_t);
21extern void *memcpy(void *, const void *, __kernel_size_t);
22
23#else /* KERNEL */
24
25/*
26 * let user libraries deal with these,
27 * IMHO the kernel has no place defining these functions for user apps
28 */
29
30#define __HAVE_ARCH_STRCPY 1
31#define __HAVE_ARCH_STRNCPY 1
32#define __HAVE_ARCH_STRCAT 1
33#define __HAVE_ARCH_STRNCAT 1
34#define __HAVE_ARCH_STRCMP 1
35#define __HAVE_ARCH_STRNCMP 1
36#define __HAVE_ARCH_STRNICMP 1
37#define __HAVE_ARCH_STRCHR 1
38#define __HAVE_ARCH_STRRCHR 1
39#define __HAVE_ARCH_STRSTR 1
40#define __HAVE_ARCH_STRLEN 1
41#define __HAVE_ARCH_STRNLEN 1
42#define __HAVE_ARCH_MEMSET 1
43#define __HAVE_ARCH_MEMCPY 1
44#define __HAVE_ARCH_MEMMOVE 1
45#define __HAVE_ARCH_MEMSCAN 1
46#define __HAVE_ARCH_MEMCMP 1
47#define __HAVE_ARCH_MEMCHR 1
48#define __HAVE_ARCH_STRTOK 1
49
50#endif /* KERNEL */
51#endif /* _ASM_STRING_H_ */
diff --git a/include/asm-frv/suspend.h b/include/asm-frv/suspend.h
deleted file mode 100644
index 5fa7b5a6ee40..000000000000
--- a/include/asm-frv/suspend.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/* suspend.h: suspension stuff
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_SUSPEND_H
13#define _ASM_SUSPEND_H
14
15static inline int arch_prepare_suspend(void)
16{
17 return 0;
18}
19
20#endif /* _ASM_SUSPEND_H */
diff --git a/include/asm-frv/swab.h b/include/asm-frv/swab.h
deleted file mode 100644
index f305834b4799..000000000000
--- a/include/asm-frv/swab.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _ASM_SWAB_H
2#define _ASM_SWAB_H
3
4#include <linux/types.h>
5
6#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
7# define __SWAB_64_THRU_32__
8#endif
9
10#endif /* _ASM_SWAB_H */
diff --git a/include/asm-frv/system.h b/include/asm-frv/system.h
deleted file mode 100644
index 7742ec000cc4..000000000000
--- a/include/asm-frv/system.h
+++ /dev/null
@@ -1,301 +0,0 @@
1/* system.h: FR-V CPU control definitions
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_SYSTEM_H
13#define _ASM_SYSTEM_H
14
15#include <linux/types.h>
16#include <linux/linkage.h>
17#include <linux/kernel.h>
18
19struct thread_struct;
20
21/*
22 * switch_to(prev, next) should switch from task `prev' to `next'
23 * `prev' will never be the same as `next'.
24 * The `mb' is to tell GCC not to cache `current' across this call.
25 */
26extern asmlinkage
27struct task_struct *__switch_to(struct thread_struct *prev_thread,
28 struct thread_struct *next_thread,
29 struct task_struct *prev);
30
31#define switch_to(prev, next, last) \
32do { \
33 (prev)->thread.sched_lr = \
34 (unsigned long) __builtin_return_address(0); \
35 (last) = __switch_to(&(prev)->thread, &(next)->thread, (prev)); \
36 mb(); \
37} while(0)
38
39/*
40 * interrupt flag manipulation
41 * - use virtual interrupt management since touching the PSR is slow
42 * - ICC2.Z: T if interrupts virtually disabled
43 * - ICC2.C: F if interrupts really disabled
44 * - if Z==1 upon interrupt:
45 * - C is set to 0
46 * - interrupts are really disabled
47 * - entry.S returns immediately
48 * - uses TIHI (TRAP if Z==0 && C==0) #2 to really reenable interrupts
49 * - if taken, the trap:
50 * - sets ICC2.C
51 * - enables interrupts
52 */
53#define local_irq_disable() \
54do { \
55 /* set Z flag, but don't change the C flag */ \
56 asm volatile(" andcc gr0,gr0,gr0,icc2 \n" \
57 : \
58 : \
59 : "memory", "icc2" \
60 ); \
61} while(0)
62
63#define local_irq_enable() \
64do { \
65 /* clear Z flag and then test the C flag */ \
66 asm volatile(" oricc gr0,#1,gr0,icc2 \n" \
67 " tihi icc2,gr0,#2 \n" \
68 : \
69 : \
70 : "memory", "icc2" \
71 ); \
72} while(0)
73
74#define local_save_flags(flags) \
75do { \
76 typecheck(unsigned long, flags); \
77 asm volatile("movsg ccr,%0" \
78 : "=r"(flags) \
79 : \
80 : "memory"); \
81 \
82 /* shift ICC2.Z to bit 0 */ \
83 flags >>= 26; \
84 \
85 /* make flags 1 if interrupts disabled, 0 otherwise */ \
86 flags &= 1UL; \
87} while(0)
88
89#define irqs_disabled() \
90 ({unsigned long flags; local_save_flags(flags); !!flags; })
91
92#define local_irq_save(flags) \
93do { \
94 typecheck(unsigned long, flags); \
95 local_save_flags(flags); \
96 local_irq_disable(); \
97} while(0)
98
99#define local_irq_restore(flags) \
100do { \
101 typecheck(unsigned long, flags); \
102 \
103 /* load the Z flag by turning 1 if disabled into 0 if disabled \
104 * and thus setting the Z flag but not the C flag */ \
105 asm volatile(" xoricc %0,#1,gr0,icc2 \n" \
106 /* then test Z=0 and C=0 */ \
107 " tihi icc2,gr0,#2 \n" \
108 : \
109 : "r"(flags) \
110 : "memory", "icc2" \
111 ); \
112 \
113} while(0)
114
115/*
116 * real interrupt flag manipulation
117 */
118#define __local_irq_disable() \
119do { \
120 unsigned long psr; \
121 asm volatile(" movsg psr,%0 \n" \
122 " andi %0,%2,%0 \n" \
123 " ori %0,%1,%0 \n" \
124 " movgs %0,psr \n" \
125 : "=r"(psr) \
126 : "i" (PSR_PIL_14), "i" (~PSR_PIL) \
127 : "memory"); \
128} while(0)
129
130#define __local_irq_enable() \
131do { \
132 unsigned long psr; \
133 asm volatile(" movsg psr,%0 \n" \
134 " andi %0,%1,%0 \n" \
135 " movgs %0,psr \n" \
136 : "=r"(psr) \
137 : "i" (~PSR_PIL) \
138 : "memory"); \
139} while(0)
140
141#define __local_save_flags(flags) \
142do { \
143 typecheck(unsigned long, flags); \
144 asm("movsg psr,%0" \
145 : "=r"(flags) \
146 : \
147 : "memory"); \
148} while(0)
149
150#define __local_irq_save(flags) \
151do { \
152 unsigned long npsr; \
153 typecheck(unsigned long, flags); \
154 asm volatile(" movsg psr,%0 \n" \
155 " andi %0,%3,%1 \n" \
156 " ori %1,%2,%1 \n" \
157 " movgs %1,psr \n" \
158 : "=r"(flags), "=r"(npsr) \
159 : "i" (PSR_PIL_14), "i" (~PSR_PIL) \
160 : "memory"); \
161} while(0)
162
163#define __local_irq_restore(flags) \
164do { \
165 typecheck(unsigned long, flags); \
166 asm volatile(" movgs %0,psr \n" \
167 : \
168 : "r" (flags) \
169 : "memory"); \
170} while(0)
171
172#define __irqs_disabled() \
173 ((__get_PSR() & PSR_PIL) >= PSR_PIL_14)
174
175/*
176 * Force strict CPU ordering.
177 */
178#define nop() asm volatile ("nop"::)
179#define mb() asm volatile ("membar" : : :"memory")
180#define rmb() asm volatile ("membar" : : :"memory")
181#define wmb() asm volatile ("membar" : : :"memory")
182#define read_barrier_depends() do { } while (0)
183
184#ifdef CONFIG_SMP
185#define smp_mb() mb()
186#define smp_rmb() rmb()
187#define smp_wmb() wmb()
188#define smp_read_barrier_depends() read_barrier_depends()
189#define set_mb(var, value) \
190 do { xchg(&var, (value)); } while (0)
191#else
192#define smp_mb() barrier()
193#define smp_rmb() barrier()
194#define smp_wmb() barrier()
195#define smp_read_barrier_depends() do {} while(0)
196#define set_mb(var, value) \
197 do { var = (value); barrier(); } while (0)
198#endif
199
200extern void die_if_kernel(const char *, ...) __attribute__((format(printf, 1, 2)));
201extern void free_initmem(void);
202
203#define arch_align_stack(x) (x)
204
205/*****************************************************************************/
206/*
207 * compare and conditionally exchange value with memory
208 * - if (*ptr == test) then orig = *ptr; *ptr = test;
209 * - if (*ptr != test) then orig = *ptr;
210 */
211#ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS
212
213#define cmpxchg(ptr, test, new) \
214({ \
215 __typeof__(ptr) __xg_ptr = (ptr); \
216 __typeof__(*(ptr)) __xg_orig, __xg_tmp; \
217 __typeof__(*(ptr)) __xg_test = (test); \
218 __typeof__(*(ptr)) __xg_new = (new); \
219 \
220 switch (sizeof(__xg_orig)) { \
221 case 4: \
222 asm volatile( \
223 "0: \n" \
224 " orcc gr0,gr0,gr0,icc3 \n" \
225 " ckeq icc3,cc7 \n" \
226 " ld.p %M0,%1 \n" \
227 " orcr cc7,cc7,cc3 \n" \
228 " sub%I4cc %1,%4,%2,icc0 \n" \
229 " bne icc0,#0,1f \n" \
230 " cst.p %3,%M0 ,cc3,#1 \n" \
231 " corcc gr29,gr29,gr0 ,cc3,#1 \n" \
232 " beq icc3,#0,0b \n" \
233 "1: \n" \
234 : "+U"(*__xg_ptr), "=&r"(__xg_orig), "=&r"(__xg_tmp) \
235 : "r"(__xg_new), "NPr"(__xg_test) \
236 : "memory", "cc7", "cc3", "icc3", "icc0" \
237 ); \
238 break; \
239 \
240 default: \
241 __xg_orig = (__typeof__(__xg_orig))0; \
242 asm volatile("break"); \
243 break; \
244 } \
245 \
246 __xg_orig; \
247})
248
249#else
250
251extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new);
252
253#define cmpxchg(ptr, test, new) \
254({ \
255 __typeof__(ptr) __xg_ptr = (ptr); \
256 __typeof__(*(ptr)) __xg_orig; \
257 __typeof__(*(ptr)) __xg_test = (test); \
258 __typeof__(*(ptr)) __xg_new = (new); \
259 \
260 switch (sizeof(__xg_orig)) { \
261 case 4: __xg_orig = (__force __typeof__(*ptr)) \
262 __cmpxchg_32((__force uint32_t *)__xg_ptr, \
263 (__force uint32_t)__xg_test, \
264 (__force uint32_t)__xg_new); break; \
265 default: \
266 __xg_orig = (__typeof__(__xg_orig))0; \
267 asm volatile("break"); \
268 break; \
269 } \
270 \
271 __xg_orig; \
272})
273
274#endif
275
276#include <asm-generic/cmpxchg-local.h>
277
278static inline unsigned long __cmpxchg_local(volatile void *ptr,
279 unsigned long old,
280 unsigned long new, int size)
281{
282 switch (size) {
283 case 4:
284 return cmpxchg((unsigned long *)ptr, old, new);
285 default:
286 return __cmpxchg_local_generic(ptr, old, new, size);
287 }
288
289 return old;
290}
291
292/*
293 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
294 * them available.
295 */
296#define cmpxchg_local(ptr, o, n) \
297 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
298 (unsigned long)(n), sizeof(*(ptr))))
299#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
300
301#endif /* _ASM_SYSTEM_H */
diff --git a/include/asm-frv/termbits.h b/include/asm-frv/termbits.h
deleted file mode 100644
index 5568492b5086..000000000000
--- a/include/asm-frv/termbits.h
+++ /dev/null
@@ -1,202 +0,0 @@
1#ifndef _ASM_TERMBITS_H__
2#define _ASM_TERMBITS_H__
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20struct termios2 {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27 speed_t c_ispeed; /* input speed */
28 speed_t c_ospeed; /* output speed */
29};
30
31struct ktermios {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_line; /* line discipline */
37 cc_t c_cc[NCCS]; /* control characters */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
42/* c_cc characters */
43#define VINTR 0
44#define VQUIT 1
45#define VERASE 2
46#define VKILL 3
47#define VEOF 4
48#define VTIME 5
49#define VMIN 6
50#define VSWTC 7
51#define VSTART 8
52#define VSTOP 9
53#define VSUSP 10
54#define VEOL 11
55#define VREPRINT 12
56#define VDISCARD 13
57#define VWERASE 14
58#define VLNEXT 15
59#define VEOL2 16
60
61
62/* c_iflag bits */
63#define IGNBRK 0000001
64#define BRKINT 0000002
65#define IGNPAR 0000004
66#define PARMRK 0000010
67#define INPCK 0000020
68#define ISTRIP 0000040
69#define INLCR 0000100
70#define IGNCR 0000200
71#define ICRNL 0000400
72#define IUCLC 0001000
73#define IXON 0002000
74#define IXANY 0004000
75#define IXOFF 0010000
76#define IMAXBEL 0020000
77#define IUTF8 0040000
78
79/* c_oflag bits */
80#define OPOST 0000001
81#define OLCUC 0000002
82#define ONLCR 0000004
83#define OCRNL 0000010
84#define ONOCR 0000020
85#define ONLRET 0000040
86#define OFILL 0000100
87#define OFDEL 0000200
88#define NLDLY 0000400
89#define NL0 0000000
90#define NL1 0000400
91#define CRDLY 0003000
92#define CR0 0000000
93#define CR1 0001000
94#define CR2 0002000
95#define CR3 0003000
96#define TABDLY 0014000
97#define TAB0 0000000
98#define TAB1 0004000
99#define TAB2 0010000
100#define TAB3 0014000
101#define XTABS 0014000
102#define BSDLY 0020000
103#define BS0 0000000
104#define BS1 0020000
105#define VTDLY 0040000
106#define VT0 0000000
107#define VT1 0040000
108#define FFDLY 0100000
109#define FF0 0000000
110#define FF1 0100000
111
112/* c_cflag bit meaning */
113#define CBAUD 0010017
114#define B0 0000000 /* hang up */
115#define B50 0000001
116#define B75 0000002
117#define B110 0000003
118#define B134 0000004
119#define B150 0000005
120#define B200 0000006
121#define B300 0000007
122#define B600 0000010
123#define B1200 0000011
124#define B1800 0000012
125#define B2400 0000013
126#define B4800 0000014
127#define B9600 0000015
128#define B19200 0000016
129#define B38400 0000017
130#define EXTA B19200
131#define EXTB B38400
132#define CSIZE 0000060
133#define CS5 0000000
134#define CS6 0000020
135#define CS7 0000040
136#define CS8 0000060
137#define CSTOPB 0000100
138#define CREAD 0000200
139#define PARENB 0000400
140#define PARODD 0001000
141#define HUPCL 0002000
142#define CLOCAL 0004000
143#define CBAUDEX 0010000
144#define BOTHER 0010000
145#define B57600 0010001
146#define B115200 0010002
147#define B230400 0010003
148#define B460800 0010004
149#define B500000 0010005
150#define B576000 0010006
151#define B921600 0010007
152#define B1000000 0010010
153#define B1152000 0010011
154#define B1500000 0010012
155#define B2000000 0010013
156#define B2500000 0010014
157#define B3000000 0010015
158#define B3500000 0010016
159#define B4000000 0010017
160#define CIBAUD 002003600000 /* Input baud rate */
161#define CTVB 004000000000 /* VisioBraille Terminal flow control */
162#define CMSPAR 010000000000 /* mark or space (stick) parity */
163#define CRTSCTS 020000000000 /* flow control */
164
165#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
166
167/* c_lflag bits */
168#define ISIG 0000001
169#define ICANON 0000002
170#define XCASE 0000004
171#define ECHO 0000010
172#define ECHOE 0000020
173#define ECHOK 0000040
174#define ECHONL 0000100
175#define NOFLSH 0000200
176#define TOSTOP 0000400
177#define ECHOCTL 0001000
178#define ECHOPRT 0002000
179#define ECHOKE 0004000
180#define FLUSHO 0010000
181#define PENDIN 0040000
182#define IEXTEN 0100000
183
184
185/* tcflow() and TCXONC use these */
186#define TCOOFF 0
187#define TCOON 1
188#define TCIOFF 2
189#define TCION 3
190
191/* tcflush() and TCFLSH use these */
192#define TCIFLUSH 0
193#define TCOFLUSH 1
194#define TCIOFLUSH 2
195
196/* tcsetattr uses these */
197#define TCSANOW 0
198#define TCSADRAIN 1
199#define TCSAFLUSH 2
200
201#endif /* _ASM_TERMBITS_H__ */
202
diff --git a/include/asm-frv/termios.h b/include/asm-frv/termios.h
deleted file mode 100644
index a62fb5872375..000000000000
--- a/include/asm-frv/termios.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _ASM_TERMIOS_H
2#define _ASM_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24#ifdef __KERNEL__
25/* intr=^C quit=^| erase=del kill=^U
26 eof=^D vtime=\0 vmin=\1 sxtc=\0
27 start=^Q stop=^S susp=^Z eol=\0
28 reprint=^R discard=^U werase=^W lnext=^V
29 eol2=\0
30*/
31#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
32#endif
33
34/* modem lines */
35#define TIOCM_LE 0x001
36#define TIOCM_DTR 0x002
37#define TIOCM_RTS 0x004
38#define TIOCM_ST 0x008
39#define TIOCM_SR 0x010
40#define TIOCM_CTS 0x020
41#define TIOCM_CAR 0x040
42#define TIOCM_RNG 0x080
43#define TIOCM_DSR 0x100
44#define TIOCM_CD TIOCM_CAR
45#define TIOCM_RI TIOCM_RNG
46#define TIOCM_OUT1 0x2000
47#define TIOCM_OUT2 0x4000
48#define TIOCM_LOOP 0x8000
49
50#define TIOCM_MODEM_BITS TIOCM_OUT2 /* IRDA support */
51
52/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
53
54#ifdef __KERNEL__
55#include <asm-generic/termios.h>
56#endif
57
58#endif /* _ASM_TERMIOS_H */
diff --git a/include/asm-frv/thread_info.h b/include/asm-frv/thread_info.h
deleted file mode 100644
index b7ac6bf2844c..000000000000
--- a/include/asm-frv/thread_info.h
+++ /dev/null
@@ -1,144 +0,0 @@
1/* thread_info.h: description
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * Derived from include/asm-i386/thread_info.h
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#ifndef _ASM_THREAD_INFO_H
14#define _ASM_THREAD_INFO_H
15
16#ifdef __KERNEL__
17
18#ifndef __ASSEMBLY__
19#include <asm/processor.h>
20#endif
21
22#define THREAD_SIZE 8192
23
24/*
25 * low level task data that entry.S needs immediate access to
26 * - this struct should fit entirely inside of one cache line
27 * - this struct shares the supervisor stack pages
28 * - if the contents of this structure are changed, the assembly constants must also be changed
29 */
30#ifndef __ASSEMBLY__
31
32struct thread_info {
33 struct task_struct *task; /* main task structure */
34 struct exec_domain *exec_domain; /* execution domain */
35 unsigned long flags; /* low level flags */
36 unsigned long status; /* thread-synchronous flags */
37 __u32 cpu; /* current CPU */
38 int preempt_count; /* 0 => preemptable, <0 => BUG */
39
40 mm_segment_t addr_limit; /* thread address space:
41 0-0xBFFFFFFF for user-thead
42 0-0xFFFFFFFF for kernel-thread
43 */
44 struct restart_block restart_block;
45
46 __u8 supervisor_stack[0];
47};
48
49#else /* !__ASSEMBLY__ */
50
51#include <asm/asm-offsets.h>
52
53#endif
54
55#define PREEMPT_ACTIVE 0x10000000
56
57/*
58 * macros/functions for gaining access to the thread information structure
59 *
60 * preempt_count needs to be 1 initially, until the scheduler is functional.
61 */
62#ifndef __ASSEMBLY__
63
64#define INIT_THREAD_INFO(tsk) \
65{ \
66 .task = &tsk, \
67 .exec_domain = &default_exec_domain, \
68 .flags = 0, \
69 .cpu = 0, \
70 .preempt_count = 1, \
71 .addr_limit = KERNEL_DS, \
72 .restart_block = { \
73 .fn = do_no_restart_syscall, \
74 }, \
75}
76
77#define init_thread_info (init_thread_union.thread_info)
78#define init_stack (init_thread_union.stack)
79
80/* how to get the thread information struct from C */
81register struct thread_info *__current_thread_info asm("gr15");
82
83#define current_thread_info() ({ __current_thread_info; })
84
85#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
86
87/* thread information allocation */
88#ifdef CONFIG_DEBUG_STACK_USAGE
89#define alloc_thread_info(tsk) \
90 ({ \
91 struct thread_info *ret; \
92 \
93 ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \
94 \
95 ret; \
96 })
97#else
98#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
99#endif
100
101#define free_thread_info(info) kfree(info)
102
103#endif /* __ASSEMBLY__ */
104
105/*
106 * thread information flags
107 * - these are process state flags that various assembly files may need to access
108 * - pending work-to-be-done flags are in LSW
109 * - other flags in MSW
110 */
111#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
112#define TIF_SIGPENDING 1 /* signal pending */
113#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
114#define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */
115#define TIF_IRET 4 /* return with iret */
116#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
117#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
118#define TIF_MEMDIE 17 /* OOM killer killed process */
119#define TIF_FREEZE 18 /* freezing for suspend */
120
121#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
122#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
123#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
124#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
125#define _TIF_IRET (1 << TIF_IRET)
126#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
127#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
128#define _TIF_FREEZE (1 << TIF_FREEZE)
129
130#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
131#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
132
133/*
134 * Thread-synchronous status.
135 *
136 * This is different from the flags in that nobody else
137 * ever touches our thread-synchronous status, so we don't
138 * have to worry about atomic accesses.
139 */
140#define TS_USEDFPM 0x0001 /* FPU/Media was used by this task this quantum (SMP) */
141
142#endif /* __KERNEL__ */
143
144#endif /* _ASM_THREAD_INFO_H */
diff --git a/include/asm-frv/timer-regs.h b/include/asm-frv/timer-regs.h
deleted file mode 100644
index 6c5a871ce5e9..000000000000
--- a/include/asm-frv/timer-regs.h
+++ /dev/null
@@ -1,106 +0,0 @@
1/* timer-regs.h: hardware timer register definitions
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_TIMER_REGS_H
13#define _ASM_TIMER_REGS_H
14
15#include <asm/sections.h>
16
17extern unsigned long __nongprelbss __clkin_clock_speed_HZ;
18extern unsigned long __nongprelbss __ext_bus_clock_speed_HZ;
19extern unsigned long __nongprelbss __res_bus_clock_speed_HZ;
20extern unsigned long __nongprelbss __sdram_clock_speed_HZ;
21extern unsigned long __nongprelbss __core_bus_clock_speed_HZ;
22extern unsigned long __nongprelbss __core_clock_speed_HZ;
23extern unsigned long __nongprelbss __dsu_clock_speed_HZ;
24extern unsigned long __nongprelbss __serial_clock_speed_HZ;
25
26#define __get_CLKC() ({ *(volatile unsigned long *)(0xfeff9a00); })
27
28static inline void __set_CLKC(unsigned long v)
29{
30 int tmp;
31
32 asm volatile(" st%I0.p %2,%M0 \n"
33 " setlos %3,%1 \n"
34 " membar \n"
35 "0: \n"
36 " subicc %1,#1,%1,icc0 \n"
37 " bnc icc0,#1,0b \n"
38 : "=m"(*(volatile unsigned long *) 0xfeff9a00), "=r"(tmp)
39 : "r"(v), "i"(256)
40 : "icc0");
41}
42
43#define __get_TCTR() ({ *(volatile unsigned long *)(0xfeff9418); })
44#define __get_TPRV() ({ *(volatile unsigned long *)(0xfeff9420); })
45#define __get_TPRCKSL() ({ *(volatile unsigned long *)(0xfeff9428); })
46#define __get_TCSR(T) ({ *(volatile unsigned long *)(0xfeff9400 + 8 * (T)); })
47#define __get_TxCKSL(T) ({ *(volatile unsigned long *)(0xfeff9430 + 8 * (T)); })
48
49#define __get_TCSR_DATA(T) ({ __get_TCSR(T) >> 24; })
50
51#define __set_TCTR(V) do { *(volatile unsigned long *)(0xfeff9418) = (V); mb(); } while(0)
52#define __set_TPRV(V) do { *(volatile unsigned long *)(0xfeff9420) = (V) << 24; mb(); } while(0)
53#define __set_TPRCKSL(V) do { *(volatile unsigned long *)(0xfeff9428) = (V); mb(); } while(0)
54#define __set_TCSR(T,V) \
55do { *(volatile unsigned long *)(0xfeff9400 + 8 * (T)) = (V); mb(); } while(0)
56
57#define __set_TxCKSL(T,V) \
58do { *(volatile unsigned long *)(0xfeff9430 + 8 * (T)) = (V); mb(); } while(0)
59
60#define __set_TCSR_DATA(T,V) __set_TCSR(T, (V) << 24)
61#define __set_TxCKSL_DATA(T,V) __set_TxCKSL(T, TxCKSL_EIGHT | __TxCKSL_SELECT((V)))
62
63/* clock control register */
64#define CLKC_CMODE 0x0f000000
65#define CLKC_SLPL 0x000f0000
66#define CLKC_P0 0x00000100
67#define CLKC_CM 0x00000003
68
69#define CLKC_CMODE_s 24
70
71/* timer control register - non-readback mode */
72#define TCTR_MODE_0 0x00000000
73#define TCTR_MODE_2 0x04000000
74#define TCTR_MODE_4 0x08000000
75#define TCTR_MODE_5 0x0a000000
76#define TCTR_RL_LATCH 0x00000000
77#define TCTR_RL_RW_LOW8 0x10000000
78#define TCTR_RL_RW_HIGH8 0x20000000
79#define TCTR_RL_RW_LH8 0x30000000
80#define TCTR_SC_CTR0 0x00000000
81#define TCTR_SC_CTR1 0x40000000
82#define TCTR_SC_CTR2 0x80000000
83
84/* timer control register - readback mode */
85#define TCTR_CNT0 0x02000000
86#define TCTR_CNT1 0x04000000
87#define TCTR_CNT2 0x08000000
88#define TCTR_NSTATUS 0x10000000
89#define TCTR_NCOUNT 0x20000000
90#define TCTR_SC_READBACK 0xc0000000
91
92/* timer control status registers - non-readback mode */
93#define TCSRx_DATA 0xff000000
94
95/* timer control status registers - readback mode */
96#define TCSRx_OUTPUT 0x80000000
97#define TCSRx_NULLCOUNT 0x40000000
98#define TCSRx_RL 0x30000000
99#define TCSRx_MODE 0x07000000
100
101/* timer clock select registers */
102#define TxCKSL_SELECT 0x0f000000
103#define __TxCKSL_SELECT(X) ((X) << 24)
104#define TxCKSL_EIGHT 0xf0000000
105
106#endif /* _ASM_TIMER_REGS_H */
diff --git a/include/asm-frv/timex.h b/include/asm-frv/timex.h
deleted file mode 100644
index a89bddefdacf..000000000000
--- a/include/asm-frv/timex.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/* timex.h: FR-V architecture timex specifications
2 */
3#ifndef _ASM_TIMEX_H
4#define _ASM_TIMEX_H
5
6#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
7#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
8
9typedef unsigned long cycles_t;
10
11static inline cycles_t get_cycles(void)
12{
13 return 0;
14}
15
16#define vxtime_lock() do {} while (0)
17#define vxtime_unlock() do {} while (0)
18
19#endif
20
diff --git a/include/asm-frv/tlb.h b/include/asm-frv/tlb.h
deleted file mode 100644
index cd458eb6d75e..000000000000
--- a/include/asm-frv/tlb.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef _ASM_TLB_H
2#define _ASM_TLB_H
3
4#include <asm/tlbflush.h>
5
6#ifdef CONFIG_MMU
7extern void check_pgt_cache(void);
8#else
9#define check_pgt_cache() do {} while(0)
10#endif
11
12/*
13 * we don't need any special per-pte or per-vma handling...
14 */
15#define tlb_start_vma(tlb, vma) do { } while (0)
16#define tlb_end_vma(tlb, vma) do { } while (0)
17#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
18
19/*
20 * .. because we flush the whole mm when it fills up
21 */
22#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
23
24#include <asm-generic/tlb.h>
25
26#endif /* _ASM_TLB_H */
27
diff --git a/include/asm-frv/tlbflush.h b/include/asm-frv/tlbflush.h
deleted file mode 100644
index 7ac5eafc5d98..000000000000
--- a/include/asm-frv/tlbflush.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/* tlbflush.h: TLB flushing functions
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_TLBFLUSH_H
13#define _ASM_TLBFLUSH_H
14
15#include <linux/mm.h>
16#include <asm/processor.h>
17
18#ifdef CONFIG_MMU
19
20#ifndef __ASSEMBLY__
21extern void asmlinkage __flush_tlb_all(void);
22extern void asmlinkage __flush_tlb_mm(unsigned long contextid);
23extern void asmlinkage __flush_tlb_page(unsigned long contextid, unsigned long start);
24extern void asmlinkage __flush_tlb_range(unsigned long contextid,
25 unsigned long start, unsigned long end);
26#endif /* !__ASSEMBLY__ */
27
28#define flush_tlb_all() \
29do { \
30 preempt_disable(); \
31 __flush_tlb_all(); \
32 preempt_enable(); \
33} while(0)
34
35#define flush_tlb_mm(mm) \
36do { \
37 preempt_disable(); \
38 __flush_tlb_mm((mm)->context.id); \
39 preempt_enable(); \
40} while(0)
41
42#define flush_tlb_range(vma,start,end) \
43do { \
44 preempt_disable(); \
45 __flush_tlb_range((vma)->vm_mm->context.id, start, end); \
46 preempt_enable(); \
47} while(0)
48
49#define flush_tlb_page(vma,addr) \
50do { \
51 preempt_disable(); \
52 __flush_tlb_page((vma)->vm_mm->context.id, addr); \
53 preempt_enable(); \
54} while(0)
55
56
57#define __flush_tlb_global() flush_tlb_all()
58#define flush_tlb() flush_tlb_all()
59#define flush_tlb_kernel_range(start, end) flush_tlb_all()
60
61#else
62
63#define flush_tlb() BUG()
64#define flush_tlb_all() BUG()
65#define flush_tlb_mm(mm) BUG()
66#define flush_tlb_page(vma,addr) BUG()
67#define flush_tlb_range(mm,start,end) BUG()
68#define flush_tlb_kernel_range(start, end) BUG()
69
70#endif
71
72
73#endif /* _ASM_TLBFLUSH_H */
diff --git a/include/asm-frv/topology.h b/include/asm-frv/topology.h
deleted file mode 100644
index 942724352705..000000000000
--- a/include/asm-frv/topology.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_TOPOLOGY_H
2#define _ASM_TOPOLOGY_H
3
4#ifdef CONFIG_NUMA
5
6#error NUMA not supported yet
7
8#endif /* CONFIG_NUMA */
9
10#include <asm-generic/topology.h>
11
12#endif /* _ASM_TOPOLOGY_H */
diff --git a/include/asm-frv/types.h b/include/asm-frv/types.h
deleted file mode 100644
index 613bf1e962f0..000000000000
--- a/include/asm-frv/types.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/* types.h: FRV types
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_TYPES_H
13#define _ASM_TYPES_H
14
15#include <asm-generic/int-ll64.h>
16
17#ifndef __ASSEMBLY__
18
19typedef unsigned short umode_t;
20
21#endif /* __ASSEMBLY__ */
22
23/*
24 * These aren't exported outside the kernel to avoid name space clashes
25 */
26#ifdef __KERNEL__
27
28#define BITS_PER_LONG 32
29
30#ifndef __ASSEMBLY__
31
32/* Dma addresses are 32-bits wide. */
33
34typedef u32 dma_addr_t;
35
36#endif /* __ASSEMBLY__ */
37
38#endif /* __KERNEL__ */
39
40#endif /* _ASM_TYPES_H */
diff --git a/include/asm-frv/uaccess.h b/include/asm-frv/uaccess.h
deleted file mode 100644
index 53650c958f41..000000000000
--- a/include/asm-frv/uaccess.h
+++ /dev/null
@@ -1,321 +0,0 @@
1/* uaccess.h: userspace accessor functions
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_UACCESS_H
13#define _ASM_UACCESS_H
14
15/*
16 * User space memory access functions
17 */
18#include <linux/sched.h>
19#include <linux/mm.h>
20#include <asm/segment.h>
21#include <asm/sections.h>
22
23#define HAVE_ARCH_UNMAPPED_AREA /* we decide where to put mmaps */
24
25#define __ptr(x) ((unsigned long __force *)(x))
26
27#define VERIFY_READ 0
28#define VERIFY_WRITE 1
29
30#define __addr_ok(addr) ((unsigned long)(addr) < get_addr_limit())
31
32/*
33 * check that a range of addresses falls within the current address limit
34 */
35static inline int ___range_ok(unsigned long addr, unsigned long size)
36{
37#ifdef CONFIG_MMU
38 int flag = -EFAULT, tmp;
39
40 asm volatile (
41 " addcc %3,%2,%1,icc0 \n" /* set C-flag if addr+size>4GB */
42 " subcc.p %1,%4,gr0,icc1 \n" /* jump if addr+size>limit */
43 " bc icc0,#0,0f \n"
44 " bhi icc1,#0,0f \n"
45 " setlos #0,%0 \n" /* mark okay */
46 "0: \n"
47 : "=r"(flag), "=&r"(tmp)
48 : "r"(addr), "r"(size), "r"(get_addr_limit()), "0"(flag)
49 );
50
51 return flag;
52
53#else
54
55 if (addr < memory_start ||
56 addr > memory_end ||
57 size > memory_end - memory_start ||
58 addr + size > memory_end)
59 return -EFAULT;
60
61 return 0;
62#endif
63}
64
65#define __range_ok(addr,size) ___range_ok((unsigned long) (addr), (unsigned long) (size))
66
67#define access_ok(type,addr,size) (__range_ok((void __user *)(addr), (size)) == 0)
68#define __access_ok(addr,size) (__range_ok((addr), (size)) == 0)
69
70/*
71 * The exception table consists of pairs of addresses: the first is the
72 * address of an instruction that is allowed to fault, and the second is
73 * the address at which the program should continue. No registers are
74 * modified, so it is entirely up to the continuation code to figure out
75 * what to do.
76 *
77 * All the routines below use bits of fixup code that are out of line
78 * with the main instruction path. This means when everything is well,
79 * we don't even have to jump over them. Further, they do not intrude
80 * on our cache or tlb entries.
81 */
82struct exception_table_entry
83{
84 unsigned long insn, fixup;
85};
86
87/* Returns 0 if exception not found and fixup otherwise. */
88extern unsigned long search_exception_table(unsigned long);
89
90
91/*
92 * These are the main single-value transfer routines. They automatically
93 * use the right size if we just have the right pointer type.
94 */
95#define __put_user(x, ptr) \
96({ \
97 int __pu_err = 0; \
98 \
99 typeof(*(ptr)) __pu_val = (x); \
100 __chk_user_ptr(ptr); \
101 \
102 switch (sizeof (*(ptr))) { \
103 case 1: \
104 __put_user_asm(__pu_err, __pu_val, ptr, "b", "r"); \
105 break; \
106 case 2: \
107 __put_user_asm(__pu_err, __pu_val, ptr, "h", "r"); \
108 break; \
109 case 4: \
110 __put_user_asm(__pu_err, __pu_val, ptr, "", "r"); \
111 break; \
112 case 8: \
113 __put_user_asm(__pu_err, __pu_val, ptr, "d", "e"); \
114 break; \
115 default: \
116 __pu_err = __put_user_bad(); \
117 break; \
118 } \
119 __pu_err; \
120})
121
122#define put_user(x, ptr) \
123({ \
124 typeof(*(ptr)) __user *_p = (ptr); \
125 int _e; \
126 \
127 _e = __range_ok(_p, sizeof(*_p)); \
128 if (_e == 0) \
129 _e = __put_user((x), _p); \
130 _e; \
131})
132
133extern int __put_user_bad(void);
134
135/*
136 * Tell gcc we read from memory instead of writing: this is because
137 * we do not write to any memory gcc knows about, so there are no
138 * aliasing issues.
139 */
140
141#ifdef CONFIG_MMU
142
143#define __put_user_asm(err,x,ptr,dsize,constraint) \
144do { \
145 asm volatile("1: st"dsize"%I1 %2,%M1 \n" \
146 "2: \n" \
147 ".subsection 2 \n" \
148 "3: setlos %3,%0 \n" \
149 " bra 2b \n" \
150 ".previous \n" \
151 ".section __ex_table,\"a\" \n" \
152 " .balign 8 \n" \
153 " .long 1b,3b \n" \
154 ".previous" \
155 : "=r" (err) \
156 : "m" (*__ptr(ptr)), constraint (x), "i"(-EFAULT), "0"(err) \
157 : "memory"); \
158} while (0)
159
160#else
161
162#define __put_user_asm(err,x,ptr,bwl,con) \
163do { \
164 asm(" st"bwl"%I0 %1,%M0 \n" \
165 " membar \n" \
166 : \
167 : "m" (*__ptr(ptr)), con (x) \
168 : "memory"); \
169} while (0)
170
171#endif
172
173/*****************************************************************************/
174/*
175 *
176 */
177#define __get_user(x, ptr) \
178({ \
179 int __gu_err = 0; \
180 __chk_user_ptr(ptr); \
181 \
182 switch (sizeof(*(ptr))) { \
183 case 1: { \
184 unsigned char __gu_val; \
185 __get_user_asm(__gu_err, __gu_val, ptr, "ub", "=r"); \
186 (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \
187 break; \
188 } \
189 case 2: { \
190 unsigned short __gu_val; \
191 __get_user_asm(__gu_err, __gu_val, ptr, "uh", "=r"); \
192 (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \
193 break; \
194 } \
195 case 4: { \
196 unsigned int __gu_val; \
197 __get_user_asm(__gu_err, __gu_val, ptr, "", "=r"); \
198 (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \
199 break; \
200 } \
201 case 8: { \
202 unsigned long long __gu_val; \
203 __get_user_asm(__gu_err, __gu_val, ptr, "d", "=e"); \
204 (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \
205 break; \
206 } \
207 default: \
208 __gu_err = __get_user_bad(); \
209 break; \
210 } \
211 __gu_err; \
212})
213
214#define get_user(x, ptr) \
215({ \
216 const typeof(*(ptr)) __user *_p = (ptr);\
217 int _e; \
218 \
219 _e = __range_ok(_p, sizeof(*_p)); \
220 if (likely(_e == 0)) \
221 _e = __get_user((x), _p); \
222 else \
223 (x) = (typeof(x)) 0; \
224 _e; \
225})
226
227extern int __get_user_bad(void);
228
229#ifdef CONFIG_MMU
230
231#define __get_user_asm(err,x,ptr,dtype,constraint) \
232do { \
233 asm("1: ld"dtype"%I2 %M2,%1 \n" \
234 "2: \n" \
235 ".subsection 2 \n" \
236 "3: setlos %3,%0 \n" \
237 " setlos #0,%1 \n" \
238 " bra 2b \n" \
239 ".previous \n" \
240 ".section __ex_table,\"a\" \n" \
241 " .balign 8 \n" \
242 " .long 1b,3b \n" \
243 ".previous" \
244 : "=r" (err), constraint (x) \
245 : "m" (*__ptr(ptr)), "i"(-EFAULT), "0"(err) \
246 ); \
247} while(0)
248
249#else
250
251#define __get_user_asm(err,x,ptr,bwl,con) \
252 asm(" ld"bwl"%I1 %M1,%0 \n" \
253 " membar \n" \
254 : con(x) \
255 : "m" (*__ptr(ptr)))
256
257#endif
258
259/*****************************************************************************/
260/*
261 *
262 */
263#define ____force(x) (__force void *)(void __user *)(x)
264#ifdef CONFIG_MMU
265extern long __memset_user(void *dst, unsigned long count);
266extern long __memcpy_user(void *dst, const void *src, unsigned long count);
267
268#define clear_user(dst,count) __memset_user(____force(dst), (count))
269#define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n))
270#define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n))
271
272#else
273
274#define clear_user(dst,count) (memset(____force(dst), 0, (count)), 0)
275#define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0)
276#define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0)
277
278#endif
279
280#define __clear_user clear_user
281
282static inline unsigned long __must_check
283__copy_to_user(void __user *to, const void *from, unsigned long n)
284{
285 might_sleep();
286 return __copy_to_user_inatomic(to, from, n);
287}
288
289static inline unsigned long
290__copy_from_user(void *to, const void __user *from, unsigned long n)
291{
292 might_sleep();
293 return __copy_from_user_inatomic(to, from, n);
294}
295
296static inline long copy_from_user(void *to, const void __user *from, unsigned long n)
297{
298 unsigned long ret = n;
299
300 if (likely(__access_ok(from, n)))
301 ret = __copy_from_user(to, from, n);
302
303 if (unlikely(ret != 0))
304 memset(to + (n - ret), 0, ret);
305
306 return ret;
307}
308
309static inline long copy_to_user(void __user *to, const void *from, unsigned long n)
310{
311 return likely(__access_ok(to, n)) ? __copy_to_user(to, from, n) : n;
312}
313
314extern long strncpy_from_user(char *dst, const char __user *src, long count);
315extern long strnlen_user(const char __user *src, long count);
316
317#define strlen_user(str) strnlen_user(str, 32767)
318
319extern unsigned long search_exception_table(unsigned long addr);
320
321#endif /* _ASM_UACCESS_H */
diff --git a/include/asm-frv/ucontext.h b/include/asm-frv/ucontext.h
deleted file mode 100644
index 8d8c0c948007..000000000000
--- a/include/asm-frv/ucontext.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_UCONTEXT_H
2#define _ASM_UCONTEXT_H
3
4struct ucontext {
5 unsigned long uc_flags;
6 struct ucontext *uc_link;
7 stack_t uc_stack;
8 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask; /* mask last for extensibility */
10};
11
12#endif
diff --git a/include/asm-frv/unaligned.h b/include/asm-frv/unaligned.h
deleted file mode 100644
index 6c61c05b2e0c..000000000000
--- a/include/asm-frv/unaligned.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* unaligned.h: unaligned access handler
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_UNALIGNED_H
13#define _ASM_UNALIGNED_H
14
15#include <linux/unaligned/le_byteshift.h>
16#include <linux/unaligned/be_struct.h>
17#include <linux/unaligned/generic.h>
18
19#define get_unaligned __get_unaligned_be
20#define put_unaligned __put_unaligned_be
21
22#endif /* _ASM_UNALIGNED_H */
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
deleted file mode 100644
index edcfaf5f0414..000000000000
--- a/include/asm-frv/unistd.h
+++ /dev/null
@@ -1,382 +0,0 @@
1#ifndef _ASM_UNISTD_H_
2#define _ASM_UNISTD_H_
3
4/*
5 * This file contains the system call numbers.
6 */
7
8#define __NR_restart_syscall 0
9#define __NR_exit 1
10#define __NR_fork 2
11#define __NR_read 3
12#define __NR_write 4
13#define __NR_open 5
14#define __NR_close 6
15#define __NR_waitpid 7
16#define __NR_creat 8
17#define __NR_link 9
18#define __NR_unlink 10
19#define __NR_execve 11
20#define __NR_chdir 12
21#define __NR_time 13
22#define __NR_mknod 14
23#define __NR_chmod 15
24#define __NR_lchown 16
25#define __NR_break 17
26#define __NR_oldstat 18
27#define __NR_lseek 19
28#define __NR_getpid 20
29#define __NR_mount 21
30#define __NR_umount 22
31#define __NR_setuid 23
32#define __NR_getuid 24
33#define __NR_stime 25
34#define __NR_ptrace 26
35#define __NR_alarm 27
36#define __NR_oldfstat 28
37#define __NR_pause 29
38#define __NR_utime 30
39#define __NR_stty 31
40#define __NR_gtty 32
41#define __NR_access 33
42#define __NR_nice 34
43#define __NR_ftime 35
44#define __NR_sync 36
45#define __NR_kill 37
46#define __NR_rename 38
47#define __NR_mkdir 39
48#define __NR_rmdir 40
49#define __NR_dup 41
50#define __NR_pipe 42
51#define __NR_times 43
52#define __NR_prof 44
53#define __NR_brk 45
54#define __NR_setgid 46
55#define __NR_getgid 47
56#define __NR_signal 48
57#define __NR_geteuid 49
58#define __NR_getegid 50
59#define __NR_acct 51
60#define __NR_umount2 52
61#define __NR_lock 53
62#define __NR_ioctl 54
63#define __NR_fcntl 55
64#define __NR_mpx 56
65#define __NR_setpgid 57
66#define __NR_ulimit 58
67// #define __NR_oldolduname /* 59 */ obsolete
68#define __NR_umask 60
69#define __NR_chroot 61
70#define __NR_ustat 62
71#define __NR_dup2 63
72#define __NR_getppid 64
73#define __NR_getpgrp 65
74#define __NR_setsid 66
75#define __NR_sigaction 67
76#define __NR_sgetmask 68
77#define __NR_ssetmask 69
78#define __NR_setreuid 70
79#define __NR_setregid 71
80#define __NR_sigsuspend 72
81#define __NR_sigpending 73
82#define __NR_sethostname 74
83#define __NR_setrlimit 75
84#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
85#define __NR_getrusage 77
86#define __NR_gettimeofday 78
87#define __NR_settimeofday 79
88#define __NR_getgroups 80
89#define __NR_setgroups 81
90#define __NR_select 82
91#define __NR_symlink 83
92#define __NR_oldlstat 84
93#define __NR_readlink 85
94#define __NR_uselib 86
95#define __NR_swapon 87
96#define __NR_reboot 88
97#define __NR_readdir 89
98// #define __NR_mmap 90 /* obsolete - not implemented */
99#define __NR_munmap 91
100#define __NR_truncate 92
101#define __NR_ftruncate 93
102#define __NR_fchmod 94
103#define __NR_fchown 95
104#define __NR_getpriority 96
105#define __NR_setpriority 97
106// #define __NR_profil /* 98 */ obsolete
107#define __NR_statfs 99
108#define __NR_fstatfs 100
109// #define __NR_ioperm /* 101 */ not supported
110#define __NR_socketcall 102
111#define __NR_syslog 103
112#define __NR_setitimer 104
113#define __NR_getitimer 105
114#define __NR_stat 106
115#define __NR_lstat 107
116#define __NR_fstat 108
117// #define __NR_olduname /* 109 */ obsolete
118// #define __NR_iopl /* 110 */ not supported
119#define __NR_vhangup 111
120// #define __NR_idle /* 112 */ Obsolete
121// #define __NR_vm86old /* 113 */ not supported
122#define __NR_wait4 114
123#define __NR_swapoff 115
124#define __NR_sysinfo 116
125#define __NR_ipc 117
126#define __NR_fsync 118
127#define __NR_sigreturn 119
128#define __NR_clone 120
129#define __NR_setdomainname 121
130#define __NR_uname 122
131// #define __NR_modify_ldt /* 123 */ not supported
132#define __NR_cacheflush 123
133#define __NR_adjtimex 124
134#define __NR_mprotect 125
135#define __NR_sigprocmask 126
136#define __NR_create_module 127
137#define __NR_init_module 128
138#define __NR_delete_module 129
139#define __NR_get_kernel_syms 130
140#define __NR_quotactl 131
141#define __NR_getpgid 132
142#define __NR_fchdir 133
143#define __NR_bdflush 134
144#define __NR_sysfs 135
145#define __NR_personality 136
146#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
147#define __NR_setfsuid 138
148#define __NR_setfsgid 139
149#define __NR__llseek 140
150#define __NR_getdents 141
151#define __NR__newselect 142
152#define __NR_flock 143
153#define __NR_msync 144
154#define __NR_readv 145
155#define __NR_writev 146
156#define __NR_getsid 147
157#define __NR_fdatasync 148
158#define __NR__sysctl 149
159#define __NR_mlock 150
160#define __NR_munlock 151
161#define __NR_mlockall 152
162#define __NR_munlockall 153
163#define __NR_sched_setparam 154
164#define __NR_sched_getparam 155
165#define __NR_sched_setscheduler 156
166#define __NR_sched_getscheduler 157
167#define __NR_sched_yield 158
168#define __NR_sched_get_priority_max 159
169#define __NR_sched_get_priority_min 160
170#define __NR_sched_rr_get_interval 161
171#define __NR_nanosleep 162
172#define __NR_mremap 163
173#define __NR_setresuid 164
174#define __NR_getresuid 165
175// #define __NR_vm86 /* 166 */ not supported
176#define __NR_query_module 167
177#define __NR_poll 168
178#define __NR_nfsservctl 169
179#define __NR_setresgid 170
180#define __NR_getresgid 171
181#define __NR_prctl 172
182#define __NR_rt_sigreturn 173
183#define __NR_rt_sigaction 174
184#define __NR_rt_sigprocmask 175
185#define __NR_rt_sigpending 176
186#define __NR_rt_sigtimedwait 177
187#define __NR_rt_sigqueueinfo 178
188#define __NR_rt_sigsuspend 179
189#define __NR_pread64 180
190#define __NR_pwrite64 181
191#define __NR_chown 182
192#define __NR_getcwd 183
193#define __NR_capget 184
194#define __NR_capset 185
195#define __NR_sigaltstack 186
196#define __NR_sendfile 187
197#define __NR_getpmsg 188 /* some people actually want streams */
198#define __NR_putpmsg 189 /* some people actually want streams */
199#define __NR_vfork 190
200#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
201#define __NR_mmap2 192
202#define __NR_truncate64 193
203#define __NR_ftruncate64 194
204#define __NR_stat64 195
205#define __NR_lstat64 196
206#define __NR_fstat64 197
207#define __NR_lchown32 198
208#define __NR_getuid32 199
209#define __NR_getgid32 200
210#define __NR_geteuid32 201
211#define __NR_getegid32 202
212#define __NR_setreuid32 203
213#define __NR_setregid32 204
214#define __NR_getgroups32 205
215#define __NR_setgroups32 206
216#define __NR_fchown32 207
217#define __NR_setresuid32 208
218#define __NR_getresuid32 209
219#define __NR_setresgid32 210
220#define __NR_getresgid32 211
221#define __NR_chown32 212
222#define __NR_setuid32 213
223#define __NR_setgid32 214
224#define __NR_setfsuid32 215
225#define __NR_setfsgid32 216
226#define __NR_pivot_root 217
227#define __NR_mincore 218
228#define __NR_madvise 219
229
230#define __NR_getdents64 220
231#define __NR_fcntl64 221
232#define __NR_security 223 /* syscall for security modules */
233#define __NR_gettid 224
234#define __NR_readahead 225
235#define __NR_setxattr 226
236#define __NR_lsetxattr 227
237#define __NR_fsetxattr 228
238#define __NR_getxattr 229
239#define __NR_lgetxattr 230
240#define __NR_fgetxattr 231
241#define __NR_listxattr 232
242#define __NR_llistxattr 233
243#define __NR_flistxattr 234
244#define __NR_removexattr 235
245#define __NR_lremovexattr 236
246#define __NR_fremovexattr 237
247#define __NR_tkill 238
248#define __NR_sendfile64 239
249#define __NR_futex 240
250#define __NR_sched_setaffinity 241
251#define __NR_sched_getaffinity 242
252#define __NR_set_thread_area 243
253#define __NR_get_thread_area 244
254#define __NR_io_setup 245
255#define __NR_io_destroy 246
256#define __NR_io_getevents 247
257#define __NR_io_submit 248
258#define __NR_io_cancel 249
259#define __NR_fadvise64 250
260
261#define __NR_exit_group 252
262#define __NR_lookup_dcookie 253
263#define __NR_epoll_create 254
264#define __NR_epoll_ctl 255
265#define __NR_epoll_wait 256
266#define __NR_remap_file_pages 257
267#define __NR_set_tid_address 258
268#define __NR_timer_create 259
269#define __NR_timer_settime (__NR_timer_create+1)
270#define __NR_timer_gettime (__NR_timer_create+2)
271#define __NR_timer_getoverrun (__NR_timer_create+3)
272#define __NR_timer_delete (__NR_timer_create+4)
273#define __NR_clock_settime (__NR_timer_create+5)
274#define __NR_clock_gettime (__NR_timer_create+6)
275#define __NR_clock_getres (__NR_timer_create+7)
276#define __NR_clock_nanosleep (__NR_timer_create+8)
277#define __NR_statfs64 268
278#define __NR_fstatfs64 269
279#define __NR_tgkill 270
280#define __NR_utimes 271
281#define __NR_fadvise64_64 272
282#define __NR_vserver 273
283#define __NR_mbind 274
284#define __NR_get_mempolicy 275
285#define __NR_set_mempolicy 276
286#define __NR_mq_open 277
287#define __NR_mq_unlink (__NR_mq_open+1)
288#define __NR_mq_timedsend (__NR_mq_open+2)
289#define __NR_mq_timedreceive (__NR_mq_open+3)
290#define __NR_mq_notify (__NR_mq_open+4)
291#define __NR_mq_getsetattr (__NR_mq_open+5)
292#define __NR_kexec_load 283
293#define __NR_waitid 284
294/* #define __NR_sys_setaltroot 285 */
295#define __NR_add_key 286
296#define __NR_request_key 287
297#define __NR_keyctl 288
298#define __NR_ioprio_set 289
299#define __NR_ioprio_get 290
300#define __NR_inotify_init 291
301#define __NR_inotify_add_watch 292
302#define __NR_inotify_rm_watch 293
303#define __NR_migrate_pages 294
304#define __NR_openat 295
305#define __NR_mkdirat 296
306#define __NR_mknodat 297
307#define __NR_fchownat 298
308#define __NR_futimesat 299
309#define __NR_fstatat64 300
310#define __NR_unlinkat 301
311#define __NR_renameat 302
312#define __NR_linkat 303
313#define __NR_symlinkat 304
314#define __NR_readlinkat 305
315#define __NR_fchmodat 306
316#define __NR_faccessat 307
317#define __NR_pselect6 308
318#define __NR_ppoll 309
319#define __NR_unshare 310
320#define __NR_set_robust_list 311
321#define __NR_get_robust_list 312
322#define __NR_splice 313
323#define __NR_sync_file_range 314
324#define __NR_tee 315
325#define __NR_vmsplice 316
326#define __NR_move_pages 317
327#define __NR_getcpu 318
328#define __NR_epoll_pwait 319
329#define __NR_utimensat 320
330#define __NR_signalfd 321
331#define __NR_timerfd_create 322
332#define __NR_eventfd 323
333#define __NR_fallocate 324
334#define __NR_timerfd_settime 325
335#define __NR_timerfd_gettime 326
336#define __NR_signalfd4 327
337#define __NR_eventfd2 328
338#define __NR_epoll_create1 329
339#define __NR_dup3 330
340#define __NR_pipe2 331
341#define __NR_inotify_init1 332
342
343#ifdef __KERNEL__
344
345#define NR_syscalls 333
346
347#define __ARCH_WANT_IPC_PARSE_VERSION
348/* #define __ARCH_WANT_OLD_READDIR */
349#define __ARCH_WANT_OLD_STAT
350#define __ARCH_WANT_STAT64
351#define __ARCH_WANT_SYS_ALARM
352/* #define __ARCH_WANT_SYS_GETHOSTNAME */
353#define __ARCH_WANT_SYS_PAUSE
354/* #define __ARCH_WANT_SYS_SGETMASK */
355/* #define __ARCH_WANT_SYS_SIGNAL */
356#define __ARCH_WANT_SYS_TIME
357#define __ARCH_WANT_SYS_UTIME
358#define __ARCH_WANT_SYS_WAITPID
359#define __ARCH_WANT_SYS_SOCKETCALL
360#define __ARCH_WANT_SYS_FADVISE64
361#define __ARCH_WANT_SYS_GETPGRP
362#define __ARCH_WANT_SYS_LLSEEK
363#define __ARCH_WANT_SYS_NICE
364/* #define __ARCH_WANT_SYS_OLD_GETRLIMIT */
365#define __ARCH_WANT_SYS_OLDUMOUNT
366/* #define __ARCH_WANT_SYS_SIGPENDING */
367#define __ARCH_WANT_SYS_SIGPROCMASK
368#define __ARCH_WANT_SYS_RT_SIGACTION
369#define __ARCH_WANT_SYS_RT_SIGSUSPEND
370
371/*
372 * "Conditional" syscalls
373 *
374 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
375 * but it doesn't work on all toolchains, so we just do it by hand
376 */
377#ifndef cond_syscall
378#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
379#endif
380
381#endif /* __KERNEL__ */
382#endif /* _ASM_UNISTD_H_ */
diff --git a/include/asm-frv/user.h b/include/asm-frv/user.h
deleted file mode 100644
index 82fa8fab64ae..000000000000
--- a/include/asm-frv/user.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/* user.h: FR-V core file format stuff
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _ASM_USER_H
12#define _ASM_USER_H
13
14#include <asm/page.h>
15#include <asm/registers.h>
16
17/* Core file format: The core file is written in such a way that gdb
18 * can understand it and provide useful information to the user (under
19 * linux we use the 'trad-core' bfd). There are quite a number of
20 * obstacles to being able to view the contents of the floating point
21 * registers, and until these are solved you will not be able to view
22 * the contents of them. Actually, you can read in the core file and
23 * look at the contents of the user struct to find out what the
24 * floating point registers contain.
25 *
26 * The actual file contents are as follows:
27 * UPAGE:
28 * 1 page consisting of a user struct that tells gdb what is present
29 * in the file. Directly after this is a copy of the task_struct,
30 * which is currently not used by gdb, but it may come in useful at
31 * some point. All of the registers are stored as part of the
32 * upage. The upage should always be only one page.
33 *
34 * DATA:
35 * The data area is stored. We use current->end_text to
36 * current->brk to pick up all of the user variables, plus any
37 * memory that may have been malloced. No attempt is made to
38 * determine if a page is demand-zero or if a page is totally
39 * unused, we just cover the entire range. All of the addresses are
40 * rounded in such a way that an integral number of pages is
41 * written.
42 *
43 * STACK:
44 * We need the stack information in order to get a meaningful
45 * backtrace. We need to write the data from (esp) to
46 * current->start_stack, so we round each of these off in order to
47 * be able to write an integer number of pages. The minimum core
48 * file size is 3 pages, or 12288 bytes.
49 */
50
51/* When the kernel dumps core, it starts by dumping the user struct -
52 * this will be used by gdb to figure out where the data and stack segments
53 * are within the file, and what virtual addresses to use.
54 */
55struct user {
56 /* We start with the registers, to mimic the way that "memory" is returned
57 * from the ptrace(3,...) function. */
58 struct user_context regs;
59
60 /* The rest of this junk is to help gdb figure out what goes where */
61 unsigned long u_tsize; /* Text segment size (pages). */
62 unsigned long u_dsize; /* Data segment size (pages). */
63 unsigned long u_ssize; /* Stack segment size (pages). */
64 unsigned long start_code; /* Starting virtual address of text. */
65 unsigned long start_stack; /* Starting virtual address of stack area.
66 * This is actually the bottom of the stack,
67 * the top of the stack is always found in the
68 * esp register. */
69 long int signal; /* Signal that caused the core dump. */
70
71 unsigned long magic; /* To uniquely identify a core file */
72 char u_comm[32]; /* User command that was responsible */
73};
74
75#define NBPG PAGE_SIZE
76#define UPAGES 1
77#define HOST_TEXT_START_ADDR (u.start_code)
78#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
79
80#endif
diff --git a/include/asm-frv/vga.h b/include/asm-frv/vga.h
deleted file mode 100644
index a702c800a229..000000000000
--- a/include/asm-frv/vga.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/* vga.h: VGA register stuff
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_VGA_H
13#define _ASM_VGA_H
14
15
16
17#endif /* _ASM_VGA_H */
diff --git a/include/asm-frv/virtconvert.h b/include/asm-frv/virtconvert.h
deleted file mode 100644
index 59788fa2a813..000000000000
--- a/include/asm-frv/virtconvert.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/* virtconvert.h: virtual/physical/page address convertion
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _ASM_VIRTCONVERT_H
12#define _ASM_VIRTCONVERT_H
13
14/*
15 * Macros used for converting between virtual and physical mappings.
16 */
17
18#ifdef __KERNEL__
19
20#include <asm/setup.h>
21
22#ifdef CONFIG_MMU
23
24#define phys_to_virt(vaddr) ((void *) ((unsigned long)(vaddr) + PAGE_OFFSET))
25#define virt_to_phys(vaddr) ((unsigned long) (vaddr) - PAGE_OFFSET)
26
27#else
28
29#define phys_to_virt(vaddr) ((void *) (vaddr))
30#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
31
32#endif
33
34#define virt_to_bus virt_to_phys
35#define bus_to_virt phys_to_virt
36
37#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT))
38#define page_to_phys(page) virt_to_phys((void *)__page_address(page))
39
40#endif
41#endif
diff --git a/include/asm-frv/xor.h b/include/asm-frv/xor.h
deleted file mode 100644
index c82eb12a5b18..000000000000
--- a/include/asm-frv/xor.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/xor.h>
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index 00f45ff081a6..b0e63c672ebd 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -80,56 +80,4 @@ extern void setup_per_cpu_areas(void);
80#define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \ 80#define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \
81 __typeof__(type) per_cpu_var(name) 81 __typeof__(type) per_cpu_var(name)
82 82
83/*
84 * Optional methods for optimized non-lvalue per-cpu variable access.
85 *
86 * @var can be a percpu variable or a field of it and its size should
87 * equal char, int or long. percpu_read() evaluates to a lvalue and
88 * all others to void.
89 *
90 * These operations are guaranteed to be atomic w.r.t. preemption.
91 * The generic versions use plain get/put_cpu_var(). Archs are
92 * encouraged to implement single-instruction alternatives which don't
93 * require preemption protection.
94 */
95#ifndef percpu_read
96# define percpu_read(var) \
97 ({ \
98 typeof(per_cpu_var(var)) __tmp_var__; \
99 __tmp_var__ = get_cpu_var(var); \
100 put_cpu_var(var); \
101 __tmp_var__; \
102 })
103#endif
104
105#define __percpu_generic_to_op(var, val, op) \
106do { \
107 get_cpu_var(var) op val; \
108 put_cpu_var(var); \
109} while (0)
110
111#ifndef percpu_write
112# define percpu_write(var, val) __percpu_generic_to_op(var, (val), =)
113#endif
114
115#ifndef percpu_add
116# define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=)
117#endif
118
119#ifndef percpu_sub
120# define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=)
121#endif
122
123#ifndef percpu_and
124# define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=)
125#endif
126
127#ifndef percpu_or
128# define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=)
129#endif
130
131#ifndef percpu_xor
132# define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=)
133#endif
134
135#endif /* _ASM_GENERIC_PERCPU_H_ */ 83#endif /* _ASM_GENERIC_PERCPU_H_ */
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 35752dadd6df..c840719a8c59 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -201,7 +201,7 @@ typedef struct siginfo {
201#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */ 201#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
202#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */ 202#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
203#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */ 203#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */
204#define NSIGTRAP 2 204#define NSIGTRAP 4
205 205
206/* 206/*
207 * SIGCHLD si_codes 207 * SIGCHLD si_codes
diff --git a/include/asm-mn10300/.gitignore b/include/asm-mn10300/.gitignore
deleted file mode 100644
index 0f87ba790e26..000000000000
--- a/include/asm-mn10300/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
1proc
2unit
diff --git a/include/asm-mn10300/Kbuild b/include/asm-mn10300/Kbuild
deleted file mode 100644
index c68e1680da01..000000000000
--- a/include/asm-mn10300/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1include include/asm-generic/Kbuild.asm
diff --git a/include/asm-mn10300/atomic.h b/include/asm-mn10300/atomic.h
deleted file mode 100644
index bc064825f9b1..000000000000
--- a/include/asm-mn10300/atomic.h
+++ /dev/null
@@ -1,157 +0,0 @@
1/* MN10300 Atomic counter operations
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_ATOMIC_H
12#define _ASM_ATOMIC_H
13
14#ifdef CONFIG_SMP
15#error not SMP safe
16#endif
17
18/*
19 * Atomic operations that C can't guarantee us. Useful for
20 * resource counting etc..
21 */
22
23#define ATOMIC_INIT(i) { (i) }
24
25#ifdef __KERNEL__
26
27/**
28 * atomic_read - read atomic variable
29 * @v: pointer of type atomic_t
30 *
31 * Atomically reads the value of @v. Note that the guaranteed
32 * useful range of an atomic_t is only 24 bits.
33 */
34#define atomic_read(v) ((v)->counter)
35
36/**
37 * atomic_set - set atomic variable
38 * @v: pointer of type atomic_t
39 * @i: required value
40 *
41 * Atomically sets the value of @v to @i. Note that the guaranteed
42 * useful range of an atomic_t is only 24 bits.
43 */
44#define atomic_set(v, i) (((v)->counter) = (i))
45
46#include <asm/system.h>
47
48/**
49 * atomic_add_return - add integer to atomic variable
50 * @i: integer value to add
51 * @v: pointer of type atomic_t
52 *
53 * Atomically adds @i to @v and returns the result
54 * Note that the guaranteed useful range of an atomic_t is only 24 bits.
55 */
56static inline int atomic_add_return(int i, atomic_t *v)
57{
58 unsigned long flags;
59 int temp;
60
61 local_irq_save(flags);
62 temp = v->counter;
63 temp += i;
64 v->counter = temp;
65 local_irq_restore(flags);
66
67 return temp;
68}
69
70/**
71 * atomic_sub_return - subtract integer from atomic variable
72 * @i: integer value to subtract
73 * @v: pointer of type atomic_t
74 *
75 * Atomically subtracts @i from @v and returns the result
76 * Note that the guaranteed useful range of an atomic_t is only 24 bits.
77 */
78static inline int atomic_sub_return(int i, atomic_t *v)
79{
80 unsigned long flags;
81 int temp;
82
83 local_irq_save(flags);
84 temp = v->counter;
85 temp -= i;
86 v->counter = temp;
87 local_irq_restore(flags);
88
89 return temp;
90}
91
92static inline int atomic_add_negative(int i, atomic_t *v)
93{
94 return atomic_add_return(i, v) < 0;
95}
96
97static inline void atomic_add(int i, atomic_t *v)
98{
99 atomic_add_return(i, v);
100}
101
102static inline void atomic_sub(int i, atomic_t *v)
103{
104 atomic_sub_return(i, v);
105}
106
107static inline void atomic_inc(atomic_t *v)
108{
109 atomic_add_return(1, v);
110}
111
112static inline void atomic_dec(atomic_t *v)
113{
114 atomic_sub_return(1, v);
115}
116
117#define atomic_dec_return(v) atomic_sub_return(1, (v))
118#define atomic_inc_return(v) atomic_add_return(1, (v))
119
120#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
121#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
122#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
123
124#define atomic_add_unless(v, a, u) \
125({ \
126 int c, old; \
127 c = atomic_read(v); \
128 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
129 c = old; \
130 c != (u); \
131})
132
133#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
134
135static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
136{
137 unsigned long flags;
138
139 mask = ~mask;
140 local_irq_save(flags);
141 *addr &= mask;
142 local_irq_restore(flags);
143}
144
145#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
146#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
147
148/* Atomic operations are already serializing on MN10300??? */
149#define smp_mb__before_atomic_dec() barrier()
150#define smp_mb__after_atomic_dec() barrier()
151#define smp_mb__before_atomic_inc() barrier()
152#define smp_mb__after_atomic_inc() barrier()
153
154#include <asm-generic/atomic.h>
155
156#endif /* __KERNEL__ */
157#endif /* _ASM_ATOMIC_H */
diff --git a/include/asm-mn10300/auxvec.h b/include/asm-mn10300/auxvec.h
deleted file mode 100644
index 4fdb60b2ae39..000000000000
--- a/include/asm-mn10300/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef _ASM_AUXVEC_H
2#define _ASM_AUXVEC_H
3
4#endif
diff --git a/include/asm-mn10300/bitops.h b/include/asm-mn10300/bitops.h
deleted file mode 100644
index 0b610f482abb..000000000000
--- a/include/asm-mn10300/bitops.h
+++ /dev/null
@@ -1,240 +0,0 @@
1/* MN10300 bit operations
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 *
11 * These have to be done with inline assembly: that way the bit-setting
12 * is guaranteed to be atomic. All bit operations return 0 if the bit
13 * was cleared before the operation and != 0 if it was not.
14 *
15 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
16 */
17#ifndef __ASM_BITOPS_H
18#define __ASM_BITOPS_H
19
20#include <asm/cpu-regs.h>
21
22#define smp_mb__before_clear_bit() barrier()
23#define smp_mb__after_clear_bit() barrier()
24
25/*
26 * set bit
27 */
28#define __set_bit(nr, addr) \
29({ \
30 volatile unsigned char *_a = (unsigned char *)(addr); \
31 const unsigned shift = (nr) & 7; \
32 _a += (nr) >> 3; \
33 \
34 asm volatile("bset %2,(%1) # set_bit reg" \
35 : "=m"(*_a) \
36 : "a"(_a), "d"(1 << shift), "m"(*_a) \
37 : "memory", "cc"); \
38})
39
40#define set_bit(nr, addr) __set_bit((nr), (addr))
41
42/*
43 * clear bit
44 */
45#define ___clear_bit(nr, addr) \
46({ \
47 volatile unsigned char *_a = (unsigned char *)(addr); \
48 const unsigned shift = (nr) & 7; \
49 _a += (nr) >> 3; \
50 \
51 asm volatile("bclr %2,(%1) # clear_bit reg" \
52 : "=m"(*_a) \
53 : "a"(_a), "d"(1 << shift), "m"(*_a) \
54 : "memory", "cc"); \
55})
56
57#define clear_bit(nr, addr) ___clear_bit((nr), (addr))
58
59
60static inline void __clear_bit(int nr, volatile void *addr)
61{
62 unsigned int *a = (unsigned int *) addr;
63 int mask;
64
65 a += nr >> 5;
66 mask = 1 << (nr & 0x1f);
67 *a &= ~mask;
68}
69
70/*
71 * test bit
72 */
73static inline int test_bit(int nr, const volatile void *addr)
74{
75 return 1UL & (((const unsigned int *) addr)[nr >> 5] >> (nr & 31));
76}
77
78/*
79 * change bit
80 */
81static inline void __change_bit(int nr, volatile void *addr)
82{
83 int mask;
84 unsigned int *a = (unsigned int *) addr;
85
86 a += nr >> 5;
87 mask = 1 << (nr & 0x1f);
88 *a ^= mask;
89}
90
91extern void change_bit(int nr, volatile void *addr);
92
93/*
94 * test and set bit
95 */
96#define __test_and_set_bit(nr,addr) \
97({ \
98 volatile unsigned char *_a = (unsigned char *)(addr); \
99 const unsigned shift = (nr) & 7; \
100 unsigned epsw; \
101 _a += (nr) >> 3; \
102 \
103 asm volatile("bset %3,(%2) # test_set_bit reg\n" \
104 "mov epsw,%1" \
105 : "=m"(*_a), "=d"(epsw) \
106 : "a"(_a), "d"(1 << shift), "m"(*_a) \
107 : "memory", "cc"); \
108 \
109 !(epsw & EPSW_FLAG_Z); \
110})
111
112#define test_and_set_bit(nr, addr) __test_and_set_bit((nr), (addr))
113
114/*
115 * test and clear bit
116 */
117#define __test_and_clear_bit(nr, addr) \
118({ \
119 volatile unsigned char *_a = (unsigned char *)(addr); \
120 const unsigned shift = (nr) & 7; \
121 unsigned epsw; \
122 _a += (nr) >> 3; \
123 \
124 asm volatile("bclr %3,(%2) # test_clear_bit reg\n" \
125 "mov epsw,%1" \
126 : "=m"(*_a), "=d"(epsw) \
127 : "a"(_a), "d"(1 << shift), "m"(*_a) \
128 : "memory", "cc"); \
129 \
130 !(epsw & EPSW_FLAG_Z); \
131})
132
133#define test_and_clear_bit(nr, addr) __test_and_clear_bit((nr), (addr))
134
135/*
136 * test and change bit
137 */
138static inline int __test_and_change_bit(int nr, volatile void *addr)
139{
140 int mask, retval;
141 unsigned int *a = (unsigned int *)addr;
142
143 a += nr >> 5;
144 mask = 1 << (nr & 0x1f);
145 retval = (mask & *a) != 0;
146 *a ^= mask;
147
148 return retval;
149}
150
151extern int test_and_change_bit(int nr, volatile void *addr);
152
153#include <asm-generic/bitops/lock.h>
154
155#ifdef __KERNEL__
156
157/**
158 * __ffs - find first bit set
159 * @x: the word to search
160 *
161 * - return 31..0 to indicate bit 31..0 most least significant bit set
162 * - if no bits are set in x, the result is undefined
163 */
164static inline __attribute__((const))
165unsigned long __ffs(unsigned long x)
166{
167 int bit;
168 asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(x & -x));
169 return bit;
170}
171
172/*
173 * special slimline version of fls() for calculating ilog2_u32()
174 * - note: no protection against n == 0
175 */
176static inline __attribute__((const))
177int __ilog2_u32(u32 n)
178{
179 int bit;
180 asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(n));
181 return bit;
182}
183
184/**
185 * fls - find last bit set
186 * @x: the word to search
187 *
188 * This is defined the same way as ffs:
189 * - return 32..1 to indicate bit 31..0 most significant bit set
190 * - return 0 to indicate no bits set
191 */
192static inline __attribute__((const))
193int fls(int x)
194{
195 return (x != 0) ? __ilog2_u32(x) + 1 : 0;
196}
197
198/**
199 * __fls - find last (most-significant) set bit in a long word
200 * @word: the word to search
201 *
202 * Undefined if no set bit exists, so code should check against 0 first.
203 */
204static inline unsigned long __fls(unsigned long word)
205{
206 return __ilog2_u32(word);
207}
208
209/**
210 * ffs - find first bit set
211 * @x: the word to search
212 *
213 * - return 32..1 to indicate bit 31..0 most least significant bit set
214 * - return 0 to indicate no bits set
215 */
216static inline __attribute__((const))
217int ffs(int x)
218{
219 /* Note: (x & -x) gives us a mask that is the least significant
220 * (rightmost) 1-bit of the value in x.
221 */
222 return fls(x & -x);
223}
224
225#include <asm-generic/bitops/ffz.h>
226#include <asm-generic/bitops/fls64.h>
227#include <asm-generic/bitops/find.h>
228#include <asm-generic/bitops/sched.h>
229#include <asm-generic/bitops/hweight.h>
230
231#define ext2_set_bit_atomic(lock, nr, addr) \
232 test_and_set_bit((nr) ^ 0x18, (addr))
233#define ext2_clear_bit_atomic(lock, nr, addr) \
234 test_and_clear_bit((nr) ^ 0x18, (addr))
235
236#include <asm-generic/bitops/ext2-non-atomic.h>
237#include <asm-generic/bitops/minix-le.h>
238
239#endif /* __KERNEL__ */
240#endif /* __ASM_BITOPS_H */
diff --git a/include/asm-mn10300/bug.h b/include/asm-mn10300/bug.h
deleted file mode 100644
index 4fcf3384e259..000000000000
--- a/include/asm-mn10300/bug.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/* MN10300 Kernel bug reporting
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_BUG_H
12#define _ASM_BUG_H
13
14/*
15 * Tell the user there is some problem.
16 */
17#define _debug_bug_trap() \
18do { \
19 asm volatile( \
20 " syscall 15 \n" \
21 "0: \n" \
22 " .section __bug_table,\"a\" \n" \
23 " .long 0b,%0,%1 \n" \
24 " .previous \n" \
25 : \
26 : "i"(__FILE__), "i"(__LINE__) \
27 ); \
28} while (0)
29
30#define BUG() _debug_bug_trap()
31
32#define HAVE_ARCH_BUG
33#include <asm-generic/bug.h>
34
35#endif /* _ASM_BUG_H */
diff --git a/include/asm-mn10300/bugs.h b/include/asm-mn10300/bugs.h
deleted file mode 100644
index 31c8bc592b47..000000000000
--- a/include/asm-mn10300/bugs.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/* MN10300 Checks for architecture-dependent bugs
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_BUGS_H
12#define _ASM_BUGS_H
13
14#include <asm/processor.h>
15
16static inline void __init check_bugs(void)
17{
18}
19
20#endif /* _ASM_BUGS_H */
diff --git a/include/asm-mn10300/busctl-regs.h b/include/asm-mn10300/busctl-regs.h
deleted file mode 100644
index 1632aef73401..000000000000
--- a/include/asm-mn10300/busctl-regs.h
+++ /dev/null
@@ -1,151 +0,0 @@
1/* AM33v2 on-board bus controller registers
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_BUSCTL_REGS_H
13#define _ASM_BUSCTL_REGS_H
14
15#include <asm/cpu-regs.h>
16
17#ifdef __KERNEL__
18
19/* bus controller registers */
20#define BCCR __SYSREG(0xc0002000, u32) /* bus controller control reg */
21#define BCCR_B0AD 0x00000003 /* block 0 (80000000-83ffffff) bus allocation */
22#define BCCR_B1AD 0x0000000c /* block 1 (84000000-87ffffff) bus allocation */
23#define BCCR_B2AD 0x00000030 /* block 2 (88000000-8bffffff) bus allocation */
24#define BCCR_B3AD 0x000000c0 /* block 3 (8c000000-8fffffff) bus allocation */
25#define BCCR_B4AD 0x00000300 /* block 4 (90000000-93ffffff) bus allocation */
26#define BCCR_B5AD 0x00000c00 /* block 5 (94000000-97ffffff) bus allocation */
27#define BCCR_B6AD 0x00003000 /* block 6 (98000000-9bffffff) bus allocation */
28#define BCCR_B7AD 0x0000c000 /* block 7 (9c000000-9fffffff) bus allocation */
29#define BCCR_BxAD_EXBUS 0x0 /* - direct to system bus controller */
30#define BCCR_BxAD_OPEXBUS 0x1 /* - direct to memory bus controller */
31#define BCCR_BxAD_OCMBUS 0x2 /* - direct to on chip memory */
32#define BCCR_API 0x00070000 /* bus arbitration priority */
33#define BCCR_API_DMACICD 0x00000000 /* - DMA > CI > CD */
34#define BCCR_API_DMACDCI 0x00010000 /* - DMA > CD > CI */
35#define BCCR_API_CICDDMA 0x00020000 /* - CI > CD > DMA */
36#define BCCR_API_CDCIDMA 0x00030000 /* - CD > CI > DMA */
37#define BCCR_API_ROUNDROBIN 0x00040000 /* - round robin */
38#define BCCR_BEPRI_DMACICD 0x00c00000 /* bus error address priority */
39#define BCCR_BEPRI_DMACDCI 0x00000000 /* - DMA > CI > CD */
40#define BCCR_BEPRI_CICDDMA 0x00400000 /* - DMA > CD > CI */
41#define BCCR_BEPRI_CDCIDMA 0x00800000 /* - CI > CD > DMA */
42#define BCCR_BEPRI 0x00c00000 /* - CD > CI > DMA */
43#define BCCR_TMON 0x03000000 /* timeout value settings */
44#define BCCR_TMON_16IOCLK 0x00000000 /* - 16 IOCLK cycles */
45#define BCCR_TMON_256IOCLK 0x01000000 /* - 256 IOCLK cycles */
46#define BCCR_TMON_4096IOCLK 0x02000000 /* - 4096 IOCLK cycles */
47#define BCCR_TMON_65536IOCLK 0x03000000 /* - 65536 IOCLK cycles */
48#define BCCR_TMOE 0x10000000 /* timeout detection enable */
49
50#define BCBERR __SYSREG(0xc0002010, u32) /* bus error source reg */
51#define BCBERR_BESB 0x0000001f /* erroneous access destination space */
52#define BCBERR_BESB_MON 0x00000001 /* - monitor space */
53#define BCBERR_BESB_IO 0x00000002 /* - IO bus */
54#define BCBERR_BESB_EX 0x00000004 /* - EX bus */
55#define BCBERR_BESB_OPEX 0x00000008 /* - OpEX bus */
56#define BCBERR_BESB_OCM 0x00000010 /* - on chip memory */
57#define BCBERR_BERW 0x00000100 /* type of access */
58#define BCBERR_BERW_WRITE 0x00000000 /* - write */
59#define BCBERR_BERW_READ 0x00000100 /* - read */
60#define BCBERR_BESD 0x00000200 /* error detector */
61#define BCBERR_BESD_BCU 0x00000000 /* - BCU detected error */
62#define BCBERR_BESD_SLAVE_BUS 0x00000200 /* - slave bus detected error */
63#define BCBERR_BEBST 0x00000400 /* type of access */
64#define BCBERR_BEBST_SINGLE 0x00000000 /* - single */
65#define BCBERR_BEBST_BURST 0x00000400 /* - burst */
66#define BCBERR_BEME 0x00000800 /* multiple bus error flag */
67#define BCBERR_BEMR 0x00007000 /* master bus that caused the error */
68#define BCBERR_BEMR_NOERROR 0x00000000 /* - no error */
69#define BCBERR_BEMR_CI 0x00001000 /* - CPU instruction fetch bus caused error */
70#define BCBERR_BEMR_CD 0x00002000 /* - CPU data bus caused error */
71#define BCBERR_BEMR_DMA 0x00004000 /* - DMA bus caused error */
72
73#define BCBEAR __SYSREGC(0xc0002020, u32) /* bus error address reg */
74
75/* system bus controller registers */
76#define SBBASE(X) __SYSREG(0xd8c00100 + (X) * 0x10, u32) /* SBC base addr regs */
77#define SBBASE_BE 0x00000001 /* bank enable */
78#define SBBASE_BAM 0x0000fffe /* bank address mask [31:17] */
79#define SBBASE_BBA 0xfffe0000 /* bank base address [31:17] */
80
81#define SBCNTRL0(X) __SYSREG(0xd8c00200 + (X) * 0x10, u32) /* SBC bank ctrl0 regs */
82#define SBCNTRL0_WEH 0x00000f00 /* write enable hold */
83#define SBCNTRL0_REH 0x0000f000 /* read enable hold */
84#define SBCNTRL0_RWH 0x000f0000 /* SRW signal hold */
85#define SBCNTRL0_CSH 0x00f00000 /* chip select hold */
86#define SBCNTRL0_DAH 0x0f000000 /* data hold */
87#define SBCNTRL0_ADH 0xf0000000 /* address hold */
88
89#define SBCNTRL1(X) __SYSREG(0xd8c00204 + (X) * 0x10, u32) /* SBC bank ctrl1 regs */
90#define SBCNTRL1_WED 0x00000f00 /* write enable delay */
91#define SBCNTRL1_RED 0x0000f000 /* read enable delay */
92#define SBCNTRL1_RWD 0x000f0000 /* SRW signal delay */
93#define SBCNTRL1_ASW 0x00f00000 /* address strobe width */
94#define SBCNTRL1_CSD 0x0f000000 /* chip select delay */
95#define SBCNTRL1_ASD 0xf0000000 /* address strobe delay */
96
97#define SBCNTRL2(X) __SYSREG(0xd8c00208 + (X) * 0x10, u32) /* SBC bank ctrl2 regs */
98#define SBCNTRL2_WC 0x000000ff /* wait count */
99#define SBCNTRL2_BWC 0x00000f00 /* burst wait count */
100#define SBCNTRL2_WM 0x01000000 /* wait mode setting */
101#define SBCNTRL2_WM_FIXEDWAIT 0x00000000 /* - fixed wait access */
102#define SBCNTRL2_WM_HANDSHAKE 0x01000000 /* - handshake access */
103#define SBCNTRL2_BM 0x02000000 /* bus synchronisation mode */
104#define SBCNTRL2_BM_SYNC 0x00000000 /* - synchronous mode */
105#define SBCNTRL2_BM_ASYNC 0x02000000 /* - asynchronous mode */
106#define SBCNTRL2_BW 0x04000000 /* bus width */
107#define SBCNTRL2_BW_32 0x00000000 /* - 32 bits */
108#define SBCNTRL2_BW_16 0x04000000 /* - 16 bits */
109#define SBCNTRL2_RWINV 0x08000000 /* R/W signal invert polarity */
110#define SBCNTRL2_RWINV_NORM 0x00000000 /* - normal (read high) */
111#define SBCNTRL2_RWINV_INV 0x08000000 /* - inverted (read low) */
112#define SBCNTRL2_BT 0x70000000 /* bus type setting */
113#define SBCNTRL2_BT_SRAM 0x00000000 /* - SRAM interface */
114#define SBCNTRL2_BT_ADMUX 0x00000000 /* - addr/data multiplexed interface */
115#define SBCNTRL2_BT_BROM 0x00000000 /* - burst ROM interface */
116#define SBCNTRL2_BTSE 0x80000000 /* burst enable */
117
118/* memory bus controller */
119#define SDBASE(X) __SYSREG(0xda000008 + (X) * 0x4, u32) /* MBC base addr regs */
120#define SDBASE_CE 0x00000001 /* chip enable */
121#define SDBASE_CBAM 0x0000fff0 /* chip base address mask [31:20] */
122#define SDBASE_CBAM_SHIFT 16
123#define SDBASE_CBA 0xfff00000 /* chip base address [31:20] */
124
125#define SDRAMBUS __SYSREG(0xda000000, u32) /* bus mode control reg */
126#define SDRAMBUS_REFEN 0x00000004 /* refresh enable */
127#define SDRAMBUS_TRC 0x00000018 /* refresh command delay time */
128#define SDRAMBUS_BSTPT 0x00000020 /* burst stop command enable */
129#define SDRAMBUS_PONSEQ 0x00000040 /* power on sequence */
130#define SDRAMBUS_SELFREQ 0x00000080 /* self-refresh mode request */
131#define SDRAMBUS_SELFON 0x00000100 /* self-refresh mode on */
132#define SDRAMBUS_SIZE 0x00030000 /* SDRAM size */
133#define SDRAMBUS_SIZE_64Mbit 0x00010000 /* 64Mbit SDRAM (x16) */
134#define SDRAMBUS_SIZE_128Mbit 0x00020000 /* 128Mbit SDRAM (x16) */
135#define SDRAMBUS_SIZE_256Mbit 0x00030000 /* 256Mbit SDRAM (x16) */
136#define SDRAMBUS_TRASWAIT 0x000c0000 /* row address precharge command cycle number */
137#define SDRAMBUS_REFNUM 0x00300000 /* refresh command number */
138#define SDRAMBUS_BSTWAIT 0x00c00000 /* burst stop command cycle */
139#define SDRAMBUS_SETWAIT 0x03000000 /* mode register setting command cycle */
140#define SDRAMBUS_PREWAIT 0x0c000000 /* precharge command cycle */
141#define SDRAMBUS_RASLATE 0x30000000 /* RAS latency */
142#define SDRAMBUS_CASLATE 0xc0000000 /* CAS latency */
143
144#define SDREFCNT __SYSREG(0xda000004, u32) /* refresh period reg */
145#define SDREFCNT_PERI 0x00000fff /* refresh period */
146
147#define SDSHDW __SYSREG(0xda000010, u32) /* test reg */
148
149#endif /* __KERNEL__ */
150
151#endif /* _ASM_BUSCTL_REGS_H */
diff --git a/include/asm-mn10300/byteorder.h b/include/asm-mn10300/byteorder.h
deleted file mode 100644
index 5dd0bdd9feee..000000000000
--- a/include/asm-mn10300/byteorder.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_BYTEORDER_H
2#define _ASM_BYTEORDER_H
3
4#include <linux/byteorder/little_endian.h>
5
6#endif /* _ASM_BYTEORDER_H */
diff --git a/include/asm-mn10300/cache.h b/include/asm-mn10300/cache.h
deleted file mode 100644
index 9e01122208a9..000000000000
--- a/include/asm-mn10300/cache.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/* MN10300 cache management registers
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_CACHE_H
13#define _ASM_CACHE_H
14
15#include <asm/cpu-regs.h>
16#include <asm/proc/cache.h>
17
18#ifndef __ASSEMBLY__
19#define L1_CACHE_DISPARITY (L1_CACHE_NENTRIES * L1_CACHE_BYTES)
20#else
21#define L1_CACHE_DISPARITY L1_CACHE_NENTRIES * L1_CACHE_BYTES
22#endif
23
24/* data cache purge registers
25 * - read from the register to unconditionally purge that cache line
26 * - write address & 0xffffff00 to conditionally purge that cache line
27 * - clear LSB to request invalidation as well
28 */
29#define DCACHE_PURGE(WAY, ENTRY) \
30 __SYSREG(0xc8400000 + (WAY) * L1_CACHE_WAYDISP + \
31 (ENTRY) * L1_CACHE_BYTES, u32)
32
33#define DCACHE_PURGE_WAY0(ENTRY) \
34 __SYSREG(0xc8400000 + 0 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32)
35#define DCACHE_PURGE_WAY1(ENTRY) \
36 __SYSREG(0xc8400000 + 1 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32)
37#define DCACHE_PURGE_WAY2(ENTRY) \
38 __SYSREG(0xc8400000 + 2 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32)
39#define DCACHE_PURGE_WAY3(ENTRY) \
40 __SYSREG(0xc8400000 + 3 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32)
41
42/* instruction cache access registers */
43#define ICACHE_DATA(WAY, ENTRY, OFF) \
44 __SYSREG(0xc8000000 + (WAY) * L1_CACHE_WAYDISP + (ENTRY) * 0x10 + (OFF) * 4, u32)
45#define ICACHE_TAG(WAY, ENTRY) \
46 __SYSREG(0xc8100000 + (WAY) * L1_CACHE_WAYDISP + (ENTRY) * 0x10, u32)
47
48/* instruction cache access registers */
49#define DCACHE_DATA(WAY, ENTRY, OFF) \
50 __SYSREG(0xc8200000 + (WAY) * L1_CACHE_WAYDISP + (ENTRY) * 0x10 + (OFF) * 4, u32)
51#define DCACHE_TAG(WAY, ENTRY) \
52 __SYSREG(0xc8300000 + (WAY) * L1_CACHE_WAYDISP + (ENTRY) * 0x10, u32)
53
54#endif /* _ASM_CACHE_H */
diff --git a/include/asm-mn10300/cacheflush.h b/include/asm-mn10300/cacheflush.h
deleted file mode 100644
index 2db746a251f8..000000000000
--- a/include/asm-mn10300/cacheflush.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/* MN10300 Cache flushing
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_CACHEFLUSH_H
12#define _ASM_CACHEFLUSH_H
13
14#ifndef __ASSEMBLY__
15
16/* Keep includes the same across arches. */
17#include <linux/mm.h>
18
19/*
20 * virtually-indexed cache managment (our cache is physically indexed)
21 */
22#define flush_cache_all() do {} while (0)
23#define flush_cache_mm(mm) do {} while (0)
24#define flush_cache_dup_mm(mm) do {} while (0)
25#define flush_cache_range(mm, start, end) do {} while (0)
26#define flush_cache_page(vma, vmaddr, pfn) do {} while (0)
27#define flush_cache_vmap(start, end) do {} while (0)
28#define flush_cache_vunmap(start, end) do {} while (0)
29#define flush_dcache_page(page) do {} while (0)
30#define flush_dcache_mmap_lock(mapping) do {} while (0)
31#define flush_dcache_mmap_unlock(mapping) do {} while (0)
32
33/*
34 * physically-indexed cache managment
35 */
36#ifndef CONFIG_MN10300_CACHE_DISABLED
37
38extern void flush_icache_range(unsigned long start, unsigned long end);
39extern void flush_icache_page(struct vm_area_struct *vma, struct page *pg);
40
41#else
42
43#define flush_icache_range(start, end) do {} while (0)
44#define flush_icache_page(vma, pg) do {} while (0)
45
46#endif
47
48#define flush_icache_user_range(vma, pg, adr, len) \
49 flush_icache_range(adr, adr + len)
50
51#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
52 do { \
53 memcpy(dst, src, len); \
54 flush_icache_page(vma, page); \
55 } while (0)
56
57#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
58 memcpy(dst, src, len)
59
60/*
61 * primitive routines
62 */
63#ifndef CONFIG_MN10300_CACHE_DISABLED
64extern void mn10300_icache_inv(void);
65extern void mn10300_dcache_inv(void);
66extern void mn10300_dcache_inv_page(unsigned start);
67extern void mn10300_dcache_inv_range(unsigned start, unsigned end);
68extern void mn10300_dcache_inv_range2(unsigned start, unsigned size);
69#ifdef CONFIG_MN10300_CACHE_WBACK
70extern void mn10300_dcache_flush(void);
71extern void mn10300_dcache_flush_page(unsigned start);
72extern void mn10300_dcache_flush_range(unsigned start, unsigned end);
73extern void mn10300_dcache_flush_range2(unsigned start, unsigned size);
74extern void mn10300_dcache_flush_inv(void);
75extern void mn10300_dcache_flush_inv_page(unsigned start);
76extern void mn10300_dcache_flush_inv_range(unsigned start, unsigned end);
77extern void mn10300_dcache_flush_inv_range2(unsigned start, unsigned size);
78#else
79#define mn10300_dcache_flush() do {} while (0)
80#define mn10300_dcache_flush_page(start) do {} while (0)
81#define mn10300_dcache_flush_range(start, end) do {} while (0)
82#define mn10300_dcache_flush_range2(start, size) do {} while (0)
83#define mn10300_dcache_flush_inv() mn10300_dcache_inv()
84#define mn10300_dcache_flush_inv_page(start) \
85 mn10300_dcache_inv_page((start))
86#define mn10300_dcache_flush_inv_range(start, end) \
87 mn10300_dcache_inv_range((start), (end))
88#define mn10300_dcache_flush_inv_range2(start, size) \
89 mn10300_dcache_inv_range2((start), (size))
90#endif /* CONFIG_MN10300_CACHE_WBACK */
91#else
92#define mn10300_icache_inv() do {} while (0)
93#define mn10300_dcache_inv() do {} while (0)
94#define mn10300_dcache_inv_page(start) do {} while (0)
95#define mn10300_dcache_inv_range(start, end) do {} while (0)
96#define mn10300_dcache_inv_range2(start, size) do {} while (0)
97#define mn10300_dcache_flush() do {} while (0)
98#define mn10300_dcache_flush_inv_page(start) do {} while (0)
99#define mn10300_dcache_flush_inv() do {} while (0)
100#define mn10300_dcache_flush_inv_range(start, end) do {} while (0)
101#define mn10300_dcache_flush_inv_range2(start, size) do {} while (0)
102#define mn10300_dcache_flush_page(start) do {} while (0)
103#define mn10300_dcache_flush_range(start, end) do {} while (0)
104#define mn10300_dcache_flush_range2(start, size) do {} while (0)
105#endif /* CONFIG_MN10300_CACHE_DISABLED */
106
107/*
108 * internal debugging function
109 */
110#ifdef CONFIG_DEBUG_PAGEALLOC
111extern void kernel_map_pages(struct page *page, int numpages, int enable);
112#endif
113
114#endif /* __ASSEMBLY__ */
115
116#endif /* _ASM_CACHEFLUSH_H */
diff --git a/include/asm-mn10300/checksum.h b/include/asm-mn10300/checksum.h
deleted file mode 100644
index 9fb2a8d8826a..000000000000
--- a/include/asm-mn10300/checksum.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/* MN10300 Optimised checksumming code
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_CHECKSUM_H
12#define _ASM_CHECKSUM_H
13
14extern __wsum csum_partial(const void *buff, int len, __wsum sum);
15extern __wsum csum_partial_copy_nocheck(const void *src, void *dst,
16 int len, __wsum sum);
17extern __wsum csum_partial_copy_from_user(const void *src, void *dst,
18 int len, __wsum sum,
19 int *err_ptr);
20extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
21extern __wsum csum_partial(const void *buff, int len, __wsum sum);
22extern __sum16 ip_compute_csum(const void *buff, int len);
23
24#define csum_partial_copy_fromuser csum_partial_copy
25extern __wsum csum_partial_copy(const void *src, void *dst, int len,
26 __wsum sum);
27
28static inline __sum16 csum_fold(__wsum sum)
29{
30 asm(
31 " add %1,%0 \n"
32 " addc 0xffff,%0 \n"
33 : "=r" (sum)
34 : "r" (sum << 16), "0" (sum & 0xffff0000)
35 : "cc"
36 );
37 return (~sum) >> 16;
38}
39
40static inline __wsum csum_tcpudp_nofold(unsigned long saddr,
41 unsigned long daddr,
42 unsigned short len,
43 unsigned short proto,
44 __wsum sum)
45{
46 __wsum tmp;
47
48 tmp = (__wsum) ntohs(len) << 16;
49 tmp += (__wsum) proto << 8;
50
51 asm(
52 " add %1,%0 \n"
53 " addc %2,%0 \n"
54 " addc %3,%0 \n"
55 " addc 0,%0 \n"
56 : "=r" (sum)
57 : "r" (daddr), "r"(saddr), "r"(tmp), "0"(sum)
58 : "cc"
59 );
60 return sum;
61}
62
63/*
64 * computes the checksum of the TCP/UDP pseudo-header
65 * returns a 16-bit checksum, already complemented
66 */
67static inline __sum16 csum_tcpudp_magic(unsigned long saddr,
68 unsigned long daddr,
69 unsigned short len,
70 unsigned short proto,
71 __wsum sum)
72{
73 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
74}
75
76#undef _HAVE_ARCH_IPV6_CSUM
77
78/*
79 * Copy and checksum to user
80 */
81#define HAVE_CSUM_COPY_USER
82extern __wsum csum_and_copy_to_user(const void *src, void *dst, int len,
83 __wsum sum, int *err_ptr);
84
85
86#endif /* _ASM_CHECKSUM_H */
diff --git a/include/asm-mn10300/cpu-regs.h b/include/asm-mn10300/cpu-regs.h
deleted file mode 100644
index 757e9b5388ea..000000000000
--- a/include/asm-mn10300/cpu-regs.h
+++ /dev/null
@@ -1,290 +0,0 @@
1/* MN10300 Core system registers
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_CPU_REGS_H
12#define _ASM_CPU_REGS_H
13
14#ifndef __ASSEMBLY__
15#include <linux/types.h>
16#endif
17
18#ifdef CONFIG_MN10300_CPU_AM33V2
19/* we tell the compiler to pretend to be AM33 so that it doesn't try and use
20 * the FP regs, but tell the assembler that we're actually allowed AM33v2
21 * instructions */
22#ifndef __ASSEMBLY__
23asm(" .am33_2\n");
24#else
25.am33_2
26#endif
27#endif
28
29#ifdef __KERNEL__
30
31#ifndef __ASSEMBLY__
32#define __SYSREG(ADDR, TYPE) (*(volatile TYPE *)(ADDR))
33#define __SYSREGC(ADDR, TYPE) (*(const volatile TYPE *)(ADDR))
34#else
35#define __SYSREG(ADDR, TYPE) ADDR
36#define __SYSREGC(ADDR, TYPE) ADDR
37#endif
38
39/* CPU registers */
40#define EPSW_FLAG_Z 0x00000001 /* zero flag */
41#define EPSW_FLAG_N 0x00000002 /* negative flag */
42#define EPSW_FLAG_C 0x00000004 /* carry flag */
43#define EPSW_FLAG_V 0x00000008 /* overflow flag */
44#define EPSW_IM 0x00000700 /* interrupt mode */
45#define EPSW_IM_0 0x00000000 /* interrupt mode 0 */
46#define EPSW_IM_1 0x00000100 /* interrupt mode 1 */
47#define EPSW_IM_2 0x00000200 /* interrupt mode 2 */
48#define EPSW_IM_3 0x00000300 /* interrupt mode 3 */
49#define EPSW_IM_4 0x00000400 /* interrupt mode 4 */
50#define EPSW_IM_5 0x00000500 /* interrupt mode 5 */
51#define EPSW_IM_6 0x00000600 /* interrupt mode 6 */
52#define EPSW_IM_7 0x00000700 /* interrupt mode 7 */
53#define EPSW_IE 0x00000800 /* interrupt enable */
54#define EPSW_S 0x00003000 /* software auxilliary bits */
55#define EPSW_T 0x00008000 /* trace enable */
56#define EPSW_nSL 0x00010000 /* not supervisor level */
57#define EPSW_NMID 0x00020000 /* nonmaskable interrupt disable */
58#define EPSW_nAR 0x00040000 /* register bank control */
59#define EPSW_ML 0x00080000 /* monitor level */
60#define EPSW_FE 0x00100000 /* FPU enable */
61
62/* FPU registers */
63#define FPCR_EF_I 0x00000001 /* inexact result FPU exception flag */
64#define FPCR_EF_U 0x00000002 /* underflow FPU exception flag */
65#define FPCR_EF_O 0x00000004 /* overflow FPU exception flag */
66#define FPCR_EF_Z 0x00000008 /* zero divide FPU exception flag */
67#define FPCR_EF_V 0x00000010 /* invalid operand FPU exception flag */
68#define FPCR_EE_I 0x00000020 /* inexact result FPU exception enable */
69#define FPCR_EE_U 0x00000040 /* underflow FPU exception enable */
70#define FPCR_EE_O 0x00000080 /* overflow FPU exception enable */
71#define FPCR_EE_Z 0x00000100 /* zero divide FPU exception enable */
72#define FPCR_EE_V 0x00000200 /* invalid operand FPU exception enable */
73#define FPCR_EC_I 0x00000400 /* inexact result FPU exception cause */
74#define FPCR_EC_U 0x00000800 /* underflow FPU exception cause */
75#define FPCR_EC_O 0x00001000 /* overflow FPU exception cause */
76#define FPCR_EC_Z 0x00002000 /* zero divide FPU exception cause */
77#define FPCR_EC_V 0x00004000 /* invalid operand FPU exception cause */
78#define FPCR_RM 0x00030000 /* rounding mode */
79#define FPCR_RM_NEAREST 0x00000000 /* - round to nearest value */
80#define FPCR_FCC_U 0x00040000 /* FPU unordered condition code */
81#define FPCR_FCC_E 0x00080000 /* FPU equal condition code */
82#define FPCR_FCC_G 0x00100000 /* FPU greater than condition code */
83#define FPCR_FCC_L 0x00200000 /* FPU less than condition code */
84#define FPCR_INIT 0x00000000 /* no exceptions, rounding to nearest */
85
86/* CPU control registers */
87#define CPUP __SYSREG(0xc0000020, u16) /* CPU pipeline register */
88#define CPUP_DWBD 0x0020 /* write buffer disable flag */
89#define CPUP_IPFD 0x0040 /* instruction prefetch disable flag */
90#define CPUP_EXM 0x0080 /* exception operation mode */
91#define CPUP_EXM_AM33V1 0x0000 /* - AM33 v1 exception mode */
92#define CPUP_EXM_AM33V2 0x0080 /* - AM33 v2 exception mode */
93
94#define CPUM __SYSREG(0xc0000040, u16) /* CPU mode register */
95#define CPUM_SLEEP 0x0004 /* set to enter sleep state */
96#define CPUM_HALT 0x0008 /* set to enter halt state */
97#define CPUM_STOP 0x0010 /* set to enter stop state */
98
99#define CPUREV __SYSREGC(0xc0000050, u32) /* CPU revision register */
100#define CPUREV_TYPE 0x0000000f /* CPU type */
101#define CPUREV_TYPE_S 0
102#define CPUREV_TYPE_AM33V1 0x00000000 /* - AM33 V1 core, AM33/1.00 arch */
103#define CPUREV_TYPE_AM33V2 0x00000001 /* - AM33 V2 core, AM33/2.00 arch */
104#define CPUREV_TYPE_AM34V1 0x00000002 /* - AM34 V1 core, AM33/2.00 arch */
105#define CPUREV_REVISION 0x000000f0 /* CPU revision */
106#define CPUREV_REVISION_S 4
107#define CPUREV_ICWAY 0x00000f00 /* number of instruction cache ways */
108#define CPUREV_ICWAY_S 8
109#define CPUREV_ICSIZE 0x0000f000 /* instruction cache way size */
110#define CPUREV_ICSIZE_S 12
111#define CPUREV_DCWAY 0x000f0000 /* number of data cache ways */
112#define CPUREV_DCWAY_S 16
113#define CPUREV_DCSIZE 0x00f00000 /* data cache way size */
114#define CPUREV_DCSIZE_S 20
115#define CPUREV_FPUTYPE 0x0f000000 /* FPU core type */
116#define CPUREV_FPUTYPE_NONE 0x00000000 /* - no FPU core implemented */
117#define CPUREV_OCDCTG 0xf0000000 /* on-chip debug function category */
118
119#define DCR __SYSREG(0xc0000030, u16) /* Debug control register */
120
121/* interrupt/exception control registers */
122#define IVAR0 __SYSREG(0xc0000000, u16) /* interrupt vector 0 */
123#define IVAR1 __SYSREG(0xc0000004, u16) /* interrupt vector 1 */
124#define IVAR2 __SYSREG(0xc0000008, u16) /* interrupt vector 2 */
125#define IVAR3 __SYSREG(0xc000000c, u16) /* interrupt vector 3 */
126#define IVAR4 __SYSREG(0xc0000010, u16) /* interrupt vector 4 */
127#define IVAR5 __SYSREG(0xc0000014, u16) /* interrupt vector 5 */
128#define IVAR6 __SYSREG(0xc0000018, u16) /* interrupt vector 6 */
129
130#define TBR __SYSREG(0xc0000024, u32) /* Trap table base */
131#define TBR_TB 0xff000000 /* table base address bits 31-24 */
132#define TBR_INT_CODE 0x00ffffff /* interrupt code */
133
134#define DEAR __SYSREG(0xc0000038, u32) /* Data access exception address */
135
136#define sISR __SYSREG(0xc0000044, u32) /* Supervisor interrupt status */
137#define sISR_IRQICE 0x00000001 /* ICE interrupt */
138#define sISR_ISTEP 0x00000002 /* single step interrupt */
139#define sISR_MISSA 0x00000004 /* memory access address misalignment fault */
140#define sISR_UNIMP 0x00000008 /* unimplemented instruction execution fault */
141#define sISR_PIEXE 0x00000010 /* program interrupt */
142#define sISR_MEMERR 0x00000020 /* illegal memory access fault */
143#define sISR_IBREAK 0x00000040 /* instraction break interrupt */
144#define sISR_DBSRL 0x00000080 /* debug serial interrupt */
145#define sISR_PERIDB 0x00000100 /* peripheral debug interrupt */
146#define sISR_EXUNIMP 0x00000200 /* unimplemented ex-instruction execution fault */
147#define sISR_OBREAK 0x00000400 /* operand break interrupt */
148#define sISR_PRIV 0x00000800 /* privileged instruction execution fault */
149#define sISR_BUSERR 0x00001000 /* bus error fault */
150#define sISR_DBLFT 0x00002000 /* double fault */
151#define sISR_DBG 0x00008000 /* debug reserved interrupt */
152#define sISR_ITMISS 0x00010000 /* instruction TLB miss */
153#define sISR_DTMISS 0x00020000 /* data TLB miss */
154#define sISR_ITEX 0x00040000 /* instruction TLB access exception */
155#define sISR_DTEX 0x00080000 /* data TLB access exception */
156#define sISR_ILGIA 0x00100000 /* illegal instruction access exception */
157#define sISR_ILGDA 0x00200000 /* illegal data access exception */
158#define sISR_IOIA 0x00400000 /* internal I/O space instruction access excep */
159#define sISR_PRIVA 0x00800000 /* privileged space instruction access excep */
160#define sISR_PRIDA 0x01000000 /* privileged space data access excep */
161#define sISR_DISA 0x02000000 /* data space instruction access excep */
162#define sISR_SYSC 0x04000000 /* system call instruction excep */
163#define sISR_FPUD 0x08000000 /* FPU disabled excep */
164#define sISR_FPUUI 0x10000000 /* FPU unimplemented instruction excep */
165#define sISR_FPUOP 0x20000000 /* FPU operation excep */
166#define sISR_NE 0x80000000 /* multiple synchronous exceptions excep */
167
168/* cache control registers */
169#define CHCTR __SYSREG(0xc0000070, u16) /* cache control */
170#define CHCTR_ICEN 0x0001 /* instruction cache enable */
171#define CHCTR_DCEN 0x0002 /* data cache enable */
172#define CHCTR_ICBUSY 0x0004 /* instruction cache busy */
173#define CHCTR_DCBUSY 0x0008 /* data cache busy */
174#define CHCTR_ICINV 0x0010 /* instruction cache invalidate */
175#define CHCTR_DCINV 0x0020 /* data cache invalidate */
176#define CHCTR_DCWTMD 0x0040 /* data cache writing mode */
177#define CHCTR_DCWTMD_WRBACK 0x0000 /* - write back mode */
178#define CHCTR_DCWTMD_WRTHROUGH 0x0040 /* - write through mode */
179#define CHCTR_DCALMD 0x0080 /* data cache allocation mode */
180#define CHCTR_ICWMD 0x0f00 /* instruction cache way mode */
181#define CHCTR_DCWMD 0xf000 /* data cache way mode */
182
183/* MMU control registers */
184#define MMUCTR __SYSREG(0xc0000090, u32) /* MMU control register */
185#define MMUCTR_IRP 0x0000003f /* instruction TLB replace pointer */
186#define MMUCTR_ITE 0x00000040 /* instruction TLB enable */
187#define MMUCTR_IIV 0x00000080 /* instruction TLB invalidate */
188#define MMUCTR_ITL 0x00000700 /* instruction TLB lock pointer */
189#define MMUCTR_ITL_NOLOCK 0x00000000 /* - no lock */
190#define MMUCTR_ITL_LOCK0 0x00000100 /* - entry 0 locked */
191#define MMUCTR_ITL_LOCK0_1 0x00000200 /* - entry 0-1 locked */
192#define MMUCTR_ITL_LOCK0_3 0x00000300 /* - entry 0-3 locked */
193#define MMUCTR_ITL_LOCK0_7 0x00000400 /* - entry 0-7 locked */
194#define MMUCTR_ITL_LOCK0_15 0x00000500 /* - entry 0-15 locked */
195#define MMUCTR_CE 0x00008000 /* cacheable bit enable */
196#define MMUCTR_DRP 0x003f0000 /* data TLB replace pointer */
197#define MMUCTR_DTE 0x00400000 /* data TLB enable */
198#define MMUCTR_DIV 0x00800000 /* data TLB invalidate */
199#define MMUCTR_DTL 0x07000000 /* data TLB lock pointer */
200#define MMUCTR_DTL_NOLOCK 0x00000000 /* - no lock */
201#define MMUCTR_DTL_LOCK0 0x01000000 /* - entry 0 locked */
202#define MMUCTR_DTL_LOCK0_1 0x02000000 /* - entry 0-1 locked */
203#define MMUCTR_DTL_LOCK0_3 0x03000000 /* - entry 0-3 locked */
204#define MMUCTR_DTL_LOCK0_7 0x04000000 /* - entry 0-7 locked */
205#define MMUCTR_DTL_LOCK0_15 0x05000000 /* - entry 0-15 locked */
206
207#define PIDR __SYSREG(0xc0000094, u16) /* PID register */
208#define PIDR_PID 0x00ff /* process identifier */
209
210#define PTBR __SYSREG(0xc0000098, unsigned long) /* Page table base register */
211
212#define IPTEL __SYSREG(0xc00000a0, u32) /* instruction TLB entry */
213#define DPTEL __SYSREG(0xc00000b0, u32) /* data TLB entry */
214#define xPTEL_V 0x00000001 /* TLB entry valid */
215#define xPTEL_UNUSED1 0x00000002 /* unused bit */
216#define xPTEL_UNUSED2 0x00000004 /* unused bit */
217#define xPTEL_C 0x00000008 /* cached if set */
218#define xPTEL_PV 0x00000010 /* page valid */
219#define xPTEL_D 0x00000020 /* dirty */
220#define xPTEL_PR 0x000001c0 /* page protection */
221#define xPTEL_PR_ROK 0x00000000 /* - R/O kernel */
222#define xPTEL_PR_RWK 0x00000100 /* - R/W kernel */
223#define xPTEL_PR_ROK_ROU 0x00000080 /* - R/O kernel and R/O user */
224#define xPTEL_PR_RWK_ROU 0x00000180 /* - R/W kernel and R/O user */
225#define xPTEL_PR_RWK_RWU 0x000001c0 /* - R/W kernel and R/W user */
226#define xPTEL_G 0x00000200 /* global (use PID if 0) */
227#define xPTEL_PS 0x00000c00 /* page size */
228#define xPTEL_PS_4Kb 0x00000000 /* - 4Kb page */
229#define xPTEL_PS_128Kb 0x00000400 /* - 128Kb page */
230#define xPTEL_PS_1Kb 0x00000800 /* - 1Kb page */
231#define xPTEL_PS_4Mb 0x00000c00 /* - 4Mb page */
232#define xPTEL_PPN 0xfffff006 /* physical page number */
233
234#define xPTEL_V_BIT 0 /* bit numbers corresponding to above masks */
235#define xPTEL_UNUSED1_BIT 1
236#define xPTEL_UNUSED2_BIT 2
237#define xPTEL_C_BIT 3
238#define xPTEL_PV_BIT 4
239#define xPTEL_D_BIT 5
240#define xPTEL_G_BIT 9
241
242#define IPTEU __SYSREG(0xc00000a4, u32) /* instruction TLB virtual addr */
243#define DPTEU __SYSREG(0xc00000b4, u32) /* data TLB virtual addr */
244#define xPTEU_VPN 0xfffffc00 /* virtual page number */
245#define xPTEU_PID 0x000000ff /* process identifier to which applicable */
246
247#define IPTEL2 __SYSREG(0xc00000a8, u32) /* instruction TLB entry */
248#define DPTEL2 __SYSREG(0xc00000b8, u32) /* data TLB entry */
249#define xPTEL2_V 0x00000001 /* TLB entry valid */
250#define xPTEL2_C 0x00000002 /* cacheable */
251#define xPTEL2_PV 0x00000004 /* page valid */
252#define xPTEL2_D 0x00000008 /* dirty */
253#define xPTEL2_PR 0x00000070 /* page protection */
254#define xPTEL2_PR_ROK 0x00000000 /* - R/O kernel */
255#define xPTEL2_PR_RWK 0x00000040 /* - R/W kernel */
256#define xPTEL2_PR_ROK_ROU 0x00000020 /* - R/O kernel and R/O user */
257#define xPTEL2_PR_RWK_ROU 0x00000060 /* - R/W kernel and R/O user */
258#define xPTEL2_PR_RWK_RWU 0x00000070 /* - R/W kernel and R/W user */
259#define xPTEL2_G 0x00000080 /* global (use PID if 0) */
260#define xPTEL2_PS 0x00000300 /* page size */
261#define xPTEL2_PS_4Kb 0x00000000 /* - 4Kb page */
262#define xPTEL2_PS_128Kb 0x00000100 /* - 128Kb page */
263#define xPTEL2_PS_1Kb 0x00000200 /* - 1Kb page */
264#define xPTEL2_PS_4Mb 0x00000300 /* - 4Mb page */
265#define xPTEL2_PPN 0xfffffc00 /* physical page number */
266
267#define MMUFCR __SYSREGC(0xc000009c, u32) /* MMU exception cause */
268#define MMUFCR_IFC __SYSREGC(0xc000009c, u16) /* MMU instruction excep cause */
269#define MMUFCR_DFC __SYSREGC(0xc000009e, u16) /* MMU data exception cause */
270#define MMUFCR_xFC_TLBMISS 0x0001 /* TLB miss flag */
271#define MMUFCR_xFC_INITWR 0x0002 /* initial write excep flag */
272#define MMUFCR_xFC_PGINVAL 0x0004 /* page invalid excep flag */
273#define MMUFCR_xFC_PROTVIOL 0x0008 /* protection violation excep flag */
274#define MMUFCR_xFC_ACCESS 0x0010 /* access level flag */
275#define MMUFCR_xFC_ACCESS_USR 0x0000 /* - user mode */
276#define MMUFCR_xFC_ACCESS_SR 0x0010 /* - supervisor mode */
277#define MMUFCR_xFC_TYPE 0x0020 /* access type flag */
278#define MMUFCR_xFC_TYPE_READ 0x0000 /* - read */
279#define MMUFCR_xFC_TYPE_WRITE 0x0020 /* - write */
280#define MMUFCR_xFC_PR 0x01c0 /* page protection flag */
281#define MMUFCR_xFC_PR_ROK 0x0000 /* - R/O kernel */
282#define MMUFCR_xFC_PR_RWK 0x0100 /* - R/W kernel */
283#define MMUFCR_xFC_PR_ROK_ROU 0x0080 /* - R/O kernel and R/O user */
284#define MMUFCR_xFC_PR_RWK_ROU 0x0180 /* - R/W kernel and R/O user */
285#define MMUFCR_xFC_PR_RWK_RWU 0x01c0 /* - R/W kernel and R/W user */
286#define MMUFCR_xFC_ILLADDR 0x0200 /* illegal address excep flag */
287
288#endif /* __KERNEL__ */
289
290#endif /* _ASM_CPU_REGS_H */
diff --git a/include/asm-mn10300/cputime.h b/include/asm-mn10300/cputime.h
deleted file mode 100644
index 6d68ad7e0ea3..000000000000
--- a/include/asm-mn10300/cputime.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/cputime.h>
diff --git a/include/asm-mn10300/current.h b/include/asm-mn10300/current.h
deleted file mode 100644
index ca6027d83743..000000000000
--- a/include/asm-mn10300/current.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/* MN10300 Current task structure accessor
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_CURRENT_H
12#define _ASM_CURRENT_H
13
14#include <linux/thread_info.h>
15
16/*
17 * dedicate E2 to keeping the current task pointer
18 */
19#ifdef CONFIG_MN10300_CURRENT_IN_E2
20
21register struct task_struct *const current asm("e2") __attribute__((used));
22
23#define get_current() current
24
25extern struct task_struct *__current;
26
27#else
28static inline __attribute__((const))
29struct task_struct *get_current(void)
30{
31 return current_thread_info()->task;
32}
33
34#define current get_current()
35#endif
36
37#endif /* _ASM_CURRENT_H */
diff --git a/include/asm-mn10300/delay.h b/include/asm-mn10300/delay.h
deleted file mode 100644
index 34517b359399..000000000000
--- a/include/asm-mn10300/delay.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/* MN10300 Uninterruptible delay routines
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_DELAY_H
12#define _ASM_DELAY_H
13
14extern void __udelay(unsigned long usecs);
15extern void __delay(unsigned long loops);
16
17#define udelay(n) __udelay(n)
18
19#endif /* _ASM_DELAY_H */
diff --git a/include/asm-mn10300/device.h b/include/asm-mn10300/device.h
deleted file mode 100644
index f0a4c256403b..000000000000
--- a/include/asm-mn10300/device.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/device.h>
diff --git a/include/asm-mn10300/div64.h b/include/asm-mn10300/div64.h
deleted file mode 100644
index 3a8329b3e869..000000000000
--- a/include/asm-mn10300/div64.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/* MN10300 64-bit division
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_DIV64
12#define _ASM_DIV64
13
14#include <linux/types.h>
15
16extern void ____unhandled_size_in_do_div___(void);
17
18/*
19 * divide n by base, leaving the result in n and returning the remainder
20 * - we can do this quite efficiently on the MN10300 by cascading the divides
21 * through the MDR register
22 */
23#define do_div(n, base) \
24({ \
25 unsigned __rem = 0; \
26 if (sizeof(n) <= 4) { \
27 asm("mov %1,mdr \n" \
28 "divu %2,%0 \n" \
29 "mov mdr,%1 \n" \
30 : "+r"(n), "=d"(__rem) \
31 : "r"(base), "1"(__rem) \
32 : "cc" \
33 ); \
34 } else if (sizeof(n) <= 8) { \
35 union { \
36 unsigned long long l; \
37 u32 w[2]; \
38 } __quot; \
39 __quot.l = n; \
40 asm("mov %0,mdr \n" /* MDR = 0 */ \
41 "divu %3,%1 \n" \
42 /* __quot.MSL = __div.MSL / base, */ \
43 /* MDR = MDR:__div.MSL % base */ \
44 "divu %3,%2 \n" \
45 /* __quot.LSL = MDR:__div.LSL / base, */ \
46 /* MDR = MDR:__div.LSL % base */ \
47 "mov mdr,%0 \n" \
48 : "=d"(__rem), "=r"(__quot.w[1]), "=r"(__quot.w[0]) \
49 : "r"(base), "0"(__rem), "1"(__quot.w[1]), \
50 "2"(__quot.w[0]) \
51 : "cc" \
52 ); \
53 n = __quot.l; \
54 } else { \
55 ____unhandled_size_in_do_div___(); \
56 } \
57 __rem; \
58})
59
60/*
61 * do an unsigned 32-bit multiply and divide with intermediate 64-bit product
62 * so as not to lose accuracy
63 * - we use the MDR register to hold the MSW of the product
64 */
65static inline __attribute__((const))
66unsigned __muldiv64u(unsigned val, unsigned mult, unsigned div)
67{
68 unsigned result;
69
70 asm("mulu %2,%0 \n" /* MDR:val = val*mult */
71 "divu %3,%0 \n" /* val = MDR:val/div;
72 * MDR = MDR:val%div */
73 : "=r"(result)
74 : "0"(val), "ir"(mult), "r"(div)
75 );
76
77 return result;
78}
79
80/*
81 * do a signed 32-bit multiply and divide with intermediate 64-bit product so
82 * as not to lose accuracy
83 * - we use the MDR register to hold the MSW of the product
84 */
85static inline __attribute__((const))
86signed __muldiv64s(signed val, signed mult, signed div)
87{
88 signed result;
89
90 asm("mul %2,%0 \n" /* MDR:val = val*mult */
91 "div %3,%0 \n" /* val = MDR:val/div;
92 * MDR = MDR:val%div */
93 : "=r"(result)
94 : "0"(val), "ir"(mult), "r"(div)
95 );
96
97 return result;
98}
99
100#endif /* _ASM_DIV64 */
diff --git a/include/asm-mn10300/dma-mapping.h b/include/asm-mn10300/dma-mapping.h
deleted file mode 100644
index ccae8f6c6326..000000000000
--- a/include/asm-mn10300/dma-mapping.h
+++ /dev/null
@@ -1,234 +0,0 @@
1/* DMA mapping routines for the MN10300 arch
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_DMA_MAPPING_H
12#define _ASM_DMA_MAPPING_H
13
14#include <linux/mm.h>
15#include <linux/scatterlist.h>
16
17#include <asm/cache.h>
18#include <asm/io.h>
19
20extern void *dma_alloc_coherent(struct device *dev, size_t size,
21 dma_addr_t *dma_handle, int flag);
22
23extern void dma_free_coherent(struct device *dev, size_t size,
24 void *vaddr, dma_addr_t dma_handle);
25
26#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent((d), (s), (h), (f))
27#define dma_free_noncoherent(d, s, v, h) dma_free_coherent((d), (s), (v), (h))
28
29/*
30 * Map a single buffer of the indicated size for DMA in streaming mode. The
31 * 32-bit bus address to use is returned.
32 *
33 * Once the device is given the dma address, the device owns this memory until
34 * either pci_unmap_single or pci_dma_sync_single is performed.
35 */
36static inline
37dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
38 enum dma_data_direction direction)
39{
40 BUG_ON(direction == DMA_NONE);
41 mn10300_dcache_flush_inv();
42 return virt_to_bus(ptr);
43}
44
45/*
46 * Unmap a single streaming mode DMA translation. The dma_addr and size must
47 * match what was provided for in a previous pci_map_single call. All other
48 * usages are undefined.
49 *
50 * After this call, reads by the cpu to the buffer are guarenteed to see
51 * whatever the device wrote there.
52 */
53static inline
54void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
55 enum dma_data_direction direction)
56{
57 BUG_ON(direction == DMA_NONE);
58}
59
60/*
61 * Map a set of buffers described by scatterlist in streaming mode for DMA.
62 * This is the scather-gather version of the above pci_map_single interface.
63 * Here the scatter gather list elements are each tagged with the appropriate
64 * dma address and length. They are obtained via sg_dma_{address,length}(SG).
65 *
66 * NOTE: An implementation may be able to use a smaller number of DMA
67 * address/length pairs than there are SG table elements. (for example
68 * via virtual mapping capabilities) The routine returns the number of
69 * addr/length pairs actually used, at most nents.
70 *
71 * Device ownership issues as mentioned above for pci_map_single are the same
72 * here.
73 */
74static inline
75int dma_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
76 enum dma_data_direction direction)
77{
78 struct scatterlist *sg;
79 int i;
80
81 BUG_ON(!valid_dma_direction(direction));
82 WARN_ON(nents == 0 || sglist[0].length == 0);
83
84 for_each_sg(sglist, sg, nents, i) {
85 BUG_ON(!sg_page(sg));
86
87 sg->dma_address = sg_phys(sg);
88 }
89
90 mn10300_dcache_flush_inv();
91 return nents;
92}
93
94/*
95 * Unmap a set of streaming mode DMA translations.
96 * Again, cpu read rules concerning calls here are the same as for
97 * pci_unmap_single() above.
98 */
99static inline
100void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
101 enum dma_data_direction direction)
102{
103 BUG_ON(!valid_dma_direction(direction));
104}
105
106/*
107 * pci_{map,unmap}_single_page maps a kernel page to a dma_addr_t. identical
108 * to pci_map_single, but takes a struct page instead of a virtual address
109 */
110static inline
111dma_addr_t dma_map_page(struct device *dev, struct page *page,
112 unsigned long offset, size_t size,
113 enum dma_data_direction direction)
114{
115 BUG_ON(direction == DMA_NONE);
116 return page_to_bus(page) + offset;
117}
118
119static inline
120void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
121 enum dma_data_direction direction)
122{
123 BUG_ON(direction == DMA_NONE);
124}
125
126/*
127 * Make physical memory consistent for a single streaming mode DMA translation
128 * after a transfer.
129 *
130 * If you perform a pci_map_single() but wish to interrogate the buffer using
131 * the cpu, yet do not wish to teardown the PCI dma mapping, you must call this
132 * function before doing so. At the next point you give the PCI dma address
133 * back to the card, the device again owns the buffer.
134 */
135static inline
136void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
137 size_t size, enum dma_data_direction direction)
138{
139}
140
141static inline
142void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
143 size_t size, enum dma_data_direction direction)
144{
145 mn10300_dcache_flush_inv();
146}
147
148static inline
149void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
150 unsigned long offset, size_t size,
151 enum dma_data_direction direction)
152{
153}
154
155static inline void
156dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
157 unsigned long offset, size_t size,
158 enum dma_data_direction direction)
159{
160 mn10300_dcache_flush_inv();
161}
162
163
164/*
165 * Make physical memory consistent for a set of streaming mode DMA translations
166 * after a transfer.
167 *
168 * The same as pci_dma_sync_single but for a scatter-gather list, same rules
169 * and usage.
170 */
171static inline
172void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
173 int nelems, enum dma_data_direction direction)
174{
175}
176
177static inline
178void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
179 int nelems, enum dma_data_direction direction)
180{
181 mn10300_dcache_flush_inv();
182}
183
184static inline
185int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
186{
187 return 0;
188}
189
190/*
191 * Return whether the given PCI device DMA address mask can be supported
192 * properly. For example, if your device can only drive the low 24-bits during
193 * PCI bus mastering, then you would pass 0x00ffffff as the mask to this
194 * function.
195 */
196static inline
197int dma_supported(struct device *dev, u64 mask)
198{
199 /*
200 * we fall back to GFP_DMA when the mask isn't all 1s, so we can't
201 * guarantee allocations that must be within a tighter range than
202 * GFP_DMA
203 */
204 if (mask < 0x00ffffff)
205 return 0;
206 return 1;
207}
208
209static inline
210int dma_set_mask(struct device *dev, u64 mask)
211{
212 if (!dev->dma_mask || !dma_supported(dev, mask))
213 return -EIO;
214
215 *dev->dma_mask = mask;
216 return 0;
217}
218
219static inline
220int dma_get_cache_alignment(void)
221{
222 return 1 << L1_CACHE_SHIFT;
223}
224
225#define dma_is_consistent(d) (1)
226
227static inline
228void dma_cache_sync(void *vaddr, size_t size,
229 enum dma_data_direction direction)
230{
231 mn10300_dcache_flush_inv();
232}
233
234#endif
diff --git a/include/asm-mn10300/dma.h b/include/asm-mn10300/dma.h
deleted file mode 100644
index 098df2e617ab..000000000000
--- a/include/asm-mn10300/dma.h
+++ /dev/null
@@ -1,118 +0,0 @@
1/* MN10300 ISA DMA handlers and definitions
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_DMA_H
12#define _ASM_DMA_H
13
14#include <asm/system.h>
15#include <linux/spinlock.h>
16#include <asm/io.h>
17#include <linux/delay.h>
18
19#undef MAX_DMA_CHANNELS /* switch off linux/kernel/dma.c */
20#define MAX_DMA_ADDRESS 0xbfffffff
21
22extern spinlock_t dma_spin_lock;
23
24static inline unsigned long claim_dma_lock(void)
25{
26 unsigned long flags;
27 spin_lock_irqsave(&dma_spin_lock, flags);
28 return flags;
29}
30
31static inline void release_dma_lock(unsigned long flags)
32{
33 spin_unlock_irqrestore(&dma_spin_lock, flags);
34}
35
36/* enable/disable a specific DMA channel */
37static inline void enable_dma(unsigned int dmanr)
38{
39}
40
41static inline void disable_dma(unsigned int dmanr)
42{
43}
44
45/* Clear the 'DMA Pointer Flip Flop'.
46 * Write 0 for LSB/MSB, 1 for MSB/LSB access.
47 * Use this once to initialize the FF to a known state.
48 * After that, keep track of it. :-)
49 * --- In order to do that, the DMA routines below should ---
50 * --- only be used while holding the DMA lock ! ---
51 */
52static inline void clear_dma_ff(unsigned int dmanr)
53{
54}
55
56/* set mode (above) for a specific DMA channel */
57static inline void set_dma_mode(unsigned int dmanr, char mode)
58{
59}
60
61/* Set only the page register bits of the transfer address.
62 * This is used for successive transfers when we know the contents of
63 * the lower 16 bits of the DMA current address register, but a 64k boundary
64 * may have been crossed.
65 */
66static inline void set_dma_page(unsigned int dmanr, char pagenr)
67{
68}
69
70
71/* Set transfer address & page bits for specific DMA channel.
72 * Assumes dma flipflop is clear.
73 */
74static inline void set_dma_addr(unsigned int dmanr, unsigned int a)
75{
76}
77
78
79/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for
80 * a specific DMA channel.
81 * You must ensure the parameters are valid.
82 * NOTE: from a manual: "the number of transfers is one more
83 * than the initial word count"! This is taken into account.
84 * Assumes dma flip-flop is clear.
85 * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
86 */
87static inline void set_dma_count(unsigned int dmanr, unsigned int count)
88{
89}
90
91
92/* Get DMA residue count. After a DMA transfer, this
93 * should return zero. Reading this while a DMA transfer is
94 * still in progress will return unpredictable results.
95 * If called before the channel has been used, it may return 1.
96 * Otherwise, it returns the number of _bytes_ left to transfer.
97 *
98 * Assumes DMA flip-flop is clear.
99 */
100static inline int get_dma_residue(unsigned int dmanr)
101{
102 return 0;
103}
104
105
106/* These are in kernel/dma.c: */
107extern int request_dma(unsigned int dmanr, const char *device_id);
108extern void free_dma(unsigned int dmanr);
109
110/* From PCI */
111
112#ifdef CONFIG_PCI
113extern int isa_dma_bridge_buggy;
114#else
115#define isa_dma_bridge_buggy (0)
116#endif
117
118#endif /* _ASM_DMA_H */
diff --git a/include/asm-mn10300/dmactl-regs.h b/include/asm-mn10300/dmactl-regs.h
deleted file mode 100644
index 58a199da0f4a..000000000000
--- a/include/asm-mn10300/dmactl-regs.h
+++ /dev/null
@@ -1,101 +0,0 @@
1/* MN10300 on-board DMA controller registers
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_DMACTL_REGS_H
12#define _ASM_DMACTL_REGS_H
13
14#include <asm/cpu-regs.h>
15
16#ifdef __KERNEL__
17
18/* DMA registers */
19#define DMxCTR(N) __SYSREG(0xd2000000 + ((N) * 0x100), u32) /* control reg */
20#define DMxCTR_BG 0x0000001f /* transfer request source */
21#define DMxCTR_BG_SOFT 0x00000000 /* - software source */
22#define DMxCTR_BG_SC0TX 0x00000002 /* - serial port 0 transmission */
23#define DMxCTR_BG_SC0RX 0x00000003 /* - serial port 0 reception */
24#define DMxCTR_BG_SC1TX 0x00000004 /* - serial port 1 transmission */
25#define DMxCTR_BG_SC1RX 0x00000005 /* - serial port 1 reception */
26#define DMxCTR_BG_SC2TX 0x00000006 /* - serial port 2 transmission */
27#define DMxCTR_BG_SC2RX 0x00000007 /* - serial port 2 reception */
28#define DMxCTR_BG_TM0UFLOW 0x00000008 /* - timer 0 underflow */
29#define DMxCTR_BG_TM1UFLOW 0x00000009 /* - timer 1 underflow */
30#define DMxCTR_BG_TM2UFLOW 0x0000000a /* - timer 2 underflow */
31#define DMxCTR_BG_TM3UFLOW 0x0000000b /* - timer 3 underflow */
32#define DMxCTR_BG_TM6ACMPCAP 0x0000000c /* - timer 6A compare/capture */
33#define DMxCTR_BG_AFE 0x0000000d /* - analogue front-end interrupt source */
34#define DMxCTR_BG_ADC 0x0000000e /* - A/D conversion end interrupt source */
35#define DMxCTR_BG_IRDA 0x0000000f /* - IrDA interrupt source */
36#define DMxCTR_BG_RTC 0x00000010 /* - RTC interrupt source */
37#define DMxCTR_BG_XIRQ0 0x00000011 /* - XIRQ0 pin interrupt source */
38#define DMxCTR_BG_XIRQ1 0x00000012 /* - XIRQ1 pin interrupt source */
39#define DMxCTR_BG_XDMR0 0x00000013 /* - external request 0 source (XDMR0 pin) */
40#define DMxCTR_BG_XDMR1 0x00000014 /* - external request 1 source (XDMR1 pin) */
41#define DMxCTR_SAM 0x000000e0 /* DMA transfer src addr mode */
42#define DMxCTR_SAM_INCR 0x00000000 /* - increment */
43#define DMxCTR_SAM_DECR 0x00000020 /* - decrement */
44#define DMxCTR_SAM_FIXED 0x00000040 /* - fixed */
45#define DMxCTR_DAM 0x00000000 /* DMA transfer dest addr mode */
46#define DMxCTR_DAM_INCR 0x00000000 /* - increment */
47#define DMxCTR_DAM_DECR 0x00000100 /* - decrement */
48#define DMxCTR_DAM_FIXED 0x00000200 /* - fixed */
49#define DMxCTR_TM 0x00001800 /* DMA transfer mode */
50#define DMxCTR_TM_BATCH 0x00000000 /* - batch transfer */
51#define DMxCTR_TM_INTERM 0x00001000 /* - intermittent transfer */
52#define DMxCTR_UT 0x00006000 /* DMA transfer unit */
53#define DMxCTR_UT_1 0x00000000 /* - 1 byte */
54#define DMxCTR_UT_2 0x00002000 /* - 2 byte */
55#define DMxCTR_UT_4 0x00004000 /* - 4 byte */
56#define DMxCTR_UT_16 0x00006000 /* - 16 byte */
57#define DMxCTR_TEN 0x00010000 /* DMA channel transfer enable */
58#define DMxCTR_RQM 0x00060000 /* external request input source mode */
59#define DMxCTR_RQM_FALLEDGE 0x00000000 /* - falling edge */
60#define DMxCTR_RQM_RISEEDGE 0x00020000 /* - rising edge */
61#define DMxCTR_RQM_LOLEVEL 0x00040000 /* - low level */
62#define DMxCTR_RQM_HILEVEL 0x00060000 /* - high level */
63#define DMxCTR_RQF 0x01000000 /* DMA transfer request flag */
64#define DMxCTR_XEND 0x80000000 /* DMA transfer end flag */
65
66#define DMxSRC(N) __SYSREG(0xd2000004 + ((N) * 0x100), u32) /* control reg */
67
68#define DMxDST(N) __SYSREG(0xd2000008 + ((N) * 0x100), u32) /* src addr reg */
69
70#define DMxSIZ(N) __SYSREG(0xd200000c + ((N) * 0x100), u32) /* dest addr reg */
71#define DMxSIZ_CT 0x000fffff /* number of bytes to transfer */
72
73#define DMxCYC(N) __SYSREG(0xd2000010 + ((N) * 0x100), u32) /* intermittent
74 * size reg */
75#define DMxCYC_CYC 0x000000ff /* number of interrmittent transfers -1 */
76
77#define DM0IRQ 16 /* DMA channel 0 complete IRQ */
78#define DM1IRQ 17 /* DMA channel 1 complete IRQ */
79#define DM2IRQ 18 /* DMA channel 2 complete IRQ */
80#define DM3IRQ 19 /* DMA channel 3 complete IRQ */
81
82#define DM0ICR GxICR(DM0IRQ) /* DMA channel 0 complete intr ctrl reg */
83#define DM1ICR GxICR(DM0IR1) /* DMA channel 1 complete intr ctrl reg */
84#define DM2ICR GxICR(DM0IR2) /* DMA channel 2 complete intr ctrl reg */
85#define DM3ICR GxICR(DM0IR3) /* DMA channel 3 complete intr ctrl reg */
86
87#ifndef __ASSEMBLY__
88
89struct mn10300_dmactl_regs {
90 u32 ctr;
91 const void *src;
92 void *dst;
93 u32 siz;
94 u32 cyc;
95} __attribute__((aligned(0x100)));
96
97#endif /* __ASSEMBLY__ */
98
99#endif /* __KERNEL__ */
100
101#endif /* _ASM_DMACTL_REGS_H */
diff --git a/include/asm-mn10300/elf.h b/include/asm-mn10300/elf.h
deleted file mode 100644
index bf09f8bb392e..000000000000
--- a/include/asm-mn10300/elf.h
+++ /dev/null
@@ -1,147 +0,0 @@
1/* MN10300 ELF constant and register definitions
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12#ifndef _ASM_ELF_H
13#define _ASM_ELF_H
14
15#include <linux/utsname.h>
16#include <asm/ptrace.h>
17#include <asm/user.h>
18
19/*
20 * AM33 relocations
21 */
22#define R_MN10300_NONE 0 /* No reloc. */
23#define R_MN10300_32 1 /* Direct 32 bit. */
24#define R_MN10300_16 2 /* Direct 16 bit. */
25#define R_MN10300_8 3 /* Direct 8 bit. */
26#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */
27#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */
28#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */
29#define R_MN10300_24 9 /* Direct 24 bit. */
30#define R_MN10300_RELATIVE 23 /* Adjust by program base. */
31
32/*
33 * ELF register definitions..
34 */
35typedef unsigned long elf_greg_t;
36
37#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
38typedef elf_greg_t elf_gregset_t[ELF_NGREG];
39
40#define ELF_NFPREG 32
41typedef float elf_fpreg_t;
42
43typedef struct {
44 elf_fpreg_t fpregs[ELF_NFPREG];
45 u_int32_t fpcr;
46} elf_fpregset_t;
47
48extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
49
50/*
51 * This is used to ensure we don't load something for the wrong architecture
52 */
53#define elf_check_arch(x) \
54 (((x)->e_machine == EM_CYGNUS_MN10300) || \
55 ((x)->e_machine == EM_MN10300))
56
57/*
58 * These are used to set parameters in the core dumps.
59 */
60#define ELF_CLASS ELFCLASS32
61#define ELF_DATA ELFDATA2LSB
62#define ELF_ARCH EM_MN10300
63
64/*
65 * ELF process initialiser
66 */
67#define ELF_PLAT_INIT(_r, load_addr) \
68do { \
69 struct pt_regs *_ur = current->thread.uregs; \
70 _ur->a3 = 0; _ur->a2 = 0; _ur->d3 = 0; _ur->d2 = 0; \
71 _ur->mcvf = 0; _ur->mcrl = 0; _ur->mcrh = 0; _ur->mdrq = 0; \
72 _ur->e1 = 0; _ur->e0 = 0; _ur->e7 = 0; _ur->e6 = 0; \
73 _ur->e5 = 0; _ur->e4 = 0; _ur->e3 = 0; _ur->e2 = 0; \
74 _ur->lar = 0; _ur->lir = 0; _ur->mdr = 0; \
75 _ur->a1 = 0; _ur->a0 = 0; _ur->d1 = 0; _ur->d0 = 0; \
76} while (0)
77
78#define USE_ELF_CORE_DUMP
79#define ELF_EXEC_PAGESIZE 4096
80
81/*
82 * This is the location that an ET_DYN program is loaded if exec'ed. Typical
83 * use of this is to invoke "./ld.so someprog" to test out a new version of
84 * the loader. We need to make sure that it is out of the way of the program
85 * that it will "exec", and that there is sufficient room for the brk.
86 * - must clear the VMALLOC area
87 */
88#define ELF_ET_DYN_BASE 0x04000000
89
90/*
91 * regs is struct pt_regs, pr_reg is elf_gregset_t (which is
92 * now struct user_regs, they are different)
93 * - ELF_CORE_COPY_REGS has been guessed, and may be wrong
94 */
95#define ELF_CORE_COPY_REGS(pr_reg, regs) \
96do { \
97 pr_reg[0] = regs->a3; \
98 pr_reg[1] = regs->a2; \
99 pr_reg[2] = regs->d3; \
100 pr_reg[3] = regs->d2; \
101 pr_reg[4] = regs->mcvf; \
102 pr_reg[5] = regs->mcrl; \
103 pr_reg[6] = regs->mcrh; \
104 pr_reg[7] = regs->mdrq; \
105 pr_reg[8] = regs->e1; \
106 pr_reg[9] = regs->e0; \
107 pr_reg[10] = regs->e7; \
108 pr_reg[11] = regs->e6; \
109 pr_reg[12] = regs->e5; \
110 pr_reg[13] = regs->e4; \
111 pr_reg[14] = regs->e3; \
112 pr_reg[15] = regs->e2; \
113 pr_reg[16] = regs->sp; \
114 pr_reg[17] = regs->lar; \
115 pr_reg[18] = regs->lir; \
116 pr_reg[19] = regs->mdr; \
117 pr_reg[20] = regs->a1; \
118 pr_reg[21] = regs->a0; \
119 pr_reg[22] = regs->d1; \
120 pr_reg[23] = regs->d0; \
121 pr_reg[24] = regs->orig_d0; \
122 pr_reg[25] = regs->epsw; \
123 pr_reg[26] = regs->pc; \
124} while (0);
125
126/*
127 * This yields a mask that user programs can use to figure out what
128 * instruction set this CPU supports. This could be done in user space,
129 * but it's not easy, and we've already done it here.
130 */
131#define ELF_HWCAP (0)
132
133/*
134 * This yields a string that ld.so will use to load implementation
135 * specific libraries for optimization. This is more specific in
136 * intent than poking at uname or /proc/cpuinfo.
137 *
138 * For the moment, we have only optimizations for the Intel generations,
139 * but that could change...
140 */
141#define ELF_PLATFORM (NULL)
142
143#ifdef __KERNEL__
144#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
145#endif
146
147#endif /* _ASM_ELF_H */
diff --git a/include/asm-mn10300/emergency-restart.h b/include/asm-mn10300/emergency-restart.h
deleted file mode 100644
index 3711bd9d50bd..000000000000
--- a/include/asm-mn10300/emergency-restart.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/emergency-restart.h>
diff --git a/include/asm-mn10300/errno.h b/include/asm-mn10300/errno.h
deleted file mode 100644
index 4c82b503d92f..000000000000
--- a/include/asm-mn10300/errno.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/errno.h>
diff --git a/include/asm-mn10300/exceptions.h b/include/asm-mn10300/exceptions.h
deleted file mode 100644
index fa16466ef3f9..000000000000
--- a/include/asm-mn10300/exceptions.h
+++ /dev/null
@@ -1,121 +0,0 @@
1/* MN10300 Microcontroller core exceptions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_EXCEPTIONS_H
12#define _ASM_EXCEPTIONS_H
13
14#include <linux/linkage.h>
15
16/*
17 * define the breakpoint instruction opcode to use
18 * - note that the JTAG unit steals 0xFF, so we want to avoid that if we can
19 * (can use 0xF7)
20 */
21#define GDBSTUB_BKPT 0xFF
22
23#ifndef __ASSEMBLY__
24
25/*
26 * enumeration of exception codes (as extracted from TBR MSW)
27 */
28enum exception_code {
29 EXCEP_RESET = 0x000000, /* reset */
30
31 /* MMU exceptions */
32 EXCEP_ITLBMISS = 0x000100, /* instruction TLB miss */
33 EXCEP_DTLBMISS = 0x000108, /* data TLB miss */
34 EXCEP_IAERROR = 0x000110, /* instruction address */
35 EXCEP_DAERROR = 0x000118, /* data address */
36
37 /* system exceptions */
38 EXCEP_TRAP = 0x000128, /* program interrupt (PI instruction) */
39 EXCEP_ISTEP = 0x000130, /* single step */
40 EXCEP_IBREAK = 0x000150, /* instruction breakpoint */
41 EXCEP_OBREAK = 0x000158, /* operand breakpoint */
42 EXCEP_PRIVINS = 0x000160, /* privileged instruction execution */
43 EXCEP_UNIMPINS = 0x000168, /* unimplemented instruction execution */
44 EXCEP_UNIMPEXINS = 0x000170, /* unimplemented extended instruction execution */
45 EXCEP_MEMERR = 0x000178, /* illegal memory access */
46 EXCEP_MISALIGN = 0x000180, /* misalignment */
47 EXCEP_BUSERROR = 0x000188, /* bus error */
48 EXCEP_ILLINSACC = 0x000190, /* illegal instruction access */
49 EXCEP_ILLDATACC = 0x000198, /* illegal data access */
50 EXCEP_IOINSACC = 0x0001a0, /* I/O space instruction access */
51 EXCEP_PRIVINSACC = 0x0001a8, /* privileged space instruction access */
52 EXCEP_PRIVDATACC = 0x0001b0, /* privileged space data access */
53 EXCEP_DATINSACC = 0x0001b8, /* data space instruction access */
54 EXCEP_DOUBLE_FAULT = 0x000200, /* double fault */
55
56 /* FPU exceptions */
57 EXCEP_FPU_DISABLED = 0x0001c0, /* FPU disabled */
58 EXCEP_FPU_UNIMPINS = 0x0001c8, /* FPU unimplemented operation */
59 EXCEP_FPU_OPERATION = 0x0001d0, /* FPU operation */
60
61 /* interrupts */
62 EXCEP_WDT = 0x000240, /* watchdog timer overflow */
63 EXCEP_NMI = 0x000248, /* non-maskable interrupt */
64 EXCEP_IRQ_LEVEL0 = 0x000280, /* level 0 maskable interrupt */
65 EXCEP_IRQ_LEVEL1 = 0x000288, /* level 1 maskable interrupt */
66 EXCEP_IRQ_LEVEL2 = 0x000290, /* level 2 maskable interrupt */
67 EXCEP_IRQ_LEVEL3 = 0x000298, /* level 3 maskable interrupt */
68 EXCEP_IRQ_LEVEL4 = 0x0002a0, /* level 4 maskable interrupt */
69 EXCEP_IRQ_LEVEL5 = 0x0002a8, /* level 5 maskable interrupt */
70 EXCEP_IRQ_LEVEL6 = 0x0002b0, /* level 6 maskable interrupt */
71
72 /* system calls */
73 EXCEP_SYSCALL0 = 0x000300, /* system call 0 */
74 EXCEP_SYSCALL1 = 0x000308, /* system call 1 */
75 EXCEP_SYSCALL2 = 0x000310, /* system call 2 */
76 EXCEP_SYSCALL3 = 0x000318, /* system call 3 */
77 EXCEP_SYSCALL4 = 0x000320, /* system call 4 */
78 EXCEP_SYSCALL5 = 0x000328, /* system call 5 */
79 EXCEP_SYSCALL6 = 0x000330, /* system call 6 */
80 EXCEP_SYSCALL7 = 0x000338, /* system call 7 */
81 EXCEP_SYSCALL8 = 0x000340, /* system call 8 */
82 EXCEP_SYSCALL9 = 0x000348, /* system call 9 */
83 EXCEP_SYSCALL10 = 0x000350, /* system call 10 */
84 EXCEP_SYSCALL11 = 0x000358, /* system call 11 */
85 EXCEP_SYSCALL12 = 0x000360, /* system call 12 */
86 EXCEP_SYSCALL13 = 0x000368, /* system call 13 */
87 EXCEP_SYSCALL14 = 0x000370, /* system call 14 */
88 EXCEP_SYSCALL15 = 0x000378, /* system call 15 */
89};
90
91extern void __set_intr_stub(enum exception_code code, void *handler);
92extern void set_intr_stub(enum exception_code code, void *handler);
93extern void set_jtag_stub(enum exception_code code, void *handler);
94
95struct pt_regs;
96
97extern asmlinkage void __common_exception(void);
98extern asmlinkage void itlb_miss(void);
99extern asmlinkage void dtlb_miss(void);
100extern asmlinkage void itlb_aerror(void);
101extern asmlinkage void dtlb_aerror(void);
102extern asmlinkage void raw_bus_error(void);
103extern asmlinkage void double_fault(void);
104extern asmlinkage int system_call(struct pt_regs *);
105extern asmlinkage void fpu_exception(struct pt_regs *, enum exception_code);
106extern asmlinkage void nmi(struct pt_regs *, enum exception_code);
107extern asmlinkage void uninitialised_exception(struct pt_regs *,
108 enum exception_code);
109extern asmlinkage void irq_handler(void);
110extern asmlinkage void profile_handler(void);
111extern asmlinkage void nmi_handler(void);
112extern asmlinkage void misalignment(struct pt_regs *, enum exception_code);
113
114extern void die(const char *, struct pt_regs *, enum exception_code)
115 ATTRIB_NORET;
116
117extern int die_if_no_fixup(const char *, struct pt_regs *, enum exception_code);
118
119#endif /* __ASSEMBLY__ */
120
121#endif /* _ASM_EXCEPTIONS_H */
diff --git a/include/asm-mn10300/fb.h b/include/asm-mn10300/fb.h
deleted file mode 100644
index 697b24a91e1a..000000000000
--- a/include/asm-mn10300/fb.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/* MN10300 Frame buffer stuff
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_FB_H
12#define _ASM_FB_H
13
14#include <linux/fb.h>
15
16#define fb_pgprotect(...) do {} while (0)
17
18static inline int fb_is_primary_device(struct fb_info *info)
19{
20 return 0;
21}
22
23#endif /* _ASM_FB_H */
diff --git a/include/asm-mn10300/fcntl.h b/include/asm-mn10300/fcntl.h
deleted file mode 100644
index 46ab12db5739..000000000000
--- a/include/asm-mn10300/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/fcntl.h>
diff --git a/include/asm-mn10300/fpu.h b/include/asm-mn10300/fpu.h
deleted file mode 100644
index 64a2b83a7a6a..000000000000
--- a/include/asm-mn10300/fpu.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/* MN10300 FPU definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * Derived from include/asm-i386/i387.h: Copyright (C) 1994 Linus Torvalds
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12#ifndef _ASM_FPU_H
13#define _ASM_FPU_H
14
15#include <asm/processor.h>
16#include <asm/sigcontext.h>
17#include <asm/user.h>
18
19#ifdef __KERNEL__
20
21/* the task that owns the FPU state */
22extern struct task_struct *fpu_state_owner;
23
24#define set_using_fpu(tsk) \
25do { \
26 (tsk)->thread.fpu_flags |= THREAD_USING_FPU; \
27} while (0)
28
29#define clear_using_fpu(tsk) \
30do { \
31 (tsk)->thread.fpu_flags &= ~THREAD_USING_FPU; \
32} while (0)
33
34#define is_using_fpu(tsk) ((tsk)->thread.fpu_flags & THREAD_USING_FPU)
35
36#define unlazy_fpu(tsk) \
37do { \
38 preempt_disable(); \
39 if (fpu_state_owner == (tsk)) \
40 fpu_save(&tsk->thread.fpu_state); \
41 preempt_enable(); \
42} while (0)
43
44#define exit_fpu() \
45do { \
46 struct task_struct *__tsk = current; \
47 preempt_disable(); \
48 if (fpu_state_owner == __tsk) \
49 fpu_state_owner = NULL; \
50 preempt_enable(); \
51} while (0)
52
53#define flush_fpu() \
54do { \
55 struct task_struct *__tsk = current; \
56 preempt_disable(); \
57 if (fpu_state_owner == __tsk) { \
58 fpu_state_owner = NULL; \
59 __tsk->thread.uregs->epsw &= ~EPSW_FE; \
60 } \
61 preempt_enable(); \
62 clear_using_fpu(__tsk); \
63} while (0)
64
65extern asmlinkage void fpu_init_state(void);
66extern asmlinkage void fpu_kill_state(struct task_struct *);
67extern asmlinkage void fpu_disabled(struct pt_regs *, enum exception_code);
68extern asmlinkage void fpu_exception(struct pt_regs *, enum exception_code);
69
70#ifdef CONFIG_FPU
71extern asmlinkage void fpu_save(struct fpu_state_struct *);
72extern asmlinkage void fpu_restore(struct fpu_state_struct *);
73#else
74#define fpu_save(a)
75#define fpu_restore(a)
76#endif /* CONFIG_FPU */
77
78/*
79 * signal frame handlers
80 */
81extern int fpu_setup_sigcontext(struct fpucontext *buf);
82extern int fpu_restore_sigcontext(struct fpucontext *buf);
83
84#endif /* __KERNEL__ */
85#endif /* _ASM_FPU_H */
diff --git a/include/asm-mn10300/frame.inc b/include/asm-mn10300/frame.inc
deleted file mode 100644
index 5b1949bdf039..000000000000
--- a/include/asm-mn10300/frame.inc
+++ /dev/null
@@ -1,91 +0,0 @@
1/* MN10300 Microcontroller core system register definitions -*- asm -*-
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_FRAME_INC
12#define _ASM_FRAME_INC
13
14#ifndef __ASSEMBLY__
15#error not for use in C files
16#endif
17
18#ifndef __ASM_OFFSETS_H__
19#include <asm/asm-offsets.h>
20#endif
21
22#define pi break
23
24#define fp a3
25
26###############################################################################
27#
28# build a stack frame from the registers
29# - the caller has subtracted 4 from SP before coming here
30#
31###############################################################################
32.macro SAVE_ALL
33 add -4,sp # next exception frame ptr save area
34 movm [other],(sp)
35 mov usp,a1
36 mov a1,(sp) # USP in MOVM[other] dummy slot
37 movm [d2,d3,a2,a3,exreg0,exreg1,exother],(sp)
38 mov sp,fp # FRAME pointer in A3
39 add -12,sp # allow for calls to be made
40 mov (__frame),a1
41 mov a1,(REG_NEXT,fp)
42 mov fp,(__frame)
43
44 and ~EPSW_FE,epsw # disable the FPU inside the kernel
45
46 # we may be holding current in E2
47#ifdef CONFIG_MN10300_CURRENT_IN_E2
48 mov (__current),e2
49#endif
50.endm
51
52###############################################################################
53#
54# restore the registers from a stack frame
55#
56###############################################################################
57.macro RESTORE_ALL
58 # peel back the stack to the calling frame
59 # - this permits execve() to discard extra frames due to kernel syscalls
60 mov (__frame),fp
61 mov fp,sp
62 mov (REG_NEXT,fp),d0 # userspace has regs->next == 0
63 mov d0,(__frame)
64
65#ifndef CONFIG_MN10300_USING_JTAG
66 mov (REG_EPSW,fp),d0
67 btst EPSW_T,d0
68 beq 99f
69
70 or EPSW_NMID,epsw
71 movhu (DCR),d1
72 or 0x0001, d1
73 movhu d1,(DCR)
74
7599:
76#endif
77 movm (sp),[d2,d3,a2,a3,exreg0,exreg1,exother]
78
79 # must restore usp even if returning to kernel space,
80 # when CONFIG_PREEMPT is enabled.
81 mov (sp),a1 # USP in MOVM[other] dummy slot
82 mov a1,usp
83
84 movm (sp),[other]
85 add 8,sp
86 rti
87
88.endm
89
90
91#endif /* _ASM_FRAME_INC */
diff --git a/include/asm-mn10300/ftrace.h b/include/asm-mn10300/ftrace.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/include/asm-mn10300/ftrace.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/include/asm-mn10300/futex.h b/include/asm-mn10300/futex.h
deleted file mode 100644
index 0b745828f42b..000000000000
--- a/include/asm-mn10300/futex.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/futex.h>
diff --git a/include/asm-mn10300/gdb-stub.h b/include/asm-mn10300/gdb-stub.h
deleted file mode 100644
index e5a6368559af..000000000000
--- a/include/asm-mn10300/gdb-stub.h
+++ /dev/null
@@ -1,183 +0,0 @@
1/* MN10300 Kernel GDB stub definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from asm-mips/gdb-stub.h (c) 1995 Andreas Busse
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12#ifndef _ASM_GDB_STUB_H
13#define _ASM_GDB_STUB_H
14
15#include <asm/exceptions.h>
16
17/*
18 * register ID numbers in GDB remote protocol
19 */
20
21#define GDB_REGID_PC 9
22#define GDB_REGID_FP 7
23#define GDB_REGID_SP 8
24
25/*
26 * virtual stack layout for the GDB exception handler
27 */
28#define NUMREGS 64
29
30#define GDB_FR_D0 (0 * 4)
31#define GDB_FR_D1 (1 * 4)
32#define GDB_FR_D2 (2 * 4)
33#define GDB_FR_D3 (3 * 4)
34#define GDB_FR_A0 (4 * 4)
35#define GDB_FR_A1 (5 * 4)
36#define GDB_FR_A2 (6 * 4)
37#define GDB_FR_A3 (7 * 4)
38
39#define GDB_FR_SP (8 * 4)
40#define GDB_FR_PC (9 * 4)
41#define GDB_FR_MDR (10 * 4)
42#define GDB_FR_EPSW (11 * 4)
43#define GDB_FR_LIR (12 * 4)
44#define GDB_FR_LAR (13 * 4)
45#define GDB_FR_MDRQ (14 * 4)
46
47#define GDB_FR_E0 (15 * 4)
48#define GDB_FR_E1 (16 * 4)
49#define GDB_FR_E2 (17 * 4)
50#define GDB_FR_E3 (18 * 4)
51#define GDB_FR_E4 (19 * 4)
52#define GDB_FR_E5 (20 * 4)
53#define GDB_FR_E6 (21 * 4)
54#define GDB_FR_E7 (22 * 4)
55
56#define GDB_FR_SSP (23 * 4)
57#define GDB_FR_MSP (24 * 4)
58#define GDB_FR_USP (25 * 4)
59#define GDB_FR_MCRH (26 * 4)
60#define GDB_FR_MCRL (27 * 4)
61#define GDB_FR_MCVF (28 * 4)
62
63#define GDB_FR_FPCR (29 * 4)
64#define GDB_FR_DUMMY0 (30 * 4)
65#define GDB_FR_DUMMY1 (31 * 4)
66
67#define GDB_FR_FS0 (32 * 4)
68
69#define GDB_FR_SIZE (NUMREGS * 4)
70
71#ifndef __ASSEMBLY__
72
73/*
74 * This is the same as above, but for the high-level
75 * part of the GDB stub.
76 */
77
78struct gdb_regs {
79 /* saved main processor registers */
80 u32 d0, d1, d2, d3, a0, a1, a2, a3;
81 u32 sp, pc, mdr, epsw, lir, lar, mdrq;
82 u32 e0, e1, e2, e3, e4, e5, e6, e7;
83 u32 ssp, msp, usp, mcrh, mcrl, mcvf;
84
85 /* saved floating point registers */
86 u32 fpcr, _dummy0, _dummy1;
87 u32 fs0, fs1, fs2, fs3, fs4, fs5, fs6, fs7;
88 u32 fs8, fs9, fs10, fs11, fs12, fs13, fs14, fs15;
89 u32 fs16, fs17, fs18, fs19, fs20, fs21, fs22, fs23;
90 u32 fs24, fs25, fs26, fs27, fs28, fs29, fs30, fs31;
91};
92
93/*
94 * Prototypes
95 */
96extern void show_registers_only(struct pt_regs *regs);
97
98extern asmlinkage void gdbstub_init(void);
99extern asmlinkage void gdbstub_exit(int status);
100extern asmlinkage void gdbstub_io_init(void);
101extern asmlinkage void gdbstub_io_set_baud(unsigned baud);
102extern asmlinkage int gdbstub_io_rx_char(unsigned char *_ch, int nonblock);
103extern asmlinkage void gdbstub_io_tx_char(unsigned char ch);
104extern asmlinkage void gdbstub_io_tx_flush(void);
105
106extern asmlinkage void gdbstub_io_rx_handler(void);
107extern asmlinkage void gdbstub_rx_irq(struct pt_regs *, enum exception_code);
108extern asmlinkage int gdbstub_intercept(struct pt_regs *, enum exception_code);
109extern asmlinkage void gdbstub_exception(struct pt_regs *, enum exception_code);
110extern asmlinkage void __gdbstub_bug_trap(void);
111extern asmlinkage void __gdbstub_pause(void);
112extern asmlinkage void start_kernel(void);
113
114#ifndef CONFIG_MN10300_CACHE_DISABLED
115extern asmlinkage void gdbstub_purge_cache(void);
116#else
117#define gdbstub_purge_cache() do {} while (0)
118#endif
119
120/* Used to prevent crashes in memory access */
121extern asmlinkage int gdbstub_read_byte(const u8 *, u8 *);
122extern asmlinkage int gdbstub_read_word(const u8 *, u8 *);
123extern asmlinkage int gdbstub_read_dword(const u8 *, u8 *);
124extern asmlinkage int gdbstub_write_byte(u32, u8 *);
125extern asmlinkage int gdbstub_write_word(u32, u8 *);
126extern asmlinkage int gdbstub_write_dword(u32, u8 *);
127
128extern asmlinkage void gdbstub_read_byte_guard(void);
129extern asmlinkage void gdbstub_read_byte_cont(void);
130extern asmlinkage void gdbstub_read_word_guard(void);
131extern asmlinkage void gdbstub_read_word_cont(void);
132extern asmlinkage void gdbstub_read_dword_guard(void);
133extern asmlinkage void gdbstub_read_dword_cont(void);
134extern asmlinkage void gdbstub_write_byte_guard(void);
135extern asmlinkage void gdbstub_write_byte_cont(void);
136extern asmlinkage void gdbstub_write_word_guard(void);
137extern asmlinkage void gdbstub_write_word_cont(void);
138extern asmlinkage void gdbstub_write_dword_guard(void);
139extern asmlinkage void gdbstub_write_dword_cont(void);
140
141extern u8 gdbstub_rx_buffer[PAGE_SIZE];
142extern u32 gdbstub_rx_inp;
143extern u32 gdbstub_rx_outp;
144extern u8 gdbstub_rx_overflow;
145extern u8 gdbstub_busy;
146extern u8 gdbstub_rx_unget;
147
148#ifdef CONFIG_GDBSTUB_DEBUGGING
149extern void gdbstub_printk(const char *fmt, ...)
150 __attribute__((format(printf, 1, 2)));
151#else
152static inline __attribute__((format(printf, 1, 2)))
153void gdbstub_printk(const char *fmt, ...)
154{
155}
156#endif
157
158#ifdef CONFIG_GDBSTUB_DEBUG_ENTRY
159#define gdbstub_entry(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)
160#else
161#define gdbstub_entry(FMT, ...) ({ 0; })
162#endif
163
164#ifdef CONFIG_GDBSTUB_DEBUG_PROTOCOL
165#define gdbstub_proto(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)
166#else
167#define gdbstub_proto(FMT, ...) ({ 0; })
168#endif
169
170#ifdef CONFIG_GDBSTUB_DEBUG_IO
171#define gdbstub_io(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)
172#else
173#define gdbstub_io(FMT, ...) ({ 0; })
174#endif
175
176#ifdef CONFIG_GDBSTUB_DEBUG_BREAKPOINT
177#define gdbstub_bkpt(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)
178#else
179#define gdbstub_bkpt(FMT, ...) ({ 0; })
180#endif
181
182#endif /* !__ASSEMBLY__ */
183#endif /* _ASM_GDB_STUB_H */
diff --git a/include/asm-mn10300/hardirq.h b/include/asm-mn10300/hardirq.h
deleted file mode 100644
index 54d950117674..000000000000
--- a/include/asm-mn10300/hardirq.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/* MN10300 Hardware IRQ statistics and management
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Modified by David Howells (dhowells@redhat.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12#ifndef _ASM_HARDIRQ_H
13#define _ASM_HARDIRQ_H
14
15#include <linux/threads.h>
16#include <linux/irq.h>
17#include <asm/exceptions.h>
18
19/* assembly code in softirq.h is sensitive to the offsets of these fields */
20typedef struct {
21 unsigned int __softirq_pending;
22 unsigned long idle_timestamp;
23 unsigned int __nmi_count; /* arch dependent */
24 unsigned int __irq_count; /* arch dependent */
25} ____cacheline_aligned irq_cpustat_t;
26
27#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
28
29extern void ack_bad_irq(int irq);
30
31/*
32 * manipulate stubs in the MN10300 CPU Trap/Interrupt Vector table
33 * - these should jump to __common_exception in entry.S unless there's a good
34 * reason to do otherwise (see trap_preinit() in traps.c)
35 */
36typedef void (*intr_stub_fnx)(struct pt_regs *regs,
37 enum exception_code intcode);
38
39/*
40 * manipulate pointers in the Exception table (see entry.S)
41 * - these are indexed by decoding the lower 24 bits of the TBR register
42 * - note that the MN103E010 doesn't always trap through the correct vector,
43 * but does always set the TBR correctly
44 */
45extern asmlinkage void set_excp_vector(enum exception_code code,
46 intr_stub_fnx handler);
47
48#endif /* _ASM_HARDIRQ_H */
diff --git a/include/asm-mn10300/highmem.h b/include/asm-mn10300/highmem.h
deleted file mode 100644
index 90f2abb04bfd..000000000000
--- a/include/asm-mn10300/highmem.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/* MN10300 Virtual kernel memory mappings for high memory
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from include/asm-i386/highmem.h
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12#ifndef _ASM_HIGHMEM_H
13#define _ASM_HIGHMEM_H
14
15#ifdef __KERNEL__
16
17#include <linux/init.h>
18#include <linux/interrupt.h>
19#include <linux/highmem.h>
20#include <asm/kmap_types.h>
21#include <asm/pgtable.h>
22
23/* undef for production */
24#undef HIGHMEM_DEBUG
25
26/* declarations for highmem.c */
27extern unsigned long highstart_pfn, highend_pfn;
28
29extern pte_t *kmap_pte;
30extern pgprot_t kmap_prot;
31extern pte_t *pkmap_page_table;
32
33extern void __init kmap_init(void);
34
35/*
36 * Right now we initialize only a single pte table. It can be extended
37 * easily, subsequent pte tables have to be allocated in one physical
38 * chunk of RAM.
39 */
40#define PKMAP_BASE 0xfe000000UL
41#define LAST_PKMAP 1024
42#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
43#define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT)
44#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
45
46extern unsigned long kmap_high(struct page *page);
47extern void kunmap_high(struct page *page);
48
49static inline unsigned long kmap(struct page *page)
50{
51 if (in_interrupt())
52 BUG();
53 if (page < highmem_start_page)
54 return page_address(page);
55 return kmap_high(page);
56}
57
58static inline void kunmap(struct page *page)
59{
60 if (in_interrupt())
61 BUG();
62 if (page < highmem_start_page)
63 return;
64 kunmap_high(page);
65}
66
67/*
68 * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
69 * gives a more generic (and caching) interface. But kmap_atomic can
70 * be used in IRQ contexts, so in some (very limited) cases we need
71 * it.
72 */
73static inline unsigned long kmap_atomic(struct page *page, enum km_type type)
74{
75 enum fixed_addresses idx;
76 unsigned long vaddr;
77
78 if (page < highmem_start_page)
79 return page_address(page);
80
81 debug_kmap_atomic(type);
82 idx = type + KM_TYPE_NR * smp_processor_id();
83 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
84#if HIGHMEM_DEBUG
85 if (!pte_none(*(kmap_pte - idx)))
86 BUG();
87#endif
88 set_pte(kmap_pte - idx, mk_pte(page, kmap_prot));
89 __flush_tlb_one(vaddr);
90
91 return vaddr;
92}
93
94static inline void kunmap_atomic(unsigned long vaddr, enum km_type type)
95{
96#if HIGHMEM_DEBUG
97 enum fixed_addresses idx = type + KM_TYPE_NR * smp_processor_id();
98
99 if (vaddr < FIXADDR_START) /* FIXME */
100 return;
101
102 if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx))
103 BUG();
104
105 /*
106 * force other mappings to Oops if they'll try to access
107 * this pte without first remap it
108 */
109 pte_clear(kmap_pte - idx);
110 __flush_tlb_one(vaddr);
111#endif
112}
113
114#endif /* __KERNEL__ */
115
116#endif /* _ASM_HIGHMEM_H */
diff --git a/include/asm-mn10300/hw_irq.h b/include/asm-mn10300/hw_irq.h
deleted file mode 100644
index 70619901098e..000000000000
--- a/include/asm-mn10300/hw_irq.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/* MN10300 Hardware interrupt definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_HW_IRQ_H
12#define _ASM_HW_IRQ_H
13
14#endif /* _ASM_HW_IRQ_H */
diff --git a/include/asm-mn10300/intctl-regs.h b/include/asm-mn10300/intctl-regs.h
deleted file mode 100644
index ba544c796c5a..000000000000
--- a/include/asm-mn10300/intctl-regs.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/* MN10300 On-board interrupt controller registers
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_INTCTL_REGS_H
12#define _ASM_INTCTL_REGS_H
13
14#include <asm/cpu-regs.h>
15
16#ifdef __KERNEL__
17
18/* interrupt controller registers */
19#define GxICR(X) __SYSREG(0xd4000000 + (X) * 4, u16) /* group irq ctrl regs */
20
21#define IAGR __SYSREG(0xd4000100, u16) /* intr acceptance group reg */
22#define IAGR_GN 0x00fc /* group number register
23 * (documentation _has_ to be wrong)
24 */
25
26#define EXTMD __SYSREG(0xd4000200, u16) /* external pin intr spec reg */
27#define GET_XIRQ_TRIGGER(X) ((EXTMD >> ((X) * 2)) & 3)
28
29#define SET_XIRQ_TRIGGER(X,Y) \
30do { \
31 u16 x = EXTMD; \
32 x &= ~(3 << ((X) * 2)); \
33 x |= ((Y) & 3) << ((X) * 2); \
34 EXTMD = x; \
35} while (0)
36
37#define XIRQ_TRIGGER_LOWLEVEL 0
38#define XIRQ_TRIGGER_HILEVEL 1
39#define XIRQ_TRIGGER_NEGEDGE 2
40#define XIRQ_TRIGGER_POSEDGE 3
41
42/* non-maskable interrupt control */
43#define NMIIRQ 0
44#define NMICR GxICR(NMIIRQ) /* NMI control register */
45#define NMICR_NMIF 0x0001 /* NMI pin interrupt flag */
46#define NMICR_WDIF 0x0002 /* watchdog timer overflow flag */
47#define NMICR_ABUSERR 0x0008 /* async bus error flag */
48
49/* maskable interrupt control */
50#define GxICR_DETECT 0x0001 /* interrupt detect flag */
51#define GxICR_REQUEST 0x0010 /* interrupt request flag */
52#define GxICR_ENABLE 0x0100 /* interrupt enable flag */
53#define GxICR_LEVEL 0x7000 /* interrupt priority level */
54#define GxICR_LEVEL_0 0x0000 /* - level 0 */
55#define GxICR_LEVEL_1 0x1000 /* - level 1 */
56#define GxICR_LEVEL_2 0x2000 /* - level 2 */
57#define GxICR_LEVEL_3 0x3000 /* - level 3 */
58#define GxICR_LEVEL_4 0x4000 /* - level 4 */
59#define GxICR_LEVEL_5 0x5000 /* - level 5 */
60#define GxICR_LEVEL_6 0x6000 /* - level 6 */
61#define GxICR_LEVEL_SHIFT 12
62
63#ifndef __ASSEMBLY__
64extern void set_intr_level(int irq, u16 level);
65extern void set_intr_postackable(int irq);
66#endif
67
68/* external interrupts */
69#define XIRQxICR(X) GxICR((X)) /* external interrupt control regs */
70
71#endif /* __KERNEL__ */
72
73#endif /* _ASM_INTCTL_REGS_H */
diff --git a/include/asm-mn10300/io.h b/include/asm-mn10300/io.h
deleted file mode 100644
index c1a4119e6497..000000000000
--- a/include/asm-mn10300/io.h
+++ /dev/null
@@ -1,301 +0,0 @@
1/* MN10300 I/O port emulation and memory-mapped I/O
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_IO_H
12#define _ASM_IO_H
13
14#include <asm/page.h> /* I/O is all done through memory accesses */
15#include <asm/cpu-regs.h>
16#include <asm/cacheflush.h>
17
18#define mmiowb() do {} while (0)
19
20/*****************************************************************************/
21/*
22 * readX/writeX() are used to access memory mapped devices. On some
23 * architectures the memory mapped IO stuff needs to be accessed
24 * differently. On the x86 architecture, we just read/write the
25 * memory location directly.
26 */
27static inline u8 readb(const volatile void __iomem *addr)
28{
29 return *(const volatile u8 *) addr;
30}
31
32static inline u16 readw(const volatile void __iomem *addr)
33{
34 return *(const volatile u16 *) addr;
35}
36
37static inline u32 readl(const volatile void __iomem *addr)
38{
39 return *(const volatile u32 *) addr;
40}
41
42#define __raw_readb readb
43#define __raw_readw readw
44#define __raw_readl readl
45
46#define readb_relaxed readb
47#define readw_relaxed readw
48#define readl_relaxed readl
49
50static inline void writeb(u8 b, volatile void __iomem *addr)
51{
52 *(volatile u8 *) addr = b;
53}
54
55static inline void writew(u16 b, volatile void __iomem *addr)
56{
57 *(volatile u16 *) addr = b;
58}
59
60static inline void writel(u32 b, volatile void __iomem *addr)
61{
62 *(volatile u32 *) addr = b;
63}
64
65#define __raw_writeb writeb
66#define __raw_writew writew
67#define __raw_writel writel
68
69/*****************************************************************************/
70/*
71 * traditional input/output functions
72 */
73static inline u8 inb_local(unsigned long addr)
74{
75 return readb((volatile void __iomem *) addr);
76}
77
78static inline void outb_local(u8 b, unsigned long addr)
79{
80 return writeb(b, (volatile void __iomem *) addr);
81}
82
83static inline u8 inb(unsigned long addr)
84{
85 return readb((volatile void __iomem *) addr);
86}
87
88static inline u16 inw(unsigned long addr)
89{
90 return readw((volatile void __iomem *) addr);
91}
92
93static inline u32 inl(unsigned long addr)
94{
95 return readl((volatile void __iomem *) addr);
96}
97
98static inline void outb(u8 b, unsigned long addr)
99{
100 return writeb(b, (volatile void __iomem *) addr);
101}
102
103static inline void outw(u16 b, unsigned long addr)
104{
105 return writew(b, (volatile void __iomem *) addr);
106}
107
108static inline void outl(u32 b, unsigned long addr)
109{
110 return writel(b, (volatile void __iomem *) addr);
111}
112
113#define inb_p(addr) inb(addr)
114#define inw_p(addr) inw(addr)
115#define inl_p(addr) inl(addr)
116#define outb_p(x, addr) outb((x), (addr))
117#define outw_p(x, addr) outw((x), (addr))
118#define outl_p(x, addr) outl((x), (addr))
119
120static inline void insb(unsigned long addr, void *buffer, int count)
121{
122 if (count) {
123 u8 *buf = buffer;
124 do {
125 u8 x = inb(addr);
126 *buf++ = x;
127 } while (--count);
128 }
129}
130
131static inline void insw(unsigned long addr, void *buffer, int count)
132{
133 if (count) {
134 u16 *buf = buffer;
135 do {
136 u16 x = inw(addr);
137 *buf++ = x;
138 } while (--count);
139 }
140}
141
142static inline void insl(unsigned long addr, void *buffer, int count)
143{
144 if (count) {
145 u32 *buf = buffer;
146 do {
147 u32 x = inl(addr);
148 *buf++ = x;
149 } while (--count);
150 }
151}
152
153static inline void outsb(unsigned long addr, const void *buffer, int count)
154{
155 if (count) {
156 const u8 *buf = buffer;
157 do {
158 outb(*buf++, addr);
159 } while (--count);
160 }
161}
162
163static inline void outsw(unsigned long addr, const void *buffer, int count)
164{
165 if (count) {
166 const u16 *buf = buffer;
167 do {
168 outw(*buf++, addr);
169 } while (--count);
170 }
171}
172
173extern void __outsl(unsigned long addr, const void *buffer, int count);
174static inline void outsl(unsigned long addr, const void *buffer, int count)
175{
176 if ((unsigned long) buffer & 0x3)
177 return __outsl(addr, buffer, count);
178
179 if (count) {
180 const u32 *buf = buffer;
181 do {
182 outl(*buf++, addr);
183 } while (--count);
184 }
185}
186
187#define ioread8(addr) readb(addr)
188#define ioread16(addr) readw(addr)
189#define ioread32(addr) readl(addr)
190
191#define iowrite8(v, addr) writeb((v), (addr))
192#define iowrite16(v, addr) writew((v), (addr))
193#define iowrite32(v, addr) writel((v), (addr))
194
195#define ioread8_rep(p, dst, count) \
196 insb((unsigned long) (p), (dst), (count))
197#define ioread16_rep(p, dst, count) \
198 insw((unsigned long) (p), (dst), (count))
199#define ioread32_rep(p, dst, count) \
200 insl((unsigned long) (p), (dst), (count))
201
202#define iowrite8_rep(p, src, count) \
203 outsb((unsigned long) (p), (src), (count))
204#define iowrite16_rep(p, src, count) \
205 outsw((unsigned long) (p), (src), (count))
206#define iowrite32_rep(p, src, count) \
207 outsl((unsigned long) (p), (src), (count))
208
209
210#define IO_SPACE_LIMIT 0xffffffff
211
212#ifdef __KERNEL__
213
214#include <linux/vmalloc.h>
215#define __io_virt(x) ((void *) (x))
216
217/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
218struct pci_dev;
219extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
220static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
221{
222}
223
224/*
225 * Change virtual addresses to physical addresses and vv.
226 * These are pretty trivial
227 */
228static inline unsigned long virt_to_phys(volatile void *address)
229{
230 return __pa(address);
231}
232
233static inline void *phys_to_virt(unsigned long address)
234{
235 return __va(address);
236}
237
238/*
239 * Change "struct page" to physical address.
240 */
241static inline void *__ioremap(unsigned long offset, unsigned long size,
242 unsigned long flags)
243{
244 return (void *) offset;
245}
246
247static inline void *ioremap(unsigned long offset, unsigned long size)
248{
249 return (void *) offset;
250}
251
252/*
253 * This one maps high address device memory and turns off caching for that
254 * area. it's useful if some control registers are in such an area and write
255 * combining or read caching is not desirable:
256 */
257static inline void *ioremap_nocache(unsigned long offset, unsigned long size)
258{
259 return (void *) (offset | 0x20000000);
260}
261
262#define ioremap_wc ioremap_nocache
263
264static inline void iounmap(void *addr)
265{
266}
267
268static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
269{
270 return (void __iomem *) port;
271}
272
273static inline void ioport_unmap(void __iomem *p)
274{
275}
276
277#define xlate_dev_kmem_ptr(p) ((void *) (p))
278#define xlate_dev_mem_ptr(p) ((void *) (p))
279
280/*
281 * PCI bus iomem addresses must be in the region 0x80000000-0x9fffffff
282 */
283static inline unsigned long virt_to_bus(volatile void *address)
284{
285 return ((unsigned long) address) & ~0x20000000;
286}
287
288static inline void *bus_to_virt(unsigned long address)
289{
290 return (void *) address;
291}
292
293#define page_to_bus page_to_phys
294
295#define memset_io(a, b, c) memset(__io_virt(a), (b), (c))
296#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c))
297#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c))
298
299#endif /* __KERNEL__ */
300
301#endif /* _ASM_IO_H */
diff --git a/include/asm-mn10300/ioctl.h b/include/asm-mn10300/ioctl.h
deleted file mode 100644
index b279fe06dfe5..000000000000
--- a/include/asm-mn10300/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/include/asm-mn10300/ioctls.h b/include/asm-mn10300/ioctls.h
deleted file mode 100644
index dcbfb452974f..000000000000
--- a/include/asm-mn10300/ioctls.h
+++ /dev/null
@@ -1,88 +0,0 @@
1#ifndef _ASM_IOCTLS_H
2#define _ASM_IOCTLS_H
3
4#include <asm/ioctl.h>
5
6/* 0x54 is just a magic number to make these relatively unique ('T') */
7
8#define TCGETS 0x5401
9#define TCSETS 0x5402
10#define TCSETSW 0x5403
11#define TCSETSF 0x5404
12#define TCGETA 0x5405
13#define TCSETA 0x5406
14#define TCSETAW 0x5407
15#define TCSETAF 0x5408
16#define TCSBRK 0x5409
17#define TCXONC 0x540A
18#define TCFLSH 0x540B
19#define TIOCEXCL 0x540C
20#define TIOCNXCL 0x540D
21#define TIOCSCTTY 0x540E
22#define TIOCGPGRP 0x540F
23#define TIOCSPGRP 0x5410
24#define TIOCOUTQ 0x5411
25#define TIOCSTI 0x5412
26#define TIOCGWINSZ 0x5413
27#define TIOCSWINSZ 0x5414
28#define TIOCMGET 0x5415
29#define TIOCMBIS 0x5416
30#define TIOCMBIC 0x5417
31#define TIOCMSET 0x5418
32#define TIOCGSOFTCAR 0x5419
33#define TIOCSSOFTCAR 0x541A
34#define FIONREAD 0x541B
35#define TIOCINQ FIONREAD
36#define TIOCLINUX 0x541C
37#define TIOCCONS 0x541D
38#define TIOCGSERIAL 0x541E
39#define TIOCSSERIAL 0x541F
40#define TIOCPKT 0x5420
41#define FIONBIO 0x5421
42#define TIOCNOTTY 0x5422
43#define TIOCSETD 0x5423
44#define TIOCGETD 0x5424
45#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
46/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
47#define TIOCSBRK 0x5427 /* BSD compatibility */
48#define TIOCCBRK 0x5428 /* BSD compatibility */
49#define TIOCGSID 0x5429 /* Return the session ID of FD */
50#define TCGETS2 _IOR('T', 0x2A, struct termios2)
51#define TCSETS2 _IOW('T', 0x2B, struct termios2)
52#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
53#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
54#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number
55 * (of pty-mux device) */
56#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
57
58#define FIONCLEX 0x5450
59#define FIOCLEX 0x5451
60#define FIOASYNC 0x5452
61#define TIOCSERCONFIG 0x5453
62#define TIOCSERGWILD 0x5454
63#define TIOCSERSWILD 0x5455
64#define TIOCGLCKTRMIOS 0x5456
65#define TIOCSLCKTRMIOS 0x5457
66#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
67#define TIOCSERGETLSR 0x5459 /* Get line status register */
68#define TIOCSERGETMULTI 0x545A /* Get multiport config */
69#define TIOCSERSETMULTI 0x545B /* Set multiport config */
70
71#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
72#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
73#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
74#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
75#define FIOQSIZE 0x5460
76
77/* Used for packet mode */
78#define TIOCPKT_DATA 0
79#define TIOCPKT_FLUSHREAD 1
80#define TIOCPKT_FLUSHWRITE 2
81#define TIOCPKT_STOP 4
82#define TIOCPKT_START 8
83#define TIOCPKT_NOSTOP 16
84#define TIOCPKT_DOSTOP 32
85
86#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
87
88#endif /* _ASM_IOCTLS_H */
diff --git a/include/asm-mn10300/ipc.h b/include/asm-mn10300/ipc.h
deleted file mode 100644
index a46e3d9c2a3f..000000000000
--- a/include/asm-mn10300/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipc.h>
diff --git a/include/asm-mn10300/ipcbuf.h b/include/asm-mn10300/ipcbuf.h
deleted file mode 100644
index f6f63d448272..000000000000
--- a/include/asm-mn10300/ipcbuf.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _ASM_IPCBUF_H
2#define _ASM_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for MN10300 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* _ASM_IPCBUF_H */
diff --git a/include/asm-mn10300/irq.h b/include/asm-mn10300/irq.h
deleted file mode 100644
index 53b380116901..000000000000
--- a/include/asm-mn10300/irq.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/* MN10300 Hardware interrupt definitions
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Modified by David Howells (dhowells@redhat.com)
6 * - Derived from include/asm-i386/irq.h:
7 * - (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef _ASM_IRQ_H
15#define _ASM_IRQ_H
16
17#include <asm/intctl-regs.h>
18#include <asm/reset-regs.h>
19#include <asm/proc/irq.h>
20
21/* this number is used when no interrupt has been assigned */
22#define NO_IRQ INT_MAX
23
24/* hardware irq numbers */
25#define NR_IRQS GxICR_NUM_IRQS
26
27/* external hardware irq numbers */
28#define NR_XIRQS GxICR_NUM_XIRQS
29
30#define irq_canonicalize(IRQ) (IRQ)
31
32#endif /* _ASM_IRQ_H */
diff --git a/include/asm-mn10300/irq_regs.h b/include/asm-mn10300/irq_regs.h
deleted file mode 100644
index a848cd232eb4..000000000000
--- a/include/asm-mn10300/irq_regs.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* MN10300 IRQ registers pointer definition
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_IRQ_REGS_H
12#define _ASM_IRQ_REGS_H
13
14/*
15 * Per-cpu current frame pointer - the location of the last exception frame on
16 * the stack
17 */
18#define ARCH_HAS_OWN_IRQ_REGS
19
20#ifndef __ASSEMBLY__
21#define get_irq_regs() (__frame)
22#endif
23
24#endif /* _ASM_IRQ_REGS_H */
diff --git a/include/asm-mn10300/kdebug.h b/include/asm-mn10300/kdebug.h
deleted file mode 100644
index 0f47e112190c..000000000000
--- a/include/asm-mn10300/kdebug.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* MN10300 In-kernel death knells
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_KDEBUG_H
13#define _ASM_KDEBUG_H
14
15/* Grossly misnamed. */
16enum die_val {
17 DIE_OOPS = 1,
18 DIE_BREAKPOINT,
19 DIE_GPF,
20};
21
22#endif /* _ASM_KDEBUG_H */
diff --git a/include/asm-mn10300/kmap_types.h b/include/asm-mn10300/kmap_types.h
deleted file mode 100644
index 3398f9f35603..000000000000
--- a/include/asm-mn10300/kmap_types.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/* MN10300 kmap_atomic() slot IDs
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_KMAP_TYPES_H
12#define _ASM_KMAP_TYPES_H
13
14enum km_type {
15 KM_BOUNCE_READ,
16 KM_SKB_SUNRPC_DATA,
17 KM_SKB_DATA_SOFTIRQ,
18 KM_USER0,
19 KM_USER1,
20 KM_BIO_SRC_IRQ,
21 KM_BIO_DST_IRQ,
22 KM_PTE0,
23 KM_PTE1,
24 KM_IRQ0,
25 KM_IRQ1,
26 KM_SOFTIRQ0,
27 KM_SOFTIRQ1,
28 KM_TYPE_NR
29};
30
31#endif /* _ASM_KMAP_TYPES_H */
diff --git a/include/asm-mn10300/kprobes.h b/include/asm-mn10300/kprobes.h
deleted file mode 100644
index c800b590183a..000000000000
--- a/include/asm-mn10300/kprobes.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/* MN10300 Kernel Probes support
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by Mark Salter (msalter@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public Licence as published by
8 * the Free Software Foundation; either version 2 of the Licence, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public Licence for more details.
15 *
16 * You should have received a copy of the GNU General Public Licence
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 */
21#ifndef _ASM_KPROBES_H
22#define _ASM_KPROBES_H
23
24#include <linux/types.h>
25#include <linux/ptrace.h>
26
27struct kprobe;
28
29typedef unsigned char kprobe_opcode_t;
30#define BREAKPOINT_INSTRUCTION 0xff
31#define MAX_INSN_SIZE 8
32#define MAX_STACK_SIZE 128
33
34/* Architecture specific copy of original instruction */
35struct arch_specific_insn {
36 /* copy of original instruction
37 */
38 kprobe_opcode_t insn[MAX_INSN_SIZE];
39};
40
41extern const int kretprobe_blacklist_size;
42
43extern int kprobe_exceptions_notify(struct notifier_block *self,
44 unsigned long val, void *data);
45
46#define flush_insn_slot(p) do {} while (0)
47
48extern void arch_remove_kprobe(struct kprobe *p);
49
50#endif /* _ASM_KPROBES_H */
diff --git a/include/asm-mn10300/linkage.h b/include/asm-mn10300/linkage.h
deleted file mode 100644
index dda3002a5dfa..000000000000
--- a/include/asm-mn10300/linkage.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/* MN10300 Linkage and calling-convention overrides
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_LINKAGE_H
12#define _ASM_LINKAGE_H
13
14/* don't override anything */
15#define asmlinkage
16
17#define __ALIGN .align 4,0xcb
18#define __ALIGN_STR ".align 4,0xcb"
19
20#endif
diff --git a/include/asm-mn10300/local.h b/include/asm-mn10300/local.h
deleted file mode 100644
index c11c530f74d0..000000000000
--- a/include/asm-mn10300/local.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local.h>
diff --git a/include/asm-mn10300/mc146818rtc.h b/include/asm-mn10300/mc146818rtc.h
deleted file mode 100644
index df6bc6e0e8c6..000000000000
--- a/include/asm-mn10300/mc146818rtc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm/rtc-regs.h>
diff --git a/include/asm-mn10300/mman.h b/include/asm-mn10300/mman.h
deleted file mode 100644
index b7986b65addf..000000000000
--- a/include/asm-mn10300/mman.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/* MN10300 Constants for mmap and co.
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * - Derived from asm-x86/mman.h
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12#ifndef _ASM_MMAN_H
13#define _ASM_MMAN_H
14
15#include <asm-generic/mman.h>
16
17#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
18#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
19#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
20#define MAP_LOCKED 0x2000 /* pages are locked */
21#define MAP_NORESERVE 0x4000 /* don't check for reservations */
22#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
23#define MAP_NONBLOCK 0x10000 /* do not block on IO */
24
25#define MCL_CURRENT 1 /* lock all current mappings */
26#define MCL_FUTURE 2 /* lock all future mappings */
27
28#endif /* _ASM_MMAN_H */
diff --git a/include/asm-mn10300/mmu.h b/include/asm-mn10300/mmu.h
deleted file mode 100644
index 2d2d097e7309..000000000000
--- a/include/asm-mn10300/mmu.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/* MN10300 Memory management context
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from include/asm-frv/mmu.h
6 */
7
8#ifndef _ASM_MMU_H
9#define _ASM_MMU_H
10
11/*
12 * MMU context
13 */
14typedef struct {
15 unsigned long tlbpid[NR_CPUS]; /* TLB PID for this process on
16 * each CPU */
17} mm_context_t;
18
19#endif /* _ASM_MMU_H */
diff --git a/include/asm-mn10300/mmu_context.h b/include/asm-mn10300/mmu_context.h
deleted file mode 100644
index a9e2e34f69b0..000000000000
--- a/include/asm-mn10300/mmu_context.h
+++ /dev/null
@@ -1,138 +0,0 @@
1/* MN10300 MMU context management
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Modified by David Howells (dhowells@redhat.com)
5 * - Derived from include/asm-m32r/mmu_context.h
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 *
12 *
13 * This implements an algorithm to provide TLB PID mappings to provide
14 * selective access to the TLB for processes, thus reducing the number of TLB
15 * flushes required.
16 *
17 * Note, however, that the M32R algorithm is technically broken as it does not
18 * handle version wrap-around, and could, theoretically, have a problem with a
19 * very long lived program that sleeps long enough for the version number to
20 * wrap all the way around so that its TLB mappings appear valid once again.
21 */
22#ifndef _ASM_MMU_CONTEXT_H
23#define _ASM_MMU_CONTEXT_H
24
25#include <asm/atomic.h>
26#include <asm/pgalloc.h>
27#include <asm/tlbflush.h>
28#include <asm-generic/mm_hooks.h>
29
30#define MMU_CONTEXT_TLBPID_MASK 0x000000ffUL
31#define MMU_CONTEXT_VERSION_MASK 0xffffff00UL
32#define MMU_CONTEXT_FIRST_VERSION 0x00000100UL
33#define MMU_NO_CONTEXT 0x00000000UL
34
35extern unsigned long mmu_context_cache[NR_CPUS];
36#define mm_context(mm) (mm->context.tlbpid[smp_processor_id()])
37
38#define enter_lazy_tlb(mm, tsk) do {} while (0)
39
40#ifdef CONFIG_SMP
41#define cpu_ran_vm(cpu, task) \
42 cpu_set((cpu), (task)->cpu_vm_mask)
43#define cpu_maybe_ran_vm(cpu, task) \
44 cpu_test_and_set((cpu), (task)->cpu_vm_mask)
45#else
46#define cpu_ran_vm(cpu, task) do {} while (0)
47#define cpu_maybe_ran_vm(cpu, task) true
48#endif /* CONFIG_SMP */
49
50/*
51 * allocate an MMU context
52 */
53static inline unsigned long allocate_mmu_context(struct mm_struct *mm)
54{
55 unsigned long *pmc = &mmu_context_cache[smp_processor_id()];
56 unsigned long mc = ++(*pmc);
57
58 if (!(mc & MMU_CONTEXT_TLBPID_MASK)) {
59 /* we exhausted the TLB PIDs of this version on this CPU, so we
60 * flush this CPU's TLB in its entirety and start new cycle */
61 flush_tlb_all();
62
63 /* fix the TLB version if needed (we avoid version #0 so as to
64 * distingush MMU_NO_CONTEXT) */
65 if (!mc)
66 *pmc = mc = MMU_CONTEXT_FIRST_VERSION;
67 }
68 mm_context(mm) = mc;
69 return mc;
70}
71
72/*
73 * get an MMU context if one is needed
74 */
75static inline unsigned long get_mmu_context(struct mm_struct *mm)
76{
77 unsigned long mc = MMU_NO_CONTEXT, cache;
78
79 if (mm) {
80 cache = mmu_context_cache[smp_processor_id()];
81 mc = mm_context(mm);
82
83 /* if we have an old version of the context, replace it */
84 if ((mc ^ cache) & MMU_CONTEXT_VERSION_MASK)
85 mc = allocate_mmu_context(mm);
86 }
87 return mc;
88}
89
90/*
91 * initialise the context related info for a new mm_struct instance
92 */
93static inline int init_new_context(struct task_struct *tsk,
94 struct mm_struct *mm)
95{
96 int num_cpus = NR_CPUS, i;
97
98 for (i = 0; i < num_cpus; i++)
99 mm->context.tlbpid[i] = MMU_NO_CONTEXT;
100 return 0;
101}
102
103/*
104 * destroy context related info for an mm_struct that is about to be put to
105 * rest
106 */
107#define destroy_context(mm) do { } while (0)
108
109/*
110 * after we have set current->mm to a new value, this activates the context for
111 * the new mm so we see the new mappings.
112 */
113static inline void activate_context(struct mm_struct *mm, int cpu)
114{
115 PIDR = get_mmu_context(mm) & MMU_CONTEXT_TLBPID_MASK;
116}
117
118/*
119 * change between virtual memory sets
120 */
121static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
122 struct task_struct *tsk)
123{
124 int cpu = smp_processor_id();
125
126 if (prev != next) {
127 cpu_ran_vm(cpu, next);
128 activate_context(next, cpu);
129 PTBR = (unsigned long) next->pgd;
130 } else if (!cpu_maybe_ran_vm(cpu, next)) {
131 activate_context(next, cpu);
132 }
133}
134
135#define deactivate_mm(tsk, mm) do {} while (0)
136#define activate_mm(prev, next) switch_mm((prev), (next), NULL)
137
138#endif /* _ASM_MMU_CONTEXT_H */
diff --git a/include/asm-mn10300/module.h b/include/asm-mn10300/module.h
deleted file mode 100644
index 5d7057d01494..000000000000
--- a/include/asm-mn10300/module.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/* MN10300 Arch-specific module definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by Mark Salter (msalter@redhat.com)
5 * Derived from include/asm-i386/module.h
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12#ifndef _ASM_MODULE_H
13#define _ASM_MODULE_H
14
15struct mod_arch_specific {
16};
17
18#define Elf_Shdr Elf32_Shdr
19#define Elf_Sym Elf32_Sym
20#define Elf_Ehdr Elf32_Ehdr
21
22/*
23 * Include the MN10300 architecture version.
24 */
25#define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " "
26
27#endif /* _ASM_MODULE_H */
diff --git a/include/asm-mn10300/msgbuf.h b/include/asm-mn10300/msgbuf.h
deleted file mode 100644
index 8b602450cc4a..000000000000
--- a/include/asm-mn10300/msgbuf.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _ASM_MSGBUF_H
2#define _ASM_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for MN10300 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 unsigned long __unused1;
18 __kernel_time_t msg_rtime; /* last msgrcv time */
19 unsigned long __unused2;
20 __kernel_time_t msg_ctime; /* last change time */
21 unsigned long __unused3;
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30
31#endif /* _ASM_MSGBUF_H */
diff --git a/include/asm-mn10300/mutex.h b/include/asm-mn10300/mutex.h
deleted file mode 100644
index 84f5490c6fb4..000000000000
--- a/include/asm-mn10300/mutex.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/* MN10300 Mutex fastpath
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 *
11 *
12 * TODO: implement optimized primitives instead, or leave the generic
13 * implementation in place, or pick the atomic_xchg() based generic
14 * implementation. (see asm-generic/mutex-xchg.h for details)
15 */
16#include <asm-generic/mutex-null.h>
diff --git a/include/asm-mn10300/nmi.h b/include/asm-mn10300/nmi.h
deleted file mode 100644
index f3671cbbc117..000000000000
--- a/include/asm-mn10300/nmi.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/* MN10300 NMI handling
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_NMI_H
12#define _ASM_NMI_H
13
14#endif /* _ASM_NMI_H */
diff --git a/include/asm-mn10300/page.h b/include/asm-mn10300/page.h
deleted file mode 100644
index 8288e124165b..000000000000
--- a/include/asm-mn10300/page.h
+++ /dev/null
@@ -1,128 +0,0 @@
1/* MN10300 Page table definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_PAGE_H
12#define _ASM_PAGE_H
13
14/* PAGE_SHIFT determines the page size */
15#define PAGE_SHIFT 12
16
17#ifndef __ASSEMBLY__
18#define PAGE_SIZE (1UL << PAGE_SHIFT)
19#define PAGE_MASK (~(PAGE_SIZE - 1))
20#else
21#define PAGE_SIZE +(1 << PAGE_SHIFT) /* unary plus marks an
22 * immediate val not an addr */
23#define PAGE_MASK +(~(PAGE_SIZE - 1))
24#endif
25
26#ifdef __KERNEL__
27#ifndef __ASSEMBLY__
28
29#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
30#define copy_page(to, from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
31
32#define clear_user_page(addr, vaddr, page) clear_page(addr)
33#define copy_user_page(vto, vfrom, vaddr, to) copy_page(vto, vfrom)
34
35/*
36 * These are used to make use of C type-checking..
37 */
38typedef struct { unsigned long pte; } pte_t;
39typedef struct { unsigned long pgd; } pgd_t;
40typedef struct { unsigned long pgprot; } pgprot_t;
41typedef struct page *pgtable_t;
42
43#define PTE_MASK PAGE_MASK
44#define HPAGE_SHIFT 22
45
46#ifdef CONFIG_HUGETLB_PAGE
47#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
48#define HPAGE_MASK (~(HPAGE_SIZE - 1))
49#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
50#endif
51
52#define pte_val(x) ((x).pte)
53#define pgd_val(x) ((x).pgd)
54#define pgprot_val(x) ((x).pgprot)
55
56#define __pte(x) ((pte_t) { (x) })
57#define __pgd(x) ((pgd_t) { (x) })
58#define __pgprot(x) ((pgprot_t) { (x) })
59
60#include <asm-generic/pgtable-nopmd.h>
61
62#endif /* !__ASSEMBLY__ */
63
64/*
65 * This handles the memory map.. We could make this a config
66 * option, but too many people screw it up, and too few need
67 * it.
68 *
69 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
70 * a virtual address space of one gigabyte, which limits the
71 * amount of physical memory you can use to about 950MB.
72 */
73
74#ifndef __ASSEMBLY__
75
76/* Pure 2^n version of get_order */
77static inline int get_order(unsigned long size) __attribute__((const));
78static inline int get_order(unsigned long size)
79{
80 int order;
81
82 size = (size - 1) >> (PAGE_SHIFT - 1);
83 order = -1;
84 do {
85 size >>= 1;
86 order++;
87 } while (size);
88 return order;
89}
90
91#endif /* __ASSEMBLY__ */
92
93#include <asm/page_offset.h>
94
95#define __PAGE_OFFSET (PAGE_OFFSET_RAW)
96#define PAGE_OFFSET ((unsigned long) __PAGE_OFFSET)
97
98/*
99 * main RAM and kernel working space are coincident at 0x90000000, but to make
100 * life more interesting, there's also an uncached virtual shadow at 0xb0000000
101 * - these mappings are fixed in the MMU
102 */
103#define __pfn_disp (CONFIG_KERNEL_RAM_BASE_ADDRESS >> PAGE_SHIFT)
104
105#define __pa(x) ((unsigned long)(x))
106#define __va(x) ((void *)(unsigned long)(x))
107#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
108#define pfn_to_page(pfn) (mem_map + ((pfn) - __pfn_disp))
109#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + __pfn_disp)
110
111#define pfn_valid(pfn) \
112({ \
113 unsigned long __pfn = (pfn) - __pfn_disp; \
114 __pfn < max_mapnr; \
115})
116
117#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
118#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
119#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
120
121#define VM_DATA_DEFAULT_FLAGS \
122 (VM_READ | VM_WRITE | \
123 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
124 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
125
126#endif /* __KERNEL__ */
127
128#endif /* _ASM_PAGE_H */
diff --git a/include/asm-mn10300/page_offset.h b/include/asm-mn10300/page_offset.h
deleted file mode 100644
index 8eb5b16ad86b..000000000000
--- a/include/asm-mn10300/page_offset.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/* MN10300 Kernel base address
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 */
6#ifndef _ASM_PAGE_OFFSET_H
7#define _ASM_PAGE_OFFSET_H
8
9#define PAGE_OFFSET_RAW CONFIG_KERNEL_RAM_BASE_ADDRESS
10
11#endif
diff --git a/include/asm-mn10300/param.h b/include/asm-mn10300/param.h
deleted file mode 100644
index 789b1df41fcb..000000000000
--- a/include/asm-mn10300/param.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/* MN10300 Kernel parameters
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_PARAM_H
12#define _ASM_PARAM_H
13
14#ifdef __KERNEL__
15#define HZ CONFIG_HZ /* Internal kernel timer frequency */
16#define USER_HZ 100 /* .. some user interfaces are in
17 * "ticks" */
18#define CLOCKS_PER_SEC (USER_HZ) /* like times() */
19#endif
20
21#ifndef HZ
22#define HZ 100
23#endif
24
25#define EXEC_PAGESIZE 4096
26
27#ifndef NOGROUP
28#define NOGROUP (-1)
29#endif
30
31#define MAXHOSTNAMELEN 64 /* max length of hostname */
32#define COMMAND_LINE_SIZE 256
33
34#endif /* _ASM_PARAM_H */
diff --git a/include/asm-mn10300/pci.h b/include/asm-mn10300/pci.h
deleted file mode 100644
index 0517b45313d8..000000000000
--- a/include/asm-mn10300/pci.h
+++ /dev/null
@@ -1,129 +0,0 @@
1/* MN10300 PCI definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_PCI_H
12#define _ASM_PCI_H
13
14#ifdef __KERNEL__
15#include <linux/mm.h> /* for struct page */
16
17#if 0
18#define __pcbdebug(FMT, ADDR, ...) \
19 printk(KERN_DEBUG "PCIBRIDGE[%08x]: "FMT"\n", \
20 (u32)(ADDR), ##__VA_ARGS__)
21
22#define __pcidebug(FMT, BUS, DEVFN, WHERE,...) \
23do { \
24 printk(KERN_DEBUG "PCI[%02x:%02x.%x + %02x]: "FMT"\n", \
25 (BUS)->number, \
26 PCI_SLOT(DEVFN), \
27 PCI_FUNC(DEVFN), \
28 (u32)(WHERE), ##__VA_ARGS__); \
29} while (0)
30
31#else
32#define __pcbdebug(FMT, ADDR, ...) do {} while (0)
33#define __pcidebug(FMT, BUS, DEVFN, WHERE, ...) do {} while (0)
34#endif
35
36/* Can be used to override the logic in pci_scan_bus for skipping
37 * already-configured bus numbers - to be used for buggy BIOSes or
38 * architectures with incomplete PCI setup by the loader */
39
40#ifdef CONFIG_PCI
41#define pcibios_assign_all_busses() 1
42extern void unit_pci_init(void);
43#else
44#define pcibios_assign_all_busses() 0
45#endif
46
47extern unsigned long pci_mem_start;
48#define PCIBIOS_MIN_IO 0xBE000004
49#define PCIBIOS_MIN_MEM 0xB8000000
50
51void pcibios_set_master(struct pci_dev *dev);
52void pcibios_penalize_isa_irq(int irq);
53
54/* Dynamic DMA mapping stuff.
55 * i386 has everything mapped statically.
56 */
57
58#include <linux/types.h>
59#include <linux/slab.h>
60#include <asm/scatterlist.h>
61#include <linux/string.h>
62#include <linux/mm.h>
63#include <asm/io.h>
64
65struct pci_dev;
66
67/* The PCI address space does equal the physical memory
68 * address space. The networking and block device layers use
69 * this boolean for bounce buffer decisions.
70 */
71#define PCI_DMA_BUS_IS_PHYS (1)
72
73
74/* This is always fine. */
75#define pci_dac_dma_supported(pci_dev, mask) (0)
76
77/* Return the index of the PCI controller for device. */
78static inline int pci_controller_num(struct pci_dev *dev)
79{
80 return 0;
81}
82
83#define HAVE_PCI_MMAP
84extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
85 enum pci_mmap_state mmap_state,
86 int write_combine);
87
88#endif /* __KERNEL__ */
89
90/* implement the pci_ DMA API in terms of the generic device dma_ one */
91#include <asm-generic/pci-dma-compat.h>
92
93/**
94 * pcibios_resource_to_bus - convert resource to PCI bus address
95 * @dev: device which owns this resource
96 * @region: converted bus-centric region (start,end)
97 * @res: resource to convert
98 *
99 * Convert a resource to a PCI device bus address or bus window.
100 */
101extern void pcibios_resource_to_bus(struct pci_dev *dev,
102 struct pci_bus_region *region,
103 struct resource *res);
104
105extern void pcibios_bus_to_resource(struct pci_dev *dev,
106 struct resource *res,
107 struct pci_bus_region *region);
108
109static inline struct resource *
110pcibios_select_root(struct pci_dev *pdev, struct resource *res)
111{
112 struct resource *root = NULL;
113
114 if (res->flags & IORESOURCE_IO)
115 root = &ioport_resource;
116 if (res->flags & IORESOURCE_MEM)
117 root = &iomem_resource;
118
119 return root;
120}
121
122#define pcibios_scan_all_fns(a, b) 0
123
124static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
125{
126 return channel ? 15 : 14;
127}
128
129#endif /* _ASM_PCI_H */
diff --git a/include/asm-mn10300/percpu.h b/include/asm-mn10300/percpu.h
deleted file mode 100644
index 06a959d67234..000000000000
--- a/include/asm-mn10300/percpu.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/percpu.h>
diff --git a/include/asm-mn10300/pgalloc.h b/include/asm-mn10300/pgalloc.h
deleted file mode 100644
index ec057e1bd4cf..000000000000
--- a/include/asm-mn10300/pgalloc.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/* MN10300 Page and page table/directory allocation
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_PGALLOC_H
12#define _ASM_PGALLOC_H
13
14#include <asm/processor.h>
15#include <asm/page.h>
16#include <linux/threads.h>
17#include <linux/mm.h> /* for struct page */
18
19struct mm_struct;
20struct page;
21
22/* attach a page table to a PMD entry */
23#define pmd_populate_kernel(mm, pmd, pte) \
24 set_pmd(pmd, __pmd(__pa(pte) | _PAGE_TABLE))
25
26static inline
27void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte)
28{
29 set_pmd(pmd, __pmd((page_to_pfn(pte) << PAGE_SHIFT) | _PAGE_TABLE));
30}
31#define pmd_pgtable(pmd) pmd_page(pmd)
32
33/*
34 * Allocate and free page tables.
35 */
36
37extern pgd_t *pgd_alloc(struct mm_struct *);
38extern void pgd_free(struct mm_struct *, pgd_t *);
39
40extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
41extern struct page *pte_alloc_one(struct mm_struct *, unsigned long);
42
43static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
44{
45 free_page((unsigned long) pte);
46}
47
48static inline void pte_free(struct mm_struct *mm, struct page *pte)
49{
50 __free_page(pte);
51}
52
53
54#define __pte_free_tlb(tlb, pte) tlb_remove_page((tlb), (pte))
55
56#endif /* _ASM_PGALLOC_H */
diff --git a/include/asm-mn10300/pgtable.h b/include/asm-mn10300/pgtable.h
deleted file mode 100644
index 6dc30fc827c4..000000000000
--- a/include/asm-mn10300/pgtable.h
+++ /dev/null
@@ -1,492 +0,0 @@
1/* MN10300 Page table manipulators and constants
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 *
11 *
12 * The Linux memory management assumes a three-level page table setup. On
13 * the i386, we use that, but "fold" the mid level into the top-level page
14 * table, so that we physically have the same two-level page table as the
15 * i386 mmu expects.
16 *
17 * This file contains the functions and defines necessary to modify and use
18 * the i386 page table tree for the purposes of the MN10300 TLB handler
19 * functions.
20 */
21#ifndef _ASM_PGTABLE_H
22#define _ASM_PGTABLE_H
23
24#include <asm/cpu-regs.h>
25
26#ifndef __ASSEMBLY__
27#include <asm/processor.h>
28#include <asm/cache.h>
29#include <linux/threads.h>
30
31#include <asm/bitops.h>
32
33#include <linux/slab.h>
34#include <linux/list.h>
35#include <linux/spinlock.h>
36
37/*
38 * ZERO_PAGE is a global shared page that is always zero: used
39 * for zero-mapped memory areas etc..
40 */
41#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
42extern unsigned long empty_zero_page[1024];
43extern spinlock_t pgd_lock;
44extern struct page *pgd_list;
45
46extern void pmd_ctor(void *, struct kmem_cache *, unsigned long);
47extern void pgtable_cache_init(void);
48extern void paging_init(void);
49
50#endif /* !__ASSEMBLY__ */
51
52/*
53 * The Linux mn10300 paging architecture only implements both the traditional
54 * 2-level page tables
55 */
56#define PGDIR_SHIFT 22
57#define PTRS_PER_PGD 1024
58#define PTRS_PER_PUD 1 /* we don't really have any PUD physically */
59#define PTRS_PER_PMD 1 /* we don't really have any PMD physically */
60#define PTRS_PER_PTE 1024
61
62#define PGD_SIZE PAGE_SIZE
63#define PMD_SIZE (1UL << PMD_SHIFT)
64#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
65#define PGDIR_MASK (~(PGDIR_SIZE - 1))
66
67#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
68#define FIRST_USER_ADDRESS 0
69
70#define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT)
71#define KERNEL_PGD_PTRS (PTRS_PER_PGD - USER_PGD_PTRS)
72
73#define TWOLEVEL_PGDIR_SHIFT 22
74#define BOOT_USER_PGD_PTRS (__PAGE_OFFSET >> TWOLEVEL_PGDIR_SHIFT)
75#define BOOT_KERNEL_PGD_PTRS (1024 - BOOT_USER_PGD_PTRS)
76
77#ifndef __ASSEMBLY__
78extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
79#endif
80
81/*
82 * Unfortunately, due to the way the MMU works on the MN10300, the vmalloc VM
83 * area has to be in the lower half of the virtual address range (the upper
84 * half is not translated through the TLB).
85 *
86 * So in this case, the vmalloc area goes at the bottom of the address map
87 * (leaving a hole at the very bottom to catch addressing errors), and
88 * userspace starts immediately above.
89 *
90 * The vmalloc() routines also leaves a hole of 4kB between each vmalloced
91 * area to catch addressing errors.
92 */
93#define VMALLOC_OFFSET (8 * 1024 * 1024)
94#define VMALLOC_START (0x70000000)
95#define VMALLOC_END (0x7C000000)
96
97#ifndef __ASSEMBLY__
98extern pte_t kernel_vmalloc_ptes[(VMALLOC_END - VMALLOC_START) / PAGE_SIZE];
99#endif
100
101/* IPTEL/DPTEL bit assignments */
102#define _PAGE_BIT_VALID xPTEL_V_BIT
103#define _PAGE_BIT_ACCESSED xPTEL_UNUSED1_BIT /* mustn't be loaded into IPTEL/DPTEL */
104#define _PAGE_BIT_NX xPTEL_UNUSED2_BIT /* mustn't be loaded into IPTEL/DPTEL */
105#define _PAGE_BIT_CACHE xPTEL_C_BIT
106#define _PAGE_BIT_PRESENT xPTEL_PV_BIT
107#define _PAGE_BIT_DIRTY xPTEL_D_BIT
108#define _PAGE_BIT_GLOBAL xPTEL_G_BIT
109
110#define _PAGE_VALID xPTEL_V
111#define _PAGE_ACCESSED xPTEL_UNUSED1
112#define _PAGE_NX xPTEL_UNUSED2 /* no-execute bit */
113#define _PAGE_CACHE xPTEL_C
114#define _PAGE_PRESENT xPTEL_PV
115#define _PAGE_DIRTY xPTEL_D
116#define _PAGE_PROT xPTEL_PR
117#define _PAGE_PROT_RKNU xPTEL_PR_ROK
118#define _PAGE_PROT_WKNU xPTEL_PR_RWK
119#define _PAGE_PROT_RKRU xPTEL_PR_ROK_ROU
120#define _PAGE_PROT_WKRU xPTEL_PR_RWK_ROU
121#define _PAGE_PROT_WKWU xPTEL_PR_RWK_RWU
122#define _PAGE_GLOBAL xPTEL_G
123#define _PAGE_PSE xPTEL_PS_4Mb /* 4MB page */
124
125#define _PAGE_FILE xPTEL_UNUSED1_BIT /* set:pagecache unset:swap */
126
127#define __PAGE_PROT_UWAUX 0x040
128#define __PAGE_PROT_USER 0x080
129#define __PAGE_PROT_WRITE 0x100
130
131#define _PAGE_PRESENTV (_PAGE_PRESENT|_PAGE_VALID)
132#define _PAGE_PROTNONE 0x000 /* If not present */
133
134#ifndef __ASSEMBLY__
135
136#define VMALLOC_VMADDR(x) ((unsigned long)(x))
137
138#define _PAGE_TABLE (_PAGE_PRESENTV | _PAGE_PROT_WKNU | _PAGE_ACCESSED | _PAGE_DIRTY)
139#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
140
141#define __PAGE_NONE (_PAGE_PRESENTV | _PAGE_PROT_RKNU | _PAGE_ACCESSED | _PAGE_CACHE)
142#define __PAGE_SHARED (_PAGE_PRESENTV | _PAGE_PROT_WKWU | _PAGE_ACCESSED | _PAGE_CACHE)
143#define __PAGE_COPY (_PAGE_PRESENTV | _PAGE_PROT_RKRU | _PAGE_ACCESSED | _PAGE_CACHE)
144#define __PAGE_READONLY (_PAGE_PRESENTV | _PAGE_PROT_RKRU | _PAGE_ACCESSED | _PAGE_CACHE)
145
146#define PAGE_NONE __pgprot(__PAGE_NONE | _PAGE_NX)
147#define PAGE_SHARED_NOEXEC __pgprot(__PAGE_SHARED | _PAGE_NX)
148#define PAGE_COPY_NOEXEC __pgprot(__PAGE_COPY | _PAGE_NX)
149#define PAGE_READONLY_NOEXEC __pgprot(__PAGE_READONLY | _PAGE_NX)
150#define PAGE_SHARED_EXEC __pgprot(__PAGE_SHARED)
151#define PAGE_COPY_EXEC __pgprot(__PAGE_COPY)
152#define PAGE_READONLY_EXEC __pgprot(__PAGE_READONLY)
153#define PAGE_COPY PAGE_COPY_NOEXEC
154#define PAGE_READONLY PAGE_READONLY_NOEXEC
155#define PAGE_SHARED PAGE_SHARED_EXEC
156
157#define __PAGE_KERNEL_BASE (_PAGE_PRESENTV | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_GLOBAL)
158
159#define __PAGE_KERNEL (__PAGE_KERNEL_BASE | _PAGE_PROT_WKNU | _PAGE_CACHE | _PAGE_NX)
160#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL_BASE | _PAGE_PROT_WKNU | _PAGE_NX)
161#define __PAGE_KERNEL_EXEC (__PAGE_KERNEL & ~_PAGE_NX)
162#define __PAGE_KERNEL_RO (__PAGE_KERNEL_BASE | _PAGE_PROT_RKNU | _PAGE_CACHE | _PAGE_NX)
163#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
164#define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE)
165
166#define PAGE_KERNEL __pgprot(__PAGE_KERNEL)
167#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO)
168#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC)
169#define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE)
170#define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE)
171#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC)
172
173/*
174 * Whilst the MN10300 can do page protection for execute (given separate data
175 * and insn TLBs), we are not supporting it at the moment. Write permission,
176 * however, always implies read permission (but not execute permission).
177 */
178#define __P000 PAGE_NONE
179#define __P001 PAGE_READONLY_NOEXEC
180#define __P010 PAGE_COPY_NOEXEC
181#define __P011 PAGE_COPY_NOEXEC
182#define __P100 PAGE_READONLY_EXEC
183#define __P101 PAGE_READONLY_EXEC
184#define __P110 PAGE_COPY_EXEC
185#define __P111 PAGE_COPY_EXEC
186
187#define __S000 PAGE_NONE
188#define __S001 PAGE_READONLY_NOEXEC
189#define __S010 PAGE_SHARED_NOEXEC
190#define __S011 PAGE_SHARED_NOEXEC
191#define __S100 PAGE_READONLY_EXEC
192#define __S101 PAGE_READONLY_EXEC
193#define __S110 PAGE_SHARED_EXEC
194#define __S111 PAGE_SHARED_EXEC
195
196/*
197 * Define this to warn about kernel memory accesses that are
198 * done without a 'verify_area(VERIFY_WRITE,..)'
199 */
200#undef TEST_VERIFY_AREA
201
202#define pte_present(x) (pte_val(x) & _PAGE_VALID)
203#define pte_clear(mm, addr, xp) \
204do { \
205 set_pte_at((mm), (addr), (xp), __pte(0)); \
206} while (0)
207
208#define pmd_none(x) (!pmd_val(x))
209#define pmd_present(x) (!pmd_none(x))
210#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
211#define pmd_bad(x) 0
212
213
214#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT))
215
216#ifndef __ASSEMBLY__
217
218/*
219 * The following only work if pte_present() is true.
220 * Undefined behaviour if not..
221 */
222static inline int pte_user(pte_t pte) { return pte_val(pte) & __PAGE_PROT_USER; }
223static inline int pte_read(pte_t pte) { return pte_val(pte) & __PAGE_PROT_USER; }
224static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
225static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
226static inline int pte_write(pte_t pte) { return pte_val(pte) & __PAGE_PROT_WRITE; }
227static inline int pte_special(pte_t pte){ return 0; }
228
229/*
230 * The following only works if pte_present() is not true.
231 */
232static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
233
234static inline pte_t pte_rdprotect(pte_t pte)
235{
236 pte_val(pte) &= ~(__PAGE_PROT_USER|__PAGE_PROT_UWAUX); return pte;
237}
238static inline pte_t pte_exprotect(pte_t pte)
239{
240 pte_val(pte) |= _PAGE_NX; return pte;
241}
242
243static inline pte_t pte_wrprotect(pte_t pte)
244{
245 pte_val(pte) &= ~(__PAGE_PROT_WRITE|__PAGE_PROT_UWAUX); return pte;
246}
247
248static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
249static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
250static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; }
251static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
252static inline pte_t pte_mkexec(pte_t pte) { pte_val(pte) &= ~_PAGE_NX; return pte; }
253
254static inline pte_t pte_mkread(pte_t pte)
255{
256 pte_val(pte) |= __PAGE_PROT_USER;
257 if (pte_write(pte))
258 pte_val(pte) |= __PAGE_PROT_UWAUX;
259 return pte;
260}
261static inline pte_t pte_mkwrite(pte_t pte)
262{
263 pte_val(pte) |= __PAGE_PROT_WRITE;
264 if (pte_val(pte) & __PAGE_PROT_USER)
265 pte_val(pte) |= __PAGE_PROT_UWAUX;
266 return pte;
267}
268
269static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
270
271#define pte_ERROR(e) \
272 printk(KERN_ERR "%s:%d: bad pte %08lx.\n", \
273 __FILE__, __LINE__, pte_val(e))
274#define pgd_ERROR(e) \
275 printk(KERN_ERR "%s:%d: bad pgd %08lx.\n", \
276 __FILE__, __LINE__, pgd_val(e))
277
278/*
279 * The "pgd_xxx()" functions here are trivial for a folded two-level
280 * setup: the pgd is never bad, and a pmd always exists (as it's folded
281 * into the pgd entry)
282 */
283#define pgd_clear(xp) do { } while (0)
284
285/*
286 * Certain architectures need to do special things when PTEs
287 * within a page table are directly modified. Thus, the following
288 * hook is made available.
289 */
290#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
291#define set_pte_at(mm, addr, ptep, pteval) set_pte((ptep), (pteval))
292#define set_pte_atomic(pteptr, pteval) set_pte((pteptr), (pteval))
293
294/*
295 * (pmds are folded into pgds so this doesn't get actually called,
296 * but the define is needed for a generic inline function.)
297 */
298#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
299
300#define ptep_get_and_clear(mm, addr, ptep) \
301 __pte(xchg(&(ptep)->pte, 0))
302#define pte_same(a, b) (pte_val(a) == pte_val(b))
303#define pte_page(x) pfn_to_page(pte_pfn(x))
304#define pte_none(x) (!pte_val(x))
305#define pte_pfn(x) ((unsigned long) (pte_val(x) >> PAGE_SHIFT))
306#define __pfn_addr(pfn) ((pfn) << PAGE_SHIFT)
307#define pfn_pte(pfn, prot) __pte(__pfn_addr(pfn) | pgprot_val(prot))
308#define pfn_pmd(pfn, prot) __pmd(__pfn_addr(pfn) | pgprot_val(prot))
309
310/*
311 * All present user pages are user-executable:
312 */
313static inline int pte_exec(pte_t pte)
314{
315 return pte_user(pte);
316}
317
318/*
319 * All present pages are kernel-executable:
320 */
321static inline int pte_exec_kernel(pte_t pte)
322{
323 return 1;
324}
325
326/*
327 * Bits 0 and 1 are taken, split up the 29 bits of offset
328 * into this range:
329 */
330#define PTE_FILE_MAX_BITS 29
331
332#define pte_to_pgoff(pte) (pte_val(pte) >> 2)
333#define pgoff_to_pte(off) __pte((off) << 2 | _PAGE_FILE)
334
335/* Encode and de-code a swap entry */
336#define __swp_type(x) (((x).val >> 2) & 0x3f)
337#define __swp_offset(x) ((x).val >> 8)
338#define __swp_entry(type, offset) \
339 ((swp_entry_t) { ((type) << 2) | ((offset) << 8) })
340#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
341#define __swp_entry_to_pte(x) __pte((x).val)
342
343static inline
344int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr,
345 pte_t *ptep)
346{
347 if (!pte_dirty(*ptep))
348 return 0;
349 return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte);
350}
351
352static inline
353int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr,
354 pte_t *ptep)
355{
356 if (!pte_young(*ptep))
357 return 0;
358 return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte);
359}
360
361static inline
362void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
363{
364 pte_val(*ptep) &= ~(__PAGE_PROT_WRITE|__PAGE_PROT_UWAUX);
365}
366
367static inline void ptep_mkdirty(pte_t *ptep)
368{
369 set_bit(_PAGE_BIT_DIRTY, &ptep->pte);
370}
371
372/*
373 * Macro to mark a page protection value as "uncacheable". On processors which
374 * do not support it, this is a no-op.
375 */
376#define pgprot_noncached(prot) __pgprot(pgprot_val(prot) | _PAGE_CACHE)
377
378
379/*
380 * Conversion functions: convert a page and protection to a page entry,
381 * and a page entry and page directory to the page they refer to.
382 */
383
384#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
385#define mk_pte_huge(entry) \
386 ((entry).pte |= _PAGE_PRESENT | _PAGE_PSE | _PAGE_VALID)
387
388static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
389{
390 pte_val(pte) &= _PAGE_CHG_MASK;
391 pte_val(pte) |= pgprot_val(newprot);
392 return pte;
393}
394
395#define page_pte(page) page_pte_prot((page), __pgprot(0))
396
397#define pmd_page_kernel(pmd) \
398 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
399
400#define pmd_page(pmd) pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)
401
402#define pmd_large(pmd) \
403 ((pmd_val(pmd) & (_PAGE_PSE | _PAGE_PRESENT)) == \
404 (_PAGE_PSE | _PAGE_PRESENT))
405
406/*
407 * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
408 *
409 * this macro returns the index of the entry in the pgd page which would
410 * control the given virtual address
411 */
412#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
413
414/*
415 * pgd_offset() returns a (pgd_t *)
416 * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
417 */
418#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
419
420/*
421 * a shortcut which implies the use of the kernel's pgd, instead
422 * of a process's
423 */
424#define pgd_offset_k(address) pgd_offset(&init_mm, address)
425
426/*
427 * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
428 *
429 * this macro returns the index of the entry in the pmd page which would
430 * control the given virtual address
431 */
432#define pmd_index(address) \
433 (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
434
435/*
436 * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
437 *
438 * this macro returns the index of the entry in the pte page which would
439 * control the given virtual address
440 */
441#define pte_index(address) \
442 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
443
444#define pte_offset_kernel(dir, address) \
445 ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address))
446
447/*
448 * Make a given kernel text page executable/non-executable.
449 * Returns the previous executability setting of that page (which
450 * is used to restore the previous state). Used by the SMP bootup code.
451 * NOTE: this is an __init function for security reasons.
452 */
453static inline int set_kernel_exec(unsigned long vaddr, int enable)
454{
455 return 0;
456}
457
458#define pte_offset_map(dir, address) \
459 ((pte_t *) page_address(pmd_page(*(dir))) + pte_index(address))
460#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
461#define pte_unmap(pte) do {} while (0)
462#define pte_unmap_nested(pte) do {} while (0)
463
464/*
465 * The MN10300 has external MMU info in the form of a TLB: this is adapted from
466 * the kernel page tables containing the necessary information by tlb-mn10300.S
467 */
468extern void update_mmu_cache(struct vm_area_struct *vma,
469 unsigned long address, pte_t pte);
470
471#endif /* !__ASSEMBLY__ */
472
473#define kern_addr_valid(addr) (1)
474
475#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
476 remap_pfn_range((vma), (vaddr), (pfn), (size), (prot))
477
478#define MK_IOSPACE_PFN(space, pfn) (pfn)
479#define GET_IOSPACE(pfn) 0
480#define GET_PFN(pfn) (pfn)
481
482#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
483#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
484#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
485#define __HAVE_ARCH_PTEP_SET_WRPROTECT
486#define __HAVE_ARCH_PTEP_MKDIRTY
487#define __HAVE_ARCH_PTE_SAME
488#include <asm-generic/pgtable.h>
489
490#endif /* !__ASSEMBLY__ */
491
492#endif /* _ASM_PGTABLE_H */
diff --git a/include/asm-mn10300/pio-regs.h b/include/asm-mn10300/pio-regs.h
deleted file mode 100644
index 96bc8182d0ba..000000000000
--- a/include/asm-mn10300/pio-regs.h
+++ /dev/null
@@ -1,233 +0,0 @@
1/* MN10300 On-board I/O port module registers
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_PIO_REGS_H
12#define _ASM_PIO_REGS_H
13
14#include <asm/cpu-regs.h>
15#include <asm/intctl-regs.h>
16
17#ifdef __KERNEL__
18
19/* I/O port 0 */
20#define P0MD __SYSREG(0xdb000000, u16) /* mode reg */
21#define P0MD_0 0x0003 /* mask */
22#define P0MD_0_IN 0x0000 /* input mode */
23#define P0MD_0_OUT 0x0001 /* output mode */
24#define P0MD_0_TM0IO 0x0002 /* timer 0 I/O mode */
25#define P0MD_0_EYECLK 0x0003 /* test signal output (clock) */
26#define P0MD_1 0x000c
27#define P0MD_1_IN 0x0000
28#define P0MD_1_OUT 0x0004
29#define P0MD_1_TM1IO 0x0008 /* timer 1 I/O mode */
30#define P0MD_1_EYED 0x000c /* test signal output (data) */
31#define P0MD_2 0x0030
32#define P0MD_2_IN 0x0000
33#define P0MD_2_OUT 0x0010
34#define P0MD_2_TM2IO 0x0020 /* timer 2 I/O mode */
35#define P0MD_3 0x00c0
36#define P0MD_3_IN 0x0000
37#define P0MD_3_OUT 0x0040
38#define P0MD_3_TM3IO 0x0080 /* timer 3 I/O mode */
39#define P0MD_4 0x0300
40#define P0MD_4_IN 0x0000
41#define P0MD_4_OUT 0x0100
42#define P0MD_4_TM4IO 0x0200 /* timer 4 I/O mode */
43#define P0MD_4_XCTS 0x0300 /* XCTS input for serial port 2 */
44#define P0MD_5 0x0c00
45#define P0MD_5_IN 0x0000
46#define P0MD_5_OUT 0x0400
47#define P0MD_5_TM5IO 0x0800 /* timer 5 I/O mode */
48#define P0MD_6 0x3000
49#define P0MD_6_IN 0x0000
50#define P0MD_6_OUT 0x1000
51#define P0MD_6_TM6IOA 0x2000 /* timer 6 I/O mode A */
52#define P0MD_7 0xc000
53#define P0MD_7_IN 0x0000
54#define P0MD_7_OUT 0x4000
55#define P0MD_7_TM6IOB 0x8000 /* timer 6 I/O mode B */
56
57#define P0IN __SYSREG(0xdb000004, u8) /* in reg */
58#define P0OUT __SYSREG(0xdb000008, u8) /* out reg */
59
60#define P0TMIO __SYSREG(0xdb00000c, u8) /* TM pin I/O control reg */
61#define P0TMIO_TM0_IN 0x00
62#define P0TMIO_TM0_OUT 0x01
63#define P0TMIO_TM1_IN 0x00
64#define P0TMIO_TM1_OUT 0x02
65#define P0TMIO_TM2_IN 0x00
66#define P0TMIO_TM2_OUT 0x04
67#define P0TMIO_TM3_IN 0x00
68#define P0TMIO_TM3_OUT 0x08
69#define P0TMIO_TM4_IN 0x00
70#define P0TMIO_TM4_OUT 0x10
71#define P0TMIO_TM5_IN 0x00
72#define P0TMIO_TM5_OUT 0x20
73#define P0TMIO_TM6A_IN 0x00
74#define P0TMIO_TM6A_OUT 0x40
75#define P0TMIO_TM6B_IN 0x00
76#define P0TMIO_TM6B_OUT 0x80
77
78/* I/O port 1 */
79#define P1MD __SYSREG(0xdb000100, u16) /* mode reg */
80#define P1MD_0 0x0003 /* mask */
81#define P1MD_0_IN 0x0000 /* input mode */
82#define P1MD_0_OUT 0x0001 /* output mode */
83#define P1MD_0_TM7IO 0x0002 /* timer 7 I/O mode */
84#define P1MD_0_ADTRG 0x0003 /* A/D converter trigger mode */
85#define P1MD_1 0x000c
86#define P1MD_1_IN 0x0000
87#define P1MD_1_OUT 0x0004
88#define P1MD_1_TM8IO 0x0008 /* timer 8 I/O mode */
89#define P1MD_1_XDMR0 0x000c /* DMA request input 0 mode */
90#define P1MD_2 0x0030
91#define P1MD_2_IN 0x0000
92#define P1MD_2_OUT 0x0010
93#define P1MD_2_TM9IO 0x0020 /* timer 9 I/O mode */
94#define P1MD_2_XDMR1 0x0030 /* DMA request input 1 mode */
95#define P1MD_3 0x00c0
96#define P1MD_3_IN 0x0000
97#define P1MD_3_OUT 0x0040
98#define P1MD_3_TM10IO 0x0080 /* timer 10 I/O mode */
99#define P1MD_3_FRQS0 0x00c0 /* CPU clock multiplier setting input 0 mode */
100#define P1MD_4 0x0300
101#define P1MD_4_IN 0x0000
102#define P1MD_4_OUT 0x0100
103#define P1MD_4_TM11IO 0x0200 /* timer 11 I/O mode */
104#define P1MD_4_FRQS1 0x0300 /* CPU clock multiplier setting input 1 mode */
105
106#define P1IN __SYSREG(0xdb000104, u8) /* in reg */
107#define P1OUT __SYSREG(0xdb000108, u8) /* out reg */
108#define P1TMIO __SYSREG(0xdb00010c, u8) /* TM pin I/O control reg */
109#define P1TMIO_TM11_IN 0x00
110#define P1TMIO_TM11_OUT 0x01
111#define P1TMIO_TM10_IN 0x00
112#define P1TMIO_TM10_OUT 0x02
113#define P1TMIO_TM9_IN 0x00
114#define P1TMIO_TM9_OUT 0x04
115#define P1TMIO_TM8_IN 0x00
116#define P1TMIO_TM8_OUT 0x08
117#define P1TMIO_TM7_IN 0x00
118#define P1TMIO_TM7_OUT 0x10
119
120/* I/O port 2 */
121#define P2MD __SYSREG(0xdb000200, u16) /* mode reg */
122#define P2MD_0 0x0003 /* mask */
123#define P2MD_0_IN 0x0000 /* input mode */
124#define P2MD_0_OUT 0x0001 /* output mode */
125#define P2MD_0_BOOTBW 0x0003 /* boot bus width selector mode */
126#define P2MD_1 0x000c
127#define P2MD_1_IN 0x0000
128#define P2MD_1_OUT 0x0004
129#define P2MD_1_BOOTSEL 0x000c /* boot device selector mode */
130#define P2MD_2 0x0030
131#define P2MD_2_IN 0x0000
132#define P2MD_2_OUT 0x0010
133#define P2MD_3 0x00c0
134#define P2MD_3_IN 0x0000
135#define P2MD_3_OUT 0x0040
136#define P2MD_3_CKIO 0x00c0 /* mode */
137#define P2MD_4 0x0300
138#define P2MD_4_IN 0x0000
139#define P2MD_4_OUT 0x0100
140#define P2MD_4_CMOD 0x0300 /* mode */
141
142#define P2IN __SYSREG(0xdb000204, u8) /* in reg */
143#define P2OUT __SYSREG(0xdb000208, u8) /* out reg */
144#define P2TMIO __SYSREG(0xdb00020c, u8) /* TM pin I/O control reg */
145
146/* I/O port 3 */
147#define P3MD __SYSREG(0xdb000300, u16) /* mode reg */
148#define P3MD_0 0x0003 /* mask */
149#define P3MD_0_IN 0x0000 /* input mode */
150#define P3MD_0_OUT 0x0001 /* output mode */
151#define P3MD_0_AFRXD 0x0002 /* AFR interface mode */
152#define P3MD_1 0x000c
153#define P3MD_1_IN 0x0000
154#define P3MD_1_OUT 0x0004
155#define P3MD_1_AFTXD 0x0008 /* AFR interface mode */
156#define P3MD_2 0x0030
157#define P3MD_2_IN 0x0000
158#define P3MD_2_OUT 0x0010
159#define P3MD_2_AFSCLK 0x0020 /* AFR interface mode */
160#define P3MD_3 0x00c0
161#define P3MD_3_IN 0x0000
162#define P3MD_3_OUT 0x0040
163#define P3MD_3_AFFS 0x0080 /* AFR interface mode */
164#define P3MD_4 0x0300
165#define P3MD_4_IN 0x0000
166#define P3MD_4_OUT 0x0100
167#define P3MD_4_AFEHC 0x0200 /* AFR interface mode */
168
169#define P3IN __SYSREG(0xdb000304, u8) /* in reg */
170#define P3OUT __SYSREG(0xdb000308, u8) /* out reg */
171
172/* I/O port 4 */
173#define P4MD __SYSREG(0xdb000400, u16) /* mode reg */
174#define P4MD_0 0x0003 /* mask */
175#define P4MD_0_IN 0x0000 /* input mode */
176#define P4MD_0_OUT 0x0001 /* output mode */
177#define P4MD_0_SCL0 0x0002 /* I2C/serial mode */
178#define P4MD_1 0x000c
179#define P4MD_1_IN 0x0000
180#define P4MD_1_OUT 0x0004
181#define P4MD_1_SDA0 0x0008
182#define P4MD_2 0x0030
183#define P4MD_2_IN 0x0000
184#define P4MD_2_OUT 0x0010
185#define P4MD_2_SCL1 0x0020
186#define P4MD_3 0x00c0
187#define P4MD_3_IN 0x0000
188#define P4MD_3_OUT 0x0040
189#define P4MD_3_SDA1 0x0080
190#define P4MD_4 0x0300
191#define P4MD_4_IN 0x0000
192#define P4MD_4_OUT 0x0100
193#define P4MD_4_SBO0 0x0200
194#define P4MD_5 0x0c00
195#define P4MD_5_IN 0x0000
196#define P4MD_5_OUT 0x0400
197#define P4MD_5_SBO1 0x0800
198#define P4MD_6 0x3000
199#define P4MD_6_IN 0x0000
200#define P4MD_6_OUT 0x1000
201#define P4MD_6_SBT0 0x2000
202#define P4MD_7 0xc000
203#define P4MD_7_IN 0x0000
204#define P4MD_7_OUT 0x4000
205#define P4MD_7_SBT1 0x8000
206
207#define P4IN __SYSREG(0xdb000404, u8) /* in reg */
208#define P4OUT __SYSREG(0xdb000408, u8) /* out reg */
209
210/* I/O port 5 */
211#define P5MD __SYSREG(0xdb000500, u16) /* mode reg */
212#define P5MD_0 0x0003 /* mask */
213#define P5MD_0_IN 0x0000 /* input mode */
214#define P5MD_0_OUT 0x0001 /* output mode */
215#define P5MD_0_IRTXD 0x0002 /* IrDA mode */
216#define P5MD_0_SOUT 0x0004 /* serial mode */
217#define P5MD_1 0x000c
218#define P5MD_1_IN 0x0000
219#define P5MD_1_OUT 0x0004
220#define P5MD_1_IRRXDS 0x0008 /* IrDA mode */
221#define P5MD_1_SIN 0x000c /* serial mode */
222#define P5MD_2 0x0030
223#define P5MD_2_IN 0x0000
224#define P5MD_2_OUT 0x0010
225#define P5MD_2_IRRXDF 0x0020 /* IrDA mode */
226
227#define P5IN __SYSREG(0xdb000504, u8) /* in reg */
228#define P5OUT __SYSREG(0xdb000508, u8) /* out reg */
229
230
231#endif /* __KERNEL__ */
232
233#endif /* _ASM_PIO_REGS_H */
diff --git a/include/asm-mn10300/poll.h b/include/asm-mn10300/poll.h
deleted file mode 100644
index c98509d3149e..000000000000
--- a/include/asm-mn10300/poll.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/poll.h>
diff --git a/include/asm-mn10300/posix_types.h b/include/asm-mn10300/posix_types.h
deleted file mode 100644
index 077567c37798..000000000000
--- a/include/asm-mn10300/posix_types.h
+++ /dev/null
@@ -1,132 +0,0 @@
1/* MN10300 POSIX types
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_POSIX_TYPES_H
12#define _ASM_POSIX_TYPES_H
13
14/*
15 * This file is generally used by user-level software, so you need to
16 * be a little careful about namespace pollution etc. Also, we cannot
17 * assume GCC is being used.
18 */
19
20typedef unsigned long __kernel_ino_t;
21typedef unsigned short __kernel_mode_t;
22typedef unsigned short __kernel_nlink_t;
23typedef long __kernel_off_t;
24typedef int __kernel_pid_t;
25typedef unsigned short __kernel_ipc_pid_t;
26typedef unsigned short __kernel_uid_t;
27typedef unsigned short __kernel_gid_t;
28typedef unsigned long __kernel_size_t;
29typedef long __kernel_ssize_t;
30typedef int __kernel_ptrdiff_t;
31typedef long __kernel_time_t;
32typedef long __kernel_suseconds_t;
33typedef long __kernel_clock_t;
34typedef int __kernel_timer_t;
35typedef int __kernel_clockid_t;
36typedef int __kernel_daddr_t;
37typedef char * __kernel_caddr_t;
38typedef unsigned short __kernel_uid16_t;
39typedef unsigned short __kernel_gid16_t;
40typedef unsigned int __kernel_uid32_t;
41typedef unsigned int __kernel_gid32_t;
42
43typedef unsigned short __kernel_old_uid_t;
44typedef unsigned short __kernel_old_gid_t;
45typedef unsigned short __kernel_old_dev_t;
46
47#ifdef __GNUC__
48typedef long long __kernel_loff_t;
49#endif
50
51typedef struct {
52#if defined(__KERNEL__) || defined(__USE_ALL)
53 int val[2];
54#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
55 int __val[2];
56#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
57} __kernel_fsid_t;
58
59#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
60
61#undef __FD_SET
62static inline void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
63{
64 unsigned long __tmp = __fd / __NFDBITS;
65 unsigned long __rem = __fd % __NFDBITS;
66 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
67}
68
69#undef __FD_CLR
70static inline void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
71{
72 unsigned long __tmp = __fd / __NFDBITS;
73 unsigned long __rem = __fd % __NFDBITS;
74 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
75}
76
77
78#undef __FD_ISSET
79static inline int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
80{
81 unsigned long __tmp = __fd / __NFDBITS;
82 unsigned long __rem = __fd % __NFDBITS;
83 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
84}
85
86/*
87 * This will unroll the loop for the normal constant case (8 ints,
88 * for a 256-bit fd_set)
89 */
90#undef __FD_ZERO
91static inline void __FD_ZERO(__kernel_fd_set *__p)
92{
93 unsigned long *__tmp = __p->fds_bits;
94 int __i;
95
96 if (__builtin_constant_p(__FDSET_LONGS)) {
97 switch (__FDSET_LONGS) {
98 case 16:
99 __tmp[ 0] = 0; __tmp[ 1] = 0;
100 __tmp[ 2] = 0; __tmp[ 3] = 0;
101 __tmp[ 4] = 0; __tmp[ 5] = 0;
102 __tmp[ 6] = 0; __tmp[ 7] = 0;
103 __tmp[ 8] = 0; __tmp[ 9] = 0;
104 __tmp[10] = 0; __tmp[11] = 0;
105 __tmp[12] = 0; __tmp[13] = 0;
106 __tmp[14] = 0; __tmp[15] = 0;
107 return;
108
109 case 8:
110 __tmp[ 0] = 0; __tmp[ 1] = 0;
111 __tmp[ 2] = 0; __tmp[ 3] = 0;
112 __tmp[ 4] = 0; __tmp[ 5] = 0;
113 __tmp[ 6] = 0; __tmp[ 7] = 0;
114 return;
115
116 case 4:
117 __tmp[ 0] = 0; __tmp[ 1] = 0;
118 __tmp[ 2] = 0; __tmp[ 3] = 0;
119 return;
120 }
121 }
122 __i = __FDSET_LONGS;
123 while (__i) {
124 __i--;
125 *__tmp = 0;
126 __tmp++;
127 }
128}
129
130#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
131
132#endif /* _ASM_POSIX_TYPES_H */
diff --git a/include/asm-mn10300/proc-mn103e010/cache.h b/include/asm-mn10300/proc-mn103e010/cache.h
deleted file mode 100644
index bdc1f9a59b4c..000000000000
--- a/include/asm-mn10300/proc-mn103e010/cache.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/* MN103E010 Cache specification
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_PROC_CACHE_H
12#define _ASM_PROC_CACHE_H
13
14/* L1 cache */
15
16#define L1_CACHE_NWAYS 4 /* number of ways in caches */
17#define L1_CACHE_NENTRIES 256 /* number of entries in each way */
18#define L1_CACHE_BYTES 16 /* bytes per entry */
19#define L1_CACHE_SHIFT 4 /* shift for bytes per entry */
20#define L1_CACHE_WAYDISP 0x1000 /* displacement of one way from the next */
21
22#define L1_CACHE_TAG_VALID 0x00000001 /* cache tag valid bit */
23#define L1_CACHE_TAG_DIRTY 0x00000008 /* data cache tag dirty bit */
24#define L1_CACHE_TAG_ENTRY 0x00000ff0 /* cache tag entry address mask */
25#define L1_CACHE_TAG_ADDRESS 0xfffff000 /* cache tag line address mask */
26
27/*
28 * specification of the interval between interrupt checking intervals whilst
29 * managing the cache with the interrupts disabled
30 */
31#define MN10300_DCACHE_INV_RANGE_INTR_LOG2_INTERVAL 4
32
33#endif /* _ASM_PROC_CACHE_H */
diff --git a/include/asm-mn10300/proc-mn103e010/clock.h b/include/asm-mn10300/proc-mn103e010/clock.h
deleted file mode 100644
index caf998350633..000000000000
--- a/include/asm-mn10300/proc-mn103e010/clock.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* MN103E010-specific clocks
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_PROC_CLOCK_H
12#define _ASM_PROC_CLOCK_H
13
14#include <asm/unit/clock.h>
15
16#define MN10300_WDCLK MN10300_IOCLK
17
18#endif /* _ASM_PROC_CLOCK_H */
diff --git a/include/asm-mn10300/proc-mn103e010/irq.h b/include/asm-mn10300/proc-mn103e010/irq.h
deleted file mode 100644
index aa6ee8f98b1b..000000000000
--- a/include/asm-mn10300/proc-mn103e010/irq.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/* MN103E010 On-board interrupt controller numbers
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_PROC_IRQ_H
13#define _ASM_PROC_IRQ_H
14
15#ifdef __KERNEL__
16
17#define GxICR_NUM_IRQS 42
18
19#define GxICR_NUM_XIRQS 8
20
21#define XIRQ0 34
22#define XIRQ1 35
23#define XIRQ2 36
24#define XIRQ3 37
25#define XIRQ4 38
26#define XIRQ5 39
27#define XIRQ6 40
28#define XIRQ7 41
29
30#define XIRQ2IRQ(num) (XIRQ0 + num)
31
32#endif /* __KERNEL__ */
33
34#endif /* _ASM_PROC_IRQ_H */
diff --git a/include/asm-mn10300/proc-mn103e010/proc.h b/include/asm-mn10300/proc-mn103e010/proc.h
deleted file mode 100644
index 22a2b93f70b7..000000000000
--- a/include/asm-mn10300/proc-mn103e010/proc.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* MN103E010 Processor description
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_PROC_PROC_H
13#define _ASM_PROC_PROC_H
14
15#define PROCESSOR_VENDOR_NAME "Matsushita"
16#define PROCESSOR_MODEL_NAME "mn103e010"
17
18#endif /* _ASM_PROC_PROC_H */
diff --git a/include/asm-mn10300/processor.h b/include/asm-mn10300/processor.h
deleted file mode 100644
index 73239271873d..000000000000
--- a/include/asm-mn10300/processor.h
+++ /dev/null
@@ -1,186 +0,0 @@
1/* MN10300 Processor specifics
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12
13#ifndef _ASM_PROCESSOR_H
14#define _ASM_PROCESSOR_H
15
16#include <asm/page.h>
17#include <asm/ptrace.h>
18#include <asm/cpu-regs.h>
19#include <linux/threads.h>
20
21/* Forward declaration, a strange C thing */
22struct task_struct;
23struct mm_struct;
24
25/*
26 * Default implementation of macro that returns current
27 * instruction pointer ("program counter").
28 */
29#define current_text_addr() \
30({ \
31 void *__pc; \
32 asm("mov pc,%0" : "=a"(__pc)); \
33 __pc; \
34})
35
36extern void show_registers(struct pt_regs *regs);
37
38/*
39 * CPU type and hardware bug flags. Kept separately for each CPU.
40 * Members of this structure are referenced in head.S, so think twice
41 * before touching them. [mj]
42 */
43
44struct mn10300_cpuinfo {
45 int type;
46 unsigned long loops_per_sec;
47 char hard_math;
48 unsigned long *pgd_quick;
49 unsigned long *pte_quick;
50 unsigned long pgtable_cache_sz;
51};
52
53extern struct mn10300_cpuinfo boot_cpu_data;
54
55#define cpu_data &boot_cpu_data
56#define current_cpu_data boot_cpu_data
57
58extern void identify_cpu(struct mn10300_cpuinfo *);
59extern void print_cpu_info(struct mn10300_cpuinfo *);
60extern void dodgy_tsc(void);
61#define cpu_relax() barrier()
62
63/*
64 * User space process size: 1.75GB (default).
65 */
66#define TASK_SIZE 0x70000000
67
68/*
69 * Where to put the userspace stack by default
70 */
71#define STACK_TOP 0x70000000
72#define STACK_TOP_MAX STACK_TOP
73
74/* This decides where the kernel will search for a free chunk of vm
75 * space during mmap's.
76 */
77#define TASK_UNMAPPED_BASE 0x30000000
78
79typedef struct {
80 unsigned long seg;
81} mm_segment_t;
82
83struct fpu_state_struct {
84 unsigned long fs[32]; /* fpu registers */
85 unsigned long fpcr; /* fpu control register */
86};
87
88struct thread_struct {
89 struct pt_regs *uregs; /* userspace register frame */
90 unsigned long pc; /* kernel PC */
91 unsigned long sp; /* kernel SP */
92 unsigned long a3; /* kernel FP */
93 unsigned long wchan;
94 unsigned long usp;
95 struct pt_regs *__frame;
96 unsigned long fpu_flags;
97#define THREAD_USING_FPU 0x00000001 /* T if this task is using the FPU */
98 struct fpu_state_struct fpu_state;
99};
100
101#define INIT_THREAD \
102{ \
103 .uregs = init_uregs, \
104 .pc = 0, \
105 .sp = 0, \
106 .a3 = 0, \
107 .wchan = 0, \
108 .__frame = NULL, \
109}
110
111#define INIT_MMAP \
112{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, \
113 NULL, NULL }
114
115/*
116 * do necessary setup to start up a newly executed thread
117 * - need to discard the frame stacked by the kernel thread invoking the execve
118 * syscall (see RESTORE_ALL macro)
119 */
120#define start_thread(regs, new_pc, new_sp) do { \
121 set_fs(USER_DS); \
122 __frame = current->thread.uregs; \
123 __frame->epsw = EPSW_nSL | EPSW_IE | EPSW_IM; \
124 __frame->pc = new_pc; \
125 __frame->sp = new_sp; \
126} while (0)
127
128/* Free all resources held by a thread. */
129extern void release_thread(struct task_struct *);
130
131/* Prepare to copy thread state - unlazy all lazy status */
132extern void prepare_to_copy(struct task_struct *tsk);
133
134/*
135 * create a kernel thread without removing it from tasklists
136 */
137extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
138
139/*
140 * Return saved PC of a blocked thread.
141 */
142extern unsigned long thread_saved_pc(struct task_struct *tsk);
143
144unsigned long get_wchan(struct task_struct *p);
145
146#define task_pt_regs(task) \
147({ \
148 struct pt_regs *__regs__; \
149 __regs__ = (struct pt_regs *) (KSTK_TOP(task_stack_page(task)) - 8); \
150 __regs__ - 1; \
151})
152
153#define KSTK_EIP(task) (task_pt_regs(task)->pc)
154#define KSTK_ESP(task) (task_pt_regs(task)->sp)
155
156#define KSTK_TOP(info) \
157({ \
158 (unsigned long)(info) + THREAD_SIZE; \
159})
160
161#define ARCH_HAS_PREFETCH
162#define ARCH_HAS_PREFETCHW
163
164static inline void prefetch(const void *x)
165{
166#ifndef CONFIG_MN10300_CACHE_DISABLED
167#ifdef CONFIG_MN10300_PROC_MN103E010
168 asm volatile ("nop; nop; dcpf (%0)" : : "r"(x));
169#else
170 asm volatile ("dcpf (%0)" : : "r"(x));
171#endif
172#endif
173}
174
175static inline void prefetchw(const void *x)
176{
177#ifndef CONFIG_MN10300_CACHE_DISABLED
178#ifdef CONFIG_MN10300_PROC_MN103E010
179 asm volatile ("nop; nop; dcpf (%0)" : : "r"(x));
180#else
181 asm volatile ("dcpf (%0)" : : "r"(x));
182#endif
183#endif
184}
185
186#endif /* _ASM_PROCESSOR_H */
diff --git a/include/asm-mn10300/ptrace.h b/include/asm-mn10300/ptrace.h
deleted file mode 100644
index 7b06cc623d8b..000000000000
--- a/include/asm-mn10300/ptrace.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/* MN10300 Exception frame layout and ptrace constants
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_PTRACE_H
12#define _ASM_PTRACE_H
13
14#define PT_A3 0
15#define PT_A2 1
16#define PT_D3 2
17#define PT_D2 3
18#define PT_MCVF 4
19#define PT_MCRL 5
20#define PT_MCRH 6
21#define PT_MDRQ 7
22#define PT_E1 8
23#define PT_E0 9
24#define PT_E7 10
25#define PT_E6 11
26#define PT_E5 12
27#define PT_E4 13
28#define PT_E3 14
29#define PT_E2 15
30#define PT_SP 16
31#define PT_LAR 17
32#define PT_LIR 18
33#define PT_MDR 19
34#define PT_A1 20
35#define PT_A0 21
36#define PT_D1 22
37#define PT_D0 23
38#define PT_ORIG_D0 24
39#define PT_EPSW 25
40#define PT_PC 26
41#define NR_PTREGS 27
42
43#ifndef __ASSEMBLY__
44/*
45 * This defines the way registers are stored in the event of an exception
46 * - the strange order is due to the MOVM instruction
47 */
48struct pt_regs {
49 unsigned long a3; /* syscall arg 3 */
50 unsigned long a2; /* syscall arg 4 */
51 unsigned long d3; /* syscall arg 5 */
52 unsigned long d2; /* syscall arg 6 */
53 unsigned long mcvf;
54 unsigned long mcrl;
55 unsigned long mcrh;
56 unsigned long mdrq;
57 unsigned long e1;
58 unsigned long e0;
59 unsigned long e7;
60 unsigned long e6;
61 unsigned long e5;
62 unsigned long e4;
63 unsigned long e3;
64 unsigned long e2;
65 unsigned long sp;
66 unsigned long lar;
67 unsigned long lir;
68 unsigned long mdr;
69 unsigned long a1;
70 unsigned long a0; /* syscall arg 1 */
71 unsigned long d1; /* syscall arg 2 */
72 unsigned long d0; /* syscall ret */
73 struct pt_regs *next; /* next frame pointer */
74 unsigned long orig_d0; /* syscall number */
75 unsigned long epsw;
76 unsigned long pc;
77};
78#endif
79
80extern struct pt_regs *__frame; /* current frame pointer */
81
82/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
83#define PTRACE_GETREGS 12
84#define PTRACE_SETREGS 13
85#define PTRACE_GETFPREGS 14
86#define PTRACE_SETFPREGS 15
87
88/* options set using PTRACE_SETOPTIONS */
89#define PTRACE_O_TRACESYSGOOD 0x00000001
90
91#if defined(__KERNEL__)
92
93#if !defined(__ASSEMBLY__)
94#define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL)
95#define instruction_pointer(regs) ((regs)->pc)
96extern void show_regs(struct pt_regs *);
97#endif /* !__ASSEMBLY */
98
99#define profile_pc(regs) ((regs)->pc)
100
101#endif /* __KERNEL__ */
102
103#endif /* _ASM_PTRACE_H */
diff --git a/include/asm-mn10300/reset-regs.h b/include/asm-mn10300/reset-regs.h
deleted file mode 100644
index 174523d50132..000000000000
--- a/include/asm-mn10300/reset-regs.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/* MN10300 Reset controller and watchdog timer definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_RESET_REGS_H
13#define _ASM_RESET_REGS_H
14
15#include <asm/cpu-regs.h>
16#include <asm/exceptions.h>
17
18#ifdef __KERNEL__
19
20#ifdef CONFIG_MN10300_WD_TIMER
21#define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */
22#endif
23
24/*
25 * watchdog timer registers
26 */
27#define WDBC __SYSREGC(0xc0001000, u8) /* watchdog binary counter reg */
28
29#define WDCTR __SYSREG(0xc0001002, u8) /* watchdog timer control reg */
30#define WDCTR_WDCK 0x07 /* clock source selection */
31#define WDCTR_WDCK_256th 0x00 /* - OSCI/256 */
32#define WDCTR_WDCK_1024th 0x01 /* - OSCI/1024 */
33#define WDCTR_WDCK_2048th 0x02 /* - OSCI/2048 */
34#define WDCTR_WDCK_16384th 0x03 /* - OSCI/16384 */
35#define WDCTR_WDCK_65536th 0x04 /* - OSCI/65536 */
36#define WDCTR_WDRST 0x40 /* binary counter reset */
37#define WDCTR_WDCNE 0x80 /* watchdog timer enable */
38
39#define RSTCTR __SYSREG(0xc0001004, u8) /* reset control reg */
40#define RSTCTR_CHIPRST 0x01 /* chip reset */
41#define RSTCTR_DBFRST 0x02 /* double fault reset flag */
42#define RSTCTR_WDTRST 0x04 /* watchdog timer reset flag */
43#define RSTCTR_WDREN 0x08 /* watchdog timer reset enable */
44
45#ifndef __ASSEMBLY__
46
47static inline void mn10300_proc_hard_reset(void)
48{
49 RSTCTR &= ~RSTCTR_CHIPRST;
50 RSTCTR |= RSTCTR_CHIPRST;
51}
52
53extern unsigned int watchdog_alert_counter;
54
55extern void watchdog_go(void);
56extern asmlinkage void watchdog_handler(void);
57extern asmlinkage
58void watchdog_interrupt(struct pt_regs *, enum exception_code);
59
60#endif
61
62#endif /* __KERNEL__ */
63
64#endif /* _ASM_RESET_REGS_H */
diff --git a/include/asm-mn10300/resource.h b/include/asm-mn10300/resource.h
deleted file mode 100644
index 04bc4db8921b..000000000000
--- a/include/asm-mn10300/resource.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/resource.h>
diff --git a/include/asm-mn10300/rtc-regs.h b/include/asm-mn10300/rtc-regs.h
deleted file mode 100644
index c42deefaec11..000000000000
--- a/include/asm-mn10300/rtc-regs.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/* MN10300 on-chip Real-Time Clock registers
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_RTC_REGS_H
12#define _ASM_RTC_REGS_H
13
14#include <asm/intctl-regs.h>
15
16#ifdef __KERNEL__
17
18#define RTSCR __SYSREG(0xd8600000, u8) /* RTC seconds count reg */
19#define RTSAR __SYSREG(0xd8600001, u8) /* RTC seconds alarm reg */
20#define RTMCR __SYSREG(0xd8600002, u8) /* RTC minutes count reg */
21#define RTMAR __SYSREG(0xd8600003, u8) /* RTC minutes alarm reg */
22#define RTHCR __SYSREG(0xd8600004, u8) /* RTC hours count reg */
23#define RTHAR __SYSREG(0xd8600005, u8) /* RTC hours alarm reg */
24#define RTDWCR __SYSREG(0xd8600006, u8) /* RTC day of the week count reg */
25#define RTDMCR __SYSREG(0xd8600007, u8) /* RTC days count reg */
26#define RTMTCR __SYSREG(0xd8600008, u8) /* RTC months count reg */
27#define RTYCR __SYSREG(0xd8600009, u8) /* RTC years count reg */
28
29#define RTCRA __SYSREG(0xd860000a, u8)/* RTC control reg A */
30#define RTCRA_RS 0x0f /* periodic timer interrupt cycle setting */
31#define RTCRA_RS_NONE 0x00 /* - off */
32#define RTCRA_RS_3_90625ms 0x01 /* - 3.90625ms (1/256s) */
33#define RTCRA_RS_7_8125ms 0x02 /* - 7.8125ms (1/128s) */
34#define RTCRA_RS_122_070us 0x03 /* - 122.070us (1/8192s) */
35#define RTCRA_RS_244_141us 0x04 /* - 244.141us (1/4096s) */
36#define RTCRA_RS_488_281us 0x05 /* - 488.281us (1/2048s) */
37#define RTCRA_RS_976_5625us 0x06 /* - 976.5625us (1/1024s) */
38#define RTCRA_RS_1_953125ms 0x07 /* - 1.953125ms (1/512s) */
39#define RTCRA_RS_3_90624ms 0x08 /* - 3.90624ms (1/256s) */
40#define RTCRA_RS_7_8125ms_b 0x09 /* - 7.8125ms (1/128s) */
41#define RTCRA_RS_15_625ms 0x0a /* - 15.625ms (1/64s) */
42#define RTCRA_RS_31_25ms 0x0b /* - 31.25ms (1/32s) */
43#define RTCRA_RS_62_5ms 0x0c /* - 62.5ms (1/16s) */
44#define RTCRA_RS_125ms 0x0d /* - 125ms (1/8s) */
45#define RTCRA_RS_250ms 0x0e /* - 250ms (1/4s) */
46#define RTCRA_RS_500ms 0x0f /* - 500ms (1/2s) */
47#define RTCRA_DVR 0x40 /* divider reset */
48#define RTCRA_UIP 0x80 /* clock update flag */
49
50#define RTCRB __SYSREG(0xd860000b, u8) /* RTC control reg B */
51#define RTCRB_DSE 0x01 /* daylight savings time enable */
52#define RTCRB_TM 0x02 /* time format */
53#define RTCRB_TM_12HR 0x00 /* - 12 hour format */
54#define RTCRB_TM_24HR 0x02 /* - 24 hour format */
55#define RTCRB_DM 0x04 /* numeric value format */
56#define RTCRB_DM_BCD 0x00 /* - BCD */
57#define RTCRB_DM_BINARY 0x04 /* - binary */
58#define RTCRB_UIE 0x10 /* update interrupt disable */
59#define RTCRB_AIE 0x20 /* alarm interrupt disable */
60#define RTCRB_PIE 0x40 /* periodic interrupt disable */
61#define RTCRB_SET 0x80 /* clock update enable */
62
63#define RTSRC __SYSREG(0xd860000c, u8) /* RTC status reg C */
64#define RTSRC_UF 0x10 /* update end interrupt flag */
65#define RTSRC_AF 0x20 /* alarm interrupt flag */
66#define RTSRC_PF 0x40 /* periodic interrupt flag */
67#define RTSRC_IRQF 0x80 /* interrupt flag */
68
69#define RTIRQ 32
70#define RTICR GxICR(RTIRQ)
71
72/*
73 * MC146818 RTC compatibility defs for the MN10300 on-chip RTC
74 */
75#define RTC_PORT(x) 0xd8600000
76#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */
77
78#define CMOS_READ(addr) __SYSREG(0xd8600000 + (addr), u8)
79#define CMOS_WRITE(val, addr) \
80 do { __SYSREG(0xd8600000 + (addr), u8) = val; } while (0)
81
82#define RTC_IRQ RTIRQ
83
84#endif /* __KERNEL__ */
85
86#endif /* _ASM_RTC_REGS_H */
diff --git a/include/asm-mn10300/rtc.h b/include/asm-mn10300/rtc.h
deleted file mode 100644
index c295194cc703..000000000000
--- a/include/asm-mn10300/rtc.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/* MN10300 Real time clock definitions
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_RTC_H
12#define _ASM_RTC_H
13
14#ifdef CONFIG_MN10300_RTC
15
16#include <linux/init.h>
17
18extern void check_rtc_time(void);
19extern void __init calibrate_clock(void);
20extern unsigned long __init get_initial_rtc_time(void);
21
22#else /* !CONFIG_MN10300_RTC */
23
24static inline void check_rtc_time(void)
25{
26}
27
28static inline void calibrate_clock(void)
29{
30}
31
32static inline unsigned long get_initial_rtc_time(void)
33{
34 return 0;
35}
36
37#endif /* !CONFIG_MN10300_RTC */
38
39#include <asm-generic/rtc.h>
40
41#endif /* _ASM_RTC_H */
diff --git a/include/asm-mn10300/scatterlist.h b/include/asm-mn10300/scatterlist.h
deleted file mode 100644
index 67535901b9ff..000000000000
--- a/include/asm-mn10300/scatterlist.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/* MN10300 Scatterlist definitions
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_SCATTERLIST_H
12#define _ASM_SCATTERLIST_H
13
14#include <asm/types.h>
15
16/*
17 * Drivers must set either ->address or (preferred) page and ->offset
18 * to indicate where data must be transferred to/from.
19 *
20 * Using page is recommended since it handles highmem data as well as
21 * low mem. ->address is restricted to data which has a virtual mapping, and
22 * it will go away in the future. Updating to page can be automated very
23 * easily -- something like
24 *
25 * sg->address = some_ptr;
26 *
27 * can be rewritten as
28 *
29 * sg_set_page(virt_to_page(some_ptr));
30 * sg->offset = (unsigned long) some_ptr & ~PAGE_MASK;
31 *
32 * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens
33 */
34struct scatterlist {
35#ifdef CONFIG_DEBUG_SG
36 unsigned long sg_magic;
37#endif
38 unsigned long page_link;
39 unsigned int offset; /* for highmem, page offset */
40 dma_addr_t dma_address;
41 unsigned int length;
42};
43
44#define ISA_DMA_THRESHOLD (0x00ffffff)
45
46/*
47 * These macros should be used after a pci_map_sg call has been done
48 * to get bus addresses of each of the SG entries and their lengths.
49 * You should only work with the number of sg entries pci_map_sg
50 * returns.
51 */
52#define sg_dma_address(sg) ((sg)->dma_address)
53#define sg_dma_len(sg) ((sg)->length)
54
55#endif /* _ASM_SCATTERLIST_H */
diff --git a/include/asm-mn10300/sections.h b/include/asm-mn10300/sections.h
deleted file mode 100644
index 2b8c5160388f..000000000000
--- a/include/asm-mn10300/sections.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/sections.h>
diff --git a/include/asm-mn10300/sembuf.h b/include/asm-mn10300/sembuf.h
deleted file mode 100644
index 301f3f9d8aa9..000000000000
--- a/include/asm-mn10300/sembuf.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef _ASM_SEMBUF_H
2#define _ASM_SEMBUF_H
3
4/*
5 * The semid64_ds structure for MN10300 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 unsigned long __unused1;
18 __kernel_time_t sem_ctime; /* last change time */
19 unsigned long __unused2;
20 unsigned long sem_nsems; /* no. of semaphores in array */
21 unsigned long __unused3;
22 unsigned long __unused4;
23};
24
25#endif /* _ASM_SEMBUF_H */
diff --git a/include/asm-mn10300/serial-regs.h b/include/asm-mn10300/serial-regs.h
deleted file mode 100644
index 6498469e93ac..000000000000
--- a/include/asm-mn10300/serial-regs.h
+++ /dev/null
@@ -1,160 +0,0 @@
1/* MN10300 on-board serial port module registers
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_SERIAL_REGS_H
13#define _ASM_SERIAL_REGS_H
14
15#include <asm/cpu-regs.h>
16#include <asm/intctl-regs.h>
17
18#ifdef __KERNEL__
19
20/* serial port 0 */
21#define SC0CTR __SYSREG(0xd4002000, u16) /* control reg */
22#define SC01CTR_CK 0x0007 /* clock source select */
23#define SC0CTR_CK_TM8UFLOW_8 0x0000 /* - 1/8 timer 8 underflow (serial port 0 only) */
24#define SC1CTR_CK_TM9UFLOW_8 0x0000 /* - 1/8 timer 9 underflow (serial port 1 only) */
25#define SC01CTR_CK_IOCLK_8 0x0001 /* - 1/8 IOCLK */
26#define SC01CTR_CK_IOCLK_32 0x0002 /* - 1/32 IOCLK */
27#define SC0CTR_CK_TM2UFLOW_2 0x0003 /* - 1/2 timer 2 underflow (serial port 0 only) */
28#define SC1CTR_CK_TM3UFLOW_2 0x0003 /* - 1/2 timer 3 underflow (serial port 1 only) */
29#define SC0CTR_CK_TM0UFLOW_8 0x0004 /* - 1/8 timer 1 underflow (serial port 0 only) */
30#define SC1CTR_CK_TM1UFLOW_8 0x0004 /* - 1/8 timer 2 underflow (serial port 1 only) */
31#define SC0CTR_CK_TM2UFLOW_8 0x0005 /* - 1/8 timer 2 underflow (serial port 0 only) */
32#define SC1CTR_CK_TM3UFLOW_8 0x0005 /* - 1/8 timer 3 underflow (serial port 1 only) */
33#define SC01CTR_CK_EXTERN_8 0x0006 /* - 1/8 external closk */
34#define SC01CTR_CK_EXTERN 0x0007 /* - external closk */
35#define SC01CTR_STB 0x0008 /* stop bit select */
36#define SC01CTR_STB_1BIT 0x0000 /* - 1 stop bit */
37#define SC01CTR_STB_2BIT 0x0008 /* - 2 stop bits */
38#define SC01CTR_PB 0x0070 /* parity bit select */
39#define SC01CTR_PB_NONE 0x0000 /* - no parity */
40#define SC01CTR_PB_FIXED0 0x0040 /* - fixed at 0 */
41#define SC01CTR_PB_FIXED1 0x0050 /* - fixed at 1 */
42#define SC01CTR_PB_EVEN 0x0060 /* - even parity */
43#define SC01CTR_PB_ODD 0x0070 /* - odd parity */
44#define SC01CTR_CLN 0x0080 /* character length */
45#define SC01CTR_CLN_7BIT 0x0000 /* - 7 bit chars */
46#define SC01CTR_CLN_8BIT 0x0080 /* - 8 bit chars */
47#define SC01CTR_TOE 0x0100 /* T input output enable */
48#define SC01CTR_OD 0x0200 /* bit order select */
49#define SC01CTR_OD_LSBFIRST 0x0000 /* - LSB first */
50#define SC01CTR_OD_MSBFIRST 0x0200 /* - MSB first */
51#define SC01CTR_MD 0x0c00 /* mode select */
52#define SC01CTR_MD_STST_SYNC 0x0000 /* - start-stop synchronous */
53#define SC01CTR_MD_CLOCK_SYNC1 0x0400 /* - clock synchronous 1 */
54#define SC01CTR_MD_I2C 0x0800 /* - I2C mode */
55#define SC01CTR_MD_CLOCK_SYNC2 0x0c00 /* - clock synchronous 2 */
56#define SC01CTR_IIC 0x1000 /* I2C mode select */
57#define SC01CTR_BKE 0x2000 /* break transmit enable */
58#define SC01CTR_RXE 0x4000 /* receive enable */
59#define SC01CTR_TXE 0x8000 /* transmit enable */
60
61#define SC0ICR __SYSREG(0xd4002004, u8) /* interrupt control reg */
62#define SC01ICR_DMD 0x80 /* output data mode */
63#define SC01ICR_TD 0x20 /* transmit DMA trigger cause */
64#define SC01ICR_TI 0x10 /* transmit interrupt cause */
65#define SC01ICR_RES 0x04 /* receive error select */
66#define SC01ICR_RI 0x01 /* receive interrupt cause */
67
68#define SC0TXB __SYSREG(0xd4002008, u8) /* transmit buffer reg */
69#define SC0RXB __SYSREG(0xd4002009, u8) /* receive buffer reg */
70
71#define SC0STR __SYSREG(0xd400200c, u16) /* status reg */
72#define SC01STR_OEF 0x0001 /* overrun error found */
73#define SC01STR_PEF 0x0002 /* parity error found */
74#define SC01STR_FEF 0x0004 /* framing error found */
75#define SC01STR_RBF 0x0010 /* receive buffer status */
76#define SC01STR_TBF 0x0020 /* transmit buffer status */
77#define SC01STR_RXF 0x0040 /* receive status */
78#define SC01STR_TXF 0x0080 /* transmit status */
79#define SC01STR_STF 0x0100 /* I2C start sequence found */
80#define SC01STR_SPF 0x0200 /* I2C stop sequence found */
81
82#define SC0RXIRQ 20 /* timer 0 Receive IRQ */
83#define SC0TXIRQ 21 /* timer 0 Transmit IRQ */
84
85#define SC0RXICR GxICR(SC0RXIRQ) /* serial 0 receive intr ctrl reg */
86#define SC0TXICR GxICR(SC0TXIRQ) /* serial 0 transmit intr ctrl reg */
87
88/* serial port 1 */
89#define SC1CTR __SYSREG(0xd4002010, u16) /* serial port 1 control */
90#define SC1ICR __SYSREG(0xd4002014, u8) /* interrupt control reg */
91#define SC1TXB __SYSREG(0xd4002018, u8) /* transmit buffer reg */
92#define SC1RXB __SYSREG(0xd4002019, u8) /* receive buffer reg */
93#define SC1STR __SYSREG(0xd400201c, u16) /* status reg */
94
95#define SC1RXIRQ 22 /* timer 1 Receive IRQ */
96#define SC1TXIRQ 23 /* timer 1 Transmit IRQ */
97
98#define SC1RXICR GxICR(SC1RXIRQ) /* serial 1 receive intr ctrl reg */
99#define SC1TXICR GxICR(SC1TXIRQ) /* serial 1 transmit intr ctrl reg */
100
101/* serial port 2 */
102#define SC2CTR __SYSREG(0xd4002020, u16) /* control reg */
103#define SC2CTR_CK 0x0003 /* clock source select */
104#define SC2CTR_CK_TM10UFLOW 0x0000 /* - timer 10 underflow */
105#define SC2CTR_CK_TM2UFLOW 0x0001 /* - timer 2 underflow */
106#define SC2CTR_CK_EXTERN 0x0002 /* - external closk */
107#define SC2CTR_CK_TM3UFLOW 0x0003 /* - timer 3 underflow */
108#define SC2CTR_STB 0x0008 /* stop bit select */
109#define SC2CTR_STB_1BIT 0x0000 /* - 1 stop bit */
110#define SC2CTR_STB_2BIT 0x0008 /* - 2 stop bits */
111#define SC2CTR_PB 0x0070 /* parity bit select */
112#define SC2CTR_PB_NONE 0x0000 /* - no parity */
113#define SC2CTR_PB_FIXED0 0x0040 /* - fixed at 0 */
114#define SC2CTR_PB_FIXED1 0x0050 /* - fixed at 1 */
115#define SC2CTR_PB_EVEN 0x0060 /* - even parity */
116#define SC2CTR_PB_ODD 0x0070 /* - odd parity */
117#define SC2CTR_CLN 0x0080 /* character length */
118#define SC2CTR_CLN_7BIT 0x0000 /* - 7 bit chars */
119#define SC2CTR_CLN_8BIT 0x0080 /* - 8 bit chars */
120#define SC2CTR_TWE 0x0100 /* transmit wait enable (enable XCTS control) */
121#define SC2CTR_OD 0x0200 /* bit order select */
122#define SC2CTR_OD_LSBFIRST 0x0000 /* - LSB first */
123#define SC2CTR_OD_MSBFIRST 0x0200 /* - MSB first */
124#define SC2CTR_TWS 0x1000 /* transmit wait select */
125#define SC2CTR_TWS_XCTS_HIGH 0x0000 /* - interrupt TX when XCTS high */
126#define SC2CTR_TWS_XCTS_LOW 0x1000 /* - interrupt TX when XCTS low */
127#define SC2CTR_BKE 0x2000 /* break transmit enable */
128#define SC2CTR_RXE 0x4000 /* receive enable */
129#define SC2CTR_TXE 0x8000 /* transmit enable */
130
131#define SC2ICR __SYSREG(0xd4002024, u8) /* interrupt control reg */
132#define SC2ICR_TD 0x20 /* transmit DMA trigger cause */
133#define SC2ICR_TI 0x10 /* transmit interrupt cause */
134#define SC2ICR_RES 0x04 /* receive error select */
135#define SC2ICR_RI 0x01 /* receive interrupt cause */
136
137#define SC2TXB __SYSREG(0xd4002018, u8) /* transmit buffer reg */
138#define SC2RXB __SYSREG(0xd4002019, u8) /* receive buffer reg */
139#define SC2STR __SYSREG(0xd400201c, u8) /* status reg */
140#define SC2STR_OEF 0x0001 /* overrun error found */
141#define SC2STR_PEF 0x0002 /* parity error found */
142#define SC2STR_FEF 0x0004 /* framing error found */
143#define SC2STR_CTS 0x0008 /* XCTS input pin status (0 means high) */
144#define SC2STR_RBF 0x0010 /* receive buffer status */
145#define SC2STR_TBF 0x0020 /* transmit buffer status */
146#define SC2STR_RXF 0x0040 /* receive status */
147#define SC2STR_TXF 0x0080 /* transmit status */
148
149#define SC2TIM __SYSREG(0xd400202d, u8) /* status reg */
150
151#define SC2RXIRQ 24 /* serial 2 Receive IRQ */
152#define SC2TXIRQ 25 /* serial 2 Transmit IRQ */
153
154#define SC2RXICR GxICR(SC2RXIRQ) /* serial 2 receive intr ctrl reg */
155#define SC2TXICR GxICR(SC2TXIRQ) /* serial 2 transmit intr ctrl reg */
156
157
158#endif /* __KERNEL__ */
159
160#endif /* _ASM_SERIAL_REGS_H */
diff --git a/include/asm-mn10300/serial.h b/include/asm-mn10300/serial.h
deleted file mode 100644
index 99785a9deadb..000000000000
--- a/include/asm-mn10300/serial.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/* Standard UART definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12/*
13 * The ASB2305 has an 18.432 MHz clock the UART
14 */
15#define BASE_BAUD (18432000 / 16)
16
17/* Standard COM flags (except for COM4, because of the 8514 problem) */
18#ifdef CONFIG_SERIAL_DETECT_IRQ
19#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
20#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
21#else
22#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
23#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
24#endif
25
26#ifdef CONFIG_SERIAL_MANY_PORTS
27#define FOURPORT_FLAGS ASYNC_FOURPORT
28#define ACCENT_FLAGS 0
29#define BOCA_FLAGS 0
30#define HUB6_FLAGS 0
31#define RS_TABLE_SIZE 64
32#else
33#define RS_TABLE_SIZE
34#endif
35
36#include <asm/unit/serial.h>
diff --git a/include/asm-mn10300/setup.h b/include/asm-mn10300/setup.h
deleted file mode 100644
index 08356c832283..000000000000
--- a/include/asm-mn10300/setup.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/* MN10300 Setup declarations
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_SETUP_H
12#define _ASM_SETUP_H
13
14extern void __init unit_setup(void);
15extern void __init unit_init_IRQ(void);
16
17#endif /* _ASM_SETUP_H */
diff --git a/include/asm-mn10300/shmbuf.h b/include/asm-mn10300/shmbuf.h
deleted file mode 100644
index 8f300cc35d6c..000000000000
--- a/include/asm-mn10300/shmbuf.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef _ASM_SHMBUF_H
2#define _ASM_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for MN10300 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 unsigned long __unused1;
19 __kernel_time_t shm_dtime; /* last detach time */
20 unsigned long __unused2;
21 __kernel_time_t shm_ctime; /* last change time */
22 unsigned long __unused3;
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused4;
27 unsigned long __unused5;
28};
29
30struct shminfo64 {
31 unsigned long shmmax;
32 unsigned long shmmin;
33 unsigned long shmmni;
34 unsigned long shmseg;
35 unsigned long shmall;
36 unsigned long __unused1;
37 unsigned long __unused2;
38 unsigned long __unused3;
39 unsigned long __unused4;
40};
41
42#endif /* _ASM_SHMBUF_H */
diff --git a/include/asm-mn10300/shmparam.h b/include/asm-mn10300/shmparam.h
deleted file mode 100644
index ab666ed1a070..000000000000
--- a/include/asm-mn10300/shmparam.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_SHMPARAM_H
2#define _ASM_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* _ASM_SHMPARAM_H */
diff --git a/include/asm-mn10300/sigcontext.h b/include/asm-mn10300/sigcontext.h
deleted file mode 100644
index 4de3afff4ad7..000000000000
--- a/include/asm-mn10300/sigcontext.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/* MN10300 Userspace signal context
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_SIGCONTEXT_H
12#define _ASM_SIGCONTEXT_H
13
14struct fpucontext {
15 /* Regular FPU environment */
16 unsigned long fs[32]; /* fpu registers */
17 unsigned long fpcr; /* fpu control register */
18};
19
20struct sigcontext {
21 unsigned long d0;
22 unsigned long d1;
23 unsigned long d2;
24 unsigned long d3;
25 unsigned long a0;
26 unsigned long a1;
27 unsigned long a2;
28 unsigned long a3;
29 unsigned long e0;
30 unsigned long e1;
31 unsigned long e2;
32 unsigned long e3;
33 unsigned long e4;
34 unsigned long e5;
35 unsigned long e6;
36 unsigned long e7;
37 unsigned long lar;
38 unsigned long lir;
39 unsigned long mdr;
40 unsigned long mcvf;
41 unsigned long mcrl;
42 unsigned long mcrh;
43 unsigned long mdrq;
44 unsigned long sp;
45 unsigned long epsw;
46 unsigned long pc;
47 struct fpucontext *fpucontext;
48 unsigned long oldmask;
49};
50
51
52#endif /* _ASM_SIGCONTEXT_H */
diff --git a/include/asm-mn10300/siginfo.h b/include/asm-mn10300/siginfo.h
deleted file mode 100644
index 0815d29d82e5..000000000000
--- a/include/asm-mn10300/siginfo.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/siginfo.h>
diff --git a/include/asm-mn10300/signal.h b/include/asm-mn10300/signal.h
deleted file mode 100644
index e98817cec5f7..000000000000
--- a/include/asm-mn10300/signal.h
+++ /dev/null
@@ -1,171 +0,0 @@
1/* MN10300 Signal definitions
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_SIGNAL_H
12#define _ASM_SIGNAL_H
13
14#include <linux/types.h>
15
16/* Avoid too many header ordering problems. */
17struct siginfo;
18
19#ifdef __KERNEL__
20/* Most things should be clean enough to redefine this at will, if care
21 is taken to make libc match. */
22
23#define _NSIG 64
24#define _NSIG_BPW 32
25#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
26
27typedef unsigned long old_sigset_t; /* at least 32 bits */
28
29typedef struct {
30 unsigned long sig[_NSIG_WORDS];
31} sigset_t;
32
33#else
34/* Here we must cater to libcs that poke about in kernel headers. */
35
36#define NSIG 32
37typedef unsigned long sigset_t;
38
39#endif /* __KERNEL__ */
40
41#define SIGHUP 1
42#define SIGINT 2
43#define SIGQUIT 3
44#define SIGILL 4
45#define SIGTRAP 5
46#define SIGABRT 6
47#define SIGIOT 6
48#define SIGBUS 7
49#define SIGFPE 8
50#define SIGKILL 9
51#define SIGUSR1 10
52#define SIGSEGV 11
53#define SIGUSR2 12
54#define SIGPIPE 13
55#define SIGALRM 14
56#define SIGTERM 15
57#define SIGSTKFLT 16
58#define SIGCHLD 17
59#define SIGCONT 18
60#define SIGSTOP 19
61#define SIGTSTP 20
62#define SIGTTIN 21
63#define SIGTTOU 22
64#define SIGURG 23
65#define SIGXCPU 24
66#define SIGXFSZ 25
67#define SIGVTALRM 26
68#define SIGPROF 27
69#define SIGWINCH 28
70#define SIGIO 29
71#define SIGPOLL SIGIO
72/*
73#define SIGLOST 29
74*/
75#define SIGPWR 30
76#define SIGSYS 31
77#define SIGUNUSED 31
78
79/* These should not be considered constants from userland. */
80#define SIGRTMIN 32
81#define SIGRTMAX (_NSIG-1)
82
83/*
84 * SA_FLAGS values:
85 *
86 * SA_ONSTACK indicates that a registered stack_t will be used.
87 * SA_RESTART flag to get restarting signals (which were the default long ago)
88 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
89 * SA_RESETHAND clears the handler when the signal is delivered.
90 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
91 * SA_NODEFER prevents the current signal from being masked in the handler.
92 *
93 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
94 * Unix names RESETHAND and NODEFER respectively.
95 */
96#define SA_NOCLDSTOP 0x00000001U
97#define SA_NOCLDWAIT 0x00000002U
98#define SA_SIGINFO 0x00000004U
99#define SA_ONSTACK 0x08000000U
100#define SA_RESTART 0x10000000U
101#define SA_NODEFER 0x40000000U
102#define SA_RESETHAND 0x80000000U
103
104#define SA_NOMASK SA_NODEFER
105#define SA_ONESHOT SA_RESETHAND
106
107#define SA_RESTORER 0x04000000
108
109/*
110 * sigaltstack controls
111 */
112#define SS_ONSTACK 1
113#define SS_DISABLE 2
114
115#define MINSIGSTKSZ 2048
116#define SIGSTKSZ 8192
117
118#include <asm-generic/signal.h>
119
120#ifdef __KERNEL__
121struct old_sigaction {
122 __sighandler_t sa_handler;
123 old_sigset_t sa_mask;
124 unsigned long sa_flags;
125 __sigrestore_t sa_restorer;
126};
127
128struct sigaction {
129 __sighandler_t sa_handler;
130 unsigned long sa_flags;
131 __sigrestore_t sa_restorer;
132 sigset_t sa_mask; /* mask last for extensibility */
133};
134
135struct k_sigaction {
136 struct sigaction sa;
137};
138#else
139/* Here we must cater to libcs that poke about in kernel headers. */
140
141struct sigaction {
142 union {
143 __sighandler_t _sa_handler;
144 void (*_sa_sigaction)(int, struct siginfo *, void *);
145 } _u;
146 sigset_t sa_mask;
147 unsigned long sa_flags;
148 void (*sa_restorer)(void);
149};
150
151#define sa_handler _u._sa_handler
152#define sa_sigaction _u._sa_sigaction
153
154#endif /* __KERNEL__ */
155
156typedef struct sigaltstack {
157 void __user *ss_sp;
158 int ss_flags;
159 size_t ss_size;
160} stack_t;
161
162#ifdef __KERNEL__
163#include <asm/sigcontext.h>
164
165
166struct pt_regs;
167#define ptrace_signal_deliver(regs, cookie) do { } while (0)
168
169#endif /* __KERNEL__ */
170
171#endif /* _ASM_SIGNAL_H */
diff --git a/include/asm-mn10300/smp.h b/include/asm-mn10300/smp.h
deleted file mode 100644
index 4eb8c61b7dab..000000000000
--- a/include/asm-mn10300/smp.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* MN10300 SMP support
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_SMP_H
12#define _ASM_SMP_H
13
14#ifdef CONFIG_SMP
15#error SMP not yet supported for MN10300
16#endif
17
18#endif
diff --git a/include/asm-mn10300/socket.h b/include/asm-mn10300/socket.h
deleted file mode 100644
index fb5daf438ec9..000000000000
--- a/include/asm-mn10300/socket.h
+++ /dev/null
@@ -1,60 +0,0 @@
1#ifndef _ASM_SOCKET_H
2#define _ASM_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26#define SO_PASSCRED 16
27#define SO_PEERCRED 17
28#define SO_RCVLOWAT 18
29#define SO_SNDLOWAT 19
30#define SO_RCVTIMEO 20
31#define SO_SNDTIMEO 21
32
33/* Security levels - as per NRL IPv6 - don't actually do anything */
34#define SO_SECURITY_AUTHENTICATION 22
35#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
36#define SO_SECURITY_ENCRYPTION_NETWORK 24
37
38#define SO_BINDTODEVICE 25
39
40/* Socket filtering */
41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27
43
44#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29
46#define SCM_TIMESTAMP SO_TIMESTAMP
47
48#define SO_ACCEPTCONN 30
49
50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54
55#define SO_MARK 36
56
57#define SO_TIMESTAMPING 37
58#define SCM_TIMESTAMPING SO_TIMESTAMPING
59
60#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-mn10300/sockios.h b/include/asm-mn10300/sockios.h
deleted file mode 100644
index b03043a1c564..000000000000
--- a/include/asm-mn10300/sockios.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_SOCKIOS_H
2#define _ASM_SOCKIOS_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif /* _ASM_SOCKIOS_H */
diff --git a/include/asm-mn10300/spinlock.h b/include/asm-mn10300/spinlock.h
deleted file mode 100644
index 4bf9c8b169e0..000000000000
--- a/include/asm-mn10300/spinlock.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/* MN10300 spinlock support
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_SPINLOCK_H
12#define _ASM_SPINLOCK_H
13
14#error SMP spinlocks not implemented for MN10300
15
16#endif /* _ASM_SPINLOCK_H */
diff --git a/include/asm-mn10300/stat.h b/include/asm-mn10300/stat.h
deleted file mode 100644
index 63ff8371cf2c..000000000000
--- a/include/asm-mn10300/stat.h
+++ /dev/null
@@ -1,78 +0,0 @@
1#ifndef _ASM_STAT_H
2#define _ASM_STAT_H
3
4struct __old_kernel_stat {
5 unsigned short st_dev;
6 unsigned short st_ino;
7 unsigned short st_mode;
8 unsigned short st_nlink;
9 unsigned short st_uid;
10 unsigned short st_gid;
11 unsigned short st_rdev;
12 unsigned long st_size;
13 unsigned long st_atime;
14 unsigned long st_mtime;
15 unsigned long st_ctime;
16};
17
18struct stat {
19 unsigned long st_dev;
20 unsigned long st_ino;
21 unsigned short st_mode;
22 unsigned short st_nlink;
23 unsigned short st_uid;
24 unsigned short st_gid;
25 unsigned long st_rdev;
26 unsigned long st_size;
27 unsigned long st_blksize;
28 unsigned long st_blocks;
29 unsigned long st_atime;
30 unsigned long st_atime_nsec;
31 unsigned long st_mtime;
32 unsigned long st_mtime_nsec;
33 unsigned long st_ctime;
34 unsigned long st_ctime_nsec;
35 unsigned long __unused4;
36 unsigned long __unused5;
37};
38
39/* This matches struct stat64 in glibc2.1, hence the absolutely
40 * insane amounts of padding around dev_t's.
41 */
42struct stat64 {
43 unsigned long long st_dev;
44 unsigned char __pad0[4];
45
46#define STAT64_HAS_BROKEN_ST_INO 1
47 unsigned long __st_ino;
48
49 unsigned int st_mode;
50 unsigned int st_nlink;
51
52 unsigned long st_uid;
53 unsigned long st_gid;
54
55 unsigned long long st_rdev;
56 unsigned char __pad3[4];
57
58 long long st_size;
59 unsigned long st_blksize;
60
61 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
62 unsigned long __pad4; /* future possible st_blocks high bits */
63
64 unsigned long st_atime;
65 unsigned long st_atime_nsec;
66
67 unsigned long st_mtime;
68 unsigned int st_mtime_nsec;
69
70 unsigned long st_ctime;
71 unsigned long st_ctime_nsec;
72
73 unsigned long long st_ino;
74};
75
76#define STAT_HAVE_NSEC 1
77
78#endif /* _ASM_STAT_H */
diff --git a/include/asm-mn10300/statfs.h b/include/asm-mn10300/statfs.h
deleted file mode 100644
index 0b91fe198c20..000000000000
--- a/include/asm-mn10300/statfs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/statfs.h>
diff --git a/include/asm-mn10300/string.h b/include/asm-mn10300/string.h
deleted file mode 100644
index 47dbd4346c32..000000000000
--- a/include/asm-mn10300/string.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/* MN10300 Optimised string functions
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Modified by David Howells (dhowells@redhat.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12#ifndef _ASM_STRING_H
13#define _ASM_STRING_H
14
15#define __HAVE_ARCH_MEMSET
16#define __HAVE_ARCH_MEMCPY
17#define __HAVE_ARCH_MEMMOVE
18
19extern void *memset(void *dest, int ch, size_t count);
20extern void *memcpy(void *dest, const void *src, size_t count);
21extern void *memmove(void *dest, const void *src, size_t count);
22
23
24extern void __struct_cpy_bug(void);
25#define struct_cpy(x, y) \
26({ \
27 if (sizeof(*(x)) != sizeof(*(y))) \
28 __struct_cpy_bug; \
29 memcpy(x, y, sizeof(*(x))); \
30})
31
32#endif /* _ASM_STRING_H */
diff --git a/include/asm-mn10300/swab.h b/include/asm-mn10300/swab.h
deleted file mode 100644
index bd818a820ca8..000000000000
--- a/include/asm-mn10300/swab.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/* MN10300 Byte-order primitive construction
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_SWAB_H
12#define _ASM_SWAB_H
13
14#include <linux/types.h>
15
16#ifdef __GNUC__
17
18static inline __attribute__((const))
19__u32 __arch_swab32(__u32 x)
20{
21 __u32 ret;
22 asm("swap %1,%0" : "=r" (ret) : "r" (x));
23 return ret;
24}
25#define __arch_swab32 __arch_swab32
26
27static inline __attribute__((const))
28__u16 __arch_swab16(__u16 x)
29{
30 __u16 ret;
31 asm("swaph %1,%0" : "=r" (ret) : "r" (x));
32 return ret;
33}
34#define __arch_swab32 __arch_swab32
35
36#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
37# define __SWAB_64_THRU_32__
38#endif
39
40#endif /* __GNUC__ */
41
42#endif /* _ASM_SWAB_H */
diff --git a/include/asm-mn10300/system.h b/include/asm-mn10300/system.h
deleted file mode 100644
index 8214fb7e7fe4..000000000000
--- a/include/asm-mn10300/system.h
+++ /dev/null
@@ -1,237 +0,0 @@
1/* MN10300 System definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_SYSTEM_H
12#define _ASM_SYSTEM_H
13
14#include <asm/cpu-regs.h>
15
16#ifdef __KERNEL__
17#ifndef __ASSEMBLY__
18
19#include <linux/kernel.h>
20
21struct task_struct;
22struct thread_struct;
23
24extern asmlinkage
25struct task_struct *__switch_to(struct thread_struct *prev,
26 struct thread_struct *next,
27 struct task_struct *prev_task);
28
29/* context switching is now performed out-of-line in switch_to.S */
30#define switch_to(prev, next, last) \
31do { \
32 current->thread.wchan = (u_long) __builtin_return_address(0); \
33 (last) = __switch_to(&(prev)->thread, &(next)->thread, (prev)); \
34 mb(); \
35 current->thread.wchan = 0; \
36} while (0)
37
38#define arch_align_stack(x) (x)
39
40#define nop() asm volatile ("nop")
41
42#endif /* !__ASSEMBLY__ */
43
44/*
45 * Force strict CPU ordering.
46 * And yes, this is required on UP too when we're talking
47 * to devices.
48 *
49 * For now, "wmb()" doesn't actually do anything, as all
50 * Intel CPU's follow what Intel calls a *Processor Order*,
51 * in which all writes are seen in the program order even
52 * outside the CPU.
53 *
54 * I expect future Intel CPU's to have a weaker ordering,
55 * but I'd also expect them to finally get their act together
56 * and add some real memory barriers if so.
57 *
58 * Some non intel clones support out of order store. wmb() ceases to be a
59 * nop for these.
60 */
61
62#define mb() asm volatile ("": : :"memory")
63#define rmb() mb()
64#define wmb() asm volatile ("": : :"memory")
65
66#ifdef CONFIG_SMP
67#define smp_mb() mb()
68#define smp_rmb() rmb()
69#define smp_wmb() wmb()
70#else
71#define smp_mb() barrier()
72#define smp_rmb() barrier()
73#define smp_wmb() barrier()
74#endif
75
76#define set_mb(var, value) do { var = value; mb(); } while (0)
77#define set_wmb(var, value) do { var = value; wmb(); } while (0)
78
79#define read_barrier_depends() do {} while (0)
80#define smp_read_barrier_depends() do {} while (0)
81
82/*****************************************************************************/
83/*
84 * interrupt control
85 * - "disabled": run in IM1/2
86 * - level 0 - GDB stub
87 * - level 1 - virtual serial DMA (if present)
88 * - level 5 - normal interrupt priority
89 * - level 6 - timer interrupt
90 * - "enabled": run in IM7
91 */
92#ifdef CONFIG_MN10300_TTYSM
93#define MN10300_CLI_LEVEL EPSW_IM_2
94#else
95#define MN10300_CLI_LEVEL EPSW_IM_1
96#endif
97
98#define local_save_flags(x) \
99do { \
100 typecheck(unsigned long, x); \
101 asm volatile( \
102 " mov epsw,%0 \n" \
103 : "=d"(x) \
104 ); \
105} while (0)
106
107#define local_irq_disable() \
108do { \
109 asm volatile( \
110 " and %0,epsw \n" \
111 " or %1,epsw \n" \
112 " nop \n" \
113 " nop \n" \
114 " nop \n" \
115 : \
116 : "i"(~EPSW_IM), "i"(EPSW_IE | MN10300_CLI_LEVEL) \
117 ); \
118} while (0)
119
120#define local_irq_save(x) \
121do { \
122 local_save_flags(x); \
123 local_irq_disable(); \
124} while (0)
125
126/*
127 * we make sure local_irq_enable() doesn't cause priority inversion
128 */
129#ifndef __ASSEMBLY__
130
131extern unsigned long __mn10300_irq_enabled_epsw;
132
133#endif
134
135#define local_irq_enable() \
136do { \
137 unsigned long tmp; \
138 \
139 asm volatile( \
140 " mov epsw,%0 \n" \
141 " and %1,%0 \n" \
142 " or %2,%0 \n" \
143 " mov %0,epsw \n" \
144 : "=&d"(tmp) \
145 : "i"(~EPSW_IM), "r"(__mn10300_irq_enabled_epsw) \
146 ); \
147} while (0)
148
149#define local_irq_restore(x) \
150do { \
151 typecheck(unsigned long, x); \
152 asm volatile( \
153 " mov %0,epsw \n" \
154 " nop \n" \
155 " nop \n" \
156 " nop \n" \
157 : \
158 : "d"(x) \
159 : "memory", "cc" \
160 ); \
161} while (0)
162
163#define irqs_disabled() \
164({ \
165 unsigned long flags; \
166 local_save_flags(flags); \
167 (flags & EPSW_IM) <= MN10300_CLI_LEVEL; \
168})
169
170/* hook to save power by halting the CPU
171 * - called from the idle loop
172 * - must reenable interrupts (which takes three instruction cycles to complete)
173 */
174#define safe_halt() \
175do { \
176 asm volatile(" or %0,epsw \n" \
177 " nop \n" \
178 " nop \n" \
179 " bset %2,(%1) \n" \
180 : \
181 : "i"(EPSW_IE|EPSW_IM), "n"(&CPUM), "i"(CPUM_SLEEP)\
182 : "cc" \
183 ); \
184} while (0)
185
186#define STI or EPSW_IE|EPSW_IM,epsw
187#define CLI and ~EPSW_IM,epsw; or EPSW_IE|MN10300_CLI_LEVEL,epsw; nop; nop; nop
188
189/*****************************************************************************/
190/*
191 * MN10300 doesn't actually have an exchange instruction
192 */
193#ifndef __ASSEMBLY__
194
195struct __xchg_dummy { unsigned long a[100]; };
196#define __xg(x) ((struct __xchg_dummy *)(x))
197
198static inline
199unsigned long __xchg(volatile unsigned long *m, unsigned long val)
200{
201 unsigned long retval;
202 unsigned long flags;
203
204 local_irq_save(flags);
205 retval = *m;
206 *m = val;
207 local_irq_restore(flags);
208 return retval;
209}
210
211#define xchg(ptr, v) \
212 ((__typeof__(*(ptr))) __xchg((unsigned long *)(ptr), \
213 (unsigned long)(v)))
214
215static inline unsigned long __cmpxchg(volatile unsigned long *m,
216 unsigned long old, unsigned long new)
217{
218 unsigned long retval;
219 unsigned long flags;
220
221 local_irq_save(flags);
222 retval = *m;
223 if (retval == old)
224 *m = new;
225 local_irq_restore(flags);
226 return retval;
227}
228
229#define cmpxchg(ptr, o, n) \
230 ((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \
231 (unsigned long)(o), \
232 (unsigned long)(n)))
233
234#endif /* !__ASSEMBLY__ */
235
236#endif /* __KERNEL__ */
237#endif /* _ASM_SYSTEM_H */
diff --git a/include/asm-mn10300/termbits.h b/include/asm-mn10300/termbits.h
deleted file mode 100644
index eb2b0dc1f696..000000000000
--- a/include/asm-mn10300/termbits.h
+++ /dev/null
@@ -1,200 +0,0 @@
1#ifndef _ASM_TERMBITS_H
2#define _ASM_TERMBITS_H
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20struct termios2 {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27 speed_t c_ispeed; /* input speed */
28 speed_t c_ospeed; /* output speed */
29};
30
31struct ktermios {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_line; /* line discipline */
37 cc_t c_cc[NCCS]; /* control characters */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
42/* c_cc characters */
43#define VINTR 0
44#define VQUIT 1
45#define VERASE 2
46#define VKILL 3
47#define VEOF 4
48#define VTIME 5
49#define VMIN 6
50#define VSWTC 7
51#define VSTART 8
52#define VSTOP 9
53#define VSUSP 10
54#define VEOL 11
55#define VREPRINT 12
56#define VDISCARD 13
57#define VWERASE 14
58#define VLNEXT 15
59#define VEOL2 16
60
61
62/* c_iflag bits */
63#define IGNBRK 0000001
64#define BRKINT 0000002
65#define IGNPAR 0000004
66#define PARMRK 0000010
67#define INPCK 0000020
68#define ISTRIP 0000040
69#define INLCR 0000100
70#define IGNCR 0000200
71#define ICRNL 0000400
72#define IUCLC 0001000
73#define IXON 0002000
74#define IXANY 0004000
75#define IXOFF 0010000
76#define IMAXBEL 0020000
77#define IUTF8 0040000
78
79/* c_oflag bits */
80#define OPOST 0000001
81#define OLCUC 0000002
82#define ONLCR 0000004
83#define OCRNL 0000010
84#define ONOCR 0000020
85#define ONLRET 0000040
86#define OFILL 0000100
87#define OFDEL 0000200
88#define NLDLY 0000400
89#define NL0 0000000
90#define NL1 0000400
91#define CRDLY 0003000
92#define CR0 0000000
93#define CR1 0001000
94#define CR2 0002000
95#define CR3 0003000
96#define TABDLY 0014000
97#define TAB0 0000000
98#define TAB1 0004000
99#define TAB2 0010000
100#define TAB3 0014000
101#define XTABS 0014000
102#define BSDLY 0020000
103#define BS0 0000000
104#define BS1 0020000
105#define VTDLY 0040000
106#define VT0 0000000
107#define VT1 0040000
108#define FFDLY 0100000
109#define FF0 0000000
110#define FF1 0100000
111
112/* c_cflag bit meaning */
113#define CBAUD 0010017
114#define B0 0000000 /* hang up */
115#define B50 0000001
116#define B75 0000002
117#define B110 0000003
118#define B134 0000004
119#define B150 0000005
120#define B200 0000006
121#define B300 0000007
122#define B600 0000010
123#define B1200 0000011
124#define B1800 0000012
125#define B2400 0000013
126#define B4800 0000014
127#define B9600 0000015
128#define B19200 0000016
129#define B38400 0000017
130#define EXTA B19200
131#define EXTB B38400
132#define CSIZE 0000060
133#define CS5 0000000
134#define CS6 0000020
135#define CS7 0000040
136#define CS8 0000060
137#define CSTOPB 0000100
138#define CREAD 0000200
139#define PARENB 0000400
140#define PARODD 0001000
141#define HUPCL 0002000
142#define CLOCAL 0004000
143#define CBAUDEX 0010000
144#define BOTHER 0010000
145#define B57600 0010001
146#define B115200 0010002
147#define B230400 0010003
148#define B460800 0010004
149#define B500000 0010005
150#define B576000 0010006
151#define B921600 0010007
152#define B1000000 0010010
153#define B1152000 0010011
154#define B1500000 0010012
155#define B2000000 0010013
156#define B2500000 0010014
157#define B3000000 0010015
158#define B3500000 0010016
159#define B4000000 0010017
160#define CIBAUD 002003600000 /* input baud rate (not used) */
161#define CTVB 004000000000 /* VisioBraille Terminal flow control */
162#define CMSPAR 010000000000 /* mark or space (stick) parity */
163#define CRTSCTS 020000000000 /* flow control */
164
165#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
166
167/* c_lflag bits */
168#define ISIG 0000001
169#define ICANON 0000002
170#define XCASE 0000004
171#define ECHO 0000010
172#define ECHOE 0000020
173#define ECHOK 0000040
174#define ECHONL 0000100
175#define NOFLSH 0000200
176#define TOSTOP 0000400
177#define ECHOCTL 0001000
178#define ECHOPRT 0002000
179#define ECHOKE 0004000
180#define FLUSHO 0010000
181#define PENDIN 0040000
182#define IEXTEN 0100000
183
184/* tcflow() and TCXONC use these */
185#define TCOOFF 0
186#define TCOON 1
187#define TCIOFF 2
188#define TCION 3
189
190/* tcflush() and TCFLSH use these */
191#define TCIFLUSH 0
192#define TCOFLUSH 1
193#define TCIOFLUSH 2
194
195/* tcsetattr uses these */
196#define TCSANOW 0
197#define TCSADRAIN 1
198#define TCSAFLUSH 2
199
200#endif /* _ASM_TERMBITS_H */
diff --git a/include/asm-mn10300/termios.h b/include/asm-mn10300/termios.h
deleted file mode 100644
index dd7cf617e118..000000000000
--- a/include/asm-mn10300/termios.h
+++ /dev/null
@@ -1,92 +0,0 @@
1#ifndef _ASM_TERMIOS_H
2#define _ASM_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24#ifdef __KERNEL__
25/* intr=^C quit=^| erase=del kill=^U
26 eof=^D vtime=\0 vmin=\1 sxtc=\0
27 start=^Q stop=^S susp=^Z eol=\0
28 reprint=^R discard=^U werase=^W lnext=^V
29 eol2=\0
30*/
31#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
32#endif
33
34/* modem lines */
35#define TIOCM_LE 0x001
36#define TIOCM_DTR 0x002
37#define TIOCM_RTS 0x004
38#define TIOCM_ST 0x008
39#define TIOCM_SR 0x010
40#define TIOCM_CTS 0x020
41#define TIOCM_CAR 0x040
42#define TIOCM_RNG 0x080
43#define TIOCM_DSR 0x100
44#define TIOCM_CD TIOCM_CAR
45#define TIOCM_RI TIOCM_RNG
46#define TIOCM_OUT1 0x2000
47#define TIOCM_OUT2 0x4000
48#define TIOCM_LOOP 0x8000
49
50#define TIOCM_MODEM_BITS TIOCM_OUT2 /* IRDA support */
51
52/*
53 * Translate a "termio" structure into a "termios". Ugh.
54 */
55#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
56 unsigned short __tmp; \
57 get_user(__tmp, &(termio)->x); \
58 *(unsigned short *) &(termios)->x = __tmp; \
59}
60
61#define user_termio_to_kernel_termios(termios, termio) \
62({ \
63 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
64 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
65 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
66 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
67 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
68})
69
70/*
71 * Translate a "termios" structure into a "termio". Ugh.
72 */
73#define kernel_termios_to_user_termio(termio, termios) \
74({ \
75 put_user((termios)->c_iflag, &(termio)->c_iflag); \
76 put_user((termios)->c_oflag, &(termio)->c_oflag); \
77 put_user((termios)->c_cflag, &(termio)->c_cflag); \
78 put_user((termios)->c_lflag, &(termio)->c_lflag); \
79 put_user((termios)->c_line, &(termio)->c_line); \
80 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
81})
82
83#define user_termios_to_kernel_termios(k, u) \
84 copy_from_user(k, u, sizeof(struct termios2))
85#define kernel_termios_to_user_termios(u, k) \
86 copy_to_user(u, k, sizeof(struct termios2))
87#define user_termios_to_kernel_termios_1(k, u) \
88 copy_from_user(k, u, sizeof(struct termios))
89#define kernel_termios_to_user_termios_1(u, k) \
90 copy_to_user(u, k, sizeof(struct termios))
91
92#endif /* _ASM_TERMIOS_H */
diff --git a/include/asm-mn10300/thread_info.h b/include/asm-mn10300/thread_info.h
deleted file mode 100644
index 78a3881f3c12..000000000000
--- a/include/asm-mn10300/thread_info.h
+++ /dev/null
@@ -1,170 +0,0 @@
1/* MN10300 Low-level thread information
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_THREAD_INFO_H
13#define _ASM_THREAD_INFO_H
14
15#ifdef __KERNEL__
16
17#include <asm/page.h>
18
19#ifndef __ASSEMBLY__
20#include <asm/processor.h>
21#endif
22
23#define PREEMPT_ACTIVE 0x10000000
24
25#ifdef CONFIG_4KSTACKS
26#define THREAD_SIZE (4096)
27#else
28#define THREAD_SIZE (8192)
29#endif
30
31#define STACK_WARN (THREAD_SIZE / 8)
32
33/*
34 * low level task data that entry.S needs immediate access to
35 * - this struct should fit entirely inside of one cache line
36 * - this struct shares the supervisor stack pages
37 * - if the contents of this structure are changed, the assembly constants
38 * must also be changed
39 */
40#ifndef __ASSEMBLY__
41
42struct thread_info {
43 struct task_struct *task; /* main task structure */
44 struct exec_domain *exec_domain; /* execution domain */
45 unsigned long flags; /* low level flags */
46 __u32 cpu; /* current CPU */
47 __s32 preempt_count; /* 0 => preemptable, <0 => BUG */
48
49 mm_segment_t addr_limit; /* thread address space:
50 0-0xBFFFFFFF for user-thead
51 0-0xFFFFFFFF for kernel-thread
52 */
53 struct restart_block restart_block;
54
55 __u8 supervisor_stack[0];
56};
57
58#else /* !__ASSEMBLY__ */
59
60#ifndef __ASM_OFFSETS_H__
61#include <asm/asm-offsets.h>
62#endif
63
64#endif
65
66/*
67 * macros/functions for gaining access to the thread information structure
68 *
69 * preempt_count needs to be 1 initially, until the scheduler is functional.
70 */
71#ifndef __ASSEMBLY__
72
73#define INIT_THREAD_INFO(tsk) \
74{ \
75 .task = &tsk, \
76 .exec_domain = &default_exec_domain, \
77 .flags = 0, \
78 .cpu = 0, \
79 .preempt_count = 1, \
80 .addr_limit = KERNEL_DS, \
81 .restart_block = { \
82 .fn = do_no_restart_syscall, \
83 }, \
84}
85
86#define init_thread_info (init_thread_union.thread_info)
87#define init_stack (init_thread_union.stack)
88#define init_uregs \
89 ((struct pt_regs *) \
90 ((unsigned long) init_stack + THREAD_SIZE - sizeof(struct pt_regs)))
91
92extern struct thread_info *__current_ti;
93
94/* how to get the thread information struct from C */
95static inline __attribute__((const))
96struct thread_info *current_thread_info(void)
97{
98 struct thread_info *ti;
99 asm("mov sp,%0\n"
100 "and %1,%0\n"
101 : "=d" (ti)
102 : "i" (~(THREAD_SIZE - 1))
103 : "cc");
104 return ti;
105}
106
107/* how to get the current stack pointer from C */
108static inline unsigned long current_stack_pointer(void)
109{
110 unsigned long sp;
111 asm("mov sp,%0; ":"=r" (sp));
112 return sp;
113}
114
115#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
116
117/* thread information allocation */
118#ifdef CONFIG_DEBUG_STACK_USAGE
119#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
120#else
121#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
122#endif
123
124#define free_thread_info(ti) kfree((ti))
125#define get_thread_info(ti) get_task_struct((ti)->task)
126#define put_thread_info(ti) put_task_struct((ti)->task)
127
128#else /* !__ASSEMBLY__ */
129
130#ifndef __VMLINUX_LDS__
131/* how to get the thread information struct from ASM */
132.macro GET_THREAD_INFO reg
133 mov sp,\reg
134 and -THREAD_SIZE,\reg
135.endm
136#endif
137#endif
138
139/*
140 * thread information flags
141 * - these are process state flags that various assembly files may need to
142 * access
143 * - pending work-to-be-done flags are in LSW
144 * - other flags in MSW
145 */
146#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
147#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
148#define TIF_SIGPENDING 2 /* signal pending */
149#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
150#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
151#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
152#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
153#define TIF_MEMDIE 17 /* OOM killer killed process */
154#define TIF_FREEZE 18 /* freezing for suspend */
155
156#define _TIF_SYSCALL_TRACE +(1 << TIF_SYSCALL_TRACE)
157#define _TIF_NOTIFY_RESUME +(1 << TIF_NOTIFY_RESUME)
158#define _TIF_SIGPENDING +(1 << TIF_SIGPENDING)
159#define _TIF_NEED_RESCHED +(1 << TIF_NEED_RESCHED)
160#define _TIF_SINGLESTEP +(1 << TIF_SINGLESTEP)
161#define _TIF_RESTORE_SIGMASK +(1 << TIF_RESTORE_SIGMASK)
162#define _TIF_POLLING_NRFLAG +(1 << TIF_POLLING_NRFLAG)
163#define _TIF_FREEZE +(1 << TIF_FREEZE)
164
165#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
166#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
167
168#endif /* __KERNEL__ */
169
170#endif /* _ASM_THREAD_INFO_H */
diff --git a/include/asm-mn10300/timer-regs.h b/include/asm-mn10300/timer-regs.h
deleted file mode 100644
index 1d883b7f94ab..000000000000
--- a/include/asm-mn10300/timer-regs.h
+++ /dev/null
@@ -1,293 +0,0 @@
1/* AM33v2 on-board timer module registers
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_TIMER_REGS_H
13#define _ASM_TIMER_REGS_H
14
15#include <asm/cpu-regs.h>
16#include <asm/intctl-regs.h>
17
18#ifdef __KERNEL__
19
20/* timer prescalar control */
21#define TMPSCNT __SYSREG(0xd4003071, u8) /* timer prescaler control */
22#define TMPSCNT_ENABLE 0x80 /* timer prescaler enable */
23#define TMPSCNT_DISABLE 0x00 /* timer prescaler disable */
24
25/* 8 bit timers */
26#define TM0MD __SYSREG(0xd4003000, u8) /* timer 0 mode register */
27#define TM0MD_SRC 0x07 /* timer source */
28#define TM0MD_SRC_IOCLK 0x00 /* - IOCLK */
29#define TM0MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */
30#define TM0MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */
31#define TM0MD_SRC_TM2IO 0x03 /* - TM2IO pin input */
32#define TM0MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */
33#define TM0MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */
34#define TM0MD_SRC_TM0IO 0x07 /* - TM0IO pin input */
35#define TM0MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */
36#define TM0MD_COUNT_ENABLE 0x80 /* timer count enable */
37
38#define TM1MD __SYSREG(0xd4003001, u8) /* timer 1 mode register */
39#define TM1MD_SRC 0x07 /* timer source */
40#define TM1MD_SRC_IOCLK 0x00 /* - IOCLK */
41#define TM1MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */
42#define TM1MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */
43#define TM1MD_SRC_TM0CASCADE 0x03 /* - cascade with timer 0 */
44#define TM1MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */
45#define TM1MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */
46#define TM1MD_SRC_TM1IO 0x07 /* - TM1IO pin input */
47#define TM1MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */
48#define TM1MD_COUNT_ENABLE 0x80 /* timer count enable */
49
50#define TM2MD __SYSREG(0xd4003002, u8) /* timer 2 mode register */
51#define TM2MD_SRC 0x07 /* timer source */
52#define TM2MD_SRC_IOCLK 0x00 /* - IOCLK */
53#define TM2MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */
54#define TM2MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */
55#define TM2MD_SRC_TM1CASCADE 0x03 /* - cascade with timer 1 */
56#define TM2MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */
57#define TM2MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */
58#define TM2MD_SRC_TM2IO 0x07 /* - TM2IO pin input */
59#define TM2MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */
60#define TM2MD_COUNT_ENABLE 0x80 /* timer count enable */
61
62#define TM3MD __SYSREG(0xd4003003, u8) /* timer 3 mode register */
63#define TM3MD_SRC 0x07 /* timer source */
64#define TM3MD_SRC_IOCLK 0x00 /* - IOCLK */
65#define TM3MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */
66#define TM3MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */
67#define TM3MD_SRC_TM1CASCADE 0x03 /* - cascade with timer 2 */
68#define TM3MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */
69#define TM3MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */
70#define TM3MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */
71#define TM3MD_SRC_TM3IO 0x07 /* - TM3IO pin input */
72#define TM3MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */
73#define TM3MD_COUNT_ENABLE 0x80 /* timer count enable */
74
75#define TM01MD __SYSREG(0xd4003000, u16) /* timer 0:1 mode register */
76
77#define TM0BR __SYSREG(0xd4003010, u8) /* timer 0 base register */
78#define TM1BR __SYSREG(0xd4003011, u8) /* timer 1 base register */
79#define TM2BR __SYSREG(0xd4003012, u8) /* timer 2 base register */
80#define TM3BR __SYSREG(0xd4003013, u8) /* timer 3 base register */
81#define TM01BR __SYSREG(0xd4003010, u16) /* timer 0:1 base register */
82
83#define TM0BC __SYSREGC(0xd4003020, u8) /* timer 0 binary counter */
84#define TM1BC __SYSREGC(0xd4003021, u8) /* timer 1 binary counter */
85#define TM2BC __SYSREGC(0xd4003022, u8) /* timer 2 binary counter */
86#define TM3BC __SYSREGC(0xd4003023, u8) /* timer 3 binary counter */
87#define TM01BC __SYSREGC(0xd4003020, u16) /* timer 0:1 binary counter */
88
89#define TM0IRQ 2 /* timer 0 IRQ */
90#define TM1IRQ 3 /* timer 1 IRQ */
91#define TM2IRQ 4 /* timer 2 IRQ */
92#define TM3IRQ 5 /* timer 3 IRQ */
93
94#define TM0ICR GxICR(TM0IRQ) /* timer 0 uflow intr ctrl reg */
95#define TM1ICR GxICR(TM1IRQ) /* timer 1 uflow intr ctrl reg */
96#define TM2ICR GxICR(TM2IRQ) /* timer 2 uflow intr ctrl reg */
97#define TM3ICR GxICR(TM3IRQ) /* timer 3 uflow intr ctrl reg */
98
99/* 16-bit timers 4,5 & 7-11 */
100#define TM4MD __SYSREG(0xd4003080, u8) /* timer 4 mode register */
101#define TM4MD_SRC 0x07 /* timer source */
102#define TM4MD_SRC_IOCLK 0x00 /* - IOCLK */
103#define TM4MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */
104#define TM4MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */
105#define TM4MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */
106#define TM4MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */
107#define TM4MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */
108#define TM4MD_SRC_TM4IO 0x07 /* - TM4IO pin input */
109#define TM4MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */
110#define TM4MD_COUNT_ENABLE 0x80 /* timer count enable */
111
112#define TM5MD __SYSREG(0xd4003082, u8) /* timer 5 mode register */
113#define TM5MD_SRC 0x07 /* timer source */
114#define TM5MD_SRC_IOCLK 0x00 /* - IOCLK */
115#define TM5MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */
116#define TM5MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */
117#define TM5MD_SRC_TM4CASCADE 0x03 /* - cascade with timer 4 */
118#define TM5MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */
119#define TM5MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */
120#define TM5MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */
121#define TM5MD_SRC_TM5IO 0x07 /* - TM5IO pin input */
122#define TM5MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */
123#define TM5MD_COUNT_ENABLE 0x80 /* timer count enable */
124
125#define TM7MD __SYSREG(0xd4003086, u8) /* timer 7 mode register */
126#define TM7MD_SRC 0x07 /* timer source */
127#define TM7MD_SRC_IOCLK 0x00 /* - IOCLK */
128#define TM7MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */
129#define TM7MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */
130#define TM7MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */
131#define TM7MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */
132#define TM7MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */
133#define TM7MD_SRC_TM7IO 0x07 /* - TM7IO pin input */
134#define TM7MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */
135#define TM7MD_COUNT_ENABLE 0x80 /* timer count enable */
136
137#define TM8MD __SYSREG(0xd4003088, u8) /* timer 8 mode register */
138#define TM8MD_SRC 0x07 /* timer source */
139#define TM8MD_SRC_IOCLK 0x00 /* - IOCLK */
140#define TM8MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */
141#define TM8MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */
142#define TM8MD_SRC_TM7CASCADE 0x03 /* - cascade with timer 7 */
143#define TM8MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */
144#define TM8MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */
145#define TM8MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */
146#define TM8MD_SRC_TM8IO 0x07 /* - TM8IO pin input */
147#define TM8MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */
148#define TM8MD_COUNT_ENABLE 0x80 /* timer count enable */
149
150#define TM9MD __SYSREG(0xd400308a, u8) /* timer 9 mode register */
151#define TM9MD_SRC 0x07 /* timer source */
152#define TM9MD_SRC_IOCLK 0x00 /* - IOCLK */
153#define TM9MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */
154#define TM9MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */
155#define TM9MD_SRC_TM8CASCADE 0x03 /* - cascade with timer 8 */
156#define TM9MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */
157#define TM9MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */
158#define TM9MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */
159#define TM9MD_SRC_TM9IO 0x07 /* - TM9IO pin input */
160#define TM9MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */
161#define TM9MD_COUNT_ENABLE 0x80 /* timer count enable */
162
163#define TM10MD __SYSREG(0xd400308c, u8) /* timer 10 mode register */
164#define TM10MD_SRC 0x07 /* timer source */
165#define TM10MD_SRC_IOCLK 0x00 /* - IOCLK */
166#define TM10MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */
167#define TM10MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */
168#define TM10MD_SRC_TM9CASCADE 0x03 /* - cascade with timer 9 */
169#define TM10MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */
170#define TM10MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */
171#define TM10MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */
172#define TM10MD_SRC_TM10IO 0x07 /* - TM10IO pin input */
173#define TM10MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */
174#define TM10MD_COUNT_ENABLE 0x80 /* timer count enable */
175
176#define TM11MD __SYSREG(0xd400308e, u8) /* timer 11 mode register */
177#define TM11MD_SRC 0x07 /* timer source */
178#define TM11MD_SRC_IOCLK 0x00 /* - IOCLK */
179#define TM11MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */
180#define TM11MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */
181#define TM11MD_SRC_TM7CASCADE 0x03 /* - cascade with timer 7 */
182#define TM11MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */
183#define TM11MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */
184#define TM11MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */
185#define TM11MD_SRC_TM11IO 0x07 /* - TM11IO pin input */
186#define TM11MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */
187#define TM11MD_COUNT_ENABLE 0x80 /* timer count enable */
188
189#define TM4BR __SYSREG(0xd4003090, u16) /* timer 4 base register */
190#define TM5BR __SYSREG(0xd4003092, u16) /* timer 5 base register */
191#define TM7BR __SYSREG(0xd4003096, u16) /* timer 7 base register */
192#define TM8BR __SYSREG(0xd4003098, u16) /* timer 8 base register */
193#define TM9BR __SYSREG(0xd400309a, u16) /* timer 9 base register */
194#define TM10BR __SYSREG(0xd400309c, u16) /* timer 10 base register */
195#define TM11BR __SYSREG(0xd400309e, u16) /* timer 11 base register */
196#define TM45BR __SYSREG(0xd4003090, u32) /* timer 4:5 base register */
197
198#define TM4BC __SYSREG(0xd40030a0, u16) /* timer 4 binary counter */
199#define TM5BC __SYSREG(0xd40030a2, u16) /* timer 5 binary counter */
200#define TM45BC __SYSREG(0xd40030a0, u32) /* timer 4:5 binary counter */
201
202#define TM7BC __SYSREG(0xd40030a6, u16) /* timer 7 binary counter */
203#define TM8BC __SYSREG(0xd40030a8, u16) /* timer 8 binary counter */
204#define TM9BC __SYSREG(0xd40030aa, u16) /* timer 9 binary counter */
205#define TM10BC __SYSREG(0xd40030ac, u16) /* timer 10 binary counter */
206#define TM11BC __SYSREG(0xd40030ae, u16) /* timer 11 binary counter */
207
208#define TM4IRQ 6 /* timer 4 IRQ */
209#define TM5IRQ 7 /* timer 5 IRQ */
210#define TM7IRQ 11 /* timer 7 IRQ */
211#define TM8IRQ 12 /* timer 8 IRQ */
212#define TM9IRQ 13 /* timer 9 IRQ */
213#define TM10IRQ 14 /* timer 10 IRQ */
214#define TM11IRQ 15 /* timer 11 IRQ */
215
216#define TM4ICR GxICR(TM4IRQ) /* timer 4 uflow intr ctrl reg */
217#define TM5ICR GxICR(TM5IRQ) /* timer 5 uflow intr ctrl reg */
218#define TM7ICR GxICR(TM7IRQ) /* timer 7 uflow intr ctrl reg */
219#define TM8ICR GxICR(TM8IRQ) /* timer 8 uflow intr ctrl reg */
220#define TM9ICR GxICR(TM9IRQ) /* timer 9 uflow intr ctrl reg */
221#define TM10ICR GxICR(TM10IRQ) /* timer 10 uflow intr ctrl reg */
222#define TM11ICR GxICR(TM11IRQ) /* timer 11 uflow intr ctrl reg */
223
224/* 16-bit timer 6 */
225#define TM6MD __SYSREG(0xd4003084, u16) /* timer6 mode register */
226#define TM6MD_SRC 0x0007 /* timer source */
227#define TM6MD_SRC_IOCLK 0x0000 /* - IOCLK */
228#define TM6MD_SRC_IOCLK_8 0x0001 /* - 1/8 IOCLK */
229#define TM6MD_SRC_IOCLK_32 0x0002 /* - 1/32 IOCLK */
230#define TM6MD_SRC_TM0UFLOW 0x0004 /* - timer 0 underflow */
231#define TM6MD_SRC_TM1UFLOW 0x0005 /* - timer 1 underflow */
232#define TM6MD_SRC_TM6IOB_BOTH 0x0006 /* - TM6IOB pin input (both edges) */
233#define TM6MD_SRC_TM6IOB_SINGLE 0x0007 /* - TM6IOB pin input (single edge) */
234#define TM6MD_CLR_ENABLE 0x0010 /* clear count enable */
235#define TM6MD_ONESHOT_ENABLE 0x0040 /* oneshot count */
236#define TM6MD_TRIG_ENABLE 0x0080 /* TM6IOB pin trigger enable */
237#define TM6MD_PWM 0x3800 /* PWM output mode */
238#define TM6MD_PWM_DIS 0x0000 /* - disabled */
239#define TM6MD_PWM_10BIT 0x1000 /* - 10 bits mode */
240#define TM6MD_PWM_11BIT 0x1800 /* - 11 bits mode */
241#define TM6MD_PWM_12BIT 0x3000 /* - 12 bits mode */
242#define TM6MD_PWM_14BIT 0x3800 /* - 14 bits mode */
243#define TM6MD_INIT_COUNTER 0x4000 /* initialize TMnBC to zero */
244#define TM6MD_COUNT_ENABLE 0x8000 /* timer count enable */
245
246#define TM6MDA __SYSREG(0xd40030b4, u8) /* timer6 cmp/cap A mode reg */
247#define TM6MDA_OUT 0x07 /* output select */
248#define TM6MDA_OUT_SETA_RESETB 0x00 /* - set at match A, reset at match B */
249#define TM6MDA_OUT_SETA_RESETOV 0x01 /* - set at match A, reset at overflow */
250#define TM6MDA_OUT_SETA 0x02 /* - set at match A */
251#define TM6MDA_OUT_RESETA 0x03 /* - reset at match A */
252#define TM6MDA_OUT_TOGGLE 0x04 /* - toggle on match A */
253#define TM6MDA_MODE 0xc0 /* compare A register mode */
254#define TM6MDA_MODE_CMP_SINGLE 0x00 /* - compare, single buffer mode */
255#define TM6MDA_MODE_CMP_DOUBLE 0x40 /* - compare, double buffer mode */
256#define TM6MDA_MODE_CAP_S_EDGE 0x80 /* - capture, single edge mode */
257#define TM6MDA_MODE_CAP_D_EDGE 0xc0 /* - capture, double edge mode */
258#define TM6MDA_EDGE 0x20 /* compare A edge select */
259#define TM6MDA_EDGE_FALLING 0x00 /* capture on falling edge */
260#define TM6MDA_EDGE_RISING 0x20 /* capture on rising edge */
261#define TM6MDA_CAPTURE_ENABLE 0x10 /* capture enable */
262
263#define TM6MDB __SYSREG(0xd40030b5, u8) /* timer6 cmp/cap B mode reg */
264#define TM6MDB_OUT 0x07 /* output select */
265#define TM6MDB_OUT_SETB_RESETA 0x00 /* - set at match B, reset at match A */
266#define TM6MDB_OUT_SETB_RESETOV 0x01 /* - set at match B */
267#define TM6MDB_OUT_RESETB 0x03 /* - reset at match B */
268#define TM6MDB_OUT_TOGGLE 0x04 /* - toggle on match B */
269#define TM6MDB_MODE 0xc0 /* compare B register mode */
270#define TM6MDB_MODE_CMP_SINGLE 0x00 /* - compare, single buffer mode */
271#define TM6MDB_MODE_CMP_DOUBLE 0x40 /* - compare, double buffer mode */
272#define TM6MDB_MODE_CAP_S_EDGE 0x80 /* - capture, single edge mode */
273#define TM6MDB_MODE_CAP_D_EDGE 0xc0 /* - capture, double edge mode */
274#define TM6MDB_EDGE 0x20 /* compare B edge select */
275#define TM6MDB_EDGE_FALLING 0x00 /* capture on falling edge */
276#define TM6MDB_EDGE_RISING 0x20 /* capture on rising edge */
277#define TM6MDB_CAPTURE_ENABLE 0x10 /* capture enable */
278
279#define TM6CA __SYSREG(0xd40030c4, u16) /* timer6 cmp/capture reg A */
280#define TM6CB __SYSREG(0xd40030d4, u16) /* timer6 cmp/capture reg B */
281#define TM6BC __SYSREG(0xd40030a4, u16) /* timer6 binary counter */
282
283#define TM6IRQ 6 /* timer 6 IRQ */
284#define TM6AIRQ 9 /* timer 6A IRQ */
285#define TM6BIRQ 10 /* timer 6B IRQ */
286
287#define TM6ICR GxICR(TM6IRQ) /* timer 6 uflow intr ctrl reg */
288#define TM6AICR GxICR(TM6AIRQ) /* timer 6A intr control reg */
289#define TM6BICR GxICR(TM6BIRQ) /* timer 6B intr control reg */
290
291#endif /* __KERNEL__ */
292
293#endif /* _ASM_TIMER_REGS_H */
diff --git a/include/asm-mn10300/timex.h b/include/asm-mn10300/timex.h
deleted file mode 100644
index 3944277dab67..000000000000
--- a/include/asm-mn10300/timex.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/* MN10300 Architecture time management specifications
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_TIMEX_H
12#define _ASM_TIMEX_H
13
14#include <asm/hardirq.h>
15#include <asm/unit/timex.h>
16
17#define TICK_SIZE (tick_nsec / 1000)
18
19#define CLOCK_TICK_RATE 1193180 /* Underlying HZ - this should probably be set
20 * to something appropriate, but what? */
21
22extern cycles_t cacheflush_time;
23
24#ifdef __KERNEL__
25
26static inline cycles_t get_cycles(void)
27{
28 return read_timestamp_counter();
29}
30
31#endif /* __KERNEL__ */
32
33#endif /* _ASM_TIMEX_H */
diff --git a/include/asm-mn10300/tlb.h b/include/asm-mn10300/tlb.h
deleted file mode 100644
index 65d232b96613..000000000000
--- a/include/asm-mn10300/tlb.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/* MN10300 TLB definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_TLB_H
13#define _ASM_TLB_H
14
15#include <asm/tlbflush.h>
16
17extern void check_pgt_cache(void);
18
19/*
20 * we don't need any special per-pte or per-vma handling...
21 */
22#define tlb_start_vma(tlb, vma) do { } while (0)
23#define tlb_end_vma(tlb, vma) do { } while (0)
24#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
25
26/*
27 * .. because we flush the whole mm when it fills up
28 */
29#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
30
31/* for now, just use the generic stuff */
32#include <asm-generic/tlb.h>
33
34#endif /* _ASM_TLB_H */
diff --git a/include/asm-mn10300/tlbflush.h b/include/asm-mn10300/tlbflush.h
deleted file mode 100644
index e0239865abcb..000000000000
--- a/include/asm-mn10300/tlbflush.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/* MN10300 TLB flushing functions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_TLBFLUSH_H
12#define _ASM_TLBFLUSH_H
13
14#include <asm/processor.h>
15
16#define __flush_tlb() \
17do { \
18 int w; \
19 __asm__ __volatile__ \
20 (" mov %1,%0 \n" \
21 " or %2,%0 \n" \
22 " mov %0,%1 \n" \
23 : "=d"(w) \
24 : "m"(MMUCTR), "i"(MMUCTR_IIV|MMUCTR_DIV) \
25 : "memory" \
26 ); \
27} while (0)
28
29#define __flush_tlb_all() __flush_tlb()
30#define __flush_tlb_one(addr) __flush_tlb()
31
32
33/*
34 * TLB flushing:
35 *
36 * - flush_tlb() flushes the current mm struct TLBs
37 * - flush_tlb_all() flushes all processes TLBs
38 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
39 * - flush_tlb_page(vma, vmaddr) flushes one page
40 * - flush_tlb_range(mm, start, end) flushes a range of pages
41 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
42 */
43#define flush_tlb_all() \
44do { \
45 preempt_disable(); \
46 __flush_tlb_all(); \
47 preempt_enable(); \
48} while (0)
49
50#define flush_tlb_mm(mm) \
51do { \
52 preempt_disable(); \
53 __flush_tlb_all(); \
54 preempt_enable(); \
55} while (0)
56
57#define flush_tlb_range(vma, start, end) \
58do { \
59 unsigned long __s __attribute__((unused)) = (start); \
60 unsigned long __e __attribute__((unused)) = (end); \
61 preempt_disable(); \
62 __flush_tlb_all(); \
63 preempt_enable(); \
64} while (0)
65
66
67#define __flush_tlb_global() flush_tlb_all()
68#define flush_tlb() flush_tlb_all()
69#define flush_tlb_kernel_range(start, end) \
70do { \
71 unsigned long __s __attribute__((unused)) = (start); \
72 unsigned long __e __attribute__((unused)) = (end); \
73 flush_tlb_all(); \
74} while (0)
75
76extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr);
77
78#define flush_tlb_pgtables(mm, start, end) do {} while (0)
79
80#endif /* _ASM_TLBFLUSH_H */
diff --git a/include/asm-mn10300/topology.h b/include/asm-mn10300/topology.h
deleted file mode 100644
index 5428f333a02c..000000000000
--- a/include/asm-mn10300/topology.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/topology.h>
diff --git a/include/asm-mn10300/types.h b/include/asm-mn10300/types.h
deleted file mode 100644
index 7b9f01042fd4..000000000000
--- a/include/asm-mn10300/types.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/* MN10300 Basic type definitions
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_TYPES_H
12#define _ASM_TYPES_H
13
14#include <asm-generic/int-ll64.h>
15
16#ifndef __ASSEMBLY__
17
18typedef unsigned short umode_t;
19
20#endif /* __ASSEMBLY__ */
21
22/*
23 * These aren't exported outside the kernel to avoid name space clashes
24 */
25#ifdef __KERNEL__
26
27#define BITS_PER_LONG 32
28
29#ifndef __ASSEMBLY__
30
31/* Dma addresses are 32-bits wide. */
32typedef u32 dma_addr_t;
33
34#endif /* __ASSEMBLY__ */
35
36#endif /* __KERNEL__ */
37
38#endif /* _ASM_TYPES_H */
diff --git a/include/asm-mn10300/uaccess.h b/include/asm-mn10300/uaccess.h
deleted file mode 100644
index 8a3a4dd55763..000000000000
--- a/include/asm-mn10300/uaccess.h
+++ /dev/null
@@ -1,490 +0,0 @@
1/* MN10300 userspace access functions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_UACCESS_H
12#define _ASM_UACCESS_H
13
14/*
15 * User space memory access functions
16 */
17#include <linux/sched.h>
18#include <asm/page.h>
19#include <asm/pgtable.h>
20#include <asm/errno.h>
21
22#define VERIFY_READ 0
23#define VERIFY_WRITE 1
24
25/*
26 * The fs value determines whether argument validity checking should be
27 * performed or not. If get_fs() == USER_DS, checking is performed, with
28 * get_fs() == KERNEL_DS, checking is bypassed.
29 *
30 * For historical reasons, these macros are grossly misnamed.
31 */
32
33#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
34
35#define KERNEL_XDS MAKE_MM_SEG(0xBFFFFFFF)
36#define KERNEL_DS MAKE_MM_SEG(0x9FFFFFFF)
37#define USER_DS MAKE_MM_SEG(TASK_SIZE)
38
39#define get_ds() (KERNEL_DS)
40#define get_fs() (current_thread_info()->addr_limit)
41#define set_fs(x) (current_thread_info()->addr_limit = (x))
42#define __kernel_ds_p() (current_thread_info()->addr_limit.seg == 0x9FFFFFFF)
43
44#define segment_eq(a, b) ((a).seg == (b).seg)
45
46#define __addr_ok(addr) \
47 ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
48
49/*
50 * check that a range of addresses falls within the current address limit
51 */
52static inline int ___range_ok(unsigned long addr, unsigned int size)
53{
54 int flag = 1, tmp;
55
56 asm(" add %3,%1 \n" /* set C-flag if addr + size > 4Gb */
57 " bcs 0f \n"
58 " cmp %4,%1 \n" /* jump if addr+size>limit (error) */
59 " bhi 0f \n"
60 " clr %0 \n" /* mark okay */
61 "0: \n"
62 : "=r"(flag), "=&r"(tmp)
63 : "1"(addr), "ir"(size),
64 "r"(current_thread_info()->addr_limit.seg), "0"(flag)
65 : "cc"
66 );
67
68 return flag;
69}
70
71#define __range_ok(addr, size) ___range_ok((unsigned long)(addr), (u32)(size))
72
73#define access_ok(type, addr, size) (__range_ok((addr), (size)) == 0)
74#define __access_ok(addr, size) (__range_ok((addr), (size)) == 0)
75
76static inline int verify_area(int type, const void *addr, unsigned long size)
77{
78 return access_ok(type, addr, size) ? 0 : -EFAULT;
79}
80
81
82/*
83 * The exception table consists of pairs of addresses: the first is the
84 * address of an instruction that is allowed to fault, and the second is
85 * the address at which the program should continue. No registers are
86 * modified, so it is entirely up to the continuation code to figure out
87 * what to do.
88 *
89 * All the routines below use bits of fixup code that are out of line
90 * with the main instruction path. This means when everything is well,
91 * we don't even have to jump over them. Further, they do not intrude
92 * on our cache or tlb entries.
93 */
94
95struct exception_table_entry
96{
97 unsigned long insn, fixup;
98};
99
100/* Returns 0 if exception not found and fixup otherwise. */
101extern int fixup_exception(struct pt_regs *regs);
102
103#define put_user(x, ptr) __put_user_check((x), (ptr), sizeof(*(ptr)))
104#define get_user(x, ptr) __get_user_check((x), (ptr), sizeof(*(ptr)))
105
106/*
107 * The "__xxx" versions do not do address space checking, useful when
108 * doing multiple accesses to the same area (the user has to do the
109 * checks by hand with "access_ok()")
110 */
111#define __put_user(x, ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
112#define __get_user(x, ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
113
114/*
115 * The "xxx_ret" versions return constant specified in third argument, if
116 * something bad happens. These macros can be optimized for the
117 * case of just returning from the function xxx_ret is used.
118 */
119
120#define put_user_ret(x, ptr, ret) \
121 ({ if (put_user((x), (ptr))) return (ret); })
122#define get_user_ret(x, ptr, ret) \
123 ({ if (get_user((x), (ptr))) return (ret); })
124#define __put_user_ret(x, ptr, ret) \
125 ({ if (__put_user((x), (ptr))) return (ret); })
126#define __get_user_ret(x, ptr, ret) \
127 ({ if (__get_user((x), (ptr))) return (ret); })
128
129struct __large_struct { unsigned long buf[100]; };
130#define __m(x) (*(struct __large_struct *)(x))
131
132#define __get_user_nocheck(x, ptr, size) \
133({ \
134 __typeof(*(ptr)) __gu_val; \
135 unsigned long __gu_addr; \
136 int __gu_err; \
137 __gu_addr = (unsigned long) (ptr); \
138 switch (size) { \
139 case 1: __get_user_asm("bu"); break; \
140 case 2: __get_user_asm("hu"); break; \
141 case 4: __get_user_asm("" ); break; \
142 default: __get_user_unknown(); break; \
143 } \
144 x = (__typeof__(*(ptr))) __gu_val; \
145 __gu_err; \
146})
147
148#define __get_user_check(x, ptr, size) \
149({ \
150 __typeof__(*(ptr)) __gu_val; \
151 unsigned long __gu_addr; \
152 int __gu_err; \
153 __gu_addr = (unsigned long) (ptr); \
154 if (likely(__access_ok(__gu_addr,size))) { \
155 switch (size) { \
156 case 1: __get_user_asm("bu"); break; \
157 case 2: __get_user_asm("hu"); break; \
158 case 4: __get_user_asm("" ); break; \
159 default: __get_user_unknown(); break; \
160 } \
161 } \
162 else { \
163 __gu_err = -EFAULT; \
164 __gu_val = 0; \
165 } \
166 x = (__typeof__(*(ptr))) __gu_val; \
167 __gu_err; \
168})
169
170#define __get_user_asm(INSN) \
171({ \
172 asm volatile( \
173 "1:\n" \
174 " mov"INSN" %2,%1\n" \
175 " mov 0,%0\n" \
176 "2:\n" \
177 " .section .fixup,\"ax\"\n" \
178 "3:\n\t" \
179 " mov %3,%0\n" \
180 " jmp 2b\n" \
181 " .previous\n" \
182 " .section __ex_table,\"a\"\n" \
183 " .balign 4\n" \
184 " .long 1b, 3b\n" \
185 " .previous" \
186 : "=&r" (__gu_err), "=&r" (__gu_val) \
187 : "m" (__m(__gu_addr)), "i" (-EFAULT)); \
188})
189
190extern int __get_user_unknown(void);
191
192#define __put_user_nocheck(x, ptr, size) \
193({ \
194 union { \
195 __typeof__(*(ptr)) val; \
196 u32 bits[2]; \
197 } __pu_val; \
198 unsigned long __pu_addr; \
199 int __pu_err; \
200 __pu_val.val = (x); \
201 __pu_addr = (unsigned long) (ptr); \
202 switch (size) { \
203 case 1: __put_user_asm("bu"); break; \
204 case 2: __put_user_asm("hu"); break; \
205 case 4: __put_user_asm("" ); break; \
206 case 8: __put_user_asm8(); break; \
207 default: __pu_err = __put_user_unknown(); break; \
208 } \
209 __pu_err; \
210})
211
212#define __put_user_check(x, ptr, size) \
213({ \
214 union { \
215 __typeof__(*(ptr)) val; \
216 u32 bits[2]; \
217 } __pu_val; \
218 unsigned long __pu_addr; \
219 int __pu_err; \
220 __pu_val.val = (x); \
221 __pu_addr = (unsigned long) (ptr); \
222 if (likely(__access_ok(__pu_addr, size))) { \
223 switch (size) { \
224 case 1: __put_user_asm("bu"); break; \
225 case 2: __put_user_asm("hu"); break; \
226 case 4: __put_user_asm("" ); break; \
227 case 8: __put_user_asm8(); break; \
228 default: __pu_err = __put_user_unknown(); break; \
229 } \
230 } \
231 else { \
232 __pu_err = -EFAULT; \
233 } \
234 __pu_err; \
235})
236
237#define __put_user_asm(INSN) \
238({ \
239 asm volatile( \
240 "1:\n" \
241 " mov"INSN" %1,%2\n" \
242 " mov 0,%0\n" \
243 "2:\n" \
244 " .section .fixup,\"ax\"\n" \
245 "3:\n" \
246 " mov %3,%0\n" \
247 " jmp 2b\n" \
248 " .previous\n" \
249 " .section __ex_table,\"a\"\n" \
250 " .balign 4\n" \
251 " .long 1b, 3b\n" \
252 " .previous" \
253 : "=&r" (__pu_err) \
254 : "r" (__pu_val.val), "m" (__m(__pu_addr)), \
255 "i" (-EFAULT) \
256 ); \
257})
258
259#define __put_user_asm8() \
260({ \
261 asm volatile( \
262 "1: mov %1,%3 \n" \
263 "2: mov %2,%4 \n" \
264 " mov 0,%0 \n" \
265 "3: \n" \
266 " .section .fixup,\"ax\" \n" \
267 "4: \n" \
268 " mov %5,%0 \n" \
269 " jmp 3b \n" \
270 " .previous \n" \
271 " .section __ex_table,\"a\"\n" \
272 " .balign 4 \n" \
273 " .long 1b, 4b \n" \
274 " .long 2b, 4b \n" \
275 " .previous \n" \
276 : "=&r" (__pu_err) \
277 : "r" (__pu_val.bits[0]), "r" (__pu_val.bits[1]), \
278 "m" (__m(__pu_addr)), "m" (__m(__pu_addr+4)), \
279 "i" (-EFAULT) \
280 ); \
281})
282
283extern int __put_user_unknown(void);
284
285
286/*
287 * Copy To/From Userspace
288 */
289/* Generic arbitrary sized copy. */
290#define __copy_user(to, from, size) \
291do { \
292 if (size) { \
293 void *__to = to; \
294 const void *__from = from; \
295 int w; \
296 asm volatile( \
297 "0: movbu (%0),%3;\n" \
298 "1: movbu %3,(%1);\n" \
299 " inc %0;\n" \
300 " inc %1;\n" \
301 " add -1,%2;\n" \
302 " bne 0b;\n" \
303 "2:\n" \
304 " .section .fixup,\"ax\"\n" \
305 "3: jmp 2b\n" \
306 " .previous\n" \
307 " .section __ex_table,\"a\"\n" \
308 " .balign 4\n" \
309 " .long 0b,3b\n" \
310 " .long 1b,3b\n" \
311 " .previous\n" \
312 : "=a"(__from), "=a"(__to), "=r"(size), "=&r"(w)\
313 : "0"(__from), "1"(__to), "2"(size) \
314 : "memory"); \
315 } \
316} while (0)
317
318#define __copy_user_zeroing(to, from, size) \
319do { \
320 if (size) { \
321 void *__to = to; \
322 const void *__from = from; \
323 int w; \
324 asm volatile( \
325 "0: movbu (%0),%3;\n" \
326 "1: movbu %3,(%1);\n" \
327 " inc %0;\n" \
328 " inc %1;\n" \
329 " add -1,%2;\n" \
330 " bne 0b;\n" \
331 "2:\n" \
332 " .section .fixup,\"ax\"\n" \
333 "3:\n" \
334 " mov %2,%0\n" \
335 " clr %3\n" \
336 "4: movbu %3,(%1);\n" \
337 " inc %1;\n" \
338 " add -1,%2;\n" \
339 " bne 4b;\n" \
340 " mov %0,%2\n" \
341 " jmp 2b\n" \
342 " .previous\n" \
343 " .section __ex_table,\"a\"\n" \
344 " .balign 4\n" \
345 " .long 0b,3b\n" \
346 " .long 1b,3b\n" \
347 " .previous\n" \
348 : "=a"(__from), "=a"(__to), "=r"(size), "=&r"(w)\
349 : "0"(__from), "1"(__to), "2"(size) \
350 : "memory"); \
351 } \
352} while (0)
353
354/* We let the __ versions of copy_from/to_user inline, because they're often
355 * used in fast paths and have only a small space overhead.
356 */
357static inline
358unsigned long __generic_copy_from_user_nocheck(void *to, const void *from,
359 unsigned long n)
360{
361 __copy_user_zeroing(to, from, n);
362 return n;
363}
364
365static inline
366unsigned long __generic_copy_to_user_nocheck(void *to, const void *from,
367 unsigned long n)
368{
369 __copy_user(to, from, n);
370 return n;
371}
372
373
374#if 0
375#error don't use - these macros don't increment to & from pointers
376/* Optimize just a little bit when we know the size of the move. */
377#define __constant_copy_user(to, from, size) \
378do { \
379 asm volatile( \
380 " mov %0,a0;\n" \
381 "0: movbu (%1),d3;\n" \
382 "1: movbu d3,(%2);\n" \
383 " add -1,a0;\n" \
384 " bne 0b;\n" \
385 "2:;" \
386 ".section .fixup,\"ax\"\n" \
387 "3: jmp 2b\n" \
388 ".previous\n" \
389 ".section __ex_table,\"a\"\n" \
390 " .balign 4\n" \
391 " .long 0b,3b\n" \
392 " .long 1b,3b\n" \
393 ".previous" \
394 : \
395 : "d"(size), "d"(to), "d"(from) \
396 : "d3", "a0"); \
397} while (0)
398
399/* Optimize just a little bit when we know the size of the move. */
400#define __constant_copy_user_zeroing(to, from, size) \
401do { \
402 asm volatile( \
403 " mov %0,a0;\n" \
404 "0: movbu (%1),d3;\n" \
405 "1: movbu d3,(%2);\n" \
406 " add -1,a0;\n" \
407 " bne 0b;\n" \
408 "2:;" \
409 ".section .fixup,\"ax\"\n" \
410 "3: jmp 2b\n" \
411 ".previous\n" \
412 ".section __ex_table,\"a\"\n" \
413 " .balign 4\n" \
414 " .long 0b,3b\n" \
415 " .long 1b,3b\n" \
416 ".previous" \
417 : \
418 : "d"(size), "d"(to), "d"(from) \
419 : "d3", "a0"); \
420} while (0)
421
422static inline
423unsigned long __constant_copy_to_user(void *to, const void *from,
424 unsigned long n)
425{
426 if (access_ok(VERIFY_WRITE, to, n))
427 __constant_copy_user(to, from, n);
428 return n;
429}
430
431static inline
432unsigned long __constant_copy_from_user(void *to, const void *from,
433 unsigned long n)
434{
435 if (access_ok(VERIFY_READ, from, n))
436 __constant_copy_user_zeroing(to, from, n);
437 return n;
438}
439
440static inline
441unsigned long __constant_copy_to_user_nocheck(void *to, const void *from,
442 unsigned long n)
443{
444 __constant_copy_user(to, from, n);
445 return n;
446}
447
448static inline
449unsigned long __constant_copy_from_user_nocheck(void *to, const void *from,
450 unsigned long n)
451{
452 __constant_copy_user_zeroing(to, from, n);
453 return n;
454}
455#endif
456
457extern unsigned long __generic_copy_to_user(void __user *, const void *,
458 unsigned long);
459extern unsigned long __generic_copy_from_user(void *, const void __user *,
460 unsigned long);
461
462#define __copy_to_user_inatomic(to, from, n) \
463 __generic_copy_to_user_nocheck((to), (from), (n))
464#define __copy_from_user_inatomic(to, from, n) \
465 __generic_copy_from_user_nocheck((to), (from), (n))
466
467#define __copy_to_user(to, from, n) \
468({ \
469 might_sleep(); \
470 __copy_to_user_inatomic((to), (from), (n)); \
471})
472
473#define __copy_from_user(to, from, n) \
474({ \
475 might_sleep(); \
476 __copy_from_user_inatomic((to), (from), (n)); \
477})
478
479
480#define copy_to_user(to, from, n) __generic_copy_to_user((to), (from), (n))
481#define copy_from_user(to, from, n) __generic_copy_from_user((to), (from), (n))
482
483extern long strncpy_from_user(char *dst, const char __user *src, long count);
484extern long __strncpy_from_user(char *dst, const char __user *src, long count);
485extern long strnlen_user(const char __user *str, long n);
486#define strlen_user(str) strnlen_user(str, ~0UL >> 1)
487extern unsigned long clear_user(void __user *mem, unsigned long len);
488extern unsigned long __clear_user(void __user *mem, unsigned long len);
489
490#endif /* _ASM_UACCESS_H */
diff --git a/include/asm-mn10300/ucontext.h b/include/asm-mn10300/ucontext.h
deleted file mode 100644
index fcab5c1d8e18..000000000000
--- a/include/asm-mn10300/ucontext.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* MN10300 User context
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_UCONTEXT_H
12#define _ASM_UCONTEXT_H
13
14struct ucontext {
15 unsigned long uc_flags;
16 struct ucontext *uc_link;
17 stack_t uc_stack;
18 struct sigcontext uc_mcontext;
19 sigset_t uc_sigmask; /* mask last for extensibility */
20};
21
22#endif /* _ASM_UCONTEXT_H */
diff --git a/include/asm-mn10300/unaligned.h b/include/asm-mn10300/unaligned.h
deleted file mode 100644
index 0df671318ae4..000000000000
--- a/include/asm-mn10300/unaligned.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/* MN10300 Unaligned memory access handling
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_MN10300_UNALIGNED_H
12#define _ASM_MN10300_UNALIGNED_H
13
14#include <linux/unaligned/access_ok.h>
15#include <linux/unaligned/generic.h>
16
17#define get_unaligned __get_unaligned_le
18#define put_unaligned __put_unaligned_le
19
20#endif /* _ASM_MN10300_UNALIGNED_H */
diff --git a/include/asm-mn10300/unistd.h b/include/asm-mn10300/unistd.h
deleted file mode 100644
index 543a4f98695d..000000000000
--- a/include/asm-mn10300/unistd.h
+++ /dev/null
@@ -1,390 +0,0 @@
1/* MN10300 System call number list
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_UNISTD_H
12#define _ASM_UNISTD_H
13
14#define __NR_restart_syscall 0
15#define __NR_exit 1
16#define __NR_fork 2
17#define __NR_read 3
18#define __NR_write 4
19#define __NR_open 5
20#define __NR_close 6
21#define __NR_waitpid 7
22#define __NR_creat 8
23#define __NR_link 9
24#define __NR_unlink 10
25#define __NR_execve 11
26#define __NR_chdir 12
27#define __NR_time 13
28#define __NR_mknod 14
29#define __NR_chmod 15
30#define __NR_lchown 16
31#define __NR_break 17
32#define __NR_oldstat 18
33#define __NR_lseek 19
34#define __NR_getpid 20
35#define __NR_mount 21
36#define __NR_umount 22
37#define __NR_setuid 23
38#define __NR_getuid 24
39#define __NR_stime 25
40#define __NR_ptrace 26
41#define __NR_alarm 27
42#define __NR_oldfstat 28
43#define __NR_pause 29
44#define __NR_utime 30
45#define __NR_stty 31
46#define __NR_gtty 32
47#define __NR_access 33
48#define __NR_nice 34
49#define __NR_ftime 35
50#define __NR_sync 36
51#define __NR_kill 37
52#define __NR_rename 38
53#define __NR_mkdir 39
54#define __NR_rmdir 40
55#define __NR_dup 41
56#define __NR_pipe 42
57#define __NR_times 43
58#define __NR_prof 44
59#define __NR_brk 45
60#define __NR_setgid 46
61#define __NR_getgid 47
62#define __NR_signal 48
63#define __NR_geteuid 49
64#define __NR_getegid 50
65#define __NR_acct 51
66#define __NR_umount2 52
67#define __NR_lock 53
68#define __NR_ioctl 54
69#define __NR_fcntl 55
70#define __NR_mpx 56
71#define __NR_setpgid 57
72#define __NR_ulimit 58
73#define __NR_oldolduname 59
74#define __NR_umask 60
75#define __NR_chroot 61
76#define __NR_ustat 62
77#define __NR_dup2 63
78#define __NR_getppid 64
79#define __NR_getpgrp 65
80#define __NR_setsid 66
81#define __NR_sigaction 67
82#define __NR_sgetmask 68
83#define __NR_ssetmask 69
84#define __NR_setreuid 70
85#define __NR_setregid 71
86#define __NR_sigsuspend 72
87#define __NR_sigpending 73
88#define __NR_sethostname 74
89#define __NR_setrlimit 75
90#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
91#define __NR_getrusage 77
92#define __NR_gettimeofday 78
93#define __NR_settimeofday 79
94#define __NR_getgroups 80
95#define __NR_setgroups 81
96#define __NR_select 82
97#define __NR_symlink 83
98#define __NR_oldlstat 84
99#define __NR_readlink 85
100#define __NR_uselib 86
101#define __NR_swapon 87
102#define __NR_reboot 88
103#define __NR_readdir 89
104#define __NR_mmap 90
105#define __NR_munmap 91
106#define __NR_truncate 92
107#define __NR_ftruncate 93
108#define __NR_fchmod 94
109#define __NR_fchown 95
110#define __NR_getpriority 96
111#define __NR_setpriority 97
112#define __NR_profil 98
113#define __NR_statfs 99
114#define __NR_fstatfs 100
115#define __NR_ioperm 101
116#define __NR_socketcall 102
117#define __NR_syslog 103
118#define __NR_setitimer 104
119#define __NR_getitimer 105
120#define __NR_stat 106
121#define __NR_lstat 107
122#define __NR_fstat 108
123#define __NR_olduname 109
124#define __NR_iopl 110
125#define __NR_vhangup 111
126#define __NR_idle 112
127#define __NR_vm86old 113
128#define __NR_wait4 114
129#define __NR_swapoff 115
130#define __NR_sysinfo 116
131#define __NR_ipc 117
132#define __NR_fsync 118
133#define __NR_sigreturn 119
134#define __NR_clone 120
135#define __NR_setdomainname 121
136#define __NR_uname 122
137#define __NR_modify_ldt 123
138#define __NR_adjtimex 124
139#define __NR_mprotect 125
140#define __NR_sigprocmask 126
141#define __NR_create_module 127
142#define __NR_init_module 128
143#define __NR_delete_module 129
144#define __NR_get_kernel_syms 130
145#define __NR_quotactl 131
146#define __NR_getpgid 132
147#define __NR_fchdir 133
148#define __NR_bdflush 134
149#define __NR_sysfs 135
150#define __NR_personality 136
151#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
152#define __NR_setfsuid 138
153#define __NR_setfsgid 139
154#define __NR__llseek 140
155#define __NR_getdents 141
156#define __NR__newselect 142
157#define __NR_flock 143
158#define __NR_msync 144
159#define __NR_readv 145
160#define __NR_writev 146
161#define __NR_getsid 147
162#define __NR_fdatasync 148
163#define __NR__sysctl 149
164#define __NR_mlock 150
165#define __NR_munlock 151
166#define __NR_mlockall 152
167#define __NR_munlockall 153
168#define __NR_sched_setparam 154
169#define __NR_sched_getparam 155
170#define __NR_sched_setscheduler 156
171#define __NR_sched_getscheduler 157
172#define __NR_sched_yield 158
173#define __NR_sched_get_priority_max 159
174#define __NR_sched_get_priority_min 160
175#define __NR_sched_rr_get_interval 161
176#define __NR_nanosleep 162
177#define __NR_mremap 163
178#define __NR_setresuid 164
179#define __NR_getresuid 165
180#define __NR_vm86 166
181#define __NR_query_module 167
182#define __NR_poll 168
183#define __NR_nfsservctl 169
184#define __NR_setresgid 170
185#define __NR_getresgid 171
186#define __NR_prctl 172
187#define __NR_rt_sigreturn 173
188#define __NR_rt_sigaction 174
189#define __NR_rt_sigprocmask 175
190#define __NR_rt_sigpending 176
191#define __NR_rt_sigtimedwait 177
192#define __NR_rt_sigqueueinfo 178
193#define __NR_rt_sigsuspend 179
194#define __NR_pread64 180
195#define __NR_pwrite64 181
196#define __NR_chown 182
197#define __NR_getcwd 183
198#define __NR_capget 184
199#define __NR_capset 185
200#define __NR_sigaltstack 186
201#define __NR_sendfile 187
202#define __NR_getpmsg 188 /* some people actually want streams */
203#define __NR_putpmsg 189 /* some people actually want streams */
204#define __NR_vfork 190
205#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
206#define __NR_mmap2 192
207#define __NR_truncate64 193
208#define __NR_ftruncate64 194
209#define __NR_stat64 195
210#define __NR_lstat64 196
211#define __NR_fstat64 197
212#define __NR_lchown32 198
213#define __NR_getuid32 199
214#define __NR_getgid32 200
215#define __NR_geteuid32 201
216#define __NR_getegid32 202
217#define __NR_setreuid32 203
218#define __NR_setregid32 204
219#define __NR_getgroups32 205
220#define __NR_setgroups32 206
221#define __NR_fchown32 207
222#define __NR_setresuid32 208
223#define __NR_getresuid32 209
224#define __NR_setresgid32 210
225#define __NR_getresgid32 211
226#define __NR_chown32 212
227#define __NR_setuid32 213
228#define __NR_setgid32 214
229#define __NR_setfsuid32 215
230#define __NR_setfsgid32 216
231#define __NR_pivot_root 217
232#define __NR_mincore 218
233#define __NR_madvise 219
234#define __NR_madvise1 219 /* delete when C lib stub is removed */
235#define __NR_getdents64 220
236#define __NR_fcntl64 221
237/* 223 is unused */
238#define __NR_gettid 224
239#define __NR_readahead 225
240#define __NR_setxattr 226
241#define __NR_lsetxattr 227
242#define __NR_fsetxattr 228
243#define __NR_getxattr 229
244#define __NR_lgetxattr 230
245#define __NR_fgetxattr 231
246#define __NR_listxattr 232
247#define __NR_llistxattr 233
248#define __NR_flistxattr 234
249#define __NR_removexattr 235
250#define __NR_lremovexattr 236
251#define __NR_fremovexattr 237
252#define __NR_tkill 238
253#define __NR_sendfile64 239
254#define __NR_futex 240
255#define __NR_sched_setaffinity 241
256#define __NR_sched_getaffinity 242
257#define __NR_set_thread_area 243
258#define __NR_get_thread_area 244
259#define __NR_io_setup 245
260#define __NR_io_destroy 246
261#define __NR_io_getevents 247
262#define __NR_io_submit 248
263#define __NR_io_cancel 249
264#define __NR_fadvise64 250
265
266#define __NR_exit_group 252
267#define __NR_lookup_dcookie 253
268#define __NR_epoll_create 254
269#define __NR_epoll_ctl 255
270#define __NR_epoll_wait 256
271#define __NR_remap_file_pages 257
272#define __NR_set_tid_address 258
273#define __NR_timer_create 259
274#define __NR_timer_settime (__NR_timer_create+1)
275#define __NR_timer_gettime (__NR_timer_create+2)
276#define __NR_timer_getoverrun (__NR_timer_create+3)
277#define __NR_timer_delete (__NR_timer_create+4)
278#define __NR_clock_settime (__NR_timer_create+5)
279#define __NR_clock_gettime (__NR_timer_create+6)
280#define __NR_clock_getres (__NR_timer_create+7)
281#define __NR_clock_nanosleep (__NR_timer_create+8)
282#define __NR_statfs64 268
283#define __NR_fstatfs64 269
284#define __NR_tgkill 270
285#define __NR_utimes 271
286#define __NR_fadvise64_64 272
287#define __NR_vserver 273
288#define __NR_mbind 274
289#define __NR_get_mempolicy 275
290#define __NR_set_mempolicy 276
291#define __NR_mq_open 277
292#define __NR_mq_unlink (__NR_mq_open+1)
293#define __NR_mq_timedsend (__NR_mq_open+2)
294#define __NR_mq_timedreceive (__NR_mq_open+3)
295#define __NR_mq_notify (__NR_mq_open+4)
296#define __NR_mq_getsetattr (__NR_mq_open+5)
297#define __NR_kexec_load 283
298#define __NR_waitid 284
299#define __NR_add_key 286
300#define __NR_request_key 287
301#define __NR_keyctl 288
302#define __NR_cacheflush 289
303#define __NR_ioprio_set 290
304#define __NR_ioprio_get 291
305#define __NR_inotify_init 292
306#define __NR_inotify_add_watch 293
307#define __NR_inotify_rm_watch 294
308#define __NR_migrate_pages 295
309#define __NR_openat 296
310#define __NR_mkdirat 297
311#define __NR_mknodat 298
312#define __NR_fchownat 299
313#define __NR_futimesat 300
314#define __NR_fstatat64 301
315#define __NR_unlinkat 302
316#define __NR_renameat 303
317#define __NR_linkat 304
318#define __NR_symlinkat 305
319#define __NR_readlinkat 306
320#define __NR_fchmodat 307
321#define __NR_faccessat 308
322#define __NR_pselect6 309
323#define __NR_ppoll 310
324#define __NR_unshare 311
325#define __NR_set_robust_list 312
326#define __NR_get_robust_list 313
327#define __NR_splice 314
328#define __NR_sync_file_range 315
329#define __NR_tee 316
330#define __NR_vmsplice 317
331#define __NR_move_pages 318
332#define __NR_getcpu 319
333#define __NR_epoll_pwait 320
334#define __NR_utimensat 321
335#define __NR_signalfd 322
336#define __NR_timerfd_create 323
337#define __NR_eventfd 324
338#define __NR_fallocate 325
339#define __NR_timerfd_settime 326
340#define __NR_timerfd_gettime 327
341#define __NR_signalfd4 328
342#define __NR_eventfd2 329
343#define __NR_epoll_create1 330
344#define __NR_dup3 331
345#define __NR_pipe2 332
346#define __NR_inotify_init1 333
347
348#ifdef __KERNEL__
349
350#define NR_syscalls 326
351
352/*
353 * specify the deprecated syscalls we want to support on this arch
354 */
355#define __ARCH_WANT_IPC_PARSE_VERSION
356#define __ARCH_WANT_OLD_READDIR
357#define __ARCH_WANT_OLD_STAT
358#define __ARCH_WANT_STAT64
359#define __ARCH_WANT_SYS_ALARM
360#define __ARCH_WANT_SYS_GETHOSTNAME
361#define __ARCH_WANT_SYS_PAUSE
362#define __ARCH_WANT_SYS_SGETMASK
363#define __ARCH_WANT_SYS_SIGNAL
364#define __ARCH_WANT_SYS_TIME
365#define __ARCH_WANT_SYS_UTIME
366#define __ARCH_WANT_SYS_WAITPID
367#define __ARCH_WANT_SYS_SOCKETCALL
368#define __ARCH_WANT_SYS_FADVISE64
369#define __ARCH_WANT_SYS_GETPGRP
370#define __ARCH_WANT_SYS_LLSEEK
371#define __ARCH_WANT_SYS_NICE
372#define __ARCH_WANT_SYS_OLD_GETRLIMIT
373#define __ARCH_WANT_SYS_OLDUMOUNT
374#define __ARCH_WANT_SYS_SIGPENDING
375#define __ARCH_WANT_SYS_SIGPROCMASK
376#define __ARCH_WANT_SYS_RT_SIGACTION
377#define __ARCH_WANT_SYS_RT_SIGSUSPEND
378
379/*
380 * "Conditional" syscalls
381 *
382 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
383 * but it doesn't work on all toolchains, so we just do it by hand
384 */
385#ifndef cond_syscall
386#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
387#endif
388
389#endif /* __KERNEL__ */
390#endif /* _ASM_UNISTD_H */
diff --git a/include/asm-mn10300/unit-asb2303/clock.h b/include/asm-mn10300/unit-asb2303/clock.h
deleted file mode 100644
index 8b450e920af1..000000000000
--- a/include/asm-mn10300/unit-asb2303/clock.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/* ASB2303-specific clocks
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_UNIT_CLOCK_H
13#define _ASM_UNIT_CLOCK_H
14
15#ifndef __ASSEMBLY__
16
17#ifdef CONFIG_MN10300_RTC
18
19extern unsigned long mn10300_ioclk; /* IOCLK (crystal speed) in HZ */
20extern unsigned long mn10300_iobclk;
21extern unsigned long mn10300_tsc_per_HZ;
22
23#define MN10300_IOCLK ((unsigned long)mn10300_ioclk)
24/* If this processors has a another clock, uncomment the below. */
25/* #define MN10300_IOBCLK ((unsigned long)mn10300_iobclk) */
26
27#else /* !CONFIG_MN10300_RTC */
28
29#define MN10300_IOCLK 33333333UL
30/* #define MN10300_IOBCLK 66666666UL */
31
32#endif /* !CONFIG_MN10300_RTC */
33
34#define MN10300_JCCLK MN10300_IOCLK
35#define MN10300_TSCCLK MN10300_IOCLK
36
37#ifdef CONFIG_MN10300_RTC
38#define MN10300_TSC_PER_HZ ((unsigned long)mn10300_tsc_per_HZ)
39#else /* !CONFIG_MN10300_RTC */
40#define MN10300_TSC_PER_HZ (MN10300_TSCCLK/HZ)
41#endif /* !CONFIG_MN10300_RTC */
42
43#endif /* !__ASSEMBLY__ */
44
45#endif /* _ASM_UNIT_CLOCK_H */
diff --git a/include/asm-mn10300/unit-asb2303/leds.h b/include/asm-mn10300/unit-asb2303/leds.h
deleted file mode 100644
index 3a7543ea7b5c..000000000000
--- a/include/asm-mn10300/unit-asb2303/leds.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/* ASB2303-specific LEDs
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_UNIT_LEDS_H
13#define _ASM_UNIT_LEDS_H
14
15#include <asm/pio-regs.h>
16#include <asm/cpu-regs.h>
17#include <asm/exceptions.h>
18
19#define ASB2303_GPIO0DEF __SYSREG(0xDB000000, u32)
20#define ASB2303_7SEGLEDS __SYSREG(0xDB000008, u32)
21
22/*
23 * use the 7-segment LEDs to indicate states
24 */
25
26/* flip the 7-segment LEDs between "G" and "-" */
27#define mn10300_set_gdbleds(ONOFF) \
28do { \
29 ASB2303_7SEGLEDS = (ONOFF) ? 0x85 : 0x7f; \
30} while (0)
31
32/* indicate double-fault by displaying "d" on the LEDs */
33#define mn10300_set_dbfleds \
34 mov 0x43,d0 ; \
35 movbu d0,(ASB2303_7SEGLEDS)
36
37#ifndef __ASSEMBLY__
38extern void peripheral_leds_display_exception(enum exception_code code);
39extern void peripheral_leds_led_chase(void);
40extern void debug_to_serial(const char *p, int n);
41#endif /* __ASSEMBLY__ */
42
43#endif /* _ASM_UNIT_LEDS_H */
diff --git a/include/asm-mn10300/unit-asb2303/serial.h b/include/asm-mn10300/unit-asb2303/serial.h
deleted file mode 100644
index 0d55cf5896ac..000000000000
--- a/include/asm-mn10300/unit-asb2303/serial.h
+++ /dev/null
@@ -1,136 +0,0 @@
1/* ASB2303-specific 8250 serial ports
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_UNIT_SERIAL_H
13#define _ASM_UNIT_SERIAL_H
14
15#include <asm/cpu-regs.h>
16#include <asm/proc/irq.h>
17#include <linux/serial_reg.h>
18
19#define SERIAL_PORT0_BASE_ADDRESS 0xA6FB0000
20#define SERIAL_PORT1_BASE_ADDRESS 0xA6FC0000
21
22#define SERIAL_IRQ XIRQ0 /* Dual serial (PC16552) (Hi) */
23
24/*
25 * dispose of the /dev/ttyS0 and /dev/ttyS1 serial ports
26 */
27#ifndef CONFIG_GDBSTUB_ON_TTYSx
28
29#define SERIAL_PORT_DFNS \
30 { \
31 .baud_base = BASE_BAUD, \
32 .irq = SERIAL_IRQ, \
33 .flags = STD_COM_FLAGS, \
34 .iomem_base = (u8 *) SERIAL_PORT0_BASE_ADDRESS, \
35 .iomem_reg_shift = 2, \
36 .io_type = SERIAL_IO_MEM, \
37 }, \
38 { \
39 .baud_base = BASE_BAUD, \
40 .irq = SERIAL_IRQ, \
41 .flags = STD_COM_FLAGS, \
42 .iomem_base = (u8 *) SERIAL_PORT1_BASE_ADDRESS, \
43 .iomem_reg_shift = 2, \
44 .io_type = SERIAL_IO_MEM, \
45 },
46
47#ifndef __ASSEMBLY__
48
49static inline void __debug_to_serial(const char *p, int n)
50{
51}
52
53#endif /* !__ASSEMBLY__ */
54
55#else /* CONFIG_GDBSTUB_ON_TTYSx */
56
57#define SERIAL_PORT_DFNS /* both stolen by gdb-stub because they share an IRQ */
58
59#if defined(CONFIG_GDBSTUB_ON_TTYS0)
60#define GDBPORT_SERIAL_RX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_RX * 4, u8)
61#define GDBPORT_SERIAL_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 4, u8)
62#define GDBPORT_SERIAL_DLL __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLL * 4, u8)
63#define GDBPORT_SERIAL_DLM __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLM * 4, u8)
64#define GDBPORT_SERIAL_IER __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IER * 4, u8)
65#define GDBPORT_SERIAL_IIR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IIR * 4, u8)
66#define GDBPORT_SERIAL_FCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_FCR * 4, u8)
67#define GDBPORT_SERIAL_LCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LCR * 4, u8)
68#define GDBPORT_SERIAL_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 4, u8)
69#define GDBPORT_SERIAL_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 4, u8)
70#define GDBPORT_SERIAL_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 4, u8)
71#define GDBPORT_SERIAL_SCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_SCR * 4, u8)
72#define GDBPORT_SERIAL_IRQ SERIAL_IRQ
73
74#elif defined(CONFIG_GDBSTUB_ON_TTYS1)
75#define GDBPORT_SERIAL_RX __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_RX * 4, u8)
76#define GDBPORT_SERIAL_TX __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_TX * 4, u8)
77#define GDBPORT_SERIAL_DLL __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_DLL * 4, u8)
78#define GDBPORT_SERIAL_DLM __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_DLM * 4, u8)
79#define GDBPORT_SERIAL_IER __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_IER * 4, u8)
80#define GDBPORT_SERIAL_IIR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_IIR * 4, u8)
81#define GDBPORT_SERIAL_FCR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_FCR * 4, u8)
82#define GDBPORT_SERIAL_LCR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_LCR * 4, u8)
83#define GDBPORT_SERIAL_MCR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_MCR * 4, u8)
84#define GDBPORT_SERIAL_LSR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_LSR * 4, u8)
85#define GDBPORT_SERIAL_MSR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_MSR * 4, u8)
86#define GDBPORT_SERIAL_SCR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_SCR * 4, u8)
87#define GDBPORT_SERIAL_IRQ SERIAL_IRQ
88#endif
89
90#ifndef __ASSEMBLY__
91
92#define LSR_WAIT_FOR(STATE) \
93do { \
94 while (!(GDBPORT_SERIAL_LSR & UART_LSR_##STATE)) {} \
95} while (0)
96#define FLOWCTL_WAIT_FOR(LINE) \
97do { \
98 while (!(GDBPORT_SERIAL_MSR & UART_MSR_##LINE)) {} \
99} while (0)
100#define FLOWCTL_CLEAR(LINE) \
101do { \
102 GDBPORT_SERIAL_MCR &= ~UART_MCR_##LINE; \
103} while (0)
104#define FLOWCTL_SET(LINE) \
105do { \
106 GDBPORT_SERIAL_MCR |= UART_MCR_##LINE; \
107} while (0)
108#define FLOWCTL_QUERY(LINE) ({ GDBPORT_SERIAL_MSR & UART_MSR_##LINE; })
109
110static inline void __debug_to_serial(const char *p, int n)
111{
112 char ch;
113
114 FLOWCTL_SET(DTR);
115
116 for (; n > 0; n--) {
117 LSR_WAIT_FOR(THRE);
118 FLOWCTL_WAIT_FOR(CTS);
119
120 ch = *p++;
121 if (ch == 0x0a) {
122 GDBPORT_SERIAL_TX = 0x0d;
123 LSR_WAIT_FOR(THRE);
124 FLOWCTL_WAIT_FOR(CTS);
125 }
126 GDBPORT_SERIAL_TX = ch;
127 }
128
129 FLOWCTL_CLEAR(DTR);
130}
131
132#endif /* !__ASSEMBLY__ */
133
134#endif /* CONFIG_GDBSTUB_ON_TTYSx */
135
136#endif /* _ASM_UNIT_SERIAL_H */
diff --git a/include/asm-mn10300/unit-asb2303/smc91111.h b/include/asm-mn10300/unit-asb2303/smc91111.h
deleted file mode 100644
index dd456e9c513f..000000000000
--- a/include/asm-mn10300/unit-asb2303/smc91111.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/* Support for the SMC91C111 NIC on an ASB2303
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_UNIT_SMC91111_H
12#define _ASM_UNIT_SMC91111_H
13
14#include <asm/intctl-regs.h>
15
16#define SMC91111_BASE 0xAA000300UL
17#define SMC91111_BASE_END 0xAA000400UL
18#define SMC91111_IRQ XIRQ3
19
20#define SMC_CAN_USE_8BIT 0
21#define SMC_CAN_USE_16BIT 1
22#define SMC_CAN_USE_32BIT 0
23#define SMC_NOWAIT 1
24#define SMC_IRQ_FLAGS (0)
25
26#if SMC_CAN_USE_8BIT
27#define SMC_inb(a, r) inb((unsigned long) ((a) + (r)))
28#define SMC_outb(v, a, r) outb(v, (unsigned long) ((a) + (r)))
29#endif
30
31#if SMC_CAN_USE_16BIT
32#define SMC_inw(a, r) inw((unsigned long) ((a) + (r)))
33#define SMC_outw(v, a, r) outw(v, (unsigned long) ((a) + (r)))
34#define SMC_insw(a, r, p, l) insw((unsigned long) ((a) + (r)), (p), (l))
35#define SMC_outsw(a, r, p, l) outsw((unsigned long) ((a) + (r)), (p), (l))
36#endif
37
38#if SMC_CAN_USE_32BIT
39#define SMC_inl(a, r) inl((unsigned long) ((a) + (r)))
40#define SMC_outl(v, a, r) outl(v, (unsigned long) ((a) + (r)))
41#define SMC_insl(a, r, p, l) insl((unsigned long) ((a) + (r)), (p), (l))
42#define SMC_outsl(a, r, p, l) outsl((unsigned long) ((a) + (r)), (p), (l))
43#endif
44
45#define RPC_LSA_DEFAULT RPC_LED_100_10
46#define RPC_LSB_DEFAULT RPC_LED_TX_RX
47
48#define set_irq_type(irq, type)
49
50#endif /* _ASM_UNIT_SMC91111_H */
diff --git a/include/asm-mn10300/unit-asb2303/timex.h b/include/asm-mn10300/unit-asb2303/timex.h
deleted file mode 100644
index 7e54b0cfdd03..000000000000
--- a/include/asm-mn10300/unit-asb2303/timex.h
+++ /dev/null
@@ -1,135 +0,0 @@
1/* ASB2303-specific timer specifcations
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_UNIT_TIMEX_H
12#define _ASM_UNIT_TIMEX_H
13
14#ifndef __ASSEMBLY__
15#include <linux/irq.h>
16#endif /* __ASSEMBLY__ */
17
18#include <asm/timer-regs.h>
19#include <asm/unit/clock.h>
20
21/*
22 * jiffies counter specifications
23 */
24
25#define TMJCBR_MAX 0xffff
26#define TMJCBC TM01BC
27
28#define TMJCMD TM01MD
29#define TMJCBR TM01BR
30#define TMJCIRQ TM1IRQ
31#define TMJCICR TM1ICR
32#define TMJCICR_LEVEL GxICR_LEVEL_5
33
34#ifndef __ASSEMBLY__
35
36static inline void startup_jiffies_counter(void)
37{
38 unsigned rate;
39 u16 md, t16;
40
41 /* use as little prescaling as possible to avoid losing accuracy */
42 md = TM0MD_SRC_IOCLK;
43 rate = MN10300_JCCLK / HZ;
44
45 if (rate > TMJCBR_MAX) {
46 md = TM0MD_SRC_IOCLK_8;
47 rate = MN10300_JCCLK / 8 / HZ;
48
49 if (rate > TMJCBR_MAX) {
50 md = TM0MD_SRC_IOCLK_32;
51 rate = MN10300_JCCLK / 32 / HZ;
52
53 if (rate > TMJCBR_MAX)
54 BUG();
55 }
56 }
57
58 TMJCBR = rate - 1;
59 t16 = TMJCBR;
60
61 TMJCMD =
62 md |
63 TM1MD_SRC_TM0CASCADE << 8 |
64 TM0MD_INIT_COUNTER |
65 TM1MD_INIT_COUNTER << 8;
66
67 TMJCMD =
68 md |
69 TM1MD_SRC_TM0CASCADE << 8 |
70 TM0MD_COUNT_ENABLE |
71 TM1MD_COUNT_ENABLE << 8;
72
73 t16 = TMJCMD;
74
75 TMJCICR |= GxICR_ENABLE | GxICR_DETECT | GxICR_REQUEST;
76 t16 = TMJCICR;
77}
78
79static inline void shutdown_jiffies_counter(void)
80{
81}
82
83#endif /* !__ASSEMBLY__ */
84
85
86/*
87 * timestamp counter specifications
88 */
89
90#define TMTSCBR_MAX 0xffffffff
91#define TMTSCBC TM45BC
92
93#ifndef __ASSEMBLY__
94
95static inline void startup_timestamp_counter(void)
96{
97 /* set up timer 4 & 5 cascaded as a 32-bit counter to count real time
98 * - count down from 4Gig-1 to 0 and wrap at IOCLK rate
99 */
100 TM45BR = TMTSCBR_MAX;
101
102 TM4MD = TM4MD_SRC_IOCLK;
103 TM4MD |= TM4MD_INIT_COUNTER;
104 TM4MD &= ~TM4MD_INIT_COUNTER;
105 TM4ICR = 0;
106
107 TM5MD = TM5MD_SRC_TM4CASCADE;
108 TM5MD |= TM5MD_INIT_COUNTER;
109 TM5MD &= ~TM5MD_INIT_COUNTER;
110 TM5ICR = 0;
111
112 TM5MD |= TM5MD_COUNT_ENABLE;
113 TM4MD |= TM4MD_COUNT_ENABLE;
114}
115
116static inline void shutdown_timestamp_counter(void)
117{
118 TM4MD = 0;
119 TM5MD = 0;
120}
121
122/*
123 * we use a cascaded pair of 16-bit down-counting timers to count I/O
124 * clock cycles for the purposes of time keeping
125 */
126typedef unsigned long cycles_t;
127
128static inline cycles_t read_timestamp_counter(void)
129{
130 return (cycles_t)TMTSCBC;
131}
132
133#endif /* !__ASSEMBLY__ */
134
135#endif /* _ASM_UNIT_TIMEX_H */
diff --git a/include/asm-mn10300/unit-asb2305/clock.h b/include/asm-mn10300/unit-asb2305/clock.h
deleted file mode 100644
index 7d514841ffda..000000000000
--- a/include/asm-mn10300/unit-asb2305/clock.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/* ASB2305-specific clocks
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_UNIT_CLOCK_H
13#define _ASM_UNIT_CLOCK_H
14
15#ifndef __ASSEMBLY__
16
17#ifdef CONFIG_MN10300_RTC
18
19extern unsigned long mn10300_ioclk; /* IOCLK (crystal speed) in HZ */
20extern unsigned long mn10300_iobclk;
21extern unsigned long mn10300_tsc_per_HZ;
22
23#define MN10300_IOCLK ((unsigned long)mn10300_ioclk)
24/* If this processors has a another clock, uncomment the below. */
25/* #define MN10300_IOBCLK ((unsigned long)mn10300_iobclk) */
26
27#else /* !CONFIG_MN10300_RTC */
28
29#define MN10300_IOCLK 33333333UL
30/* #define MN10300_IOBCLK 66666666UL */
31
32#endif /* !CONFIG_MN10300_RTC */
33
34#define MN10300_JCCLK MN10300_IOCLK
35#define MN10300_TSCCLK MN10300_IOCLK
36
37#ifdef CONFIG_MN10300_RTC
38#define MN10300_TSC_PER_HZ ((unsigned long)mn10300_tsc_per_HZ)
39#else /* !CONFIG_MN10300_RTC */
40#define MN10300_TSC_PER_HZ (MN10300_TSCCLK/HZ)
41#endif /* !CONFIG_MN10300_RTC */
42
43#endif /* !__ASSEMBLY__ */
44
45#endif /* _ASM_UNIT_CLOCK_H */
diff --git a/include/asm-mn10300/unit-asb2305/leds.h b/include/asm-mn10300/unit-asb2305/leds.h
deleted file mode 100644
index bc471f617fd1..000000000000
--- a/include/asm-mn10300/unit-asb2305/leds.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/* ASB2305-specific LEDs
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_UNIT_LEDS_H
13#define _ASM_UNIT_LEDS_H
14
15#include <asm/pio-regs.h>
16#include <asm/cpu-regs.h>
17#include <asm/exceptions.h>
18
19#define ASB2305_7SEGLEDS __SYSREG(0xA6F90000, u32)
20
21/* perform a hard reset by driving PIO06 low */
22#define mn10300_unit_hard_reset() \
23do { \
24 P0OUT &= 0xbf; \
25 P0MD = (P0MD & P0MD_6) | P0MD_6_OUT; \
26} while (0)
27
28/*
29 * use the 7-segment LEDs to indicate states
30 */
31/* indicate double-fault by displaying "db-f" on the LEDs */
32#define mn10300_set_dbfleds \
33 mov 0x43077f1d,d0 ; \
34 mov d0,(ASB2305_7SEGLEDS)
35
36/* flip the 7-segment LEDs between "Gdb-" and "----" */
37#define mn10300_set_gdbleds(ONOFF) \
38do { \
39 ASB2305_7SEGLEDS = (ONOFF) ? 0x8543077f : 0x7f7f7f7f; \
40} while (0)
41
42#ifndef __ASSEMBLY__
43extern void peripheral_leds_display_exception(enum exception_code);
44extern void peripheral_leds_led_chase(void);
45extern void peripheral_leds7x4_display_dec(unsigned int, unsigned int);
46extern void peripheral_leds7x4_display_hex(unsigned int, unsigned int);
47extern void peripheral_leds7x4_display_minssecs(unsigned int, unsigned int);
48extern void peripheral_leds7x4_display_rtc(void);
49#endif /* __ASSEMBLY__ */
50
51#endif /* _ASM_UNIT_LEDS_H */
diff --git a/include/asm-mn10300/unit-asb2305/serial.h b/include/asm-mn10300/unit-asb2305/serial.h
deleted file mode 100644
index 73d31d67bb71..000000000000
--- a/include/asm-mn10300/unit-asb2305/serial.h
+++ /dev/null
@@ -1,120 +0,0 @@
1/* ASB2305-specific 8250 serial ports
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_UNIT_SERIAL_H
12#define _ASM_UNIT_SERIAL_H
13
14#include <asm/cpu/cpu-regs.h>
15#include <asm/proc/irq.h>
16#include <linux/serial_reg.h>
17
18#define SERIAL_PORT0_BASE_ADDRESS 0xA6FB0000
19#define ASB2305_DEBUG_MCR __SYSREG(0xA6FB0000 + UART_MCR * 2, u8)
20
21#define SERIAL_IRQ XIRQ0 /* Dual serial (PC16552) (Hi) */
22
23/*
24 * dispose of the /dev/ttyS0 serial port
25 */
26#ifndef CONFIG_GDBSTUB_ON_TTYSx
27
28#define SERIAL_PORT_DFNS \
29 { \
30 .baud_base = BASE_BAUD, \
31 .irq = SERIAL_IRQ, \
32 .flags = STD_COM_FLAGS, \
33 .iomem_base = (u8 *) SERIAL_PORT0_BASE_ADDRESS, \
34 .iomem_reg_shift = 2, \
35 .io_type = SERIAL_IO_MEM, \
36 },
37
38#ifndef __ASSEMBLY__
39
40static inline void __debug_to_serial(const char *p, int n)
41{
42}
43
44#endif /* !__ASSEMBLY__ */
45
46#else /* CONFIG_GDBSTUB_ON_TTYSx */
47
48#define SERIAL_PORT_DFNS /* stolen by gdb-stub */
49
50#if defined(CONFIG_GDBSTUB_ON_TTYS0)
51#define GDBPORT_SERIAL_RX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_RX * 4, u8)
52#define GDBPORT_SERIAL_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 4, u8)
53#define GDBPORT_SERIAL_DLL __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLL * 4, u8)
54#define GDBPORT_SERIAL_DLM __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLM * 4, u8)
55#define GDBPORT_SERIAL_IER __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IER * 4, u8)
56#define GDBPORT_SERIAL_IIR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IIR * 4, u8)
57#define GDBPORT_SERIAL_FCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_FCR * 4, u8)
58#define GDBPORT_SERIAL_LCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LCR * 4, u8)
59#define GDBPORT_SERIAL_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 4, u8)
60#define GDBPORT_SERIAL_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 4, u8)
61#define GDBPORT_SERIAL_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 4, u8)
62#define GDBPORT_SERIAL_SCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_SCR * 4, u8)
63#define GDBPORT_SERIAL_IRQ SERIAL_IRQ
64
65#elif defined(CONFIG_GDBSTUB_ON_TTYS1)
66#error The ASB2305 doesnt have a /dev/ttyS1
67#endif
68
69#ifndef __ASSEMBLY__
70
71#define TTYS0_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 4, u8)
72#define TTYS0_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 4, u8)
73#define TTYS0_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 4, u8)
74#define TTYS0_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 4, u8)
75
76#define LSR_WAIT_FOR(STATE) \
77do { \
78 while (!(TTYS0_LSR & UART_LSR_##STATE)) {} \
79} while (0)
80#define FLOWCTL_WAIT_FOR(LINE) \
81do { \
82 while (!(TTYS0_MSR & UART_MSR_##LINE)) {} \
83} while (0)
84#define FLOWCTL_CLEAR(LINE) \
85do { \
86 TTYS0_MCR &= ~UART_MCR_##LINE; \
87} while (0)
88#define FLOWCTL_SET(LINE) \
89do { \
90 TTYS0_MCR |= UART_MCR_##LINE; \
91} while (0)
92#define FLOWCTL_QUERY(LINE) ({ TTYS0_MSR & UART_MSR_##LINE; })
93
94static inline void __debug_to_serial(const char *p, int n)
95{
96 char ch;
97
98 FLOWCTL_SET(DTR);
99
100 for (; n > 0; n--) {
101 LSR_WAIT_FOR(THRE);
102 FLOWCTL_WAIT_FOR(CTS);
103
104 ch = *p++;
105 if (ch == 0x0a) {
106 TTYS0_TX = 0x0d;
107 LSR_WAIT_FOR(THRE);
108 FLOWCTL_WAIT_FOR(CTS);
109 }
110 TTYS0_TX = ch;
111 }
112
113 FLOWCTL_CLEAR(DTR);
114}
115
116#endif /* !__ASSEMBLY__ */
117
118#endif /* CONFIG_GDBSTUB_ON_TTYSx */
119
120#endif /* _ASM_UNIT_SERIAL_H */
diff --git a/include/asm-mn10300/unit-asb2305/timex.h b/include/asm-mn10300/unit-asb2305/timex.h
deleted file mode 100644
index 10e1bfe34463..000000000000
--- a/include/asm-mn10300/unit-asb2305/timex.h
+++ /dev/null
@@ -1,135 +0,0 @@
1/* ASB2305 timer specifcations
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_UNIT_TIMEX_H
12#define _ASM_UNIT_TIMEX_H
13
14#ifndef __ASSEMBLY__
15#include <linux/irq.h>
16#endif /* __ASSEMBLY__ */
17
18#include <asm/cpu/timer-regs.h>
19#include <asm/unit/clock.h>
20
21/*
22 * jiffies counter specifications
23 */
24
25#define TMJCBR_MAX 0xffff
26#define TMJCBC TM01BC
27
28#define TMJCMD TM01MD
29#define TMJCBR TM01BR
30#define TMJCIRQ TM1IRQ
31#define TMJCICR TM1ICR
32#define TMJCICR_LEVEL GxICR_LEVEL_5
33
34#ifndef __ASSEMBLY__
35
36static inline void startup_jiffies_counter(void)
37{
38 unsigned rate;
39 u16 md, t16;
40
41 /* use as little prescaling as possible to avoid losing accuracy */
42 md = TM0MD_SRC_IOCLK;
43 rate = MN10300_JCCLK / HZ;
44
45 if (rate > TMJCBR_MAX) {
46 md = TM0MD_SRC_IOCLK_8;
47 rate = MN10300_JCCLK / 8 / HZ;
48
49 if (rate > TMJCBR_MAX) {
50 md = TM0MD_SRC_IOCLK_32;
51 rate = MN10300_JCCLK / 32 / HZ;
52
53 if (rate > TMJCBR_MAX)
54 BUG();
55 }
56 }
57
58 TMJCBR = rate - 1;
59 t16 = TMJCBR;
60
61 TMJCMD =
62 md |
63 TM1MD_SRC_TM0CASCADE << 8 |
64 TM0MD_INIT_COUNTER |
65 TM1MD_INIT_COUNTER << 8;
66
67 TMJCMD =
68 md |
69 TM1MD_SRC_TM0CASCADE << 8 |
70 TM0MD_COUNT_ENABLE |
71 TM1MD_COUNT_ENABLE << 8;
72
73 t16 = TMJCMD;
74
75 TMJCICR |= GxICR_ENABLE | GxICR_DETECT | GxICR_REQUEST;
76 t16 = TMJCICR;
77}
78
79static inline void shutdown_jiffies_counter(void)
80{
81}
82
83#endif /* !__ASSEMBLY__ */
84
85
86/*
87 * timestamp counter specifications
88 */
89
90#define TMTSCBR_MAX 0xffffffff
91#define TMTSCBC TM45BC
92
93#ifndef __ASSEMBLY__
94
95static inline void startup_timestamp_counter(void)
96{
97 /* set up timer 4 & 5 cascaded as a 32-bit counter to count real time
98 * - count down from 4Gig-1 to 0 and wrap at IOCLK rate
99 */
100 TM45BR = TMTSCBR_MAX;
101
102 TM4MD = TM4MD_SRC_IOCLK;
103 TM4MD |= TM4MD_INIT_COUNTER;
104 TM4MD &= ~TM4MD_INIT_COUNTER;
105 TM4ICR = 0;
106
107 TM5MD = TM5MD_SRC_TM4CASCADE;
108 TM5MD |= TM5MD_INIT_COUNTER;
109 TM5MD &= ~TM5MD_INIT_COUNTER;
110 TM5ICR = 0;
111
112 TM5MD |= TM5MD_COUNT_ENABLE;
113 TM4MD |= TM4MD_COUNT_ENABLE;
114}
115
116static inline void shutdown_timestamp_counter(void)
117{
118 TM4MD = 0;
119 TM5MD = 0;
120}
121
122/*
123 * we use a cascaded pair of 16-bit down-counting timers to count I/O
124 * clock cycles for the purposes of time keeping
125 */
126typedef unsigned long cycles_t;
127
128static inline cycles_t read_timestamp_counter(void)
129{
130 return (cycles_t) TMTSCBC;
131}
132
133#endif /* !__ASSEMBLY__ */
134
135#endif /* _ASM_UNIT_TIMEX_H */
diff --git a/include/asm-mn10300/user.h b/include/asm-mn10300/user.h
deleted file mode 100644
index e1193908b78c..000000000000
--- a/include/asm-mn10300/user.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/* MN10300 User process data
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_USER_H
12#define _ASM_USER_H
13
14#include <asm/page.h>
15#include <linux/ptrace.h>
16
17#ifndef __ASSEMBLY__
18/*
19 * When the kernel dumps core, it starts by dumping the user struct - this will
20 * be used by gdb to figure out where the data and stack segments are within
21 * the file, and what virtual addresses to use.
22 */
23struct user {
24 /* We start with the registers, to mimic the way that "memory" is
25 * returned from the ptrace(3,...) function.
26 */
27 struct pt_regs regs; /* Where the registers are actually stored */
28
29 /* The rest of this junk is to help gdb figure out what goes where */
30 unsigned long int u_tsize; /* Text segment size (pages). */
31 unsigned long int u_dsize; /* Data segment size (pages). */
32 unsigned long int u_ssize; /* Stack segment size (pages). */
33 unsigned long start_code; /* Starting virtual address of text. */
34 unsigned long start_stack; /* Starting virtual address of stack area.
35 This is actually the bottom of the stack,
36 the top of the stack is always found in the
37 esp register. */
38 long int signal; /* Signal that caused the core dump. */
39 int reserved; /* No longer used */
40 struct user_pt_regs *u_ar0; /* Used by gdb to help find the values for */
41
42 /* the registers */
43 unsigned long magic; /* To uniquely identify a core file */
44 char u_comm[32]; /* User command that was responsible */
45};
46#endif
47
48#define NBPG PAGE_SIZE
49#define UPAGES 1
50#define HOST_TEXT_START_ADDR +(u.start_code)
51#define HOST_STACK_END_ADDR +(u.start_stack + u.u_ssize * NBPG)
52
53#endif /* _ASM_USER_H */
diff --git a/include/asm-mn10300/vga.h b/include/asm-mn10300/vga.h
deleted file mode 100644
index 0163e50a3459..000000000000
--- a/include/asm-mn10300/vga.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/* MN10300 VGA register definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_VGA_H
13#define _ASM_VGA_H
14
15
16
17#endif /* _ASM_VGA_H */
diff --git a/include/asm-mn10300/xor.h b/include/asm-mn10300/xor.h
deleted file mode 100644
index c82eb12a5b18..000000000000
--- a/include/asm-mn10300/xor.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/xor.h>
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 2df74eb09563..9477af01a639 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -472,6 +472,7 @@
472 {0x8086, 0x2562, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 472 {0x8086, 0x2562, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
473 {0x8086, 0x3582, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 473 {0x8086, 0x3582, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
474 {0x8086, 0x2572, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 474 {0x8086, 0x2572, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
475 {0x8086, 0x358e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
475 {0, 0, 0} 476 {0, 0, 0}
476 477
477#define gamma_PCI_IDS \ 478#define gamma_PCI_IDS \
@@ -533,4 +534,5 @@
533 {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 534 {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
534 {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 535 {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
535 {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 536 {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
537 {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
536 {0, 0, 0} 538 {0, 0, 0}
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 67e3353a56d6..95962fa8398a 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -594,6 +594,9 @@ struct drm_i915_gem_busy {
594#define I915_BIT_6_SWIZZLE_9_10_11 4 594#define I915_BIT_6_SWIZZLE_9_10_11 4
595/* Not seen by userland */ 595/* Not seen by userland */
596#define I915_BIT_6_SWIZZLE_UNKNOWN 5 596#define I915_BIT_6_SWIZZLE_UNKNOWN 5
597/* Seen by userland. */
598#define I915_BIT_6_SWIZZLE_9_17 6
599#define I915_BIT_6_SWIZZLE_9_10_17 7
597 600
598struct drm_i915_gem_set_tiling { 601struct drm_i915_gem_set_tiling {
599 /** Handle of the buffer to have its tiling state updated */ 602 /** Handle of the buffer to have its tiling state updated */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 6617c9f8f2ca..cb79b7a208e1 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -29,6 +29,8 @@
29#ifndef __LINUX_ATA_H__ 29#ifndef __LINUX_ATA_H__
30#define __LINUX_ATA_H__ 30#define __LINUX_ATA_H__
31 31
32#include <linux/kernel.h>
33#include <linux/string.h>
32#include <linux/types.h> 34#include <linux/types.h>
33#include <asm/byteorder.h> 35#include <asm/byteorder.h>
34 36
@@ -91,6 +93,7 @@ enum {
91 ATA_ID_CFA_POWER = 160, 93 ATA_ID_CFA_POWER = 160,
92 ATA_ID_CFA_KEY_MGMT = 162, 94 ATA_ID_CFA_KEY_MGMT = 162,
93 ATA_ID_CFA_MODES = 163, 95 ATA_ID_CFA_MODES = 163,
96 ATA_ID_DATA_SET_MGMT = 169,
94 ATA_ID_ROT_SPEED = 217, 97 ATA_ID_ROT_SPEED = 217,
95 ATA_ID_PIO4 = (1 << 1), 98 ATA_ID_PIO4 = (1 << 1),
96 99
@@ -248,6 +251,7 @@ enum {
248 ATA_CMD_SMART = 0xB0, 251 ATA_CMD_SMART = 0xB0,
249 ATA_CMD_MEDIA_LOCK = 0xDE, 252 ATA_CMD_MEDIA_LOCK = 0xDE,
250 ATA_CMD_MEDIA_UNLOCK = 0xDF, 253 ATA_CMD_MEDIA_UNLOCK = 0xDF,
254 ATA_CMD_DSM = 0x06,
251 /* marked obsolete in the ATA/ATAPI-7 spec */ 255 /* marked obsolete in the ATA/ATAPI-7 spec */
252 ATA_CMD_RESTORE = 0x10, 256 ATA_CMD_RESTORE = 0x10,
253 257
@@ -321,6 +325,9 @@ enum {
321 ATA_SMART_READ_VALUES = 0xD0, 325 ATA_SMART_READ_VALUES = 0xD0,
322 ATA_SMART_READ_THRESHOLDS = 0xD1, 326 ATA_SMART_READ_THRESHOLDS = 0xD1,
323 327
328 /* feature values for Data Set Management */
329 ATA_DSM_TRIM = 0x01,
330
324 /* password used in LBA Mid / LBA High for executing SMART commands */ 331 /* password used in LBA Mid / LBA High for executing SMART commands */
325 ATA_SMART_LBAM_PASS = 0x4F, 332 ATA_SMART_LBAM_PASS = 0x4F,
326 ATA_SMART_LBAH_PASS = 0xC2, 333 ATA_SMART_LBAH_PASS = 0xC2,
@@ -723,6 +730,14 @@ static inline int ata_id_has_unload(const u16 *id)
723 return 0; 730 return 0;
724} 731}
725 732
733static inline int ata_id_has_trim(const u16 *id)
734{
735 if (ata_id_major_version(id) >= 7 &&
736 (id[ATA_ID_DATA_SET_MGMT] & 1))
737 return 1;
738 return 0;
739}
740
726static inline int ata_id_current_chs_valid(const u16 *id) 741static inline int ata_id_current_chs_valid(const u16 *id)
727{ 742{
728 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 743 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -863,6 +878,32 @@ static inline void ata_id_to_hd_driveid(u16 *id)
863#endif 878#endif
864} 879}
865 880
881/*
882 * Write up to 'max' LBA Range Entries to the buffer that will cover the
883 * extent from sector to sector + count. This is used for TRIM and for
884 * ADD LBA(S) TO NV CACHE PINNED SET.
885 */
886static inline unsigned ata_set_lba_range_entries(void *_buffer, unsigned max,
887 u64 sector, unsigned long count)
888{
889 __le64 *buffer = _buffer;
890 unsigned i = 0;
891
892 while (i < max) {
893 u64 entry = sector |
894 ((u64)(count > 0xffff ? 0xffff : count) << 48);
895 buffer[i++] = __cpu_to_le64(entry);
896 if (count <= 0xffff)
897 break;
898 count -= 0xffff;
899 sector += 0xffff;
900 }
901
902 max = ALIGN(i * 8, 512);
903 memset(buffer + i, 0, max - i * 8);
904 return max;
905}
906
866static inline int is_multi_taskfile(struct ata_taskfile *tf) 907static inline int is_multi_taskfile(struct ata_taskfile *tf)
867{ 908{
868 return (tf->command == ATA_CMD_READ_MULTI) || 909 return (tf->command == ATA_CMD_READ_MULTI) ||
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index bee52abb8a4d..0ec2c594868e 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -24,8 +24,8 @@ struct dentry;
24 */ 24 */
25enum bdi_state { 25enum bdi_state {
26 BDI_pdflush, /* A pdflush thread is working this device */ 26 BDI_pdflush, /* A pdflush thread is working this device */
27 BDI_write_congested, /* The write queue is getting full */ 27 BDI_async_congested, /* The async (write) queue is getting full */
28 BDI_read_congested, /* The read queue is getting full */ 28 BDI_sync_congested, /* The sync queue is getting full */
29 BDI_unused, /* Available bits start here */ 29 BDI_unused, /* Available bits start here */
30}; 30};
31 31
@@ -215,18 +215,18 @@ static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits)
215 215
216static inline int bdi_read_congested(struct backing_dev_info *bdi) 216static inline int bdi_read_congested(struct backing_dev_info *bdi)
217{ 217{
218 return bdi_congested(bdi, 1 << BDI_read_congested); 218 return bdi_congested(bdi, 1 << BDI_sync_congested);
219} 219}
220 220
221static inline int bdi_write_congested(struct backing_dev_info *bdi) 221static inline int bdi_write_congested(struct backing_dev_info *bdi)
222{ 222{
223 return bdi_congested(bdi, 1 << BDI_write_congested); 223 return bdi_congested(bdi, 1 << BDI_async_congested);
224} 224}
225 225
226static inline int bdi_rw_congested(struct backing_dev_info *bdi) 226static inline int bdi_rw_congested(struct backing_dev_info *bdi)
227{ 227{
228 return bdi_congested(bdi, (1 << BDI_read_congested)| 228 return bdi_congested(bdi, (1 << BDI_sync_congested) |
229 (1 << BDI_write_congested)); 229 (1 << BDI_async_congested));
230} 230}
231 231
232void clear_bdi_congested(struct backing_dev_info *bdi, int rw); 232void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
diff --git a/include/linux/bio.h b/include/linux/bio.h
index b05b1d4d17d2..b900d2c67d29 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -145,20 +145,21 @@ struct bio {
145 * bit 2 -- barrier 145 * bit 2 -- barrier
146 * Insert a serialization point in the IO queue, forcing previously 146 * Insert a serialization point in the IO queue, forcing previously
147 * submitted IO to be completed before this one is issued. 147 * submitted IO to be completed before this one is issued.
148 * bit 3 -- synchronous I/O hint: the block layer will unplug immediately 148 * bit 3 -- synchronous I/O hint.
149 * Note that this does NOT indicate that the IO itself is sync, just 149 * bit 4 -- Unplug the device immediately after submitting this bio.
150 * that the block layer will not postpone issue of this IO by plugging. 150 * bit 5 -- metadata request
151 * bit 4 -- metadata request
152 * Used for tracing to differentiate metadata and data IO. May also 151 * Used for tracing to differentiate metadata and data IO. May also
153 * get some preferential treatment in the IO scheduler 152 * get some preferential treatment in the IO scheduler
154 * bit 5 -- discard sectors 153 * bit 6 -- discard sectors
155 * Informs the lower level device that this range of sectors is no longer 154 * Informs the lower level device that this range of sectors is no longer
156 * used by the file system and may thus be freed by the device. Used 155 * used by the file system and may thus be freed by the device. Used
157 * for flash based storage. 156 * for flash based storage.
158 * bit 6 -- fail fast device errors 157 * bit 7 -- fail fast device errors
159 * bit 7 -- fail fast transport errors 158 * bit 8 -- fail fast transport errors
160 * bit 8 -- fail fast driver errors 159 * bit 9 -- fail fast driver errors
161 * Don't want driver retries for any fast fail whatever the reason. 160 * Don't want driver retries for any fast fail whatever the reason.
161 * bit 10 -- Tell the IO scheduler not to wait for more requests after this
162 one has been submitted, even if it is a SYNC request.
162 */ 163 */
163#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ 164#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */
164#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ 165#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */
@@ -170,6 +171,7 @@ struct bio {
170#define BIO_RW_FAILFAST_DEV 7 171#define BIO_RW_FAILFAST_DEV 7
171#define BIO_RW_FAILFAST_TRANSPORT 8 172#define BIO_RW_FAILFAST_TRANSPORT 8
172#define BIO_RW_FAILFAST_DRIVER 9 173#define BIO_RW_FAILFAST_DRIVER 9
174#define BIO_RW_NOIDLE 10
173 175
174#define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) 176#define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag)))
175 177
@@ -188,6 +190,7 @@ struct bio {
188#define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD) 190#define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD)
189#define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META) 191#define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META)
190#define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD) 192#define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD)
193#define bio_noidle(bio) bio_rw_flagged(bio, BIO_RW_NOIDLE)
191 194
192/* 195/*
193 * upper 16 bits of bi_rw define the io priority of this bio 196 * upper 16 bits of bi_rw define the io priority of this bio
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 465d6babc847..ba54c834a590 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -38,6 +38,10 @@ struct request;
38typedef void (rq_end_io_fn)(struct request *, int); 38typedef void (rq_end_io_fn)(struct request *, int);
39 39
40struct request_list { 40struct request_list {
41 /*
42 * count[], starved[], and wait[] are indexed by
43 * BLK_RW_SYNC/BLK_RW_ASYNC
44 */
41 int count[2]; 45 int count[2];
42 int starved[2]; 46 int starved[2];
43 int elvpriv; 47 int elvpriv;
@@ -66,6 +70,11 @@ enum rq_cmd_type_bits {
66 REQ_TYPE_ATA_PC, 70 REQ_TYPE_ATA_PC,
67}; 71};
68 72
73enum {
74 BLK_RW_ASYNC = 0,
75 BLK_RW_SYNC = 1,
76};
77
69/* 78/*
70 * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being 79 * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being
71 * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a 80 * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a
@@ -103,12 +112,12 @@ enum rq_flag_bits {
103 __REQ_QUIET, /* don't worry about errors */ 112 __REQ_QUIET, /* don't worry about errors */
104 __REQ_PREEMPT, /* set for "ide_preempt" requests */ 113 __REQ_PREEMPT, /* set for "ide_preempt" requests */
105 __REQ_ORDERED_COLOR, /* is before or after barrier */ 114 __REQ_ORDERED_COLOR, /* is before or after barrier */
106 __REQ_RW_SYNC, /* request is sync (O_DIRECT) */ 115 __REQ_RW_SYNC, /* request is sync (sync write or read) */
107 __REQ_ALLOCED, /* request came from our alloc pool */ 116 __REQ_ALLOCED, /* request came from our alloc pool */
108 __REQ_RW_META, /* metadata io request */ 117 __REQ_RW_META, /* metadata io request */
109 __REQ_COPY_USER, /* contains copies of user pages */ 118 __REQ_COPY_USER, /* contains copies of user pages */
110 __REQ_INTEGRITY, /* integrity metadata has been remapped */ 119 __REQ_INTEGRITY, /* integrity metadata has been remapped */
111 __REQ_UNPLUG, /* unplug queue on submission */ 120 __REQ_NOIDLE, /* Don't anticipate more IO after this one */
112 __REQ_NR_BITS, /* stops here */ 121 __REQ_NR_BITS, /* stops here */
113}; 122};
114 123
@@ -135,7 +144,7 @@ enum rq_flag_bits {
135#define REQ_RW_META (1 << __REQ_RW_META) 144#define REQ_RW_META (1 << __REQ_RW_META)
136#define REQ_COPY_USER (1 << __REQ_COPY_USER) 145#define REQ_COPY_USER (1 << __REQ_COPY_USER)
137#define REQ_INTEGRITY (1 << __REQ_INTEGRITY) 146#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
138#define REQ_UNPLUG (1 << __REQ_UNPLUG) 147#define REQ_NOIDLE (1 << __REQ_NOIDLE)
139 148
140#define BLK_MAX_CDB 16 149#define BLK_MAX_CDB 16
141 150
@@ -438,8 +447,8 @@ struct request_queue
438#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ 447#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
439#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 448#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
440#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ 449#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */
441#define QUEUE_FLAG_READFULL 3 /* read queue has been filled */ 450#define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */
442#define QUEUE_FLAG_WRITEFULL 4 /* write queue has been filled */ 451#define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */
443#define QUEUE_FLAG_DEAD 5 /* queue being torn down */ 452#define QUEUE_FLAG_DEAD 5 /* queue being torn down */
444#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ 453#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */
445#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 454#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
@@ -611,32 +620,42 @@ enum {
611#define rq_data_dir(rq) ((rq)->cmd_flags & 1) 620#define rq_data_dir(rq) ((rq)->cmd_flags & 1)
612 621
613/* 622/*
614 * We regard a request as sync, if it's a READ or a SYNC write. 623 * We regard a request as sync, if either a read or a sync write
615 */ 624 */
616#define rq_is_sync(rq) (rq_data_dir((rq)) == READ || (rq)->cmd_flags & REQ_RW_SYNC) 625static inline bool rw_is_sync(unsigned int rw_flags)
626{
627 return !(rw_flags & REQ_RW) || (rw_flags & REQ_RW_SYNC);
628}
629
630static inline bool rq_is_sync(struct request *rq)
631{
632 return rw_is_sync(rq->cmd_flags);
633}
634
617#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META) 635#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
636#define rq_noidle(rq) ((rq)->cmd_flags & REQ_NOIDLE)
618 637
619static inline int blk_queue_full(struct request_queue *q, int rw) 638static inline int blk_queue_full(struct request_queue *q, int sync)
620{ 639{
621 if (rw == READ) 640 if (sync)
622 return test_bit(QUEUE_FLAG_READFULL, &q->queue_flags); 641 return test_bit(QUEUE_FLAG_SYNCFULL, &q->queue_flags);
623 return test_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags); 642 return test_bit(QUEUE_FLAG_ASYNCFULL, &q->queue_flags);
624} 643}
625 644
626static inline void blk_set_queue_full(struct request_queue *q, int rw) 645static inline void blk_set_queue_full(struct request_queue *q, int sync)
627{ 646{
628 if (rw == READ) 647 if (sync)
629 queue_flag_set(QUEUE_FLAG_READFULL, q); 648 queue_flag_set(QUEUE_FLAG_SYNCFULL, q);
630 else 649 else
631 queue_flag_set(QUEUE_FLAG_WRITEFULL, q); 650 queue_flag_set(QUEUE_FLAG_ASYNCFULL, q);
632} 651}
633 652
634static inline void blk_clear_queue_full(struct request_queue *q, int rw) 653static inline void blk_clear_queue_full(struct request_queue *q, int sync)
635{ 654{
636 if (rw == READ) 655 if (sync)
637 queue_flag_clear(QUEUE_FLAG_READFULL, q); 656 queue_flag_clear(QUEUE_FLAG_SYNCFULL, q);
638 else 657 else
639 queue_flag_clear(QUEUE_FLAG_WRITEFULL, q); 658 queue_flag_clear(QUEUE_FLAG_ASYNCFULL, q);
640} 659}
641 660
642 661
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 4864a43b2b45..c3021105edc0 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -377,7 +377,21 @@ struct cpu_vfs_cap_data {
377#define CAP_FOR_EACH_U32(__capi) \ 377#define CAP_FOR_EACH_U32(__capi) \
378 for (__capi = 0; __capi < _KERNEL_CAPABILITY_U32S; ++__capi) 378 for (__capi = 0; __capi < _KERNEL_CAPABILITY_U32S; ++__capi)
379 379
380/*
381 * CAP_FS_MASK and CAP_NFSD_MASKS:
382 *
383 * The fs mask is all the privileges that fsuid==0 historically meant.
384 * At one time in the past, that included CAP_MKNOD and CAP_LINUX_IMMUTABLE.
385 *
386 * It has never meant setting security.* and trusted.* xattrs.
387 *
388 * We could also define fsmask as follows:
389 * 1. CAP_FS_MASK is the privilege to bypass all fs-related DAC permissions
390 * 2. The security.* and trusted.* xattrs are fs-related MAC permissions
391 */
392
380# define CAP_FS_MASK_B0 (CAP_TO_MASK(CAP_CHOWN) \ 393# define CAP_FS_MASK_B0 (CAP_TO_MASK(CAP_CHOWN) \
394 | CAP_TO_MASK(CAP_MKNOD) \
381 | CAP_TO_MASK(CAP_DAC_OVERRIDE) \ 395 | CAP_TO_MASK(CAP_DAC_OVERRIDE) \
382 | CAP_TO_MASK(CAP_DAC_READ_SEARCH) \ 396 | CAP_TO_MASK(CAP_DAC_READ_SEARCH) \
383 | CAP_TO_MASK(CAP_FOWNER) \ 397 | CAP_TO_MASK(CAP_FOWNER) \
@@ -392,11 +406,12 @@ struct cpu_vfs_cap_data {
392# define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }}) 406# define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }})
393# define CAP_FULL_SET ((kernel_cap_t){{ ~0, ~0 }}) 407# define CAP_FULL_SET ((kernel_cap_t){{ ~0, ~0 }})
394# define CAP_INIT_EFF_SET ((kernel_cap_t){{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }}) 408# define CAP_INIT_EFF_SET ((kernel_cap_t){{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }})
395# define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0, CAP_FS_MASK_B1 } }) 409# define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \
410 | CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \
411 CAP_FS_MASK_B1 } })
396# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \ 412# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \
397 | CAP_TO_MASK(CAP_SYS_RESOURCE) \ 413 | CAP_TO_MASK(CAP_SYS_RESOURCE), \
398 | CAP_TO_MASK(CAP_MKNOD), \ 414 CAP_FS_MASK_B1 } })
399 CAP_FS_MASK_B1 } })
400 415
401#endif /* _KERNEL_CAPABILITY_U32S != 2 */ 416#endif /* _KERNEL_CAPABILITY_U32S != 2 */
402 417
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 6faa7e549de4..37bcb50a4d7c 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -76,7 +76,8 @@ struct ftrace_branch_data {
76 * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code 76 * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
77 * to disable branch tracing on a per file basis. 77 * to disable branch tracing on a per file basis.
78 */ 78 */
79#if defined(CONFIG_TRACE_BRANCH_PROFILING) && !defined(DISABLE_BRANCH_PROFILING) 79#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
80 && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
80void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); 81void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
81 82
82#define likely_notrace(x) __builtin_expect(!!(x), 1) 83#define likely_notrace(x) __builtin_expect(!!(x), 1)
@@ -114,7 +115,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
114 * "Define 'is'", Bill Clinton 115 * "Define 'is'", Bill Clinton
115 * "Define 'if'", Steven Rostedt 116 * "Define 'if'", Steven Rostedt
116 */ 117 */
117#define if(cond) if (__builtin_constant_p((cond)) ? !!(cond) : \ 118#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
119#define __trace_if(cond) \
120 if (__builtin_constant_p((cond)) ? !!(cond) : \
118 ({ \ 121 ({ \
119 int ______r; \ 122 int ______r; \
120 static struct ftrace_branch_data \ 123 static struct ftrace_branch_data \
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 096476f1fb35..29b3ce3f2a1d 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -2,12 +2,20 @@
2#define __LINUX_DEBUG_LOCKING_H 2#define __LINUX_DEBUG_LOCKING_H
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <asm/atomic.h>
6#include <asm/system.h>
5 7
6struct task_struct; 8struct task_struct;
7 9
8extern int debug_locks; 10extern int debug_locks;
9extern int debug_locks_silent; 11extern int debug_locks_silent;
10 12
13
14static inline int __debug_locks_off(void)
15{
16 return xchg(&debug_locks, 0);
17}
18
11/* 19/*
12 * Generic 'turn off all lock debugging' function: 20 * Generic 'turn off all lock debugging' function:
13 */ 21 */
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 66ec05a57955..ded2d7c42668 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -116,7 +116,6 @@ void dm_put_device(struct dm_target *ti, struct dm_dev *d);
116/* 116/*
117 * Target features 117 * Target features
118 */ 118 */
119#define DM_TARGET_SUPPORTS_BARRIERS 0x00000001
120 119
121struct target_type { 120struct target_type {
122 uint64_t features; 121 uint64_t features;
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index d7d090d21031..8083b6a36a38 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -115,7 +115,7 @@ static inline u64 dma_get_mask(struct device *dev)
115{ 115{
116 if (dev && dev->dma_mask && *dev->dma_mask) 116 if (dev && dev->dma_mask && *dev->dma_mask)
117 return *dev->dma_mask; 117 return *dev->dma_mask;
118 return DMA_32BIT_MASK; 118 return DMA_BIT_MASK(32);
119} 119}
120 120
121extern u64 dma_get_required_mask(struct device *dev); 121extern u64 dma_get_required_mask(struct device *dev);
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 2f3427468956..e397dc342cda 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -34,6 +34,7 @@ struct dmar_drhd_unit {
34 u64 reg_base_addr; /* register base address*/ 34 u64 reg_base_addr; /* register base address*/
35 struct pci_dev **devices; /* target device array */ 35 struct pci_dev **devices; /* target device array */
36 int devices_cnt; /* target device count */ 36 int devices_cnt; /* target device count */
37 u16 segment; /* PCI domain */
37 u8 ignored:1; /* ignore drhd */ 38 u8 ignored:1; /* ignore drhd */
38 u8 include_all:1; 39 u8 include_all:1;
39 struct intel_iommu *iommu; 40 struct intel_iommu *iommu;
@@ -44,6 +45,14 @@ extern struct list_head dmar_drhd_units;
44#define for_each_drhd_unit(drhd) \ 45#define for_each_drhd_unit(drhd) \
45 list_for_each_entry(drhd, &dmar_drhd_units, list) 46 list_for_each_entry(drhd, &dmar_drhd_units, list)
46 47
48#define for_each_active_iommu(i, drhd) \
49 list_for_each_entry(drhd, &dmar_drhd_units, list) \
50 if (i=drhd->iommu, drhd->ignored) {} else
51
52#define for_each_iommu(i, drhd) \
53 list_for_each_entry(drhd, &dmar_drhd_units, list) \
54 if (i=drhd->iommu, 0) {} else
55
47extern int dmar_table_init(void); 56extern int dmar_table_init(void);
48extern int dmar_dev_scope_init(void); 57extern int dmar_dev_scope_init(void);
49 58
@@ -100,6 +109,8 @@ struct irte {
100#ifdef CONFIG_INTR_REMAP 109#ifdef CONFIG_INTR_REMAP
101extern int intr_remapping_enabled; 110extern int intr_remapping_enabled;
102extern int enable_intr_remapping(int); 111extern int enable_intr_remapping(int);
112extern void disable_intr_remapping(void);
113extern int reenable_intr_remapping(int);
103 114
104extern int get_irte(int irq, struct irte *entry); 115extern int get_irte(int irq, struct irte *entry);
105extern int modify_irte(int irq, struct irte *irte_modified); 116extern int modify_irte(int irq, struct irte *irte_modified);
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 7a204256b155..c59b769f62b0 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -116,6 +116,7 @@ extern void elv_abort_queue(struct request_queue *);
116extern void elv_completed_request(struct request_queue *, struct request *); 116extern void elv_completed_request(struct request_queue *, struct request *);
117extern int elv_set_request(struct request_queue *, struct request *, gfp_t); 117extern int elv_set_request(struct request_queue *, struct request *, gfp_t);
118extern void elv_put_request(struct request_queue *, struct request *); 118extern void elv_put_request(struct request_queue *, struct request *);
119extern void elv_drain_elevator(struct request_queue *);
119 120
120/* 121/*
121 * io scheduler registration 122 * io scheduler registration
diff --git a/include/linux/fb.h b/include/linux/fb.h
index f563c5013932..330c4b1bfcaa 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -173,8 +173,12 @@ struct fb_fix_screeninfo {
173/* Interpretation of offset for color fields: All offsets are from the right, 173/* Interpretation of offset for color fields: All offsets are from the right,
174 * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you 174 * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
175 * can use the offset as right argument to <<). A pixel afterwards is a bit 175 * can use the offset as right argument to <<). A pixel afterwards is a bit
176 * stream and is written to video memory as that unmodified. This implies 176 * stream and is written to video memory as that unmodified.
177 * big-endian byte order if bits_per_pixel is greater than 8. 177 *
178 * For pseudocolor: offset and length should be the same for all color
179 * components. Offset specifies the position of the least significant bit
180 * of the pallette index in a pixel value. Length indicates the number
181 * of available palette entries (i.e. # of entries = 1 << length).
178 */ 182 */
179struct fb_bitfield { 183struct fb_bitfield {
180 __u32 offset; /* beginning of bitfield */ 184 __u32 offset; /* beginning of bitfield */
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 09d6c5bbdddd..a2ec74bc4812 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -5,12 +5,14 @@
5#ifndef __LINUX_FDTABLE_H 5#ifndef __LINUX_FDTABLE_H
6#define __LINUX_FDTABLE_H 6#define __LINUX_FDTABLE_H
7 7
8#include <asm/atomic.h>
9#include <linux/posix_types.h> 8#include <linux/posix_types.h>
10#include <linux/compiler.h> 9#include <linux/compiler.h>
11#include <linux/spinlock.h> 10#include <linux/spinlock.h>
12#include <linux/rcupdate.h> 11#include <linux/rcupdate.h>
13#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/init.h>
14
15#include <asm/atomic.h>
14 16
15/* 17/*
16 * The default fd array needs to be at least BITS_PER_LONG, 18 * The default fd array needs to be at least BITS_PER_LONG,
diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h
index 671decbd2aeb..934e22d65801 100644
--- a/include/linux/fiemap.h
+++ b/include/linux/fiemap.h
@@ -11,6 +11,8 @@
11#ifndef _LINUX_FIEMAP_H 11#ifndef _LINUX_FIEMAP_H
12#define _LINUX_FIEMAP_H 12#define _LINUX_FIEMAP_H
13 13
14#include <linux/types.h>
15
14struct fiemap_extent { 16struct fiemap_extent {
15 __u64 fe_logical; /* logical offset in bytes for the start of 17 __u64 fe_logical; /* logical offset in bytes for the start of
16 * the extent from the beginning of the file */ 18 * the extent from the beginning of the file */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a09e17c8f5fd..562d2855cf30 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -95,8 +95,12 @@ struct inodes_stat_t {
95#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 95#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
96#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 96#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
97#define READ_META (READ | (1 << BIO_RW_META)) 97#define READ_META (READ | (1 << BIO_RW_META))
98#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 98#define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
99#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 99#define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
100#define WRITE_ODIRECT (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
101#define SWRITE_SYNC_PLUG \
102 (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
103#define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
100#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) 104#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
101#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) 105#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
102#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) 106#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
@@ -1695,6 +1699,9 @@ struct file_system_type {
1695 struct lock_class_key i_alloc_sem_key; 1699 struct lock_class_key i_alloc_sem_key;
1696}; 1700};
1697 1701
1702extern int get_sb_ns(struct file_system_type *fs_type, int flags, void *data,
1703 int (*fill_super)(struct super_block *, void *, int),
1704 struct vfsmount *mnt);
1698extern int get_sb_bdev(struct file_system_type *fs_type, 1705extern int get_sb_bdev(struct file_system_type *fs_type,
1699 int flags, const char *dev_name, void *data, 1706 int flags, const char *dev_name, void *data,
1700 int (*fill_super)(struct super_block *, void *, int), 1707 int (*fill_super)(struct super_block *, void *, int),
@@ -2337,19 +2344,7 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf,
2337 size_t size, loff_t *pos); 2344 size_t size, loff_t *pos);
2338int simple_transaction_release(struct inode *inode, struct file *file); 2345int simple_transaction_release(struct inode *inode, struct file *file);
2339 2346
2340static inline void simple_transaction_set(struct file *file, size_t n) 2347void simple_transaction_set(struct file *file, size_t n);
2341{
2342 struct simple_transaction_argresp *ar = file->private_data;
2343
2344 BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
2345
2346 /*
2347 * The barrier ensures that ar->size will really remain zero until
2348 * ar->data is ready for reading.
2349 */
2350 smp_mb();
2351 ar->size = n;
2352}
2353 2348
2354/* 2349/*
2355 * simple attribute files 2350 * simple attribute files
@@ -2396,27 +2391,6 @@ ssize_t simple_attr_read(struct file *file, char __user *buf,
2396ssize_t simple_attr_write(struct file *file, const char __user *buf, 2391ssize_t simple_attr_write(struct file *file, const char __user *buf,
2397 size_t len, loff_t *ppos); 2392 size_t len, loff_t *ppos);
2398 2393
2399
2400#ifdef CONFIG_SECURITY
2401static inline char *alloc_secdata(void)
2402{
2403 return (char *)get_zeroed_page(GFP_KERNEL);
2404}
2405
2406static inline void free_secdata(void *secdata)
2407{
2408 free_page((unsigned long)secdata);
2409}
2410#else
2411static inline char *alloc_secdata(void)
2412{
2413 return (char *)1;
2414}
2415
2416static inline void free_secdata(void *secdata)
2417{ }
2418#endif /* CONFIG_SECURITY */
2419
2420struct ctl_table; 2394struct ctl_table;
2421int proc_nr_files(struct ctl_table *table, int write, struct file *filp, 2395int proc_nr_files(struct ctl_table *table, int write, struct file *filp,
2422 void __user *buffer, size_t *lenp, loff_t *ppos); 2396 void __user *buffer, size_t *lenp, loff_t *ppos);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 43fc95d822d5..244677cc082b 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -79,6 +79,10 @@ struct fsl_spi_platform_data {
79 u16 max_chipselect; 79 u16 max_chipselect;
80 void (*cs_control)(struct spi_device *spi, bool on); 80 void (*cs_control)(struct spi_device *spi, bool on);
81 u32 sysclk; 81 u32 sysclk;
82
83 /* Legacy hooks, used by mpc52xx_psc_spi driver. */
84 void (*activate_cs)(u8 cs, u8 polarity);
85 void (*deactivate_cs)(u8 cs, u8 polarity);
82}; 86};
83 87
84struct mpc8xx_pcmcia_ops { 88struct mpc8xx_pcmcia_ops {
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 015a3d22cf74..8a0c2f221e6b 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -356,6 +356,9 @@ struct ftrace_graph_ret {
356 356
357#ifdef CONFIG_FUNCTION_GRAPH_TRACER 357#ifdef CONFIG_FUNCTION_GRAPH_TRACER
358 358
359/* for init task */
360#define INIT_FTRACE_GRAPH .ret_stack = NULL,
361
359/* 362/*
360 * Stack of return addresses for functions 363 * Stack of return addresses for functions
361 * of a thread. 364 * of a thread.
@@ -430,10 +433,11 @@ static inline void unpause_graph_tracing(void)
430{ 433{
431 atomic_dec(&current->tracing_graph_pause); 434 atomic_dec(&current->tracing_graph_pause);
432} 435}
433#else 436#else /* !CONFIG_FUNCTION_GRAPH_TRACER */
434 437
435#define __notrace_funcgraph 438#define __notrace_funcgraph
436#define __irq_entry 439#define __irq_entry
440#define INIT_FTRACE_GRAPH
437 441
438static inline void ftrace_graph_init_task(struct task_struct *t) { } 442static inline void ftrace_graph_init_task(struct task_struct *t) { }
439static inline void ftrace_graph_exit_task(struct task_struct *t) { } 443static inline void ftrace_graph_exit_task(struct task_struct *t) { }
@@ -445,7 +449,7 @@ static inline int task_curr_ret_stack(struct task_struct *tsk)
445 449
446static inline void pause_graph_tracing(void) { } 450static inline void pause_graph_tracing(void) { }
447static inline void unpause_graph_tracing(void) { } 451static inline void unpause_graph_tracing(void) { }
448#endif 452#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
449 453
450#ifdef CONFIG_TRACING 454#ifdef CONFIG_TRACING
451#include <linux/sched.h> 455#include <linux/sched.h>
@@ -507,33 +511,4 @@ static inline void trace_hw_branch_oops(void) {}
507 511
508#endif /* CONFIG_HW_BRANCH_TRACER */ 512#endif /* CONFIG_HW_BRANCH_TRACER */
509 513
510/*
511 * A syscall entry in the ftrace syscalls array.
512 *
513 * @name: name of the syscall
514 * @nb_args: number of parameters it takes
515 * @types: list of types as strings
516 * @args: list of args as strings (args[i] matches types[i])
517 */
518struct syscall_metadata {
519 const char *name;
520 int nb_args;
521 const char **types;
522 const char **args;
523};
524
525#ifdef CONFIG_FTRACE_SYSCALLS
526extern void arch_init_ftrace_syscalls(void);
527extern struct syscall_metadata *syscall_nr_to_meta(int nr);
528extern void start_ftrace_syscalls(void);
529extern void stop_ftrace_syscalls(void);
530extern void ftrace_syscall_enter(struct pt_regs *regs);
531extern void ftrace_syscall_exit(struct pt_regs *regs);
532#else
533static inline void start_ftrace_syscalls(void) { }
534static inline void stop_ftrace_syscalls(void) { }
535static inline void ftrace_syscall_enter(struct pt_regs *regs) { }
536static inline void ftrace_syscall_exit(struct pt_regs *regs) { }
537#endif
538
539#endif /* _LINUX_FTRACE_H */ 514#endif /* _LINUX_FTRACE_H */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index faa1cf848bcd..45257475623c 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -116,7 +116,7 @@
116# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET 116# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
117#endif 117#endif
118 118
119#ifdef CONFIG_SMP 119#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
120extern void synchronize_irq(unsigned int irq); 120extern void synchronize_irq(unsigned int irq);
121#else 121#else
122# define synchronize_irq(irq) barrier() 122# define synchronize_irq(irq) barrier()
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index bd37078c2d7d..0d2f7c8a33d6 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -336,6 +336,11 @@ extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
336 const enum hrtimer_mode mode); 336 const enum hrtimer_mode mode);
337extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, 337extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
338 unsigned long range_ns, const enum hrtimer_mode mode); 338 unsigned long range_ns, const enum hrtimer_mode mode);
339extern int
340__hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
341 unsigned long delta_ns,
342 const enum hrtimer_mode mode, int wakeup);
343
339extern int hrtimer_cancel(struct hrtimer *timer); 344extern int hrtimer_cancel(struct hrtimer *timer);
340extern int hrtimer_try_to_cancel(struct hrtimer *timer); 345extern int hrtimer_try_to_cancel(struct hrtimer *timer);
341 346
diff --git a/include/linux/i2c-algo-sgi.h b/include/linux/i2c-algo-sgi.h
deleted file mode 100644
index 3b7715024e69..000000000000
--- a/include/linux/i2c-algo-sgi.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License version 2 as published by the Free Software Foundation.
4 *
5 * Copyright (C) 2003 Ladislav Michl <ladis@linux-mips.org>
6 */
7
8#ifndef I2C_ALGO_SGI_H
9#define I2C_ALGO_SGI_H 1
10
11#include <linux/i2c.h>
12
13struct i2c_algo_sgi_data {
14 void *data; /* private data for lowlevel routines */
15 unsigned (*getctrl)(void *data);
16 void (*setctrl)(void *data, unsigned val);
17 unsigned (*rdata)(void *data);
18 void (*wdata)(void *data, unsigned val);
19
20 int xfer_timeout;
21 int ack_timeout;
22};
23
24int i2c_sgi_add_bus(struct i2c_adapter *);
25
26#endif /* I2C_ALGO_SGI_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index f27604af8378..c9087de5c6c6 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -33,47 +33,10 @@
33 33
34#define I2C_DRIVERID_MSP3400 1 34#define I2C_DRIVERID_MSP3400 1
35#define I2C_DRIVERID_TUNER 2 35#define I2C_DRIVERID_TUNER 2
36#define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */
37#define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */
38#define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */
39#define I2C_DRIVERID_SAA7111A 8 /* video input processor */
40#define I2C_DRIVERID_SAA7185B 13 /* video encoder */
41#define I2C_DRIVERID_SAA7110 22 /* video decoder */
42#define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */
43#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ 36#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
44#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ 37#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
45#define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */
46#define I2C_DRIVERID_BT819 40 /* video decoder */
47#define I2C_DRIVERID_BT856 41 /* video encoder */
48#define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */
49#define I2C_DRIVERID_ADV7175 48 /* ADV 7175/7176 video encoder */
50#define I2C_DRIVERID_SAA7114 49 /* video decoder */
51#define I2C_DRIVERID_ADV7170 54 /* video encoder */
52#define I2C_DRIVERID_SAA7191 57 /* video decoder */
53#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */
54#define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */
55#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */
56#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */
57#define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */
58#define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */
59#define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */
60#define I2C_DRIVERID_SAA7127 72 /* saa7127 video encoder */
61#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ 38#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
62#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ 39#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
63#define I2C_DRIVERID_TVP5150 76 /* TVP5150 video decoder */
64#define I2C_DRIVERID_WM8739 77 /* wm8739 audio processor */
65#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */
66#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */
67#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */
68#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */
69#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
70#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
71#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */
72#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */
73#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */
74#define I2C_DRIVERID_AU8522 97 /* Auvitek au8522 */
75
76#define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */
77 40
78/* 41/*
79 * ---- Adapter types ---------------------------------------------------- 42 * ---- Adapter types ----------------------------------------------------
@@ -88,6 +51,7 @@
88#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ 51#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
89#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */ 52#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */
90#define I2C_HW_B_AU0828 0x010023 /* auvitek au0828 usb bridge */ 53#define I2C_HW_B_AU0828 0x010023 /* auvitek au0828 usb bridge */
54#define I2C_HW_B_CX231XX 0x010024 /* Conexant CX231XX USB based cards */
91#define I2C_HW_B_HDPVR 0x010025 /* Hauppauge HD PVR */ 55#define I2C_HW_B_HDPVR 0x010025 /* Hauppauge HD PVR */
92 56
93/* --- SGI adapters */ 57/* --- SGI adapters */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index c86c3b07604c..ad2580596033 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -274,7 +274,7 @@ struct i2c_board_info {
274 * are provided using conventional syntax. 274 * are provided using conventional syntax.
275 */ 275 */
276#define I2C_BOARD_INFO(dev_type, dev_addr) \ 276#define I2C_BOARD_INFO(dev_type, dev_addr) \
277 .type = (dev_type), .addr = (dev_addr) 277 .type = dev_type, .addr = (dev_addr)
278 278
279 279
280/* Add-on boards should register/unregister their devices; e.g. a board 280/* Add-on boards should register/unregister their devices; e.g. a board
@@ -353,8 +353,8 @@ struct i2c_adapter {
353 void *algo_data; 353 void *algo_data;
354 354
355 /* --- administration stuff. */ 355 /* --- administration stuff. */
356 int (*client_register)(struct i2c_client *); 356 int (*client_register)(struct i2c_client *) __deprecated;
357 int (*client_unregister)(struct i2c_client *); 357 int (*client_unregister)(struct i2c_client *) __deprecated;
358 358
359 /* data fields that are valid for all devices */ 359 /* data fields that are valid for all devices */
360 u8 level; /* nesting level for lockdep */ 360 u8 level; /* nesting level for lockdep */
diff --git a/include/linux/i2c/s6000.h b/include/linux/i2c/s6000.h
new file mode 100644
index 000000000000..d9b34bfdae76
--- /dev/null
+++ b/include/linux/i2c/s6000.h
@@ -0,0 +1,10 @@
1#ifndef __LINUX_I2C_S6000_H
2#define __LINUX_I2C_S6000_H
3
4struct s6_i2c_platform_data {
5 const char *clock; /* the clock to use */
6 int bus_num; /* the bus number to register */
7};
8
9#endif
10
diff --git a/include/linux/ide.h b/include/linux/ide.h
index a5d26f66ef78..ff65fffb078f 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -240,65 +240,38 @@ typedef enum {
240} ide_startstop_t; 240} ide_startstop_t;
241 241
242enum { 242enum {
243 IDE_VALID_ERROR = (1 << 1),
244 IDE_VALID_FEATURE = IDE_VALID_ERROR,
245 IDE_VALID_NSECT = (1 << 2),
246 IDE_VALID_LBAL = (1 << 3),
247 IDE_VALID_LBAM = (1 << 4),
248 IDE_VALID_LBAH = (1 << 5),
249 IDE_VALID_DEVICE = (1 << 6),
250 IDE_VALID_LBA = IDE_VALID_LBAL |
251 IDE_VALID_LBAM |
252 IDE_VALID_LBAH,
253 IDE_VALID_OUT_TF = IDE_VALID_FEATURE |
254 IDE_VALID_NSECT |
255 IDE_VALID_LBA,
256 IDE_VALID_IN_TF = IDE_VALID_NSECT |
257 IDE_VALID_LBA,
258 IDE_VALID_OUT_HOB = IDE_VALID_OUT_TF,
259 IDE_VALID_IN_HOB = IDE_VALID_ERROR |
260 IDE_VALID_NSECT |
261 IDE_VALID_LBA,
262};
263
264enum {
243 IDE_TFLAG_LBA48 = (1 << 0), 265 IDE_TFLAG_LBA48 = (1 << 0),
244 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 1), 266 IDE_TFLAG_WRITE = (1 << 1),
245 IDE_TFLAG_OUT_HOB_NSECT = (1 << 2), 267 IDE_TFLAG_CUSTOM_HANDLER = (1 << 2),
246 IDE_TFLAG_OUT_HOB_LBAL = (1 << 3), 268 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 3),
247 IDE_TFLAG_OUT_HOB_LBAM = (1 << 4),
248 IDE_TFLAG_OUT_HOB_LBAH = (1 << 5),
249 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
250 IDE_TFLAG_OUT_HOB_NSECT |
251 IDE_TFLAG_OUT_HOB_LBAL |
252 IDE_TFLAG_OUT_HOB_LBAM |
253 IDE_TFLAG_OUT_HOB_LBAH,
254 IDE_TFLAG_OUT_FEATURE = (1 << 6),
255 IDE_TFLAG_OUT_NSECT = (1 << 7),
256 IDE_TFLAG_OUT_LBAL = (1 << 8),
257 IDE_TFLAG_OUT_LBAM = (1 << 9),
258 IDE_TFLAG_OUT_LBAH = (1 << 10),
259 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
260 IDE_TFLAG_OUT_NSECT |
261 IDE_TFLAG_OUT_LBAL |
262 IDE_TFLAG_OUT_LBAM |
263 IDE_TFLAG_OUT_LBAH,
264 IDE_TFLAG_OUT_DEVICE = (1 << 11),
265 IDE_TFLAG_WRITE = (1 << 12),
266 IDE_TFLAG_CUSTOM_HANDLER = (1 << 13),
267 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 14),
268 IDE_TFLAG_IN_HOB_ERROR = (1 << 15),
269 IDE_TFLAG_IN_HOB_NSECT = (1 << 16),
270 IDE_TFLAG_IN_HOB_LBAL = (1 << 17),
271 IDE_TFLAG_IN_HOB_LBAM = (1 << 18),
272 IDE_TFLAG_IN_HOB_LBAH = (1 << 19),
273 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
274 IDE_TFLAG_IN_HOB_LBAM |
275 IDE_TFLAG_IN_HOB_LBAH,
276 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_ERROR |
277 IDE_TFLAG_IN_HOB_NSECT |
278 IDE_TFLAG_IN_HOB_LBA,
279 IDE_TFLAG_IN_ERROR = (1 << 20),
280 IDE_TFLAG_IN_NSECT = (1 << 21),
281 IDE_TFLAG_IN_LBAL = (1 << 22),
282 IDE_TFLAG_IN_LBAM = (1 << 23),
283 IDE_TFLAG_IN_LBAH = (1 << 24),
284 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
285 IDE_TFLAG_IN_LBAM |
286 IDE_TFLAG_IN_LBAH,
287 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
288 IDE_TFLAG_IN_LBA,
289 IDE_TFLAG_IN_DEVICE = (1 << 25),
290 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
291 IDE_TFLAG_IN_HOB,
292 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
293 IDE_TFLAG_IN_TF,
294 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
295 IDE_TFLAG_IN_DEVICE,
296 /* force 16-bit I/O operations */ 269 /* force 16-bit I/O operations */
297 IDE_TFLAG_IO_16BIT = (1 << 26), 270 IDE_TFLAG_IO_16BIT = (1 << 4),
298 /* struct ide_cmd was allocated using kmalloc() */ 271 /* struct ide_cmd was allocated using kmalloc() */
299 IDE_TFLAG_DYN = (1 << 27), 272 IDE_TFLAG_DYN = (1 << 5),
300 IDE_TFLAG_FS = (1 << 28), 273 IDE_TFLAG_FS = (1 << 6),
301 IDE_TFLAG_MULTI_PIO = (1 << 29), 274 IDE_TFLAG_MULTI_PIO = (1 << 7),
302}; 275};
303 276
304enum { 277enum {
@@ -309,45 +282,34 @@ enum {
309}; 282};
310 283
311struct ide_taskfile { 284struct ide_taskfile {
312 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ 285 u8 data; /* 0: data byte (for TASKFILE ioctl) */
313 /* 1-5: additional data to support LBA48 */ 286 union { /* 1: */
314 union { 287 u8 error; /* read: error */
315 u8 hob_error; /* read: error */ 288 u8 feature; /* write: feature */
316 u8 hob_feature; /* write: feature */
317 };
318
319 u8 hob_nsect;
320 u8 hob_lbal;
321 u8 hob_lbam;
322 u8 hob_lbah;
323
324 u8 data; /* 6: low data byte (for TASKFILE IOCTL) */
325
326 union { /*  7: */
327 u8 error; /* read: error */
328 u8 feature; /* write: feature */
329 }; 289 };
330 290 u8 nsect; /* 2: number of sectors */
331 u8 nsect; /* 8: number of sectors */ 291 u8 lbal; /* 3: LBA low */
332 u8 lbal; /* 9: LBA low */ 292 u8 lbam; /* 4: LBA mid */
333 u8 lbam; /* 10: LBA mid */ 293 u8 lbah; /* 5: LBA high */
334 u8 lbah; /* 11: LBA high */ 294 u8 device; /* 6: device select */
335 295 union { /* 7: */
336 u8 device; /* 12: device select */ 296 u8 status; /* read: status */
337
338 union { /* 13: */
339 u8 status; /*  read: status  */
340 u8 command; /* write: command */ 297 u8 command; /* write: command */
341 }; 298 };
342}; 299};
343 300
344struct ide_cmd { 301struct ide_cmd {
345 union { 302 struct ide_taskfile tf;
346 struct ide_taskfile tf; 303 struct ide_taskfile hob;
347 u8 tf_array[14]; 304 struct {
348 }; 305 struct {
306 u8 tf;
307 u8 hob;
308 } out, in;
309 } valid;
310
311 u8 tf_flags;
349 u8 ftf_flags; /* for TASKFILE ioctl */ 312 u8 ftf_flags; /* for TASKFILE ioctl */
350 u32 tf_flags;
351 int protocol; 313 int protocol;
352 314
353 int sg_nents; /* number of sg entries */ 315 int sg_nents; /* number of sg entries */
@@ -662,8 +624,8 @@ struct ide_tp_ops {
662 void (*write_devctl)(struct hwif_s *, u8); 624 void (*write_devctl)(struct hwif_s *, u8);
663 625
664 void (*dev_select)(ide_drive_t *); 626 void (*dev_select)(ide_drive_t *);
665 void (*tf_load)(ide_drive_t *, struct ide_cmd *); 627 void (*tf_load)(ide_drive_t *, struct ide_taskfile *, u8);
666 void (*tf_read)(ide_drive_t *, struct ide_cmd *); 628 void (*tf_read)(ide_drive_t *, struct ide_taskfile *, u8);
667 629
668 void (*input_data)(ide_drive_t *, struct ide_cmd *, 630 void (*input_data)(ide_drive_t *, struct ide_cmd *,
669 void *, unsigned int); 631 void *, unsigned int);
@@ -1162,7 +1124,8 @@ extern int ide_devset_execute(ide_drive_t *drive,
1162void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8); 1124void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8);
1163int ide_complete_rq(ide_drive_t *, int, unsigned int); 1125int ide_complete_rq(ide_drive_t *, int, unsigned int);
1164 1126
1165void ide_tf_dump(const char *, struct ide_taskfile *); 1127void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd);
1128void ide_tf_dump(const char *, struct ide_cmd *);
1166 1129
1167void ide_exec_command(ide_hwif_t *, u8); 1130void ide_exec_command(ide_hwif_t *, u8);
1168u8 ide_read_status(ide_hwif_t *); 1131u8 ide_read_status(ide_hwif_t *);
@@ -1170,8 +1133,8 @@ u8 ide_read_altstatus(ide_hwif_t *);
1170void ide_write_devctl(ide_hwif_t *, u8); 1133void ide_write_devctl(ide_hwif_t *, u8);
1171 1134
1172void ide_dev_select(ide_drive_t *); 1135void ide_dev_select(ide_drive_t *);
1173void ide_tf_load(ide_drive_t *, struct ide_cmd *); 1136void ide_tf_load(ide_drive_t *, struct ide_taskfile *, u8);
1174void ide_tf_read(ide_drive_t *, struct ide_cmd *); 1137void ide_tf_read(ide_drive_t *, struct ide_taskfile *, u8);
1175 1138
1176void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); 1139void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
1177void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); 1140void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
@@ -1529,7 +1492,7 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1529 1492
1530extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1493extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1531 1494
1532u64 ide_get_lba_addr(struct ide_taskfile *, int); 1495u64 ide_get_lba_addr(struct ide_cmd *, int);
1533u8 ide_dump_status(ide_drive_t *, const char *, u8); 1496u8 ide_dump_status(ide_drive_t *, const char *, u8);
1534 1497
1535struct ide_timing { 1498struct ide_timing {
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index af1de95e711e..d87247d2641f 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -5,6 +5,7 @@
5#include <linux/irqflags.h> 5#include <linux/irqflags.h>
6#include <linux/utsname.h> 6#include <linux/utsname.h>
7#include <linux/lockdep.h> 7#include <linux/lockdep.h>
8#include <linux/ftrace.h>
8#include <linux/ipc.h> 9#include <linux/ipc.h>
9#include <linux/pid_namespace.h> 10#include <linux/pid_namespace.h>
10#include <linux/user_namespace.h> 11#include <linux/user_namespace.h>
@@ -14,19 +15,6 @@
14extern struct files_struct init_files; 15extern struct files_struct init_files;
15extern struct fs_struct init_fs; 16extern struct fs_struct init_fs;
16 17
17#define INIT_KIOCTX(name, which_mm) \
18{ \
19 .users = ATOMIC_INIT(1), \
20 .dead = 0, \
21 .mm = &which_mm, \
22 .user_id = 0, \
23 .next = NULL, \
24 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait), \
25 .ctx_lock = __SPIN_LOCK_UNLOCKED(name.ctx_lock), \
26 .reqs_active = 0U, \
27 .max_reqs = ~0U, \
28}
29
30#define INIT_MM(name) \ 18#define INIT_MM(name) \
31{ \ 19{ \
32 .mm_rb = RB_ROOT, \ 20 .mm_rb = RB_ROOT, \
@@ -185,6 +173,7 @@ extern struct cred init_cred;
185 INIT_IDS \ 173 INIT_IDS \
186 INIT_TRACE_IRQFLAGS \ 174 INIT_TRACE_IRQFLAGS \
187 INIT_LOCKDEP \ 175 INIT_LOCKDEP \
176 INIT_FTRACE_GRAPH \
188} 177}
189 178
190 179
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 77214ead1a36..aa8c53171233 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -164,6 +164,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
164#define DMA_GCMD_QIE (((u32)1) << 26) 164#define DMA_GCMD_QIE (((u32)1) << 26)
165#define DMA_GCMD_SIRTP (((u32)1) << 24) 165#define DMA_GCMD_SIRTP (((u32)1) << 24)
166#define DMA_GCMD_IRE (((u32) 1) << 25) 166#define DMA_GCMD_IRE (((u32) 1) << 25)
167#define DMA_GCMD_CFI (((u32) 1) << 23)
167 168
168/* GSTS_REG */ 169/* GSTS_REG */
169#define DMA_GSTS_TES (((u32)1) << 31) 170#define DMA_GSTS_TES (((u32)1) << 31)
@@ -174,6 +175,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
174#define DMA_GSTS_QIES (((u32)1) << 26) 175#define DMA_GSTS_QIES (((u32)1) << 26)
175#define DMA_GSTS_IRTPS (((u32)1) << 24) 176#define DMA_GSTS_IRTPS (((u32)1) << 24)
176#define DMA_GSTS_IRES (((u32)1) << 25) 177#define DMA_GSTS_IRES (((u32)1) << 25)
178#define DMA_GSTS_CFIS (((u32)1) << 23)
177 179
178/* CCMD_REG */ 180/* CCMD_REG */
179#define DMA_CCMD_ICC (((u64)1) << 63) 181#define DMA_CCMD_ICC (((u64)1) << 63)
@@ -284,6 +286,14 @@ struct iommu_flush {
284 unsigned int size_order, u64 type, int non_present_entry_flush); 286 unsigned int size_order, u64 type, int non_present_entry_flush);
285}; 287};
286 288
289enum {
290 SR_DMAR_FECTL_REG,
291 SR_DMAR_FEDATA_REG,
292 SR_DMAR_FEADDR_REG,
293 SR_DMAR_FEUADDR_REG,
294 MAX_SR_DMAR_REGS
295};
296
287struct intel_iommu { 297struct intel_iommu {
288 void __iomem *reg; /* Pointer to hardware regs, virtual addr */ 298 void __iomem *reg; /* Pointer to hardware regs, virtual addr */
289 u64 cap; 299 u64 cap;
@@ -304,6 +314,8 @@ struct intel_iommu {
304 struct iommu_flush flush; 314 struct iommu_flush flush;
305#endif 315#endif
306 struct q_inval *qi; /* Queued invalidation info */ 316 struct q_inval *qi; /* Queued invalidation info */
317 u32 *iommu_state; /* Store iommu states between suspend and resume.*/
318
307#ifdef CONFIG_INTR_REMAP 319#ifdef CONFIG_INTR_REMAP
308 struct ir_table *ir_table; /* Interrupt remapping info */ 320 struct ir_table *ir_table; /* Interrupt remapping info */
309#endif 321#endif
@@ -322,6 +334,7 @@ extern int alloc_iommu(struct dmar_drhd_unit *drhd);
322extern void free_iommu(struct intel_iommu *iommu); 334extern void free_iommu(struct intel_iommu *iommu);
323extern int dmar_enable_qi(struct intel_iommu *iommu); 335extern int dmar_enable_qi(struct intel_iommu *iommu);
324extern void dmar_disable_qi(struct intel_iommu *iommu); 336extern void dmar_disable_qi(struct intel_iommu *iommu);
337extern int dmar_reenable_qi(struct intel_iommu *iommu);
325extern void qi_global_iec(struct intel_iommu *iommu); 338extern void qi_global_iec(struct intel_iommu *iommu);
326 339
327extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, 340extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid,
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index ce2c07d99fc3..91bb76f44f14 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -59,6 +59,18 @@
59#define IRQF_NOBALANCING 0x00000800 59#define IRQF_NOBALANCING 0x00000800
60#define IRQF_IRQPOLL 0x00001000 60#define IRQF_IRQPOLL 0x00001000
61 61
62/*
63 * Bits used by threaded handlers:
64 * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
65 * IRQTF_DIED - handler thread died
66 * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
67 */
68enum {
69 IRQTF_RUNTHREAD,
70 IRQTF_DIED,
71 IRQTF_WARNED,
72};
73
62typedef irqreturn_t (*irq_handler_t)(int, void *); 74typedef irqreturn_t (*irq_handler_t)(int, void *);
63 75
64/** 76/**
@@ -71,6 +83,9 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
71 * @next: pointer to the next irqaction for shared interrupts 83 * @next: pointer to the next irqaction for shared interrupts
72 * @irq: interrupt number 84 * @irq: interrupt number
73 * @dir: pointer to the proc/irq/NN/name entry 85 * @dir: pointer to the proc/irq/NN/name entry
86 * @thread_fn: interupt handler function for threaded interrupts
87 * @thread: thread pointer for threaded interrupts
88 * @thread_flags: flags related to @thread
74 */ 89 */
75struct irqaction { 90struct irqaction {
76 irq_handler_t handler; 91 irq_handler_t handler;
@@ -81,18 +96,68 @@ struct irqaction {
81 struct irqaction *next; 96 struct irqaction *next;
82 int irq; 97 int irq;
83 struct proc_dir_entry *dir; 98 struct proc_dir_entry *dir;
99 irq_handler_t thread_fn;
100 struct task_struct *thread;
101 unsigned long thread_flags;
84}; 102};
85 103
86extern irqreturn_t no_action(int cpl, void *dev_id); 104extern irqreturn_t no_action(int cpl, void *dev_id);
87extern int __must_check request_irq(unsigned int, irq_handler_t handler, 105
88 unsigned long, const char *, void *); 106#ifdef CONFIG_GENERIC_HARDIRQS
107extern int __must_check
108request_threaded_irq(unsigned int irq, irq_handler_t handler,
109 irq_handler_t thread_fn,
110 unsigned long flags, const char *name, void *dev);
111
112static inline int __must_check
113request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
114 const char *name, void *dev)
115{
116 return request_threaded_irq(irq, handler, NULL, flags, name, dev);
117}
118
119extern void exit_irq_thread(void);
120#else
121
122extern int __must_check
123request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
124 const char *name, void *dev);
125
126/*
127 * Special function to avoid ifdeffery in kernel/irq/devres.c which
128 * gets magically built by GENERIC_HARDIRQS=n architectures (sparc,
129 * m68k). I really love these $@%#!* obvious Makefile references:
130 * ../../../kernel/irq/devres.o
131 */
132static inline int __must_check
133request_threaded_irq(unsigned int irq, irq_handler_t handler,
134 irq_handler_t thread_fn,
135 unsigned long flags, const char *name, void *dev)
136{
137 return request_irq(irq, handler, flags, name, dev);
138}
139
140static inline void exit_irq_thread(void) { }
141#endif
142
89extern void free_irq(unsigned int, void *); 143extern void free_irq(unsigned int, void *);
90 144
91struct device; 145struct device;
92 146
93extern int __must_check devm_request_irq(struct device *dev, unsigned int irq, 147extern int __must_check
94 irq_handler_t handler, unsigned long irqflags, 148devm_request_threaded_irq(struct device *dev, unsigned int irq,
95 const char *devname, void *dev_id); 149 irq_handler_t handler, irq_handler_t thread_fn,
150 unsigned long irqflags, const char *devname,
151 void *dev_id);
152
153static inline int __must_check
154devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler,
155 unsigned long irqflags, const char *devname, void *dev_id)
156{
157 return devm_request_threaded_irq(dev, irq, handler, NULL, irqflags,
158 devname, dev_id);
159}
160
96extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id); 161extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
97 162
98/* 163/*
@@ -299,6 +364,7 @@ extern void softirq_init(void);
299#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) 364#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
300extern void raise_softirq_irqoff(unsigned int nr); 365extern void raise_softirq_irqoff(unsigned int nr);
301extern void raise_softirq(unsigned int nr); 366extern void raise_softirq(unsigned int nr);
367extern void wakeup_softirqd(void);
302 368
303/* This is the worklist that queues up per-cpu softirq work. 369/* This is the worklist that queues up per-cpu softirq work.
304 * 370 *
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index ea330f9e7100..3bf40e246a80 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -25,7 +25,7 @@ struct ipc_ids {
25}; 25};
26 26
27struct ipc_namespace { 27struct ipc_namespace {
28 struct kref kref; 28 atomic_t count;
29 struct ipc_ids ids[3]; 29 struct ipc_ids ids[3];
30 30
31 int sem_ctls[4]; 31 int sem_ctls[4];
@@ -44,25 +44,57 @@ struct ipc_namespace {
44 int shm_tot; 44 int shm_tot;
45 45
46 struct notifier_block ipcns_nb; 46 struct notifier_block ipcns_nb;
47
48 /* The kern_mount of the mqueuefs sb. We take a ref on it */
49 struct vfsmount *mq_mnt;
50
51 /* # queues in this ns, protected by mq_lock */
52 unsigned int mq_queues_count;
53
54 /* next fields are set through sysctl */
55 unsigned int mq_queues_max; /* initialized to DFLT_QUEUESMAX */
56 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */
57 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */
58
47}; 59};
48 60
49extern struct ipc_namespace init_ipc_ns; 61extern struct ipc_namespace init_ipc_ns;
50extern atomic_t nr_ipc_ns; 62extern atomic_t nr_ipc_ns;
51 63
52#ifdef CONFIG_SYSVIPC 64extern spinlock_t mq_lock;
65#if defined(CONFIG_POSIX_MQUEUE) || defined(CONFIG_SYSVIPC)
53#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, 66#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
67#else
68#define INIT_IPC_NS(ns)
69#endif
54 70
71#ifdef CONFIG_SYSVIPC
55extern int register_ipcns_notifier(struct ipc_namespace *); 72extern int register_ipcns_notifier(struct ipc_namespace *);
56extern int cond_register_ipcns_notifier(struct ipc_namespace *); 73extern int cond_register_ipcns_notifier(struct ipc_namespace *);
57extern void unregister_ipcns_notifier(struct ipc_namespace *); 74extern void unregister_ipcns_notifier(struct ipc_namespace *);
58extern int ipcns_notify(unsigned long); 75extern int ipcns_notify(unsigned long);
59
60#else /* CONFIG_SYSVIPC */ 76#else /* CONFIG_SYSVIPC */
61#define INIT_IPC_NS(ns) 77static inline int register_ipcns_notifier(struct ipc_namespace *ns)
78{ return 0; }
79static inline int cond_register_ipcns_notifier(struct ipc_namespace *ns)
80{ return 0; }
81static inline void unregister_ipcns_notifier(struct ipc_namespace *ns) { }
82static inline int ipcns_notify(unsigned long l) { return 0; }
62#endif /* CONFIG_SYSVIPC */ 83#endif /* CONFIG_SYSVIPC */
63 84
64#if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS) 85#ifdef CONFIG_POSIX_MQUEUE
65extern void free_ipc_ns(struct kref *kref); 86extern int mq_init_ns(struct ipc_namespace *ns);
87/* default values */
88#define DFLT_QUEUESMAX 256 /* max number of message queues */
89#define DFLT_MSGMAX 10 /* max number of messages in each queue */
90#define HARD_MSGMAX (131072/sizeof(void *))
91#define DFLT_MSGSIZEMAX 8192 /* max message size */
92#else
93static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
94#endif
95
96#if defined(CONFIG_IPC_NS)
97extern void free_ipc_ns(struct ipc_namespace *ns);
66extern struct ipc_namespace *copy_ipcs(unsigned long flags, 98extern struct ipc_namespace *copy_ipcs(unsigned long flags,
67 struct ipc_namespace *ns); 99 struct ipc_namespace *ns);
68extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids, 100extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
@@ -72,14 +104,11 @@ extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
72static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 104static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
73{ 105{
74 if (ns) 106 if (ns)
75 kref_get(&ns->kref); 107 atomic_inc(&ns->count);
76 return ns; 108 return ns;
77} 109}
78 110
79static inline void put_ipc_ns(struct ipc_namespace *ns) 111extern void put_ipc_ns(struct ipc_namespace *ns);
80{
81 kref_put(&ns->kref, free_ipc_ns);
82}
83#else 112#else
84static inline struct ipc_namespace *copy_ipcs(unsigned long flags, 113static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
85 struct ipc_namespace *ns) 114 struct ipc_namespace *ns)
@@ -99,4 +128,18 @@ static inline void put_ipc_ns(struct ipc_namespace *ns)
99{ 128{
100} 129}
101#endif 130#endif
131
132#ifdef CONFIG_POSIX_MQUEUE_SYSCTL
133
134struct ctl_table_header;
135extern struct ctl_table_header *mq_register_sysctl_table(void);
136
137#else /* CONFIG_POSIX_MQUEUE_SYSCTL */
138
139static inline struct ctl_table_header *mq_register_sysctl_table(void)
140{
141 return NULL;
142}
143
144#endif /* CONFIG_POSIX_MQUEUE_SYSCTL */
102#endif 145#endif
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 974890b3c52f..b7cbeed972e4 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -22,6 +22,7 @@
22#include <linux/irqnr.h> 22#include <linux/irqnr.h>
23#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/topology.h> 24#include <linux/topology.h>
25#include <linux/wait.h>
25 26
26#include <asm/irq.h> 27#include <asm/irq.h>
27#include <asm/ptrace.h> 28#include <asm/ptrace.h>
@@ -158,6 +159,8 @@ struct irq_2_iommu;
158 * @affinity: IRQ affinity on SMP 159 * @affinity: IRQ affinity on SMP
159 * @cpu: cpu index useful for balancing 160 * @cpu: cpu index useful for balancing
160 * @pending_mask: pending rebalanced interrupts 161 * @pending_mask: pending rebalanced interrupts
162 * @threads_active: number of irqaction threads currently running
163 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
161 * @dir: /proc/irq/ procfs entry 164 * @dir: /proc/irq/ procfs entry
162 * @name: flow handler name for /proc/interrupts output 165 * @name: flow handler name for /proc/interrupts output
163 */ 166 */
@@ -189,6 +192,8 @@ struct irq_desc {
189 cpumask_var_t pending_mask; 192 cpumask_var_t pending_mask;
190#endif 193#endif
191#endif 194#endif
195 atomic_t threads_active;
196 wait_queue_head_t wait_for_threads;
192#ifdef CONFIG_PROC_FS 197#ifdef CONFIG_PROC_FS
193 struct proc_dir_entry *dir; 198 struct proc_dir_entry *dir;
194#endif 199#endif
@@ -482,6 +487,16 @@ static inline void init_copy_desc_masks(struct irq_desc *old_desc,
482#endif 487#endif
483} 488}
484 489
490static inline void free_desc_masks(struct irq_desc *old_desc,
491 struct irq_desc *new_desc)
492{
493 free_cpumask_var(old_desc->affinity);
494
495#ifdef CONFIG_GENERIC_PENDING_IRQ
496 free_cpumask_var(old_desc->pending_mask);
497#endif
498}
499
485#else /* !CONFIG_SMP */ 500#else /* !CONFIG_SMP */
486 501
487static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, 502static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu,
@@ -495,6 +510,10 @@ static inline void init_copy_desc_masks(struct irq_desc *old_desc,
495{ 510{
496} 511}
497 512
513static inline void free_desc_masks(struct irq_desc *old_desc,
514 struct irq_desc *new_desc)
515{
516}
498#endif /* CONFIG_SMP */ 517#endif /* CONFIG_SMP */
499 518
500#endif /* _LINUX_IRQ_H */ 519#endif /* _LINUX_IRQ_H */
diff --git a/include/linux/irqreturn.h b/include/linux/irqreturn.h
index c5584ca5b8c9..819acaaac3f5 100644
--- a/include/linux/irqreturn.h
+++ b/include/linux/irqreturn.h
@@ -5,10 +5,12 @@
5 * enum irqreturn 5 * enum irqreturn
6 * @IRQ_NONE interrupt was not from this device 6 * @IRQ_NONE interrupt was not from this device
7 * @IRQ_HANDLED interrupt was handled by this device 7 * @IRQ_HANDLED interrupt was handled by this device
8 * @IRQ_WAKE_THREAD handler requests to wake the handler thread
8 */ 9 */
9enum irqreturn { 10enum irqreturn {
10 IRQ_NONE, 11 IRQ_NONE,
11 IRQ_HANDLED, 12 IRQ_HANDLED,
13 IRQ_WAKE_THREAD,
12}; 14};
13 15
14typedef enum irqreturn irqreturn_t; 16typedef enum irqreturn irqreturn_t;
diff --git a/include/linux/key.h b/include/linux/key.h
index 21d32a142c00..e544f466d69a 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -20,6 +20,7 @@
20#include <linux/rbtree.h> 20#include <linux/rbtree.h>
21#include <linux/rcupdate.h> 21#include <linux/rcupdate.h>
22#include <linux/sysctl.h> 22#include <linux/sysctl.h>
23#include <linux/rwsem.h>
23#include <asm/atomic.h> 24#include <asm/atomic.h>
24 25
25#ifdef __KERNEL__ 26#ifdef __KERNEL__
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index d5fa565086d1..384ca8bbf1ac 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -34,7 +34,7 @@ extern int __request_module(bool wait, const char *name, ...) \
34#define request_module(mod...) __request_module(true, mod) 34#define request_module(mod...) __request_module(true, mod)
35#define request_module_nowait(mod...) __request_module(false, mod) 35#define request_module_nowait(mod...) __request_module(false, mod)
36#define try_then_request_module(x, mod...) \ 36#define try_then_request_module(x, mod...) \
37 ((x) ?: (__request_module(false, mod), (x))) 37 ((x) ?: (__request_module(true, mod), (x)))
38#else 38#else
39static inline int request_module(const char *name, ...) { return -ENOSYS; } 39static inline int request_module(const char *name, ...) { return -ENOSYS; }
40static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; } 40static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; }
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 2ec6cc14a114..bcd9c07848be 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -94,12 +94,16 @@ struct kprobe {
94 /* Called after addr is executed, unless... */ 94 /* Called after addr is executed, unless... */
95 kprobe_post_handler_t post_handler; 95 kprobe_post_handler_t post_handler;
96 96
97 /* ... called if executing addr causes a fault (eg. page fault). 97 /*
98 * Return 1 if it handled fault, otherwise kernel will see it. */ 98 * ... called if executing addr causes a fault (eg. page fault).
99 * Return 1 if it handled fault, otherwise kernel will see it.
100 */
99 kprobe_fault_handler_t fault_handler; 101 kprobe_fault_handler_t fault_handler;
100 102
101 /* ... called if breakpoint trap occurs in probe handler. 103 /*
102 * Return 1 if it handled break, otherwise kernel will see it. */ 104 * ... called if breakpoint trap occurs in probe handler.
105 * Return 1 if it handled break, otherwise kernel will see it.
106 */
103 kprobe_break_handler_t break_handler; 107 kprobe_break_handler_t break_handler;
104 108
105 /* Saved opcode (which has been replaced with breakpoint) */ 109 /* Saved opcode (which has been replaced with breakpoint) */
@@ -108,18 +112,28 @@ struct kprobe {
108 /* copy of the original instruction */ 112 /* copy of the original instruction */
109 struct arch_specific_insn ainsn; 113 struct arch_specific_insn ainsn;
110 114
111 /* Indicates various status flags. Protected by kprobe_mutex. */ 115 /*
116 * Indicates various status flags.
117 * Protected by kprobe_mutex after this kprobe is registered.
118 */
112 u32 flags; 119 u32 flags;
113}; 120};
114 121
115/* Kprobe status flags */ 122/* Kprobe status flags */
116#define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */ 123#define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */
124#define KPROBE_FLAG_DISABLED 2 /* probe is temporarily disabled */
117 125
126/* Has this kprobe gone ? */
118static inline int kprobe_gone(struct kprobe *p) 127static inline int kprobe_gone(struct kprobe *p)
119{ 128{
120 return p->flags & KPROBE_FLAG_GONE; 129 return p->flags & KPROBE_FLAG_GONE;
121} 130}
122 131
132/* Is this kprobe disabled ? */
133static inline int kprobe_disabled(struct kprobe *p)
134{
135 return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE);
136}
123/* 137/*
124 * Special probe type that uses setjmp-longjmp type tricks to resume 138 * Special probe type that uses setjmp-longjmp type tricks to resume
125 * execution at a specified entry with a matching prototype corresponding 139 * execution at a specified entry with a matching prototype corresponding
@@ -279,6 +293,9 @@ void unregister_kretprobes(struct kretprobe **rps, int num);
279void kprobe_flush_task(struct task_struct *tk); 293void kprobe_flush_task(struct task_struct *tk);
280void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); 294void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
281 295
296int disable_kprobe(struct kprobe *kp);
297int enable_kprobe(struct kprobe *kp);
298
282#else /* !CONFIG_KPROBES: */ 299#else /* !CONFIG_KPROBES: */
283 300
284static inline int kprobes_built_in(void) 301static inline int kprobes_built_in(void)
@@ -345,5 +362,30 @@ static inline void unregister_kretprobes(struct kretprobe **rps, int num)
345static inline void kprobe_flush_task(struct task_struct *tk) 362static inline void kprobe_flush_task(struct task_struct *tk)
346{ 363{
347} 364}
365static inline int disable_kprobe(struct kprobe *kp)
366{
367 return -ENOSYS;
368}
369static inline int enable_kprobe(struct kprobe *kp)
370{
371 return -ENOSYS;
372}
348#endif /* CONFIG_KPROBES */ 373#endif /* CONFIG_KPROBES */
374static inline int disable_kretprobe(struct kretprobe *rp)
375{
376 return disable_kprobe(&rp->kp);
377}
378static inline int enable_kretprobe(struct kretprobe *rp)
379{
380 return enable_kprobe(&rp->kp);
381}
382static inline int disable_jprobe(struct jprobe *jp)
383{
384 return disable_kprobe(&jp->kp);
385}
386static inline int enable_jprobe(struct jprobe *jp)
387{
388 return enable_kprobe(&jp->kp);
389}
390
349#endif /* _LINUX_KPROBES_H */ 391#endif /* _LINUX_KPROBES_H */
diff --git a/include/linux/leds-bd2802.h b/include/linux/leds-bd2802.h
new file mode 100644
index 000000000000..42f854a1a199
--- /dev/null
+++ b/include/linux/leds-bd2802.h
@@ -0,0 +1,26 @@
1/*
2 * leds-bd2802.h - RGB LED Driver
3 *
4 * Copyright (C) 2009 Samsung Electronics
5 * Kim Kyuwon <q1.kim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Datasheet: http://www.rohm.com/products/databook/driver/pdf/bd2802gu-e.pdf
12 *
13 */
14#ifndef _LEDS_BD2802_H_
15#define _LEDS_BD2802_H_
16
17struct bd2802_led_platform_data{
18 int reset_gpio;
19 u8 rgb_time;
20};
21
22#define RGB_TIME(slopedown, slopeup, waveform) \
23 ((slopedown) << 6 | (slopeup) << 4 | (waveform))
24
25#endif /* _LEDS_BD2802_H_ */
26
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 24489da701e3..376fe07732ea 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -30,6 +30,7 @@ enum led_brightness {
30struct led_classdev { 30struct led_classdev {
31 const char *name; 31 const char *name;
32 int brightness; 32 int brightness;
33 int max_brightness;
33 int flags; 34 int flags;
34 35
35 /* Lower 16 bits reflect status */ 36 /* Lower 16 bits reflect status */
@@ -140,7 +141,8 @@ struct gpio_led {
140 const char *name; 141 const char *name;
141 const char *default_trigger; 142 const char *default_trigger;
142 unsigned gpio; 143 unsigned gpio;
143 u8 active_low; 144 u8 active_low : 1;
145 u8 retain_state_suspended : 1;
144}; 146};
145 147
146struct gpio_led_platform_data { 148struct gpio_led_platform_data {
diff --git a/include/linux/leds_pwm.h b/include/linux/leds_pwm.h
new file mode 100644
index 000000000000..33a071167489
--- /dev/null
+++ b/include/linux/leds_pwm.h
@@ -0,0 +1,21 @@
1/*
2 * PWM LED driver data - see drivers/leds/leds-pwm.c
3 */
4#ifndef __LINUX_LEDS_PWM_H
5#define __LINUX_LEDS_PWM_H
6
7struct led_pwm {
8 const char *name;
9 const char *default_trigger;
10 unsigned pwm_id;
11 u8 active_low;
12 unsigned max_brightness;
13 unsigned pwm_period_ns;
14};
15
16struct led_pwm_platform_data {
17 int num_leds;
18 struct led_pwm *leds;
19};
20
21#endif
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index 7dc5b6cb44cd..d39ed1cc5fbf 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -25,13 +25,13 @@ struct svc_rqst;
25#define NLM_MAXCOOKIELEN 32 25#define NLM_MAXCOOKIELEN 32
26#define NLM_MAXSTRLEN 1024 26#define NLM_MAXSTRLEN 1024
27 27
28#define nlm_granted __constant_htonl(NLM_LCK_GRANTED) 28#define nlm_granted cpu_to_be32(NLM_LCK_GRANTED)
29#define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED) 29#define nlm_lck_denied cpu_to_be32(NLM_LCK_DENIED)
30#define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS) 30#define nlm_lck_denied_nolocks cpu_to_be32(NLM_LCK_DENIED_NOLOCKS)
31#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED) 31#define nlm_lck_blocked cpu_to_be32(NLM_LCK_BLOCKED)
32#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD) 32#define nlm_lck_denied_grace_period cpu_to_be32(NLM_LCK_DENIED_GRACE_PERIOD)
33 33
34#define nlm_drop_reply __constant_htonl(30000) 34#define nlm_drop_reply cpu_to_be32(30000)
35 35
36/* Lock info passed via NLM */ 36/* Lock info passed via NLM */
37struct nlm_lock { 37struct nlm_lock {
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h
index 12bfe09de2b1..7353821341ed 100644
--- a/include/linux/lockd/xdr4.h
+++ b/include/linux/lockd/xdr4.h
@@ -15,11 +15,11 @@
15#include <linux/lockd/xdr.h> 15#include <linux/lockd/xdr.h>
16 16
17/* error codes new to NLMv4 */ 17/* error codes new to NLMv4 */
18#define nlm4_deadlock __constant_htonl(NLM_DEADLCK) 18#define nlm4_deadlock cpu_to_be32(NLM_DEADLCK)
19#define nlm4_rofs __constant_htonl(NLM_ROFS) 19#define nlm4_rofs cpu_to_be32(NLM_ROFS)
20#define nlm4_stale_fh __constant_htonl(NLM_STALE_FH) 20#define nlm4_stale_fh cpu_to_be32(NLM_STALE_FH)
21#define nlm4_fbig __constant_htonl(NLM_FBIG) 21#define nlm4_fbig cpu_to_be32(NLM_FBIG)
22#define nlm4_failed __constant_htonl(NLM_FAILED) 22#define nlm4_failed cpu_to_be32(NLM_FAILED)
23 23
24 24
25 25
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index 4455b212d75a..c8f51c3c0a72 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -29,6 +29,8 @@ struct pcf50633_platform_data {
29 char **batteries; 29 char **batteries;
30 int num_batteries; 30 int num_batteries;
31 31
32 int charging_restart_interval;
33
32 /* Callbacks */ 34 /* Callbacks */
33 void (*probe_done)(struct pcf50633 *); 35 void (*probe_done)(struct pcf50633 *);
34 void (*mbc_event_callback)(struct pcf50633 *, int); 36 void (*mbc_event_callback)(struct pcf50633 *, int);
diff --git a/include/linux/mfd/pcf50633/mbc.h b/include/linux/mfd/pcf50633/mbc.h
index 6e17619b773a..4119579acf2c 100644
--- a/include/linux/mfd/pcf50633/mbc.h
+++ b/include/linux/mfd/pcf50633/mbc.h
@@ -128,7 +128,6 @@ enum pcf50633_reg_mbcs3 {
128int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma); 128int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma);
129 129
130int pcf50633_mbc_get_status(struct pcf50633 *); 130int pcf50633_mbc_get_status(struct pcf50633 *);
131void pcf50633_mbc_set_status(struct pcf50633 *, int what, int status);
132 131
133#endif 132#endif
134 133
diff --git a/include/linux/mg_disk.h b/include/linux/mg_disk.h
new file mode 100644
index 000000000000..1f76b1ebf627
--- /dev/null
+++ b/include/linux/mg_disk.h
@@ -0,0 +1,206 @@
1/*
2 * include/linux/mg_disk.c
3 *
4 * Support for the mGine m[g]flash IO mode.
5 * Based on legacy hd.c
6 *
7 * (c) 2008 mGine Co.,LTD
8 * (c) 2008 unsik Kim <donari75@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __MG_DISK_H__
16#define __MG_DISK_H__
17
18#include <linux/blkdev.h>
19#include <linux/ata.h>
20
21/* name for block device */
22#define MG_DISK_NAME "mgd"
23/* name for platform device */
24#define MG_DEV_NAME "mg_disk"
25
26#define MG_DISK_MAJ 0
27#define MG_DISK_MAX_PART 16
28#define MG_SECTOR_SIZE 512
29#define MG_MAX_SECTS 256
30
31/* Register offsets */
32#define MG_BUFF_OFFSET 0x8000
33#define MG_STORAGE_BUFFER_SIZE 0x200
34#define MG_REG_OFFSET 0xC000
35#define MG_REG_FEATURE (MG_REG_OFFSET + 2) /* write case */
36#define MG_REG_ERROR (MG_REG_OFFSET + 2) /* read case */
37#define MG_REG_SECT_CNT (MG_REG_OFFSET + 4)
38#define MG_REG_SECT_NUM (MG_REG_OFFSET + 6)
39#define MG_REG_CYL_LOW (MG_REG_OFFSET + 8)
40#define MG_REG_CYL_HIGH (MG_REG_OFFSET + 0xA)
41#define MG_REG_DRV_HEAD (MG_REG_OFFSET + 0xC)
42#define MG_REG_COMMAND (MG_REG_OFFSET + 0xE) /* write case */
43#define MG_REG_STATUS (MG_REG_OFFSET + 0xE) /* read case */
44#define MG_REG_DRV_CTRL (MG_REG_OFFSET + 0x10)
45#define MG_REG_BURST_CTRL (MG_REG_OFFSET + 0x12)
46
47/* "Drive Select/Head Register" bit values */
48#define MG_REG_HEAD_MUST_BE_ON 0xA0 /* These 2 bits are always on */
49#define MG_REG_HEAD_DRIVE_MASTER (0x00 | MG_REG_HEAD_MUST_BE_ON)
50#define MG_REG_HEAD_DRIVE_SLAVE (0x10 | MG_REG_HEAD_MUST_BE_ON)
51#define MG_REG_HEAD_LBA_MODE (0x40 | MG_REG_HEAD_MUST_BE_ON)
52
53
54/* "Device Control Register" bit values */
55#define MG_REG_CTRL_INTR_ENABLE 0x0
56#define MG_REG_CTRL_INTR_DISABLE (0x1<<1)
57#define MG_REG_CTRL_RESET (0x1<<2)
58#define MG_REG_CTRL_INTR_POLA_ACTIVE_HIGH 0x0
59#define MG_REG_CTRL_INTR_POLA_ACTIVE_LOW (0x1<<4)
60#define MG_REG_CTRL_DPD_POLA_ACTIVE_LOW 0x0
61#define MG_REG_CTRL_DPD_POLA_ACTIVE_HIGH (0x1<<5)
62#define MG_REG_CTRL_DPD_DISABLE 0x0
63#define MG_REG_CTRL_DPD_ENABLE (0x1<<6)
64
65/* Status register bit */
66/* error bit in status register */
67#define MG_REG_STATUS_BIT_ERROR 0x01
68/* corrected error in status register */
69#define MG_REG_STATUS_BIT_CORRECTED_ERROR 0x04
70/* data request bit in status register */
71#define MG_REG_STATUS_BIT_DATA_REQ 0x08
72/* DSC - Drive Seek Complete */
73#define MG_REG_STATUS_BIT_SEEK_DONE 0x10
74/* DWF - Drive Write Fault */
75#define MG_REG_STATUS_BIT_WRITE_FAULT 0x20
76#define MG_REG_STATUS_BIT_READY 0x40
77#define MG_REG_STATUS_BIT_BUSY 0x80
78
79/* handy status */
80#define MG_STAT_READY (MG_REG_STATUS_BIT_READY | MG_REG_STATUS_BIT_SEEK_DONE)
81#define MG_READY_OK(s) (((s) & (MG_STAT_READY | \
82 (MG_REG_STATUS_BIT_BUSY | \
83 MG_REG_STATUS_BIT_WRITE_FAULT | \
84 MG_REG_STATUS_BIT_ERROR))) == MG_STAT_READY)
85
86/* Error register */
87#define MG_REG_ERR_AMNF 0x01
88#define MG_REG_ERR_ABRT 0x04
89#define MG_REG_ERR_IDNF 0x10
90#define MG_REG_ERR_UNC 0x40
91#define MG_REG_ERR_BBK 0x80
92
93/* error code for others */
94#define MG_ERR_NONE 0
95#define MG_ERR_TIMEOUT 0x100
96#define MG_ERR_INIT_STAT 0x101
97#define MG_ERR_TRANSLATION 0x102
98#define MG_ERR_CTRL_RST 0x103
99#define MG_ERR_INV_STAT 0x104
100#define MG_ERR_RSTOUT 0x105
101
102#define MG_MAX_ERRORS 6 /* Max read/write errors */
103
104/* command */
105#define MG_CMD_RD 0x20
106#define MG_CMD_WR 0x30
107#define MG_CMD_SLEEP 0x99
108#define MG_CMD_WAKEUP 0xC3
109#define MG_CMD_ID 0xEC
110#define MG_CMD_WR_CONF 0x3C
111#define MG_CMD_RD_CONF 0x40
112
113/* operation mode */
114#define MG_OP_CASCADE (1 << 0)
115#define MG_OP_CASCADE_SYNC_RD (1 << 1)
116#define MG_OP_CASCADE_SYNC_WR (1 << 2)
117#define MG_OP_INTERLEAVE (1 << 3)
118
119/* synchronous */
120#define MG_BURST_LAT_4 (3 << 4)
121#define MG_BURST_LAT_5 (4 << 4)
122#define MG_BURST_LAT_6 (5 << 4)
123#define MG_BURST_LAT_7 (6 << 4)
124#define MG_BURST_LAT_8 (7 << 4)
125#define MG_BURST_LEN_4 (1 << 1)
126#define MG_BURST_LEN_8 (2 << 1)
127#define MG_BURST_LEN_16 (3 << 1)
128#define MG_BURST_LEN_32 (4 << 1)
129#define MG_BURST_LEN_CONT (0 << 1)
130
131/* timeout value (unit: ms) */
132#define MG_TMAX_CONF_TO_CMD 1
133#define MG_TMAX_WAIT_RD_DRQ 10
134#define MG_TMAX_WAIT_WR_DRQ 500
135#define MG_TMAX_RST_TO_BUSY 10
136#define MG_TMAX_HDRST_TO_RDY 500
137#define MG_TMAX_SWRST_TO_RDY 500
138#define MG_TMAX_RSTOUT 3000
139
140/* device attribution */
141/* use mflash as boot device */
142#define MG_BOOT_DEV (1 << 0)
143/* use mflash as storage device */
144#define MG_STORAGE_DEV (1 << 1)
145/* same as MG_STORAGE_DEV, but bootloader already done reset sequence */
146#define MG_STORAGE_DEV_SKIP_RST (1 << 2)
147
148#define MG_DEV_MASK (MG_BOOT_DEV | MG_STORAGE_DEV | MG_STORAGE_DEV_SKIP_RST)
149
150/* names of GPIO resource */
151#define MG_RST_PIN "mg_rst"
152/* except MG_BOOT_DEV, reset-out pin should be assigned */
153#define MG_RSTOUT_PIN "mg_rstout"
154
155/* private driver data */
156struct mg_drv_data {
157 /* disk resource */
158 u32 use_polling;
159
160 /* device attribution */
161 u32 dev_attr;
162
163 /* internally used */
164 struct mg_host *host;
165};
166
167/* main structure for mflash driver */
168struct mg_host {
169 struct device *dev;
170
171 struct request_queue *breq;
172 spinlock_t lock;
173 struct gendisk *gd;
174
175 struct timer_list timer;
176 void (*mg_do_intr) (struct mg_host *);
177
178 u16 id[ATA_ID_WORDS];
179
180 u16 cyls;
181 u16 heads;
182 u16 sectors;
183 u32 n_sectors;
184 u32 nres_sectors;
185
186 void __iomem *dev_base;
187 unsigned int irq;
188 unsigned int rst;
189 unsigned int rstout;
190
191 u32 major;
192 u32 error;
193};
194
195/*
196 * Debugging macro and defines
197 */
198#undef DO_MG_DEBUG
199#ifdef DO_MG_DEBUG
200# define MG_DBG(fmt, args...) \
201 printk(KERN_DEBUG "%s:%d "fmt, __func__, __LINE__, ##args)
202#else /* CONFIG_MG_DEBUG */
203# define MG_DBG(fmt, args...) do { } while (0)
204#endif /* CONFIG_MG_DEBUG */
205
206#endif
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 3aa5d77c2cdb..5675b63a0631 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -11,6 +11,7 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <linux/notifier.h> 13#include <linux/notifier.h>
14#include <linux/device.h>
14 15
15#include <linux/mtd/compatmac.h> 16#include <linux/mtd/compatmac.h>
16#include <mtd/mtd-abi.h> 17#include <mtd/mtd-abi.h>
@@ -162,6 +163,20 @@ struct mtd_info {
162 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ 163 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
163 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); 164 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
164 165
166 /* Allow NOMMU mmap() to directly map the device (if not NULL)
167 * - return the address to which the offset maps
168 * - return -ENOSYS to indicate refusal to do the mapping
169 */
170 unsigned long (*get_unmapped_area) (struct mtd_info *mtd,
171 unsigned long len,
172 unsigned long offset,
173 unsigned long flags);
174
175 /* Backing device capabilities for this device
176 * - provides mmap capabilities
177 */
178 struct backing_dev_info *backing_dev_info;
179
165 180
166 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 181 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
167 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); 182 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
@@ -223,6 +238,7 @@ struct mtd_info {
223 void *priv; 238 void *priv;
224 239
225 struct module *owner; 240 struct module *owner;
241 struct device dev;
226 int usecount; 242 int usecount;
227 243
228 /* If the driver is something smart, like UBI, it may need to maintain 244 /* If the driver is something smart, like UBI, it may need to maintain
@@ -233,6 +249,11 @@ struct mtd_info {
233 void (*put_device) (struct mtd_info *mtd); 249 void (*put_device) (struct mtd_info *mtd);
234}; 250};
235 251
252static inline struct mtd_info *dev_to_mtd(struct device *dev)
253{
254 return dev ? container_of(dev, struct mtd_info, dev) : NULL;
255}
256
236static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) 257static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
237{ 258{
238 if (mtd->erasesize_shift) 259 if (mtd->erasesize_shift)
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index db5b63da2a7e..7efb9be34662 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -43,8 +43,8 @@ extern void nand_wait_ready(struct mtd_info *mtd);
43 * is supported now. If you add a chip with bigger oobsize/page 43 * is supported now. If you add a chip with bigger oobsize/page
44 * adjust this accordingly. 44 * adjust this accordingly.
45 */ 45 */
46#define NAND_MAX_OOBSIZE 64 46#define NAND_MAX_OOBSIZE 128
47#define NAND_MAX_PAGESIZE 2048 47#define NAND_MAX_PAGESIZE 4096
48 48
49/* 49/*
50 * Constants for hardware specific CLE/ALE/NCE function 50 * Constants for hardware specific CLE/ALE/NCE function
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index a45dd831b3f8..7535a74083b9 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -76,4 +76,16 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
76 struct device_node *node, 76 struct device_node *node,
77 struct mtd_partition **pparts); 77 struct mtd_partition **pparts);
78 78
79#ifdef CONFIG_MTD_PARTITIONS
80static inline int mtd_has_partitions(void) { return 1; }
81#else
82static inline int mtd_has_partitions(void) { return 0; }
83#endif
84
85#ifdef CONFIG_MTD_CMDLINE_PARTS
86static inline int mtd_has_cmdlinepart(void) { return 1; }
87#else
88static inline int mtd_has_cmdlinepart(void) { return 0; }
89#endif
90
79#endif 91#endif
diff --git a/include/linux/nfs.h b/include/linux/nfs.h
index 54af92c1c70b..214d499718f7 100644
--- a/include/linux/nfs.h
+++ b/include/linux/nfs.h
@@ -109,7 +109,6 @@
109 NFSERR_FILE_OPEN = 10046, /* v4 */ 109 NFSERR_FILE_OPEN = 10046, /* v4 */
110 NFSERR_ADMIN_REVOKED = 10047, /* v4 */ 110 NFSERR_ADMIN_REVOKED = 10047, /* v4 */
111 NFSERR_CB_PATH_DOWN = 10048, /* v4 */ 111 NFSERR_CB_PATH_DOWN = 10048, /* v4 */
112 NFSERR_REPLAY_ME = 10049 /* v4 */
113}; 112};
114 113
115/* NFSv2 file types - beware, these are not the same in NFSv3 */ 114/* NFSv2 file types - beware, these are not the same in NFSv3 */
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index b912311a56b1..e3f0cbcbd0db 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -21,6 +21,7 @@
21#define NFS4_FHSIZE 128 21#define NFS4_FHSIZE 128
22#define NFS4_MAXPATHLEN PATH_MAX 22#define NFS4_MAXPATHLEN PATH_MAX
23#define NFS4_MAXNAMLEN NAME_MAX 23#define NFS4_MAXNAMLEN NAME_MAX
24#define NFS4_MAX_SESSIONID_LEN 16
24 25
25#define NFS4_ACCESS_READ 0x0001 26#define NFS4_ACCESS_READ 0x0001
26#define NFS4_ACCESS_LOOKUP 0x0002 27#define NFS4_ACCESS_LOOKUP 0x0002
@@ -38,6 +39,7 @@
38#define NFS4_OPEN_RESULT_CONFIRM 0x0002 39#define NFS4_OPEN_RESULT_CONFIRM 0x0002
39#define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004 40#define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004
40 41
42#define NFS4_SHARE_ACCESS_MASK 0x000F
41#define NFS4_SHARE_ACCESS_READ 0x0001 43#define NFS4_SHARE_ACCESS_READ 0x0001
42#define NFS4_SHARE_ACCESS_WRITE 0x0002 44#define NFS4_SHARE_ACCESS_WRITE 0x0002
43#define NFS4_SHARE_ACCESS_BOTH 0x0003 45#define NFS4_SHARE_ACCESS_BOTH 0x0003
@@ -45,6 +47,19 @@
45#define NFS4_SHARE_DENY_WRITE 0x0002 47#define NFS4_SHARE_DENY_WRITE 0x0002
46#define NFS4_SHARE_DENY_BOTH 0x0003 48#define NFS4_SHARE_DENY_BOTH 0x0003
47 49
50/* nfs41 */
51#define NFS4_SHARE_WANT_MASK 0xFF00
52#define NFS4_SHARE_WANT_NO_PREFERENCE 0x0000
53#define NFS4_SHARE_WANT_READ_DELEG 0x0100
54#define NFS4_SHARE_WANT_WRITE_DELEG 0x0200
55#define NFS4_SHARE_WANT_ANY_DELEG 0x0300
56#define NFS4_SHARE_WANT_NO_DELEG 0x0400
57#define NFS4_SHARE_WANT_CANCEL 0x0500
58
59#define NFS4_SHARE_WHEN_MASK 0xF0000
60#define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000
61#define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000
62
48#define NFS4_SET_TO_SERVER_TIME 0 63#define NFS4_SET_TO_SERVER_TIME 0
49#define NFS4_SET_TO_CLIENT_TIME 1 64#define NFS4_SET_TO_CLIENT_TIME 1
50 65
@@ -88,6 +103,31 @@
88#define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 103#define NFS4_ACE_GENERIC_EXECUTE 0x001200A0
89#define NFS4_ACE_MASK_ALL 0x001F01FF 104#define NFS4_ACE_MASK_ALL 0x001F01FF
90 105
106#define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001
107#define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002
108#define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000
109#define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000
110#define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000
111#define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000
112#define EXCHGID4_FLAG_CONFIRMED_R 0x80000000
113/*
114 * Since the validity of these bits depends on whether
115 * they're set in the argument or response, have separate
116 * invalid flag masks for arg (_A) and resp (_R).
117 */
118#define EXCHGID4_FLAG_MASK_A 0x40070003
119#define EXCHGID4_FLAG_MASK_R 0x80070003
120
121#define SEQ4_STATUS_CB_PATH_DOWN 0x00000001
122#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002
123#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004
124#define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008
125#define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010
126#define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020
127#define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040
128#define SEQ4_STATUS_LEASE_MOVED 0x00000080
129#define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100
130
91#define NFS4_MAX_UINT64 (~(u64)0) 131#define NFS4_MAX_UINT64 (~(u64)0)
92 132
93enum nfs4_acl_whotype { 133enum nfs4_acl_whotype {
@@ -154,6 +194,28 @@ enum nfs_opnum4 {
154 OP_VERIFY = 37, 194 OP_VERIFY = 37,
155 OP_WRITE = 38, 195 OP_WRITE = 38,
156 OP_RELEASE_LOCKOWNER = 39, 196 OP_RELEASE_LOCKOWNER = 39,
197
198 /* nfs41 */
199 OP_BACKCHANNEL_CTL = 40,
200 OP_BIND_CONN_TO_SESSION = 41,
201 OP_EXCHANGE_ID = 42,
202 OP_CREATE_SESSION = 43,
203 OP_DESTROY_SESSION = 44,
204 OP_FREE_STATEID = 45,
205 OP_GET_DIR_DELEGATION = 46,
206 OP_GETDEVICEINFO = 47,
207 OP_GETDEVICELIST = 48,
208 OP_LAYOUTCOMMIT = 49,
209 OP_LAYOUTGET = 50,
210 OP_LAYOUTRETURN = 51,
211 OP_SECINFO_NO_NAME = 52,
212 OP_SEQUENCE = 53,
213 OP_SET_SSV = 54,
214 OP_TEST_STATEID = 55,
215 OP_WANT_DELEGATION = 56,
216 OP_DESTROY_CLIENTID = 57,
217 OP_RECLAIM_COMPLETE = 58,
218
157 OP_ILLEGAL = 10044, 219 OP_ILLEGAL = 10044,
158}; 220};
159 221
@@ -230,7 +292,48 @@ enum nfsstat4 {
230 NFS4ERR_DEADLOCK = 10045, 292 NFS4ERR_DEADLOCK = 10045,
231 NFS4ERR_FILE_OPEN = 10046, 293 NFS4ERR_FILE_OPEN = 10046,
232 NFS4ERR_ADMIN_REVOKED = 10047, 294 NFS4ERR_ADMIN_REVOKED = 10047,
233 NFS4ERR_CB_PATH_DOWN = 10048 295 NFS4ERR_CB_PATH_DOWN = 10048,
296
297 /* nfs41 */
298 NFS4ERR_BADIOMODE = 10049,
299 NFS4ERR_BADLAYOUT = 10050,
300 NFS4ERR_BAD_SESSION_DIGEST = 10051,
301 NFS4ERR_BADSESSION = 10052,
302 NFS4ERR_BADSLOT = 10053,
303 NFS4ERR_COMPLETE_ALREADY = 10054,
304 NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055,
305 NFS4ERR_DELEG_ALREADY_WANTED = 10056,
306 NFS4ERR_BACK_CHAN_BUSY = 10057, /* backchan reqs outstanding */
307 NFS4ERR_LAYOUTTRYLATER = 10058,
308 NFS4ERR_LAYOUTUNAVAILABLE = 10059,
309 NFS4ERR_NOMATCHING_LAYOUT = 10060,
310 NFS4ERR_RECALLCONFLICT = 10061,
311 NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062,
312 NFS4ERR_SEQ_MISORDERED = 10063, /* unexpected seq.id in req */
313 NFS4ERR_SEQUENCE_POS = 10064, /* [CB_]SEQ. op not 1st op */
314 NFS4ERR_REQ_TOO_BIG = 10065, /* request too big */
315 NFS4ERR_REP_TOO_BIG = 10066, /* reply too big */
316 NFS4ERR_REP_TOO_BIG_TO_CACHE = 10067, /* rep. not all cached */
317 NFS4ERR_RETRY_UNCACHED_REP = 10068, /* retry & rep. uncached */
318 NFS4ERR_UNSAFE_COMPOUND = 10069, /* retry/recovery too hard */
319 NFS4ERR_TOO_MANY_OPS = 10070, /* too many ops in [CB_]COMP */
320 NFS4ERR_OP_NOT_IN_SESSION = 10071, /* op needs [CB_]SEQ. op */
321 NFS4ERR_HASH_ALG_UNSUPP = 10072, /* hash alg. not supp. */
322 /* Error 10073 is unused. */
323 NFS4ERR_CLIENTID_BUSY = 10074, /* clientid has state */
324 NFS4ERR_PNFS_IO_HOLE = 10075, /* IO to _SPARSE file hole */
325 NFS4ERR_SEQ_FALSE_RETRY = 10076, /* retry not origional */
326 NFS4ERR_BAD_HIGH_SLOT = 10077, /* sequence arg bad */
327 NFS4ERR_DEADSESSION = 10078, /* persistent session dead */
328 NFS4ERR_ENCR_ALG_UNSUPP = 10079, /* SSV alg mismatch */
329 NFS4ERR_PNFS_NO_LAYOUT = 10080, /* direct I/O with no layout */
330 NFS4ERR_NOT_ONLY_OP = 10081, /* bad compound */
331 NFS4ERR_WRONG_CRED = 10082, /* permissions:state change */
332 NFS4ERR_WRONG_TYPE = 10083, /* current operation mismatch */
333 NFS4ERR_DIRDELEG_UNAVAIL = 10084, /* no directory delegation */
334 NFS4ERR_REJECT_DELEG = 10085, /* on callback */
335 NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */
336 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */
234}; 337};
235 338
236/* 339/*
@@ -265,7 +368,13 @@ enum opentype4 {
265enum createmode4 { 368enum createmode4 {
266 NFS4_CREATE_UNCHECKED = 0, 369 NFS4_CREATE_UNCHECKED = 0,
267 NFS4_CREATE_GUARDED = 1, 370 NFS4_CREATE_GUARDED = 1,
268 NFS4_CREATE_EXCLUSIVE = 2 371 NFS4_CREATE_EXCLUSIVE = 2,
372 /*
373 * New to NFSv4.1. If session is persistent,
374 * GUARDED4 MUST be used. Otherwise, use
375 * EXCLUSIVE4_1 instead of EXCLUSIVE4.
376 */
377 NFS4_CREATE_EXCLUSIVE4_1 = 3
269}; 378};
270 379
271enum limit_by4 { 380enum limit_by4 {
@@ -301,6 +410,8 @@ enum lock_type4 {
301#define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9) 410#define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9)
302#define FATTR4_WORD0_LEASE_TIME (1UL << 10) 411#define FATTR4_WORD0_LEASE_TIME (1UL << 10)
303#define FATTR4_WORD0_RDATTR_ERROR (1UL << 11) 412#define FATTR4_WORD0_RDATTR_ERROR (1UL << 11)
413/* Mandatory in NFSv4.1 */
414#define FATTR4_WORD2_SUPPATTR_EXCLCREAT (1UL << 11)
304 415
305/* Recommended Attributes */ 416/* Recommended Attributes */
306#define FATTR4_WORD0_ACL (1UL << 12) 417#define FATTR4_WORD0_ACL (1UL << 12)
@@ -391,6 +502,29 @@ enum {
391 NFSPROC4_CLNT_GETACL, 502 NFSPROC4_CLNT_GETACL,
392 NFSPROC4_CLNT_SETACL, 503 NFSPROC4_CLNT_SETACL,
393 NFSPROC4_CLNT_FS_LOCATIONS, 504 NFSPROC4_CLNT_FS_LOCATIONS,
505
506 /* nfs41 */
507 NFSPROC4_CLNT_EXCHANGE_ID,
508 NFSPROC4_CLNT_CREATE_SESSION,
509 NFSPROC4_CLNT_DESTROY_SESSION,
510 NFSPROC4_CLNT_SEQUENCE,
511 NFSPROC4_CLNT_GET_LEASE_TIME,
512};
513
514/* nfs41 types */
515struct nfs4_sessionid {
516 unsigned char data[NFS4_MAX_SESSIONID_LEN];
517};
518
519/* Create Session Flags */
520#define SESSION4_PERSIST 0x001
521#define SESSION4_BACK_CHAN 0x002
522#define SESSION4_RDMA 0x004
523
524enum state_protect_how4 {
525 SP4_NONE = 0,
526 SP4_MACH_CRED = 1,
527 SP4_SSV = 2
394}; 528};
395 529
396#endif 530#endif
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
index 04b355c801d8..5bccaab81056 100644
--- a/include/linux/nfsd/cache.h
+++ b/include/linux/nfsd/cache.h
@@ -76,4 +76,12 @@ void nfsd_reply_cache_shutdown(void);
76int nfsd_cache_lookup(struct svc_rqst *, int); 76int nfsd_cache_lookup(struct svc_rqst *, int);
77void nfsd_cache_update(struct svc_rqst *, int, __be32 *); 77void nfsd_cache_update(struct svc_rqst *, int, __be32 *);
78 78
79#ifdef CONFIG_NFSD_V4
80void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp);
81#else /* CONFIG_NFSD_V4 */
82static inline void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp)
83{
84}
85#endif /* CONFIG_NFSD_V4 */
86
79#endif /* NFSCACHE_H */ 87#endif /* NFSCACHE_H */
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index e19f45991b2e..2b49d676d0c9 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -23,7 +23,7 @@
23/* 23/*
24 * nfsd version 24 * nfsd version
25 */ 25 */
26#define NFSD_SUPPORTED_MINOR_VERSION 0 26#define NFSD_SUPPORTED_MINOR_VERSION 1
27 27
28/* 28/*
29 * Flags for nfsd_permission 29 * Flags for nfsd_permission
@@ -53,6 +53,7 @@ typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int);
53extern struct svc_program nfsd_program; 53extern struct svc_program nfsd_program;
54extern struct svc_version nfsd_version2, nfsd_version3, 54extern struct svc_version nfsd_version2, nfsd_version3,
55 nfsd_version4; 55 nfsd_version4;
56extern u32 nfsd_supported_minorversion;
56extern struct mutex nfsd_mutex; 57extern struct mutex nfsd_mutex;
57extern struct svc_serv *nfsd_serv; 58extern struct svc_serv *nfsd_serv;
58 59
@@ -105,7 +106,7 @@ void nfsd_close(struct file *);
105__be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, 106__be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *,
106 loff_t, struct kvec *, int, unsigned long *); 107 loff_t, struct kvec *, int, unsigned long *);
107__be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, 108__be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *,
108 loff_t, struct kvec *,int, unsigned long, int *); 109 loff_t, struct kvec *,int, unsigned long *, int *);
109__be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, 110__be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *,
110 char *, int *); 111 char *, int *);
111__be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *, 112__be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *,
@@ -149,6 +150,7 @@ int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *);
149 150
150enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL }; 151enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL };
151int nfsd_vers(int vers, enum vers_op change); 152int nfsd_vers(int vers, enum vers_op change);
153int nfsd_minorversion(u32 minorversion, enum vers_op change);
152void nfsd_reset_versions(void); 154void nfsd_reset_versions(void);
153int nfsd_create_serv(void); 155int nfsd_create_serv(void);
154 156
@@ -186,78 +188,119 @@ void nfsd_lockd_shutdown(void);
186/* 188/*
187 * These macros provide pre-xdr'ed values for faster operation. 189 * These macros provide pre-xdr'ed values for faster operation.
188 */ 190 */
189#define nfs_ok __constant_htonl(NFS_OK) 191#define nfs_ok cpu_to_be32(NFS_OK)
190#define nfserr_perm __constant_htonl(NFSERR_PERM) 192#define nfserr_perm cpu_to_be32(NFSERR_PERM)
191#define nfserr_noent __constant_htonl(NFSERR_NOENT) 193#define nfserr_noent cpu_to_be32(NFSERR_NOENT)
192#define nfserr_io __constant_htonl(NFSERR_IO) 194#define nfserr_io cpu_to_be32(NFSERR_IO)
193#define nfserr_nxio __constant_htonl(NFSERR_NXIO) 195#define nfserr_nxio cpu_to_be32(NFSERR_NXIO)
194#define nfserr_eagain __constant_htonl(NFSERR_EAGAIN) 196#define nfserr_eagain cpu_to_be32(NFSERR_EAGAIN)
195#define nfserr_acces __constant_htonl(NFSERR_ACCES) 197#define nfserr_acces cpu_to_be32(NFSERR_ACCES)
196#define nfserr_exist __constant_htonl(NFSERR_EXIST) 198#define nfserr_exist cpu_to_be32(NFSERR_EXIST)
197#define nfserr_xdev __constant_htonl(NFSERR_XDEV) 199#define nfserr_xdev cpu_to_be32(NFSERR_XDEV)
198#define nfserr_nodev __constant_htonl(NFSERR_NODEV) 200#define nfserr_nodev cpu_to_be32(NFSERR_NODEV)
199#define nfserr_notdir __constant_htonl(NFSERR_NOTDIR) 201#define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR)
200#define nfserr_isdir __constant_htonl(NFSERR_ISDIR) 202#define nfserr_isdir cpu_to_be32(NFSERR_ISDIR)
201#define nfserr_inval __constant_htonl(NFSERR_INVAL) 203#define nfserr_inval cpu_to_be32(NFSERR_INVAL)
202#define nfserr_fbig __constant_htonl(NFSERR_FBIG) 204#define nfserr_fbig cpu_to_be32(NFSERR_FBIG)
203#define nfserr_nospc __constant_htonl(NFSERR_NOSPC) 205#define nfserr_nospc cpu_to_be32(NFSERR_NOSPC)
204#define nfserr_rofs __constant_htonl(NFSERR_ROFS) 206#define nfserr_rofs cpu_to_be32(NFSERR_ROFS)
205#define nfserr_mlink __constant_htonl(NFSERR_MLINK) 207#define nfserr_mlink cpu_to_be32(NFSERR_MLINK)
206#define nfserr_opnotsupp __constant_htonl(NFSERR_OPNOTSUPP) 208#define nfserr_opnotsupp cpu_to_be32(NFSERR_OPNOTSUPP)
207#define nfserr_nametoolong __constant_htonl(NFSERR_NAMETOOLONG) 209#define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG)
208#define nfserr_notempty __constant_htonl(NFSERR_NOTEMPTY) 210#define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY)
209#define nfserr_dquot __constant_htonl(NFSERR_DQUOT) 211#define nfserr_dquot cpu_to_be32(NFSERR_DQUOT)
210#define nfserr_stale __constant_htonl(NFSERR_STALE) 212#define nfserr_stale cpu_to_be32(NFSERR_STALE)
211#define nfserr_remote __constant_htonl(NFSERR_REMOTE) 213#define nfserr_remote cpu_to_be32(NFSERR_REMOTE)
212#define nfserr_wflush __constant_htonl(NFSERR_WFLUSH) 214#define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH)
213#define nfserr_badhandle __constant_htonl(NFSERR_BADHANDLE) 215#define nfserr_badhandle cpu_to_be32(NFSERR_BADHANDLE)
214#define nfserr_notsync __constant_htonl(NFSERR_NOT_SYNC) 216#define nfserr_notsync cpu_to_be32(NFSERR_NOT_SYNC)
215#define nfserr_badcookie __constant_htonl(NFSERR_BAD_COOKIE) 217#define nfserr_badcookie cpu_to_be32(NFSERR_BAD_COOKIE)
216#define nfserr_notsupp __constant_htonl(NFSERR_NOTSUPP) 218#define nfserr_notsupp cpu_to_be32(NFSERR_NOTSUPP)
217#define nfserr_toosmall __constant_htonl(NFSERR_TOOSMALL) 219#define nfserr_toosmall cpu_to_be32(NFSERR_TOOSMALL)
218#define nfserr_serverfault __constant_htonl(NFSERR_SERVERFAULT) 220#define nfserr_serverfault cpu_to_be32(NFSERR_SERVERFAULT)
219#define nfserr_badtype __constant_htonl(NFSERR_BADTYPE) 221#define nfserr_badtype cpu_to_be32(NFSERR_BADTYPE)
220#define nfserr_jukebox __constant_htonl(NFSERR_JUKEBOX) 222#define nfserr_jukebox cpu_to_be32(NFSERR_JUKEBOX)
221#define nfserr_denied __constant_htonl(NFSERR_DENIED) 223#define nfserr_denied cpu_to_be32(NFSERR_DENIED)
222#define nfserr_deadlock __constant_htonl(NFSERR_DEADLOCK) 224#define nfserr_deadlock cpu_to_be32(NFSERR_DEADLOCK)
223#define nfserr_expired __constant_htonl(NFSERR_EXPIRED) 225#define nfserr_expired cpu_to_be32(NFSERR_EXPIRED)
224#define nfserr_bad_cookie __constant_htonl(NFSERR_BAD_COOKIE) 226#define nfserr_bad_cookie cpu_to_be32(NFSERR_BAD_COOKIE)
225#define nfserr_same __constant_htonl(NFSERR_SAME) 227#define nfserr_same cpu_to_be32(NFSERR_SAME)
226#define nfserr_clid_inuse __constant_htonl(NFSERR_CLID_INUSE) 228#define nfserr_clid_inuse cpu_to_be32(NFSERR_CLID_INUSE)
227#define nfserr_stale_clientid __constant_htonl(NFSERR_STALE_CLIENTID) 229#define nfserr_stale_clientid cpu_to_be32(NFSERR_STALE_CLIENTID)
228#define nfserr_resource __constant_htonl(NFSERR_RESOURCE) 230#define nfserr_resource cpu_to_be32(NFSERR_RESOURCE)
229#define nfserr_moved __constant_htonl(NFSERR_MOVED) 231#define nfserr_moved cpu_to_be32(NFSERR_MOVED)
230#define nfserr_nofilehandle __constant_htonl(NFSERR_NOFILEHANDLE) 232#define nfserr_nofilehandle cpu_to_be32(NFSERR_NOFILEHANDLE)
231#define nfserr_minor_vers_mismatch __constant_htonl(NFSERR_MINOR_VERS_MISMATCH) 233#define nfserr_minor_vers_mismatch cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH)
232#define nfserr_share_denied __constant_htonl(NFSERR_SHARE_DENIED) 234#define nfserr_share_denied cpu_to_be32(NFSERR_SHARE_DENIED)
233#define nfserr_stale_stateid __constant_htonl(NFSERR_STALE_STATEID) 235#define nfserr_stale_stateid cpu_to_be32(NFSERR_STALE_STATEID)
234#define nfserr_old_stateid __constant_htonl(NFSERR_OLD_STATEID) 236#define nfserr_old_stateid cpu_to_be32(NFSERR_OLD_STATEID)
235#define nfserr_bad_stateid __constant_htonl(NFSERR_BAD_STATEID) 237#define nfserr_bad_stateid cpu_to_be32(NFSERR_BAD_STATEID)
236#define nfserr_bad_seqid __constant_htonl(NFSERR_BAD_SEQID) 238#define nfserr_bad_seqid cpu_to_be32(NFSERR_BAD_SEQID)
237#define nfserr_symlink __constant_htonl(NFSERR_SYMLINK) 239#define nfserr_symlink cpu_to_be32(NFSERR_SYMLINK)
238#define nfserr_not_same __constant_htonl(NFSERR_NOT_SAME) 240#define nfserr_not_same cpu_to_be32(NFSERR_NOT_SAME)
239#define nfserr_restorefh __constant_htonl(NFSERR_RESTOREFH) 241#define nfserr_restorefh cpu_to_be32(NFSERR_RESTOREFH)
240#define nfserr_attrnotsupp __constant_htonl(NFSERR_ATTRNOTSUPP) 242#define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP)
241#define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR) 243#define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR)
242#define nfserr_openmode __constant_htonl(NFSERR_OPENMODE) 244#define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE)
243#define nfserr_locks_held __constant_htonl(NFSERR_LOCKS_HELD) 245#define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD)
244#define nfserr_op_illegal __constant_htonl(NFSERR_OP_ILLEGAL) 246#define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL)
245#define nfserr_grace __constant_htonl(NFSERR_GRACE) 247#define nfserr_grace cpu_to_be32(NFSERR_GRACE)
246#define nfserr_no_grace __constant_htonl(NFSERR_NO_GRACE) 248#define nfserr_no_grace cpu_to_be32(NFSERR_NO_GRACE)
247#define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD) 249#define nfserr_reclaim_bad cpu_to_be32(NFSERR_RECLAIM_BAD)
248#define nfserr_badname __constant_htonl(NFSERR_BADNAME) 250#define nfserr_badname cpu_to_be32(NFSERR_BADNAME)
249#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) 251#define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN)
250#define nfserr_locked __constant_htonl(NFSERR_LOCKED) 252#define nfserr_locked cpu_to_be32(NFSERR_LOCKED)
251#define nfserr_wrongsec __constant_htonl(NFSERR_WRONGSEC) 253#define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC)
252#define nfserr_replay_me __constant_htonl(NFSERR_REPLAY_ME) 254#define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE)
255#define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT)
256#define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST)
257#define nfserr_badsession cpu_to_be32(NFS4ERR_BADSESSION)
258#define nfserr_badslot cpu_to_be32(NFS4ERR_BADSLOT)
259#define nfserr_complete_already cpu_to_be32(NFS4ERR_COMPLETE_ALREADY)
260#define nfserr_conn_not_bound_to_session cpu_to_be32(NFS4ERR_CONN_NOT_BOUND_TO_SESSION)
261#define nfserr_deleg_already_wanted cpu_to_be32(NFS4ERR_DELEG_ALREADY_WANTED)
262#define nfserr_back_chan_busy cpu_to_be32(NFS4ERR_BACK_CHAN_BUSY)
263#define nfserr_layouttrylater cpu_to_be32(NFS4ERR_LAYOUTTRYLATER)
264#define nfserr_layoutunavailable cpu_to_be32(NFS4ERR_LAYOUTUNAVAILABLE)
265#define nfserr_nomatching_layout cpu_to_be32(NFS4ERR_NOMATCHING_LAYOUT)
266#define nfserr_recallconflict cpu_to_be32(NFS4ERR_RECALLCONFLICT)
267#define nfserr_unknown_layouttype cpu_to_be32(NFS4ERR_UNKNOWN_LAYOUTTYPE)
268#define nfserr_seq_misordered cpu_to_be32(NFS4ERR_SEQ_MISORDERED)
269#define nfserr_sequence_pos cpu_to_be32(NFS4ERR_SEQUENCE_POS)
270#define nfserr_req_too_big cpu_to_be32(NFS4ERR_REQ_TOO_BIG)
271#define nfserr_rep_too_big cpu_to_be32(NFS4ERR_REP_TOO_BIG)
272#define nfserr_rep_too_big_to_cache cpu_to_be32(NFS4ERR_REP_TOO_BIG_TO_CACHE)
273#define nfserr_retry_uncached_rep cpu_to_be32(NFS4ERR_RETRY_UNCACHED_REP)
274#define nfserr_unsafe_compound cpu_to_be32(NFS4ERR_UNSAFE_COMPOUND)
275#define nfserr_too_many_ops cpu_to_be32(NFS4ERR_TOO_MANY_OPS)
276#define nfserr_op_not_in_session cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION)
277#define nfserr_hash_alg_unsupp cpu_to_be32(NFS4ERR_HASH_ALG_UNSUPP)
278#define nfserr_clientid_busy cpu_to_be32(NFS4ERR_CLIENTID_BUSY)
279#define nfserr_pnfs_io_hole cpu_to_be32(NFS4ERR_PNFS_IO_HOLE)
280#define nfserr_seq_false_retry cpu_to_be32(NFS4ERR_SEQ_FALSE_RETRY)
281#define nfserr_bad_high_slot cpu_to_be32(NFS4ERR_BAD_HIGH_SLOT)
282#define nfserr_deadsession cpu_to_be32(NFS4ERR_DEADSESSION)
283#define nfserr_encr_alg_unsupp cpu_to_be32(NFS4ERR_ENCR_ALG_UNSUPP)
284#define nfserr_pnfs_no_layout cpu_to_be32(NFS4ERR_PNFS_NO_LAYOUT)
285#define nfserr_not_only_op cpu_to_be32(NFS4ERR_NOT_ONLY_OP)
286#define nfserr_wrong_cred cpu_to_be32(NFS4ERR_WRONG_CRED)
287#define nfserr_wrong_type cpu_to_be32(NFS4ERR_WRONG_TYPE)
288#define nfserr_dirdeleg_unavail cpu_to_be32(NFS4ERR_DIRDELEG_UNAVAIL)
289#define nfserr_reject_deleg cpu_to_be32(NFS4ERR_REJECT_DELEG)
290#define nfserr_returnconflict cpu_to_be32(NFS4ERR_RETURNCONFLICT)
291#define nfserr_deleg_revoked cpu_to_be32(NFS4ERR_DELEG_REVOKED)
253 292
254/* error codes for internal use */ 293/* error codes for internal use */
255/* if a request fails due to kmalloc failure, it gets dropped. 294/* if a request fails due to kmalloc failure, it gets dropped.
256 * Client should resend eventually 295 * Client should resend eventually
257 */ 296 */
258#define nfserr_dropit __constant_htonl(30000) 297#define nfserr_dropit cpu_to_be32(30000)
259/* end-of-file indicator in readdir */ 298/* end-of-file indicator in readdir */
260#define nfserr_eof __constant_htonl(30001) 299#define nfserr_eof cpu_to_be32(30001)
300/* replay detected */
301#define nfserr_replay_me cpu_to_be32(11001)
302/* nfs41 replay detected */
303#define nfserr_replay_cache cpu_to_be32(11002)
261 304
262/* Check for dir entries '.' and '..' */ 305/* Check for dir entries '.' and '..' */
263#define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) 306#define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.'))
@@ -300,7 +343,7 @@ extern struct timeval nfssvc_boot;
300 * TIME_BACKUP (unlikely to be supported any time soon) 343 * TIME_BACKUP (unlikely to be supported any time soon)
301 * TIME_CREATE (unlikely to be supported any time soon) 344 * TIME_CREATE (unlikely to be supported any time soon)
302 */ 345 */
303#define NFSD_SUPPORTED_ATTRS_WORD0 \ 346#define NFSD4_SUPPORTED_ATTRS_WORD0 \
304(FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \ 347(FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \
305 | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \ 348 | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \
306 | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \ 349 | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \
@@ -312,7 +355,7 @@ extern struct timeval nfssvc_boot;
312 | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \ 355 | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \
313 | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL) 356 | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL)
314 357
315#define NFSD_SUPPORTED_ATTRS_WORD1 \ 358#define NFSD4_SUPPORTED_ATTRS_WORD1 \
316(FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \ 359(FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \
317 | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \ 360 | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \
318 | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \ 361 | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \
@@ -320,6 +363,35 @@ extern struct timeval nfssvc_boot;
320 | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ 363 | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \
321 | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID) 364 | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID)
322 365
366#define NFSD4_SUPPORTED_ATTRS_WORD2 0
367
368#define NFSD4_1_SUPPORTED_ATTRS_WORD0 \
369 NFSD4_SUPPORTED_ATTRS_WORD0
370
371#define NFSD4_1_SUPPORTED_ATTRS_WORD1 \
372 NFSD4_SUPPORTED_ATTRS_WORD1
373
374#define NFSD4_1_SUPPORTED_ATTRS_WORD2 \
375 (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT)
376
377static inline u32 nfsd_suppattrs0(u32 minorversion)
378{
379 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0
380 : NFSD4_SUPPORTED_ATTRS_WORD0;
381}
382
383static inline u32 nfsd_suppattrs1(u32 minorversion)
384{
385 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD1
386 : NFSD4_SUPPORTED_ATTRS_WORD1;
387}
388
389static inline u32 nfsd_suppattrs2(u32 minorversion)
390{
391 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD2
392 : NFSD4_SUPPORTED_ATTRS_WORD2;
393}
394
323/* These will return ERR_INVAL if specified in GETATTR or READDIR. */ 395/* These will return ERR_INVAL if specified in GETATTR or READDIR. */
324#define NFSD_WRITEONLY_ATTRS_WORD1 \ 396#define NFSD_WRITEONLY_ATTRS_WORD1 \
325(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) 397(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
@@ -330,6 +402,19 @@ extern struct timeval nfssvc_boot;
330#define NFSD_WRITEABLE_ATTRS_WORD1 \ 402#define NFSD_WRITEABLE_ATTRS_WORD1 \
331(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ 403(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \
332 | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) 404 | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
405#define NFSD_WRITEABLE_ATTRS_WORD2 0
406
407#define NFSD_SUPPATTR_EXCLCREAT_WORD0 \
408 NFSD_WRITEABLE_ATTRS_WORD0
409/*
410 * we currently store the exclusive create verifier in the v_{a,m}time
411 * attributes so the client can't set these at create time using EXCLUSIVE4_1
412 */
413#define NFSD_SUPPATTR_EXCLCREAT_WORD1 \
414 (NFSD_WRITEABLE_ATTRS_WORD1 & \
415 ~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET))
416#define NFSD_SUPPATTR_EXCLCREAT_WORD2 \
417 NFSD_WRITEABLE_ATTRS_WORD2
333 418
334#endif /* CONFIG_NFSD_V4 */ 419#endif /* CONFIG_NFSD_V4 */
335 420
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index fa317f6c154b..afa19016c4a8 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -269,6 +269,13 @@ fh_copy(struct svc_fh *dst, struct svc_fh *src)
269 return dst; 269 return dst;
270} 270}
271 271
272static inline void
273fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src)
274{
275 dst->fh_size = src->fh_size;
276 memcpy(&dst->fh_base, &src->fh_base, src->fh_size);
277}
278
272static __inline__ struct svc_fh * 279static __inline__ struct svc_fh *
273fh_init(struct svc_fh *fhp, int maxsize) 280fh_init(struct svc_fh *fhp, int maxsize)
274{ 281{
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 128298c0362d..4d61c873feed 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -66,8 +66,7 @@ struct nfs4_cb_recall {
66 u32 cbr_ident; 66 u32 cbr_ident;
67 int cbr_trunc; 67 int cbr_trunc;
68 stateid_t cbr_stateid; 68 stateid_t cbr_stateid;
69 u32 cbr_fhlen; 69 struct knfsd_fh cbr_fh;
70 char cbr_fhval[NFS4_FHSIZE];
71 struct nfs4_delegation *cbr_dp; 70 struct nfs4_delegation *cbr_dp;
72}; 71};
73 72
@@ -86,8 +85,7 @@ struct nfs4_delegation {
86}; 85};
87 86
88#define dl_stateid dl_recall.cbr_stateid 87#define dl_stateid dl_recall.cbr_stateid
89#define dl_fhlen dl_recall.cbr_fhlen 88#define dl_fh dl_recall.cbr_fh
90#define dl_fhval dl_recall.cbr_fhval
91 89
92/* client delegation callback info */ 90/* client delegation callback info */
93struct nfs4_callback { 91struct nfs4_callback {
@@ -101,6 +99,64 @@ struct nfs4_callback {
101 struct rpc_clnt * cb_client; 99 struct rpc_clnt * cb_client;
102}; 100};
103 101
102/* Maximum number of slots per session. 128 is useful for long haul TCP */
103#define NFSD_MAX_SLOTS_PER_SESSION 128
104/* Maximum number of pages per slot cache entry */
105#define NFSD_PAGES_PER_SLOT 1
106/* Maximum number of operations per session compound */
107#define NFSD_MAX_OPS_PER_COMPOUND 16
108
109struct nfsd4_cache_entry {
110 __be32 ce_status;
111 struct kvec ce_datav; /* encoded NFSv4.1 data in rq_res.head[0] */
112 struct page *ce_respages[NFSD_PAGES_PER_SLOT + 1];
113 int ce_cachethis;
114 short ce_resused;
115 int ce_opcnt;
116 int ce_rpchdrlen;
117};
118
119struct nfsd4_slot {
120 bool sl_inuse;
121 u32 sl_seqid;
122 struct nfsd4_cache_entry sl_cache_entry;
123};
124
125struct nfsd4_session {
126 struct kref se_ref;
127 struct list_head se_hash; /* hash by sessionid */
128 struct list_head se_perclnt;
129 u32 se_flags;
130 struct nfs4_client *se_client; /* for expire_client */
131 struct nfs4_sessionid se_sessionid;
132 u32 se_fmaxreq_sz;
133 u32 se_fmaxresp_sz;
134 u32 se_fmaxresp_cached;
135 u32 se_fmaxops;
136 u32 se_fnumslots;
137 struct nfsd4_slot se_slots[]; /* forward channel slots */
138};
139
140static inline void
141nfsd4_put_session(struct nfsd4_session *ses)
142{
143 extern void free_session(struct kref *kref);
144 kref_put(&ses->se_ref, free_session);
145}
146
147static inline void
148nfsd4_get_session(struct nfsd4_session *ses)
149{
150 kref_get(&ses->se_ref);
151}
152
153/* formatted contents of nfs4_sessionid */
154struct nfsd4_sessionid {
155 clientid_t clientid;
156 u32 sequence;
157 u32 reserved;
158};
159
104#define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ 160#define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */
105 161
106/* 162/*
@@ -132,6 +188,12 @@ struct nfs4_client {
132 struct nfs4_callback cl_callback; /* callback info */ 188 struct nfs4_callback cl_callback; /* callback info */
133 atomic_t cl_count; /* ref count */ 189 atomic_t cl_count; /* ref count */
134 u32 cl_firststate; /* recovery dir creation */ 190 u32 cl_firststate; /* recovery dir creation */
191
192 /* for nfs41 */
193 struct list_head cl_sessions;
194 struct nfsd4_slot cl_slot; /* create_session slot */
195 u32 cl_exchange_flags;
196 struct nfs4_sessionid cl_sessionid;
135}; 197};
136 198
137/* struct nfs4_client_reset 199/* struct nfs4_client_reset
@@ -168,8 +230,7 @@ struct nfs4_replay {
168 unsigned int rp_buflen; 230 unsigned int rp_buflen;
169 char *rp_buf; 231 char *rp_buf;
170 unsigned intrp_allocated; 232 unsigned intrp_allocated;
171 int rp_openfh_len; 233 struct knfsd_fh rp_openfh;
172 char rp_openfh[NFS4_FHSIZE];
173 char rp_ibuf[NFSD4_REPLAY_ISIZE]; 234 char rp_ibuf[NFSD4_REPLAY_ISIZE];
174}; 235};
175 236
@@ -217,7 +278,7 @@ struct nfs4_stateowner {
217* share_acces, share_deny on the file. 278* share_acces, share_deny on the file.
218*/ 279*/
219struct nfs4_file { 280struct nfs4_file {
220 struct kref fi_ref; 281 atomic_t fi_ref;
221 struct list_head fi_hash; /* hash by "struct inode *" */ 282 struct list_head fi_hash; /* hash by "struct inode *" */
222 struct list_head fi_stateids; 283 struct list_head fi_stateids;
223 struct list_head fi_delegations; 284 struct list_head fi_delegations;
@@ -259,14 +320,13 @@ struct nfs4_stateid {
259}; 320};
260 321
261/* flags for preprocess_seqid_op() */ 322/* flags for preprocess_seqid_op() */
262#define CHECK_FH 0x00000001 323#define HAS_SESSION 0x00000001
263#define CONFIRM 0x00000002 324#define CONFIRM 0x00000002
264#define OPEN_STATE 0x00000004 325#define OPEN_STATE 0x00000004
265#define LOCK_STATE 0x00000008 326#define LOCK_STATE 0x00000008
266#define RD_STATE 0x00000010 327#define RD_STATE 0x00000010
267#define WR_STATE 0x00000020 328#define WR_STATE 0x00000020
268#define CLOSE_STATE 0x00000040 329#define CLOSE_STATE 0x00000040
269#define DELEG_RET 0x00000080
270 330
271#define seqid_mutating_err(err) \ 331#define seqid_mutating_err(err) \
272 (((err) != nfserr_stale_clientid) && \ 332 (((err) != nfserr_stale_clientid) && \
@@ -274,7 +334,9 @@ struct nfs4_stateid {
274 ((err) != nfserr_stale_stateid) && \ 334 ((err) != nfserr_stale_stateid) && \
275 ((err) != nfserr_bad_stateid)) 335 ((err) != nfserr_bad_stateid))
276 336
277extern __be32 nfs4_preprocess_stateid_op(struct svc_fh *current_fh, 337struct nfsd4_compound_state;
338
339extern __be32 nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
278 stateid_t *stateid, int flags, struct file **filp); 340 stateid_t *stateid, int flags, struct file **filp);
279extern void nfs4_lock_state(void); 341extern void nfs4_lock_state(void);
280extern void nfs4_unlock_state(void); 342extern void nfs4_unlock_state(void);
@@ -290,7 +352,7 @@ extern void nfsd4_init_recdir(char *recdir_name);
290extern int nfsd4_recdir_load(void); 352extern int nfsd4_recdir_load(void);
291extern void nfsd4_shutdown_recdir(void); 353extern void nfsd4_shutdown_recdir(void);
292extern int nfs4_client_to_reclaim(const char *name); 354extern int nfs4_client_to_reclaim(const char *name);
293extern int nfs4_has_reclaimed_state(const char *name); 355extern int nfs4_has_reclaimed_state(const char *name, bool use_exchange_id);
294extern void nfsd4_recdir_purge_old(void); 356extern void nfsd4_recdir_purge_old(void);
295extern int nfsd4_create_clid_dir(struct nfs4_client *clp); 357extern int nfsd4_create_clid_dir(struct nfs4_client *clp);
296extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); 358extern void nfsd4_remove_clid_dir(struct nfs4_client *clp);
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h
index 7678cfbe9960..2693ef647df6 100644
--- a/include/linux/nfsd/stats.h
+++ b/include/linux/nfsd/stats.h
@@ -11,6 +11,11 @@
11 11
12#include <linux/nfs4.h> 12#include <linux/nfs4.h>
13 13
14/* thread usage wraps very million seconds (approx one fortnight) */
15#define NFSD_USAGE_WRAP (HZ*1000000)
16
17#ifdef __KERNEL__
18
14struct nfsd_stats { 19struct nfsd_stats {
15 unsigned int rchits; /* repcache hits */ 20 unsigned int rchits; /* repcache hits */
16 unsigned int rcmisses; /* repcache hits */ 21 unsigned int rcmisses; /* repcache hits */
@@ -35,10 +40,6 @@ struct nfsd_stats {
35 40
36}; 41};
37 42
38/* thread usage wraps very million seconds (approx one fortnight) */
39#define NFSD_USAGE_WRAP (HZ*1000000)
40
41#ifdef __KERNEL__
42 43
43extern struct nfsd_stats nfsdstats; 44extern struct nfsd_stats nfsdstats;
44extern struct svc_stat nfsd_svcstats; 45extern struct svc_stat nfsd_svcstats;
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 27bd3e38ec5a..f80d6013fdc3 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -45,10 +45,22 @@
45#define XDR_LEN(n) (((n) + 3) & ~3) 45#define XDR_LEN(n) (((n) + 3) & ~3)
46 46
47struct nfsd4_compound_state { 47struct nfsd4_compound_state {
48 struct svc_fh current_fh; 48 struct svc_fh current_fh;
49 struct svc_fh save_fh; 49 struct svc_fh save_fh;
50 struct nfs4_stateowner *replay_owner; 50 struct nfs4_stateowner *replay_owner;
51}; 51 /* For sessions DRC */
52 struct nfsd4_session *session;
53 struct nfsd4_slot *slot;
54 __be32 *statp;
55 size_t iovlen;
56 u32 minorversion;
57 u32 status;
58};
59
60static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
61{
62 return cs->slot != NULL;
63}
52 64
53struct nfsd4_change_info { 65struct nfsd4_change_info {
54 u32 atomic; 66 u32 atomic;
@@ -90,7 +102,7 @@ struct nfsd4_create {
90 u32 specdata2; 102 u32 specdata2;
91 } dev; /* NF4BLK, NF4CHR */ 103 } dev; /* NF4BLK, NF4CHR */
92 } u; 104 } u;
93 u32 cr_bmval[2]; /* request */ 105 u32 cr_bmval[3]; /* request */
94 struct iattr cr_iattr; /* request */ 106 struct iattr cr_iattr; /* request */
95 struct nfsd4_change_info cr_cinfo; /* response */ 107 struct nfsd4_change_info cr_cinfo; /* response */
96 struct nfs4_acl *cr_acl; 108 struct nfs4_acl *cr_acl;
@@ -105,7 +117,7 @@ struct nfsd4_delegreturn {
105}; 117};
106 118
107struct nfsd4_getattr { 119struct nfsd4_getattr {
108 u32 ga_bmval[2]; /* request */ 120 u32 ga_bmval[3]; /* request */
109 struct svc_fh *ga_fhp; /* response */ 121 struct svc_fh *ga_fhp; /* response */
110}; 122};
111 123
@@ -206,11 +218,9 @@ struct nfsd4_open {
206 stateid_t op_delegate_stateid; /* request - response */ 218 stateid_t op_delegate_stateid; /* request - response */
207 u32 op_create; /* request */ 219 u32 op_create; /* request */
208 u32 op_createmode; /* request */ 220 u32 op_createmode; /* request */
209 u32 op_bmval[2]; /* request */ 221 u32 op_bmval[3]; /* request */
210 union { /* request */ 222 struct iattr iattr; /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */
211 struct iattr iattr; /* UNCHECKED4,GUARDED4 */ 223 nfs4_verifier verf; /* EXCLUSIVE4 */
212 nfs4_verifier verf; /* EXCLUSIVE4 */
213 } u;
214 clientid_t op_clientid; /* request */ 224 clientid_t op_clientid; /* request */
215 struct xdr_netobj op_owner; /* request */ 225 struct xdr_netobj op_owner; /* request */
216 u32 op_seqid; /* request */ 226 u32 op_seqid; /* request */
@@ -224,8 +234,8 @@ struct nfsd4_open {
224 struct nfs4_stateowner *op_stateowner; /* used during processing */ 234 struct nfs4_stateowner *op_stateowner; /* used during processing */
225 struct nfs4_acl *op_acl; 235 struct nfs4_acl *op_acl;
226}; 236};
227#define op_iattr u.iattr 237#define op_iattr iattr
228#define op_verf u.verf 238#define op_verf verf
229 239
230struct nfsd4_open_confirm { 240struct nfsd4_open_confirm {
231 stateid_t oc_req_stateid /* request */; 241 stateid_t oc_req_stateid /* request */;
@@ -259,7 +269,7 @@ struct nfsd4_readdir {
259 nfs4_verifier rd_verf; /* request */ 269 nfs4_verifier rd_verf; /* request */
260 u32 rd_dircount; /* request */ 270 u32 rd_dircount; /* request */
261 u32 rd_maxcount; /* request */ 271 u32 rd_maxcount; /* request */
262 u32 rd_bmval[2]; /* request */ 272 u32 rd_bmval[3]; /* request */
263 struct svc_rqst *rd_rqstp; /* response */ 273 struct svc_rqst *rd_rqstp; /* response */
264 struct svc_fh * rd_fhp; /* response */ 274 struct svc_fh * rd_fhp; /* response */
265 275
@@ -301,7 +311,7 @@ struct nfsd4_secinfo {
301 311
302struct nfsd4_setattr { 312struct nfsd4_setattr {
303 stateid_t sa_stateid; /* request */ 313 stateid_t sa_stateid; /* request */
304 u32 sa_bmval[2]; /* request */ 314 u32 sa_bmval[3]; /* request */
305 struct iattr sa_iattr; /* request */ 315 struct iattr sa_iattr; /* request */
306 struct nfs4_acl *sa_acl; 316 struct nfs4_acl *sa_acl;
307}; 317};
@@ -327,7 +337,7 @@ struct nfsd4_setclientid_confirm {
327 337
328/* also used for NVERIFY */ 338/* also used for NVERIFY */
329struct nfsd4_verify { 339struct nfsd4_verify {
330 u32 ve_bmval[2]; /* request */ 340 u32 ve_bmval[3]; /* request */
331 u32 ve_attrlen; /* request */ 341 u32 ve_attrlen; /* request */
332 char * ve_attrval; /* request */ 342 char * ve_attrval; /* request */
333}; 343};
@@ -344,6 +354,54 @@ struct nfsd4_write {
344 nfs4_verifier wr_verifier; /* response */ 354 nfs4_verifier wr_verifier; /* response */
345}; 355};
346 356
357struct nfsd4_exchange_id {
358 nfs4_verifier verifier;
359 struct xdr_netobj clname;
360 u32 flags;
361 clientid_t clientid;
362 u32 seqid;
363 int spa_how;
364};
365
366struct nfsd4_channel_attrs {
367 u32 headerpadsz;
368 u32 maxreq_sz;
369 u32 maxresp_sz;
370 u32 maxresp_cached;
371 u32 maxops;
372 u32 maxreqs;
373 u32 nr_rdma_attrs;
374 u32 rdma_attrs;
375};
376
377struct nfsd4_create_session {
378 clientid_t clientid;
379 struct nfs4_sessionid sessionid;
380 u32 seqid;
381 u32 flags;
382 struct nfsd4_channel_attrs fore_channel;
383 struct nfsd4_channel_attrs back_channel;
384 u32 callback_prog;
385 u32 uid;
386 u32 gid;
387};
388
389struct nfsd4_sequence {
390 struct nfs4_sessionid sessionid; /* request/response */
391 u32 seqid; /* request/response */
392 u32 slotid; /* request/response */
393 u32 maxslots; /* request/response */
394 u32 cachethis; /* request */
395#if 0
396 u32 target_maxslots; /* response */
397 u32 status_flags; /* response */
398#endif /* not yet */
399};
400
401struct nfsd4_destroy_session {
402 struct nfs4_sessionid sessionid;
403};
404
347struct nfsd4_op { 405struct nfsd4_op {
348 int opnum; 406 int opnum;
349 __be32 status; 407 __be32 status;
@@ -378,6 +436,12 @@ struct nfsd4_op {
378 struct nfsd4_verify verify; 436 struct nfsd4_verify verify;
379 struct nfsd4_write write; 437 struct nfsd4_write write;
380 struct nfsd4_release_lockowner release_lockowner; 438 struct nfsd4_release_lockowner release_lockowner;
439
440 /* NFSv4.1 */
441 struct nfsd4_exchange_id exchange_id;
442 struct nfsd4_create_session create_session;
443 struct nfsd4_destroy_session destroy_session;
444 struct nfsd4_sequence sequence;
381 } u; 445 } u;
382 struct nfs4_replay * replay; 446 struct nfs4_replay * replay;
383}; 447};
@@ -416,9 +480,22 @@ struct nfsd4_compoundres {
416 u32 taglen; 480 u32 taglen;
417 char * tag; 481 char * tag;
418 u32 opcnt; 482 u32 opcnt;
419 __be32 * tagp; /* where to encode tag and opcount */ 483 __be32 * tagp; /* tag, opcount encode location */
484 struct nfsd4_compound_state cstate;
420}; 485};
421 486
487static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
488{
489 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
490 return args->opcnt == 1;
491}
492
493static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
494{
495 return !resp->cstate.slot->sl_cache_entry.ce_cachethis ||
496 nfsd4_is_solo_sequence(resp);
497}
498
422#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) 499#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
423 500
424static inline void 501static inline void
@@ -448,7 +525,23 @@ extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
448extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp, 525extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
449 struct nfsd4_compound_state *, 526 struct nfsd4_compound_state *,
450 struct nfsd4_setclientid_confirm *setclientid_confirm); 527 struct nfsd4_setclientid_confirm *setclientid_confirm);
451extern __be32 nfsd4_process_open1(struct nfsd4_open *open); 528extern void nfsd4_store_cache_entry(struct nfsd4_compoundres *resp);
529extern __be32 nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp,
530 struct nfsd4_sequence *seq);
531extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp,
532 struct nfsd4_compound_state *,
533struct nfsd4_exchange_id *);
534 extern __be32 nfsd4_create_session(struct svc_rqst *,
535 struct nfsd4_compound_state *,
536 struct nfsd4_create_session *);
537extern __be32 nfsd4_sequence(struct svc_rqst *,
538 struct nfsd4_compound_state *,
539 struct nfsd4_sequence *);
540extern __be32 nfsd4_destroy_session(struct svc_rqst *,
541 struct nfsd4_compound_state *,
542 struct nfsd4_destroy_session *);
543extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *,
544 struct nfsd4_open *open);
452extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, 545extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
453 struct svc_fh *current_fh, struct nfsd4_open *open); 546 struct svc_fh *current_fh, struct nfsd4_open *open);
454extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp, 547extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
new file mode 100644
index 000000000000..79fec6af3f9f
--- /dev/null
+++ b/include/linux/nilfs2_fs.h
@@ -0,0 +1,801 @@
1/*
2 * nilfs2_fs.h - NILFS2 on-disk structures and common declarations.
3 *
4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Written by Koji Sato <koji@osrg.net>
21 * Ryusuke Konishi <ryusuke@osrg.net>
22 */
23/*
24 * linux/include/linux/ext2_fs.h
25 *
26 * Copyright (C) 1992, 1993, 1994, 1995
27 * Remy Card (card@masi.ibp.fr)
28 * Laboratoire MASI - Institut Blaise Pascal
29 * Universite Pierre et Marie Curie (Paris VI)
30 *
31 * from
32 *
33 * linux/include/linux/minix_fs.h
34 *
35 * Copyright (C) 1991, 1992 Linus Torvalds
36 */
37
38#ifndef _LINUX_NILFS_FS_H
39#define _LINUX_NILFS_FS_H
40
41#include <linux/types.h>
42#include <linux/ioctl.h>
43
44/*
45 * Inode flags stored in nilfs_inode and on-memory nilfs inode
46 *
47 * We define these flags based on ext2-fs because of the
48 * compatibility reason; to avoid problems in chattr(1)
49 */
50#define NILFS_SECRM_FL 0x00000001 /* Secure deletion */
51#define NILFS_UNRM_FL 0x00000002 /* Undelete */
52#define NILFS_SYNC_FL 0x00000008 /* Synchronous updates */
53#define NILFS_IMMUTABLE_FL 0x00000010 /* Immutable file */
54#define NILFS_APPEND_FL 0x00000020 /* writes to file may only append */
55#define NILFS_NODUMP_FL 0x00000040 /* do not dump file */
56#define NILFS_NOATIME_FL 0x00000080 /* do not update atime */
57/* Reserved for compression usage... */
58#define NILFS_NOTAIL_FL 0x00008000 /* file tail should not be merged */
59#define NILFS_DIRSYNC_FL 0x00010000 /* dirsync behaviour */
60
61#define NILFS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
62#define NILFS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
63
64
65#define NILFS_INODE_BMAP_SIZE 7
66/**
67 * struct nilfs_inode - structure of an inode on disk
68 * @i_blocks: blocks count
69 * @i_size: size in bytes
70 * @i_ctime: creation time (seconds)
71 * @i_mtime: modification time (seconds)
72 * @i_ctime_nsec: creation time (nano seconds)
73 * @i_mtime_nsec: modification time (nano seconds)
74 * @i_uid: user id
75 * @i_gid: group id
76 * @i_mode: file mode
77 * @i_links_count: links count
78 * @i_flags: file flags
79 * @i_bmap: block mapping
80 * @i_xattr: extended attributes
81 * @i_generation: file generation (for NFS)
82 * @i_pad: padding
83 */
84struct nilfs_inode {
85 __le64 i_blocks;
86 __le64 i_size;
87 __le64 i_ctime;
88 __le64 i_mtime;
89 __le32 i_ctime_nsec;
90 __le32 i_mtime_nsec;
91 __le32 i_uid;
92 __le32 i_gid;
93 __le16 i_mode;
94 __le16 i_links_count;
95 __le32 i_flags;
96 __le64 i_bmap[NILFS_INODE_BMAP_SIZE];
97#define i_device_code i_bmap[0]
98 __le64 i_xattr;
99 __le32 i_generation;
100 __le32 i_pad;
101};
102
103/**
104 * struct nilfs_super_root - structure of super root
105 * @sr_sum: check sum
106 * @sr_bytes: byte count of the structure
107 * @sr_flags: flags (reserved)
108 * @sr_nongc_ctime: write time of the last segment not for cleaner operation
109 * @sr_dat: DAT file inode
110 * @sr_cpfile: checkpoint file inode
111 * @sr_sufile: segment usage file inode
112 */
113struct nilfs_super_root {
114 __le32 sr_sum;
115 __le16 sr_bytes;
116 __le16 sr_flags;
117 __le64 sr_nongc_ctime;
118 struct nilfs_inode sr_dat;
119 struct nilfs_inode sr_cpfile;
120 struct nilfs_inode sr_sufile;
121};
122
123#define NILFS_SR_MDT_OFFSET(inode_size, i) \
124 ((unsigned long)&((struct nilfs_super_root *)0)->sr_dat + \
125 (inode_size) * (i))
126#define NILFS_SR_DAT_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 0)
127#define NILFS_SR_CPFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 1)
128#define NILFS_SR_SUFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 2)
129#define NILFS_SR_BYTES (sizeof(struct nilfs_super_root))
130
131/*
132 * Maximal mount counts
133 */
134#define NILFS_DFL_MAX_MNT_COUNT 50 /* 50 mounts */
135
136/*
137 * File system states (sbp->s_state, nilfs->ns_mount_state)
138 */
139#define NILFS_VALID_FS 0x0001 /* Unmounted cleanly */
140#define NILFS_ERROR_FS 0x0002 /* Errors detected */
141#define NILFS_RESIZE_FS 0x0004 /* Resize required */
142
143/*
144 * Mount flags (sbi->s_mount_opt)
145 */
146#define NILFS_MOUNT_ERROR_MODE 0x0070 /* Error mode mask */
147#define NILFS_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */
148#define NILFS_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */
149#define NILFS_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
150#define NILFS_MOUNT_SNAPSHOT 0x0080 /* Snapshot flag */
151#define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */
152#define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order
153 semantics also for data */
154
155
156/**
157 * struct nilfs_super_block - structure of super block on disk
158 */
159struct nilfs_super_block {
160 __le32 s_rev_level; /* Revision level */
161 __le16 s_minor_rev_level; /* minor revision level */
162 __le16 s_magic; /* Magic signature */
163
164 __le16 s_bytes; /* Bytes count of CRC calculation
165 for this structure. s_reserved
166 is excluded. */
167 __le16 s_flags; /* flags */
168 __le32 s_crc_seed; /* Seed value of CRC calculation */
169 __le32 s_sum; /* Check sum of super block */
170
171 __le32 s_log_block_size; /* Block size represented as follows
172 blocksize =
173 1 << (s_log_block_size + 10) */
174 __le64 s_nsegments; /* Number of segments in filesystem */
175 __le64 s_dev_size; /* block device size in bytes */
176 __le64 s_first_data_block; /* 1st seg disk block number */
177 __le32 s_blocks_per_segment; /* number of blocks per full segment */
178 __le32 s_r_segments_percentage; /* Reserved segments percentage */
179
180 __le64 s_last_cno; /* Last checkpoint number */
181 __le64 s_last_pseg; /* disk block addr pseg written last */
182 __le64 s_last_seq; /* seq. number of seg written last */
183 __le64 s_free_blocks_count; /* Free blocks count */
184
185 __le64 s_ctime; /* Creation time (execution time of
186 newfs) */
187 __le64 s_mtime; /* Mount time */
188 __le64 s_wtime; /* Write time */
189 __le16 s_mnt_count; /* Mount count */
190 __le16 s_max_mnt_count; /* Maximal mount count */
191 __le16 s_state; /* File system state */
192 __le16 s_errors; /* Behaviour when detecting errors */
193 __le64 s_lastcheck; /* time of last check */
194
195 __le32 s_checkinterval; /* max. time between checks */
196 __le32 s_creator_os; /* OS */
197 __le16 s_def_resuid; /* Default uid for reserved blocks */
198 __le16 s_def_resgid; /* Default gid for reserved blocks */
199 __le32 s_first_ino; /* First non-reserved inode */
200
201 __le16 s_inode_size; /* Size of an inode */
202 __le16 s_dat_entry_size; /* Size of a dat entry */
203 __le16 s_checkpoint_size; /* Size of a checkpoint */
204 __le16 s_segment_usage_size; /* Size of a segment usage */
205
206 __u8 s_uuid[16]; /* 128-bit uuid for volume */
207 char s_volume_name[16]; /* volume name */
208 char s_last_mounted[64]; /* directory where last mounted */
209
210 __le32 s_c_interval; /* Commit interval of segment */
211 __le32 s_c_block_max; /* Threshold of data amount for
212 the segment construction */
213 __u32 s_reserved[192]; /* padding to the end of the block */
214};
215
216/*
217 * Codes for operating systems
218 */
219#define NILFS_OS_LINUX 0
220/* Codes from 1 to 4 are reserved to keep compatibility with ext2 creator-OS */
221
222/*
223 * Revision levels
224 */
225#define NILFS_CURRENT_REV 2 /* current major revision */
226#define NILFS_MINOR_REV 0 /* minor revision */
227
228/*
229 * Bytes count of super_block for CRC-calculation
230 */
231#define NILFS_SB_BYTES \
232 ((long)&((struct nilfs_super_block *)0)->s_reserved)
233
234/*
235 * Special inode number
236 */
237#define NILFS_ROOT_INO 2 /* Root file inode */
238#define NILFS_DAT_INO 3 /* DAT file */
239#define NILFS_CPFILE_INO 4 /* checkpoint file */
240#define NILFS_SUFILE_INO 5 /* segment usage file */
241#define NILFS_IFILE_INO 6 /* ifile */
242#define NILFS_ATIME_INO 7 /* Atime file (reserved) */
243#define NILFS_XATTR_INO 8 /* Xattribute file (reserved) */
244#define NILFS_SKETCH_INO 10 /* Sketch file */
245#define NILFS_USER_INO 11 /* Fisrt user's file inode number */
246
247#define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */
248#define NILFS_SUPER_MAGIC 0x3434 /* NILFS filesystem magic number */
249
250#define NILFS_SEG_MIN_BLOCKS 16 /* Minimum number of blocks in
251 a full segment */
252#define NILFS_PSEG_MIN_BLOCKS 2 /* Minimum number of blocks in
253 a partial segment */
254#define NILFS_MIN_NRSVSEGS 8 /* Minimum number of reserved
255 segments */
256
257/*
258 * bytes offset of secondary super block
259 */
260#define NILFS_SB2_OFFSET_BYTES(devsize) ((((devsize) >> 12) - 1) << 12)
261
262/*
263 * Maximal count of links to a file
264 */
265#define NILFS_LINK_MAX 32000
266
267/*
268 * Structure of a directory entry
269 * (Same as ext2)
270 */
271
272#define NILFS_NAME_LEN 255
273
274/*
275 * The new version of the directory entry. Since V0 structures are
276 * stored in intel byte order, and the name_len field could never be
277 * bigger than 255 chars, it's safe to reclaim the extra byte for the
278 * file_type field.
279 */
280struct nilfs_dir_entry {
281 __le64 inode; /* Inode number */
282 __le16 rec_len; /* Directory entry length */
283 __u8 name_len; /* Name length */
284 __u8 file_type;
285 char name[NILFS_NAME_LEN]; /* File name */
286 char pad;
287};
288
289/*
290 * NILFS directory file types. Only the low 3 bits are used. The
291 * other bits are reserved for now.
292 */
293enum {
294 NILFS_FT_UNKNOWN,
295 NILFS_FT_REG_FILE,
296 NILFS_FT_DIR,
297 NILFS_FT_CHRDEV,
298 NILFS_FT_BLKDEV,
299 NILFS_FT_FIFO,
300 NILFS_FT_SOCK,
301 NILFS_FT_SYMLINK,
302 NILFS_FT_MAX
303};
304
305/*
306 * NILFS_DIR_PAD defines the directory entries boundaries
307 *
308 * NOTE: It must be a multiple of 8
309 */
310#define NILFS_DIR_PAD 8
311#define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1)
312#define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \
313 ~NILFS_DIR_ROUND)
314
315
316/**
317 * struct nilfs_finfo - file information
318 * @fi_ino: inode number
319 * @fi_cno: checkpoint number
320 * @fi_nblocks: number of blocks (including intermediate blocks)
321 * @fi_ndatablk: number of file data blocks
322 */
323struct nilfs_finfo {
324 __le64 fi_ino;
325 __le64 fi_cno;
326 __le32 fi_nblocks;
327 __le32 fi_ndatablk;
328 /* array of virtual block numbers */
329};
330
331/**
332 * struct nilfs_binfo_v - information for the block to which a virtual block number is assigned
333 * @bi_vblocknr: virtual block number
334 * @bi_blkoff: block offset
335 */
336struct nilfs_binfo_v {
337 __le64 bi_vblocknr;
338 __le64 bi_blkoff;
339};
340
341/**
342 * struct nilfs_binfo_dat - information for the block which belongs to the DAT file
343 * @bi_blkoff: block offset
344 * @bi_level: level
345 * @bi_pad: padding
346 */
347struct nilfs_binfo_dat {
348 __le64 bi_blkoff;
349 __u8 bi_level;
350 __u8 bi_pad[7];
351};
352
353/**
354 * union nilfs_binfo: block information
355 * @bi_v: nilfs_binfo_v structure
356 * @bi_dat: nilfs_binfo_dat structure
357 */
358union nilfs_binfo {
359 struct nilfs_binfo_v bi_v;
360 struct nilfs_binfo_dat bi_dat;
361};
362
363/**
364 * struct nilfs_segment_summary - segment summary
365 * @ss_datasum: checksum of data
366 * @ss_sumsum: checksum of segment summary
367 * @ss_magic: magic number
368 * @ss_bytes: size of this structure in bytes
369 * @ss_flags: flags
370 * @ss_seq: sequence number
371 * @ss_create: creation timestamp
372 * @ss_next: next segment
373 * @ss_nblocks: number of blocks
374 * @ss_nfinfo: number of finfo structures
375 * @ss_sumbytes: total size of segment summary in bytes
376 * @ss_pad: padding
377 */
378struct nilfs_segment_summary {
379 __le32 ss_datasum;
380 __le32 ss_sumsum;
381 __le32 ss_magic;
382 __le16 ss_bytes;
383 __le16 ss_flags;
384 __le64 ss_seq;
385 __le64 ss_create;
386 __le64 ss_next;
387 __le32 ss_nblocks;
388 __le32 ss_nfinfo;
389 __le32 ss_sumbytes;
390 __le32 ss_pad;
391 /* array of finfo structures */
392};
393
394#define NILFS_SEGSUM_MAGIC 0x1eaffa11 /* segment summary magic number */
395
396/*
397 * Segment summary flags
398 */
399#define NILFS_SS_LOGBGN 0x0001 /* begins a logical segment */
400#define NILFS_SS_LOGEND 0x0002 /* ends a logical segment */
401#define NILFS_SS_SR 0x0004 /* has super root */
402#define NILFS_SS_SYNDT 0x0008 /* includes data only updates */
403#define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */
404
405/**
406 * struct nilfs_palloc_group_desc - block group descriptor
407 * @pg_nfrees: number of free entries in block group
408 */
409struct nilfs_palloc_group_desc {
410 __le32 pg_nfrees;
411};
412
413/**
414 * struct nilfs_dat_entry - disk address translation entry
415 * @dt_blocknr: block number
416 * @dt_start: start checkpoint number
417 * @dt_end: end checkpoint number
418 * @dt_rsv: reserved for future use
419 */
420struct nilfs_dat_entry {
421 __le64 de_blocknr;
422 __le64 de_start;
423 __le64 de_end;
424 __le64 de_rsv;
425};
426
427/**
428 * struct nilfs_dat_group_desc - block group descriptor
429 * @dg_nfrees: number of free virtual block numbers in block group
430 */
431struct nilfs_dat_group_desc {
432 __le32 dg_nfrees;
433};
434
435
436/**
437 * struct nilfs_snapshot_list - snapshot list
438 * @ssl_next: next checkpoint number on snapshot list
439 * @ssl_prev: previous checkpoint number on snapshot list
440 */
441struct nilfs_snapshot_list {
442 __le64 ssl_next;
443 __le64 ssl_prev;
444};
445
446/**
447 * struct nilfs_checkpoint - checkpoint structure
448 * @cp_flags: flags
449 * @cp_checkpoints_count: checkpoints count in a block
450 * @cp_snapshot_list: snapshot list
451 * @cp_cno: checkpoint number
452 * @cp_create: creation timestamp
453 * @cp_nblk_inc: number of blocks incremented by this checkpoint
454 * @cp_inodes_count: inodes count
455 * @cp_blocks_count: blocks count
456 * @cp_ifile_inode: inode of ifile
457 */
458struct nilfs_checkpoint {
459 __le32 cp_flags;
460 __le32 cp_checkpoints_count;
461 struct nilfs_snapshot_list cp_snapshot_list;
462 __le64 cp_cno;
463 __le64 cp_create;
464 __le64 cp_nblk_inc;
465 __le64 cp_inodes_count;
466 __le64 cp_blocks_count; /* Reserved (might be deleted) */
467
468 /* Do not change the byte offset of ifile inode.
469 To keep the compatibility of the disk format,
470 additional fields should be added behind cp_ifile_inode. */
471 struct nilfs_inode cp_ifile_inode;
472};
473
474/* checkpoint flags */
475enum {
476 NILFS_CHECKPOINT_SNAPSHOT,
477 NILFS_CHECKPOINT_INVALID,
478 NILFS_CHECKPOINT_SKETCH,
479 NILFS_CHECKPOINT_MINOR,
480};
481
482#define NILFS_CHECKPOINT_FNS(flag, name) \
483static inline void \
484nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \
485{ \
486 cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | \
487 (1UL << NILFS_CHECKPOINT_##flag)); \
488} \
489static inline void \
490nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \
491{ \
492 cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & \
493 ~(1UL << NILFS_CHECKPOINT_##flag)); \
494} \
495static inline int \
496nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \
497{ \
498 return !!(le32_to_cpu(cp->cp_flags) & \
499 (1UL << NILFS_CHECKPOINT_##flag)); \
500}
501
502NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot)
503NILFS_CHECKPOINT_FNS(INVALID, invalid)
504NILFS_CHECKPOINT_FNS(MINOR, minor)
505
506/**
507 * struct nilfs_cpinfo - checkpoint information
508 * @ci_flags: flags
509 * @ci_pad: padding
510 * @ci_cno: checkpoint number
511 * @ci_create: creation timestamp
512 * @ci_nblk_inc: number of blocks incremented by this checkpoint
513 * @ci_inodes_count: inodes count
514 * @ci_blocks_count: blocks count
515 * @ci_next: next checkpoint number in snapshot list
516 */
517struct nilfs_cpinfo {
518 __u32 ci_flags;
519 __u32 ci_pad;
520 __u64 ci_cno;
521 __u64 ci_create;
522 __u64 ci_nblk_inc;
523 __u64 ci_inodes_count;
524 __u64 ci_blocks_count;
525 __u64 ci_next;
526};
527
528#define NILFS_CPINFO_FNS(flag, name) \
529static inline int \
530nilfs_cpinfo_##name(const struct nilfs_cpinfo *cpinfo) \
531{ \
532 return !!(cpinfo->ci_flags & (1UL << NILFS_CHECKPOINT_##flag)); \
533}
534
535NILFS_CPINFO_FNS(SNAPSHOT, snapshot)
536NILFS_CPINFO_FNS(INVALID, invalid)
537NILFS_CPINFO_FNS(MINOR, minor)
538
539
540/**
541 * struct nilfs_cpfile_header - checkpoint file header
542 * @ch_ncheckpoints: number of checkpoints
543 * @ch_nsnapshots: number of snapshots
544 * @ch_snapshot_list: snapshot list
545 */
546struct nilfs_cpfile_header {
547 __le64 ch_ncheckpoints;
548 __le64 ch_nsnapshots;
549 struct nilfs_snapshot_list ch_snapshot_list;
550};
551
552#define NILFS_CPFILE_FIRST_CHECKPOINT_OFFSET \
553 ((sizeof(struct nilfs_cpfile_header) + \
554 sizeof(struct nilfs_checkpoint) - 1) / \
555 sizeof(struct nilfs_checkpoint))
556
557/**
558 * struct nilfs_segment_usage - segment usage
559 * @su_lastmod: last modified timestamp
560 * @su_nblocks: number of blocks in segment
561 * @su_flags: flags
562 */
563struct nilfs_segment_usage {
564 __le64 su_lastmod;
565 __le32 su_nblocks;
566 __le32 su_flags;
567};
568
569/* segment usage flag */
570enum {
571 NILFS_SEGMENT_USAGE_ACTIVE,
572 NILFS_SEGMENT_USAGE_DIRTY,
573 NILFS_SEGMENT_USAGE_ERROR,
574
575 /* ... */
576};
577
578#define NILFS_SEGMENT_USAGE_FNS(flag, name) \
579static inline void \
580nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su) \
581{ \
582 su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | \
583 (1UL << NILFS_SEGMENT_USAGE_##flag));\
584} \
585static inline void \
586nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su) \
587{ \
588 su->su_flags = \
589 cpu_to_le32(le32_to_cpu(su->su_flags) & \
590 ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \
591} \
592static inline int \
593nilfs_segment_usage_##name(const struct nilfs_segment_usage *su) \
594{ \
595 return !!(le32_to_cpu(su->su_flags) & \
596 (1UL << NILFS_SEGMENT_USAGE_##flag)); \
597}
598
599NILFS_SEGMENT_USAGE_FNS(ACTIVE, active)
600NILFS_SEGMENT_USAGE_FNS(DIRTY, dirty)
601NILFS_SEGMENT_USAGE_FNS(ERROR, error)
602
603static inline void
604nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su)
605{
606 su->su_lastmod = cpu_to_le64(0);
607 su->su_nblocks = cpu_to_le32(0);
608 su->su_flags = cpu_to_le32(0);
609}
610
611static inline int
612nilfs_segment_usage_clean(const struct nilfs_segment_usage *su)
613{
614 return !le32_to_cpu(su->su_flags);
615}
616
617/**
618 * struct nilfs_sufile_header - segment usage file header
619 * @sh_ncleansegs: number of clean segments
620 * @sh_ndirtysegs: number of dirty segments
621 * @sh_last_alloc: last allocated segment number
622 */
623struct nilfs_sufile_header {
624 __le64 sh_ncleansegs;
625 __le64 sh_ndirtysegs;
626 __le64 sh_last_alloc;
627 /* ... */
628};
629
630#define NILFS_SUFILE_FIRST_SEGMENT_USAGE_OFFSET \
631 ((sizeof(struct nilfs_sufile_header) + \
632 sizeof(struct nilfs_segment_usage) - 1) / \
633 sizeof(struct nilfs_segment_usage))
634
635/**
636 * nilfs_suinfo - segment usage information
637 * @sui_lastmod:
638 * @sui_nblocks:
639 * @sui_flags:
640 */
641struct nilfs_suinfo {
642 __u64 sui_lastmod;
643 __u32 sui_nblocks;
644 __u32 sui_flags;
645};
646
647#define NILFS_SUINFO_FNS(flag, name) \
648static inline int \
649nilfs_suinfo_##name(const struct nilfs_suinfo *si) \
650{ \
651 return si->sui_flags & (1UL << NILFS_SEGMENT_USAGE_##flag); \
652}
653
654NILFS_SUINFO_FNS(ACTIVE, active)
655NILFS_SUINFO_FNS(DIRTY, dirty)
656NILFS_SUINFO_FNS(ERROR, error)
657
658static inline int nilfs_suinfo_clean(const struct nilfs_suinfo *si)
659{
660 return !si->sui_flags;
661}
662
663/* ioctl */
664enum {
665 NILFS_CHECKPOINT,
666 NILFS_SNAPSHOT,
667};
668
669/**
670 * struct nilfs_cpmode -
671 * @cc_cno:
672 * @cc_mode:
673 */
674struct nilfs_cpmode {
675 __u64 cm_cno;
676 __u32 cm_mode;
677 __u32 cm_pad;
678};
679
680/**
681 * struct nilfs_argv - argument vector
682 * @v_base:
683 * @v_nmembs:
684 * @v_size:
685 * @v_flags:
686 * @v_index:
687 */
688struct nilfs_argv {
689 __u64 v_base;
690 __u32 v_nmembs; /* number of members */
691 __u16 v_size; /* size of members */
692 __u16 v_flags;
693 __u64 v_index;
694};
695
696/**
697 * struct nilfs_period -
698 * @p_start:
699 * @p_end:
700 */
701struct nilfs_period {
702 __u64 p_start;
703 __u64 p_end;
704};
705
706/**
707 * struct nilfs_cpstat -
708 * @cs_cno: checkpoint number
709 * @cs_ncps: number of checkpoints
710 * @cs_nsss: number of snapshots
711 */
712struct nilfs_cpstat {
713 __u64 cs_cno;
714 __u64 cs_ncps;
715 __u64 cs_nsss;
716};
717
718/**
719 * struct nilfs_sustat -
720 * @ss_nsegs: number of segments
721 * @ss_ncleansegs: number of clean segments
722 * @ss_ndirtysegs: number of dirty segments
723 * @ss_ctime: creation time of the last segment
724 * @ss_nongc_ctime: creation time of the last segment not for GC
725 * @ss_prot_seq: least sequence number of segments which must not be reclaimed
726 */
727struct nilfs_sustat {
728 __u64 ss_nsegs;
729 __u64 ss_ncleansegs;
730 __u64 ss_ndirtysegs;
731 __u64 ss_ctime;
732 __u64 ss_nongc_ctime;
733 __u64 ss_prot_seq;
734};
735
736/**
737 * struct nilfs_vinfo - virtual block number information
738 * @vi_vblocknr:
739 * @vi_start:
740 * @vi_end:
741 * @vi_blocknr:
742 */
743struct nilfs_vinfo {
744 __u64 vi_vblocknr;
745 __u64 vi_start;
746 __u64 vi_end;
747 __u64 vi_blocknr;
748};
749
750/**
751 * struct nilfs_vdesc -
752 */
753struct nilfs_vdesc {
754 __u64 vd_ino;
755 __u64 vd_cno;
756 __u64 vd_vblocknr;
757 struct nilfs_period vd_period;
758 __u64 vd_blocknr;
759 __u64 vd_offset;
760 __u32 vd_flags;
761 __u32 vd_pad;
762};
763
764/**
765 * struct nilfs_bdesc -
766 */
767struct nilfs_bdesc {
768 __u64 bd_ino;
769 __u64 bd_oblocknr;
770 __u64 bd_blocknr;
771 __u64 bd_offset;
772 __u32 bd_level;
773 __u32 bd_pad;
774};
775
776#define NILFS_IOCTL_IDENT 'n'
777
778#define NILFS_IOCTL_CHANGE_CPMODE \
779 _IOW(NILFS_IOCTL_IDENT, 0x80, struct nilfs_cpmode)
780#define NILFS_IOCTL_DELETE_CHECKPOINT \
781 _IOW(NILFS_IOCTL_IDENT, 0x81, __u64)
782#define NILFS_IOCTL_GET_CPINFO \
783 _IOR(NILFS_IOCTL_IDENT, 0x82, struct nilfs_argv)
784#define NILFS_IOCTL_GET_CPSTAT \
785 _IOR(NILFS_IOCTL_IDENT, 0x83, struct nilfs_cpstat)
786#define NILFS_IOCTL_GET_SUINFO \
787 _IOR(NILFS_IOCTL_IDENT, 0x84, struct nilfs_argv)
788#define NILFS_IOCTL_GET_SUSTAT \
789 _IOR(NILFS_IOCTL_IDENT, 0x85, struct nilfs_sustat)
790#define NILFS_IOCTL_GET_VINFO \
791 _IOWR(NILFS_IOCTL_IDENT, 0x86, struct nilfs_argv)
792#define NILFS_IOCTL_GET_BDESCS \
793 _IOWR(NILFS_IOCTL_IDENT, 0x87, struct nilfs_argv)
794#define NILFS_IOCTL_CLEAN_SEGMENTS \
795 _IOW(NILFS_IOCTL_IDENT, 0x88, struct nilfs_argv[5])
796#define NILFS_IOCTL_SYNC \
797 _IOR(NILFS_IOCTL_IDENT, 0x8A, __u64)
798#define NILFS_IOCTL_RESIZE \
799 _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64)
800
801#endif /* _LINUX_NILFS_FS_H */
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index ea8c6d84996d..cc1767f5cca8 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -228,10 +228,11 @@ extern void parport_pc_release_resources(struct parport *p);
228extern int parport_pc_claim_resources(struct parport *p); 228extern int parport_pc_claim_resources(struct parport *p);
229 229
230/* PCMCIA code will want to get us to look at a port. Provide a mechanism. */ 230/* PCMCIA code will want to get us to look at a port. Provide a mechanism. */
231extern struct parport *parport_pc_probe_port (unsigned long base, 231extern struct parport *parport_pc_probe_port(unsigned long base,
232 unsigned long base_hi, 232 unsigned long base_hi,
233 int irq, int dma, 233 int irq, int dma,
234 struct device *dev); 234 struct device *dev,
235extern void parport_pc_unregister_port (struct parport *p); 235 int irqflags);
236extern void parport_pc_unregister_port(struct parport *p);
236 237
237#endif 238#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a7fe4bbd7ff1..72698d89e767 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -674,6 +674,11 @@ int __must_check pci_reenable_device(struct pci_dev *);
674int __must_check pcim_enable_device(struct pci_dev *pdev); 674int __must_check pcim_enable_device(struct pci_dev *pdev);
675void pcim_pin_device(struct pci_dev *pdev); 675void pcim_pin_device(struct pci_dev *pdev);
676 676
677static inline int pci_is_enabled(struct pci_dev *pdev)
678{
679 return (atomic_read(&pdev->enable_cnt) > 0);
680}
681
677static inline int pci_is_managed(struct pci_dev *pdev) 682static inline int pci_is_managed(struct pci_dev *pdev)
678{ 683{
679 return pdev->is_managed; 684 return pdev->is_managed;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 170f8b1f22db..06ba90c211a5 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -944,6 +944,32 @@
944#define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801 944#define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801
945#define PCI_DEVICE_ID_SUN_CASSINI 0xabba 945#define PCI_DEVICE_ID_SUN_CASSINI 0xabba
946 946
947#define PCI_VENDOR_ID_NI 0x1093
948#define PCI_DEVICE_ID_NI_PCI2322 0xd130
949#define PCI_DEVICE_ID_NI_PCI2324 0xd140
950#define PCI_DEVICE_ID_NI_PCI2328 0xd150
951#define PCI_DEVICE_ID_NI_PXI8422_2322 0xd190
952#define PCI_DEVICE_ID_NI_PXI8422_2324 0xd1a0
953#define PCI_DEVICE_ID_NI_PXI8420_2322 0xd1d0
954#define PCI_DEVICE_ID_NI_PXI8420_2324 0xd1e0
955#define PCI_DEVICE_ID_NI_PXI8420_2328 0xd1f0
956#define PCI_DEVICE_ID_NI_PXI8420_23216 0xd1f1
957#define PCI_DEVICE_ID_NI_PCI2322I 0xd250
958#define PCI_DEVICE_ID_NI_PCI2324I 0xd270
959#define PCI_DEVICE_ID_NI_PCI23216 0xd2b0
960#define PCI_DEVICE_ID_NI_PXI8430_2322 0x7080
961#define PCI_DEVICE_ID_NI_PCI8430_2322 0x70db
962#define PCI_DEVICE_ID_NI_PXI8430_2324 0x70dd
963#define PCI_DEVICE_ID_NI_PCI8430_2324 0x70df
964#define PCI_DEVICE_ID_NI_PXI8430_2328 0x70e2
965#define PCI_DEVICE_ID_NI_PCI8430_2328 0x70e4
966#define PCI_DEVICE_ID_NI_PXI8430_23216 0x70e6
967#define PCI_DEVICE_ID_NI_PCI8430_23216 0x70e7
968#define PCI_DEVICE_ID_NI_PXI8432_2322 0x70e8
969#define PCI_DEVICE_ID_NI_PCI8432_2322 0x70ea
970#define PCI_DEVICE_ID_NI_PXI8432_2324 0x70ec
971#define PCI_DEVICE_ID_NI_PCI8432_2324 0x70ee
972
947#define PCI_VENDOR_ID_CMD 0x1095 973#define PCI_VENDOR_ID_CMD 0x1095
948#define PCI_DEVICE_ID_CMD_643 0x0643 974#define PCI_DEVICE_ID_CMD_643 0x0643
949#define PCI_DEVICE_ID_CMD_646 0x0646 975#define PCI_DEVICE_ID_CMD_646 0x0646
@@ -2488,6 +2514,8 @@
2488#define PCI_DEVICE_ID_INTEL_IOAT_TBG3 0x3433 2514#define PCI_DEVICE_ID_INTEL_IOAT_TBG3 0x3433
2489#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2515#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
2490#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 2516#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
2517#define PCI_DEVICE_ID_INTEL_82854_HB 0x358c
2518#define PCI_DEVICE_ID_INTEL_82854_IG 0x358e
2491#define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580 2519#define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580
2492#define PCI_DEVICE_ID_INTEL_82855GM_IG 0x3582 2520#define PCI_DEVICE_ID_INTEL_82855GM_IG 0x3582
2493#define PCI_DEVICE_ID_INTEL_E7520_MCH 0x3590 2521#define PCI_DEVICE_ID_INTEL_E7520_MCH 0x3590
diff --git a/include/linux/pda_power.h b/include/linux/pda_power.h
index cb7d10f30763..d4cf7a2ceb3e 100644
--- a/include/linux/pda_power.h
+++ b/include/linux/pda_power.h
@@ -31,6 +31,8 @@ struct pda_power_pdata {
31 unsigned int wait_for_status; /* msecs, default is 500 */ 31 unsigned int wait_for_status; /* msecs, default is 500 */
32 unsigned int wait_for_charger; /* msecs, default is 500 */ 32 unsigned int wait_for_charger; /* msecs, default is 500 */
33 unsigned int polling_interval; /* msecs, default is 2000 */ 33 unsigned int polling_interval; /* msecs, default is 2000 */
34
35 unsigned long ac_max_uA; /* current to draw when on AC */
34}; 36};
35 37
36#endif /* __PDA_POWER_H__ */ 38#endif /* __PDA_POWER_H__ */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index ee5615d65211..cfda2d5ad319 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -168,4 +168,56 @@ static inline void free_percpu(void *p)
168#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \ 168#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \
169 __alignof__(type)) 169 __alignof__(type))
170 170
171/*
172 * Optional methods for optimized non-lvalue per-cpu variable access.
173 *
174 * @var can be a percpu variable or a field of it and its size should
175 * equal char, int or long. percpu_read() evaluates to a lvalue and
176 * all others to void.
177 *
178 * These operations are guaranteed to be atomic w.r.t. preemption.
179 * The generic versions use plain get/put_cpu_var(). Archs are
180 * encouraged to implement single-instruction alternatives which don't
181 * require preemption protection.
182 */
183#ifndef percpu_read
184# define percpu_read(var) \
185 ({ \
186 typeof(per_cpu_var(var)) __tmp_var__; \
187 __tmp_var__ = get_cpu_var(var); \
188 put_cpu_var(var); \
189 __tmp_var__; \
190 })
191#endif
192
193#define __percpu_generic_to_op(var, val, op) \
194do { \
195 get_cpu_var(var) op val; \
196 put_cpu_var(var); \
197} while (0)
198
199#ifndef percpu_write
200# define percpu_write(var, val) __percpu_generic_to_op(var, (val), =)
201#endif
202
203#ifndef percpu_add
204# define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=)
205#endif
206
207#ifndef percpu_sub
208# define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=)
209#endif
210
211#ifndef percpu_and
212# define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=)
213#endif
214
215#ifndef percpu_or
216# define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=)
217#endif
218
219#ifndef percpu_xor
220# define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=)
221#endif
222
171#endif /* __LINUX_PERCPU_H */ 223#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
index 80044a4f3ab9..bfd92e1e5d2c 100644
--- a/include/linux/rcuclassic.h
+++ b/include/linux/rcuclassic.h
@@ -36,7 +36,6 @@
36#include <linux/cache.h> 36#include <linux/cache.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/threads.h> 38#include <linux/threads.h>
39#include <linux/percpu.h>
40#include <linux/cpumask.h> 39#include <linux/cpumask.h>
41#include <linux/seqlock.h> 40#include <linux/seqlock.h>
42 41
@@ -108,25 +107,14 @@ struct rcu_data {
108 struct rcu_head barrier; 107 struct rcu_head barrier;
109}; 108};
110 109
111DECLARE_PER_CPU(struct rcu_data, rcu_data);
112DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
113
114/* 110/*
115 * Increment the quiescent state counter. 111 * Increment the quiescent state counter.
116 * The counter is a bit degenerated: We do not need to know 112 * The counter is a bit degenerated: We do not need to know
117 * how many quiescent states passed, just if there was at least 113 * how many quiescent states passed, just if there was at least
118 * one since the start of the grace period. Thus just a flag. 114 * one since the start of the grace period. Thus just a flag.
119 */ 115 */
120static inline void rcu_qsctr_inc(int cpu) 116extern void rcu_qsctr_inc(int cpu);
121{ 117extern void rcu_bh_qsctr_inc(int cpu);
122 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
123 rdp->passed_quiesc = 1;
124}
125static inline void rcu_bh_qsctr_inc(int cpu)
126{
127 struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
128 rdp->passed_quiesc = 1;
129}
130 118
131extern int rcu_pending(int cpu); 119extern int rcu_pending(int cpu);
132extern int rcu_needs_cpu(int cpu); 120extern int rcu_needs_cpu(int cpu);
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 528343e6da51..15fbb3ca634d 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -36,7 +36,6 @@
36#include <linux/cache.h> 36#include <linux/cache.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/threads.h> 38#include <linux/threads.h>
39#include <linux/percpu.h>
40#include <linux/cpumask.h> 39#include <linux/cpumask.h>
41#include <linux/seqlock.h> 40#include <linux/seqlock.h>
42#include <linux/lockdep.h> 41#include <linux/lockdep.h>
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
index 74304b4538d8..fce522782ffa 100644
--- a/include/linux/rcupreempt.h
+++ b/include/linux/rcupreempt.h
@@ -36,34 +36,19 @@
36#include <linux/cache.h> 36#include <linux/cache.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/threads.h> 38#include <linux/threads.h>
39#include <linux/percpu.h> 39#include <linux/smp.h>
40#include <linux/cpumask.h> 40#include <linux/cpumask.h>
41#include <linux/seqlock.h> 41#include <linux/seqlock.h>
42 42
43struct rcu_dyntick_sched { 43extern void rcu_qsctr_inc(int cpu);
44 int dynticks; 44static inline void rcu_bh_qsctr_inc(int cpu) { }
45 int dynticks_snap;
46 int sched_qs;
47 int sched_qs_snap;
48 int sched_dynticks_snap;
49};
50
51DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched);
52
53static inline void rcu_qsctr_inc(int cpu)
54{
55 struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu);
56
57 rdssp->sched_qs++;
58}
59#define rcu_bh_qsctr_inc(cpu)
60 45
61/* 46/*
62 * Someone might want to pass call_rcu_bh as a function pointer. 47 * Someone might want to pass call_rcu_bh as a function pointer.
63 * So this needs to just be a rename and not a macro function. 48 * So this needs to just be a rename and not a macro function.
64 * (no parentheses) 49 * (no parentheses)
65 */ 50 */
66#define call_rcu_bh call_rcu 51#define call_rcu_bh call_rcu
67 52
68/** 53/**
69 * call_rcu_sched - Queue RCU callback for invocation after sched grace period. 54 * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
@@ -117,30 +102,12 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
117struct softirq_action; 102struct softirq_action;
118 103
119#ifdef CONFIG_NO_HZ 104#ifdef CONFIG_NO_HZ
120 105extern void rcu_enter_nohz(void);
121static inline void rcu_enter_nohz(void) 106extern void rcu_exit_nohz(void);
122{ 107#else
123 static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); 108# define rcu_enter_nohz() do { } while (0)
124 109# define rcu_exit_nohz() do { } while (0)
125 smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */ 110#endif
126 __get_cpu_var(rcu_dyntick_sched).dynticks++;
127 WARN_ON_RATELIMIT(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1, &rs);
128}
129
130static inline void rcu_exit_nohz(void)
131{
132 static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
133
134 __get_cpu_var(rcu_dyntick_sched).dynticks++;
135 smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
136 WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1),
137 &rs);
138}
139
140#else /* CONFIG_NO_HZ */
141#define rcu_enter_nohz() do { } while (0)
142#define rcu_exit_nohz() do { } while (0)
143#endif /* CONFIG_NO_HZ */
144 111
145/* 112/*
146 * A context switch is a grace period for rcupreempt synchronize_rcu() 113 * A context switch is a grace period for rcupreempt synchronize_rcu()
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index a722fb67bb2d..0cdda00f2b2a 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -33,7 +33,6 @@
33#include <linux/cache.h> 33#include <linux/cache.h>
34#include <linux/spinlock.h> 34#include <linux/spinlock.h>
35#include <linux/threads.h> 35#include <linux/threads.h>
36#include <linux/percpu.h>
37#include <linux/cpumask.h> 36#include <linux/cpumask.h>
38#include <linux/seqlock.h> 37#include <linux/seqlock.h>
39 38
@@ -236,30 +235,8 @@ struct rcu_state {
236#endif /* #ifdef CONFIG_NO_HZ */ 235#endif /* #ifdef CONFIG_NO_HZ */
237}; 236};
238 237
239extern struct rcu_state rcu_state; 238extern void rcu_qsctr_inc(int cpu);
240DECLARE_PER_CPU(struct rcu_data, rcu_data); 239extern void rcu_bh_qsctr_inc(int cpu);
241
242extern struct rcu_state rcu_bh_state;
243DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
244
245/*
246 * Increment the quiescent state counter.
247 * The counter is a bit degenerated: We do not need to know
248 * how many quiescent states passed, just if there was at least
249 * one since the start of the grace period. Thus just a flag.
250 */
251static inline void rcu_qsctr_inc(int cpu)
252{
253 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
254 rdp->passed_quiesc = 1;
255 rdp->passed_quiesc_completed = rdp->completed;
256}
257static inline void rcu_bh_qsctr_inc(int cpu)
258{
259 struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
260 rdp->passed_quiesc = 1;
261 rdp->passed_quiesc_completed = rdp->completed;
262}
263 240
264extern int rcu_pending(int cpu); 241extern int rcu_pending(int cpu);
265extern int rcu_needs_cpu(int cpu); 242extern int rcu_needs_cpu(int cpu);
diff --git a/include/linux/rotary_encoder.h b/include/linux/rotary_encoder.h
new file mode 100644
index 000000000000..12d63a30c347
--- /dev/null
+++ b/include/linux/rotary_encoder.h
@@ -0,0 +1,13 @@
1#ifndef __ROTARY_ENCODER_H__
2#define __ROTARY_ENCODER_H__
3
4struct rotary_encoder_platform_data {
5 unsigned int steps;
6 unsigned int axis;
7 unsigned int gpio_a;
8 unsigned int gpio_b;
9 unsigned int inverted_a;
10 unsigned int inverted_b;
11};
12
13#endif /* __ROTARY_ENCODER_H__ */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b94f3541f67b..b4c38bc8049c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -205,7 +205,8 @@ extern unsigned long long time_sync_thresh;
205#define task_is_stopped_or_traced(task) \ 205#define task_is_stopped_or_traced(task) \
206 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) 206 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
207#define task_contributes_to_load(task) \ 207#define task_contributes_to_load(task) \
208 ((task->state & TASK_UNINTERRUPTIBLE) != 0) 208 ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \
209 (task->flags & PF_FROZEN) == 0)
209 210
210#define __set_task_state(tsk, state_value) \ 211#define __set_task_state(tsk, state_value) \
211 do { (tsk)->state = (state_value); } while (0) 212 do { (tsk)->state = (state_value); } while (0)
@@ -300,17 +301,11 @@ extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
300 struct file *filp, void __user *buffer, 301 struct file *filp, void __user *buffer,
301 size_t *lenp, loff_t *ppos); 302 size_t *lenp, loff_t *ppos);
302extern unsigned int softlockup_panic; 303extern unsigned int softlockup_panic;
303extern unsigned long sysctl_hung_task_check_count;
304extern unsigned long sysctl_hung_task_timeout_secs;
305extern unsigned long sysctl_hung_task_warnings;
306extern int softlockup_thresh; 304extern int softlockup_thresh;
307#else 305#else
308static inline void softlockup_tick(void) 306static inline void softlockup_tick(void)
309{ 307{
310} 308}
311static inline void spawn_softlockup_task(void)
312{
313}
314static inline void touch_softlockup_watchdog(void) 309static inline void touch_softlockup_watchdog(void)
315{ 310{
316} 311}
@@ -319,6 +314,15 @@ static inline void touch_all_softlockup_watchdogs(void)
319} 314}
320#endif 315#endif
321 316
317#ifdef CONFIG_DETECT_HUNG_TASK
318extern unsigned int sysctl_hung_task_panic;
319extern unsigned long sysctl_hung_task_check_count;
320extern unsigned long sysctl_hung_task_timeout_secs;
321extern unsigned long sysctl_hung_task_warnings;
322extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
323 struct file *filp, void __user *buffer,
324 size_t *lenp, loff_t *ppos);
325#endif
322 326
323/* Attach to any functions which should be ignored in wchan output. */ 327/* Attach to any functions which should be ignored in wchan output. */
324#define __sched __attribute__((__section__(".sched.text"))) 328#define __sched __attribute__((__section__(".sched.text")))
@@ -1255,9 +1259,8 @@ struct task_struct {
1255/* ipc stuff */ 1259/* ipc stuff */
1256 struct sysv_sem sysvsem; 1260 struct sysv_sem sysvsem;
1257#endif 1261#endif
1258#ifdef CONFIG_DETECT_SOFTLOCKUP 1262#ifdef CONFIG_DETECT_HUNG_TASK
1259/* hung task detection */ 1263/* hung task detection */
1260 unsigned long last_switch_timestamp;
1261 unsigned long last_switch_count; 1264 unsigned long last_switch_count;
1262#endif 1265#endif
1263/* CPU-specific state of this task */ 1266/* CPU-specific state of this task */
@@ -1294,6 +1297,11 @@ struct task_struct {
1294/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ 1297/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */
1295 spinlock_t alloc_lock; 1298 spinlock_t alloc_lock;
1296 1299
1300#ifdef CONFIG_GENERIC_HARDIRQS
1301 /* IRQ handler threads */
1302 struct irqaction *irqaction;
1303#endif
1304
1297 /* Protection of the PI data structures: */ 1305 /* Protection of the PI data structures: */
1298 spinlock_t pi_lock; 1306 spinlock_t pi_lock;
1299 1307
diff --git a/include/linux/security.h b/include/linux/security.h
index 54ed15799a83..d5fd6163606f 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -32,6 +32,7 @@
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/key.h> 33#include <linux/key.h>
34#include <linux/xfrm.h> 34#include <linux/xfrm.h>
35#include <linux/gfp.h>
35#include <net/flow.h> 36#include <net/flow.h>
36 37
37/* Maximum number of letters for an LSM name string */ 38/* Maximum number of letters for an LSM name string */
@@ -2953,5 +2954,28 @@ static inline void securityfs_remove(struct dentry *dentry)
2953 2954
2954#endif 2955#endif
2955 2956
2957#ifdef CONFIG_SECURITY
2958
2959static inline char *alloc_secdata(void)
2960{
2961 return (char *)get_zeroed_page(GFP_KERNEL);
2962}
2963
2964static inline void free_secdata(void *secdata)
2965{
2966 free_page((unsigned long)secdata);
2967}
2968
2969#else
2970
2971static inline char *alloc_secdata(void)
2972{
2973 return (char *)1;
2974}
2975
2976static inline void free_secdata(void *secdata)
2977{ }
2978#endif /* CONFIG_SECURITY */
2979
2956#endif /* ! __LINUX_SECURITY_H */ 2980#endif /* ! __LINUX_SECURITY_H */
2957 2981
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index df9245c7bd3b..57a97e52e58d 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -164,6 +164,9 @@
164/* NWPSERIAL */ 164/* NWPSERIAL */
165#define PORT_NWPSERIAL 85 165#define PORT_NWPSERIAL 85
166 166
167/* MAX3100 */
168#define PORT_MAX3100 86
169
167#ifdef __KERNEL__ 170#ifdef __KERNEL__
168 171
169#include <linux/compiler.h> 172#include <linux/compiler.h>
@@ -277,7 +280,7 @@ struct uart_port {
277 struct uart_icount icount; /* statistics */ 280 struct uart_icount icount; /* statistics */
278 281
279 struct console *cons; /* struct console, if any */ 282 struct console *cons; /* struct console, if any */
280#ifdef CONFIG_SERIAL_CORE_CONSOLE 283#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(SUPPORT_SYSRQ)
281 unsigned long sysrq; /* sysrq timeout */ 284 unsigned long sysrq; /* sysrq timeout */
282#endif 285#endif
283 286
diff --git a/include/linux/serial_max3100.h b/include/linux/serial_max3100.h
new file mode 100644
index 000000000000..4976befb6aeb
--- /dev/null
+++ b/include/linux/serial_max3100.h
@@ -0,0 +1,52 @@
1/*
2 *
3 * Copyright (C) 2007 Christian Pellegrin
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
11
12#ifndef _LINUX_SERIAL_MAX3100_H
13#define _LINUX_SERIAL_MAX3100_H 1
14
15
16/**
17 * struct plat_max3100 - MAX3100 SPI UART platform data
18 * @loopback: force MAX3100 in loopback
19 * @crystal: 1 for 3.6864 Mhz, 0 for 1.8432
20 * @max3100_hw_suspend: MAX3100 has a shutdown pin. This is a hook
21 * called on suspend and resume to activate it.
22 * @poll_time: poll time for CTS signal in ms, 0 disables (so no hw
23 * flow ctrl is possible but you have less CPU usage)
24 *
25 * You should use this structure in your machine description to specify
26 * how the MAX3100 is connected. Example:
27 *
28 * static struct plat_max3100 max3100_plat_data = {
29 * .loopback = 0,
30 * .crystal = 0,
31 * .poll_time = 100,
32 * };
33 *
34 * static struct spi_board_info spi_board_info[] = {
35 * {
36 * .modalias = "max3100",
37 * .platform_data = &max3100_plat_data,
38 * .irq = IRQ_EINT12,
39 * .max_speed_hz = 5*1000*1000,
40 * .chip_select = 0,
41 * },
42 * };
43 *
44 **/
45struct plat_max3100 {
46 int loopback;
47 int crystal;
48 void (*max3100_hw_suspend) (int suspend);
49 int poll_time;
50};
51
52#endif
diff --git a/include/linux/sht15.h b/include/linux/sht15.h
new file mode 100644
index 000000000000..046bce05ecab
--- /dev/null
+++ b/include/linux/sht15.h
@@ -0,0 +1,24 @@
1/*
2 * sht15.h - support for the SHT15 Temperature and Humidity Sensor
3 *
4 * Copyright (c) 2009 Jonathan Cameron
5 *
6 * Copyright (c) 2007 Wouter Horre
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13/**
14 * struct sht15_platform_data - sht15 connectivity info
15 * @gpio_data: no. of gpio to which bidirectional data line is connected
16 * @gpio_sck: no. of gpio to which the data clock is connected.
17 * @supply_mv: supply voltage in mv. Overridden by regulator if available.
18 **/
19struct sht15_platform_data {
20 int gpio_data;
21 int gpio_sck;
22 int supply_mv;
23};
24
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index f4523651fa42..5ac9b0bcaf9a 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -73,8 +73,8 @@ found:
73 73
74 ret = kmem_cache_alloc_notrace(cachep, flags); 74 ret = kmem_cache_alloc_notrace(cachep, flags);
75 75
76 kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret, 76 trace_kmalloc(_THIS_IP_, ret,
77 size, slab_buffer_size(cachep), flags); 77 size, slab_buffer_size(cachep), flags);
78 78
79 return ret; 79 return ret;
80 } 80 }
@@ -128,9 +128,9 @@ found:
128 128
129 ret = kmem_cache_alloc_node_notrace(cachep, flags, node); 129 ret = kmem_cache_alloc_node_notrace(cachep, flags, node);
130 130
131 kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, 131 trace_kmalloc_node(_THIS_IP_, ret,
132 ret, size, slab_buffer_size(cachep), 132 size, slab_buffer_size(cachep),
133 flags, node); 133 flags, node);
134 134
135 return ret; 135 return ret;
136 } 136 }
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index a1f90528e70b..5046f90c1171 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -233,8 +233,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
233 unsigned int order = get_order(size); 233 unsigned int order = get_order(size);
234 void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); 234 void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order);
235 235
236 kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret, 236 trace_kmalloc(_THIS_IP_, ret, size, PAGE_SIZE << order, flags);
237 size, PAGE_SIZE << order, flags);
238 237
239 return ret; 238 return ret;
240} 239}
@@ -255,9 +254,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
255 254
256 ret = kmem_cache_alloc_notrace(s, flags); 255 ret = kmem_cache_alloc_notrace(s, flags);
257 256
258 kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, 257 trace_kmalloc(_THIS_IP_, ret, size, s->size, flags);
259 _THIS_IP_, ret,
260 size, s->size, flags);
261 258
262 return ret; 259 return ret;
263 } 260 }
@@ -296,9 +293,8 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
296 293
297 ret = kmem_cache_alloc_node_notrace(s, flags, node); 294 ret = kmem_cache_alloc_node_notrace(s, flags, node);
298 295
299 kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC, 296 trace_kmalloc_node(_THIS_IP_, ret,
300 _THIS_IP_, ret, 297 size, s->size, flags, node);
301 size, s->size, flags, node);
302 298
303 return ret; 299 return ret;
304 } 300 }
diff --git a/include/linux/spi/ad7879.h b/include/linux/spi/ad7879.h
new file mode 100644
index 000000000000..4231104c9afa
--- /dev/null
+++ b/include/linux/spi/ad7879.h
@@ -0,0 +1,35 @@
1/* linux/spi/ad7879.h */
2
3/* Touchscreen characteristics vary between boards and models. The
4 * platform_data for the device's "struct device" holds this information.
5 *
6 * It's OK if the min/max values are zero.
7 */
8struct ad7879_platform_data {
9 u16 model; /* 7879 */
10 u16 x_plate_ohms;
11 u16 x_min, x_max;
12 u16 y_min, y_max;
13 u16 pressure_min, pressure_max;
14
15 /* [0..255] 0=OFF Starts at 1=550us and goes
16 * all the way to 9.440ms in steps of 35us.
17 */
18 u8 pen_down_acc_interval;
19 /* [0..15] Starts at 0=128us and goes all the
20 * way to 4.096ms in steps of 128us.
21 */
22 u8 first_conversion_delay;
23 /* [0..3] 0 = 2us, 1 = 4us, 2 = 8us, 3 = 16us */
24 u8 acquisition_time;
25 /* [0..3] Average X middle samples 0 = 2, 1 = 4, 2 = 8, 3 = 16 */
26 u8 averaging;
27 /* [0..3] Perform X measurements 0 = OFF,
28 * 1 = 4, 2 = 8, 3 = 16 (median > averaging)
29 */
30 u8 median;
31 /* 1 = AUX/VBAT/GPIO set to GPIO Output */
32 u8 gpio_output;
33 /* Initial GPIO pin state (valid if gpio_output = 1) */
34 u8 gpio_default;
35};
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 68bb1c501d0d..2cc43fa380cb 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -204,6 +204,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
204 * SPI slaves, and are numbered from zero to num_chipselects. 204 * SPI slaves, and are numbered from zero to num_chipselects.
205 * each slave has a chipselect signal, but it's common that not 205 * each slave has a chipselect signal, but it's common that not
206 * every chipselect is connected to a slave. 206 * every chipselect is connected to a slave.
207 * @dma_alignment: SPI controller constraint on DMA buffers alignment.
207 * @setup: updates the device mode and clocking records used by a 208 * @setup: updates the device mode and clocking records used by a
208 * device's SPI controller; protocol code may call this. This 209 * device's SPI controller; protocol code may call this. This
209 * must fail if an unrecognized or unsupported mode is requested. 210 * must fail if an unrecognized or unsupported mode is requested.
@@ -239,6 +240,11 @@ struct spi_master {
239 */ 240 */
240 u16 num_chipselect; 241 u16 num_chipselect;
241 242
243 /* some SPI controllers pose alignment requirements on DMAable
244 * buffers; let protocol drivers know about these requirements.
245 */
246 u16 dma_alignment;
247
242 /* setup mode and clock, etc (spi driver may call many times) */ 248 /* setup mode and clock, etc (spi driver may call many times) */
243 int (*setup)(struct spi_device *spi); 249 int (*setup)(struct spi_device *spi);
244 250
diff --git a/include/linux/stringify.h b/include/linux/stringify.h
index 0b4388356c87..841cec8ed525 100644
--- a/include/linux/stringify.h
+++ b/include/linux/stringify.h
@@ -6,7 +6,7 @@
6 * converts to "bar". 6 * converts to "bar".
7 */ 7 */
8 8
9#define __stringify_1(x) #x 9#define __stringify_1(x...) #x
10#define __stringify(x) __stringify_1(x) 10#define __stringify(x...) __stringify_1(x)
11 11
12#endif /* !__LINUX_STRINGIFY_H */ 12#endif /* !__LINUX_STRINGIFY_H */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index d3a4c0231933..2a30775959e9 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -24,6 +24,15 @@
24 */ 24 */
25typedef int (*svc_thread_fn)(void *); 25typedef int (*svc_thread_fn)(void *);
26 26
27/* statistics for svc_pool structures */
28struct svc_pool_stats {
29 unsigned long packets;
30 unsigned long sockets_queued;
31 unsigned long threads_woken;
32 unsigned long overloads_avoided;
33 unsigned long threads_timedout;
34};
35
27/* 36/*
28 * 37 *
29 * RPC service thread pool. 38 * RPC service thread pool.
@@ -41,6 +50,8 @@ struct svc_pool {
41 struct list_head sp_sockets; /* pending sockets */ 50 struct list_head sp_sockets; /* pending sockets */
42 unsigned int sp_nrthreads; /* # of threads in pool */ 51 unsigned int sp_nrthreads; /* # of threads in pool */
43 struct list_head sp_all_threads; /* all server threads */ 52 struct list_head sp_all_threads; /* all server threads */
53 int sp_nwaking; /* number of threads woken but not yet active */
54 struct svc_pool_stats sp_stats; /* statistics on pool operation */
44} ____cacheline_aligned_in_smp; 55} ____cacheline_aligned_in_smp;
45 56
46/* 57/*
@@ -83,6 +94,8 @@ struct svc_serv {
83 struct module * sv_module; /* optional module to count when 94 struct module * sv_module; /* optional module to count when
84 * adding threads */ 95 * adding threads */
85 svc_thread_fn sv_function; /* main function for threads */ 96 svc_thread_fn sv_function; /* main function for threads */
97 unsigned int sv_drc_max_pages; /* Total pages for DRC */
98 unsigned int sv_drc_pages_used;/* DRC pages used */
86}; 99};
87 100
88/* 101/*
@@ -218,6 +231,7 @@ struct svc_rqst {
218 struct svc_cred rq_cred; /* auth info */ 231 struct svc_cred rq_cred; /* auth info */
219 void * rq_xprt_ctxt; /* transport specific context ptr */ 232 void * rq_xprt_ctxt; /* transport specific context ptr */
220 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ 233 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */
234 int rq_usedeferral; /* use deferral */
221 235
222 size_t rq_xprt_hlen; /* xprt header len */ 236 size_t rq_xprt_hlen; /* xprt header len */
223 struct xdr_buf rq_arg; 237 struct xdr_buf rq_arg;
@@ -263,6 +277,7 @@ struct svc_rqst {
263 * cache pages */ 277 * cache pages */
264 wait_queue_head_t rq_wait; /* synchronization */ 278 wait_queue_head_t rq_wait; /* synchronization */
265 struct task_struct *rq_task; /* service thread */ 279 struct task_struct *rq_task; /* service thread */
280 int rq_waking; /* 1 if thread is being woken */
266}; 281};
267 282
268/* 283/*
@@ -393,6 +408,7 @@ struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
393 void (*shutdown)(struct svc_serv *), 408 void (*shutdown)(struct svc_serv *),
394 svc_thread_fn, struct module *); 409 svc_thread_fn, struct module *);
395int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); 410int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
411int svc_pool_stats_open(struct svc_serv *serv, struct file *file);
396void svc_destroy(struct svc_serv *); 412void svc_destroy(struct svc_serv *);
397int svc_process(struct svc_rqst *); 413int svc_process(struct svc_rqst *);
398int svc_register(const struct svc_serv *, const int, 414int svc_register(const struct svc_serv *, const int,
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 49e1eb454465..d8910b68e1bd 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -69,27 +69,27 @@ struct xdr_buf {
69 * pre-xdr'ed macros. 69 * pre-xdr'ed macros.
70 */ 70 */
71 71
72#define xdr_zero __constant_htonl(0) 72#define xdr_zero cpu_to_be32(0)
73#define xdr_one __constant_htonl(1) 73#define xdr_one cpu_to_be32(1)
74#define xdr_two __constant_htonl(2) 74#define xdr_two cpu_to_be32(2)
75 75
76#define rpc_success __constant_htonl(RPC_SUCCESS) 76#define rpc_success cpu_to_be32(RPC_SUCCESS)
77#define rpc_prog_unavail __constant_htonl(RPC_PROG_UNAVAIL) 77#define rpc_prog_unavail cpu_to_be32(RPC_PROG_UNAVAIL)
78#define rpc_prog_mismatch __constant_htonl(RPC_PROG_MISMATCH) 78#define rpc_prog_mismatch cpu_to_be32(RPC_PROG_MISMATCH)
79#define rpc_proc_unavail __constant_htonl(RPC_PROC_UNAVAIL) 79#define rpc_proc_unavail cpu_to_be32(RPC_PROC_UNAVAIL)
80#define rpc_garbage_args __constant_htonl(RPC_GARBAGE_ARGS) 80#define rpc_garbage_args cpu_to_be32(RPC_GARBAGE_ARGS)
81#define rpc_system_err __constant_htonl(RPC_SYSTEM_ERR) 81#define rpc_system_err cpu_to_be32(RPC_SYSTEM_ERR)
82#define rpc_drop_reply __constant_htonl(RPC_DROP_REPLY) 82#define rpc_drop_reply cpu_to_be32(RPC_DROP_REPLY)
83 83
84#define rpc_auth_ok __constant_htonl(RPC_AUTH_OK) 84#define rpc_auth_ok cpu_to_be32(RPC_AUTH_OK)
85#define rpc_autherr_badcred __constant_htonl(RPC_AUTH_BADCRED) 85#define rpc_autherr_badcred cpu_to_be32(RPC_AUTH_BADCRED)
86#define rpc_autherr_rejectedcred __constant_htonl(RPC_AUTH_REJECTEDCRED) 86#define rpc_autherr_rejectedcred cpu_to_be32(RPC_AUTH_REJECTEDCRED)
87#define rpc_autherr_badverf __constant_htonl(RPC_AUTH_BADVERF) 87#define rpc_autherr_badverf cpu_to_be32(RPC_AUTH_BADVERF)
88#define rpc_autherr_rejectedverf __constant_htonl(RPC_AUTH_REJECTEDVERF) 88#define rpc_autherr_rejectedverf cpu_to_be32(RPC_AUTH_REJECTEDVERF)
89#define rpc_autherr_tooweak __constant_htonl(RPC_AUTH_TOOWEAK) 89#define rpc_autherr_tooweak cpu_to_be32(RPC_AUTH_TOOWEAK)
90#define rpcsec_gsserr_credproblem __constant_htonl(RPCSEC_GSS_CREDPROBLEM) 90#define rpcsec_gsserr_credproblem cpu_to_be32(RPCSEC_GSS_CREDPROBLEM)
91#define rpcsec_gsserr_ctxproblem __constant_htonl(RPCSEC_GSS_CTXPROBLEM) 91#define rpcsec_gsserr_ctxproblem cpu_to_be32(RPCSEC_GSS_CTXPROBLEM)
92#define rpc_autherr_oldseqnum __constant_htonl(101) 92#define rpc_autherr_oldseqnum cpu_to_be32(101)
93 93
94/* 94/*
95 * Miscellaneous XDR helper functions 95 * Miscellaneous XDR helper functions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 6470f74074af..dabe4ad89141 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -65,7 +65,7 @@ struct old_linux_dirent;
65#include <asm/signal.h> 65#include <asm/signal.h>
66#include <linux/quota.h> 66#include <linux/quota.h>
67#include <linux/key.h> 67#include <linux/key.h>
68#include <linux/ftrace.h> 68#include <trace/syscall.h>
69 69
70#define __SC_DECL1(t1, a1) t1 a1 70#define __SC_DECL1(t1, a1) t1 a1
71#define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__) 71#define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__)
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 8615d661ab60..bcba84ea2d86 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -309,7 +309,8 @@ extern void tty_set_operations(struct tty_driver *driver,
309extern struct tty_driver *tty_find_polling_driver(char *name, int *line); 309extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
310 310
311extern void tty_driver_kref_put(struct tty_driver *driver); 311extern void tty_driver_kref_put(struct tty_driver *driver);
312extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) 312
313static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
313{ 314{
314 kref_get(&d->kref); 315 kref_get(&d->kref);
315 return d; 316 return d;
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index b95842542590..625e9e4639c6 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -29,7 +29,7 @@
29/** 29/**
30 * usb_serial_port: structure for the specific ports of a device. 30 * usb_serial_port: structure for the specific ports of a device.
31 * @serial: pointer back to the struct usb_serial owner of this port. 31 * @serial: pointer back to the struct usb_serial owner of this port.
32 * @tty: pointer to the corresponding tty for this port. 32 * @port: pointer to the corresponding tty_port for this port.
33 * @lock: spinlock to grab when updating portions of this structure. 33 * @lock: spinlock to grab when updating portions of this structure.
34 * @mutex: mutex used to synchronize serial_open() and serial_close() 34 * @mutex: mutex used to synchronize serial_open() and serial_close()
35 * access for this port. 35 * access for this port.
@@ -44,19 +44,22 @@
44 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe 44 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe
45 * for this port. 45 * for this port.
46 * @bulk_in_buffer: pointer to the bulk in buffer for this port. 46 * @bulk_in_buffer: pointer to the bulk in buffer for this port.
47 * @bulk_in_size: the size of the bulk_in_buffer, in bytes.
47 * @read_urb: pointer to the bulk in struct urb for this port. 48 * @read_urb: pointer to the bulk in struct urb for this port.
48 * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this 49 * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this
49 * port. 50 * port.
50 * @bulk_out_buffer: pointer to the bulk out buffer for this port. 51 * @bulk_out_buffer: pointer to the bulk out buffer for this port.
51 * @bulk_out_size: the size of the bulk_out_buffer, in bytes. 52 * @bulk_out_size: the size of the bulk_out_buffer, in bytes.
52 * @write_urb: pointer to the bulk out struct urb for this port. 53 * @write_urb: pointer to the bulk out struct urb for this port.
54 * @write_urb_busy: port`s writing status
53 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this 55 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
54 * port. 56 * port.
55 * @write_wait: a wait_queue_head_t used by the port. 57 * @write_wait: a wait_queue_head_t used by the port.
56 * @work: work queue entry for the line discipline waking up. 58 * @work: work queue entry for the line discipline waking up.
57 * @open_count: number of times this port has been opened.
58 * @throttled: nonzero if the read urb is inactive to throttle the device 59 * @throttled: nonzero if the read urb is inactive to throttle the device
59 * @throttle_req: nonzero if the tty wants to throttle us 60 * @throttle_req: nonzero if the tty wants to throttle us
61 * @console: attached usb serial console
62 * @dev: pointer to the serial device
60 * 63 *
61 * This structure is used by the usb-serial core and drivers for the specific 64 * This structure is used by the usb-serial core and drivers for the specific
62 * ports of a device. 65 * ports of a device.
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 139d234923cd..ebb2ea6b4995 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -737,6 +737,11 @@ struct v4l2_input {
737#define V4L2_IN_ST_NO_SIGNAL 0x00000002 737#define V4L2_IN_ST_NO_SIGNAL 0x00000002
738#define V4L2_IN_ST_NO_COLOR 0x00000004 738#define V4L2_IN_ST_NO_COLOR 0x00000004
739 739
740/* field 'status' - sensor orientation */
741/* If sensor is mounted upside down set both bits */
742#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */
743#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */
744
740/* field 'status' - analog */ 745/* field 'status' - analog */
741#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ 746#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */
742#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ 747#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 93445477f86a..9c1ed1fb6ddb 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -168,6 +168,8 @@ void writeback_set_ratelimit(void);
168/* pdflush.c */ 168/* pdflush.c */
169extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 169extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
170 read-only. */ 170 read-only. */
171extern int nr_pdflush_threads_max; /* Global so it can be exported to sysctl */
172extern int nr_pdflush_threads_min; /* Global so it can be exported to sysctl */
171 173
172 174
173#endif /* WRITEBACK_H */ 175#endif /* WRITEBACK_H */
diff --git a/include/media/msp3400.h b/include/media/msp3400.h
index 6ab854931c05..90cf22ada8b4 100644
--- a/include/media/msp3400.h
+++ b/include/media/msp3400.h
@@ -54,13 +54,13 @@
54 ======= 54 =======
55 55
56 So to specify a complete routing scheme for the msp3400 you will have to 56 So to specify a complete routing scheme for the msp3400 you will have to
57 specify in the 'input' field of the v4l2_routing struct: 57 specify in the 'input' arg of the s_routing function:
58 58
59 1) which tuner input to use 59 1) which tuner input to use
60 2) which SCART input to use 60 2) which SCART input to use
61 3) which DSP input to use for each DSP output 61 3) which DSP input to use for each DSP output
62 62
63 And in the 'output' field of the v4l2_routing struct you specify: 63 And in the 'output' arg of the s_routing function you specify:
64 64
65 1) which SCART input to use for each SCART output 65 1) which SCART input to use for each SCART output
66 66
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 57db48dd85b8..30d9629198ef 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -17,10 +17,45 @@
17#define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */ 17#define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */
18#define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */ 18#define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */
19 19
20/*
21 * for Edge ctrl
22 *
23 * strength also control Auto or Manual Edge Control Mode
24 * see also OV772X_MANUAL_EDGE_CTRL
25 */
26struct ov772x_edge_ctrl {
27 unsigned char strength;
28 unsigned char threshold;
29 unsigned char upper;
30 unsigned char lower;
31};
32
33#define OV772X_MANUAL_EDGE_CTRL 0x80 /* un-used bit of strength */
34#define EDGE_STRENGTH_MASK 0x1F
35#define EDGE_THRESHOLD_MASK 0x0F
36#define EDGE_UPPER_MASK 0xFF
37#define EDGE_LOWER_MASK 0xFF
38
39#define OV772X_AUTO_EDGECTRL(u, l) \
40{ \
41 .upper = (u & EDGE_UPPER_MASK), \
42 .lower = (l & EDGE_LOWER_MASK), \
43}
44
45#define OV772X_MANUAL_EDGECTRL(s, t) \
46{ \
47 .strength = (s & EDGE_STRENGTH_MASK) | OV772X_MANUAL_EDGE_CTRL,\
48 .threshold = (t & EDGE_THRESHOLD_MASK), \
49}
50
51/*
52 * ov772x camera info
53 */
20struct ov772x_camera_info { 54struct ov772x_camera_info {
21 unsigned long buswidth; 55 unsigned long buswidth;
22 unsigned long flags; 56 unsigned long flags;
23 struct soc_camera_link link; 57 struct soc_camera_link link;
58 struct ov772x_edge_ctrl edgectrl;
24}; 59};
25 60
26#endif /* __OV772X_H__ */ 61#endif /* __OV772X_H__ */
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index fff4235adae5..7a9f76ecbbbd 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -18,7 +18,7 @@
18#include <linux/vmalloc.h> /* for vmalloc() */ 18#include <linux/vmalloc.h> /* for vmalloc() */
19#include <linux/mm.h> /* for vmalloc_to_page() */ 19#include <linux/mm.h> /* for vmalloc_to_page() */
20 20
21#define SAA7146_VERSION_CODE 0x000500 /* 0.5.0 */ 21#define SAA7146_VERSION_CODE 0x000600 /* 0.6.0 */
22 22
23#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr))) 23#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr)))
24#define saa7146_read(sxy,adr) readl(sxy->mem+(adr)) 24#define saa7146_read(sxy,adr) readl(sxy->mem+(adr))
diff --git a/include/media/tvaudio.h b/include/media/tvaudio.h
index 6915aafc875a..1ac8184693f8 100644
--- a/include/media/tvaudio.h
+++ b/include/media/tvaudio.h
@@ -21,10 +21,29 @@
21#ifndef _TVAUDIO_H 21#ifndef _TVAUDIO_H
22#define _TVAUDIO_H 22#define _TVAUDIO_H
23 23
24#include <media/i2c-addr.h>
25
24/* The tvaudio module accepts the following inputs: */ 26/* The tvaudio module accepts the following inputs: */
25#define TVAUDIO_INPUT_TUNER 0 27#define TVAUDIO_INPUT_TUNER 0
26#define TVAUDIO_INPUT_RADIO 1 28#define TVAUDIO_INPUT_RADIO 1
27#define TVAUDIO_INPUT_EXTERN 2 29#define TVAUDIO_INPUT_EXTERN 2
28#define TVAUDIO_INPUT_INTERN 3 30#define TVAUDIO_INPUT_INTERN 3
29 31
32static inline const unsigned short *tvaudio_addrs(void)
33{
34 static const unsigned short addrs[] = {
35 I2C_ADDR_TDA8425 >> 1,
36 I2C_ADDR_TEA6300 >> 1,
37 I2C_ADDR_TEA6420 >> 1,
38 I2C_ADDR_TDA9840 >> 1,
39 I2C_ADDR_TDA985x_L >> 1,
40 I2C_ADDR_TDA985x_H >> 1,
41 I2C_ADDR_TDA9874 >> 1,
42 I2C_ADDR_PIC16C54 >> 1,
43 I2C_CLIENT_END
44 };
45
46 return addrs;
47}
48
30#endif 49#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 3a6905615d68..c48c24e4d0fa 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -125,7 +125,7 @@ int v4l2_chip_match_host(const struct v4l2_dbg_match *match);
125 125
126/* ------------------------------------------------------------------------- */ 126/* ------------------------------------------------------------------------- */
127 127
128/* Helper function for I2C legacy drivers */ 128/* I2C Helper functions */
129 129
130struct i2c_driver; 130struct i2c_driver;
131struct i2c_adapter; 131struct i2c_adapter;
@@ -135,21 +135,24 @@ struct v4l2_device;
135struct v4l2_subdev; 135struct v4l2_subdev;
136struct v4l2_subdev_ops; 136struct v4l2_subdev_ops;
137 137
138int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver,
139 const char *name,
140 int (*probe)(struct i2c_client *, const struct i2c_device_id *));
141 138
142/* Load an i2c module and return an initialized v4l2_subdev struct. 139/* Load an i2c module and return an initialized v4l2_subdev struct.
143 Only call request_module if module_name != NULL. 140 Only call request_module if module_name != NULL.
144 The client_type argument is the name of the chip that's on the adapter. */ 141 The client_type argument is the name of the chip that's on the adapter. */
145struct v4l2_subdev *v4l2_i2c_new_subdev(struct i2c_adapter *adapter, 142struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
143 struct i2c_adapter *adapter,
146 const char *module_name, const char *client_type, u8 addr); 144 const char *module_name, const char *client_type, u8 addr);
147/* Probe and load an i2c module and return an initialized v4l2_subdev struct. 145/* Probe and load an i2c module and return an initialized v4l2_subdev struct.
148 Only call request_module if module_name != NULL. 146 Only call request_module if module_name != NULL.
149 The client_type argument is the name of the chip that's on the adapter. */ 147 The client_type argument is the name of the chip that's on the adapter. */
150struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter, 148struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct v4l2_device *v4l2_dev,
149 struct i2c_adapter *adapter,
151 const char *module_name, const char *client_type, 150 const char *module_name, const char *client_type,
152 const unsigned short *addrs); 151 const unsigned short *addrs);
152/* Like v4l2_i2c_new_probed_subdev, except probe for a single address. */
153struct v4l2_subdev *v4l2_i2c_new_probed_subdev_addr(struct v4l2_device *v4l2_dev,
154 struct i2c_adapter *adapter,
155 const char *module_name, const char *client_type, u8 addr);
153/* Initialize an v4l2_subdev with data from an i2c_client struct */ 156/* Initialize an v4l2_subdev with data from an i2c_client struct */
154void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, 157void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
155 const struct v4l2_subdev_ops *ops); 158 const struct v4l2_subdev_ops *ops);
@@ -171,139 +174,23 @@ const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type);
171 174
172/* ------------------------------------------------------------------------- */ 175/* ------------------------------------------------------------------------- */
173 176
174/* Internal ioctls */ 177/* Note: these remaining ioctls/structs should be removed as well, but they are
175 178 still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and
176/* VIDIOC_INT_DECODE_VBI_LINE */ 179 v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup
177struct v4l2_decode_vbi_line { 180 is needed in those modules. */
178 u32 is_second_field; /* Set to 0 for the first (odd) field,
179 set to 1 for the second (even) field. */
180 u8 *p; /* Pointer to the sliced VBI data from the decoder.
181 On exit points to the start of the payload. */
182 u32 line; /* Line number of the sliced VBI data (1-23) */
183 u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */
184};
185 181
182/* s_config */
186struct v4l2_priv_tun_config { 183struct v4l2_priv_tun_config {
187 int tuner; 184 int tuner;
188 void *priv; 185 void *priv;
189}; 186};
190
191/* audio ioctls */
192
193/* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */
194#define AUDC_SET_RADIO _IO('d',88)
195
196/* tuner ioctls */
197
198/* Sets tuner type and its I2C addr */
199#define TUNER_SET_TYPE_ADDR _IOW('d', 90, int)
200
201/* Puts tuner on powersaving state, disabling it, except for i2c. To be replaced
202 by VIDIOC_INT_S_STANDBY. */
203#define TUNER_SET_STANDBY _IOW('d', 91, int)
204
205/* Sets tda9887 specific stuff, like port1, port2 and qss */
206#define TUNER_SET_CONFIG _IOW('d', 92, struct v4l2_priv_tun_config) 187#define TUNER_SET_CONFIG _IOW('d', 92, struct v4l2_priv_tun_config)
207 188
208/* Switch the tuner to a specific tuner mode. Replacement of AUDC_SET_RADIO */
209#define VIDIOC_INT_S_TUNER_MODE _IOW('d', 93, enum v4l2_tuner_type)
210
211/* Generic standby command. Passing -1 (all bits set to 1) will put the whole
212 chip into standby mode, value 0 will make the chip fully active. Specific
213 bits can be used by certain chips to enable/disable specific subsystems.
214 Replacement of TUNER_SET_STANDBY. */
215#define VIDIOC_INT_S_STANDBY _IOW('d', 94, u32)
216
217/* 100, 101 used by VIDIOC_DBG_[SG]_REGISTER */
218
219/* Generic reset command. The argument selects which subsystems to reset.
220 Passing 0 will always reset the whole chip. */
221#define VIDIOC_INT_RESET _IOW ('d', 102, u32) 189#define VIDIOC_INT_RESET _IOW ('d', 102, u32)
222 190
223/* Set the frequency (in Hz) of the audio clock output.
224 Used to slave an audio processor to the video decoder, ensuring that audio
225 and video remain synchronized.
226 Usual values for the frequency are 48000, 44100 or 32000 Hz.
227 If the frequency is not supported, then -EINVAL is returned. */
228#define VIDIOC_INT_AUDIO_CLOCK_FREQ _IOW ('d', 103, u32)
229
230/* Video decoders that support sliced VBI need to implement this ioctl.
231 Field p of the v4l2_sliced_vbi_line struct is set to the start of the VBI
232 data that was generated by the decoder. The driver then parses the sliced
233 VBI data and sets the other fields in the struct accordingly. The pointer p
234 is updated to point to the start of the payload which can be copied
235 verbatim into the data field of the v4l2_sliced_vbi_data struct. If no
236 valid VBI data was found, then the type field is set to 0 on return. */
237#define VIDIOC_INT_DECODE_VBI_LINE _IOWR('d', 104, struct v4l2_decode_vbi_line)
238
239/* Used to generate VBI signals on a video signal. v4l2_sliced_vbi_data is
240 filled with the data packets that should be output. Note that if you set
241 the line field to 0, then that VBI signal is disabled. If no
242 valid VBI data was found, then the type field is set to 0 on return. */
243#define VIDIOC_INT_S_VBI_DATA _IOW ('d', 105, struct v4l2_sliced_vbi_data)
244
245/* Used to obtain the sliced VBI packet from a readback register. Not all
246 video decoders support this. If no data is available because the readback
247 register contains invalid or erroneous data -EIO is returned. Note that
248 you must fill in the 'id' member and the 'field' member (to determine
249 whether CC data from the first or second field should be obtained). */
250#define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data)
251
252/* Sets I2S speed in bps. This is used to provide a standard way to select I2S
253 clock used by driving digital audio streams at some board designs.
254 Usual values for the frequency are 1024000 and 2048000.
255 If the frequency is not supported, then -EINVAL is returned. */
256#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32)
257
258/* Routing definition, device dependent. It specifies which inputs (if any)
259 should be routed to which outputs (if any). */
260struct v4l2_routing { 191struct v4l2_routing {
261 u32 input; 192 u32 input;
262 u32 output; 193 u32 output;
263}; 194};
264 195
265/* These internal commands should be used to define the inputs and outputs
266 of an audio/video chip. They will replace the v4l2 API commands
267 VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT, VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT
268 that are meant to be used by the user.
269 The internal commands should be used to switch inputs/outputs
270 because only the driver knows how to map a 'Television' input to the precise
271 input/output routing of an A/D converter, or a DSP, or a video digitizer.
272 These four commands should only be sent directly to an i2c device, they
273 should not be broadcast as the routing is very device specific. */
274#define VIDIOC_INT_S_AUDIO_ROUTING _IOW ('d', 109, struct v4l2_routing)
275#define VIDIOC_INT_G_AUDIO_ROUTING _IOR ('d', 110, struct v4l2_routing)
276#define VIDIOC_INT_S_VIDEO_ROUTING _IOW ('d', 111, struct v4l2_routing)
277#define VIDIOC_INT_G_VIDEO_ROUTING _IOR ('d', 112, struct v4l2_routing)
278
279struct v4l2_crystal_freq {
280 u32 freq; /* frequency in Hz of the crystal */
281 u32 flags; /* device specific flags */
282};
283
284/* Sets the frequency of the crystal used to generate the clocks.
285 An extra flags field allows device specific configuration regarding
286 clock frequency dividers, etc. If not used, then set flags to 0.
287 If the frequency is not supported, then -EINVAL is returned. */
288#define VIDIOC_INT_S_CRYSTAL_FREQ _IOW('d', 113, struct v4l2_crystal_freq)
289
290/* Initialize the sensor registors to some sort of reasonable
291 default values. */
292#define VIDIOC_INT_INIT _IOW('d', 114, u32)
293
294/* Set v4l2_std_id for video OUTPUT devices. This is ignored by
295 video input devices. */
296#define VIDIOC_INT_S_STD_OUTPUT _IOW('d', 115, v4l2_std_id)
297
298/* Get v4l2_std_id for video OUTPUT devices. This is ignored by
299 video input devices. */
300#define VIDIOC_INT_G_STD_OUTPUT _IOW('d', 116, v4l2_std_id)
301
302/* Set GPIO pins. Very simple right now, might need to be extended with
303 a v4l2_gpio struct if a direction is also needed. */
304#define VIDIOC_INT_S_GPIO _IOW('d', 117, u32)
305
306/* Get input status. Same as the status field in the v4l2_input struct. */
307#define VIDIOC_INT_G_INPUT_STATUS _IOR('d', 118, u32)
308
309#endif /* V4L2_COMMON_H_ */ 196#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-i2c-drv-legacy.h b/include/media/v4l2-i2c-drv-legacy.h
deleted file mode 100644
index e65dd9d84e8b..000000000000
--- a/include/media/v4l2-i2c-drv-legacy.h
+++ /dev/null
@@ -1,152 +0,0 @@
1/*
2 * v4l2-i2c-drv-legacy.h - contains I2C handling code that's identical
3 * for all V4L2 I2C drivers. Use this header if the
4 * I2C driver is used by both legacy drivers and
5 * drivers converted to the bus-based I2C API.
6 *
7 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24/* NOTE: the full version of this header is in the v4l-dvb repository
25 * and allows v4l i2c drivers to be compiled on older kernels as well.
26 * The version of this header as it appears in the kernel is a stripped
27 * version (without all the backwards compatibility stuff) and so it
28 * looks a bit odd.
29 *
30 * If you look at the full version then you will understand the reason
31 * for introducing this header since you really don't want to have all
32 * the tricky backwards compatibility code in each and every i2c driver.
33 */
34
35struct v4l2_i2c_driver_data {
36 const char * const name;
37 int driverid;
38 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
39 int (*probe)(struct i2c_client *client, const struct i2c_device_id *id);
40 int (*remove)(struct i2c_client *client);
41 int (*suspend)(struct i2c_client *client, pm_message_t state);
42 int (*resume)(struct i2c_client *client);
43 int (*legacy_probe)(struct i2c_adapter *adapter);
44 int legacy_class;
45 const struct i2c_device_id *id_table;
46};
47
48static struct v4l2_i2c_driver_data v4l2_i2c_data;
49static const struct i2c_client_address_data addr_data;
50static struct i2c_driver v4l2_i2c_driver_legacy;
51static char v4l2_i2c_drv_name_legacy[32];
52
53static int v4l2_i2c_drv_attach_legacy(struct i2c_adapter *adapter, int address, int kind)
54{
55 return v4l2_i2c_attach(adapter, address, &v4l2_i2c_driver_legacy,
56 v4l2_i2c_drv_name_legacy, v4l2_i2c_data.probe);
57}
58
59static int v4l2_i2c_drv_probe_legacy(struct i2c_adapter *adapter)
60{
61 if (v4l2_i2c_data.legacy_probe) {
62 if (v4l2_i2c_data.legacy_probe(adapter))
63 return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
64 return 0;
65 }
66 if (adapter->class & v4l2_i2c_data.legacy_class)
67 return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
68 return 0;
69}
70
71static int v4l2_i2c_drv_detach_legacy(struct i2c_client *client)
72{
73 int err;
74
75 if (v4l2_i2c_data.remove)
76 v4l2_i2c_data.remove(client);
77
78 err = i2c_detach_client(client);
79 if (err)
80 return err;
81 kfree(client);
82 return 0;
83}
84
85static int v4l2_i2c_drv_suspend_helper(struct i2c_client *client, pm_message_t state)
86{
87 return v4l2_i2c_data.suspend ? v4l2_i2c_data.suspend(client, state) : 0;
88}
89
90static int v4l2_i2c_drv_resume_helper(struct i2c_client *client)
91{
92 return v4l2_i2c_data.resume ? v4l2_i2c_data.resume(client) : 0;
93}
94
95/* ----------------------------------------------------------------------- */
96
97/* i2c implementation */
98static struct i2c_driver v4l2_i2c_driver_legacy = {
99 .driver = {
100 .owner = THIS_MODULE,
101 },
102 .attach_adapter = v4l2_i2c_drv_probe_legacy,
103 .detach_client = v4l2_i2c_drv_detach_legacy,
104 .suspend = v4l2_i2c_drv_suspend_helper,
105 .resume = v4l2_i2c_drv_resume_helper,
106};
107
108/* ----------------------------------------------------------------------- */
109
110/* i2c implementation */
111static struct i2c_driver v4l2_i2c_driver = {
112 .suspend = v4l2_i2c_drv_suspend_helper,
113 .resume = v4l2_i2c_drv_resume_helper,
114};
115
116static int __init v4l2_i2c_drv_init(void)
117{
118 int err;
119
120 strlcpy(v4l2_i2c_drv_name_legacy, v4l2_i2c_data.name, sizeof(v4l2_i2c_drv_name_legacy));
121 strlcat(v4l2_i2c_drv_name_legacy, "'", sizeof(v4l2_i2c_drv_name_legacy));
122
123 if (v4l2_i2c_data.legacy_class == 0)
124 v4l2_i2c_data.legacy_class = I2C_CLASS_TV_ANALOG;
125
126 v4l2_i2c_driver_legacy.driver.name = v4l2_i2c_drv_name_legacy;
127 v4l2_i2c_driver_legacy.id = v4l2_i2c_data.driverid;
128 v4l2_i2c_driver_legacy.command = v4l2_i2c_data.command;
129 err = i2c_add_driver(&v4l2_i2c_driver_legacy);
130
131 if (err)
132 return err;
133 v4l2_i2c_driver.driver.name = v4l2_i2c_data.name;
134 v4l2_i2c_driver.id = v4l2_i2c_data.driverid;
135 v4l2_i2c_driver.command = v4l2_i2c_data.command;
136 v4l2_i2c_driver.probe = v4l2_i2c_data.probe;
137 v4l2_i2c_driver.remove = v4l2_i2c_data.remove;
138 v4l2_i2c_driver.id_table = v4l2_i2c_data.id_table;
139 err = i2c_add_driver(&v4l2_i2c_driver);
140 if (err)
141 i2c_del_driver(&v4l2_i2c_driver_legacy);
142 return err;
143}
144
145static void __exit v4l2_i2c_drv_cleanup(void)
146{
147 i2c_del_driver(&v4l2_i2c_driver_legacy);
148 i2c_del_driver(&v4l2_i2c_driver);
149}
150
151module_init(v4l2_i2c_drv_init);
152module_exit(v4l2_i2c_drv_cleanup);
diff --git a/include/media/v4l2-i2c-drv.h b/include/media/v4l2-i2c-drv.h
index efdc8bf27f87..10a2882c3cbf 100644
--- a/include/media/v4l2-i2c-drv.h
+++ b/include/media/v4l2-i2c-drv.h
@@ -39,14 +39,11 @@
39 39
40struct v4l2_i2c_driver_data { 40struct v4l2_i2c_driver_data {
41 const char * const name; 41 const char * const name;
42 int driverid;
43 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg); 42 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
44 int (*probe)(struct i2c_client *client, const struct i2c_device_id *id); 43 int (*probe)(struct i2c_client *client, const struct i2c_device_id *id);
45 int (*remove)(struct i2c_client *client); 44 int (*remove)(struct i2c_client *client);
46 int (*suspend)(struct i2c_client *client, pm_message_t state); 45 int (*suspend)(struct i2c_client *client, pm_message_t state);
47 int (*resume)(struct i2c_client *client); 46 int (*resume)(struct i2c_client *client);
48 int (*legacy_probe)(struct i2c_adapter *adapter);
49 int legacy_class;
50 const struct i2c_device_id *id_table; 47 const struct i2c_device_id *id_table;
51}; 48};
52 49
@@ -54,12 +51,11 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data;
54static struct i2c_driver v4l2_i2c_driver; 51static struct i2c_driver v4l2_i2c_driver;
55 52
56 53
57/* Bus-based I2C implementation for kernels >= 2.6.22 */ 54/* Bus-based I2C implementation for kernels >= 2.6.26 */
58 55
59static int __init v4l2_i2c_drv_init(void) 56static int __init v4l2_i2c_drv_init(void)
60{ 57{
61 v4l2_i2c_driver.driver.name = v4l2_i2c_data.name; 58 v4l2_i2c_driver.driver.name = v4l2_i2c_data.name;
62 v4l2_i2c_driver.id = v4l2_i2c_data.driverid;
63 v4l2_i2c_driver.command = v4l2_i2c_data.command; 59 v4l2_i2c_driver.command = v4l2_i2c_data.command;
64 v4l2_i2c_driver.probe = v4l2_i2c_data.probe; 60 v4l2_i2c_driver.probe = v4l2_i2c_data.probe;
65 v4l2_i2c_driver.remove = v4l2_i2c_data.remove; 61 v4l2_i2c_driver.remove = v4l2_i2c_data.remove;
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 1d181b4ccb01..17856081c809 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -27,6 +27,16 @@ struct v4l2_device;
27struct v4l2_subdev; 27struct v4l2_subdev;
28struct tuner_setup; 28struct tuner_setup;
29 29
30/* decode_vbi_line */
31struct v4l2_decode_vbi_line {
32 u32 is_second_field; /* Set to 0 for the first (odd) field,
33 set to 1 for the second (even) field. */
34 u8 *p; /* Pointer to the sliced VBI data from the decoder.
35 On exit points to the start of the payload. */
36 u32 line; /* Line number of the sliced VBI data (1-23) */
37 u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */
38};
39
30/* Sub-devices are devices that are connected somehow to the main bridge 40/* Sub-devices are devices that are connected somehow to the main bridge
31 device. These devices are usually audio/video muxers/encoders/decoders or 41 device. These devices are usually audio/video muxers/encoders/decoders or
32 sensors and webcam controllers. 42 sensors and webcam controllers.
@@ -68,11 +78,26 @@ struct tuner_setup;
68 the use-case it might be better to use subdev-specific ops (currently 78 the use-case it might be better to use subdev-specific ops (currently
69 not yet implemented) since ops provide proper type-checking. 79 not yet implemented) since ops provide proper type-checking.
70 */ 80 */
81
82/* init: initialize the sensor registors to some sort of reasonable default
83 values. Do not use for new drivers and should be removed in existing
84 drivers.
85
86 load_fw: load firmware.
87
88 reset: generic reset command. The argument selects which subsystems to
89 reset. Passing 0 will always reset the whole chip. Do not use for new
90 drivers without discussing this first on the linux-media mailinglist.
91 There should be no reason normally to reset a device.
92
93 s_gpio: set GPIO pins. Very simple right now, might need to be extended with
94 a direction argument if needed.
95 */
71struct v4l2_subdev_core_ops { 96struct v4l2_subdev_core_ops {
72 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 97 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
73 int (*log_status)(struct v4l2_subdev *sd); 98 int (*log_status)(struct v4l2_subdev *sd);
74 int (*init)(struct v4l2_subdev *sd, u32 val); 99 int (*init)(struct v4l2_subdev *sd, u32 val);
75 int (*s_standby)(struct v4l2_subdev *sd, u32 standby); 100 int (*load_fw)(struct v4l2_subdev *sd);
76 int (*reset)(struct v4l2_subdev *sd, u32 val); 101 int (*reset)(struct v4l2_subdev *sd, u32 val);
77 int (*s_gpio)(struct v4l2_subdev *sd, u32 val); 102 int (*s_gpio)(struct v4l2_subdev *sd, u32 val);
78 int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc); 103 int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
@@ -82,6 +107,7 @@ struct v4l2_subdev_core_ops {
82 int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls); 107 int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
83 int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls); 108 int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
84 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm); 109 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
110 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
85 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); 111 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
86#ifdef CONFIG_VIDEO_ADV_DEBUG 112#ifdef CONFIG_VIDEO_ADV_DEBUG
87 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 113 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
@@ -89,6 +115,16 @@ struct v4l2_subdev_core_ops {
89#endif 115#endif
90}; 116};
91 117
118/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio.
119
120 s_radio: v4l device was opened in Radio mode, to be replaced by s_mode.
121
122 s_type_addr: sets tuner type and its I2C addr.
123
124 s_config: sets tda9887 specific stuff, like port1, port2 and qss
125
126 s_standby: puts tuner on powersaving state, disabling it, except for i2c.
127 */
92struct v4l2_subdev_tuner_ops { 128struct v4l2_subdev_tuner_ops {
93 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type); 129 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type);
94 int (*s_radio)(struct v4l2_subdev *sd); 130 int (*s_radio)(struct v4l2_subdev *sd);
@@ -96,20 +132,77 @@ struct v4l2_subdev_tuner_ops {
96 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); 132 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
97 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 133 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
98 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 134 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
99 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
100 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); 135 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
101 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); 136 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
137 int (*s_standby)(struct v4l2_subdev *sd);
102}; 138};
103 139
140/* s_clock_freq: set the frequency (in Hz) of the audio clock output.
141 Used to slave an audio processor to the video decoder, ensuring that
142 audio and video remain synchronized. Usual values for the frequency
143 are 48000, 44100 or 32000 Hz. If the frequency is not supported, then
144 -EINVAL is returned.
145
146 s_i2s_clock_freq: sets I2S speed in bps. This is used to provide a standard
147 way to select I2S clock used by driving digital audio streams at some
148 board designs. Usual values for the frequency are 1024000 and 2048000.
149 If the frequency is not supported, then -EINVAL is returned.
150
151 s_routing: used to define the input and/or output pins of an audio chip,
152 and any additional configuration data.
153 Never attempt to use user-level input IDs (e.g. Composite, S-Video,
154 Tuner) at this level. An i2c device shouldn't know about whether an
155 input pin is connected to a Composite connector, become on another
156 board or platform it might be connected to something else entirely.
157 The calling driver is responsible for mapping a user-level input to
158 the right pins on the i2c device.
159 */
104struct v4l2_subdev_audio_ops { 160struct v4l2_subdev_audio_ops {
105 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq); 161 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
106 int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq); 162 int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
107 int (*s_routing)(struct v4l2_subdev *sd, const struct v4l2_routing *route); 163 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
108}; 164};
109 165
166/*
167 decode_vbi_line: video decoders that support sliced VBI need to implement
168 this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
169 start of the VBI data that was generated by the decoder. The driver
170 then parses the sliced VBI data and sets the other fields in the
171 struct accordingly. The pointer p is updated to point to the start of
172 the payload which can be copied verbatim into the data field of the
173 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
174 type field is set to 0 on return.
175
176 s_vbi_data: used to generate VBI signals on a video signal.
177 v4l2_sliced_vbi_data is filled with the data packets that should be
178 output. Note that if you set the line field to 0, then that VBI signal
179 is disabled. If no valid VBI data was found, then the type field is
180 set to 0 on return.
181
182 g_vbi_data: used to obtain the sliced VBI packet from a readback register.
183 Not all video decoders support this. If no data is available because
184 the readback register contains invalid or erroneous data -EIO is
185 returned. Note that you must fill in the 'id' member and the 'field'
186 member (to determine whether CC data from the first or second field
187 should be obtained).
188
189 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
190 video input devices.
191
192 s_crystal_freq: sets the frequency of the crystal used to generate the
193 clocks in Hz. An extra flags field allows device specific configuration
194 regarding clock frequency dividers, etc. If not used, then set flags
195 to 0. If the frequency is not supported, then -EINVAL is returned.
196
197 g_input_status: get input status. Same as the status field in the v4l2_input
198 struct.
199
200 s_routing: see s_routing in audio_ops, except this version is for video
201 devices.
202 */
110struct v4l2_subdev_video_ops { 203struct v4l2_subdev_video_ops {
111 int (*s_routing)(struct v4l2_subdev *sd, const struct v4l2_routing *route); 204 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
112 int (*s_crystal_freq)(struct v4l2_subdev *sd, struct v4l2_crystal_freq *freq); 205 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
113 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line); 206 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
114 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data); 207 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
115 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data); 208 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
@@ -163,18 +256,6 @@ static inline void *v4l2_get_subdevdata(const struct v4l2_subdev *sd)
163 return sd->priv; 256 return sd->priv;
164} 257}
165 258
166/* Convert an ioctl-type command to the proper v4l2_subdev_ops function call.
167 This is used by subdev modules that can be called by both old-style ioctl
168 commands and through the v4l2_subdev_ops.
169
170 The ioctl API of the subdev driver can call this function to call the
171 right ops based on the ioctl cmd and arg.
172
173 Once all subdev drivers have been converted and all drivers no longer
174 use the ioctl interface, then this function can be removed.
175 */
176int v4l2_subdev_command(struct v4l2_subdev *sd, unsigned cmd, void *arg);
177
178static inline void v4l2_subdev_init(struct v4l2_subdev *sd, 259static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
179 const struct v4l2_subdev_ops *ops) 260 const struct v4l2_subdev_ops *ops)
180{ 261{
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index ab17a159ac66..a9652806d0df 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -99,9 +99,12 @@ void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
99 const union nf_inet_addr *, 99 const union nf_inet_addr *,
100 u_int8_t, const __be16 *, const __be16 *); 100 u_int8_t, const __be16 *, const __be16 *);
101void nf_ct_expect_put(struct nf_conntrack_expect *exp); 101void nf_ct_expect_put(struct nf_conntrack_expect *exp);
102int nf_ct_expect_related(struct nf_conntrack_expect *expect);
103int nf_ct_expect_related_report(struct nf_conntrack_expect *expect, 102int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
104 u32 pid, int report); 103 u32 pid, int report);
104static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect)
105{
106 return nf_ct_expect_related_report(expect, 0, 0);
107}
105 108
106#endif /*_NF_CONNTRACK_EXPECT_H*/ 109#endif /*_NF_CONNTRACK_EXPECT_H*/
107 110
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h
new file mode 100644
index 000000000000..0627a9ae6347
--- /dev/null
+++ b/include/scsi/fc/fc_fip.h
@@ -0,0 +1,237 @@
1/*
2 * Copyright 2008 Cisco Systems, Inc. All rights reserved.
3 *
4 * This program is free software; you may redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15 * SOFTWARE.
16 */
17#ifndef _FC_FIP_H_
18#define _FC_FIP_H_
19
20/*
21 * This version is based on:
22 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf
23 */
24
25/*
26 * The FIP ethertype eventually goes in net/if_ether.h.
27 */
28#ifndef ETH_P_FIP
29#define ETH_P_FIP 0x8914 /* FIP Ethertype */
30#endif
31
32#define FIP_DEF_PRI 128 /* default selection priority */
33#define FIP_DEF_FC_MAP 0x0efc00 /* default FCoE MAP (MAC OUI) value */
34#define FIP_DEF_FKA 8000 /* default FCF keep-alive/advert period (mS) */
35#define FIP_VN_KA_PERIOD 90000 /* required VN_port keep-alive period (mS) */
36#define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */
37
38/*
39 * Multicast MAC addresses. T11-adopted.
40 */
41#define FIP_ALL_FCOE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 0 })
42#define FIP_ALL_ENODE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 1 })
43#define FIP_ALL_FCF_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
44
45#define FIP_VER 1 /* version for fip_header */
46
47struct fip_header {
48 __u8 fip_ver; /* upper 4 bits are the version */
49 __u8 fip_resv1; /* reserved */
50 __be16 fip_op; /* operation code */
51 __u8 fip_resv2; /* reserved */
52 __u8 fip_subcode; /* lower 4 bits are sub-code */
53 __be16 fip_dl_len; /* length of descriptors in words */
54 __be16 fip_flags; /* header flags */
55} __attribute__((packed));
56
57#define FIP_VER_SHIFT 4
58#define FIP_VER_ENCAPS(v) ((v) << FIP_VER_SHIFT)
59#define FIP_VER_DECAPS(v) ((v) >> FIP_VER_SHIFT)
60#define FIP_BPW 4 /* bytes per word for lengths */
61
62/*
63 * fip_op.
64 */
65enum fip_opcode {
66 FIP_OP_DISC = 1, /* discovery, advertisement, etc. */
67 FIP_OP_LS = 2, /* Link Service request or reply */
68 FIP_OP_CTRL = 3, /* Keep Alive / Link Reset */
69 FIP_OP_VLAN = 4, /* VLAN discovery */
70 FIP_OP_VENDOR_MIN = 0xfff8, /* min vendor-specific opcode */
71 FIP_OP_VENDOR_MAX = 0xfffe, /* max vendor-specific opcode */
72};
73
74/*
75 * Subcodes for FIP_OP_DISC.
76 */
77enum fip_disc_subcode {
78 FIP_SC_SOL = 1, /* solicitation */
79 FIP_SC_ADV = 2, /* advertisement */
80};
81
82/*
83 * Subcodes for FIP_OP_LS.
84 */
85enum fip_trans_subcode {
86 FIP_SC_REQ = 1, /* request */
87 FIP_SC_REP = 2, /* reply */
88};
89
90/*
91 * Subcodes for FIP_OP_RESET.
92 */
93enum fip_reset_subcode {
94 FIP_SC_KEEP_ALIVE = 1, /* keep-alive from VN_Port */
95 FIP_SC_CLR_VLINK = 2, /* clear virtual link from VF_Port */
96};
97
98/*
99 * Subcodes for FIP_OP_VLAN.
100 */
101enum fip_vlan_subcode {
102 FIP_SC_VL_REQ = 1, /* request */
103 FIP_SC_VL_REP = 2, /* reply */
104};
105
106/*
107 * flags in header fip_flags.
108 */
109enum fip_flag {
110 FIP_FL_FPMA = 0x8000, /* supports FPMA fabric-provided MACs */
111 FIP_FL_SPMA = 0x4000, /* supports SPMA server-provided MACs */
112 FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */
113 FIP_FL_SOL = 0x0002, /* this is a solicited message */
114 FIP_FL_FPORT = 0x0001, /* sent from an F port */
115};
116
117/*
118 * Common descriptor header format.
119 */
120struct fip_desc {
121 __u8 fip_dtype; /* type - see below */
122 __u8 fip_dlen; /* length - in 32-bit words */
123};
124
125enum fip_desc_type {
126 FIP_DT_PRI = 1, /* priority for forwarder selection */
127 FIP_DT_MAC = 2, /* MAC address */
128 FIP_DT_MAP_OUI = 3, /* FC-MAP OUI */
129 FIP_DT_NAME = 4, /* switch name or node name */
130 FIP_DT_FAB = 5, /* fabric descriptor */
131 FIP_DT_FCOE_SIZE = 6, /* max FCoE frame size */
132 FIP_DT_FLOGI = 7, /* FLOGI request or response */
133 FIP_DT_FDISC = 8, /* FDISC request or response */
134 FIP_DT_LOGO = 9, /* LOGO request or response */
135 FIP_DT_ELP = 10, /* ELP request or response */
136 FIP_DT_VN_ID = 11, /* VN_Node Identifier */
137 FIP_DT_FKA = 12, /* advertisement keep-alive period */
138 FIP_DT_VENDOR = 13, /* vendor ID */
139 FIP_DT_VLAN = 14, /* vlan number */
140 FIP_DT_LIMIT, /* max defined desc_type + 1 */
141 FIP_DT_VENDOR_BASE = 128, /* first vendor-specific desc_type */
142};
143
144/*
145 * FIP_DT_PRI - priority descriptor.
146 */
147struct fip_pri_desc {
148 struct fip_desc fd_desc;
149 __u8 fd_resvd;
150 __u8 fd_pri; /* FCF priority: higher is better */
151} __attribute__((packed));
152
153/*
154 * FIP_DT_MAC - MAC address descriptor.
155 */
156struct fip_mac_desc {
157 struct fip_desc fd_desc;
158 __u8 fd_mac[ETH_ALEN];
159} __attribute__((packed));
160
161/*
162 * FIP_DT_MAP - descriptor.
163 */
164struct fip_map_desc {
165 struct fip_desc fd_desc;
166 __u8 fd_resvd[3];
167 __u8 fd_map[3];
168} __attribute__((packed));
169
170/*
171 * FIP_DT_NAME descriptor.
172 */
173struct fip_wwn_desc {
174 struct fip_desc fd_desc;
175 __u8 fd_resvd[2];
176 __be64 fd_wwn; /* 64-bit WWN, unaligned */
177} __attribute__((packed));
178
179/*
180 * FIP_DT_FAB descriptor.
181 */
182struct fip_fab_desc {
183 struct fip_desc fd_desc;
184 __be16 fd_vfid; /* virtual fabric ID */
185 __u8 fd_resvd;
186 __u8 fd_map[3]; /* FC-MAP value */
187 __be64 fd_wwn; /* fabric name, unaligned */
188} __attribute__((packed));
189
190/*
191 * FIP_DT_FCOE_SIZE descriptor.
192 */
193struct fip_size_desc {
194 struct fip_desc fd_desc;
195 __be16 fd_size;
196} __attribute__((packed));
197
198/*
199 * Descriptor that encapsulates an ELS or ILS frame.
200 * The encapsulated frame immediately follows this header, without
201 * SOF, EOF, or CRC.
202 */
203struct fip_encaps {
204 struct fip_desc fd_desc;
205 __u8 fd_resvd[2];
206} __attribute__((packed));
207
208/*
209 * FIP_DT_VN_ID - VN_Node Identifier descriptor.
210 */
211struct fip_vn_desc {
212 struct fip_desc fd_desc;
213 __u8 fd_mac[ETH_ALEN];
214 __u8 fd_resvd;
215 __u8 fd_fc_id[3];
216 __be64 fd_wwpn; /* port name, unaligned */
217} __attribute__((packed));
218
219/*
220 * FIP_DT_FKA - Advertisement keep-alive period.
221 */
222struct fip_fka_desc {
223 struct fip_desc fd_desc;
224 __u8 fd_resvd[2];
225 __be32 fd_fka_period; /* adv./keep-alive period in mS */
226} __attribute__((packed));
227
228/*
229 * FIP_DT_VENDOR descriptor.
230 */
231struct fip_vendor_desc {
232 struct fip_desc fd_desc;
233 __u8 fd_resvd[2];
234 __u8 fd_vendor_id[8];
235} __attribute__((packed));
236
237#endif /* _FC_FIP_H_ */
diff --git a/include/scsi/fc_transport_fcoe.h b/include/scsi/fc_transport_fcoe.h
deleted file mode 100644
index 8dca2af14ffc..000000000000
--- a/include/scsi/fc_transport_fcoe.h
+++ /dev/null
@@ -1,54 +0,0 @@
1#ifndef FC_TRANSPORT_FCOE_H
2#define FC_TRANSPORT_FCOE_H
3
4#include <linux/device.h>
5#include <linux/netdevice.h>
6#include <scsi/scsi_host.h>
7#include <scsi/libfc.h>
8
9/**
10 * struct fcoe_transport - FCoE transport struct for generic transport
11 * for Ethernet devices as well as pure HBAs
12 *
13 * @name: name for thsi transport
14 * @bus: physical bus type (pci_bus_type)
15 * @driver: physical bus driver for network device
16 * @create: entry create function
17 * @destroy: exit destroy function
18 * @list: list of transports
19 */
20struct fcoe_transport {
21 char *name;
22 unsigned short vendor;
23 unsigned short device;
24 struct bus_type *bus;
25 struct device_driver *driver;
26 int (*create)(struct net_device *device);
27 int (*destroy)(struct net_device *device);
28 bool (*match)(struct net_device *device);
29 struct list_head list;
30 struct list_head devlist;
31 struct mutex devlock;
32};
33
34/**
35 * MODULE_ALIAS_FCOE_PCI
36 *
37 * some care must be taken with this, vendor and device MUST be a hex value
38 * preceded with 0x and with letters in lower case (0x12ab, not 0x12AB or 12AB)
39 */
40#define MODULE_ALIAS_FCOE_PCI(vendor, device) \
41 MODULE_ALIAS("fcoe-pci-" __stringify(vendor) "-" __stringify(device))
42
43/* exported funcs */
44int fcoe_transport_attach(struct net_device *netdev);
45int fcoe_transport_release(struct net_device *netdev);
46int fcoe_transport_register(struct fcoe_transport *t);
47int fcoe_transport_unregister(struct fcoe_transport *t);
48int fcoe_load_transport_driver(struct net_device *netdev);
49int __init fcoe_transport_init(void);
50int __exit fcoe_transport_exit(void);
51
52/* fcow_sw is the default transport */
53extern struct fcoe_transport fcoe_sw_transport;
54#endif /* FC_TRANSPORT_FCOE_H */
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index a70eafaad084..0303a6a098cc 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/timer.h> 23#include <linux/timer.h>
24#include <linux/if.h> 24#include <linux/if.h>
25#include <linux/percpu.h>
25 26
26#include <scsi/scsi_transport.h> 27#include <scsi/scsi_transport.h>
27#include <scsi/scsi_transport_fc.h> 28#include <scsi/scsi_transport_fc.h>
@@ -661,7 +662,8 @@ struct fc_lport {
661 unsigned long boot_time; 662 unsigned long boot_time;
662 663
663 struct fc_host_statistics host_stats; 664 struct fc_host_statistics host_stats;
664 struct fcoe_dev_stats *dev_stats[NR_CPUS]; 665 struct fcoe_dev_stats *dev_stats;
666
665 u64 wwpn; 667 u64 wwpn;
666 u64 wwnn; 668 u64 wwnn;
667 u8 retry_count; 669 u8 retry_count;
@@ -694,11 +696,6 @@ struct fc_lport {
694/* 696/*
695 * FC_LPORT HELPER FUNCTIONS 697 * FC_LPORT HELPER FUNCTIONS
696 *****************************/ 698 *****************************/
697static inline void *lport_priv(const struct fc_lport *lp)
698{
699 return (void *)(lp + 1);
700}
701
702static inline int fc_lport_test_ready(struct fc_lport *lp) 699static inline int fc_lport_test_ready(struct fc_lport *lp)
703{ 700{
704 return lp->state == LPORT_ST_READY; 701 return lp->state == LPORT_ST_READY;
@@ -722,6 +719,42 @@ static inline void fc_lport_state_enter(struct fc_lport *lp,
722 lp->state = state; 719 lp->state = state;
723} 720}
724 721
722static inline int fc_lport_init_stats(struct fc_lport *lp)
723{
724 /* allocate per cpu stats block */
725 lp->dev_stats = alloc_percpu(struct fcoe_dev_stats);
726 if (!lp->dev_stats)
727 return -ENOMEM;
728 return 0;
729}
730
731static inline void fc_lport_free_stats(struct fc_lport *lp)
732{
733 free_percpu(lp->dev_stats);
734}
735
736static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lp)
737{
738 return per_cpu_ptr(lp->dev_stats, smp_processor_id());
739}
740
741static inline void *lport_priv(const struct fc_lport *lp)
742{
743 return (void *)(lp + 1);
744}
745
746/**
747 * libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport
748 * @sht: ptr to the scsi host templ
749 * @priv_size: size of private data after fc_lport
750 *
751 * Returns: ptr to Scsi_Host
752 */
753static inline struct Scsi_Host *
754libfc_host_alloc(struct scsi_host_template *sht, int priv_size)
755{
756 return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size);
757}
725 758
726/* 759/*
727 * LOCAL PORT LAYER 760 * LOCAL PORT LAYER
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index c41f7d0c6efc..666cc131732e 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright(c) 2007 - 2008 Intel Corporation. All rights reserved. 2 * Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2007-2008 Intel Corporation. All rights reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
@@ -20,134 +21,144 @@
20#ifndef _LIBFCOE_H 21#ifndef _LIBFCOE_H
21#define _LIBFCOE_H 22#define _LIBFCOE_H
22 23
24#include <linux/etherdevice.h>
25#include <linux/if_ether.h>
23#include <linux/netdevice.h> 26#include <linux/netdevice.h>
24#include <linux/skbuff.h> 27#include <linux/skbuff.h>
28#include <linux/workqueue.h>
25#include <scsi/fc/fc_fcoe.h> 29#include <scsi/fc/fc_fcoe.h>
26#include <scsi/libfc.h> 30#include <scsi/libfc.h>
27 31
28/* 32/*
29 * this percpu struct for fcoe 33 * FIP tunable parameters.
30 */ 34 */
31struct fcoe_percpu_s { 35#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */
32 int cpu; 36#define FCOE_CTRL_SOL_TOV 2000 /* min. solicitation interval (mS) */
33 struct task_struct *thread; 37#define FCOE_CTLR_FCF_LIMIT 20 /* max. number of FCF entries */
34 struct sk_buff_head fcoe_rx_list; 38
35 struct page *crc_eof_page; 39/**
36 int crc_eof_offset; 40 * enum fip_state - internal state of FCoE controller.
41 * @FIP_ST_DISABLED: controller has been disabled or not yet enabled.
42 * @FIP_ST_LINK_WAIT: the physical link is down or unusable.
43 * @FIP_ST_AUTO: determining whether to use FIP or non-FIP mode.
44 * @FIP_ST_NON_FIP: non-FIP mode selected.
45 * @FIP_ST_ENABLED: FIP mode selected.
46 */
47enum fip_state {
48 FIP_ST_DISABLED,
49 FIP_ST_LINK_WAIT,
50 FIP_ST_AUTO,
51 FIP_ST_NON_FIP,
52 FIP_ST_ENABLED,
37}; 53};
38 54
39/* 55/**
40 * the fcoe sw transport private data 56 * struct fcoe_ctlr - FCoE Controller and FIP state.
57 * @state: internal FIP state for network link and FIP or non-FIP mode.
58 * @lp: &fc_lport: libfc local port.
59 * @sel_fcf: currently selected FCF, or NULL.
60 * @fcfs: list of discovered FCFs.
61 * @fcf_count: number of discovered FCF entries.
62 * @sol_time: time when a multicast solicitation was last sent.
63 * @sel_time: time after which to select an FCF.
64 * @port_ka_time: time of next port keep-alive.
65 * @ctlr_ka_time: time of next controller keep-alive.
66 * @timer: timer struct used for all delayed events.
67 * @link_work: &work_struct for doing FCF selection.
68 * @recv_work: &work_struct for receiving FIP frames.
69 * @fip_recv_list: list of received FIP frames.
70 * @user_mfs: configured maximum FC frame size, including FC header.
71 * @flogi_oxid: exchange ID of most recent fabric login.
72 * @flogi_count: number of FLOGI attempts in AUTO mode.
73 * @link: current link status for libfc.
74 * @last_link: last link state reported to libfc.
75 * @map_dest: use the FC_MAP mode for destination MAC addresses.
76 * @dest_addr: MAC address of the selected FC forwarder.
77 * @ctl_src_addr: the native MAC address of our local port.
78 * @data_src_addr: the assigned MAC address for the local port after FLOGI.
79 * @send: LLD-supplied function to handle sending of FIP Ethernet frames.
80 * @update_mac: LLD-supplied function to handle changes to MAC addresses.
81 * @lock: lock protecting this structure.
82 *
83 * This structure is used by all FCoE drivers. It contains information
84 * needed by all FCoE low-level drivers (LLDs) as well as internal state
85 * for FIP, and fields shared with the LLDS.
41 */ 86 */
42struct fcoe_softc { 87struct fcoe_ctlr {
43 struct list_head list; 88 enum fip_state state;
44 struct fc_lport *lp; 89 struct fc_lport *lp;
45 struct net_device *real_dev; 90 struct fcoe_fcf *sel_fcf;
46 struct net_device *phys_dev; /* device with ethtool_ops */ 91 struct list_head fcfs;
47 struct packet_type fcoe_packet_type; 92 u16 fcf_count;
48 struct sk_buff_head fcoe_pending_queue; 93 unsigned long sol_time;
49 u8 fcoe_pending_queue_active; 94 unsigned long sel_time;
50 95 unsigned long port_ka_time;
96 unsigned long ctlr_ka_time;
97 struct timer_list timer;
98 struct work_struct link_work;
99 struct work_struct recv_work;
100 struct sk_buff_head fip_recv_list;
101 u16 user_mfs;
102 u16 flogi_oxid;
103 u8 flogi_count;
104 u8 link;
105 u8 last_link;
106 u8 map_dest;
51 u8 dest_addr[ETH_ALEN]; 107 u8 dest_addr[ETH_ALEN];
52 u8 ctl_src_addr[ETH_ALEN]; 108 u8 ctl_src_addr[ETH_ALEN];
53 u8 data_src_addr[ETH_ALEN]; 109 u8 data_src_addr[ETH_ALEN];
54 /*
55 * fcoe protocol address learning related stuff
56 */
57 u16 flogi_oxid;
58 u8 flogi_progress;
59 u8 address_mode;
60};
61
62static inline struct net_device *fcoe_netdev(
63 const struct fc_lport *lp)
64{
65 return ((struct fcoe_softc *)lport_priv(lp))->real_dev;
66}
67
68static inline struct fcoe_hdr *skb_fcoe_header(const struct sk_buff *skb)
69{
70 return (struct fcoe_hdr *)skb_network_header(skb);
71}
72
73static inline int skb_fcoe_offset(const struct sk_buff *skb)
74{
75 return skb_network_offset(skb);
76}
77
78static inline struct fc_frame_header *skb_fc_header(const struct sk_buff *skb)
79{
80 return (struct fc_frame_header *)skb_transport_header(skb);
81}
82
83static inline int skb_fc_offset(const struct sk_buff *skb)
84{
85 return skb_transport_offset(skb);
86}
87 110
88static inline void skb_reset_fc_header(struct sk_buff *skb) 111 void (*send)(struct fcoe_ctlr *, struct sk_buff *);
89{ 112 void (*update_mac)(struct fcoe_ctlr *, u8 *old, u8 *new);
90 skb_reset_network_header(skb); 113 spinlock_t lock;
91 skb_set_transport_header(skb, skb_network_offset(skb) + 114};
92 sizeof(struct fcoe_hdr));
93}
94
95static inline bool skb_fc_is_data(const struct sk_buff *skb)
96{
97 return skb_fc_header(skb)->fh_r_ctl == FC_RCTL_DD_SOL_DATA;
98}
99
100static inline bool skb_fc_is_cmd(const struct sk_buff *skb)
101{
102 return skb_fc_header(skb)->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD;
103}
104 115
105static inline bool skb_fc_has_exthdr(const struct sk_buff *skb) 116/*
106{ 117 * struct fcoe_fcf - Fibre-Channel Forwarder.
107 return (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_VFTH) || 118 * @list: list linkage.
108 (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_IFRH) || 119 * @time: system time (jiffies) when an advertisement was last received.
109 (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_ENCH); 120 * @switch_name: WWN of switch from advertisement.
110} 121 * @fabric_name: WWN of fabric from advertisement.
122 * @fc_map: FC_MAP value from advertisement.
123 * @fcf_mac: Ethernet address of the FCF.
124 * @vfid: virtual fabric ID.
125 * @pri: seletion priority, smaller values are better.
126 * @flags: flags received from advertisement.
127 * @fka_period: keep-alive period, in jiffies.
128 *
129 * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that
130 * passes FCoE frames on to an FC fabric. This structure represents
131 * one FCF from which advertisements have been received.
132 *
133 * When looking up an FCF, @switch_name, @fabric_name, @fc_map, @vfid, and
134 * @fcf_mac together form the lookup key.
135 */
136struct fcoe_fcf {
137 struct list_head list;
138 unsigned long time;
111 139
112static inline bool skb_fc_is_roff(const struct sk_buff *skb) 140 u64 switch_name;
113{ 141 u64 fabric_name;
114 return skb_fc_header(skb)->fh_f_ctl[2] & FC_FC_REL_OFF; 142 u32 fc_map;
115} 143 u16 vfid;
144 u8 fcf_mac[ETH_ALEN];
116 145
117static inline u16 skb_fc_oxid(const struct sk_buff *skb) 146 u8 pri;
118{ 147 u16 flags;
119 return be16_to_cpu(skb_fc_header(skb)->fh_ox_id); 148 u32 fka_period;
120} 149};
121 150
122static inline u16 skb_fc_rxid(const struct sk_buff *skb) 151/* FIP API functions */
123{ 152void fcoe_ctlr_init(struct fcoe_ctlr *);
124 return be16_to_cpu(skb_fc_header(skb)->fh_rx_id); 153void fcoe_ctlr_destroy(struct fcoe_ctlr *);
125} 154void fcoe_ctlr_link_up(struct fcoe_ctlr *);
155int fcoe_ctlr_link_down(struct fcoe_ctlr *);
156int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct sk_buff *);
157void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *);
158int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_frame *fp, u8 *sa);
126 159
127/* libfcoe funcs */ 160/* libfcoe funcs */
128int fcoe_reset(struct Scsi_Host *shost); 161u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
129u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN],
130 unsigned int scheme, unsigned int port);
131
132u32 fcoe_fc_crc(struct fc_frame *fp);
133int fcoe_xmit(struct fc_lport *, struct fc_frame *);
134int fcoe_rcv(struct sk_buff *, struct net_device *,
135 struct packet_type *, struct net_device *);
136
137int fcoe_percpu_receive_thread(void *arg);
138void fcoe_clean_pending_queue(struct fc_lport *lp);
139void fcoe_percpu_clean(struct fc_lport *lp);
140void fcoe_watchdog(ulong vp);
141int fcoe_link_ok(struct fc_lport *lp);
142
143struct fc_lport *fcoe_hostlist_lookup(const struct net_device *);
144int fcoe_hostlist_add(const struct fc_lport *);
145int fcoe_hostlist_remove(const struct fc_lport *);
146
147struct Scsi_Host *fcoe_host_alloc(struct scsi_host_template *, int);
148int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *); 162int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *);
149 163
150/* fcoe sw hba */
151int __init fcoe_sw_init(void);
152int __exit fcoe_sw_exit(void);
153#endif /* _LIBFCOE_H */ 164#endif /* _LIBFCOE_H */
diff --git a/include/scsi/scsi_scan.h b/include/scsi/scsi_scan.h
new file mode 100644
index 000000000000..78898889243d
--- /dev/null
+++ b/include/scsi/scsi_scan.h
@@ -0,0 +1,11 @@
1#ifndef _SCSI_SCSI_SCAN_H
2#define _SCSI_SCSI_SCAN_H
3
4#ifdef CONFIG_SCSI
5/* drivers/scsi/scsi_scan.c */
6extern int scsi_complete_async_scans(void);
7#else
8static inline int scsi_complete_async_scans(void) { return 0; }
9#endif
10
11#endif /* _SCSI_SCSI_SCAN_H */
diff --git a/include/trace/kmemtrace.h b/include/trace/kmemtrace.h
index ad8b7857855a..28ee69f9cd46 100644
--- a/include/trace/kmemtrace.h
+++ b/include/trace/kmemtrace.h
@@ -9,65 +9,53 @@
9 9
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12#include <linux/tracepoint.h>
12#include <linux/types.h> 13#include <linux/types.h>
13#include <linux/marker.h>
14
15enum kmemtrace_type_id {
16 KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */
17 KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */
18 KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */
19};
20 14
21#ifdef CONFIG_KMEMTRACE 15#ifdef CONFIG_KMEMTRACE
22
23extern void kmemtrace_init(void); 16extern void kmemtrace_init(void);
24 17#else
25extern void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id,
26 unsigned long call_site,
27 const void *ptr,
28 size_t bytes_req,
29 size_t bytes_alloc,
30 gfp_t gfp_flags,
31 int node);
32
33extern void kmemtrace_mark_free(enum kmemtrace_type_id type_id,
34 unsigned long call_site,
35 const void *ptr);
36
37#else /* CONFIG_KMEMTRACE */
38
39static inline void kmemtrace_init(void) 18static inline void kmemtrace_init(void)
40{ 19{
41} 20}
42 21#endif
43static inline void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id, 22
44 unsigned long call_site, 23DECLARE_TRACE(kmalloc,
45 const void *ptr, 24 TP_PROTO(unsigned long call_site,
46 size_t bytes_req, 25 const void *ptr,
47 size_t bytes_alloc, 26 size_t bytes_req,
48 gfp_t gfp_flags, 27 size_t bytes_alloc,
49 int node) 28 gfp_t gfp_flags),
50{ 29 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags));
51} 30DECLARE_TRACE(kmem_cache_alloc,
52 31 TP_PROTO(unsigned long call_site,
53static inline void kmemtrace_mark_free(enum kmemtrace_type_id type_id, 32 const void *ptr,
54 unsigned long call_site, 33 size_t bytes_req,
55 const void *ptr) 34 size_t bytes_alloc,
56{ 35 gfp_t gfp_flags),
57} 36 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags));
58 37DECLARE_TRACE(kmalloc_node,
59#endif /* CONFIG_KMEMTRACE */ 38 TP_PROTO(unsigned long call_site,
60 39 const void *ptr,
61static inline void kmemtrace_mark_alloc(enum kmemtrace_type_id type_id, 40 size_t bytes_req,
62 unsigned long call_site, 41 size_t bytes_alloc,
63 const void *ptr, 42 gfp_t gfp_flags,
64 size_t bytes_req, 43 int node),
65 size_t bytes_alloc, 44 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node));
66 gfp_t gfp_flags) 45DECLARE_TRACE(kmem_cache_alloc_node,
67{ 46 TP_PROTO(unsigned long call_site,
68 kmemtrace_mark_alloc_node(type_id, call_site, ptr, 47 const void *ptr,
69 bytes_req, bytes_alloc, gfp_flags, -1); 48 size_t bytes_req,
70} 49 size_t bytes_alloc,
50 gfp_t gfp_flags,
51 int node),
52 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node));
53DECLARE_TRACE(kfree,
54 TP_PROTO(unsigned long call_site, const void *ptr),
55 TP_ARGS(call_site, ptr));
56DECLARE_TRACE(kmem_cache_free,
57 TP_PROTO(unsigned long call_site, const void *ptr),
58 TP_ARGS(call_site, ptr));
71 59
72#endif /* __KERNEL__ */ 60#endif /* __KERNEL__ */
73 61
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
new file mode 100644
index 000000000000..8cfe515cbc47
--- /dev/null
+++ b/include/trace/syscall.h
@@ -0,0 +1,35 @@
1#ifndef _TRACE_SYSCALL_H
2#define _TRACE_SYSCALL_H
3
4#include <asm/ptrace.h>
5
6/*
7 * A syscall entry in the ftrace syscalls array.
8 *
9 * @name: name of the syscall
10 * @nb_args: number of parameters it takes
11 * @types: list of types as strings
12 * @args: list of args as strings (args[i] matches types[i])
13 */
14struct syscall_metadata {
15 const char *name;
16 int nb_args;
17 const char **types;
18 const char **args;
19};
20
21#ifdef CONFIG_FTRACE_SYSCALLS
22extern void arch_init_ftrace_syscalls(void);
23extern struct syscall_metadata *syscall_nr_to_meta(int nr);
24extern void start_ftrace_syscalls(void);
25extern void stop_ftrace_syscalls(void);
26extern void ftrace_syscall_enter(struct pt_regs *regs);
27extern void ftrace_syscall_exit(struct pt_regs *regs);
28#else
29static inline void start_ftrace_syscalls(void) { }
30static inline void stop_ftrace_syscalls(void) { }
31static inline void ftrace_syscall_enter(struct pt_regs *regs) { }
32static inline void ftrace_syscall_exit(struct pt_regs *regs) { }
33#endif
34
35#endif /* _TRACE_SYSCALL_H */
diff --git a/include/video/cyblafb.h b/include/video/cyblafb.h
deleted file mode 100644
index d3c1d4e2c8e3..000000000000
--- a/include/video/cyblafb.h
+++ /dev/null
@@ -1,175 +0,0 @@
1
2#ifndef CYBLAFB_DEBUG
3#define CYBLAFB_DEBUG 0
4#endif
5
6#if CYBLAFB_DEBUG
7#define debug(f,a...) printk("%s:" f, __func__ , ## a);
8#else
9#define debug(f,a...)
10#endif
11
12#define output(f, a...) printk("cyblafb: " f, ## a)
13
14#define Kb (1024)
15#define Mb (Kb*Kb)
16
17/* PCI IDS of supported cards temporarily here */
18
19#define CYBERBLADEi1 0x8500
20
21/* these defines are for 'lcd' variable */
22#define LCD_STRETCH 0
23#define LCD_CENTER 1
24#define LCD_BIOS 2
25
26/* display types */
27#define DISPLAY_CRT 0
28#define DISPLAY_FP 1
29
30#define ROP_S 0xCC
31
32#define point(x,y) ((y)<<16|(x))
33
34//
35// Attribute Regs, ARxx, 3c0/3c1
36//
37#define AR00 0x00
38#define AR01 0x01
39#define AR02 0x02
40#define AR03 0x03
41#define AR04 0x04
42#define AR05 0x05
43#define AR06 0x06
44#define AR07 0x07
45#define AR08 0x08
46#define AR09 0x09
47#define AR0A 0x0A
48#define AR0B 0x0B
49#define AR0C 0x0C
50#define AR0D 0x0D
51#define AR0E 0x0E
52#define AR0F 0x0F
53#define AR10 0x10
54#define AR12 0x12
55#define AR13 0x13
56
57//
58// Sequencer Regs, SRxx, 3c4/3c5
59//
60#define SR00 0x00
61#define SR01 0x01
62#define SR02 0x02
63#define SR03 0x03
64#define SR04 0x04
65#define SR0D 0x0D
66#define SR0E 0x0E
67#define SR11 0x11
68#define SR18 0x18
69#define SR19 0x19
70
71//
72//
73//
74#define CR00 0x00
75#define CR01 0x01
76#define CR02 0x02
77#define CR03 0x03
78#define CR04 0x04
79#define CR05 0x05
80#define CR06 0x06
81#define CR07 0x07
82#define CR08 0x08
83#define CR09 0x09
84#define CR0A 0x0A
85#define CR0B 0x0B
86#define CR0C 0x0C
87#define CR0D 0x0D
88#define CR0E 0x0E
89#define CR0F 0x0F
90#define CR10 0x10
91#define CR11 0x11
92#define CR12 0x12
93#define CR13 0x13
94#define CR14 0x14
95#define CR15 0x15
96#define CR16 0x16
97#define CR17 0x17
98#define CR18 0x18
99#define CR19 0x19
100#define CR1A 0x1A
101#define CR1B 0x1B
102#define CR1C 0x1C
103#define CR1D 0x1D
104#define CR1E 0x1E
105#define CR1F 0x1F
106#define CR20 0x20
107#define CR21 0x21
108#define CR27 0x27
109#define CR29 0x29
110#define CR2A 0x2A
111#define CR2B 0x2B
112#define CR2D 0x2D
113#define CR2F 0x2F
114#define CR36 0x36
115#define CR38 0x38
116#define CR39 0x39
117#define CR3A 0x3A
118#define CR55 0x55
119#define CR56 0x56
120#define CR57 0x57
121#define CR58 0x58
122
123//
124//
125//
126
127#define GR00 0x01
128#define GR01 0x01
129#define GR02 0x02
130#define GR03 0x03
131#define GR04 0x04
132#define GR05 0x05
133#define GR06 0x06
134#define GR07 0x07
135#define GR08 0x08
136#define GR0F 0x0F
137#define GR20 0x20
138#define GR23 0x23
139#define GR2F 0x2F
140#define GR30 0x30
141#define GR31 0x31
142#define GR33 0x33
143#define GR52 0x52
144#define GR53 0x53
145#define GR5D 0x5d
146
147
148//
149// Graphics Engine
150//
151#define GEBase 0x2100 // could be mapped elsewhere if we like it
152#define GE00 (GEBase+0x00) // source 1, p 111
153#define GE04 (GEBase+0x04) // source 2, p 111
154#define GE08 (GEBase+0x08) // destination 1, p 111
155#define GE0C (GEBase+0x0C) // destination 2, p 112
156#define GE10 (GEBase+0x10) // right view base & enable, p 112
157#define GE13 (GEBase+0x13) // left view base & enable, p 112
158#define GE18 (GEBase+0x18) // block write start address, p 112
159#define GE1C (GEBase+0x1C) // block write end address, p 112
160#define GE20 (GEBase+0x20) // engine status, p 113
161#define GE24 (GEBase+0x24) // reset all GE pointers
162#define GE44 (GEBase+0x44) // command register, p 126
163#define GE48 (GEBase+0x48) // raster operation, p 127
164#define GE60 (GEBase+0x60) // foreground color, p 128
165#define GE64 (GEBase+0x64) // background color, p 128
166#define GE6C (GEBase+0x6C) // Pattern and Style, p 129, ok
167#define GE9C (GEBase+0x9C) // pixel engine data port, p 125
168#define GEB8 (GEBase+0xB8) // Destination Stride / Buffer Base 0, p 133
169#define GEBC (GEBase+0xBC) // Destination Stride / Buffer Base 1, p 133
170#define GEC0 (GEBase+0xC0) // Destination Stride / Buffer Base 2, p 133
171#define GEC4 (GEBase+0xC4) // Destination Stride / Buffer Base 3, p 133
172#define GEC8 (GEBase+0xC8) // Source Stride / Buffer Base 0, p 133
173#define GECC (GEBase+0xCC) // Source Stride / Buffer Base 1, p 133
174#define GED0 (GEBase+0xD0) // Source Stride / Buffer Base 2, p 133
175#define GED4 (GEBase+0xD4) // Source Stride / Buffer Base 3, p 133
diff --git a/include/video/tdfx.h b/include/video/tdfx.h
index 7431d9681e57..befbaf0a92d8 100644
--- a/include/video/tdfx.h
+++ b/include/video/tdfx.h
@@ -1,6 +1,9 @@
1#ifndef _TDFX_H 1#ifndef _TDFX_H
2#define _TDFX_H 2#define _TDFX_H
3 3
4#include <linux/i2c.h>
5#include <linux/i2c-algo-bit.h>
6
4/* membase0 register offsets */ 7/* membase0 register offsets */
5#define STATUS 0x00 8#define STATUS 0x00
6#define PCIINIT0 0x04 9#define PCIINIT0 0x04
@@ -123,6 +126,18 @@
123#define VIDCFG_PIXFMT_SHIFT 18 126#define VIDCFG_PIXFMT_SHIFT 18
124#define DACMODE_2X BIT(0) 127#define DACMODE_2X BIT(0)
125 128
129/* I2C bit locations in the VIDSERPARPORT register */
130#define DDC_ENAB 0x00040000
131#define DDC_SCL_OUT 0x00080000
132#define DDC_SDA_OUT 0x00100000
133#define DDC_SCL_IN 0x00200000
134#define DDC_SDA_IN 0x00400000
135#define I2C_ENAB 0x00800000
136#define I2C_SCL_OUT 0x01000000
137#define I2C_SDA_OUT 0x02000000
138#define I2C_SCL_IN 0x04000000
139#define I2C_SDA_IN 0x08000000
140
126/* VGA rubbish, need to change this for multihead support */ 141/* VGA rubbish, need to change this for multihead support */
127#define MISC_W 0x3c2 142#define MISC_W 0x3c2
128#define MISC_R 0x3cc 143#define MISC_R 0x3cc
@@ -168,12 +183,23 @@ struct banshee_reg {
168 unsigned long miscinit0; 183 unsigned long miscinit0;
169}; 184};
170 185
186struct tdfx_par;
187
188struct tdfxfb_i2c_chan {
189 struct tdfx_par *par;
190 struct i2c_adapter adapter;
191 struct i2c_algo_bit_data algo;
192};
193
171struct tdfx_par { 194struct tdfx_par {
172 u32 max_pixclock; 195 u32 max_pixclock;
173 u32 palette[16]; 196 u32 palette[16];
174 void __iomem *regbase_virt; 197 void __iomem *regbase_virt;
175 unsigned long iobase; 198 unsigned long iobase;
176 int mtrr_handle; 199 int mtrr_handle;
200#ifdef CONFIG_FB_3DFX_I2C
201 struct tdfxfb_i2c_chan chan[2];
202#endif
177}; 203};
178 204
179#endif /* __KERNEL__ */ 205#endif /* __KERNEL__ */